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

react-hook-form

Package Overview
Dependencies
Maintainers
1
Versions
1032
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hook-form - npm Package Compare versions

Comparing version 7.39.1 to 7.39.2

2

dist/index.cjs.js

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

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react")),r=e=>"checkbox"===e.type,s=e=>e instanceof Date,a=e=>null==e;const n=e=>"object"==typeof e;var i=e=>!a(e)&&!Array.isArray(e)&&n(e)&&!s(e),o=e=>i(e)&&e.target?r(e.target)?e.target.checked:e.target.value:e,u=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),l=e=>Array.isArray(e)?e.filter(Boolean):[],c=e=>void 0===e,d=(e,t,r)=>{if(!t||!i(e))return r;const s=l(t.split(/[,[\].]+?/)).reduce((e,t)=>a(e)?e:e[t],e);return c(s)||s===e?c(e[t])?r:e[t]:s};const f="blur",m="focusout",y="change",g="onBlur",h="onChange",p="onSubmit",_="onTouched",v="all",b="max",x="min",A="maxLength",F="minLength",V="pattern",S="required",w="validate",k=t.default.createContext(null),D=()=>t.default.useContext(k);var C=(e,t,r,s=!0)=>{const a={defaultValues:t._defaultValues};for(const n in e)Object.defineProperty(a,n,{get:()=>{const a=n;return t._proxyFormState[a]!==v&&(t._proxyFormState[a]=!s||v),r&&(r[a]=!0),e[a]}});return a},E=e=>i(e)&&!Object.keys(e).length,j=(e,t,r)=>{const{name:s,...a}=e;return E(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||v))},O=e=>Array.isArray(e)?e:[e],U=(e,t,r)=>r&&t?e===t:!e||!t||e===t||O(e).some(e=>e&&(e.startsWith(t)||t.startsWith(e)));function B(e){const r=t.default.useRef(e);r.current=e,t.default.useEffect(()=>{const t=!e.disabled&&r.current.subject.subscribe({next:r.current.callback});return()=>{t&&t.unsubscribe()}},[e.disabled])}function T(e){const r=D(),{control:s=r.control,disabled:a,name:n,exact:i}=e||{},[o,u]=t.default.useState(s._formState),l=t.default.useRef(!0),c=t.default.useRef({isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=t.default.useRef(n);return d.current=n,B({disabled:a,callback:t.default.useCallback(e=>l.current&&U(d.current,e.name,i)&&j(e,c.current)&&u({...s._formState,...e}),[s,i]),subject:s._subjects.state}),t.default.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]),C(o,s,c.current,!1)}var M=e=>"string"==typeof e,N=(e,t,r,s)=>{const a=Array.isArray(e);return M(e)?(s&&t.watch.add(e),d(r,e)):a?e.map(e=>(s&&t.watch.add(e),d(r,e))):(s&&(t.watchAll=!0),r)},L=e=>"function"==typeof e,R=e=>{for(const t in e)if(L(e[t]))return!0;return!1};function q(e){const r=D(),{control:s=r.control,name:a,defaultValue:n,disabled:o,exact:u}=e||{},l=t.default.useRef(a);l.current=a,B({disabled:o,subject:s._subjects.watch,callback:t.default.useCallback(e=>{if(U(l.current,e.name,u)){const t=N(l.current,s._names,e.values||s._formValues);f(c(l.current)||i(t)&&!R(t)?{...t}:Array.isArray(t)?[...t]:c(t)?n:t)}},[s,u,n])});const[d,f]=t.default.useState(c(n)?s._getWatch(a):n);return t.default.useEffect(()=>s._removeUnmounted()),d}function P(e){const r=D(),{name:s,control:a=r.control,shouldUnregister:n}=e,i=u(a._names.array,s),l=q({control:a,name:s,defaultValue:d(a._formValues,s,d(a._defaultValues,s,e.defaultValue)),exact:!0}),c=T({control:a,name:s}),m=t.default.useRef(a.register(s,{...e.rules,value:l}));return t.default.useEffect(()=>{const e=(e,t)=>{const r=d(a._fields,e);r&&(r._f.mount=t)};return e(s,!0),()=>{const t=a._options.shouldUnregister||n;(i?t&&!a._stateFlags.action:t)?a.unregister(s):e(s,!1)}},[s,a,i,n]),{field:{name:s,value:l,onChange:t.default.useCallback(e=>m.current.onChange({target:{value:o(e),name:s},type:y}),[s]),onBlur:t.default.useCallback(()=>m.current.onBlur({target:{value:d(a._formValues,s),name:s},type:f}),[s,a]),ref:e=>{const t=d(a._fields,s);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!d(c.errors,s)},isDirty:{enumerable:!0,get:()=>!!d(c.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!d(c.touchedFields,s)},error:{enumerable:!0,get:()=>d(c.errors,s)}})}}var W=(e,t,r,s,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:a||!0}}:{},$=e=>/^\w*$/.test(e),I=e=>l(e.replace(/["|']|\]/g,"").split(/\.|\[/));function H(e,t,r){let s=-1;const a=$(t)?[t]:I(t),n=a.length,o=n-1;for(;++s<n;){const t=a[s];let n=r;if(s!==o){const r=e[t];n=i(r)||Array.isArray(r)?r:isNaN(+a[s+1])?{}:[]}e[t]=n,e=e[t]}return e}const z=(e,t,r)=>{for(const s of r||Object.keys(e)){const r=d(e,s);if(r){const{_f:e,...s}=r;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else i(s)&&z(s,t)}}};var G=()=>{const e="undefined"==typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(16*Math.random()+e)%16|0;return("x"==t?r:3&r|8).toString(16)})},J=(e,t,r={})=>r.shouldFocus||c(r.shouldFocus)?r.focusName||`${e}.${c(r.focusIndex)?t:r.focusIndex}.`:"",K=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),Q=(e,t,r)=>{const s=l(d(e,r));return H(s,"root",t[r]),H(e,r,s),e},X=e=>"boolean"==typeof e,Y=e=>"file"===e.type,Z=e=>M(e)||t.default.isValidElement(e),ee=e=>"radio"===e.type,te=e=>e instanceof RegExp;const re={value:!1,isValid:!1},se={value:!0,isValid:!0};var ae=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!c(e[0].attributes.value)?c(e[0].value)||""===e[0].value?se:{value:e[0].value,isValid:!0}:se:re}return re};const ne={isValid:!1,value:null};var ie=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,ne):ne;function oe(e,t,r="validate"){if(Z(e)||Array.isArray(e)&&e.every(Z)||X(e)&&!e)return{type:r,message:Z(e)?e:"",ref:t}}var ue=e=>i(e)&&!te(e)?e:{value:e,message:""},le=async(e,t,s,n,o)=>{const{ref:u,refs:l,required:c,maxLength:d,minLength:f,min:m,max:y,pattern:g,validate:h,name:p,valueAsNumber:_,mount:v,disabled:k}=e._f;if(!v||k)return{};const D=l?l[0]:u,C=e=>{n&&M(e)&&(D.setCustomValidity(e),D.reportValidity())},j={},O=ee(u),U=r(u),B=O||U,T=(_||Y(u))&&!u.value||""===t||Array.isArray(t)&&!t.length,N=W.bind(null,p,s,j),R=(e,t,r,s=A,a=F)=>{const n=e?t:r;j[p]={type:e?s:a,message:n,ref:u,...N(e?s:a,n)}};if(o?!Array.isArray(t)||!t.length:c&&(!B&&(T||a(t))||X(t)&&!t||U&&!ae(l).isValid||O&&!ie(l).isValid)){const{value:e,message:t}=Z(c)?{value:!!c,message:c}:ue(c);if(e&&(j[p]={type:S,message:t,ref:D,...N(S,t)},!s))return C(t),j}if(!(T||a(m)&&a(y))){let e,r;const n=ue(y),i=ue(m);if(a(t)||isNaN(t)){const s=u.valueAsDate||new Date(t),a=e=>new Date((new Date).toDateString()+" "+e),o="time"==u.type,l="week"==u.type;M(n.value)&&t&&(e=o?a(t)>a(n.value):l?t>n.value:s>new Date(n.value)),M(i.value)&&t&&(r=o?a(t)<a(i.value):l?t<i.value:s<new Date(i.value))}else{const s=u.valueAsNumber||(t?+t:t);a(n.value)||(e=s>n.value),a(i.value)||(r=s<i.value)}if((e||r)&&(R(!!e,n.message,i.message,b,x),!s))return C(j[p].message),j}if((d||f)&&!T&&(M(t)||o&&Array.isArray(t))){const e=ue(d),r=ue(f),n=!a(e.value)&&t.length>e.value,i=!a(r.value)&&t.length<r.value;if((n||i)&&(R(n,e.message,r.message),!s))return C(j[p].message),j}if(g&&!T&&M(t)){const{value:e,message:r}=ue(g);if(te(e)&&!t.match(e)&&(j[p]={type:V,message:r,ref:u,...N(V,r)},!s))return C(r),j}if(h)if(L(h)){const e=oe(await h(t),D);if(e&&(j[p]={...e,...N(w,e.message)},!s))return C(e.message),j}else if(i(h)){let e={};for(const r in h){if(!E(e)&&!s)break;const a=oe(await h[r](t),D,r);a&&(e={...a,...N(r,a.message)},C(a.message),s&&(j[p]=e))}if(!E(e)&&(j[p]={ref:D,...e},!s))return j}return C(!0),j};function ce(e,t){return[...e,...O(t)]}var de="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function fe(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(de&&(e instanceof Blob||e instanceof FileList)||!r&&!i(e))return e;if(t=r?[]:{},Array.isArray(e)||(e=>{const t=e.constructor&&e.constructor.prototype;return i(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)t[r]=fe(e[r]);else t=e}return t}var me=e=>Array.isArray(e)?e.map(()=>{}):void 0,ye=e=>({isOnSubmit:!e||e===p,isOnBlur:e===g,isOnChange:e===h,isOnAll:e===v,isOnTouch:e===_});function ge(e,t,r){return[...e.slice(0,t),...O(r),...e.slice(t)]}var he=(e,t,r)=>Array.isArray(e)?(c(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[];function pe(e,t){return[...O(t),...O(e)]}var _e=(e,t)=>c(t)?[]:function(e,t){let r=0;const s=[...e];for(const e of t)s.splice(e-r,1),r++;return l(s).length?s:[]}(e,O(t).sort((e,t)=>e-t)),ve=(e,t,r)=>{e[t]=[e[r],e[r]=e[t]][0]};function be(e){for(const t in e)if(!c(e[t]))return!1;return!0}function xe(e,t){const r=$(t)?[t]:I(t),s=1==r.length?e:function(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=c(e)?s++:e[t[s++]];return e}(e,r),a=r[r.length-1];let n;s&&delete s[a];for(let t=0;t<r.slice(0,-1).length;t++){let s,a=-1;const o=r.slice(0,-(t+1)),u=o.length-1;for(t>0&&(n=e);++a<o.length;){const t=o[a];s=s?s[t]:e[t],u===a&&(i(s)&&E(s)||Array.isArray(s)&&be(s))&&(n?delete n[t]:delete e[t]),n=s}}return e}var Ae=(e,t,r)=>(e[t]=r,e);function Fe(){let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}}var Ve=e=>a(e)||!n(e);function Se(e,t){if(Ve(e)||Ve(t))return e===t;if(s(e)&&s(t))return e.getTime()===t.getTime();const r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(const n of r){const r=e[n];if(!a.includes(n))return!1;if("ref"!==n){const e=t[n];if(s(r)&&s(e)||i(r)&&i(e)||Array.isArray(r)&&Array.isArray(e)?!Se(r,e):r!==e)return!1}}return!0}var we=e=>{const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ke=e=>"select-multiple"===e.type,De=e=>we(e)&&e.isConnected;function Ce(e,t={}){const r=Array.isArray(e);if(i(e)||r)for(const r in e)Array.isArray(e[r])||i(e[r])&&!R(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Ce(e[r],t[r])):a(e[r])||(t[r]=!0);return t}var Ee=(e,t)=>function e(t,r,s){const n=Array.isArray(t);if(i(t)||n)for(const n in t)Array.isArray(t[n])||i(t[n])&&!R(t[n])?c(r)||Ve(s[n])?s[n]=Array.isArray(t[n])?Ce(t[n],[]):{...Ce(t[n])}:e(t[n],a(r)?{}:r[n],s[n]):Se(t[n],r[n])?delete s[n]:s[n]=!0;return s}(e,t,Ce(t)),je=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>c(e)?e:t?""===e?NaN:e?+e:e:r&&M(e)?new Date(e):s?s(e):e;function Oe(e){const t=e.ref;if(!(e.refs?e.refs.every(e=>e.disabled):t.disabled))return Y(t)?t.files:ee(t)?ie(e.refs).value:ke(t)?[...t.selectedOptions].map(({value:e})=>e):r(t)?ae(e.refs).value:je(c(t.value)?e.ref.value:t.value,e)}var Ue=e=>c(e)?void 0:te(e)?e.source:i(e)?te(e.value)?e.value.source:e.value:e;function Be(e,t,r){const s=d(e,r);if(s||$(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),n=d(t,s),i=d(e,s);if(n&&!Array.isArray(n)&&r!==s)return{name:r};if(i&&i.type)return{name:s,error:i};a.pop()}return{name:r}}const Te={mode:p,reValidateMode:h,shouldFocusError:!0};function Me(e={}){let t,n={...Te,...e},i={submitCount:0,isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},y={},g=fe(n.defaultValues)||{},h=n.shouldUnregister?{}:fe(g),p={action:!1,mount:!1,watch:!1},_={mount:new Set,unMount:new Set,array:new Set,watch:new Set},b=0,x={};const A={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},F={watch:Fe(),array:Fe(),state:Fe()},V=ye(n.mode),S=ye(n.reValidateMode),w=n.criteriaMode===v,k=async()=>{let e=!1;return A.isValid&&(e=n.resolver?E((await U()).errors):await B(y,!0),e!==i.isValid&&(i.isValid=e,F.state.next({isValid:e}))),e},D=(e,t,r,s)=>{const a=d(y,e);if(a){const n=d(h,e,c(r)?d(g,e):r);c(n)||s&&s.defaultChecked||t?H(h,e,t?n:Oe(a._f)):q(e,n),p.mount&&k()}},C=(e,t,r,s,a)=>{let n=!1;const o={name:e},u=d(i.touchedFields,e);if(A.isDirty){const e=i.isDirty;i.isDirty=o.isDirty=T(),n=e!==o.isDirty}if(A.dirtyFields&&(!r||s)){const r=d(i.dirtyFields,e);Se(d(g,e),t)?xe(i.dirtyFields,e):H(i.dirtyFields,e,!0),o.dirtyFields=i.dirtyFields,n=n||r!==d(i.dirtyFields,e)}return r&&!u&&(H(i.touchedFields,e,r),o.touchedFields=i.touchedFields,n=n||A.touchedFields&&u!==r),n&&a&&F.state.next(o),n?o:{}},j=(r,s,a,n)=>{const o=d(i.errors,r),u=A.isValid&&X(s)&&i.isValid!==s;var l;if(e.delayError&&a?(l=()=>((e,t)=>{H(i.errors,e,t),F.state.next({errors:i.errors})})(r,a),t=e=>{clearTimeout(b),b=window.setTimeout(l,e)},t(e.delayError)):(clearTimeout(b),t=null,a?H(i.errors,r,a):xe(i.errors,r)),(a?!Se(o,a):o)||!E(n)||u){const e={...n,...u&&X(s)?{isValid:s}:{},errors:i.errors,name:r};i={...i,...e},F.state.next(e)}x[r]--,A.isValidating&&!Object.values(x).some(e=>e)&&(F.state.next({isValidating:!1}),x={})},U=async e=>n.resolver?await n.resolver({...h},n.context,((e,t,r,s)=>{const a={};for(const r of e){const e=d(t,r);e&&H(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:s}})(e||_.mount,y,n.criteriaMode,n.shouldUseNativeValidation)):{},B=async(e,t,r={valid:!0})=>{for(const s in e){const a=e[s];if(a){const{_f:e,...s}=a;if(e){const s=_.array.has(e.name),o=await le(a,d(h,e.name),w,n.shouldUseNativeValidation,s);if(o[e.name]&&(r.valid=!1,t))break;!t&&(d(o,e.name)?s?Q(i.errors,o,e.name):H(i.errors,e.name,o[e.name]):xe(i.errors,e.name))}s&&await B(s,t,r)}}return r.valid},T=(e,t)=>(e&&t&&H(h,e,t),!Se(G(),g)),R=(e,t,r)=>{const s={...p.mount?h:c(t)?g:M(e)?{[e]:t}:t};return N(e,_,s,r)},q=(e,t,s={})=>{const n=d(y,e);let i=t;if(n){const s=n._f;s&&(!s.disabled&&H(h,e,je(t,s)),i=de&&we(s.ref)&&a(t)?"":t,ke(s.ref)?[...s.ref.options].forEach(e=>e.selected=i.includes(e.value)):s.refs?r(s.ref)?s.refs.length>1?s.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find(t=>t===e.value):i===e.value)):s.refs[0]&&(s.refs[0].checked=!!i):s.refs.forEach(e=>e.checked=e.value===i):Y(s.ref)?s.ref.value="":(s.ref.value=i,s.ref.type||F.watch.next({name:e})))}(s.shouldDirty||s.shouldTouch)&&C(e,i,s.shouldTouch,s.shouldDirty,!0),s.shouldValidate&&I(e)},P=(e,t,r)=>{for(const a in t){const n=t[a],i=`${e}.${a}`,o=d(y,i);!_.array.has(e)&&Ve(n)&&(!o||o._f)||s(n)?q(i,n,r):P(i,n,r)}},W=(e,t,r={})=>{const s=d(y,e),n=_.array.has(e),o=fe(t);H(h,e,o),n?(F.array.next({name:e,values:h}),(A.isDirty||A.dirtyFields)&&r.shouldDirty&&(i.dirtyFields=Ee(g,h),F.state.next({name:e,dirtyFields:i.dirtyFields,isDirty:T(e,o)}))):!s||s._f||a(o)?q(e,o,r):P(e,o,r),K(e,_)&&F.state.next({}),F.watch.next({name:e})},$=async e=>{const r=e.target;let s=r.name;const a=d(y,s);if(a){let l,c;const g=r.type?Oe(a._f):o(e),p=e.type===f||e.type===m,v=!((u=a._f).mount&&(u.required||u.min||u.max||u.maxLength||u.minLength||u.pattern||u.validate)||n.resolver||d(i.errors,s)||a._f.deps)||((e,t,r,s,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?s.isOnBlur:a.isOnBlur)?!e:!(r?s.isOnChange:a.isOnChange)||e))(p,d(i.touchedFields,s),i.isSubmitted,S,V),b=K(s,_,p);H(h,s,g),p?(a._f.onBlur&&a._f.onBlur(e),t&&t(0)):a._f.onChange&&a._f.onChange(e);const D=C(s,g,p,!1),O=!E(D)||b;if(!p&&F.watch.next({name:s,type:e.type}),v)return A.isValid&&k(),O&&F.state.next({name:s,...b?{}:D});if(!p&&b&&F.state.next({}),x[s]=x[s]?x[s]+1:1,F.state.next({isValidating:!0}),n.resolver){const{errors:e}=await U([s]),t=Be(i.errors,y,s),r=Be(e,y,t.name||s);l=r.error,s=r.name,c=E(e)}else l=(await le(a,d(h,s),w,n.shouldUseNativeValidation))[s],k();a._f.deps&&I(a._f.deps),j(s,c,l,D)}var u},I=async(e,t={})=>{let r,s;const a=O(e);if(F.state.next({isValidating:!0}),n.resolver){const t=await(async e=>{const{errors:t}=await U();if(e)for(const r of e){const e=d(t,r);e?H(i.errors,r,e):xe(i.errors,r)}else i.errors=t;return t})(c(e)?e:a);r=E(t),s=e?!a.some(e=>d(t,e)):r}else e?(s=(await Promise.all(a.map(async e=>{const t=d(y,e);return await B(t&&t._f?{[e]:t}:t)}))).every(Boolean),(s||i.isValid)&&k()):s=r=await B(y);return F.state.next({...!M(e)||A.isValid&&r!==i.isValid?{}:{name:e},...n.resolver||!e?{isValid:r}:{},errors:i.errors,isValidating:!1}),t.shouldFocus&&!s&&z(y,e=>e&&d(i.errors,e),e?a:_.mount),s},G=e=>{const t={...g,...p.mount?h:{}};return c(e)?t:M(e)?d(t,e):e.map(e=>d(t,e))},J=(e,t)=>({invalid:!!d((t||i).errors,e),isDirty:!!d((t||i).dirtyFields,e),isTouched:!!d((t||i).touchedFields,e),error:d((t||i).errors,e)}),Z=(e,t={})=>{for(const r of e?O(e):_.mount)_.mount.delete(r),_.array.delete(r),d(y,r)&&(t.keepValue||(xe(y,r),xe(h,r)),!t.keepError&&xe(i.errors,r),!t.keepDirty&&xe(i.dirtyFields,r),!t.keepTouched&&xe(i.touchedFields,r),!n.shouldUnregister&&!t.keepDefaultValue&&xe(g,r));F.watch.next({}),F.state.next({...i,...t.keepDirty?{isDirty:T()}:{}}),!t.keepIsValid&&k()},te=(e,t={})=>{let s=d(y,e);const a=X(t.disabled);return H(y,e,{...s||{},_f:{...s&&s._f?s._f:{ref:{name:e}},name:e,mount:!0,...t}}),_.mount.add(e),s?a&&H(h,e,t.disabled?void 0:d(h,e,Oe(s._f))):D(e,!0,t.value),{...a?{disabled:t.disabled}:{},...n.shouldUseNativeValidation?{required:!!t.required,min:Ue(t.min),max:Ue(t.max),minLength:Ue(t.minLength),maxLength:Ue(t.maxLength),pattern:Ue(t.pattern)}:{},name:e,onChange:$,onBlur:$,ref:a=>{if(a){te(e,t),s=d(y,e);const n=c(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,i=(e=>ee(e)||r(e))(n),o=s._f.refs||[];if(i?o.find(e=>e===n):n===s._f.ref)return;H(y,e,{_f:{...s._f,...i?{refs:[...o.filter(De),n,...Array.isArray(d(g,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),D(e,!1,void 0,n)}else s=d(y,e,{}),s._f&&(s._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!u(_.array,e)||!p.action)&&_.unMount.add(e)}}},re=()=>n.shouldFocusError&&z(y,e=>e&&d(i.errors,e),_.mount);return{control:{register:te,unregister:Z,getFieldState:J,_executeSchema:U,_focusError:re,_getWatch:R,_getDirty:T,_updateValid:k,_removeUnmounted:()=>{for(const e of _.unMount){const t=d(y,e);t&&(t._f.refs?t._f.refs.every(e=>!De(e)):!De(t._f.ref))&&Z(e)}_.unMount=new Set},_updateFieldArray:(e,t=[],r,s,a=!0,n=!0)=>{if(s&&r){if(p.action=!0,n&&Array.isArray(d(y,e))){const t=r(d(y,e),s.argA,s.argB);a&&H(y,e,t)}if(A.errors&&n&&Array.isArray(d(i.errors,e))){const t=r(d(i.errors,e),s.argA,s.argB);a&&H(i.errors,e,t),((e,t)=>{!l(d(e,t)).length&&xe(e,t)})(i.errors,e)}if(A.touchedFields&&n&&Array.isArray(d(i.touchedFields,e))){const t=r(d(i.touchedFields,e),s.argA,s.argB);a&&H(i.touchedFields,e,t)}A.dirtyFields&&(i.dirtyFields=Ee(g,h)),F.state.next({isDirty:T(e,t),dirtyFields:i.dirtyFields,errors:i.errors,isValid:i.isValid})}else H(h,e,t)},_getFieldArray:t=>l(d(p.mount?h:g,t,e.shouldUnregister?d(g,t,[]):[])),_subjects:F,_proxyFormState:A,get _fields(){return y},get _formValues(){return h},get _stateFlags(){return p},set _stateFlags(e){p=e},get _defaultValues(){return g},get _names(){return _},set _names(e){_=e},get _formState(){return i},set _formState(e){i=e},get _options(){return n},set _options(e){n={...n,...e}}},trigger:I,register:te,handleSubmit:(e,t)=>async r=>{r&&(r.preventDefault&&r.preventDefault(),r.persist&&r.persist());let s=!0,a=fe(h);F.state.next({isSubmitting:!0});try{if(n.resolver){const{errors:e,values:t}=await U();i.errors=e,a=t}else await B(y);E(i.errors)?(F.state.next({errors:{},isSubmitting:!0}),await e(a,r)):(t&&await t({...i.errors},r),re())}catch(e){throw s=!1,e}finally{i.isSubmitted=!0,F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:E(i.errors)&&s,submitCount:i.submitCount+1,errors:i.errors})}},watch:(e,t)=>L(e)?F.watch.subscribe({next:r=>e(R(void 0,t),r)}):R(e,t,!0),setValue:W,getValues:G,reset:(t,r)=>((t,r={})=>{const s=t||g,a=fe(s),n=t&&!E(t)?a:g;if(r.keepDefaultValues||(g=s),!r.keepValues){if(r.keepDirtyValues)for(const e of _.mount)d(i.dirtyFields,e)?H(n,e,d(h,e)):W(e,d(n,e));else{if(de&&c(t))for(const e of _.mount){const t=d(y,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(we(e)){const t=e.closest("form");if(t){t.reset();break}}}}y={}}h=e.shouldUnregister?r.keepDefaultValues?fe(g):{}:a,F.array.next({values:n}),F.watch.next({values:n})}_={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},p.mount=!A.isValid||!!r.keepIsValid,p.watch=!!e.shouldUnregister,F.state.next({submitCount:r.keepSubmitCount?i.submitCount:0,isDirty:r.keepDirty||r.keepDirtyValues?i.isDirty:!(!r.keepDefaultValues||Se(t,g)),isSubmitted:!!r.keepIsSubmitted&&i.isSubmitted,dirtyFields:r.keepDirty||r.keepDirtyValues?i.dirtyFields:r.keepDefaultValues&&t?Ee(g,t):{},touchedFields:r.keepTouched?i.touchedFields:{},errors:r.keepErrors?i.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})})(L(t)?t(h):t,r),resetField:(e,t={})=>{d(y,e)&&(c(t.defaultValue)?W(e,d(g,e)):(W(e,t.defaultValue),H(g,e,t.defaultValue)),t.keepTouched||xe(i.touchedFields,e),t.keepDirty||(xe(i.dirtyFields,e),i.isDirty=t.defaultValue?T(e,d(g,e)):T()),t.keepError||(xe(i.errors,e),A.isValid&&k()),F.state.next({...i}))},clearErrors:e=>{e?O(e).forEach(e=>xe(i.errors,e)):i.errors={},F.state.next({errors:i.errors})},unregister:Z,setError:(e,t,r)=>{const s=(d(y,e,{_f:{}})._f||{}).ref;H(i.errors,e,{...t,ref:s}),F.state.next({name:e,errors:i.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},setFocus:(e,t={})=>{const r=d(y,e),s=r&&r._f;if(s){const e=s.refs?s.refs[0]:s.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:J}}exports.Controller=e=>e.render(P(e)),exports.FormProvider=e=>{const{children:r,...s}=e;return t.default.createElement(k.Provider,{value:s},r)},exports.appendErrors=W,exports.get=d,exports.set=H,exports.useController=P,exports.useFieldArray=function(e){const r=D(),{control:s=r.control,name:a,keyName:n="id",shouldUnregister:i}=e,[o,u]=t.default.useState(s._getFieldArray(a)),l=t.default.useRef(s._getFieldArray(a).map(G)),c=t.default.useRef(o),f=t.default.useRef(a),m=t.default.useRef(!1);f.current=a,c.current=o,s._names.array.add(a),e.rules&&s.register(a,e.rules),B({callback:t.default.useCallback(({values:e,name:t})=>{if(t===f.current||!t){const t=d(e,f.current);Array.isArray(t)&&(u(t),l.current=t.map(G))}},[]),subject:s._subjects.array});const y=t.default.useCallback(e=>{m.current=!0,s._updateFieldArray(a,e)},[s,a]);return t.default.useEffect(()=>{if(s._stateFlags.action=!1,K(a,s._names)&&s._subjects.state.next({}),m.current&&(!ye(s._options.mode).isOnSubmit||s._formState.isSubmitted))if(s._options.resolver)s._executeSchema([a]).then(e=>{const t=d(e.errors,a),r=d(s._formState.errors,a);(r?!t&&r.type:t&&t.type)&&(t?H(s._formState.errors,a,t):xe(s._formState.errors,a),s._subjects.state.next({errors:s._formState.errors}))});else{const e=d(s._fields,a);e&&e._f&&le(e,d(s._formValues,a),s._options.criteriaMode===v,s._options.shouldUseNativeValidation,!0).then(e=>!E(e)&&s._subjects.state.next({errors:Q(s._formState.errors,e,a)}))}s._subjects.watch.next({name:a,values:s._formValues}),s._names.focus&&z(s._fields,e=>!!e&&e.startsWith(s._names.focus)),s._names.focus="",s._proxyFormState.isValid&&s._updateValid()},[o,a,s]),t.default.useEffect(()=>(!d(s._formValues,a)&&s._updateFieldArray(a),()=>{(s._options.shouldUnregister||i)&&s.unregister(a)}),[a,s,n,i]),{swap:t.default.useCallback((e,t)=>{const r=s._getFieldArray(a);ve(r,e,t),ve(l.current,e,t),y(r),u(r),s._updateFieldArray(a,r,ve,{argA:e,argB:t},!1)},[y,a,s]),move:t.default.useCallback((e,t)=>{const r=s._getFieldArray(a);he(r,e,t),he(l.current,e,t),y(r),u(r),s._updateFieldArray(a,r,he,{argA:e,argB:t},!1)},[y,a,s]),prepend:t.default.useCallback((e,t)=>{const r=O(fe(e)),n=pe(s._getFieldArray(a),r);s._names.focus=J(a,0,t),l.current=pe(l.current,r.map(G)),y(n),u(n),s._updateFieldArray(a,n,pe,{argA:me(e)})},[y,a,s]),append:t.default.useCallback((e,t)=>{const r=O(fe(e)),n=ce(s._getFieldArray(a),r);s._names.focus=J(a,n.length-1,t),l.current=ce(l.current,r.map(G)),y(n),u(n),s._updateFieldArray(a,n,ce,{argA:me(e)})},[y,a,s]),remove:t.default.useCallback(e=>{const t=_e(s._getFieldArray(a),e);l.current=_e(l.current,e),y(t),u(t),s._updateFieldArray(a,t,_e,{argA:e})},[y,a,s]),insert:t.default.useCallback((e,t,r)=>{const n=O(fe(t)),i=ge(s._getFieldArray(a),e,n);s._names.focus=J(a,e,r),l.current=ge(l.current,e,n.map(G)),y(i),u(i),s._updateFieldArray(a,i,ge,{argA:e,argB:me(t)})},[y,a,s]),update:t.default.useCallback((e,t)=>{const r=fe(t),n=Ae(s._getFieldArray(a),e,r);l.current=[...n].map((t,r)=>t&&r!==e?l.current[r]:G()),y(n),u([...n]),s._updateFieldArray(a,n,Ae,{argA:e,argB:r},!0,!1)},[y,a,s]),replace:t.default.useCallback(e=>{const t=O(fe(e));l.current=t.map(G),y([...t]),u([...t]),s._updateFieldArray(a,[...t],e=>e,{},!0,!1)},[y,a,s]),fields:t.default.useMemo(()=>o.map((e,t)=>({...e,[n]:l.current[t]||G()})),[o,n])}},exports.useForm=function(e={}){const r=t.default.useRef(),[s,a]=t.default.useState({isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:e.defaultValues});r.current||(r.current={...Me(e),formState:s});const n=r.current.control;return n._options=e,B({subject:n._subjects.state,callback:t.default.useCallback(e=>{j(e,n._proxyFormState,!0)&&(n._formState={...n._formState,...e},a({...n._formState}))},[n])}),t.default.useEffect(()=>{n._stateFlags.mount||(n._proxyFormState.isValid&&n._updateValid(),n._stateFlags.mount=!0),n._stateFlags.watch&&(n._stateFlags.watch=!1,n._subjects.state.next({})),n._removeUnmounted()}),t.default.useEffect(()=>{s.submitCount&&n._focusError()},[n,s.submitCount]),r.current.formState=C(s,n),r.current},exports.useFormContext=D,exports.useFormState=T,exports.useWatch=q;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react")),r=e=>"checkbox"===e.type,s=e=>e instanceof Date,a=e=>null==e;const n=e=>"object"==typeof e;var i=e=>!a(e)&&!Array.isArray(e)&&n(e)&&!s(e),o=e=>i(e)&&e.target?r(e.target)?e.target.checked:e.target.value:e,u=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),l=e=>Array.isArray(e)?e.filter(Boolean):[],c=e=>void 0===e,d=(e,t,r)=>{if(!t||!i(e))return r;const s=l(t.split(/[,[\].]+?/)).reduce(((e,t)=>a(e)?e:e[t]),e);return c(s)||s===e?c(e[t])?r:e[t]:s};const f="blur",m="focusout",y="change",g="onBlur",h="onChange",p="onSubmit",_="onTouched",v="all",b="max",x="min",A="maxLength",F="minLength",V="pattern",S="required",w="validate",k=t.default.createContext(null),D=()=>t.default.useContext(k);var C=(e,t,r,s=!0)=>{const a={defaultValues:t._defaultValues};for(const n in e)Object.defineProperty(a,n,{get:()=>{const a=n;return t._proxyFormState[a]!==v&&(t._proxyFormState[a]=!s||v),r&&(r[a]=!0),e[a]}});return a},E=e=>i(e)&&!Object.keys(e).length,j=(e,t,r)=>{const{name:s,...a}=e;return E(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===(!r||v)))},O=e=>Array.isArray(e)?e:[e],U=(e,t,r)=>r&&t?e===t:!e||!t||e===t||O(e).some((e=>e&&(e.startsWith(t)||t.startsWith(e))));function B(e){const r=t.default.useRef(e);r.current=e,t.default.useEffect((()=>{const t=!e.disabled&&r.current.subject.subscribe({next:r.current.callback});return()=>{t&&t.unsubscribe()}}),[e.disabled])}function T(e){const r=D(),{control:s=r.control,disabled:a,name:n,exact:i}=e||{},[o,u]=t.default.useState(s._formState),l=t.default.useRef(!0),c=t.default.useRef({isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=t.default.useRef(n);return d.current=n,B({disabled:a,callback:t.default.useCallback((e=>l.current&&U(d.current,e.name,i)&&j(e,c.current)&&u({...s._formState,...e})),[s,i]),subject:s._subjects.state}),t.default.useEffect((()=>(l.current=!0,()=>{l.current=!1})),[]),C(o,s,c.current,!1)}var M=e=>"string"==typeof e,N=(e,t,r,s)=>{const a=Array.isArray(e);return M(e)?(s&&t.watch.add(e),d(r,e)):a?e.map((e=>(s&&t.watch.add(e),d(r,e)))):(s&&(t.watchAll=!0),r)},L=e=>"function"==typeof e,R=e=>{for(const t in e)if(L(e[t]))return!0;return!1};function q(e){const r=D(),{control:s=r.control,name:a,defaultValue:n,disabled:o,exact:u}=e||{},l=t.default.useRef(a);l.current=a,B({disabled:o,subject:s._subjects.watch,callback:t.default.useCallback((e=>{if(U(l.current,e.name,u)){const t=N(l.current,s._names,e.values||s._formValues);f(c(l.current)||i(t)&&!R(t)?{...t}:Array.isArray(t)?[...t]:c(t)?n:t)}}),[s,u,n])});const[d,f]=t.default.useState(c(n)?s._getWatch(a):n);return t.default.useEffect((()=>s._removeUnmounted())),d}function P(e){const r=D(),{name:s,control:a=r.control,shouldUnregister:n}=e,i=u(a._names.array,s),l=q({control:a,name:s,defaultValue:d(a._formValues,s,d(a._defaultValues,s,e.defaultValue)),exact:!0}),c=T({control:a,name:s}),m=t.default.useRef(a.register(s,{...e.rules,value:l})),g=d(a._fields,s);return g&&(g._f._c=!0),t.default.useEffect((()=>{const e=(e,t)=>{const r=d(a._fields,e);r&&(r._f.mount=t)};return e(s,!0),()=>{const t=a._options.shouldUnregister||n;(i?t&&!a._stateFlags.action:t)?a.unregister(s):e(s,!1)}}),[s,a,i,n]),{field:{name:s,value:l,onChange:t.default.useCallback((e=>m.current.onChange({target:{value:o(e),name:s},type:y})),[s]),onBlur:t.default.useCallback((()=>m.current.onBlur({target:{value:d(a._formValues,s),name:s},type:f})),[s,a]),ref:e=>{g&&e&&(g._f.ref=e)}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!d(c.errors,s)},isDirty:{enumerable:!0,get:()=>!!d(c.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!d(c.touchedFields,s)},error:{enumerable:!0,get:()=>d(c.errors,s)}})}}var W=(e,t,r,s,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:a||!0}}:{},$=e=>/^\w*$/.test(e),I=e=>l(e.replace(/["|']|\]/g,"").split(/\.|\[/));function H(e,t,r){let s=-1;const a=$(t)?[t]:I(t),n=a.length,o=n-1;for(;++s<n;){const t=a[s];let n=r;if(s!==o){const r=e[t];n=i(r)||Array.isArray(r)?r:isNaN(+a[s+1])?{}:[]}e[t]=n,e=e[t]}return e}const z=(e,t,r)=>{for(const s of r||Object.keys(e)){const r=d(e,s);if(r){const{_f:e,...s}=r;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else i(s)&&z(s,t)}}};var G=()=>{const e="undefined"==typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const r=(16*Math.random()+e)%16|0;return("x"==t?r:3&r|8).toString(16)}))},J=(e,t,r={})=>r.shouldFocus||c(r.shouldFocus)?r.focusName||`${e}.${c(r.focusIndex)?t:r.focusIndex}.`:"",K=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))))),Q=(e,t,r)=>{const s=l(d(e,r));return H(s,"root",t[r]),H(e,r,s),e},X=e=>"boolean"==typeof e,Y=e=>"file"===e.type,Z=e=>M(e)||t.default.isValidElement(e),ee=e=>"radio"===e.type,te=e=>e instanceof RegExp;const re={value:!1,isValid:!1},se={value:!0,isValid:!0};var ae=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!c(e[0].attributes.value)?c(e[0].value)||""===e[0].value?se:{value:e[0].value,isValid:!0}:se:re}return re};const ne={isValid:!1,value:null};var ie=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),ne):ne;function oe(e,t,r="validate"){if(Z(e)||Array.isArray(e)&&e.every(Z)||X(e)&&!e)return{type:r,message:Z(e)?e:"",ref:t}}var ue=e=>i(e)&&!te(e)?e:{value:e,message:""},le=async(e,t,s,n,o)=>{const{ref:u,refs:l,required:c,maxLength:d,minLength:f,min:m,max:y,pattern:g,validate:h,name:p,valueAsNumber:_,mount:v,disabled:k}=e._f;if(!v||k)return{};const D=l?l[0]:u,C=e=>{n&&M(e)&&(D.setCustomValidity(e),D.reportValidity())},j={},O=ee(u),U=r(u),B=O||U,T=(_||Y(u))&&!u.value||""===t||Array.isArray(t)&&!t.length,N=W.bind(null,p,s,j),R=(e,t,r,s=A,a=F)=>{const n=e?t:r;j[p]={type:e?s:a,message:n,ref:u,...N(e?s:a,n)}};if(o?!Array.isArray(t)||!t.length:c&&(!B&&(T||a(t))||X(t)&&!t||U&&!ae(l).isValid||O&&!ie(l).isValid)){const{value:e,message:t}=Z(c)?{value:!!c,message:c}:ue(c);if(e&&(j[p]={type:S,message:t,ref:D,...N(S,t)},!s))return C(t),j}if(!(T||a(m)&&a(y))){let e,r;const n=ue(y),i=ue(m);if(a(t)||isNaN(t)){const s=u.valueAsDate||new Date(t),a=e=>new Date((new Date).toDateString()+" "+e),o="time"==u.type,l="week"==u.type;M(n.value)&&t&&(e=o?a(t)>a(n.value):l?t>n.value:s>new Date(n.value)),M(i.value)&&t&&(r=o?a(t)<a(i.value):l?t<i.value:s<new Date(i.value))}else{const s=u.valueAsNumber||(t?+t:t);a(n.value)||(e=s>n.value),a(i.value)||(r=s<i.value)}if((e||r)&&(R(!!e,n.message,i.message,b,x),!s))return C(j[p].message),j}if((d||f)&&!T&&(M(t)||o&&Array.isArray(t))){const e=ue(d),r=ue(f),n=!a(e.value)&&t.length>e.value,i=!a(r.value)&&t.length<r.value;if((n||i)&&(R(n,e.message,r.message),!s))return C(j[p].message),j}if(g&&!T&&M(t)){const{value:e,message:r}=ue(g);if(te(e)&&!t.match(e)&&(j[p]={type:V,message:r,ref:u,...N(V,r)},!s))return C(r),j}if(h)if(L(h)){const e=oe(await h(t),D);if(e&&(j[p]={...e,...N(w,e.message)},!s))return C(e.message),j}else if(i(h)){let e={};for(const r in h){if(!E(e)&&!s)break;const a=oe(await h[r](t),D,r);a&&(e={...a,...N(r,a.message)},C(a.message),s&&(j[p]=e))}if(!E(e)&&(j[p]={ref:D,...e},!s))return j}return C(!0),j};function ce(e,t){return[...e,...O(t)]}var de="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function fe(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(de&&(e instanceof Blob||e instanceof FileList)||!r&&!i(e))return e;if(t=r?[]:{},Array.isArray(e)||(e=>{const t=e.constructor&&e.constructor.prototype;return i(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)t[r]=fe(e[r]);else t=e}return t}var me=e=>Array.isArray(e)?e.map((()=>{})):void 0,ye=e=>({isOnSubmit:!e||e===p,isOnBlur:e===g,isOnChange:e===h,isOnAll:e===v,isOnTouch:e===_});function ge(e,t,r){return[...e.slice(0,t),...O(r),...e.slice(t)]}var he=(e,t,r)=>Array.isArray(e)?(c(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[];function pe(e,t){return[...O(t),...O(e)]}var _e=(e,t)=>c(t)?[]:function(e,t){let r=0;const s=[...e];for(const e of t)s.splice(e-r,1),r++;return l(s).length?s:[]}(e,O(t).sort(((e,t)=>e-t))),ve=(e,t,r)=>{e[t]=[e[r],e[r]=e[t]][0]};function be(e){for(const t in e)if(!c(e[t]))return!1;return!0}function xe(e,t){const r=$(t)?[t]:I(t),s=1==r.length?e:function(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=c(e)?s++:e[t[s++]];return e}(e,r),a=r[r.length-1];let n;s&&delete s[a];for(let t=0;t<r.slice(0,-1).length;t++){let s,a=-1;const o=r.slice(0,-(t+1)),u=o.length-1;for(t>0&&(n=e);++a<o.length;){const t=o[a];s=s?s[t]:e[t],u===a&&(i(s)&&E(s)||Array.isArray(s)&&be(s))&&(n?delete n[t]:delete e[t]),n=s}}return e}var Ae=(e,t,r)=>(e[t]=r,e);function Fe(){let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}}var Ve=e=>a(e)||!n(e);function Se(e,t){if(Ve(e)||Ve(t))return e===t;if(s(e)&&s(t))return e.getTime()===t.getTime();const r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(const n of r){const r=e[n];if(!a.includes(n))return!1;if("ref"!==n){const e=t[n];if(s(r)&&s(e)||i(r)&&i(e)||Array.isArray(r)&&Array.isArray(e)?!Se(r,e):r!==e)return!1}}return!0}var we=e=>{const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ke=e=>"select-multiple"===e.type,De=e=>we(e)&&e.isConnected;function Ce(e,t={}){const r=Array.isArray(e);if(i(e)||r)for(const r in e)Array.isArray(e[r])||i(e[r])&&!R(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Ce(e[r],t[r])):a(e[r])||(t[r]=!0);return t}function Ee(e,t,r){const s=Array.isArray(e);if(i(e)||s)for(const s in e)Array.isArray(e[s])||i(e[s])&&!R(e[s])?c(t)||Ve(r[s])?r[s]=Array.isArray(e[s])?Ce(e[s],[]):{...Ce(e[s])}:Ee(e[s],a(t)?{}:t[s],r[s]):Se(e[s],t[s])?delete r[s]:r[s]=!0;return r}var je=(e,t)=>Ee(e,t,Ce(t)),Oe=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>c(e)?e:t?""===e?NaN:e?+e:e:r&&M(e)?new Date(e):s?s(e):e;function Ue(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return Y(t)?t.files:ee(t)?ie(e.refs).value:ke(t)?[...t.selectedOptions].map((({value:e})=>e)):r(t)?ae(e.refs).value:Oe(c(t.value)?e.ref.value:t.value,e)}var Be=e=>c(e)?void 0:te(e)?e.source:i(e)?te(e.value)?e.value.source:e.value:e;function Te(e,t,r){const s=d(e,r);if(s||$(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),n=d(t,s),i=d(e,s);if(n&&!Array.isArray(n)&&r!==s)return{name:r};if(i&&i.type)return{name:s,error:i};a.pop()}return{name:r}}const Me={mode:p,reValidateMode:h,shouldFocusError:!0};function Ne(e={}){let t,n={...Me,...e},i={submitCount:0,isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},y={},g=fe(n.defaultValues)||{},h=n.shouldUnregister?{}:fe(g),p={action:!1,mount:!1,watch:!1},_={mount:new Set,unMount:new Set,array:new Set,watch:new Set},b=0,x={};const A={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},F={watch:Fe(),array:Fe(),state:Fe()},V=ye(n.mode),S=ye(n.reValidateMode),w=n.criteriaMode===v,k=async()=>{let e=!1;return A.isValid&&(e=n.resolver?E((await U()).errors):await B(y,!0),e!==i.isValid&&(i.isValid=e,F.state.next({isValid:e}))),e},D=(e,t,r,s)=>{const a=d(y,e);if(a){const n=d(h,e,c(r)?d(g,e):r);c(n)||s&&s.defaultChecked||t?H(h,e,t?n:Ue(a._f)):q(e,n),p.mount&&k()}},C=(e,t,r,s,a)=>{let n=!1;const o={name:e},u=d(i.touchedFields,e);if(A.isDirty){const e=i.isDirty;i.isDirty=o.isDirty=T(),n=e!==o.isDirty}if(A.dirtyFields&&(!r||s)){const r=d(i.dirtyFields,e);Se(d(g,e),t)?xe(i.dirtyFields,e):H(i.dirtyFields,e,!0),o.dirtyFields=i.dirtyFields,n=n||r!==d(i.dirtyFields,e)}return r&&!u&&(H(i.touchedFields,e,r),o.touchedFields=i.touchedFields,n=n||A.touchedFields&&u!==r),n&&a&&F.state.next(o),n?o:{}},j=(r,s,a,n)=>{const o=d(i.errors,r),u=A.isValid&&X(s)&&i.isValid!==s;var l;if(e.delayError&&a?(l=()=>((e,t)=>{H(i.errors,e,t),F.state.next({errors:i.errors})})(r,a),t=e=>{clearTimeout(b),b=window.setTimeout(l,e)},t(e.delayError)):(clearTimeout(b),t=null,a?H(i.errors,r,a):xe(i.errors,r)),(a?!Se(o,a):o)||!E(n)||u){const e={...n,...u&&X(s)?{isValid:s}:{},errors:i.errors,name:r};i={...i,...e},F.state.next(e)}x[r]--,A.isValidating&&!Object.values(x).some((e=>e))&&(F.state.next({isValidating:!1}),x={})},U=async e=>n.resolver?await n.resolver({...h},n.context,((e,t,r,s)=>{const a={};for(const r of e){const e=d(t,r);e&&H(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:s}})(e||_.mount,y,n.criteriaMode,n.shouldUseNativeValidation)):{},B=async(e,t,r={valid:!0})=>{for(const s in e){const a=e[s];if(a){const{_f:e,...s}=a;if(e){const s=_.array.has(e.name),o=await le(a,d(h,e.name),w,n.shouldUseNativeValidation,s);if(o[e.name]&&(r.valid=!1,t))break;!t&&(d(o,e.name)?s?Q(i.errors,o,e.name):H(i.errors,e.name,o[e.name]):xe(i.errors,e.name))}s&&await B(s,t,r)}}return r.valid},T=(e,t)=>(e&&t&&H(h,e,t),!Se(G(),g)),R=(e,t,r)=>{const s={...p.mount?h:c(t)?g:M(e)?{[e]:t}:t};return N(e,_,s,r)},q=(e,t,s={})=>{const n=d(y,e);let i=t;if(n){const s=n._f;s&&(!s.disabled&&H(h,e,Oe(t,s)),i=de&&we(s.ref)&&a(t)?"":t,ke(s.ref)?[...s.ref.options].forEach((e=>e.selected=i.includes(e.value))):s.refs?r(s.ref)?s.refs.length>1?s.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):s.refs[0]&&(s.refs[0].checked=!!i):s.refs.forEach((e=>e.checked=e.value===i)):Y(s.ref)?s.ref.value="":(s.ref.value=i,s._c&&F.watch.next({name:e})))}(s.shouldDirty||s.shouldTouch)&&C(e,i,s.shouldTouch,s.shouldDirty,!0),s.shouldValidate&&I(e)},P=(e,t,r)=>{for(const a in t){const n=t[a],i=`${e}.${a}`,o=d(y,i);!_.array.has(e)&&Ve(n)&&(!o||o._f)||s(n)?q(i,n,r):P(i,n,r)}},W=(e,t,r={})=>{const s=d(y,e),n=_.array.has(e),o=fe(t);H(h,e,o),n?(F.array.next({name:e,values:h}),(A.isDirty||A.dirtyFields)&&r.shouldDirty&&(i.dirtyFields=je(g,h),F.state.next({name:e,dirtyFields:i.dirtyFields,isDirty:T(e,o)}))):!s||s._f||a(o)?q(e,o,r):P(e,o,r),K(e,_)&&F.state.next({}),F.watch.next({name:e})},$=async e=>{const r=e.target;let s=r.name;const a=d(y,s);if(a){let l,c;const g=r.type?Ue(a._f):o(e),p=e.type===f||e.type===m,v=!((u=a._f).mount&&(u.required||u.min||u.max||u.maxLength||u.minLength||u.pattern||u.validate)||n.resolver||d(i.errors,s)||a._f.deps)||((e,t,r,s,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?s.isOnBlur:a.isOnBlur)?!e:!(r?s.isOnChange:a.isOnChange)||e))(p,d(i.touchedFields,s),i.isSubmitted,S,V),b=K(s,_,p);H(h,s,g),p?(a._f.onBlur&&a._f.onBlur(e),t&&t(0)):a._f.onChange&&a._f.onChange(e);const D=C(s,g,p,!1),O=!E(D)||b;if(!p&&F.watch.next({name:s,type:e.type}),v)return A.isValid&&k(),O&&F.state.next({name:s,...b?{}:D});if(!p&&b&&F.state.next({}),x[s]=x[s]?x[s]+1:1,F.state.next({isValidating:!0}),n.resolver){const{errors:e}=await U([s]),t=Te(i.errors,y,s),r=Te(e,y,t.name||s);l=r.error,s=r.name,c=E(e)}else l=(await le(a,d(h,s),w,n.shouldUseNativeValidation))[s],k();a._f.deps&&I(a._f.deps),j(s,c,l,D)}var u},I=async(e,t={})=>{let r,s;const a=O(e);if(F.state.next({isValidating:!0}),n.resolver){const t=await(async e=>{const{errors:t}=await U();if(e)for(const r of e){const e=d(t,r);e?H(i.errors,r,e):xe(i.errors,r)}else i.errors=t;return t})(c(e)?e:a);r=E(t),s=e?!a.some((e=>d(t,e))):r}else e?(s=(await Promise.all(a.map((async e=>{const t=d(y,e);return await B(t&&t._f?{[e]:t}:t)})))).every(Boolean),(s||i.isValid)&&k()):s=r=await B(y);return F.state.next({...!M(e)||A.isValid&&r!==i.isValid?{}:{name:e},...n.resolver||!e?{isValid:r}:{},errors:i.errors,isValidating:!1}),t.shouldFocus&&!s&&z(y,(e=>e&&d(i.errors,e)),e?a:_.mount),s},G=e=>{const t={...g,...p.mount?h:{}};return c(e)?t:M(e)?d(t,e):e.map((e=>d(t,e)))},J=(e,t)=>({invalid:!!d((t||i).errors,e),isDirty:!!d((t||i).dirtyFields,e),isTouched:!!d((t||i).touchedFields,e),error:d((t||i).errors,e)}),Z=(e,t={})=>{for(const r of e?O(e):_.mount)_.mount.delete(r),_.array.delete(r),d(y,r)&&(t.keepValue||(xe(y,r),xe(h,r)),!t.keepError&&xe(i.errors,r),!t.keepDirty&&xe(i.dirtyFields,r),!t.keepTouched&&xe(i.touchedFields,r),!n.shouldUnregister&&!t.keepDefaultValue&&xe(g,r));F.watch.next({}),F.state.next({...i,...t.keepDirty?{isDirty:T()}:{}}),!t.keepIsValid&&k()},te=(e,t={})=>{let s=d(y,e);const a=X(t.disabled);return H(y,e,{...s||{},_f:{...s&&s._f?s._f:{ref:{name:e}},name:e,mount:!0,...t}}),_.mount.add(e),s?a&&H(h,e,t.disabled?void 0:d(h,e,Ue(s._f))):D(e,!0,t.value),{...a?{disabled:t.disabled}:{},...n.shouldUseNativeValidation?{required:!!t.required,min:Be(t.min),max:Be(t.max),minLength:Be(t.minLength),maxLength:Be(t.maxLength),pattern:Be(t.pattern)}:{},name:e,onChange:$,onBlur:$,ref:a=>{if(a){te(e,t),s=d(y,e);const n=c(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,i=(e=>ee(e)||r(e))(n),o=s._f.refs||[];if(i?o.find((e=>e===n)):n===s._f.ref)return;H(y,e,{_f:{...s._f,...i?{refs:[...o.filter(De),n,...Array.isArray(d(g,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),D(e,!1,void 0,n)}else s=d(y,e,{}),s._f&&(s._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!u(_.array,e)||!p.action)&&_.unMount.add(e)}}},re=()=>n.shouldFocusError&&z(y,(e=>e&&d(i.errors,e)),_.mount);return{control:{register:te,unregister:Z,getFieldState:J,_executeSchema:U,_focusError:re,_getWatch:R,_getDirty:T,_updateValid:k,_removeUnmounted:()=>{for(const e of _.unMount){const t=d(y,e);t&&(t._f.refs?t._f.refs.every((e=>!De(e))):!De(t._f.ref))&&Z(e)}_.unMount=new Set},_updateFieldArray:(e,t=[],r,s,a=!0,n=!0)=>{if(s&&r){if(p.action=!0,n&&Array.isArray(d(y,e))){const t=r(d(y,e),s.argA,s.argB);a&&H(y,e,t)}if(A.errors&&n&&Array.isArray(d(i.errors,e))){const t=r(d(i.errors,e),s.argA,s.argB);a&&H(i.errors,e,t),((e,t)=>{!l(d(e,t)).length&&xe(e,t)})(i.errors,e)}if(A.touchedFields&&n&&Array.isArray(d(i.touchedFields,e))){const t=r(d(i.touchedFields,e),s.argA,s.argB);a&&H(i.touchedFields,e,t)}A.dirtyFields&&(i.dirtyFields=je(g,h)),F.state.next({isDirty:T(e,t),dirtyFields:i.dirtyFields,errors:i.errors,isValid:i.isValid})}else H(h,e,t)},_getFieldArray:t=>l(d(p.mount?h:g,t,e.shouldUnregister?d(g,t,[]):[])),_subjects:F,_proxyFormState:A,get _fields(){return y},get _formValues(){return h},get _stateFlags(){return p},set _stateFlags(e){p=e},get _defaultValues(){return g},get _names(){return _},set _names(e){_=e},get _formState(){return i},set _formState(e){i=e},get _options(){return n},set _options(e){n={...n,...e}}},trigger:I,register:te,handleSubmit:(e,t)=>async r=>{r&&(r.preventDefault&&r.preventDefault(),r.persist&&r.persist());let s=!0,a=fe(h);F.state.next({isSubmitting:!0});try{if(n.resolver){const{errors:e,values:t}=await U();i.errors=e,a=t}else await B(y);E(i.errors)?(F.state.next({errors:{},isSubmitting:!0}),await e(a,r)):(t&&await t({...i.errors},r),re())}catch(e){throw s=!1,e}finally{i.isSubmitted=!0,F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:E(i.errors)&&s,submitCount:i.submitCount+1,errors:i.errors})}},watch:(e,t)=>L(e)?F.watch.subscribe({next:r=>e(R(void 0,t),r)}):R(e,t,!0),setValue:W,getValues:G,reset:(t,r)=>((t,r={})=>{const s=t||g,a=fe(s),n=t&&!E(t)?a:g;if(r.keepDefaultValues||(g=s),!r.keepValues){if(r.keepDirtyValues)for(const e of _.mount)d(i.dirtyFields,e)?H(n,e,d(h,e)):W(e,d(n,e));else{if(de&&c(t))for(const e of _.mount){const t=d(y,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(we(e)){const t=e.closest("form");if(t){t.reset();break}}}}y={}}h=e.shouldUnregister?r.keepDefaultValues?fe(g):{}:a,F.array.next({values:n}),F.watch.next({values:n})}_={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},p.mount=!A.isValid||!!r.keepIsValid,p.watch=!!e.shouldUnregister,F.state.next({submitCount:r.keepSubmitCount?i.submitCount:0,isDirty:r.keepDirty||r.keepDirtyValues?i.isDirty:!(!r.keepDefaultValues||Se(t,g)),isSubmitted:!!r.keepIsSubmitted&&i.isSubmitted,dirtyFields:r.keepDirty||r.keepDirtyValues?i.dirtyFields:r.keepDefaultValues&&t?je(g,t):{},touchedFields:r.keepTouched?i.touchedFields:{},errors:r.keepErrors?i.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})})(L(t)?t(h):t,r),resetField:(e,t={})=>{d(y,e)&&(c(t.defaultValue)?W(e,d(g,e)):(W(e,t.defaultValue),H(g,e,t.defaultValue)),t.keepTouched||xe(i.touchedFields,e),t.keepDirty||(xe(i.dirtyFields,e),i.isDirty=t.defaultValue?T(e,d(g,e)):T()),t.keepError||(xe(i.errors,e),A.isValid&&k()),F.state.next({...i}))},clearErrors:e=>{e?O(e).forEach((e=>xe(i.errors,e))):i.errors={},F.state.next({errors:i.errors})},unregister:Z,setError:(e,t,r)=>{const s=(d(y,e,{_f:{}})._f||{}).ref;H(i.errors,e,{...t,ref:s}),F.state.next({name:e,errors:i.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},setFocus:(e,t={})=>{const r=d(y,e),s=r&&r._f;if(s){const e=s.refs?s.refs[0]:s.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:J}}exports.Controller=e=>e.render(P(e)),exports.FormProvider=e=>{const{children:r,...s}=e;return t.default.createElement(k.Provider,{value:s},r)},exports.appendErrors=W,exports.get=d,exports.set=H,exports.useController=P,exports.useFieldArray=function(e){const r=D(),{control:s=r.control,name:a,keyName:n="id",shouldUnregister:i}=e,[o,u]=t.default.useState(s._getFieldArray(a)),l=t.default.useRef(s._getFieldArray(a).map(G)),c=t.default.useRef(o),f=t.default.useRef(a),m=t.default.useRef(!1);f.current=a,c.current=o,s._names.array.add(a),e.rules&&s.register(a,e.rules),B({callback:t.default.useCallback((({values:e,name:t})=>{if(t===f.current||!t){const t=d(e,f.current);Array.isArray(t)&&(u(t),l.current=t.map(G))}}),[]),subject:s._subjects.array});const y=t.default.useCallback((e=>{m.current=!0,s._updateFieldArray(a,e)}),[s,a]);return t.default.useEffect((()=>{if(s._stateFlags.action=!1,K(a,s._names)&&s._subjects.state.next({}),m.current&&(!ye(s._options.mode).isOnSubmit||s._formState.isSubmitted))if(s._options.resolver)s._executeSchema([a]).then((e=>{const t=d(e.errors,a),r=d(s._formState.errors,a);(r?!t&&r.type:t&&t.type)&&(t?H(s._formState.errors,a,t):xe(s._formState.errors,a),s._subjects.state.next({errors:s._formState.errors}))}));else{const e=d(s._fields,a);e&&e._f&&le(e,d(s._formValues,a),s._options.criteriaMode===v,s._options.shouldUseNativeValidation,!0).then((e=>!E(e)&&s._subjects.state.next({errors:Q(s._formState.errors,e,a)})))}s._subjects.watch.next({name:a,values:s._formValues}),s._names.focus&&z(s._fields,(e=>!!e&&e.startsWith(s._names.focus))),s._names.focus="",s._proxyFormState.isValid&&s._updateValid()}),[o,a,s]),t.default.useEffect((()=>(!d(s._formValues,a)&&s._updateFieldArray(a),()=>{(s._options.shouldUnregister||i)&&s.unregister(a)})),[a,s,n,i]),{swap:t.default.useCallback(((e,t)=>{const r=s._getFieldArray(a);ve(r,e,t),ve(l.current,e,t),y(r),u(r),s._updateFieldArray(a,r,ve,{argA:e,argB:t},!1)}),[y,a,s]),move:t.default.useCallback(((e,t)=>{const r=s._getFieldArray(a);he(r,e,t),he(l.current,e,t),y(r),u(r),s._updateFieldArray(a,r,he,{argA:e,argB:t},!1)}),[y,a,s]),prepend:t.default.useCallback(((e,t)=>{const r=O(fe(e)),n=pe(s._getFieldArray(a),r);s._names.focus=J(a,0,t),l.current=pe(l.current,r.map(G)),y(n),u(n),s._updateFieldArray(a,n,pe,{argA:me(e)})}),[y,a,s]),append:t.default.useCallback(((e,t)=>{const r=O(fe(e)),n=ce(s._getFieldArray(a),r);s._names.focus=J(a,n.length-1,t),l.current=ce(l.current,r.map(G)),y(n),u(n),s._updateFieldArray(a,n,ce,{argA:me(e)})}),[y,a,s]),remove:t.default.useCallback((e=>{const t=_e(s._getFieldArray(a),e);l.current=_e(l.current,e),y(t),u(t),s._updateFieldArray(a,t,_e,{argA:e})}),[y,a,s]),insert:t.default.useCallback(((e,t,r)=>{const n=O(fe(t)),i=ge(s._getFieldArray(a),e,n);s._names.focus=J(a,e,r),l.current=ge(l.current,e,n.map(G)),y(i),u(i),s._updateFieldArray(a,i,ge,{argA:e,argB:me(t)})}),[y,a,s]),update:t.default.useCallback(((e,t)=>{const r=fe(t),n=Ae(s._getFieldArray(a),e,r);l.current=[...n].map(((t,r)=>t&&r!==e?l.current[r]:G())),y(n),u([...n]),s._updateFieldArray(a,n,Ae,{argA:e,argB:r},!0,!1)}),[y,a,s]),replace:t.default.useCallback((e=>{const t=O(fe(e));l.current=t.map(G),y([...t]),u([...t]),s._updateFieldArray(a,[...t],(e=>e),{},!0,!1)}),[y,a,s]),fields:t.default.useMemo((()=>o.map(((e,t)=>({...e,[n]:l.current[t]||G()})))),[o,n])}},exports.useForm=function(e={}){const r=t.default.useRef(),[s,a]=t.default.useState({isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:e.defaultValues});r.current||(r.current={...Ne(e),formState:s});const n=r.current.control;return n._options=e,B({subject:n._subjects.state,callback:t.default.useCallback((e=>{j(e,n._proxyFormState,!0)&&(n._formState={...n._formState,...e},a({...n._formState}))}),[n])}),t.default.useEffect((()=>{n._stateFlags.mount||(n._proxyFormState.isValid&&n._updateValid(),n._stateFlags.mount=!0),n._stateFlags.watch&&(n._stateFlags.watch=!1,n._subjects.state.next({})),n._removeUnmounted()})),t.default.useEffect((()=>{s.submitCount&&n._focusError()}),[n,s.submitCount]),r.current.formState=C(s,n),r.current},exports.useFormContext=D,exports.useFormState=T,exports.useWatch=q;
//# sourceMappingURL=index.cjs.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactHookForm={},e.React)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(t),a=e=>"checkbox"===e.type,n=e=>e instanceof Date,i=e=>null==e;const o=e=>"object"==typeof e;var u=e=>!i(e)&&!Array.isArray(e)&&o(e)&&!n(e),l=e=>u(e)&&e.target?a(e.target)?e.target.checked:e.target.value:e,c=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),d=e=>Array.isArray(e)?e.filter(Boolean):[],f=e=>void 0===e,m=(e,t,r)=>{if(!t||!u(e))return r;const s=d(t.split(/[,[\].]+?/)).reduce((e,t)=>i(e)?e:e[t],e);return f(s)||s===e?f(e[t])?r:e[t]:s};const y="blur",g="focusout",h="change",p="onBlur",_="onChange",v="onSubmit",b="onTouched",A="all",x="max",F="min",V="maxLength",S="minLength",w="pattern",k="required",D="validate",C=s.default.createContext(null),j=()=>s.default.useContext(C);var E=(e,t,r,s=!0)=>{const a={defaultValues:t._defaultValues};for(const n in e)Object.defineProperty(a,n,{get:()=>{const a=n;return t._proxyFormState[a]!==A&&(t._proxyFormState[a]=!s||A),r&&(r[a]=!0),e[a]}});return a},O=e=>u(e)&&!Object.keys(e).length,T=(e,t,r)=>{const{name:s,...a}=e;return O(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||A))},U=e=>Array.isArray(e)?e:[e],B=(e,t,r)=>r&&t?e===t:!e||!t||e===t||U(e).some(e=>e&&(e.startsWith(t)||t.startsWith(e)));function M(e){const t=s.default.useRef(e);t.current=e,s.default.useEffect(()=>{const r=!e.disabled&&t.current.subject.subscribe({next:t.current.callback});return()=>{r&&r.unsubscribe()}},[e.disabled])}function N(e){const t=j(),{control:r=t.control,disabled:a,name:n,exact:i}=e||{},[o,u]=s.default.useState(r._formState),l=s.default.useRef(!0),c=s.default.useRef({isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=s.default.useRef(n);return d.current=n,M({disabled:a,callback:s.default.useCallback(e=>l.current&&B(d.current,e.name,i)&&T(e,c.current)&&u({...r._formState,...e}),[r,i]),subject:r._subjects.state}),s.default.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]),E(o,r,c.current,!1)}var L=e=>"string"==typeof e,R=(e,t,r,s)=>{const a=Array.isArray(e);return L(e)?(s&&t.watch.add(e),m(r,e)):a?e.map(e=>(s&&t.watch.add(e),m(r,e))):(s&&(t.watchAll=!0),r)},q=e=>"function"==typeof e,P=e=>{for(const t in e)if(q(e[t]))return!0;return!1};function W(e){const t=j(),{control:r=t.control,name:a,defaultValue:n,disabled:i,exact:o}=e||{},l=s.default.useRef(a);l.current=a,M({disabled:i,subject:r._subjects.watch,callback:s.default.useCallback(e=>{if(B(l.current,e.name,o)){const t=R(l.current,r._names,e.values||r._formValues);d(f(l.current)||u(t)&&!P(t)?{...t}:Array.isArray(t)?[...t]:f(t)?n:t)}},[r,o,n])});const[c,d]=s.default.useState(f(n)?r._getWatch(a):n);return s.default.useEffect(()=>r._removeUnmounted()),c}function $(e){const t=j(),{name:r,control:a=t.control,shouldUnregister:n}=e,i=c(a._names.array,r),o=W({control:a,name:r,defaultValue:m(a._formValues,r,m(a._defaultValues,r,e.defaultValue)),exact:!0}),u=N({control:a,name:r}),d=s.default.useRef(a.register(r,{...e.rules,value:o}));return s.default.useEffect(()=>{const e=(e,t)=>{const r=m(a._fields,e);r&&(r._f.mount=t)};return e(r,!0),()=>{const t=a._options.shouldUnregister||n;(i?t&&!a._stateFlags.action:t)?a.unregister(r):e(r,!1)}},[r,a,i,n]),{field:{name:r,value:o,onChange:s.default.useCallback(e=>d.current.onChange({target:{value:l(e),name:r},type:h}),[r]),onBlur:s.default.useCallback(()=>d.current.onBlur({target:{value:m(a._formValues,r),name:r},type:y}),[r,a]),ref:e=>{const t=m(a._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:u,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!m(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!m(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!m(u.touchedFields,r)},error:{enumerable:!0,get:()=>m(u.errors,r)}})}}var I=(e,t,r,s,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:a||!0}}:{},H=e=>/^\w*$/.test(e),z=e=>d(e.replace(/["|']|\]/g,"").split(/\.|\[/));function G(e,t,r){let s=-1;const a=H(t)?[t]:z(t),n=a.length,i=n-1;for(;++s<n;){const t=a[s];let n=r;if(s!==i){const r=e[t];n=u(r)||Array.isArray(r)?r:isNaN(+a[s+1])?{}:[]}e[t]=n,e=e[t]}return e}const J=(e,t,r)=>{for(const s of r||Object.keys(e)){const r=m(e,s);if(r){const{_f:e,...s}=r;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else u(s)&&J(s,t)}}};var K=()=>{const e="undefined"==typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(16*Math.random()+e)%16|0;return("x"==t?r:3&r|8).toString(16)})},Q=(e,t,r={})=>r.shouldFocus||f(r.shouldFocus)?r.focusName||`${e}.${f(r.focusIndex)?t:r.focusIndex}.`:"",X=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),Y=(e,t,r)=>{const s=d(m(e,r));return G(s,"root",t[r]),G(e,r,s),e},Z=e=>"boolean"==typeof e,ee=e=>"file"===e.type,te=e=>L(e)||s.default.isValidElement(e),re=e=>"radio"===e.type,se=e=>e instanceof RegExp;const ae={value:!1,isValid:!1},ne={value:!0,isValid:!0};var ie=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!f(e[0].attributes.value)?f(e[0].value)||""===e[0].value?ne:{value:e[0].value,isValid:!0}:ne:ae}return ae};const oe={isValid:!1,value:null};var ue=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,oe):oe;function le(e,t,r="validate"){if(te(e)||Array.isArray(e)&&e.every(te)||Z(e)&&!e)return{type:r,message:te(e)?e:"",ref:t}}var ce=e=>u(e)&&!se(e)?e:{value:e,message:""},de=async(e,t,r,s,n)=>{const{ref:o,refs:l,required:c,maxLength:d,minLength:f,min:m,max:y,pattern:g,validate:h,name:p,valueAsNumber:_,mount:v,disabled:b}=e._f;if(!v||b)return{};const A=l?l[0]:o,C=e=>{s&&L(e)&&(A.setCustomValidity(e),A.reportValidity())},j={},E=re(o),T=a(o),U=E||T,B=(_||ee(o))&&!o.value||""===t||Array.isArray(t)&&!t.length,M=I.bind(null,p,r,j),N=(e,t,r,s=V,a=S)=>{const n=e?t:r;j[p]={type:e?s:a,message:n,ref:o,...M(e?s:a,n)}};if(n?!Array.isArray(t)||!t.length:c&&(!U&&(B||i(t))||Z(t)&&!t||T&&!ie(l).isValid||E&&!ue(l).isValid)){const{value:e,message:t}=te(c)?{value:!!c,message:c}:ce(c);if(e&&(j[p]={type:k,message:t,ref:A,...M(k,t)},!r))return C(t),j}if(!(B||i(m)&&i(y))){let e,s;const a=ce(y),n=ce(m);if(i(t)||isNaN(t)){const r=o.valueAsDate||new Date(t),i=e=>new Date((new Date).toDateString()+" "+e),u="time"==o.type,l="week"==o.type;L(a.value)&&t&&(e=u?i(t)>i(a.value):l?t>a.value:r>new Date(a.value)),L(n.value)&&t&&(s=u?i(t)<i(n.value):l?t<n.value:r<new Date(n.value))}else{const r=o.valueAsNumber||(t?+t:t);i(a.value)||(e=r>a.value),i(n.value)||(s=r<n.value)}if((e||s)&&(N(!!e,a.message,n.message,x,F),!r))return C(j[p].message),j}if((d||f)&&!B&&(L(t)||n&&Array.isArray(t))){const e=ce(d),s=ce(f),a=!i(e.value)&&t.length>e.value,n=!i(s.value)&&t.length<s.value;if((a||n)&&(N(a,e.message,s.message),!r))return C(j[p].message),j}if(g&&!B&&L(t)){const{value:e,message:s}=ce(g);if(se(e)&&!t.match(e)&&(j[p]={type:w,message:s,ref:o,...M(w,s)},!r))return C(s),j}if(h)if(q(h)){const e=le(await h(t),A);if(e&&(j[p]={...e,...M(D,e.message)},!r))return C(e.message),j}else if(u(h)){let e={};for(const s in h){if(!O(e)&&!r)break;const a=le(await h[s](t),A,s);a&&(e={...a,...M(s,a.message)},C(a.message),r&&(j[p]=e))}if(!O(e)&&(j[p]={ref:A,...e},!r))return j}return C(!0),j};function fe(e,t){return[...e,...U(t)]}var me="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function ye(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(me&&(e instanceof Blob||e instanceof FileList)||!r&&!u(e))return e;if(t=r?[]:{},Array.isArray(e)||(e=>{const t=e.constructor&&e.constructor.prototype;return u(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)t[r]=ye(e[r]);else t=e}return t}var ge=e=>Array.isArray(e)?e.map(()=>{}):void 0,he=e=>({isOnSubmit:!e||e===v,isOnBlur:e===p,isOnChange:e===_,isOnAll:e===A,isOnTouch:e===b});function pe(e,t,r){return[...e.slice(0,t),...U(r),...e.slice(t)]}var _e=(e,t,r)=>Array.isArray(e)?(f(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[];function ve(e,t){return[...U(t),...U(e)]}var be=(e,t)=>f(t)?[]:function(e,t){let r=0;const s=[...e];for(const e of t)s.splice(e-r,1),r++;return d(s).length?s:[]}(e,U(t).sort((e,t)=>e-t)),Ae=(e,t,r)=>{e[t]=[e[r],e[r]=e[t]][0]};function xe(e){for(const t in e)if(!f(e[t]))return!1;return!0}function Fe(e,t){const r=H(t)?[t]:z(t),s=1==r.length?e:function(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=f(e)?s++:e[t[s++]];return e}(e,r),a=r[r.length-1];let n;s&&delete s[a];for(let t=0;t<r.slice(0,-1).length;t++){let s,a=-1;const i=r.slice(0,-(t+1)),o=i.length-1;for(t>0&&(n=e);++a<i.length;){const t=i[a];s=s?s[t]:e[t],o===a&&(u(s)&&O(s)||Array.isArray(s)&&xe(s))&&(n?delete n[t]:delete e[t]),n=s}}return e}var Ve=(e,t,r)=>(e[t]=r,e);function Se(){let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}}var we=e=>i(e)||!o(e);function ke(e,t){if(we(e)||we(t))return e===t;if(n(e)&&n(t))return e.getTime()===t.getTime();const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(const a of r){const r=e[a];if(!s.includes(a))return!1;if("ref"!==a){const e=t[a];if(n(r)&&n(e)||u(r)&&u(e)||Array.isArray(r)&&Array.isArray(e)?!ke(r,e):r!==e)return!1}}return!0}var De=e=>{const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ce=e=>"select-multiple"===e.type,je=e=>De(e)&&e.isConnected;function Ee(e,t={}){const r=Array.isArray(e);if(u(e)||r)for(const r in e)Array.isArray(e[r])||u(e[r])&&!P(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Ee(e[r],t[r])):i(e[r])||(t[r]=!0);return t}var Oe=(e,t)=>function e(t,r,s){const a=Array.isArray(t);if(u(t)||a)for(const a in t)Array.isArray(t[a])||u(t[a])&&!P(t[a])?f(r)||we(s[a])?s[a]=Array.isArray(t[a])?Ee(t[a],[]):{...Ee(t[a])}:e(t[a],i(r)?{}:r[a],s[a]):ke(t[a],r[a])?delete s[a]:s[a]=!0;return s}(e,t,Ee(t)),Te=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>f(e)?e:t?""===e?NaN:e?+e:e:r&&L(e)?new Date(e):s?s(e):e;function Ue(e){const t=e.ref;if(!(e.refs?e.refs.every(e=>e.disabled):t.disabled))return ee(t)?t.files:re(t)?ue(e.refs).value:Ce(t)?[...t.selectedOptions].map(({value:e})=>e):a(t)?ie(e.refs).value:Te(f(t.value)?e.ref.value:t.value,e)}var Be=e=>f(e)?void 0:se(e)?e.source:u(e)?se(e.value)?e.value.source:e.value:e;function Me(e,t,r){const s=m(e,r);if(s||H(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),n=m(t,s),i=m(e,s);if(n&&!Array.isArray(n)&&r!==s)return{name:r};if(i&&i.type)return{name:s,error:i};a.pop()}return{name:r}}const Ne={mode:v,reValidateMode:_,shouldFocusError:!0};function Le(e={}){let t,r={...Ne,...e},s={submitCount:0,isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},o={},u=ye(r.defaultValues)||{},h=r.shouldUnregister?{}:ye(u),p={action:!1,mount:!1,watch:!1},_={mount:new Set,unMount:new Set,array:new Set,watch:new Set},v=0,b={};const x={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},F={watch:Se(),array:Se(),state:Se()},V=he(r.mode),S=he(r.reValidateMode),w=r.criteriaMode===A,k=async()=>{let e=!1;return x.isValid&&(e=r.resolver?O((await E()).errors):await T(o,!0),e!==s.isValid&&(s.isValid=e,F.state.next({isValid:e}))),e},D=(e,t,r,s)=>{const a=m(o,e);if(a){const n=m(h,e,f(r)?m(u,e):r);f(n)||s&&s.defaultChecked||t?G(h,e,t?n:Ue(a._f)):N(e,n),p.mount&&k()}},C=(e,t,r,a,n)=>{let i=!1;const o={name:e},l=m(s.touchedFields,e);if(x.isDirty){const e=s.isDirty;s.isDirty=o.isDirty=B(),i=e!==o.isDirty}if(x.dirtyFields&&(!r||a)){const r=m(s.dirtyFields,e);ke(m(u,e),t)?Fe(s.dirtyFields,e):G(s.dirtyFields,e,!0),o.dirtyFields=s.dirtyFields,i=i||r!==m(s.dirtyFields,e)}return r&&!l&&(G(s.touchedFields,e,r),o.touchedFields=s.touchedFields,i=i||x.touchedFields&&l!==r),i&&n&&F.state.next(o),i?o:{}},j=(r,a,n,i)=>{const o=m(s.errors,r),u=x.isValid&&Z(a)&&s.isValid!==a;var l;if(e.delayError&&n?(l=()=>((e,t)=>{G(s.errors,e,t),F.state.next({errors:s.errors})})(r,n),t=e=>{clearTimeout(v),v=window.setTimeout(l,e)},t(e.delayError)):(clearTimeout(v),t=null,n?G(s.errors,r,n):Fe(s.errors,r)),(n?!ke(o,n):o)||!O(i)||u){const e={...i,...u&&Z(a)?{isValid:a}:{},errors:s.errors,name:r};s={...s,...e},F.state.next(e)}b[r]--,x.isValidating&&!Object.values(b).some(e=>e)&&(F.state.next({isValidating:!1}),b={})},E=async e=>r.resolver?await r.resolver({...h},r.context,((e,t,r,s)=>{const a={};for(const r of e){const e=m(t,r);e&&G(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:s}})(e||_.mount,o,r.criteriaMode,r.shouldUseNativeValidation)):{},T=async(e,t,a={valid:!0})=>{for(const n in e){const i=e[n];if(i){const{_f:e,...n}=i;if(e){const n=_.array.has(e.name),o=await de(i,m(h,e.name),w,r.shouldUseNativeValidation,n);if(o[e.name]&&(a.valid=!1,t))break;!t&&(m(o,e.name)?n?Y(s.errors,o,e.name):G(s.errors,e.name,o[e.name]):Fe(s.errors,e.name))}n&&await T(n,t,a)}}return a.valid},B=(e,t)=>(e&&t&&G(h,e,t),!ke(H(),u)),M=(e,t,r)=>{const s={...p.mount?h:f(t)?u:L(e)?{[e]:t}:t};return R(e,_,s,r)},N=(e,t,r={})=>{const s=m(o,e);let n=t;if(s){const r=s._f;r&&(!r.disabled&&G(h,e,Te(t,r)),n=me&&De(r.ref)&&i(t)?"":t,Ce(r.ref)?[...r.ref.options].forEach(e=>e.selected=n.includes(e.value)):r.refs?a(r.ref)?r.refs.length>1?r.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(n)?!!n.find(t=>t===e.value):n===e.value)):r.refs[0]&&(r.refs[0].checked=!!n):r.refs.forEach(e=>e.checked=e.value===n):ee(r.ref)?r.ref.value="":(r.ref.value=n,r.ref.type||F.watch.next({name:e})))}(r.shouldDirty||r.shouldTouch)&&C(e,n,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&I(e)},P=(e,t,r)=>{for(const s in t){const a=t[s],i=`${e}.${s}`,u=m(o,i);!_.array.has(e)&&we(a)&&(!u||u._f)||n(a)?N(i,a,r):P(i,a,r)}},W=(e,t,r={})=>{const a=m(o,e),n=_.array.has(e),l=ye(t);G(h,e,l),n?(F.array.next({name:e,values:h}),(x.isDirty||x.dirtyFields)&&r.shouldDirty&&(s.dirtyFields=Oe(u,h),F.state.next({name:e,dirtyFields:s.dirtyFields,isDirty:B(e,l)}))):!a||a._f||i(l)?N(e,l,r):P(e,l,r),X(e,_)&&F.state.next({}),F.watch.next({name:e})},$=async e=>{const a=e.target;let n=a.name;const i=m(o,n);if(i){let c,d;const f=a.type?Ue(i._f):l(e),p=e.type===y||e.type===g,v=!((u=i._f).mount&&(u.required||u.min||u.max||u.maxLength||u.minLength||u.pattern||u.validate)||r.resolver||m(s.errors,n)||i._f.deps)||((e,t,r,s,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?s.isOnBlur:a.isOnBlur)?!e:!(r?s.isOnChange:a.isOnChange)||e))(p,m(s.touchedFields,n),s.isSubmitted,S,V),A=X(n,_,p);G(h,n,f),p?(i._f.onBlur&&i._f.onBlur(e),t&&t(0)):i._f.onChange&&i._f.onChange(e);const D=C(n,f,p,!1),T=!O(D)||A;if(!p&&F.watch.next({name:n,type:e.type}),v)return x.isValid&&k(),T&&F.state.next({name:n,...A?{}:D});if(!p&&A&&F.state.next({}),b[n]=b[n]?b[n]+1:1,F.state.next({isValidating:!0}),r.resolver){const{errors:e}=await E([n]),t=Me(s.errors,o,n),r=Me(e,o,t.name||n);c=r.error,n=r.name,d=O(e)}else c=(await de(i,m(h,n),w,r.shouldUseNativeValidation))[n],k();i._f.deps&&I(i._f.deps),j(n,d,c,D)}var u},I=async(e,t={})=>{let a,n;const i=U(e);if(F.state.next({isValidating:!0}),r.resolver){const t=await(async e=>{const{errors:t}=await E();if(e)for(const r of e){const e=m(t,r);e?G(s.errors,r,e):Fe(s.errors,r)}else s.errors=t;return t})(f(e)?e:i);a=O(t),n=e?!i.some(e=>m(t,e)):a}else e?(n=(await Promise.all(i.map(async e=>{const t=m(o,e);return await T(t&&t._f?{[e]:t}:t)}))).every(Boolean),(n||s.isValid)&&k()):n=a=await T(o);return F.state.next({...!L(e)||x.isValid&&a!==s.isValid?{}:{name:e},...r.resolver||!e?{isValid:a}:{},errors:s.errors,isValidating:!1}),t.shouldFocus&&!n&&J(o,e=>e&&m(s.errors,e),e?i:_.mount),n},H=e=>{const t={...u,...p.mount?h:{}};return f(e)?t:L(e)?m(t,e):e.map(e=>m(t,e))},z=(e,t)=>({invalid:!!m((t||s).errors,e),isDirty:!!m((t||s).dirtyFields,e),isTouched:!!m((t||s).touchedFields,e),error:m((t||s).errors,e)}),K=(e,t={})=>{for(const a of e?U(e):_.mount)_.mount.delete(a),_.array.delete(a),m(o,a)&&(t.keepValue||(Fe(o,a),Fe(h,a)),!t.keepError&&Fe(s.errors,a),!t.keepDirty&&Fe(s.dirtyFields,a),!t.keepTouched&&Fe(s.touchedFields,a),!r.shouldUnregister&&!t.keepDefaultValue&&Fe(u,a));F.watch.next({}),F.state.next({...s,...t.keepDirty?{isDirty:B()}:{}}),!t.keepIsValid&&k()},Q=(e,t={})=>{let s=m(o,e);const n=Z(t.disabled);return G(o,e,{...s||{},_f:{...s&&s._f?s._f:{ref:{name:e}},name:e,mount:!0,...t}}),_.mount.add(e),s?n&&G(h,e,t.disabled?void 0:m(h,e,Ue(s._f))):D(e,!0,t.value),{...n?{disabled:t.disabled}:{},...r.shouldUseNativeValidation?{required:!!t.required,min:Be(t.min),max:Be(t.max),minLength:Be(t.minLength),maxLength:Be(t.maxLength),pattern:Be(t.pattern)}:{},name:e,onChange:$,onBlur:$,ref:n=>{if(n){Q(e,t),s=m(o,e);const r=f(n.value)&&n.querySelectorAll&&n.querySelectorAll("input,select,textarea")[0]||n,i=(e=>re(e)||a(e))(r),l=s._f.refs||[];if(i?l.find(e=>e===r):r===s._f.ref)return;G(o,e,{_f:{...s._f,...i?{refs:[...l.filter(je),r,...Array.isArray(m(u,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),D(e,!1,void 0,r)}else s=m(o,e,{}),s._f&&(s._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!c(_.array,e)||!p.action)&&_.unMount.add(e)}}},te=()=>r.shouldFocusError&&J(o,e=>e&&m(s.errors,e),_.mount);return{control:{register:Q,unregister:K,getFieldState:z,_executeSchema:E,_focusError:te,_getWatch:M,_getDirty:B,_updateValid:k,_removeUnmounted:()=>{for(const e of _.unMount){const t=m(o,e);t&&(t._f.refs?t._f.refs.every(e=>!je(e)):!je(t._f.ref))&&K(e)}_.unMount=new Set},_updateFieldArray:(e,t=[],r,a,n=!0,i=!0)=>{if(a&&r){if(p.action=!0,i&&Array.isArray(m(o,e))){const t=r(m(o,e),a.argA,a.argB);n&&G(o,e,t)}if(x.errors&&i&&Array.isArray(m(s.errors,e))){const t=r(m(s.errors,e),a.argA,a.argB);n&&G(s.errors,e,t),((e,t)=>{!d(m(e,t)).length&&Fe(e,t)})(s.errors,e)}if(x.touchedFields&&i&&Array.isArray(m(s.touchedFields,e))){const t=r(m(s.touchedFields,e),a.argA,a.argB);n&&G(s.touchedFields,e,t)}x.dirtyFields&&(s.dirtyFields=Oe(u,h)),F.state.next({isDirty:B(e,t),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else G(h,e,t)},_getFieldArray:t=>d(m(p.mount?h:u,t,e.shouldUnregister?m(u,t,[]):[])),_subjects:F,_proxyFormState:x,get _fields(){return o},get _formValues(){return h},get _stateFlags(){return p},set _stateFlags(e){p=e},get _defaultValues(){return u},get _names(){return _},set _names(e){_=e},get _formState(){return s},set _formState(e){s=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:I,register:Q,handleSubmit:(e,t)=>async a=>{a&&(a.preventDefault&&a.preventDefault(),a.persist&&a.persist());let n=!0,i=ye(h);F.state.next({isSubmitting:!0});try{if(r.resolver){const{errors:e,values:t}=await E();s.errors=e,i=t}else await T(o);O(s.errors)?(F.state.next({errors:{},isSubmitting:!0}),await e(i,a)):(t&&await t({...s.errors},a),te())}catch(e){throw n=!1,e}finally{s.isSubmitted=!0,F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:O(s.errors)&&n,submitCount:s.submitCount+1,errors:s.errors})}},watch:(e,t)=>q(e)?F.watch.subscribe({next:r=>e(M(void 0,t),r)}):M(e,t,!0),setValue:W,getValues:H,reset:(t,r)=>((t,r={})=>{const a=t||u,n=ye(a),i=t&&!O(t)?n:u;if(r.keepDefaultValues||(u=a),!r.keepValues){if(r.keepDirtyValues)for(const e of _.mount)m(s.dirtyFields,e)?G(i,e,m(h,e)):W(e,m(i,e));else{if(me&&f(t))for(const e of _.mount){const t=m(o,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(De(e)){const t=e.closest("form");if(t){t.reset();break}}}}o={}}h=e.shouldUnregister?r.keepDefaultValues?ye(u):{}:n,F.array.next({values:i}),F.watch.next({values:i})}_={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},p.mount=!x.isValid||!!r.keepIsValid,p.watch=!!e.shouldUnregister,F.state.next({submitCount:r.keepSubmitCount?s.submitCount:0,isDirty:r.keepDirty||r.keepDirtyValues?s.isDirty:!(!r.keepDefaultValues||ke(t,u)),isSubmitted:!!r.keepIsSubmitted&&s.isSubmitted,dirtyFields:r.keepDirty||r.keepDirtyValues?s.dirtyFields:r.keepDefaultValues&&t?Oe(u,t):{},touchedFields:r.keepTouched?s.touchedFields:{},errors:r.keepErrors?s.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})})(q(t)?t(h):t,r),resetField:(e,t={})=>{m(o,e)&&(f(t.defaultValue)?W(e,m(u,e)):(W(e,t.defaultValue),G(u,e,t.defaultValue)),t.keepTouched||Fe(s.touchedFields,e),t.keepDirty||(Fe(s.dirtyFields,e),s.isDirty=t.defaultValue?B(e,m(u,e)):B()),t.keepError||(Fe(s.errors,e),x.isValid&&k()),F.state.next({...s}))},clearErrors:e=>{e?U(e).forEach(e=>Fe(s.errors,e)):s.errors={},F.state.next({errors:s.errors})},unregister:K,setError:(e,t,r)=>{const a=(m(o,e,{_f:{}})._f||{}).ref;G(s.errors,e,{...t,ref:a}),F.state.next({name:e,errors:s.errors,isValid:!1}),r&&r.shouldFocus&&a&&a.focus&&a.focus()},setFocus:(e,t={})=>{const r=m(o,e),s=r&&r._f;if(s){const e=s.refs?s.refs[0]:s.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:z}}e.Controller=e=>e.render($(e)),e.FormProvider=e=>{const{children:t,...r}=e;return s.default.createElement(C.Provider,{value:r},t)},e.appendErrors=I,e.get=m,e.set=G,e.useController=$,e.useFieldArray=function(e){const t=j(),{control:r=t.control,name:a,keyName:n="id",shouldUnregister:i}=e,[o,u]=s.default.useState(r._getFieldArray(a)),l=s.default.useRef(r._getFieldArray(a).map(K)),c=s.default.useRef(o),d=s.default.useRef(a),f=s.default.useRef(!1);d.current=a,c.current=o,r._names.array.add(a),e.rules&&r.register(a,e.rules),M({callback:s.default.useCallback(({values:e,name:t})=>{if(t===d.current||!t){const t=m(e,d.current);Array.isArray(t)&&(u(t),l.current=t.map(K))}},[]),subject:r._subjects.array});const y=s.default.useCallback(e=>{f.current=!0,r._updateFieldArray(a,e)},[r,a]);return s.default.useEffect(()=>{if(r._stateFlags.action=!1,X(a,r._names)&&r._subjects.state.next({}),f.current&&(!he(r._options.mode).isOnSubmit||r._formState.isSubmitted))if(r._options.resolver)r._executeSchema([a]).then(e=>{const t=m(e.errors,a),s=m(r._formState.errors,a);(s?!t&&s.type:t&&t.type)&&(t?G(r._formState.errors,a,t):Fe(r._formState.errors,a),r._subjects.state.next({errors:r._formState.errors}))});else{const e=m(r._fields,a);e&&e._f&&de(e,m(r._formValues,a),r._options.criteriaMode===A,r._options.shouldUseNativeValidation,!0).then(e=>!O(e)&&r._subjects.state.next({errors:Y(r._formState.errors,e,a)}))}r._subjects.watch.next({name:a,values:r._formValues}),r._names.focus&&J(r._fields,e=>!!e&&e.startsWith(r._names.focus)),r._names.focus="",r._proxyFormState.isValid&&r._updateValid()},[o,a,r]),s.default.useEffect(()=>(!m(r._formValues,a)&&r._updateFieldArray(a),()=>{(r._options.shouldUnregister||i)&&r.unregister(a)}),[a,r,n,i]),{swap:s.default.useCallback((e,t)=>{const s=r._getFieldArray(a);Ae(s,e,t),Ae(l.current,e,t),y(s),u(s),r._updateFieldArray(a,s,Ae,{argA:e,argB:t},!1)},[y,a,r]),move:s.default.useCallback((e,t)=>{const s=r._getFieldArray(a);_e(s,e,t),_e(l.current,e,t),y(s),u(s),r._updateFieldArray(a,s,_e,{argA:e,argB:t},!1)},[y,a,r]),prepend:s.default.useCallback((e,t)=>{const s=U(ye(e)),n=ve(r._getFieldArray(a),s);r._names.focus=Q(a,0,t),l.current=ve(l.current,s.map(K)),y(n),u(n),r._updateFieldArray(a,n,ve,{argA:ge(e)})},[y,a,r]),append:s.default.useCallback((e,t)=>{const s=U(ye(e)),n=fe(r._getFieldArray(a),s);r._names.focus=Q(a,n.length-1,t),l.current=fe(l.current,s.map(K)),y(n),u(n),r._updateFieldArray(a,n,fe,{argA:ge(e)})},[y,a,r]),remove:s.default.useCallback(e=>{const t=be(r._getFieldArray(a),e);l.current=be(l.current,e),y(t),u(t),r._updateFieldArray(a,t,be,{argA:e})},[y,a,r]),insert:s.default.useCallback((e,t,s)=>{const n=U(ye(t)),i=pe(r._getFieldArray(a),e,n);r._names.focus=Q(a,e,s),l.current=pe(l.current,e,n.map(K)),y(i),u(i),r._updateFieldArray(a,i,pe,{argA:e,argB:ge(t)})},[y,a,r]),update:s.default.useCallback((e,t)=>{const s=ye(t),n=Ve(r._getFieldArray(a),e,s);l.current=[...n].map((t,r)=>t&&r!==e?l.current[r]:K()),y(n),u([...n]),r._updateFieldArray(a,n,Ve,{argA:e,argB:s},!0,!1)},[y,a,r]),replace:s.default.useCallback(e=>{const t=U(ye(e));l.current=t.map(K),y([...t]),u([...t]),r._updateFieldArray(a,[...t],e=>e,{},!0,!1)},[y,a,r]),fields:s.default.useMemo(()=>o.map((e,t)=>({...e,[n]:l.current[t]||K()})),[o,n])}},e.useForm=function(e={}){const t=s.default.useRef(),[r,a]=s.default.useState({isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:e.defaultValues});t.current||(t.current={...Le(e),formState:r});const n=t.current.control;return n._options=e,M({subject:n._subjects.state,callback:s.default.useCallback(e=>{T(e,n._proxyFormState,!0)&&(n._formState={...n._formState,...e},a({...n._formState}))},[n])}),s.default.useEffect(()=>{n._stateFlags.mount||(n._proxyFormState.isValid&&n._updateValid(),n._stateFlags.mount=!0),n._stateFlags.watch&&(n._stateFlags.watch=!1,n._subjects.state.next({})),n._removeUnmounted()}),s.default.useEffect(()=>{r.submitCount&&n._focusError()},[n,r.submitCount]),t.current.formState=E(r,n),t.current},e.useFormContext=j,e.useFormState=N,e.useWatch=W,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactHookForm={},e.React)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(t),a=e=>"checkbox"===e.type,n=e=>e instanceof Date,i=e=>null==e;const o=e=>"object"==typeof e;var u=e=>!i(e)&&!Array.isArray(e)&&o(e)&&!n(e),l=e=>u(e)&&e.target?a(e.target)?e.target.checked:e.target.value:e,c=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),d=e=>Array.isArray(e)?e.filter(Boolean):[],f=e=>void 0===e,m=(e,t,r)=>{if(!t||!u(e))return r;const s=d(t.split(/[,[\].]+?/)).reduce(((e,t)=>i(e)?e:e[t]),e);return f(s)||s===e?f(e[t])?r:e[t]:s};const y="blur",g="focusout",h="change",p="onBlur",_="onChange",v="onSubmit",b="onTouched",A="all",x="max",F="min",V="maxLength",S="minLength",w="pattern",k="required",D="validate",C=s.default.createContext(null),j=()=>s.default.useContext(C);var E=(e,t,r,s=!0)=>{const a={defaultValues:t._defaultValues};for(const n in e)Object.defineProperty(a,n,{get:()=>{const a=n;return t._proxyFormState[a]!==A&&(t._proxyFormState[a]=!s||A),r&&(r[a]=!0),e[a]}});return a},O=e=>u(e)&&!Object.keys(e).length,T=(e,t,r)=>{const{name:s,...a}=e;return O(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===(!r||A)))},U=e=>Array.isArray(e)?e:[e],B=(e,t,r)=>r&&t?e===t:!e||!t||e===t||U(e).some((e=>e&&(e.startsWith(t)||t.startsWith(e))));function M(e){const t=s.default.useRef(e);t.current=e,s.default.useEffect((()=>{const r=!e.disabled&&t.current.subject.subscribe({next:t.current.callback});return()=>{r&&r.unsubscribe()}}),[e.disabled])}function N(e){const t=j(),{control:r=t.control,disabled:a,name:n,exact:i}=e||{},[o,u]=s.default.useState(r._formState),l=s.default.useRef(!0),c=s.default.useRef({isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=s.default.useRef(n);return d.current=n,M({disabled:a,callback:s.default.useCallback((e=>l.current&&B(d.current,e.name,i)&&T(e,c.current)&&u({...r._formState,...e})),[r,i]),subject:r._subjects.state}),s.default.useEffect((()=>(l.current=!0,()=>{l.current=!1})),[]),E(o,r,c.current,!1)}var L=e=>"string"==typeof e,R=(e,t,r,s)=>{const a=Array.isArray(e);return L(e)?(s&&t.watch.add(e),m(r,e)):a?e.map((e=>(s&&t.watch.add(e),m(r,e)))):(s&&(t.watchAll=!0),r)},q=e=>"function"==typeof e,P=e=>{for(const t in e)if(q(e[t]))return!0;return!1};function W(e){const t=j(),{control:r=t.control,name:a,defaultValue:n,disabled:i,exact:o}=e||{},l=s.default.useRef(a);l.current=a,M({disabled:i,subject:r._subjects.watch,callback:s.default.useCallback((e=>{if(B(l.current,e.name,o)){const t=R(l.current,r._names,e.values||r._formValues);d(f(l.current)||u(t)&&!P(t)?{...t}:Array.isArray(t)?[...t]:f(t)?n:t)}}),[r,o,n])});const[c,d]=s.default.useState(f(n)?r._getWatch(a):n);return s.default.useEffect((()=>r._removeUnmounted())),c}function $(e){const t=j(),{name:r,control:a=t.control,shouldUnregister:n}=e,i=c(a._names.array,r),o=W({control:a,name:r,defaultValue:m(a._formValues,r,m(a._defaultValues,r,e.defaultValue)),exact:!0}),u=N({control:a,name:r}),d=s.default.useRef(a.register(r,{...e.rules,value:o})),f=m(a._fields,r);return f&&(f._f._c=!0),s.default.useEffect((()=>{const e=(e,t)=>{const r=m(a._fields,e);r&&(r._f.mount=t)};return e(r,!0),()=>{const t=a._options.shouldUnregister||n;(i?t&&!a._stateFlags.action:t)?a.unregister(r):e(r,!1)}}),[r,a,i,n]),{field:{name:r,value:o,onChange:s.default.useCallback((e=>d.current.onChange({target:{value:l(e),name:r},type:h})),[r]),onBlur:s.default.useCallback((()=>d.current.onBlur({target:{value:m(a._formValues,r),name:r},type:y})),[r,a]),ref:e=>{f&&e&&(f._f.ref=e)}},formState:u,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!m(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!m(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!m(u.touchedFields,r)},error:{enumerable:!0,get:()=>m(u.errors,r)}})}}var I=(e,t,r,s,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:a||!0}}:{},H=e=>/^\w*$/.test(e),z=e=>d(e.replace(/["|']|\]/g,"").split(/\.|\[/));function G(e,t,r){let s=-1;const a=H(t)?[t]:z(t),n=a.length,i=n-1;for(;++s<n;){const t=a[s];let n=r;if(s!==i){const r=e[t];n=u(r)||Array.isArray(r)?r:isNaN(+a[s+1])?{}:[]}e[t]=n,e=e[t]}return e}const J=(e,t,r)=>{for(const s of r||Object.keys(e)){const r=m(e,s);if(r){const{_f:e,...s}=r;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else u(s)&&J(s,t)}}};var K=()=>{const e="undefined"==typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const r=(16*Math.random()+e)%16|0;return("x"==t?r:3&r|8).toString(16)}))},Q=(e,t,r={})=>r.shouldFocus||f(r.shouldFocus)?r.focusName||`${e}.${f(r.focusIndex)?t:r.focusIndex}.`:"",X=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))))),Y=(e,t,r)=>{const s=d(m(e,r));return G(s,"root",t[r]),G(e,r,s),e},Z=e=>"boolean"==typeof e,ee=e=>"file"===e.type,te=e=>L(e)||s.default.isValidElement(e),re=e=>"radio"===e.type,se=e=>e instanceof RegExp;const ae={value:!1,isValid:!1},ne={value:!0,isValid:!0};var ie=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!f(e[0].attributes.value)?f(e[0].value)||""===e[0].value?ne:{value:e[0].value,isValid:!0}:ne:ae}return ae};const oe={isValid:!1,value:null};var ue=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),oe):oe;function le(e,t,r="validate"){if(te(e)||Array.isArray(e)&&e.every(te)||Z(e)&&!e)return{type:r,message:te(e)?e:"",ref:t}}var ce=e=>u(e)&&!se(e)?e:{value:e,message:""},de=async(e,t,r,s,n)=>{const{ref:o,refs:l,required:c,maxLength:d,minLength:f,min:m,max:y,pattern:g,validate:h,name:p,valueAsNumber:_,mount:v,disabled:b}=e._f;if(!v||b)return{};const A=l?l[0]:o,C=e=>{s&&L(e)&&(A.setCustomValidity(e),A.reportValidity())},j={},E=re(o),T=a(o),U=E||T,B=(_||ee(o))&&!o.value||""===t||Array.isArray(t)&&!t.length,M=I.bind(null,p,r,j),N=(e,t,r,s=V,a=S)=>{const n=e?t:r;j[p]={type:e?s:a,message:n,ref:o,...M(e?s:a,n)}};if(n?!Array.isArray(t)||!t.length:c&&(!U&&(B||i(t))||Z(t)&&!t||T&&!ie(l).isValid||E&&!ue(l).isValid)){const{value:e,message:t}=te(c)?{value:!!c,message:c}:ce(c);if(e&&(j[p]={type:k,message:t,ref:A,...M(k,t)},!r))return C(t),j}if(!(B||i(m)&&i(y))){let e,s;const a=ce(y),n=ce(m);if(i(t)||isNaN(t)){const r=o.valueAsDate||new Date(t),i=e=>new Date((new Date).toDateString()+" "+e),u="time"==o.type,l="week"==o.type;L(a.value)&&t&&(e=u?i(t)>i(a.value):l?t>a.value:r>new Date(a.value)),L(n.value)&&t&&(s=u?i(t)<i(n.value):l?t<n.value:r<new Date(n.value))}else{const r=o.valueAsNumber||(t?+t:t);i(a.value)||(e=r>a.value),i(n.value)||(s=r<n.value)}if((e||s)&&(N(!!e,a.message,n.message,x,F),!r))return C(j[p].message),j}if((d||f)&&!B&&(L(t)||n&&Array.isArray(t))){const e=ce(d),s=ce(f),a=!i(e.value)&&t.length>e.value,n=!i(s.value)&&t.length<s.value;if((a||n)&&(N(a,e.message,s.message),!r))return C(j[p].message),j}if(g&&!B&&L(t)){const{value:e,message:s}=ce(g);if(se(e)&&!t.match(e)&&(j[p]={type:w,message:s,ref:o,...M(w,s)},!r))return C(s),j}if(h)if(q(h)){const e=le(await h(t),A);if(e&&(j[p]={...e,...M(D,e.message)},!r))return C(e.message),j}else if(u(h)){let e={};for(const s in h){if(!O(e)&&!r)break;const a=le(await h[s](t),A,s);a&&(e={...a,...M(s,a.message)},C(a.message),r&&(j[p]=e))}if(!O(e)&&(j[p]={ref:A,...e},!r))return j}return C(!0),j};function fe(e,t){return[...e,...U(t)]}var me="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function ye(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(me&&(e instanceof Blob||e instanceof FileList)||!r&&!u(e))return e;if(t=r?[]:{},Array.isArray(e)||(e=>{const t=e.constructor&&e.constructor.prototype;return u(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)t[r]=ye(e[r]);else t=e}return t}var ge=e=>Array.isArray(e)?e.map((()=>{})):void 0,he=e=>({isOnSubmit:!e||e===v,isOnBlur:e===p,isOnChange:e===_,isOnAll:e===A,isOnTouch:e===b});function pe(e,t,r){return[...e.slice(0,t),...U(r),...e.slice(t)]}var _e=(e,t,r)=>Array.isArray(e)?(f(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[];function ve(e,t){return[...U(t),...U(e)]}var be=(e,t)=>f(t)?[]:function(e,t){let r=0;const s=[...e];for(const e of t)s.splice(e-r,1),r++;return d(s).length?s:[]}(e,U(t).sort(((e,t)=>e-t))),Ae=(e,t,r)=>{e[t]=[e[r],e[r]=e[t]][0]};function xe(e){for(const t in e)if(!f(e[t]))return!1;return!0}function Fe(e,t){const r=H(t)?[t]:z(t),s=1==r.length?e:function(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=f(e)?s++:e[t[s++]];return e}(e,r),a=r[r.length-1];let n;s&&delete s[a];for(let t=0;t<r.slice(0,-1).length;t++){let s,a=-1;const i=r.slice(0,-(t+1)),o=i.length-1;for(t>0&&(n=e);++a<i.length;){const t=i[a];s=s?s[t]:e[t],o===a&&(u(s)&&O(s)||Array.isArray(s)&&xe(s))&&(n?delete n[t]:delete e[t]),n=s}}return e}var Ve=(e,t,r)=>(e[t]=r,e);function Se(){let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}}var we=e=>i(e)||!o(e);function ke(e,t){if(we(e)||we(t))return e===t;if(n(e)&&n(t))return e.getTime()===t.getTime();const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(const a of r){const r=e[a];if(!s.includes(a))return!1;if("ref"!==a){const e=t[a];if(n(r)&&n(e)||u(r)&&u(e)||Array.isArray(r)&&Array.isArray(e)?!ke(r,e):r!==e)return!1}}return!0}var De=e=>{const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ce=e=>"select-multiple"===e.type,je=e=>De(e)&&e.isConnected;function Ee(e,t={}){const r=Array.isArray(e);if(u(e)||r)for(const r in e)Array.isArray(e[r])||u(e[r])&&!P(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Ee(e[r],t[r])):i(e[r])||(t[r]=!0);return t}function Oe(e,t,r){const s=Array.isArray(e);if(u(e)||s)for(const s in e)Array.isArray(e[s])||u(e[s])&&!P(e[s])?f(t)||we(r[s])?r[s]=Array.isArray(e[s])?Ee(e[s],[]):{...Ee(e[s])}:Oe(e[s],i(t)?{}:t[s],r[s]):ke(e[s],t[s])?delete r[s]:r[s]=!0;return r}var Te=(e,t)=>Oe(e,t,Ee(t)),Ue=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>f(e)?e:t?""===e?NaN:e?+e:e:r&&L(e)?new Date(e):s?s(e):e;function Be(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return ee(t)?t.files:re(t)?ue(e.refs).value:Ce(t)?[...t.selectedOptions].map((({value:e})=>e)):a(t)?ie(e.refs).value:Ue(f(t.value)?e.ref.value:t.value,e)}var Me=e=>f(e)?void 0:se(e)?e.source:u(e)?se(e.value)?e.value.source:e.value:e;function Ne(e,t,r){const s=m(e,r);if(s||H(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),n=m(t,s),i=m(e,s);if(n&&!Array.isArray(n)&&r!==s)return{name:r};if(i&&i.type)return{name:s,error:i};a.pop()}return{name:r}}const Le={mode:v,reValidateMode:_,shouldFocusError:!0};function Re(e={}){let t,r={...Le,...e},s={submitCount:0,isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},o={},u=ye(r.defaultValues)||{},h=r.shouldUnregister?{}:ye(u),p={action:!1,mount:!1,watch:!1},_={mount:new Set,unMount:new Set,array:new Set,watch:new Set},v=0,b={};const x={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},F={watch:Se(),array:Se(),state:Se()},V=he(r.mode),S=he(r.reValidateMode),w=r.criteriaMode===A,k=async()=>{let e=!1;return x.isValid&&(e=r.resolver?O((await E()).errors):await T(o,!0),e!==s.isValid&&(s.isValid=e,F.state.next({isValid:e}))),e},D=(e,t,r,s)=>{const a=m(o,e);if(a){const n=m(h,e,f(r)?m(u,e):r);f(n)||s&&s.defaultChecked||t?G(h,e,t?n:Be(a._f)):N(e,n),p.mount&&k()}},C=(e,t,r,a,n)=>{let i=!1;const o={name:e},l=m(s.touchedFields,e);if(x.isDirty){const e=s.isDirty;s.isDirty=o.isDirty=B(),i=e!==o.isDirty}if(x.dirtyFields&&(!r||a)){const r=m(s.dirtyFields,e);ke(m(u,e),t)?Fe(s.dirtyFields,e):G(s.dirtyFields,e,!0),o.dirtyFields=s.dirtyFields,i=i||r!==m(s.dirtyFields,e)}return r&&!l&&(G(s.touchedFields,e,r),o.touchedFields=s.touchedFields,i=i||x.touchedFields&&l!==r),i&&n&&F.state.next(o),i?o:{}},j=(r,a,n,i)=>{const o=m(s.errors,r),u=x.isValid&&Z(a)&&s.isValid!==a;var l;if(e.delayError&&n?(l=()=>((e,t)=>{G(s.errors,e,t),F.state.next({errors:s.errors})})(r,n),t=e=>{clearTimeout(v),v=window.setTimeout(l,e)},t(e.delayError)):(clearTimeout(v),t=null,n?G(s.errors,r,n):Fe(s.errors,r)),(n?!ke(o,n):o)||!O(i)||u){const e={...i,...u&&Z(a)?{isValid:a}:{},errors:s.errors,name:r};s={...s,...e},F.state.next(e)}b[r]--,x.isValidating&&!Object.values(b).some((e=>e))&&(F.state.next({isValidating:!1}),b={})},E=async e=>r.resolver?await r.resolver({...h},r.context,((e,t,r,s)=>{const a={};for(const r of e){const e=m(t,r);e&&G(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:s}})(e||_.mount,o,r.criteriaMode,r.shouldUseNativeValidation)):{},T=async(e,t,a={valid:!0})=>{for(const n in e){const i=e[n];if(i){const{_f:e,...n}=i;if(e){const n=_.array.has(e.name),o=await de(i,m(h,e.name),w,r.shouldUseNativeValidation,n);if(o[e.name]&&(a.valid=!1,t))break;!t&&(m(o,e.name)?n?Y(s.errors,o,e.name):G(s.errors,e.name,o[e.name]):Fe(s.errors,e.name))}n&&await T(n,t,a)}}return a.valid},B=(e,t)=>(e&&t&&G(h,e,t),!ke(H(),u)),M=(e,t,r)=>{const s={...p.mount?h:f(t)?u:L(e)?{[e]:t}:t};return R(e,_,s,r)},N=(e,t,r={})=>{const s=m(o,e);let n=t;if(s){const r=s._f;r&&(!r.disabled&&G(h,e,Ue(t,r)),n=me&&De(r.ref)&&i(t)?"":t,Ce(r.ref)?[...r.ref.options].forEach((e=>e.selected=n.includes(e.value))):r.refs?a(r.ref)?r.refs.length>1?r.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(n)?!!n.find((t=>t===e.value)):n===e.value))):r.refs[0]&&(r.refs[0].checked=!!n):r.refs.forEach((e=>e.checked=e.value===n)):ee(r.ref)?r.ref.value="":(r.ref.value=n,r._c&&F.watch.next({name:e})))}(r.shouldDirty||r.shouldTouch)&&C(e,n,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&I(e)},P=(e,t,r)=>{for(const s in t){const a=t[s],i=`${e}.${s}`,u=m(o,i);!_.array.has(e)&&we(a)&&(!u||u._f)||n(a)?N(i,a,r):P(i,a,r)}},W=(e,t,r={})=>{const a=m(o,e),n=_.array.has(e),l=ye(t);G(h,e,l),n?(F.array.next({name:e,values:h}),(x.isDirty||x.dirtyFields)&&r.shouldDirty&&(s.dirtyFields=Te(u,h),F.state.next({name:e,dirtyFields:s.dirtyFields,isDirty:B(e,l)}))):!a||a._f||i(l)?N(e,l,r):P(e,l,r),X(e,_)&&F.state.next({}),F.watch.next({name:e})},$=async e=>{const a=e.target;let n=a.name;const i=m(o,n);if(i){let c,d;const f=a.type?Be(i._f):l(e),p=e.type===y||e.type===g,v=!((u=i._f).mount&&(u.required||u.min||u.max||u.maxLength||u.minLength||u.pattern||u.validate)||r.resolver||m(s.errors,n)||i._f.deps)||((e,t,r,s,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?s.isOnBlur:a.isOnBlur)?!e:!(r?s.isOnChange:a.isOnChange)||e))(p,m(s.touchedFields,n),s.isSubmitted,S,V),A=X(n,_,p);G(h,n,f),p?(i._f.onBlur&&i._f.onBlur(e),t&&t(0)):i._f.onChange&&i._f.onChange(e);const D=C(n,f,p,!1),T=!O(D)||A;if(!p&&F.watch.next({name:n,type:e.type}),v)return x.isValid&&k(),T&&F.state.next({name:n,...A?{}:D});if(!p&&A&&F.state.next({}),b[n]=b[n]?b[n]+1:1,F.state.next({isValidating:!0}),r.resolver){const{errors:e}=await E([n]),t=Ne(s.errors,o,n),r=Ne(e,o,t.name||n);c=r.error,n=r.name,d=O(e)}else c=(await de(i,m(h,n),w,r.shouldUseNativeValidation))[n],k();i._f.deps&&I(i._f.deps),j(n,d,c,D)}var u},I=async(e,t={})=>{let a,n;const i=U(e);if(F.state.next({isValidating:!0}),r.resolver){const t=await(async e=>{const{errors:t}=await E();if(e)for(const r of e){const e=m(t,r);e?G(s.errors,r,e):Fe(s.errors,r)}else s.errors=t;return t})(f(e)?e:i);a=O(t),n=e?!i.some((e=>m(t,e))):a}else e?(n=(await Promise.all(i.map((async e=>{const t=m(o,e);return await T(t&&t._f?{[e]:t}:t)})))).every(Boolean),(n||s.isValid)&&k()):n=a=await T(o);return F.state.next({...!L(e)||x.isValid&&a!==s.isValid?{}:{name:e},...r.resolver||!e?{isValid:a}:{},errors:s.errors,isValidating:!1}),t.shouldFocus&&!n&&J(o,(e=>e&&m(s.errors,e)),e?i:_.mount),n},H=e=>{const t={...u,...p.mount?h:{}};return f(e)?t:L(e)?m(t,e):e.map((e=>m(t,e)))},z=(e,t)=>({invalid:!!m((t||s).errors,e),isDirty:!!m((t||s).dirtyFields,e),isTouched:!!m((t||s).touchedFields,e),error:m((t||s).errors,e)}),K=(e,t={})=>{for(const a of e?U(e):_.mount)_.mount.delete(a),_.array.delete(a),m(o,a)&&(t.keepValue||(Fe(o,a),Fe(h,a)),!t.keepError&&Fe(s.errors,a),!t.keepDirty&&Fe(s.dirtyFields,a),!t.keepTouched&&Fe(s.touchedFields,a),!r.shouldUnregister&&!t.keepDefaultValue&&Fe(u,a));F.watch.next({}),F.state.next({...s,...t.keepDirty?{isDirty:B()}:{}}),!t.keepIsValid&&k()},Q=(e,t={})=>{let s=m(o,e);const n=Z(t.disabled);return G(o,e,{...s||{},_f:{...s&&s._f?s._f:{ref:{name:e}},name:e,mount:!0,...t}}),_.mount.add(e),s?n&&G(h,e,t.disabled?void 0:m(h,e,Be(s._f))):D(e,!0,t.value),{...n?{disabled:t.disabled}:{},...r.shouldUseNativeValidation?{required:!!t.required,min:Me(t.min),max:Me(t.max),minLength:Me(t.minLength),maxLength:Me(t.maxLength),pattern:Me(t.pattern)}:{},name:e,onChange:$,onBlur:$,ref:n=>{if(n){Q(e,t),s=m(o,e);const r=f(n.value)&&n.querySelectorAll&&n.querySelectorAll("input,select,textarea")[0]||n,i=(e=>re(e)||a(e))(r),l=s._f.refs||[];if(i?l.find((e=>e===r)):r===s._f.ref)return;G(o,e,{_f:{...s._f,...i?{refs:[...l.filter(je),r,...Array.isArray(m(u,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),D(e,!1,void 0,r)}else s=m(o,e,{}),s._f&&(s._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!c(_.array,e)||!p.action)&&_.unMount.add(e)}}},te=()=>r.shouldFocusError&&J(o,(e=>e&&m(s.errors,e)),_.mount);return{control:{register:Q,unregister:K,getFieldState:z,_executeSchema:E,_focusError:te,_getWatch:M,_getDirty:B,_updateValid:k,_removeUnmounted:()=>{for(const e of _.unMount){const t=m(o,e);t&&(t._f.refs?t._f.refs.every((e=>!je(e))):!je(t._f.ref))&&K(e)}_.unMount=new Set},_updateFieldArray:(e,t=[],r,a,n=!0,i=!0)=>{if(a&&r){if(p.action=!0,i&&Array.isArray(m(o,e))){const t=r(m(o,e),a.argA,a.argB);n&&G(o,e,t)}if(x.errors&&i&&Array.isArray(m(s.errors,e))){const t=r(m(s.errors,e),a.argA,a.argB);n&&G(s.errors,e,t),((e,t)=>{!d(m(e,t)).length&&Fe(e,t)})(s.errors,e)}if(x.touchedFields&&i&&Array.isArray(m(s.touchedFields,e))){const t=r(m(s.touchedFields,e),a.argA,a.argB);n&&G(s.touchedFields,e,t)}x.dirtyFields&&(s.dirtyFields=Te(u,h)),F.state.next({isDirty:B(e,t),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else G(h,e,t)},_getFieldArray:t=>d(m(p.mount?h:u,t,e.shouldUnregister?m(u,t,[]):[])),_subjects:F,_proxyFormState:x,get _fields(){return o},get _formValues(){return h},get _stateFlags(){return p},set _stateFlags(e){p=e},get _defaultValues(){return u},get _names(){return _},set _names(e){_=e},get _formState(){return s},set _formState(e){s=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:I,register:Q,handleSubmit:(e,t)=>async a=>{a&&(a.preventDefault&&a.preventDefault(),a.persist&&a.persist());let n=!0,i=ye(h);F.state.next({isSubmitting:!0});try{if(r.resolver){const{errors:e,values:t}=await E();s.errors=e,i=t}else await T(o);O(s.errors)?(F.state.next({errors:{},isSubmitting:!0}),await e(i,a)):(t&&await t({...s.errors},a),te())}catch(e){throw n=!1,e}finally{s.isSubmitted=!0,F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:O(s.errors)&&n,submitCount:s.submitCount+1,errors:s.errors})}},watch:(e,t)=>q(e)?F.watch.subscribe({next:r=>e(M(void 0,t),r)}):M(e,t,!0),setValue:W,getValues:H,reset:(t,r)=>((t,r={})=>{const a=t||u,n=ye(a),i=t&&!O(t)?n:u;if(r.keepDefaultValues||(u=a),!r.keepValues){if(r.keepDirtyValues)for(const e of _.mount)m(s.dirtyFields,e)?G(i,e,m(h,e)):W(e,m(i,e));else{if(me&&f(t))for(const e of _.mount){const t=m(o,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(De(e)){const t=e.closest("form");if(t){t.reset();break}}}}o={}}h=e.shouldUnregister?r.keepDefaultValues?ye(u):{}:n,F.array.next({values:i}),F.watch.next({values:i})}_={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},p.mount=!x.isValid||!!r.keepIsValid,p.watch=!!e.shouldUnregister,F.state.next({submitCount:r.keepSubmitCount?s.submitCount:0,isDirty:r.keepDirty||r.keepDirtyValues?s.isDirty:!(!r.keepDefaultValues||ke(t,u)),isSubmitted:!!r.keepIsSubmitted&&s.isSubmitted,dirtyFields:r.keepDirty||r.keepDirtyValues?s.dirtyFields:r.keepDefaultValues&&t?Te(u,t):{},touchedFields:r.keepTouched?s.touchedFields:{},errors:r.keepErrors?s.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})})(q(t)?t(h):t,r),resetField:(e,t={})=>{m(o,e)&&(f(t.defaultValue)?W(e,m(u,e)):(W(e,t.defaultValue),G(u,e,t.defaultValue)),t.keepTouched||Fe(s.touchedFields,e),t.keepDirty||(Fe(s.dirtyFields,e),s.isDirty=t.defaultValue?B(e,m(u,e)):B()),t.keepError||(Fe(s.errors,e),x.isValid&&k()),F.state.next({...s}))},clearErrors:e=>{e?U(e).forEach((e=>Fe(s.errors,e))):s.errors={},F.state.next({errors:s.errors})},unregister:K,setError:(e,t,r)=>{const a=(m(o,e,{_f:{}})._f||{}).ref;G(s.errors,e,{...t,ref:a}),F.state.next({name:e,errors:s.errors,isValid:!1}),r&&r.shouldFocus&&a&&a.focus&&a.focus()},setFocus:(e,t={})=>{const r=m(o,e),s=r&&r._f;if(s){const e=s.refs?s.refs[0]:s.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:z}}e.Controller=e=>e.render($(e)),e.FormProvider=e=>{const{children:t,...r}=e;return s.default.createElement(C.Provider,{value:r},t)},e.appendErrors=I,e.get=m,e.set=G,e.useController=$,e.useFieldArray=function(e){const t=j(),{control:r=t.control,name:a,keyName:n="id",shouldUnregister:i}=e,[o,u]=s.default.useState(r._getFieldArray(a)),l=s.default.useRef(r._getFieldArray(a).map(K)),c=s.default.useRef(o),d=s.default.useRef(a),f=s.default.useRef(!1);d.current=a,c.current=o,r._names.array.add(a),e.rules&&r.register(a,e.rules),M({callback:s.default.useCallback((({values:e,name:t})=>{if(t===d.current||!t){const t=m(e,d.current);Array.isArray(t)&&(u(t),l.current=t.map(K))}}),[]),subject:r._subjects.array});const y=s.default.useCallback((e=>{f.current=!0,r._updateFieldArray(a,e)}),[r,a]);return s.default.useEffect((()=>{if(r._stateFlags.action=!1,X(a,r._names)&&r._subjects.state.next({}),f.current&&(!he(r._options.mode).isOnSubmit||r._formState.isSubmitted))if(r._options.resolver)r._executeSchema([a]).then((e=>{const t=m(e.errors,a),s=m(r._formState.errors,a);(s?!t&&s.type:t&&t.type)&&(t?G(r._formState.errors,a,t):Fe(r._formState.errors,a),r._subjects.state.next({errors:r._formState.errors}))}));else{const e=m(r._fields,a);e&&e._f&&de(e,m(r._formValues,a),r._options.criteriaMode===A,r._options.shouldUseNativeValidation,!0).then((e=>!O(e)&&r._subjects.state.next({errors:Y(r._formState.errors,e,a)})))}r._subjects.watch.next({name:a,values:r._formValues}),r._names.focus&&J(r._fields,(e=>!!e&&e.startsWith(r._names.focus))),r._names.focus="",r._proxyFormState.isValid&&r._updateValid()}),[o,a,r]),s.default.useEffect((()=>(!m(r._formValues,a)&&r._updateFieldArray(a),()=>{(r._options.shouldUnregister||i)&&r.unregister(a)})),[a,r,n,i]),{swap:s.default.useCallback(((e,t)=>{const s=r._getFieldArray(a);Ae(s,e,t),Ae(l.current,e,t),y(s),u(s),r._updateFieldArray(a,s,Ae,{argA:e,argB:t},!1)}),[y,a,r]),move:s.default.useCallback(((e,t)=>{const s=r._getFieldArray(a);_e(s,e,t),_e(l.current,e,t),y(s),u(s),r._updateFieldArray(a,s,_e,{argA:e,argB:t},!1)}),[y,a,r]),prepend:s.default.useCallback(((e,t)=>{const s=U(ye(e)),n=ve(r._getFieldArray(a),s);r._names.focus=Q(a,0,t),l.current=ve(l.current,s.map(K)),y(n),u(n),r._updateFieldArray(a,n,ve,{argA:ge(e)})}),[y,a,r]),append:s.default.useCallback(((e,t)=>{const s=U(ye(e)),n=fe(r._getFieldArray(a),s);r._names.focus=Q(a,n.length-1,t),l.current=fe(l.current,s.map(K)),y(n),u(n),r._updateFieldArray(a,n,fe,{argA:ge(e)})}),[y,a,r]),remove:s.default.useCallback((e=>{const t=be(r._getFieldArray(a),e);l.current=be(l.current,e),y(t),u(t),r._updateFieldArray(a,t,be,{argA:e})}),[y,a,r]),insert:s.default.useCallback(((e,t,s)=>{const n=U(ye(t)),i=pe(r._getFieldArray(a),e,n);r._names.focus=Q(a,e,s),l.current=pe(l.current,e,n.map(K)),y(i),u(i),r._updateFieldArray(a,i,pe,{argA:e,argB:ge(t)})}),[y,a,r]),update:s.default.useCallback(((e,t)=>{const s=ye(t),n=Ve(r._getFieldArray(a),e,s);l.current=[...n].map(((t,r)=>t&&r!==e?l.current[r]:K())),y(n),u([...n]),r._updateFieldArray(a,n,Ve,{argA:e,argB:s},!0,!1)}),[y,a,r]),replace:s.default.useCallback((e=>{const t=U(ye(e));l.current=t.map(K),y([...t]),u([...t]),r._updateFieldArray(a,[...t],(e=>e),{},!0,!1)}),[y,a,r]),fields:s.default.useMemo((()=>o.map(((e,t)=>({...e,[n]:l.current[t]||K()})))),[o,n])}},e.useForm=function(e={}){const t=s.default.useRef(),[r,a]=s.default.useState({isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:e.defaultValues});t.current||(t.current={...Re(e),formState:r});const n=t.current.control;return n._options=e,M({subject:n._subjects.state,callback:s.default.useCallback((e=>{T(e,n._proxyFormState,!0)&&(n._formState={...n._formState,...e},a({...n._formState}))}),[n])}),s.default.useEffect((()=>{n._stateFlags.mount||(n._proxyFormState.isValid&&n._updateValid(),n._stateFlags.mount=!0),n._stateFlags.watch&&(n._stateFlags.watch=!1,n._subjects.state.next({})),n._removeUnmounted()})),s.default.useEffect((()=>{r.submitCount&&n._focusError()}),[n,r.submitCount]),t.current.formState=E(r,n),t.current},e.useFormContext=j,e.useFormState=N,e.useWatch=W,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.js.map

