Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

formik

Package Overview
Dependencies
Maintainers
1
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formik - npm Package Compare versions

Comparing version 2.0.1-alpha.5 to 2.0.1-alpha.51

dist/formik.es.production.js

5

dist/connect.d.ts
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { FormikContext } from './types';
export declare function connect<OuterProps, Values = {}>(Comp: React.ComponentType<OuterProps & {
formik: FormikContext<Values>;
}>): (React.FunctionComponent<OuterProps> & {}) | (React.ComponentClass<OuterProps, any> & {});
}>): React.FunctionComponent<OuterProps> & hoistNonReactStatics.NonReactStatics<React.ComponentClass<OuterProps & {
formik: FormikContext<Values>;
}, any>, {}>;

8

dist/ErrorMessage.d.ts

@@ -0,2 +1,4 @@

/// <reference types="hoist-non-react-statics" />
import * as React from 'react';
import { FormikContext } from './types';
export interface ErrorMessageProps {

@@ -9,2 +11,6 @@ name: string;

}
export declare const ErrorMessage: (React.FunctionComponent<ErrorMessageProps> & {}) | (React.ComponentClass<ErrorMessageProps, any> & {});
export declare const ErrorMessage: React.FunctionComponent<ErrorMessageProps> & import("hoist-non-react-statics").NonReactStatics<React.ComponentClass<ErrorMessageProps & {
formik: FormikContext<ErrorMessageProps & {
formik: FormikContext<any>;
}>;
}, any>, {}>;

@@ -0,0 +0,0 @@ import * as React from 'react';

@@ -0,3 +1,4 @@

