forked from avelino/awesome-go
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
6601-5dec516288cbb217.js.download
1 lines (1 loc) · 26 KB
/
6601-5dec516288cbb217.js.download
1
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6601],{76601:function(e,t,r){r.d(t,{Dq:function(){return eh},KN:function(){return R},Qr:function(){return N},RV:function(){return x},U2:function(){return g},bc:function(){return T},cI:function(){return eB},qo:function(){return j},t8:function(){return L}});var a=r(91710),s=e=>"checkbox"===e.type,i=e=>e instanceof Date,l=e=>null==e;let u=e=>"object"==typeof e;var n=e=>!l(e)&&!Array.isArray(e)&&u(e)&&!i(e),o=e=>n(e)&&e.target?s(e.target)?e.target.checked:e.target.value:e,d=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,f=(e,t)=>e.has(d(t)),c=e=>{let t=e.constructor&&e.constructor.prototype;return n(t)&&t.hasOwnProperty("isPrototypeOf")},y=void 0!==window.HTMLElement&&"undefined"!=typeof document;function m(e){let t;let r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(!(y&&(e instanceof Blob||e instanceof FileList))&&(r||n(e))))return e;else if(t=r?[]:{},Array.isArray(e)||c(e))for(let r in e)t[r]=m(e[r]);else t=e;return t}var h=e=>Array.isArray(e)?e.filter(Boolean):[],v=e=>void 0===e,g=(e,t,r)=>{if(!t||!n(e))return r;let a=h(t.split(/[,[\].]+?/)).reduce((e,t)=>l(e)?e:e[t],e);return v(a)||a===e?v(e[t])?r:e[t]:a};let p={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},_={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},b={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},A=a.createContext(null),V=()=>a.useContext(A),x=e=>{let{children:t,...r}=e;return a.createElement(A.Provider,{value:r},t)};var F=function(e,t,r){let a=!(arguments.length>3)||void 0===arguments[3]||arguments[3],s={defaultValues:t._defaultValues};for(let i in e)Object.defineProperty(s,i,{get:()=>(t._proxyFormState[i]!==_.all&&(t._proxyFormState[i]=!a||_.all),r&&(r[i]=!0),e[i])});return s},S=e=>n(e)&&!Object.keys(e).length,k=(e,t,r,a)=>{r(e);let{name:s,...i}=e;return S(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(e=>t[e]===(!a||_.all))},w=e=>Array.isArray(e)?e:[e],D=(e,t,r)=>r&&t?e===t:!e||!t||e===t||w(e).some(e=>e&&(e.startsWith(t)||t.startsWith(e)));function C(e){let t=a.useRef(e);t.current=e,a.useEffect(()=>{let r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var O=e=>"string"==typeof e,E=(e,t,r,a,s)=>O(e)?(a&&t.watch.add(e),g(r,e,s)):Array.isArray(e)?e.map(e=>(a&&t.watch.add(e),g(r,e))):(a&&(t.watchAll=!0),r);function j(e){let t=V(),{control:r=t.control,name:s,defaultValue:i,disabled:l,exact:u}=e||{},n=a.useRef(s);n.current=s,C({disabled:l,subject:r._subjects.values,next:e=>{D(n.current,e.name,u)&&d(m(E(n.current,r._names,e.values||r._formValues,!1,i)))}});let[o,d]=a.useState(r._getWatch(s,i));return a.useEffect(()=>r._removeUnmounted()),o}var U=e=>/^\w*$/.test(e),B=e=>h(e.replace(/["|']|\]/g,"").split(/\.|\[/));function L(e,t,r){let a=-1,s=U(t)?[t]:B(t),i=s.length,l=i-1;for(;++a<i;){let t=s[a],i=r;if(a!==l){let r=e[t];i=n(r)||Array.isArray(r)?r:isNaN(+s[a+1])?{}:[]}e[t]=i,e=e[t]}return e}function T(e){let t=V(),{name:r,control:s=t.control,shouldUnregister:i}=e,l=f(s._names.array,r),u=j({control:s,name:r,defaultValue:g(s._formValues,r,g(s._defaultValues,r,e.defaultValue)),exact:!0}),n=function(e){let t=V(),{control:r=t.control,disabled:s,name:i,exact:l}=e||{},[u,n]=a.useState(r._formState),o=a.useRef(!0),d=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),f=a.useRef(i);return f.current=i,C({disabled:s,next:e=>o.current&&D(f.current,e.name,l)&&k(e,d.current,r._updateFormState)&&n({...r._formState,...e}),subject:r._subjects.state}),a.useEffect(()=>(o.current=!0,d.current.isValid&&r._updateValid(!0),()=>{o.current=!1}),[r]),F(u,r,d.current,!1)}({control:s,name:r}),d=a.useRef(s.register(r,{...e.rules,value:u}));return a.useEffect(()=>{let e=s._options.shouldUnregister||i,t=(e,t)=>{let r=g(s._fields,e);r&&(r._f.mount=t)};if(t(r,!0),e){let e=m(g(s._options.defaultValues,r));L(s._defaultValues,r,e),v(g(s._formValues,r))&&L(s._formValues,r,e)}return()=>{(l?e&&!s._state.action:e)?s.unregister(r):t(r,!1)}},[r,s,l,i]),{field:{name:r,value:u,onChange:a.useCallback(e=>d.current.onChange({target:{value:o(e),name:r},type:p.CHANGE}),[r]),onBlur:a.useCallback(()=>d.current.onBlur({target:{value:g(s._formValues,r),name:r},type:p.BLUR}),[r,s]),ref:e=>{let t=g(s._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:n,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!g(n.errors,r)},isDirty:{enumerable:!0,get:()=>!!g(n.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!g(n.touchedFields,r)},error:{enumerable:!0,get:()=>g(n.errors,r)}})}}let N=e=>e.render(T(e));var R=(e,t,r,a,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[a]:s||!0}}:{};let M=(e,t,r)=>{for(let a of r||Object.keys(e)){let r=g(e,a);if(r){let{_f:e,...a}=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 n(a)&&M(a,t)}}};var q=()=>{let e="undefined"==typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=(16*Math.random()+e)%16|0;return("x"==t?r:3&r|8).toString(16)})},I=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.shouldFocus||v(r.shouldFocus)?r.focusName||"".concat(e,".").concat(v(r.focusIndex)?t:r.focusIndex,"."):""},P=e=>({isOnSubmit:!e||e===_.onSubmit,isOnBlur:e===_.onBlur,isOnChange:e===_.onChange,isOnAll:e===_.all,isOnTouch:e===_.onTouched}),H=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),W=(e,t,r)=>{let a=h(g(e,r));return L(a,"root",t[r]),L(e,r,a),e},G=e=>"boolean"==typeof e,$=e=>"file"===e.type,K=e=>"function"==typeof e,Q=e=>{if(!y)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},z=e=>O(e),J=e=>"radio"===e.type,X=e=>e instanceof RegExp;let Y={value:!1,isValid:!1},Z={value:!0,isValid:!0};var ee=e=>{if(Array.isArray(e)){if(e.length>1){let 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&&!v(e[0].attributes.value)?v(e[0].value)||""===e[0].value?Z:{value:e[0].value,isValid:!0}:Z:Y}return Y};let et={isValid:!1,value:null};var er=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,et):et;function ea(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"validate";if(z(e)||Array.isArray(e)&&e.every(z)||G(e)&&!e)return{type:r,message:z(e)?e:"",ref:t}}var es=e=>n(e)&&!X(e)?e:{value:e,message:""},ei=async(e,t,r,a,i)=>{let{ref:u,refs:o,required:d,maxLength:f,minLength:c,min:y,max:m,pattern:h,validate:p,name:_,valueAsNumber:A,mount:V,disabled:x}=e._f,F=g(t,_);if(!V||x)return{};let k=o?o[0]:u,w=e=>{a&&k.reportValidity&&(k.setCustomValidity(G(e)?"":e||""),k.reportValidity())},D={},C=J(u),E=s(u),j=(A||$(u))&&v(u.value)&&v(F)||Q(u)&&""===u.value||""===F||Array.isArray(F)&&!F.length,U=R.bind(null,_,r,D),B=function(e,t,r){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:b.maxLength,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:b.minLength,i=e?t:r;D[_]={type:e?a:s,message:i,ref:u,...U(e?a:s,i)}};if(i?!Array.isArray(F)||!F.length:d&&(!(C||E)&&(j||l(F))||G(F)&&!F||E&&!ee(o).isValid||C&&!er(o).isValid)){let{value:e,message:t}=z(d)?{value:!!d,message:d}:es(d);if(e&&(D[_]={type:b.required,message:t,ref:k,...U(b.required,t)},!r))return w(t),D}if(!j&&(!l(y)||!l(m))){let e,t;let a=es(m),s=es(y);if(l(F)||isNaN(F)){let r=u.valueAsDate||new Date(F),i=e=>new Date(new Date().toDateString()+" "+e),l="time"==u.type,n="week"==u.type;O(a.value)&&F&&(e=l?i(F)>i(a.value):n?F>a.value:r>new Date(a.value)),O(s.value)&&F&&(t=l?i(F)<i(s.value):n?F<s.value:r<new Date(s.value))}else{let r=u.valueAsNumber||(F?+F:F);l(a.value)||(e=r>a.value),l(s.value)||(t=r<s.value)}if((e||t)&&(B(!!e,a.message,s.message,b.max,b.min),!r))return w(D[_].message),D}if((f||c)&&!j&&(O(F)||i&&Array.isArray(F))){let e=es(f),t=es(c),a=!l(e.value)&&F.length>+e.value,s=!l(t.value)&&F.length<+t.value;if((a||s)&&(B(a,e.message,t.message),!r))return w(D[_].message),D}if(h&&!j&&O(F)){let{value:e,message:t}=es(h);if(X(e)&&!F.match(e)&&(D[_]={type:b.pattern,message:t,ref:u,...U(b.pattern,t)},!r))return w(t),D}if(p){if(K(p)){let e=ea(await p(F,t),k);if(e&&(D[_]={...e,...U(b.validate,e.message)},!r))return w(e.message),D}else if(n(p)){let e={};for(let a in p){if(!S(e)&&!r)break;let s=ea(await p[a](F,t),k,a);s&&(e={...s,...U(a,s.message)},w(s.message),r&&(D[_]=e))}if(!S(e)&&(D[_]={ref:k,...e},!r))return D}}return w(!0),D};function el(e,t){return[...e,...w(t)]}var eu=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function en(e,t,r){return[...e.slice(0,t),...w(r),...e.slice(t)]}var eo=(e,t,r)=>Array.isArray(e)?(v(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[];function ed(e,t){return[...w(t),...w(e)]}var ef=(e,t)=>v(t)?[]:function(e,t){let r=0,a=[...e];for(let e of t)a.splice(e-r,1),r++;return h(a).length?a:[]}(e,w(t).sort((e,t)=>e-t)),ec=(e,t,r)=>{e[t]=[e[r],e[r]=e[t]][0]};function ey(e,t){let r=Array.isArray(t)?t:U(t)?[t]:B(t),a=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,a=0;for(;a<r;)e=v(e)?a++:e[t[a++]];return e}(e,r),s=r.length-1,i=r[s];return a&&delete a[i],0!==s&&(n(a)&&S(a)||Array.isArray(a)&&function(e){for(let t in e)if(!v(e[t]))return!1;return!0}(a))&&ey(e,r.slice(0,-1)),e}var em=(e,t,r)=>(e[t]=r,e);function eh(e){let t=V(),{control:r=t.control,name:s,keyName:i="id",shouldUnregister:l}=e,[u,n]=a.useState(r._getFieldArray(s)),o=a.useRef(r._getFieldArray(s).map(q)),d=a.useRef(u),f=a.useRef(s),c=a.useRef(!1);f.current=s,d.current=u,r._names.array.add(s),e.rules&&r.register(s,e.rules),C({next:e=>{let{values:t,name:r}=e;if(r===f.current||!r){let e=g(t,f.current);Array.isArray(e)&&(n(e),o.current=e.map(q))}},subject:r._subjects.array});let y=a.useCallback(e=>{c.current=!0,r._updateFieldArray(s,e)},[r,s]);return a.useEffect(()=>{if(r._state.action=!1,H(s,r._names)&&r._subjects.state.next({...r._formState}),c.current&&(!P(r._options.mode).isOnSubmit||r._formState.isSubmitted)){if(r._options.resolver)r._executeSchema([s]).then(e=>{let t=g(e.errors,s),a=g(r._formState.errors,s);(a?!t&&a.type:t&&t.type)&&(t?L(r._formState.errors,s,t):ey(r._formState.errors,s),r._subjects.state.next({errors:r._formState.errors}))});else{let e=g(r._fields,s);e&&e._f&&ei(e,r._formValues,r._options.criteriaMode===_.all,r._options.shouldUseNativeValidation,!0).then(e=>!S(e)&&r._subjects.state.next({errors:W(r._formState.errors,e,s)}))}}r._subjects.values.next({name:s,values:{...r._formValues}}),r._names.focus&&M(r._fields,e=>!!e&&e.startsWith(r._names.focus||"")),r._names.focus="",r._updateValid()},[u,s,r]),a.useEffect(()=>(g(r._formValues,s)||r._updateFieldArray(s),()=>{(r._options.shouldUnregister||l)&&r.unregister(s)}),[s,r,i,l]),{swap:a.useCallback((e,t)=>{let a=r._getFieldArray(s);ec(a,e,t),ec(o.current,e,t),y(a),n(a),r._updateFieldArray(s,a,ec,{argA:e,argB:t},!1)},[y,s,r]),move:a.useCallback((e,t)=>{let a=r._getFieldArray(s);eo(a,e,t),eo(o.current,e,t),y(a),n(a),r._updateFieldArray(s,a,eo,{argA:e,argB:t},!1)},[y,s,r]),prepend:a.useCallback((e,t)=>{let a=w(m(e)),i=ed(r._getFieldArray(s),a);r._names.focus=I(s,0,t),o.current=ed(o.current,a.map(q)),y(i),n(i),r._updateFieldArray(s,i,ed,{argA:eu(e)})},[y,s,r]),append:a.useCallback((e,t)=>{let a=w(m(e)),i=el(r._getFieldArray(s),a);r._names.focus=I(s,i.length-1,t),o.current=el(o.current,a.map(q)),y(i),n(i),r._updateFieldArray(s,i,el,{argA:eu(e)})},[y,s,r]),remove:a.useCallback(e=>{let t=ef(r._getFieldArray(s),e);o.current=ef(o.current,e),y(t),n(t),r._updateFieldArray(s,t,ef,{argA:e})},[y,s,r]),insert:a.useCallback((e,t,a)=>{let i=w(m(t)),l=en(r._getFieldArray(s),e,i);r._names.focus=I(s,e,a),o.current=en(o.current,e,i.map(q)),y(l),n(l),r._updateFieldArray(s,l,en,{argA:e,argB:eu(t)})},[y,s,r]),update:a.useCallback((e,t)=>{let a=m(t),i=em(r._getFieldArray(s),e,a);o.current=[...i].map((t,r)=>t&&r!==e?o.current[r]:q()),y(i),n([...i]),r._updateFieldArray(s,i,em,{argA:e,argB:a},!0,!1)},[y,s,r]),replace:a.useCallback(e=>{let t=w(m(e));o.current=t.map(q),y([...t]),n([...t]),r._updateFieldArray(s,[...t],e=>e,{},!0,!1)},[y,s,r]),fields:a.useMemo(()=>u.map((e,t)=>({...e,[i]:o.current[t]||q()})),[u,i])}}function ev(){let e=[];return{get observers(){return e},next:t=>{for(let r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}}var eg=e=>l(e)||!u(e);function ep(e,t){if(eg(e)||eg(t))return e===t;if(i(e)&&i(t))return e.getTime()===t.getTime();let r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(let s of r){let r=e[s];if(!a.includes(s))return!1;if("ref"!==s){let e=t[s];if(i(r)&&i(e)||n(r)&&n(e)||Array.isArray(r)&&Array.isArray(e)?!ep(r,e):r!==e)return!1}}return!0}var e_=e=>"select-multiple"===e.type,eb=e=>J(e)||s(e),eA=e=>Q(e)&&e.isConnected,eV=e=>{for(let t in e)if(K(e[t]))return!0;return!1};function ex(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Array.isArray(e);if(n(e)||r)for(let r in e)Array.isArray(e[r])||n(e[r])&&!eV(e[r])?(t[r]=Array.isArray(e[r])?[]:{},ex(e[r],t[r])):l(e[r])||(t[r]=!0);return t}var eF=(e,t)=>(function e(t,r,a){let s=Array.isArray(t);if(n(t)||s)for(let s in t)Array.isArray(t[s])||n(t[s])&&!eV(t[s])?v(r)||eg(a[s])?a[s]=Array.isArray(t[s])?ex(t[s],[]):{...ex(t[s])}:e(t[s],l(r)?{}:r[s],a[s]):a[s]=!ep(t[s],r[s]);return a})(e,t,ex(t)),eS=(e,t)=>{let{valueAsNumber:r,valueAsDate:a,setValueAs:s}=t;return v(e)?e:r?""===e?NaN:e?+e:e:a&&O(e)?new Date(e):s?s(e):e};function ek(e){let t=e.ref;return(e.refs?e.refs.every(e=>e.disabled):t.disabled)?void 0:$(t)?t.files:J(t)?er(e.refs).value:e_(t)?[...t.selectedOptions].map(e=>{let{value:t}=e;return t}):s(t)?ee(e.refs).value:eS(v(t.value)?e.ref.value:t.value,e)}var ew=(e,t,r,a)=>{let s={};for(let r of e){let e=g(t,r);e&&L(s,r,e._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:a}},eD=e=>v(e)?e:X(e)?e.source:n(e)?X(e.value)?e.value.source:e.value:e,eC=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function eO(e,t,r){let a=g(e,r);if(a||U(r))return{error:a,name:r};let s=r.split(".");for(;s.length;){let a=s.join("."),i=g(t,a),l=g(e,a);if(i&&!Array.isArray(i)&&r!==a)break;if(l&&l.type)return{name:a,error:l};s.pop()}return{name:r}}var eE=(e,t,r,a,s)=>!s.isOnAll&&(!r&&s.isOnTouch?!(t||e):(r?a.isOnBlur:s.isOnBlur)?!e:(r?!a.isOnChange:!s.isOnChange)||e),ej=(e,t)=>!h(g(e,t)).length&&ey(e,t);let eU={mode:_.onSubmit,reValidateMode:_.onChange,shouldFocusError:!0};function eB(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=a.useRef(),[r,u]=a.useState({isDirty:!1,isValidating:!1,isLoading:K(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:K(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,a={...eU,...t},u={submitCount:0,isDirty:!1,isLoading:K(a.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},d={},c=(n(a.defaultValues)||n(a.values))&&m(a.defaultValues||a.values)||{},b=a.shouldUnregister?{}:m(c),A={action:!1,mount:!1,watch:!1},V={mount:new Set,unMount:new Set,array:new Set,watch:new Set},x=0,F={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},k={values:ev(),array:ev(),state:ev()},D=t.resetOptions&&t.resetOptions.keepDirtyValues,C=P(a.mode),j=P(a.reValidateMode),U=a.criteriaMode===_.all,B=e=>t=>{clearTimeout(x),x=setTimeout(e,t)},T=async e=>{if(F.isValid||e){let e=a.resolver?S((await J()).errors):await Y(d,!0);e!==u.isValid&&k.state.next({isValid:e})}},N=e=>F.isValidating&&k.state.next({isValidating:e}),R=(e,t)=>{L(u.errors,e,t),k.state.next({errors:u.errors})},q=(e,t,r,a)=>{let s=g(d,e);if(s){let i=g(b,e,v(r)?g(c,e):r);v(i)||a&&a.defaultChecked||t?L(b,e,t?i:ek(s._f)):et(e,i),A.mount&&T()}},I=(e,t,r,a,s)=>{let i=!1,l=!1,n={name:e};if(!r||a){F.isDirty&&(l=u.isDirty,u.isDirty=n.isDirty=Z(),i=l!==n.isDirty);let r=ep(g(c,e),t);l=g(u.dirtyFields,e),r?ey(u.dirtyFields,e):L(u.dirtyFields,e,!0),n.dirtyFields=u.dirtyFields,i=i||F.dirtyFields&&!r!==l}if(r){let t=g(u.touchedFields,e);t||(L(u.touchedFields,e,r),n.touchedFields=u.touchedFields,i=i||F.touchedFields&&t!==r)}return i&&s&&k.state.next(n),i?n:{}},z=(r,a,s,i)=>{let l=g(u.errors,r),n=F.isValid&&G(a)&&u.isValid!==a;if(t.delayError&&s?(e=B(()=>R(r,s)))(t.delayError):(clearTimeout(x),e=null,s?L(u.errors,r,s):ey(u.errors,r)),(s?!ep(l,s):l)||!S(i)||n){let e={...i,...n&&G(a)?{isValid:a}:{},errors:u.errors,name:r};u={...u,...e},k.state.next(e)}N(!1)},J=async e=>a.resolver(b,a.context,ew(e||V.mount,d,a.criteriaMode,a.shouldUseNativeValidation)),X=async e=>{let{errors:t}=await J();if(e)for(let r of e){let e=g(t,r);e?L(u.errors,r,e):ey(u.errors,r)}else u.errors=t;return t},Y=async function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{valid:!0};for(let s in e){let i=e[s];if(i){let{_f:e,...s}=i;if(e){let s=V.array.has(e.name),l=await ei(i,b,U,a.shouldUseNativeValidation&&!t,s);if(l[e.name]&&(r.valid=!1,t))break;t||(g(l,e.name)?s?W(u.errors,l,e.name):L(u.errors,e.name,l[e.name]):ey(u.errors,e.name))}s&&await Y(s,t,r)}}return r.valid},Z=(e,t)=>(e&&t&&L(b,e,t),!ep(eu(),c)),ee=(e,t,r)=>E(e,V,{...A.mount?b:v(t)?c:O(e)?{[e]:t}:t},r,t),et=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=g(d,e),i=t;if(a){let r=a._f;r&&(r.disabled||L(b,e,eS(t,r)),i=Q(r.ref)&&l(t)?"":t,e_(r.ref)?[...r.ref.options].forEach(e=>e.selected=i.includes(e.value)):r.refs?s(r.ref)?r.refs.length>1?r.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find(t=>t===e.value):i===e.value)):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach(e=>e.checked=e.value===i):$(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||k.values.next({name:e,values:{...b}})))}(r.shouldDirty||r.shouldTouch)&&I(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&el(e)},er=(e,t,r)=>{for(let a in t){let s=t[a],l="".concat(e,".").concat(a),u=g(d,l);!V.array.has(e)&&eg(s)&&(!u||u._f)||i(s)?et(l,s,r):er(l,s,r)}},ea=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=g(d,e),i=V.array.has(e),n=m(t);L(b,e,n),i?(k.array.next({name:e,values:{...b}}),(F.isDirty||F.dirtyFields)&&a.shouldDirty&&k.state.next({name:e,dirtyFields:eF(c,b),isDirty:Z(e,n)})):!s||s._f||l(n)?et(e,n,a):er(e,n,a),H(e,V)&&k.state.next({...u}),k.values.next({name:e,values:{...b}}),A.mount||r()},es=async t=>{let r=t.target,s=r.name,i=!0,l=g(d,s);if(l){let n,f;let c=r.type?ek(l._f):o(t),y=t.type===p.BLUR||t.type===p.FOCUS_OUT,m=!eC(l._f)&&!a.resolver&&!g(u.errors,s)&&!l._f.deps||eE(y,g(u.touchedFields,s),u.isSubmitted,j,C),h=H(s,V,y);L(b,s,c),y?(l._f.onBlur&&l._f.onBlur(t),e&&e(0)):l._f.onChange&&l._f.onChange(t);let v=I(s,c,y,!1),_=!S(v)||h;if(y||k.values.next({name:s,type:t.type,values:{...b}}),m)return F.isValid&&T(),_&&k.state.next({name:s,...h?{}:v});if(!y&&h&&k.state.next({...u}),N(!0),a.resolver){let{errors:e}=await J([s]),t=eO(u.errors,d,s),r=eO(e,d,t.name||s);n=r.error,s=r.name,f=S(e)}else n=(await ei(l,b,U,a.shouldUseNativeValidation))[s],(i=isNaN(c)||c===g(b,s,c))&&(n?f=!1:F.isValid&&(f=await Y(d,!0)));i&&(l._f.deps&&el(l._f.deps),z(s,f,n,v))}},el=async function(e){let t,r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=w(e);if(N(!0),a.resolver){let a=await X(v(e)?e:i);t=S(a),r=e?!i.some(e=>g(a,e)):t}else e?((r=(await Promise.all(i.map(async e=>{let t=g(d,e);return await Y(t&&t._f?{[e]:t}:t)}))).every(Boolean))||u.isValid)&&T():r=t=await Y(d);return k.state.next({...!O(e)||F.isValid&&t!==u.isValid?{}:{name:e},...a.resolver||!e?{isValid:t}:{},errors:u.errors,isValidating:!1}),s.shouldFocus&&!r&&M(d,e=>e&&g(u.errors,e),e?i:V.mount),r},eu=e=>{let t={...c,...A.mount?b:{}};return v(e)?t:O(e)?g(t,e):e.map(e=>g(t,e))},en=(e,t)=>({invalid:!!g((t||u).errors,e),isDirty:!!g((t||u).dirtyFields,e),isTouched:!!g((t||u).touchedFields,e),error:g((t||u).errors,e)}),eo=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(let r of e?w(e):V.mount)V.mount.delete(r),V.array.delete(r),t.keepValue||(ey(d,r),ey(b,r)),t.keepError||ey(u.errors,r),t.keepDirty||ey(u.dirtyFields,r),t.keepTouched||ey(u.touchedFields,r),a.shouldUnregister||t.keepDefaultValue||ey(c,r);k.values.next({values:{...b}}),k.state.next({...u,...t.keepDirty?{isDirty:Z()}:{}}),t.keepIsValid||T()},ed=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=g(d,e),s=G(t.disabled);return L(d,e,{...r||{},_f:{...r&&r._f?r._f:{ref:{name:e}},name:e,mount:!0,...t}}),V.mount.add(e),r?s&&L(b,e,t.disabled?void 0:g(b,e,ek(r._f))):q(e,!0,t.value),{...s?{disabled:t.disabled}:{},...a.shouldUseNativeValidation?{required:!!t.required,min:eD(t.min),max:eD(t.max),minLength:eD(t.minLength),maxLength:eD(t.maxLength),pattern:eD(t.pattern)}:{},name:e,onChange:es,onBlur:es,ref:s=>{if(s){ed(e,t),r=g(d,e);let a=v(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,i=eb(a),l=r._f.refs||[];(i?l.find(e=>e===a):a===r._f.ref)||(L(d,e,{_f:{...r._f,...i?{refs:[...l.filter(eA),a,...Array.isArray(g(c,e))?[{}]:[]],ref:{type:a.type,name:e}}:{ref:a}}}),q(e,!1,void 0,a))}else(r=g(d,e,{}))._f&&(r._f.mount=!1),(a.shouldUnregister||t.shouldUnregister)&&!(f(V.array,e)&&A.action)&&V.unMount.add(e)}}},ef=()=>a.shouldFocusError&&M(d,e=>e&&g(u.errors,e),V.mount),ec=function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=e||c,i=m(s),l=e&&!S(e)?i:c;if(a.keepDefaultValues||(c=s),!a.keepValues){if(a.keepDirtyValues||D)for(let e of V.mount)g(u.dirtyFields,e)?L(l,e,g(b,e)):ea(e,g(l,e));else{if(y&&v(e))for(let e of V.mount){let t=g(d,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Q(e)){let t=e.closest("form");if(t){t.reset();break}}}}d={}}b=t.shouldUnregister?a.keepDefaultValues?m(c):{}:i,k.array.next({values:{...l}}),k.values.next({values:{...l}})}V={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},A.mount||r(),A.mount=!F.isValid||!!a.keepIsValid,A.watch=!!t.shouldUnregister,k.state.next({submitCount:a.keepSubmitCount?u.submitCount:0,isDirty:a.keepDirty?u.isDirty:!!(a.keepDefaultValues&&!ep(e,c)),isSubmitted:!!a.keepIsSubmitted&&u.isSubmitted,dirtyFields:a.keepDirtyValues?u.dirtyFields:a.keepDefaultValues&&e?eF(c,e):{},touchedFields:a.keepTouched?u.touchedFields:{},errors:a.keepErrors?u.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},em=(e,t)=>ec(K(e)?e(b):e,t);return{control:{register:ed,unregister:eo,getFieldState:en,_executeSchema:J,_getWatch:ee,_getDirty:Z,_updateValid:T,_removeUnmounted:()=>{for(let e of V.unMount){let t=g(d,e);t&&(t._f.refs?t._f.refs.every(e=>!eA(e)):!eA(t._f.ref))&&eo(e)}V.unMount=new Set},_updateFieldArray:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,s=!(arguments.length>4)||void 0===arguments[4]||arguments[4],i=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if(a&&r){if(A.action=!0,i&&Array.isArray(g(d,e))){let t=r(g(d,e),a.argA,a.argB);s&&L(d,e,t)}if(i&&Array.isArray(g(u.errors,e))){let t=r(g(u.errors,e),a.argA,a.argB);s&&L(u.errors,e,t),ej(u.errors,e)}if(F.touchedFields&&i&&Array.isArray(g(u.touchedFields,e))){let t=r(g(u.touchedFields,e),a.argA,a.argB);s&&L(u.touchedFields,e,t)}F.dirtyFields&&(u.dirtyFields=eF(c,b)),k.state.next({name:e,isDirty:Z(e,t),dirtyFields:u.dirtyFields,errors:u.errors,isValid:u.isValid})}else L(b,e,t)},_getFieldArray:e=>h(g(A.mount?b:c,e,t.shouldUnregister?g(c,e,[]):[])),_reset:ec,_resetDefaultValues:()=>K(a.defaultValues)&&a.defaultValues().then(e=>{em(e,a.resetOptions),k.state.next({isLoading:!1})}),_updateFormState:e=>{u={...u,...e}},_subjects:k,_proxyFormState:F,get _fields(){return d},get _formValues(){return b},get _state(){return A},set _state(value){A=value},get _defaultValues(){return c},get _names(){return V},set _names(value){V=value},get _formState(){return u},set _formState(value){u=value},get _options(){return a},set _options(value){a={...a,...value}}},trigger:el,register:ed,handleSubmit:(e,t)=>async r=>{r&&(r.preventDefault&&r.preventDefault(),r.persist&&r.persist());let s=m(b);if(k.state.next({isSubmitting:!0}),a.resolver){let{errors:e,values:t}=await J();u.errors=e,s=t}else await Y(d);ey(u.errors,"root"),S(u.errors)?(k.state.next({errors:{}}),await e(s,r)):(t&&await t({...u.errors},r),ef(),setTimeout(ef)),k.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:S(u.errors),submitCount:u.submitCount+1,errors:u.errors})},watch:(e,t)=>K(e)?k.values.subscribe({next:r=>e(ee(void 0,t),r)}):ee(e,t,!0),setValue:ea,getValues:eu,reset:em,resetField:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(d,e)&&(v(t.defaultValue)?ea(e,g(c,e)):(ea(e,t.defaultValue),L(c,e,t.defaultValue)),t.keepTouched||ey(u.touchedFields,e),t.keepDirty||(ey(u.dirtyFields,e),u.isDirty=t.defaultValue?Z(e,g(c,e)):Z()),!t.keepError&&(ey(u.errors,e),F.isValid&&T()),k.state.next({...u}))},clearErrors:e=>{e&&w(e).forEach(e=>ey(u.errors,e)),k.state.next({errors:e?u.errors:{}})},unregister:eo,setError:(e,t,r)=>{let a=(g(d,e,{_f:{}})._f||{}).ref;L(u.errors,e,{...t,ref:a}),k.state.next({name:e,errors:u.errors,isValid:!1}),r&&r.shouldFocus&&a&&a.focus&&a.focus()},setFocus:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=g(d,e),a=r&&r._f;if(a){let e=a.refs?a.refs[0]:a.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:en}}(e,()=>u(e=>({...e}))),formState:r});let d=t.current.control;return d._options=e,C({subject:d._subjects.state,next:e=>{k(e,d._proxyFormState,d._updateFormState,!0)&&u({...d._formState})}}),a.useEffect(()=>{e.values&&!ep(e.values,d._defaultValues)?d._reset(e.values,d._options.resetOptions):d._resetDefaultValues()},[e.values,d]),a.useEffect(()=>{d._state.mount||(d._updateValid(),d._state.mount=!0),d._state.watch&&(d._state.watch=!1,d._subjects.state.next({...d._formState})),d._removeUnmounted()}),t.current.formState=F(r,d),t.current}}}]);