Socket
Socket
Sign inDemoInstall

formik

Package Overview
Dependencies
8
Maintainers
1
Versions
212
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.7 to 2.0.8-canary.2

4

dist/connect.d.ts
import * as React from 'react';
import { FormikContextType } from './types';
/**
* Connect any component to Formik context, and inject as a prop called `formik`;
* @param Comp React Component
*/
export declare function connect<OuterProps, Values = {}>(Comp: React.ComponentType<OuterProps & {
formik: FormikContextType<Values>;
}>): React.ComponentType<OuterProps>;

@@ -10,2 +10,3 @@ import * as React from 'react';

export declare type FastFieldConfig<T> = FieldConfig & {
/** Override FastField's default shouldComponentUpdate */
shouldUpdate?: (nextProps: T & GenericFieldHTMLAttributes, props: {}) => boolean;

@@ -12,0 +13,0 @@ };

@@ -9,10 +9,32 @@ import * as React from 'react';

export interface FieldConfig {
/**
* Field component to render. Can either be a string like 'select' or a component.
*/
component?: keyof JSX.IntrinsicElements | React.ComponentType<FieldProps<any>> | React.ComponentType;
/**
* Component to render. Can either be a string e.g. 'select', 'input', or 'textarea', or a component.
*/
as?: React.ComponentType<FieldProps<any>['field']> | keyof JSX.IntrinsicElements | React.ComponentType;
/**
* Render prop (works like React router's <Route render={props =>} />)
* @deprecated
*/
render?: (props: FieldProps<any>) => React.ReactNode;
/**
* Children render function <Field name>{props => ...}</Field>)
*/
children?: ((props: FieldProps<any>) => React.ReactNode) | React.ReactNode;
/**
* Validate a single field value independently
*/
validate?: FieldValidator;
/**
* Field name
*/
name: string;
/** HTML input type */
type?: string;
/** Field value */
value?: any;
/** Inner ref */
innerRef?: (instance: any) => void;

@@ -24,2 +46,3 @@ }

export declare function useField<Val = any>(propsOrFieldName: string | FieldAttributes<Val>): [FieldInputProps<Val>, FieldMetaProps<Val>];
export declare function Field({ validate, name, render, children, as: is, component, ...props }: FieldAttributes<any>): any;
export declare function Field({ validate, name, render, children, as: is, // `as` is reserved in typescript lol
component, ...props }: FieldAttributes<any>): any;

@@ -8,23 +8,44 @@ import * as React from 'react';

export declare type FieldArrayConfig = {
/** Really the path to the array field to be updated */
name: string;
/** Should field array validate the form AFTER array updates/changes? */
validateOnChange?: boolean;
} & SharedRenderProps<FieldArrayRenderProps>;
export interface ArrayHelpers {
/** Imperatively add a value to the end of an array */
push: (obj: any) => void;
/** Curried fn to add a value to the end of an array */
handlePush: (obj: any) => () => void;
/** Imperatively swap two values in an array */
swap: (indexA: number, indexB: number) => void;
/** Curried fn to swap two values in an array */
handleSwap: (indexA: number, indexB: number) => () => void;
/** Imperatively move an element in an array to another index */
move: (from: number, to: number) => void;
/** Imperatively move an element in an array to another index */
handleMove: (from: number, to: number) => () => void;
/** Imperatively insert an element at a given index into the array */
insert: (index: number, value: any) => void;
/** Curried fn to insert an element at a given index into the array */
handleInsert: (index: number, value: any) => () => void;
/** Imperatively replace a value at an index of an array */
replace: (index: number, value: any) => void;
/** Curried fn to replace an element at a given index into the array */
handleReplace: (index: number, value: any) => () => void;
/** Imperatively add an element to the beginning of an array and return its length */
unshift: (value: any) => number;
/** Curried fn to add an element to the beginning of an array */
handleUnshift: (value: any) => () => void;
/** Curried fn to remove an element at an index of an array */
handleRemove: (index: number) => () => void;
/** Curried fn to remove a value from the end of the array */
handlePop: () => () => void;
/** Imperatively remove and element at an index of an array */
remove<T>(index: number): T | undefined;
/** Imperatively remove and return value from the end of the array */
pop<T>(): T | undefined;
}
/**
* Some array helpers!
*/
export declare const move: (array: any[], from: number, to: number) => unknown[];

@@ -31,0 +52,0 @@ export declare const swap: (arrayLike: ArrayLike<any>, indexA: number, indexB: number) => unknown[];

2

dist/Form.d.ts
import * as React from 'react';
export declare type FormikFormProps = Pick<React.FormHTMLAttributes<HTMLFormElement>, Exclude<keyof React.FormHTMLAttributes<HTMLFormElement>, 'onReset' | 'onSubmit'>>;
export declare const Form: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "acceptCharset" | "action" | "autoComplete" | "encType" | "method" | "name" | "noValidate" | "target" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & React.RefAttributes<HTMLFormElement>>;
export declare const Form: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "acceptCharset" | "action" | "autoComplete" | "encType" | "method" | "name" | "noValidate" | "target" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & React.RefAttributes<HTMLFormElement>>;

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

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

@@ -43,4 +43,13 @@ import * as React from 'react';