/// <reference types="hoist-non-react-statics" />
import * as React from 'react';
import { SharedRenderProps, FormikProps } from './types';
import { FormikContext, SharedRenderProps, FormikProps } from './types';
export declare type FieldArrayRenderProps = ArrayHelpers & {

@@ -33,2 +34,7 @@ form: FormikProps<any>;

export declare const replace: (array: any[], index: number, value: any) => any[];
export declare const FieldArray: (React.FunctionComponent<FieldArrayConfig> & {}) | (React.ComponentClass<FieldArrayConfig, any> & {});
export declare const FieldArray: React.FunctionComponent<FieldArrayConfig> & import("hoist-non-react-statics").NonReactStatics<React.ComponentClass<{
name: string;
validateOnChange?: boolean | undefined;
} & SharedRenderProps<FieldArrayRenderProps> & {
formik: FormikContext<any>;
}, any>, {}>;

@@ -0,0 +0,0 @@ import * as React from 'react';

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var tslib_1 = require('tslib');
var React = require('react');

@@ -17,1066 +14,1195 @@ var isEqual = _interopDefault(require('react-fast-compare'));

var isFunction = function (obj) {
return typeof obj === 'function';
};
var isObject = function (obj) {
return obj !== null && typeof obj === 'object';
};
var isInteger = function (obj) {
return String(Math.floor(Number(obj))) === obj;
};
var isString = function (obj) {
return Object.prototype.toString.call(obj) === '[object String]';
};
var isNaN$1 = function (obj) { return obj !== obj; };
var isEmptyChildren = function (children) {
return React.Children.count(children) === 0;
};
var isPromise = function (value) {
return isObject(value) && isFunction(value.then);
};
var isInputEvent = function (value) {
return value && isObject(value) && isObject(value.target);
};
const isFunction = obj => typeof obj === 'function';
const isObject = obj => obj !== null && typeof obj === 'object';
const isInteger = obj => String(Math.floor(Number(obj))) === obj;
const isString = obj => Object.prototype.toString.call(obj) === '[object String]';
const isNaN$1 = obj => obj !== obj;
const isEmptyChildren = children => React.Children.count(children) === 0;
const isPromise = value => isObject(value) && isFunction(value.then);
const isInputEvent = value => value && isObject(value) && isObject(value.target);
function getActiveElement(doc) {
doc = doc || (typeof document !== 'undefined' ? document : undefined);
if (typeof doc === 'undefined') {
return null;
}
try {
return doc.activeElement || doc.body;
}
catch (e) {
return doc.body;
}
doc = doc || (typeof document !== 'undefined' ? document : undefined);
if (typeof doc === 'undefined') {
return null;
}
try {
return doc.activeElement || doc.body;
} catch (e) {
return doc.body;
}
}
function makeCancelable(promise) {
var hasCanceled = false;
var wrappedPromise = new Promise(function (resolve, reject) {
promise.then(function (val) { return (hasCanceled ? reject({ isCanceled: true }) : resolve(val)); }, function (error) { return (hasCanceled ? reject({ isCanceled: true }) : reject(error)); });
});
return [
wrappedPromise,
function cancel() {
hasCanceled = true;
},
];
let hasCanceled = false;
const wrappedPromise = new Promise((resolve, reject) => {
promise.then(val => hasCanceled ? reject({
isCanceled: true
}) : resolve(val), error => hasCanceled ? reject({
isCanceled: true
}) : reject(error));
});
return [wrappedPromise, function cancel() {
hasCanceled = true;
}];
}
function getIn(obj, key, def, p) {
if (p === void 0) { p = 0; }
var path = toPath(key);
while (obj && p < path.length) {
obj = obj[path[p++]];
}
return obj === undefined ? def : obj;
function getIn(obj, key, def, p = 0) {
const path = toPath(key);
while (obj && p < path.length) {
obj = obj[path[p++]];
}
return obj === undefined ? def : obj;
}
function setIn(obj, path, value) {
var res = clone(obj);
var resVal = res;
var i = 0;
var pathArray = toPath(path);
for (; i < pathArray.length - 1; i++) {
var currentPath = pathArray[i];
var currentObj = getIn(obj, pathArray.slice(0, i + 1));
if (currentObj) {
resVal = resVal[currentPath] = clone(currentObj);
}
else {
var nextPath = pathArray[i + 1];
resVal = resVal[currentPath] =
isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};
}
let res = clone(obj);
let resVal = res;
let i = 0;
let pathArray = toPath(path);
for (; i < pathArray.length - 1; i++) {
const currentPath = pathArray[i];
let currentObj = getIn(obj, pathArray.slice(0, i + 1));
if (currentObj) {
resVal = resVal[currentPath] = clone(currentObj);
} else {
const nextPath = pathArray[i + 1];
resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};
}
if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {
return obj;
}
if (value === undefined) {
delete resVal[pathArray[i]];
}
else {
resVal[pathArray[i]] = value;
}
if (i === 0 && value === undefined) {
delete res[pathArray[i]];
}
return res;
}
if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {
return obj;
}
if (value === undefined) {
delete resVal[pathArray[i]];
} else {
resVal[pathArray[i]] = value;
}
if (i === 0 && value === undefined) {
delete res[pathArray[i]];
}
return res;
}
function setNestedObjectValues(object, value, visited, response) {
if (visited === void 0) { visited = new WeakMap(); }
if (response === void 0) { response = {}; }
for (var _i = 0, _a = Object.keys(object); _i < _a.length; _i++) {
var k = _a[_i];
var val = object[k];
if (isObject(val)) {
if (!visited.get(val)) {
visited.set(val, true);
response[k] = Array.isArray(val) ? [] : {};
setNestedObjectValues(val, value, visited, response[k]);
}
}
else {
response[k] = value;
}
function setNestedObjectValues(object, value, visited = new WeakMap(), response = {}) {
for (let k of Object.keys(object)) {
const val = object[k];
if (isObject(val)) {
if (!visited.get(val)) {
visited.set(val, true);
response[k] = Array.isArray(val) ? [] : {};
setNestedObjectValues(val, value, visited, response[k]);
}
} else {
response[k] = value;
}
return response;
}
return response;
}
var PrivateFormikContext = React.createContext({});
var FormikProvider = PrivateFormikContext.Provider;
var FormikConsumer = PrivateFormikContext.Consumer;
const PrivateFormikContext =
/*#__PURE__*/
React.createContext({});
const FormikProvider = PrivateFormikContext.Provider;
const FormikConsumer = PrivateFormikContext.Consumer;
function useFormikContext() {
return React.useContext(PrivateFormikContext);
return React.useContext(PrivateFormikContext);
}
function formikReducer(state, msg) {
switch (msg.type) {
case 'SET_VALUES':
return tslib_1.__assign({}, state, { values: msg.payload });
case 'SET_TOUCHED':
return tslib_1.__assign({}, state, { touched: msg.payload });
case 'SET_ERRORS':
return tslib_1.__assign({}, state, { errors: msg.payload });
case 'SET_STATUS':
return tslib_1.__assign({}, state, { status: msg.payload });
case 'SET_ISSUBMITTING':
return tslib_1.__assign({}, state, { isSubmitting: msg.payload });
case 'SET_ISVALIDATING':
return tslib_1.__assign({}, state, { isValidating: msg.payload });
case 'SET_FIELD_VALUE':
return tslib_1.__assign({}, state, { values: setIn(state.values, msg.payload.field, msg.payload.value) });
case 'SET_FIELD_TOUCHED':
return tslib_1.__assign({}, state, { touched: setIn(state.touched, msg.payload.field, msg.payload.value) });
case 'SET_FIELD_ERROR':
return tslib_1.__assign({}, state, { errors: setIn(state.errors, msg.payload.field, msg.payload.value) });
case 'RESET_FORM':
case 'SET_FORMIK_STATE':
return tslib_1.__assign({}, state, msg.payload);
case 'SUBMIT_ATTEMPT':
return tslib_1.__assign({}, state, { touched: setNestedObjectValues(state.values, true), isSubmitting: true, submitCount: state.submitCount + 1 });
case 'SUBMIT_FAILURE':
return tslib_1.__assign({}, state, { isSubmitting: false });
case 'SUBMIT_SUCCESS':
return tslib_1.__assign({}, state, { isSubmitting: false });
default:
return state;
}
switch (msg.type) {
case 'SET_VALUES':
return { ...state,
values: msg.payload
};
case 'SET_TOUCHED':
return { ...state,
touched: msg.payload
};
case 'SET_ERRORS':
return { ...state,
errors: msg.payload
};
case 'SET_STATUS':
return { ...state,
status: msg.payload
};
case 'SET_ISSUBMITTING':
return { ...state,
isSubmitting: msg.payload
};
case 'SET_ISVALIDATING':
return { ...state,
isValidating: msg.payload
};
case 'SET_FIELD_VALUE':
return { ...state,
values: setIn(state.values, msg.payload.field, msg.payload.value)
};
case 'SET_FIELD_TOUCHED':
return { ...state,
touched: setIn(state.touched, msg.payload.field, msg.payload.value)
};
case 'SET_FIELD_ERROR':
return { ...state,
errors: setIn(state.errors, msg.payload.field, msg.payload.value)
};
case 'RESET_FORM':
case 'SET_FORMIK_STATE':
return { ...state,
...msg.payload
};
case 'SUBMIT_ATTEMPT':
return { ...state,
touched: setNestedObjectValues(state.values, true),
isSubmitting: true,
submitCount: state.submitCount + 1
};
case 'SUBMIT_FAILURE':
return { ...state,
isSubmitting: false
};
case 'SUBMIT_SUCCESS':
return { ...state,
isSubmitting: false
};
default:
return state;
}
}
function usePrevious(val) {
var ref = React.useRef(val);
React.useEffect(function () {
ref.current = val;
}, [val]);
return ref.current;
const ref = React.useRef(val);
React.useEffect(() => {
ref.current = val;
}, [val]);
return ref.current;
}
function useFormik(_a) {
var _b = _a.validateOnChange, validateOnChange = _b === void 0 ? true : _b, _c = _a.validateOnBlur, validateOnBlur = _c === void 0 ? true : _c, isInitialValid = _a.isInitialValid, _d = _a.enableReinitialize, enableReinitialize = _d === void 0 ? false : _d, onSubmit = _a.onSubmit, rest = tslib_1.__rest(_a, ["validateOnChange", "validateOnBlur", "isInitialValid", "enableReinitialize", "onSubmit"]);
var props = tslib_1.__assign({ validateOnChange: validateOnChange, validateOnBlur: validateOnBlur, onSubmit: onSubmit }, rest);
var initialValues = React.useRef(props.initialValues);
var initialErrors = React.useRef(props.initialErrors || {});
var initialTouched = React.useRef(props.initialTouched || {});
var initialStatus = React.useRef(props.initialStatus);
var isMounted = React.useRef(false);
var fields = React.useRef({});
React.useEffect(function () {
{
invariant(typeof isInitialValid === 'undefined', 'isInitialValid has been deprecated and will be removed in future versions of Formik. Please use initialErrors instead.');
function useFormik({
validateOnChange = true,
validateOnBlur = true,
isInitialValid,
enableReinitialize = false,
onSubmit,
...rest
}) {
const props = {
validateOnChange,
validateOnBlur,
onSubmit,
...rest
};
const initialValues = React.useRef(props.initialValues);
const initialErrors = React.useRef(props.initialErrors || {});
const initialTouched = React.useRef(props.initialTouched || {});
const initialStatus = React.useRef(props.initialStatus);
const isMounted = React.useRef(false);
const fields = React.useRef({});
React.useEffect(() => {
{
!(typeof isInitialValid === 'undefined') ? invariant(false, 'isInitialValid has been deprecated and will be removed in future versions of Formik. Please use initialErrors instead.') : void 0;
}
}, [isInitialValid]);
React.useEffect(() => {
isMounted.current = true;
return () => {
isMounted.current = false;
};
}, []);
const [state, dispatch] = React.useReducer(formikReducer, {
values: props.initialValues,
errors: props.initialErrors || {},
touched: props.initialTouched || {},
status: props.initialStatus,
isSubmitting: false,
isValidating: false,
submitCount: 0
});
const prevState = usePrevious(state);
const runValidateHandler = React.useCallback((values, field) => {
return new Promise(resolve => {
const maybePromisedErrors = props.validate(values, field);
if (maybePromisedErrors === undefined) {
resolve({});
} else if (isPromise(maybePromisedErrors)) {
maybePromisedErrors.then(() => {
resolve({});
}, errors => {
resolve(errors);
});
} else {
resolve(maybePromisedErrors);
}
});
}, [props.validate]);
const runValidationSchema = React.useCallback((values, field) => {
return new Promise(resolve => {
const validationSchema = props.validationSchema;
const schema = isFunction(validationSchema) ? validationSchema(field) : validationSchema;
let promise = field && schema.validateAt ? schema.validateAt(field, values) : validateYupSchema(values, schema);
promise.then(() => {
resolve({});
}, err => {
resolve(yupToFormErrors(err));
});
});
}, [props.validationSchema]);
const runSingleFieldLevelValidation = React.useCallback((field, value) => {
return new Promise(resolve => resolve(fields.current[field].validate(value))).then(x => x, e => e);
}, [fields]);
const runFieldLevelValidations = React.useCallback(values => {
if (fields.current === null) {
return Promise.resolve({});
}
const fieldKeysWithValidation = Object.keys(fields.current).filter(f => fields.current !== null && fields.current[f] && fields.current[f].validate && isFunction(fields.current[f].validate));
const fieldValidations = fieldKeysWithValidation.length > 0 ? fieldKeysWithValidation.map(f => runSingleFieldLevelValidation(f, getIn(values, f))) : [Promise.resolve('DO_NOT_DELETE_YOU_WILL_BE_FIRED')];
return Promise.all(fieldValidations).then(fieldErrorsList => fieldErrorsList.reduce((prev, curr, index) => {
if (curr === 'DO_NOT_DELETE_YOU_WILL_BE_FIRED') {
return prev;
}
if (curr) {
prev = setIn(prev, fieldKeysWithValidation[index], curr);
}
return prev;
}, {}));
}, [runSingleFieldLevelValidation, fields]);
const validateForm = React.useCallback((values = state.values) => {
if (props.validationSchema || props.validate || fields.current && Object.keys(fields.current).filter(key => !!fields.current[key].validate).length > 0) {
dispatch({
type: 'SET_ISVALIDATING',
payload: true
});
return Promise.all([runFieldLevelValidations(values), props.validationSchema ? runValidationSchema(values) : {}, props.validate ? runValidateHandler(values) : {}]).then(([fieldErrors, schemaErrors, validateErrors]) => {
const combinedErrors = deepmerge.all([fieldErrors, schemaErrors, validateErrors], {
arrayMerge
});
if (!isEqual(state.errors, combinedErrors)) {
dispatch({
type: 'SET_ERRORS',
payload: combinedErrors
});
}
}, [isInitialValid]);
React.useEffect(function () {
isMounted.current = true;
return function () {
isMounted.current = false;
};
}, []);
var _e = React.useReducer(formikReducer, {
values: props.initialValues,
errors: props.initialErrors || {},
touched: props.initialTouched || {},
status: props.initialStatus,
isSubmitting: false,
isValidating: false,
submitCount: 0,
}), state = _e[0], dispatch = _e[1];
var prevState = usePrevious(state);
var runValidateHandler = React.useCallback(function (values, field) {
return new Promise(function (resolve) {
var maybePromisedErrors = props.validate(values, field);
if (maybePromisedErrors === undefined) {
resolve({});
dispatch({
type: 'SET_ISVALIDATING',
payload: false
});
return combinedErrors;
});
} else {
return Promise.resolve({});
}
}, [props.validate, props.validationSchema, runFieldLevelValidations, runValidateHandler, runValidationSchema, state.errors, state.values, fields]);
React.useEffect(() => {
if (prevState.values !== state.values && !!validateOnChange && !state.isSubmitting && isMounted.current != null) {
const [validate, cancel] = makeCancelable(validateForm());
validate.then(x => x).catch(x => x);
return cancel;
}
return;
}, [prevState.values, state.isSubmitting, state.values, validateForm, validateOnChange, isMounted]);
React.useEffect(() => {
if (prevState.touched !== state.touched && !!validateOnBlur && !state.isSubmitting && isMounted.current != null) {
const [validate, cancel] = makeCancelable(validateForm());
validate.then(x => x).catch(x => x);
return cancel;
}
return;
}, [prevState.touched, state.isSubmitting, state.touched, validateForm, validateOnBlur, isMounted]);
const resetForm = React.useCallback(nextState => {
const values = nextState && nextState.values ? nextState.values : initialValues.current ? initialValues.current : props.initialValues;
const errors = nextState && nextState.errors ? nextState.values : initialErrors.current ? initialErrors.current : props.initialErrors || {};
const touched = nextState && nextState.touched ? nextState.values : initialTouched.current ? initialTouched.current : props.initialTouched || {};
const status = nextState && nextState.status ? nextState.status : initialStatus.current ? initialStatus.current : props.initialStatus;
initialValues.current = values;
initialErrors.current = errors;
initialTouched.current = touched;
initialStatus.current = status;
dispatch({
type: 'RESET_FORM',
payload: {
isSubmitting: !!nextState && !!nextState.isSubmitting,
errors,
touched,
status,
values,
isValidating: !!nextState && !!nextState.isValidating,
submitCount: !!nextState && !!nextState.submitCount && typeof nextState.submitCount === 'number' ? nextState.submitCount : 0
}
});
}, [props.initialErrors, props.initialStatus, props.initialTouched, props.initialValues]);
React.useEffect(() => {
if (enableReinitialize && isMounted.current && !isEqual(initialValues.current, props.initialValues)) {
resetForm();
}
}, [enableReinitialize, props.initialValues, resetForm]);
const validateField = React.useCallback(name => {
if (fields.current !== null && fields.current[name] && fields.current[name].validate && isFunction(fields.current[name].validate)) {
const value = getIn(state.values, name);
const maybePromise = fields.current[name].validate(value);
if (isPromise(maybePromise)) {
dispatch({
type: 'SET_ISVALIDATING',
payload: true
});
return maybePromise.then(x => x, e => e).then(error => {
dispatch({
type: 'SET_FIELD_ERROR',
payload: {
field: name,
value: error
}
else if (isPromise(maybePromisedErrors)) {
maybePromisedErrors.then(function () {
resolve({});
}, function (errors) {
resolve(errors);
});
}
else {
resolve(maybePromisedErrors);
}
});
dispatch({
type: 'SET_ISVALIDATING',
payload: false
});
});
}, [props.validate]);
var runValidationSchema = React.useCallback(function (values, field) {
return new Promise(function (resolve) {
var validationSchema = props.validationSchema;
var schema = isFunction(validationSchema)
? validationSchema(field)
: validationSchema;
var promise = field && schema.validateAt
? schema.validateAt(field, values)
: validateYupSchema(values, schema);
promise.then(function () {
resolve({});
}, function (err) {
resolve(yupToFormErrors(err));
});
} else {
dispatch({
type: 'SET_FIELD_ERROR',
payload: {
field: name,
value: maybePromise
}
});
}, [props.validationSchema]);
var runSingleFieldLevelValidation = React.useCallback(function (field, value) {
return new Promise(function (resolve) {
return resolve(fields.current[field].validate(value));
}).then(function (x) { return x; }, function (e) { return e; });
}, [fields]);
var runFieldLevelValidations = React.useCallback(function (values) {
if (fields.current === null) {
return Promise.resolve({});
}
var fieldKeysWithValidation = Object.keys(fields.current).filter(function (f) {
return fields.current !== null &&
fields.current[f] &&
fields.current[f].validate &&
isFunction(fields.current[f].validate);
return Promise.resolve(maybePromise);
}
} else {
return Promise.resolve();
}
}, [state.values, fields]);
const registerField = React.useCallback((name, {
validate
}) => {
if (fields.current !== null) {
fields.current[name] = {
validate
};
}
}, [fields]);
const unregisterField = React.useCallback(name => {
if (fields.current !== null) {
delete fields.current[name];
}
}, [fields]);
const handleBlur = React.useCallback(eventOrString => {
if (isString(eventOrString)) {
return event => executeBlur(event, eventOrString);
} else {
executeBlur(eventOrString);
}
function executeBlur(e, path) {
if (e.persist) {
e.persist();
}
const {
name,
id,
outerHTML
} = e.target;
const field = path ? path : name ? name : id;
if (!field && "development" !== 'production') {
warnAboutMissingIdentifier({
htmlContent: outerHTML,
documentationAnchorLink: 'handleblur-e-any--void',
handlerName: 'handleBlur'
});
var fieldValidations = fieldKeysWithValidation.length > 0
? fieldKeysWithValidation.map(function (f) {
return runSingleFieldLevelValidation(f, getIn(values, f));
})
: [Promise.resolve('DO_NOT_DELETE_YOU_WILL_BE_FIRED')];
return Promise.all(fieldValidations).then(function (fieldErrorsList) {
return fieldErrorsList.reduce(function (prev, curr, index) {
if (curr === 'DO_NOT_DELETE_YOU_WILL_BE_FIRED') {
return prev;
}
if (curr) {
prev = setIn(prev, fieldKeysWithValidation[index], curr);
}
return prev;
}, {});
});
}, [runSingleFieldLevelValidation, fields]);
var validateForm = React.useCallback(function (values) {
if (values === void 0) { values = state.values; }
if (props.validationSchema ||
props.validate ||
(fields.current &&
Object.keys(fields.current).filter(function (key) { return !!fields.current[key].validate; }).length > 0)) {
dispatch({ type: 'SET_ISVALIDATING', payload: true });
return Promise.all([
runFieldLevelValidations(values),
props.validationSchema ? runValidationSchema(values) : {},
props.validate ? runValidateHandler(values) : {},
]).then(function (_a) {
var fieldErrors = _a[0], schemaErrors = _a[1], validateErrors = _a[2];
var combinedErrors = deepmerge.all([fieldErrors, schemaErrors, validateErrors], { arrayMerge: arrayMerge });
if (!isEqual(state.errors, combinedErrors)) {
dispatch({ type: 'SET_ERRORS', payload: combinedErrors });
}
dispatch({ type: 'SET_ISVALIDATING', payload: false });
return combinedErrors;
});
}
dispatch({
type: 'SET_FIELD_TOUCHED',
payload: {
field,
value: true
}
else {
return Promise.resolve({});
});
}
}, []);
const handleChange = React.useCallback(eventOrPath => {
if (isString(eventOrPath)) {
return event => executeChange(event, eventOrPath);
} else {
executeChange(eventOrPath);
}
function executeChange(eventOrTextValue, maybePath) {
let field = maybePath;
let val = eventOrTextValue;
let parsed;
if (!isString(eventOrTextValue)) {
if (eventOrTextValue.persist) {
eventOrTextValue.persist();
}
}, [
props.validate,
props.validationSchema,
runFieldLevelValidations,
runValidateHandler,
runValidationSchema,
state.errors,
state.values,
fields,
]);
React.useEffect(function () {
if (prevState.values !== state.values &&
!!validateOnChange &&
!state.isSubmitting &&
isMounted.current != null) {
var _a = makeCancelable(validateForm()), validate = _a[0], cancel = _a[1];
validate.then(function (x) { return x; }).catch(function (x) { return x; });
return cancel;
const {
type,
name,
id,
value,
checked,
outerHTML
} = eventOrTextValue.target;
field = maybePath ? maybePath : name ? name : id;
if (!field && "development" !== 'production') {
warnAboutMissingIdentifier({
htmlContent: outerHTML,
documentationAnchorLink: 'handlechange-e-reactchangeeventany--void',
handlerName: 'handleChange'
});
}
return;
}, [
prevState.values,
state.isSubmitting,
state.values,
validateForm,
validateOnChange,
isMounted,
]);
React.useEffect(function () {
if (prevState.touched !== state.touched &&
!!validateOnBlur &&
!state.isSubmitting &&
isMounted.current != null) {
var _a = makeCancelable(validateForm()), validate = _a[0], cancel = _a[1];
validate.then(function (x) { return x; }).catch(function (x) { return x; });
return cancel;
}
return;
}, [
prevState.touched,
state.isSubmitting,
state.touched,
validateForm,
validateOnBlur,
isMounted,
]);
var resetForm = React.useCallback(function (nextState) {
var values = nextState && nextState.values
? nextState.values
: initialValues.current
? initialValues.current
: props.initialValues;
var errors = nextState && nextState.errors
? nextState.values
: initialErrors.current
? initialErrors.current
: props.initialErrors || {};
var touched = nextState && nextState.touched
? nextState.values
: initialTouched.current
? initialTouched.current
: props.initialTouched || {};
var status = nextState && nextState.status
? nextState.status
: initialStatus.current
? initialStatus.current
: props.initialStatus;
initialValues.current = values;
initialErrors.current = errors;
initialTouched.current = touched;
initialStatus.current = status;
val = /number|range/.test(type) ? (parsed = parseFloat(value), isNaN(parsed) ? '' : parsed) : /checkbox/.test(type) ? checked : value;
}
if (field) {
dispatch({
type: 'RESET_FORM',
payload: {
isSubmitting: !!nextState && !!nextState.isSubmitting,
errors: errors,
touched: touched,
status: status,
values: values,
isValidating: !!nextState && !!nextState.isValidating,
submitCount: !!nextState &&
!!nextState.submitCount &&
typeof nextState.submitCount === 'number'
? nextState.submitCount
: 0,
},
type: 'SET_FIELD_VALUE',
payload: {
field,
value: val
}
});
}, [
props.initialErrors,
props.initialStatus,
props.initialTouched,
props.initialValues,
]);
React.useEffect(function () {
if (enableReinitialize &&
isMounted.current &&
!isEqual(initialValues.current, props.initialValues)) {
resetForm();
}
}, [enableReinitialize, props.initialValues, resetForm]);
var validateField = React.useCallback(function (name) {
if (fields.current !== null &&
fields.current[name] &&
fields.current[name].validate &&
isFunction(fields.current[name].validate)) {
var value = getIn(state.values, name);
var maybePromise = fields.current[name].validate(value);
if (isPromise(maybePromise)) {
dispatch({ type: 'SET_ISVALIDATING', payload: true });
return maybePromise
.then(function (x) { return x; }, function (e) { return e; })
.then(function (error) {
dispatch({
type: 'SET_FIELD_ERROR',
payload: { field: name, value: error },
});
dispatch({ type: 'SET_ISVALIDATING', payload: false });
});
}
else {
dispatch({
type: 'SET_FIELD_ERROR',
payload: {
field: name,
value: maybePromise,
},
});
return Promise.resolve(maybePromise);
}
}
else {
return Promise.resolve();
}
}, [state.values, fields]);
var registerField = React.useCallback(function (name, _a) {
var validate = _a.validate;
if (fields.current !== null) {
fields.current[name] = {
validate: validate,
};
}
}, [fields]);
var unregisterField = React.useCallback(function (name) {
if (fields.current !== null) {
delete fields.current[name];
}
}, [fields]);
var handleBlur = React.useCallback(function (eventOrString) {
if (isString(eventOrString)) {
return function (event) { return executeBlur(event, eventOrString); };
}
else {
executeBlur(eventOrString);
}
function executeBlur(e, path) {
if (e.persist) {
e.persist();
}
var _a = e.target, name = _a.name, id = _a.id, outerHTML = _a.outerHTML;
var field = path ? path : name ? name : id;
if (!field && "development" !== 'production') {
warnAboutMissingIdentifier({
htmlContent: outerHTML,
documentationAnchorLink: 'handleblur-e-any--void',
handlerName: 'handleBlur',
});
}
}
}
}, []);
const setTouched = React.useCallback(touched => {
dispatch({
type: 'SET_TOUCHED',
payload: touched
});
}, []);
const setErrors = React.useCallback(errors => {
dispatch({
type: 'SET_ERRORS',
payload: errors
});
}, []);
const setValues = React.useCallback(values => {
dispatch({
type: 'SET_VALUES',
payload: values
});
}, []);
const setFieldError = React.useCallback((field, value) => {
dispatch({
type: 'SET_FIELD_ERROR',
payload: {
field,
value
}
});
}, []);
const setFieldValue = React.useCallback((field, value) => {
dispatch({
type: 'SET_FIELD_VALUE',
payload: {
field,
value
}
});
}, []);
const setFieldTouched = React.useCallback((field, touched = true) => {
dispatch({
type: 'SET_FIELD_TOUCHED',
payload: {
field,
value: touched
}
});
}, []);
function setFormikState(stateOrCb) {
if (isFunction(stateOrCb)) {
dispatch({
type: 'SET_FORMIK_STATE',
payload: stateOrCb(state)
});
} else {
dispatch({
type: 'SET_FORMIK_STATE',
payload: stateOrCb
});
}
}
const setStatus = React.useCallback(status => {
dispatch({
type: 'SET_STATUS',
payload: status
});
}, []);
const setSubmitting = React.useCallback(isSubmitting => {
dispatch({
type: 'SET_ISSUBMITTING',
payload: isSubmitting
});
}, []);
const imperativeMethods = {
resetForm,
validateForm,
validateField,
setErrors,
setFieldError,
setFieldTouched,
setFieldValue,
setStatus,
setSubmitting,
setTouched,
setValues,
setFormikState
};
const executeSubmit = React.useCallback(() => {
return onSubmit(state.values, imperativeMethods);
}, [imperativeMethods, onSubmit, state.values]);
const submitForm = React.useCallback(() => {
dispatch({
type: 'SUBMIT_ATTEMPT'
});
return validateForm().then(combinedErrors => {
const isActuallyValid = Object.keys(combinedErrors).length === 0;
if (isActuallyValid) {
Promise.resolve(executeSubmit()).then(() => {
if (isMounted.current) {
dispatch({
type: 'SET_FIELD_TOUCHED',
payload: { field: field, value: true },
type: 'SUBMIT_SUCCESS'
});
}
}, []);
var handleChange = React.useCallback(function (eventOrPath) {
if (isString(eventOrPath)) {
return function (event) { return executeChange(event, eventOrPath); };
}
else {
executeChange(eventOrPath);
}
function executeChange(eventOrTextValue, maybePath) {
var field = maybePath;
var val = eventOrTextValue;
var parsed;
if (!isString(eventOrTextValue)) {
if (eventOrTextValue.persist) {
eventOrTextValue.persist();
}
var _a = eventOrTextValue.target, type = _a.type, name_1 = _a.name, id = _a.id, value = _a.value, checked = _a.checked, outerHTML = _a.outerHTML;
field = maybePath ? maybePath : name_1 ? name_1 : id;
if (!field && "development" !== 'production') {
warnAboutMissingIdentifier({
htmlContent: outerHTML,
documentationAnchorLink: 'handlechange-e-reactchangeeventany--void',
handlerName: 'handleChange',
});
}
val = /number|range/.test(type)
? ((parsed = parseFloat(value)), isNaN(parsed) ? '' : parsed)
: /checkbox/.test(type)
? checked
: value;
}
if (field) {
dispatch({ type: 'SET_FIELD_VALUE', payload: { field: field, value: val } });
}
}
}, []);
var setTouched = React.useCallback(function (touched) {
dispatch({ type: 'SET_TOUCHED', payload: touched });
}, []);
var setErrors = React.useCallback(function (errors) {
dispatch({ type: 'SET_ERRORS', payload: errors });
}, []);
var setValues = React.useCallback(function (values) {
dispatch({ type: 'SET_VALUES', payload: values });
}, []);
var setFieldError = React.useCallback(function (field, value) {
dispatch({
type: 'SET_FIELD_ERROR',
payload: { field: field, value: value },
}
}).catch(_errors => {
if (isMounted.current) {
dispatch({
type: 'SUBMIT_FAILURE'
});
}
});
}, []);
var setFieldValue = React.useCallback(function (field, value) {
} else if (isMounted.current) {
dispatch({
type: 'SET_FIELD_VALUE',
payload: {
field: field,
value: value,
},
type: 'SUBMIT_FAILURE'
});
}, []);
var setFieldTouched = React.useCallback(function (field, touched) {
if (touched === void 0) { touched = true; }
dispatch({
type: 'SET_FIELD_TOUCHED',
payload: {
field: field,
value: touched,
},
});
}, []);
function setFormikState(stateOrCb) {
if (isFunction(stateOrCb)) {
dispatch({ type: 'SET_FORMIK_STATE', payload: stateOrCb(state) });
}
else {
dispatch({ type: 'SET_FORMIK_STATE', payload: stateOrCb });
}
}
});
}, [executeSubmit, validateForm]);
const handleSubmit = React.useCallback(e => {
if (e && e.preventDefault && isFunction(e.preventDefault)) {
e.preventDefault();
}
var setStatus = React.useCallback(function (status) {
dispatch({ type: 'SET_STATUS', payload: status });
}, []);
var setSubmitting = React.useCallback(function (isSubmitting) {
dispatch({ type: 'SET_ISSUBMITTING', payload: isSubmitting });
}, []);
var imperativeMethods = {
resetForm: resetForm,
validateForm: validateForm,
validateField: validateField,
setErrors: setErrors,
setFieldError: setFieldError,
setFieldTouched: setFieldTouched,
setFieldValue: setFieldValue,
setStatus: setStatus,
setSubmitting: setSubmitting,
setTouched: setTouched,
setValues: setValues,
setFormikState: setFormikState,
if (e && e.stopPropagation && isFunction(e.stopPropagation)) {
e.stopPropagation();
}
if (typeof document !== 'undefined') {
const activeElement = getActiveElement();
if (activeElement !== null && activeElement instanceof HTMLButtonElement) {
!(activeElement.attributes && activeElement.attributes.getNamedItem('type')) ? 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"`.') : void 0;
}
}
submitForm();
}, [submitForm]);
const handleReset = React.useCallback(() => {
if (props.onReset) {
const maybePromisedOnReset = props.onReset(state.values, imperativeMethods);
if (isPromise(maybePromisedOnReset)) {
maybePromisedOnReset.then(resetForm);
} else {
resetForm();
}
} else {
resetForm();
}
}, [imperativeMethods, props.onReset, resetForm, state.values]);
const getFieldMeta = React.useCallback(name => {
return {
value: getIn(state.values, name),
error: getIn(state.errors, name),
touched: !!getIn(state.touched, name),
initialValue: getIn(initialValues.current, name),
initialTouched: !!getIn(initialTouched.current, name),
initialError: getIn(initialErrors.current, name)
};
var executeSubmit = React.useCallback(function () {
return onSubmit(state.values, imperativeMethods);
}, [imperativeMethods, onSubmit, state.values]);
var submitForm = React.useCallback(function () {
dispatch({ type: 'SUBMIT_ATTEMPT' });
return validateForm().then(function (combinedErrors) {
var isActuallyValid = Object.keys(combinedErrors).length === 0;
if (isActuallyValid) {
Promise.resolve(executeSubmit())
.then(function () {
if (isMounted.current) {
dispatch({ type: 'SUBMIT_SUCCESS' });
}
})
.catch(function (_errors) {
if (isMounted.current) {
dispatch({ type: 'SUBMIT_FAILURE' });
}
});
}
else if (isMounted.current) {
dispatch({ type: 'SUBMIT_FAILURE' });
}
});
}, [executeSubmit, validateForm]);
var handleSubmit = React.useCallback(function (e) {
if (e && e.preventDefault && isFunction(e.preventDefault)) {
e.preventDefault();
}
if (e && e.stopPropagation && isFunction(e.stopPropagation)) {
e.stopPropagation();
}
if (typeof document !== 'undefined') {
var activeElement = getActiveElement();
if (activeElement !== null &&
activeElement instanceof HTMLButtonElement) {
invariant(activeElement.attributes &&
activeElement.attributes.getNamedItem('type'), '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"`.');
}
}
submitForm();
}, [submitForm]);
var handleReset = React.useCallback(function () {
if (props.onReset) {
var maybePromisedOnReset = props.onReset(state.values, imperativeMethods);
if (isPromise(maybePromisedOnReset)) {
maybePromisedOnReset.then(resetForm);
}
else {
resetForm();
}
}
else {
resetForm();
}
}, [imperativeMethods, props.onReset, resetForm, state.values]);
var getFieldMeta = React.useCallback(function (name) {
return {
value: getIn(state.values, name),
error: getIn(state.errors, name),
touched: !!getIn(state.touched, name),
initialValue: getIn(initialValues.current, name),
initialTouched: !!getIn(initialTouched.current, name),
initialError: getIn(initialErrors.current, name),
};
}, [state.errors, state.touched, state.values]);
var getFieldProps = React.useCallback(function (name, type) {
var field = {
name: name,
value: type && (type === 'radio' || type === 'checkbox')
? undefined
: getIn(state.values, name),
onChange: handleChange,
onBlur: handleBlur,
};
return [field, getFieldMeta(name)];
}, [getFieldMeta, handleBlur, handleChange, state.values]);
var dirty = React.useMemo(function () { return !isEqual(initialValues.current, state.values); }, [state.values]);
var isValid = React.useMemo(function () {
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;
}, [isInitialValid, dirty, state.errors, props]);
var ctx = tslib_1.__assign({}, state, { initialValues: initialValues.current, initialErrors: initialErrors.current, initialTouched: initialTouched.current, initialStatus: initialStatus.current, handleBlur: handleBlur,
handleChange: handleChange,
handleReset: handleReset,
handleSubmit: handleSubmit,
resetForm: resetForm,
setErrors: setErrors,
setFormikState: setFormikState,
setFieldTouched: setFieldTouched,
setFieldValue: setFieldValue,
setFieldError: setFieldError,
setStatus: setStatus,
setSubmitting: setSubmitting,
setTouched: setTouched,
setValues: setValues,
submitForm: submitForm,
validateForm: validateForm,
validateField: validateField,
isValid: isValid,
dirty: dirty,
unregisterField: unregisterField,
registerField: registerField,
getFieldProps: getFieldProps,
validateOnBlur: validateOnBlur,
validateOnChange: validateOnChange });
return ctx;
}, [state.errors, state.touched, state.values]);
const getFieldProps = React.useCallback((name, type) => {
const field = {
name,
value: type && (type === 'radio' || type === 'checkbox') ? undefined : getIn(state.values, name),
onChange: handleChange,
onBlur: handleBlur
};
return [field, getFieldMeta(name)];
}, [getFieldMeta, handleBlur, handleChange, state.values]);
const dirty = React.useMemo(() => !isEqual(initialValues.current, state.values), [state.values]);
const isValid = React.useMemo(() => 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, [isInitialValid, dirty, state.errors, props]);
const ctx = { ...state,
initialValues: initialValues.current,
initialErrors: initialErrors.current,
initialTouched: initialTouched.current,
initialStatus: initialStatus.current,
handleBlur,
handleChange,
handleReset,
handleSubmit,
resetForm,
setErrors,
setFormikState,
setFieldTouched,
setFieldValue,
setFieldError,
setStatus,
setSubmitting,
setTouched,
setValues,
submitForm,
validateForm,
validateField,
isValid,
dirty,
unregisterField,
registerField,
getFieldProps,
validateOnBlur,
validateOnChange
};
return ctx;
}
function Formik(props) {
var formikbag = useFormik(props);
var component = props.component, children = props.children, render = props.render;
return (React.createElement(FormikProvider, { value: formikbag }, component
? React.createElement(component, formikbag)
: render
? render(formikbag)
: children
? isFunction(children)
? children(formikbag)
: !isEmptyChildren(children)
? React.Children.only(children)
: null
: null));
const formikbag = useFormik(props);
const {
component,
children,
render
} = props;
return React.createElement(FormikProvider, {
value: formikbag
}, component ? React.createElement(component, formikbag) : render ? render(formikbag) : children ? isFunction(children) ? children(formikbag) : !isEmptyChildren(children) ? React.Children.only(children) : null : null);
}
function warnAboutMissingIdentifier(_a) {
var htmlContent = _a.htmlContent, documentationAnchorLink = _a.documentationAnchorLink, handlerName = _a.handlerName;
console.warn("Warning: Formik called `" + handlerName + "`, but you forgot to pass an `id` or `name` attribute to your input:\n " + htmlContent + "\n Formik cannot determine which value to update. For more info see https://github.com/jaredpalmer/formik#" + documentationAnchorLink + "\n ");
function warnAboutMissingIdentifier({
htmlContent,
documentationAnchorLink,
handlerName
}) {
console.warn(`Warning: Formik called \`${handlerName}\`, but you forgot to pass an \`id\` or \`name\` attribute to your input:
${htmlContent}
Formik cannot determine which value to update. For more info see https://github.com/jaredpalmer/formik#${documentationAnchorLink}
`);
}
function yupToFormErrors(yupError) {
var errors = {};
if (yupError.inner.length === 0) {
return setIn(errors, yupError.path, yupError.message);
let errors = {};
if (yupError.inner.length === 0) {
return setIn(errors, yupError.path, yupError.message);
}
for (let err of yupError.inner) {
if (!errors[err.path]) {
errors = setIn(errors, err.path, err.message);
}
for (var _i = 0, _a = yupError.inner; _i < _a.length; _i++) {
var err = _a[_i];
if (!errors[err.path]) {
errors = setIn(errors, err.path, err.message);
}
}
return errors;
}
return errors;
}
function validateYupSchema(values, schema, sync, context) {
if (sync === void 0) { sync = false; }
if (context === void 0) { context = {}; }
var validateData = {};
for (var k in values) {
if (values.hasOwnProperty(k)) {
var key = String(k);
validateData[key] = values[key] !== '' ? values[key] : undefined;
}
function validateYupSchema(values, schema, sync = false, context = {}) {
let validateData = {};
for (let k in values) {
if (values.hasOwnProperty(k)) {
const key = String(k);
validateData[key] = values[key] !== '' ? values[key] : undefined;
}
return schema[sync ? 'validateSync' : 'validate'](validateData, {
abortEarly: false,
context: context,
});
}
return schema[sync ? 'validateSync' : 'validate'](validateData, {
abortEarly: false,
context: context
});
}
function arrayMerge(target, source, options) {
var destination = target.slice();
source.forEach(function (e, i) {
if (typeof destination[i] === 'undefined') {
var cloneRequested = options.clone !== false;
var shouldClone = cloneRequested && options.isMergeableObject(e);
destination[i] = shouldClone
? deepmerge(Array.isArray(e) ? [] : {}, e, options)
: e;
}
else if (options.isMergeableObject(e)) {
destination[i] = deepmerge(target[i], e, options);
}
else if (target.indexOf(e) === -1) {
destination.push(e);
}
});
return destination;
const destination = target.slice();
source.forEach(function (e, i) {
if (typeof destination[i] === 'undefined') {
const cloneRequested = options.clone !== false;
const shouldClone = cloneRequested && options.isMergeableObject(e);
destination[i] = shouldClone ? deepmerge(Array.isArray(e) ? [] : {}, e, options) : e;
} else if (options.isMergeableObject(e)) {
destination[i] = deepmerge(target[i], e, options);
} else if (target.indexOf(e) === -1) {
destination.push(e);
}
});
return destination;
}
function useField(name, type) {
var formik = useFormikContext();
const formik = useFormikContext();
{
!formik ? invariant(false, 'useField() / <Field /> must be used underneath a <Formik> component or withFormik() higher order component') : void 0;
}
return formik.getFieldProps(name, type);
}
function Field({
validate,
name,
render,
children,
as: is = 'input',
component,
...props
}) {
const {
validate: _validate,
validationSchema: _validationSchema,
...formik
} = useFormikContext();
React.useEffect(() => {
{
invariant(formik, 'useField() / <Field /> must be used underneath a <Formik> component or withFormik() higher order component');
!!render ? 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>`) : void 0;
!!component ? invariant(false, '<Field component> has been deprecated and will be removed in future versions of Formik. Use <Field as> instead. Note that with the `as` prop, all props are passed directly through and not grouped in `field` object key.') : void 0;
!!(is && children && isFunction(children)) ? invariant(false, 'You should not use <Field as> and <Field children> as a function in the same <Field> component; <Field as> will be ignored.') : void 0;
!!(component && children && isFunction(children)) ? invariant(false, 'You should not use <Field component> and <Field children> as a function in the same <Field> component; <Field component> will be ignored.') : void 0;
!!(render && children && !isEmptyChildren(children)) ? invariant(false, 'You should not use <Field render> and <Field children> in the same <Field> component; <Field children> will be ignored') : void 0;
}
return formik.getFieldProps(name, type);
}
function Field(_a) {
var validate = _a.validate, name = _a.name, render = _a.render, children = _a.children, _b = _a.as, is = _b === void 0 ? 'input' : _b, component = _a.component, props = tslib_1.__rest(_a, ["validate", "name", "render", "children", "as", "component"]);
var _c = useFormikContext(), _validate = _c.validate, _validationSchema = _c.validationSchema, formik = tslib_1.__rest(_c, ["validate", "validationSchema"]);
React.useEffect(function () {
{
invariant(!render, "<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(!component, '<Field component> has been deprecated and will be removed in future versions of Formik. Use <Field as> instead. Note that with the `as` prop, all props are passed directly through and not grouped in `field` object key.');
invariant(!(is && children && isFunction(children)), 'You should not use <Field as> and <Field children> as a function in the same <Field> component; <Field as> will be ignored.');
invariant(!(component && children && isFunction(children)), 'You should not use <Field component> and <Field children> as a function in the same <Field> component; <Field component> will be ignored.');
invariant(!(render && children && !isEmptyChildren(children)), 'You should not use <Field render> and <Field children> in the same <Field> component; <Field children> will be ignored');
}
}, []);
React.useEffect(function () {
formik.registerField(name, {
validate: validate,
});
return function () {
formik.unregisterField(name);
};
}, [formik, name, validate]);
var _d = formik.getFieldProps(name, props.type), field = _d[0], meta = _d[1];
var legacyBag = { field: field, form: formik };
if (render) {
return render(legacyBag);
}, []);
React.useEffect(() => {
formik.registerField(name, {
validate: validate
});
return () => {
formik.unregisterField(name);
};
}, [formik, name, validate]);
const [field, meta] = formik.getFieldProps(name, props.type);
const legacyBag = {
field,
form: formik
};
if (render) {
return render(legacyBag);
}
if (isFunction(children)) {
return children({ ...legacyBag,
meta
});
}
if (component) {
if (typeof component === 'string') {
const {
innerRef,
...rest
} = props;
return React.createElement(component, {
ref: innerRef,
...field,
...rest
}, children);
}
if (isFunction(children)) {
return children(tslib_1.__assign({}, legacyBag, { meta: meta }));
}
if (component) {
if (typeof component === 'string') {
var innerRef = props.innerRef, rest = tslib_1.__rest(props, ["innerRef"]);
return React.createElement(component, tslib_1.__assign({ ref: innerRef }, field, rest), children);
}
return React.createElement(component, tslib_1.__assign({ field: field, form: formik }, props), children);
}
if (typeof is === 'string') {
var innerRef = props.innerRef, rest = tslib_1.__rest(props, ["innerRef"]);
return React.createElement(is, tslib_1.__assign({ ref: innerRef }, field, rest), children);
}
return React.createElement(is, tslib_1.__assign({}, field, props), children);
return React.createElement(component, {
field,
form: formik,
...props
}, children);
}
if (typeof is === 'string') {
const {
innerRef,
...rest
} = props;
return React.createElement(is, {
ref: innerRef,
...field,
...rest
}, children);
}
return React.createElement(is, { ...field,
...props
}, children);
}
var FastField = Field;
const FastField = Field;
function Form(props) {
var _a = useFormikContext(), handleReset = _a.handleReset, handleSubmit = _a.handleSubmit;
return React.createElement("form", tslib_1.__assign({ onSubmit: handleSubmit, onReset: handleReset }, props));
const {
handleReset,
handleSubmit
} = useFormikContext();
return React.createElement("form", Object.assign({
onSubmit: handleSubmit,
onReset: handleReset
}, props));
}
Form.displayName = 'Form';
function withFormik(_a) {
var _b = _a.mapPropsToValues, mapPropsToValues = _b === void 0 ? function (vanillaProps) {
var val = {};
for (var k in vanillaProps) {
if (vanillaProps.hasOwnProperty(k) &&
typeof vanillaProps[k] !== 'function') {
val[k] = vanillaProps[k];
}
}
return val;
} : _b, config = tslib_1.__rest(_a, ["mapPropsToValues"]);
return function createFormik(Component) {
var componentDisplayName = Component.displayName ||
Component.name ||
(Component.constructor && Component.constructor.name) ||
'Component';
var C = (function (_super) {
tslib_1.__extends(C, _super);
function C() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.validate = function (values) {
return config.validate(values, _this.props);
};
_this.validationSchema = function () {
return isFunction(config.validationSchema)
? config.validationSchema(_this.props)
: config.validationSchema;
};
_this.handleSubmit = function (values, actions) {
return config.handleSubmit(values, tslib_1.__assign({}, actions, { props: _this.props }));
};
_this.renderFormComponent = function (formikProps) {
return React.createElement(Component, tslib_1.__assign({}, _this.props, formikProps));
};
return _this;
}
C.prototype.render = function () {
var _a = this.props, children = _a.children, props = tslib_1.__rest(_a, ["children"]);
return (React.createElement(Formik, tslib_1.__assign({}, props, config, { validate: config.validate && this.validate, validationSchema: config.validationSchema && this.validationSchema, initialValues: mapPropsToValues(this.props), initialStatus: config.mapPropsToStatus && config.mapPropsToStatus(this.props), initialErrors: config.mapPropsToErrors && config.mapPropsToErrors(this.props), initialTouched: config.mapPropsToTouched && config.mapPropsToTouched(this.props), onSubmit: this.handleSubmit, render: this.renderFormComponent })));
};
C.displayName = "WithFormik(" + componentDisplayName + ")";
return C;
}(React.Component));
return hoistNonReactStatics(C, Component);
};
function withFormik({
mapPropsToValues = vanillaProps => {
let val = {};
for (let k in vanillaProps) {
if (vanillaProps.hasOwnProperty(k) && typeof vanillaProps[k] !== 'function') {
val[k] = vanillaProps[k];
}
}
return val;
},
...config
}) {
return function createFormik(Component) {
const componentDisplayName = Component.displayName || Component.name || Component.constructor && Component.constructor.name || 'Component';
class C extends React.Component {
constructor() {
super(...arguments);
this.validate = values => {
return config.validate(values, this.props);
};
this.validationSchema = () => {
return isFunction(config.validationSchema) ? config.validationSchema(this.props) : config.validationSchema;
};
this.handleSubmit = (values, actions) => {
return config.handleSubmit(values, { ...actions,
props: this.props
});
};
this.renderFormComponent = formikProps => {
return React.createElement(Component, Object.assign({}, this.props, formikProps));
};
}
render() {
const {
children,
...props
} = this.props;
return React.createElement(Formik, Object.assign({}, props, config, {
validate: config.validate && this.validate,
validationSchema: config.validationSchema && this.validationSchema,
initialValues: mapPropsToValues(this.props),
initialStatus: config.mapPropsToStatus && config.mapPropsToStatus(this.props),
initialErrors: config.mapPropsToErrors && config.mapPropsToErrors(this.props),
initialTouched: config.mapPropsToTouched && config.mapPropsToTouched(this.props),
onSubmit: this.handleSubmit,
render: this.renderFormComponent
}));
}
}
C.displayName = `WithFormik(${componentDisplayName})`;
return hoistNonReactStatics(C, Component);
};
}
function connect(Comp) {
var C = function (props) { return (React.createElement(FormikConsumer, null, function (formik) { return React.createElement(Comp, tslib_1.__assign({}, props, { formik: formik })); })); };
var componentDisplayName = Comp.displayName ||
Comp.name ||
(Comp.constructor && Comp.constructor.name) ||
'Component';
C.WrappedComponent = Comp;
C.displayName = "FormikConnect(" + componentDisplayName + ")";
return hoistNonReactStatics(C, Comp);
const C = props => React.createElement(FormikConsumer, null, formik => React.createElement(Comp, Object.assign({}, props, {
formik: formik
})));
const componentDisplayName = Comp.displayName || Comp.name || Comp.constructor && Comp.constructor.name || 'Component';
C.WrappedComponent = Comp;
C.displayName = `FormikConnect(${componentDisplayName})`;
return hoistNonReactStatics(C, Comp);
}
var move = function (array, from, to) {
var copy = (array || []).slice();
var value = copy[from];
copy.splice(from, 1);
copy.splice(to, 0, value);
return copy;
const move = (array, from, to) => {
const copy = [...(array || [])];
const value = copy[from];
copy.splice(from, 1);
copy.splice(to, 0, value);
return copy;
};
var swap = function (array, indexA, indexB) {
var copy = (array || []).slice();
var a = copy[indexA];
copy[indexA] = copy[indexB];
copy[indexB] = a;
return copy;
const swap = (array, indexA, indexB) => {
const copy = [...(array || [])];
const a = copy[indexA];
copy[indexA] = copy[indexB];
copy[indexB] = a;
return copy;
};
var insert = function (array, index, value) {
var copy = (array || []).slice();
copy.splice(index, 0, value);
return copy;
const insert = (array, index, value) => {
const copy = [...(array || [])];
copy.splice(index, 0, value);
return copy;
};
var replace = function (array, index, value) {
var copy = (array || []).slice();
copy[index] = value;
return copy;
const replace = (array, index, value) => {
const copy = [...(array || [])];
copy[index] = value;
return copy;
};
var FieldArrayInner = (function (_super) {
tslib_1.__extends(FieldArrayInner, _super);
function FieldArrayInner(props) {
var _this = _super.call(this, props) || this;
_this.updateArrayField = function (fn, alterTouched, alterErrors) {
var _a = _this.props, name = _a.name, validateOnChange = _a.validateOnChange, _b = _a.formik, setFormikState = _b.setFormikState, validateForm = _b.validateForm;
setFormikState(function (prevState) {
var updateErrors = typeof alterErrors === 'function' ? alterErrors : fn;
var updateTouched = typeof alterTouched === 'function' ? alterTouched : fn;
return tslib_1.__assign({}, prevState, { values: setIn(prevState.values, name, fn(getIn(prevState.values, name))), errors: alterErrors
? setIn(prevState.errors, name, updateErrors(getIn(prevState.errors, name)))
: prevState.errors, touched: alterTouched
? setIn(prevState.touched, name, updateTouched(getIn(prevState.touched, name)))
: prevState.touched });
}, function () {
if (validateOnChange) {
validateForm();
}
});
class FieldArrayInner extends React.Component {
constructor(props) {
super(props);
this.updateArrayField = (fn, alterTouched, alterErrors) => {
const {
name,
validateOnChange,
formik: {
setFormikState,
validateForm
}
} = this.props;
setFormikState(prevState => {
let updateErrors = typeof alterErrors === 'function' ? alterErrors : fn;
let updateTouched = typeof alterTouched === 'function' ? alterTouched : fn;
return { ...prevState,
values: setIn(prevState.values, name, fn(getIn(prevState.values, name))),
errors: alterErrors ? setIn(prevState.errors, name, updateErrors(getIn(prevState.errors, name))) : prevState.errors,
touched: alterTouched ? setIn(prevState.touched, name, updateTouched(getIn(prevState.touched, name))) : prevState.touched
};
_this.push = function (value) {
return _this.updateArrayField(function (array) { return (array || []).concat([cloneDeep(value)]); }, false, false);
};
_this.handlePush = function (value) { return function () { return _this.push(value); }; };
_this.swap = function (indexA, indexB) {
return _this.updateArrayField(function (array) { return swap(array, indexA, indexB); }, true, true);
};
_this.handleSwap = function (indexA, indexB) { return function () {
return _this.swap(indexA, indexB);
}; };
_this.move = function (from, to) {
return _this.updateArrayField(function (array) { return move(array, from, to); }, true, true);
};
_this.handleMove = function (from, to) { return function () { return _this.move(from, to); }; };
_this.insert = function (index, value) {
return _this.updateArrayField(function (array) { return insert(array, index, value); }, function (array) { return insert(array, index, null); }, function (array) { return insert(array, index, null); });
};
_this.handleInsert = function (index, value) { return function () { return _this.insert(index, value); }; };
_this.replace = function (index, value) {
return _this.updateArrayField(function (array) { return replace(array, index, value); }, false, false);
};
_this.handleReplace = function (index, value) { return function () {
return _this.replace(index, value);
}; };
_this.unshift = function (value) {
var length = -1;
_this.updateArrayField(function (array) {
var arr = array ? [value].concat(array) : [value];
if (length < 0) {
length = arr.length;
}
return arr;
}, function (array) {
var arr = array ? [null].concat(array) : [null];
if (length < 0) {
length = arr.length;
}
return arr;
}, function (array) {
var arr = array ? [null].concat(array) : [null];
if (length < 0) {
length = arr.length;
}
return arr;
});
return length;
};
_this.handleUnshift = function (value) { return function () { return _this.unshift(value); }; };
_this.handleRemove = function (index) { return function () { return _this.remove(index); }; };
_this.handlePop = function () { return function () { return _this.pop(); }; };
_this.remove = _this.remove.bind(_this);
_this.pop = _this.pop.bind(_this);
return _this;
}
FieldArrayInner.prototype.remove = function (index) {
var result;
this.updateArrayField(function (array) {
var copy = array ? array.slice() : [];
if (!result) {
result = copy[index];
}
if (isFunction(copy.splice)) {
copy.splice(index, 1);
}
return copy;
}, true, true);
return result;
}, () => {
if (validateOnChange) {
validateForm();
}
});
};
FieldArrayInner.prototype.pop = function () {
var result;
this.updateArrayField(function (array) {
var tmp = array;
if (!result) {
result = tmp && tmp.pop && tmp.pop();
}
return tmp;
}, true, true);
return result;
};
FieldArrayInner.prototype.render = function () {
var arrayHelpers = {
push: this.push,
pop: this.pop,
swap: this.swap,
move: this.move,
insert: this.insert,
replace: this.replace,
unshift: this.unshift,
remove: this.remove,
handlePush: this.handlePush,
handlePop: this.handlePop,
handleSwap: this.handleSwap,
handleMove: this.handleMove,
handleInsert: this.handleInsert,
handleReplace: this.handleReplace,
handleUnshift: this.handleUnshift,
handleRemove: this.handleRemove,
};
var _a = this.props, component = _a.component, render = _a.render, children = _a.children, name = _a.name, _b = _a.formik, _validate = _b.validate, _validationSchema = _b.validationSchema, restOfFormik = tslib_1.__rest(_b, ["validate", "validationSchema"]);
var props = tslib_1.__assign({}, arrayHelpers, { form: restOfFormik, name: name });
return component
? React.createElement(component, props)
: render
? render(props)
: children
? typeof children === 'function'
? children(props)
: !isEmptyChildren(children) ? React.Children.only(children) : null
: null;
};
FieldArrayInner.defaultProps = {
validateOnChange: true,
};
return FieldArrayInner;
}(React.Component));
var FieldArray = connect(FieldArrayInner);
var ErrorMessageImpl = (function (_super) {
tslib_1.__extends(ErrorMessageImpl, _super);
function ErrorMessageImpl() {
return _super !== null && _super.apply(this, arguments) || this;
}
ErrorMessageImpl.prototype.shouldComponentUpdate = function (props) {
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) {
return true;
this.push = value => this.updateArrayField(array => [...(array || []), cloneDeep(value)], false, false);
this.handlePush = value => () => this.push(value);
this.swap = (indexA, indexB) => this.updateArrayField(array => swap(array, indexA, indexB), true, true);
this.handleSwap = (indexA, indexB) => () => this.swap(indexA, indexB);
this.move = (from, to) => this.updateArrayField(array => move(array, from, to), true, true);
this.handleMove = (from, to) => () => this.move(from, to);
this.insert = (index, value) => this.updateArrayField(array => insert(array, index, value), array => insert(array, index, null), array => insert(array, index, null));
this.handleInsert = (index, value) => () => this.insert(index, value);
this.replace = (index, value) => this.updateArrayField(array => replace(array, index, value), false, false);
this.handleReplace = (index, value) => () => this.replace(index, value);
this.unshift = value => {
let length = -1;
this.updateArrayField(array => {
const arr = array ? [value, ...array] : [value];
if (length < 0) {
length = arr.length;
}
else {
return false;
return arr;
}, array => {
const arr = array ? [null, ...array] : [null];
if (length < 0) {
length = arr.length;
}
return arr;
}, array => {
const arr = array ? [null, ...array] : [null];
if (length < 0) {
length = arr.length;
}
return arr;
});
return length;
};
ErrorMessageImpl.prototype.render = function () {
var _a = this.props, component = _a.component, formik = _a.formik, render = _a.render, children = _a.children, name = _a.name, rest = tslib_1.__rest(_a, ["component", "formik", "render", "children", "name"]);
var touch = getIn(formik.touched, name);
var error = getIn(formik.errors, name);
return !!touch && !!error
? render
? isFunction(render) ? render(error) : null
: children
? isFunction(children) ? children(error) : null
: component
? React.createElement(component, rest, error)
: error
: null;
this.handleUnshift = value => () => this.unshift(value);
this.handleRemove = index => () => this.remove(index);
this.handlePop = () => () => this.pop();
this.remove = this.remove.bind(this);
this.pop = this.pop.bind(this);
}
remove(index) {
let result;
this.updateArrayField(array => {
const copy = array ? [...array] : [];
if (!result) {
result = copy[index];
}
if (isFunction(copy.splice)) {
copy.splice(index, 1);
}
return copy;
}, true, true);
return result;
}
pop() {
let result;
this.updateArrayField(array => {
const tmp = array;
if (!result) {
result = tmp && tmp.pop && tmp.pop();
}
return tmp;
}, true, true);
return result;
}
render() {
const arrayHelpers = {
push: this.push,
pop: this.pop,
swap: this.swap,
move: this.move,
insert: this.insert,
replace: this.replace,
unshift: this.unshift,
remove: this.remove,
handlePush: this.handlePush,
handlePop: this.handlePop,
handleSwap: this.handleSwap,
handleMove: this.handleMove,
handleInsert: this.handleInsert,
handleReplace: this.handleReplace,
handleUnshift: this.handleUnshift,
handleRemove: this.handleRemove
};
return ErrorMessageImpl;
}(React.Component));
var ErrorMessage = connect(ErrorMessageImpl);
const {
component,
render,
children,
name,
formik: {
validate: _validate,
validationSchema: _validationSchema,
...restOfFormik
}
} = this.props;
const props = { ...arrayHelpers,
form: restOfFormik,
name
};
return component ? React.createElement(component, props) : render ? render(props) : children ? typeof children === 'function' ? children(props) : !isEmptyChildren(children) ? React.Children.only(children) : null : null;
}
exports.useFormik = useFormik;
exports.Formik = Formik;
exports.yupToFormErrors = yupToFormErrors;
exports.validateYupSchema = validateYupSchema;
exports.useField = useField;
}
FieldArrayInner.defaultProps = {
validateOnChange: true
};
const FieldArray =
/*#__PURE__*/
connect(FieldArrayInner);
class ErrorMessageImpl extends React.Component {
shouldComponentUpdate(props) {
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) {
return true;
} else {
return false;
}
}
render() {
let {
component,
formik,
render,
children,
name,
...rest
} = this.props;
const touch = getIn(formik.touched, name);
const error = getIn(formik.errors, name);
return !!touch && !!error ? render ? isFunction(render) ? render(error) : null : children ? isFunction(children) ? children(error) : null : component ? React.createElement(component, rest, error) : error : null;
}
}
const ErrorMessage =
/*#__PURE__*/
connect(ErrorMessageImpl);
exports.ErrorMessage = ErrorMessage;
exports.FastField = FastField;
exports.Field = Field;
exports.FastField = FastField;
exports.FieldArray = FieldArray;
exports.Form = Form;
exports.withFormik = withFormik;
exports.move = move;
exports.swap = swap;
exports.Formik = Formik;
exports.FormikConsumer = FormikConsumer;
exports.FormikProvider = FormikProvider;
exports.connect = connect;
exports.getActiveElement = getActiveElement;
exports.getIn = getIn;
exports.insert = insert;
exports.replace = replace;
exports.FieldArray = FieldArray;
exports.isEmptyChildren = isEmptyChildren;
exports.isFunction = isFunction;
exports.isObject = isObject;
exports.isInputEvent = isInputEvent;
exports.isInteger = isInteger;
exports.isString = isString;
exports.isNaN = isNaN$1;
exports.isEmptyChildren = isEmptyChildren;
exports.isObject = isObject;
exports.isPromise = isPromise;
exports.isInputEvent = isInputEvent;
exports.getActiveElement = getActiveElement;
exports.isString = isString;
exports.makeCancelable = makeCancelable;
exports.getIn = getIn;
exports.move = move;
exports.replace = replace;
exports.setIn = setIn;
exports.setNestedObjectValues = setNestedObjectValues;
exports.connect = connect;
exports.ErrorMessage = ErrorMessage;
exports.FormikProvider = FormikProvider;
exports.FormikConsumer = FormikConsumer;
exports.swap = swap;
exports.useField = useField;
exports.useFormik = useFormik;
exports.useFormikContext = useFormikContext;
exports.validateYupSchema = validateYupSchema;
exports.withFormik = withFormik;
exports.yupToFormErrors = yupToFormErrors;
//# sourceMappingURL=formik.cjs.development.js.map

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),n=require("react"),r=e(require("react-fast-compare")),i=e(require("deepmerge")),a=e(require("lodash/clone")),u=e(require("lodash/toPath"));require("tiny-warning");var o=e(require("hoist-non-react-statics")),s=e(require("lodash/cloneDeep")),l=function(e){return"function"==typeof e},c=function(e){return null!==e&&"object"==typeof e},d=function(e){return String(Math.floor(Number(e)))===e},p=function(e){return"[object String]"===Object.prototype.toString.call(e)},f=function(e){return 0===n.Children.count(e)},v=function(e){return c(e)&&l(e.then)};function h(e){var t=!1;return[new Promise(function(n,r){e.then(function(e){return t?r({isCanceled:!0}):n(e)},function(e){return r(t?{isCanceled:!0}:e)})}),function(){t=!0}]}function m(e,t,n,r){void 0===r&&(r=0);for(var i=u(t);e&&r<i.length;)e=e[i[r++]];return void 0===e?n:e}function _(e,t,n){for(var r=a(e),i=r,o=0,s=u(t);o<s.length-1;o++){var l=s[o],c=m(e,s.slice(0,o+1));if(c)i=i[l]=a(c);else{var p=s[o+1];i=i[l]=d(p)&&Number(p)>=0?[]:{}}}return(0===o?e:i)[s[o]]===n?e:(void 0===n?delete i[s[o]]:i[s[o]]=n,0===o&&void 0===n&&delete r[s[o]],r)}function S(e,t,n,r){void 0===n&&(n=new WeakMap),void 0===r&&(r={});for(var i=0,a=Object.keys(e);i<a.length;i++){var u=a[i],o=e[u];c(o)?n.get(o)||(n.set(o,!0),r[u]=Array.isArray(o)?[]:{},S(o,t,n,r[u])):r[u]=t}return r}var y=n.createContext({}),E=y.Provider,g=y.Consumer;function T(){return n.useContext(y)}function b(e,n){switch(n.type){case"SET_VALUES":return t.__assign({},e,{values:n.payload});case"SET_TOUCHED":return t.__assign({},e,{touched:n.payload});case"SET_ERRORS":return t.__assign({},e,{errors:n.payload});case"SET_STATUS":return t.__assign({},e,{status:n.payload});case"SET_ISSUBMITTING":return t.__assign({},e,{isSubmitting:n.payload});case"SET_ISVALIDATING":return t.__assign({},e,{isValidating:n.payload});case"SET_FIELD_VALUE":return t.__assign({},e,{values:_(e.values,n.payload.field,n.payload.value)});case"SET_FIELD_TOUCHED":return t.__assign({},e,{touched:_(e.touched,n.payload.field,n.payload.value)});case"SET_FIELD_ERROR":return t.__assign({},e,{errors:_(e.errors,n.payload.field,n.payload.value)});case"RESET_FORM":case"SET_FORMIK_STATE":return t.__assign({},e,n.payload);case"SUBMIT_ATTEMPT":return t.__assign({},e,{touched:S(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return t.__assign({},e,{isSubmitting:!1});default:return e}}function F(e){var a=e.validateOnChange,u=void 0===a||a,o=e.validateOnBlur,s=void 0===o||o,c=e.isInitialValid,d=e.enableReinitialize,f=void 0!==d&&d,S=e.onSubmit,y=t.__rest(e,["validateOnChange","validateOnBlur","isInitialValid","enableReinitialize","onSubmit"]),E=t.__assign({validateOnChange:u,validateOnBlur:s,onSubmit:S},y),g=n.useRef(E.initialValues),T=n.useRef(E.initialErrors||{}),F=n.useRef(E.initialTouched||{}),C=n.useRef(E.initialStatus),O=n.useRef(!1),x=n.useRef({});n.useEffect(function(){},[c]),n.useEffect(function(){return O.current=!0,function(){O.current=!1}},[]);var A,P,V=n.useReducer(b,{values:E.initialValues,errors:E.initialErrors||{},touched:E.initialTouched||{},status:E.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),U=V[0],D=V[1],L=(P=n.useRef(A=U),n.useEffect(function(){P.current=A},[A]),P.current),M=n.useCallback(function(e,t){return new Promise(function(n){var r=E.validate(e,t);void 0===r?n({}):v(r)?r.then(function(){n({})},function(e){n(e)}):n(r)})},[E.validate]),N=n.useCallback(function(e,t){return new Promise(function(n){var r=E.validationSchema,i=l(r)?r(t):r;(t&&i.validateAt?i.validateAt(t,e):k(e,i)).then(function(){n({})},function(e){n(R(e))})})},[E.validationSchema]),w=n.useCallback(function(e,t){return new Promise(function(n){return n(x.current[e].validate(t))}).then(function(e){return e},function(e){return e})},[x]),j=n.useCallback(function(e){if(null===x.current)return Promise.resolve({});var t=Object.keys(x.current).filter(function(e){return null!==x.current&&x.current[e]&&x.current[e].validate&&l(x.current[e].validate)}),n=t.length>0?t.map(function(t){return w(t,m(e,t))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(n).then(function(e){return e.reduce(function(e,n,r){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===n?e:(n&&(e=_(e,t[r],n)),e)},{})})},[w,x]),B=n.useCallback(function(e){return void 0===e&&(e=U.values),E.validationSchema||E.validate||x.current&&Object.keys(x.current).filter(function(e){return!!x.current[e].validate}).length>0?(D({type:"SET_ISVALIDATING",payload:!0}),Promise.all([j(e),E.validationSchema?N(e):{},E.validate?M(e):{}]).then(function(e){var t=i.all([e[0],e[1],e[2]],{arrayMerge:I});return r(U.errors,t)||D({type:"SET_ERRORS",payload:t}),D({type:"SET_ISVALIDATING",payload:!1}),t})):Promise.resolve({})},[E.validate,E.validationSchema,j,M,N,U.errors,U.values,x]);n.useEffect(function(){if(L.values!==U.values&&u&&!U.isSubmitting&&null!=O.current){var e=h(B()),t=e[1];return e[0].then(function(e){return e}).catch(function(e){return e}),t}},[L.values,U.isSubmitting,U.values,B,u,O]),n.useEffect(function(){if(L.touched!==U.touched&&s&&!U.isSubmitting&&null!=O.current){var e=h(B()),t=e[1];return e[0].then(function(e){return e}).catch(function(e){return e}),t}},[L.touched,U.isSubmitting,U.touched,B,s,O]);var q=n.useCallback(function(e){var t=e&&e.values?e.values:g.current?g.current:E.initialValues,n=e&&e.errors?e.values:T.current?T.current:E.initialErrors||{},r=e&&e.touched?e.values:F.current?F.current:E.initialTouched||{},i=e&&e.status?e.status:C.current?C.current:E.initialStatus;g.current=t,T.current=n,F.current=r,C.current=i,D({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:n,touched:r,status:i,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})},[E.initialErrors,E.initialStatus,E.initialTouched,E.initialValues]);n.useEffect(function(){f&&O.current&&!r(g.current,E.initialValues)&&q()},[f,E.initialValues,q]);var G=n.useCallback(function(e){if(null!==x.current&&x.current[e]&&x.current[e].validate&&l(x.current[e].validate)){var t=m(U.values,e),n=x.current[e].validate(t);return v(n)?(D({type:"SET_ISVALIDATING",payload:!0}),n.then(function(e){return e},function(e){return e}).then(function(t){D({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),D({type:"SET_ISVALIDATING",payload:!1})})):(D({type:"SET_FIELD_ERROR",payload:{field:e,value:n}}),Promise.resolve(n))}return Promise.resolve()},[U.values,x]),H=n.useCallback(function(e,t){null!==x.current&&(x.current[e]={validate:t.validate})},[x]),W=n.useCallback(function(e){null!==x.current&&delete x.current[e]},[x]),K=n.useCallback(function(e){if(p(e))return function(n){return t(n,e)};function t(e,t){e.persist&&e.persist();var n=e.target,r=n.name,i=t||(r||n.id);D({type:"SET_FIELD_TOUCHED",payload:{field:i,value:!0}})}t(e)},[]),Y=n.useCallback(function(e){if(p(e))return function(n){return t(n,e)};function t(e,t){var n,r=t,i=e;if(!p(e)){e.persist&&e.persist();var a=e.target,u=a.type,o=a.name,s=a.value,l=a.checked;r=t||(o||a.id),i=/number|range/.test(u)?(n=parseFloat(s),isNaN(n)?"":n):/checkbox/.test(u)?l:s}r&&D({type:"SET_FIELD_VALUE",payload:{field:r,value:i}})}t(e)},[]),z=n.useCallback(function(e){D({type:"SET_TOUCHED",payload:e})},[]),J=n.useCallback(function(e){D({type:"SET_ERRORS",payload:e})},[]),Q=n.useCallback(function(e){D({type:"SET_VALUES",payload:e})},[]),X=n.useCallback(function(e,t){D({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})},[]),Z=n.useCallback(function(e,t){D({type:"SET_FIELD_VALUE",payload:{field:e,value:t}})},[]),$=n.useCallback(function(e,t){void 0===t&&(t=!0),D({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}})},[]);function ee(e){l(e)?D({type:"SET_FORMIK_STATE",payload:e(U)}):D({type:"SET_FORMIK_STATE",payload:e})}var te=n.useCallback(function(e){D({type:"SET_STATUS",payload:e})},[]),ne=n.useCallback(function(e){D({type:"SET_ISSUBMITTING",payload:e})},[]),re={resetForm:q,validateForm:B,validateField:G,setErrors:J,setFieldError:X,setFieldTouched:$,setFieldValue:Z,setStatus:te,setSubmitting:ne,setTouched:z,setValues:Q,setFormikState:ee},ie=n.useCallback(function(){return S(U.values,re)},[re,S,U.values]),ae=n.useCallback(function(){return D({type:"SUBMIT_ATTEMPT"}),B().then(function(e){0===Object.keys(e).length?Promise.resolve(ie()).then(function(){O.current&&D({type:"SUBMIT_SUCCESS"})}).catch(function(e){O.current&&D({type:"SUBMIT_FAILURE"})}):O.current&&D({type:"SUBMIT_FAILURE"})})},[ie,B]),ue=n.useCallback(function(e){e&&e.preventDefault&&l(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&l(e.stopPropagation)&&e.stopPropagation(),ae()},[ae]),oe=n.useCallback(function(){if(E.onReset){var e=E.onReset(U.values,re);v(e)?e.then(q):q()}else q()},[re,E.onReset,q,U.values]),se=n.useCallback(function(e){return{value:m(U.values,e),error:m(U.errors,e),touched:!!m(U.touched,e),initialValue:m(g.current,e),initialTouched:!!m(F.current,e),initialError:m(T.current,e)}},[U.errors,U.touched,U.values]),le=n.useCallback(function(e,t){return[{name:e,value:!t||"radio"!==t&&"checkbox"!==t?m(U.values,e):void 0,onChange:Y,onBlur:K},se(e)]},[se,K,Y,U.values]),ce=n.useMemo(function(){return!r(g.current,U.values)},[U.values]),de=n.useMemo(function(){return void 0!==c?ce?U.errors&&0===Object.keys(U.errors).length:!1!==c&&l(c)?c(E):c:U.errors&&0===Object.keys(U.errors).length},[c,ce,U.errors,E]);return t.__assign({},U,{initialValues:g.current,initialErrors:T.current,initialTouched:F.current,initialStatus:C.current,handleBlur:K,handleChange:Y,handleReset:oe,handleSubmit:ue,resetForm:q,setErrors:J,setFormikState:ee,setFieldTouched:$,setFieldValue:Z,setFieldError:X,setStatus:te,setSubmitting:ne,setTouched:z,setValues:Q,submitForm:ae,validateForm:B,validateField:G,isValid:de,dirty:ce,unregisterField:W,registerField:H,getFieldProps:le,validateOnBlur:s,validateOnChange:u})}function C(e){var t=F(e),r=e.component,i=e.children,a=e.render;return n.createElement(E,{value:t},r?n.createElement(r,t):a?a(t):i?l(i)?i(t):f(i)?null:n.Children.only(i):null)}function R(e){var t={};if(0===e.inner.length)return _(t,e.path,e.message);for(var n=0,r=e.inner;n<r.length;n++){var i=r[n];t[i.path]||(t=_(t,i.path,i.message))}return t}function k(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r={});var i={};for(var a in e)if(e.hasOwnProperty(a)){var u=String(a);i[u]=""!==e[u]?e[u]:void 0}return t[n?"validateSync":"validate"](i,{abortEarly:!1,context:r})}function I(e,t,n){var r=e.slice();return t.forEach(function(t,a){if(void 0===r[a]){var u=!1!==n.clone&&n.isMergeableObject(t);r[a]=u?i(Array.isArray(t)?[]:{},t,n):t}else n.isMergeableObject(t)?r[a]=i(e[a],t,n):-1===e.indexOf(t)&&r.push(t)}),r}function O(e){var r=e.validate,i=e.name,a=e.render,u=e.children,o=e.as,s=void 0===o?"input":o,c=e.component,d=t.__rest(e,["validate","name","render","children","as","component"]),p=T(),f=t.__rest(p,["validate","validationSchema"]);n.useEffect(function(){},[]),n.useEffect(function(){return f.registerField(i,{validate:r}),function(){f.unregisterField(i)}},[f,i,r]);var v=f.getFieldProps(i,d.type),h=v[0],m=v[1],_={field:h,form:f};if(a)return a(_);if(l(u))return u(t.__assign({},_,{meta:m}));if(c){if("string"==typeof c){var S=d.innerRef,y=t.__rest(d,["innerRef"]);return n.createElement(c,t.__assign({ref:S},h,y),u)}return n.createElement(c,t.__assign({field:h,form:f},d),u)}if("string"==typeof s){S=d.innerRef,y=t.__rest(d,["innerRef"]);return n.createElement(s,t.__assign({ref:S},h,y),u)}return n.createElement(s,t.__assign({},h,d),u)}var x=O;function A(e){var r=T();return n.createElement("form",t.__assign({onSubmit:r.handleSubmit,onReset:r.handleReset},e))}function P(e){var r=function(r){return n.createElement(g,null,function(i){return n.createElement(e,t.__assign({},r,{formik:i}))})},i=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return r.WrappedComponent=e,r.displayName="FormikConnect("+i+")",o(r,e)}A.displayName="Form";var V=function(e,t,n){var r=(e||[]).slice(),i=r[t];return r.splice(t,1),r.splice(n,0,i),r},U=function(e,t,n){var r=(e||[]).slice(),i=r[t];return r[t]=r[n],r[n]=i,r},D=function(e,t,n){var r=(e||[]).slice();return r.splice(t,0,n),r},L=function(e,t,n){var r=(e||[]).slice();return r[t]=n,r},M=P(function(e){function r(n){var r=e.call(this,n)||this;return r.updateArrayField=function(e,n,i){var a=r.props,u=a.name,o=a.validateOnChange,s=a.formik,l=s.validateForm;(0,s.setFormikState)(function(r){var a="function"==typeof i?i:e,o="function"==typeof n?n:e;return t.__assign({},r,{values:_(r.values,u,e(m(r.values,u))),errors:i?_(r.errors,u,a(m(r.errors,u))):r.errors,touched:n?_(r.touched,u,o(m(r.touched,u))):r.touched})},function(){o&&l()})},r.push=function(e){return r.updateArrayField(function(t){return(t||[]).concat([s(e)])},!1,!1)},r.handlePush=function(e){return function(){return r.push(e)}},r.swap=function(e,t){return r.updateArrayField(function(n){return U(n,e,t)},!0,!0)},r.handleSwap=function(e,t){return function(){return r.swap(e,t)}},r.move=function(e,t){return r.updateArrayField(function(n){return V(n,e,t)},!0,!0)},r.handleMove=function(e,t){return function(){return r.move(e,t)}},r.insert=function(e,t){return r.updateArrayField(function(n){return D(n,e,t)},function(t){return D(t,e,null)},function(t){return D(t,e,null)})},r.handleInsert=function(e,t){return function(){return r.insert(e,t)}},r.replace=function(e,t){return r.updateArrayField(function(n){return L(n,e,t)},!1,!1)},r.handleReplace=function(e,t){return function(){return r.replace(e,t)}},r.unshift=function(e){var t=-1;return r.updateArrayField(function(n){var r=n?[e].concat(n):[e];return t<0&&(t=r.length),r},function(e){var n=e?[null].concat(e):[null];return t<0&&(t=n.length),n},function(e){var n=e?[null].concat(e):[null];return t<0&&(t=n.length),n}),t},r.handleUnshift=function(e){return function(){return r.unshift(e)}},r.handleRemove=function(e){return function(){return r.remove(e)}},r.handlePop=function(){return function(){return r.pop()}},r.remove=r.remove.bind(r),r.pop=r.pop.bind(r),r}return t.__extends(r,e),r.prototype.remove=function(e){var t;return this.updateArrayField(function(n){var r=n?n.slice():[];return t||(t=r[e]),l(r.splice)&&r.splice(e,1),r},!0,!0),t},r.prototype.pop=function(){var e;return this.updateArrayField(function(t){var n=t;return e||(e=n&&n.pop&&n.pop()),n},!0,!0),e},r.prototype.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},r=this.props,i=r.component,a=r.render,u=r.children,o=r.name,s=r.formik,l=t.__rest(s,["validate","validationSchema"]),c=t.__assign({},e,{form:l,name:o});return i?n.createElement(i,c):a?a(c):u?"function"==typeof u?u(c):f(u)?null:n.Children.only(u):null},r.defaultProps={validateOnChange:!0},r}(n.Component)),N=P(function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),r.prototype.shouldComponentUpdate=function(e){return m(this.props.formik.errors,this.props.name)!==m(e.formik.errors,this.props.name)||m(this.props.formik.touched,this.props.name)!==m(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},r.prototype.render=function(){var e=this.props,r=e.component,i=e.formik,a=e.render,u=e.children,o=e.name,s=t.__rest(e,["component","formik","render","children","name"]),c=m(i.touched,o),d=m(i.errors,o);return c&&d?a?l(a)?a(d):null:u?l(u)?u(d):null:r?n.createElement(r,s,d):d:null},r}(n.Component));exports.useFormik=F,exports.Formik=C,exports.yupToFormErrors=R,exports.validateYupSchema=k,exports.useField=function(e,t){return T().getFieldProps(e,t)},exports.Field=O,exports.FastField=x,exports.Form=A,exports.withFormik=function(e){var r=e.mapPropsToValues,i=void 0===r?function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&"function"!=typeof e[n]&&(t[n]=e[n]);return t}:r,a=t.__rest(e,["mapPropsToValues"]);return function(e){var r=e.displayName||e.name||e.constructor&&e.constructor.name||"Component",u=function(u){function o(){var r=null!==u&&u.apply(this,arguments)||this;return r.validate=function(e){return a.validate(e,r.props)},r.validationSchema=function(){return l(a.validationSchema)?a.validationSchema(r.props):a.validationSchema},r.handleSubmit=function(e,n){return a.handleSubmit(e,t.__assign({},n,{props:r.props}))},r.renderFormComponent=function(i){return n.createElement(e,t.__assign({},r.props,i))},r}return t.__extends(o,u),o.prototype.render=function(){var e=this.props,r=t.__rest(e,["children"]);return n.createElement(C,t.__assign({},r,a,{validate:a.validate&&this.validate,validationSchema:a.validationSchema&&this.validationSchema,initialValues:i(this.props),initialStatus:a.mapPropsToStatus&&a.mapPropsToStatus(this.props),initialErrors:a.mapPropsToErrors&&a.mapPropsToErrors(this.props),initialTouched:a.mapPropsToTouched&&a.mapPropsToTouched(this.props),onSubmit:this.handleSubmit,render:this.renderFormComponent}))},o.displayName="WithFormik("+r+")",o}(n.Component);return o(u,e)}},exports.move=V,exports.swap=U,exports.insert=D,exports.replace=L,exports.FieldArray=M,exports.isFunction=l,exports.isObject=c,exports.isInteger=d,exports.isString=p,exports.isNaN=function(e){return e!=e},exports.isEmptyChildren=f,exports.isPromise=v,exports.isInputEvent=function(e){return e&&c(e)&&c(e.target)},exports.getActiveElement=function(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}},exports.makeCancelable=h,exports.getIn=m,exports.setIn=_,exports.setNestedObjectValues=S,exports.connect=P,exports.ErrorMessage=N,exports.FormikProvider=E,exports.FormikConsumer=g,exports.useFormikContext=T;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),r=e(require("react-fast-compare")),n=e(require("deepmerge")),a=e(require("lodash/clone")),s=e(require("lodash/toPath"));require("tiny-warning");var i=e(require("hoist-non-react-statics")),o=e(require("lodash/cloneDeep"));const l=e=>"function"==typeof e,u=e=>null!==e&&"object"==typeof e,c=e=>String(Math.floor(Number(e)))===e,d=e=>"[object String]"===Object.prototype.toString.call(e),p=e=>0===t.Children.count(e),h=e=>u(e)&&l(e.then);function m(e){let t=!1;const r=new Promise((r,n)=>{e.then(e=>t?n({isCanceled:!0}):r(e),e=>n(t?{isCanceled:!0}:e))});return[r,function(){t=!0}]}function f(e,t,r,n=0){const a=s(t);for(;e&&n<a.length;)e=e[a[n++]];return void 0===e?r:e}function v(e,t,r){let n=a(e),i=n,o=0,l=s(t);for(;o<l.length-1;o++){const t=l[o];let r=f(e,l.slice(0,o+1));if(r)i=i[t]=a(r);else{const e=l[o+1];i=i[t]=c(e)&&Number(e)>=0?[]:{}}}return(0===o?e:i)[l[o]]===r?e:(void 0===r?delete i[l[o]]:i[l[o]]=r,0===o&&void 0===r&&delete n[l[o]],n)}function E(e,t,r=new WeakMap,n={}){for(let a of Object.keys(e)){const s=e[a];u(s)?r.get(s)||(r.set(s,!0),n[a]=Array.isArray(s)?[]:{},E(s,t,r,n[a])):n[a]=t}return n}const S=t.createContext({}),y=S.Provider,T=S.Consumer;function b(){return t.useContext(S)}function g(e,t){switch(t.type){case"SET_VALUES":return{...e,values:t.payload};case"SET_TOUCHED":return{...e,touched:t.payload};case"SET_ERRORS":return{...e,errors:t.payload};case"SET_STATUS":return{...e,status:t.payload};case"SET_ISSUBMITTING":return{...e,isSubmitting:t.payload};case"SET_ISVALIDATING":return{...e,isValidating:t.payload};case"SET_FIELD_VALUE":return{...e,values:v(e.values,t.payload.field,t.payload.value)};case"SET_FIELD_TOUCHED":return{...e,touched:v(e.touched,t.payload.field,t.payload.value)};case"SET_FIELD_ERROR":return{...e,errors:v(e.errors,t.payload.field,t.payload.value)};case"RESET_FORM":case"SET_FORMIK_STATE":return{...e,...t.payload};case"SUBMIT_ATTEMPT":return{...e,touched:E(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1};case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return{...e,isSubmitting:!1};default:return e}}function F({validateOnChange:e=!0,validateOnBlur:a=!0,isInitialValid:s,enableReinitialize:i=!1,onSubmit:o,...u}){const c={validateOnChange:e,validateOnBlur:a,onSubmit:o,...u},p=t.useRef(c.initialValues),E=t.useRef(c.initialErrors||{}),S=t.useRef(c.initialTouched||{}),y=t.useRef(c.initialStatus),T=t.useRef(!1),b=t.useRef({});t.useEffect(()=>{},[s]),t.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const[F,C]=t.useReducer(g,{values:c.initialValues,errors:c.initialErrors||{},touched:c.initialTouched||{},status:c.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),R=function(e){const r=t.useRef(e);return t.useEffect(()=>{r.current=e},[e]),r.current}(F),O=t.useCallback((e,t)=>new Promise(r=>{const n=c.validate(e,t);void 0===n?r({}):h(n)?n.then(()=>{r({})},e=>{r(e)}):r(n)}),[c.validate]),x=t.useCallback((e,t)=>new Promise(r=>{const n=c.validationSchema,a=l(n)?n(t):n;let s=t&&a.validateAt?a.validateAt(t,e):k(e,a);s.then(()=>{r({})},e=>{r(_(e))})}),[c.validationSchema]),A=t.useCallback((e,t)=>new Promise(r=>r(b.current[e].validate(t))).then(e=>e,e=>e),[b]),P=t.useCallback(e=>{if(null===b.current)return Promise.resolve({});const t=Object.keys(b.current).filter(e=>null!==b.current&&b.current[e]&&b.current[e].validate&&l(b.current[e].validate)),r=t.length>0?t.map(t=>A(t,f(e,t))):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(r).then(e=>e.reduce((e,r,n)=>"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===r?e:(r&&(e=v(e,t[n],r)),e),{}))},[A,b]),U=t.useCallback((e=F.values)=>c.validationSchema||c.validate||b.current&&Object.keys(b.current).filter(e=>!!b.current[e].validate).length>0?(C({type:"SET_ISVALIDATING",payload:!0}),Promise.all([P(e),c.validationSchema?x(e):{},c.validate?O(e):{}]).then(([e,t,a])=>{const s=n.all([e,t,a],{arrayMerge:I});return r(F.errors,s)||C({type:"SET_ERRORS",payload:s}),C({type:"SET_ISVALIDATING",payload:!1}),s})):Promise.resolve({}),[c.validate,c.validationSchema,P,O,x,F.errors,F.values,b]);t.useEffect(()=>{if(R.values!==F.values&&e&&!F.isSubmitting&&null!=T.current){const[e,t]=m(U());return e.then(e=>e).catch(e=>e),t}},[R.values,F.isSubmitting,F.values,U,e,T]),t.useEffect(()=>{if(R.touched!==F.touched&&a&&!F.isSubmitting&&null!=T.current){const[e,t]=m(U());return e.then(e=>e).catch(e=>e),t}},[R.touched,F.isSubmitting,F.touched,U,a,T]);const L=t.useCallback(e=>{const t=e&&e.values?e.values:p.current?p.current:c.initialValues,r=e&&e.errors?e.values:E.current?E.current:c.initialErrors||{},n=e&&e.touched?e.values:S.current?S.current:c.initialTouched||{},a=e&&e.status?e.status:y.current?y.current:c.initialStatus;p.current=t,E.current=r,S.current=n,y.current=a,C({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:r,touched:n,status:a,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})},[c.initialErrors,c.initialStatus,c.initialTouched,c.initialValues]);t.useEffect(()=>{i&&T.current&&!r(p.current,c.initialValues)&&L()},[i,c.initialValues,L]);const V=t.useCallback(e=>{if(null!==b.current&&b.current[e]&&b.current[e].validate&&l(b.current[e].validate)){const t=f(F.values,e),r=b.current[e].validate(t);return h(r)?(C({type:"SET_ISVALIDATING",payload:!0}),r.then(e=>e,e=>e).then(t=>{C({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),C({type:"SET_ISVALIDATING",payload:!1})})):(C({type:"SET_FIELD_ERROR",payload:{field:e,value:r}}),Promise.resolve(r))}return Promise.resolve()},[F.values,b]),D=t.useCallback((e,{validate:t})=>{null!==b.current&&(b.current[e]={validate:t})},[b]),M=t.useCallback(e=>{null!==b.current&&delete b.current[e]},[b]),N=t.useCallback(e=>{if(d(e))return r=>t(r,e);function t(e,t){e.persist&&e.persist();const{name:r,id:n,outerHTML:a}=e.target,s=t||(r||n);C({type:"SET_FIELD_TOUCHED",payload:{field:s,value:!0}})}t(e)},[]),j=t.useCallback(e=>{if(d(e))return r=>t(r,e);function t(e,t){let r,n=t,a=e;if(!d(e)){e.persist&&e.persist();const{type:s,name:i,id:o,value:l,checked:u,outerHTML:c}=e.target;n=t||(i||o),a=/number|range/.test(s)?(r=parseFloat(l),isNaN(r)?"":r):/checkbox/.test(s)?u:l}n&&C({type:"SET_FIELD_VALUE",payload:{field:n,value:a}})}t(e)},[]),w=t.useCallback(e=>{C({type:"SET_TOUCHED",payload:e})},[]),B=t.useCallback(e=>{C({type:"SET_ERRORS",payload:e})},[]),q=t.useCallback(e=>{C({type:"SET_VALUES",payload:e})},[]),G=t.useCallback((e,t)=>{C({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})},[]),H=t.useCallback((e,t)=>{C({type:"SET_FIELD_VALUE",payload:{field:e,value:t}})},[]),W=t.useCallback((e,t=!0)=>{C({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}})},[]);function K(e){l(e)?C({type:"SET_FORMIK_STATE",payload:e(F)}):C({type:"SET_FORMIK_STATE",payload:e})}const Y=t.useCallback(e=>{C({type:"SET_STATUS",payload:e})},[]),$=t.useCallback(e=>{C({type:"SET_ISSUBMITTING",payload:e})},[]),z={resetForm:L,validateForm:U,validateField:V,setErrors:B,setFieldError:G,setFieldTouched:W,setFieldValue:H,setStatus:Y,setSubmitting:$,setTouched:w,setValues:q,setFormikState:K},J=t.useCallback(()=>o(F.values,z),[z,o,F.values]),Q=t.useCallback(()=>(C({type:"SUBMIT_ATTEMPT"}),U().then(e=>{const t=0===Object.keys(e).length;t?Promise.resolve(J()).then(()=>{T.current&&C({type:"SUBMIT_SUCCESS"})}).catch(e=>{T.current&&C({type:"SUBMIT_FAILURE"})}):T.current&&C({type:"SUBMIT_FAILURE"})})),[J,U]),X=t.useCallback(e=>{e&&e.preventDefault&&l(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&l(e.stopPropagation)&&e.stopPropagation(),Q()},[Q]),Z=t.useCallback(()=>{if(c.onReset){const e=c.onReset(F.values,z);h(e)?e.then(L):L()}else L()},[z,c.onReset,L,F.values]),ee=t.useCallback(e=>({value:f(F.values,e),error:f(F.errors,e),touched:!!f(F.touched,e),initialValue:f(p.current,e),initialTouched:!!f(S.current,e),initialError:f(E.current,e)}),[F.errors,F.touched,F.values]),te=t.useCallback((e,t)=>{const r={name:e,value:!t||"radio"!==t&&"checkbox"!==t?f(F.values,e):void 0,onChange:j,onBlur:N};return[r,ee(e)]},[ee,N,j,F.values]),re=t.useMemo(()=>!r(p.current,F.values),[F.values]),ne=t.useMemo(()=>void 0!==s?re?F.errors&&0===Object.keys(F.errors).length:!1!==s&&l(s)?s(c):s:F.errors&&0===Object.keys(F.errors).length,[s,re,F.errors,c]),ae={...F,initialValues:p.current,initialErrors:E.current,initialTouched:S.current,initialStatus:y.current,handleBlur:N,handleChange:j,handleReset:Z,handleSubmit:X,resetForm:L,setErrors:B,setFormikState:K,setFieldTouched:W,setFieldValue:H,setFieldError:G,setStatus:Y,setSubmitting:$,setTouched:w,setValues:q,submitForm:Q,validateForm:U,validateField:V,isValid:ne,dirty:re,unregisterField:M,registerField:D,getFieldProps:te,validateOnBlur:a,validateOnChange:e};return ae}function C(e){const r=F(e),{component:n,children:a,render:s}=e;return t.createElement(y,{value:r},n?t.createElement(n,r):s?s(r):a?l(a)?a(r):p(a)?null:t.Children.only(a):null)}function _(e){let t={};if(0===e.inner.length)return v(t,e.path,e.message);for(let r of e.inner)t[r.path]||(t=v(t,r.path,r.message));return t}function k(e,t,r=!1,n={}){let a={};for(let t in e)if(e.hasOwnProperty(t)){const r=String(t);a[r]=""!==e[r]?e[r]:void 0}return t[r?"validateSync":"validate"](a,{abortEarly:!1,context:n})}function I(e,t,r){const a=e.slice();return t.forEach(function(t,s){if(void 0===a[s]){const e=!1!==r.clone,i=e&&r.isMergeableObject(t);a[s]=i?n(Array.isArray(t)?[]:{},t,r):t}else r.isMergeableObject(t)?a[s]=n(e[s],t,r):-1===e.indexOf(t)&&a.push(t)}),a}function R({validate:e,name:r,render:n,children:a,as:s="input",component:i,...o}){const{...u}=b();t.useEffect(()=>{},[]),t.useEffect(()=>(u.registerField(r,{validate:e}),()=>{u.unregisterField(r)}),[u,r,e]);const[c,d]=u.getFieldProps(r,o.type),p={field:c,form:u};if(n)return n(p);if(l(a))return a({...p,meta:d});if(i){if("string"==typeof i){const{innerRef:e,...r}=o;return t.createElement(i,{ref:e,...c,...r},a)}return t.createElement(i,{field:c,form:u,...o},a)}if("string"==typeof s){const{innerRef:e,...r}=o;return t.createElement(s,{ref:e,...c,...r},a)}return t.createElement(s,{...c,...o},a)}const O=R;function x(e){const{handleReset:r,handleSubmit:n}=b();return t.createElement("form",Object.assign({onSubmit:n,onReset:r},e))}function A(e){const r=r=>t.createElement(T,null,n=>t.createElement(e,Object.assign({},r,{formik:n}))),n=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return r.WrappedComponent=e,r.displayName=`FormikConnect(${n})`,i(r,e)}x.displayName="Form";const P=(e,t,r)=>{const n=[...e||[]],a=n[t];return n.splice(t,1),n.splice(r,0,a),n},U=(e,t,r)=>{const n=[...e||[]],a=n[t];return n[t]=n[r],n[r]=a,n},L=(e,t,r)=>{const n=[...e||[]];return n.splice(t,0,r),n},V=(e,t,r)=>{const n=[...e||[]];return n[t]=r,n};class D extends t.Component{constructor(e){super(e),this.updateArrayField=((e,t,r)=>{const{name:n,validateOnChange:a,formik:{setFormikState:s,validateForm:i}}=this.props;s(a=>{let s="function"==typeof r?r:e,i="function"==typeof t?t:e;return{...a,values:v(a.values,n,e(f(a.values,n))),errors:r?v(a.errors,n,s(f(a.errors,n))):a.errors,touched:t?v(a.touched,n,i(f(a.touched,n))):a.touched}},()=>{a&&i()})}),this.push=(e=>this.updateArrayField(t=>[...t||[],o(e)],!1,!1)),this.handlePush=(e=>()=>this.push(e)),this.swap=((e,t)=>this.updateArrayField(r=>U(r,e,t),!0,!0)),this.handleSwap=((e,t)=>()=>this.swap(e,t)),this.move=((e,t)=>this.updateArrayField(r=>P(r,e,t),!0,!0)),this.handleMove=((e,t)=>()=>this.move(e,t)),this.insert=((e,t)=>this.updateArrayField(r=>L(r,e,t),t=>L(t,e,null),t=>L(t,e,null))),this.handleInsert=((e,t)=>()=>this.insert(e,t)),this.replace=((e,t)=>this.updateArrayField(r=>V(r,e,t),!1,!1)),this.handleReplace=((e,t)=>()=>this.replace(e,t)),this.unshift=(e=>{let t=-1;return this.updateArrayField(r=>{const n=r?[e,...r]:[e];return t<0&&(t=n.length),n},e=>{const r=e?[null,...e]:[null];return t<0&&(t=r.length),r},e=>{const r=e?[null,...e]:[null];return t<0&&(t=r.length),r}),t}),this.handleUnshift=(e=>()=>this.unshift(e)),this.handleRemove=(e=>()=>this.remove(e)),this.handlePop=(()=>()=>this.pop()),this.remove=this.remove.bind(this),this.pop=this.pop.bind(this)}remove(e){let t;return this.updateArrayField(r=>{const n=r?[...r]:[];return t||(t=n[e]),l(n.splice)&&n.splice(e,1),n},!0,!0),t}pop(){let e;return this.updateArrayField(t=>{const r=t;return e||(e=r&&r.pop&&r.pop()),r},!0,!0),e}render(){const e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},{component:r,render:n,children:a,name:s,formik:{...i}}=this.props,o={...e,form:i,name:s};return r?t.createElement(r,o):n?n(o):a?"function"==typeof a?a(o):p(a)?null:t.Children.only(a):null}}D.defaultProps={validateOnChange:!0};const M=A(D);class N extends t.Component{shouldComponentUpdate(e){return f(this.props.formik.errors,this.props.name)!==f(e.formik.errors,this.props.name)||f(this.props.formik.touched,this.props.name)!==f(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length}render(){let{component:e,formik:r,render:n,children:a,name:s,...i}=this.props;const o=f(r.touched,s),u=f(r.errors,s);return o&&u?n?l(n)?n(u):null:a?l(a)?a(u):null:e?t.createElement(e,i,u):u:null}}const j=A(N);exports.ErrorMessage=j,exports.FastField=O,exports.Field=R,exports.FieldArray=M,exports.Form=x,exports.Formik=C,exports.FormikConsumer=T,exports.FormikProvider=y,exports.connect=A,exports.getActiveElement=function(e){if(e=e||("undefined"!=typeof document?document:void 0),void 0===e)return null;try{return e.activeElement||e.body}catch(t){return e.body}},exports.getIn=f,exports.insert=L,exports.isEmptyChildren=p,exports.isFunction=l,exports.isInputEvent=(e=>e&&u(e)&&u(e.target)),exports.isInteger=c,exports.isNaN=(e=>e!=e),exports.isObject=u,exports.isPromise=h,exports.isString=d,exports.makeCancelable=m,exports.move=P,exports.replace=V,exports.setIn=v,exports.setNestedObjectValues=E,exports.swap=U,exports.useField=function(e,t){const r=b();return r.getFieldProps(e,t)},exports.useFormik=F,exports.useFormikContext=b,exports.validateYupSchema=k,exports.withFormik=function({mapPropsToValues:e=(e=>{let t={};for(let r in e)e.hasOwnProperty(r)&&"function"!=typeof e[r]&&(t[r]=e[r]);return t}),...r}){return function(n){const a=n.displayName||n.name||n.constructor&&n.constructor.name||"Component";class s extends t.Component{constructor(){super(...arguments),this.validate=(e=>r.validate(e,this.props)),this.validationSchema=(()=>l(r.validationSchema)?r.validationSchema(this.props):r.validationSchema),this.handleSubmit=((e,t)=>r.handleSubmit(e,{...t,props:this.props})),this.renderFormComponent=(e=>t.createElement(n,Object.assign({},this.props,e)))}render(){const{...n}=this.props;return t.createElement(C,Object.assign({},n,r,{validate:r.validate&&this.validate,validationSchema:r.validationSchema&&this.validationSchema,initialValues:e(this.props),initialStatus:r.mapPropsToStatus&&r.mapPropsToStatus(this.props),initialErrors:r.mapPropsToErrors&&r.mapPropsToErrors(this.props),initialTouched:r.mapPropsToTouched&&r.mapPropsToTouched(this.props),onSubmit:this.handleSubmit,render:this.renderFormComponent}))}}return s.displayName=`WithFormik(${a})`,i(s,n)}},exports.yupToFormErrors=_;
//# sourceMappingURL=formik.cjs.production.js.map

@@ -0,0 +0,0 @@ import * as React from 'react';

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).Formik={},e.React)}(this,function(e,t){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&(r[n[o]]=e[n[o]])}return r}var i=Array.isArray,u=Object.keys,c=Object.prototype.hasOwnProperty,l="undefined"!=typeof Element;var s=function(e,t){try{return function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){var n,o,a,s=i(t),f=i(r);if(s&&f){if((o=t.length)!=r.length)return!1;for(n=o;0!=n--;)if(!e(t[n],r[n]))return!1;return!0}if(s!=f)return!1;var p=t instanceof Date,d=r instanceof Date;if(p!=d)return!1;if(p&&d)return t.getTime()==r.getTime();var v=t instanceof RegExp,y=r instanceof RegExp;if(v!=y)return!1;if(v&&y)return t.toString()==r.toString();var h=u(t);if((o=h.length)!==u(r).length)return!1;for(n=o;0!=n--;)if(!c.call(r,h[n]))return!1;if(l&&t instanceof Element&&r instanceof Element)return t===r;for(n=o;0!=n--;)if(!("_owner"===(a=h[n])&&t.$$typeof||e(t[a],r[a])))return!1;return!0}return t!=t&&r!=r}(e,t)}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-2146828260===e.number)return console.warn("Warning: react-fast-compare does not handle circular references.",e.name,e.message),!1;throw e}},f=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===p}(e)}(e)};var p="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function d(e,t){return!1!==t.clone&&t.isMergeableObject(e)?y(Array.isArray(e)?[]:{},e,t):e}function v(e,t,r){return e.concat(t).map(function(e){return d(e,r)})}function y(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||v,r.isMergeableObject=r.isMergeableObject||f;var n=Array.isArray(t);return n===Array.isArray(e)?n?r.arrayMerge(e,t,r):function(e,t,r){var n={};return r.isMergeableObject(e)&&Object.keys(e).forEach(function(t){n[t]=d(e[t],r)}),Object.keys(t).forEach(function(o){n[o]=r.isMergeableObject(t[o])&&e[o]?y(e[o],t[o],r):d(t[o],r)}),n}(e,t,r):d(t,r)}y.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,r){return y(e,r,t)},{})};var h=y;function b(e,t){return e===t||e!=e&&t!=t}function m(e,t){for(var r=e.length;r--;)if(b(e[r][0],t))return r;return-1}var _=Array.prototype.splice;function g(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}g.prototype.clear=function(){this.__data__=[],this.size=0},g.prototype.delete=function(e){var t=this.__data__,r=m(t,e);return!(r<0||(r==t.length-1?t.pop():_.call(t,r,1),--this.size,0))},g.prototype.get=function(e){var t=this.__data__,r=m(t,e);return r<0?void 0:t[r][1]},g.prototype.has=function(e){return m(this.__data__,e)>-1},g.prototype.set=function(e,t){var r=this.__data__,n=m(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var j="object"==typeof global&&global&&global.Object===Object&&global,S="object"==typeof self&&self&&self.Object===Object&&self,E=j||S||Function("return this")(),O=E.Symbol,T=Object.prototype,A=T.hasOwnProperty,F=T.toString,w=O?O.toStringTag:void 0;var C=Object.prototype.toString;var P="[object Null]",k="[object Undefined]",I=O?O.toStringTag:void 0;function R(e){return null==e?void 0===e?k:P:I&&I in Object(e)?function(e){var t=A.call(e,w),r=e[w];try{e[w]=void 0;var n=!0}catch(e){}var o=F.call(e);return n&&(t?e[w]=r:delete e[w]),o}(e):function(e){return C.call(e)}(e)}function M(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var U="[object AsyncFunction]",D="[object Function]",x="[object GeneratorFunction]",V="[object Proxy]";function $(e){if(!M(e))return!1;var t=R(e);return t==D||t==x||t==U||t==V}var L,N=E["__core-js_shared__"],B=(L=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+L:"";var z=Function.prototype.toString;function W(e){if(null!=e){try{return z.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var G=/^\[object .+?Constructor\]$/,H=Function.prototype,q=Object.prototype,K=RegExp("^"+H.toString.call(q.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Y(e){return!(!M(e)||(t=e,B&&B in t))&&($(e)?K:G).test(W(e));var t}function J(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Y(r)?r:void 0}var Q=J(E,"Map"),X=J(Object,"create");var Z="__lodash_hash_undefined__",ee=Object.prototype.hasOwnProperty;var te=Object.prototype.hasOwnProperty;var re="__lodash_hash_undefined__";function ne(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function oe(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function ae(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ne.prototype.clear=function(){this.__data__=X?X(null):{},this.size=0},ne.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne.prototype.get=function(e){var t=this.__data__;if(X){var r=t[e];return r===Z?void 0:r}return ee.call(t,e)?t[e]:void 0},ne.prototype.has=function(e){var t=this.__data__;return X?void 0!==t[e]:te.call(t,e)},ne.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=X&&void 0===t?re:t,this},ae.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new(Q||g),string:new ne}},ae.prototype.delete=function(e){var t=oe(this,e).delete(e);return this.size-=t?1:0,t},ae.prototype.get=function(e){return oe(this,e).get(e)},ae.prototype.has=function(e){return oe(this,e).has(e)},ae.prototype.set=function(e,t){var r=oe(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};var ie=200;function ue(e){var t=this.__data__=new g(e);this.size=t.size}ue.prototype.clear=function(){this.__data__=new g,this.size=0},ue.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ue.prototype.get=function(e){return this.__data__.get(e)},ue.prototype.has=function(e){return this.__data__.has(e)},ue.prototype.set=function(e,t){var r=this.__data__;if(r instanceof g){var n=r.__data__;if(!Q||n.length<ie-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new ae(n)}return r.set(e,t),this.size=r.size,this};var ce=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();function le(e,t,r){"__proto__"==t&&ce?ce(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var se=Object.prototype.hasOwnProperty;function fe(e,t,r){var n=e[t];se.call(e,t)&&b(n,r)&&(void 0!==r||t in e)||le(e,t,r)}function pe(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var u=t[a],c=n?n(r[u],e[u],u,r,e):void 0;void 0===c&&(c=e[u]),o?le(r,u,c):fe(r,u,c)}return r}function de(e){return null!=e&&"object"==typeof e}var ve="[object Arguments]";function ye(e){return de(e)&&R(e)==ve}var he=Object.prototype,be=he.hasOwnProperty,me=he.propertyIsEnumerable,_e=ye(function(){return arguments}())?ye:function(e){return de(e)&&be.call(e,"callee")&&!me.call(e,"callee")},ge=Array.isArray;var je="object"==typeof e&&e&&!e.nodeType&&e,Se=je&&"object"==typeof module&&module&&!module.nodeType&&module,Ee=Se&&Se.exports===je?E.Buffer:void 0,Oe=(Ee?Ee.isBuffer:void 0)||function(){return!1},Te=9007199254740991,Ae=/^(?:0|[1-9]\d*)$/;function Fe(e,t){var r=typeof e;return!!(t=null==t?Te:t)&&("number"==r||"symbol"!=r&&Ae.test(e))&&e>-1&&e%1==0&&e<t}var we=9007199254740991;function Ce(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=we}var Pe={};function ke(e){return function(t){return e(t)}}Pe["[object Float32Array]"]=Pe["[object Float64Array]"]=Pe["[object Int8Array]"]=Pe["[object Int16Array]"]=Pe["[object Int32Array]"]=Pe["[object Uint8Array]"]=Pe["[object Uint8ClampedArray]"]=Pe["[object Uint16Array]"]=Pe["[object Uint32Array]"]=!0,Pe["[object Arguments]"]=Pe["[object Array]"]=Pe["[object ArrayBuffer]"]=Pe["[object Boolean]"]=Pe["[object DataView]"]=Pe["[object Date]"]=Pe["[object Error]"]=Pe["[object Function]"]=Pe["[object Map]"]=Pe["[object Number]"]=Pe["[object Object]"]=Pe["[object RegExp]"]=Pe["[object Set]"]=Pe["[object String]"]=Pe["[object WeakMap]"]=!1;var Ie="object"==typeof e&&e&&!e.nodeType&&e,Re=Ie&&"object"==typeof module&&module&&!module.nodeType&&module,Me=Re&&Re.exports===Ie&&j.process,Ue=function(){try{var e=Re&&Re.require&&Re.require("util").types;return e||Me&&Me.binding&&Me.binding("util")}catch(e){}}(),De=Ue&&Ue.isTypedArray,xe=De?ke(De):function(e){return de(e)&&Ce(e.length)&&!!Pe[R(e)]},Ve=Object.prototype.hasOwnProperty;function $e(e,t){var r=ge(e),n=!r&&_e(e),o=!r&&!n&&Oe(e),a=!r&&!n&&!o&&xe(e),i=r||n||o||a,u=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=u.length;for(var l in e)!t&&!Ve.call(e,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Fe(l,c))||u.push(l);return u}var Le=Object.prototype;function Ne(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Le)}function Be(e,t){return function(r){return e(t(r))}}var ze=Be(Object.keys,Object),We=Object.prototype.hasOwnProperty;function Ge(e){return null!=e&&Ce(e.length)&&!$(e)}function He(e){return Ge(e)?$e(e):function(e){if(!Ne(e))return ze(e);var t=[];for(var r in Object(e))We.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var qe=Object.prototype.hasOwnProperty;function Ke(e){if(!M(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=Ne(e),r=[];for(var n in e)("constructor"!=n||!t&&qe.call(e,n))&&r.push(n);return r}function Ye(e){return Ge(e)?$e(e,!0):Ke(e)}var Je="object"==typeof e&&e&&!e.nodeType&&e,Qe=Je&&"object"==typeof module&&module&&!module.nodeType&&module,Xe=Qe&&Qe.exports===Je?E.Buffer:void 0,Ze=Xe?Xe.allocUnsafe:void 0;function et(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function tt(){return[]}var rt=Object.prototype.propertyIsEnumerable,nt=Object.getOwnPropertySymbols,ot=nt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a}(nt(e),function(t){return rt.call(e,t)}))}:tt;function at(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}var it=Be(Object.getPrototypeOf,Object),ut=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)at(t,ot(e)),e=it(e);return t}:tt;function ct(e,t,r){var n=t(e);return ge(e)?n:at(n,r(e))}function lt(e){return ct(e,He,ot)}function st(e){return ct(e,Ye,ut)}var ft=J(E,"DataView"),pt=J(E,"Promise"),dt=J(E,"Set"),vt=J(E,"WeakMap"),yt=W(ft),ht=W(Q),bt=W(pt),mt=W(dt),_t=W(vt),gt=R;(ft&&"[object DataView]"!=gt(new ft(new ArrayBuffer(1)))||Q&&"[object Map]"!=gt(new Q)||pt&&"[object Promise]"!=gt(pt.resolve())||dt&&"[object Set]"!=gt(new dt)||vt&&"[object WeakMap]"!=gt(new vt))&&(gt=function(e){var t=R(e),r="[object Object]"==t?e.constructor:void 0,n=r?W(r):"";if(n)switch(n){case yt:return"[object DataView]";case ht:return"[object Map]";case bt:return"[object Promise]";case mt:return"[object Set]";case _t:return"[object WeakMap]"}return t});var jt=gt,St=Object.prototype.hasOwnProperty;var Et=E.Uint8Array;function Ot(e){var t=new e.constructor(e.byteLength);return new Et(t).set(new Et(e)),t}var Tt=/\w*$/;var At=O?O.prototype:void 0,Ft=At?At.valueOf:void 0;var wt="[object Boolean]",Ct="[object Date]",Pt="[object Map]",kt="[object Number]",It="[object RegExp]",Rt="[object Set]",Mt="[object String]",Ut="[object Symbol]",Dt="[object ArrayBuffer]",xt="[object DataView]",Vt="[object Float32Array]",$t="[object Float64Array]",Lt="[object Int8Array]",Nt="[object Int16Array]",Bt="[object Int32Array]",zt="[object Uint8Array]",Wt="[object Uint8ClampedArray]",Gt="[object Uint16Array]",Ht="[object Uint32Array]";function qt(e,t,r){var n,o,a,i=e.constructor;switch(t){case Dt:return Ot(e);case wt:case Ct:return new i(+e);case xt:return function(e,t){var r=t?Ot(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case Vt:case $t:case Lt:case Nt:case Bt:case zt:case Wt:case Gt:case Ht:return function(e,t){var r=t?Ot(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,r);case Pt:return new i;case kt:case Mt:return new i(e);case It:return(a=new(o=e).constructor(o.source,Tt.exec(o))).lastIndex=o.lastIndex,a;case Rt:return new i;case Ut:return n=e,Ft?Object(Ft.call(n)):{}}}var Kt=Object.create,Yt=function(){function e(){}return function(t){if(!M(t))return{};if(Kt)return Kt(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();var Jt="[object Map]";var Qt=Ue&&Ue.isMap,Xt=Qt?ke(Qt):function(e){return de(e)&&jt(e)==Jt},Zt="[object Set]";var er=Ue&&Ue.isSet,tr=er?ke(er):function(e){return de(e)&&jt(e)==Zt},rr=1,nr=2,or=4,ar="[object Arguments]",ir="[object Function]",ur="[object GeneratorFunction]",cr="[object Object]",lr={};function sr(e,t,r,n,o,a){var i,u=t&rr,c=t&nr,l=t&or;if(r&&(i=o?r(e,n,o,a):r(e)),void 0!==i)return i;if(!M(e))return e;var s=ge(e);if(s){if(i=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&St.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!u)return et(e,i)}else{var f=jt(e),p=f==ir||f==ur;if(Oe(e))return function(e,t){if(t)return e.slice();var r=e.length,n=Ze?Ze(r):new e.constructor(r);return e.copy(n),n}(e,u);if(f==cr||f==ar||p&&!o){if(i=c||p?{}:function(e){return"function"!=typeof e.constructor||Ne(e)?{}:Yt(it(e))}(e),!u)return c?function(e,t){return pe(e,ut(e),t)}(e,function(e,t){return e&&pe(t,Ye(t),e)}(i,e)):function(e,t){return pe(e,ot(e),t)}(e,function(e,t){return e&&pe(t,He(t),e)}(i,e))}else{if(!lr[f])return o?e:{};i=qt(e,f,u)}}a||(a=new ue);var d=a.get(e);if(d)return d;if(a.set(e,i),tr(e))return e.forEach(function(n){i.add(sr(n,t,r,n,e,a))}),i;if(Xt(e))return e.forEach(function(n,o){i.set(o,sr(n,t,r,o,e,a))}),i;var v=l?c?st:lt:c?keysIn:He,y=s?void 0:v(e);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(y||e,function(n,o){y&&(n=e[o=n]),fe(i,o,sr(n,t,r,o,e,a))}),i}lr[ar]=lr["[object Array]"]=lr["[object ArrayBuffer]"]=lr["[object DataView]"]=lr["[object Boolean]"]=lr["[object Date]"]=lr["[object Float32Array]"]=lr["[object Float64Array]"]=lr["[object Int8Array]"]=lr["[object Int16Array]"]=lr["[object Int32Array]"]=lr["[object Map]"]=lr["[object Number]"]=lr[cr]=lr["[object RegExp]"]=lr["[object Set]"]=lr["[object String]"]=lr["[object Symbol]"]=lr["[object Uint8Array]"]=lr["[object Uint8ClampedArray]"]=lr["[object Uint16Array]"]=lr["[object Uint32Array]"]=!0,lr["[object Error]"]=lr[ir]=lr["[object WeakMap]"]=!1;var fr=4;function pr(e){return sr(e,fr)}function dr(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}var vr="[object Symbol]";function yr(e){return"symbol"==typeof e||de(e)&&R(e)==vr}var hr="Expected a function";function br(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(hr);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(br.Cache||ae),r}br.Cache=ae;var mr=500;var _r,gr,jr,Sr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Er=/\\(\\)?/g,Or=(_r=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Sr,function(e,r,n,o){t.push(n?o.replace(Er,"$1"):r||e)}),t},gr=br(_r,function(e){return jr.size===mr&&jr.clear(),e}),jr=gr.cache,gr),Tr=1/0;function Ar(e){if("string"==typeof e||yr(e))return e;var t=e+"";return"0"==t&&1/e==-Tr?"-0":t}var Fr=1/0,wr=O?O.prototype:void 0,Cr=wr?wr.toString:void 0;function Pr(e){if("string"==typeof e)return e;if(ge(e))return dr(e,Pr)+"";if(yr(e))return Cr?Cr.call(e):"";var t=e+"";return"0"==t&&1/e==-Fr?"-0":t}function kr(e){return ge(e)?dr(e,Ar):yr(e)?[e]:et(Or(function(e){return null==e?"":Pr(e)}(e)))}var Ir=function(e){return"function"==typeof e},Rr=function(e){return null!==e&&"object"==typeof e},Mr=function(e){return String(Math.floor(Number(e)))===e},Ur=function(e){return"[object String]"===Object.prototype.toString.call(e)},Dr=function(e){return 0===t.Children.count(e)},xr=function(e){return Rr(e)&&Ir(e.then)};function Vr(e){var t=!1;return[new Promise(function(r,n){e.then(function(e){return t?n({isCanceled:!0}):r(e)},function(e){return n(t?{isCanceled:!0}:e)})}),function(){t=!0}]}function $r(e,t,r,n){void 0===n&&(n=0);for(var o=kr(t);e&&n<o.length;)e=e[o[n++]];return void 0===e?r:e}function Lr(e,t,r){for(var n=pr(e),o=n,a=0,i=kr(t);a<i.length-1;a++){var u=i[a],c=$r(e,i.slice(0,a+1));if(c)o=o[u]=pr(c);else{var l=i[a+1];o=o[u]=Mr(l)&&Number(l)>=0?[]:{}}}return(0===a?e:o)[i[a]]===r?e:(void 0===r?delete o[i[a]]:o[i[a]]=r,0===a&&void 0===r&&delete n[i[a]],n)}function Nr(e,t,r,n){void 0===r&&(r=new WeakMap),void 0===n&&(n={});for(var o=0,a=Object.keys(e);o<a.length;o++){var i=a[o],u=e[i];Rr(u)?r.get(u)||(r.set(u,!0),n[i]=Array.isArray(u)?[]:{},Nr(u,t,r,n[i])):n[i]=t}return n}var Br=t.createContext({}),zr=Br.Provider,Wr=Br.Consumer;function Gr(){return t.useContext(Br)}function Hr(e,t){switch(t.type){case"SET_VALUES":return o({},e,{values:t.payload});case"SET_TOUCHED":return o({},e,{touched:t.payload});case"SET_ERRORS":return o({},e,{errors:t.payload});case"SET_STATUS":return o({},e,{status:t.payload});case"SET_ISSUBMITTING":return o({},e,{isSubmitting:t.payload});case"SET_ISVALIDATING":return o({},e,{isValidating:t.payload});case"SET_FIELD_VALUE":return o({},e,{values:Lr(e.values,t.payload.field,t.payload.value)});case"SET_FIELD_TOUCHED":return o({},e,{touched:Lr(e.touched,t.payload.field,t.payload.value)});case"SET_FIELD_ERROR":return o({},e,{errors:Lr(e.errors,t.payload.field,t.payload.value)});case"RESET_FORM":case"SET_FORMIK_STATE":return o({},e,t.payload);case"SUBMIT_ATTEMPT":return o({},e,{touched:Nr(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return o({},e,{isSubmitting:!1});default:return e}}function qr(e){var r=e.validateOnChange,n=void 0===r||r,i=e.validateOnBlur,u=void 0===i||i,c=e.isInitialValid,l=e.enableReinitialize,f=void 0!==l&&l,p=e.onSubmit,d=a(e,["validateOnChange","validateOnBlur","isInitialValid","enableReinitialize","onSubmit"]),v=o({validateOnChange:n,validateOnBlur:u,onSubmit:p},d),y=t.useRef(v.initialValues),b=t.useRef(v.initialErrors||{}),m=t.useRef(v.initialTouched||{}),_=t.useRef(v.initialStatus),g=t.useRef(!1),j=t.useRef({});t.useEffect(function(){},[c]),t.useEffect(function(){return g.current=!0,function(){g.current=!1}},[]);var S,E,O=t.useReducer(Hr,{values:v.initialValues,errors:v.initialErrors||{},touched:v.initialTouched||{},status:v.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),T=O[0],A=O[1],F=(E=t.useRef(S=T),t.useEffect(function(){E.current=S},[S]),E.current),w=t.useCallback(function(e,t){return new Promise(function(r){var n=v.validate(e,t);void 0===n?r({}):xr(n)?n.then(function(){r({})},function(e){r(e)}):r(n)})},[v.validate]),C=t.useCallback(function(e,t){return new Promise(function(r){var n=v.validationSchema,o=Ir(n)?n(t):n;(t&&o.validateAt?o.validateAt(t,e):Jr(e,o)).then(function(){r({})},function(e){r(Yr(e))})})},[v.validationSchema]),P=t.useCallback(function(e,t){return new Promise(function(r){return r(j.current[e].validate(t))}).then(function(e){return e},function(e){return e})},[j]),k=t.useCallback(function(e){if(null===j.current)return Promise.resolve({});var t=Object.keys(j.current).filter(function(e){return null!==j.current&&j.current[e]&&j.current[e].validate&&Ir(j.current[e].validate)}),r=t.length>0?t.map(function(t){return P(t,$r(e,t))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(r).then(function(e){return e.reduce(function(e,r,n){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===r?e:(r&&(e=Lr(e,t[n],r)),e)},{})})},[P,j]),I=t.useCallback(function(e){return void 0===e&&(e=T.values),v.validationSchema||v.validate||j.current&&Object.keys(j.current).filter(function(e){return!!j.current[e].validate}).length>0?(A({type:"SET_ISVALIDATING",payload:!0}),Promise.all([k(e),v.validationSchema?C(e):{},v.validate?w(e):{}]).then(function(e){var t=h.all([e[0],e[1],e[2]],{arrayMerge:Qr});return s(T.errors,t)||A({type:"SET_ERRORS",payload:t}),A({type:"SET_ISVALIDATING",payload:!1}),t})):Promise.resolve({})},[v.validate,v.validationSchema,k,w,C,T.errors,T.values,j]);t.useEffect(function(){if(F.values!==T.values&&n&&!T.isSubmitting&&null!=g.current){var e=Vr(I()),t=e[1];return e[0].then(function(e){return e}).catch(function(e){return e}),t}},[F.values,T.isSubmitting,T.values,I,n,g]),t.useEffect(function(){if(F.touched!==T.touched&&u&&!T.isSubmitting&&null!=g.current){var e=Vr(I()),t=e[1];return e[0].then(function(e){return e}).catch(function(e){return e}),t}},[F.touched,T.isSubmitting,T.touched,I,u,g]);var R=t.useCallback(function(e){var t=e&&e.values?e.values:y.current?y.current:v.initialValues,r=e&&e.errors?e.values:b.current?b.current:v.initialErrors||{},n=e&&e.touched?e.values:m.current?m.current:v.initialTouched||{},o=e&&e.status?e.status:_.current?_.current:v.initialStatus;y.current=t,b.current=r,m.current=n,_.current=o,A({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:r,touched:n,status:o,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})},[v.initialErrors,v.initialStatus,v.initialTouched,v.initialValues]);t.useEffect(function(){f&&g.current&&!s(y.current,v.initialValues)&&R()},[f,v.initialValues,R]);var M=t.useCallback(function(e){if(null!==j.current&&j.current[e]&&j.current[e].validate&&Ir(j.current[e].validate)){var t=$r(T.values,e),r=j.current[e].validate(t);return xr(r)?(A({type:"SET_ISVALIDATING",payload:!0}),r.then(function(e){return e},function(e){return e}).then(function(t){A({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),A({type:"SET_ISVALIDATING",payload:!1})})):(A({type:"SET_FIELD_ERROR",payload:{field:e,value:r}}),Promise.resolve(r))}return Promise.resolve()},[T.values,j]),U=t.useCallback(function(e,t){null!==j.current&&(j.current[e]={validate:t.validate})},[j]),D=t.useCallback(function(e){null!==j.current&&delete j.current[e]},[j]),x=t.useCallback(function(e){if(Ur(e))return function(r){return t(r,e)};function t(e,t){e.persist&&e.persist();var r=e.target,n=r.name,o=t||(n||r.id);A({type:"SET_FIELD_TOUCHED",payload:{field:o,value:!0}})}t(e)},[]),V=t.useCallback(function(e){if(Ur(e))return function(r){return t(r,e)};function t(e,t){var r,n=t,o=e;if(!Ur(e)){e.persist&&e.persist();var a=e.target,i=a.type,u=a.name,c=a.value,l=a.checked;n=t||(u||a.id),o=/number|range/.test(i)?(r=parseFloat(c),isNaN(r)?"":r):/checkbox/.test(i)?l:c}n&&A({type:"SET_FIELD_VALUE",payload:{field:n,value:o}})}t(e)},[]),$=t.useCallback(function(e){A({type:"SET_TOUCHED",payload:e})},[]),L=t.useCallback(function(e){A({type:"SET_ERRORS",payload:e})},[]),N=t.useCallback(function(e){A({type:"SET_VALUES",payload:e})},[]),B=t.useCallback(function(e,t){A({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})},[]),z=t.useCallback(function(e,t){A({type:"SET_FIELD_VALUE",payload:{field:e,value:t}})},[]),W=t.useCallback(function(e,t){void 0===t&&(t=!0),A({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}})},[]);function G(e){Ir(e)?A({type:"SET_FORMIK_STATE",payload:e(T)}):A({type:"SET_FORMIK_STATE",payload:e})}var H=t.useCallback(function(e){A({type:"SET_STATUS",payload:e})},[]),q=t.useCallback(function(e){A({type:"SET_ISSUBMITTING",payload:e})},[]),K={resetForm:R,validateForm:I,validateField:M,setErrors:L,setFieldError:B,setFieldTouched:W,setFieldValue:z,setStatus:H,setSubmitting:q,setTouched:$,setValues:N,setFormikState:G},Y=t.useCallback(function(){return p(T.values,K)},[K,p,T.values]),J=t.useCallback(function(){return A({type:"SUBMIT_ATTEMPT"}),I().then(function(e){0===Object.keys(e).length?Promise.resolve(Y()).then(function(){g.current&&A({type:"SUBMIT_SUCCESS"})}).catch(function(e){g.current&&A({type:"SUBMIT_FAILURE"})}):g.current&&A({type:"SUBMIT_FAILURE"})})},[Y,I]),Q=t.useCallback(function(e){e&&e.preventDefault&&Ir(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&Ir(e.stopPropagation)&&e.stopPropagation(),J()},[J]),X=t.useCallback(function(){if(v.onReset){var e=v.onReset(T.values,K);xr(e)?e.then(R):R()}else R()},[K,v.onReset,R,T.values]),Z=t.useCallback(function(e){return{value:$r(T.values,e),error:$r(T.errors,e),touched:!!$r(T.touched,e),initialValue:$r(y.current,e),initialTouched:!!$r(m.current,e),initialError:$r(b.current,e)}},[T.errors,T.touched,T.values]),ee=t.useCallback(function(e,t){return[{name:e,value:!t||"radio"!==t&&"checkbox"!==t?$r(T.values,e):void 0,onChange:V,onBlur:x},Z(e)]},[Z,x,V,T.values]),te=t.useMemo(function(){return!s(y.current,T.values)},[T.values]),re=t.useMemo(function(){return void 0!==c?te?T.errors&&0===Object.keys(T.errors).length:!1!==c&&Ir(c)?c(v):c:T.errors&&0===Object.keys(T.errors).length},[c,te,T.errors,v]);return o({},T,{initialValues:y.current,initialErrors:b.current,initialTouched:m.current,initialStatus:_.current,handleBlur:x,handleChange:V,handleReset:X,handleSubmit:Q,resetForm:R,setErrors:L,setFormikState:G,setFieldTouched:W,setFieldValue:z,setFieldError:B,setStatus:H,setSubmitting:q,setTouched:$,setValues:N,submitForm:J,validateForm:I,validateField:M,isValid:re,dirty:te,unregisterField:D,registerField:U,getFieldProps:ee,validateOnBlur:u,validateOnChange:n})}function Kr(e){var r=qr(e),n=e.component,o=e.children,a=e.render;return t.createElement(zr,{value:r},n?t.createElement(n,r):a?a(r):o?Ir(o)?o(r):Dr(o)?null:t.Children.only(o):null)}function Yr(e){var t={};if(0===e.inner.length)return Lr(t,e.path,e.message);for(var r=0,n=e.inner;r<n.length;r++){var o=n[r];t[o.path]||(t=Lr(t,o.path,o.message))}return t}function Jr(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n={});var o={};for(var a in e)if(e.hasOwnProperty(a)){var i=String(a);o[i]=""!==e[i]?e[i]:void 0}return t[r?"validateSync":"validate"](o,{abortEarly:!1,context:n})}function Qr(e,t,r){var n=e.slice();return t.forEach(function(t,o){if(void 0===n[o]){var a=!1!==r.clone&&r.isMergeableObject(t);n[o]=a?h(Array.isArray(t)?[]:{},t,r):t}else r.isMergeableObject(t)?n[o]=h(e[o],t,r):-1===e.indexOf(t)&&n.push(t)}),n}function Xr(e){var r=e.validate,n=e.name,i=e.render,u=e.children,c=e.as,l=void 0===c?"input":c,s=e.component,f=a(e,["validate","name","render","children","as","component"]),p=Gr(),d=a(p,["validate","validationSchema"]);t.useEffect(function(){},[]),t.useEffect(function(){return d.registerField(n,{validate:r}),function(){d.unregisterField(n)}},[d,n,r]);var v=d.getFieldProps(n,f.type),y=v[0],h=v[1],b={field:y,form:d};if(i)return i(b);if(Ir(u))return u(o({},b,{meta:h}));if(s){if("string"==typeof s){var m=f.innerRef,_=a(f,["innerRef"]);return t.createElement(s,o({ref:m},y,_),u)}return t.createElement(s,o({field:y,form:d},f),u)}if("string"==typeof l){m=f.innerRef,_=a(f,["innerRef"]);return t.createElement(l,o({ref:m},y,_),u)}return t.createElement(l,o({},y,f),u)}var Zr=Xr;function en(e){var r=Gr();return t.createElement("form",o({onSubmit:r.handleSubmit,onReset:r.handleReset},e))}function tn(e,t){return e(t={exports:{}},t.exports),t.exports}en.displayName="Form";var rn,nn=tn(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,i=r?Symbol.for("react.strict_mode"):60108,u=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,l=r?Symbol.for("react.context"):60110,s=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,d=r?Symbol.for("react.suspense"):60113,v=r?Symbol.for("react.memo"):60115,y=r?Symbol.for("react.lazy"):60116;function h(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case s:case f:case a:case u:case i:return e;default:switch(e=e&&e.$$typeof){case l:case p:case c:return e;default:return t}}case o:return t}}}function b(e){return h(e)===f}t.typeOf=h,t.AsyncMode=s,t.ConcurrentMode=f,t.ContextConsumer=l,t.ContextProvider=c,t.Element=n,t.ForwardRef=p,t.Fragment=a,t.Profiler=u,t.Portal=o,t.StrictMode=i,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===f||e===u||e===i||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===v||e.$$typeof===c||e.$$typeof===l||e.$$typeof===p)},t.isAsyncMode=function(e){return b(e)||h(e)===s},t.isConcurrentMode=b,t.isContextConsumer=function(e){return h(e)===l},t.isContextProvider=function(e){return h(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return h(e)===p},t.isFragment=function(e){return h(e)===a},t.isProfiler=function(e){return h(e)===u},t.isPortal=function(e){return h(e)===o},t.isStrictMode=function(e){return h(e)===i}});(rn=nn)&&rn.__esModule&&Object.prototype.hasOwnProperty.call(rn,"default");var on=tn(function(e){e.exports=nn}),an={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},un={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},cn={};cn[on.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var ln=Object.defineProperty,sn=Object.getOwnPropertyNames,fn=Object.getOwnPropertySymbols,pn=Object.getOwnPropertyDescriptor,dn=Object.getPrototypeOf,vn=Object.prototype;var yn=function e(t,r,n){if("string"!=typeof r){if(vn){var o=dn(r);o&&o!==vn&&e(t,o,n)}var a=sn(r);fn&&(a=a.concat(fn(r)));for(var i=cn[t.$$typeof]||an,u=cn[r.$$typeof]||an,c=0;c<a.length;++c){var l=a[c];if(!(un[l]||n&&n[l]||u&&u[l]||i&&i[l])){var s=pn(r,l);try{ln(t,l,s)}catch(e){}}}return t}return t};var hn=1,bn=4;function mn(e){return sr(e,hn|bn)}function _n(e){var r=function(r){return t.createElement(Wr,null,function(n){return t.createElement(e,o({},r,{formik:n}))})},n=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return r.WrappedComponent=e,r.displayName="FormikConnect("+n+")",yn(r,e)}var gn=function(e,t,r){var n=(e||[]).slice(),o=n[t];return n.splice(t,1),n.splice(r,0,o),n},jn=function(e,t,r){var n=(e||[]).slice(),o=n[t];return n[t]=n[r],n[r]=o,n},Sn=function(e,t,r){var n=(e||[]).slice();return n.splice(t,0,r),n},En=function(e,t,r){var n=(e||[]).slice();return n[t]=r,n},On=_n(function(e){function r(t){var r=e.call(this,t)||this;return r.updateArrayField=function(e,t,n){var a=r.props,i=a.name,u=a.validateOnChange,c=a.formik,l=c.validateForm;(0,c.setFormikState)(function(r){var a="function"==typeof n?n:e,u="function"==typeof t?t:e;return o({},r,{values:Lr(r.values,i,e($r(r.values,i))),errors:n?Lr(r.errors,i,a($r(r.errors,i))):r.errors,touched:t?Lr(r.touched,i,u($r(r.touched,i))):r.touched})},function(){u&&l()})},r.push=function(e){return r.updateArrayField(function(t){return(t||[]).concat([mn(e)])},!1,!1)},r.handlePush=function(e){return function(){return r.push(e)}},r.swap=function(e,t){return r.updateArrayField(function(r){return jn(r,e,t)},!0,!0)},r.handleSwap=function(e,t){return function(){return r.swap(e,t)}},r.move=function(e,t){return r.updateArrayField(function(r){return gn(r,e,t)},!0,!0)},r.handleMove=function(e,t){return function(){return r.move(e,t)}},r.insert=function(e,t){return r.updateArrayField(function(r){return Sn(r,e,t)},function(t){return Sn(t,e,null)},function(t){return Sn(t,e,null)})},r.handleInsert=function(e,t){return function(){return r.insert(e,t)}},r.replace=function(e,t){return r.updateArrayField(function(r){return En(r,e,t)},!1,!1)},r.handleReplace=function(e,t){return function(){return r.replace(e,t)}},r.unshift=function(e){var t=-1;return r.updateArrayField(function(r){var n=r?[e].concat(r):[e];return t<0&&(t=n.length),n},function(e){var r=e?[null].concat(e):[null];return t<0&&(t=r.length),r},function(e){var r=e?[null].concat(e):[null];return t<0&&(t=r.length),r}),t},r.handleUnshift=function(e){return function(){return r.unshift(e)}},r.handleRemove=function(e){return function(){return r.remove(e)}},r.handlePop=function(){return function(){return r.pop()}},r.remove=r.remove.bind(r),r.pop=r.pop.bind(r),r}return n(r,e),r.prototype.remove=function(e){var t;return this.updateArrayField(function(r){var n=r?r.slice():[];return t||(t=n[e]),Ir(n.splice)&&n.splice(e,1),n},!0,!0),t},r.prototype.pop=function(){var e;return this.updateArrayField(function(t){var r=t;return e||(e=r&&r.pop&&r.pop()),r},!0,!0),e},r.prototype.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},r=this.props,n=r.component,i=r.render,u=r.children,c=r.name,l=r.formik,s=a(l,["validate","validationSchema"]),f=o({},e,{form:s,name:c});return n?t.createElement(n,f):i?i(f):u?"function"==typeof u?u(f):Dr(u)?null:t.Children.only(u):null},r.defaultProps={validateOnChange:!0},r}(t.Component)),Tn=_n(function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.shouldComponentUpdate=function(e){return $r(this.props.formik.errors,this.props.name)!==$r(e.formik.errors,this.props.name)||$r(this.props.formik.touched,this.props.name)!==$r(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},r.prototype.render=function(){var e=this.props,r=e.component,n=e.formik,o=e.render,i=e.children,u=e.name,c=a(e,["component","formik","render","children","name"]),l=$r(n.touched,u),s=$r(n.errors,u);return l&&s?o?Ir(o)?o(s):null:i?Ir(i)?i(s):null:r?t.createElement(r,c,s):s:null},r}(t.Component));e.useFormik=qr,e.Formik=Kr,e.yupToFormErrors=Yr,e.validateYupSchema=Jr,e.useField=function(e,t){return Gr().getFieldProps(e,t)},e.Field=Xr,e.FastField=Zr,e.Form=en,e.withFormik=function(e){var r=e.mapPropsToValues,i=void 0===r?function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&"function"!=typeof e[r]&&(t[r]=e[r]);return t}:r,u=a(e,["mapPropsToValues"]);return function(e){var r=e.displayName||e.name||e.constructor&&e.constructor.name||"Component",c=function(c){function l(){var r=null!==c&&c.apply(this,arguments)||this;return r.validate=function(e){return u.validate(e,r.props)},r.validationSchema=function(){return Ir(u.validationSchema)?u.validationSchema(r.props):u.validationSchema},r.handleSubmit=function(e,t){return u.handleSubmit(e,o({},t,{props:r.props}))},r.renderFormComponent=function(n){return t.createElement(e,o({},r.props,n))},r}return n(l,c),l.prototype.render=function(){var e=this.props,r=a(e,["children"]);return t.createElement(Kr,o({},r,u,{validate:u.validate&&this.validate,validationSchema:u.validationSchema&&this.validationSchema,initialValues:i(this.props),initialStatus:u.mapPropsToStatus&&u.mapPropsToStatus(this.props),initialErrors:u.mapPropsToErrors&&u.mapPropsToErrors(this.props),initialTouched:u.mapPropsToTouched&&u.mapPropsToTouched(this.props),onSubmit:this.handleSubmit,render:this.renderFormComponent}))},l.displayName="WithFormik("+r+")",l}(t.Component);return yn(c,e)}},e.move=gn,e.swap=jn,e.insert=Sn,e.replace=En,e.FieldArray=On,e.isFunction=Ir,e.isObject=Rr,e.isInteger=Mr,e.isString=Ur,e.isNaN=function(e){return e!=e},e.isEmptyChildren=Dr,e.isPromise=xr,e.isInputEvent=function(e){return e&&Rr(e)&&Rr(e.target)},e.getActiveElement=function(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}},e.makeCancelable=Vr,e.getIn=$r,e.setIn=Lr,e.setNestedObjectValues=Nr,e.connect=_n,e.ErrorMessage=Tn,e.FormikProvider=zr,e.FormikConsumer=Wr,e.useFormikContext=Gr,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-fast-compare"),require("deepmerge"),require("lodash-es/clone"),require("lodash-es/toPath"),require("tiny-warning"),require("hoist-non-react-statics"),require("lodash-es/cloneDeep")):"function"==typeof define&&define.amd?define(["exports","react","react-fast-compare","deepmerge","lodash-es/clone","lodash-es/toPath","tiny-warning","hoist-non-react-statics","lodash-es/cloneDeep"],t):(e=e||self,t(e.formik={},e.React,e.isEqual,e.deepmerge,e.clone,e.toPath,e.invariant,e.hoistNonReactStatics,e.cloneDeep))}(this,function(e,t,r,n,a,s,i,l,o){"use strict";r=r&&r.hasOwnProperty("default")?r.default:r,n=n&&n.hasOwnProperty("default")?n.default:n,a=a&&a.hasOwnProperty("default")?a.default:a,s=s&&s.hasOwnProperty("default")?s.default:s,i=i&&i.hasOwnProperty("default")?i.default:i,l=l&&l.hasOwnProperty("default")?l.default:l,o=o&&o.hasOwnProperty("default")?o.default:o;const u=e=>"function"==typeof e,c=e=>null!==e&&"object"==typeof e,d=e=>String(Math.floor(Number(e)))===e,h=e=>"[object String]"===Object.prototype.toString.call(e),p=e=>0===t.Children.count(e),m=e=>c(e)&&u(e.then);function f(e){let t=!1;const r=new Promise((r,n)=>{e.then(e=>t?n({isCanceled:!0}):r(e),e=>n(t?{isCanceled:!0}:e))});return[r,function(){t=!0}]}function v(e,t,r,n=0){const a=s(t);for(;e&&n<a.length;)e=e[a[n++]];return void 0===e?r:e}function y(e,t,r){let n=a(e),i=n,l=0,o=s(t);for(;l<o.length-1;l++){const t=o[l];let r=v(e,o.slice(0,l+1));if(r)i=i[t]=a(r);else{const e=o[l+1];i=i[t]=d(e)&&Number(e)>=0?[]:{}}}return(0===l?e:i)[o[l]]===r?e:(void 0===r?delete i[o[l]]:i[o[l]]=r,0===l&&void 0===r&&delete n[o[l]],n)}function E(e,t,r=new WeakMap,n={}){for(let a of Object.keys(e)){const s=e[a];c(s)?r.get(s)||(r.set(s,!0),n[a]=Array.isArray(s)?[]:{},E(s,t,r,n[a])):n[a]=t}return n}const S=t.createContext({}),T=S.Provider,b=S.Consumer;function g(){return t.useContext(S)}function F(e,t){switch(t.type){case"SET_VALUES":return{...e,values:t.payload};case"SET_TOUCHED":return{...e,touched:t.payload};case"SET_ERRORS":return{...e,errors:t.payload};case"SET_STATUS":return{...e,status:t.payload};case"SET_ISSUBMITTING":return{...e,isSubmitting:t.payload};case"SET_ISVALIDATING":return{...e,isValidating:t.payload};case"SET_FIELD_VALUE":return{...e,values:y(e.values,t.payload.field,t.payload.value)};case"SET_FIELD_TOUCHED":return{...e,touched:y(e.touched,t.payload.field,t.payload.value)};case"SET_FIELD_ERROR":return{...e,errors:y(e.errors,t.payload.field,t.payload.value)};case"RESET_FORM":case"SET_FORMIK_STATE":return{...e,...t.payload};case"SUBMIT_ATTEMPT":return{...e,touched:E(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1};case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return{...e,isSubmitting:!1};default:return e}}function C({validateOnChange:e=!0,validateOnBlur:a=!0,isInitialValid:s,enableReinitialize:i=!1,onSubmit:l,...o}){const c={validateOnChange:e,validateOnBlur:a,onSubmit:l,...o},d=t.useRef(c.initialValues),p=t.useRef(c.initialErrors||{}),E=t.useRef(c.initialTouched||{}),S=t.useRef(c.initialStatus),T=t.useRef(!1),b=t.useRef({});t.useEffect(()=>{},[s]),t.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const[g,C]=t.useReducer(F,{values:c.initialValues,errors:c.initialErrors||{},touched:c.initialTouched||{},status:c.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),_=function(e){const r=t.useRef(e);return t.useEffect(()=>{r.current=e},[e]),r.current}(g),I=t.useCallback((e,t)=>new Promise(r=>{const n=c.validate(e,t);void 0===n?r({}):m(n)?n.then(()=>{r({})},e=>{r(e)}):r(n)}),[c.validate]),P=t.useCallback((e,t)=>new Promise(r=>{const n=c.validationSchema,a=u(n)?n(t):n;let s=t&&a.validateAt?a.validateAt(t,e):O(e,a);s.then(()=>{r({})},e=>{r(k(e))})}),[c.validationSchema]),A=t.useCallback((e,t)=>new Promise(r=>r(b.current[e].validate(t))).then(e=>e,e=>e),[b]),D=t.useCallback(e=>{if(null===b.current)return Promise.resolve({});const t=Object.keys(b.current).filter(e=>null!==b.current&&b.current[e]&&b.current[e].validate&&u(b.current[e].validate)),r=t.length>0?t.map(t=>A(t,v(e,t))):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(r).then(e=>e.reduce((e,r,n)=>"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===r?e:(r&&(e=y(e,t[n],r)),e),{}))},[A,b]),U=t.useCallback((e=g.values)=>c.validationSchema||c.validate||b.current&&Object.keys(b.current).filter(e=>!!b.current[e].validate).length>0?(C({type:"SET_ISVALIDATING",payload:!0}),Promise.all([D(e),c.validationSchema?P(e):{},c.validate?I(e):{}]).then(([e,t,a])=>{const s=n.all([e,t,a],{arrayMerge:R});return r(g.errors,s)||C({type:"SET_ERRORS",payload:s}),C({type:"SET_ISVALIDATING",payload:!1}),s})):Promise.resolve({}),[c.validate,c.validationSchema,D,I,P,g.errors,g.values,b]);t.useEffect(()=>{if(_.values!==g.values&&e&&!g.isSubmitting&&null!=T.current){const[e,t]=f(U());return e.then(e=>e).catch(e=>e),t}},[_.values,g.isSubmitting,g.values,U,e,T]),t.useEffect(()=>{if(_.touched!==g.touched&&a&&!g.isSubmitting&&null!=T.current){const[e,t]=f(U());return e.then(e=>e).catch(e=>e),t}},[_.touched,g.isSubmitting,g.touched,U,a,T]);const L=t.useCallback(e=>{const t=e&&e.values?e.values:d.current?d.current:c.initialValues,r=e&&e.errors?e.values:p.current?p.current:c.initialErrors||{},n=e&&e.touched?e.values:E.current?E.current:c.initialTouched||{},a=e&&e.status?e.status:S.current?S.current:c.initialStatus;d.current=t,p.current=r,E.current=n,S.current=a,C({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:r,touched:n,status:a,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})},[c.initialErrors,c.initialStatus,c.initialTouched,c.initialValues]);t.useEffect(()=>{i&&T.current&&!r(d.current,c.initialValues)&&L()},[i,c.initialValues,L]);const V=t.useCallback(e=>{if(null!==b.current&&b.current[e]&&b.current[e].validate&&u(b.current[e].validate)){const t=v(g.values,e),r=b.current[e].validate(t);return m(r)?(C({type:"SET_ISVALIDATING",payload:!0}),r.then(e=>e,e=>e).then(t=>{C({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),C({type:"SET_ISVALIDATING",payload:!1})})):(C({type:"SET_FIELD_ERROR",payload:{field:e,value:r}}),Promise.resolve(r))}return Promise.resolve()},[g.values,b]),M=t.useCallback((e,{validate:t})=>{null!==b.current&&(b.current[e]={validate:t})},[b]),w=t.useCallback(e=>{null!==b.current&&delete b.current[e]},[b]),N=t.useCallback(e=>{if(h(e))return r=>t(r,e);function t(e,t){e.persist&&e.persist();const{name:r,id:n,outerHTML:a}=e.target,s=t||(r||n);C({type:"SET_FIELD_TOUCHED",payload:{field:s,value:!0}})}t(e)},[]),j=t.useCallback(e=>{if(h(e))return r=>t(r,e);function t(e,t){let r,n=t,a=e;if(!h(e)){e.persist&&e.persist();const{type:s,name:i,id:l,value:o,checked:u,outerHTML:c}=e.target;n=t||(i||l),a=/number|range/.test(s)?(r=parseFloat(o),isNaN(r)?"":r):/checkbox/.test(s)?u:o}n&&C({type:"SET_FIELD_VALUE",payload:{field:n,value:a}})}t(e)},[]),B=t.useCallback(e=>{C({type:"SET_TOUCHED",payload:e})},[]),x=t.useCallback(e=>{C({type:"SET_ERRORS",payload:e})},[]),q=t.useCallback(e=>{C({type:"SET_VALUES",payload:e})},[]),G=t.useCallback((e,t)=>{C({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})},[]),H=t.useCallback((e,t)=>{C({type:"SET_FIELD_VALUE",payload:{field:e,value:t}})},[]),W=t.useCallback((e,t=!0)=>{C({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}})},[]);function K(e){u(e)?C({type:"SET_FORMIK_STATE",payload:e(g)}):C({type:"SET_FORMIK_STATE",payload:e})}const Y=t.useCallback(e=>{C({type:"SET_STATUS",payload:e})},[]),$=t.useCallback(e=>{C({type:"SET_ISSUBMITTING",payload:e})},[]),z={resetForm:L,validateForm:U,validateField:V,setErrors:x,setFieldError:G,setFieldTouched:W,setFieldValue:H,setStatus:Y,setSubmitting:$,setTouched:B,setValues:q,setFormikState:K},J=t.useCallback(()=>l(g.values,z),[z,l,g.values]),Q=t.useCallback(()=>(C({type:"SUBMIT_ATTEMPT"}),U().then(e=>{const t=0===Object.keys(e).length;t?Promise.resolve(J()).then(()=>{T.current&&C({type:"SUBMIT_SUCCESS"})}).catch(e=>{T.current&&C({type:"SUBMIT_FAILURE"})}):T.current&&C({type:"SUBMIT_FAILURE"})})),[J,U]),X=t.useCallback(e=>{e&&e.preventDefault&&u(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&u(e.stopPropagation)&&e.stopPropagation(),Q()},[Q]),Z=t.useCallback(()=>{if(c.onReset){const e=c.onReset(g.values,z);m(e)?e.then(L):L()}else L()},[z,c.onReset,L,g.values]),ee=t.useCallback(e=>({value:v(g.values,e),error:v(g.errors,e),touched:!!v(g.touched,e),initialValue:v(d.current,e),initialTouched:!!v(E.current,e),initialError:v(p.current,e)}),[g.errors,g.touched,g.values]),te=t.useCallback((e,t)=>{const r={name:e,value:!t||"radio"!==t&&"checkbox"!==t?v(g.values,e):void 0,onChange:j,onBlur:N};return[r,ee(e)]},[ee,N,j,g.values]),re=t.useMemo(()=>!r(d.current,g.values),[g.values]),ne=t.useMemo(()=>void 0!==s?re?g.errors&&0===Object.keys(g.errors).length:!1!==s&&u(s)?s(c):s:g.errors&&0===Object.keys(g.errors).length,[s,re,g.errors,c]),ae={...g,initialValues:d.current,initialErrors:p.current,initialTouched:E.current,initialStatus:S.current,handleBlur:N,handleChange:j,handleReset:Z,handleSubmit:X,resetForm:L,setErrors:x,setFormikState:K,setFieldTouched:W,setFieldValue:H,setFieldError:G,setStatus:Y,setSubmitting:$,setTouched:B,setValues:q,submitForm:Q,validateForm:U,validateField:V,isValid:ne,dirty:re,unregisterField:w,registerField:M,getFieldProps:te,validateOnBlur:a,validateOnChange:e};return ae}function _(e){const r=C(e),{component:n,children:a,render:s}=e;return t.createElement(T,{value:r},n?t.createElement(n,r):s?s(r):a?u(a)?a(r):p(a)?null:t.Children.only(a):null)}function k(e){let t={};if(0===e.inner.length)return y(t,e.path,e.message);for(let r of e.inner)t[r.path]||(t=y(t,r.path,r.message));return t}function O(e,t,r=!1,n={}){let a={};for(let t in e)if(e.hasOwnProperty(t)){const r=String(t);a[r]=""!==e[r]?e[r]:void 0}return t[r?"validateSync":"validate"](a,{abortEarly:!1,context:n})}function R(e,t,r){const a=e.slice();return t.forEach(function(t,s){if(void 0===a[s]){const e=!1!==r.clone,i=e&&r.isMergeableObject(t);a[s]=i?n(Array.isArray(t)?[]:{},t,r):t}else r.isMergeableObject(t)?a[s]=n(e[s],t,r):-1===e.indexOf(t)&&a.push(t)}),a}function I({validate:e,name:r,render:n,children:a,as:s="input",component:i,...l}){const{...o}=g();t.useEffect(()=>{},[]),t.useEffect(()=>(o.registerField(r,{validate:e}),()=>{o.unregisterField(r)}),[o,r,e]);const[c,d]=o.getFieldProps(r,l.type),h={field:c,form:o};if(n)return n(h);if(u(a))return a({...h,meta:d});if(i){if("string"==typeof i){const{innerRef:e,...r}=l;return t.createElement(i,{ref:e,...c,...r},a)}return t.createElement(i,{field:c,form:o,...l},a)}if("string"==typeof s){const{innerRef:e,...r}=l;return t.createElement(s,{ref:e,...c,...r},a)}return t.createElement(s,{...c,...l},a)}const P=I;function A(e){const{handleReset:r,handleSubmit:n}=g();return t.createElement("form",Object.assign({onSubmit:n,onReset:r},e))}function D(e){const r=r=>t.createElement(b,null,n=>t.createElement(e,Object.assign({},r,{formik:n}))),n=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return r.WrappedComponent=e,r.displayName=`FormikConnect(${n})`,l(r,e)}A.displayName="Form";const U=(e,t,r)=>{const n=[...e||[]],a=n[t];return n.splice(t,1),n.splice(r,0,a),n},L=(e,t,r)=>{const n=[...e||[]],a=n[t];return n[t]=n[r],n[r]=a,n},V=(e,t,r)=>{const n=[...e||[]];return n.splice(t,0,r),n},M=(e,t,r)=>{const n=[...e||[]];return n[t]=r,n};class w extends t.Component{constructor(e){super(e),this.updateArrayField=((e,t,r)=>{const{name:n,validateOnChange:a,formik:{setFormikState:s,validateForm:i}}=this.props;s(a=>{let s="function"==typeof r?r:e,i="function"==typeof t?t:e;return{...a,values:y(a.values,n,e(v(a.values,n))),errors:r?y(a.errors,n,s(v(a.errors,n))):a.errors,touched:t?y(a.touched,n,i(v(a.touched,n))):a.touched}},()=>{a&&i()})}),this.push=(e=>this.updateArrayField(t=>[...t||[],o(e)],!1,!1)),this.handlePush=(e=>()=>this.push(e)),this.swap=((e,t)=>this.updateArrayField(r=>L(r,e,t),!0,!0)),this.handleSwap=((e,t)=>()=>this.swap(e,t)),this.move=((e,t)=>this.updateArrayField(r=>U(r,e,t),!0,!0)),this.handleMove=((e,t)=>()=>this.move(e,t)),this.insert=((e,t)=>this.updateArrayField(r=>V(r,e,t),t=>V(t,e,null),t=>V(t,e,null))),this.handleInsert=((e,t)=>()=>this.insert(e,t)),this.replace=((e,t)=>this.updateArrayField(r=>M(r,e,t),!1,!1)),this.handleReplace=((e,t)=>()=>this.replace(e,t)),this.unshift=(e=>{let t=-1;return this.updateArrayField(r=>{const n=r?[e,...r]:[e];return t<0&&(t=n.length),n},e=>{const r=e?[null,...e]:[null];return t<0&&(t=r.length),r},e=>{const r=e?[null,...e]:[null];return t<0&&(t=r.length),r}),t}),this.handleUnshift=(e=>()=>this.unshift(e)),this.handleRemove=(e=>()=>this.remove(e)),this.handlePop=(()=>()=>this.pop()),this.remove=this.remove.bind(this),this.pop=this.pop.bind(this)}remove(e){let t;return this.updateArrayField(r=>{const n=r?[...r]:[];return t||(t=n[e]),u(n.splice)&&n.splice(e,1),n},!0,!0),t}pop(){let e;return this.updateArrayField(t=>{const r=t;return e||(e=r&&r.pop&&r.pop()),r},!0,!0),e}render(){const e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},{component:r,render:n,children:a,name:s,formik:{...i}}=this.props,l={...e,form:i,name:s};return r?t.createElement(r,l):n?n(l):a?"function"==typeof a?a(l):p(a)?null:t.Children.only(a):null}}w.defaultProps={validateOnChange:!0};const N=D(w);class j extends t.Component{shouldComponentUpdate(e){return v(this.props.formik.errors,this.props.name)!==v(e.formik.errors,this.props.name)||v(this.props.formik.touched,this.props.name)!==v(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length}render(){let{component:e,formik:r,render:n,children:a,name:s,...i}=this.props;const l=v(r.touched,s),o=v(r.errors,s);return l&&o?n?u(n)?n(o):null:a?u(a)?a(o):null:e?t.createElement(e,i,o):o:null}}const B=D(j);e.ErrorMessage=B,e.FastField=P,e.Field=I,e.FieldArray=N,e.Form=A,e.Formik=_,e.FormikConsumer=b,e.FormikProvider=T,e.connect=D,e.getActiveElement=function(e){if(e=e||("undefined"!=typeof document?document:void 0),void 0===e)return null;try{return e.activeElement||e.body}catch(t){return e.body}},e.getIn=v,e.insert=V,e.isEmptyChildren=p,e.isFunction=u,e.isInputEvent=(e=>e&&c(e)&&c(e.target)),e.isInteger=d,e.isNaN=(e=>e!=e),e.isObject=c,e.isPromise=m,e.isString=h,e.makeCancelable=f,e.move=U,e.replace=M,e.setIn=y,e.setNestedObjectValues=E,e.swap=L,e.useField=function(e,t){const r=g();return r.getFieldProps(e,t)},e.useFormik=C,e.useFormikContext=g,e.validateYupSchema=O,e.withFormik=function({mapPropsToValues:e=(e=>{let t={};for(let r in e)e.hasOwnProperty(r)&&"function"!=typeof e[r]&&(t[r]=e[r]);return t}),...r}){return function(n){const a=n.displayName||n.name||n.constructor&&n.constructor.name||"Component";class s extends t.Component{constructor(){super(...arguments),this.validate=(e=>r.validate(e,this.props)),this.validationSchema=(()=>u(r.validationSchema)?r.validationSchema(this.props):r.validationSchema),this.handleSubmit=((e,t)=>r.handleSubmit(e,{...t,props:this.props})),this.renderFormComponent=(e=>t.createElement(n,Object.assign({},this.props,e)))}render(){const{...n}=this.props;return t.createElement(_,Object.assign({},n,r,{validate:r.validate&&this.validate,validationSchema:r.validationSchema&&this.validationSchema,initialValues:e(this.props),initialStatus:r.mapPropsToStatus&&r.mapPropsToStatus(this.props),initialErrors:r.mapPropsToErrors&&r.mapPropsToErrors(this.props),initialTouched:r.mapPropsToTouched&&r.mapPropsToTouched(this.props),onSubmit:this.handleSubmit,render:this.renderFormComponent}))}}return s.displayName=`WithFormik(${a})`,l(s,n)}},e.yupToFormErrors=k});
//# sourceMappingURL=formik.umd.production.js.map

@@ -0,0 +0,0 @@ import * as React from 'react';

@@ -0,0 +0,0 @@ export * from './Formik';

@@ -1,7 +0,8 @@

'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./formik.cjs.production.js');
} else {
module.exports = require('./formik.cjs.development.js');
}
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./formik.cjs.production.js')
} else {
module.exports = require('./formik.cjs.development.js')
}

@@ -0,0 +0,0 @@ import * as React from 'react';

@@ -0,0 +0,0 @@ import * as React from 'react';

@@ -0,0 +0,0 @@ import * as React from 'react';

{
"name": "formik",
"description": "Forms in React, without tears",
"version": "2.0.1-alpha.5",
"version": "2.0.1-alpha.51",
"license": "MIT",

@@ -19,3 +19,4 @@ "author": "Jared Palmer <jared@palmer.net>",

"main": "dist/index.js",
"module": "dist/formik.esm.js",
"umd:main": "dist/formik.umd.production.js",
"module": "dist/formik.es.production.js",
"typings": "dist/index.d.ts",

@@ -29,7 +30,7 @@ "files": [

"scripts": {
"test": "jest --env=jsdom",
"test:watch": "npm run test -- --watch",
"start": "cp-cli ./index.js ./dist/index.js && cross-env NODE_ENV=development rollup -w -c | tsc -w -p tsconfig.base.json",
"test": "tsdx test --env=jsdom",
"test:watch": "npm run test -- --watchAll",
"start": "cross-env NODE_ENV=development tsdx watch",
"prebuild": "rimraf dist",
"build": "cross-env NODE_ENV=production tsc -p tsconfig.base.json && rollup -c && rimraf compiled && cp-cli ./index.js ./dist/index.js",
"build": "cross-env NODE_ENV=production tsdx build",
"prepublish": "npm run build",

@@ -47,3 +48,3 @@ "format": "prettier --trailing-comma es5 --single-quote --write 'src/**/*' 'test/**/*' 'README.md'",

"deepmerge": "^2.1.1",
"hoist-non-react-statics": "^3.2.1",
"hoist-non-react-statics": "^3.3.0",
"lodash": "^4.17.11",

@@ -64,3 +65,3 @@ "lodash-es": "^4.17.11",

"@storybook/react": "^3.4.0",
"@types/hoist-non-react-statics": "^3.0.1",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/jest": "^22.2.3",

@@ -77,5 +78,2 @@ "@types/lodash": "^4.14.119",

"babel-eslint": "9.x",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"babel-plugin-dev-expression": "^0.2.1",
"babel-plugin-transform-rename-import": "^2.3.0",
"cp-cli": "^1.1.2",

@@ -94,3 +92,2 @@ "cross-env": "5.0.5",

"husky": "0.14.3",
"jest": "^24.1.0",
"lint-staged": "4.0.2",

@@ -103,13 +100,3 @@ "prettier": "^1.17.1",

"rimraf": "^2.6.2",
"rollup": "^1.1.2",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-size-snapshot": "^0.8.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-terser": "^4.0.2",
"size-limit": "^0.17.0",
"ts-jest": "^22.4.6",
"tsc-watch": "^1.0.21",
"tsdx": "^0.5.11",
"typescript": "^3.4.5",

@@ -136,17 +123,2 @@ "yup": "0.21.3"

"<rootDir>/test/setupTests.ts"
],
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"testMatch": [
"<rootDir>/test/**/?(*.)(spec|test).ts?(x)"
],
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"json"
]

@@ -153,0 +125,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc