!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","react","final-form"],t):t((e=e||self)["react-final-form"]={},e.React,e.FinalForm)}(this,function(e,x,F){"use strict";var E="default"in x?x.default:x;function R(){return(R=Object.assign||function(e){for(var t=1;t component");return t}function o(e){var t=void 0===e?{}:e,n=t.onChange,r=t.subscription,i=void 0===r?D:r,u=N("useFormState"),a=x.useRef(!0),o=x.useRef(n);o.current=n;var c=x.useState(function(){var t={};return u.subscribe(function(e){t=e},i)(),n&&n(t),t}),l=c[0],f=c[1];x.useEffect(function(){return u.subscribe(function(e){a.current?a.current=!1:(f(e),o.current&&o.current(e))},i)},[]);var s={};return U(s,l),s}function r(e){var t=e.onChange,n=e.subscription,r=V(e,["onChange","subscription"]),i=N("FormSpy"),u=o({onChange:t,subscription:n});if(t)return null;var a={form:R({},i,{reset:function(e){k(e)?i.reset():i.reset(e)}})};return w(R({},r,{},a),u,"FormSpy")}function z(e){return void 0===e?"":e}function _(e){return""===e?void 0:e}var I="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product,L=F.fieldSubscriptionItems.reduce(function(e,t){return e[t]=!0,e},{});function S(n,e){void 0===e&&(e={});function r(e){return O.registerField(n,e,b,{afterSubmit:i,beforeSubmit:function(){var e=S.current,t=e.beforeSubmit,n=e.formatOnBlur,r=e.format,i=void 0===r?z:r;if(n){var u=O.getFieldState(V.name).value,a=i(u,V.name);a!==u&&V.change(a)}return t&&t()},defaultValue:o,getValidator:function(){return S.current.validate},initialValue:s,isEqual:function(e,t){return(S.current.isEqual||function(e,t){return e===t})(e,t)},validateFields:y})}var t=e,i=t.afterSubmit,u=t.allowNull,a=t.component,o=t.defaultValue,c=t.format,l=void 0===c?z:c,f=t.formatOnBlur,s=t.initialValue,d=t.multiple,v=t.parse,m=void 0===v?_:v,p=t.subscription,b=void 0===p?L:p,g=t.type,y=t.validateFields,h=t.value,O=N("useField"),S=q(e),F=x.useRef(!0),E=x.useState(function(){var t={},e=O.destroyOnUnregister;return O.destroyOnUnregister=!1,r(function(e){t=e})(),O.destroyOnUnregister=e,t}),V=E[0],w=E[1];x.useEffect(function(){return r(function(e){F.current?F.current=!1:w(e)})},[n,o,s]);var C={onBlur:x.useCallback(function(e){if(V.blur(),f){var t=O.getFieldState(V.name);V.change(l(t.value,V.name))}},[V.name,l,f]),onChange:x.useCallback(function(e){var t=e&&e.target?function(e,t,n,r){if(!r&&e.nativeEvent&&void 0!==e.nativeEvent.text)return e.nativeEvent.text;if(r&&e.nativeEvent)return e.nativeEvent.text;var i=e.target,u=i.type,a=i.value,o=i.checked;switch(u){case"checkbox":if(void 0===n)return!!o;if(o)return Array.isArray(t)?t.concat(n):[n];if(!Array.isArray(t))return t;var c=t.indexOf(n);return c<0?t:t.slice(0,c).concat(t.slice(c+1));case"select-multiple":return function(e){var t=[];if(e)for(var n=0;n