@@ -6,2 +6,3 @@ import { CriteriaMode, FieldName, FieldRefs, FieldValues, InternalFieldName } from '../types';

fields: Record<string, {
_c?: boolean | undefined;
ref: import("../types").Ref;

@@ -8,0 +9,0 @@ name: string;

@@ -10,3 +10,3 @@ import { FieldValues } from './fields';

rules?: {
validate?: Validate<FieldArray<TFieldValues, TFieldArrayName>[]> | Record<string, Validate<FieldArray<TFieldValues, TFieldArrayName>>>;
validate?: Validate<FieldArray<TFieldValues, TFieldArrayName>[]> | Record<string, Validate<FieldArray<TFieldValues, TFieldArrayName>[]>>;
} & Pick<RegisterOptions<TFieldValues>, 'maxLength' | 'minLength' | 'required'>;

@@ -13,0 +13,0 @@ shouldUnregister?: boolean;

@@ -22,2 +22,3 @@ import { IsFlatObject, Noop } from './utils';

_f: {
_c?: boolean;
ref: Ref;

@@ -24,0 +25,0 @@ name: InternalFieldName;

{
"name": "react-hook-form",
"description": "Performant, flexible and extensible forms library for React Hooks",
"version": "7.39.1",
"version": "7.39.2",
"main": "dist/index.cjs.js",

@@ -6,0 +6,0 @@ "module": "dist/index.esm.mjs",

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 not supported yet

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 not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc