mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
1 line
207 KiB
JSON
1 line
207 KiB
JSON
{"ast":null,"code":"import { Children, createContext, useContext, useRef, useEffect, useReducer, useCallback, useMemo, useImperativeHandle, createElement, useLayoutEffect, forwardRef, Component } from 'react';\nimport isEqual from 'react-fast-compare';\nimport deepmerge from 'deepmerge';\nimport isPlainObject from 'lodash-es/isPlainObject';\nimport clone from 'lodash-es/clone';\nimport toPath from 'lodash-es/toPath';\nimport invariant from 'tiny-warning';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport cloneDeep from 'lodash-es/cloneDeep';\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n/** @private is the value an empty array? */\n\n\nvar isEmptyArray = function isEmptyArray(value) {\n return Array.isArray(value) && value.length === 0;\n};\n/** @private is the given object a Function? */\n\n\nvar isFunction = function isFunction(obj) {\n return typeof obj === 'function';\n};\n/** @private is the given object an Object? */\n\n\nvar isObject = function isObject(obj) {\n return obj !== null && typeof obj === 'object';\n};\n/** @private is the given object an integer? */\n\n\nvar isInteger = function isInteger(obj) {\n return String(Math.floor(Number(obj))) === obj;\n};\n/** @private is the given object a string? */\n\n\nvar isString = function isString(obj) {\n return Object.prototype.toString.call(obj) === '[object String]';\n};\n/** @private is the given object a NaN? */\n// eslint-disable-next-line no-self-compare\n\n\nvar isNaN$1 = function isNaN(obj) {\n return obj !== obj;\n};\n/** @private Does a React component have exactly 0 children? */\n\n\nvar isEmptyChildren = function isEmptyChildren(children) {\n return Children.count(children) === 0;\n};\n/** @private is the given object/value a promise? */\n\n\nvar isPromise = function isPromise(value) {\n return isObject(value) && isFunction(value.then);\n};\n/** @private is the given object/value a type of synthetic event? */\n\n\nvar isInputEvent = function isInputEvent(value) {\n return value && isObject(value) && isObject(value.target);\n};\n/**\r\n * Same as document.activeElement but wraps in a try-catch block. In IE it is\r\n * not safe to call document.activeElement if there is nothing focused.\r\n *\r\n * The activeElement will be null only if the document or document body is not\r\n * yet defined.\r\n *\r\n * @param {?Document} doc Defaults to current document.\r\n * @return {Element | null}\r\n * @see https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/dom/getActiveElement.js\r\n */\n\n\nfunction getActiveElement(doc) {\n doc = doc || (typeof document !== 'undefined' ? document : undefined);\n\n if (typeof doc === 'undefined') {\n return null;\n }\n\n try {\n return doc.activeElement || doc.body;\n } catch (e) {\n return doc.body;\n }\n}\n/**\r\n * Deeply get a value from an object via its path.\r\n */\n\n\nfunction getIn(obj, key, def, p) {\n if (p === void 0) {\n p = 0;\n }\n\n var path = toPath(key);\n\n while (obj && p < path.length) {\n obj = obj[path[p++]];\n }\n\n return obj === undefined ? def : obj;\n}\n/**\r\n * Deeply set a value from in object via it's path. If the value at `path`\r\n * has changed, return a shallow copy of obj with `value` set at `path`.\r\n * If `value` has not changed, return the original `obj`.\r\n *\r\n * Existing objects / arrays along `path` are also shallow copied. Sibling\r\n * objects along path retain the same internal js reference. Since new\r\n * objects / arrays are only created along `path`, we can test if anything\r\n * changed in a nested structure by comparing the object's reference in\r\n * the old and new object, similar to how russian doll cache invalidation\r\n * works.\r\n *\r\n * In earlier versions of this function, which used cloneDeep, there were\r\n * issues whereby settings a nested value would mutate the parent\r\n * instead of creating a new object. `clone` avoids that bug making a\r\n * shallow copy of the objects along the update path\r\n * so no object is mutated in place.\r\n *\r\n * Before changing this function, please read through the following\r\n * discussions.\r\n *\r\n * @see https://github.com/developit/linkstate\r\n * @see https://github.com/jaredpalmer/formik/pull/123\r\n */\n\n\nfunction setIn(obj, path, value) {\n var res = clone(obj); // this keeps inheritance when obj is a class\n\n var resVal = res;\n var i = 0;\n var pathArray = toPath(path);\n\n for (; i < pathArray.length - 1; i++) {\n var currentPath = pathArray[i];\n var currentObj = getIn(obj, pathArray.slice(0, i + 1));\n\n if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {\n resVal = resVal[currentPath] = clone(currentObj);\n } else {\n var nextPath = pathArray[i + 1];\n resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};\n }\n } // Return original object if new value is the same as current\n\n\n if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {\n return obj;\n }\n\n if (value === undefined) {\n delete resVal[pathArray[i]];\n } else {\n resVal[pathArray[i]] = value;\n } // If the path array has a single element, the loop did not run.\n // Deleting on `resVal` had no effect in this scenario, so we delete on the result instead.\n\n\n if (i === 0 && value === undefined) {\n delete res[pathArray[i]];\n }\n\n return res;\n}\n/**\r\n * Recursively a set the same value for all keys and arrays nested object, cloning\r\n * @param object\r\n * @param value\r\n * @param visited\r\n * @param response\r\n */\n\n\nfunction setNestedObjectValues(object, value, visited, response) {\n if (visited === void 0) {\n visited = new WeakMap();\n }\n\n if (response === void 0) {\n response = {};\n }\n\n for (var _i = 0, _Object$keys = Object.keys(object); _i < _Object$keys.length; _i++) {\n var k = _Object$keys[_i];\n var val = object[k];\n\n if (isObject(val)) {\n if (!visited.get(val)) {\n visited.set(val, true); // In order to keep array values consistent for both dot path and\n // bracket syntax, we need to check if this is an array so that\n // this will output { friends: [true] } and not { friends: { \"0\": true } }\n\n response[k] = Array.isArray(val) ? [] : {};\n setNestedObjectValues(val, value, visited, response[k]);\n }\n } else {\n response[k] = value;\n }\n }\n\n return response;\n}\n\nvar FormikContext = /*#__PURE__*/createContext(undefined);\nFormikContext.displayName = 'FormikContext';\nvar FormikProvider = FormikContext.Provider;\nvar FormikConsumer = FormikContext.Consumer;\n\nfunction useFormikContext() {\n var formik = useContext(FormikContext);\n !!!formik ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Formik context is undefined, please verify you are calling useFormikContext() as child of a <Formik> component.\") : invariant(false) : void 0;\n return formik;\n}\n\nfunction formikReducer(state, msg) {\n switch (msg.type) {\n case 'SET_VALUES':\n return _extends({}, state, {\n values: msg.payload\n });\n\n case 'SET_TOUCHED':\n return _extends({}, state, {\n touched: msg.payload\n });\n\n case 'SET_ERRORS':\n if (isEqual(state.errors, msg.payload)) {\n return state;\n }\n\n return _extends({}, state, {\n errors: msg.payload\n });\n\n case 'SET_STATUS':\n return _extends({}, state, {\n status: msg.payload\n });\n\n case 'SET_ISSUBMITTING':\n return _extends({}, state, {\n isSubmitting: msg.payload\n });\n\n case 'SET_ISVALIDATING':\n return _extends({}, state, {\n isValidating: msg.payload\n });\n\n case 'SET_FIELD_VALUE':\n return _extends({}, state, {\n values: setIn(state.values, msg.payload.field, msg.payload.value)\n });\n\n case 'SET_FIELD_TOUCHED':\n return _extends({}, state, {\n touched: setIn(state.touched, msg.payload.field, msg.payload.value)\n });\n\n case 'SET_FIELD_ERROR':\n return _extends({}, state, {\n errors: setIn(state.errors, msg.payload.field, msg.payload.value)\n });\n\n case 'RESET_FORM':\n return _extends({}, state, msg.payload);\n\n case 'SET_FORMIK_STATE':\n return msg.payload(state);\n\n case 'SUBMIT_ATTEMPT':\n return _extends({}, state, {\n touched: setNestedObjectValues(state.values, true),\n isSubmitting: true,\n submitCount: state.submitCount + 1\n });\n\n case 'SUBMIT_FAILURE':\n return _extends({}, state, {\n isSubmitting: false\n });\n\n case 'SUBMIT_SUCCESS':\n return _extends({}, state, {\n isSubmitting: false\n });\n\n default:\n return state;\n }\n} // Initial empty states // objects\n\n\nvar emptyErrors = {};\nvar emptyTouched = {};\n\nfunction useFormik(_ref) {\n var _ref$validateOnChange = _ref.validateOnChange,\n validateOnChange = _ref$validateOnChange === void 0 ? true : _ref$validateOnChange,\n _ref$validateOnBlur = _ref.validateOnBlur,\n validateOnBlur = _ref$validateOnBlur === void 0 ? true : _ref$validateOnBlur,\n _ref$validateOnMount = _ref.validateOnMount,\n validateOnMount = _ref$validateOnMount === void 0 ? false : _ref$validateOnMount,\n isInitialValid = _ref.isInitialValid,\n _ref$enableReinitiali = _ref.enableReinitialize,\n enableReinitialize = _ref$enableReinitiali === void 0 ? false : _ref$enableReinitiali,\n onSubmit = _ref.onSubmit,\n rest = _objectWithoutPropertiesLoose(_ref, [\"validateOnChange\", \"validateOnBlur\", \"validateOnMount\", \"isInitialValid\", \"enableReinitialize\", \"onSubmit\"]);\n\n var props = _extends({\n validateOnChange: validateOnChange,\n validateOnBlur: validateOnBlur,\n validateOnMount: validateOnMount,\n onSubmit: onSubmit\n }, rest);\n\n var initialValues = useRef(props.initialValues);\n var initialErrors = useRef(props.initialErrors || emptyErrors);\n var initialTouched = useRef(props.initialTouched || emptyTouched);\n var initialStatus = useRef(props.initialStatus);\n var isMounted = useRef(false);\n var fieldRegistry = useRef({});\n\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(function () {\n !(typeof isInitialValid === 'undefined') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'isInitialValid has been deprecated and will be removed in future versions of Formik. Please use initialErrors or validateOnMount instead.') : invariant(false) : void 0; // eslint-disable-next-line\n }, []);\n }\n\n useEffect(function () {\n isMounted.current = true;\n return function () {\n isMounted.current = false;\n };\n }, []);\n\n var _React$useReducer = useReducer(formikReducer, {\n values: props.initialValues,\n errors: props.initialErrors || emptyErrors,\n touched: props.initialTouched || emptyTouched,\n status: props.initialStatus,\n isSubmitting: false,\n isValidating: false,\n submitCount: 0\n }),\n state = _React$useReducer[0],\n dispatch = _React$useReducer[1];\n\n var runValidateHandler = useCallback(function (values, field) {\n return new Promise(function (resolve, reject) {\n var maybePromisedErrors = props.validate(values, field);\n\n if (maybePromisedErrors == null) {\n // use loose null check here on purpose\n resolve(emptyErrors);\n } else if (isPromise(maybePromisedErrors)) {\n maybePromisedErrors.then(function (errors) {\n resolve(errors || emptyErrors);\n }, function (actualException) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\"Warning: An unhandled error was caught during validation in <Formik validate />\", actualException);\n }\n\n reject(actualException);\n });\n } else {\n resolve(maybePromisedErrors);\n }\n });\n }, [props.validate]);\n /**\r\n * Run validation against a Yup schema and optionally run a function if successful\r\n */\n\n var runValidationSchema = useCallback(function (values, field) {\n var validationSchema = props.validationSchema;\n var schema = isFunction(validationSchema) ? validationSchema(field) : validationSchema;\n var promise = field && schema.validateAt ? schema.validateAt(field, values) : validateYupSchema(values, schema);\n return new Promise(function (resolve, reject) {\n promise.then(function () {\n resolve(emptyErrors);\n }, function (err) {\n // Yup will throw a validation error if validation fails. We catch those and\n // resolve them into Formik errors. We can sniff if something is a Yup error\n // by checking error.name.\n // @see https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string\n if (err.name === 'ValidationError') {\n resolve(yupToFormErrors(err));\n } else {\n // We throw any other errors\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\"Warning: An unhandled error was caught during validation in <Formik validationSchema />\", err);\n }\n\n reject(err);\n }\n });\n });\n }, [props.validationSchema]);\n var runSingleFieldLevelValidation = useCallback(function (field, value) {\n return new Promise(function (resolve) {\n return resolve(fieldRegistry.current[field].validate(value));\n });\n }, []);\n var runFieldLevelValidations = useCallback(function (values) {\n var fieldKeysWithValidation = Object.keys(fieldRegistry.current).filter(function (f) {\n return isFunction(fieldRegistry.current[f].validate);\n }); // Construct an array with all of the field validation functions\n\n var fieldValidations = fieldKeysWithValidation.length > 0 ? fieldKeysWithValidation.map(function (f) {\n return runSingleFieldLevelValidation(f, getIn(values, f));\n }) : [Promise.resolve('DO_NOT_DELETE_YOU_WILL_BE_FIRED')]; // use special case ;)\n\n return Promise.all(fieldValidations).then(function (fieldErrorsList) {\n return fieldErrorsList.reduce(function (prev, curr, index) {\n if (curr === 'DO_NOT_DELETE_YOU_WILL_BE_FIRED') {\n return prev;\n }\n\n if (curr) {\n prev = setIn(prev, fieldKeysWithValidation[index], curr);\n }\n\n return prev;\n }, {});\n });\n }, [runSingleFieldLevelValidation]); // Run all validations and return the result\n\n var runAllValidations = useCallback(function (values) {\n return Promise.all([runFieldLevelValidations(values), props.validationSchema ? runValidationSchema(values) : {}, props.validate ? runValidateHandler(values) : {}]).then(function (_ref2) {\n var fieldErrors = _ref2[0],\n schemaErrors = _ref2[1],\n validateErrors = _ref2[2];\n var combinedErrors = deepmerge.all([fieldErrors, schemaErrors, validateErrors], {\n arrayMerge: arrayMerge\n });\n return combinedErrors;\n });\n }, [props.validate, props.validationSchema, runFieldLevelValidations, runValidateHandler, runValidationSchema]); // Run all validations methods and update state accordingly\n\n var validateFormWithHighPriority = useEventCallback(function (values) {\n if (values === void 0) {\n values = state.values;\n }\n\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: true\n });\n return runAllValidations(values).then(function (combinedErrors) {\n if (!!isMounted.current) {\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: false\n });\n dispatch({\n type: 'SET_ERRORS',\n payload: combinedErrors\n });\n }\n\n return combinedErrors;\n });\n });\n useEffect(function () {\n if (validateOnMount && isMounted.current === true && isEqual(initialValues.current, props.initialValues)) {\n validateFormWithHighPriority(initialValues.current);\n }\n }, [validateOnMount, validateFormWithHighPriority]);\n var resetForm = useCallback(function (nextState) {\n var values = nextState && nextState.values ? nextState.values : initialValues.current;\n var errors = nextState && nextState.errors ? nextState.errors : initialErrors.current ? initialErrors.current : props.initialErrors || {};\n var touched = nextState && nextState.touched ? nextState.touched : initialTouched.current ? initialTouched.current : props.initialTouched || {};\n var status = nextState && nextState.status ? nextState.status : initialStatus.current ? initialStatus.current : props.initialStatus;\n initialValues.current = values;\n initialErrors.current = errors;\n initialTouched.current = touched;\n initialStatus.current = status;\n\n var dispatchFn = function dispatchFn() {\n dispatch({\n type: 'RESET_FORM',\n payload: {\n isSubmitting: !!nextState && !!nextState.isSubmitting,\n errors: errors,\n touched: touched,\n status: status,\n values: values,\n isValidating: !!nextState && !!nextState.isValidating,\n submitCount: !!nextState && !!nextState.submitCount && typeof nextState.submitCount === 'number' ? nextState.submitCount : 0\n }\n });\n };\n\n if (props.onReset) {\n var maybePromisedOnReset = props.onReset(state.values, imperativeMethods);\n\n if (isPromise(maybePromisedOnReset)) {\n maybePromisedOnReset.then(dispatchFn);\n } else {\n dispatchFn();\n }\n } else {\n dispatchFn();\n }\n }, [props.initialErrors, props.initialStatus, props.initialTouched]);\n useEffect(function () {\n if (isMounted.current === true && !isEqual(initialValues.current, props.initialValues)) {\n if (enableReinitialize) {\n initialValues.current = props.initialValues;\n resetForm();\n }\n\n if (validateOnMount) {\n validateFormWithHighPriority(initialValues.current);\n }\n }\n }, [enableReinitialize, props.initialValues, resetForm, validateOnMount, validateFormWithHighPriority]);\n useEffect(function () {\n if (enableReinitialize && isMounted.current === true && !isEqual(initialErrors.current, props.initialErrors)) {\n initialErrors.current = props.initialErrors || emptyErrors;\n dispatch({\n type: 'SET_ERRORS',\n payload: props.initialErrors || emptyErrors\n });\n }\n }, [enableReinitialize, props.initialErrors]);\n useEffect(function () {\n if (enableReinitialize && isMounted.current === true && !isEqual(initialTouched.current, props.initialTouched)) {\n initialTouched.current = props.initialTouched || emptyTouched;\n dispatch({\n type: 'SET_TOUCHED',\n payload: props.initialTouched || emptyTouched\n });\n }\n }, [enableReinitialize, props.initialTouched]);\n useEffect(function () {\n if (enableReinitialize && isMounted.current === true && !isEqual(initialStatus.current, props.initialStatus)) {\n initialStatus.current = props.initialStatus;\n dispatch({\n type: 'SET_STATUS',\n payload: props.initialStatus\n });\n }\n }, [enableReinitialize, props.initialStatus, props.initialTouched]);\n var validateField = useEventCallback(function (name) {\n // This will efficiently validate a single field by avoiding state\n // changes if the validation function is synchronous. It's different from\n // what is called when using validateForm.\n if (fieldRegistry.current[name] && isFunction(fieldRegistry.current[name].validate)) {\n var value = getIn(state.values, name);\n var maybePromise = fieldRegistry.current[name].validate(value);\n\n if (isPromise(maybePromise)) {\n // Only flip isValidating if the function is async.\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: true\n });\n return maybePromise.then(function (x) {\n return x;\n }).then(function (error) {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: {\n field: name,\n value: error\n }\n });\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: false\n });\n });\n } else {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: {\n field: name,\n value: maybePromise\n }\n });\n return Promise.resolve(maybePromise);\n }\n } else if (props.validationSchema) {\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: true\n });\n return runValidationSchema(state.values, name).then(function (x) {\n return x;\n }).then(function (error) {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: {\n field: name,\n value: error[name]\n }\n });\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: false\n });\n });\n }\n\n return Promise.resolve();\n });\n var registerField = useCallback(function (name, _ref3) {\n var validate = _ref3.validate;\n fieldRegistry.current[name] = {\n validate: validate\n };\n }, []);\n var unregisterField = useCallback(function (name) {\n delete fieldRegistry.current[name];\n }, []);\n var setTouched = useEventCallback(function (touched, shouldValidate) {\n dispatch({\n type: 'SET_TOUCHED',\n payload: touched\n });\n var willValidate = shouldValidate === undefined ? validateOnBlur : shouldValidate;\n return willValidate ? validateFormWithHighPriority(state.values) : Promise.resolve();\n });\n var setErrors = useCallback(function (errors) {\n dispatch({\n type: 'SET_ERRORS',\n payload: errors\n });\n }, []);\n var setValues = useEventCallback(function (values, shouldValidate) {\n var resolvedValues = isFunction(values) ? values(state.values) : values;\n dispatch({\n type: 'SET_VALUES',\n payload: resolvedValues\n });\n var willValidate = shouldValidate === undefined ? validateOnChange : shouldValidate;\n return willValidate ? validateFormWithHighPriority(resolvedValues) : Promise.resolve();\n });\n var setFieldError = useCallback(function (field, value) {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: {\n field: field,\n value: value\n }\n });\n }, []);\n var setFieldValue = useEventCallback(function (field, value, shouldValidate) {\n dispatch({\n type: 'SET_FIELD_VALUE',\n payload: {\n field: field,\n value: value\n }\n });\n var willValidate = shouldValidate === undefined ? validateOnChange : shouldValidate;\n return willValidate ? validateFormWithHighPriority(setIn(state.values, field, value)) : Promise.resolve();\n });\n var executeChange = useCallback(function (eventOrTextValue, maybePath) {\n // By default, assume that the first argument is a string. This allows us to use\n // handleChange with React Native and React Native Web's onChangeText prop which\n // provides just the value of the input.\n var field = maybePath;\n var val = eventOrTextValue;\n var parsed; // If the first argument is not a string though, it has to be a synthetic React Event (or a fake one),\n // so we handle like we would a normal HTML change event.\n\n if (!isString(eventOrTextValue)) {\n // If we can, persist the event\n // @see https://reactjs.org/docs/events.html#event-pooling\n if (eventOrTextValue.persist) {\n eventOrTextValue.persist();\n }\n\n var target = eventOrTextValue.target ? eventOrTextValue.target : eventOrTextValue.currentTarget;\n var type = target.type,\n name = target.name,\n id = target.id,\n value = target.value,\n checked = target.checked,\n outerHTML = target.outerHTML,\n options = target.options,\n multiple = target.multiple;\n field = maybePath ? maybePath : name ? name : id;\n\n if (!field && process.env.NODE_ENV !== \"production\") {\n warnAboutMissingIdentifier({\n htmlContent: outerHTML,\n documentationAnchorLink: 'handlechange-e-reactchangeeventany--void',\n handlerName: 'handleChange'\n });\n }\n\n val = /number|range/.test(type) ? (parsed = parseFloat(value), isNaN(parsed) ? '' : parsed) : /checkbox/.test(type) // checkboxes\n ? getValueForCheckbox(getIn(state.values, field), checked, value) : options && multiple // <select multiple>\n ? getSelectedValues(options) : value;\n }\n\n if (field) {\n // Set form fields by name\n setFieldValue(field, val);\n }\n }, [setFieldValue, state.values]);\n var handleChange = useEventCallback(function (eventOrPath) {\n if (isString(eventOrPath)) {\n return function (event) {\n return executeChange(event, eventOrPath);\n };\n } else {\n executeChange(eventOrPath);\n }\n });\n var setFieldTouched = useEventCallback(function (field, touched, shouldValidate) {\n if (touched === void 0) {\n touched = true;\n }\n\n dispatch({\n type: 'SET_FIELD_TOUCHED',\n payload: {\n field: field,\n value: touched\n }\n });\n var willValidate = shouldValidate === undefined ? validateOnBlur : shouldValidate;\n return willValidate ? validateFormWithHighPriority(state.values) : Promise.resolve();\n });\n var executeBlur = useCallback(function (e, path) {\n if (e.persist) {\n e.persist();\n }\n\n var _e$target = e.target,\n name = _e$target.name,\n id = _e$target.id,\n outerHTML = _e$target.outerHTML;\n var field = path ? path : name ? name : id;\n\n if (!field && process.env.NODE_ENV !== \"production\") {\n warnAboutMissingIdentifier({\n htmlContent: outerHTML,\n documentationAnchorLink: 'handleblur-e-any--void',\n handlerName: 'handleBlur'\n });\n }\n\n setFieldTouched(field, true);\n }, [setFieldTouched]);\n var handleBlur = useEventCallback(function (eventOrString) {\n if (isString(eventOrString)) {\n return function (event) {\n return executeBlur(event, eventOrString);\n };\n } else {\n executeBlur(eventOrString);\n }\n });\n var setFormikState = useCallback(function (stateOrCb) {\n if (isFunction(stateOrCb)) {\n dispatch({\n type: 'SET_FORMIK_STATE',\n payload: stateOrCb\n });\n } else {\n dispatch({\n type: 'SET_FORMIK_STATE',\n payload: function payload() {\n return stateOrCb;\n }\n });\n }\n }, []);\n var setStatus = useCallback(function (status) {\n dispatch({\n type: 'SET_STATUS',\n payload: status\n });\n }, []);\n var setSubmitting = useCallback(function (isSubmitting) {\n dispatch({\n type: 'SET_ISSUBMITTING',\n payload: isSubmitting\n });\n }, []);\n var submitForm = useEventCallback(function () {\n dispatch({\n type: 'SUBMIT_ATTEMPT'\n });\n return validateFormWithHighPriority().then(function (combinedErrors) {\n // In case an error was thrown and passed to the resolved Promise,\n // `combinedErrors` can be an instance of an Error. We need to check\n // that and abort the submit.\n // If we don't do that, calling `Object.keys(new Error())` yields an\n // empty array, which causes the validation to pass and the form\n // to be submitted.\n var isInstanceOfError = combinedErrors instanceof Error;\n var isActuallyValid = !isInstanceOfError && Object.keys(combinedErrors).length === 0;\n\n if (isActuallyValid) {\n // Proceed with submit...\n //\n // To respect sync submit fns, we can't simply wrap executeSubmit in a promise and\n // _always_ dispatch SUBMIT_SUCCESS because isSubmitting would then always be false.\n // This would be fine in simple cases, but make it impossible to disable submit\n // buttons where people use callbacks or promises as side effects (which is basically\n // all of v1 Formik code). Instead, recall that we are inside of a promise chain already,\n // so we can try/catch executeSubmit(), if it returns undefined, then just bail.\n // If there are errors, throw em. Otherwise, wrap executeSubmit in a promise and handle\n // cleanup of isSubmitting on behalf of the consumer.\n var promiseOrUndefined;\n\n try {\n promiseOrUndefined = executeSubmit(); // Bail if it's sync, consumer is responsible for cleaning up\n // via setSubmitting(false)\n\n if (promiseOrUndefined === undefined) {\n return;\n }\n } catch (error) {\n throw error;\n }\n\n return Promise.resolve(promiseOrUndefined).then(function (result) {\n if (!!isMounted.current) {\n dispatch({\n type: 'SUBMIT_SUCCESS'\n });\n }\n\n return result;\n })[\"catch\"](function (_errors) {\n if (!!isMounted.current) {\n dispatch({\n type: 'SUBMIT_FAILURE'\n }); // This is a legit error rejected by the onSubmit fn\n // so we don't want to break the promise chain\n\n throw _errors;\n }\n });\n } else if (!!isMounted.current) {\n // ^^^ Make sure Formik is still mounted before updating state\n dispatch({\n type: 'SUBMIT_FAILURE'\n }); // throw combinedErrors;\n\n if (isInstanceOfError) {\n throw combinedErrors;\n }\n }\n\n return;\n });\n });\n var handleSubmit = useEventCallback(function (e) {\n if (e && e.preventDefault && isFunction(e.preventDefault)) {\n e.preventDefault();\n }\n\n if (e && e.stopPropagation && isFunction(e.stopPropagation)) {\n e.stopPropagation();\n } // Warn if form submission is triggered by a <button> without a\n // specified `type` attribute during development. This mitigates\n // a common gotcha in forms with both reset and submit buttons,\n // where the dev forgets to add type=\"button\" to the reset button.\n\n\n if (process.env.NODE_ENV !== \"production\" && typeof document !== 'undefined') {\n // Safely get the active element (works with IE)\n var activeElement = getActiveElement();\n\n if (activeElement !== null && activeElement instanceof HTMLButtonElement) {\n !(activeElement.attributes && activeElement.attributes.getNamedItem('type')) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'You submitted a Formik form using a button with an unspecified `type` attribute. Most browsers default button elements to `type=\"submit\"`. If this is not a submit button, please add `type=\"button\"`.') : invariant(false) : void 0;\n }\n }\n\n submitForm()[\"catch\"](function (reason) {\n console.warn(\"Warning: An unhandled error was caught from submitForm()\", reason);\n });\n });\n var imperativeMethods = {\n resetForm: resetForm,\n validateForm: validateFormWithHighPriority,\n validateField: validateField,\n setErrors: setErrors,\n setFieldError: setFieldError,\n setFieldTouched: setFieldTouched,\n setFieldValue: setFieldValue,\n setStatus: setStatus,\n setSubmitting: setSubmitting,\n setTouched: setTouched,\n setValues: setValues,\n setFormikState: setFormikState,\n submitForm: submitForm\n };\n var executeSubmit = useEventCallback(function () {\n return onSubmit(state.values, imperativeMethods);\n });\n var handleReset = useEventCallback(function (e) {\n if (e && e.preventDefault && isFunction(e.preventDefault)) {\n e.preventDefault();\n }\n\n if (e && e.stopPropagation && isFunction(e.stopPropagation)) {\n e.stopPropagation();\n }\n\n resetForm();\n });\n var getFieldMeta = useCallback(function (name) {\n return {\n value: getIn(state.values, name),\n error: getIn(state.errors, name),\n touched: !!getIn(state.touched, name),\n initialValue: getIn(initialValues.current, name),\n initialTouched: !!getIn(initialTouched.current, name),\n initialError: getIn(initialErrors.current, name)\n };\n }, [state.errors, state.touched, state.values]);\n var getFieldHelpers = useCallback(function (name) {\n return {\n setValue: function setValue(value, shouldValidate) {\n return setFieldValue(name, value, shouldValidate);\n },\n setTouched: function setTouched(value, shouldValidate) {\n return setFieldTouched(name, value, shouldValidate);\n },\n setError: function setError(value) {\n return setFieldError(name, value);\n }\n };\n }, [setFieldValue, setFieldTouched, setFieldError]);\n var getFieldProps = useCallback(function (nameOrOptions) {\n var isAnObject = isObject(nameOrOptions);\n var name = isAnObject ? nameOrOptions.name : nameOrOptions;\n var valueState = getIn(state.values, name);\n var field = {\n name: name,\n value: valueState,\n onChange: handleChange,\n onBlur: handleBlur\n };\n\n if (isAnObject) {\n var type = nameOrOptions.type,\n valueProp = nameOrOptions.value,\n is = nameOrOptions.as,\n multiple = nameOrOptions.multiple;\n\n if (type === 'checkbox') {\n if (valueProp === undefined) {\n field.checked = !!valueState;\n } else {\n field.checked = !!(Array.isArray(valueState) && ~valueState.indexOf(valueProp));\n field.value = valueProp;\n }\n } else if (type === 'radio') {\n field.checked = valueState === valueProp;\n field.value = valueProp;\n } else if (is === 'select' && multiple) {\n field.value = field.value || [];\n field.multiple = true;\n }\n }\n\n return field;\n }, [handleBlur, handleChange, state.values]);\n var dirty = useMemo(function () {\n return !isEqual(initialValues.current, state.values);\n }, [initialValues.current, state.values]);\n var isValid = useMemo(function () {\n 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;\n }, [isInitialValid, dirty, state.errors, props]);\n\n var ctx = _extends({}, state, {\n initialValues: initialValues.current,\n initialErrors: initialErrors.current,\n initialTouched: initialTouched.current,\n initialStatus: initialStatus.current,\n handleBlur: handleBlur,\n handleChange: handleChange,\n handleReset: handleReset,\n handleSubmit: handleSubmit,\n resetForm: resetForm,\n setErrors: setErrors,\n setFormikState: setFormikState,\n setFieldTouched: setFieldTouched,\n setFieldValue: setFieldValue,\n setFieldError: setFieldError,\n setStatus: setStatus,\n setSubmitting: setSubmitting,\n setTouched: setTouched,\n setValues: setValues,\n submitForm: submitForm,\n validateForm: validateFormWithHighPriority,\n validateField: validateField,\n isValid: isValid,\n dirty: dirty,\n unregisterField: unregisterField,\n registerField: registerField,\n getFieldProps: getFieldProps,\n getFieldMeta: getFieldMeta,\n getFieldHelpers: getFieldHelpers,\n validateOnBlur: validateOnBlur,\n validateOnChange: validateOnChange,\n validateOnMount: validateOnMount\n });\n\n return ctx;\n}\n\nfunction Formik(props) {\n var formikbag = useFormik(props);\n var component = props.component,\n children = props.children,\n render = props.render,\n innerRef = props.innerRef; // This allows folks to pass a ref to <Formik />\n\n useImperativeHandle(innerRef, function () {\n return formikbag;\n });\n\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(function () {\n !!props.render ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"<Formik render> has been deprecated and will be removed in future versions of Formik. Please use a child callback function instead. To get rid of this warning, replace <Formik render={(props) => ...} /> with <Formik>{(props) => ...}</Formik>\") : invariant(false) : void 0; // eslint-disable-next-line\n }, []);\n }\n\n return createElement(FormikProvider, {\n value: formikbag\n }, component ? createElement(component, formikbag) : render ? render(formikbag) : children // children come last, always called\n ? isFunction(children) ? children(formikbag) : !isEmptyChildren(children) ? Children.only(children) : null : null);\n}\n\nfunction warnAboutMissingIdentifier(_ref4) {\n var htmlContent = _ref4.htmlContent,\n documentationAnchorLink = _ref4.documentationAnchorLink,\n handlerName = _ref4.handlerName;\n 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://formik.org/docs/api/formik#\" + documentationAnchorLink + \"\\n \");\n}\n/**\r\n * Transform Yup ValidationError to a more usable object\r\n */\n\n\nfunction yupToFormErrors(yupError) {\n var errors = {};\n\n if (yupError.inner) {\n if (yupError.inner.length === 0) {\n return setIn(errors, yupError.path, yupError.message);\n }\n\n for (var _iterator = yupError.inner, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref5;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref5 = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref5 = _i.value;\n }\n\n var err = _ref5;\n\n if (!getIn(errors, err.path)) {\n errors = setIn(errors, err.path, err.message);\n }\n }\n }\n\n return errors;\n}\n/**\r\n * Validate a yup schema.\r\n */\n\n\nfunction validateYupSchema(values, schema, sync, context) {\n if (sync === void 0) {\n sync = false;\n }\n\n if (context === void 0) {\n context = {};\n }\n\n var validateData = prepareDataForValidation(values);\n return schema[sync ? 'validateSync' : 'validate'](validateData, {\n abortEarly: false,\n context: context\n });\n}\n/**\r\n * Recursively prepare values.\r\n */\n\n\nfunction prepareDataForValidation(values) {\n var data = Array.isArray(values) ? [] : {};\n\n for (var k in values) {\n if (Object.prototype.hasOwnProperty.call(values, k)) {\n var key = String(k);\n\n if (Array.isArray(values[key]) === true) {\n data[key] = values[key].map(function (value) {\n if (Array.isArray(value) === true || isPlainObject(value)) {\n return prepareDataForValidation(value);\n } else {\n return value !== '' ? value : undefined;\n }\n });\n } else if (isPlainObject(values[key])) {\n data[key] = prepareDataForValidation(values[key]);\n } else {\n data[key] = values[key] !== '' ? values[key] : undefined;\n }\n }\n }\n\n return data;\n}\n/**\r\n * deepmerge array merging algorithm\r\n * https://github.com/KyleAMathews/deepmerge#combine-array\r\n */\n\n\nfunction arrayMerge(target, source, options) {\n var destination = target.slice();\n source.forEach(function merge(e, i) {\n if (typeof destination[i] === 'undefined') {\n var cloneRequested = options.clone !== false;\n var shouldClone = cloneRequested && options.isMergeableObject(e);\n destination[i] = shouldClone ? deepmerge(Array.isArray(e) ? [] : {}, e, options) : e;\n } else if (options.isMergeableObject(e)) {\n destination[i] = deepmerge(target[i], e, options);\n } else if (target.indexOf(e) === -1) {\n destination.push(e);\n }\n });\n return destination;\n}\n/** Return multi select values based on an array of options */\n\n\nfunction getSelectedValues(options) {\n return Array.from(options).filter(function (el) {\n return el.selected;\n }).map(function (el) {\n return el.value;\n });\n}\n/** Return the next value for a checkbox */\n\n\nfunction getValueForCheckbox(currentValue, checked, valueProp) {\n // If the current value was a boolean, return a boolean\n if (typeof currentValue === 'boolean') {\n return Boolean(checked);\n } // If the currentValue was not a boolean we want to return an array\n\n\n var currentArrayOfValues = [];\n var isValueInArray = false;\n var index = -1;\n\n if (!Array.isArray(currentValue)) {\n // eslint-disable-next-line eqeqeq\n if (!valueProp || valueProp == 'true' || valueProp == 'false') {\n return Boolean(checked);\n }\n } else {\n // If the current value is already an array, use it\n currentArrayOfValues = currentValue;\n index = currentValue.indexOf(valueProp);\n isValueInArray = index >= 0;\n } // 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\n\n\n if (checked && valueProp && !isValueInArray) {\n return currentArrayOfValues.concat(valueProp);\n } // If the checkbox was unchecked and the value is not in the array, simply return the already existing array of values\n\n\n if (!isValueInArray) {\n return currentArrayOfValues;\n } // If the checkbox was unchecked and the value is in the array, remove the value and return the array\n\n\n return currentArrayOfValues.slice(0, index).concat(currentArrayOfValues.slice(index + 1));\n} // React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser.\n// @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n\n\nvar useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? useLayoutEffect : useEffect;\n\nfunction useEventCallback(fn) {\n var ref = useRef(fn); // we copy a ref to the callback scoped to the current state/props on each render\n\n useIsomorphicLayoutEffect(function () {\n ref.current = fn;\n });\n return useCallback(function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return ref.current.apply(void 0, args);\n }, []);\n}\n\nfunction useField(propsOrFieldName) {\n var formik = useFormikContext();\n var getFieldProps = formik.getFieldProps,\n getFieldMeta = formik.getFieldMeta,\n getFieldHelpers = formik.getFieldHelpers,\n registerField = formik.registerField,\n unregisterField = formik.unregisterField;\n var isAnObject = isObject(propsOrFieldName); // Normalize propsOrFieldName to FieldHookConfig<Val>\n\n var props = isAnObject ? propsOrFieldName : {\n name: propsOrFieldName\n };\n var fieldName = props.name,\n validateFn = props.validate;\n useEffect(function () {\n if (fieldName) {\n registerField(fieldName, {\n validate: validateFn\n });\n }\n\n return function () {\n if (fieldName) {\n unregisterField(fieldName);\n }\n };\n }, [registerField, unregisterField, fieldName, validateFn]);\n\n if (process.env.NODE_ENV !== \"production\") {\n !formik ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'useField() / <Field /> must be used underneath a <Formik> component or withFormik() higher order component') : invariant(false) : void 0;\n }\n\n !fieldName ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Invalid field name. Either pass `useField` a string or an object containing a `name` key.') : invariant(false) : void 0;\n return [getFieldProps(props), getFieldMeta(fieldName), getFieldHelpers(fieldName)];\n}\n\nfunction Field(_ref) {\n var validate = _ref.validate,\n name = _ref.name,\n render = _ref.render,\n children = _ref.children,\n is = _ref.as,\n component = _ref.component,\n props = _objectWithoutPropertiesLoose(_ref, [\"validate\", \"name\", \"render\", \"children\", \"as\", \"component\"]);\n\n var _useFormikContext = useFormikContext(),\n formik = _objectWithoutPropertiesLoose(_useFormikContext, [\"validate\", \"validationSchema\"]);\n\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(function () {\n !!render ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"<Field render> has been deprecated and will be removed in future versions of Formik. Please use a child callback function instead. To get rid of this warning, replace <Field name=\\\"\" + name + \"\\\" render={({field, form}) => ...} /> with <Field name=\\\"\" + name + \"\\\">{({field, form, meta}) => ...}</Field>\") : invariant(false) : void 0;\n !!(is && children && isFunction(children)) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'You should not use <Field as> and <Field children> as a function in the same <Field> component; <Field as> will be ignored.') : invariant(false) : void 0;\n !!(component && children && isFunction(children)) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'You should not use <Field component> and <Field children> as a function in the same <Field> component; <Field component> will be ignored.') : invariant(false) : void 0;\n !!(render && children && !isEmptyChildren(children)) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'You should not use <Field render> and <Field children> in the same <Field> component; <Field children> will be ignored') : invariant(false) : void 0; // eslint-disable-next-line\n }, []);\n } // Register field and field-level validation with parent <Formik>\n\n\n var registerField = formik.registerField,\n unregisterField = formik.unregisterField;\n useEffect(function () {\n registerField(name, {\n validate: validate\n });\n return function () {\n unregisterField(name);\n };\n }, [registerField, unregisterField, name, validate]);\n var field = formik.getFieldProps(_extends({\n name: name\n }, props));\n var meta = formik.getFieldMeta(name);\n var legacyBag = {\n field: field,\n form: formik\n };\n\n if (render) {\n return render(_extends({}, legacyBag, {\n meta: meta\n }));\n }\n\n if (isFunction(children)) {\n return children(_extends({}, legacyBag, {\n meta: meta\n }));\n }\n\n if (component) {\n // This behavior is backwards compat with earlier Formik 0.9 to 1.x\n if (typeof component === 'string') {\n var innerRef = props.innerRef,\n rest = _objectWithoutPropertiesLoose(props, [\"innerRef\"]);\n\n return createElement(component, _extends({\n ref: innerRef\n }, field, rest), children);\n } // We don't pass `meta` for backwards compat\n\n\n return createElement(component, _extends({\n field: field,\n form: formik\n }, props), children);\n } // default to input here so we can check for both `as` and `children` above\n\n\n var asElement = is || 'input';\n\n if (typeof asElement === 'string') {\n var _innerRef = props.innerRef,\n _rest = _objectWithoutPropertiesLoose(props, [\"innerRef\"]);\n\n return createElement(asElement, _extends({\n ref: _innerRef\n }, field, _rest), children);\n }\n\n return createElement(asElement, _extends({}, field, props), children);\n}\n\nvar Form = /*#__PURE__*/forwardRef(function (props, ref) {\n // iOS needs an \"action\" attribute for nice input: https://stackoverflow.com/a/39485162/406725\n // We default the action to \"#\" in case the preventDefault fails (just updates the URL hash)\n var action = props.action,\n rest = _objectWithoutPropertiesLoose(props, [\"action\"]);\n\n var _action = action != null ? action : '#';\n\n var _useFormikContext = useFormikContext(),\n handleReset = _useFormikContext.handleReset,\n handleSubmit = _useFormikContext.handleSubmit;\n\n return createElement(\"form\", Object.assign({\n onSubmit: handleSubmit,\n ref: ref,\n onReset: handleReset,\n action: _action\n }, rest));\n});\nForm.displayName = 'Form';\n/**\r\n * A public higher-order component to access the imperative API\r\n */\n\nfunction withFormik(_ref) {\n var _ref$mapPropsToValues = _ref.mapPropsToValues,\n mapPropsToValues = _ref$mapPropsToValues === void 0 ? function (vanillaProps) {\n var val = {};\n\n for (var k in vanillaProps) {\n if (vanillaProps.hasOwnProperty(k) && typeof vanillaProps[k] !== 'function') {\n // @todo TypeScript fix\n val[k] = vanillaProps[k];\n }\n }\n\n return val;\n } : _ref$mapPropsToValues,\n config = _objectWithoutPropertiesLoose(_ref, [\"mapPropsToValues\"]);\n\n return function createFormik(Component$1) {\n var componentDisplayName = Component$1.displayName || Component$1.name || Component$1.constructor && Component$1.constructor.name || 'Component';\n /**\r\n * We need to use closures here for to provide the wrapped component's props to\r\n * the respective withFormik config methods.\r\n */\n\n var C = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(C, _React$Component);\n\n function C() {\n var _this;\n\n _this = _React$Component.apply(this, arguments) || this;\n\n _this.validate = function (values) {\n return config.validate(values, _this.props);\n };\n\n _this.validationSchema = function () {\n return isFunction(config.validationSchema) ? config.validationSchema(_this.props) : config.validationSchema;\n };\n\n _this.handleSubmit = function (values, actions) {\n return config.handleSubmit(values, _extends({}, actions, {\n props: _this.props\n }));\n };\n /**\r\n * Just avoiding a render callback for perf here\r\n */\n\n\n _this.renderFormComponent = function (formikProps) {\n return createElement(Component$1, Object.assign({}, _this.props, formikProps));\n };\n\n return _this;\n }\n\n var _proto = C.prototype;\n\n _proto.render = function render() {\n var _this$props = this.props,\n props = _objectWithoutPropertiesLoose(_this$props, [\"children\"]);\n\n return createElement(Formik, Object.assign({}, props, config, {\n validate: config.validate && this.validate,\n validationSchema: config.validationSchema && this.validationSchema,\n initialValues: mapPropsToValues(this.props),\n initialStatus: config.mapPropsToStatus && config.mapPropsToStatus(this.props),\n initialErrors: config.mapPropsToErrors && config.mapPropsToErrors(this.props),\n initialTouched: config.mapPropsToTouched && config.mapPropsToTouched(this.props),\n onSubmit: this.handleSubmit,\n children: this.renderFormComponent\n }));\n };\n\n return C;\n }(Component);\n\n C.displayName = \"WithFormik(\" + componentDisplayName + \")\";\n return hoistNonReactStatics(C, Component$1 // cast type to ComponentClass (even if SFC)\n );\n };\n}\n/**\r\n * Connect any component to Formik context, and inject as a prop called `formik`;\r\n * @param Comp React Component\r\n */\n\n\nfunction connect(Comp) {\n var C = function C(props) {\n return createElement(FormikConsumer, null, function (formik) {\n !!!formik ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Formik context is undefined, please verify you are rendering <Form>, <Field>, <FastField>, <FieldArray>, or your custom context-using component as a child of a <Formik> component. Component name: \" + Comp.name) : invariant(false) : void 0;\n return createElement(Comp, Object.assign({}, props, {\n formik: formik\n }));\n });\n };\n\n 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\n // For example, <Field.WrappedComponent /> gets us <FieldInner/>\n\n C.WrappedComponent = Comp;\n C.displayName = \"FormikConnect(\" + componentDisplayName + \")\";\n return hoistNonReactStatics(C, Comp // cast type to ComponentClass (even if SFC)\n );\n}\n/**\r\n * Some array helpers!\r\n */\n\n\nvar move = function move(array, from, to) {\n var copy = copyArrayLike(array);\n var value = copy[from];\n copy.splice(from, 1);\n copy.splice(to, 0, value);\n return copy;\n};\n\nvar swap = function swap(arrayLike, indexA, indexB) {\n var copy = copyArrayLike(arrayLike);\n var a = copy[indexA];\n copy[indexA] = copy[indexB];\n copy[indexB] = a;\n return copy;\n};\n\nvar insert = function insert(arrayLike, index, value) {\n var copy = copyArrayLike(arrayLike);\n copy.splice(index, 0, value);\n return copy;\n};\n\nvar replace = function replace(arrayLike, index, value) {\n var copy = copyArrayLike(arrayLike);\n copy[index] = value;\n return copy;\n};\n\nvar copyArrayLike = function copyArrayLike(arrayLike) {\n if (!arrayLike) {\n return [];\n } else if (Array.isArray(arrayLike)) {\n return [].concat(arrayLike);\n } else {\n var maxIndex = Object.keys(arrayLike).map(function (key) {\n return parseInt(key);\n }).reduce(function (max, el) {\n return el > max ? el : max;\n }, 0);\n return Array.from(_extends({}, arrayLike, {\n length: maxIndex + 1\n }));\n }\n};\n\nvar FieldArrayInner = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(FieldArrayInner, _React$Component);\n\n function FieldArrayInner(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n\n _this.updateArrayField = function (fn, alterTouched, alterErrors) {\n var _this$props = _this.props,\n name = _this$props.name,\n setFormikState = _this$props.formik.setFormikState;\n setFormikState(function (prevState) {\n var updateErrors = typeof alterErrors === 'function' ? alterErrors : fn;\n var updateTouched = typeof alterTouched === 'function' ? alterTouched : fn; // values fn should be executed before updateErrors and updateTouched,\n // otherwise it causes an error with unshift.\n\n var values = setIn(prevState.values, name, fn(getIn(prevState.values, name)));\n var fieldError = alterErrors ? updateErrors(getIn(prevState.errors, name)) : undefined;\n var fieldTouched = alterTouched ? updateTouched(getIn(prevState.touched, name)) : undefined;\n\n if (isEmptyArray(fieldError)) {\n fieldError = undefined;\n }\n\n if (isEmptyArray(fieldTouched)) {\n fieldTouched = undefined;\n }\n\n return _extends({}, prevState, {\n values: values,\n errors: alterErrors ? setIn(prevState.errors, name, fieldError) : prevState.errors,\n touched: alterTouched ? setIn(prevState.touched, name, fieldTouched) : prevState.touched\n });\n });\n };\n\n _this.push = function (value) {\n return _this.updateArrayField(function (arrayLike) {\n return [].concat(copyArrayLike(arrayLike), [cloneDeep(value)]);\n }, false, false);\n };\n\n _this.handlePush = function (value) {\n return function () {\n return _this.push(value);\n };\n };\n\n _this.swap = function (indexA, indexB) {\n return _this.updateArrayField(function (array) {\n return swap(array, indexA, indexB);\n }, true, true);\n };\n\n _this.handleSwap = function (indexA, indexB) {\n return function () {\n return _this.swap(indexA, indexB);\n };\n };\n\n _this.move = function (from, to) {\n return _this.updateArrayField(function (array) {\n return move(array, from, to);\n }, true, true);\n };\n\n _this.handleMove = function (from, to) {\n return function () {\n return _this.move(from, to);\n };\n };\n\n _this.insert = function (index, value) {\n return _this.updateArrayField(function (array) {\n return insert(array, index, value);\n }, function (array) {\n return insert(array, index, null);\n }, function (array) {\n return insert(array, index, null);\n });\n };\n\n _this.handleInsert = function (index, value) {\n return function () {\n return _this.insert(index, value);\n };\n };\n\n _this.replace = function (index, value) {\n return _this.updateArrayField(function (array) {\n return replace(array, index, value);\n }, false, false);\n };\n\n _this.handleReplace = function (index, value) {\n return function () {\n return _this.replace(index, value);\n };\n };\n\n _this.unshift = function (value) {\n var length = -1;\n\n _this.updateArrayField(function (array) {\n var arr = array ? [value].concat(array) : [value];\n\n if (length < 0) {\n length = arr.length;\n }\n\n return arr;\n }, function (array) {\n var arr = array ? [null].concat(array) : [null];\n\n if (length < 0) {\n length = arr.length;\n }\n\n return arr;\n }, function (array) {\n var arr = array ? [null].concat(array) : [null];\n\n if (length < 0) {\n length = arr.length;\n }\n\n return arr;\n });\n\n return length;\n };\n\n _this.handleUnshift = function (value) {\n return function () {\n return _this.unshift(value);\n };\n };\n\n _this.handleRemove = function (index) {\n return function () {\n return _this.remove(index);\n };\n };\n\n _this.handlePop = function () {\n return function () {\n return _this.pop();\n };\n }; // We need TypeScript generics on these, so we'll bind them in the constructor\n // @todo Fix TS 3.2.1\n\n\n _this.remove = _this.remove.bind(_assertThisInitialized(_this));\n _this.pop = _this.pop.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = FieldArrayInner.prototype;\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps) {\n if (this.props.validateOnChange && this.props.formik.validateOnChange && !isEqual(getIn(prevProps.formik.values, prevProps.name), getIn(this.props.formik.values, this.props.name))) {\n this.props.formik.validateForm(this.props.formik.values);\n }\n };\n\n _proto.remove = function remove(index) {\n // We need to make sure we also remove relevant pieces of `touched` and `errors`\n var result;\n this.updateArrayField( // so this gets call 3 times\n function (array) {\n var copy = array ? copyArrayLike(array) : [];\n\n if (!result) {\n result = copy[index];\n }\n\n if (isFunction(copy.splice)) {\n copy.splice(index, 1);\n }\n\n return copy;\n }, true, true);\n return result;\n };\n\n _proto.pop = function pop() {\n // Remove relevant pieces of `touched` and `errors` too!\n var result;\n this.updateArrayField( // so this gets call 3 times\n function (array) {\n var tmp = array;\n\n if (!result) {\n result = tmp && tmp.pop && tmp.pop();\n }\n\n return tmp;\n }, true, true);\n return result;\n };\n\n _proto.render = function render() {\n var arrayHelpers = {\n push: this.push,\n pop: this.pop,\n swap: this.swap,\n move: this.move,\n insert: this.insert,\n replace: this.replace,\n unshift: this.unshift,\n remove: this.remove,\n handlePush: this.handlePush,\n handlePop: this.handlePop,\n handleSwap: this.handleSwap,\n handleMove: this.handleMove,\n handleInsert: this.handleInsert,\n handleReplace: this.handleReplace,\n handleUnshift: this.handleUnshift,\n handleRemove: this.handleRemove\n };\n\n var _this$props2 = this.props,\n component = _this$props2.component,\n render = _this$props2.render,\n children = _this$props2.children,\n name = _this$props2.name,\n _this$props2$formik = _this$props2.formik,\n restOfFormik = _objectWithoutPropertiesLoose(_this$props2$formik, [\"validate\", \"validationSchema\"]);\n\n var props = _extends({}, arrayHelpers, {\n form: restOfFormik,\n name: name\n });\n\n return component ? createElement(component, props) : render ? render(props) : children // children come last, always called\n ? typeof children === 'function' ? children(props) : !isEmptyChildren(children) ? Children.only(children) : null : null;\n };\n\n return FieldArrayInner;\n}(Component);\n\nFieldArrayInner.defaultProps = {\n validateOnChange: true\n};\nvar FieldArray = /*#__PURE__*/connect(FieldArrayInner);\n\nvar ErrorMessageImpl = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(ErrorMessageImpl, _React$Component);\n\n function ErrorMessageImpl() {\n return _React$Component.apply(this, arguments) || this;\n }\n\n var _proto = ErrorMessageImpl.prototype;\n\n _proto.shouldComponentUpdate = function shouldComponentUpdate(props) {\n 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) {\n return true;\n } else {\n return false;\n }\n };\n\n _proto.render = function render() {\n var _this$props = this.props,\n component = _this$props.component,\n formik = _this$props.formik,\n render = _this$props.render,\n children = _this$props.children,\n name = _this$props.name,\n rest = _objectWithoutPropertiesLoose(_this$props, [\"component\", \"formik\", \"render\", \"children\", \"name\"]);\n\n var touch = getIn(formik.touched, name);\n var error = getIn(formik.errors, name);\n return !!touch && !!error ? render ? isFunction(render) ? render(error) : null : children ? isFunction(children) ? children(error) : null : component ? createElement(component, rest, error) : error : null;\n };\n\n return ErrorMessageImpl;\n}(Component);\n\nvar ErrorMessage = /*#__PURE__*/connect(ErrorMessageImpl);\n/**\r\n * Custom Field component for quickly hooking into Formik\r\n * context and wiring up forms.\r\n */\n\nvar FastFieldInner = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(FastFieldInner, _React$Component);\n\n function FastFieldInner(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n var render = props.render,\n children = props.children,\n component = props.component,\n is = props.as,\n name = props.name;\n !!render ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"<FastField render> has been deprecated. Please use a child callback function instead: <FastField name={\" + name + \"}>{props => ...}</FastField> instead.\") : invariant(false) : void 0;\n !!(component && render) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'You should not use <FastField component> and <FastField render> in the same <FastField> component; <FastField component> will be ignored') : invariant(false) : void 0;\n !!(is && children && isFunction(children)) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'You should not use <FastField as> and <FastField children> as a function in the same <FastField> component; <FastField as> will be ignored.') : invariant(false) : void 0;\n !!(component && children && isFunction(children)) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'You should not use <FastField component> and <FastField children> as a function in the same <FastField> component; <FastField component> will be ignored.') : invariant(false) : void 0;\n !!(render && children && !isEmptyChildren(children)) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'You should not use <FastField render> and <FastField children> in the same <FastField> component; <FastField children> will be ignored') : invariant(false) : void 0;\n return _this;\n }\n\n var _proto = FastFieldInner.prototype;\n\n _proto.shouldComponentUpdate = function shouldComponentUpdate(props) {\n if (this.props.shouldUpdate) {\n return this.props.shouldUpdate(props, this.props);\n } 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) {\n return true;\n } else {\n return false;\n }\n };\n\n _proto.componentDidMount = function componentDidMount() {\n // Register the Field with the parent Formik. Parent will cycle through\n // registered Field's validate fns right prior to submit\n this.props.formik.registerField(this.props.name, {\n validate: this.props.validate\n });\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps) {\n if (this.props.name !== prevProps.name) {\n this.props.formik.unregisterField(prevProps.name);\n this.props.formik.registerField(this.props.name, {\n validate: this.props.validate\n });\n }\n\n if (this.props.validate !== prevProps.validate) {\n this.props.formik.registerField(this.props.name, {\n validate: this.props.validate\n });\n }\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.props.formik.unregisterField(this.props.name);\n };\n\n _proto.render = function render() {\n var _this$props = this.props,\n name = _this$props.name,\n render = _this$props.render,\n is = _this$props.as,\n children = _this$props.children,\n component = _this$props.component,\n formik = _this$props.formik,\n props = _objectWithoutPropertiesLoose(_this$props, [\"validate\", \"name\", \"render\", \"as\", \"children\", \"component\", \"shouldUpdate\", \"formik\"]);\n\n var restOfFormik = _objectWithoutPropertiesLoose(formik, [\"validate\", \"validationSchema\"]);\n\n var field = formik.getFieldProps(_extends({\n name: name\n }, props));\n var meta = {\n value: getIn(formik.values, name),\n error: getIn(formik.errors, name),\n touched: !!getIn(formik.touched, name),\n initialValue: getIn(formik.initialValues, name),\n initialTouched: !!getIn(formik.initialTouched, name),\n initialError: getIn(formik.initialErrors, name)\n };\n var bag = {\n field: field,\n meta: meta,\n form: restOfFormik\n };\n\n if (render) {\n return render(bag);\n }\n\n if (isFunction(children)) {\n return children(bag);\n }\n\n if (component) {\n // This behavior is backwards compat with earlier Formik 0.9 to 1.x\n if (typeof component === 'string') {\n var innerRef = props.innerRef,\n rest = _objectWithoutPropertiesLoose(props, [\"innerRef\"]);\n\n return createElement(component, _extends({\n ref: innerRef\n }, field, rest), children);\n } // We don't pass `meta` for backwards compat\n\n\n return createElement(component, _extends({\n field: field,\n form: formik\n }, props), children);\n } // default to input here so we can check for both `as` and `children` above\n\n\n var asElement = is || 'input';\n\n if (typeof asElement === 'string') {\n var _innerRef = props.innerRef,\n _rest = _objectWithoutPropertiesLoose(props, [\"innerRef\"]);\n\n return createElement(asElement, _extends({\n ref: _innerRef\n }, field, _rest), children);\n }\n\n return createElement(asElement, _extends({}, field, props), children);\n };\n\n return FastFieldInner;\n}(Component);\n\nvar FastField = /*#__PURE__*/connect(FastFieldInner);\nexport { ErrorMessage, FastField, Field, FieldArray, Form, Formik, FormikConsumer, FormikContext, FormikProvider, connect, getActiveElement, getIn, insert, isEmptyArray, isEmptyChildren, isFunction, isInputEvent, isInteger, isNaN$1 as isNaN, isObject, isPromise, isString, move, prepareDataForValidation, replace, setIn, setNestedObjectValues, swap, useField, useFormik, useFormikContext, validateYupSchema, withFormik, yupToFormErrors };","map":{"version":3,"sources":["../src/utils.ts","../src/FormikContext.tsx","../src/Formik.tsx","../src/Field.tsx","../src/Form.tsx","../src/withFormik.tsx","../src/connect.tsx","../src/FieldArray.tsx","../src/ErrorMessage.tsx","../src/FastField.tsx"],"names":["isEmptyArray","Array","value","isFunction","isObject","obj","isInteger","String","Math","Number","isString","Object","isNaN","isEmptyChildren","React","isPromise","isInputEvent","getActiveElement","doc","getIn","key","def","p","path","toPath","setIn","res","clone","resVal","i","pathArray","currentPath","currentObj","nextPath","setNestedObjectValues","object","visited","response","k","val","FormikContext","FormikProvider","FormikConsumer","useFormikContext","formik","msg","values","payload","touched","isEqual","state","errors","status","isSubmitting","isValidating","submitCount","emptyErrors","emptyTouched","useFormik","validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit","rest","props","initialValues","initialErrors","initialTouched","initialStatus","isMounted","fieldRegistry","dispatch","runValidateHandler","maybePromisedErrors","resolve","process","console","reject","runValidationSchema","validationSchema","schema","promise","field","validateYupSchema","err","yupToFormErrors","runSingleFieldLevelValidation","runFieldLevelValidations","fieldKeysWithValidation","fieldValidations","Promise","curr","prev","runAllValidations","fieldErrors","schemaErrors","validateErrors","combinedErrors","arrayMerge","validateFormWithHighPriority","useEventCallback","type","resetForm","nextState","dispatchFn","maybePromisedOnReset","validateField","maybePromise","error","registerField","validate","unregisterField","setTouched","willValidate","shouldValidate","setErrors","setValues","resolvedValues","setFieldError","setFieldValue","executeChange","eventOrTextValue","target","name","id","checked","outerHTML","options","multiple","maybePath","warnAboutMissingIdentifier","htmlContent","documentationAnchorLink","handlerName","parsed","parseFloat","getValueForCheckbox","getSelectedValues","handleChange","setFieldTouched","executeBlur","e","handleBlur","setFormikState","stateOrCb","setStatus","setSubmitting","submitForm","isInstanceOfError","isActuallyValid","promiseOrUndefined","executeSubmit","handleSubmit","activeElement","imperativeMethods","validateForm","handleReset","getFieldMeta","initialValue","initialError","getFieldHelpers","setValue","setError","getFieldProps","isAnObject","nameOrOptions","valueState","onChange","onBlur","valueProp","is","dirty","isValid","ctx","Formik","formikbag","component","children","render","innerRef","yupError","sync","context","validateData","prepareDataForValidation","abortEarly","data","isPlainObject","destination","source","cloneRequested","shouldClone","deepmerge","el","Boolean","currentArrayOfValues","isValueInArray","index","currentValue","useIsomorphicLayoutEffect","window","ref","args","useField","propsOrFieldName","fieldName","validateFn","Field","as","meta","legacyBag","form","asElement","Form","action","_action","onReset","withFormik","mapPropsToValues","vanillaProps","config","componentDisplayName","Component","C","renderFormComponent","hoistNonReactStatics","connect","Comp","move","copy","copyArrayLike","swap","a","insert","replace","maxIndex","parseInt","length","FieldArrayInner","componentDidUpdate","prevProps","updateErrors","updateTouched","prevState","fn","fieldError","alterErrors","fieldTouched","alterTouched","cloneDeep","arr","array","remove","result","pop","tmp","arrayHelpers","push","unshift","handlePush","handlePop","handleSwap","handleMove","handleInsert","handleReplace","handleUnshift","handleRemove","restOfFormik","FieldArray","ErrorMessageImpl","shouldComponentUpdate","touch","ErrorMessage","FastFieldInner","componentDidMount","componentWillUnmount","bag","FastField"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;;IACaA,YAAY,GAAG,SAAfA,YAAe,CAAA,KAAA,EAAA;AAAA,SAC1BC,KAAK,CAALA,OAAAA,CAAAA,KAAAA,KAAwBC,KAAK,CAALA,MAAAA,KADE,CAAA;AAAA,C;AAG5B;;;IACaC,UAAU,GAAG,SAAbA,UAAa,CAAA,GAAA,EAAA;AAAA,SACxB,OAAA,GAAA,KADwB,UAAA;AAAA,C;AAG1B;;;IACaC,QAAQ,GAAG,SAAXA,QAAW,CAAA,GAAA,EAAA;AAAA,SACtBC,GAAG,KAAHA,IAAAA,IAAgB,OAAA,GAAA,KADM,QAAA;AAAA,C;AAGxB;;;IACaC,SAAS,GAAG,SAAZA,SAAY,CAAA,GAAA,EAAA;AAAA,SACvBC,MAAM,CAACC,IAAI,CAAJA,KAAAA,CAAWC,MAAM,CAAxBF,GAAwB,CAAjBC,CAAD,CAAND,KADuB,GAAA;AAAA,C;AAGzB;;;IACaG,QAAQ,GAAG,SAAXA,QAAW,CAAA,GAAA,EAAA;AAAA,SACtBC,MAAM,CAANA,SAAAA,CAAAA,QAAAA,CAAAA,IAAAA,CAAAA,GAAAA,MADsB,iBAAA;AAAA,C;AAGxB;AACA;;;IACaC,OAAK,GAAG,SAARA,KAAQ,CAAA,GAAA,EAAA;AAAA,SAAuBP,GAAG,KAA1B,GAA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I,OAAA,SAAA,KAAJ,QAAA,EAAmC;AAAA,YACzBE,QADyB,GACHnH,KADG,CAAA,QAAA;AAAA,YACZD,IADY,GAAA,6BAAA,CAAA,KAAA,EAAA,CAAA,UAAA,CAAA,CAAA;;AAEjC,eAAO,aAAA,CAAA,SAAA,EAAA,QAAA,CAAA;AAEH0I,UAAAA,GAAG,EAAEtB;AAFF,SAAA,EAAA,KAAA,EAAA,IAAA,CAAA,EAAP,QAAO,CAAP;AAJW,OAAA,CAAA;;;AAWb,aAAO,aAAA,CAAA,SAAA,EAAA,QAAA,CAAA;AAEHjG,QAAAA,KAAK,EAFF,KAAA;AAEIiI,QAAAA,IAAI,EAAEzK;AAFV,OAAA,EAAA,KAAA,CAAA,EAAP,QAAO,CAAP;AAKD,KAtDHwI,CAsDG;;;AAGD,QAAMkC,SAAS,GAAG1C,EAAE,IAApB,OAAA;;AAEA,QAAI,OAAA,SAAA,KAAJ,QAAA,EAAmC;AAAA,UACzBS,SADyB,GACHnH,KADG,CAAA,QAAA;AAAA,UACZD,KADY,GAAA,6BAAA,CAAA,KAAA,EAAA,CAAA,UAAA,CAAA,CAAA;;AAEjC,aAAO,aAAA,CAAA,SAAA,EAAA,QAAA,CAAA;AAEH0I,QAAAA,GAAG,EAAEtB;AAFF,OAAA,EAAA,KAAA,EAAA,KAAA,CAAA,EAAP,QAAO,CAAP;AAKD;;AAED,WAAOvK,aAAAA,CAAAA,SAAAA,EAAAA,QAAAA,CAAAA,EAAAA,EAAAA,KAAAA,EAAAA,KAAAA,CAAAA,EAAP,QAAOA,CAAP;AAKD,G;;;CAxJGqQ,CAAgDrQ,SAAhDqQ,C;;AA2JN,IAAaI,SAAS,GAAA,aAAGnD,OAAO,CAAzB,cAAyB,CAAhC","sourcesContent":["import clone from 'lodash/clone';\nimport toPath from 'lodash/toPath';\nimport * as React from 'react';\n\n// Assertions\n\n/** @private is the value an empty array? */\nexport const isEmptyArray = (value?: any) =>\n Array.isArray(value) && value.length === 0;\n\n/** @private is the given object a Function? */\nexport const isFunction = (obj: any): obj is Function =>\n typeof obj === 'function';\n\n/** @private is the given object an Object? */\nexport const isObject = (obj: any): obj is Object =>\n obj !== null && typeof obj === 'object';\n\n/** @private is the given object an integer? */\nexport const isInteger = (obj: any): boolean =>\n String(Math.floor(Number(obj))) === obj;\n\n/** @private is the given object a string? */\nexport const isString = (obj: any): obj is string =>\n Object.prototype.toString.call(obj) === '[object String]';\n\n/** @private is the given object a NaN? */\n// eslint-disable-next-line no-self-compare\nexport const isNaN = (obj: any): boolean => obj !== obj;\n\n/** @private Does a React component have exactly 0 children? */\nexport const isEmptyChildren = (children: any): boolean =>\n React.Children.count(children) === 0;\n\n/** @private is the given object/value a promise? */\nexport const isPromise = (value: any): value is PromiseLike<any> =>\n isObject(value) && isFunction(value.then);\n\n/** @private is the given object/value a type of synthetic event? */\nexport const isInputEvent = (value: any): value is React.SyntheticEvent<any> =>\n value && isObject(value) && isObject(value.target);\n\n/**\n * Same as document.activeElement but wraps in a try-catch block. In IE it is\n * not safe to call document.activeElement if there is nothing focused.\n *\n * The activeElement will be null only if the document or document body is not\n * yet defined.\n *\n * @param {?Document} doc Defaults to current document.\n * @return {Element | null}\n * @see https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/dom/getActiveElement.js\n */\nexport function getActiveElement(doc?: Document): Element | null {\n doc = doc || (typeof document !== 'undefined' ? document : undefined);\n if (typeof doc === 'undefined') {\n return null;\n }\n try {\n return doc.activeElement || doc.body;\n } catch (e) {\n return doc.body;\n }\n}\n\n/**\n * Deeply get a value from an object via its path.\n */\nexport function getIn(\n obj: any,\n key: string | string[],\n def?: any,\n p: number = 0\n) {\n const path = toPath(key);\n while (obj && p < path.length) {\n obj = obj[path[p++]];\n }\n return obj === undefined ? def : obj;\n}\n\n/**\n * Deeply set a value from in object via it's path. If the value at `path`\n * has changed, return a shallow copy of obj with `value` set at `path`.\n * If `value` has not changed, return the original `obj`.\n *\n * Existing objects / arrays along `path` are also shallow copied. Sibling\n * objects along path retain the same internal js reference. Since new\n * objects / arrays are only created along `path`, we can test if anything\n * changed in a nested structure by comparing the object's reference in\n * the old and new object, similar to how russian doll cache invalidation\n * works.\n *\n * In earlier versions of this function, which used cloneDeep, there were\n * issues whereby settings a nested value would mutate the parent\n * instead of creating a new object. `clone` avoids that bug making a\n * shallow copy of the objects along the update path\n * so no object is mutated in place.\n *\n * Before changing this function, please read through the following\n * discussions.\n *\n * @see https://github.com/developit/linkstate\n * @see https://github.com/jaredpalmer/formik/pull/123\n */\nexport function setIn(obj: any, path: string, value: any): any {\n let res: any = clone(obj); // this keeps inheritance when obj is a class\n let resVal: any = res;\n let i = 0;\n let pathArray = toPath(path);\n\n for (; i < pathArray.length - 1; i++) {\n const currentPath: string = pathArray[i];\n let currentObj: any = getIn(obj, pathArray.slice(0, i + 1));\n\n if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {\n resVal = resVal[currentPath] = clone(currentObj);\n } else {\n const nextPath: string = pathArray[i + 1];\n resVal = resVal[currentPath] =\n isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};\n }\n }\n\n // Return original object if new value is the same as current\n if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {\n return obj;\n }\n\n if (value === undefined) {\n delete resVal[pathArray[i]];\n } else {\n resVal[pathArray[i]] = value;\n }\n\n // If the path array has a single element, the loop did not run.\n // Deleting on `resVal` had no effect in this scenario, so we delete on the result instead.\n if (i === 0 && value === undefined) {\n delete res[pathArray[i]];\n }\n\n return res;\n}\n\n/**\n * Recursively a set the same value for all keys and arrays nested object, cloning\n * @param object\n * @param value\n * @param visited\n * @param response\n */\nexport function setNestedObjectValues<T>(\n object: any,\n value: any,\n visited: any = new WeakMap(),\n response: any = {}\n): T {\n for (let k of Object.keys(object)) {\n const val = object[k];\n if (isObject(val)) {\n if (!visited.get(val)) {\n visited.set(val, true);\n // In order to keep array values consistent for both dot path and\n // bracket syntax, we need to check if this is an array so that\n // this will output { friends: [true] } and not { friends: { \"0\": true } }\n response[k] = Array.isArray(val) ? [] : {};\n setNestedObjectValues(val, value, visited, response[k]);\n }\n } else {\n response[k] = value;\n }\n }\n\n return response;\n}\n","import * as React from 'react';\nimport { FormikContextType } from './types';\nimport invariant from 'tiny-warning';\n\nexport const FormikContext = React.createContext<FormikContextType<any>>(\n undefined as any\n);\nFormikContext.displayName = 'FormikContext';\n\nexport const FormikProvider = FormikContext.Provider;\nexport const FormikConsumer = FormikContext.Consumer;\n\nexport function useFormikContext<Values>() {\n const formik = React.useContext<FormikContextType<Values>>(FormikContext);\n\n invariant(\n !!formik,\n `Formik context is undefined, please verify you are calling useFormikContext() as child of a <Formik> component.`\n );\n\n return formik;\n}\n","import * as React from 'react';\nimport isEqual from 'react-fast-compare';\nimport deepmerge from 'deepmerge';\nimport isPlainObject from 'lodash/isPlainObject';\nimport {\n FormikConfig,\n FormikErrors,\n FormikState,\n FormikTouched,\n FormikValues,\n FormikProps,\n FieldMetaProps,\n FieldHelperProps,\n FieldInputProps,\n FormikHelpers,\n FormikHandlers,\n} from './types';\nimport {\n isFunction,\n isString,\n setIn,\n isEmptyChildren,\n isPromise,\n setNestedObjectValues,\n getActiveElement,\n getIn,\n isObject,\n} from './utils';\nimport { FormikProvider } from './FormikContext';\nimport invariant from 'tiny-warning';\n\ntype FormikMessage<Values> =\n | { type: 'SUBMIT_ATTEMPT' }\n | { type: 'SUBMIT_FAILURE' }\n | { type: 'SUBMIT_SUCCESS' }\n | { type: 'SET_ISVALIDATING'; payload: boolean }\n | { type: 'SET_ISSUBMITTING'; payload: boolean }\n | { type: 'SET_VALUES'; payload: Values }\n | { type: 'SET_FIELD_VALUE'; payload: { field: string; value?: any } }\n | { type: 'SET_FIELD_TOUCHED'; payload: { field: string; value?: boolean } }\n | { type: 'SET_FIELD_ERROR'; payload: { field: string; value?: string } }\n | { type: 'SET_TOUCHED'; payload: FormikTouched<Values> }\n | { type: 'SET_ERRORS'; payload: FormikErrors<Values> }\n | { type: 'SET_STATUS'; payload: any }\n | {\n type: 'SET_FORMIK_STATE';\n payload: (s: FormikState<Values>) => FormikState<Values>;\n }\n | {\n type: 'RESET_FORM';\n payload: FormikState<Values>;\n };\n\n// State reducer\nfunction formikReducer<Values>(\n state: FormikState<Values>,\n msg: FormikMessage<Values>\n) {\n switch (msg.type) {\n case 'SET_VALUES':\n return { ...state, values: msg.payload };\n case 'SET_TOUCHED':\n return { ...state, touched: msg.payload };\n case 'SET_ERRORS':\n if (isEqual(state.errors, msg.payload)) {\n return state;\n }\n\n return { ...state, errors: msg.payload };\n case 'SET_STATUS':\n return { ...state, status: msg.payload };\n case 'SET_ISSUBMITTING':\n return { ...state, isSubmitting: msg.payload };\n case 'SET_ISVALIDATING':\n return { ...state, isValidating: msg.payload };\n case 'SET_FIELD_VALUE':\n return {\n ...state,\n values: setIn(state.values, msg.payload.field, msg.payload.value),\n };\n case 'SET_FIELD_TOUCHED':\n return {\n ...state,\n touched: setIn(state.touched, msg.payload.field, msg.payload.value),\n };\n case 'SET_FIELD_ERROR':\n return {\n ...state,\n errors: setIn(state.errors, msg.payload.field, msg.payload.value),\n };\n case 'RESET_FORM':\n return { ...state, ...msg.payload };\n case 'SET_FORMIK_STATE':\n return msg.payload(state);\n case 'SUBMIT_ATTEMPT':\n return {\n ...state,\n touched: setNestedObjectValues<FormikTouched<Values>>(\n state.values,\n true\n ),\n isSubmitting: true,\n submitCount: state.submitCount + 1,\n };\n case 'SUBMIT_FAILURE':\n return {\n ...state,\n isSubmitting: false,\n };\n case 'SUBMIT_SUCCESS':\n return {\n ...state,\n isSubmitting: false,\n };\n default:\n return state;\n }\n}\n\n// Initial empty states // objects\nconst emptyErrors: FormikErrors<unknown> = {};\nconst emptyTouched: FormikTouched<unknown> = {};\n\n// This is an object that contains a map of all registered fields\n// and their validate functions\ninterface FieldRegistry {\n [field: string]: {\n validate: (value: any) => string | Promise<string> | undefined;\n };\n}\n\nexport function useFormik<Values extends FormikValues = FormikValues>({\n validateOnChange = true,\n validateOnBlur = true,\n validateOnMount = false,\n isInitialValid,\n enableReinitialize = false,\n onSubmit,\n ...rest\n}: FormikConfig<Values>) {\n const props = {\n validateOnChange,\n validateOnBlur,\n validateOnMount,\n onSubmit,\n ...rest,\n };\n const initialValues = React.useRef(props.initialValues);\n const initialErrors = React.useRef(props.initialErrors || emptyErrors);\n const initialTouched = React.useRef(props.initialTouched || emptyTouched);\n const initialStatus = React.useRef(props.initialStatus);\n const isMounted = React.useRef<boolean>(false);\n const fieldRegistry = React.useRef<FieldRegistry>({});\n if (__DEV__) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n invariant(\n typeof isInitialValid === 'undefined',\n 'isInitialValid has been deprecated and will be removed in future versions of Formik. Please use initialErrors or validateOnMount instead.'\n );\n // eslint-disable-next-line\n }, []);\n }\n\n React.useEffect(() => {\n isMounted.current = true;\n\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const [state, dispatch] = React.useReducer<\n React.Reducer<FormikState<Values>, FormikMessage<Values>>\n >(formikReducer, {\n values: props.initialValues,\n errors: props.initialErrors || emptyErrors,\n touched: props.initialTouched || emptyTouched,\n status: props.initialStatus,\n isSubmitting: false,\n isValidating: false,\n submitCount: 0,\n });\n\n const runValidateHandler = React.useCallback(\n (values: Values, field?: string): Promise<FormikErrors<Values>> => {\n return new Promise((resolve, reject) => {\n const maybePromisedErrors = (props.validate as any)(values, field);\n if (maybePromisedErrors == null) {\n // use loose null check here on purpose\n resolve(emptyErrors);\n } else if (isPromise(maybePromisedErrors)) {\n (maybePromisedErrors as Promise<any>).then(\n errors => {\n resolve(errors || emptyErrors);\n },\n actualException => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Warning: An unhandled error was caught during validation in <Formik validate />`,\n actualException\n );\n }\n\n reject(actualException);\n }\n );\n } else {\n resolve(maybePromisedErrors);\n }\n });\n },\n [props.validate]\n );\n\n /**\n * Run validation against a Yup schema and optionally run a function if successful\n */\n const runValidationSchema = React.useCallback(\n (values: Values, field?: string): Promise<FormikErrors<Values>> => {\n const validationSchema = props.validationSchema;\n const schema = isFunction(validationSchema)\n ? validationSchema(field)\n : validationSchema;\n const promise =\n field && schema.validateAt\n ? schema.validateAt(field, values)\n : validateYupSchema(values, schema);\n return new Promise((resolve, reject) => {\n promise.then(\n () => {\n resolve(emptyErrors);\n },\n (err: any) => {\n // Yup will throw a validation error if validation fails. We catch those and\n // resolve them into Formik errors. We can sniff if something is a Yup error\n // by checking error.name.\n // @see https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string\n if (err.name === 'ValidationError') {\n resolve(yupToFormErrors(err));\n } else {\n // We throw any other errors\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Warning: An unhandled error was caught during validation in <Formik validationSchema />`,\n err\n );\n }\n\n reject(err);\n }\n }\n );\n });\n },\n [props.validationSchema]\n );\n\n const runSingleFieldLevelValidation = React.useCallback(\n (field: string, value: void | string): Promise<string> => {\n return new Promise(resolve =>\n resolve(fieldRegistry.current[field].validate(value) as string)\n );\n },\n []\n );\n\n const runFieldLevelValidations = React.useCallback(\n (values: Values): Promise<FormikErrors<Values>> => {\n const fieldKeysWithValidation: string[] = Object.keys(\n fieldRegistry.current\n ).filter(f => isFunction(fieldRegistry.current[f].validate));\n\n // Construct an array with all of the field validation functions\n const fieldValidations: Promise<string>[] =\n fieldKeysWithValidation.length > 0\n ? fieldKeysWithValidation.map(f =>\n runSingleFieldLevelValidation(f, getIn(values, f))\n )\n : [Promise.resolve('DO_NOT_DELETE_YOU_WILL_BE_FIRED')]; // use special case ;)\n\n return Promise.all(fieldValidations).then((fieldErrorsList: string[]) =>\n fieldErrorsList.reduce((prev, curr, index) => {\n if (curr === 'DO_NOT_DELETE_YOU_WILL_BE_FIRED') {\n return prev;\n }\n if (curr) {\n prev = setIn(prev, fieldKeysWithValidation[index], curr);\n }\n return prev;\n }, {})\n );\n },\n [runSingleFieldLevelValidation]\n );\n\n // Run all validations and return the result\n const runAllValidations = React.useCallback(\n (values: Values) => {\n return Promise.all([\n runFieldLevelValidations(values),\n props.validationSchema ? runValidationSchema(values) : {},\n props.validate ? runValidateHandler(values) : {},\n ]).then(([fieldErrors, schemaErrors, validateErrors]) => {\n const combinedErrors = deepmerge.all<FormikErrors<Values>>(\n [fieldErrors, schemaErrors, validateErrors],\n { arrayMerge }\n );\n return combinedErrors;\n });\n },\n [\n props.validate,\n props.validationSchema,\n runFieldLevelValidations,\n runValidateHandler,\n runValidationSchema,\n ]\n );\n\n // Run all validations methods and update state accordingly\n const validateFormWithHighPriority = useEventCallback(\n (values: Values = state.values) => {\n dispatch({ type: 'SET_ISVALIDATING', payload: true });\n return runAllValidations(values).then(combinedErrors => {\n if (!!isMounted.current) {\n dispatch({ type: 'SET_ISVALIDATING', payload: false });\n dispatch({ type: 'SET_ERRORS', payload: combinedErrors });\n }\n return combinedErrors;\n });\n }\n );\n\n React.useEffect(() => {\n if (\n validateOnMount &&\n isMounted.current === true &&\n isEqual(initialValues.current, props.initialValues)\n ) {\n validateFormWithHighPriority(initialValues.current);\n }\n }, [validateOnMount, validateFormWithHighPriority]);\n\n const resetForm = React.useCallback(\n (nextState?: Partial<FormikState<Values>>) => {\n const values =\n nextState && nextState.values\n ? nextState.values\n : initialValues.current;\n const errors =\n nextState && nextState.errors\n ? nextState.errors\n : initialErrors.current\n ? initialErrors.current\n : props.initialErrors || {};\n const touched =\n nextState && nextState.touched\n ? nextState.touched\n : initialTouched.current\n ? initialTouched.current\n : props.initialTouched || {};\n const status =\n nextState && nextState.status\n ? nextState.status\n : initialStatus.current\n ? initialStatus.current\n : props.initialStatus;\n initialValues.current = values;\n initialErrors.current = errors;\n initialTouched.current = touched;\n initialStatus.current = status;\n\n const dispatchFn = () => {\n dispatch({\n type: 'RESET_FORM',\n payload: {\n isSubmitting: !!nextState && !!nextState.isSubmitting,\n errors,\n touched,\n status,\n values,\n isValidating: !!nextState && !!nextState.isValidating,\n submitCount:\n !!nextState &&\n !!nextState.submitCount &&\n typeof nextState.submitCount === 'number'\n ? nextState.submitCount\n : 0,\n },\n });\n };\n\n if (props.onReset) {\n const maybePromisedOnReset = (props.onReset as any)(\n state.values,\n imperativeMethods\n );\n\n if (isPromise(maybePromisedOnReset)) {\n (maybePromisedOnReset as Promise<any>).then(dispatchFn);\n } else {\n dispatchFn();\n }\n } else {\n dispatchFn();\n }\n },\n [props.initialErrors, props.initialStatus, props.initialTouched]\n );\n\n React.useEffect(() => {\n if (\n isMounted.current === true &&\n !isEqual(initialValues.current, props.initialValues)\n ) {\n if (enableReinitialize) {\n initialValues.current = props.initialValues;\n resetForm();\n }\n\n if (validateOnMount) {\n validateFormWithHighPriority(initialValues.current);\n }\n }\n }, [\n enableReinitialize,\n props.initialValues,\n resetForm,\n validateOnMount,\n validateFormWithHighPriority,\n ]);\n\n React.useEffect(() => {\n if (\n enableReinitialize &&\n isMounted.current === true &&\n !isEqual(initialErrors.current, props.initialErrors)\n ) {\n initialErrors.current = props.initialErrors || emptyErrors;\n dispatch({\n type: 'SET_ERRORS',\n payload: props.initialErrors || emptyErrors,\n });\n }\n }, [enableReinitialize, props.initialErrors]);\n\n React.useEffect(() => {\n if (\n enableReinitialize &&\n isMounted.current === true &&\n !isEqual(initialTouched.current, props.initialTouched)\n ) {\n initialTouched.current = props.initialTouched || emptyTouched;\n dispatch({\n type: 'SET_TOUCHED',\n payload: props.initialTouched || emptyTouched,\n });\n }\n }, [enableReinitialize, props.initialTouched]);\n\n React.useEffect(() => {\n if (\n enableReinitialize &&\n isMounted.current === true &&\n !isEqual(initialStatus.current, props.initialStatus)\n ) {\n initialStatus.current = props.initialStatus;\n dispatch({\n type: 'SET_STATUS',\n payload: props.initialStatus,\n });\n }\n }, [enableReinitialize, props.initialStatus, props.initialTouched]);\n\n const validateField = useEventCallback((name: string) => {\n // This will efficiently validate a single field by avoiding state\n // changes if the validation function is synchronous. It's different from\n // what is called when using validateForm.\n\n if (\n fieldRegistry.current[name] &&\n isFunction(fieldRegistry.current[name].validate)\n ) {\n const value = getIn(state.values, name);\n const maybePromise = fieldRegistry.current[name].validate(value);\n if (isPromise(maybePromise)) {\n // Only flip isValidating if the function is async.\n dispatch({ type: 'SET_ISVALIDATING', payload: true });\n return maybePromise\n .then((x: any) => x)\n .then((error: string) => {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: { field: name, value: error },\n });\n dispatch({ type: 'SET_ISVALIDATING', payload: false });\n });\n } else {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: {\n field: name,\n value: maybePromise as string | undefined,\n },\n });\n return Promise.resolve(maybePromise as string | undefined);\n }\n } else if (props.validationSchema) {\n dispatch({ type: 'SET_ISVALIDATING', payload: true });\n return runValidationSchema(state.values, name)\n .then((x: any) => x)\n .then((error: any) => {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: { field: name, value: error[name] },\n });\n dispatch({ type: 'SET_ISVALIDATING', payload: false });\n });\n }\n\n return Promise.resolve();\n });\n\n const registerField = React.useCallback((name: string, { validate }: any) => {\n fieldRegistry.current[name] = {\n validate,\n };\n }, []);\n\n const unregisterField = React.useCallback((name: string) => {\n delete fieldRegistry.current[name];\n }, []);\n\n const setTouched = useEventCallback(\n (touched: FormikTouched<Values>, shouldValidate?: boolean) => {\n dispatch({ type: 'SET_TOUCHED', payload: touched });\n const willValidate =\n shouldValidate === undefined ? validateOnBlur : shouldValidate;\n return willValidate\n ? validateFormWithHighPriority(state.values)\n : Promise.resolve();\n }\n );\n\n const setErrors = React.useCallback((errors: FormikErrors<Values>) => {\n dispatch({ type: 'SET_ERRORS', payload: errors });\n }, []);\n\n const setValues = useEventCallback(\n (values: React.SetStateAction<Values>, shouldValidate?: boolean) => {\n const resolvedValues = isFunction(values) ? values(state.values) : values;\n\n dispatch({ type: 'SET_VALUES', payload: resolvedValues });\n const willValidate =\n shouldValidate === undefined ? validateOnChange : shouldValidate;\n return willValidate\n ? validateFormWithHighPriority(resolvedValues)\n : Promise.resolve();\n }\n );\n\n const setFieldError = React.useCallback(\n (field: string, value: string | undefined) => {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: { field, value },\n });\n },\n []\n );\n\n const setFieldValue = useEventCallback(\n (field: string, value: any, shouldValidate?: boolean) => {\n dispatch({\n type: 'SET_FIELD_VALUE',\n payload: {\n field,\n value,\n },\n });\n const willValidate =\n shouldValidate === undefined ? validateOnChange : shouldValidate;\n return willValidate\n ? validateFormWithHighPriority(setIn(state.values, field, value))\n : Promise.resolve();\n }\n );\n\n const executeChange = React.useCallback(\n (eventOrTextValue: string | React.ChangeEvent<any>, maybePath?: string) => {\n // By default, assume that the first argument is a string. This allows us to use\n // handleChange with React Native and React Native Web's onChangeText prop which\n // provides just the value of the input.\n let field = maybePath;\n let val = eventOrTextValue;\n let parsed;\n // If the first argument is not a string though, it has to be a synthetic React Event (or a fake one),\n // so we handle like we would a normal HTML change event.\n if (!isString(eventOrTextValue)) {\n // If we can, persist the event\n // @see https://reactjs.org/docs/events.html#event-pooling\n if ((eventOrTextValue as any).persist) {\n (eventOrTextValue as React.ChangeEvent<any>).persist();\n }\n const target = eventOrTextValue.target\n ? (eventOrTextValue as React.ChangeEvent<any>).target\n : (eventOrTextValue as React.ChangeEvent<any>).currentTarget;\n\n const {\n type,\n name,\n id,\n value,\n checked,\n outerHTML,\n options,\n multiple,\n } = target;\n\n field = maybePath ? maybePath : name ? name : id;\n if (!field && __DEV__) {\n warnAboutMissingIdentifier({\n htmlContent: outerHTML,\n documentationAnchorLink: 'handlechange-e-reactchangeeventany--void',\n handlerName: 'handleChange',\n });\n }\n val = /number|range/.test(type)\n ? ((parsed = parseFloat(value)), isNaN(parsed) ? '' : parsed)\n : /checkbox/.test(type) // checkboxes\n ? getValueForCheckbox(getIn(state.values, field!), checked, value)\n : options && multiple // <select multiple>\n ? getSelectedValues(options)\n : value;\n }\n\n if (field) {\n // Set form fields by name\n setFieldValue(field, val);\n }\n },\n [setFieldValue, state.values]\n );\n\n const handleChange = useEventCallback<FormikHandlers['handleChange']>(\n (\n eventOrPath: string | React.ChangeEvent<any>\n ): void | ((eventOrTextValue: string | React.ChangeEvent<any>) => void) => {\n if (isString(eventOrPath)) {\n return event => executeChange(event, eventOrPath);\n } else {\n executeChange(eventOrPath);\n }\n }\n );\n\n const setFieldTouched = useEventCallback(\n (field: string, touched: boolean = true, shouldValidate?: boolean) => {\n dispatch({\n type: 'SET_FIELD_TOUCHED',\n payload: {\n field,\n value: touched,\n },\n });\n const willValidate =\n shouldValidate === undefined ? validateOnBlur : shouldValidate;\n return willValidate\n ? validateFormWithHighPriority(state.values)\n : Promise.resolve();\n }\n );\n\n const executeBlur = React.useCallback(\n (e: any, path?: string) => {\n if (e.persist) {\n e.persist();\n }\n const { name, id, outerHTML } = e.target;\n const field = path ? path : name ? name : id;\n\n if (!field && __DEV__) {\n warnAboutMissingIdentifier({\n htmlContent: outerHTML,\n documentationAnchorLink: 'handleblur-e-any--void',\n handlerName: 'handleBlur',\n });\n }\n\n setFieldTouched(field, true);\n },\n [setFieldTouched]\n );\n\n const handleBlur = useEventCallback<FormikHandlers['handleBlur']>(\n (eventOrString: any): void | ((e: any) => void) => {\n if (isString(eventOrString)) {\n return event => executeBlur(event, eventOrString);\n } else {\n executeBlur(eventOrString);\n }\n }\n );\n\n const setFormikState = React.useCallback(\n (\n stateOrCb:\n | FormikState<Values>\n | ((state: FormikState<Values>) => FormikState<Values>)\n ): void => {\n if (isFunction(stateOrCb)) {\n dispatch({ type: 'SET_FORMIK_STATE', payload: stateOrCb });\n } else {\n dispatch({ type: 'SET_FORMIK_STATE', payload: () => stateOrCb });\n }\n },\n []\n );\n\n const setStatus = React.useCallback((status: any) => {\n dispatch({ type: 'SET_STATUS', payload: status });\n }, []);\n\n const setSubmitting = React.useCallback((isSubmitting: boolean) => {\n dispatch({ type: 'SET_ISSUBMITTING', payload: isSubmitting });\n }, []);\n\n const submitForm = useEventCallback(() => {\n dispatch({ type: 'SUBMIT_ATTEMPT' });\n return validateFormWithHighPriority().then(\n (combinedErrors: FormikErrors<Values>) => {\n // In case an error was thrown and passed to the resolved Promise,\n // `combinedErrors` can be an instance of an Error. We need to check\n // that and abort the submit.\n // If we don't do that, calling `Object.keys(new Error())` yields an\n // empty array, which causes the validation to pass and the form\n // to be submitted.\n\n const isInstanceOfError = combinedErrors instanceof Error;\n const isActuallyValid =\n !isInstanceOfError && Object.keys(combinedErrors).length === 0;\n if (isActuallyValid) {\n // Proceed with submit...\n //\n // To respect sync submit fns, we can't simply wrap executeSubmit in a promise and\n // _always_ dispatch SUBMIT_SUCCESS because isSubmitting would then always be false.\n // This would be fine in simple cases, but make it impossible to disable submit\n // buttons where people use callbacks or promises as side effects (which is basically\n // all of v1 Formik code). Instead, recall that we are inside of a promise chain already,\n // so we can try/catch executeSubmit(), if it returns undefined, then just bail.\n // If there are errors, throw em. Otherwise, wrap executeSubmit in a promise and handle\n // cleanup of isSubmitting on behalf of the consumer.\n let promiseOrUndefined;\n try {\n promiseOrUndefined = executeSubmit();\n // Bail if it's sync, consumer is responsible for cleaning up\n // via setSubmitting(false)\n if (promiseOrUndefined === undefined) {\n return;\n }\n } catch (error) {\n throw error;\n }\n\n return Promise.resolve(promiseOrUndefined)\n .then(result => {\n if (!!isMounted.current) {\n dispatch({ type: 'SUBMIT_SUCCESS' });\n }\n return result;\n })\n .catch(_errors => {\n if (!!isMounted.current) {\n dispatch({ type: 'SUBMIT_FAILURE' });\n // This is a legit error rejected by the onSubmit fn\n // so we don't want to break the promise chain\n throw _errors;\n }\n });\n } else if (!!isMounted.current) {\n // ^^^ Make sure Formik is still mounted before updating state\n dispatch({ type: 'SUBMIT_FAILURE' });\n // throw combinedErrors;\n if (isInstanceOfError) {\n throw combinedErrors;\n }\n }\n return;\n }\n );\n });\n\n const handleSubmit = useEventCallback(\n (e?: React.FormEvent<HTMLFormElement>) => {\n if (e && e.preventDefault && isFunction(e.preventDefault)) {\n e.preventDefault();\n }\n\n if (e && e.stopPropagation && isFunction(e.stopPropagation)) {\n e.stopPropagation();\n }\n\n // Warn if form submission is triggered by a <button> without a\n // specified `type` attribute during development. This mitigates\n // a common gotcha in forms with both reset and submit buttons,\n // where the dev forgets to add type=\"button\" to the reset button.\n if (__DEV__ && typeof document !== 'undefined') {\n // Safely get the active element (works with IE)\n const activeElement = getActiveElement();\n if (\n activeElement !== null &&\n activeElement instanceof HTMLButtonElement\n ) {\n invariant(\n activeElement.attributes &&\n activeElement.attributes.getNamedItem('type'),\n 'You submitted a Formik form using a button with an unspecified `type` attribute. Most browsers default button elements to `type=\"submit\"`. If this is not a submit button, please add `type=\"button\"`.'\n );\n }\n }\n\n submitForm().catch(reason => {\n console.warn(\n `Warning: An unhandled error was caught from submitForm()`,\n reason\n );\n });\n }\n );\n\n const imperativeMethods: FormikHelpers<Values> = {\n resetForm,\n validateForm: validateFormWithHighPriority,\n validateField,\n setErrors,\n setFieldError,\n setFieldTouched,\n setFieldValue,\n setStatus,\n setSubmitting,\n setTouched,\n setValues,\n setFormikState,\n submitForm,\n };\n\n const executeSubmit = useEventCallback(() => {\n return onSubmit(state.values, imperativeMethods);\n });\n\n const handleReset = useEventCallback(e => {\n if (e && e.preventDefault && isFunction(e.preventDefault)) {\n e.preventDefault();\n }\n\n if (e && e.stopPropagation && isFunction(e.stopPropagation)) {\n e.stopPropagation();\n }\n\n resetForm();\n });\n\n const getFieldMeta = React.useCallback(\n (name: string): FieldMetaProps<any> => {\n return {\n value: getIn(state.values, name),\n error: getIn(state.errors, name),\n touched: !!getIn(state.touched, name),\n initialValue: getIn(initialValues.current, name),\n initialTouched: !!getIn(initialTouched.current, name),\n initialError: getIn(initialErrors.current, name),\n };\n },\n [state.errors, state.touched, state.values]\n );\n\n const getFieldHelpers = React.useCallback(\n (name: string): FieldHelperProps<any> => {\n return {\n setValue: (value: any, shouldValidate?: boolean) =>\n setFieldValue(name, value, shouldValidate),\n setTouched: (value: boolean, shouldValidate?: boolean) =>\n setFieldTouched(name, value, shouldValidate),\n setError: (value: any) => setFieldError(name, value),\n };\n },\n [setFieldValue, setFieldTouched, setFieldError]\n );\n\n const getFieldProps = React.useCallback(\n (nameOrOptions): FieldInputProps<any> => {\n const isAnObject = isObject(nameOrOptions);\n const name = isAnObject ? nameOrOptions.name : nameOrOptions;\n const valueState = getIn(state.values, name);\n\n const field: FieldInputProps<any> = {\n name,\n value: valueState,\n onChange: handleChange,\n onBlur: handleBlur,\n };\n if (isAnObject) {\n const {\n type,\n value: valueProp, // value is special for checkboxes\n as: is,\n multiple,\n } = nameOrOptions;\n\n if (type === 'checkbox') {\n if (valueProp === undefined) {\n field.checked = !!valueState;\n } else {\n field.checked = !!(\n Array.isArray(valueState) && ~valueState.indexOf(valueProp)\n );\n field.value = valueProp;\n }\n } else if (type === 'radio') {\n field.checked = valueState === valueProp;\n field.value = valueProp;\n } else if (is === 'select' && multiple) {\n field.value = field.value || [];\n field.multiple = true;\n }\n }\n return field;\n },\n [handleBlur, handleChange, state.values]\n );\n\n const dirty = React.useMemo(\n () => !isEqual(initialValues.current, state.values),\n [initialValues.current, state.values]\n );\n\n const isValid = React.useMemo(\n () =>\n typeof isInitialValid !== 'undefined'\n ? dirty\n ? state.errors && Object.keys(state.errors).length === 0\n : isInitialValid !== false && isFunction(isInitialValid)\n ? (isInitialValid as (props: FormikConfig<Values>) => boolean)(props)\n : (isInitialValid as boolean)\n : state.errors && Object.keys(state.errors).length === 0,\n [isInitialValid, dirty, state.errors, props]\n );\n\n const ctx = {\n ...state,\n initialValues: initialValues.current,\n initialErrors: initialErrors.current,\n initialTouched: initialTouched.current,\n initialStatus: initialStatus.current,\n handleBlur,\n handleChange,\n handleReset,\n handleSubmit,\n resetForm,\n setErrors,\n setFormikState,\n setFieldTouched,\n setFieldValue,\n setFieldError,\n setStatus,\n setSubmitting,\n setTouched,\n setValues,\n submitForm,\n validateForm: validateFormWithHighPriority,\n validateField,\n isValid,\n dirty,\n unregisterField,\n registerField,\n getFieldProps,\n getFieldMeta,\n getFieldHelpers,\n validateOnBlur,\n validateOnChange,\n validateOnMount,\n };\n\n return ctx;\n}\n\nexport function Formik<\n Values extends FormikValues = FormikValues,\n ExtraProps = {}\n>(props: FormikConfig<Values> & ExtraProps) {\n const formikbag = useFormik<Values>(props);\n const { component, children, render, innerRef } = props;\n\n // This allows folks to pass a ref to <Formik />\n React.useImperativeHandle(innerRef, () => formikbag);\n\n if (__DEV__) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n invariant(\n !props.render,\n `<Formik render> has been deprecated and will be removed in future versions of Formik. Please use a child callback function instead. To get rid of this warning, replace <Formik render={(props) => ...} /> with <Formik>{(props) => ...}</Formik>`\n );\n // eslint-disable-next-line\n }, []);\n }\n return (\n <FormikProvider value={formikbag}>\n {component\n ? React.createElement(component as any, formikbag)\n : render\n ? render(formikbag)\n : children // children come last, always called\n ? isFunction(children)\n ? (children as (bag: FormikProps<Values>) => React.ReactNode)(\n formikbag as FormikProps<Values>\n )\n : !isEmptyChildren(children)\n ? React.Children.only(children)\n : null\n : null}\n </FormikProvider>\n );\n}\n\nfunction warnAboutMissingIdentifier({\n htmlContent,\n documentationAnchorLink,\n handlerName,\n}: {\n htmlContent: string;\n documentationAnchorLink: string;\n handlerName: string;\n}) {\n console.warn(\n `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://formik.org/docs/api/formik#${documentationAnchorLink}\n `\n );\n}\n\n/**\n * Transform Yup ValidationError to a more usable object\n */\nexport function yupToFormErrors<Values>(yupError: any): FormikErrors<Values> {\n let errors: FormikErrors<Values> = {};\n if (yupError.inner) {\n if (yupError.inner.length === 0) {\n return setIn(errors, yupError.path, yupError.message);\n }\n for (let err of yupError.inner) {\n if (!getIn(errors, err.path)) {\n errors = setIn(errors, err.path, err.message);\n }\n }\n }\n return errors;\n}\n\n/**\n * Validate a yup schema.\n */\nexport function validateYupSchema<T extends FormikValues>(\n values: T,\n schema: any,\n sync: boolean = false,\n context: any = {}\n): Promise<Partial<T>> {\n const validateData: FormikValues = prepareDataForValidation(values);\n return schema[sync ? 'validateSync' : 'validate'](validateData, {\n abortEarly: false,\n context: context,\n });\n}\n\n/**\n * Recursively prepare values.\n */\nexport function prepareDataForValidation<T extends FormikValues>(\n values: T\n): FormikValues {\n let data: FormikValues = Array.isArray(values) ? [] : {};\n for (let k in values) {\n if (Object.prototype.hasOwnProperty.call(values, k)) {\n const key = String(k);\n if (Array.isArray(values[key]) === true) {\n data[key] = values[key].map((value: any) => {\n if (Array.isArray(value) === true || isPlainObject(value)) {\n return prepareDataForValidation(value);\n } else {\n return value !== '' ? value : undefined;\n }\n });\n } else if (isPlainObject(values[key])) {\n data[key] = prepareDataForValidation(values[key]);\n } else {\n data[key] = values[key] !== '' ? values[key] : undefined;\n }\n }\n }\n return data;\n}\n\n/**\n * deepmerge array merging algorithm\n * https://github.com/KyleAMathews/deepmerge#combine-array\n */\nfunction arrayMerge(target: any[], source: any[], options: any): any[] {\n const destination = target.slice();\n\n source.forEach(function merge(e: any, i: number) {\n if (typeof destination[i] === 'undefined') {\n const cloneRequested = options.clone !== false;\n const shouldClone = cloneRequested && options.isMergeableObject(e);\n destination[i] = shouldClone\n ? deepmerge(Array.isArray(e) ? [] : {}, e, options)\n : e;\n } else if (options.isMergeableObject(e)) {\n destination[i] = deepmerge(target[i], e, options);\n } else if (target.indexOf(e) === -1) {\n destination.push(e);\n }\n });\n return destination;\n}\n\n/** Return multi select values based on an array of options */\nfunction getSelectedValues(options: any[]) {\n return Array.from(options)\n .filter(el => el.selected)\n .map(el => el.value);\n}\n\n/** Return the next value for a checkbox */\nfunction getValueForCheckbox(\n currentValue: string | any[],\n checked: boolean,\n valueProp: any\n) {\n // If the current value was a boolean, return a boolean\n if (typeof currentValue === 'boolean') {\n return Boolean(checked);\n }\n\n // If the currentValue was not a boolean we want to return an array\n let currentArrayOfValues = [];\n let isValueInArray = false;\n let index = -1;\n\n if (!Array.isArray(currentValue)) {\n // eslint-disable-next-line eqeqeq\n if (!valueProp || valueProp == 'true' || valueProp == 'false') {\n return Boolean(checked);\n }\n } else {\n // If the current value is already an array, use it\n currentArrayOfValues = currentValue;\n index = currentValue.indexOf(valueProp);\n isValueInArray = index >= 0;\n }\n\n // 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\n if (checked && valueProp && !isValueInArray) {\n return currentArrayOfValues.concat(valueProp);\n }\n\n // If the checkbox was unchecked and the value is not in the array, simply return the already existing array of values\n if (!isValueInArray) {\n return currentArrayOfValues;\n }\n\n // If the checkbox was unchecked and the value is in the array, remove the value and return the array\n return currentArrayOfValues\n .slice(0, index)\n .concat(currentArrayOfValues.slice(index + 1));\n}\n\n// React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser.\n// @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' &&\n typeof window.document !== 'undefined' &&\n typeof window.document.createElement !== 'undefined'\n ? React.useLayoutEffect\n : React.useEffect;\n\nfunction useEventCallback<T extends (...args: any[]) => any>(fn: T): T {\n const ref: any = React.useRef(fn);\n\n // we copy a ref to the callback scoped to the current state/props on each render\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n });\n\n return React.useCallback(\n (...args: any[]) => ref.current.apply(void 0, args),\n []\n ) as T;\n}\n","import * as React from 'react';\nimport {\n FormikProps,\n GenericFieldHTMLAttributes,\n FieldMetaProps,\n FieldHelperProps,\n FieldInputProps,\n FieldValidator,\n} from './types';\nimport { useFormikContext } from './FormikContext';\nimport { isFunction, isEmptyChildren, isObject } from './utils';\nimport invariant from 'tiny-warning';\n\nexport interface FieldProps<V = any, FormValues = any> {\n field: FieldInputProps<V>;\n form: FormikProps<FormValues>; // if ppl want to restrict this for a given form, let them.\n meta: FieldMetaProps<V>;\n}\n\nexport interface FieldConfig<V = any> {\n /**\n * Field component to render. Can either be a string like 'select' or a component.\n */\n component?:\n | string\n | React.ComponentType<FieldProps<V>>\n | React.ComponentType\n | React.ForwardRefExoticComponent<any>;\n\n /**\n * Component to render. Can either be a string e.g. 'select', 'input', or 'textarea', or a component.\n */\n as?:\n | React.ComponentType<FieldProps<V>['field']>\n | string\n | React.ComponentType\n | React.ForwardRefExoticComponent<any>;\n\n /**\n * Render prop (works like React router's <Route render={props =>} />)\n * @deprecated\n */\n render?: (props: FieldProps<V>) => React.ReactNode;\n\n /**\n * Children render function <Field name>{props => ...}</Field>)\n */\n children?: ((props: FieldProps<V>) => React.ReactNode) | React.ReactNode;\n\n /**\n * Validate a single field value independently\n */\n validate?: FieldValidator;\n\n /**\n * Field name\n */\n name: string;\n\n /** HTML input type */\n type?: string;\n\n /** Field value */\n value?: any;\n\n /** Inner ref */\n innerRef?: (instance: any) => void;\n}\n\nexport type FieldAttributes<T> = GenericFieldHTMLAttributes &\n FieldConfig<T> &\n T & { name: string };\n\nexport type FieldHookConfig<T> = GenericFieldHTMLAttributes & FieldConfig<T>;\n\nexport function useField<Val = any>(\n propsOrFieldName: string | FieldHookConfig<Val>\n): [FieldInputProps<Val>, FieldMetaProps<Val>, FieldHelperProps<Val>] {\n const formik = useFormikContext();\n const {\n getFieldProps,\n getFieldMeta,\n getFieldHelpers,\n registerField,\n unregisterField,\n } = formik;\n\n const isAnObject = isObject(propsOrFieldName);\n\n // Normalize propsOrFieldName to FieldHookConfig<Val>\n const props: FieldHookConfig<Val> = isAnObject\n ? (propsOrFieldName as FieldHookConfig<Val>)\n : { name: propsOrFieldName as string };\n\n const { name: fieldName, validate: validateFn } = props;\n\n React.useEffect(() => {\n if (fieldName) {\n registerField(fieldName, {\n validate: validateFn,\n });\n }\n return () => {\n if (fieldName) {\n unregisterField(fieldName);\n }\n };\n }, [registerField, unregisterField, fieldName, validateFn]);\n\n if (__DEV__) {\n invariant(\n formik,\n 'useField() / <Field /> must be used underneath a <Formik> component or withFormik() higher order component'\n );\n }\n\n invariant(\n fieldName,\n 'Invalid field name. Either pass `useField` a string or an object containing a `name` key.'\n );\n\n return [\n getFieldProps(props),\n getFieldMeta(fieldName),\n getFieldHelpers(fieldName),\n ];\n}\n\nexport function Field({\n validate,\n name,\n render,\n children,\n as: is, // `as` is reserved in typescript lol\n component,\n ...props\n}: FieldAttributes<any>) {\n const {\n validate: _validate,\n validationSchema: _validationSchema,\n\n ...formik\n } = useFormikContext();\n\n if (__DEV__) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n invariant(\n !render,\n `<Field render> has been deprecated and will be removed in future versions of Formik. Please use a child callback function instead. To get rid of this warning, replace <Field name=\"${name}\" render={({field, form}) => ...} /> with <Field name=\"${name}\">{({field, form, meta}) => ...}</Field>`\n );\n\n invariant(\n !(is && children && isFunction(children)),\n 'You should not use <Field as> and <Field children> as a function in the same <Field> component; <Field as> will be ignored.'\n );\n\n invariant(\n !(component && children && isFunction(children)),\n 'You should not use <Field component> and <Field children> as a function in the same <Field> component; <Field component> will be ignored.'\n );\n\n invariant(\n !(render && children && !isEmptyChildren(children)),\n 'You should not use <Field render> and <Field children> in the same <Field> component; <Field children> will be ignored'\n );\n // eslint-disable-next-line\n }, []);\n }\n\n // Register field and field-level validation with parent <Formik>\n const { registerField, unregisterField } = formik;\n React.useEffect(() => {\n registerField(name, {\n validate: validate,\n });\n return () => {\n unregisterField(name);\n };\n }, [registerField, unregisterField, name, validate]);\n const field = formik.getFieldProps({ name, ...props });\n const meta = formik.getFieldMeta(name);\n const legacyBag = { field, form: formik };\n\n if (render) {\n return render({ ...legacyBag, meta });\n }\n\n if (isFunction(children)) {\n return children({ ...legacyBag, meta });\n }\n\n if (component) {\n // This behavior is backwards compat with earlier Formik 0.9 to 1.x\n if (typeof component === 'string') {\n const { innerRef, ...rest } = props;\n return React.createElement(\n component,\n { ref: innerRef, ...field, ...rest },\n children\n );\n }\n // We don't pass `meta` for backwards compat\n return React.createElement(\n component,\n { field, form: formik, ...props },\n children\n );\n }\n\n // default to input here so we can check for both `as` and `children` above\n const asElement = is || 'input';\n\n if (typeof asElement === 'string') {\n const { innerRef, ...rest } = props;\n return React.createElement(\n asElement,\n { ref: innerRef, ...field, ...rest },\n children\n );\n }\n\n return React.createElement(asElement, { ...field, ...props }, children);\n}\n","import * as React from 'react';\nimport { useFormikContext } from './FormikContext';\n\nexport type FormikFormProps = Pick<\n React.FormHTMLAttributes<HTMLFormElement>,\n Exclude<\n keyof React.FormHTMLAttributes<HTMLFormElement>,\n 'onReset' | 'onSubmit'\n >\n>;\n\ntype FormProps = React.ComponentPropsWithoutRef<'form'>;\n\n// @todo tests\nexport const Form = React.forwardRef<HTMLFormElement, FormProps>(\n (props: FormikFormProps, ref) => {\n // iOS needs an \"action\" attribute for nice input: https://stackoverflow.com/a/39485162/406725\n // We default the action to \"#\" in case the preventDefault fails (just updates the URL hash)\n const { action, ...rest } = props;\n const _action = action ?? '#';\n const { handleReset, handleSubmit } = useFormikContext();\n return (\n <form\n onSubmit={handleSubmit}\n ref={ref}\n onReset={handleReset}\n action={_action}\n {...rest}\n />\n );\n }\n);\n\nForm.displayName = 'Form';\n","import hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { Formik } from './Formik';\nimport {\n FormikHelpers,\n FormikProps,\n FormikSharedConfig,\n FormikValues,\n FormikTouched,\n FormikErrors,\n} from './types';\nimport { isFunction } from './utils';\n\n/**\n * State, handlers, and helpers injected as props into the wrapped form component.\n * Used with withFormik()\n *\n * @deprecated Use `OuterProps & FormikProps<Values>` instead.\n */\nexport type InjectedFormikProps<Props, Values> = Props & FormikProps<Values>;\n\n/**\n * Formik helpers + { props }\n */\nexport type FormikBag<P, V> = { props: P } & FormikHelpers<V>;\n\n/**\n * withFormik() configuration options. Backwards compatible.\n */\nexport interface WithFormikConfig<\n Props,\n Values extends FormikValues = FormikValues,\n DeprecatedPayload = Values\n> extends FormikSharedConfig<Props> {\n /**\n * Set the display name of the component. Useful for React DevTools.\n */\n displayName?: string;\n\n /**\n * Submission handler\n */\n handleSubmit: (values: Values, formikBag: FormikBag<Props, Values>) => void;\n\n /**\n * Map props to the form values\n */\n mapPropsToValues?: (props: Props) => Values;\n\n /**\n * Map props to the form status\n */\n mapPropsToStatus?: (props: Props) => any;\n\n /**\n * Map props to the form touched state\n */\n mapPropsToTouched?: (props: Props) => FormikTouched<Values>;\n\n /**\n * Map props to the form errors state\n */\n mapPropsToErrors?: (props: Props) => FormikErrors<Values>;\n\n /**\n * @deprecated in 0.9.0 (but needed to break TS types)\n */\n mapValuesToPayload?: (values: Values) => DeprecatedPayload;\n\n /**\n * A Yup Schema or a function that returns a Yup schema\n */\n validationSchema?: any | ((props: Props) => any);\n\n /**\n * Validation function. Must return an error object or promise that\n * throws an error object where that object keys map to corresponding value.\n */\n validate?: (values: Values, props: Props) => void | object | Promise<any>;\n}\n\nexport type CompositeComponent<P> =\n | React.ComponentClass<P>\n | React.StatelessComponent<P>;\n\nexport interface ComponentDecorator<TOwnProps, TMergedProps> {\n (component: CompositeComponent<TMergedProps>): React.ComponentType<TOwnProps>;\n}\n\nexport interface InferableComponentDecorator<TOwnProps> {\n <T extends CompositeComponent<TOwnProps>>(component: T): T;\n}\n\n/**\n * A public higher-order component to access the imperative API\n */\nexport function withFormik<\n OuterProps extends object,\n Values extends FormikValues,\n Payload = Values\n>({\n mapPropsToValues = (vanillaProps: OuterProps): Values => {\n let val: Values = {} as Values;\n for (let k in vanillaProps) {\n if (\n vanillaProps.hasOwnProperty(k) &&\n typeof vanillaProps[k] !== 'function'\n ) {\n // @todo TypeScript fix\n (val as any)[k] = vanillaProps[k];\n }\n }\n return val as Values;\n },\n ...config\n}: WithFormikConfig<OuterProps, Values, Payload>): ComponentDecorator<\n OuterProps,\n OuterProps & FormikProps<Values>\n> {\n return function createFormik(\n Component: CompositeComponent<OuterProps & FormikProps<Values>>\n ): React.ComponentClass<OuterProps> {\n const componentDisplayName =\n Component.displayName ||\n Component.name ||\n (Component.constructor && Component.constructor.name) ||\n 'Component';\n /**\n * We need to use closures here for to provide the wrapped component's props to\n * the respective withFormik config methods.\n */\n class C extends React.Component<OuterProps, {}> {\n static displayName = `WithFormik(${componentDisplayName})`;\n\n validate = (values: Values): void | object | Promise<any> => {\n return config.validate!(values, this.props);\n };\n\n validationSchema = () => {\n return isFunction(config.validationSchema)\n ? config.validationSchema!(this.props)\n : config.validationSchema;\n };\n\n handleSubmit = (values: Values, actions: FormikHelpers<Values>) => {\n return config.handleSubmit(values, {\n ...actions,\n props: this.props,\n });\n };\n\n /**\n * Just avoiding a render callback for perf here\n */\n renderFormComponent = (formikProps: FormikProps<Values>) => {\n return <Component {...this.props} {...formikProps} />;\n };\n\n render() {\n const { children, ...props } = this.props as any;\n return (\n <Formik\n {...props}\n {...config}\n validate={config.validate && this.validate}\n validationSchema={config.validationSchema && this.validationSchema}\n initialValues={mapPropsToValues(this.props)}\n initialStatus={\n config.mapPropsToStatus && config.mapPropsToStatus(this.props)\n }\n initialErrors={\n config.mapPropsToErrors && config.mapPropsToErrors(this.props)\n }\n initialTouched={\n config.mapPropsToTouched && config.mapPropsToTouched(this.props)\n }\n onSubmit={this.handleSubmit as any}\n children={this.renderFormComponent}\n />\n );\n }\n }\n\n return hoistNonReactStatics(\n C,\n Component as React.ComponentClass<OuterProps & FormikProps<Values>> // cast type to ComponentClass (even if SFC)\n ) as React.ComponentClass<OuterProps>;\n };\n}\n","import * as React from 'react';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport { FormikContextType } from './types';\nimport { FormikConsumer } from './FormikContext';\nimport invariant from 'tiny-warning';\n\n/**\n * Connect any component to Formik context, and inject as a prop called `formik`;\n * @param Comp React Component\n */\nexport function connect<OuterProps, Values = {}>(\n Comp: React.ComponentType<OuterProps & { formik: FormikContextType<Values> }>\n) {\n const C: React.FC<OuterProps> = (props: OuterProps) => (\n <FormikConsumer>\n {formik => {\n invariant(\n !!formik,\n `Formik context is undefined, please verify you are rendering <Form>, <Field>, <FastField>, <FieldArray>, or your custom context-using component as a child of a <Formik> component. Component name: ${Comp.name}`\n );\n return <Comp {...props} formik={formik} />;\n }}\n </FormikConsumer>\n );\n const componentDisplayName =\n Comp.displayName ||\n Comp.name ||\n (Comp.constructor && Comp.constructor.name) ||\n 'Component';\n\n // Assign Comp to C.WrappedComponent so we can access the inner component in tests\n // For example, <Field.WrappedComponent /> gets us <FieldInner/>\n (C as React.FC<OuterProps> & {\n WrappedComponent: React.ReactNode;\n }).WrappedComponent = Comp;\n\n C.displayName = `FormikConnect(${componentDisplayName})`;\n\n return hoistNonReactStatics(\n C,\n Comp as React.ComponentClass<\n OuterProps & { formik: FormikContextType<Values> }\n > // cast type to ComponentClass (even if SFC)\n ) as React.ComponentType<OuterProps>;\n}\n","import * as React from 'react';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { connect } from './connect';\nimport {\n FormikContextType,\n FormikState,\n SharedRenderProps,\n FormikProps,\n} from './types';\nimport {\n getIn,\n isEmptyChildren,\n isFunction,\n setIn,\n isEmptyArray,\n} from './utils';\nimport isEqual from 'react-fast-compare';\n\nexport type FieldArrayRenderProps = ArrayHelpers & {\n form: FormikProps<any>;\n name: string;\n};\n\nexport type FieldArrayConfig = {\n /** Really the path to the array field to be updated */\n name: string;\n /** Should field array validate the form AFTER array updates/changes? */\n validateOnChange?: boolean;\n} & SharedRenderProps<FieldArrayRenderProps>;\nexport interface ArrayHelpers {\n /** Imperatively add a value to the end of an array */\n push: (obj: any) => void;\n /** Curried fn to add a value to the end of an array */\n handlePush: (obj: any) => () => void;\n /** Imperatively swap two values in an array */\n swap: (indexA: number, indexB: number) => void;\n /** Curried fn to swap two values in an array */\n handleSwap: (indexA: number, indexB: number) => () => void;\n /** Imperatively move an element in an array to another index */\n move: (from: number, to: number) => void;\n /** Imperatively move an element in an array to another index */\n handleMove: (from: number, to: number) => () => void;\n /** Imperatively insert an element at a given index into the array */\n insert: (index: number, value: any) => void;\n /** Curried fn to insert an element at a given index into the array */\n handleInsert: (index: number, value: any) => () => void;\n /** Imperatively replace a value at an index of an array */\n replace: (index: number, value: any) => void;\n /** Curried fn to replace an element at a given index into the array */\n handleReplace: (index: number, value: any) => () => void;\n /** Imperatively add an element to the beginning of an array and return its length */\n unshift: (value: any) => number;\n /** Curried fn to add an element to the beginning of an array */\n handleUnshift: (value: any) => () => void;\n /** Curried fn to remove an element at an index of an array */\n handleRemove: (index: number) => () => void;\n /** Curried fn to remove a value from the end of the array */\n handlePop: () => () => void;\n /** Imperatively remove and element at an index of an array */\n remove<T>(index: number): T | undefined;\n /** Imperatively remove and return value from the end of the array */\n pop<T>(): T | undefined;\n}\n\n/**\n * Some array helpers!\n */\nexport const move = (array: any[], from: number, to: number) => {\n const copy = copyArrayLike(array);\n const value = copy[from];\n copy.splice(from, 1);\n copy.splice(to, 0, value);\n return copy;\n};\n\nexport const swap = (\n arrayLike: ArrayLike<any>,\n indexA: number,\n indexB: number\n) => {\n const copy = copyArrayLike(arrayLike);\n const a = copy[indexA];\n copy[indexA] = copy[indexB];\n copy[indexB] = a;\n return copy;\n};\n\nexport const insert = (\n arrayLike: ArrayLike<any>,\n index: number,\n value: any\n) => {\n const copy = copyArrayLike(arrayLike);\n copy.splice(index, 0, value);\n return copy;\n};\n\nexport const replace = (\n arrayLike: ArrayLike<any>,\n index: number,\n value: any\n) => {\n const copy = copyArrayLike(arrayLike);\n copy[index] = value;\n return copy;\n};\n\nconst copyArrayLike = (arrayLike: ArrayLike<any>) => {\n if (!arrayLike) {\n return [];\n } else if (Array.isArray(arrayLike)) {\n return [...arrayLike];\n } else {\n const maxIndex = Object.keys(arrayLike)\n .map(key => parseInt(key))\n .reduce((max, el) => (el > max ? el : max), 0);\n return Array.from({ ...arrayLike, length: maxIndex + 1 });\n }\n};\n\nclass FieldArrayInner<Values = {}> extends React.Component<\n FieldArrayConfig & { formik: FormikContextType<Values> },\n {}\n> {\n static defaultProps = {\n validateOnChange: true,\n };\n\n constructor(props: FieldArrayConfig & { formik: FormikContextType<Values> }) {\n super(props);\n // We need TypeScript generics on these, so we'll bind them in the constructor\n // @todo Fix TS 3.2.1\n this.remove = this.remove.bind(this) as any;\n this.pop = this.pop.bind(this) as any;\n }\n\n componentDidUpdate(\n prevProps: FieldArrayConfig & { formik: FormikContextType<Values> }\n ) {\n if (\n this.props.validateOnChange &&\n this.props.formik.validateOnChange &&\n !isEqual(\n getIn(prevProps.formik.values, prevProps.name),\n getIn(this.props.formik.values, this.props.name)\n )\n ) {\n this.props.formik.validateForm(this.props.formik.values);\n }\n }\n\n updateArrayField = (\n fn: Function,\n alterTouched: boolean | Function,\n alterErrors: boolean | Function\n ) => {\n const {\n name,\n\n formik: { setFormikState },\n } = this.props;\n setFormikState((prevState: FormikState<any>) => {\n let updateErrors = typeof alterErrors === 'function' ? alterErrors : fn;\n let updateTouched =\n typeof alterTouched === 'function' ? alterTouched : fn;\n\n // values fn should be executed before updateErrors and updateTouched,\n // otherwise it causes an error with unshift.\n let values = setIn(\n prevState.values,\n name,\n fn(getIn(prevState.values, name))\n );\n\n let fieldError = alterErrors\n ? updateErrors(getIn(prevState.errors, name))\n : undefined;\n let fieldTouched = alterTouched\n ? updateTouched(getIn(prevState.touched, name))\n : undefined;\n\n if (isEmptyArray(fieldError)) {\n fieldError = undefined;\n }\n if (isEmptyArray(fieldTouched)) {\n fieldTouched = undefined;\n }\n\n return {\n ...prevState,\n values,\n errors: alterErrors\n ? setIn(prevState.errors, name, fieldError)\n : prevState.errors,\n touched: alterTouched\n ? setIn(prevState.touched, name, fieldTouched)\n : prevState.touched,\n };\n });\n };\n\n push = (value: any) =>\n this.updateArrayField(\n (arrayLike: ArrayLike<any>) => [\n ...copyArrayLike(arrayLike),\n cloneDeep(value),\n ],\n false,\n false\n );\n\n handlePush = (value: any) => () => this.push(value);\n\n swap = (indexA: number, indexB: number) =>\n this.updateArrayField(\n (array: any[]) => swap(array, indexA, indexB),\n true,\n true\n );\n\n handleSwap = (indexA: number, indexB: number) => () =>\n this.swap(indexA, indexB);\n\n move = (from: number, to: number) =>\n this.updateArrayField((array: any[]) => move(array, from, to), true, true);\n\n handleMove = (from: number, to: number) => () => this.move(from, to);\n\n insert = (index: number, value: any) =>\n this.updateArrayField(\n (array: any[]) => insert(array, index, value),\n (array: any[]) => insert(array, index, null),\n (array: any[]) => insert(array, index, null)\n );\n\n handleInsert = (index: number, value: any) => () => this.insert(index, value);\n\n replace = (index: number, value: any) =>\n this.updateArrayField(\n (array: any[]) => replace(array, index, value),\n false,\n false\n );\n\n handleReplace = (index: number, value: any) => () =>\n this.replace(index, value);\n\n unshift = (value: any) => {\n let length = -1;\n this.updateArrayField(\n (array: any[]) => {\n const arr = array ? [value, ...array] : [value];\n if (length < 0) {\n length = arr.length;\n }\n return arr;\n },\n (array: any[]) => {\n const arr = array ? [null, ...array] : [null];\n if (length < 0) {\n length = arr.length;\n }\n return arr;\n },\n (array: any[]) => {\n const arr = array ? [null, ...array] : [null];\n if (length < 0) {\n length = arr.length;\n }\n return arr;\n }\n );\n return length;\n };\n\n handleUnshift = (value: any) => () => this.unshift(value);\n\n remove<T>(index: number): T {\n // We need to make sure we also remove relevant pieces of `touched` and `errors`\n let result: any;\n this.updateArrayField(\n // so this gets call 3 times\n (array?: any[]) => {\n const copy = array ? copyArrayLike(array) : [];\n if (!result) {\n result = copy[index];\n }\n if (isFunction(copy.splice)) {\n copy.splice(index, 1);\n }\n return copy;\n },\n true,\n true\n );\n\n return result as T;\n }\n\n handleRemove = (index: number) => () => this.remove<any>(index);\n\n pop<T>(): T {\n // Remove relevant pieces of `touched` and `errors` too!\n let result: any;\n this.updateArrayField(\n // so this gets call 3 times\n (array: any[]) => {\n const tmp = array;\n if (!result) {\n result = tmp && tmp.pop && tmp.pop();\n }\n return tmp;\n },\n true,\n true\n );\n\n return result as T;\n }\n\n handlePop = () => () => this.pop<any>();\n\n render() {\n const arrayHelpers: ArrayHelpers = {\n push: this.push,\n pop: this.pop,\n swap: this.swap,\n move: this.move,\n insert: this.insert,\n replace: this.replace,\n unshift: this.unshift,\n remove: this.remove,\n handlePush: this.handlePush,\n handlePop: this.handlePop,\n handleSwap: this.handleSwap,\n handleMove: this.handleMove,\n handleInsert: this.handleInsert,\n handleReplace: this.handleReplace,\n handleUnshift: this.handleUnshift,\n handleRemove: this.handleRemove,\n };\n\n const {\n component,\n render,\n children,\n name,\n formik: {\n validate: _validate,\n validationSchema: _validationSchema,\n ...restOfFormik\n },\n } = this.props;\n\n const props: FieldArrayRenderProps = {\n ...arrayHelpers,\n form: restOfFormik,\n name,\n };\n\n return component\n ? React.createElement(component as any, props)\n : render\n ? (render as any)(props)\n : children // children come last, always called\n ? typeof children === 'function'\n ? (children as any)(props)\n : !isEmptyChildren(children)\n ? React.Children.only(children)\n : null\n : null;\n }\n}\n\nexport const FieldArray = connect<FieldArrayConfig, any>(FieldArrayInner);\n","import * as React from 'react';\nimport { FormikContextType } from './types';\nimport { getIn, isFunction } from './utils';\nimport { connect } from './connect';\n\nexport interface ErrorMessageProps {\n name: string;\n className?: string;\n component?: string | React.ComponentType;\n children?: (errorMessage: string) => React.ReactNode;\n render?: (errorMessage: string) => React.ReactNode;\n}\n\nclass ErrorMessageImpl extends React.Component<\n ErrorMessageProps & { formik: FormikContextType<any> }\n> {\n shouldComponentUpdate(\n props: ErrorMessageProps & { formik: FormikContextType<any> }\n ) {\n if (\n getIn(this.props.formik.errors, this.props.name) !==\n getIn(props.formik.errors, this.props.name) ||\n getIn(this.props.formik.touched, this.props.name) !==\n getIn(props.formik.touched, this.props.name) ||\n Object.keys(this.props).length !== Object.keys(props).length\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n render() {\n let { component, formik, render, children, name, ...rest } = this.props;\n\n const touch = getIn(formik.touched, name);\n const error = getIn(formik.errors, name);\n\n return !!touch && !!error\n ? render\n ? isFunction(render)\n ? render(error)\n : null\n : children\n ? isFunction(children)\n ? children(error)\n : null\n : component\n ? React.createElement(component, rest as any, error)\n : error\n : null;\n }\n}\n\nexport const ErrorMessage = connect<\n ErrorMessageProps,\n ErrorMessageProps & { formik: FormikContextType<any> }\n>(ErrorMessageImpl);\n","import * as React from 'react';\n\nimport {\n FormikProps,\n GenericFieldHTMLAttributes,\n FormikContextType,\n FieldMetaProps,\n FieldInputProps,\n} from './types';\nimport invariant from 'tiny-warning';\nimport { getIn, isEmptyChildren, isFunction } from './utils';\nimport { FieldConfig } from './Field';\nimport { connect } from './connect';\n\ntype $FixMe = any;\n\nexport interface FastFieldProps<V = any> {\n field: FieldInputProps<V>;\n meta: FieldMetaProps<V>;\n form: FormikProps<V>; // if ppl want to restrict this for a given form, let them.\n}\n\nexport type FastFieldConfig<T> = FieldConfig & {\n /** Override FastField's default shouldComponentUpdate */\n shouldUpdate?: (\n nextProps: T & GenericFieldHTMLAttributes,\n props: {}\n ) => boolean;\n};\n\nexport type FastFieldAttributes<T> = GenericFieldHTMLAttributes &\n FastFieldConfig<T> &\n T;\n\ntype FastFieldInnerProps<Values = {}, Props = {}> = FastFieldAttributes<\n Props\n> & { formik: FormikContextType<Values> };\n\n/**\n * Custom Field component for quickly hooking into Formik\n * context and wiring up forms.\n */\nclass FastFieldInner<Values = {}, Props = {}> extends React.Component<\n FastFieldInnerProps<Values, Props>,\n {}\n> {\n constructor(props: FastFieldInnerProps<Values, Props>) {\n super(props);\n const { render, children, component, as: is, name } = props;\n invariant(\n !render,\n `<FastField render> has been deprecated. Please use a child callback function instead: <FastField name={${name}}>{props => ...}</FastField> instead.`\n );\n invariant(\n !(component && render),\n 'You should not use <FastField component> and <FastField render> in the same <FastField> component; <FastField component> will be ignored'\n );\n\n invariant(\n !(is && children && isFunction(children)),\n 'You should not use <FastField as> and <FastField children> as a function in the same <FastField> component; <FastField as> will be ignored.'\n );\n\n invariant(\n !(component && children && isFunction(children)),\n 'You should not use <FastField component> and <FastField children> as a function in the same <FastField> component; <FastField component> will be ignored.'\n );\n\n invariant(\n !(render && children && !isEmptyChildren(children)),\n 'You should not use <FastField render> and <FastField children> in the same <FastField> component; <FastField children> will be ignored'\n );\n }\n\n shouldComponentUpdate(props: FastFieldInnerProps<Values, Props>) {\n if (this.props.shouldUpdate) {\n return this.props.shouldUpdate(props, this.props);\n } else if (\n props.name !== this.props.name ||\n getIn(props.formik.values, this.props.name) !==\n getIn(this.props.formik.values, this.props.name) ||\n getIn(props.formik.errors, this.props.name) !==\n getIn(this.props.formik.errors, this.props.name) ||\n getIn(props.formik.touched, this.props.name) !==\n getIn(this.props.formik.touched, this.props.name) ||\n Object.keys(this.props).length !== Object.keys(props).length ||\n props.formik.isSubmitting !== this.props.formik.isSubmitting\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n componentDidMount() {\n // Register the Field with the parent Formik. Parent will cycle through\n // registered Field's validate fns right prior to submit\n this.props.formik.registerField(this.props.name, {\n validate: this.props.validate,\n });\n }\n\n componentDidUpdate(prevProps: FastFieldAttributes<Props>) {\n if (this.props.name !== prevProps.name) {\n this.props.formik.unregisterField(prevProps.name);\n this.props.formik.registerField(this.props.name, {\n validate: this.props.validate,\n });\n }\n\n if (this.props.validate !== prevProps.validate) {\n this.props.formik.registerField(this.props.name, {\n validate: this.props.validate,\n });\n }\n }\n\n componentWillUnmount() {\n this.props.formik.unregisterField(this.props.name);\n }\n\n render() {\n const {\n validate,\n name,\n render,\n as: is,\n children,\n component,\n shouldUpdate,\n formik,\n ...props\n } = this.props as FastFieldInnerProps<Values, Props>;\n\n const {\n validate: _validate,\n validationSchema: _validationSchema,\n ...restOfFormik\n } = formik;\n const field = formik.getFieldProps({ name, ...props });\n const meta = {\n value: getIn(formik.values, name),\n error: getIn(formik.errors, name),\n touched: !!getIn(formik.touched, name),\n initialValue: getIn(formik.initialValues, name),\n initialTouched: !!getIn(formik.initialTouched, name),\n initialError: getIn(formik.initialErrors, name),\n };\n\n const bag = { field, meta, form: restOfFormik };\n\n if (render) {\n return (render as any)(bag);\n }\n\n if (isFunction(children)) {\n return (children as (props: FastFieldProps<any>) => React.ReactNode)(bag);\n }\n\n if (component) {\n // This behavior is backwards compat with earlier Formik 0.9 to 1.x\n if (typeof component === 'string') {\n const { innerRef, ...rest } = props;\n return React.createElement(\n component,\n { ref: innerRef, ...field, ...(rest as $FixMe) },\n children\n );\n }\n // We don't pass `meta` for backwards compat\n return React.createElement(\n component as React.ComponentClass<$FixMe>,\n { field, form: formik, ...props },\n children\n );\n }\n\n // default to input here so we can check for both `as` and `children` above\n const asElement = is || 'input';\n\n if (typeof asElement === 'string') {\n const { innerRef, ...rest } = props;\n return React.createElement(\n asElement,\n { ref: innerRef, ...field, ...(rest as $FixMe) },\n children\n );\n }\n\n return React.createElement(\n asElement as React.ComponentClass,\n { ...field, ...props },\n children\n );\n }\n}\n\nexport const FastField = connect<FastFieldAttributes<any>, any>(FastFieldInner);\n"]},"metadata":{},"sourceType":"module"} |