· 5 years ago · Feb 05, 2021, 09:44 PM
1(window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([[11],{
2
3/***/ "2uMm":
4/***/ (function(module, exports, __webpack_require__) {
5
6"use strict";
7
8
9if (true) {
10 module.exports = __webpack_require__("YnIC");
11} else {}
12
13
14/***/ }),
15
16/***/ "Ig4x":
17/***/ (function(module, __webpack_exports__, __webpack_require__) {
18
19"use strict";
20/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CheckboxState; });
21/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return SubmitContainer; });
22/* unused harmony export SubmitHelp */
23/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return SubmitTerms; });
24/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return SubmitTip; });
25/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return FormMessage; });
26/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return VerticallyCenteredForm; });
27/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return InputsContainer; });
28/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return FieldError; });
29/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return FormFieldError; });
30/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("q1tI");
31/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
32/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("vOnD");
33/* harmony import */ var polished__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("ufqH");
34/* harmony import */ var formik__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("KYPV");
35/* harmony import */ var _style_motion__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("WUNS");
36/* harmony import */ var _components_Ui_Form_Input__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("fjfa");
37
38var __jsx = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement;
39
40
41
42
43
44var CheckboxState = styled_components__WEBPACK_IMPORTED_MODULE_1__["default"].div.withConfig({
45 displayName: "Form__CheckboxState",
46 componentId: "mlsxs-0"
47})(["", " transition-duration:0.1s;display:flex;align-items:center;justify-content:center;width:var(--checkboxStateSize);height:var(--checkboxStateSize);border-radius:5px;border:2px solid ", ";background-color:", ";&::after{", " transition-duration:0.1s;content:'';opacity:0;transform:scale(0);width:100%;height:100%;background-image:url('/images/icons/check-light.svg');background-repeat:no-repeat;background-position:center;background-size:12px 10px;}input:hover ~ &{background-color:", ";}input:focus ~ &{outline:2px solid var(--brandSecondary);}input:checked ~ &{border-color:", ";background-color:", ";&::after{opacity:1;transform:scale(1);}}", ""], Object(_style_motion__WEBPACK_IMPORTED_MODULE_4__[/* sharedTransition */ "a"])('border-color, background-color'), function (_ref) {
48 var theme = _ref.theme;
49 return theme.mode === 'light' ? Object(polished__WEBPACK_IMPORTED_MODULE_2__[/* transparentize */ "f"])('0.6', theme.colors.blank) : Object(polished__WEBPACK_IMPORTED_MODULE_2__[/* transparentize */ "f"])('0.4', theme.brandPrimary);
50}, function (_ref2) {
51 var theme = _ref2.theme;
52 return theme.mode === 'light' ? null : 'var(--colors-blank)';
53}, Object(_style_motion__WEBPACK_IMPORTED_MODULE_4__[/* sharedTransition */ "a"])('opacity, transform'), function (_ref3) {
54 var theme = _ref3.theme;
55 return theme.mode === 'light' ? Object(polished__WEBPACK_IMPORTED_MODULE_2__[/* transparentize */ "f"])('0.8', theme.colors.blank) : 'var(--brandPrimaryTransparentized)';
56}, function (_ref4) {
57 var theme = _ref4.theme;
58 return theme.mode === 'light' ? Object(polished__WEBPACK_IMPORTED_MODULE_2__[/* transparentize */ "f"])('0.4', theme.colors.blank) : "var(--brandPrimary)";
59}, function (_ref5) {
60 var theme = _ref5.theme;
61 return theme.mode === 'light' ? null : "var(--brandPrimary)";
62}, function (_ref6) {
63 var $size = _ref6.$size;
64
65 switch ($size) {
66 case 'small':
67 {
68 return Object(styled_components__WEBPACK_IMPORTED_MODULE_1__["css"])(["--checkboxStateSize:16px;border-width:1.5px;border-radius:3px;&::after{background-size:8px 6px;}"]);
69 }
70
71 default:
72 return null;
73 }
74});
75var SubmitContainer = styled_components__WEBPACK_IMPORTED_MODULE_1__["default"].div.withConfig({
76 displayName: "Form__SubmitContainer",
77 componentId: "mlsxs-1"
78})(["--spacingTop:50px;display:flex;flex-direction:column;align-items:center;margin-top:var(--spacingTop);text-align:center;@media screen and (min-width:", "){--spacingTop:100px;}@media screen and (min-width:", "){--spacingTop:150px;}"], function (_ref7) {
79 var theme = _ref7.theme;
80 return theme.screenMedium;
81}, function (_ref8) {
82 var theme = _ref8.theme;
83 return theme.screenLarge;
84});
85var SubmitHelp = styled_components__WEBPACK_IMPORTED_MODULE_1__["default"].span.withConfig({
86 displayName: "Form__SubmitHelp",
87 componentId: "mlsxs-2"
88})(["font-size:13px;line-height:16px;color:var(--colors-blank);opacity:0.5;margin-top:17px;"]);
89var SubmitTerms = styled_components__WEBPACK_IMPORTED_MODULE_1__["default"].p.withConfig({
90 displayName: "Form__SubmitTerms",
91 componentId: "mlsxs-3"
92})(["font-weight:normal;font-size:14px;line-height:17px;color:var(--colors-blank);margin:40px 0 0;text-align:center;span{opacity:0.6;}a{opacity:1;}"]);
93var SubmitTip = styled_components__WEBPACK_IMPORTED_MODULE_1__["default"].p.withConfig({
94 displayName: "Form__SubmitTip",
95 componentId: "mlsxs-4"
96})(["font-size:13px;line-height:16px;opacity:0.5;margin:17px 0;"]);
97var FormMessage = styled_components__WEBPACK_IMPORTED_MODULE_1__["default"].div.withConfig({
98 displayName: "Form__FormMessage",
99 componentId: "mlsxs-5"
100})(["--spacingX:24px;--spacingY:18px;--iconReferenceWidth:22px;--iconSpacingX:16px;position:relative;padding:var(--spacingY) var(--spacingX);padding-left:calc(var(--spacingX) + var(--iconReferenceWidth) + var(--iconSpacingX));margin-bottom:16px;border-radius:5px;color:var(--colors-bayoux);background-color:#f7f7fc;border:1.5px solid ", ";text-align:left;line-height:1.5;&::before{content:'';display:block;width:22px;height:22px;position:absolute;left:var(--spacingX);top:var(--spacingY);background-repeat:no-repeat;background-image:url('/images/form/message-info.svg');}a{text-decoration:underline;}a,strong{font-weight:500;}", " ", " ", ""], function (_ref9) {
101 var theme = _ref9.theme;
102 return Object(polished__WEBPACK_IMPORTED_MODULE_2__[/* transparentize */ "f"])('0.5', theme.brandPrimary);
103}, function (props) {
104 return props.error && Object(styled_components__WEBPACK_IMPORTED_MODULE_1__["css"])(["background-color:rgb(256,246,246);border-color:rgba(255,74,90,0.5);&::before{background-image:url('/images/form/message-error.svg');}"]);
105}, function (props) {
106 return props.warning && Object(styled_components__WEBPACK_IMPORTED_MODULE_1__["css"])(["background-color:#fffbf5;border-color:#e9b34a;&::before{background-image:url('/images/form/message-warning.svg');}"]);
107}, function (props) {
108 return props.success && Object(styled_components__WEBPACK_IMPORTED_MODULE_1__["css"])(["background-color:#f3fafb;border-color:#01b0bb;&::before{width:23px;background-image:url('/images/form/message-success.svg');}"]);
109});
110var VerticallyCenteredForm = styled_components__WEBPACK_IMPORTED_MODULE_1__["default"].form.withConfig({
111 displayName: "Form__VerticallyCenteredForm",
112 componentId: "mlsxs-6"
113})(["flex-grow:1;flex-shrink:0;display:flex;flex-direction:column;", "{margin:0;}"], SubmitContainer);
114var InputsContainer = styled_components__WEBPACK_IMPORTED_MODULE_1__["default"].div.withConfig({
115 displayName: "Form__InputsContainer",
116 componentId: "mlsxs-7"
117})(["margin:var(--dynamicFormContainerMargin,45px 0 80px);flex-grow:1;display:flex;flex-direction:column;justify-content:center;"]);
118var FieldError = styled_components__WEBPACK_IMPORTED_MODULE_1__["default"].div.withConfig({
119 displayName: "Form__FieldError",
120 componentId: "mlsxs-8"
121})(["font-size:13px;line-height:1.2;color:var(--colors-redPink);opacity:1;text-align:", ";white-space:initial;", "{display:inline;}"], function (props) {
122 return props.textCenter ? 'center' : 'inherit';
123}, _components_Ui_Form_Input__WEBPACK_IMPORTED_MODULE_5__[/* LabelText */ "h"]);
124var InvisibleFieldError = Object(styled_components__WEBPACK_IMPORTED_MODULE_1__["default"])(FieldError).withConfig({
125 displayName: "Form__InvisibleFieldError",
126 componentId: "mlsxs-9"
127})(["visibility:hidden;"]);
128/**
129 * FormFieldError
130 *
131 * This component renders an error message if a field has
132 * an error and it's already been touched.
133 *
134 * preventJump - Endures a similar component is rendered in place
135 * so when it appears, the form elements dont jump
136 */
137
138var FormFieldError = Object(formik__WEBPACK_IMPORTED_MODULE_3__[/* connect */ "e"])(function (_ref10) {
139 var name = _ref10.name,
140 formik = _ref10.formik,
141 preventJump = _ref10.preventJump,
142 textCenter = _ref10.textCenter,
143 description = _ref10.description;
144 var error = Object(formik__WEBPACK_IMPORTED_MODULE_3__[/* getIn */ "f"])(formik.errors, name);
145 var touch = Object(formik__WEBPACK_IMPORTED_MODULE_3__[/* getIn */ "f"])(formik.touched, name);
146 var noErrorOutput = preventJump ? __jsx(InvisibleFieldError, null, "\xA0") : null;
147 return touch && error ? __jsx(FieldError, {
148 textCenter: textCenter
149 }, error, ' ', description && __jsx(_components_Ui_Form_Input__WEBPACK_IMPORTED_MODULE_5__[/* LabelText */ "h"], null, '- ', " ", description)) : noErrorOutput;
150});
151
152/***/ }),
153
154/***/ "KYPV":
155/***/ (function(module, __webpack_exports__, __webpack_require__) {
156
157"use strict";
158
159// EXPORTS
160__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ErrorMessage; });
161__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ Field; });
162__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ FieldArray; });
163__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ Formik; });
164__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ connect; });
165__webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ getIn; });
166__webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ useFormikContext; });
167
168// UNUSED EXPORTS: FastField, Form, FormikConsumer, FormikContext, FormikProvider, getActiveElement, insert, isEmptyArray, isEmptyChildren, isFunction, isInputEvent, isInteger, isNaN, isObject, isPromise, isString, move, prepareDataForValidation, replace, setIn, setNestedObjectValues, swap, useField, useFormik, validateYupSchema, withFormik, yupToFormErrors
169
170// EXTERNAL MODULE: ./node_modules/react/index.js
171var react = __webpack_require__("q1tI");
172
173// EXTERNAL MODULE: ./node_modules/react-fast-compare/index.js
174var react_fast_compare = __webpack_require__("bmMU");
175var react_fast_compare_default = /*#__PURE__*/__webpack_require__.n(react_fast_compare);
176
177// CONCATENATED MODULE: ./node_modules/deepmerge/dist/es.js
178var isMergeableObject = function isMergeableObject(value) {
179 return isNonNullObject(value)
180 && !isSpecial(value)
181};
182
183function isNonNullObject(value) {
184 return !!value && typeof value === 'object'
185}
186
187function isSpecial(value) {
188 var stringValue = Object.prototype.toString.call(value);
189
190 return stringValue === '[object RegExp]'
191 || stringValue === '[object Date]'
192 || isReactElement(value)
193}
194
195// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
196var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
197var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
198
199function isReactElement(value) {
200 return value.$$typeof === REACT_ELEMENT_TYPE
201}
202
203function emptyTarget(val) {
204 return Array.isArray(val) ? [] : {}
205}
206
207function cloneUnlessOtherwiseSpecified(value, options) {
208 return (options.clone !== false && options.isMergeableObject(value))
209 ? deepmerge(emptyTarget(value), value, options)
210 : value
211}
212
213function defaultArrayMerge(target, source, options) {
214 return target.concat(source).map(function(element) {
215 return cloneUnlessOtherwiseSpecified(element, options)
216 })
217}
218
219function mergeObject(target, source, options) {
220 var destination = {};
221 if (options.isMergeableObject(target)) {
222 Object.keys(target).forEach(function(key) {
223 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
224 });
225 }
226 Object.keys(source).forEach(function(key) {
227 if (!options.isMergeableObject(source[key]) || !target[key]) {
228 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
229 } else {
230 destination[key] = deepmerge(target[key], source[key], options);
231 }
232 });
233 return destination
234}
235
236function deepmerge(target, source, options) {
237 options = options || {};
238 options.arrayMerge = options.arrayMerge || defaultArrayMerge;
239 options.isMergeableObject = options.isMergeableObject || isMergeableObject;
240
241 var sourceIsArray = Array.isArray(source);
242 var targetIsArray = Array.isArray(target);
243 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
244
245 if (!sourceAndTargetTypesMatch) {
246 return cloneUnlessOtherwiseSpecified(source, options)
247 } else if (sourceIsArray) {
248 return options.arrayMerge(target, source, options)
249 } else {
250 return mergeObject(target, source, options)
251 }
252}
253
254deepmerge.all = function deepmergeAll(array, options) {
255 if (!Array.isArray(array)) {
256 throw new Error('first argument should be an array')
257 }
258
259 return array.reduce(function(prev, next) {
260 return deepmerge(prev, next, options)
261 }, {})
262};
263
264var deepmerge_1 = deepmerge;
265
266/* harmony default export */ var es = (deepmerge_1);
267
268// EXTERNAL MODULE: ./node_modules/lodash-es/_baseGetTag.js + 2 modules
269var _baseGetTag = __webpack_require__("8M4i");
270
271// EXTERNAL MODULE: ./node_modules/lodash-es/_getPrototype.js
272var _getPrototype = __webpack_require__("UudT");
273
274// EXTERNAL MODULE: ./node_modules/lodash-es/isObjectLike.js
275var isObjectLike = __webpack_require__("EUcb");
276
277// CONCATENATED MODULE: ./node_modules/lodash-es/isPlainObject.js
278
279
280
281
282/** `Object#toString` result references. */
283var objectTag = '[object Object]';
284
285/** Used for built-in method references. */
286var funcProto = Function.prototype,
287 objectProto = Object.prototype;
288
289/** Used to resolve the decompiled source of functions. */
290var funcToString = funcProto.toString;
291
292/** Used to check objects for own properties. */
293var isPlainObject_hasOwnProperty = objectProto.hasOwnProperty;
294
295/** Used to infer the `Object` constructor. */
296var objectCtorString = funcToString.call(Object);
297
298/**
299 * Checks if `value` is a plain object, that is, an object created by the
300 * `Object` constructor or one with a `[[Prototype]]` of `null`.
301 *
302 * @static
303 * @memberOf _
304 * @since 0.8.0
305 * @category Lang
306 * @param {*} value The value to check.
307 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
308 * @example
309 *
310 * function Foo() {
311 * this.a = 1;
312 * }
313 *
314 * _.isPlainObject(new Foo);
315 * // => false
316 *
317 * _.isPlainObject([1, 2, 3]);
318 * // => false
319 *
320 * _.isPlainObject({ 'x': 0, 'y': 0 });
321 * // => true
322 *
323 * _.isPlainObject(Object.create(null));
324 * // => true
325 */
326function isPlainObject(value) {
327 if (!Object(isObjectLike["a" /* default */])(value) || Object(_baseGetTag["a" /* default */])(value) != objectTag) {
328 return false;
329 }
330 var proto = Object(_getPrototype["a" /* default */])(value);
331 if (proto === null) {
332 return true;
333 }
334 var Ctor = isPlainObject_hasOwnProperty.call(proto, 'constructor') && proto.constructor;
335 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
336 funcToString.call(Ctor) == objectCtorString;
337}
338
339/* harmony default export */ var lodash_es_isPlainObject = (isPlainObject);
340
341// EXTERNAL MODULE: ./node_modules/lodash-es/_baseClone.js + 25 modules
342var _baseClone = __webpack_require__("CfRg");
343
344// CONCATENATED MODULE: ./node_modules/lodash-es/clone.js
345
346
347/** Used to compose bitmasks for cloning. */
348var CLONE_SYMBOLS_FLAG = 4;
349
350/**
351 * Creates a shallow clone of `value`.
352 *
353 * **Note:** This method is loosely based on the
354 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
355 * and supports cloning arrays, array buffers, booleans, date objects, maps,
356 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
357 * arrays. The own enumerable properties of `arguments` objects are cloned
358 * as plain objects. An empty object is returned for uncloneable values such
359 * as error objects, functions, DOM nodes, and WeakMaps.
360 *
361 * @static
362 * @memberOf _
363 * @since 0.1.0
364 * @category Lang
365 * @param {*} value The value to clone.
366 * @returns {*} Returns the cloned value.
367 * @see _.cloneDeep
368 * @example
369 *
370 * var objects = [{ 'a': 1 }, { 'b': 2 }];
371 *
372 * var shallow = _.clone(objects);
373 * console.log(shallow[0] === objects[0]);
374 * // => true
375 */
376function clone(value) {
377 return Object(_baseClone["a" /* default */])(value, CLONE_SYMBOLS_FLAG);
378}
379
380/* harmony default export */ var lodash_es_clone = (clone);
381
382// EXTERNAL MODULE: ./node_modules/lodash-es/_arrayMap.js
383var _arrayMap = __webpack_require__("twO/");
384
385// EXTERNAL MODULE: ./node_modules/lodash-es/_copyArray.js
386var _copyArray = __webpack_require__("eAQQ");
387
388// EXTERNAL MODULE: ./node_modules/lodash-es/isArray.js
389var isArray = __webpack_require__("/1FC");
390
391// EXTERNAL MODULE: ./node_modules/lodash-es/isSymbol.js
392var isSymbol = __webpack_require__("G8aS");
393
394// EXTERNAL MODULE: ./node_modules/lodash-es/_stringToPath.js + 2 modules
395var _stringToPath = __webpack_require__("/1Be");
396
397// EXTERNAL MODULE: ./node_modules/lodash-es/_toKey.js
398var _toKey = __webpack_require__("Tchk");
399
400// EXTERNAL MODULE: ./node_modules/lodash-es/toString.js + 1 modules
401var lodash_es_toString = __webpack_require__("efZk");
402
403// CONCATENATED MODULE: ./node_modules/lodash-es/toPath.js
404
405
406
407
408
409
410
411
412/**
413 * Converts `value` to a property path array.
414 *
415 * @static
416 * @memberOf _
417 * @since 4.0.0
418 * @category Util
419 * @param {*} value The value to convert.
420 * @returns {Array} Returns the new property path array.
421 * @example
422 *
423 * _.toPath('a.b.c');
424 * // => ['a', 'b', 'c']
425 *
426 * _.toPath('a[0].b.c');
427 * // => ['a', '0', 'b', 'c']
428 */
429function toPath(value) {
430 if (Object(isArray["a" /* default */])(value)) {
431 return Object(_arrayMap["a" /* default */])(value, _toKey["a" /* default */]);
432 }
433 return Object(isSymbol["a" /* default */])(value) ? [value] : Object(_copyArray["a" /* default */])(Object(_stringToPath["a" /* default */])(Object(lodash_es_toString["a" /* default */])(value)));
434}
435
436/* harmony default export */ var lodash_es_toPath = (toPath);
437
438// CONCATENATED MODULE: ./node_modules/tiny-warning/dist/tiny-warning.esm.js
439var isProduction = "production" === 'production';
440function warning(condition, message) {
441 if (!isProduction) {
442 if (condition) {
443 return;
444 }
445
446 var text = "Warning: " + message;
447
448 if (typeof console !== 'undefined') {
449 console.warn(text);
450 }
451
452 try {
453 throw Error(text);
454 } catch (x) {}
455 }
456}
457
458/* harmony default export */ var tiny_warning_esm = (warning);
459
460// EXTERNAL MODULE: ./node_modules/formik/node_modules/scheduler/index.js
461var scheduler = __webpack_require__("2uMm");
462
463// EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js
464var hoist_non_react_statics_cjs = __webpack_require__("2mql");
465var hoist_non_react_statics_cjs_default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics_cjs);
466
467// CONCATENATED MODULE: ./node_modules/lodash-es/cloneDeep.js
468
469
470/** Used to compose bitmasks for cloning. */
471var CLONE_DEEP_FLAG = 1,
472 cloneDeep_CLONE_SYMBOLS_FLAG = 4;
473
474/**
475 * This method is like `_.clone` except that it recursively clones `value`.
476 *
477 * @static
478 * @memberOf _
479 * @since 1.0.0
480 * @category Lang
481 * @param {*} value The value to recursively clone.
482 * @returns {*} Returns the deep cloned value.
483 * @see _.clone
484 * @example
485 *
486 * var objects = [{ 'a': 1 }, { 'b': 2 }];
487 *
488 * var deep = _.cloneDeep(objects);
489 * console.log(deep[0] === objects[0]);
490 * // => false
491 */
492function cloneDeep(value) {
493 return Object(_baseClone["a" /* default */])(value, CLONE_DEEP_FLAG | cloneDeep_CLONE_SYMBOLS_FLAG);
494}
495
496/* harmony default export */ var lodash_es_cloneDeep = (cloneDeep);
497
498// CONCATENATED MODULE: ./node_modules/formik/dist/formik.esm.js
499
500
501
502
503
504
505
506
507
508
509
510function _extends() {
511 _extends = Object.assign || function (target) {
512 for (var i = 1; i < arguments.length; i++) {
513 var source = arguments[i];
514
515 for (var key in source) {
516 if (Object.prototype.hasOwnProperty.call(source, key)) {
517 target[key] = source[key];
518 }
519 }
520 }
521
522 return target;
523 };
524
525 return _extends.apply(this, arguments);
526}
527
528function _inheritsLoose(subClass, superClass) {
529 subClass.prototype = Object.create(superClass.prototype);
530 subClass.prototype.constructor = subClass;
531 subClass.__proto__ = superClass;
532}
533
534function _objectWithoutPropertiesLoose(source, excluded) {
535 if (source == null) return {};
536 var target = {};
537 var sourceKeys = Object.keys(source);
538 var key, i;
539
540 for (i = 0; i < sourceKeys.length; i++) {
541 key = sourceKeys[i];
542 if (excluded.indexOf(key) >= 0) continue;
543 target[key] = source[key];
544 }
545
546 return target;
547}
548
549function _assertThisInitialized(self) {
550 if (self === void 0) {
551 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
552 }
553
554 return self;
555}
556
557/** @private is the value an empty array? */
558
559var isEmptyArray = function isEmptyArray(value) {
560 return Array.isArray(value) && value.length === 0;
561};
562/** @private is the given object a Function? */
563
564var isFunction = function isFunction(obj) {
565 return typeof obj === 'function';
566};
567/** @private is the given object an Object? */
568
569var isObject = function isObject(obj) {
570 return obj !== null && typeof obj === 'object';
571};
572/** @private is the given object an integer? */
573
574var isInteger = function isInteger(obj) {
575 return String(Math.floor(Number(obj))) === obj;
576};
577/** @private is the given object a string? */
578
579var isString = function isString(obj) {
580 return Object.prototype.toString.call(obj) === '[object String]';
581};
582/** @private is the given object a NaN? */
583// eslint-disable-next-line no-self-compare
584
585var isNaN$1 = function isNaN(obj) {
586 return obj !== obj;
587};
588/** @private Does a React component have exactly 0 children? */
589
590var formik_esm_isEmptyChildren = function isEmptyChildren(children) {
591 return react["Children"].count(children) === 0;
592};
593/** @private is the given object/value a promise? */
594
595var isPromise = function isPromise(value) {
596 return isObject(value) && isFunction(value.then);
597};
598/** @private is the given object/value a type of synthetic event? */
599
600var isInputEvent = function isInputEvent(value) {
601 return value && isObject(value) && isObject(value.target);
602};
603/**
604 * Same as document.activeElement but wraps in a try-catch block. In IE it is
605 * not safe to call document.activeElement if there is nothing focused.
606 *
607 * The activeElement will be null only if the document or document body is not
608 * yet defined.
609 *
610 * @param {?Document} doc Defaults to current document.
611 * @return {Element | null}
612 * @see https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/dom/getActiveElement.js
613 */
614
615function getActiveElement(doc) {
616 doc = doc || (typeof document !== 'undefined' ? document : undefined);
617
618 if (typeof doc === 'undefined') {
619 return null;
620 }
621
622 try {
623 return doc.activeElement || doc.body;
624 } catch (e) {
625 return doc.body;
626 }
627}
628/**
629 * Deeply get a value from an object via its path.
630 */
631
632function getIn(obj, key, def, p) {
633 if (p === void 0) {
634 p = 0;
635 }
636
637 var path = lodash_es_toPath(key);
638
639 while (obj && p < path.length) {
640 obj = obj[path[p++]];
641 }
642
643 return obj === undefined ? def : obj;
644}
645/**
646 * Deeply set a value from in object via it's path. If the value at `path`
647 * has changed, return a shallow copy of obj with `value` set at `path`.
648 * If `value` has not changed, return the original `obj`.
649 *
650 * Existing objects / arrays along `path` are also shallow copied. Sibling
651 * objects along path retain the same internal js reference. Since new
652 * objects / arrays are only created along `path`, we can test if anything
653 * changed in a nested structure by comparing the object's reference in
654 * the old and new object, similar to how russian doll cache invalidation
655 * works.
656 *
657 * In earlier versions of this function, which used cloneDeep, there were
658 * issues whereby settings a nested value would mutate the parent
659 * instead of creating a new object. `clone` avoids that bug making a
660 * shallow copy of the objects along the update path
661 * so no object is mutated in place.
662 *
663 * Before changing this function, please read through the following
664 * discussions.
665 *
666 * @see https://github.com/developit/linkstate
667 * @see https://github.com/jaredpalmer/formik/pull/123
668 */
669
670function setIn(obj, path, value) {
671 var res = lodash_es_clone(obj); // this keeps inheritance when obj is a class
672
673 var resVal = res;
674 var i = 0;
675 var pathArray = lodash_es_toPath(path);
676
677 for (; i < pathArray.length - 1; i++) {
678 var currentPath = pathArray[i];
679 var currentObj = getIn(obj, pathArray.slice(0, i + 1));
680
681 if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {
682 resVal = resVal[currentPath] = lodash_es_clone(currentObj);
683 } else {
684 var nextPath = pathArray[i + 1];
685 resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};
686 }
687 } // Return original object if new value is the same as current
688
689
690 if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {
691 return obj;
692 }
693
694 if (value === undefined) {
695 delete resVal[pathArray[i]];
696 } else {
697 resVal[pathArray[i]] = value;
698 } // If the path array has a single element, the loop did not run.
699 // Deleting on `resVal` had no effect in this scenario, so we delete on the result instead.
700
701
702 if (i === 0 && value === undefined) {
703 delete res[pathArray[i]];
704 }
705
706 return res;
707}
708/**
709 * Recursively a set the same value for all keys and arrays nested object, cloning
710 * @param object
711 * @param value
712 * @param visited
713 * @param response
714 */
715
716function setNestedObjectValues(object, value, visited, response) {
717 if (visited === void 0) {
718 visited = new WeakMap();
719 }
720
721 if (response === void 0) {
722 response = {};
723 }
724
725 for (var _i = 0, _Object$keys = Object.keys(object); _i < _Object$keys.length; _i++) {
726 var k = _Object$keys[_i];
727 var val = object[k];
728
729 if (isObject(val)) {
730 if (!visited.get(val)) {
731 visited.set(val, true); // In order to keep array values consistent for both dot path and
732 // bracket syntax, we need to check if this is an array so that
733 // this will output { friends: [true] } and not { friends: { "0": true } }
734
735 response[k] = Array.isArray(val) ? [] : {};
736 setNestedObjectValues(val, value, visited, response[k]);
737 }
738 } else {
739 response[k] = value;
740 }
741 }
742
743 return response;
744}
745
746var FormikContext =
747/*#__PURE__*/
748Object(react["createContext"])(undefined);
749var FormikProvider = FormikContext.Provider;
750var FormikConsumer = FormikContext.Consumer;
751function useFormikContext() {
752 var formik = Object(react["useContext"])(FormikContext);
753 !!!formik ? false ? undefined : tiny_warning_esm(false) : void 0;
754 return formik;
755}
756
757function formikReducer(state, msg) {
758 switch (msg.type) {
759 case 'SET_VALUES':
760 return _extends({}, state, {
761 values: msg.payload
762 });
763
764 case 'SET_TOUCHED':
765 return _extends({}, state, {
766 touched: msg.payload
767 });
768
769 case 'SET_ERRORS':
770 if (react_fast_compare_default()(state.errors, msg.payload)) {
771 return state;
772 }
773
774 return _extends({}, state, {
775 errors: msg.payload
776 });
777
778 case 'SET_STATUS':
779 return _extends({}, state, {
780 status: msg.payload
781 });
782
783 case 'SET_ISSUBMITTING':
784 return _extends({}, state, {
785 isSubmitting: msg.payload
786 });
787
788 case 'SET_ISVALIDATING':
789 return _extends({}, state, {
790 isValidating: msg.payload
791 });
792
793 case 'SET_FIELD_VALUE':
794 return _extends({}, state, {
795 values: setIn(state.values, msg.payload.field, msg.payload.value)
796 });
797
798 case 'SET_FIELD_TOUCHED':
799 return _extends({}, state, {
800 touched: setIn(state.touched, msg.payload.field, msg.payload.value)
801 });
802
803 case 'SET_FIELD_ERROR':
804 return _extends({}, state, {
805 errors: setIn(state.errors, msg.payload.field, msg.payload.value)
806 });
807
808 case 'RESET_FORM':
809 return _extends({}, state, {}, msg.payload);
810
811 case 'SET_FORMIK_STATE':
812 return msg.payload(state);
813
814 case 'SUBMIT_ATTEMPT':
815 return _extends({}, state, {
816 touched: setNestedObjectValues(state.values, true),
817 isSubmitting: true,
818 submitCount: state.submitCount + 1
819 });
820
821 case 'SUBMIT_FAILURE':
822 return _extends({}, state, {
823 isSubmitting: false
824 });
825
826 case 'SUBMIT_SUCCESS':
827 return _extends({}, state, {
828 isSubmitting: false
829 });
830
831 default:
832 return state;
833 }
834} // Initial empty states // objects
835
836
837var emptyErrors = {};
838var emptyTouched = {};
839function useFormik(_ref) {
840 var _ref$validateOnChange = _ref.validateOnChange,
841 validateOnChange = _ref$validateOnChange === void 0 ? true : _ref$validateOnChange,
842 _ref$validateOnBlur = _ref.validateOnBlur,
843 validateOnBlur = _ref$validateOnBlur === void 0 ? true : _ref$validateOnBlur,
844 _ref$validateOnMount = _ref.validateOnMount,
845 validateOnMount = _ref$validateOnMount === void 0 ? false : _ref$validateOnMount,
846 isInitialValid = _ref.isInitialValid,
847 _ref$enableReinitiali = _ref.enableReinitialize,
848 enableReinitialize = _ref$enableReinitiali === void 0 ? false : _ref$enableReinitiali,
849 onSubmit = _ref.onSubmit,
850 rest = _objectWithoutPropertiesLoose(_ref, ["validateOnChange", "validateOnBlur", "validateOnMount", "isInitialValid", "enableReinitialize", "onSubmit"]);
851
852 var props = _extends({
853 validateOnChange: validateOnChange,
854 validateOnBlur: validateOnBlur,
855 validateOnMount: validateOnMount,
856 onSubmit: onSubmit
857 }, rest);
858
859 var initialValues = Object(react["useRef"])(props.initialValues);
860 var initialErrors = Object(react["useRef"])(props.initialErrors || emptyErrors);
861 var initialTouched = Object(react["useRef"])(props.initialTouched || emptyTouched);
862 var initialStatus = Object(react["useRef"])(props.initialStatus);
863 var isMounted = Object(react["useRef"])(false);
864 var fieldRegistry = Object(react["useRef"])({});
865 Object(react["useEffect"])(function () {
866 if (false) {} // eslint-disable-next-line
867
868 }, []);
869 Object(react["useEffect"])(function () {
870 isMounted.current = true;
871 return function () {
872 isMounted.current = false;
873 };
874 }, []);
875
876 var _React$useReducer = Object(react["useReducer"])(formikReducer, {
877 values: props.initialValues,
878 errors: props.initialErrors || emptyErrors,
879 touched: props.initialTouched || emptyTouched,
880 status: props.initialStatus,
881 isSubmitting: false,
882 isValidating: false,
883 submitCount: 0
884 }),
885 state = _React$useReducer[0],
886 dispatch = _React$useReducer[1];
887
888 var runValidateHandler = Object(react["useCallback"])(function (values, field) {
889 return new Promise(function (resolve, reject) {
890 var maybePromisedErrors = props.validate(values, field);
891
892 if (maybePromisedErrors == null) {
893 // use loose null check here on purpose
894 resolve(emptyErrors);
895 } else if (isPromise(maybePromisedErrors)) {
896 maybePromisedErrors.then(function (errors) {
897 resolve(errors || emptyErrors);
898 }, function (actualException) {
899 if (false) {}
900
901 reject(actualException);
902 });
903 } else {
904 resolve(maybePromisedErrors);
905 }
906 });
907 }, [props.validate]);
908 /**
909 * Run validation against a Yup schema and optionally run a function if successful
910 */
911
912 var runValidationSchema = Object(react["useCallback"])(function (values, field) {
913 var validationSchema = props.validationSchema;
914 var schema = isFunction(validationSchema) ? validationSchema(field) : validationSchema;
915 var promise = field && schema.validateAt ? schema.validateAt(field, values) : validateYupSchema(values, schema);
916 return new Promise(function (resolve, reject) {
917 promise.then(function () {
918 resolve(emptyErrors);
919 }, function (err) {
920 // Yup will throw a validation error if validation fails. We catch those and
921 // resolve them into Formik errors. We can sniff if something is a Yup error
922 // by checking error.name.
923 // @see https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string
924 if (err.name === 'ValidationError') {
925 resolve(yupToFormErrors(err));
926 } else {
927 // We throw any other errors
928 if (false) {}
929
930 reject(err);
931 }
932 });
933 });
934 }, [props.validationSchema]);
935 var runSingleFieldLevelValidation = Object(react["useCallback"])(function (field, value) {
936 return new Promise(function (resolve) {
937 return resolve(fieldRegistry.current[field].validate(value));
938 });
939 }, []);
940 var runFieldLevelValidations = Object(react["useCallback"])(function (values) {
941 var fieldKeysWithValidation = Object.keys(fieldRegistry.current).filter(function (f) {
942 return isFunction(fieldRegistry.current[f].validate);
943 }); // Construct an array with all of the field validation functions
944
945 var fieldValidations = fieldKeysWithValidation.length > 0 ? fieldKeysWithValidation.map(function (f) {
946 return runSingleFieldLevelValidation(f, getIn(values, f));
947 }) : [Promise.resolve('DO_NOT_DELETE_YOU_WILL_BE_FIRED')]; // use special case ;)
948
949 return Promise.all(fieldValidations).then(function (fieldErrorsList) {
950 return fieldErrorsList.reduce(function (prev, curr, index) {
951 if (curr === 'DO_NOT_DELETE_YOU_WILL_BE_FIRED') {
952 return prev;
953 }
954
955 if (curr) {
956 prev = setIn(prev, fieldKeysWithValidation[index], curr);
957 }
958
959 return prev;
960 }, {});
961 });
962 }, [runSingleFieldLevelValidation]); // Run all validations and return the result
963
964 var runAllValidations = Object(react["useCallback"])(function (values) {
965 return Promise.all([runFieldLevelValidations(values), props.validationSchema ? runValidationSchema(values) : {}, props.validate ? runValidateHandler(values) : {}]).then(function (_ref2) {
966 var fieldErrors = _ref2[0],
967 schemaErrors = _ref2[1],
968 validateErrors = _ref2[2];
969 var combinedErrors = es.all([fieldErrors, schemaErrors, validateErrors], {
970 arrayMerge: arrayMerge
971 });
972 return combinedErrors;
973 });
974 }, [props.validate, props.validationSchema, runFieldLevelValidations, runValidateHandler, runValidationSchema]); // Run validations and dispatching the result as low-priority via rAF.
975 //
976 // The thinking is that validation as a result of onChange and onBlur
977 // should never block user input. Note: This method should never be called
978 // during the submission phase because validation prior to submission
979 // is actaully high-priority since we absolutely need to guarantee the
980 // form is valid before executing props.onSubmit.
981
982 var validateFormWithLowPriority = useEventCallback(function (values) {
983 if (values === void 0) {
984 values = state.values;
985 }
986
987 return Object(scheduler["unstable_runWithPriority"])(scheduler["LowPriority"], function () {
988 return runAllValidations(values).then(function (combinedErrors) {
989 if (!!isMounted.current) {
990 dispatch({
991 type: 'SET_ERRORS',
992 payload: combinedErrors
993 });
994 }
995
996 return combinedErrors;
997 })["catch"](function (actualException) {
998 if (false) {}
999 });
1000 });
1001 }); // Run all validations methods and update state accordingly
1002
1003 var validateFormWithHighPriority = useEventCallback(function (values) {
1004 if (values === void 0) {
1005 values = state.values;
1006 }
1007
1008 dispatch({
1009 type: 'SET_ISVALIDATING',
1010 payload: true
1011 });
1012 return runAllValidations(values).then(function (combinedErrors) {
1013 if (!!isMounted.current) {
1014 dispatch({
1015 type: 'SET_ISVALIDATING',
1016 payload: false
1017 });
1018
1019 if (!react_fast_compare_default()(state.errors, combinedErrors)) {
1020 dispatch({
1021 type: 'SET_ERRORS',
1022 payload: combinedErrors
1023 });
1024 }
1025 }
1026
1027 return combinedErrors;
1028 });
1029 });
1030 Object(react["useEffect"])(function () {
1031 if (validateOnMount && isMounted.current === true) {
1032 validateFormWithLowPriority(initialValues.current);
1033 }
1034 }, [validateOnMount, validateFormWithLowPriority]);
1035 var resetForm = Object(react["useCallback"])(function (nextState) {
1036 var values = nextState && nextState.values ? nextState.values : initialValues.current;
1037 var errors = nextState && nextState.errors ? nextState.errors : initialErrors.current ? initialErrors.current : props.initialErrors || {};
1038 var touched = nextState && nextState.touched ? nextState.touched : initialTouched.current ? initialTouched.current : props.initialTouched || {};
1039 var status = nextState && nextState.status ? nextState.status : initialStatus.current ? initialStatus.current : props.initialStatus;
1040 initialValues.current = values;
1041 initialErrors.current = errors;
1042 initialTouched.current = touched;
1043 initialStatus.current = status;
1044
1045 var dispatchFn = function dispatchFn() {
1046 dispatch({
1047 type: 'RESET_FORM',
1048 payload: {
1049 isSubmitting: !!nextState && !!nextState.isSubmitting,
1050 errors: errors,
1051 touched: touched,
1052 status: status,
1053 values: values,
1054 isValidating: !!nextState && !!nextState.isValidating,
1055 submitCount: !!nextState && !!nextState.submitCount && typeof nextState.submitCount === 'number' ? nextState.submitCount : 0
1056 }
1057 });
1058 };
1059
1060 if (props.onReset) {
1061 var maybePromisedOnReset = props.onReset(state.values, imperativeMethods);
1062
1063 if (isPromise(maybePromisedOnReset)) {
1064 maybePromisedOnReset.then(dispatchFn);
1065 } else {
1066 dispatchFn();
1067 }
1068 } else {
1069 dispatchFn();
1070 }
1071 }, [props.initialErrors, props.initialStatus, props.initialTouched]);
1072 Object(react["useEffect"])(function () {
1073 if (!enableReinitialize) {
1074 initialValues.current = props.initialValues;
1075 }
1076 }, [enableReinitialize, props.initialValues]);
1077 Object(react["useEffect"])(function () {
1078 if (enableReinitialize && isMounted.current === true && !react_fast_compare_default()(initialValues.current, props.initialValues)) {
1079 initialValues.current = props.initialValues;
1080 resetForm();
1081 }
1082 }, [enableReinitialize, props.initialValues, resetForm]);
1083 Object(react["useEffect"])(function () {
1084 if (enableReinitialize && isMounted.current === true && !react_fast_compare_default()(initialErrors.current, props.initialErrors)) {
1085 initialErrors.current = props.initialErrors || emptyErrors;
1086 dispatch({
1087 type: 'SET_ERRORS',
1088 payload: props.initialErrors || emptyErrors
1089 });
1090 }
1091 }, [enableReinitialize, props.initialErrors]);
1092 Object(react["useEffect"])(function () {
1093 if (enableReinitialize && isMounted.current === true && !react_fast_compare_default()(initialTouched.current, props.initialTouched)) {
1094 initialTouched.current = props.initialTouched || emptyTouched;
1095 dispatch({
1096 type: 'SET_TOUCHED',
1097 payload: props.initialTouched || emptyTouched
1098 });
1099 }
1100 }, [enableReinitialize, props.initialTouched]);
1101 Object(react["useEffect"])(function () {
1102 if (enableReinitialize && isMounted.current === true && !react_fast_compare_default()(initialStatus.current, props.initialStatus)) {
1103 initialStatus.current = props.initialStatus;
1104 dispatch({
1105 type: 'SET_STATUS',
1106 payload: props.initialStatus
1107 });
1108 }
1109 }, [enableReinitialize, props.initialStatus, props.initialTouched]);
1110 var validateField = useEventCallback(function (name) {
1111 // This will efficiently validate a single field by avoiding state
1112 // changes if the validation function is synchronous. It's different from
1113 // what is called when using validateForm.
1114 if (isFunction(fieldRegistry.current[name].validate)) {
1115 var value = getIn(state.values, name);
1116 var maybePromise = fieldRegistry.current[name].validate(value);
1117
1118 if (isPromise(maybePromise)) {
1119 // Only flip isValidating if the function is async.
1120 dispatch({
1121 type: 'SET_ISVALIDATING',
1122 payload: true
1123 });
1124 return maybePromise.then(function (x) {
1125 return x;
1126 }).then(function (error) {
1127 dispatch({
1128 type: 'SET_FIELD_ERROR',
1129 payload: {
1130 field: name,
1131 value: error
1132 }
1133 });
1134 dispatch({
1135 type: 'SET_ISVALIDATING',
1136 payload: false
1137 });
1138 });
1139 } else {
1140 dispatch({
1141 type: 'SET_FIELD_ERROR',
1142 payload: {
1143 field: name,
1144 value: maybePromise
1145 }
1146 });
1147 return Promise.resolve(maybePromise);
1148 }
1149 } else if (props.validationSchema) {
1150 dispatch({
1151 type: 'SET_ISVALIDATING',
1152 payload: true
1153 });
1154 return runValidationSchema(state.values, name).then(function (x) {
1155 return x;
1156 }).then(function (error) {
1157 dispatch({
1158 type: 'SET_FIELD_ERROR',
1159 payload: {
1160 field: name,
1161 value: error[name]
1162 }
1163 });
1164 dispatch({
1165 type: 'SET_ISVALIDATING',
1166 payload: false
1167 });
1168 });
1169 }
1170
1171 return Promise.resolve();
1172 });
1173 var registerField = Object(react["useCallback"])(function (name, _ref3) {
1174 var validate = _ref3.validate;
1175 fieldRegistry.current[name] = {
1176 validate: validate
1177 };
1178 }, []);
1179 var unregisterField = Object(react["useCallback"])(function (name) {
1180 delete fieldRegistry.current[name];
1181 }, []);
1182 var setTouched = useEventCallback(function (touched, shouldValidate) {
1183 dispatch({
1184 type: 'SET_TOUCHED',
1185 payload: touched
1186 });
1187 var willValidate = shouldValidate === undefined ? validateOnBlur : shouldValidate;
1188 return willValidate ? validateFormWithLowPriority(state.values) : Promise.resolve();
1189 });
1190 var setErrors = Object(react["useCallback"])(function (errors) {
1191 dispatch({
1192 type: 'SET_ERRORS',
1193 payload: errors
1194 });
1195 }, []);
1196 var setValues = useEventCallback(function (values, shouldValidate) {
1197 dispatch({
1198 type: 'SET_VALUES',
1199 payload: values
1200 });
1201 var willValidate = shouldValidate === undefined ? validateOnChange : shouldValidate;
1202 return willValidate ? validateFormWithLowPriority(values) : Promise.resolve();
1203 });
1204 var setFieldError = Object(react["useCallback"])(function (field, value) {
1205 dispatch({
1206 type: 'SET_FIELD_ERROR',
1207 payload: {
1208 field: field,
1209 value: value
1210 }
1211 });
1212 }, []);
1213 var setFieldValue = useEventCallback(function (field, value, shouldValidate) {
1214 dispatch({
1215 type: 'SET_FIELD_VALUE',
1216 payload: {
1217 field: field,
1218 value: value
1219 }
1220 });
1221 var willValidate = shouldValidate === undefined ? validateOnChange : shouldValidate;
1222 return willValidate ? validateFormWithLowPriority(setIn(state.values, field, value)) : Promise.resolve();
1223 });
1224 var executeChange = Object(react["useCallback"])(function (eventOrTextValue, maybePath) {
1225 // By default, assume that the first argument is a string. This allows us to use
1226 // handleChange with React Native and React Native Web's onChangeText prop which
1227 // provides just the value of the input.
1228 var field = maybePath;
1229 var val = eventOrTextValue;
1230 var parsed; // If the first argument is not a string though, it has to be a synthetic React Event (or a fake one),
1231 // so we handle like we would a normal HTML change event.
1232
1233 if (!isString(eventOrTextValue)) {
1234 // If we can, persist the event
1235 // @see https://reactjs.org/docs/events.html#event-pooling
1236 if (eventOrTextValue.persist) {
1237 eventOrTextValue.persist();
1238 }
1239
1240 var target = eventOrTextValue.target ? eventOrTextValue.target : eventOrTextValue.currentTarget;
1241 var type = target.type,
1242 name = target.name,
1243 id = target.id,
1244 value = target.value,
1245 checked = target.checked,
1246 outerHTML = target.outerHTML,
1247 options = target.options,
1248 multiple = target.multiple;
1249 field = maybePath ? maybePath : name ? name : id;
1250
1251 if (!field && "production" !== "production") {
1252 warnAboutMissingIdentifier({
1253 htmlContent: outerHTML,
1254 documentationAnchorLink: 'handlechange-e-reactchangeeventany--void',
1255 handlerName: 'handleChange'
1256 });
1257 }
1258
1259 val = /number|range/.test(type) ? (parsed = parseFloat(value), isNaN(parsed) ? '' : parsed) : /checkbox/.test(type) // checkboxes
1260 ? getValueForCheckbox(getIn(state.values, field), checked, value) : !!multiple // <select multiple>
1261 ? getSelectedValues(options) : value;
1262 }
1263
1264 if (field) {
1265 // Set form fields by name
1266 setFieldValue(field, val);
1267 }
1268 }, [setFieldValue, state.values]);
1269 var handleChange = useEventCallback(function (eventOrPath) {
1270 if (isString(eventOrPath)) {
1271 return function (event) {
1272 return executeChange(event, eventOrPath);
1273 };
1274 } else {
1275 executeChange(eventOrPath);
1276 }
1277 });
1278 var setFieldTouched = useEventCallback(function (field, touched, shouldValidate) {
1279 if (touched === void 0) {
1280 touched = true;
1281 }
1282
1283 dispatch({
1284 type: 'SET_FIELD_TOUCHED',
1285 payload: {
1286 field: field,
1287 value: touched
1288 }
1289 });
1290 var willValidate = shouldValidate === undefined ? validateOnBlur : shouldValidate;
1291 return willValidate ? validateFormWithLowPriority(state.values) : Promise.resolve();
1292 });
1293 var executeBlur = Object(react["useCallback"])(function (e, path) {
1294 if (e.persist) {
1295 e.persist();
1296 }
1297
1298 var _e$target = e.target,
1299 name = _e$target.name,
1300 id = _e$target.id,
1301 outerHTML = _e$target.outerHTML;
1302 var field = path ? path : name ? name : id;
1303
1304 if (!field && "production" !== "production") {
1305 warnAboutMissingIdentifier({
1306 htmlContent: outerHTML,
1307 documentationAnchorLink: 'handleblur-e-any--void',
1308 handlerName: 'handleBlur'
1309 });
1310 }
1311
1312 setFieldTouched(field, true);
1313 }, [setFieldTouched]);
1314 var handleBlur = useEventCallback(function (eventOrString) {
1315 if (isString(eventOrString)) {
1316 return function (event) {
1317 return executeBlur(event, eventOrString);
1318 };
1319 } else {
1320 executeBlur(eventOrString);
1321 }
1322 });
1323 var setFormikState = Object(react["useCallback"])(function (stateOrCb) {
1324 if (isFunction(stateOrCb)) {
1325 dispatch({
1326 type: 'SET_FORMIK_STATE',
1327 payload: stateOrCb
1328 });
1329 } else {
1330 dispatch({
1331 type: 'SET_FORMIK_STATE',
1332 payload: function payload() {
1333 return stateOrCb;
1334 }
1335 });
1336 }
1337 }, []);
1338 var setStatus = Object(react["useCallback"])(function (status) {
1339 dispatch({
1340 type: 'SET_STATUS',
1341 payload: status
1342 });
1343 }, []);
1344 var setSubmitting = Object(react["useCallback"])(function (isSubmitting) {
1345 dispatch({
1346 type: 'SET_ISSUBMITTING',
1347 payload: isSubmitting
1348 });
1349 }, []);
1350 var submitForm = useEventCallback(function () {
1351 dispatch({
1352 type: 'SUBMIT_ATTEMPT'
1353 });
1354 return validateFormWithHighPriority().then(function (combinedErrors) {
1355 // In case an error was thrown and passed to the resolved Promise,
1356 // `combinedErrors` can be an instance of an Error. We need to check
1357 // that and abort the submit.
1358 // If we don't do that, calling `Object.keys(new Error())` yields an
1359 // empty array, which causes the validation to pass and the form
1360 // to be submitted.
1361 var isInstanceOfError = combinedErrors instanceof Error;
1362 var isActuallyValid = !isInstanceOfError && Object.keys(combinedErrors).length === 0;
1363
1364 if (isActuallyValid) {
1365 // Proceed with submit...
1366 //
1367 // To respect sync submit fns, we can't simply wrap executeSubmit in a promise and
1368 // _always_ dispatch SUBMIT_SUCCESS because isSubmitting would then always be false.
1369 // This would be fine in simple cases, but make it impossible to disable submit
1370 // buttons where people use callbacks or promises as side effects (which is basically
1371 // all of v1 Formik code). Instead, recall that we are inside of a promise chain already,
1372 // so we can try/catch executeSubmit(), if it returns undefined, then just bail.
1373 // If there are errors, throw em. Otherwise, wrap executeSubmit in a promise and handle
1374 // cleanup of isSubmitting on behalf of the consumer.
1375 var promiseOrUndefined;
1376
1377 try {
1378 promiseOrUndefined = executeSubmit(); // Bail if it's sync, consumer is responsible for cleaning up
1379 // via setSubmitting(false)
1380
1381 if (promiseOrUndefined === undefined) {
1382 return;
1383 }
1384 } catch (error) {
1385 throw error;
1386 }
1387
1388 return Promise.resolve(promiseOrUndefined).then(function () {
1389 if (!!isMounted.current) {
1390 dispatch({
1391 type: 'SUBMIT_SUCCESS'
1392 });
1393 }
1394 })["catch"](function (_errors) {
1395 if (!!isMounted.current) {
1396 dispatch({
1397 type: 'SUBMIT_FAILURE'
1398 }); // This is a legit error rejected by the onSubmit fn
1399 // so we don't want to break the promise chain
1400
1401 throw _errors;
1402 }
1403 });
1404 } else if (!!isMounted.current) {
1405 // ^^^ Make sure Formik is still mounted before updating state
1406 dispatch({
1407 type: 'SUBMIT_FAILURE'
1408 }); // throw combinedErrors;
1409
1410 if (isInstanceOfError) {
1411 throw combinedErrors;
1412 }
1413 }
1414
1415 return;
1416 });
1417 });
1418 var handleSubmit = useEventCallback(function (e) {
1419 if (e && e.preventDefault && isFunction(e.preventDefault)) {
1420 e.preventDefault();
1421 }
1422
1423 if (e && e.stopPropagation && isFunction(e.stopPropagation)) {
1424 e.stopPropagation();
1425 } // Warn if form submission is triggered by a <button> without a
1426 // specified `type` attribute during development. This mitigates
1427 // a common gotcha in forms with both reset and submit buttons,
1428 // where the dev forgets to add type="button" to the reset button.
1429
1430
1431 if (false) { var activeElement; }
1432
1433 submitForm()["catch"](function (reason) {
1434 console.warn("Warning: An unhandled error was caught from submitForm()", reason);
1435 });
1436 });
1437 var imperativeMethods = {
1438 resetForm: resetForm,
1439 validateForm: validateFormWithHighPriority,
1440 validateField: validateField,
1441 setErrors: setErrors,
1442 setFieldError: setFieldError,
1443 setFieldTouched: setFieldTouched,
1444 setFieldValue: setFieldValue,
1445 setStatus: setStatus,
1446 setSubmitting: setSubmitting,
1447 setTouched: setTouched,
1448 setValues: setValues,
1449 setFormikState: setFormikState,
1450 submitForm: submitForm
1451 };
1452 var executeSubmit = useEventCallback(function () {
1453 return onSubmit(state.values, imperativeMethods);
1454 });
1455 var handleReset = useEventCallback(function (e) {
1456 if (e && e.preventDefault && isFunction(e.preventDefault)) {
1457 e.preventDefault();
1458 }
1459
1460 if (e && e.stopPropagation && isFunction(e.stopPropagation)) {
1461 e.stopPropagation();
1462 }
1463
1464 resetForm();
1465 });
1466 var getFieldMeta = Object(react["useCallback"])(function (name) {
1467 return {
1468 value: getIn(state.values, name),
1469 error: getIn(state.errors, name),
1470 touched: !!getIn(state.touched, name),
1471 initialValue: getIn(initialValues.current, name),
1472 initialTouched: !!getIn(initialTouched.current, name),
1473 initialError: getIn(initialErrors.current, name)
1474 };
1475 }, [state.errors, state.touched, state.values]);
1476 var getFieldHelpers = Object(react["useCallback"])(function (name) {
1477 return {
1478 setValue: function setValue(value) {
1479 return setFieldValue(name, value);
1480 },
1481 setTouched: function setTouched(value) {
1482 return setFieldTouched(name, value);
1483 },
1484 setError: function setError(value) {
1485 return setFieldError(name, value);
1486 }
1487 };
1488 }, [setFieldValue, setFieldTouched, setFieldError]);
1489 var getFieldProps = Object(react["useCallback"])(function (nameOrOptions) {
1490 var isAnObject = isObject(nameOrOptions);
1491 var name = isAnObject ? nameOrOptions.name : nameOrOptions;
1492 var valueState = getIn(state.values, name);
1493 var field = {
1494 name: name,
1495 value: valueState,
1496 onChange: handleChange,
1497 onBlur: handleBlur
1498 };
1499
1500 if (isAnObject) {
1501 var type = nameOrOptions.type,
1502 valueProp = nameOrOptions.value,
1503 is = nameOrOptions.as,
1504 multiple = nameOrOptions.multiple;
1505
1506 if (type === 'checkbox') {
1507 if (valueProp === undefined) {
1508 field.checked = !!valueState;
1509 } else {
1510 field.checked = !!(Array.isArray(valueState) && ~valueState.indexOf(valueProp));
1511 field.value = valueProp;
1512 }
1513 } else if (type === 'radio') {
1514 field.checked = valueState === valueProp;
1515 field.value = valueProp;
1516 } else if (is === 'select' && multiple) {
1517 field.value = field.value || [];
1518 field.multiple = true;
1519 }
1520 }
1521
1522 return field;
1523 }, [handleBlur, handleChange, state.values]);
1524 var dirty = Object(react["useMemo"])(function () {
1525 return !react_fast_compare_default()(initialValues.current, state.values);
1526 }, [initialValues.current, state.values]);
1527 var isValid = Object(react["useMemo"])(function () {
1528 return typeof isInitialValid !== 'undefined' ? dirty ? state.errors && Object.keys(state.errors).length === 0 : isInitialValid !== false && isFunction(isInitialValid) ? isInitialValid(props) : isInitialValid : state.errors && Object.keys(state.errors).length === 0;
1529 }, [isInitialValid, dirty, state.errors, props]);
1530
1531 var ctx = _extends({}, state, {
1532 initialValues: initialValues.current,
1533 initialErrors: initialErrors.current,
1534 initialTouched: initialTouched.current,
1535 initialStatus: initialStatus.current,
1536 handleBlur: handleBlur,
1537 handleChange: handleChange,
1538 handleReset: handleReset,
1539 handleSubmit: handleSubmit,
1540 resetForm: resetForm,
1541 setErrors: setErrors,
1542 setFormikState: setFormikState,
1543 setFieldTouched: setFieldTouched,
1544 setFieldValue: setFieldValue,
1545 setFieldError: setFieldError,
1546 setStatus: setStatus,
1547 setSubmitting: setSubmitting,
1548 setTouched: setTouched,
1549 setValues: setValues,
1550 submitForm: submitForm,
1551 validateForm: validateFormWithHighPriority,
1552 validateField: validateField,
1553 isValid: isValid,
1554 dirty: dirty,
1555 unregisterField: unregisterField,
1556 registerField: registerField,
1557 getFieldProps: getFieldProps,
1558 getFieldMeta: getFieldMeta,
1559 getFieldHelpers: getFieldHelpers,
1560 validateOnBlur: validateOnBlur,
1561 validateOnChange: validateOnChange,
1562 validateOnMount: validateOnMount
1563 });
1564
1565 return ctx;
1566}
1567function Formik(props) {
1568 var formikbag = useFormik(props);
1569 var component = props.component,
1570 children = props.children,
1571 render = props.render,
1572 innerRef = props.innerRef; // This allows folks to pass a ref to <Formik />
1573
1574 Object(react["useImperativeHandle"])(innerRef, function () {
1575 return formikbag;
1576 });
1577 Object(react["useEffect"])(function () {
1578 if (false) {} // eslint-disable-next-line
1579
1580 }, []);
1581 return Object(react["createElement"])(FormikProvider, {
1582 value: formikbag
1583 }, component ? Object(react["createElement"])(component, formikbag) : render ? render(formikbag) : children // children come last, always called
1584 ? isFunction(children) ? children(formikbag) : !formik_esm_isEmptyChildren(children) ? react["Children"].only(children) : null : null);
1585}
1586
1587function warnAboutMissingIdentifier(_ref4) {
1588 var htmlContent = _ref4.htmlContent,
1589 documentationAnchorLink = _ref4.documentationAnchorLink,
1590 handlerName = _ref4.handlerName;
1591 console.warn("Warning: Formik called `" + handlerName + "`, but you forgot to pass an `id` or `name` attribute to your input:\n " + htmlContent + "\n Formik cannot determine which value to update. For more info see https://github.com/jaredpalmer/formik#" + documentationAnchorLink + "\n ");
1592}
1593/**
1594 * Transform Yup ValidationError to a more usable object
1595 */
1596
1597
1598function yupToFormErrors(yupError) {
1599 var errors = {};
1600
1601 if (yupError.inner) {
1602 if (yupError.inner.length === 0) {
1603 return setIn(errors, yupError.path, yupError.message);
1604 }
1605
1606 for (var _iterator = yupError.inner, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
1607 var _ref5;
1608
1609 if (_isArray) {
1610 if (_i >= _iterator.length) break;
1611 _ref5 = _iterator[_i++];
1612 } else {
1613 _i = _iterator.next();
1614 if (_i.done) break;
1615 _ref5 = _i.value;
1616 }
1617
1618 var err = _ref5;
1619
1620 if (!getIn(errors, err.path)) {
1621 errors = setIn(errors, err.path, err.message);
1622 }
1623 }
1624 }
1625
1626 return errors;
1627}
1628/**
1629 * Validate a yup schema.
1630 */
1631
1632function validateYupSchema(values, schema, sync, context) {
1633 if (sync === void 0) {
1634 sync = false;
1635 }
1636
1637 if (context === void 0) {
1638 context = {};
1639 }
1640
1641 var validateData = prepareDataForValidation(values);
1642 return schema[sync ? 'validateSync' : 'validate'](validateData, {
1643 abortEarly: false,
1644 context: context
1645 });
1646}
1647/**
1648 * Recursively prepare values.
1649 */
1650
1651function prepareDataForValidation(values) {
1652 var data = {};
1653
1654 for (var k in values) {
1655 if (Object.prototype.hasOwnProperty.call(values, k)) {
1656 var key = String(k);
1657
1658 if (Array.isArray(values[key]) === true) {
1659 data[key] = values[key].map(function (value) {
1660 if (Array.isArray(value) === true || lodash_es_isPlainObject(value)) {
1661 return prepareDataForValidation(value);
1662 } else {
1663 return value !== '' ? value : undefined;
1664 }
1665 });
1666 } else if (lodash_es_isPlainObject(values[key])) {
1667 data[key] = prepareDataForValidation(values[key]);
1668 } else {
1669 data[key] = values[key] !== '' ? values[key] : undefined;
1670 }
1671 }
1672 }
1673
1674 return data;
1675}
1676/**
1677 * deepmerge array merging algorithm
1678 * https://github.com/KyleAMathews/deepmerge#combine-array
1679 */
1680
1681function arrayMerge(target, source, options) {
1682 var destination = target.slice();
1683 source.forEach(function (e, i) {
1684 if (typeof destination[i] === 'undefined') {
1685 var cloneRequested = options.clone !== false;
1686 var shouldClone = cloneRequested && options.isMergeableObject(e);
1687 destination[i] = shouldClone ? es(Array.isArray(e) ? [] : {}, e, options) : e;
1688 } else if (options.isMergeableObject(e)) {
1689 destination[i] = es(target[i], e, options);
1690 } else if (target.indexOf(e) === -1) {
1691 destination.push(e);
1692 }
1693 });
1694 return destination;
1695}
1696/** Return multi select values based on an array of options */
1697
1698
1699function getSelectedValues(options) {
1700 return Array.from(options).filter(function (el) {
1701 return el.selected;
1702 }).map(function (el) {
1703 return el.value;
1704 });
1705}
1706/** Return the next value for a checkbox */
1707
1708
1709function getValueForCheckbox(currentValue, checked, valueProp) {
1710 // If the current value was a boolean, return a boolean
1711 if (typeof currentValue === 'boolean') {
1712 return Boolean(checked);
1713 } // If the currentValue was not a boolean we want to return an array
1714
1715
1716 var currentArrayOfValues = [];
1717 var isValueInArray = false;
1718 var index = -1;
1719
1720 if (!Array.isArray(currentValue)) {
1721 // eslint-disable-next-line eqeqeq
1722 if (!valueProp || valueProp == 'true' || valueProp == 'false') {
1723 return Boolean(checked);
1724 }
1725 } else {
1726 // If the current value is already an array, use it
1727 currentArrayOfValues = currentValue;
1728 index = currentValue.indexOf(valueProp);
1729 isValueInArray = index >= 0;
1730 } // If the checkbox was checked and the value is not already present in the aray we want to add the new value to the array of values
1731
1732
1733 if (checked && valueProp && !isValueInArray) {
1734 return currentArrayOfValues.concat(valueProp);
1735 } // If the checkbox was unchecked and the value is not in the array, simply return the already existing array of values
1736
1737
1738 if (!isValueInArray) {
1739 return currentArrayOfValues;
1740 } // If the checkbox was unchecked and the value is in the array, remove the value and return the array
1741
1742
1743 return currentArrayOfValues.slice(0, index).concat(currentArrayOfValues.slice(index + 1));
1744} // React currently throws a warning when using useLayoutEffect on the server.
1745// To get around it, we can conditionally useEffect on the server (no-op) and
1746// useLayoutEffect in the browser.
1747// @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
1748
1749
1750var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? react["useLayoutEffect"] : react["useEffect"];
1751
1752function useEventCallback(fn) {
1753 var ref = Object(react["useRef"])(fn); // we copy a ref to the callback scoped to the current state/props on each render
1754
1755 useIsomorphicLayoutEffect(function () {
1756 ref.current = fn;
1757 });
1758 return Object(react["useCallback"])(function () {
1759 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1760 args[_key] = arguments[_key];
1761 }
1762
1763 return ref.current.apply(void 0, args);
1764 }, []);
1765}
1766
1767function useField(propsOrFieldName) {
1768 var formik = useFormikContext();
1769 var getFieldProps = formik.getFieldProps,
1770 getFieldMeta = formik.getFieldMeta,
1771 getFieldHelpers = formik.getFieldHelpers,
1772 registerField = formik.registerField,
1773 unregisterField = formik.unregisterField;
1774 var isAnObject = isObject(propsOrFieldName); // Normalize propsOrFieldName to FieldHookConfig<Val>
1775
1776 var props = isAnObject ? propsOrFieldName : {
1777 name: propsOrFieldName
1778 };
1779 var fieldName = props.name,
1780 validateFn = props.validate;
1781 Object(react["useEffect"])(function () {
1782 if (fieldName) {
1783 registerField(fieldName, {
1784 validate: validateFn
1785 });
1786 }
1787
1788 return function () {
1789 if (fieldName) {
1790 unregisterField(fieldName);
1791 }
1792 };
1793 }, [registerField, unregisterField, fieldName, validateFn]);
1794
1795 if (false) {}
1796
1797 !fieldName ? false ? undefined : tiny_warning_esm(false) : void 0;
1798 return [getFieldProps(props), getFieldMeta(fieldName), getFieldHelpers(fieldName)];
1799}
1800function Field(_ref) {
1801 var validate = _ref.validate,
1802 name = _ref.name,
1803 render = _ref.render,
1804 children = _ref.children,
1805 is = _ref.as,
1806 component = _ref.component,
1807 props = _objectWithoutPropertiesLoose(_ref, ["validate", "name", "render", "children", "as", "component"]);
1808
1809 var _useFormikContext = useFormikContext(),
1810 formik = _objectWithoutPropertiesLoose(_useFormikContext, ["validate", "validationSchema"]);
1811
1812 Object(react["useEffect"])(function () {
1813 if (false) {} // eslint-disable-next-line
1814
1815 }, []); // Register field and field-level validation with parent <Formik>
1816
1817 var registerField = formik.registerField,
1818 unregisterField = formik.unregisterField;
1819 Object(react["useEffect"])(function () {
1820 registerField(name, {
1821 validate: validate
1822 });
1823 return function () {
1824 unregisterField(name);
1825 };
1826 }, [registerField, unregisterField, name, validate]);
1827 var field = formik.getFieldProps(_extends({
1828 name: name
1829 }, props));
1830 var meta = formik.getFieldMeta(name);
1831 var legacyBag = {
1832 field: field,
1833 form: formik
1834 };
1835
1836 if (render) {
1837 return render(_extends({}, legacyBag, {
1838 meta: meta
1839 }));
1840 }
1841
1842 if (isFunction(children)) {
1843 return children(_extends({}, legacyBag, {
1844 meta: meta
1845 }));
1846 }
1847
1848 if (component) {
1849 // This behavior is backwards compat with earlier Formik 0.9 to 1.x
1850 if (typeof component === 'string') {
1851 var innerRef = props.innerRef,
1852 rest = _objectWithoutPropertiesLoose(props, ["innerRef"]);
1853
1854 return Object(react["createElement"])(component, _extends({
1855 ref: innerRef
1856 }, field, {}, rest), children);
1857 } // We don't pass `meta` for backwards compat
1858
1859
1860 return Object(react["createElement"])(component, _extends({
1861 field: field,
1862 form: formik
1863 }, props), children);
1864 } // default to input here so we can check for both `as` and `children` above
1865
1866
1867 var asElement = is || 'input';
1868
1869 if (typeof asElement === 'string') {
1870 var _innerRef = props.innerRef,
1871 _rest = _objectWithoutPropertiesLoose(props, ["innerRef"]);
1872
1873 return Object(react["createElement"])(asElement, _extends({
1874 ref: _innerRef
1875 }, field, {}, _rest), children);
1876 }
1877
1878 return Object(react["createElement"])(asElement, _extends({}, field, {}, props), children);
1879}
1880
1881var Form =
1882/*#__PURE__*/
1883Object(react["forwardRef"])(function (props, ref) {
1884 // iOS needs an "action" attribute for nice input: https://stackoverflow.com/a/39485162/406725
1885 // We default the action to "#" in case the preventDefault fails (just updates the URL hash)
1886 var action = props.action,
1887 rest = _objectWithoutPropertiesLoose(props, ["action"]);
1888
1889 var _action = action || '#';
1890
1891 var _useFormikContext = useFormikContext(),
1892 handleReset = _useFormikContext.handleReset,
1893 handleSubmit = _useFormikContext.handleSubmit;
1894
1895 return Object(react["createElement"])("form", Object.assign({
1896 onSubmit: handleSubmit,
1897 ref: ref,
1898 onReset: handleReset,
1899 action: _action
1900 }, rest));
1901});
1902Form.displayName = 'Form';
1903
1904/**
1905 * A public higher-order component to access the imperative API
1906 */
1907
1908function withFormik(_ref) {
1909 var _ref$mapPropsToValues = _ref.mapPropsToValues,
1910 mapPropsToValues = _ref$mapPropsToValues === void 0 ? function (vanillaProps) {
1911 var val = {};
1912
1913 for (var k in vanillaProps) {
1914 if (vanillaProps.hasOwnProperty(k) && typeof vanillaProps[k] !== 'function') {
1915 // @todo TypeScript fix
1916 val[k] = vanillaProps[k];
1917 }
1918 }
1919
1920 return val;
1921 } : _ref$mapPropsToValues,
1922 config = _objectWithoutPropertiesLoose(_ref, ["mapPropsToValues"]);
1923
1924 return function createFormik(Component$1) {
1925 var componentDisplayName = Component$1.displayName || Component$1.name || Component$1.constructor && Component$1.constructor.name || 'Component';
1926 /**
1927 * We need to use closures here for to provide the wrapped component's props to
1928 * the respective withFormik config methods.
1929 */
1930
1931 var C =
1932 /*#__PURE__*/
1933 function (_React$Component) {
1934 _inheritsLoose(C, _React$Component);
1935
1936 function C() {
1937 var _this;
1938
1939 _this = _React$Component.apply(this, arguments) || this;
1940
1941 _this.validate = function (values) {
1942 return config.validate(values, _this.props);
1943 };
1944
1945 _this.validationSchema = function () {
1946 return isFunction(config.validationSchema) ? config.validationSchema(_this.props) : config.validationSchema;
1947 };
1948
1949 _this.handleSubmit = function (values, actions) {
1950 return config.handleSubmit(values, _extends({}, actions, {
1951 props: _this.props
1952 }));
1953 };
1954 /**
1955 * Just avoiding a render callback for perf here
1956 */
1957
1958
1959 _this.renderFormComponent = function (formikProps) {
1960 return Object(react["createElement"])(Component$1, Object.assign({}, _this.props, formikProps));
1961 };
1962
1963 return _this;
1964 }
1965
1966 var _proto = C.prototype;
1967
1968 _proto.render = function render() {
1969 var _this$props = this.props,
1970 props = _objectWithoutPropertiesLoose(_this$props, ["children"]);
1971
1972 return Object(react["createElement"])(Formik, Object.assign({}, props, config, {
1973 validate: config.validate && this.validate,
1974 validationSchema: config.validationSchema && this.validationSchema,
1975 initialValues: mapPropsToValues(this.props),
1976 initialStatus: config.mapPropsToStatus && config.mapPropsToStatus(this.props),
1977 initialErrors: config.mapPropsToErrors && config.mapPropsToErrors(this.props),
1978 initialTouched: config.mapPropsToTouched && config.mapPropsToTouched(this.props),
1979 onSubmit: this.handleSubmit,
1980 children: this.renderFormComponent
1981 }));
1982 };
1983
1984 return C;
1985 }(react["Component"]);
1986
1987 C.displayName = "WithFormik(" + componentDisplayName + ")";
1988 return hoist_non_react_statics_cjs_default()(C, Component$1 // cast type to ComponentClass (even if SFC)
1989 );
1990 };
1991}
1992
1993/**
1994 * Connect any component to Formik context, and inject as a prop called `formik`;
1995 * @param Comp React Component
1996 */
1997
1998function connect(Comp) {
1999 var C = function C(props) {
2000 return Object(react["createElement"])(FormikConsumer, null, function (formik) {
2001 !!!formik ? false ? undefined : tiny_warning_esm(false) : void 0;
2002 return Object(react["createElement"])(Comp, Object.assign({}, props, {
2003 formik: formik
2004 }));
2005 });
2006 };
2007
2008 var componentDisplayName = Comp.displayName || Comp.name || Comp.constructor && Comp.constructor.name || 'Component'; // Assign Comp to C.WrappedComponent so we can access the inner component in tests
2009 // For example, <Field.WrappedComponent /> gets us <FieldInner/>
2010
2011 C.WrappedComponent = Comp;
2012 C.displayName = "FormikConnect(" + componentDisplayName + ")";
2013 return hoist_non_react_statics_cjs_default()(C, Comp // cast type to ComponentClass (even if SFC)
2014 );
2015}
2016
2017/**
2018 * Some array helpers!
2019 */
2020
2021var move = function move(array, from, to) {
2022 var copy = copyArrayLike(array);
2023 var value = copy[from];
2024 copy.splice(from, 1);
2025 copy.splice(to, 0, value);
2026 return copy;
2027};
2028var swap = function swap(arrayLike, indexA, indexB) {
2029 var copy = copyArrayLike(arrayLike);
2030 var a = copy[indexA];
2031 copy[indexA] = copy[indexB];
2032 copy[indexB] = a;
2033 return copy;
2034};
2035var insert = function insert(arrayLike, index, value) {
2036 var copy = copyArrayLike(arrayLike);
2037 copy.splice(index, 0, value);
2038 return copy;
2039};
2040var replace = function replace(arrayLike, index, value) {
2041 var copy = copyArrayLike(arrayLike);
2042 copy[index] = value;
2043 return copy;
2044};
2045
2046var copyArrayLike = function copyArrayLike(arrayLike) {
2047 if (!arrayLike) {
2048 return [];
2049 } else if (Array.isArray(arrayLike)) {
2050 return [].concat(arrayLike);
2051 } else {
2052 var maxIndex = Object.keys(arrayLike).map(function (key) {
2053 return parseInt(key);
2054 }).reduce(function (max, el) {
2055 return el > max ? el : max;
2056 }, 0);
2057 return Array.from(_extends({}, arrayLike, {
2058 length: maxIndex + 1
2059 }));
2060 }
2061};
2062
2063var formik_esm_FieldArrayInner =
2064/*#__PURE__*/
2065function (_React$Component) {
2066 _inheritsLoose(FieldArrayInner, _React$Component);
2067
2068 function FieldArrayInner(props) {
2069 var _this;
2070
2071 _this = _React$Component.call(this, props) || this;
2072
2073 _this.updateArrayField = function (fn, alterTouched, alterErrors) {
2074 var _this$props = _this.props,
2075 name = _this$props.name,
2076 setFormikState = _this$props.formik.setFormikState;
2077 setFormikState(function (prevState) {
2078 var updateErrors = typeof alterErrors === 'function' ? alterErrors : fn;
2079 var updateTouched = typeof alterTouched === 'function' ? alterTouched : fn; // values fn should be executed before updateErrors and updateTouched,
2080 // otherwise it causes an error with unshift.
2081
2082 var values = setIn(prevState.values, name, fn(getIn(prevState.values, name)));
2083 var fieldError = alterErrors ? updateErrors(getIn(prevState.errors, name)) : undefined;
2084 var fieldTouched = alterTouched ? updateTouched(getIn(prevState.touched, name)) : undefined;
2085
2086 if (isEmptyArray(fieldError)) {
2087 fieldError = undefined;
2088 }
2089
2090 if (isEmptyArray(fieldTouched)) {
2091 fieldTouched = undefined;
2092 }
2093
2094 return _extends({}, prevState, {
2095 values: values,
2096 errors: alterErrors ? setIn(prevState.errors, name, fieldError) : prevState.errors,
2097 touched: alterTouched ? setIn(prevState.touched, name, fieldTouched) : prevState.touched
2098 });
2099 });
2100 };
2101
2102 _this.push = function (value) {
2103 return _this.updateArrayField(function (arrayLike) {
2104 return [].concat(copyArrayLike(arrayLike), [lodash_es_cloneDeep(value)]);
2105 }, false, false);
2106 };
2107
2108 _this.handlePush = function (value) {
2109 return function () {
2110 return _this.push(value);
2111 };
2112 };
2113
2114 _this.swap = function (indexA, indexB) {
2115 return _this.updateArrayField(function (array) {
2116 return swap(array, indexA, indexB);
2117 }, true, true);
2118 };
2119
2120 _this.handleSwap = function (indexA, indexB) {
2121 return function () {
2122 return _this.swap(indexA, indexB);
2123 };
2124 };
2125
2126 _this.move = function (from, to) {
2127 return _this.updateArrayField(function (array) {
2128 return move(array, from, to);
2129 }, true, true);
2130 };
2131
2132 _this.handleMove = function (from, to) {
2133 return function () {
2134 return _this.move(from, to);
2135 };
2136 };
2137
2138 _this.insert = function (index, value) {
2139 return _this.updateArrayField(function (array) {
2140 return insert(array, index, value);
2141 }, function (array) {
2142 return insert(array, index, null);
2143 }, function (array) {
2144 return insert(array, index, null);
2145 });
2146 };
2147
2148 _this.handleInsert = function (index, value) {
2149 return function () {
2150 return _this.insert(index, value);
2151 };
2152 };
2153
2154 _this.replace = function (index, value) {
2155 return _this.updateArrayField(function (array) {
2156 return replace(array, index, value);
2157 }, false, false);
2158 };
2159
2160 _this.handleReplace = function (index, value) {
2161 return function () {
2162 return _this.replace(index, value);
2163 };
2164 };
2165
2166 _this.unshift = function (value) {
2167 var length = -1;
2168
2169 _this.updateArrayField(function (array) {
2170 var arr = array ? [value].concat(array) : [value];
2171
2172 if (length < 0) {
2173 length = arr.length;
2174 }
2175
2176 return arr;
2177 }, function (array) {
2178 var arr = array ? [null].concat(array) : [null];
2179
2180 if (length < 0) {
2181 length = arr.length;
2182 }
2183
2184 return arr;
2185 }, function (array) {
2186 var arr = array ? [null].concat(array) : [null];
2187
2188 if (length < 0) {
2189 length = arr.length;
2190 }
2191
2192 return arr;
2193 });
2194
2195 return length;
2196 };
2197
2198 _this.handleUnshift = function (value) {
2199 return function () {
2200 return _this.unshift(value);
2201 };
2202 };
2203
2204 _this.handleRemove = function (index) {
2205 return function () {
2206 return _this.remove(index);
2207 };
2208 };
2209
2210 _this.handlePop = function () {
2211 return function () {
2212 return _this.pop();
2213 };
2214 }; // We need TypeScript generics on these, so we'll bind them in the constructor
2215 // @todo Fix TS 3.2.1
2216
2217
2218 _this.remove = _this.remove.bind(_assertThisInitialized(_this));
2219 _this.pop = _this.pop.bind(_assertThisInitialized(_this));
2220 return _this;
2221 }
2222
2223 var _proto = FieldArrayInner.prototype;
2224
2225 _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
2226 if (!react_fast_compare_default()(getIn(prevProps.formik.values, prevProps.name), getIn(this.props.formik.values, this.props.name)) && this.props.formik.validateOnChange) {
2227 this.props.formik.validateForm(this.props.formik.values);
2228 }
2229 };
2230
2231 _proto.remove = function remove(index) {
2232 // We need to make sure we also remove relevant pieces of `touched` and `errors`
2233 var result;
2234 this.updateArrayField( // so this gets call 3 times
2235 function (array) {
2236 var copy = array ? copyArrayLike(array) : [];
2237
2238 if (!result) {
2239 result = copy[index];
2240 }
2241
2242 if (isFunction(copy.splice)) {
2243 copy.splice(index, 1);
2244 }
2245
2246 return copy;
2247 }, true, true);
2248 return result;
2249 };
2250
2251 _proto.pop = function pop() {
2252 // Remove relevant pieces of `touched` and `errors` too!
2253 var result;
2254 this.updateArrayField( // so this gets call 3 times
2255 function (array) {
2256 var tmp = array;
2257
2258 if (!result) {
2259 result = tmp && tmp.pop && tmp.pop();
2260 }
2261
2262 return tmp;
2263 }, true, true);
2264 return result;
2265 };
2266
2267 _proto.render = function render() {
2268 var arrayHelpers = {
2269 push: this.push,
2270 pop: this.pop,
2271 swap: this.swap,
2272 move: this.move,
2273 insert: this.insert,
2274 replace: this.replace,
2275 unshift: this.unshift,
2276 remove: this.remove,
2277 handlePush: this.handlePush,
2278 handlePop: this.handlePop,
2279 handleSwap: this.handleSwap,
2280 handleMove: this.handleMove,
2281 handleInsert: this.handleInsert,
2282 handleReplace: this.handleReplace,
2283 handleUnshift: this.handleUnshift,
2284 handleRemove: this.handleRemove
2285 };
2286
2287 var _this$props2 = this.props,
2288 component = _this$props2.component,
2289 render = _this$props2.render,
2290 children = _this$props2.children,
2291 name = _this$props2.name,
2292 _this$props2$formik = _this$props2.formik,
2293 restOfFormik = _objectWithoutPropertiesLoose(_this$props2$formik, ["validate", "validationSchema"]);
2294
2295 var props = _extends({}, arrayHelpers, {
2296 form: restOfFormik,
2297 name: name
2298 });
2299
2300 return component ? Object(react["createElement"])(component, props) : render ? render(props) : children // children come last, always called
2301 ? typeof children === 'function' ? children(props) : !formik_esm_isEmptyChildren(children) ? react["Children"].only(children) : null : null;
2302 };
2303
2304 return FieldArrayInner;
2305}(react["Component"]);
2306
2307formik_esm_FieldArrayInner.defaultProps = {
2308 validateOnChange: true
2309};
2310var FieldArray =
2311/*#__PURE__*/
2312connect(formik_esm_FieldArrayInner);
2313
2314var formik_esm_ErrorMessageImpl =
2315/*#__PURE__*/
2316function (_React$Component) {
2317 _inheritsLoose(ErrorMessageImpl, _React$Component);
2318
2319 function ErrorMessageImpl() {
2320 return _React$Component.apply(this, arguments) || this;
2321 }
2322
2323 var _proto = ErrorMessageImpl.prototype;
2324
2325 _proto.shouldComponentUpdate = function shouldComponentUpdate(props) {
2326 if (getIn(this.props.formik.errors, this.props.name) !== getIn(props.formik.errors, this.props.name) || getIn(this.props.formik.touched, this.props.name) !== getIn(props.formik.touched, this.props.name) || Object.keys(this.props).length !== Object.keys(props).length) {
2327 return true;
2328 } else {
2329 return false;
2330 }
2331 };
2332
2333 _proto.render = function render() {
2334 var _this$props = this.props,
2335 component = _this$props.component,
2336 formik = _this$props.formik,
2337 render = _this$props.render,
2338 children = _this$props.children,
2339 name = _this$props.name,
2340 rest = _objectWithoutPropertiesLoose(_this$props, ["component", "formik", "render", "children", "name"]);
2341
2342 var touch = getIn(formik.touched, name);
2343 var error = getIn(formik.errors, name);
2344 return !!touch && !!error ? render ? isFunction(render) ? render(error) : null : children ? isFunction(children) ? children(error) : null : component ? Object(react["createElement"])(component, rest, error) : error : null;
2345 };
2346
2347 return ErrorMessageImpl;
2348}(react["Component"]);
2349
2350var ErrorMessage =
2351/*#__PURE__*/
2352connect(formik_esm_ErrorMessageImpl);
2353
2354/**
2355 * Custom Field component for quickly hooking into Formik
2356 * context and wiring up forms.
2357 */
2358
2359var formik_esm_FastFieldInner =
2360/*#__PURE__*/
2361function (_React$Component) {
2362 _inheritsLoose(FastFieldInner, _React$Component);
2363
2364 function FastFieldInner(props) {
2365 var _this;
2366
2367 _this = _React$Component.call(this, props) || this;
2368 var render = props.render,
2369 children = props.children,
2370 component = props.component,
2371 is = props.as,
2372 name = props.name;
2373 !!render ? false ? undefined : tiny_warning_esm(false) : void 0;
2374 !!(component && render) ? false ? undefined : tiny_warning_esm(false) : void 0;
2375 !!(is && children && isFunction(children)) ? false ? undefined : tiny_warning_esm(false) : void 0;
2376 !!(component && children && isFunction(children)) ? false ? undefined : tiny_warning_esm(false) : void 0;
2377 !!(render && children && !formik_esm_isEmptyChildren(children)) ? false ? undefined : tiny_warning_esm(false) : void 0;
2378 return _this;
2379 }
2380
2381 var _proto = FastFieldInner.prototype;
2382
2383 _proto.shouldComponentUpdate = function shouldComponentUpdate(props) {
2384 if (this.props.shouldUpdate) {
2385 return this.props.shouldUpdate(props, this.props);
2386 } else if (props.name !== this.props.name || getIn(props.formik.values, this.props.name) !== getIn(this.props.formik.values, this.props.name) || getIn(props.formik.errors, this.props.name) !== getIn(this.props.formik.errors, this.props.name) || getIn(props.formik.touched, this.props.name) !== getIn(this.props.formik.touched, this.props.name) || Object.keys(this.props).length !== Object.keys(props).length || props.formik.isSubmitting !== this.props.formik.isSubmitting) {
2387 return true;
2388 } else {
2389 return false;
2390 }
2391 };
2392
2393 _proto.componentDidMount = function componentDidMount() {
2394 // Register the Field with the parent Formik. Parent will cycle through
2395 // registered Field's validate fns right prior to submit
2396 this.props.formik.registerField(this.props.name, {
2397 validate: this.props.validate
2398 });
2399 };
2400
2401 _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
2402 if (this.props.name !== prevProps.name) {
2403 this.props.formik.unregisterField(prevProps.name);
2404 this.props.formik.registerField(this.props.name, {
2405 validate: this.props.validate
2406 });
2407 }
2408
2409 if (this.props.validate !== prevProps.validate) {
2410 this.props.formik.registerField(this.props.name, {
2411 validate: this.props.validate
2412 });
2413 }
2414 };
2415
2416 _proto.componentWillUnmount = function componentWillUnmount() {
2417 this.props.formik.unregisterField(this.props.name);
2418 };
2419
2420 _proto.render = function render() {
2421 var _this$props = this.props,
2422 name = _this$props.name,
2423 render = _this$props.render,
2424 is = _this$props.as,
2425 children = _this$props.children,
2426 component = _this$props.component,
2427 formik = _this$props.formik,
2428 props = _objectWithoutPropertiesLoose(_this$props, ["validate", "name", "render", "as", "children", "component", "shouldUpdate", "formik"]);
2429
2430 var restOfFormik = _objectWithoutPropertiesLoose(formik, ["validate", "validationSchema"]);
2431
2432 var field = {
2433 value: props.type === 'radio' || props.type === 'checkbox' ? props.value // React uses checked={} for these inputs
2434 : getIn(formik.values, name),
2435 name: name,
2436 onChange: formik.handleChange,
2437 onBlur: formik.handleBlur
2438 };
2439 var meta = {
2440 value: getIn(formik.values, name),
2441 error: getIn(formik.errors, name),
2442 touched: !!getIn(formik.touched, name),
2443 initialValue: getIn(formik.initialValues, name),
2444 initialTouched: !!getIn(formik.initialTouched, name),
2445 initialError: getIn(formik.initialErrors, name)
2446 };
2447 var bag = {
2448 field: field,
2449 meta: meta,
2450 form: restOfFormik
2451 };
2452
2453 if (render) {
2454 return render(bag);
2455 }
2456
2457 if (isFunction(children)) {
2458 return children(bag);
2459 }
2460
2461 if (component) {
2462 // This behavior is backwards compat with earlier Formik 0.9 to 1.x
2463 if (typeof component === 'string') {
2464 var innerRef = props.innerRef,
2465 rest = _objectWithoutPropertiesLoose(props, ["innerRef"]);
2466
2467 return Object(react["createElement"])(component, _extends({
2468 ref: innerRef
2469 }, field, {}, rest), children);
2470 } // We don't pass `meta` for backwards compat
2471
2472
2473 return Object(react["createElement"])(component, _extends({
2474 field: field,
2475 form: formik
2476 }, props), children);
2477 } // default to input here so we can check for both `as` and `children` above
2478
2479
2480 var asElement = is || 'input';
2481
2482 if (typeof asElement === 'string') {
2483 var _innerRef = props.innerRef,
2484 _rest = _objectWithoutPropertiesLoose(props, ["innerRef"]);
2485
2486 return Object(react["createElement"])(asElement, _extends({
2487 ref: _innerRef
2488 }, field, {}, _rest), children);
2489 }
2490
2491 return Object(react["createElement"])(asElement, _extends({}, field, {}, props), children);
2492 };
2493
2494 return FastFieldInner;
2495}(react["Component"]);
2496
2497var FastField =
2498/*#__PURE__*/
2499connect(formik_esm_FastFieldInner);
2500
2501
2502//# sourceMappingURL=formik.esm.js.map
2503
2504
2505/***/ }),
2506
2507/***/ "YnIC":
2508/***/ (function(module, exports, __webpack_require__) {
2509
2510"use strict";
2511/** @license React v0.18.0
2512 * scheduler.production.min.js
2513 *
2514 * Copyright (c) Facebook, Inc. and its affiliates.
2515 *
2516 * This source code is licensed under the MIT license found in the
2517 * LICENSE file in the root directory of this source tree.
2518 */
2519
2520Object.defineProperty(exports,"__esModule",{value:!0});var f,g,h,k,l;
2521if("undefined"===typeof window||"function"!==typeof MessageChannel){var p=null,q=null,t=function(){if(null!==p)try{var a=exports.unstable_now();p(!0,a);p=null}catch(b){throw setTimeout(t,0),b;}},u=Date.now();exports.unstable_now=function(){return Date.now()-u};f=function(a){null!==p?setTimeout(f,0,a):(p=a,setTimeout(t,0))};g=function(a,b){q=setTimeout(a,b)};h=function(){clearTimeout(q)};k=function(){return!1};l=exports.unstable_forceFrameRate=function(){}}else{var w=window.performance,x=window.Date,
2522y=window.setTimeout,z=window.clearTimeout;if("undefined"!==typeof console){var A=window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills");"function"!==typeof A&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"===
2523typeof w&&"function"===typeof w.now)exports.unstable_now=function(){return w.now()};else{var B=x.now();exports.unstable_now=function(){return x.now()-B}}var C=!1,D=null,E=-1,F=5,G=0;k=function(){return exports.unstable_now()>=G};l=function(){};exports.unstable_forceFrameRate=function(a){0>a||125<a?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):F=0<a?Math.floor(1E3/a):5};var H=new MessageChannel,I=H.port2;H.port1.onmessage=
2524function(){if(null!==D){var a=exports.unstable_now();G=a+F;try{D(!0,a)?I.postMessage(null):(C=!1,D=null)}catch(b){throw I.postMessage(null),b;}}else C=!1};f=function(a){D=a;C||(C=!0,I.postMessage(null))};g=function(a,b){E=y(function(){a(exports.unstable_now())},b)};h=function(){z(E);E=-1}}function J(a,b){var c=a.length;a.push(b);a:for(;;){var d=Math.floor((c-1)/2),e=a[d];if(void 0!==e&&0<K(e,b))a[d]=b,a[c]=e,c=d;else break a}}function L(a){a=a[0];return void 0===a?null:a}
2525function M(a){var b=a[0];if(void 0!==b){var c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length;d<e;){var m=2*(d+1)-1,n=a[m],v=m+1,r=a[v];if(void 0!==n&&0>K(n,c))void 0!==r&&0>K(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>K(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function K(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var N=[],O=[],P=1,Q=null,R=3,S=!1,T=!1,U=!1;
2526function V(a){for(var b=L(O);null!==b;){if(null===b.callback)M(O);else if(b.startTime<=a)M(O),b.sortIndex=b.expirationTime,J(N,b);else break;b=L(O)}}function W(a){U=!1;V(a);if(!T)if(null!==L(N))T=!0,f(X);else{var b=L(O);null!==b&&g(W,b.startTime-a)}}
2527function X(a,b){T=!1;U&&(U=!1,h());S=!0;var c=R;try{V(b);for(Q=L(N);null!==Q&&(!(Q.expirationTime>b)||a&&!k());){var d=Q.callback;if(null!==d){Q.callback=null;R=Q.priorityLevel;var e=d(Q.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?Q.callback=e:Q===L(N)&&M(N);V(b)}else M(N);Q=L(N)}if(null!==Q)var m=!0;else{var n=L(O);null!==n&&g(W,n.startTime-b);m=!1}return m}finally{Q=null,R=c,S=!1}}
2528function Y(a){switch(a){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1E4;default:return 5E3}}var Z=l;exports.unstable_ImmediatePriority=1;exports.unstable_UserBlockingPriority=2;exports.unstable_NormalPriority=3;exports.unstable_IdlePriority=5;exports.unstable_LowPriority=4;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=R;R=a;try{return b()}finally{R=c}};
2529exports.unstable_next=function(a){switch(R){case 1:case 2:case 3:var b=3;break;default:b=R}var c=R;R=b;try{return a()}finally{R=c}};
2530exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();if("object"===typeof c&&null!==c){var e=c.delay;e="number"===typeof e&&0<e?d+e:d;c="number"===typeof c.timeout?c.timeout:Y(a)}else c=Y(a),e=d;c=e+c;a={id:P++,callback:b,priorityLevel:a,startTime:e,expirationTime:c,sortIndex:-1};e>d?(a.sortIndex=e,J(O,a),null===L(N)&&a===L(O)&&(U?h():U=!0,g(W,e-d))):(a.sortIndex=c,J(N,a),T||S||(T=!0,f(X)));return a};exports.unstable_cancelCallback=function(a){a.callback=null};
2531exports.unstable_wrapCallback=function(a){var b=R;return function(){var c=R;R=b;try{return a.apply(this,arguments)}finally{R=c}}};exports.unstable_getCurrentPriorityLevel=function(){return R};exports.unstable_shouldYield=function(){var a=exports.unstable_now();V(a);var b=L(N);return b!==Q&&null!==Q&&null!==b&&null!==b.callback&&b.startTime<=a&&b.expirationTime<Q.expirationTime||k()};exports.unstable_requestPaint=Z;exports.unstable_continueExecution=function(){T||S||(T=!0,f(X))};
2532exports.unstable_pauseExecution=function(){};exports.unstable_getFirstCallbackNode=function(){return L(N)};exports.unstable_Profiling=null;
2533
2534
2535/***/ }),
2536
2537/***/ "bmMU":
2538/***/ (function(module, exports, __webpack_require__) {
2539
2540"use strict";
2541
2542
2543var isArray = Array.isArray;
2544var keyList = Object.keys;
2545var hasProp = Object.prototype.hasOwnProperty;
2546var hasElementType = typeof Element !== 'undefined';
2547
2548function equal(a, b) {
2549 // fast-deep-equal index.js 2.0.1
2550 if (a === b) return true;
2551
2552 if (a && b && typeof a == 'object' && typeof b == 'object') {
2553 var arrA = isArray(a)
2554 , arrB = isArray(b)
2555 , i
2556 , length
2557 , key;
2558
2559 if (arrA && arrB) {
2560 length = a.length;
2561 if (length != b.length) return false;
2562 for (i = length; i-- !== 0;)
2563 if (!equal(a[i], b[i])) return false;
2564 return true;
2565 }
2566
2567 if (arrA != arrB) return false;
2568
2569 var dateA = a instanceof Date
2570 , dateB = b instanceof Date;
2571 if (dateA != dateB) return false;
2572 if (dateA && dateB) return a.getTime() == b.getTime();
2573
2574 var regexpA = a instanceof RegExp
2575 , regexpB = b instanceof RegExp;
2576 if (regexpA != regexpB) return false;
2577 if (regexpA && regexpB) return a.toString() == b.toString();
2578
2579 var keys = keyList(a);
2580 length = keys.length;
2581
2582 if (length !== keyList(b).length)
2583 return false;
2584
2585 for (i = length; i-- !== 0;)
2586 if (!hasProp.call(b, keys[i])) return false;
2587 // end fast-deep-equal
2588
2589 // start react-fast-compare
2590 // custom handling for DOM elements
2591 if (hasElementType && a instanceof Element && b instanceof Element)
2592 return a === b;
2593
2594 // custom handling for React
2595 for (i = length; i-- !== 0;) {
2596 key = keys[i];
2597 if (key === '_owner' && a.$$typeof) {
2598 // React-specific: avoid traversing React elements' _owner.
2599 // _owner contains circular references
2600 // and is not needed when comparing the actual elements (and not their owners)
2601 // .$$typeof and ._store on just reasonable markers of a react element
2602 continue;
2603 } else {
2604 // all other properties should be traversed as usual
2605 if (!equal(a[key], b[key])) return false;
2606 }
2607 }
2608 // end react-fast-compare
2609
2610 // fast-deep-equal index.js 2.0.1
2611 return true;
2612 }
2613
2614 return a !== a && b !== b;
2615}
2616// end fast-deep-equal
2617
2618module.exports = function exportedEqual(a, b) {
2619 try {
2620 return equal(a, b);
2621 } catch (error) {
2622 if ((error.message && error.message.match(/stack|recursion/i)) || (error.number === -2146828260)) {
2623 // warn on circular references, don't crash
2624 // browsers give this different errors name and messages:
2625 // chrome/safari: "RangeError", "Maximum call stack size exceeded"
2626 // firefox: "InternalError", too much recursion"
2627 // edge: "Error", "Out of stack space"
2628 console.warn('Warning: react-fast-compare does not handle circular references.', error.name, error.message);
2629 return false;
2630 }
2631 // some other error. we should definitely know about these
2632 throw error;
2633 }
2634};
2635
2636
2637/***/ })
2638
2639}]);