export declare function Formik<Values extends FormikValues = FormikValues, ExtraProps = {}>(props: FormikConfig<Values> & ExtraProps): JSX.Element;
/**
* Transform Yup ValidationError to a more usable object
*/
export declare function yupToFormErrors<Values>(yupError: any): FormikErrors<Values>;
/**
* Validate a yup schema.
*/
export declare function validateYupSchema<T extends FormikValues>(values: T, schema: any, sync?: boolean, context?: any): Promise<Partial<T>>;
/**
* Recursively prepare values.
*/
export declare function prepareDataForValidation<T extends FormikValues>(values: T): FormikValues;

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-fast-compare"),require("deepmerge"),require("lodash-es/isPlainObject"),require("lodash-es/clone"),require("lodash-es/toPath"),require("tiny-warning"),require("scheduler"),require("hoist-non-react-statics"),require("lodash-es/cloneDeep")):"function"==typeof define&&define.amd?define(["exports","react","react-fast-compare","deepmerge","lodash-es/isPlainObject","lodash-es/clone","lodash-es/toPath","tiny-warning","scheduler","hoist-non-react-statics","lodash-es/cloneDeep"],t):t((e=e||self).formik={},e.React,e.isEqual,e.deepmerge,e.isPlainObject,e.clone,e.toPath,e.invariant,e.scheduler,e.hoistNonReactStatics,e.cloneDeep)}(this,function(e,t,r,n,i,a,o,u,l,s,c){"use strict";function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function p(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(i[r]=e[r]);return i}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}r=r&&r.hasOwnProperty("default")?r.default:r,n=n&&n.hasOwnProperty("default")?n.default:n,i=i&&i.hasOwnProperty("default")?i.default:i,a=a&&a.hasOwnProperty("default")?a.default:a,o=o&&o.hasOwnProperty("default")?o.default:o,u=u&&u.hasOwnProperty("default")?u.default:u,s=s&&s.hasOwnProperty("default")?s.default:s,c=c&&c.hasOwnProperty("default")?c.default:c;var v=function(e){return Array.isArray(e)&&0===e.length},m=function(e){return"function"==typeof e},y=function(e){return null!==e&&"object"==typeof e},E=function(e){return String(Math.floor(Number(e)))===e},S=function(e){return"[object String]"===Object.prototype.toString.call(e)},T=function(e){return 0===t.Children.count(e)},g=function(e){return y(e)&&m(e.then)};function b(e,t,r,n){void 0===n&&(n=0);for(var i=o(t);e&&n<i.length;)e=e[i[n++]];return void 0===e?r:e}function F(e,t,r){for(var n=a(e),i=n,u=0,l=o(t);u<l.length-1;u++){var s=l[u],c=b(e,l.slice(0,u+1));if(c&&(y(c)||Array.isArray(c)))i=i[s]=a(c);else{var d=l[u+1];i=i[s]=E(d)&&Number(d)>=0?[]:{}}}return(0===u?e:i)[l[u]]===r?e:(void 0===r||v(r)?delete i[l[u]]:i[l[u]]=r,(0===u&&void 0===r||v(r))&&delete n[l[u]],n)}function O(e,t,r,n){void 0===r&&(r=new WeakMap),void 0===n&&(n={});for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],u=e[o];y(u)?r.get(u)||(r.set(u,!0),n[o]=Array.isArray(u)?[]:{},O(u,t,r,n[o])):n[o]=t}return n}var k=t.createContext(void 0),R=k.Provider,C=k.Consumer;function _(){var e=t.useContext(k);return e||u(!1),e}function A(e,t){switch(t.type){case"SET_VALUES":return d({},e,{values:t.payload});case"SET_TOUCHED":return d({},e,{touched:t.payload});case"SET_ERRORS":return r(e.errors,t.payload)?e:d({},e,{errors:t.payload});case"SET_STATUS":return d({},e,{status:t.payload});case"SET_ISSUBMITTING":return d({},e,{isSubmitting:t.payload});case"SET_ISVALIDATING":return d({},e,{isValidating:t.payload});case"SET_FIELD_VALUE":return d({},e,{values:F(e.values,t.payload.field,t.payload.value)});case"SET_FIELD_TOUCHED":return d({},e,{touched:F(e.touched,t.payload.field,t.payload.value)});case"SET_FIELD_ERROR":return d({},e,{errors:F(e.errors,t.payload.field,t.payload.value)});case"RESET_FORM":return d({},e,t.payload);case"SET_FORMIK_STATE":return t.payload(e);case"SUBMIT_ATTEMPT":return d({},e,{touched:O(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return d({},e,{isSubmitting:!1});default:return e}}var P={},I={};function w(e){var i=e.validateOnChange,a=void 0===i||i,o=e.validateOnBlur,u=void 0===o||o,s=e.validateOnMount,c=void 0!==s&&s,f=e.isInitialValid,h=e.enableReinitialize,v=void 0!==h&&h,E=e.onSubmit,T=p(e,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),O=d({validateOnChange:a,validateOnBlur:u,validateOnMount:c,onSubmit:E},T),k=t.useRef(O.initialValues),R=t.useRef(O.initialErrors||P),C=t.useRef(O.initialTouched||I),_=t.useRef(O.initialStatus),w=t.useRef(!1),U=t.useRef({});t.useEffect(function(){},[]),t.useEffect(function(){return w.current=!0,function(){w.current=!1}},[]);var M=t.useReducer(A,{values:O.initialValues,errors:O.initialErrors||P,touched:O.initialTouched||I,status:O.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),L=M[0],B=M[1],x=t.useCallback(function(e,t){return new Promise(function(r,n){var i=O.validate(e,t);null==i?r(P):g(i)?i.then(function(e){r(e||P)},function(e){n(e)}):r(i)})},[O.validate]),q=t.useCallback(function(e,t){var r=O.validationSchema,n=m(r)?r(t):r,i=t&&n.validateAt?n.validateAt(t,e):D(e,n);return new Promise(function(e,t){i.then(function(){e(P)},function(r){"ValidationError"===r.name?e(V(r)):t(r)})})},[O.validationSchema]),G=t.useCallback(function(e,t){return new Promise(function(r){return r(U.current[e].validate(t))})},[]),W=t.useCallback(function(e){var t=Object.keys(U.current).filter(function(e){return m(U.current[e].validate)}),r=t.length>0?t.map(function(t){return G(t,b(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=F(e,t[n],r)),e)},{})})},[G]),H=t.useCallback(function(e){return Promise.all([W(e),O.validationSchema?q(e):{},O.validate?x(e):{}]).then(function(e){return n.all([e[0],e[1],e[2]],{arrayMerge:j})})},[O.validate,O.validationSchema,W,x,q]),K=N(function(e){return void 0===e&&(e=L.values),l.unstable_runWithPriority(l.LowPriority,function(){return H(e).then(function(e){return w.current&&B({type:"SET_ERRORS",payload:e}),e})})}),Y=N(function(e){return void 0===e&&(e=L.values),B({type:"SET_ISVALIDATING",payload:!0}),H(e).then(function(e){return w.current&&(B({type:"SET_ISVALIDATING",payload:!1}),r(L.errors,e)||B({type:"SET_ERRORS",payload:e})),e})});t.useEffect(function(){c&&!0===w.current&&K(O.initialValues)},[O.initialValues,c,K]);var z=t.useCallback(function(e){var t=e&&e.values?e.values:k.current,r=e&&e.errors?e.errors:R.current?R.current:O.initialErrors||{},n=e&&e.touched?e.touched:C.current?C.current:O.initialTouched||{},i=e&&e.status?e.status:_.current?_.current:O.initialStatus;k.current=t,R.current=r,C.current=n,_.current=i,B({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:r,touched:n,status:i,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})},[O.initialErrors,O.initialStatus,O.initialTouched]);t.useEffect(function(){v&&!0===w.current&&!r(k.current,O.initialValues)&&(k.current=O.initialValues,z())},[v,O.initialValues,z]),t.useEffect(function(){v&&!0===w.current&&!r(R.current,O.initialErrors)&&(R.current=O.initialErrors||P,B({type:"SET_ERRORS",payload:O.initialErrors||P}))},[v,O.initialErrors]),t.useEffect(function(){v&&!0===w.current&&!r(C.current,O.initialTouched)&&(C.current=O.initialTouched||I,B({type:"SET_TOUCHED",payload:O.initialTouched||I}))},[v,O.initialTouched]),t.useEffect(function(){v&&!0===w.current&&!r(_.current,O.initialStatus)&&(_.current=O.initialStatus,B({type:"SET_STATUS",payload:O.initialStatus}))},[v,O.initialStatus,O.initialTouched]);var J=N(function(e){if(m(U.current[e].validate)){var t=b(L.values,e),r=U.current[e].validate(t);return g(r)?(B({type:"SET_ISVALIDATING",payload:!0}),r.then(function(e){return e}).then(function(t){B({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),B({type:"SET_ISVALIDATING",payload:!1})})):(B({type:"SET_FIELD_ERROR",payload:{field:e,value:r}}),Promise.resolve(r))}return Promise.resolve()}),Q=t.useCallback(function(e,t){U.current[e]={validate:t.validate}},[]),X=t.useCallback(function(e){delete U.current[e]},[]),Z=N(function(e){return B({type:"SET_TOUCHED",payload:e}),u?K(L.values):Promise.resolve()}),$=t.useCallback(function(e){B({type:"SET_ERRORS",payload:e})},[]),ee=N(function(e){return B({type:"SET_VALUES",payload:e}),a?K(e):Promise.resolve()}),te=t.useCallback(function(e,t){B({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})},[]),re=N(function(e,t,r){return void 0===r&&(r=!0),B({type:"SET_FIELD_VALUE",payload:{field:e,value:t}}),a&&r?K(F(L.values,e,t)):Promise.resolve()}),ne=t.useCallback(function(e,t){var r,n=t,i=e;if(!S(e)){e.persist&&e.persist();var a=e.target?e.target:e.currentTarget,o=a.type,u=a.value,l=a.checked,s=a.options,c=a.multiple;n=t||a.name||a.id,i=/number|range/.test(o)?(r=parseFloat(u),isNaN(r)?"":r):/checkbox/.test(o)?function(e,t,r){if("true"==r||"false"==r)return!!t;if(t&&r)return Array.isArray(e)?e.concat(r):[r];if(!Array.isArray(e))return!e;var n=e.indexOf(r);return n<0?e:e.slice(0,n).concat(e.slice(n+1))}(b(L.values,n),l,u):c?function(e){return Array.from(e).filter(function(e){return e.selected}).map(function(e){return e.value})}(s):u}n&&re(n,i)},[re,L.values]),ie=t.useCallback(function(e){if(S(e))return function(t){return ne(t,e)};ne(e)},[ne]),ae=N(function(e,t,r){return void 0===t&&(t=!0),void 0===r&&(r=!0),B({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}}),u&&r?K(L.values):Promise.resolve()}),oe=t.useCallback(function(e,t){e.persist&&e.persist();var r=e.target;ae(t||r.name||r.id,!0)},[ae]),ue=t.useCallback(function(e){if(S(e))return function(t){return oe(t,e)};oe(e)},[oe]),le=t.useCallback(function(e){m(e)?B({type:"SET_FORMIK_STATE",payload:e}):B({type:"SET_FORMIK_STATE",payload:function(){return e}})},[]),se=t.useCallback(function(e){B({type:"SET_STATUS",payload:e})},[]),ce=t.useCallback(function(e){B({type:"SET_ISSUBMITTING",payload:e})},[]),de={resetForm:z,validateForm:Y,validateField:J,setErrors:$,setFieldError:te,setFieldTouched:ae,setFieldValue:re,setStatus:se,setSubmitting:ce,setTouched:Z,setValues:ee,setFormikState:le},fe=N(function(){return E(L.values,de)}),pe=N(function(){return B({type:"SUBMIT_ATTEMPT"}),Y().then(function(e){if(0===Object.keys(e).length){var t=fe();if(void 0===t)return;return Promise.resolve(t).then(function(){w.current&&B({type:"SUBMIT_SUCCESS"})}).catch(function(e){if(w.current)throw B({type:"SUBMIT_FAILURE"}),e})}if(w.current)throw B({type:"SUBMIT_FAILURE"}),e})}),he=N(function(e){e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),pe()}),ve=N(function(e){if(e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),O.onReset){var t=O.onReset(L.values,de);g(t)?t.then(z):z()}else z()}),me=t.useCallback(function(e){return{value:b(L.values,e),error:b(L.errors,e),touched:!!b(L.touched,e),initialValue:b(k.current,e),initialTouched:!!b(C.current,e),initialError:b(R.current,e)}},[L.errors,L.touched,L.values]),ye=t.useCallback(function(e){var t=y(e),r=t?e.name:e,n=b(L.values,r),i={name:r,value:n,onChange:ie,onBlur:ue};if(t){var a=e.type,o=e.value,u=e.as,l=e.multiple;"checkbox"===a?void 0===o?i.checked=!!n:(i.checked=!(!Array.isArray(n)||!~n.indexOf(o)),i.value=o):"radio"===a?(i.checked=n===o,i.value=o):"select"===u&&l&&(i.value=i.value||[],i.multiple=!0)}return i},[ue,ie,L.values]),Ee=t.useMemo(function(){return!r(k.current,L.values)},[k.current,L.values]),Se=t.useMemo(function(){return void 0!==f?Ee?L.errors&&0===Object.keys(L.errors).length:!1!==f&&m(f)?f(O):f:L.errors&&0===Object.keys(L.errors).length},[f,Ee,L.errors,O]);return d({},L,{initialValues:k.current,initialErrors:R.current,initialTouched:C.current,initialStatus:_.current,handleBlur:ue,handleChange:ie,handleReset:ve,handleSubmit:he,resetForm:z,setErrors:$,setFormikState:le,setFieldTouched:ae,setFieldValue:re,setFieldError:te,setStatus:se,setSubmitting:ce,setTouched:Z,setValues:ee,submitForm:pe,validateForm:Y,validateField:J,isValid:Se,dirty:Ee,unregisterField:X,registerField:Q,getFieldProps:ye,getFieldMeta:me,validateOnBlur:u,validateOnChange:a,validateOnMount:c})}function U(e){var r=w(e),n=e.component,i=e.children,a=e.render;return t.useEffect(function(){},[]),t.createElement(R,{value:r},n?t.createElement(n,r):a?a(r):i?m(i)?i(r):T(i)?null:t.Children.only(i):null)}function V(e){var t={};if(e.inner){if(0===e.inner.length)return F(t,e.path,e.message);var r=e.inner,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var a;if(n){if(i>=r.length)break;a=r[i++]}else{if((i=r.next()).done)break;a=i.value}var o=a;b(t,o.path)||(t=F(t,o.path,o.message))}}return t}function D(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n={});var i=M(e);return t[r?"validateSync":"validate"](i,{abortEarly:!1,context:n})}function M(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=String(r);t[n]=!0===Array.isArray(e[n])?e[n].map(function(e){return!0===Array.isArray(e)||i(e)?M(e):""!==e?e:void 0}):i(e[n])?M(e[n]):""!==e[n]?e[n]:void 0}return t}function j(e,t,r){var i=e.slice();return t.forEach(function(t,a){if(void 0===i[a]){var o=!1!==r.clone&&r.isMergeableObject(t);i[a]=o?n(Array.isArray(t)?[]:{},t,r):t}else r.isMergeableObject(t)?i[a]=n(e[a],t,r):-1===e.indexOf(t)&&i.push(t)}),i}var L="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function N(e){var r=t.useRef(e);return L(function(){r.current=e}),t.useCallback(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.current.apply(void 0,t)},[])}var B=t.forwardRef(function(e,r){var n=e.action,i=p(e,["action"]),a=n||"#",o=_();return t.createElement("form",Object.assign({onSubmit:o.handleSubmit,ref:r,onReset:o.handleReset,action:a},i))});function x(e){var r=function(r){return t.createElement(C,null,function(n){return n||u(!1),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+")",s(r,e)}B.displayName="Form";var q=function(e,t,r){var n=K(e),i=n[t];return n.splice(t,1),n.splice(r,0,i),n},G=function(e,t,r){var n=K(e),i=n[t];return n[t]=n[r],n[r]=i,n},W=function(e,t,r){var n=K(e);return n.splice(t,0,r),n},H=function(e,t,r){var n=K(e);return n[t]=r,n},K=function(e){if(e){if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,t){return t>e?t:e},0);return Array.from(d({},e,{length:t+1}))}return[]},Y=function(e){function r(t){var r;return(r=e.call(this,t)||this).updateArrayField=function(e,t,n){var i=r.props,a=i.name,o=i.validateOnChange,u=i.formik,l=u.validateForm;(0,u.setFormikState)(function(r){var i="function"==typeof n?n:e,o="function"==typeof t?t:e;return d({},r,{values:F(r.values,a,e(b(r.values,a))),errors:n?F(r.errors,a,i(b(r.errors,a))):r.errors,touched:t?F(r.touched,a,o(b(r.touched,a))):r.touched})},function(){o&&l()})},r.push=function(e){return r.updateArrayField(function(t){return[].concat(K(t),[c(e)])},!1,!1)},r.handlePush=function(e){return function(){return r.push(e)}},r.swap=function(e,t){return r.updateArrayField(function(r){return G(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 q(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 W(r,e,t)},function(t){return W(t,e,null)},function(t){return W(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 H(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(h(r)),r.pop=r.pop.bind(h(r)),r}f(r,e);var n=r.prototype;return n.remove=function(e){var t;return this.updateArrayField(function(r){var n=r?K(r):[];return t||(t=n[e]),m(n.splice)&&n.splice(e,1),n},!0,!0),t},n.pop=function(){var e;return this.updateArrayField(function(t){var r=t;return e||(e=r&&r.pop&&r.pop()),r},!0,!0),e},n.render=function(){var e=this.props,r=e.component,n=e.render,i=e.children,a=e.name,o=d({},{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},{form:p(e.formik,["validate","validationSchema"]),name:a});return r?t.createElement(r,o):n?n(o):i?"function"==typeof i?i(o):T(i)?null:t.Children.only(i):null},r}(t.Component);Y.defaultProps={validateOnChange:!0};var z=x(Y),J=x(function(e){function r(){return e.apply(this,arguments)||this}f(r,e);var n=r.prototype;return n.shouldComponentUpdate=function(e){return b(this.props.formik.errors,this.props.name)!==b(e.formik.errors,this.props.name)||b(this.props.formik.touched,this.props.name)!==b(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},n.render=function(){var e=this.props,r=e.component,n=e.formik,i=e.render,a=e.children,o=e.name,u=p(e,["component","formik","render","children","name"]),l=b(n.touched,o),s=b(n.errors,o);return l&&s?i?m(i)?i(s):null:a?m(a)?a(s):null:r?t.createElement(r,u,s):s:null},r}(t.Component)),Q=x(function(e){function r(t){var r;r=e.call(this,t)||this;var n=t.render,i=t.children,a=t.component,o=t.as;return n&&u(!1),a&&n&&u(!1),o&&i&&m(i)&&u(!1),a&&i&&m(i)&&u(!1),n&&i&&!T(i)&&u(!1),r}f(r,e);var n=r.prototype;return n.shouldComponentUpdate=function(e){return this.props.shouldUpdate?this.props.shouldUpdate(e,this.props):e.name!==this.props.name||b(e.formik.values,this.props.name)!==b(this.props.formik.values,this.props.name)||b(e.formik.errors,this.props.name)!==b(this.props.formik.errors,this.props.name)||b(e.formik.touched,this.props.name)!==b(this.props.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length||e.formik.isSubmitting!==this.props.formik.isSubmitting},n.componentDidMount=function(){this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentDidUpdate=function(e){this.props.name!==e.name&&(this.props.formik.unregisterField(e.name),this.props.formik.registerField(this.props.name,{validate:this.props.validate})),this.props.validate!==e.validate&&this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentWillUnmount=function(){this.props.formik.unregisterField(this.props.name)},n.render=function(){var e=this.props,r=e.name,n=e.render,i=e.as,a=e.children,o=e.component,u=e.formik,l=p(e,["validate","name","render","as","children","component","shouldUpdate","formik"]),s=p(u,["validate","validationSchema"]),c={value:"radio"===l.type||"checkbox"===l.type?l.value:b(u.values,r),name:r,onChange:u.handleChange,onBlur:u.handleBlur},f={field:c,meta:{value:b(u.values,r),error:b(u.errors,r),touched:!!b(u.touched,r),initialValue:b(u.initialValues,r),initialTouched:!!b(u.initialTouched,r),initialError:b(u.initialErrors,r)},form:s};if(n)return n(f);if(m(a))return a(f);if(o){if("string"==typeof o){var h=l.innerRef,v=p(l,["innerRef"]);return t.createElement(o,d({ref:h},c,v),a)}return t.createElement(o,d({field:c,form:u},l),a)}var y=i||"input";if("string"==typeof y){var E=l.innerRef,S=p(l,["innerRef"]);return t.createElement(y,d({ref:E},c,S),a)}return t.createElement(y,d({},c,l),a)},r}(t.Component));e.ErrorMessage=J,e.FastField=Q,e.Field=function(e){var r=e.validate,n=e.name,i=e.render,a=e.children,o=e.as,u=e.component,l=p(e,["validate","name","render","children","as","component"]),s=p(_(),["validate","validationSchema"]);t.useEffect(function(){},[]);var c=s.registerField,f=s.unregisterField;t.useEffect(function(){return c(n,{validate:r}),function(){f(n)}},[c,f,n,r]);var h=s.getFieldProps(d({name:n},l)),v=s.getFieldMeta(n),y={field:h,form:s};if(i)return i(d({},y,{meta:v}));if(m(a))return a(d({},y,{meta:v}));if(u){if("string"==typeof u){var E=l.innerRef,S=p(l,["innerRef"]);return t.createElement(u,d({ref:E},h,S),a)}return t.createElement(u,d({field:h,form:s},l),a)}var T=o||"input";if("string"==typeof T){var g=l.innerRef,b=p(l,["innerRef"]);return t.createElement(T,d({ref:g},h,b),a)}return t.createElement(T,d({},h,l),a)},e.FieldArray=z,e.Form=B,e.Formik=U,e.FormikConsumer=C,e.FormikContext=k,e.FormikProvider=R,e.connect=x,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.getIn=b,e.insert=W,e.isEmptyArray=v,e.isEmptyChildren=T,e.isFunction=m,e.isInputEvent=function(e){return e&&y(e)&&y(e.target)},e.isInteger=E,e.isNaN=function(e){return e!=e},e.isObject=y,e.isPromise=g,e.isString=S,e.move=q,e.prepareDataForValidation=M,e.replace=H,e.setIn=F,e.setNestedObjectValues=O,e.swap=G,e.useField=function(e){var r=_(),n=r.getFieldProps,i=r.getFieldMeta,a=r.registerField,o=r.unregisterField,l=y(e),s=l?e.name:e,c=l?e.validate:void 0;return t.useEffect(function(){return s&&a(s,{validate:c}),function(){s&&o(s)}},[a,o,s,c]),y(e)?(e.name||u(!1),[n(e),i(e.name)]):[n({name:e}),i(e)]},e.useFormik=w,e.useFormikContext=_,e.validateYupSchema=D,e.withFormik=function(e){var r=e.mapPropsToValues,n=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,i=p(e,["mapPropsToValues"]);return function(e){var r=e.displayName||e.name||e.constructor&&e.constructor.name||"Component",a=function(r){function a(){var n;return(n=r.apply(this,arguments)||this).validate=function(e){return i.validate(e,n.props)},n.validationSchema=function(){return m(i.validationSchema)?i.validationSchema(n.props):i.validationSchema},n.handleSubmit=function(e,t){return i.handleSubmit(e,d({},t,{props:n.props}))},n.renderFormComponent=function(r){return t.createElement(e,Object.assign({},n.props,r))},n}return f(a,r),a.prototype.render=function(){var e=p(this.props,["children"]);return t.createElement(U,Object.assign({},e,i,{validate:i.validate&&this.validate,validationSchema:i.validationSchema&&this.validationSchema,initialValues:n(this.props),initialStatus:i.mapPropsToStatus&&i.mapPropsToStatus(this.props),initialErrors:i.mapPropsToErrors&&i.mapPropsToErrors(this.props),initialTouched:i.mapPropsToTouched&&i.mapPropsToTouched(this.props),onSubmit:this.handleSubmit,children:this.renderFormComponent}))},a}(t.Component);return a.displayName="WithFormik("+r+")",s(a,e)}},e.yupToFormErrors=V});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-fast-compare"),require("deepmerge"),require("lodash-es/isPlainObject"),require("lodash-es/clone"),require("lodash-es/toPath"),require("tiny-warning"),require("scheduler"),require("hoist-non-react-statics"),require("lodash-es/cloneDeep")):"function"==typeof define&&define.amd?define(["exports","react","react-fast-compare","deepmerge","lodash-es/isPlainObject","lodash-es/clone","lodash-es/toPath","tiny-warning","scheduler","hoist-non-react-statics","lodash-es/cloneDeep"],t):t((e=e||self).formik={},e.React,e.isEqual,e.deepmerge,e.isPlainObject,e.clone,e.toPath,e.invariant,e.scheduler,e.hoistNonReactStatics,e.cloneDeep)}(this,function(e,t,r,n,i,a,o,u,s,l,c){"use strict";function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function f(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(i[r]=e[r]);return i}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}r=r&&r.hasOwnProperty("default")?r.default:r,n=n&&n.hasOwnProperty("default")?n.default:n,i=i&&i.hasOwnProperty("default")?i.default:i,a=a&&a.hasOwnProperty("default")?a.default:a,o=o&&o.hasOwnProperty("default")?o.default:o,u=u&&u.hasOwnProperty("default")?u.default:u,l=l&&l.hasOwnProperty("default")?l.default:l,c=c&&c.hasOwnProperty("default")?c.default:c;var v=function(e){return Array.isArray(e)&&0===e.length},m=function(e){return"function"==typeof e},y=function(e){return null!==e&&"object"==typeof e},E=function(e){return String(Math.floor(Number(e)))===e},S=function(e){return"[object String]"===Object.prototype.toString.call(e)},T=function(e){return 0===t.Children.count(e)},g=function(e){return y(e)&&m(e.then)};function b(e,t,r,n){void 0===n&&(n=0);for(var i=o(t);e&&n<i.length;)e=e[i[n++]];return void 0===e?r:e}function F(e,t,r){for(var n=a(e),i=n,u=0,s=o(t);u<s.length-1;u++){var l=s[u],c=b(e,s.slice(0,u+1));if(c&&(y(c)||Array.isArray(c)))i=i[l]=a(c);else{var d=s[u+1];i=i[l]=E(d)&&Number(d)>=0?[]:{}}}return(0===u?e:i)[s[u]]===r?e:(void 0===r||v(r)?delete i[s[u]]:i[s[u]]=r,(0===u&&void 0===r||v(r))&&delete n[s[u]],n)}function k(e,t,r,n){void 0===r&&(r=new WeakMap),void 0===n&&(n={});for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],u=e[o];y(u)?r.get(u)||(r.set(u,!0),n[o]=Array.isArray(u)?[]:{},k(u,t,r,n[o])):n[o]=t}return n}var O=t.createContext(void 0),R=O.Provider,C=O.Consumer;function _(){var e=t.useContext(O);return e||u(!1),e}function A(e,t){switch(t.type){case"SET_VALUES":return d({},e,{values:t.payload});case"SET_TOUCHED":return d({},e,{touched:t.payload});case"SET_ERRORS":return r(e.errors,t.payload)?e:d({},e,{errors:t.payload});case"SET_STATUS":return d({},e,{status:t.payload});case"SET_ISSUBMITTING":return d({},e,{isSubmitting:t.payload});case"SET_ISVALIDATING":return d({},e,{isValidating:t.payload});case"SET_FIELD_VALUE":return d({},e,{values:F(e.values,t.payload.field,t.payload.value)});case"SET_FIELD_TOUCHED":return d({},e,{touched:F(e.touched,t.payload.field,t.payload.value)});case"SET_FIELD_ERROR":return d({},e,{errors:F(e.errors,t.payload.field,t.payload.value)});case"RESET_FORM":return d({},e,{},t.payload);case"SET_FORMIK_STATE":return t.payload(e);case"SUBMIT_ATTEMPT":return d({},e,{touched:k(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return d({},e,{isSubmitting:!1});default:return e}}var P={},I={};function w(e){var i=e.validateOnChange,a=void 0===i||i,o=e.validateOnBlur,u=void 0===o||o,l=e.validateOnMount,c=void 0!==l&&l,p=e.isInitialValid,h=e.enableReinitialize,v=void 0!==h&&h,E=e.onSubmit,T=f(e,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),k=d({validateOnChange:a,validateOnBlur:u,validateOnMount:c,onSubmit:E},T),O=t.useRef(k.initialValues),R=t.useRef(k.initialErrors||P),C=t.useRef(k.initialTouched||I),_=t.useRef(k.initialStatus),w=t.useRef(!1),U=t.useRef({});t.useEffect(function(){},[]),t.useEffect(function(){return w.current=!0,function(){w.current=!1}},[]);var M=t.useReducer(A,{values:k.initialValues,errors:k.initialErrors||P,touched:k.initialTouched||I,status:k.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),L=M[0],B=M[1],x=t.useCallback(function(e,t){return new Promise(function(r,n){var i=k.validate(e,t);null==i?r(P):g(i)?i.then(function(e){r(e||P)},function(e){n(e)}):r(i)})},[k.validate]),q=t.useCallback(function(e,t){var r=k.validationSchema,n=m(r)?r(t):r,i=t&&n.validateAt?n.validateAt(t,e):V(e,n);return new Promise(function(e,t){i.then(function(){e(P)},function(r){"ValidationError"===r.name?e(D(r)):t(r)})})},[k.validationSchema]),G=t.useCallback(function(e,t){return new Promise(function(r){return r(U.current[e].validate(t))})},[]),W=t.useCallback(function(e){var t=Object.keys(U.current).filter(function(e){return m(U.current[e].validate)}),r=t.length>0?t.map(function(t){return G(t,b(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=F(e,t[n],r)),e)},{})})},[G]),H=t.useCallback(function(e){return Promise.all([W(e),k.validationSchema?q(e):{},k.validate?x(e):{}]).then(function(e){return n.all([e[0],e[1],e[2]],{arrayMerge:j})})},[k.validate,k.validationSchema,W,x,q]),K=N(function(e){return void 0===e&&(e=L.values),s.unstable_runWithPriority(s.LowPriority,function(){return H(e).then(function(e){return w.current&&B({type:"SET_ERRORS",payload:e}),e})})}),Y=N(function(e){return void 0===e&&(e=L.values),B({type:"SET_ISVALIDATING",payload:!0}),H(e).then(function(e){return w.current&&(B({type:"SET_ISVALIDATING",payload:!1}),r(L.errors,e)||B({type:"SET_ERRORS",payload:e})),e})});t.useEffect(function(){c&&!0===w.current&&K(k.initialValues)},[k.initialValues,c,K]);var z=t.useCallback(function(e){var t=e&&e.values?e.values:O.current,r=e&&e.errors?e.errors:R.current?R.current:k.initialErrors||{},n=e&&e.touched?e.touched:C.current?C.current:k.initialTouched||{},i=e&&e.status?e.status:_.current?_.current:k.initialStatus;O.current=t,R.current=r,C.current=n,_.current=i,B({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:r,touched:n,status:i,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})},[k.initialErrors,k.initialStatus,k.initialTouched]);t.useEffect(function(){v&&!0===w.current&&!r(O.current,k.initialValues)&&(O.current=k.initialValues,z())},[v,k.initialValues,z]),t.useEffect(function(){v&&!0===w.current&&!r(R.current,k.initialErrors)&&(R.current=k.initialErrors||P,B({type:"SET_ERRORS",payload:k.initialErrors||P}))},[v,k.initialErrors]),t.useEffect(function(){v&&!0===w.current&&!r(C.current,k.initialTouched)&&(C.current=k.initialTouched||I,B({type:"SET_TOUCHED",payload:k.initialTouched||I}))},[v,k.initialTouched]),t.useEffect(function(){v&&!0===w.current&&!r(_.current,k.initialStatus)&&(_.current=k.initialStatus,B({type:"SET_STATUS",payload:k.initialStatus}))},[v,k.initialStatus,k.initialTouched]);var J=N(function(e){if(m(U.current[e].validate)){var t=b(L.values,e),r=U.current[e].validate(t);return g(r)?(B({type:"SET_ISVALIDATING",payload:!0}),r.then(function(e){return e}).then(function(t){B({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),B({type:"SET_ISVALIDATING",payload:!1})})):(B({type:"SET_FIELD_ERROR",payload:{field:e,value:r}}),Promise.resolve(r))}return Promise.resolve()}),Q=t.useCallback(function(e,t){U.current[e]={validate:t.validate}},[]),X=t.useCallback(function(e){delete U.current[e]},[]),Z=N(function(e){return B({type:"SET_TOUCHED",payload:e}),u?K(L.values):Promise.resolve()}),$=t.useCallback(function(e){B({type:"SET_ERRORS",payload:e})},[]),ee=N(function(e){return B({type:"SET_VALUES",payload:e}),a?K(e):Promise.resolve()}),te=t.useCallback(function(e,t){B({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})},[]),re=N(function(e,t,r){return void 0===r&&(r=!0),B({type:"SET_FIELD_VALUE",payload:{field:e,value:t}}),a&&r?K(F(L.values,e,t)):Promise.resolve()}),ne=t.useCallback(function(e,t){var r,n=t,i=e;if(!S(e)){e.persist&&e.persist();var a=e.target?e.target:e.currentTarget,o=a.type,u=a.value,s=a.checked,l=a.options,c=a.multiple;n=t||a.name||a.id,i=/number|range/.test(o)?(r=parseFloat(u),isNaN(r)?"":r):/checkbox/.test(o)?function(e,t,r){if("true"==r||"false"==r)return!!t;if(t&&r)return Array.isArray(e)?e.concat(r):[r];if(!Array.isArray(e))return!e;var n=e.indexOf(r);return n<0?e:e.slice(0,n).concat(e.slice(n+1))}(b(L.values,n),s,u):c?function(e){return Array.from(e).filter(function(e){return e.selected}).map(function(e){return e.value})}(l):u}n&&re(n,i)},[re,L.values]),ie=t.useCallback(function(e){if(S(e))return function(t){return ne(t,e)};ne(e)},[ne]),ae=N(function(e,t,r){return void 0===t&&(t=!0),void 0===r&&(r=!0),B({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}}),u&&r?K(L.values):Promise.resolve()}),oe=t.useCallback(function(e,t){e.persist&&e.persist();var r=e.target;ae(t||r.name||r.id,!0)},[ae]),ue=t.useCallback(function(e){if(S(e))return function(t){return oe(t,e)};oe(e)},[oe]),se=t.useCallback(function(e){m(e)?B({type:"SET_FORMIK_STATE",payload:e}):B({type:"SET_FORMIK_STATE",payload:function(){return e}})},[]),le=t.useCallback(function(e){B({type:"SET_STATUS",payload:e})},[]),ce=t.useCallback(function(e){B({type:"SET_ISSUBMITTING",payload:e})},[]),de={resetForm:z,validateForm:Y,validateField:J,setErrors:$,setFieldError:te,setFieldTouched:ae,setFieldValue:re,setStatus:le,setSubmitting:ce,setTouched:Z,setValues:ee,setFormikState:se},pe=N(function(){return E(L.values,de)}),fe=N(function(){return B({type:"SUBMIT_ATTEMPT"}),Y().then(function(e){var t=e instanceof Error;if(!t&&0===Object.keys(e).length){var r;try{if(void 0===(r=pe()))return}catch(e){throw e}return Promise.resolve(r).then(function(){w.current&&B({type:"SUBMIT_SUCCESS"})}).catch(function(e){if(w.current)throw B({type:"SUBMIT_FAILURE"}),e})}if(w.current&&(B({type:"SUBMIT_FAILURE"}),t))throw e})}),he=N(function(e){e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),fe()}),ve=N(function(e){if(e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),k.onReset){var t=k.onReset(L.values,de);g(t)?t.then(z):z()}else z()}),me=t.useCallback(function(e){return{value:b(L.values,e),error:b(L.errors,e),touched:!!b(L.touched,e),initialValue:b(O.current,e),initialTouched:!!b(C.current,e),initialError:b(R.current,e)}},[L.errors,L.touched,L.values]),ye=t.useCallback(function(e){var t=y(e),r=t?e.name:e,n=b(L.values,r),i={name:r,value:n,onChange:ie,onBlur:ue};if(t){var a=e.type,o=e.value,u=e.as,s=e.multiple;"checkbox"===a?void 0===o?i.checked=!!n:(i.checked=!(!Array.isArray(n)||!~n.indexOf(o)),i.value=o):"radio"===a?(i.checked=n===o,i.value=o):"select"===u&&s&&(i.value=i.value||[],i.multiple=!0)}return i},[ue,ie,L.values]),Ee=t.useMemo(function(){return!r(O.current,L.values)},[O.current,L.values]),Se=t.useMemo(function(){return void 0!==p?Ee?L.errors&&0===Object.keys(L.errors).length:!1!==p&&m(p)?p(k):p:L.errors&&0===Object.keys(L.errors).length},[p,Ee,L.errors,k]);return d({},L,{initialValues:O.current,initialErrors:R.current,initialTouched:C.current,initialStatus:_.current,handleBlur:ue,handleChange:ie,handleReset:ve,handleSubmit:he,resetForm:z,setErrors:$,setFormikState:se,setFieldTouched:ae,setFieldValue:re,setFieldError:te,setStatus:le,setSubmitting:ce,setTouched:Z,setValues:ee,submitForm:fe,validateForm:Y,validateField:J,isValid:Se,dirty:Ee,unregisterField:X,registerField:Q,getFieldProps:ye,getFieldMeta:me,validateOnBlur:u,validateOnChange:a,validateOnMount:c})}function U(e){var r=w(e),n=e.component,i=e.children,a=e.render;return t.useEffect(function(){},[]),t.createElement(R,{value:r},n?t.createElement(n,r):a?a(r):i?m(i)?i(r):T(i)?null:t.Children.only(i):null)}function D(e){var t={};if(e.inner){if(0===e.inner.length)return F(t,e.path,e.message);var r=e.inner,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var a;if(n){if(i>=r.length)break;a=r[i++]}else{if((i=r.next()).done)break;a=i.value}var o=a;b(t,o.path)||(t=F(t,o.path,o.message))}}return t}function V(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n={});var i=M(e);return t[r?"validateSync":"validate"](i,{abortEarly:!1,context:n})}function M(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=String(r);t[n]=!0===Array.isArray(e[n])?e[n].map(function(e){return!0===Array.isArray(e)||i(e)?M(e):""!==e?e:void 0}):i(e[n])?M(e[n]):""!==e[n]?e[n]:void 0}return t}function j(e,t,r){var i=e.slice();return t.forEach(function(t,a){if(void 0===i[a]){var o=!1!==r.clone&&r.isMergeableObject(t);i[a]=o?n(Array.isArray(t)?[]:{},t,r):t}else r.isMergeableObject(t)?i[a]=n(e[a],t,r):-1===e.indexOf(t)&&i.push(t)}),i}var L="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function N(e){var r=t.useRef(e);return L(function(){r.current=e}),t.useCallback(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.current.apply(void 0,t)},[])}var B=t.forwardRef(function(e,r){var n=e.action,i=f(e,["action"]),a=n||"#",o=_();return t.createElement("form",Object.assign({onSubmit:o.handleSubmit,ref:r,onReset:o.handleReset,action:a},i))});function x(e){var r=function(r){return t.createElement(C,null,function(n){return n||u(!1),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)}B.displayName="Form";var q=function(e,t,r){var n=K(e),i=n[t];return n.splice(t,1),n.splice(r,0,i),n},G=function(e,t,r){var n=K(e),i=n[t];return n[t]=n[r],n[r]=i,n},W=function(e,t,r){var n=K(e);return n.splice(t,0,r),n},H=function(e,t,r){var n=K(e);return n[t]=r,n},K=function(e){if(e){if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,t){return t>e?t:e},0);return Array.from(d({},e,{length:t+1}))}return[]},Y=function(e){function n(t){var r;return(r=e.call(this,t)||this).updateArrayField=function(e,t,n){var i=r.props,a=i.name;(0,i.formik.setFormikState)(function(r){var i="function"==typeof n?n:e,o="function"==typeof t?t:e;return d({},r,{values:F(r.values,a,e(b(r.values,a))),errors:n?F(r.errors,a,i(b(r.errors,a))):r.errors,touched:t?F(r.touched,a,o(b(r.touched,a))):r.touched})})},r.push=function(e){return r.updateArrayField(function(t){return[].concat(K(t),[c(e)])},!1,!1)},r.handlePush=function(e){return function(){return r.push(e)}},r.swap=function(e,t){return r.updateArrayField(function(r){return G(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 q(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 W(r,e,t)},function(t){return W(t,e,null)},function(t){return W(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 H(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(h(r)),r.pop=r.pop.bind(h(r)),r}p(n,e);var i=n.prototype;return i.componentDidUpdate=function(e){!r(b(e.formik.values,e.name),b(this.props.formik.values,this.props.name))&&this.props.formik.validateOnChange&&this.props.formik.validateForm()},i.remove=function(e){var t;return this.updateArrayField(function(r){var n=r?K(r):[];return t||(t=n[e]),m(n.splice)&&n.splice(e,1),n},!0,!0),t},i.pop=function(){var e;return this.updateArrayField(function(t){var r=t;return e||(e=r&&r.pop&&r.pop()),r},!0,!0),e},i.render=function(){var e=this.props,r=e.component,n=e.render,i=e.children,a=e.name,o=d({},{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},{form:f(e.formik,["validate","validationSchema"]),name:a});return r?t.createElement(r,o):n?n(o):i?"function"==typeof i?i(o):T(i)?null:t.Children.only(i):null},n}(t.Component);Y.defaultProps={validateOnChange:!0};var z=x(Y),J=x(function(e){function r(){return e.apply(this,arguments)||this}p(r,e);var n=r.prototype;return n.shouldComponentUpdate=function(e){return b(this.props.formik.errors,this.props.name)!==b(e.formik.errors,this.props.name)||b(this.props.formik.touched,this.props.name)!==b(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},n.render=function(){var e=this.props,r=e.component,n=e.formik,i=e.render,a=e.children,o=e.name,u=f(e,["component","formik","render","children","name"]),s=b(n.touched,o),l=b(n.errors,o);return s&&l?i?m(i)?i(l):null:a?m(a)?a(l):null:r?t.createElement(r,u,l):l:null},r}(t.Component)),Q=x(function(e){function r(t){var r;r=e.call(this,t)||this;var n=t.render,i=t.children,a=t.component,o=t.as;return n&&u(!1),a&&n&&u(!1),o&&i&&m(i)&&u(!1),a&&i&&m(i)&&u(!1),n&&i&&!T(i)&&u(!1),r}p(r,e);var n=r.prototype;return n.shouldComponentUpdate=function(e){return this.props.shouldUpdate?this.props.shouldUpdate(e,this.props):e.name!==this.props.name||b(e.formik.values,this.props.name)!==b(this.props.formik.values,this.props.name)||b(e.formik.errors,this.props.name)!==b(this.props.formik.errors,this.props.name)||b(e.formik.touched,this.props.name)!==b(this.props.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length||e.formik.isSubmitting!==this.props.formik.isSubmitting},n.componentDidMount=function(){this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentDidUpdate=function(e){this.props.name!==e.name&&(this.props.formik.unregisterField(e.name),this.props.formik.registerField(this.props.name,{validate:this.props.validate})),this.props.validate!==e.validate&&this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentWillUnmount=function(){this.props.formik.unregisterField(this.props.name)},n.render=function(){var e=this.props,r=e.name,n=e.render,i=e.as,a=e.children,o=e.component,u=e.formik,s=f(e,["validate","name","render","as","children","component","shouldUpdate","formik"]),l=f(u,["validate","validationSchema"]),c={value:"radio"===s.type||"checkbox"===s.type?s.value:b(u.values,r),name:r,onChange:u.handleChange,onBlur:u.handleBlur},p={field:c,meta:{value:b(u.values,r),error:b(u.errors,r),touched:!!b(u.touched,r),initialValue:b(u.initialValues,r),initialTouched:!!b(u.initialTouched,r),initialError:b(u.initialErrors,r)},form:l};if(n)return n(p);if(m(a))return a(p);if(o){if("string"==typeof o){var h=s.innerRef,v=f(s,["innerRef"]);return t.createElement(o,d({ref:h},c,{},v),a)}return t.createElement(o,d({field:c,form:u},s),a)}var y=i||"input";if("string"==typeof y){var E=s.innerRef,S=f(s,["innerRef"]);return t.createElement(y,d({ref:E},c,{},S),a)}return t.createElement(y,d({},c,{},s),a)},r}(t.Component));e.ErrorMessage=J,e.FastField=Q,e.Field=function(e){var r=e.validate,n=e.name,i=e.render,a=e.children,o=e.as,u=e.component,s=f(e,["validate","name","render","children","as","component"]),l=f(_(),["validate","validationSchema"]);t.useEffect(function(){},[]);var c=l.registerField,p=l.unregisterField;t.useEffect(function(){return c(n,{validate:r}),function(){p(n)}},[c,p,n,r]);var h=l.getFieldProps(d({name:n},s)),v=l.getFieldMeta(n),y={field:h,form:l};if(i)return i(d({},y,{meta:v}));if(m(a))return a(d({},y,{meta:v}));if(u){if("string"==typeof u){var E=s.innerRef,S=f(s,["innerRef"]);return t.createElement(u,d({ref:E},h,{},S),a)}return t.createElement(u,d({field:h,form:l},s),a)}var T=o||"input";if("string"==typeof T){var g=s.innerRef,b=f(s,["innerRef"]);return t.createElement(T,d({ref:g},h,{},b),a)}return t.createElement(T,d({},h,{},s),a)},e.FieldArray=z,e.Form=B,e.Formik=U,e.FormikConsumer=C,e.FormikContext=O,e.FormikProvider=R,e.connect=x,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.getIn=b,e.insert=W,e.isEmptyArray=v,e.isEmptyChildren=T,e.isFunction=m,e.isInputEvent=function(e){return e&&y(e)&&y(e.target)},e.isInteger=E,e.isNaN=function(e){return e!=e},e.isObject=y,e.isPromise=g,e.isString=S,e.move=q,e.prepareDataForValidation=M,e.replace=H,e.setIn=F,e.setNestedObjectValues=k,e.swap=G,e.useField=function(e){var r=_(),n=r.getFieldProps,i=r.getFieldMeta,a=r.registerField,o=r.unregisterField,s=y(e),l=s?e.name:e,c=s?e.validate:void 0;return t.useEffect(function(){return l&&a(l,{validate:c}),function(){l&&o(l)}},[a,o,l,c]),y(e)?(e.name||u(!1),[n(e),i(e.name)]):[n({name:e}),i(e)]},e.useFormik=w,e.useFormikContext=_,e.validateYupSchema=V,e.withFormik=function(e){var r=e.mapPropsToValues,n=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,i=f(e,["mapPropsToValues"]);return function(e){var r=e.displayName||e.name||e.constructor&&e.constructor.name||"Component",a=function(r){function a(){var n;return(n=r.apply(this,arguments)||this).validate=function(e){return i.validate(e,n.props)},n.validationSchema=function(){return m(i.validationSchema)?i.validationSchema(n.props):i.validationSchema},n.handleSubmit=function(e,t){return i.handleSubmit(e,d({},t,{props:n.props}))},n.renderFormComponent=function(r){return t.createElement(e,Object.assign({},n.props,r))},n}return p(a,r),a.prototype.render=function(){var e=f(this.props,["children"]);return t.createElement(U,Object.assign({},e,i,{validate:i.validate&&this.validate,validationSchema:i.validationSchema&&this.validationSchema,initialValues:n(this.props),initialStatus:i.mapPropsToStatus&&i.mapPropsToStatus(this.props),initialErrors:i.mapPropsToErrors&&i.mapPropsToErrors(this.props),initialTouched:i.mapPropsToTouched&&i.mapPropsToTouched(this.props),onSubmit:this.handleSubmit,children:this.renderFormComponent}))},a}(t.Component);return a.displayName="WithFormik("+r+")",l(a,e)}},e.yupToFormErrors=D});
//# sourceMappingURL=formik.umd.production.min.js.map
import * as React from 'react';
import { FormikContextType } from './types';
export declare const FormikContext: React.Context<FormikContextType<any>>;
export declare const FormikProvider: React.ProviderExoticComponent<React.ProviderProps<FormikContextType<any>>>;
export declare const FormikConsumer: React.ExoticComponent<React.ConsumerProps<FormikContextType<any>>>;
export declare const FormikProvider: React.Provider<FormikContextType<any>>;
export declare const FormikConsumer: React.Consumer<FormikContextType<any>>;
export declare function useFormikContext<Values>(): FormikContextType<Values>;
import * as React from 'react';
/**
* Values of fields in the form
*/
export interface FormikValues {
[field: string]: any;
}
/**
* An object containing error messages whose keys correspond to FormikValues.
* Should be always be and object of strings, but any is allowed to support i18n libraries.
*/
export declare type FormikErrors<Values> = {
[K in keyof Values]?: Values[K] extends any[] ? Values[K][number] extends object ? FormikErrors<Values[K][number]>[] | string | string[] : string | string[] : Values[K] extends object ? FormikErrors<Values[K]> : string;
};
/**
* An object containing touched state of the form whose keys correspond to FormikValues.
*/
export declare type FormikTouched<Values> = {
[K in keyof Values]?: Values[K] extends any[] ? Values[K][number] extends object ? FormikTouched<Values[K][number]>[] : boolean : Values[K] extends object ? FormikTouched<Values[K]> : boolean;
};
/**
* Formik state tree
*/
export interface FormikState<Values> {
/** Form values */
values: Values;
/** map of field names to specific error for that field */
errors: FormikErrors<Values>;
/** map of field names to whether the field has been touched */
touched: FormikTouched<Values>;
/** whether the form is currently submitting */
isSubmitting: boolean;
/** whether the form is currently validating (prior to submission) */
isValidating: boolean;
/** Top level status state, in case you need it */
status?: any;
/** Number of times user tried to submit the form */
submitCount: number;
}
/**
* Formik computed properties. These are read-only.
*/
export interface FormikComputedProps<Values> {
/** True if any input has been touched. False otherwise. */
readonly dirty: boolean;
/** True if state.errors is empty */
readonly isValid: boolean;
/** The initial values of the form */
readonly initialValues: Values;
/** The initial errors of the form */
readonly initialErrors: FormikErrors<Values>;
/** The initial visited fields of the form */
readonly initialTouched: FormikTouched<Values>;
/** The initial status of the form */
readonly initialStatus?: any;
}
/**
* Formik state helpers
*/
export interface FormikHelpers<Values> {
/** Manually set top level status. */
setStatus(status?: any): void;
/** Manually set errors object */
setErrors(errors: FormikErrors<Values>): void;
/** Manually set isSubmitting */
setSubmitting(isSubmitting: boolean): void;
/** Manually set touched object */
setTouched(touched: FormikTouched<Values>): void;
/** Manually set values object */
setValues(values: Values): void;
/** Set value of form field directly */
setFieldValue(field: string, value: any, shouldValidate?: boolean): void;
/** Set error message of a form field directly */
setFieldError(field: string, message: string): void;
/** Set whether field has been touched directly */
setFieldTouched(field: string, isTouched?: boolean, shouldValidate?: boolean): void;
/** Validate form values */
validateForm(values?: any): Promise<FormikErrors<Values>>;
/** Validate field value */
validateField(field: string): void;
/** Reset form */
resetForm(nextState?: Partial<FormikState<Values>>): void;
/** Set Formik state, careful! */
setFormikState(f: FormikState<Values> | ((prevState: FormikState<Values>) => FormikState<Values>), cb?: () => void): void;
}
/**
* Formik form event handlers
*/
export interface FormikHandlers {
/** Form submit handler */
handleSubmit: (e?: React.FormEvent<HTMLFormElement>) => void;
/** Reset form event handler */
handleReset: (e?: React.SyntheticEvent<any>) => void;
/** Classic React blur handler, keyed by input name */
handleBlur(e: React.FocusEvent<any>): void;
/** Preact-like linkState. Will return a handleBlur function. */
handleBlur<T = string | any>(fieldOrEvent: T): T extends string ? ((e: any) => void) : void;
/** Classic React change handler, keyed by input name */
handleChange(e: React.ChangeEvent<any>): void;
/** Preact-like linkState. Will return a handleChange function. */
handleChange<T = string | React.ChangeEvent<any>>(field: T): T extends React.ChangeEvent<any> ? void : ((e: string | React.ChangeEvent<any>) => void);

@@ -52,25 +105,72 @@ getFieldProps<Value = any>(props: any): FieldInputProps<Value>;

}
/**
* Base formik configuration/props shared between the HoC and Component.
*/
export interface FormikSharedConfig<Props = {}> {
/** Tells Formik to validate the form on each input's onChange event */
validateOnChange?: boolean;
/** Tells Formik to validate the form on each input's onBlur event */
validateOnBlur?: boolean;
/** Tells Formik to validate upon mount */
validateOnMount?: boolean;
/** Tell Formik if initial form values are valid or not on first render */
isInitialValid?: boolean | ((props: Props) => boolean);
/** Should Formik reset the form when new initialValues change */
enableReinitialize?: boolean;
}
/**
* <Formik /> props
*/
export interface FormikConfig<Values> extends FormikSharedConfig {
/**
* Form component to render
*/
component?: React.ComponentType<FormikProps<Values>> | React.ReactNode;
/**
* Render prop (works like React router's <Route render={props =>} />)
* @deprecated
*/
render?: (props: FormikProps<Values>) => React.ReactNode;
/**
* React children or child render callback
*/
children?: ((props: FormikProps<Values>) => React.ReactNode) | React.ReactNode;
/**
* Initial values of the form
*/
initialValues: Values;
/**
* Initial status
*/
initialStatus?: any;
/** Initial object map of field names to specific error for that field */
initialErrors?: FormikErrors<Values>;
/** Initial object map of field names to whether the field has been touched */
initialTouched?: FormikTouched<Values>;
/**
* Reset handler
*/
onReset?: (values: Values, formikHelpers: FormikHelpers<Values>) => void;
/**
* Submission handler
*/
onSubmit: (values: Values, formikHelpers: FormikHelpers<Values>) => void | Promise<any>;
/**
* A Yup Schema or a function that returns a Yup schema
*/
validationSchema?: any | (() => any);
/**
* Validation function. Must return an error object or promise that
* throws an error object where that object keys map to corresponding value.
*/
validate?: (values: Values) => void | object | Promise<FormikErrors<Values>>;
}
/**
* State, handlers, and helpers made available to form component or render prop
* of <Formik/>.
*/
export declare type FormikProps<Values> = FormikSharedConfig & FormikState<Values> & FormikHelpers<Values> & FormikHandlers & FormikComputedProps<Values> & FormikRegistration & {
submitForm: () => Promise<any>;
};
/** Internal Formik registration methods that get passed down as props */
export interface FormikRegistration {

@@ -82,25 +182,51 @@ registerField(name: string, fns: {

}
/**
* State, handlers, and helpers made available to Formik's primitive components through context.
*/
export declare type FormikContextType<Values> = FormikProps<Values> & Pick<FormikConfig<Values>, 'validate' | 'validationSchema'>;
export interface SharedRenderProps<T> {
/**
* Field component to render. Can either be a string like 'select' or a component.
*/
component?: string | React.ComponentType<T | void>;
/**
* Render prop (works like React router's <Route render={props =>} />)
*/
render?: (props: T) => React.ReactNode;
/**
* Children render function <Field name>{props => ...}</Field>)
*/
children?: (props: T) => React.ReactNode;
}
export declare type GenericFieldHTMLAttributes = JSX.IntrinsicElements['input'] | JSX.IntrinsicElements['select'] | JSX.IntrinsicElements['textarea'];
/** Field metadata */
export interface FieldMetaProps<Value> {
/** Value of the field */
value: Value;
/** Error message of the field */
error?: string;
/** Has the field been visited? */
touched: boolean;
/** Initial value of the field */
initialValue?: Value;
/** Initial touched state of the field */
initialTouched: boolean;
/** Initial error message of the field */
initialError?: string;
}
/** Field input value, name, and event handlers */
export interface FieldInputProps<Value> {
/** Value of the field */
value: Value;
/** Name of the field */
name: string;
/** Multiple select? */
multiple?: boolean;
/** Is the field checked? */
checked?: boolean;
/** Change event handler */
onChange: FormikHandlers['handleChange'];
/** Blur event handler */
onBlur: FormikHandlers['handleBlur'];
}
export declare type FieldValidator = (value: any) => string | void | Promise<string | void>;
import * as React from 'react';
/** @private is the value an empty array? */
export declare const isEmptyArray: (value?: any) => boolean;
/** @private is the given object a Function? */
export declare const isFunction: (obj: any) => obj is Function;
/** @private is the given object an Object? */
export declare const isObject: (obj: any) => obj is Object;
/** @private is the given object an integer? */
export declare const isInteger: (obj: any) => boolean;
/** @private is the given object a string? */
export declare const isString: (obj: any) => obj is string;
/** @private is the given object a NaN? */
export declare const isNaN: (obj: any) => boolean;
/** @private Does a React component have exactly 0 children? */
export declare const isEmptyChildren: (children: any) => boolean;
/** @private is the given object/value a promise? */
export declare const isPromise: (value: any) => value is PromiseLike<any>;
/** @private is the given object/value a type of synthetic event? */
export declare const isInputEvent: (value: any) => value is React.SyntheticEvent<any, Event>;
/**
* Same as document.activeElement but wraps in a try-catch block. In IE it is
* not safe to call document.activeElement if there is nothing focused.
*
* The activeElement will be null only if the document or document body is not
* yet defined.
*
* @param {?Document} doc Defaults to current document.
* @return {Element | null}
* @see https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/dom/getActiveElement.js
*/
export declare function getActiveElement(doc?: Document): Element | null;
/**
* Deeply get a value from an object via its path.
*/
export declare function getIn(obj: any, key: string | string[], def?: any, p?: number): any;
/**
* Deeply set a value from in object via it's path. If the value at `path`
* has changed, return a shallow copy of obj with `value` set at `path`.
* If `value` has not changed, return the original `obj`.
*
* Existing objects / arrays along `path` are also shallow copied. Sibling
* objects along path retain the same internal js reference. Since new
* objects / arrays are only created along `path`, we can test if anything
* changed in a nested structure by comparing the object's reference in
* the old and new object, similar to how russian doll cache invalidation
* works.
*
* In earlier versions of this function, which used cloneDeep, there were
* issues whereby settings a nested value would mutate the parent
* instead of creating a new object. `clone` avoids that bug making a
* shallow copy of the objects along the update path
* so no object is mutated in place.
*
* Before changing this function, please read through the following
* discussions.
*
* @see https://github.com/developit/linkstate
* @see https://github.com/jaredpalmer/formik/pull/123
*/
export declare function setIn(obj: any, path: string, value: any): any;
/**
* Recursively a set the same value for all keys and arrays nested object, cloning
* @param object
* @param value
* @param visited
* @param response
*/
export declare function setNestedObjectValues<T>(object: any, value: any, visited?: any, response?: any): T;
import * as React from 'react';
import { FormikHelpers, FormikProps, FormikSharedConfig, FormikValues, FormikTouched, FormikErrors } from './types';
/**
* State, handlers, and helpers injected as props into the wrapped form component.
* Used with withFormik()
*
* @deprecated Use `OuterProps & FormikProps<Values>` instead.
*/
export declare type InjectedFormikProps<Props, Values> = Props & FormikProps<Values>;
/**
* Formik actions + { props }
*/
export declare type FormikBag<P, V> = {
props: P;
} & FormikHelpers<V>;
/**
* withFormik() configuration options. Backwards compatible.
*/
export interface WithFormikConfig<Props, Values extends FormikValues = FormikValues, DeprecatedPayload = Values> extends FormikSharedConfig<Props> {
/**
* Set the display name of the component. Useful for React DevTools.
*/
displayName?: string;
/**
* Submission handler
*/
handleSubmit: (values: Values, formikBag: FormikBag<Props, Values>) => void;
/**
* Map props to the form values
*/
mapPropsToValues?: (props: Props) => Values;
/**
* Map props to the form values
*/
mapPropsToStatus?: (props: Props) => any;
/**
* Map props to the form touched state
*/
mapPropsToTouched?: (props: Props) => FormikTouched<Values>;
/**
* Map props to the form touched state
*/
mapPropsToErrors?: (props: Props) => FormikErrors<Values>;
/**
* @deprecated in 0.9.0 (but needed to break TS types)
*/
mapValuesToPayload?: (values: Values) => DeprecatedPayload;
/**
* A Yup Schema or a function that returns a Yup schema
*/
validationSchema?: any | ((props: Props) => any);
/**
* Validation function. Must return an error object or promise that
* throws an error object where that object keys map to corresponding value.
*/
validate?: (values: Values, props: Props) => void | object | Promise<any>;

@@ -25,2 +65,5 @@ }

}
/**
* A public higher-order component to access the imperative API
*/
export declare function withFormik<OuterProps extends object, Values extends FormikValues, Payload = Values>({ mapPropsToValues, ...config }: WithFormikConfig<OuterProps, Values, Payload>): ComponentDecorator<OuterProps, OuterProps & FormikProps<Values>>;
{
"name": "formik",
"description": "Forms in React, without tears",
"version": "2.0.7",
"version": "2.0.8-canary.2",
"license": "MIT",

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

"peerDependencies": {
"react": "^16.8.0"
"react": ">=16.3.0"
},

@@ -32,6 +32,6 @@ "scripts": {

"test:watch": "npm run test -- --watchAll",
"start": "cross-env NODE_ENV=development tsdx watch",
"start": "cross-env NODE_ENV=development tsdx watch --verbose",
"prebuild": "rimraf dist",
"build": "cross-env NODE_ENV=production tsdx build --format=cjs,esm,umd",
"prepublishOnly": "npm run build",
"prepublish": "npm run build",
"format": "prettier --trailing-comma es5 --single-quote --write 'src/**/*' 'test/**/*' 'README.md' '/docs/**/*.md'",

@@ -41,5 +41,2 @@ "precommit": "lint-staged",

"addc": "all-contributors add",
"start-website": "cd website && yarn start",
"build-website": "cd website && yarn install && yarn build",
"now-build": "npm run build-website",
"gen-docs": "all-contributors generate && doctoc README.md",

@@ -58,3 +55,2 @@ "size": "size-limit"

},
"optionalDependencies": {},
"resolutions": {

@@ -99,4 +95,4 @@ "@types/react": "16.9.11",

"raw-loader": "^2.0.0",
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-testing-library": "^7.0.0",

@@ -145,3 +141,4 @@ "rimraf": "^2.6.2",

}
]
],
"gitHead": "351ab23cdc5d71b5f2aea1918d7873c82c2e2f63"
}

@@ -22,3 +22,3 @@ <p align="center">

**The below readme is the documentation for the `next` (prerelease) version of Formik. To view the documentation for the latest stable Formik version visit [jaredpalmer.com/formik/docs](https://jaredpalmer.com/formik/docs/overview)**
**The below readme is the documentation for the `canary` (prerelease) version of Formik. To view the documentation for the latest stable Formik version visit [jaredpalmer.com/formik/docs](https://jaredpalmer.com/formik/docs/overview)**

@@ -100,3 +100,3 @@ ---

- [TSDX](https://github.com/palmerhq/tsdx) - Zero-config CLI for TypeScript used by this repo.
- [TSDX](https://github.com/jaredpalmer/tsdx) - Zero-config CLI for TypeScript used by this repo.

@@ -103,0 +103,0 @@ ---

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

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 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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc