UNPKG

247 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom')) :
3 typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactBootstrapTypeahead = {}, global.React, global.ReactDOM));
5})(this, (function (exports, React, ReactDOM) { 'use strict';
6
7 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
9 function _interopNamespace(e) {
10 if (e && e.__esModule) return e;
11 var n = Object.create(null);
12 if (e) {
13 Object.keys(e).forEach(function (k) {
14 if (k !== 'default') {
15 var d = Object.getOwnPropertyDescriptor(e, k);
16 Object.defineProperty(n, k, d.get ? d : {
17 enumerable: true,
18 get: function () { return e[k]; }
19 });
20 }
21 });
22 }
23 n["default"] = e;
24 return Object.freeze(n);
25 }
26
27 var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
28 var React__namespace = /*#__PURE__*/_interopNamespace(React);
29 var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
30 var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
31
32 function _iterableToArrayLimit(r, l) {
33 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
34 if (null != t) {
35 var e,
36 n,
37 i,
38 u,
39 a = [],
40 f = !0,
41 o = !1;
42 try {
43 if (i = (t = t.call(r)).next, 0 === l) {
44 if (Object(t) !== t) return;
45 f = !1;
46 } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
47 } catch (r) {
48 o = !0, n = r;
49 } finally {
50 try {
51 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
52 } finally {
53 if (o) throw n;
54 }
55 }
56 return a;
57 }
58 }
59 function ownKeys(e, r) {
60 var t = Object.keys(e);
61 if (Object.getOwnPropertySymbols) {
62 var o = Object.getOwnPropertySymbols(e);
63 r && (o = o.filter(function (r) {
64 return Object.getOwnPropertyDescriptor(e, r).enumerable;
65 })), t.push.apply(t, o);
66 }
67 return t;
68 }
69 function _objectSpread2(e) {
70 for (var r = 1; r < arguments.length; r++) {
71 var t = null != arguments[r] ? arguments[r] : {};
72 r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
73 _defineProperty(e, r, t[r]);
74 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
75 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
76 });
77 }
78 return e;
79 }
80 function _classCallCheck(instance, Constructor) {
81 if (!(instance instanceof Constructor)) {
82 throw new TypeError("Cannot call a class as a function");
83 }
84 }
85 function _defineProperties(target, props) {
86 for (var i = 0; i < props.length; i++) {
87 var descriptor = props[i];
88 descriptor.enumerable = descriptor.enumerable || false;
89 descriptor.configurable = true;
90 if ("value" in descriptor) descriptor.writable = true;
91 Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
92 }
93 }
94 function _createClass(Constructor, protoProps, staticProps) {
95 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
96 if (staticProps) _defineProperties(Constructor, staticProps);
97 Object.defineProperty(Constructor, "prototype", {
98 writable: false
99 });
100 return Constructor;
101 }
102 function _defineProperty(obj, key, value) {
103 key = _toPropertyKey(key);
104 if (key in obj) {
105 Object.defineProperty(obj, key, {
106 value: value,
107 enumerable: true,
108 configurable: true,
109 writable: true
110 });
111 } else {
112 obj[key] = value;
113 }
114 return obj;
115 }
116 function _extends() {
117 _extends = Object.assign ? Object.assign.bind() : function (target) {
118 for (var i = 1; i < arguments.length; i++) {
119 var source = arguments[i];
120 for (var key in source) {
121 if (Object.prototype.hasOwnProperty.call(source, key)) {
122 target[key] = source[key];
123 }
124 }
125 }
126 return target;
127 };
128 return _extends.apply(this, arguments);
129 }
130 function _inherits(subClass, superClass) {
131 if (typeof superClass !== "function" && superClass !== null) {
132 throw new TypeError("Super expression must either be null or a function");
133 }
134 subClass.prototype = Object.create(superClass && superClass.prototype, {
135 constructor: {
136 value: subClass,
137 writable: true,
138 configurable: true
139 }
140 });
141 Object.defineProperty(subClass, "prototype", {
142 writable: false
143 });
144 if (superClass) _setPrototypeOf(subClass, superClass);
145 }
146 function _getPrototypeOf(o) {
147 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
148 return o.__proto__ || Object.getPrototypeOf(o);
149 };
150 return _getPrototypeOf(o);
151 }
152 function _setPrototypeOf(o, p) {
153 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
154 o.__proto__ = p;
155 return o;
156 };
157 return _setPrototypeOf(o, p);
158 }
159 function _isNativeReflectConstruct() {
160 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
161 if (Reflect.construct.sham) return false;
162 if (typeof Proxy === "function") return true;
163 try {
164 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
165 return true;
166 } catch (e) {
167 return false;
168 }
169 }
170 function _objectWithoutPropertiesLoose(source, excluded) {
171 if (source == null) return {};
172 var target = {};
173 var sourceKeys = Object.keys(source);
174 var key, i;
175 for (i = 0; i < sourceKeys.length; i++) {
176 key = sourceKeys[i];
177 if (excluded.indexOf(key) >= 0) continue;
178 target[key] = source[key];
179 }
180 return target;
181 }
182 function _objectWithoutProperties(source, excluded) {
183 if (source == null) return {};
184 var target = _objectWithoutPropertiesLoose(source, excluded);
185 var key, i;
186 if (Object.getOwnPropertySymbols) {
187 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
188 for (i = 0; i < sourceSymbolKeys.length; i++) {
189 key = sourceSymbolKeys[i];
190 if (excluded.indexOf(key) >= 0) continue;
191 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
192 target[key] = source[key];
193 }
194 }
195 return target;
196 }
197 function _assertThisInitialized(self) {
198 if (self === void 0) {
199 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
200 }
201 return self;
202 }
203 function _possibleConstructorReturn(self, call) {
204 if (call && (typeof call === "object" || typeof call === "function")) {
205 return call;
206 } else if (call !== void 0) {
207 throw new TypeError("Derived constructors may only return object or undefined");
208 }
209 return _assertThisInitialized(self);
210 }
211 function _createSuper(Derived) {
212 var hasNativeReflectConstruct = _isNativeReflectConstruct();
213 return function _createSuperInternal() {
214 var Super = _getPrototypeOf(Derived),
215 result;
216 if (hasNativeReflectConstruct) {
217 var NewTarget = _getPrototypeOf(this).constructor;
218 result = Reflect.construct(Super, arguments, NewTarget);
219 } else {
220 result = Super.apply(this, arguments);
221 }
222 return _possibleConstructorReturn(this, result);
223 };
224 }
225 function _slicedToArray(arr, i) {
226 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
227 }
228 function _arrayWithHoles(arr) {
229 if (Array.isArray(arr)) return arr;
230 }
231 function _unsupportedIterableToArray(o, minLen) {
232 if (!o) return;
233 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
234 var n = Object.prototype.toString.call(o).slice(8, -1);
235 if (n === "Object" && o.constructor) n = o.constructor.name;
236 if (n === "Map" || n === "Set") return Array.from(o);
237 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
238 }
239 function _arrayLikeToArray(arr, len) {
240 if (len == null || len > arr.length) len = arr.length;
241 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
242 return arr2;
243 }
244 function _nonIterableRest() {
245 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
246 }
247 function _toPrimitive(input, hint) {
248 if (typeof input !== "object" || input === null) return input;
249 var prim = input[Symbol.toPrimitive];
250 if (prim !== undefined) {
251 var res = prim.call(input, hint || "default");
252 if (typeof res !== "object") return res;
253 throw new TypeError("@@toPrimitive must return a primitive value.");
254 }
255 return (hint === "string" ? String : Number)(input);
256 }
257 function _toPropertyKey(arg) {
258 var key = _toPrimitive(arg, "string");
259 return typeof key === "symbol" ? key : String(key);
260 }
261
262 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
263
264 /**
265 * lodash (Custom Build) <https://lodash.com/>
266 * Build: `lodash modularize exports="npm" -o ./`
267 * Copyright jQuery Foundation and other contributors <https://jquery.org/>
268 * Released under MIT license <https://lodash.com/license>
269 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
270 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
271 */
272
273 /** Used as the `TypeError` message for "Functions" methods. */
274 var FUNC_ERROR_TEXT = 'Expected a function';
275
276 /** Used as references for various `Number` constants. */
277 var NAN = 0 / 0;
278
279 /** `Object#toString` result references. */
280 var symbolTag = '[object Symbol]';
281
282 /** Used to match leading and trailing whitespace. */
283 var reTrim = /^\s+|\s+$/g;
284
285 /** Used to detect bad signed hexadecimal string values. */
286 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
287
288 /** Used to detect binary string values. */
289 var reIsBinary = /^0b[01]+$/i;
290
291 /** Used to detect octal string values. */
292 var reIsOctal = /^0o[0-7]+$/i;
293
294 /** Built-in method references without a dependency on `root`. */
295 var freeParseInt = parseInt;
296
297 /** Detect free variable `global` from Node.js. */
298 var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
299
300 /** Detect free variable `self`. */
301 var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
302
303 /** Used as a reference to the global object. */
304 var root = freeGlobal || freeSelf || Function('return this')();
305
306 /** Used for built-in method references. */
307 var objectProto = Object.prototype;
308
309 /**
310 * Used to resolve the
311 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
312 * of values.
313 */
314 var objectToString = objectProto.toString;
315
316 /* Built-in method references for those with the same name as other `lodash` methods. */
317 var nativeMax = Math.max,
318 nativeMin = Math.min;
319
320 /**
321 * Gets the timestamp of the number of milliseconds that have elapsed since
322 * the Unix epoch (1 January 1970 00:00:00 UTC).
323 *
324 * @static
325 * @memberOf _
326 * @since 2.4.0
327 * @category Date
328 * @returns {number} Returns the timestamp.
329 * @example
330 *
331 * _.defer(function(stamp) {
332 * console.log(_.now() - stamp);
333 * }, _.now());
334 * // => Logs the number of milliseconds it took for the deferred invocation.
335 */
336 var now = function() {
337 return root.Date.now();
338 };
339
340 /**
341 * Creates a debounced function that delays invoking `func` until after `wait`
342 * milliseconds have elapsed since the last time the debounced function was
343 * invoked. The debounced function comes with a `cancel` method to cancel
344 * delayed `func` invocations and a `flush` method to immediately invoke them.
345 * Provide `options` to indicate whether `func` should be invoked on the
346 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
347 * with the last arguments provided to the debounced function. Subsequent
348 * calls to the debounced function return the result of the last `func`
349 * invocation.
350 *
351 * **Note:** If `leading` and `trailing` options are `true`, `func` is
352 * invoked on the trailing edge of the timeout only if the debounced function
353 * is invoked more than once during the `wait` timeout.
354 *
355 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
356 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
357 *
358 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
359 * for details over the differences between `_.debounce` and `_.throttle`.
360 *
361 * @static
362 * @memberOf _
363 * @since 0.1.0
364 * @category Function
365 * @param {Function} func The function to debounce.
366 * @param {number} [wait=0] The number of milliseconds to delay.
367 * @param {Object} [options={}] The options object.
368 * @param {boolean} [options.leading=false]
369 * Specify invoking on the leading edge of the timeout.
370 * @param {number} [options.maxWait]
371 * The maximum time `func` is allowed to be delayed before it's invoked.
372 * @param {boolean} [options.trailing=true]
373 * Specify invoking on the trailing edge of the timeout.
374 * @returns {Function} Returns the new debounced function.
375 * @example
376 *
377 * // Avoid costly calculations while the window size is in flux.
378 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
379 *
380 * // Invoke `sendMail` when clicked, debouncing subsequent calls.
381 * jQuery(element).on('click', _.debounce(sendMail, 300, {
382 * 'leading': true,
383 * 'trailing': false
384 * }));
385 *
386 * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
387 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
388 * var source = new EventSource('/stream');
389 * jQuery(source).on('message', debounced);
390 *
391 * // Cancel the trailing debounced invocation.
392 * jQuery(window).on('popstate', debounced.cancel);
393 */
394 function debounce$1(func, wait, options) {
395 var lastArgs,
396 lastThis,
397 maxWait,
398 result,
399 timerId,
400 lastCallTime,
401 lastInvokeTime = 0,
402 leading = false,
403 maxing = false,
404 trailing = true;
405
406 if (typeof func != 'function') {
407 throw new TypeError(FUNC_ERROR_TEXT);
408 }
409 wait = toNumber(wait) || 0;
410 if (isObject(options)) {
411 leading = !!options.leading;
412 maxing = 'maxWait' in options;
413 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
414 trailing = 'trailing' in options ? !!options.trailing : trailing;
415 }
416
417 function invokeFunc(time) {
418 var args = lastArgs,
419 thisArg = lastThis;
420
421 lastArgs = lastThis = undefined;
422 lastInvokeTime = time;
423 result = func.apply(thisArg, args);
424 return result;
425 }
426
427 function leadingEdge(time) {
428 // Reset any `maxWait` timer.
429 lastInvokeTime = time;
430 // Start the timer for the trailing edge.
431 timerId = setTimeout(timerExpired, wait);
432 // Invoke the leading edge.
433 return leading ? invokeFunc(time) : result;
434 }
435
436 function remainingWait(time) {
437 var timeSinceLastCall = time - lastCallTime,
438 timeSinceLastInvoke = time - lastInvokeTime,
439 result = wait - timeSinceLastCall;
440
441 return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
442 }
443
444 function shouldInvoke(time) {
445 var timeSinceLastCall = time - lastCallTime,
446 timeSinceLastInvoke = time - lastInvokeTime;
447
448 // Either this is the first call, activity has stopped and we're at the
449 // trailing edge, the system time has gone backwards and we're treating
450 // it as the trailing edge, or we've hit the `maxWait` limit.
451 return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
452 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
453 }
454
455 function timerExpired() {
456 var time = now();
457 if (shouldInvoke(time)) {
458 return trailingEdge(time);
459 }
460 // Restart the timer.
461 timerId = setTimeout(timerExpired, remainingWait(time));
462 }
463
464 function trailingEdge(time) {
465 timerId = undefined;
466
467 // Only invoke if we have `lastArgs` which means `func` has been
468 // debounced at least once.
469 if (trailing && lastArgs) {
470 return invokeFunc(time);
471 }
472 lastArgs = lastThis = undefined;
473 return result;
474 }
475
476 function cancel() {
477 if (timerId !== undefined) {
478 clearTimeout(timerId);
479 }
480 lastInvokeTime = 0;
481 lastArgs = lastCallTime = lastThis = timerId = undefined;
482 }
483
484 function flush() {
485 return timerId === undefined ? result : trailingEdge(now());
486 }
487
488 function debounced() {
489 var time = now(),
490 isInvoking = shouldInvoke(time);
491
492 lastArgs = arguments;
493 lastThis = this;
494 lastCallTime = time;
495
496 if (isInvoking) {
497 if (timerId === undefined) {
498 return leadingEdge(lastCallTime);
499 }
500 if (maxing) {
501 // Handle invocations in a tight loop.
502 timerId = setTimeout(timerExpired, wait);
503 return invokeFunc(lastCallTime);
504 }
505 }
506 if (timerId === undefined) {
507 timerId = setTimeout(timerExpired, wait);
508 }
509 return result;
510 }
511 debounced.cancel = cancel;
512 debounced.flush = flush;
513 return debounced;
514 }
515
516 /**
517 * Checks if `value` is the
518 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
519 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
520 *
521 * @static
522 * @memberOf _
523 * @since 0.1.0
524 * @category Lang
525 * @param {*} value The value to check.
526 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
527 * @example
528 *
529 * _.isObject({});
530 * // => true
531 *
532 * _.isObject([1, 2, 3]);
533 * // => true
534 *
535 * _.isObject(_.noop);
536 * // => true
537 *
538 * _.isObject(null);
539 * // => false
540 */
541 function isObject(value) {
542 var type = typeof value;
543 return !!value && (type == 'object' || type == 'function');
544 }
545
546 /**
547 * Checks if `value` is object-like. A value is object-like if it's not `null`
548 * and has a `typeof` result of "object".
549 *
550 * @static
551 * @memberOf _
552 * @since 4.0.0
553 * @category Lang
554 * @param {*} value The value to check.
555 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
556 * @example
557 *
558 * _.isObjectLike({});
559 * // => true
560 *
561 * _.isObjectLike([1, 2, 3]);
562 * // => true
563 *
564 * _.isObjectLike(_.noop);
565 * // => false
566 *
567 * _.isObjectLike(null);
568 * // => false
569 */
570 function isObjectLike(value) {
571 return !!value && typeof value == 'object';
572 }
573
574 /**
575 * Checks if `value` is classified as a `Symbol` primitive or object.
576 *
577 * @static
578 * @memberOf _
579 * @since 4.0.0
580 * @category Lang
581 * @param {*} value The value to check.
582 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
583 * @example
584 *
585 * _.isSymbol(Symbol.iterator);
586 * // => true
587 *
588 * _.isSymbol('abc');
589 * // => false
590 */
591 function isSymbol(value) {
592 return typeof value == 'symbol' ||
593 (isObjectLike(value) && objectToString.call(value) == symbolTag);
594 }
595
596 /**
597 * Converts `value` to a number.
598 *
599 * @static
600 * @memberOf _
601 * @since 4.0.0
602 * @category Lang
603 * @param {*} value The value to process.
604 * @returns {number} Returns the number.
605 * @example
606 *
607 * _.toNumber(3.2);
608 * // => 3.2
609 *
610 * _.toNumber(Number.MIN_VALUE);
611 * // => 5e-324
612 *
613 * _.toNumber(Infinity);
614 * // => Infinity
615 *
616 * _.toNumber('3.2');
617 * // => 3.2
618 */
619 function toNumber(value) {
620 if (typeof value == 'number') {
621 return value;
622 }
623 if (isSymbol(value)) {
624 return NAN;
625 }
626 if (isObject(value)) {
627 var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
628 value = isObject(other) ? (other + '') : other;
629 }
630 if (typeof value != 'string') {
631 return value === 0 ? value : +value;
632 }
633 value = value.replace(reTrim, '');
634 var isBinary = reIsBinary.test(value);
635 return (isBinary || reIsOctal.test(value))
636 ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
637 : (reIsBadHex.test(value) ? NAN : +value);
638 }
639
640 var lodash_debounce = debounce$1;
641
642 var propTypes$b = {exports: {}};
643
644 var reactIs = {exports: {}};
645
646 var reactIs_development = {};
647
648 /** @license React v16.13.1
649 * react-is.development.js
650 *
651 * Copyright (c) Facebook, Inc. and its affiliates.
652 *
653 * This source code is licensed under the MIT license found in the
654 * LICENSE file in the root directory of this source tree.
655 */
656
657 var hasRequiredReactIs_development;
658
659 function requireReactIs_development () {
660 if (hasRequiredReactIs_development) return reactIs_development;
661 hasRequiredReactIs_development = 1;
662
663
664
665 {
666 (function() {
667
668 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
669 // nor polyfill, then a plain number is used for performance.
670 var hasSymbol = typeof Symbol === 'function' && Symbol.for;
671 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
672 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
673 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
674 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
675 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
676 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
677 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
678 // (unstable) APIs that have been removed. Can we remove the symbols?
679
680 var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
681 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
682 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
683 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
684 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
685 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
686 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
687 var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
688 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
689 var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
690 var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
691
692 function isValidElementType(type) {
693 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
694 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
695 }
696
697 function typeOf(object) {
698 if (typeof object === 'object' && object !== null) {
699 var $$typeof = object.$$typeof;
700
701 switch ($$typeof) {
702 case REACT_ELEMENT_TYPE:
703 var type = object.type;
704
705 switch (type) {
706 case REACT_ASYNC_MODE_TYPE:
707 case REACT_CONCURRENT_MODE_TYPE:
708 case REACT_FRAGMENT_TYPE:
709 case REACT_PROFILER_TYPE:
710 case REACT_STRICT_MODE_TYPE:
711 case REACT_SUSPENSE_TYPE:
712 return type;
713
714 default:
715 var $$typeofType = type && type.$$typeof;
716
717 switch ($$typeofType) {
718 case REACT_CONTEXT_TYPE:
719 case REACT_FORWARD_REF_TYPE:
720 case REACT_LAZY_TYPE:
721 case REACT_MEMO_TYPE:
722 case REACT_PROVIDER_TYPE:
723 return $$typeofType;
724
725 default:
726 return $$typeof;
727 }
728
729 }
730
731 case REACT_PORTAL_TYPE:
732 return $$typeof;
733 }
734 }
735
736 return undefined;
737 } // AsyncMode is deprecated along with isAsyncMode
738
739 var AsyncMode = REACT_ASYNC_MODE_TYPE;
740 var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
741 var ContextConsumer = REACT_CONTEXT_TYPE;
742 var ContextProvider = REACT_PROVIDER_TYPE;
743 var Element = REACT_ELEMENT_TYPE;
744 var ForwardRef = REACT_FORWARD_REF_TYPE;
745 var Fragment = REACT_FRAGMENT_TYPE;
746 var Lazy = REACT_LAZY_TYPE;
747 var Memo = REACT_MEMO_TYPE;
748 var Portal = REACT_PORTAL_TYPE;
749 var Profiler = REACT_PROFILER_TYPE;
750 var StrictMode = REACT_STRICT_MODE_TYPE;
751 var Suspense = REACT_SUSPENSE_TYPE;
752 var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
753
754 function isAsyncMode(object) {
755 {
756 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
757 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
758
759 console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
760 }
761 }
762
763 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
764 }
765 function isConcurrentMode(object) {
766 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
767 }
768 function isContextConsumer(object) {
769 return typeOf(object) === REACT_CONTEXT_TYPE;
770 }
771 function isContextProvider(object) {
772 return typeOf(object) === REACT_PROVIDER_TYPE;
773 }
774 function isElement(object) {
775 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
776 }
777 function isForwardRef(object) {
778 return typeOf(object) === REACT_FORWARD_REF_TYPE;
779 }
780 function isFragment(object) {
781 return typeOf(object) === REACT_FRAGMENT_TYPE;
782 }
783 function isLazy(object) {
784 return typeOf(object) === REACT_LAZY_TYPE;
785 }
786 function isMemo(object) {
787 return typeOf(object) === REACT_MEMO_TYPE;
788 }
789 function isPortal(object) {
790 return typeOf(object) === REACT_PORTAL_TYPE;
791 }
792 function isProfiler(object) {
793 return typeOf(object) === REACT_PROFILER_TYPE;
794 }
795 function isStrictMode(object) {
796 return typeOf(object) === REACT_STRICT_MODE_TYPE;
797 }
798 function isSuspense(object) {
799 return typeOf(object) === REACT_SUSPENSE_TYPE;
800 }
801
802 reactIs_development.AsyncMode = AsyncMode;
803 reactIs_development.ConcurrentMode = ConcurrentMode;
804 reactIs_development.ContextConsumer = ContextConsumer;
805 reactIs_development.ContextProvider = ContextProvider;
806 reactIs_development.Element = Element;
807 reactIs_development.ForwardRef = ForwardRef;
808 reactIs_development.Fragment = Fragment;
809 reactIs_development.Lazy = Lazy;
810 reactIs_development.Memo = Memo;
811 reactIs_development.Portal = Portal;
812 reactIs_development.Profiler = Profiler;
813 reactIs_development.StrictMode = StrictMode;
814 reactIs_development.Suspense = Suspense;
815 reactIs_development.isAsyncMode = isAsyncMode;
816 reactIs_development.isConcurrentMode = isConcurrentMode;
817 reactIs_development.isContextConsumer = isContextConsumer;
818 reactIs_development.isContextProvider = isContextProvider;
819 reactIs_development.isElement = isElement;
820 reactIs_development.isForwardRef = isForwardRef;
821 reactIs_development.isFragment = isFragment;
822 reactIs_development.isLazy = isLazy;
823 reactIs_development.isMemo = isMemo;
824 reactIs_development.isPortal = isPortal;
825 reactIs_development.isProfiler = isProfiler;
826 reactIs_development.isStrictMode = isStrictMode;
827 reactIs_development.isSuspense = isSuspense;
828 reactIs_development.isValidElementType = isValidElementType;
829 reactIs_development.typeOf = typeOf;
830 })();
831 }
832 return reactIs_development;
833 }
834
835 var hasRequiredReactIs;
836
837 function requireReactIs () {
838 if (hasRequiredReactIs) return reactIs.exports;
839 hasRequiredReactIs = 1;
840 (function (module) {
841
842 {
843 module.exports = requireReactIs_development();
844 }
845 } (reactIs));
846 return reactIs.exports;
847 }
848
849 /*
850 object-assign
851 (c) Sindre Sorhus
852 @license MIT
853 */
854
855 var objectAssign;
856 var hasRequiredObjectAssign;
857
858 function requireObjectAssign () {
859 if (hasRequiredObjectAssign) return objectAssign;
860 hasRequiredObjectAssign = 1;
861 /* eslint-disable no-unused-vars */
862 var getOwnPropertySymbols = Object.getOwnPropertySymbols;
863 var hasOwnProperty = Object.prototype.hasOwnProperty;
864 var propIsEnumerable = Object.prototype.propertyIsEnumerable;
865
866 function toObject(val) {
867 if (val === null || val === undefined) {
868 throw new TypeError('Object.assign cannot be called with null or undefined');
869 }
870
871 return Object(val);
872 }
873
874 function shouldUseNative() {
875 try {
876 if (!Object.assign) {
877 return false;
878 }
879
880 // Detect buggy property enumeration order in older V8 versions.
881
882 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
883 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
884 test1[5] = 'de';
885 if (Object.getOwnPropertyNames(test1)[0] === '5') {
886 return false;
887 }
888
889 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
890 var test2 = {};
891 for (var i = 0; i < 10; i++) {
892 test2['_' + String.fromCharCode(i)] = i;
893 }
894 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
895 return test2[n];
896 });
897 if (order2.join('') !== '0123456789') {
898 return false;
899 }
900
901 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
902 var test3 = {};
903 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
904 test3[letter] = letter;
905 });
906 if (Object.keys(Object.assign({}, test3)).join('') !==
907 'abcdefghijklmnopqrst') {
908 return false;
909 }
910
911 return true;
912 } catch (err) {
913 // We don't expect any of the above to throw, but better to be safe.
914 return false;
915 }
916 }
917
918 objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
919 var from;
920 var to = toObject(target);
921 var symbols;
922
923 for (var s = 1; s < arguments.length; s++) {
924 from = Object(arguments[s]);
925
926 for (var key in from) {
927 if (hasOwnProperty.call(from, key)) {
928 to[key] = from[key];
929 }
930 }
931
932 if (getOwnPropertySymbols) {
933 symbols = getOwnPropertySymbols(from);
934 for (var i = 0; i < symbols.length; i++) {
935 if (propIsEnumerable.call(from, symbols[i])) {
936 to[symbols[i]] = from[symbols[i]];
937 }
938 }
939 }
940 }
941
942 return to;
943 };
944 return objectAssign;
945 }
946
947 /**
948 * Copyright (c) 2013-present, Facebook, Inc.
949 *
950 * This source code is licensed under the MIT license found in the
951 * LICENSE file in the root directory of this source tree.
952 */
953
954 var ReactPropTypesSecret_1;
955 var hasRequiredReactPropTypesSecret;
956
957 function requireReactPropTypesSecret () {
958 if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
959 hasRequiredReactPropTypesSecret = 1;
960
961 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
962
963 ReactPropTypesSecret_1 = ReactPropTypesSecret;
964 return ReactPropTypesSecret_1;
965 }
966
967 var has;
968 var hasRequiredHas;
969
970 function requireHas () {
971 if (hasRequiredHas) return has;
972 hasRequiredHas = 1;
973 has = Function.call.bind(Object.prototype.hasOwnProperty);
974 return has;
975 }
976
977 /**
978 * Copyright (c) 2013-present, Facebook, Inc.
979 *
980 * This source code is licensed under the MIT license found in the
981 * LICENSE file in the root directory of this source tree.
982 */
983
984 var checkPropTypes_1;
985 var hasRequiredCheckPropTypes;
986
987 function requireCheckPropTypes () {
988 if (hasRequiredCheckPropTypes) return checkPropTypes_1;
989 hasRequiredCheckPropTypes = 1;
990
991 var printWarning = function() {};
992
993 {
994 var ReactPropTypesSecret = requireReactPropTypesSecret();
995 var loggedTypeFailures = {};
996 var has = requireHas();
997
998 printWarning = function(text) {
999 var message = 'Warning: ' + text;
1000 if (typeof console !== 'undefined') {
1001 console.error(message);
1002 }
1003 try {
1004 // --- Welcome to debugging React ---
1005 // This error was thrown as a convenience so that you can use this stack
1006 // to find the callsite that caused this warning to fire.
1007 throw new Error(message);
1008 } catch (x) { /**/ }
1009 };
1010 }
1011
1012 /**
1013 * Assert that the values match with the type specs.
1014 * Error messages are memorized and will only be shown once.
1015 *
1016 * @param {object} typeSpecs Map of name to a ReactPropType
1017 * @param {object} values Runtime values that need to be type-checked
1018 * @param {string} location e.g. "prop", "context", "child context"
1019 * @param {string} componentName Name of the component for error messages.
1020 * @param {?Function} getStack Returns the component stack.
1021 * @private
1022 */
1023 function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
1024 {
1025 for (var typeSpecName in typeSpecs) {
1026 if (has(typeSpecs, typeSpecName)) {
1027 var error;
1028 // Prop type validation may throw. In case they do, we don't want to
1029 // fail the render phase where it didn't fail before. So we log it.
1030 // After these have been cleaned up, we'll let them throw.
1031 try {
1032 // This is intentionally an invariant that gets caught. It's the same
1033 // behavior as without this statement except with a better message.
1034 if (typeof typeSpecs[typeSpecName] !== 'function') {
1035 var err = Error(
1036 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
1037 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
1038 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
1039 );
1040 err.name = 'Invariant Violation';
1041 throw err;
1042 }
1043 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
1044 } catch (ex) {
1045 error = ex;
1046 }
1047 if (error && !(error instanceof Error)) {
1048 printWarning(
1049 (componentName || 'React class') + ': type specification of ' +
1050 location + ' `' + typeSpecName + '` is invalid; the type checker ' +
1051 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
1052 'You may have forgotten to pass an argument to the type checker ' +
1053 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
1054 'shape all require an argument).'
1055 );
1056 }
1057 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
1058 // Only monitor this failure once because there tends to be a lot of the
1059 // same error.
1060 loggedTypeFailures[error.message] = true;
1061
1062 var stack = getStack ? getStack() : '';
1063
1064 printWarning(
1065 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
1066 );
1067 }
1068 }
1069 }
1070 }
1071 }
1072
1073 /**
1074 * Resets warning cache when testing.
1075 *
1076 * @private
1077 */
1078 checkPropTypes.resetWarningCache = function() {
1079 {
1080 loggedTypeFailures = {};
1081 }
1082 };
1083
1084 checkPropTypes_1 = checkPropTypes;
1085 return checkPropTypes_1;
1086 }
1087
1088 /**
1089 * Copyright (c) 2013-present, Facebook, Inc.
1090 *
1091 * This source code is licensed under the MIT license found in the
1092 * LICENSE file in the root directory of this source tree.
1093 */
1094
1095 var factoryWithTypeCheckers;
1096 var hasRequiredFactoryWithTypeCheckers;
1097
1098 function requireFactoryWithTypeCheckers () {
1099 if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
1100 hasRequiredFactoryWithTypeCheckers = 1;
1101
1102 var ReactIs = requireReactIs();
1103 var assign = requireObjectAssign();
1104
1105 var ReactPropTypesSecret = requireReactPropTypesSecret();
1106 var has = requireHas();
1107 var checkPropTypes = requireCheckPropTypes();
1108
1109 var printWarning = function() {};
1110
1111 {
1112 printWarning = function(text) {
1113 var message = 'Warning: ' + text;
1114 if (typeof console !== 'undefined') {
1115 console.error(message);
1116 }
1117 try {
1118 // --- Welcome to debugging React ---
1119 // This error was thrown as a convenience so that you can use this stack
1120 // to find the callsite that caused this warning to fire.
1121 throw new Error(message);
1122 } catch (x) {}
1123 };
1124 }
1125
1126 function emptyFunctionThatReturnsNull() {
1127 return null;
1128 }
1129
1130 factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
1131 /* global Symbol */
1132 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
1133 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
1134
1135 /**
1136 * Returns the iterator method function contained on the iterable object.
1137 *
1138 * Be sure to invoke the function with the iterable as context:
1139 *
1140 * var iteratorFn = getIteratorFn(myIterable);
1141 * if (iteratorFn) {
1142 * var iterator = iteratorFn.call(myIterable);
1143 * ...
1144 * }
1145 *
1146 * @param {?object} maybeIterable
1147 * @return {?function}
1148 */
1149 function getIteratorFn(maybeIterable) {
1150 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
1151 if (typeof iteratorFn === 'function') {
1152 return iteratorFn;
1153 }
1154 }
1155
1156 /**
1157 * Collection of methods that allow declaration and validation of props that are
1158 * supplied to React components. Example usage:
1159 *
1160 * var Props = require('ReactPropTypes');
1161 * var MyArticle = React.createClass({
1162 * propTypes: {
1163 * // An optional string prop named "description".
1164 * description: Props.string,
1165 *
1166 * // A required enum prop named "category".
1167 * category: Props.oneOf(['News','Photos']).isRequired,
1168 *
1169 * // A prop named "dialog" that requires an instance of Dialog.
1170 * dialog: Props.instanceOf(Dialog).isRequired
1171 * },
1172 * render: function() { ... }
1173 * });
1174 *
1175 * A more formal specification of how these methods are used:
1176 *
1177 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
1178 * decl := ReactPropTypes.{type}(.isRequired)?
1179 *
1180 * Each and every declaration produces a function with the same signature. This
1181 * allows the creation of custom validation functions. For example:
1182 *
1183 * var MyLink = React.createClass({
1184 * propTypes: {
1185 * // An optional string or URI prop named "href".
1186 * href: function(props, propName, componentName) {
1187 * var propValue = props[propName];
1188 * if (propValue != null && typeof propValue !== 'string' &&
1189 * !(propValue instanceof URI)) {
1190 * return new Error(
1191 * 'Expected a string or an URI for ' + propName + ' in ' +
1192 * componentName
1193 * );
1194 * }
1195 * }
1196 * },
1197 * render: function() {...}
1198 * });
1199 *
1200 * @internal
1201 */
1202
1203 var ANONYMOUS = '<<anonymous>>';
1204
1205 // Important!
1206 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
1207 var ReactPropTypes = {
1208 array: createPrimitiveTypeChecker('array'),
1209 bigint: createPrimitiveTypeChecker('bigint'),
1210 bool: createPrimitiveTypeChecker('boolean'),
1211 func: createPrimitiveTypeChecker('function'),
1212 number: createPrimitiveTypeChecker('number'),
1213 object: createPrimitiveTypeChecker('object'),
1214 string: createPrimitiveTypeChecker('string'),
1215 symbol: createPrimitiveTypeChecker('symbol'),
1216
1217 any: createAnyTypeChecker(),
1218 arrayOf: createArrayOfTypeChecker,
1219 element: createElementTypeChecker(),
1220 elementType: createElementTypeTypeChecker(),
1221 instanceOf: createInstanceTypeChecker,
1222 node: createNodeChecker(),
1223 objectOf: createObjectOfTypeChecker,
1224 oneOf: createEnumTypeChecker,
1225 oneOfType: createUnionTypeChecker,
1226 shape: createShapeTypeChecker,
1227 exact: createStrictShapeTypeChecker,
1228 };
1229
1230 /**
1231 * inlined Object.is polyfill to avoid requiring consumers ship their own
1232 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1233 */
1234 /*eslint-disable no-self-compare*/
1235 function is(x, y) {
1236 // SameValue algorithm
1237 if (x === y) {
1238 // Steps 1-5, 7-10
1239 // Steps 6.b-6.e: +0 != -0
1240 return x !== 0 || 1 / x === 1 / y;
1241 } else {
1242 // Step 6.a: NaN == NaN
1243 return x !== x && y !== y;
1244 }
1245 }
1246 /*eslint-enable no-self-compare*/
1247
1248 /**
1249 * We use an Error-like object for backward compatibility as people may call
1250 * PropTypes directly and inspect their output. However, we don't use real
1251 * Errors anymore. We don't inspect their stack anyway, and creating them
1252 * is prohibitively expensive if they are created too often, such as what
1253 * happens in oneOfType() for any type before the one that matched.
1254 */
1255 function PropTypeError(message, data) {
1256 this.message = message;
1257 this.data = data && typeof data === 'object' ? data: {};
1258 this.stack = '';
1259 }
1260 // Make `instanceof Error` still work for returned errors.
1261 PropTypeError.prototype = Error.prototype;
1262
1263 function createChainableTypeChecker(validate) {
1264 {
1265 var manualPropTypeCallCache = {};
1266 var manualPropTypeWarningCount = 0;
1267 }
1268 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
1269 componentName = componentName || ANONYMOUS;
1270 propFullName = propFullName || propName;
1271
1272 if (secret !== ReactPropTypesSecret) {
1273 if (throwOnDirectAccess) {
1274 // New behavior only for users of `prop-types` package
1275 var err = new Error(
1276 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1277 'Use `PropTypes.checkPropTypes()` to call them. ' +
1278 'Read more at http://fb.me/use-check-prop-types'
1279 );
1280 err.name = 'Invariant Violation';
1281 throw err;
1282 } else if (typeof console !== 'undefined') {
1283 // Old behavior for people using React.PropTypes
1284 var cacheKey = componentName + ':' + propName;
1285 if (
1286 !manualPropTypeCallCache[cacheKey] &&
1287 // Avoid spamming the console because they are often not actionable except for lib authors
1288 manualPropTypeWarningCount < 3
1289 ) {
1290 printWarning(
1291 'You are manually calling a React.PropTypes validation ' +
1292 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
1293 'and will throw in the standalone `prop-types` package. ' +
1294 'You may be seeing this warning due to a third-party PropTypes ' +
1295 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
1296 );
1297 manualPropTypeCallCache[cacheKey] = true;
1298 manualPropTypeWarningCount++;
1299 }
1300 }
1301 }
1302 if (props[propName] == null) {
1303 if (isRequired) {
1304 if (props[propName] === null) {
1305 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
1306 }
1307 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
1308 }
1309 return null;
1310 } else {
1311 return validate(props, propName, componentName, location, propFullName);
1312 }
1313 }
1314
1315 var chainedCheckType = checkType.bind(null, false);
1316 chainedCheckType.isRequired = checkType.bind(null, true);
1317
1318 return chainedCheckType;
1319 }
1320
1321 function createPrimitiveTypeChecker(expectedType) {
1322 function validate(props, propName, componentName, location, propFullName, secret) {
1323 var propValue = props[propName];
1324 var propType = getPropType(propValue);
1325 if (propType !== expectedType) {
1326 // `propValue` being instance of, say, date/regexp, pass the 'object'
1327 // check, but we can offer a more precise error message here rather than
1328 // 'of type `object`'.
1329 var preciseType = getPreciseType(propValue);
1330
1331 return new PropTypeError(
1332 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
1333 {expectedType: expectedType}
1334 );
1335 }
1336 return null;
1337 }
1338 return createChainableTypeChecker(validate);
1339 }
1340
1341 function createAnyTypeChecker() {
1342 return createChainableTypeChecker(emptyFunctionThatReturnsNull);
1343 }
1344
1345 function createArrayOfTypeChecker(typeChecker) {
1346 function validate(props, propName, componentName, location, propFullName) {
1347 if (typeof typeChecker !== 'function') {
1348 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
1349 }
1350 var propValue = props[propName];
1351 if (!Array.isArray(propValue)) {
1352 var propType = getPropType(propValue);
1353 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
1354 }
1355 for (var i = 0; i < propValue.length; i++) {
1356 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
1357 if (error instanceof Error) {
1358 return error;
1359 }
1360 }
1361 return null;
1362 }
1363 return createChainableTypeChecker(validate);
1364 }
1365
1366 function createElementTypeChecker() {
1367 function validate(props, propName, componentName, location, propFullName) {
1368 var propValue = props[propName];
1369 if (!isValidElement(propValue)) {
1370 var propType = getPropType(propValue);
1371 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
1372 }
1373 return null;
1374 }
1375 return createChainableTypeChecker(validate);
1376 }
1377
1378 function createElementTypeTypeChecker() {
1379 function validate(props, propName, componentName, location, propFullName) {
1380 var propValue = props[propName];
1381 if (!ReactIs.isValidElementType(propValue)) {
1382 var propType = getPropType(propValue);
1383 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
1384 }
1385 return null;
1386 }
1387 return createChainableTypeChecker(validate);
1388 }
1389
1390 function createInstanceTypeChecker(expectedClass) {
1391 function validate(props, propName, componentName, location, propFullName) {
1392 if (!(props[propName] instanceof expectedClass)) {
1393 var expectedClassName = expectedClass.name || ANONYMOUS;
1394 var actualClassName = getClassName(props[propName]);
1395 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
1396 }
1397 return null;
1398 }
1399 return createChainableTypeChecker(validate);
1400 }
1401
1402 function createEnumTypeChecker(expectedValues) {
1403 if (!Array.isArray(expectedValues)) {
1404 {
1405 if (arguments.length > 1) {
1406 printWarning(
1407 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
1408 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
1409 );
1410 } else {
1411 printWarning('Invalid argument supplied to oneOf, expected an array.');
1412 }
1413 }
1414 return emptyFunctionThatReturnsNull;
1415 }
1416
1417 function validate(props, propName, componentName, location, propFullName) {
1418 var propValue = props[propName];
1419 for (var i = 0; i < expectedValues.length; i++) {
1420 if (is(propValue, expectedValues[i])) {
1421 return null;
1422 }
1423 }
1424
1425 var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
1426 var type = getPreciseType(value);
1427 if (type === 'symbol') {
1428 return String(value);
1429 }
1430 return value;
1431 });
1432 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
1433 }
1434 return createChainableTypeChecker(validate);
1435 }
1436
1437 function createObjectOfTypeChecker(typeChecker) {
1438 function validate(props, propName, componentName, location, propFullName) {
1439 if (typeof typeChecker !== 'function') {
1440 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
1441 }
1442 var propValue = props[propName];
1443 var propType = getPropType(propValue);
1444 if (propType !== 'object') {
1445 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
1446 }
1447 for (var key in propValue) {
1448 if (has(propValue, key)) {
1449 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1450 if (error instanceof Error) {
1451 return error;
1452 }
1453 }
1454 }
1455 return null;
1456 }
1457 return createChainableTypeChecker(validate);
1458 }
1459
1460 function createUnionTypeChecker(arrayOfTypeCheckers) {
1461 if (!Array.isArray(arrayOfTypeCheckers)) {
1462 printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') ;
1463 return emptyFunctionThatReturnsNull;
1464 }
1465
1466 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1467 var checker = arrayOfTypeCheckers[i];
1468 if (typeof checker !== 'function') {
1469 printWarning(
1470 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
1471 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
1472 );
1473 return emptyFunctionThatReturnsNull;
1474 }
1475 }
1476
1477 function validate(props, propName, componentName, location, propFullName) {
1478 var expectedTypes = [];
1479 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1480 var checker = arrayOfTypeCheckers[i];
1481 var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
1482 if (checkerResult == null) {
1483 return null;
1484 }
1485 if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
1486 expectedTypes.push(checkerResult.data.expectedType);
1487 }
1488 }
1489 var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
1490 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
1491 }
1492 return createChainableTypeChecker(validate);
1493 }
1494
1495 function createNodeChecker() {
1496 function validate(props, propName, componentName, location, propFullName) {
1497 if (!isNode(props[propName])) {
1498 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
1499 }
1500 return null;
1501 }
1502 return createChainableTypeChecker(validate);
1503 }
1504
1505 function invalidValidatorError(componentName, location, propFullName, key, type) {
1506 return new PropTypeError(
1507 (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
1508 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
1509 );
1510 }
1511
1512 function createShapeTypeChecker(shapeTypes) {
1513 function validate(props, propName, componentName, location, propFullName) {
1514 var propValue = props[propName];
1515 var propType = getPropType(propValue);
1516 if (propType !== 'object') {
1517 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1518 }
1519 for (var key in shapeTypes) {
1520 var checker = shapeTypes[key];
1521 if (typeof checker !== 'function') {
1522 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1523 }
1524 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1525 if (error) {
1526 return error;
1527 }
1528 }
1529 return null;
1530 }
1531 return createChainableTypeChecker(validate);
1532 }
1533
1534 function createStrictShapeTypeChecker(shapeTypes) {
1535 function validate(props, propName, componentName, location, propFullName) {
1536 var propValue = props[propName];
1537 var propType = getPropType(propValue);
1538 if (propType !== 'object') {
1539 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1540 }
1541 // We need to check all keys in case some are required but missing from props.
1542 var allKeys = assign({}, props[propName], shapeTypes);
1543 for (var key in allKeys) {
1544 var checker = shapeTypes[key];
1545 if (has(shapeTypes, key) && typeof checker !== 'function') {
1546 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1547 }
1548 if (!checker) {
1549 return new PropTypeError(
1550 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
1551 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
1552 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
1553 );
1554 }
1555 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1556 if (error) {
1557 return error;
1558 }
1559 }
1560 return null;
1561 }
1562
1563 return createChainableTypeChecker(validate);
1564 }
1565
1566 function isNode(propValue) {
1567 switch (typeof propValue) {
1568 case 'number':
1569 case 'string':
1570 case 'undefined':
1571 return true;
1572 case 'boolean':
1573 return !propValue;
1574 case 'object':
1575 if (Array.isArray(propValue)) {
1576 return propValue.every(isNode);
1577 }
1578 if (propValue === null || isValidElement(propValue)) {
1579 return true;
1580 }
1581
1582 var iteratorFn = getIteratorFn(propValue);
1583 if (iteratorFn) {
1584 var iterator = iteratorFn.call(propValue);
1585 var step;
1586 if (iteratorFn !== propValue.entries) {
1587 while (!(step = iterator.next()).done) {
1588 if (!isNode(step.value)) {
1589 return false;
1590 }
1591 }
1592 } else {
1593 // Iterator will provide entry [k,v] tuples rather than values.
1594 while (!(step = iterator.next()).done) {
1595 var entry = step.value;
1596 if (entry) {
1597 if (!isNode(entry[1])) {
1598 return false;
1599 }
1600 }
1601 }
1602 }
1603 } else {
1604 return false;
1605 }
1606
1607 return true;
1608 default:
1609 return false;
1610 }
1611 }
1612
1613 function isSymbol(propType, propValue) {
1614 // Native Symbol.
1615 if (propType === 'symbol') {
1616 return true;
1617 }
1618
1619 // falsy value can't be a Symbol
1620 if (!propValue) {
1621 return false;
1622 }
1623
1624 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1625 if (propValue['@@toStringTag'] === 'Symbol') {
1626 return true;
1627 }
1628
1629 // Fallback for non-spec compliant Symbols which are polyfilled.
1630 if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1631 return true;
1632 }
1633
1634 return false;
1635 }
1636
1637 // Equivalent of `typeof` but with special handling for array and regexp.
1638 function getPropType(propValue) {
1639 var propType = typeof propValue;
1640 if (Array.isArray(propValue)) {
1641 return 'array';
1642 }
1643 if (propValue instanceof RegExp) {
1644 // Old webkits (at least until Android 4.0) return 'function' rather than
1645 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1646 // passes PropTypes.object.
1647 return 'object';
1648 }
1649 if (isSymbol(propType, propValue)) {
1650 return 'symbol';
1651 }
1652 return propType;
1653 }
1654
1655 // This handles more types than `getPropType`. Only used for error messages.
1656 // See `createPrimitiveTypeChecker`.
1657 function getPreciseType(propValue) {
1658 if (typeof propValue === 'undefined' || propValue === null) {
1659 return '' + propValue;
1660 }
1661 var propType = getPropType(propValue);
1662 if (propType === 'object') {
1663 if (propValue instanceof Date) {
1664 return 'date';
1665 } else if (propValue instanceof RegExp) {
1666 return 'regexp';
1667 }
1668 }
1669 return propType;
1670 }
1671
1672 // Returns a string that is postfixed to a warning about an invalid type.
1673 // For example, "undefined" or "of type array"
1674 function getPostfixForTypeWarning(value) {
1675 var type = getPreciseType(value);
1676 switch (type) {
1677 case 'array':
1678 case 'object':
1679 return 'an ' + type;
1680 case 'boolean':
1681 case 'date':
1682 case 'regexp':
1683 return 'a ' + type;
1684 default:
1685 return type;
1686 }
1687 }
1688
1689 // Returns class name of the object, if any.
1690 function getClassName(propValue) {
1691 if (!propValue.constructor || !propValue.constructor.name) {
1692 return ANONYMOUS;
1693 }
1694 return propValue.constructor.name;
1695 }
1696
1697 ReactPropTypes.checkPropTypes = checkPropTypes;
1698 ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1699 ReactPropTypes.PropTypes = ReactPropTypes;
1700
1701 return ReactPropTypes;
1702 };
1703 return factoryWithTypeCheckers;
1704 }
1705
1706 /**
1707 * Copyright (c) 2013-present, Facebook, Inc.
1708 *
1709 * This source code is licensed under the MIT license found in the
1710 * LICENSE file in the root directory of this source tree.
1711 */
1712
1713 {
1714 var ReactIs = requireReactIs();
1715
1716 // By explicitly using `prop-types` you are opting into new development behavior.
1717 // http://fb.me/prop-types-in-prod
1718 var throwOnDirectAccess = true;
1719 propTypes$b.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1720 }
1721
1722 /**
1723 * Returns a function that triggers a component update. the hook equivalent to
1724 * `this.forceUpdate()` in a class component. In most cases using a state value directly
1725 * is preferable but may be required in some advanced usages of refs for interop or
1726 * when direct DOM manipulation is required.
1727 *
1728 * ```ts
1729 * const forceUpdate = useForceUpdate();
1730 *
1731 * const updateOnClick = useCallback(() => {
1732 * forceUpdate()
1733 * }, [forceUpdate])
1734 *
1735 * return <button type="button" onClick={updateOnClick}>Hi there</button>
1736 * ```
1737 */
1738 function useForceUpdate() {
1739 // The toggling state value is designed to defeat React optimizations for skipping
1740 // updates when they are strictly equal to the last state value
1741 const [, dispatch] = React.useReducer(state => !state, false);
1742 return dispatch;
1743 }
1744
1745 /**
1746 * Store the last of some value. Tracked via a `Ref` only updating it
1747 * after the component renders.
1748 *
1749 * Helpful if you need to compare a prop value to it's previous value during render.
1750 *
1751 * ```ts
1752 * function Component(props) {
1753 * const lastProps = usePrevious(props)
1754 *
1755 * if (lastProps.foo !== props.foo)
1756 * resetValueFromProps(props.foo)
1757 * }
1758 * ```
1759 *
1760 * @param value the value to track
1761 */
1762 function usePrevious(value) {
1763 const ref = React.useRef(null);
1764 React.useEffect(() => {
1765 ref.current = value;
1766 });
1767 return ref.current;
1768 }
1769
1770 var ALIGN_VALUES = ['justify', 'left', 'right'];
1771 var DEFAULT_LABELKEY = 'label';
1772 var SIZES = ['lg', 'sm'];
1773
1774 /**
1775 * Copyright (c) 2013-present, Facebook, Inc.
1776 *
1777 * This source code is licensed under the MIT license found in the
1778 * LICENSE file in the root directory of this source tree.
1779 */
1780
1781 var invariant = function(condition, format, a, b, c, d, e, f) {
1782 {
1783 if (format === undefined) {
1784 throw new Error('invariant requires an error message argument');
1785 }
1786 }
1787
1788 if (!condition) {
1789 var error;
1790 if (format === undefined) {
1791 error = new Error(
1792 'Minified exception occurred; use the non-minified dev environment ' +
1793 'for the full error message and additional helpful warnings.'
1794 );
1795 } else {
1796 var args = [a, b, c, d, e, f];
1797 var argIndex = 0;
1798 error = new Error(
1799 format.replace(/%s/g, function() { return args[argIndex++]; })
1800 );
1801 error.name = 'Invariant Violation';
1802 }
1803
1804 error.framesToPop = 1; // we don't care about invariant's own frame
1805 throw error;
1806 }
1807 };
1808
1809 var invariant_1 = invariant;
1810
1811 function getStringLabelKey(labelKey) {
1812 return typeof labelKey === 'string' ? labelKey : DEFAULT_LABELKEY;
1813 }
1814
1815 /**
1816 * Check if an object has the given property in a type-safe way.
1817 */
1818 function hasOwnProperty(obj, prop) {
1819 return Object.prototype.hasOwnProperty.call(obj, prop);
1820 }
1821
1822 var idCounter = 0;
1823
1824 // eslint-disable-next-line @typescript-eslint/ban-types
1825 function isFunction(value) {
1826 return typeof value === 'function';
1827 }
1828 function isString(value) {
1829 return typeof value === 'string';
1830 }
1831 function noop$1() {}
1832 function pick(obj, keys) {
1833 // eslint-disable-next-line @typescript-eslint/no-explicit-any
1834 var result = {};
1835 keys.forEach(function (key) {
1836 result[key] = obj[key];
1837 });
1838 return result;
1839 }
1840 function uniqueId(prefix) {
1841 idCounter += 1;
1842 return (prefix == null ? '' : String(prefix)) + idCounter;
1843 }
1844
1845 /**
1846 * Retrieves the display string from an option. Options can be the string
1847 * themselves, or an object with a defined display string. Anything else throws
1848 * an error.
1849 */
1850 function getOptionLabel(option, labelKey) {
1851 // Handle internally created options first.
1852 if (!isString(option) && (hasOwnProperty(option, 'paginationOption') || hasOwnProperty(option, 'customOption'))) {
1853 return option[getStringLabelKey(labelKey)];
1854 }
1855 var optionLabel;
1856 if (isFunction(labelKey)) {
1857 optionLabel = labelKey(option);
1858 } else if (isString(option)) {
1859 optionLabel = option;
1860 } else {
1861 // `option` is an object and `labelKey` is a string.
1862 optionLabel = option[labelKey];
1863 }
1864 !isString(optionLabel) ? invariant_1(false, 'One or more options does not have a valid label string. Check the ' + '`labelKey` prop to ensure that it matches the correct option key and ' + 'provides a string for filtering and display.') : void 0;
1865 return optionLabel;
1866 }
1867
1868 function addCustomOption(results, props) {
1869 var allowNew = props.allowNew,
1870 labelKey = props.labelKey,
1871 text = props.text;
1872 if (!allowNew || !text.trim()) {
1873 return false;
1874 }
1875
1876 // If the consumer has provided a callback, use that to determine whether or
1877 // not to add the custom option.
1878 if (isFunction(allowNew)) {
1879 return allowNew(results, props);
1880 }
1881
1882 // By default, don't add the custom option if there is an exact text match
1883 // with an existing option.
1884 return !results.some(function (o) {
1885 return getOptionLabel(o, labelKey) === text;
1886 });
1887 }
1888
1889 // do not edit .js files directly - edit src/index.jst
1890
1891
1892
1893 var fastDeepEqual = function equal(a, b) {
1894 if (a === b) return true;
1895
1896 if (a && b && typeof a == 'object' && typeof b == 'object') {
1897 if (a.constructor !== b.constructor) return false;
1898
1899 var length, i, keys;
1900 if (Array.isArray(a)) {
1901 length = a.length;
1902 if (length != b.length) return false;
1903 for (i = length; i-- !== 0;)
1904 if (!equal(a[i], b[i])) return false;
1905 return true;
1906 }
1907
1908
1909
1910 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
1911 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
1912 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
1913
1914 keys = Object.keys(a);
1915 length = keys.length;
1916 if (length !== Object.keys(b).length) return false;
1917
1918 for (i = length; i-- !== 0;)
1919 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
1920
1921 for (i = length; i-- !== 0;) {
1922 var key = keys[i];
1923
1924 if (!equal(a[key], b[key])) return false;
1925 }
1926
1927 return true;
1928 }
1929
1930 // true if both NaN, false otherwise
1931 return a!==a && b!==b;
1932 };
1933
1934 function getOptionProperty(option, key) {
1935 if (isString(option)) {
1936 return undefined;
1937 }
1938 return option[key];
1939 }
1940
1941 // prettier-ignore
1942
1943 var map = [{
1944 base: 'A',
1945 letters: "A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"
1946 }, {
1947 base: 'AA',
1948 letters: "\uA732"
1949 }, {
1950 base: 'AE',
1951 letters: "\xC6\u01FC\u01E2"
1952 }, {
1953 base: 'AO',
1954 letters: "\uA734"
1955 }, {
1956 base: 'AU',
1957 letters: "\uA736"
1958 }, {
1959 base: 'AV',
1960 letters: "\uA738\uA73A"
1961 }, {
1962 base: 'AY',
1963 letters: "\uA73C"
1964 }, {
1965 base: 'B',
1966 letters: "B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"
1967 }, {
1968 base: 'C',
1969 letters: "C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"
1970 }, {
1971 base: 'D',
1972 letters: "D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779\xD0"
1973 }, {
1974 base: 'DZ',
1975 letters: "\u01F1\u01C4"
1976 }, {
1977 base: 'Dz',
1978 letters: "\u01F2\u01C5"
1979 }, {
1980 base: 'E',
1981 letters: "E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"
1982 }, {
1983 base: 'F',
1984 letters: "F\u24BB\uFF26\u1E1E\u0191\uA77B"
1985 }, {
1986 base: 'G',
1987 letters: "G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"
1988 }, {
1989 base: 'H',
1990 letters: "H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
1991 }, {
1992 base: 'I',
1993 letters: "I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
1994 }, {
1995 base: 'J',
1996 letters: "J\u24BF\uFF2A\u0134\u0248"
1997 }, {
1998 base: 'K',
1999 letters: "K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
2000 }, {
2001 base: 'L',
2002 letters: "L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
2003 }, {
2004 base: 'LJ',
2005 letters: "\u01C7"
2006 }, {
2007 base: 'Lj',
2008 letters: "\u01C8"
2009 }, {
2010 base: 'M',
2011 letters: "M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"
2012 }, {
2013 base: 'N',
2014 letters: "N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"
2015 }, {
2016 base: 'NJ',
2017 letters: "\u01CA"
2018 }, {
2019 base: 'Nj',
2020 letters: "\u01CB"
2021 }, {
2022 base: 'O',
2023 letters: "O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"
2024 }, {
2025 base: 'OI',
2026 letters: "\u01A2"
2027 }, {
2028 base: 'OO',
2029 letters: "\uA74E"
2030 }, {
2031 base: 'OU',
2032 letters: "\u0222"
2033 }, {
2034 base: 'OE',
2035 letters: "\x8C\u0152"
2036 }, {
2037 base: 'oe',
2038 letters: "\x9C\u0153"
2039 }, {
2040 base: 'P',
2041 letters: "P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
2042 }, {
2043 base: 'Q',
2044 letters: "Q\u24C6\uFF31\uA756\uA758\u024A"
2045 }, {
2046 base: 'R',
2047 letters: "R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
2048 }, {
2049 base: 'S',
2050 letters: "S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
2051 }, {
2052 base: 'T',
2053 letters: "T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
2054 }, {
2055 base: 'TZ',
2056 letters: "\uA728"
2057 }, {
2058 base: 'U',
2059 letters: "U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"
2060 }, {
2061 base: 'V',
2062 letters: "V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
2063 }, {
2064 base: 'VY',
2065 letters: "\uA760"
2066 }, {
2067 base: 'W',
2068 letters: "W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
2069 }, {
2070 base: 'X',
2071 letters: "X\u24CD\uFF38\u1E8A\u1E8C"
2072 }, {
2073 base: 'Y',
2074 letters: "Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
2075 }, {
2076 base: 'Z',
2077 letters: "Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
2078 }, {
2079 base: 'a',
2080 letters: "a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"
2081 }, {
2082 base: 'aa',
2083 letters: "\uA733"
2084 }, {
2085 base: 'ae',
2086 letters: "\xE6\u01FD\u01E3"
2087 }, {
2088 base: 'ao',
2089 letters: "\uA735"
2090 }, {
2091 base: 'au',
2092 letters: "\uA737"
2093 }, {
2094 base: 'av',
2095 letters: "\uA739\uA73B"
2096 }, {
2097 base: 'ay',
2098 letters: "\uA73D"
2099 }, {
2100 base: 'b',
2101 letters: "b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"
2102 }, {
2103 base: 'c',
2104 letters: "c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
2105 }, {
2106 base: 'd',
2107 letters: "d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"
2108 }, {
2109 base: 'dz',
2110 letters: "\u01F3\u01C6"
2111 }, {
2112 base: 'e',
2113 letters: "e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"
2114 }, {
2115 base: 'f',
2116 letters: "f\u24D5\uFF46\u1E1F\u0192\uA77C"
2117 }, {
2118 base: 'g',
2119 letters: "g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"
2120 }, {
2121 base: 'h',
2122 letters: "h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
2123 }, {
2124 base: 'hv',
2125 letters: "\u0195"
2126 }, {
2127 base: 'i',
2128 letters: "i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
2129 }, {
2130 base: 'j',
2131 letters: "j\u24D9\uFF4A\u0135\u01F0\u0249"
2132 }, {
2133 base: 'k',
2134 letters: "k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
2135 }, {
2136 base: 'l',
2137 letters: "l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"
2138 }, {
2139 base: 'lj',
2140 letters: "\u01C9"
2141 }, {
2142 base: 'm',
2143 letters: "m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
2144 }, {
2145 base: 'n',
2146 letters: "n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"
2147 }, {
2148 base: 'nj',
2149 letters: "\u01CC"
2150 }, {
2151 base: 'o',
2152 letters: "o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"
2153 }, {
2154 base: 'oi',
2155 letters: "\u01A3"
2156 }, {
2157 base: 'ou',
2158 letters: "\u0223"
2159 }, {
2160 base: 'oo',
2161 letters: "\uA74F"
2162 }, {
2163 base: 'p',
2164 letters: "p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"
2165 }, {
2166 base: 'q',
2167 letters: "q\u24E0\uFF51\u024B\uA757\uA759"
2168 }, {
2169 base: 'r',
2170 letters: "r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
2171 }, {
2172 base: 's',
2173 letters: "s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"
2174 }, {
2175 base: 't',
2176 letters: "t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
2177 }, {
2178 base: 'tz',
2179 letters: "\uA729"
2180 }, {
2181 base: 'u',
2182 letters: "u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"
2183 }, {
2184 base: 'v',
2185 letters: "v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
2186 }, {
2187 base: 'vy',
2188 letters: "\uA761"
2189 }, {
2190 base: 'w',
2191 letters: "w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
2192 }, {
2193 base: 'x',
2194 letters: "x\u24E7\uFF58\u1E8B\u1E8D"
2195 }, {
2196 base: 'y',
2197 letters: "y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
2198 }, {
2199 base: 'z',
2200 letters: "z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
2201 }].reduce(function (acc, _ref) {
2202 var base = _ref.base,
2203 letters = _ref.letters;
2204 letters.split('').forEach(function (letter) {
2205 acc[letter] = base;
2206 });
2207 return acc;
2208 }, {});
2209
2210 // Combining marks
2211 var latin = "\u0300-\u036F";
2212 var japanese = "\u3099\u309A";
2213 function stripDiacritics(str) {
2214 return str.normalize('NFD')
2215 // Remove combining diacritics
2216 .replace(new RegExp("[".concat(latin).concat(japanese, "]"), 'g'), '')
2217 /* eslint-disable-next-line no-control-regex */.replace(/[^\u0000-\u007E]/g, function (a) {
2218 return map[a] || a;
2219 });
2220 }
2221
2222 /**
2223 * Copyright (c) 2014-present, Facebook, Inc.
2224 *
2225 * This source code is licensed under the MIT license found in the
2226 * LICENSE file in the root directory of this source tree.
2227 */
2228
2229 var warning = function() {};
2230
2231 {
2232 var printWarning = function printWarning(format, args) {
2233 var len = arguments.length;
2234 args = new Array(len > 1 ? len - 1 : 0);
2235 for (var key = 1; key < len; key++) {
2236 args[key - 1] = arguments[key];
2237 }
2238 var argIndex = 0;
2239 var message = 'Warning: ' +
2240 format.replace(/%s/g, function() {
2241 return args[argIndex++];
2242 });
2243 if (typeof console !== 'undefined') {
2244 console.error(message);
2245 }
2246 try {
2247 // --- Welcome to debugging React ---
2248 // This error was thrown as a convenience so that you can use this stack
2249 // to find the callsite that caused this warning to fire.
2250 throw new Error(message);
2251 } catch (x) {}
2252 };
2253
2254 warning = function(condition, format, args) {
2255 var len = arguments.length;
2256 args = new Array(len > 2 ? len - 2 : 0);
2257 for (var key = 2; key < len; key++) {
2258 args[key - 2] = arguments[key];
2259 }
2260 if (format === undefined) {
2261 throw new Error(
2262 '`warning(condition, format, ...args)` requires a warning ' +
2263 'message argument'
2264 );
2265 }
2266 if (!condition) {
2267 printWarning.apply(null, [format].concat(args));
2268 }
2269 };
2270 }
2271
2272 var warning_1 = warning;
2273
2274 var warned = {};
2275
2276 /**
2277 * Copied from: https://github.com/ReactTraining/react-router/blob/master/modules/routerWarning.js
2278 */
2279 function warn(falseToWarn, message) {
2280 // Only issue deprecation warnings once.
2281 if (!falseToWarn && message.indexOf('deprecated') !== -1) {
2282 if (warned[message]) {
2283 return;
2284 }
2285 warned[message] = true;
2286 }
2287 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2288 args[_key - 2] = arguments[_key];
2289 }
2290 warning_1.apply(void 0, [falseToWarn, "[react-bootstrap-typeahead] ".concat(message)].concat(args));
2291 }
2292
2293 function isMatch(input, string, props) {
2294 var searchStr = input;
2295 var str = string;
2296 if (!props.caseSensitive) {
2297 searchStr = searchStr.toLowerCase();
2298 str = str.toLowerCase();
2299 }
2300 if (props.ignoreDiacritics) {
2301 searchStr = stripDiacritics(searchStr);
2302 str = stripDiacritics(str);
2303 }
2304 return str.indexOf(searchStr) !== -1;
2305 }
2306
2307 /**
2308 * Default algorithm for filtering results.
2309 */
2310 function defaultFilterBy(option, props) {
2311 var filterBy = props.filterBy,
2312 labelKey = props.labelKey,
2313 multiple = props.multiple,
2314 selected = props.selected,
2315 text = props.text;
2316
2317 // Don't show selected options in the menu for the multi-select case.
2318 if (multiple && selected.some(function (o) {
2319 return fastDeepEqual(o, option);
2320 })) {
2321 return false;
2322 }
2323 if (isFunction(labelKey)) {
2324 return isMatch(text, labelKey(option), props);
2325 }
2326 var fields = filterBy.slice();
2327 if (isString(labelKey)) {
2328 // Add the `labelKey` field to the list of fields if it isn't already there.
2329 if (fields.indexOf(labelKey) === -1) {
2330 fields.unshift(labelKey);
2331 }
2332 }
2333 if (isString(option)) {
2334 warn(fields.length <= 1, 'You cannot filter by properties when `option` is a string.');
2335 return isMatch(text, option, props);
2336 }
2337 return fields.some(function (field) {
2338 var value = getOptionProperty(option, field);
2339 if (!isString(value)) {
2340 warn(false, 'Fields passed to `filterBy` should have string values. Value will ' + 'be converted to a string; results may be unexpected.');
2341 value = String(value);
2342 }
2343 return isMatch(text, value, props);
2344 });
2345 }
2346
2347 /**
2348 * Check if an input type is selectable, based on WHATWG spec.
2349 *
2350 * See:
2351 * - https://stackoverflow.com/questions/21177489/selectionstart-selectionend-on-input-type-number-no-longer-allowed-in-chrome/24175357
2352 * - https://html.spec.whatwg.org/multipage/input.html#do-not-apply
2353 */
2354 function isSelectable(inputNode) {
2355 return inputNode.selectionStart != null;
2356 }
2357
2358 function defaultSelectHint(e, selectHint) {
2359 var shouldSelectHint = false;
2360 if (e.key === 'ArrowRight') {
2361 // For selectable input types ("text", "search"), only select the hint if
2362 // it's at the end of the input value. For non-selectable types ("email",
2363 // "number"), always select the hint.
2364 shouldSelectHint = isSelectable(e.currentTarget) ? e.currentTarget.selectionStart === e.currentTarget.value.length : true;
2365 }
2366 if (e.key === 'Tab') {
2367 // Prevent input from blurring on TAB.
2368 e.preventDefault();
2369 shouldSelectHint = true;
2370 }
2371 return selectHint ? selectHint(shouldSelectHint, e) : shouldSelectHint;
2372 }
2373
2374 // eslint-disable-next-line @typescript-eslint/no-explicit-any
2375 function getDisplayName(Component) {
2376 return Component.displayName || Component.name || 'Component';
2377 }
2378
2379 var CASE_INSENSITIVE = 'i';
2380 var COMBINING_MARKS = /[\u0300-\u036F]/;
2381 // Export for testing.
2382 function escapeStringRegexp(str) {
2383 !(typeof str === 'string') ? invariant_1(false, '`escapeStringRegexp` expected a string.') : void 0;
2384
2385 // Escape characters with special meaning either inside or outside character
2386 // sets. Use a simple backslash escape when it’s always valid, and a \unnnn
2387 // escape when the simpler form would be disallowed by Unicode patterns’
2388 // stricter grammar.
2389 return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
2390 }
2391 function getMatchBounds(subject, str) {
2392 var search = new RegExp(escapeStringRegexp(stripDiacritics(str)), CASE_INSENSITIVE);
2393 var matches = search.exec(stripDiacritics(subject));
2394 if (!matches) {
2395 return null;
2396 }
2397 var start = matches.index;
2398 var matchLength = matches[0].length;
2399
2400 // Account for combining marks, which changes the indices.
2401 if (COMBINING_MARKS.test(subject)) {
2402 // Starting at the beginning of the subject string, check for the number of
2403 // combining marks and increment the start index whenever one is found.
2404 for (var ii = 0; ii <= start; ii++) {
2405 if (COMBINING_MARKS.test(subject[ii])) {
2406 start += 1;
2407 }
2408 }
2409
2410 // Similarly, increment the length of the match string if it contains a
2411 // combining mark.
2412 for (var _ii = start; _ii <= start + matchLength; _ii++) {
2413 if (COMBINING_MARKS.test(subject[_ii])) {
2414 matchLength += 1;
2415 }
2416 }
2417 }
2418 return {
2419 end: start + matchLength,
2420 start: start
2421 };
2422 }
2423
2424 function getHintText(_ref) {
2425 var activeIndex = _ref.activeIndex,
2426 initialItem = _ref.initialItem,
2427 isFocused = _ref.isFocused,
2428 isMenuShown = _ref.isMenuShown,
2429 labelKey = _ref.labelKey,
2430 multiple = _ref.multiple,
2431 selected = _ref.selected,
2432 text = _ref.text;
2433 // Don't display a hint under the following conditions:
2434 if (
2435 // No text entered.
2436 !text ||
2437 // The input is not focused.
2438 !isFocused ||
2439 // The menu is hidden.
2440 !isMenuShown ||
2441 // No item in the menu.
2442 !initialItem ||
2443 // The initial item is a custom option.
2444 !isString(initialItem) && hasOwnProperty(initialItem, 'customOption') ||
2445 // One of the menu items is active.
2446 activeIndex > -1 ||
2447 // There's already a selection in single-select mode.
2448 !!selected.length && !multiple) {
2449 return '';
2450 }
2451 var initialItemStr = getOptionLabel(initialItem, labelKey);
2452 var bounds = getMatchBounds(initialItemStr.toLowerCase(), text.toLowerCase());
2453 if (!(bounds && bounds.start === 0)) {
2454 return '';
2455 }
2456
2457 // Text matching is case- and accent-insensitive, so to display the hint
2458 // correctly, splice the input string with the hint string.
2459 return text + initialItemStr.slice(bounds.end, initialItemStr.length);
2460 }
2461
2462 var classnames = {exports: {}};
2463
2464 /*!
2465 Copyright (c) 2018 Jed Watson.
2466 Licensed under the MIT License (MIT), see
2467 http://jedwatson.github.io/classnames
2468 */
2469
2470 (function (module) {
2471 /* global define */
2472
2473 (function () {
2474
2475 var hasOwn = {}.hasOwnProperty;
2476
2477 function classNames() {
2478 var classes = [];
2479
2480 for (var i = 0; i < arguments.length; i++) {
2481 var arg = arguments[i];
2482 if (!arg) continue;
2483
2484 var argType = typeof arg;
2485
2486 if (argType === 'string' || argType === 'number') {
2487 classes.push(arg);
2488 } else if (Array.isArray(arg)) {
2489 if (arg.length) {
2490 var inner = classNames.apply(null, arg);
2491 if (inner) {
2492 classes.push(inner);
2493 }
2494 }
2495 } else if (argType === 'object') {
2496 if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
2497 classes.push(arg.toString());
2498 continue;
2499 }
2500
2501 for (var key in arg) {
2502 if (hasOwn.call(arg, key) && arg[key]) {
2503 classes.push(key);
2504 }
2505 }
2506 }
2507 }
2508
2509 return classes.join(' ');
2510 }
2511
2512 if (module.exports) {
2513 classNames.default = classNames;
2514 module.exports = classNames;
2515 } else {
2516 window.classNames = classNames;
2517 }
2518 }());
2519 } (classnames));
2520
2521 var cx = classnames.exports;
2522
2523 function getMenuItemId() {
2524 var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2525 var position = arguments.length > 1 ? arguments[1] : undefined;
2526 return "".concat(id, "-item-").concat(position);
2527 }
2528
2529 var _excluded$e = ["activeIndex", "id", "isFocused", "isMenuShown", "multiple", "onClick", "onFocus", "placeholder"];
2530 var getInputProps = function getInputProps(_ref) {
2531 var activeIndex = _ref.activeIndex,
2532 id = _ref.id,
2533 isFocused = _ref.isFocused,
2534 isMenuShown = _ref.isMenuShown,
2535 multiple = _ref.multiple,
2536 onClick = _ref.onClick,
2537 onFocus = _ref.onFocus,
2538 placeholder = _ref.placeholder,
2539 props = _objectWithoutProperties(_ref, _excluded$e);
2540 return function () {
2541 var _cx;
2542 var inputProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2543 var className = hasOwnProperty(inputProps, 'className') ? String(inputProps.className) : undefined;
2544 return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
2545 // These props can be overridden by values in `inputProps`.
2546 autoComplete: 'off',
2547 placeholder: placeholder,
2548 type: 'text'
2549 }, inputProps), props), {}, {
2550 'aria-activedescendant': activeIndex >= 0 ? getMenuItemId(id, activeIndex) : undefined,
2551 'aria-autocomplete': 'both',
2552 'aria-expanded': isMenuShown,
2553 'aria-haspopup': 'listbox',
2554 'aria-multiselectable': multiple || undefined,
2555 'aria-owns': isMenuShown ? id : undefined,
2556 className: cx((_cx = {}, _defineProperty(_cx, className || '', !multiple), _defineProperty(_cx, "focus", isFocused), _cx))
2557 }, multiple && {
2558 inputClassName: className
2559 }), {}, {
2560 onClick: onClick,
2561 onFocus: onFocus,
2562 role: 'combobox'
2563 });
2564 };
2565 };
2566
2567 function getInputText(props) {
2568 var activeItem = props.activeItem,
2569 labelKey = props.labelKey,
2570 multiple = props.multiple,
2571 selected = props.selected,
2572 text = props.text;
2573 if (activeItem) {
2574 // Display the input value if the pagination item is active.
2575 return getOptionLabel(activeItem, labelKey);
2576 }
2577 if (!multiple && selected.length && selected[0]) {
2578 return getOptionLabel(selected[0], labelKey);
2579 }
2580 return text;
2581 }
2582
2583 function getIsOnlyResult(props) {
2584 var allowNew = props.allowNew,
2585 highlightOnlyResult = props.highlightOnlyResult,
2586 results = props.results;
2587 if (!highlightOnlyResult || allowNew) {
2588 return false;
2589 }
2590 return results.length === 1 && !getOptionProperty(results[0], 'disabled');
2591 }
2592
2593 /**
2594 * Truncates the result set based on `maxResults` and returns the new set.
2595 */
2596 function getTruncatedOptions(options, maxResults) {
2597 if (!maxResults || maxResults >= options.length) {
2598 return options;
2599 }
2600 return options.slice(0, maxResults);
2601 }
2602
2603 function isDisabledOption(index, items) {
2604 var option = items[index];
2605 return !!option && !!getOptionProperty(option, 'disabled');
2606 }
2607 function skipDisabledOptions(currentIndex, key, items) {
2608 var newIndex = currentIndex;
2609 while (isDisabledOption(newIndex, items)) {
2610 newIndex += key === 'ArrowUp' ? -1 : 1;
2611 }
2612 return newIndex;
2613 }
2614 function getUpdatedActiveIndex(currentIndex, key, items) {
2615 var newIndex = currentIndex;
2616
2617 // Increment or decrement index based on user keystroke.
2618 newIndex += key === 'ArrowUp' ? -1 : 1;
2619
2620 // Skip over any disabled options.
2621 newIndex = skipDisabledOptions(newIndex, key, items);
2622
2623 // If we've reached the end, go back to the beginning or vice-versa.
2624 if (newIndex === items.length) {
2625 newIndex = -1;
2626 } else if (newIndex === -2) {
2627 newIndex = items.length - 1;
2628
2629 // Skip over any disabled options.
2630 newIndex = skipDisabledOptions(newIndex, key, items);
2631 }
2632 return newIndex;
2633 }
2634
2635 function isShown(_ref) {
2636 var open = _ref.open,
2637 minLength = _ref.minLength,
2638 showMenu = _ref.showMenu,
2639 text = _ref.text;
2640 // If menu visibility is controlled via props, that value takes precedence.
2641 if (open || open === false) {
2642 return open;
2643 }
2644 if (text.length < minLength) {
2645 return false;
2646 }
2647 return showMenu;
2648 }
2649
2650 /**
2651 * Prevent the main input from blurring when a menu item or the clear button is
2652 * clicked. (#226 & #310)
2653 */
2654 function preventInputBlur(e) {
2655 e.preventDefault();
2656 }
2657
2658 function isSizeLarge(size) {
2659 return size === 'lg';
2660 }
2661 function isSizeSmall(size) {
2662 return size === 'sm';
2663 }
2664
2665 var _excluded$d = ["className", "isInvalid", "isValid", "size"];
2666 /**
2667 * Returns Bootstrap classnames from `size` and validation props, along
2668 * with pass-through props.
2669 */
2670 function propsWithBsClassName(_ref) {
2671 var className = _ref.className,
2672 isInvalid = _ref.isInvalid,
2673 isValid = _ref.isValid,
2674 size = _ref.size,
2675 props = _objectWithoutProperties(_ref, _excluded$d);
2676 return _objectSpread2(_objectSpread2({}, props), {}, {
2677 className: cx('form-control', 'rbt-input', {
2678 'form-control-lg': isSizeLarge(size),
2679 'form-control-sm': isSizeSmall(size),
2680 'is-invalid': isInvalid,
2681 'is-valid': isValid
2682 }, className)
2683 });
2684 }
2685
2686 function validateSelectedPropChange(prevSelected, selected) {
2687 var uncontrolledToControlled = !prevSelected && selected;
2688 var controlledToUncontrolled = prevSelected && !selected;
2689 var from, to, precedent;
2690 if (uncontrolledToControlled) {
2691 from = 'uncontrolled';
2692 to = 'controlled';
2693 precedent = 'an';
2694 } else {
2695 from = 'controlled';
2696 to = 'uncontrolled';
2697 precedent = 'a';
2698 }
2699 var message = "You are changing ".concat(precedent, " ").concat(from, " typeahead to be ").concat(to, ". ") + "Input elements should not switch from ".concat(from, " to ").concat(to, " (or vice versa). ") + 'Decide between using a controlled or uncontrolled element for the ' + 'lifetime of the component.';
2700 warn(!(uncontrolledToControlled || controlledToUncontrolled), message);
2701 }
2702
2703 var INPUT_PROPS_BLACKLIST = [{
2704 alt: 'onBlur',
2705 prop: 'onBlur'
2706 }, {
2707 alt: 'onInputChange',
2708 prop: 'onChange'
2709 }, {
2710 alt: 'onFocus',
2711 prop: 'onFocus'
2712 }, {
2713 alt: 'onKeyDown',
2714 prop: 'onKeyDown'
2715 }];
2716 var sizeType = propTypes$b.exports.oneOf(SIZES);
2717 /**
2718 * Allows additional warnings or messaging related to prop validation.
2719 */
2720 function checkPropType(validator, callback) {
2721 return function (props, propName, componentName) {
2722 propTypes$b.exports.checkPropTypes(_defineProperty({}, propName, validator), props, 'prop', componentName);
2723 isFunction(callback) && callback(props, propName, componentName);
2724 };
2725 }
2726 function caseSensitiveType(props) {
2727 var caseSensitive = props.caseSensitive,
2728 filterBy = props.filterBy;
2729 warn(!caseSensitive || typeof filterBy !== 'function', 'Your `filterBy` function will override the `caseSensitive` prop.');
2730 }
2731 function defaultInputValueType(props) {
2732 var defaultInputValue = props.defaultInputValue,
2733 defaultSelected = props.defaultSelected,
2734 multiple = props.multiple,
2735 selected = props.selected;
2736 var name = defaultSelected.length ? 'defaultSelected' : 'selected';
2737 warn(!(!multiple && defaultInputValue && (defaultSelected.length || selected && selected.length)), "`defaultInputValue` will be overridden by the value from `".concat(name, "`."));
2738 }
2739 function defaultSelectedType(props) {
2740 var defaultSelected = props.defaultSelected,
2741 multiple = props.multiple;
2742 warn(multiple || defaultSelected.length <= 1, 'You are passing multiple options to the `defaultSelected` prop of a ' + 'Typeahead in single-select mode. The selections will be truncated to a ' + 'single selection.');
2743 }
2744 function highlightOnlyResultType(_ref) {
2745 var allowNew = _ref.allowNew,
2746 highlightOnlyResult = _ref.highlightOnlyResult;
2747 warn(!(highlightOnlyResult && allowNew), '`highlightOnlyResult` will not work with `allowNew`.');
2748 }
2749 function ignoreDiacriticsType(props) {
2750 var filterBy = props.filterBy,
2751 ignoreDiacritics = props.ignoreDiacritics;
2752 warn(ignoreDiacritics || typeof filterBy !== 'function', 'Your `filterBy` function will override the `ignoreDiacritics` prop.');
2753 }
2754 function inputPropsType(_ref2) {
2755 var inputProps = _ref2.inputProps;
2756 if (!(inputProps && Object.prototype.toString.call(inputProps) === '[object Object]')) {
2757 return;
2758 }
2759
2760 // Blacklisted properties.
2761 INPUT_PROPS_BLACKLIST.forEach(function (_ref3) {
2762 var alt = _ref3.alt,
2763 prop = _ref3.prop;
2764 var msg = alt ? " Use the top-level `".concat(alt, "` prop instead.") : null;
2765 warn(!inputProps[prop], "The `".concat(prop, "` property of `inputProps` will be ignored.").concat(msg));
2766 });
2767 }
2768 function isRequiredForA11y(props, propName, componentName) {
2769 warn(props[propName] != null, "The prop `".concat(propName, "` is required to make `").concat(componentName, "` ") + 'accessible for users of assistive technologies such as screen readers.');
2770 }
2771 function labelKeyType(_ref4) {
2772 var allowNew = _ref4.allowNew,
2773 labelKey = _ref4.labelKey;
2774 warn(!(isFunction(labelKey) && allowNew), '`labelKey` must be a string when `allowNew={true}`.');
2775 }
2776 var optionType = propTypes$b.exports.oneOfType([propTypes$b.exports.object, propTypes$b.exports.string]);
2777 function selectedType(_ref5) {
2778 var multiple = _ref5.multiple,
2779 onChange = _ref5.onChange,
2780 selected = _ref5.selected;
2781 warn(multiple || !selected || selected.length <= 1, 'You are passing multiple options to the `selected` prop of a Typeahead ' + 'in single-select mode. This may lead to unexpected behaviors or errors.');
2782 warn(!selected || selected && isFunction(onChange), 'You provided a `selected` prop without an `onChange` handler. If you ' + 'want the typeahead to be uncontrolled, use `defaultSelected`. ' + 'Otherwise, set `onChange`.');
2783 }
2784
2785 var _excluded$c = ["allowNew", "delay", "emptyLabel", "isLoading", "minLength", "onInputChange", "onSearch", "options", "promptText", "searchText", "useCache"];
2786 var propTypes$a = {
2787 /**
2788 * Delay, in milliseconds, before performing search.
2789 */
2790 delay: propTypes$b.exports.number,
2791 /**
2792 * Whether or not a request is currently pending. Necessary for the
2793 * container to know when new results are available.
2794 */
2795 isLoading: propTypes$b.exports.bool.isRequired,
2796 /**
2797 * Number of input characters that must be entered before showing results.
2798 */
2799 minLength: propTypes$b.exports.number,
2800 /**
2801 * Callback to perform when the search is executed.
2802 */
2803 onSearch: propTypes$b.exports.func.isRequired,
2804 /**
2805 * Options to be passed to the typeahead. Will typically be the query
2806 * results, but can also be initial default options.
2807 */
2808 options: propTypes$b.exports.arrayOf(optionType),
2809 /**
2810 * Message displayed in the menu when there is no user input.
2811 */
2812 promptText: propTypes$b.exports.node,
2813 /**
2814 * Message displayed in the menu while the request is pending.
2815 */
2816 searchText: propTypes$b.exports.node,
2817 /**
2818 * Whether or not the component should cache query results.
2819 */
2820 useCache: propTypes$b.exports.bool
2821 };
2822 /**
2823 * Logic that encapsulates common behavior and functionality around
2824 * asynchronous searches, including:
2825 *
2826 * - Debouncing user input
2827 * - Optional query caching
2828 * - Search prompt and empty results behaviors
2829 */
2830 function useAsync(props) {
2831 var allowNew = props.allowNew,
2832 _props$delay = props.delay,
2833 delay = _props$delay === void 0 ? 200 : _props$delay,
2834 emptyLabel = props.emptyLabel,
2835 isLoading = props.isLoading,
2836 _props$minLength = props.minLength,
2837 minLength = _props$minLength === void 0 ? 2 : _props$minLength,
2838 onInputChange = props.onInputChange,
2839 onSearch = props.onSearch,
2840 _props$options = props.options,
2841 options = _props$options === void 0 ? [] : _props$options,
2842 _props$promptText = props.promptText,
2843 promptText = _props$promptText === void 0 ? 'Type to search...' : _props$promptText,
2844 _props$searchText = props.searchText,
2845 searchText = _props$searchText === void 0 ? 'Searching...' : _props$searchText,
2846 _props$useCache = props.useCache,
2847 useCache = _props$useCache === void 0 ? true : _props$useCache,
2848 otherProps = _objectWithoutProperties(props, _excluded$c);
2849 var cacheRef = React.useRef({});
2850 var handleSearchDebouncedRef = React.useRef(null);
2851 var queryRef = React.useRef(props.defaultInputValue || '');
2852 var forceUpdate = useForceUpdate();
2853 var prevProps = usePrevious(props);
2854 var handleSearch = React.useCallback(function (query) {
2855 queryRef.current = query;
2856 if (!query || minLength && query.length < minLength) {
2857 return;
2858 }
2859
2860 // Use cached results, if applicable.
2861 if (useCache && cacheRef.current[query]) {
2862 // Re-render the component with the cached results.
2863 forceUpdate();
2864 return;
2865 }
2866
2867 // Perform the search.
2868 onSearch(query);
2869 }, [forceUpdate, minLength, onSearch, useCache]);
2870
2871 // Set the debounced search function.
2872 React.useEffect(function () {
2873 handleSearchDebouncedRef.current = lodash_debounce(handleSearch, delay);
2874 return function () {
2875 handleSearchDebouncedRef.current && handleSearchDebouncedRef.current.cancel();
2876 };
2877 }, [delay, handleSearch]);
2878 React.useEffect(function () {
2879 // Ensure that we've gone from a loading to a completed state. Otherwise
2880 // an empty response could get cached if the component updates during the
2881 // request (eg: if the parent re-renders for some reason).
2882 if (!isLoading && prevProps && prevProps.isLoading && useCache) {
2883 cacheRef.current[queryRef.current] = options;
2884 }
2885 });
2886 var getEmptyLabel = function getEmptyLabel() {
2887 if (!queryRef.current.length) {
2888 return promptText;
2889 }
2890 if (isLoading) {
2891 return searchText;
2892 }
2893 return emptyLabel;
2894 };
2895 var handleInputChange = React.useCallback(function (query, e) {
2896 onInputChange && onInputChange(query, e);
2897 handleSearchDebouncedRef.current && handleSearchDebouncedRef.current(query);
2898 }, [onInputChange]);
2899 var cachedQuery = cacheRef.current[queryRef.current];
2900 return _objectSpread2(_objectSpread2({}, otherProps), {}, {
2901 // Disable custom selections during a search if `allowNew` isn't a function.
2902 allowNew: isFunction(allowNew) ? allowNew : allowNew && !isLoading,
2903 emptyLabel: getEmptyLabel(),
2904 isLoading: isLoading,
2905 minLength: minLength,
2906 onInputChange: handleInputChange,
2907 options: useCache && cachedQuery ? cachedQuery : options
2908 });
2909 }
2910
2911 /* istanbul ignore next */
2912 function withAsync(Component) {
2913 warn(false, 'Warning: `withAsync` is deprecated and will be removed in the next ' + 'major version. Use `useAsync` instead.');
2914 var AsyncTypeahead = /*#__PURE__*/React.forwardRef(function (props, ref) {
2915 return /*#__PURE__*/React__default["default"].createElement(Component, _extends({}, props, useAsync(props), {
2916 ref: ref
2917 }));
2918 });
2919 AsyncTypeahead.displayName = "withAsync(".concat(getDisplayName(Component), ")");
2920 // @ts-ignore
2921 AsyncTypeahead.propTypes = propTypes$a;
2922 return AsyncTypeahead;
2923 }
2924
2925 var defaultContext = {
2926 activeIndex: -1,
2927 hintText: '',
2928 id: '',
2929 initialItem: null,
2930 inputNode: null,
2931 isOnlyResult: false,
2932 onActiveItemChange: noop$1,
2933 onAdd: noop$1,
2934 onInitialItemChange: noop$1,
2935 onMenuItemClick: noop$1,
2936 setItem: noop$1
2937 };
2938 var TypeaheadContext = /*#__PURE__*/React.createContext(defaultContext);
2939 var useTypeaheadContext = function useTypeaheadContext() {
2940 return React.useContext(TypeaheadContext);
2941 };
2942
2943 var inputPropKeys = ['activeIndex', 'disabled', 'id', 'inputRef', 'isFocused', 'isMenuShown', 'multiple', 'onBlur', 'onChange', 'onClick', 'onFocus', 'onKeyDown', 'placeholder'];
2944 var propKeys = ['activeIndex', 'hideMenu', 'isMenuShown', 'labelKey', 'onClear', 'onHide', 'onRemove', 'results', 'selected', 'text', 'toggleMenu'];
2945 var contextKeys = ['activeIndex', 'id', 'initialItem', 'inputNode', 'onActiveItemChange', 'onAdd', 'onInitialItemChange', 'onMenuItemClick', 'setItem'];
2946 var TypeaheadManager = function TypeaheadManager(props) {
2947 var allowNew = props.allowNew,
2948 children = props.children,
2949 initialItem = props.initialItem,
2950 isMenuShown = props.isMenuShown,
2951 onAdd = props.onAdd,
2952 onInitialItemChange = props.onInitialItemChange,
2953 onKeyDown = props.onKeyDown,
2954 onMenuToggle = props.onMenuToggle,
2955 results = props.results,
2956 selectHint = props.selectHint;
2957 var hintText = getHintText(props);
2958 React.useEffect(function () {
2959 // Clear the initial item when there are no results.
2960 if (!(allowNew || results.length)) {
2961 onInitialItemChange();
2962 }
2963 });
2964 var isInitialRender = React.useRef(true);
2965 React.useEffect(function () {
2966 if (isInitialRender.current) {
2967 isInitialRender.current = false;
2968 return;
2969 }
2970 onMenuToggle(isMenuShown);
2971 }, [isMenuShown, onMenuToggle]);
2972 var handleKeyDown = function handleKeyDown(e) {
2973 onKeyDown(e);
2974 if (!initialItem) {
2975 return;
2976 }
2977 var addOnlyResult = e.key === 'Enter' && getIsOnlyResult(props);
2978 var shouldSelectHint = hintText && defaultSelectHint(e, selectHint);
2979 if (addOnlyResult || shouldSelectHint) {
2980 onAdd(initialItem);
2981 }
2982 };
2983 var childProps = _objectSpread2(_objectSpread2({}, pick(props, propKeys)), {}, {
2984 getInputProps: getInputProps(_objectSpread2(_objectSpread2({}, pick(props, inputPropKeys)), {}, {
2985 onKeyDown: handleKeyDown,
2986 value: getInputText(props)
2987 }))
2988 });
2989 var contextValue = _objectSpread2(_objectSpread2({}, pick(props, contextKeys)), {}, {
2990 hintText: hintText,
2991 isOnlyResult: getIsOnlyResult(props)
2992 });
2993 return /*#__PURE__*/React__default["default"].createElement(TypeaheadContext.Provider, {
2994 value: contextValue
2995 }, isFunction(children) ? children(childProps) : children);
2996 };
2997
2998 function getInitialState(props) {
2999 var defaultInputValue = props.defaultInputValue,
3000 defaultOpen = props.defaultOpen,
3001 defaultSelected = props.defaultSelected,
3002 maxResults = props.maxResults,
3003 multiple = props.multiple;
3004 var selected = props.selected ? props.selected.slice() : defaultSelected.slice();
3005 var text = defaultInputValue;
3006 if (!multiple && selected.length) {
3007 // Set the text if an initial selection is passed in.
3008 text = getOptionLabel(selected[0], props.labelKey);
3009 if (selected.length > 1) {
3010 // Limit to 1 selection in single-select mode.
3011 selected = selected.slice(0, 1);
3012 }
3013 }
3014 return {
3015 activeIndex: -1,
3016 activeItem: undefined,
3017 initialItem: undefined,
3018 isFocused: false,
3019 selected: selected,
3020 showMenu: defaultOpen,
3021 shownResults: maxResults,
3022 text: text
3023 };
3024 }
3025 function clearTypeahead(state, props) {
3026 return _objectSpread2(_objectSpread2({}, getInitialState(props)), {}, {
3027 isFocused: state.isFocused,
3028 selected: [],
3029 text: ''
3030 });
3031 }
3032 function clickOrFocusInput(state) {
3033 return _objectSpread2(_objectSpread2({}, state), {}, {
3034 isFocused: true,
3035 showMenu: true
3036 });
3037 }
3038 function hideMenu(state, props) {
3039 var _getInitialState = getInitialState(props),
3040 activeIndex = _getInitialState.activeIndex,
3041 activeItem = _getInitialState.activeItem,
3042 initialItem = _getInitialState.initialItem,
3043 shownResults = _getInitialState.shownResults;
3044 return _objectSpread2(_objectSpread2({}, state), {}, {
3045 activeIndex: activeIndex,
3046 activeItem: activeItem,
3047 initialItem: initialItem,
3048 showMenu: false,
3049 shownResults: shownResults
3050 });
3051 }
3052 function toggleMenu(state, props) {
3053 return state.showMenu ? hideMenu(state, props) : _objectSpread2(_objectSpread2({}, state), {}, {
3054 showMenu: true
3055 });
3056 }
3057
3058 var _excluded$b = ["onChange"];
3059 var propTypes$9 = {
3060 /**
3061 * Allows the creation of new selections on the fly. Note that any new items
3062 * will be added to the list of selections, but not the list of original
3063 * options unless handled as such by `Typeahead`'s parent.
3064 *
3065 * If a function is specified, it will be used to determine whether a custom
3066 * option should be included. The return value should be true or false.
3067 */
3068 allowNew: propTypes$b.exports.oneOfType([propTypes$b.exports.bool, propTypes$b.exports.func]),
3069 /**
3070 * Autofocus the input when the component initially mounts.
3071 */
3072 autoFocus: propTypes$b.exports.bool,
3073 /**
3074 * Whether or not filtering should be case-sensitive.
3075 */
3076 caseSensitive: checkPropType(propTypes$b.exports.bool, caseSensitiveType),
3077 /**
3078 * The initial value displayed in the text input.
3079 */
3080 defaultInputValue: checkPropType(propTypes$b.exports.string, defaultInputValueType),
3081 /**
3082 * Whether or not the menu is displayed upon initial render.
3083 */
3084 defaultOpen: propTypes$b.exports.bool,
3085 /**
3086 * Specify any pre-selected options. Use only if you want the component to
3087 * be uncontrolled.
3088 */
3089 defaultSelected: checkPropType(propTypes$b.exports.arrayOf(optionType), defaultSelectedType),
3090 /**
3091 * Either an array of fields in `option` to search, or a custom filtering
3092 * callback.
3093 */
3094 filterBy: propTypes$b.exports.oneOfType([propTypes$b.exports.arrayOf(propTypes$b.exports.string.isRequired), propTypes$b.exports.func]),
3095 /**
3096 * Highlights the menu item if there is only one result and allows selecting
3097 * that item by hitting enter. Does not work with `allowNew`.
3098 */
3099 highlightOnlyResult: checkPropType(propTypes$b.exports.bool, highlightOnlyResultType),
3100 /**
3101 * An html id attribute, required for assistive technologies such as screen
3102 * readers.
3103 */
3104 id: checkPropType(propTypes$b.exports.oneOfType([propTypes$b.exports.number, propTypes$b.exports.string]), isRequiredForA11y),
3105 /**
3106 * Whether the filter should ignore accents and other diacritical marks.
3107 */
3108 ignoreDiacritics: checkPropType(propTypes$b.exports.bool, ignoreDiacriticsType),
3109 /**
3110 * Specify the option key to use for display or a function returning the
3111 * display string. By default, the selector will use the `label` key.
3112 */
3113 labelKey: checkPropType(propTypes$b.exports.oneOfType([propTypes$b.exports.string, propTypes$b.exports.func]), labelKeyType),
3114 /**
3115 * Maximum number of results to display by default. Mostly done for
3116 * performance reasons so as not to render too many DOM nodes in the case of
3117 * large data sets.
3118 */
3119 maxResults: propTypes$b.exports.number,
3120 /**
3121 * Number of input characters that must be entered before showing results.
3122 */
3123 minLength: propTypes$b.exports.number,
3124 /**
3125 * Whether or not multiple selections are allowed.
3126 */
3127 multiple: propTypes$b.exports.bool,
3128 /**
3129 * Invoked when the input is blurred. Receives an event.
3130 */
3131 onBlur: propTypes$b.exports.func,
3132 /**
3133 * Invoked whenever items are added or removed. Receives an array of the
3134 * selected options.
3135 */
3136 onChange: propTypes$b.exports.func,
3137 /**
3138 * Invoked when the input is focused. Receives an event.
3139 */
3140 onFocus: propTypes$b.exports.func,
3141 /**
3142 * Invoked when the input value changes. Receives the string value of the
3143 * input.
3144 */
3145 onInputChange: propTypes$b.exports.func,
3146 /**
3147 * Invoked when a key is pressed. Receives an event.
3148 */
3149 onKeyDown: propTypes$b.exports.func,
3150 /**
3151 * Invoked when menu visibility changes.
3152 */
3153 onMenuToggle: propTypes$b.exports.func,
3154 /**
3155 * Invoked when the pagination menu item is clicked. Receives an event.
3156 */
3157 onPaginate: propTypes$b.exports.func,
3158 /**
3159 * Whether or not the menu should be displayed. `undefined` allows the
3160 * component to control visibility, while `true` and `false` show and hide
3161 * the menu, respectively.
3162 */
3163 open: propTypes$b.exports.bool,
3164 /**
3165 * Full set of options, including pre-selected options. Must either be an
3166 * array of objects (recommended) or strings.
3167 */
3168 options: propTypes$b.exports.arrayOf(optionType).isRequired,
3169 /**
3170 * Give user the ability to display additional results if the number of
3171 * results exceeds `maxResults`.
3172 */
3173 paginate: propTypes$b.exports.bool,
3174 /**
3175 * The selected option(s) displayed in the input. Use this prop if you want
3176 * to control the component via its parent.
3177 */
3178 selected: checkPropType(propTypes$b.exports.arrayOf(optionType), selectedType)
3179 };
3180 var defaultProps$1 = {
3181 allowNew: false,
3182 autoFocus: false,
3183 caseSensitive: false,
3184 defaultInputValue: '',
3185 defaultOpen: false,
3186 defaultSelected: [],
3187 filterBy: [],
3188 highlightOnlyResult: false,
3189 ignoreDiacritics: true,
3190 labelKey: DEFAULT_LABELKEY,
3191 maxResults: 100,
3192 minLength: 0,
3193 multiple: false,
3194 onBlur: noop$1,
3195 onFocus: noop$1,
3196 onInputChange: noop$1,
3197 onKeyDown: noop$1,
3198 onMenuToggle: noop$1,
3199 onPaginate: noop$1,
3200 paginate: true
3201 };
3202 /**
3203 * Manually trigger the input's change event.
3204 * https://stackoverflow.com/questions/23892547/what-is-the-best-way-to-trigger-onchange-event-in-react-js/46012210#46012210
3205 */
3206 function triggerInputChange(input, value) {
3207 var inputValue = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value');
3208 inputValue && inputValue.set && inputValue.set.call(input, value);
3209 var e = new Event('input', {
3210 bubbles: true
3211 });
3212 input.dispatchEvent(e);
3213 }
3214 var Typeahead = /*#__PURE__*/function (_React$Component) {
3215 _inherits(Typeahead, _React$Component);
3216 var _super = _createSuper(Typeahead);
3217 function Typeahead() {
3218 var _this;
3219 _classCallCheck(this, Typeahead);
3220 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3221 args[_key] = arguments[_key];
3222 }
3223 _this = _super.call.apply(_super, [this].concat(args));
3224 _defineProperty(_assertThisInitialized(_this), "state", getInitialState(_this.props));
3225 _defineProperty(_assertThisInitialized(_this), "inputNode", null);
3226 _defineProperty(_assertThisInitialized(_this), "isMenuShown", false);
3227 // Keeps track of actual items displayed in the menu, after sorting,
3228 // truncating, grouping, etc.
3229 _defineProperty(_assertThisInitialized(_this), "items", []);
3230 _defineProperty(_assertThisInitialized(_this), "blur", function () {
3231 _this.inputNode && _this.inputNode.blur();
3232 _this.hideMenu();
3233 });
3234 _defineProperty(_assertThisInitialized(_this), "clear", function () {
3235 _this.setState(clearTypeahead);
3236 });
3237 _defineProperty(_assertThisInitialized(_this), "focus", function () {
3238 _this.inputNode && _this.inputNode.focus();
3239 });
3240 _defineProperty(_assertThisInitialized(_this), "getInput", function () {
3241 return _this.inputNode;
3242 });
3243 _defineProperty(_assertThisInitialized(_this), "inputRef", function (inputNode) {
3244 _this.inputNode = inputNode;
3245 });
3246 _defineProperty(_assertThisInitialized(_this), "setItem", function (item, position) {
3247 _this.items[position] = item;
3248 });
3249 _defineProperty(_assertThisInitialized(_this), "hideMenu", function () {
3250 _this.setState(hideMenu);
3251 });
3252 _defineProperty(_assertThisInitialized(_this), "toggleMenu", function () {
3253 _this.setState(toggleMenu);
3254 });
3255 _defineProperty(_assertThisInitialized(_this), "_handleActiveIndexChange", function (activeIndex) {
3256 _this.setState(function (state) {
3257 return {
3258 activeIndex: activeIndex,
3259 activeItem: activeIndex >= 0 ? state.activeItem : undefined
3260 };
3261 });
3262 });
3263 _defineProperty(_assertThisInitialized(_this), "_handleActiveItemChange", function (activeItem) {
3264 // Don't update the active item if it hasn't changed.
3265 if (!fastDeepEqual(activeItem, _this.state.activeItem)) {
3266 _this.setState({
3267 activeItem: activeItem
3268 });
3269 }
3270 });
3271 _defineProperty(_assertThisInitialized(_this), "_handleBlur", function (e) {
3272 e.persist();
3273 _this.setState({
3274 isFocused: false
3275 }, function () {
3276 return _this.props.onBlur(e);
3277 });
3278 });
3279 _defineProperty(_assertThisInitialized(_this), "_handleChange", function (selected) {
3280 _this.props.onChange && _this.props.onChange(selected);
3281 });
3282 _defineProperty(_assertThisInitialized(_this), "_handleClear", function () {
3283 _this.inputNode && triggerInputChange(_this.inputNode, '');
3284 _this.setState(clearTypeahead, function () {
3285 // Change handler is automatically triggered for single selections but
3286 // not multi-selections.
3287 if (_this.props.multiple) {
3288 _this._handleChange([]);
3289 }
3290 });
3291 });
3292 _defineProperty(_assertThisInitialized(_this), "_handleClick", function (e) {
3293 var _this$props$inputProp;
3294 e.persist();
3295 var onClick = (_this$props$inputProp = _this.props.inputProps) === null || _this$props$inputProp === void 0 ? void 0 : _this$props$inputProp.onClick;
3296 _this.setState(clickOrFocusInput, function () {
3297 return isFunction(onClick) && onClick(e);
3298 });
3299 });
3300 _defineProperty(_assertThisInitialized(_this), "_handleFocus", function (e) {
3301 e.persist();
3302 _this.setState(clickOrFocusInput, function () {
3303 return _this.props.onFocus(e);
3304 });
3305 });
3306 _defineProperty(_assertThisInitialized(_this), "_handleInitialItemChange", function (initialItem) {
3307 // Don't update the initial item if it hasn't changed.
3308 if (!fastDeepEqual(initialItem, _this.state.initialItem)) {
3309 _this.setState({
3310 initialItem: initialItem
3311 });
3312 }
3313 });
3314 _defineProperty(_assertThisInitialized(_this), "_handleInputChange", function (e) {
3315 e.persist();
3316 var text = e.currentTarget.value;
3317 var _this$props = _this.props,
3318 multiple = _this$props.multiple,
3319 onInputChange = _this$props.onInputChange;
3320
3321 // Clear selections when the input value changes in single-select mode.
3322 var shouldClearSelections = _this.state.selected.length && !multiple;
3323 _this.setState(function (state, props) {
3324 var _getInitialState = getInitialState(props),
3325 activeIndex = _getInitialState.activeIndex,
3326 activeItem = _getInitialState.activeItem,
3327 shownResults = _getInitialState.shownResults;
3328 return {
3329 activeIndex: activeIndex,
3330 activeItem: activeItem,
3331 selected: shouldClearSelections ? [] : state.selected,
3332 showMenu: true,
3333 shownResults: shownResults,
3334 text: text
3335 };
3336 }, function () {
3337 onInputChange(text, e);
3338 shouldClearSelections && _this._handleChange([]);
3339 });
3340 });
3341 _defineProperty(_assertThisInitialized(_this), "_handleKeyDown", function (e) {
3342 var activeItem = _this.state.activeItem;
3343
3344 // Skip most actions when the menu is hidden.
3345 if (!_this.isMenuShown) {
3346 if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
3347 _this.setState({
3348 showMenu: true
3349 });
3350 }
3351 _this.props.onKeyDown(e);
3352 return;
3353 }
3354 switch (e.key) {
3355 case 'ArrowUp':
3356 case 'ArrowDown':
3357 // Prevent input cursor from going to the beginning when pressing up.
3358 e.preventDefault();
3359 _this._handleActiveIndexChange(getUpdatedActiveIndex(_this.state.activeIndex, e.key, _this.items));
3360 break;
3361 case 'Enter':
3362 // Prevent form submission while menu is open.
3363 e.preventDefault();
3364 activeItem && _this._handleMenuItemSelect(activeItem, e);
3365 break;
3366 case 'Escape':
3367 case 'Tab':
3368 // ESC simply hides the menu. TAB will blur the input and move focus to
3369 // the next item; hide the menu so it doesn't gain focus.
3370 _this.hideMenu();
3371 break;
3372 }
3373 _this.props.onKeyDown(e);
3374 });
3375 _defineProperty(_assertThisInitialized(_this), "_handleMenuItemSelect", function (option, e) {
3376 if (getOptionProperty(option, 'paginationOption')) {
3377 _this._handlePaginate(e);
3378 } else {
3379 _this._handleSelectionAdd(option);
3380 }
3381 });
3382 _defineProperty(_assertThisInitialized(_this), "_handlePaginate", function (e) {
3383 e.persist();
3384 _this.setState(function (state, props) {
3385 return {
3386 shownResults: state.shownResults + props.maxResults
3387 };
3388 }, function () {
3389 return _this.props.onPaginate(e, _this.state.shownResults);
3390 });
3391 });
3392 _defineProperty(_assertThisInitialized(_this), "_handleSelectionAdd", function (option) {
3393 var _this$props2 = _this.props,
3394 multiple = _this$props2.multiple,
3395 labelKey = _this$props2.labelKey;
3396 var selected;
3397 var selection = option;
3398 var text;
3399
3400 // Add a unique id to the custom selection. Avoid doing this in `render` so
3401 // the id doesn't increment every time.
3402 if (!isString(selection) && selection.customOption) {
3403 selection = _objectSpread2(_objectSpread2({}, selection), {}, {
3404 id: uniqueId('new-id-')
3405 });
3406 }
3407 if (multiple) {
3408 // If multiple selections are allowed, add the new selection to the
3409 // existing selections.
3410 selected = _this.state.selected.concat(selection);
3411 text = '';
3412 } else {
3413 // If only a single selection is allowed, replace the existing selection
3414 // with the new one.
3415 selected = [selection];
3416 text = getOptionLabel(selection, labelKey);
3417 }
3418 _this.setState(function (state, props) {
3419 return _objectSpread2(_objectSpread2({}, hideMenu(state, props)), {}, {
3420 initialItem: selection,
3421 selected: selected,
3422 text: text
3423 });
3424 }, function () {
3425 return _this._handleChange(selected);
3426 });
3427 });
3428 _defineProperty(_assertThisInitialized(_this), "_handleSelectionRemove", function (selection) {
3429 var selected = _this.state.selected.filter(function (option) {
3430 return !fastDeepEqual(option, selection);
3431 });
3432
3433 // Make sure the input stays focused after the item is removed.
3434 _this.focus();
3435 _this.setState(function (state, props) {
3436 return _objectSpread2(_objectSpread2({}, hideMenu(state, props)), {}, {
3437 selected: selected
3438 });
3439 }, function () {
3440 return _this._handleChange(selected);
3441 });
3442 });
3443 return _this;
3444 }
3445 _createClass(Typeahead, [{
3446 key: "componentDidMount",
3447 value: function componentDidMount() {
3448 this.props.autoFocus && this.focus();
3449 }
3450 }, {
3451 key: "componentDidUpdate",
3452 value: function componentDidUpdate(prevProps, prevState) {
3453 var _this$props3 = this.props,
3454 labelKey = _this$props3.labelKey,
3455 multiple = _this$props3.multiple,
3456 selected = _this$props3.selected;
3457 validateSelectedPropChange(selected, prevProps.selected);
3458
3459 // Sync selections in state with those in props.
3460 if (selected && !fastDeepEqual(selected, prevState.selected)) {
3461 this.setState({
3462 selected: selected
3463 });
3464 if (!multiple) {
3465 this.setState({
3466 text: selected.length ? getOptionLabel(selected[0], labelKey) : ''
3467 });
3468 }
3469 }
3470 }
3471 }, {
3472 key: "render",
3473 value: function render() {
3474 var _this$props4 = this.props;
3475 _this$props4.onChange;
3476 var props = _objectWithoutProperties(_this$props4, _excluded$b);
3477 var mergedPropsAndState = _objectSpread2(_objectSpread2({}, props), this.state);
3478 var filterBy = mergedPropsAndState.filterBy,
3479 labelKey = mergedPropsAndState.labelKey,
3480 options = mergedPropsAndState.options,
3481 paginate = mergedPropsAndState.paginate,
3482 shownResults = mergedPropsAndState.shownResults,
3483 text = mergedPropsAndState.text;
3484 this.isMenuShown = isShown(mergedPropsAndState);
3485 this.items = []; // Reset items on re-render.
3486
3487 var results = [];
3488 if (this.isMenuShown) {
3489 var cb = isFunction(filterBy) ? filterBy : defaultFilterBy;
3490 results = options.filter(function (option) {
3491 return cb(option, mergedPropsAndState);
3492 });
3493
3494 // This must come before results are truncated.
3495 var shouldPaginate = paginate && results.length > shownResults;
3496
3497 // Truncate results if necessary.
3498 results = getTruncatedOptions(results, shownResults);
3499
3500 // Add the custom option if necessary.
3501 if (addCustomOption(results, mergedPropsAndState)) {
3502 results.push(_defineProperty({
3503 customOption: true
3504 }, getStringLabelKey(labelKey), text));
3505 }
3506
3507 // Add the pagination item if necessary.
3508 if (shouldPaginate) {
3509 var _results$push2;
3510 results.push((_results$push2 = {}, _defineProperty(_results$push2, getStringLabelKey(labelKey), ''), _defineProperty(_results$push2, "paginationOption", true), _results$push2));
3511 }
3512 }
3513 return /*#__PURE__*/React__default["default"].createElement(TypeaheadManager, _extends({}, mergedPropsAndState, {
3514 hideMenu: this.hideMenu,
3515 inputNode: this.inputNode,
3516 inputRef: this.inputRef,
3517 isMenuShown: this.isMenuShown,
3518 onActiveItemChange: this._handleActiveItemChange,
3519 onAdd: this._handleSelectionAdd,
3520 onBlur: this._handleBlur,
3521 onChange: this._handleInputChange,
3522 onClear: this._handleClear,
3523 onClick: this._handleClick,
3524 onFocus: this._handleFocus,
3525 onHide: this.hideMenu,
3526 onInitialItemChange: this._handleInitialItemChange,
3527 onKeyDown: this._handleKeyDown,
3528 onMenuItemClick: this._handleMenuItemSelect,
3529 onRemove: this._handleSelectionRemove,
3530 results: results,
3531 setItem: this.setItem,
3532 toggleMenu: this.toggleMenu
3533 }));
3534 }
3535 }]);
3536 return Typeahead;
3537 }(React__default["default"].Component);
3538 _defineProperty(Typeahead, "propTypes", propTypes$9);
3539 _defineProperty(Typeahead, "defaultProps", defaultProps$1);
3540
3541 var _excluded$a = ["className", "label", "onClick", "onKeyDown", "size"];
3542 var propTypes$8 = {
3543 label: propTypes$b.exports.string,
3544 onClick: propTypes$b.exports.func,
3545 onKeyDown: propTypes$b.exports.func,
3546 size: sizeType
3547 };
3548 /**
3549 * ClearButton
3550 *
3551 * http://getbootstrap.com/css/#helper-classes-close
3552 */
3553 var ClearButton = function ClearButton(_ref) {
3554 var className = _ref.className,
3555 _ref$label = _ref.label,
3556 label = _ref$label === void 0 ? 'Clear' : _ref$label,
3557 _onClick = _ref.onClick,
3558 _onKeyDown = _ref.onKeyDown,
3559 size = _ref.size,
3560 props = _objectWithoutProperties(_ref, _excluded$a);
3561 return /*#__PURE__*/React__default["default"].createElement("button", _extends({}, props, {
3562 "aria-label": label,
3563 className: cx('close', 'btn-close', 'rbt-close', {
3564 'rbt-close-lg': isSizeLarge(size),
3565 'rbt-close-sm': isSizeSmall(size)
3566 }, className),
3567 onClick: function onClick(e) {
3568 e.stopPropagation();
3569 _onClick && _onClick(e);
3570 },
3571 onKeyDown: function onKeyDown(e) {
3572 // Prevent browser from navigating back.
3573 if (e.key === 'Backspace') {
3574 e.preventDefault();
3575 }
3576 _onKeyDown && _onKeyDown(e);
3577 },
3578 type: "button"
3579 }), /*#__PURE__*/React__default["default"].createElement("span", {
3580 "aria-hidden": "true",
3581 className: "rbt-close-content"
3582 }, "\xD7"), /*#__PURE__*/React__default["default"].createElement("span", {
3583 className: "sr-only visually-hidden"
3584 }, label));
3585 };
3586 ClearButton.propTypes = propTypes$8;
3587
3588 var propTypes$7 = {
3589 label: propTypes$b.exports.string
3590 };
3591 var Loader = function Loader(_ref) {
3592 var _ref$label = _ref.label,
3593 label = _ref$label === void 0 ? 'Loading...' : _ref$label;
3594 return /*#__PURE__*/React__default["default"].createElement("div", {
3595 className: "rbt-loader spinner-border spinner-border-sm",
3596 role: "status"
3597 }, /*#__PURE__*/React__default["default"].createElement("span", {
3598 className: "sr-only visually-hidden"
3599 }, label));
3600 };
3601 Loader.propTypes = propTypes$7;
3602
3603 React__namespace.createContext();
3604 React__namespace.createContext();
3605
3606 /**
3607 * Simple ponyfill for Object.fromEntries
3608 */
3609
3610 var fromEntries = function fromEntries(entries) {
3611 return entries.reduce(function (acc, _ref) {
3612 var key = _ref[0],
3613 value = _ref[1];
3614 acc[key] = value;
3615 return acc;
3616 }, {});
3617 };
3618 /**
3619 * Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs
3620 */
3621
3622 var useIsomorphicLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? React__namespace.useLayoutEffect : React__namespace.useEffect;
3623
3624 var top = 'top';
3625 var bottom = 'bottom';
3626 var right = 'right';
3627 var left = 'left';
3628 var auto = 'auto';
3629 var basePlacements = [top, bottom, right, left];
3630 var start = 'start';
3631 var end = 'end';
3632 var clippingParents = 'clippingParents';
3633 var viewport = 'viewport';
3634 var popper = 'popper';
3635 var reference = 'reference';
3636 var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
3637 return acc.concat([placement + "-" + start, placement + "-" + end]);
3638 }, []);
3639 var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
3640 return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
3641 }, []); // modifiers that need to read the DOM
3642
3643 var beforeRead = 'beforeRead';
3644 var read = 'read';
3645 var afterRead = 'afterRead'; // pure-logic modifiers
3646
3647 var beforeMain = 'beforeMain';
3648 var main = 'main';
3649 var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
3650
3651 var beforeWrite = 'beforeWrite';
3652 var write = 'write';
3653 var afterWrite = 'afterWrite';
3654 var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
3655
3656 function getNodeName(element) {
3657 return element ? (element.nodeName || '').toLowerCase() : null;
3658 }
3659
3660 function getWindow(node) {
3661 if (node == null) {
3662 return window;
3663 }
3664
3665 if (node.toString() !== '[object Window]') {
3666 var ownerDocument = node.ownerDocument;
3667 return ownerDocument ? ownerDocument.defaultView || window : window;
3668 }
3669
3670 return node;
3671 }
3672
3673 function isElement(node) {
3674 var OwnElement = getWindow(node).Element;
3675 return node instanceof OwnElement || node instanceof Element;
3676 }
3677
3678 function isHTMLElement(node) {
3679 var OwnElement = getWindow(node).HTMLElement;
3680 return node instanceof OwnElement || node instanceof HTMLElement;
3681 }
3682
3683 function isShadowRoot(node) {
3684 // IE 11 has no ShadowRoot
3685 if (typeof ShadowRoot === 'undefined') {
3686 return false;
3687 }
3688
3689 var OwnElement = getWindow(node).ShadowRoot;
3690 return node instanceof OwnElement || node instanceof ShadowRoot;
3691 }
3692
3693 // and applies them to the HTMLElements such as popper and arrow
3694
3695 function applyStyles(_ref) {
3696 var state = _ref.state;
3697 Object.keys(state.elements).forEach(function (name) {
3698 var style = state.styles[name] || {};
3699 var attributes = state.attributes[name] || {};
3700 var element = state.elements[name]; // arrow is optional + virtual elements
3701
3702 if (!isHTMLElement(element) || !getNodeName(element)) {
3703 return;
3704 } // Flow doesn't support to extend this property, but it's the most
3705 // effective way to apply styles to an HTMLElement
3706 // $FlowFixMe[cannot-write]
3707
3708
3709 Object.assign(element.style, style);
3710 Object.keys(attributes).forEach(function (name) {
3711 var value = attributes[name];
3712
3713 if (value === false) {
3714 element.removeAttribute(name);
3715 } else {
3716 element.setAttribute(name, value === true ? '' : value);
3717 }
3718 });
3719 });
3720 }
3721
3722 function effect$2(_ref2) {
3723 var state = _ref2.state;
3724 var initialStyles = {
3725 popper: {
3726 position: state.options.strategy,
3727 left: '0',
3728 top: '0',
3729 margin: '0'
3730 },
3731 arrow: {
3732 position: 'absolute'
3733 },
3734 reference: {}
3735 };
3736 Object.assign(state.elements.popper.style, initialStyles.popper);
3737 state.styles = initialStyles;
3738
3739 if (state.elements.arrow) {
3740 Object.assign(state.elements.arrow.style, initialStyles.arrow);
3741 }
3742
3743 return function () {
3744 Object.keys(state.elements).forEach(function (name) {
3745 var element = state.elements[name];
3746 var attributes = state.attributes[name] || {};
3747 var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
3748
3749 var style = styleProperties.reduce(function (style, property) {
3750 style[property] = '';
3751 return style;
3752 }, {}); // arrow is optional + virtual elements
3753
3754 if (!isHTMLElement(element) || !getNodeName(element)) {
3755 return;
3756 }
3757
3758 Object.assign(element.style, style);
3759 Object.keys(attributes).forEach(function (attribute) {
3760 element.removeAttribute(attribute);
3761 });
3762 });
3763 };
3764 } // eslint-disable-next-line import/no-unused-modules
3765
3766
3767 var applyStyles$1 = {
3768 name: 'applyStyles',
3769 enabled: true,
3770 phase: 'write',
3771 fn: applyStyles,
3772 effect: effect$2,
3773 requires: ['computeStyles']
3774 };
3775
3776 function getBasePlacement(placement) {
3777 return placement.split('-')[0];
3778 }
3779
3780 var max = Math.max;
3781 var min = Math.min;
3782 var round = Math.round;
3783
3784 function getUAString() {
3785 var uaData = navigator.userAgentData;
3786
3787 if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
3788 return uaData.brands.map(function (item) {
3789 return item.brand + "/" + item.version;
3790 }).join(' ');
3791 }
3792
3793 return navigator.userAgent;
3794 }
3795
3796 function isLayoutViewport() {
3797 return !/^((?!chrome|android).)*safari/i.test(getUAString());
3798 }
3799
3800 function getBoundingClientRect(element, includeScale, isFixedStrategy) {
3801 if (includeScale === void 0) {
3802 includeScale = false;
3803 }
3804
3805 if (isFixedStrategy === void 0) {
3806 isFixedStrategy = false;
3807 }
3808
3809 var clientRect = element.getBoundingClientRect();
3810 var scaleX = 1;
3811 var scaleY = 1;
3812
3813 if (includeScale && isHTMLElement(element)) {
3814 scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
3815 scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
3816 }
3817
3818 var _ref = isElement(element) ? getWindow(element) : window,
3819 visualViewport = _ref.visualViewport;
3820
3821 var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
3822 var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
3823 var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
3824 var width = clientRect.width / scaleX;
3825 var height = clientRect.height / scaleY;
3826 return {
3827 width: width,
3828 height: height,
3829 top: y,
3830 right: x + width,
3831 bottom: y + height,
3832 left: x,
3833 x: x,
3834 y: y
3835 };
3836 }
3837
3838 // means it doesn't take into account transforms.
3839
3840 function getLayoutRect(element) {
3841 var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
3842 // Fixes https://github.com/popperjs/popper-core/issues/1223
3843
3844 var width = element.offsetWidth;
3845 var height = element.offsetHeight;
3846
3847 if (Math.abs(clientRect.width - width) <= 1) {
3848 width = clientRect.width;
3849 }
3850
3851 if (Math.abs(clientRect.height - height) <= 1) {
3852 height = clientRect.height;
3853 }
3854
3855 return {
3856 x: element.offsetLeft,
3857 y: element.offsetTop,
3858 width: width,
3859 height: height
3860 };
3861 }
3862
3863 function contains$1(parent, child) {
3864 var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
3865
3866 if (parent.contains(child)) {
3867 return true;
3868 } // then fallback to custom implementation with Shadow DOM support
3869 else if (rootNode && isShadowRoot(rootNode)) {
3870 var next = child;
3871
3872 do {
3873 if (next && parent.isSameNode(next)) {
3874 return true;
3875 } // $FlowFixMe[prop-missing]: need a better way to handle this...
3876
3877
3878 next = next.parentNode || next.host;
3879 } while (next);
3880 } // Give up, the result is false
3881
3882
3883 return false;
3884 }
3885
3886 function getComputedStyle$1(element) {
3887 return getWindow(element).getComputedStyle(element);
3888 }
3889
3890 function isTableElement(element) {
3891 return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
3892 }
3893
3894 function getDocumentElement(element) {
3895 // $FlowFixMe[incompatible-return]: assume body is always available
3896 return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
3897 element.document) || window.document).documentElement;
3898 }
3899
3900 function getParentNode(element) {
3901 if (getNodeName(element) === 'html') {
3902 return element;
3903 }
3904
3905 return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
3906 // $FlowFixMe[incompatible-return]
3907 // $FlowFixMe[prop-missing]
3908 element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
3909 element.parentNode || ( // DOM Element detected
3910 isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
3911 // $FlowFixMe[incompatible-call]: HTMLElement is a Node
3912 getDocumentElement(element) // fallback
3913
3914 );
3915 }
3916
3917 function getTrueOffsetParent(element) {
3918 if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
3919 getComputedStyle$1(element).position === 'fixed') {
3920 return null;
3921 }
3922
3923 return element.offsetParent;
3924 } // `.offsetParent` reports `null` for fixed elements, while absolute elements
3925 // return the containing block
3926
3927
3928 function getContainingBlock(element) {
3929 var isFirefox = /firefox/i.test(getUAString());
3930 var isIE = /Trident/i.test(getUAString());
3931
3932 if (isIE && isHTMLElement(element)) {
3933 // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
3934 var elementCss = getComputedStyle$1(element);
3935
3936 if (elementCss.position === 'fixed') {
3937 return null;
3938 }
3939 }
3940
3941 var currentNode = getParentNode(element);
3942
3943 if (isShadowRoot(currentNode)) {
3944 currentNode = currentNode.host;
3945 }
3946
3947 while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
3948 var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that
3949 // create a containing block.
3950 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
3951
3952 if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
3953 return currentNode;
3954 } else {
3955 currentNode = currentNode.parentNode;
3956 }
3957 }
3958
3959 return null;
3960 } // Gets the closest ancestor positioned element. Handles some edge cases,
3961 // such as table ancestors and cross browser bugs.
3962
3963
3964 function getOffsetParent(element) {
3965 var window = getWindow(element);
3966 var offsetParent = getTrueOffsetParent(element);
3967
3968 while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
3969 offsetParent = getTrueOffsetParent(offsetParent);
3970 }
3971
3972 if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) {
3973 return window;
3974 }
3975
3976 return offsetParent || getContainingBlock(element) || window;
3977 }
3978
3979 function getMainAxisFromPlacement(placement) {
3980 return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
3981 }
3982
3983 function within(min$1, value, max$1) {
3984 return max(min$1, min(value, max$1));
3985 }
3986 function withinMaxClamp(min, value, max) {
3987 var v = within(min, value, max);
3988 return v > max ? max : v;
3989 }
3990
3991 function getFreshSideObject() {
3992 return {
3993 top: 0,
3994 right: 0,
3995 bottom: 0,
3996 left: 0
3997 };
3998 }
3999
4000 function mergePaddingObject(paddingObject) {
4001 return Object.assign({}, getFreshSideObject(), paddingObject);
4002 }
4003
4004 function expandToHashMap(value, keys) {
4005 return keys.reduce(function (hashMap, key) {
4006 hashMap[key] = value;
4007 return hashMap;
4008 }, {});
4009 }
4010
4011 var toPaddingObject = function toPaddingObject(padding, state) {
4012 padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
4013 placement: state.placement
4014 })) : padding;
4015 return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
4016 };
4017
4018 function arrow(_ref) {
4019 var _state$modifiersData$;
4020
4021 var state = _ref.state,
4022 name = _ref.name,
4023 options = _ref.options;
4024 var arrowElement = state.elements.arrow;
4025 var popperOffsets = state.modifiersData.popperOffsets;
4026 var basePlacement = getBasePlacement(state.placement);
4027 var axis = getMainAxisFromPlacement(basePlacement);
4028 var isVertical = [left, right].indexOf(basePlacement) >= 0;
4029 var len = isVertical ? 'height' : 'width';
4030
4031 if (!arrowElement || !popperOffsets) {
4032 return;
4033 }
4034
4035 var paddingObject = toPaddingObject(options.padding, state);
4036 var arrowRect = getLayoutRect(arrowElement);
4037 var minProp = axis === 'y' ? top : left;
4038 var maxProp = axis === 'y' ? bottom : right;
4039 var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
4040 var startDiff = popperOffsets[axis] - state.rects.reference[axis];
4041 var arrowOffsetParent = getOffsetParent(arrowElement);
4042 var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
4043 var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
4044 // outside of the popper bounds
4045
4046 var min = paddingObject[minProp];
4047 var max = clientSize - arrowRect[len] - paddingObject[maxProp];
4048 var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
4049 var offset = within(min, center, max); // Prevents breaking syntax highlighting...
4050
4051 var axisProp = axis;
4052 state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
4053 }
4054
4055 function effect$1(_ref2) {
4056 var state = _ref2.state,
4057 options = _ref2.options;
4058 var _options$element = options.element,
4059 arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
4060
4061 if (arrowElement == null) {
4062 return;
4063 } // CSS selector
4064
4065
4066 if (typeof arrowElement === 'string') {
4067 arrowElement = state.elements.popper.querySelector(arrowElement);
4068
4069 if (!arrowElement) {
4070 return;
4071 }
4072 }
4073
4074 if (!contains$1(state.elements.popper, arrowElement)) {
4075 return;
4076 }
4077
4078 state.elements.arrow = arrowElement;
4079 } // eslint-disable-next-line import/no-unused-modules
4080
4081
4082 var arrow$1 = {
4083 name: 'arrow',
4084 enabled: true,
4085 phase: 'main',
4086 fn: arrow,
4087 effect: effect$1,
4088 requires: ['popperOffsets'],
4089 requiresIfExists: ['preventOverflow']
4090 };
4091
4092 function getVariation(placement) {
4093 return placement.split('-')[1];
4094 }
4095
4096 var unsetSides = {
4097 top: 'auto',
4098 right: 'auto',
4099 bottom: 'auto',
4100 left: 'auto'
4101 }; // Round the offsets to the nearest suitable subpixel based on the DPR.
4102 // Zooming can change the DPR, but it seems to report a value that will
4103 // cleanly divide the values into the appropriate subpixels.
4104
4105 function roundOffsetsByDPR(_ref, win) {
4106 var x = _ref.x,
4107 y = _ref.y;
4108 var dpr = win.devicePixelRatio || 1;
4109 return {
4110 x: round(x * dpr) / dpr || 0,
4111 y: round(y * dpr) / dpr || 0
4112 };
4113 }
4114
4115 function mapToStyles(_ref2) {
4116 var _Object$assign2;
4117
4118 var popper = _ref2.popper,
4119 popperRect = _ref2.popperRect,
4120 placement = _ref2.placement,
4121 variation = _ref2.variation,
4122 offsets = _ref2.offsets,
4123 position = _ref2.position,
4124 gpuAcceleration = _ref2.gpuAcceleration,
4125 adaptive = _ref2.adaptive,
4126 roundOffsets = _ref2.roundOffsets,
4127 isFixed = _ref2.isFixed;
4128 var _offsets$x = offsets.x,
4129 x = _offsets$x === void 0 ? 0 : _offsets$x,
4130 _offsets$y = offsets.y,
4131 y = _offsets$y === void 0 ? 0 : _offsets$y;
4132
4133 var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
4134 x: x,
4135 y: y
4136 }) : {
4137 x: x,
4138 y: y
4139 };
4140
4141 x = _ref3.x;
4142 y = _ref3.y;
4143 var hasX = offsets.hasOwnProperty('x');
4144 var hasY = offsets.hasOwnProperty('y');
4145 var sideX = left;
4146 var sideY = top;
4147 var win = window;
4148
4149 if (adaptive) {
4150 var offsetParent = getOffsetParent(popper);
4151 var heightProp = 'clientHeight';
4152 var widthProp = 'clientWidth';
4153
4154 if (offsetParent === getWindow(popper)) {
4155 offsetParent = getDocumentElement(popper);
4156
4157 if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') {
4158 heightProp = 'scrollHeight';
4159 widthProp = 'scrollWidth';
4160 }
4161 } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
4162
4163
4164 offsetParent = offsetParent;
4165
4166 if (placement === top || (placement === left || placement === right) && variation === end) {
4167 sideY = bottom;
4168 var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
4169 offsetParent[heightProp];
4170 y -= offsetY - popperRect.height;
4171 y *= gpuAcceleration ? 1 : -1;
4172 }
4173
4174 if (placement === left || (placement === top || placement === bottom) && variation === end) {
4175 sideX = right;
4176 var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
4177 offsetParent[widthProp];
4178 x -= offsetX - popperRect.width;
4179 x *= gpuAcceleration ? 1 : -1;
4180 }
4181 }
4182
4183 var commonStyles = Object.assign({
4184 position: position
4185 }, adaptive && unsetSides);
4186
4187 var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
4188 x: x,
4189 y: y
4190 }, getWindow(popper)) : {
4191 x: x,
4192 y: y
4193 };
4194
4195 x = _ref4.x;
4196 y = _ref4.y;
4197
4198 if (gpuAcceleration) {
4199 var _Object$assign;
4200
4201 return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
4202 }
4203
4204 return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
4205 }
4206
4207 function computeStyles(_ref5) {
4208 var state = _ref5.state,
4209 options = _ref5.options;
4210 var _options$gpuAccelerat = options.gpuAcceleration,
4211 gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
4212 _options$adaptive = options.adaptive,
4213 adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
4214 _options$roundOffsets = options.roundOffsets,
4215 roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
4216 var commonStyles = {
4217 placement: getBasePlacement(state.placement),
4218 variation: getVariation(state.placement),
4219 popper: state.elements.popper,
4220 popperRect: state.rects.popper,
4221 gpuAcceleration: gpuAcceleration,
4222 isFixed: state.options.strategy === 'fixed'
4223 };
4224
4225 if (state.modifiersData.popperOffsets != null) {
4226 state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
4227 offsets: state.modifiersData.popperOffsets,
4228 position: state.options.strategy,
4229 adaptive: adaptive,
4230 roundOffsets: roundOffsets
4231 })));
4232 }
4233
4234 if (state.modifiersData.arrow != null) {
4235 state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
4236 offsets: state.modifiersData.arrow,
4237 position: 'absolute',
4238 adaptive: false,
4239 roundOffsets: roundOffsets
4240 })));
4241 }
4242
4243 state.attributes.popper = Object.assign({}, state.attributes.popper, {
4244 'data-popper-placement': state.placement
4245 });
4246 } // eslint-disable-next-line import/no-unused-modules
4247
4248
4249 var computeStyles$1 = {
4250 name: 'computeStyles',
4251 enabled: true,
4252 phase: 'beforeWrite',
4253 fn: computeStyles,
4254 data: {}
4255 };
4256
4257 var passive = {
4258 passive: true
4259 };
4260
4261 function effect(_ref) {
4262 var state = _ref.state,
4263 instance = _ref.instance,
4264 options = _ref.options;
4265 var _options$scroll = options.scroll,
4266 scroll = _options$scroll === void 0 ? true : _options$scroll,
4267 _options$resize = options.resize,
4268 resize = _options$resize === void 0 ? true : _options$resize;
4269 var window = getWindow(state.elements.popper);
4270 var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
4271
4272 if (scroll) {
4273 scrollParents.forEach(function (scrollParent) {
4274 scrollParent.addEventListener('scroll', instance.update, passive);
4275 });
4276 }
4277
4278 if (resize) {
4279 window.addEventListener('resize', instance.update, passive);
4280 }
4281
4282 return function () {
4283 if (scroll) {
4284 scrollParents.forEach(function (scrollParent) {
4285 scrollParent.removeEventListener('scroll', instance.update, passive);
4286 });
4287 }
4288
4289 if (resize) {
4290 window.removeEventListener('resize', instance.update, passive);
4291 }
4292 };
4293 } // eslint-disable-next-line import/no-unused-modules
4294
4295
4296 var eventListeners = {
4297 name: 'eventListeners',
4298 enabled: true,
4299 phase: 'write',
4300 fn: function fn() {},
4301 effect: effect,
4302 data: {}
4303 };
4304
4305 var hash$1 = {
4306 left: 'right',
4307 right: 'left',
4308 bottom: 'top',
4309 top: 'bottom'
4310 };
4311 function getOppositePlacement(placement) {
4312 return placement.replace(/left|right|bottom|top/g, function (matched) {
4313 return hash$1[matched];
4314 });
4315 }
4316
4317 var hash = {
4318 start: 'end',
4319 end: 'start'
4320 };
4321 function getOppositeVariationPlacement(placement) {
4322 return placement.replace(/start|end/g, function (matched) {
4323 return hash[matched];
4324 });
4325 }
4326
4327 function getWindowScroll(node) {
4328 var win = getWindow(node);
4329 var scrollLeft = win.pageXOffset;
4330 var scrollTop = win.pageYOffset;
4331 return {
4332 scrollLeft: scrollLeft,
4333 scrollTop: scrollTop
4334 };
4335 }
4336
4337 function getWindowScrollBarX(element) {
4338 // If <html> has a CSS width greater than the viewport, then this will be
4339 // incorrect for RTL.
4340 // Popper 1 is broken in this case and never had a bug report so let's assume
4341 // it's not an issue. I don't think anyone ever specifies width on <html>
4342 // anyway.
4343 // Browsers where the left scrollbar doesn't cause an issue report `0` for
4344 // this (e.g. Edge 2019, IE11, Safari)
4345 return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
4346 }
4347
4348 function getViewportRect(element, strategy) {
4349 var win = getWindow(element);
4350 var html = getDocumentElement(element);
4351 var visualViewport = win.visualViewport;
4352 var width = html.clientWidth;
4353 var height = html.clientHeight;
4354 var x = 0;
4355 var y = 0;
4356
4357 if (visualViewport) {
4358 width = visualViewport.width;
4359 height = visualViewport.height;
4360 var layoutViewport = isLayoutViewport();
4361
4362 if (layoutViewport || !layoutViewport && strategy === 'fixed') {
4363 x = visualViewport.offsetLeft;
4364 y = visualViewport.offsetTop;
4365 }
4366 }
4367
4368 return {
4369 width: width,
4370 height: height,
4371 x: x + getWindowScrollBarX(element),
4372 y: y
4373 };
4374 }
4375
4376 // of the `<html>` and `<body>` rect bounds if horizontally scrollable
4377
4378 function getDocumentRect(element) {
4379 var _element$ownerDocumen;
4380
4381 var html = getDocumentElement(element);
4382 var winScroll = getWindowScroll(element);
4383 var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
4384 var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
4385 var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
4386 var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
4387 var y = -winScroll.scrollTop;
4388
4389 if (getComputedStyle$1(body || html).direction === 'rtl') {
4390 x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
4391 }
4392
4393 return {
4394 width: width,
4395 height: height,
4396 x: x,
4397 y: y
4398 };
4399 }
4400
4401 function isScrollParent(element) {
4402 // Firefox wants us to check `-x` and `-y` variations as well
4403 var _getComputedStyle = getComputedStyle$1(element),
4404 overflow = _getComputedStyle.overflow,
4405 overflowX = _getComputedStyle.overflowX,
4406 overflowY = _getComputedStyle.overflowY;
4407
4408 return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
4409 }
4410
4411 function getScrollParent(node) {
4412 if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
4413 // $FlowFixMe[incompatible-return]: assume body is always available
4414 return node.ownerDocument.body;
4415 }
4416
4417 if (isHTMLElement(node) && isScrollParent(node)) {
4418 return node;
4419 }
4420
4421 return getScrollParent(getParentNode(node));
4422 }
4423
4424 /*
4425 given a DOM element, return the list of all scroll parents, up the list of ancesors
4426 until we get to the top window object. This list is what we attach scroll listeners
4427 to, because if any of these parent elements scroll, we'll need to re-calculate the
4428 reference element's position.
4429 */
4430
4431 function listScrollParents(element, list) {
4432 var _element$ownerDocumen;
4433
4434 if (list === void 0) {
4435 list = [];
4436 }
4437
4438 var scrollParent = getScrollParent(element);
4439 var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
4440 var win = getWindow(scrollParent);
4441 var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
4442 var updatedList = list.concat(target);
4443 return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
4444 updatedList.concat(listScrollParents(getParentNode(target)));
4445 }
4446
4447 function rectToClientRect(rect) {
4448 return Object.assign({}, rect, {
4449 left: rect.x,
4450 top: rect.y,
4451 right: rect.x + rect.width,
4452 bottom: rect.y + rect.height
4453 });
4454 }
4455
4456 function getInnerBoundingClientRect(element, strategy) {
4457 var rect = getBoundingClientRect(element, false, strategy === 'fixed');
4458 rect.top = rect.top + element.clientTop;
4459 rect.left = rect.left + element.clientLeft;
4460 rect.bottom = rect.top + element.clientHeight;
4461 rect.right = rect.left + element.clientWidth;
4462 rect.width = element.clientWidth;
4463 rect.height = element.clientHeight;
4464 rect.x = rect.left;
4465 rect.y = rect.top;
4466 return rect;
4467 }
4468
4469 function getClientRectFromMixedType(element, clippingParent, strategy) {
4470 return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
4471 } // A "clipping parent" is an overflowable container with the characteristic of
4472 // clipping (or hiding) overflowing elements with a position different from
4473 // `initial`
4474
4475
4476 function getClippingParents(element) {
4477 var clippingParents = listScrollParents(getParentNode(element));
4478 var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0;
4479 var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
4480
4481 if (!isElement(clipperElement)) {
4482 return [];
4483 } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
4484
4485
4486 return clippingParents.filter(function (clippingParent) {
4487 return isElement(clippingParent) && contains$1(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
4488 });
4489 } // Gets the maximum area that the element is visible in due to any number of
4490 // clipping parents
4491
4492
4493 function getClippingRect(element, boundary, rootBoundary, strategy) {
4494 var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
4495 var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
4496 var firstClippingParent = clippingParents[0];
4497 var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
4498 var rect = getClientRectFromMixedType(element, clippingParent, strategy);
4499 accRect.top = max(rect.top, accRect.top);
4500 accRect.right = min(rect.right, accRect.right);
4501 accRect.bottom = min(rect.bottom, accRect.bottom);
4502 accRect.left = max(rect.left, accRect.left);
4503 return accRect;
4504 }, getClientRectFromMixedType(element, firstClippingParent, strategy));
4505 clippingRect.width = clippingRect.right - clippingRect.left;
4506 clippingRect.height = clippingRect.bottom - clippingRect.top;
4507 clippingRect.x = clippingRect.left;
4508 clippingRect.y = clippingRect.top;
4509 return clippingRect;
4510 }
4511
4512 function computeOffsets(_ref) {
4513 var reference = _ref.reference,
4514 element = _ref.element,
4515 placement = _ref.placement;
4516 var basePlacement = placement ? getBasePlacement(placement) : null;
4517 var variation = placement ? getVariation(placement) : null;
4518 var commonX = reference.x + reference.width / 2 - element.width / 2;
4519 var commonY = reference.y + reference.height / 2 - element.height / 2;
4520 var offsets;
4521
4522 switch (basePlacement) {
4523 case top:
4524 offsets = {
4525 x: commonX,
4526 y: reference.y - element.height
4527 };
4528 break;
4529
4530 case bottom:
4531 offsets = {
4532 x: commonX,
4533 y: reference.y + reference.height
4534 };
4535 break;
4536
4537 case right:
4538 offsets = {
4539 x: reference.x + reference.width,
4540 y: commonY
4541 };
4542 break;
4543
4544 case left:
4545 offsets = {
4546 x: reference.x - element.width,
4547 y: commonY
4548 };
4549 break;
4550
4551 default:
4552 offsets = {
4553 x: reference.x,
4554 y: reference.y
4555 };
4556 }
4557
4558 var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
4559
4560 if (mainAxis != null) {
4561 var len = mainAxis === 'y' ? 'height' : 'width';
4562
4563 switch (variation) {
4564 case start:
4565 offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
4566 break;
4567
4568 case end:
4569 offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
4570 break;
4571 }
4572 }
4573
4574 return offsets;
4575 }
4576
4577 function detectOverflow(state, options) {
4578 if (options === void 0) {
4579 options = {};
4580 }
4581
4582 var _options = options,
4583 _options$placement = _options.placement,
4584 placement = _options$placement === void 0 ? state.placement : _options$placement,
4585 _options$strategy = _options.strategy,
4586 strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
4587 _options$boundary = _options.boundary,
4588 boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
4589 _options$rootBoundary = _options.rootBoundary,
4590 rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
4591 _options$elementConte = _options.elementContext,
4592 elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
4593 _options$altBoundary = _options.altBoundary,
4594 altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
4595 _options$padding = _options.padding,
4596 padding = _options$padding === void 0 ? 0 : _options$padding;
4597 var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
4598 var altContext = elementContext === popper ? reference : popper;
4599 var popperRect = state.rects.popper;
4600 var element = state.elements[altBoundary ? altContext : elementContext];
4601 var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
4602 var referenceClientRect = getBoundingClientRect(state.elements.reference);
4603 var popperOffsets = computeOffsets({
4604 reference: referenceClientRect,
4605 element: popperRect,
4606 strategy: 'absolute',
4607 placement: placement
4608 });
4609 var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
4610 var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
4611 // 0 or negative = within the clipping rect
4612
4613 var overflowOffsets = {
4614 top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
4615 bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
4616 left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
4617 right: elementClientRect.right - clippingClientRect.right + paddingObject.right
4618 };
4619 var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
4620
4621 if (elementContext === popper && offsetData) {
4622 var offset = offsetData[placement];
4623 Object.keys(overflowOffsets).forEach(function (key) {
4624 var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
4625 var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
4626 overflowOffsets[key] += offset[axis] * multiply;
4627 });
4628 }
4629
4630 return overflowOffsets;
4631 }
4632
4633 function computeAutoPlacement(state, options) {
4634 if (options === void 0) {
4635 options = {};
4636 }
4637
4638 var _options = options,
4639 placement = _options.placement,
4640 boundary = _options.boundary,
4641 rootBoundary = _options.rootBoundary,
4642 padding = _options.padding,
4643 flipVariations = _options.flipVariations,
4644 _options$allowedAutoP = _options.allowedAutoPlacements,
4645 allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
4646 var variation = getVariation(placement);
4647 var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
4648 return getVariation(placement) === variation;
4649 }) : basePlacements;
4650 var allowedPlacements = placements$1.filter(function (placement) {
4651 return allowedAutoPlacements.indexOf(placement) >= 0;
4652 });
4653
4654 if (allowedPlacements.length === 0) {
4655 allowedPlacements = placements$1;
4656 } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
4657
4658
4659 var overflows = allowedPlacements.reduce(function (acc, placement) {
4660 acc[placement] = detectOverflow(state, {
4661 placement: placement,
4662 boundary: boundary,
4663 rootBoundary: rootBoundary,
4664 padding: padding
4665 })[getBasePlacement(placement)];
4666 return acc;
4667 }, {});
4668 return Object.keys(overflows).sort(function (a, b) {
4669 return overflows[a] - overflows[b];
4670 });
4671 }
4672
4673 function getExpandedFallbackPlacements(placement) {
4674 if (getBasePlacement(placement) === auto) {
4675 return [];
4676 }
4677
4678 var oppositePlacement = getOppositePlacement(placement);
4679 return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
4680 }
4681
4682 function flip(_ref) {
4683 var state = _ref.state,
4684 options = _ref.options,
4685 name = _ref.name;
4686
4687 if (state.modifiersData[name]._skip) {
4688 return;
4689 }
4690
4691 var _options$mainAxis = options.mainAxis,
4692 checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
4693 _options$altAxis = options.altAxis,
4694 checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
4695 specifiedFallbackPlacements = options.fallbackPlacements,
4696 padding = options.padding,
4697 boundary = options.boundary,
4698 rootBoundary = options.rootBoundary,
4699 altBoundary = options.altBoundary,
4700 _options$flipVariatio = options.flipVariations,
4701 flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
4702 allowedAutoPlacements = options.allowedAutoPlacements;
4703 var preferredPlacement = state.options.placement;
4704 var basePlacement = getBasePlacement(preferredPlacement);
4705 var isBasePlacement = basePlacement === preferredPlacement;
4706 var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
4707 var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
4708 return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
4709 placement: placement,
4710 boundary: boundary,
4711 rootBoundary: rootBoundary,
4712 padding: padding,
4713 flipVariations: flipVariations,
4714 allowedAutoPlacements: allowedAutoPlacements
4715 }) : placement);
4716 }, []);
4717 var referenceRect = state.rects.reference;
4718 var popperRect = state.rects.popper;
4719 var checksMap = new Map();
4720 var makeFallbackChecks = true;
4721 var firstFittingPlacement = placements[0];
4722
4723 for (var i = 0; i < placements.length; i++) {
4724 var placement = placements[i];
4725
4726 var _basePlacement = getBasePlacement(placement);
4727
4728 var isStartVariation = getVariation(placement) === start;
4729 var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
4730 var len = isVertical ? 'width' : 'height';
4731 var overflow = detectOverflow(state, {
4732 placement: placement,
4733 boundary: boundary,
4734 rootBoundary: rootBoundary,
4735 altBoundary: altBoundary,
4736 padding: padding
4737 });
4738 var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
4739
4740 if (referenceRect[len] > popperRect[len]) {
4741 mainVariationSide = getOppositePlacement(mainVariationSide);
4742 }
4743
4744 var altVariationSide = getOppositePlacement(mainVariationSide);
4745 var checks = [];
4746
4747 if (checkMainAxis) {
4748 checks.push(overflow[_basePlacement] <= 0);
4749 }
4750
4751 if (checkAltAxis) {
4752 checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
4753 }
4754
4755 if (checks.every(function (check) {
4756 return check;
4757 })) {
4758 firstFittingPlacement = placement;
4759 makeFallbackChecks = false;
4760 break;
4761 }
4762
4763 checksMap.set(placement, checks);
4764 }
4765
4766 if (makeFallbackChecks) {
4767 // `2` may be desired in some cases – research later
4768 var numberOfChecks = flipVariations ? 3 : 1;
4769
4770 var _loop = function _loop(_i) {
4771 var fittingPlacement = placements.find(function (placement) {
4772 var checks = checksMap.get(placement);
4773
4774 if (checks) {
4775 return checks.slice(0, _i).every(function (check) {
4776 return check;
4777 });
4778 }
4779 });
4780
4781 if (fittingPlacement) {
4782 firstFittingPlacement = fittingPlacement;
4783 return "break";
4784 }
4785 };
4786
4787 for (var _i = numberOfChecks; _i > 0; _i--) {
4788 var _ret = _loop(_i);
4789
4790 if (_ret === "break") break;
4791 }
4792 }
4793
4794 if (state.placement !== firstFittingPlacement) {
4795 state.modifiersData[name]._skip = true;
4796 state.placement = firstFittingPlacement;
4797 state.reset = true;
4798 }
4799 } // eslint-disable-next-line import/no-unused-modules
4800
4801
4802 var flip$1 = {
4803 name: 'flip',
4804 enabled: true,
4805 phase: 'main',
4806 fn: flip,
4807 requiresIfExists: ['offset'],
4808 data: {
4809 _skip: false
4810 }
4811 };
4812
4813 function getSideOffsets(overflow, rect, preventedOffsets) {
4814 if (preventedOffsets === void 0) {
4815 preventedOffsets = {
4816 x: 0,
4817 y: 0
4818 };
4819 }
4820
4821 return {
4822 top: overflow.top - rect.height - preventedOffsets.y,
4823 right: overflow.right - rect.width + preventedOffsets.x,
4824 bottom: overflow.bottom - rect.height + preventedOffsets.y,
4825 left: overflow.left - rect.width - preventedOffsets.x
4826 };
4827 }
4828
4829 function isAnySideFullyClipped(overflow) {
4830 return [top, right, bottom, left].some(function (side) {
4831 return overflow[side] >= 0;
4832 });
4833 }
4834
4835 function hide(_ref) {
4836 var state = _ref.state,
4837 name = _ref.name;
4838 var referenceRect = state.rects.reference;
4839 var popperRect = state.rects.popper;
4840 var preventedOffsets = state.modifiersData.preventOverflow;
4841 var referenceOverflow = detectOverflow(state, {
4842 elementContext: 'reference'
4843 });
4844 var popperAltOverflow = detectOverflow(state, {
4845 altBoundary: true
4846 });
4847 var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
4848 var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
4849 var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
4850 var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
4851 state.modifiersData[name] = {
4852 referenceClippingOffsets: referenceClippingOffsets,
4853 popperEscapeOffsets: popperEscapeOffsets,
4854 isReferenceHidden: isReferenceHidden,
4855 hasPopperEscaped: hasPopperEscaped
4856 };
4857 state.attributes.popper = Object.assign({}, state.attributes.popper, {
4858 'data-popper-reference-hidden': isReferenceHidden,
4859 'data-popper-escaped': hasPopperEscaped
4860 });
4861 } // eslint-disable-next-line import/no-unused-modules
4862
4863
4864 var hide$1 = {
4865 name: 'hide',
4866 enabled: true,
4867 phase: 'main',
4868 requiresIfExists: ['preventOverflow'],
4869 fn: hide
4870 };
4871
4872 function distanceAndSkiddingToXY(placement, rects, offset) {
4873 var basePlacement = getBasePlacement(placement);
4874 var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
4875
4876 var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
4877 placement: placement
4878 })) : offset,
4879 skidding = _ref[0],
4880 distance = _ref[1];
4881
4882 skidding = skidding || 0;
4883 distance = (distance || 0) * invertDistance;
4884 return [left, right].indexOf(basePlacement) >= 0 ? {
4885 x: distance,
4886 y: skidding
4887 } : {
4888 x: skidding,
4889 y: distance
4890 };
4891 }
4892
4893 function offset(_ref2) {
4894 var state = _ref2.state,
4895 options = _ref2.options,
4896 name = _ref2.name;
4897 var _options$offset = options.offset,
4898 offset = _options$offset === void 0 ? [0, 0] : _options$offset;
4899 var data = placements.reduce(function (acc, placement) {
4900 acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
4901 return acc;
4902 }, {});
4903 var _data$state$placement = data[state.placement],
4904 x = _data$state$placement.x,
4905 y = _data$state$placement.y;
4906
4907 if (state.modifiersData.popperOffsets != null) {
4908 state.modifiersData.popperOffsets.x += x;
4909 state.modifiersData.popperOffsets.y += y;
4910 }
4911
4912 state.modifiersData[name] = data;
4913 } // eslint-disable-next-line import/no-unused-modules
4914
4915
4916 var offset$1 = {
4917 name: 'offset',
4918 enabled: true,
4919 phase: 'main',
4920 requires: ['popperOffsets'],
4921 fn: offset
4922 };
4923
4924 function popperOffsets(_ref) {
4925 var state = _ref.state,
4926 name = _ref.name;
4927 // Offsets are the actual position the popper needs to have to be
4928 // properly positioned near its reference element
4929 // This is the most basic placement, and will be adjusted by
4930 // the modifiers in the next step
4931 state.modifiersData[name] = computeOffsets({
4932 reference: state.rects.reference,
4933 element: state.rects.popper,
4934 strategy: 'absolute',
4935 placement: state.placement
4936 });
4937 } // eslint-disable-next-line import/no-unused-modules
4938
4939
4940 var popperOffsets$1 = {
4941 name: 'popperOffsets',
4942 enabled: true,
4943 phase: 'read',
4944 fn: popperOffsets,
4945 data: {}
4946 };
4947
4948 function getAltAxis(axis) {
4949 return axis === 'x' ? 'y' : 'x';
4950 }
4951
4952 function preventOverflow(_ref) {
4953 var state = _ref.state,
4954 options = _ref.options,
4955 name = _ref.name;
4956 var _options$mainAxis = options.mainAxis,
4957 checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
4958 _options$altAxis = options.altAxis,
4959 checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
4960 boundary = options.boundary,
4961 rootBoundary = options.rootBoundary,
4962 altBoundary = options.altBoundary,
4963 padding = options.padding,
4964 _options$tether = options.tether,
4965 tether = _options$tether === void 0 ? true : _options$tether,
4966 _options$tetherOffset = options.tetherOffset,
4967 tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
4968 var overflow = detectOverflow(state, {
4969 boundary: boundary,
4970 rootBoundary: rootBoundary,
4971 padding: padding,
4972 altBoundary: altBoundary
4973 });
4974 var basePlacement = getBasePlacement(state.placement);
4975 var variation = getVariation(state.placement);
4976 var isBasePlacement = !variation;
4977 var mainAxis = getMainAxisFromPlacement(basePlacement);
4978 var altAxis = getAltAxis(mainAxis);
4979 var popperOffsets = state.modifiersData.popperOffsets;
4980 var referenceRect = state.rects.reference;
4981 var popperRect = state.rects.popper;
4982 var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
4983 placement: state.placement
4984 })) : tetherOffset;
4985 var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
4986 mainAxis: tetherOffsetValue,
4987 altAxis: tetherOffsetValue
4988 } : Object.assign({
4989 mainAxis: 0,
4990 altAxis: 0
4991 }, tetherOffsetValue);
4992 var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
4993 var data = {
4994 x: 0,
4995 y: 0
4996 };
4997
4998 if (!popperOffsets) {
4999 return;
5000 }
5001
5002 if (checkMainAxis) {
5003 var _offsetModifierState$;
5004
5005 var mainSide = mainAxis === 'y' ? top : left;
5006 var altSide = mainAxis === 'y' ? bottom : right;
5007 var len = mainAxis === 'y' ? 'height' : 'width';
5008 var offset = popperOffsets[mainAxis];
5009 var min$1 = offset + overflow[mainSide];
5010 var max$1 = offset - overflow[altSide];
5011 var additive = tether ? -popperRect[len] / 2 : 0;
5012 var minLen = variation === start ? referenceRect[len] : popperRect[len];
5013 var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
5014 // outside the reference bounds
5015
5016 var arrowElement = state.elements.arrow;
5017 var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
5018 width: 0,
5019 height: 0
5020 };
5021 var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
5022 var arrowPaddingMin = arrowPaddingObject[mainSide];
5023 var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
5024 // to include its full size in the calculation. If the reference is small
5025 // and near the edge of a boundary, the popper can overflow even if the
5026 // reference is not overflowing as well (e.g. virtual elements with no
5027 // width or height)
5028
5029 var arrowLen = within(0, referenceRect[len], arrowRect[len]);
5030 var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
5031 var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
5032 var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
5033 var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
5034 var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
5035 var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
5036 var tetherMax = offset + maxOffset - offsetModifierValue;
5037 var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
5038 popperOffsets[mainAxis] = preventedOffset;
5039 data[mainAxis] = preventedOffset - offset;
5040 }
5041
5042 if (checkAltAxis) {
5043 var _offsetModifierState$2;
5044
5045 var _mainSide = mainAxis === 'x' ? top : left;
5046
5047 var _altSide = mainAxis === 'x' ? bottom : right;
5048
5049 var _offset = popperOffsets[altAxis];
5050
5051 var _len = altAxis === 'y' ? 'height' : 'width';
5052
5053 var _min = _offset + overflow[_mainSide];
5054
5055 var _max = _offset - overflow[_altSide];
5056
5057 var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
5058
5059 var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
5060
5061 var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
5062
5063 var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
5064
5065 var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
5066
5067 popperOffsets[altAxis] = _preventedOffset;
5068 data[altAxis] = _preventedOffset - _offset;
5069 }
5070
5071 state.modifiersData[name] = data;
5072 } // eslint-disable-next-line import/no-unused-modules
5073
5074
5075 var preventOverflow$1 = {
5076 name: 'preventOverflow',
5077 enabled: true,
5078 phase: 'main',
5079 fn: preventOverflow,
5080 requiresIfExists: ['offset']
5081 };
5082
5083 function getHTMLElementScroll(element) {
5084 return {
5085 scrollLeft: element.scrollLeft,
5086 scrollTop: element.scrollTop
5087 };
5088 }
5089
5090 function getNodeScroll(node) {
5091 if (node === getWindow(node) || !isHTMLElement(node)) {
5092 return getWindowScroll(node);
5093 } else {
5094 return getHTMLElementScroll(node);
5095 }
5096 }
5097
5098 function isElementScaled(element) {
5099 var rect = element.getBoundingClientRect();
5100 var scaleX = round(rect.width) / element.offsetWidth || 1;
5101 var scaleY = round(rect.height) / element.offsetHeight || 1;
5102 return scaleX !== 1 || scaleY !== 1;
5103 } // Returns the composite rect of an element relative to its offsetParent.
5104 // Composite means it takes into account transforms as well as layout.
5105
5106
5107 function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
5108 if (isFixed === void 0) {
5109 isFixed = false;
5110 }
5111
5112 var isOffsetParentAnElement = isHTMLElement(offsetParent);
5113 var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
5114 var documentElement = getDocumentElement(offsetParent);
5115 var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
5116 var scroll = {
5117 scrollLeft: 0,
5118 scrollTop: 0
5119 };
5120 var offsets = {
5121 x: 0,
5122 y: 0
5123 };
5124
5125 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
5126 if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
5127 isScrollParent(documentElement)) {
5128 scroll = getNodeScroll(offsetParent);
5129 }
5130
5131 if (isHTMLElement(offsetParent)) {
5132 offsets = getBoundingClientRect(offsetParent, true);
5133 offsets.x += offsetParent.clientLeft;
5134 offsets.y += offsetParent.clientTop;
5135 } else if (documentElement) {
5136 offsets.x = getWindowScrollBarX(documentElement);
5137 }
5138 }
5139
5140 return {
5141 x: rect.left + scroll.scrollLeft - offsets.x,
5142 y: rect.top + scroll.scrollTop - offsets.y,
5143 width: rect.width,
5144 height: rect.height
5145 };
5146 }
5147
5148 function order(modifiers) {
5149 var map = new Map();
5150 var visited = new Set();
5151 var result = [];
5152 modifiers.forEach(function (modifier) {
5153 map.set(modifier.name, modifier);
5154 }); // On visiting object, check for its dependencies and visit them recursively
5155
5156 function sort(modifier) {
5157 visited.add(modifier.name);
5158 var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
5159 requires.forEach(function (dep) {
5160 if (!visited.has(dep)) {
5161 var depModifier = map.get(dep);
5162
5163 if (depModifier) {
5164 sort(depModifier);
5165 }
5166 }
5167 });
5168 result.push(modifier);
5169 }
5170
5171 modifiers.forEach(function (modifier) {
5172 if (!visited.has(modifier.name)) {
5173 // check for visited object
5174 sort(modifier);
5175 }
5176 });
5177 return result;
5178 }
5179
5180 function orderModifiers(modifiers) {
5181 // order based on dependencies
5182 var orderedModifiers = order(modifiers); // order based on phase
5183
5184 return modifierPhases.reduce(function (acc, phase) {
5185 return acc.concat(orderedModifiers.filter(function (modifier) {
5186 return modifier.phase === phase;
5187 }));
5188 }, []);
5189 }
5190
5191 function debounce(fn) {
5192 var pending;
5193 return function () {
5194 if (!pending) {
5195 pending = new Promise(function (resolve) {
5196 Promise.resolve().then(function () {
5197 pending = undefined;
5198 resolve(fn());
5199 });
5200 });
5201 }
5202
5203 return pending;
5204 };
5205 }
5206
5207 function mergeByName(modifiers) {
5208 var merged = modifiers.reduce(function (merged, current) {
5209 var existing = merged[current.name];
5210 merged[current.name] = existing ? Object.assign({}, existing, current, {
5211 options: Object.assign({}, existing.options, current.options),
5212 data: Object.assign({}, existing.data, current.data)
5213 }) : current;
5214 return merged;
5215 }, {}); // IE11 does not support Object.values
5216
5217 return Object.keys(merged).map(function (key) {
5218 return merged[key];
5219 });
5220 }
5221
5222 var DEFAULT_OPTIONS = {
5223 placement: 'bottom',
5224 modifiers: [],
5225 strategy: 'absolute'
5226 };
5227
5228 function areValidElements() {
5229 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5230 args[_key] = arguments[_key];
5231 }
5232
5233 return !args.some(function (element) {
5234 return !(element && typeof element.getBoundingClientRect === 'function');
5235 });
5236 }
5237
5238 function popperGenerator(generatorOptions) {
5239 if (generatorOptions === void 0) {
5240 generatorOptions = {};
5241 }
5242
5243 var _generatorOptions = generatorOptions,
5244 _generatorOptions$def = _generatorOptions.defaultModifiers,
5245 defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
5246 _generatorOptions$def2 = _generatorOptions.defaultOptions,
5247 defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
5248 return function createPopper(reference, popper, options) {
5249 if (options === void 0) {
5250 options = defaultOptions;
5251 }
5252
5253 var state = {
5254 placement: 'bottom',
5255 orderedModifiers: [],
5256 options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
5257 modifiersData: {},
5258 elements: {
5259 reference: reference,
5260 popper: popper
5261 },
5262 attributes: {},
5263 styles: {}
5264 };
5265 var effectCleanupFns = [];
5266 var isDestroyed = false;
5267 var instance = {
5268 state: state,
5269 setOptions: function setOptions(setOptionsAction) {
5270 var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
5271 cleanupModifierEffects();
5272 state.options = Object.assign({}, defaultOptions, state.options, options);
5273 state.scrollParents = {
5274 reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
5275 popper: listScrollParents(popper)
5276 }; // Orders the modifiers based on their dependencies and `phase`
5277 // properties
5278
5279 var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
5280
5281 state.orderedModifiers = orderedModifiers.filter(function (m) {
5282 return m.enabled;
5283 });
5284 runModifierEffects();
5285 return instance.update();
5286 },
5287 // Sync update – it will always be executed, even if not necessary. This
5288 // is useful for low frequency updates where sync behavior simplifies the
5289 // logic.
5290 // For high frequency updates (e.g. `resize` and `scroll` events), always
5291 // prefer the async Popper#update method
5292 forceUpdate: function forceUpdate() {
5293 if (isDestroyed) {
5294 return;
5295 }
5296
5297 var _state$elements = state.elements,
5298 reference = _state$elements.reference,
5299 popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
5300 // anymore
5301
5302 if (!areValidElements(reference, popper)) {
5303 return;
5304 } // Store the reference and popper rects to be read by modifiers
5305
5306
5307 state.rects = {
5308 reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
5309 popper: getLayoutRect(popper)
5310 }; // Modifiers have the ability to reset the current update cycle. The
5311 // most common use case for this is the `flip` modifier changing the
5312 // placement, which then needs to re-run all the modifiers, because the
5313 // logic was previously ran for the previous placement and is therefore
5314 // stale/incorrect
5315
5316 state.reset = false;
5317 state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
5318 // is filled with the initial data specified by the modifier. This means
5319 // it doesn't persist and is fresh on each update.
5320 // To ensure persistent data, use `${name}#persistent`
5321
5322 state.orderedModifiers.forEach(function (modifier) {
5323 return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
5324 });
5325
5326 for (var index = 0; index < state.orderedModifiers.length; index++) {
5327 if (state.reset === true) {
5328 state.reset = false;
5329 index = -1;
5330 continue;
5331 }
5332
5333 var _state$orderedModifie = state.orderedModifiers[index],
5334 fn = _state$orderedModifie.fn,
5335 _state$orderedModifie2 = _state$orderedModifie.options,
5336 _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
5337 name = _state$orderedModifie.name;
5338
5339 if (typeof fn === 'function') {
5340 state = fn({
5341 state: state,
5342 options: _options,
5343 name: name,
5344 instance: instance
5345 }) || state;
5346 }
5347 }
5348 },
5349 // Async and optimistically optimized update – it will not be executed if
5350 // not necessary (debounced to run at most once-per-tick)
5351 update: debounce(function () {
5352 return new Promise(function (resolve) {
5353 instance.forceUpdate();
5354 resolve(state);
5355 });
5356 }),
5357 destroy: function destroy() {
5358 cleanupModifierEffects();
5359 isDestroyed = true;
5360 }
5361 };
5362
5363 if (!areValidElements(reference, popper)) {
5364 return instance;
5365 }
5366
5367 instance.setOptions(options).then(function (state) {
5368 if (!isDestroyed && options.onFirstUpdate) {
5369 options.onFirstUpdate(state);
5370 }
5371 }); // Modifiers have the ability to execute arbitrary code before the first
5372 // update cycle runs. They will be executed in the same order as the update
5373 // cycle. This is useful when a modifier adds some persistent data that
5374 // other modifiers need to use, but the modifier is run after the dependent
5375 // one.
5376
5377 function runModifierEffects() {
5378 state.orderedModifiers.forEach(function (_ref) {
5379 var name = _ref.name,
5380 _ref$options = _ref.options,
5381 options = _ref$options === void 0 ? {} : _ref$options,
5382 effect = _ref.effect;
5383
5384 if (typeof effect === 'function') {
5385 var cleanupFn = effect({
5386 state: state,
5387 name: name,
5388 instance: instance,
5389 options: options
5390 });
5391
5392 var noopFn = function noopFn() {};
5393
5394 effectCleanupFns.push(cleanupFn || noopFn);
5395 }
5396 });
5397 }
5398
5399 function cleanupModifierEffects() {
5400 effectCleanupFns.forEach(function (fn) {
5401 return fn();
5402 });
5403 effectCleanupFns = [];
5404 }
5405
5406 return instance;
5407 };
5408 }
5409
5410 var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
5411 var createPopper = /*#__PURE__*/popperGenerator({
5412 defaultModifiers: defaultModifiers
5413 }); // eslint-disable-next-line import/no-unused-modules
5414
5415 /* global Map:readonly, Set:readonly, ArrayBuffer:readonly */
5416
5417 var hasElementType = typeof Element !== 'undefined';
5418 var hasMap = typeof Map === 'function';
5419 var hasSet = typeof Set === 'function';
5420 var hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;
5421
5422 // Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js
5423
5424 function equal(a, b) {
5425 // START: fast-deep-equal es6/index.js 3.1.3
5426 if (a === b) return true;
5427
5428 if (a && b && typeof a == 'object' && typeof b == 'object') {
5429 if (a.constructor !== b.constructor) return false;
5430
5431 var length, i, keys;
5432 if (Array.isArray(a)) {
5433 length = a.length;
5434 if (length != b.length) return false;
5435 for (i = length; i-- !== 0;)
5436 if (!equal(a[i], b[i])) return false;
5437 return true;
5438 }
5439
5440 // START: Modifications:
5441 // 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
5442 // to co-exist with es5.
5443 // 2. Replace `for of` with es5 compliant iteration using `for`.
5444 // Basically, take:
5445 //
5446 // ```js
5447 // for (i of a.entries())
5448 // if (!b.has(i[0])) return false;
5449 // ```
5450 //
5451 // ... and convert to:
5452 //
5453 // ```js
5454 // it = a.entries();
5455 // while (!(i = it.next()).done)
5456 // if (!b.has(i.value[0])) return false;
5457 // ```
5458 //
5459 // **Note**: `i` access switches to `i.value`.
5460 var it;
5461 if (hasMap && (a instanceof Map) && (b instanceof Map)) {
5462 if (a.size !== b.size) return false;
5463 it = a.entries();
5464 while (!(i = it.next()).done)
5465 if (!b.has(i.value[0])) return false;
5466 it = a.entries();
5467 while (!(i = it.next()).done)
5468 if (!equal(i.value[1], b.get(i.value[0]))) return false;
5469 return true;
5470 }
5471
5472 if (hasSet && (a instanceof Set) && (b instanceof Set)) {
5473 if (a.size !== b.size) return false;
5474 it = a.entries();
5475 while (!(i = it.next()).done)
5476 if (!b.has(i.value[0])) return false;
5477 return true;
5478 }
5479 // END: Modifications
5480
5481 if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
5482 length = a.length;
5483 if (length != b.length) return false;
5484 for (i = length; i-- !== 0;)
5485 if (a[i] !== b[i]) return false;
5486 return true;
5487 }
5488
5489 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
5490 // START: Modifications:
5491 // Apply guards for `Object.create(null)` handling. See:
5492 // - https://github.com/FormidableLabs/react-fast-compare/issues/64
5493 // - https://github.com/epoberezkin/fast-deep-equal/issues/49
5494 if (a.valueOf !== Object.prototype.valueOf && typeof a.valueOf === 'function' && typeof b.valueOf === 'function') return a.valueOf() === b.valueOf();
5495 if (a.toString !== Object.prototype.toString && typeof a.toString === 'function' && typeof b.toString === 'function') return a.toString() === b.toString();
5496 // END: Modifications
5497
5498 keys = Object.keys(a);
5499 length = keys.length;
5500 if (length !== Object.keys(b).length) return false;
5501
5502 for (i = length; i-- !== 0;)
5503 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
5504 // END: fast-deep-equal
5505
5506 // START: react-fast-compare
5507 // custom handling for DOM elements
5508 if (hasElementType && a instanceof Element) return false;
5509
5510 // custom handling for React/Preact
5511 for (i = length; i-- !== 0;) {
5512 if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {
5513 // React-specific: avoid traversing React elements' _owner
5514 // Preact-specific: avoid traversing Preact elements' __v and __o
5515 // __v = $_original / $_vnode
5516 // __o = $_owner
5517 // These properties contain circular references and are not needed when
5518 // comparing the actual elements (and not their owners)
5519 // .$$typeof and ._store on just reasonable markers of elements
5520
5521 continue;
5522 }
5523
5524 // all other properties should be traversed as usual
5525 if (!equal(a[keys[i]], b[keys[i]])) return false;
5526 }
5527 // END: react-fast-compare
5528
5529 // START: fast-deep-equal
5530 return true;
5531 }
5532
5533 return a !== a && b !== b;
5534 }
5535 // end fast-deep-equal
5536
5537 var reactFastCompare = function isEqual(a, b) {
5538 try {
5539 return equal(a, b);
5540 } catch (error) {
5541 if (((error.message || '').match(/stack|recursion/i))) {
5542 // warn on circular references, don't crash
5543 // browsers give this different errors name and messages:
5544 // chrome/safari: "RangeError", "Maximum call stack size exceeded"
5545 // firefox: "InternalError", too much recursion"
5546 // edge: "Error", "Out of stack space"
5547 console.warn('react-fast-compare cannot handle circular refs');
5548 return false;
5549 }
5550 // some other error. we should definitely know about these
5551 throw error;
5552 }
5553 };
5554
5555 var EMPTY_MODIFIERS = [];
5556 var usePopper = function usePopper(referenceElement, popperElement, options) {
5557 if (options === void 0) {
5558 options = {};
5559 }
5560
5561 var prevOptions = React__namespace.useRef(null);
5562 var optionsWithDefaults = {
5563 onFirstUpdate: options.onFirstUpdate,
5564 placement: options.placement || 'bottom',
5565 strategy: options.strategy || 'absolute',
5566 modifiers: options.modifiers || EMPTY_MODIFIERS
5567 };
5568
5569 var _React$useState = React__namespace.useState({
5570 styles: {
5571 popper: {
5572 position: optionsWithDefaults.strategy,
5573 left: '0',
5574 top: '0'
5575 },
5576 arrow: {
5577 position: 'absolute'
5578 }
5579 },
5580 attributes: {}
5581 }),
5582 state = _React$useState[0],
5583 setState = _React$useState[1];
5584
5585 var updateStateModifier = React__namespace.useMemo(function () {
5586 return {
5587 name: 'updateState',
5588 enabled: true,
5589 phase: 'write',
5590 fn: function fn(_ref) {
5591 var state = _ref.state;
5592 var elements = Object.keys(state.elements);
5593 ReactDOM__namespace.flushSync(function () {
5594 setState({
5595 styles: fromEntries(elements.map(function (element) {
5596 return [element, state.styles[element] || {}];
5597 })),
5598 attributes: fromEntries(elements.map(function (element) {
5599 return [element, state.attributes[element]];
5600 }))
5601 });
5602 });
5603 },
5604 requires: ['computeStyles']
5605 };
5606 }, []);
5607 var popperOptions = React__namespace.useMemo(function () {
5608 var newOptions = {
5609 onFirstUpdate: optionsWithDefaults.onFirstUpdate,
5610 placement: optionsWithDefaults.placement,
5611 strategy: optionsWithDefaults.strategy,
5612 modifiers: [].concat(optionsWithDefaults.modifiers, [updateStateModifier, {
5613 name: 'applyStyles',
5614 enabled: false
5615 }])
5616 };
5617
5618 if (reactFastCompare(prevOptions.current, newOptions)) {
5619 return prevOptions.current || newOptions;
5620 } else {
5621 prevOptions.current = newOptions;
5622 return newOptions;
5623 }
5624 }, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);
5625 var popperInstanceRef = React__namespace.useRef();
5626 useIsomorphicLayoutEffect(function () {
5627 if (popperInstanceRef.current) {
5628 popperInstanceRef.current.setOptions(popperOptions);
5629 }
5630 }, [popperOptions]);
5631 useIsomorphicLayoutEffect(function () {
5632 if (referenceElement == null || popperElement == null) {
5633 return;
5634 }
5635
5636 var createPopper$1 = options.createPopper || createPopper;
5637 var popperInstance = createPopper$1(referenceElement, popperElement, popperOptions);
5638 popperInstanceRef.current = popperInstance;
5639 return function () {
5640 popperInstance.destroy();
5641 popperInstanceRef.current = null;
5642 };
5643 }, [referenceElement, popperElement, options.createPopper]);
5644 return {
5645 state: popperInstanceRef.current ? popperInstanceRef.current.state : null,
5646 styles: state.styles,
5647 attributes: state.attributes,
5648 update: popperInstanceRef.current ? popperInstanceRef.current.update : null,
5649 forceUpdate: popperInstanceRef.current ? popperInstanceRef.current.forceUpdate : null
5650 };
5651 };
5652
5653 var setPopperWidth = {
5654 enabled: true,
5655 fn: function fn(data) {
5656 // eslint-disable-next-line no-param-reassign
5657 data.state.styles.popper.width = "".concat(data.state.rects.reference.width, "px");
5658 },
5659 name: 'setPopperWidth',
5660 phase: 'write'
5661 };
5662 function getModifiers(props) {
5663 var modifiers = [{
5664 enabled: !!props.flip,
5665 name: 'flip'
5666 }];
5667 if (props.align !== 'right' && props.align !== 'left') {
5668 modifiers.push(setPopperWidth);
5669 }
5670 return modifiers;
5671 }
5672 function getPlacement(props) {
5673 var x = props.align === 'right' ? 'end' : 'start';
5674 var y = props.dropup ? 'top' : 'bottom';
5675 return "".concat(y, "-").concat(x);
5676 }
5677 function useOverlay(referenceElement, options) {
5678 var _useState = React.useState(null),
5679 _useState2 = _slicedToArray(_useState, 2),
5680 popperElement = _useState2[0],
5681 attachRef = _useState2[1];
5682 var _usePopper = usePopper(referenceElement, popperElement, {
5683 modifiers: getModifiers(options),
5684 placement: getPlacement(options),
5685 strategy: options.positionFixed ? 'fixed' : 'absolute'
5686 }),
5687 attributes = _usePopper.attributes,
5688 styles = _usePopper.styles,
5689 forceUpdate = _usePopper.forceUpdate;
5690 var refElementHeight = referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetHeight;
5691
5692 // Re-position the popper if the height of the reference element changes.
5693 // Exclude `forceUpdate` from dependencies since it changes with each render.
5694 React.useEffect(function () {
5695 forceUpdate && forceUpdate();
5696 }, [refElementHeight]); // eslint-disable-line
5697
5698 return _objectSpread2(_objectSpread2({}, attributes.popper), {}, {
5699 innerRef: attachRef,
5700 style: styles.popper
5701 });
5702 }
5703
5704 var _excluded$9 = ["referenceElement", "isMenuShown"];
5705
5706 // `Element` is not defined during server-side rendering, so shim it here.
5707 /* istanbul ignore next */
5708 var SafeElement = typeof Element === 'undefined' ? noop$1 : Element;
5709 var propTypes$6 = {
5710 /**
5711 * Specify menu alignment. The default value is `justify`, which makes the
5712 * menu as wide as the input and truncates long values. Specifying `left`
5713 * or `right` will align the menu to that side and the width will be
5714 * determined by the length of menu item values.
5715 */
5716 align: propTypes$b.exports.oneOf(ALIGN_VALUES),
5717 children: propTypes$b.exports.func.isRequired,
5718 /**
5719 * Specify whether the menu should appear above the input.
5720 */
5721 dropup: propTypes$b.exports.bool,
5722 /**
5723 * Whether or not to automatically adjust the position of the menu when it
5724 * reaches the viewport boundaries.
5725 */
5726 flip: propTypes$b.exports.bool,
5727 isMenuShown: propTypes$b.exports.bool,
5728 positionFixed: propTypes$b.exports.bool,
5729 // @ts-ignore
5730 referenceElement: propTypes$b.exports.instanceOf(SafeElement)
5731 };
5732 var Overlay = function Overlay(_ref) {
5733 var referenceElement = _ref.referenceElement,
5734 isMenuShown = _ref.isMenuShown,
5735 props = _objectWithoutProperties(_ref, _excluded$9);
5736 var overlayProps = useOverlay(referenceElement, props);
5737 if (!isMenuShown) {
5738 return null;
5739 }
5740 return props.children(overlayProps);
5741 };
5742 Overlay.propTypes = propTypes$6;
5743
5744 /* eslint-disable no-bitwise, no-cond-assign */
5745
5746 /**
5747 * Checks if an element contains another given element.
5748 *
5749 * @param context the context element
5750 * @param node the element to check
5751 */
5752 function contains(context, node) {
5753 // HTML DOM and SVG DOM may have different support levels,
5754 // so we need to check on context instead of a document root element.
5755 if (context.contains) return context.contains(node);
5756 if (context.compareDocumentPosition) return context === node || !!(context.compareDocumentPosition(node) & 16);
5757 }
5758
5759 var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
5760
5761 /* eslint-disable no-return-assign */
5762 var optionsSupported = false;
5763 var onceSupported = false;
5764
5765 try {
5766 var options = {
5767 get passive() {
5768 return optionsSupported = true;
5769 },
5770
5771 get once() {
5772 // eslint-disable-next-line no-multi-assign
5773 return onceSupported = optionsSupported = true;
5774 }
5775
5776 };
5777
5778 if (canUseDOM) {
5779 window.addEventListener('test', options, options);
5780 window.removeEventListener('test', options, true);
5781 }
5782 } catch (e) {
5783 /* */
5784 }
5785
5786 /**
5787 * An `addEventListener` ponyfill, supports the `once` option
5788 *
5789 * @param node the element
5790 * @param eventName the event name
5791 * @param handle the handler
5792 * @param options event options
5793 */
5794 function addEventListener(node, eventName, handler, options) {
5795 if (options && typeof options !== 'boolean' && !onceSupported) {
5796 var once = options.once,
5797 capture = options.capture;
5798 var wrappedHandler = handler;
5799
5800 if (!onceSupported && once) {
5801 wrappedHandler = handler.__once || function onceHandler(event) {
5802 this.removeEventListener(eventName, onceHandler, capture);
5803 handler.call(this, event);
5804 };
5805
5806 handler.__once = wrappedHandler;
5807 }
5808
5809 node.addEventListener(eventName, wrappedHandler, optionsSupported ? options : capture);
5810 }
5811
5812 node.addEventListener(eventName, handler, options);
5813 }
5814
5815 /**
5816 * A `removeEventListener` ponyfill
5817 *
5818 * @param node the element
5819 * @param eventName the event name
5820 * @param handle the handler
5821 * @param options event options
5822 */
5823 function removeEventListener(node, eventName, handler, options) {
5824 var capture = options && typeof options !== 'boolean' ? options.capture : options;
5825 node.removeEventListener(eventName, handler, capture);
5826
5827 if (handler.__once) {
5828 node.removeEventListener(eventName, handler.__once, capture);
5829 }
5830 }
5831
5832 function listen(node, eventName, handler, options) {
5833 addEventListener(node, eventName, handler, options);
5834 return function () {
5835 removeEventListener(node, eventName, handler, options);
5836 };
5837 }
5838
5839 /**
5840 * Creates a `Ref` whose value is updated in an effect, ensuring the most recent
5841 * value is the one rendered with. Generally only required for Concurrent mode usage
5842 * where previous work in `render()` may be discarded before being used.
5843 *
5844 * This is safe to access in an event handler.
5845 *
5846 * @param value The `Ref` value
5847 */
5848 function useCommittedRef(value) {
5849 const ref = React.useRef(value);
5850 React.useEffect(() => {
5851 ref.current = value;
5852 }, [value]);
5853 return ref;
5854 }
5855
5856 function useEventCallback(fn) {
5857 const ref = useCommittedRef(fn);
5858 return React.useCallback(function (...args) {
5859 return ref.current && ref.current(...args);
5860 }, [ref]);
5861 }
5862
5863 /**
5864 * Returns the owner document of a given element.
5865 *
5866 * @param node the element
5867 */
5868 function ownerDocument$1(node) {
5869 return node && node.ownerDocument || document;
5870 }
5871
5872 function safeFindDOMNode(componentOrElement) {
5873 if (componentOrElement && 'setState' in componentOrElement) {
5874 return ReactDOM__default["default"].findDOMNode(componentOrElement);
5875 }
5876
5877 return componentOrElement != null ? componentOrElement : null;
5878 }
5879
5880 var ownerDocument = (function (componentOrElement) {
5881 return ownerDocument$1(safeFindDOMNode(componentOrElement));
5882 });
5883
5884 var escapeKeyCode = 27;
5885
5886 var noop = function noop() {};
5887
5888 function isLeftClickEvent(event) {
5889 return event.button === 0;
5890 }
5891
5892 function isModifiedEvent(event) {
5893 return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
5894 }
5895
5896 var getRefTarget = function getRefTarget(ref) {
5897 return ref && ('current' in ref ? ref.current : ref);
5898 };
5899
5900 /**
5901 * The `useRootClose` hook registers your callback on the document
5902 * when rendered. Powers the `<Overlay/>` component. This is used achieve modal
5903 * style behavior where your callback is triggered when the user tries to
5904 * interact with the rest of the document or hits the `esc` key.
5905 *
5906 * @param {Ref<HTMLElement>| HTMLElement} ref The element boundary
5907 * @param {function} onRootClose
5908 * @param {object=} options
5909 * @param {boolean=} options.disabled
5910 * @param {string=} options.clickTrigger The DOM event name (click, mousedown, etc) to attach listeners on
5911 */
5912 function useRootClose$1(ref, onRootClose, _temp) {
5913 var _ref = _temp === void 0 ? {} : _temp,
5914 disabled = _ref.disabled,
5915 _ref$clickTrigger = _ref.clickTrigger,
5916 clickTrigger = _ref$clickTrigger === void 0 ? 'click' : _ref$clickTrigger;
5917
5918 var preventMouseRootCloseRef = React.useRef(false);
5919 var onClose = onRootClose || noop;
5920 var handleMouseCapture = React.useCallback(function (e) {
5921 var _e$composedPath$;
5922
5923 var currentTarget = getRefTarget(ref);
5924 warning_1(!!currentTarget, 'RootClose captured a close event but does not have a ref to compare it to. ' + 'useRootClose(), should be passed a ref that resolves to a DOM node');
5925 preventMouseRootCloseRef.current = !currentTarget || isModifiedEvent(e) || !isLeftClickEvent(e) || !!contains(currentTarget, (_e$composedPath$ = e.composedPath == null ? void 0 : e.composedPath()[0]) != null ? _e$composedPath$ : e.target);
5926 }, [ref]);
5927 var handleMouse = useEventCallback(function (e) {
5928 if (!preventMouseRootCloseRef.current) {
5929 onClose(e);
5930 }
5931 });
5932 var handleKeyUp = useEventCallback(function (e) {
5933 if (e.keyCode === escapeKeyCode) {
5934 onClose(e);
5935 }
5936 });
5937 React.useEffect(function () {
5938 if (disabled || ref == null) return undefined; // Store the current event to avoid triggering handlers immediately
5939 // https://github.com/facebook/react/issues/20074
5940
5941 var currentEvent = window.event;
5942 var doc = ownerDocument(getRefTarget(ref)); // Use capture for this listener so it fires before React's listener, to
5943 // avoid false positives in the contains() check below if the target DOM
5944 // element is removed in the React mouse callback.
5945
5946 var removeMouseCaptureListener = listen(doc, clickTrigger, handleMouseCapture, true);
5947 var removeMouseListener = listen(doc, clickTrigger, function (e) {
5948 // skip if this event is the same as the one running when we added the handlers
5949 if (e === currentEvent) {
5950 currentEvent = undefined;
5951 return;
5952 }
5953
5954 handleMouse(e);
5955 });
5956 var removeKeyupListener = listen(doc, 'keyup', function (e) {
5957 // skip if this event is the same as the one running when we added the handlers
5958 if (e === currentEvent) {
5959 currentEvent = undefined;
5960 return;
5961 }
5962
5963 handleKeyUp(e);
5964 });
5965 var mobileSafariHackListeners = [];
5966
5967 if ('ontouchstart' in doc.documentElement) {
5968 mobileSafariHackListeners = [].slice.call(doc.body.children).map(function (el) {
5969 return listen(el, 'mousemove', noop);
5970 });
5971 }
5972
5973 return function () {
5974 removeMouseCaptureListener();
5975 removeMouseListener();
5976 removeKeyupListener();
5977 mobileSafariHackListeners.forEach(function (remove) {
5978 return remove();
5979 });
5980 };
5981 }, [ref, disabled, clickTrigger, handleMouseCapture, handleMouse, handleKeyUp]);
5982 }
5983
5984 function useRootClose(onRootClose, options) {
5985 var rootElementRef = React.useRef(null);
5986 useRootClose$1(rootElementRef.current, onRootClose, options);
5987 return rootElementRef;
5988 }
5989
5990 var _excluded$8 = ["children", "onRootClose"];
5991 function RootClose(_ref) {
5992 var children = _ref.children,
5993 onRootClose = _ref.onRootClose,
5994 props = _objectWithoutProperties(_ref, _excluded$8);
5995 var rootRef = useRootClose(onRootClose, props);
5996 return children(rootRef);
5997 }
5998
5999 var _excluded$7 = ["onBlur", "onClick", "onFocus", "onRemove", "option"];
6000 var propTypes$5 = {
6001 onBlur: propTypes$b.exports.func,
6002 onClick: propTypes$b.exports.func,
6003 onFocus: propTypes$b.exports.func,
6004 onRemove: propTypes$b.exports.func,
6005 option: optionType.isRequired
6006 };
6007 function useToken(_ref) {
6008 var onBlur = _ref.onBlur,
6009 onClick = _ref.onClick,
6010 onFocus = _ref.onFocus,
6011 onRemove = _ref.onRemove,
6012 option = _ref.option,
6013 props = _objectWithoutProperties(_ref, _excluded$7);
6014 var _useState = React.useState(false),
6015 _useState2 = _slicedToArray(_useState, 2),
6016 active = _useState2[0],
6017 setActive = _useState2[1];
6018 var _useState3 = React.useState(null),
6019 _useState4 = _slicedToArray(_useState3, 2),
6020 rootElement = _useState4[0],
6021 attachRef = _useState4[1];
6022 var handleBlur = function handleBlur(e) {
6023 setActive(false);
6024 onBlur && onBlur(e);
6025 };
6026 var handleClick = function handleClick(e) {
6027 setActive(true);
6028 onClick && onClick(e);
6029 };
6030 var handleFocus = function handleFocus(e) {
6031 setActive(true);
6032 onFocus && onFocus(e);
6033 };
6034 var handleRemove = function handleRemove() {
6035 onRemove && onRemove(option);
6036 };
6037 var handleKeyDown = function handleKeyDown(e) {
6038 if (e.key === 'Backspace' && active) {
6039 // Prevent browser from going back.
6040 e.preventDefault();
6041 handleRemove();
6042 }
6043 };
6044 useRootClose$1(rootElement, handleBlur, _objectSpread2(_objectSpread2({}, props), {}, {
6045 disabled: !active
6046 }));
6047 return {
6048 active: active,
6049 onBlur: handleBlur,
6050 onClick: handleClick,
6051 onFocus: handleFocus,
6052 onKeyDown: handleKeyDown,
6053 onRemove: isFunction(onRemove) ? handleRemove : undefined,
6054 ref: attachRef
6055 };
6056 }
6057
6058 /* istanbul ignore next */
6059 function withToken(Component) {
6060 warn(false, 'Warning: `withToken` is deprecated and will be removed in the next ' + 'major version. Use `useToken` instead.');
6061 var displayName = "withToken(".concat(getDisplayName(Component), ")");
6062 var WrappedToken = function WrappedToken(props) {
6063 return /*#__PURE__*/React__default["default"].createElement(Component, _extends({}, props, useToken(props)));
6064 };
6065 WrappedToken.displayName = displayName;
6066 WrappedToken.propTypes = propTypes$5;
6067 return WrappedToken;
6068 }
6069
6070 var _excluded$6 = ["active", "children", "className", "onRemove", "tabIndex"],
6071 _excluded2 = ["children", "option", "readOnly"],
6072 _excluded3 = ["ref"];
6073 var InteractiveToken = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
6074 var active = _ref.active,
6075 children = _ref.children,
6076 className = _ref.className,
6077 onRemove = _ref.onRemove,
6078 tabIndex = _ref.tabIndex,
6079 props = _objectWithoutProperties(_ref, _excluded$6);
6080 return /*#__PURE__*/React__default["default"].createElement("div", _extends({}, props, {
6081 className: cx('rbt-token', 'rbt-token-removeable', {
6082 'rbt-token-active': !!active
6083 }, className),
6084 ref: ref,
6085 tabIndex: tabIndex || 0
6086 }), children, /*#__PURE__*/React__default["default"].createElement(ClearButton, {
6087 className: "rbt-token-remove-button",
6088 label: "Remove",
6089 onClick: onRemove,
6090 tabIndex: -1
6091 }));
6092 });
6093 var StaticToken = function StaticToken(_ref2) {
6094 var children = _ref2.children,
6095 className = _ref2.className,
6096 disabled = _ref2.disabled,
6097 href = _ref2.href;
6098 var classnames = cx('rbt-token', {
6099 'rbt-token-disabled': disabled
6100 }, className);
6101 if (href && !disabled) {
6102 return /*#__PURE__*/React__default["default"].createElement("a", {
6103 className: classnames,
6104 href: href
6105 }, children);
6106 }
6107 return /*#__PURE__*/React__default["default"].createElement("div", {
6108 className: classnames
6109 }, children);
6110 };
6111 /**
6112 * Individual token component, generally displayed within the
6113 * `TypeaheadInputMulti` component, but can also be rendered on its own.
6114 */
6115 var Token = function Token(_ref3) {
6116 var children = _ref3.children,
6117 option = _ref3.option,
6118 readOnly = _ref3.readOnly,
6119 props = _objectWithoutProperties(_ref3, _excluded2);
6120 var _useToken = useToken(_objectSpread2(_objectSpread2({}, props), {}, {
6121 option: option
6122 })),
6123 ref = _useToken.ref,
6124 tokenProps = _objectWithoutProperties(_useToken, _excluded3);
6125 var child = /*#__PURE__*/React__default["default"].createElement("div", {
6126 className: "rbt-token-label"
6127 }, children);
6128 return !props.disabled && !readOnly && isFunction(tokenProps.onRemove) ? /*#__PURE__*/React__default["default"].createElement(InteractiveToken, _extends({}, props, tokenProps, {
6129 ref: ref
6130 }), child) : /*#__PURE__*/React__default["default"].createElement(StaticToken, props, child);
6131 };
6132
6133 // IE doesn't seem to get the composite computed value (eg: 'padding',
6134 // 'borderStyle', etc.), so generate these from the individual values.
6135 function interpolateStyle(styles, attr) {
6136 var subattr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
6137 // Title-case the sub-attribute.
6138 if (subattr) {
6139 /* eslint-disable-next-line no-param-reassign */
6140 subattr = subattr.replace(subattr[0], subattr[0].toUpperCase());
6141 }
6142 return ['Top', 'Right', 'Bottom', 'Left'].map(function (dir) {
6143 return styles["".concat(attr).concat(dir).concat(subattr)];
6144 }).join(' ');
6145 }
6146 function copyStyles(inputNode, hintNode) {
6147 var inputStyle = window.getComputedStyle(inputNode);
6148
6149 /* eslint-disable no-param-reassign */
6150 hintNode.style.borderStyle = interpolateStyle(inputStyle, 'border', 'style');
6151 hintNode.style.borderWidth = interpolateStyle(inputStyle, 'border', 'width');
6152 hintNode.style.fontSize = inputStyle.fontSize;
6153 hintNode.style.fontWeight = inputStyle.fontWeight;
6154 hintNode.style.height = inputStyle.height;
6155 hintNode.style.lineHeight = inputStyle.lineHeight;
6156 hintNode.style.margin = interpolateStyle(inputStyle, 'margin');
6157 hintNode.style.padding = interpolateStyle(inputStyle, 'padding');
6158 /* eslint-enable no-param-reassign */
6159 }
6160
6161 var useHint = function useHint() {
6162 var _useTypeaheadContext = useTypeaheadContext(),
6163 hintText = _useTypeaheadContext.hintText,
6164 inputNode = _useTypeaheadContext.inputNode;
6165 var hintRef = React.useRef(null);
6166 React.useEffect(function () {
6167 if (inputNode && hintRef.current) {
6168 copyStyles(inputNode, hintRef.current);
6169 }
6170 });
6171 return {
6172 hintRef: hintRef,
6173 hintText: hintText
6174 };
6175 };
6176 var Hint = function Hint(_ref) {
6177 var children = _ref.children,
6178 className = _ref.className;
6179 var _useHint = useHint(),
6180 hintRef = _useHint.hintRef,
6181 hintText = _useHint.hintText;
6182 return /*#__PURE__*/React__default["default"].createElement("div", {
6183 className: className,
6184 style: {
6185 display: 'flex',
6186 flex: 1,
6187 height: '100%',
6188 position: 'relative'
6189 }
6190 }, children, /*#__PURE__*/React__default["default"].createElement("input", {
6191 "aria-hidden": true,
6192 className: "rbt-input-hint",
6193 ref: hintRef,
6194 readOnly: true,
6195 style: {
6196 backgroundColor: 'transparent',
6197 borderColor: 'transparent',
6198 boxShadow: 'none',
6199 color: 'rgba(0, 0, 0, 0.54)',
6200 left: 0,
6201 pointerEvents: 'none',
6202 position: 'absolute',
6203 top: 0,
6204 width: '100%'
6205 },
6206 tabIndex: -1,
6207 value: hintText
6208 }));
6209 };
6210
6211 var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
6212 return /*#__PURE__*/React__default["default"].createElement("input", _extends({}, props, {
6213 className: cx('rbt-input-main', props.className),
6214 ref: ref
6215 }));
6216 });
6217
6218 var _excluded$5 = ["children", "className", "inputClassName", "inputRef", "referenceElementRef", "selected"];
6219 function TypeaheadInputMulti(props) {
6220 var wrapperRef = React__default["default"].useRef(null);
6221 var inputElem = React__default["default"].useRef(null);
6222 var _propsWithBsClassName = propsWithBsClassName(props),
6223 children = _propsWithBsClassName.children,
6224 className = _propsWithBsClassName.className,
6225 inputClassName = _propsWithBsClassName.inputClassName;
6226 _propsWithBsClassName.inputRef;
6227 var referenceElementRef = _propsWithBsClassName.referenceElementRef,
6228 selected = _propsWithBsClassName.selected,
6229 rest = _objectWithoutProperties(_propsWithBsClassName, _excluded$5);
6230 function getInputRef(input) {
6231 inputElem.current = input;
6232 props.inputRef(input);
6233 }
6234
6235 /**
6236 * Forward click or focus events on the container element to the input.
6237 */
6238 function handleContainerClickOrFocus(e) {
6239 // Don't focus the input if it's disabled.
6240 if (props.disabled) {
6241 e.currentTarget.blur();
6242 return;
6243 }
6244 var inputNode = inputElem.current;
6245 if (!inputNode ||
6246 // Ignore if the clicked element is a child of the container, ie: a token
6247 // or the input itself.
6248 e.currentTarget.contains(e.target) && e.currentTarget !== e.target) {
6249 return;
6250 }
6251 if (isSelectable(inputNode)) {
6252 // Move cursor to the end if the user clicks outside the actual input.
6253 inputNode.selectionStart = inputNode.value.length;
6254 }
6255 inputNode.focus();
6256 }
6257 function handleKeyDown(e) {
6258 if (e.key === 'Backspace' && selected.length && !props.value) {
6259 var _wrapperRef$current;
6260 // Prevent browser from going back.
6261 e.preventDefault();
6262
6263 // If the input is selected and there is no text, focus the last
6264 // token when the user hits backspace.
6265
6266 var wrapperChildren = (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.children;
6267 if (wrapperChildren !== null && wrapperChildren !== void 0 && wrapperChildren.length) {
6268 var lastToken = wrapperChildren[wrapperChildren.length - 2];
6269 lastToken === null || lastToken === void 0 || lastToken.focus();
6270 }
6271 }
6272 props.onKeyDown && props.onKeyDown(e);
6273 }
6274 return /*#__PURE__*/React__default["default"].createElement("div", {
6275 className: cx('rbt-input-multi', {
6276 disabled: props.disabled
6277 }, className),
6278 onClick: handleContainerClickOrFocus,
6279 onFocus: handleContainerClickOrFocus,
6280 ref: referenceElementRef,
6281 tabIndex: -1
6282 }, /*#__PURE__*/React__default["default"].createElement("div", {
6283 className: "rbt-input-wrapper",
6284 ref: wrapperRef
6285 }, children, /*#__PURE__*/React__default["default"].createElement(Hint, null, /*#__PURE__*/React__default["default"].createElement(Input, _extends({}, rest, {
6286 className: inputClassName,
6287 onKeyDown: handleKeyDown,
6288 ref: getInputRef,
6289 style: {
6290 backgroundColor: 'transparent',
6291 border: 0,
6292 boxShadow: 'none',
6293 cursor: 'inherit',
6294 outline: 'none',
6295 padding: 0,
6296 width: '100%',
6297 zIndex: 1
6298 }
6299 })))));
6300 }
6301
6302 var _excluded$4 = ["inputRef", "referenceElementRef"];
6303 var TypeaheadInputSingle = function TypeaheadInputSingle(_ref) {
6304 var inputRef = _ref.inputRef,
6305 referenceElementRef = _ref.referenceElementRef,
6306 props = _objectWithoutProperties(_ref, _excluded$4);
6307 return /*#__PURE__*/React__default["default"].createElement(Hint, null, /*#__PURE__*/React__default["default"].createElement(Input, _extends({}, propsWithBsClassName(props), {
6308 ref: function ref(node) {
6309 inputRef(node);
6310 referenceElementRef(node);
6311 }
6312 })));
6313 };
6314
6315 var propTypes$4 = {
6316 children: propTypes$b.exports.string.isRequired,
6317 highlightClassName: propTypes$b.exports.string,
6318 search: propTypes$b.exports.string.isRequired
6319 };
6320 /**
6321 * Stripped-down version of https://github.com/helior/react-highlighter
6322 *
6323 * Results are already filtered by the time the component is used internally so
6324 * we can safely ignore case and diacritical marks for the purposes of matching.
6325 */
6326 var Highlighter = function Highlighter(_ref) {
6327 var children = _ref.children,
6328 _ref$highlightClassNa = _ref.highlightClassName,
6329 highlightClassName = _ref$highlightClassNa === void 0 ? 'rbt-highlight-text' : _ref$highlightClassNa,
6330 search = _ref.search;
6331 if (!search || !children) {
6332 return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, children);
6333 }
6334 var matchCount = 0;
6335 var remaining = children;
6336 var highlighterChildren = [];
6337 while (remaining) {
6338 var bounds = getMatchBounds(remaining, search);
6339
6340 // No match anywhere in the remaining string, stop.
6341 if (!bounds) {
6342 highlighterChildren.push(remaining);
6343 break;
6344 }
6345
6346 // Capture the string that leads up to a match.
6347 var nonMatch = remaining.slice(0, bounds.start);
6348 if (nonMatch) {
6349 highlighterChildren.push(nonMatch);
6350 }
6351
6352 // Capture the matching string.
6353 var match = remaining.slice(bounds.start, bounds.end);
6354 highlighterChildren.push( /*#__PURE__*/React__default["default"].createElement("mark", {
6355 className: highlightClassName,
6356 key: matchCount
6357 }, match));
6358 matchCount += 1;
6359
6360 // And if there's anything left over, continue the loop.
6361 remaining = remaining.slice(bounds.end);
6362 }
6363 return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, highlighterChildren);
6364 };
6365 Highlighter.propTypes = propTypes$4;
6366
6367 const t=t=>"object"==typeof t&&null!=t&&1===t.nodeType,e$1=(t,e)=>(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e$1(o.overflowY,n)||e$1(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return !1},o$1=(t,e,n,o,l,r,i,s)=>r<t&&i>e||r>t&&i<e?0:r<=t&&s<=n||i>=e&&s>=n?r-t-o:i>e&&s<n||r<t&&s>n?i-e+l:0,l=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},r=(e,r)=>{var i,s,d,h;if("undefined"==typeof document)return [];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=r,p="function"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&p(W);){if(W=l(W),W===m){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W);}const b=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,H=null!=(h=null==(d=window.visualViewport)?void 0:d.height)?h:innerHeight,{scrollX:y,scrollY:M}=window,{height:v,width:E,top:x,right:C,bottom:I,left:R}=e.getBoundingClientRect(),{top:T,right:B,bottom:F,left:V}=(t=>{const e=window.getComputedStyle(t);return {top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(e);let k="start"===f||"nearest"===f?x-T:"end"===f?I+F:x+v/2-T+F,D="center"===u?R+E/2-V+B:"end"===u?C+B:R-V;const L=[];for(let t=0;t<w.length;t++){const e=w[t],{height:n,width:l,top:r,right:i,bottom:s,left:d}=e.getBoundingClientRect();if("if-needed"===c&&x>=0&&R>=0&&I<=H&&C<=b&&x>=r&&I<=s&&R>=d&&C<=i)return L;const h=getComputedStyle(e),a=parseInt(h.borderLeftWidth,10),g=parseInt(h.borderTopWidth,10),p=parseInt(h.borderRightWidth,10),W=parseInt(h.borderBottomWidth,10);let T=0,B=0;const F="offsetWidth"in e?e.offsetWidth-e.clientWidth-a-p:0,V="offsetHeight"in e?e.offsetHeight-e.clientHeight-g-W:0,S="offsetWidth"in e?0===e.offsetWidth?0:l/e.offsetWidth:0,X="offsetHeight"in e?0===e.offsetHeight?0:n/e.offsetHeight:0;if(m===e)T="start"===f?k:"end"===f?k-H:"nearest"===f?o$1(M,M+H,H,g,W,M+k,M+k+v,v):k-H/2,B="start"===u?D:"center"===u?D-b/2:"end"===u?D-b:o$1(y,y+b,b,a,p,y+D,y+D+E,E),T=Math.max(0,T+M),B=Math.max(0,B+y);else {T="start"===f?k-r-g:"end"===f?k-s+W+V:"nearest"===f?o$1(r,s,n,g,W+V,k,k+v,v):k-(r+n/2)+V/2,B="start"===u?D-d-a:"center"===u?D-(d+l/2)+F/2:"end"===u?D-i+p+F:o$1(d,i,l,a,p+F,D,D+E,E);const{scrollLeft:t,scrollTop:h}=e;T=0===X?0:Math.max(0,Math.min(h+T/X,e.scrollHeight-n/X+V)),B=0===S?0:Math.max(0,Math.min(t+B/S,e.scrollWidth-l/S+F)),k+=h-T,D+=t-B;}L.push({el:e,top:T,left:B});}return L};
6368
6369 const o=t=>!1===t?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&0!==Object.keys(t).length)(t)?t:{block:"start",inline:"nearest"};function e(e,r$1){if(!e.isConnected||!(t=>{let o=t;for(;o&&o.parentNode;){if(o.parentNode===document)return !0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode;}return !1})(e))return;const n=(t=>{const o=window.getComputedStyle(t);return {top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(e);if((t=>"object"==typeof t&&"function"==typeof t.behavior)(r$1))return r$1.behavior(r(e,r$1));const l="boolean"==typeof r$1||null==r$1?void 0:r$1.behavior;for(const{el:a,top:i,left:s}of r(e,o(r$1))){const t=i-n.top+n.bottom,o=s-n.left+n.right;a.scroll({top:t,left:o,behavior:l});}}
6370
6371 var _excluded$3 = ["label", "onClick", "option", "position"];
6372 var propTypes$3 = {
6373 option: optionType.isRequired,
6374 position: propTypes$b.exports.number
6375 };
6376 function useItem(_ref) {
6377 var label = _ref.label,
6378 onClick = _ref.onClick,
6379 option = _ref.option,
6380 position = _ref.position,
6381 props = _objectWithoutProperties(_ref, _excluded$3);
6382 var _useTypeaheadContext = useTypeaheadContext(),
6383 activeIndex = _useTypeaheadContext.activeIndex,
6384 id = _useTypeaheadContext.id,
6385 isOnlyResult = _useTypeaheadContext.isOnlyResult,
6386 onActiveItemChange = _useTypeaheadContext.onActiveItemChange,
6387 onInitialItemChange = _useTypeaheadContext.onInitialItemChange,
6388 onMenuItemClick = _useTypeaheadContext.onMenuItemClick,
6389 setItem = _useTypeaheadContext.setItem;
6390 var itemRef = React.useRef(null);
6391 React.useEffect(function () {
6392 if (position === 0) {
6393 onInitialItemChange(option);
6394 }
6395 });
6396 React.useEffect(function () {
6397 if (position === activeIndex) {
6398 onActiveItemChange(option);
6399
6400 // Automatically scroll the menu as the user keys through it.
6401 var node = itemRef.current;
6402 node && e(node, {
6403 boundary: node.parentNode,
6404 scrollMode: 'if-needed'
6405 });
6406 }
6407 }, [activeIndex, onActiveItemChange, option, position]);
6408 var handleClick = React.useCallback(function (e) {
6409 onMenuItemClick(option, e);
6410 onClick && onClick(e);
6411 }, [onClick, onMenuItemClick, option]);
6412 var active = isOnlyResult || activeIndex === position;
6413
6414 // Update the item's position in the item stack.
6415 setItem(option, position);
6416 return _objectSpread2(_objectSpread2({}, props), {}, {
6417 active: active,
6418 'aria-label': label,
6419 'aria-selected': active,
6420 id: getMenuItemId(id, position),
6421 onClick: handleClick,
6422 onMouseDown: preventInputBlur,
6423 ref: itemRef,
6424 role: 'option'
6425 });
6426 }
6427
6428 /* istanbul ignore next */
6429 function withItem(Component) {
6430 warn(false, 'Warning: `withItem` is deprecated and will be removed in the next ' + 'major version. Use `useItem` instead.');
6431 var WrappedMenuItem = function WrappedMenuItem(props) {
6432 return /*#__PURE__*/React__default["default"].createElement(Component, _extends({}, props, useItem(props)));
6433 };
6434 WrappedMenuItem.displayName = "withItem(".concat(getDisplayName(Component), ")");
6435 WrappedMenuItem.propTypes = propTypes$3;
6436 return WrappedMenuItem;
6437 }
6438
6439 var _excluded$2 = ["active", "children", "className", "disabled", "onClick"];
6440 var BaseMenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
6441 var active = _ref.active,
6442 children = _ref.children,
6443 className = _ref.className,
6444 disabled = _ref.disabled,
6445 _onClick = _ref.onClick,
6446 props = _objectWithoutProperties(_ref, _excluded$2);
6447 return /*#__PURE__*/React__default["default"].createElement("a", _extends({}, props, {
6448 className: cx('dropdown-item', {
6449 active: active,
6450 disabled: disabled
6451 }, className),
6452 href: props.href || '#',
6453 onClick: function onClick(e) {
6454 e.preventDefault();
6455 !disabled && _onClick && _onClick(e);
6456 },
6457 ref: ref
6458 }), children);
6459 });
6460 function MenuItem(props) {
6461 return /*#__PURE__*/React__default["default"].createElement(BaseMenuItem, useItem(props));
6462 }
6463
6464 var _excluded$1 = ["emptyLabel", "innerRef", "maxHeight", "style"];
6465 var MenuDivider = function MenuDivider() {
6466 return /*#__PURE__*/React__default["default"].createElement("div", {
6467 className: "dropdown-divider",
6468 role: "separator"
6469 });
6470 };
6471 var MenuHeader = function MenuHeader(props) {
6472 return (
6473 /*#__PURE__*/
6474 // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
6475 React__default["default"].createElement("div", _extends({}, props, {
6476 className: "dropdown-header",
6477 role: "heading"
6478 }))
6479 );
6480 };
6481 var propTypes$2 = {
6482 'aria-label': propTypes$b.exports.string,
6483 /**
6484 * Message to display in the menu if there are no valid results.
6485 */
6486 emptyLabel: propTypes$b.exports.node,
6487 /**
6488 * Needed for accessibility.
6489 */
6490 id: checkPropType(propTypes$b.exports.oneOfType([propTypes$b.exports.number, propTypes$b.exports.string]), isRequiredForA11y),
6491 /**
6492 * Maximum height of the dropdown menu.
6493 */
6494 maxHeight: propTypes$b.exports.string
6495 };
6496 /**
6497 * Menu component that handles empty state when passed a set of results.
6498 */
6499 var Menu = function Menu(_ref) {
6500 var _ref$emptyLabel = _ref.emptyLabel,
6501 emptyLabel = _ref$emptyLabel === void 0 ? 'No matches found.' : _ref$emptyLabel,
6502 innerRef = _ref.innerRef,
6503 _ref$maxHeight = _ref.maxHeight,
6504 maxHeight = _ref$maxHeight === void 0 ? '300px' : _ref$maxHeight,
6505 style = _ref.style,
6506 props = _objectWithoutProperties(_ref, _excluded$1);
6507 var children = React.Children.count(props.children) === 0 ? /*#__PURE__*/React__default["default"].createElement(BaseMenuItem, {
6508 disabled: true,
6509 role: "option"
6510 }, emptyLabel) : props.children;
6511 return (
6512 /*#__PURE__*/
6513 /* eslint-disable jsx-a11y/interactive-supports-focus */
6514 React__default["default"].createElement("div", _extends({}, props, {
6515 "aria-label": props['aria-label'] || 'menu-options',
6516 className: cx('rbt-menu', 'dropdown-menu', 'show', props.className),
6517 onMouseDown:
6518 // Prevent input from blurring when clicking on the menu scrollbar.
6519 preventInputBlur,
6520 ref: innerRef,
6521 role: "listbox",
6522 style: _objectSpread2(_objectSpread2({}, style), {}, {
6523 display: 'block',
6524 maxHeight: maxHeight,
6525 overflow: 'auto'
6526 })
6527 }), children)
6528 /* eslint-enable jsx-a11y/interactive-supports-focus */
6529 );
6530 };
6531
6532 Menu.propTypes = propTypes$2;
6533 Menu.Divider = MenuDivider;
6534 Menu.Header = MenuHeader;
6535
6536 var _excluded = ["labelKey", "newSelectionPrefix", "options", "paginationText", "renderMenuItemChildren", "text"];
6537 var propTypes$1 = {
6538 /**
6539 * Provides the ability to specify a prefix before the user-entered text to
6540 * indicate that the selection will be new. No-op unless `allowNew={true}`.
6541 */
6542 newSelectionPrefix: propTypes$b.exports.node,
6543 /**
6544 * Prompt displayed when large data sets are paginated.
6545 */
6546 paginationText: propTypes$b.exports.node,
6547 /**
6548 * Provides a hook for customized rendering of menu item contents.
6549 */
6550 renderMenuItemChildren: propTypes$b.exports.func
6551 };
6552 function renderMenuItemChildrenFn(option, props) {
6553 return /*#__PURE__*/React__default["default"].createElement(Highlighter, {
6554 search: props.text
6555 }, getOptionLabel(option, props.labelKey));
6556 }
6557 var TypeaheadMenu = function TypeaheadMenu(props) {
6558 var labelKey = props.labelKey,
6559 _props$newSelectionPr = props.newSelectionPrefix,
6560 newSelectionPrefix = _props$newSelectionPr === void 0 ? 'New selection: ' : _props$newSelectionPr,
6561 options = props.options,
6562 _props$paginationText = props.paginationText,
6563 paginationText = _props$paginationText === void 0 ? 'Display additional results...' : _props$paginationText,
6564 _props$renderMenuItem = props.renderMenuItemChildren,
6565 renderMenuItemChildren = _props$renderMenuItem === void 0 ? renderMenuItemChildrenFn : _props$renderMenuItem,
6566 text = props.text,
6567 menuProps = _objectWithoutProperties(props, _excluded);
6568 var renderMenuItem = function renderMenuItem(option, position) {
6569 var label = getOptionLabel(option, labelKey);
6570 var menuItemProps = {
6571 disabled: !!getOptionProperty(option, 'disabled'),
6572 label: label,
6573 option: option,
6574 position: position
6575 };
6576 if (getOptionProperty(option, 'customOption')) {
6577 return /*#__PURE__*/React__default["default"].createElement(MenuItem, _extends({}, menuItemProps, {
6578 className: "rbt-menu-custom-option",
6579 key: position,
6580 label: label
6581 }), newSelectionPrefix, /*#__PURE__*/React__default["default"].createElement(Highlighter, {
6582 search: text
6583 }, label));
6584 }
6585 if (getOptionProperty(option, 'paginationOption')) {
6586 return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
6587 key: "pagination-option-divider"
6588 }, /*#__PURE__*/React__default["default"].createElement(Menu.Divider, null), /*#__PURE__*/React__default["default"].createElement(MenuItem, _extends({}, menuItemProps, {
6589 className: "rbt-menu-pagination-option",
6590 label:
6591 // TODO: Fix how (aria-)labels are passed to `MenuItem`.
6592 // `paginationText` can be a ReactNode.
6593 isString(paginationText) ? paginationText : ''
6594 }), paginationText));
6595 }
6596 return /*#__PURE__*/React__default["default"].createElement(MenuItem, _extends({}, menuItemProps, {
6597 key: position
6598 }), renderMenuItemChildren(option, props, position));
6599 };
6600 return /*#__PURE__*/React__default["default"].createElement(Menu, _extends({}, menuProps, {
6601 key:
6602 // Force a re-render if the text changes to ensure that menu
6603 // positioning updates correctly.
6604 text
6605 }), options.map(renderMenuItem));
6606 };
6607 TypeaheadMenu.propTypes = propTypes$1;
6608
6609 var propTypes = {
6610 /**
6611 * Displays a button to clear the input when there are selections.
6612 */
6613 clearButton: propTypes$b.exports.bool,
6614 /**
6615 * Props to be applied directly to the input. `onBlur`, `onChange`,
6616 * `onFocus`, and `onKeyDown` are ignored.
6617 */
6618 inputProps: checkPropType(propTypes$b.exports.object, inputPropsType),
6619 /**
6620 * Bootstrap 4 only. Adds the `is-invalid` classname to the `form-control`.
6621 */
6622 isInvalid: propTypes$b.exports.bool,
6623 /**
6624 * Indicate whether an asynchronous data fetch is happening.
6625 */
6626 isLoading: propTypes$b.exports.bool,
6627 /**
6628 * Bootstrap 4 only. Adds the `is-valid` classname to the `form-control`.
6629 */
6630 isValid: propTypes$b.exports.bool,
6631 /**
6632 * Callback for custom input rendering.
6633 */
6634 renderInput: propTypes$b.exports.func,
6635 /**
6636 * Callback for custom menu rendering.
6637 */
6638 renderMenu: propTypes$b.exports.func,
6639 /**
6640 * Callback for custom menu rendering.
6641 */
6642 renderToken: propTypes$b.exports.func,
6643 /**
6644 * Specifies the size of the input.
6645 */
6646 size: sizeType
6647 };
6648 var defaultProps = {
6649 isLoading: false
6650 };
6651 var defaultRenderMenu = function defaultRenderMenu(results, menuProps, props) {
6652 return /*#__PURE__*/React__default["default"].createElement(TypeaheadMenu, _extends({}, menuProps, {
6653 labelKey: props.labelKey,
6654 options: results,
6655 text: props.text
6656 }));
6657 };
6658 var defaultRenderToken = function defaultRenderToken(option, props, idx) {
6659 return /*#__PURE__*/React__default["default"].createElement(Token, {
6660 disabled: props.disabled,
6661 key: idx,
6662 onRemove: props.onRemove,
6663 option: option,
6664 tabIndex: props.tabIndex
6665 }, getOptionLabel(option, props.labelKey));
6666 };
6667 var overlayPropKeys = ['align', 'dropup', 'flip', 'positionFixed'];
6668 function getOverlayProps(props) {
6669 return pick(props, overlayPropKeys);
6670 }
6671 var TypeaheadComponent = /*#__PURE__*/function (_React$Component) {
6672 _inherits(TypeaheadComponent, _React$Component);
6673 var _super = _createSuper(TypeaheadComponent);
6674 function TypeaheadComponent() {
6675 var _this;
6676 _classCallCheck(this, TypeaheadComponent);
6677 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
6678 args[_key] = arguments[_key];
6679 }
6680 _this = _super.call.apply(_super, [this].concat(args));
6681 _defineProperty(_assertThisInitialized(_this), "_referenceElement", null);
6682 _defineProperty(_assertThisInitialized(_this), "referenceElementRef", function (referenceElement) {
6683 _this._referenceElement = referenceElement;
6684 });
6685 _defineProperty(_assertThisInitialized(_this), "_renderInput", function (inputProps, props) {
6686 var _this$props = _this.props,
6687 isInvalid = _this$props.isInvalid,
6688 isValid = _this$props.isValid,
6689 multiple = _this$props.multiple,
6690 renderInput = _this$props.renderInput,
6691 renderToken = _this$props.renderToken,
6692 size = _this$props.size;
6693 if (isFunction(renderInput)) {
6694 return renderInput(inputProps, props);
6695 }
6696 var commonProps = _objectSpread2(_objectSpread2({}, inputProps), {}, {
6697 isInvalid: isInvalid,
6698 isValid: isValid,
6699 size: size
6700 });
6701 if (!multiple) {
6702 return /*#__PURE__*/React__default["default"].createElement(TypeaheadInputSingle, commonProps);
6703 }
6704 var labelKey = props.labelKey,
6705 onRemove = props.onRemove,
6706 selected = props.selected;
6707 return /*#__PURE__*/React__default["default"].createElement(TypeaheadInputMulti, _extends({}, commonProps, {
6708 placeholder: selected.length ? '' : inputProps.placeholder,
6709 selected: selected
6710 }), selected.map(function (option, idx) {
6711 return (renderToken || defaultRenderToken)(option, _objectSpread2(_objectSpread2({}, commonProps), {}, {
6712 labelKey: labelKey,
6713 onRemove: onRemove
6714 }), idx);
6715 }));
6716 });
6717 _defineProperty(_assertThisInitialized(_this), "_renderMenu", function (results, menuProps, props) {
6718 var _this$props2 = _this.props,
6719 emptyLabel = _this$props2.emptyLabel,
6720 id = _this$props2.id,
6721 maxHeight = _this$props2.maxHeight,
6722 newSelectionPrefix = _this$props2.newSelectionPrefix,
6723 paginationText = _this$props2.paginationText,
6724 renderMenu = _this$props2.renderMenu,
6725 renderMenuItemChildren = _this$props2.renderMenuItemChildren;
6726 return (renderMenu || defaultRenderMenu)(results, _objectSpread2(_objectSpread2({}, menuProps), {}, {
6727 emptyLabel: emptyLabel,
6728 id: id,
6729 maxHeight: maxHeight,
6730 newSelectionPrefix: newSelectionPrefix,
6731 paginationText: paginationText,
6732 renderMenuItemChildren: renderMenuItemChildren
6733 }), props);
6734 });
6735 _defineProperty(_assertThisInitialized(_this), "_renderAux", function (_ref) {
6736 var onClear = _ref.onClear,
6737 selected = _ref.selected;
6738 var _this$props3 = _this.props,
6739 clearButton = _this$props3.clearButton,
6740 disabled = _this$props3.disabled,
6741 isLoading = _this$props3.isLoading,
6742 size = _this$props3.size;
6743 var content;
6744 if (isLoading) {
6745 content = /*#__PURE__*/React__default["default"].createElement(Loader, null);
6746 } else if (clearButton && !disabled && selected.length) {
6747 content = /*#__PURE__*/React__default["default"].createElement(ClearButton, {
6748 onClick: onClear,
6749 onMouseDown: preventInputBlur,
6750 size: size
6751 });
6752 }
6753 return content ? /*#__PURE__*/React__default["default"].createElement("div", {
6754 className: cx('rbt-aux', {
6755 'rbt-aux-lg': isSizeLarge(size)
6756 })
6757 }, content) : null;
6758 });
6759 return _this;
6760 }
6761 _createClass(TypeaheadComponent, [{
6762 key: "render",
6763 value: function render() {
6764 var _this2 = this;
6765 var _this$props4 = this.props,
6766 children = _this$props4.children,
6767 className = _this$props4.className,
6768 instanceRef = _this$props4.instanceRef,
6769 open = _this$props4.open,
6770 options = _this$props4.options,
6771 style = _this$props4.style;
6772 return /*#__PURE__*/React__default["default"].createElement(Typeahead, _extends({}, this.props, {
6773 options: options,
6774 ref: instanceRef
6775 }), function (props) {
6776 var hideMenu = props.hideMenu,
6777 isMenuShown = props.isMenuShown,
6778 results = props.results;
6779 var auxContent = _this2._renderAux(props);
6780 return /*#__PURE__*/React__default["default"].createElement(RootClose, {
6781 disabled: open || !isMenuShown,
6782 onRootClose: hideMenu
6783 }, function (ref) {
6784 return /*#__PURE__*/React__default["default"].createElement("div", {
6785 className: cx('rbt', {
6786 'has-aux': !!auxContent,
6787 'is-invalid': _this2.props.isInvalid,
6788 'is-valid': _this2.props.isValid
6789 }, className),
6790 ref: ref,
6791 style: _objectSpread2(_objectSpread2({}, style), {}, {
6792 outline: 'none',
6793 position: 'relative'
6794 }),
6795 tabIndex: -1
6796 }, _this2._renderInput(_objectSpread2(_objectSpread2({}, props.getInputProps(_this2.props.inputProps)), {}, {
6797 referenceElementRef: _this2.referenceElementRef
6798 }), props), /*#__PURE__*/React__default["default"].createElement(Overlay, _extends({}, getOverlayProps(_this2.props), {
6799 isMenuShown: isMenuShown,
6800 referenceElement: _this2._referenceElement
6801 }), function (menuProps) {
6802 return _this2._renderMenu(results, menuProps, props);
6803 }), auxContent, isFunction(children) ? children(props) : children);
6804 });
6805 });
6806 }
6807 }]);
6808 return TypeaheadComponent;
6809 }(React__default["default"].Component);
6810 _defineProperty(TypeaheadComponent, "propTypes", propTypes);
6811 _defineProperty(TypeaheadComponent, "defaultProps", defaultProps);
6812 var TypeaheadComponent$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
6813 return /*#__PURE__*/React__default["default"].createElement(TypeaheadComponent, _extends({}, props, {
6814 instanceRef: ref
6815 }));
6816 });
6817
6818 var AsyncTypeahead = /*#__PURE__*/React.forwardRef(function (props, ref) {
6819 return /*#__PURE__*/React__default["default"].createElement(TypeaheadComponent$1, _extends({}, useAsync(props), {
6820 ref: ref
6821 }));
6822 });
6823
6824 exports.AsyncTypeahead = AsyncTypeahead;
6825 exports.BaseMenuItem = BaseMenuItem;
6826 exports.ClearButton = ClearButton;
6827 exports.Highlighter = Highlighter;
6828 exports.Hint = Hint;
6829 exports.Input = Input;
6830 exports.Loader = Loader;
6831 exports.Menu = Menu;
6832 exports.MenuItem = MenuItem;
6833 exports.Token = Token;
6834 exports.Typeahead = TypeaheadComponent$1;
6835 exports.TypeaheadInputMulti = TypeaheadInputMulti;
6836 exports.TypeaheadInputSingle = TypeaheadInputSingle;
6837 exports.TypeaheadMenu = TypeaheadMenu;
6838 exports.TypeaheadRef = Typeahead;
6839 exports.useAsync = useAsync;
6840 exports.useHint = useHint;
6841 exports.useItem = useItem;
6842 exports.useToken = useToken;
6843 exports.withAsync = withAsync;
6844 exports.withItem = withItem;
6845 exports.withToken = withToken;
6846
6847 Object.defineProperty(exports, '__esModule', { value: true });
6848
6849}));