"use strict";(self.webpackChunkweb_toolbox=self.webpackChunkweb_toolbox||[]).push([[970],{23266:(e,t,r)=>{r.d(t,{A:()=>w});var s=r(98587),a=r(58168),i=r(9950),n=r(72004),o=r(74061),l=r(99269),u=r(59254),d=r(19608),c=r(48283),f=r(13372),m=r(24184),y=r(79044),v=r(31506),g=r(40777),p=r(92455),h=r(88543),b=r(80863),_=r(68483);function V(e){return(0,_.Ay)("MuiMenuItem",e)}const A=(0,b.A)("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]);var F=r(44414);const x=["autoFocus","component","dense","divider","disableGutters","focusVisibleClassName","role","tabIndex","className"],S=(0,u.Ay)(m.A,{shouldForwardProp:e=>(0,d.A)(e)||"classes"===e,name:"MuiMenuItem",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.dense&&t.dense,r.divider&&t.divider,!r.disableGutters&&t.gutters]}})((e=>{let{theme:t,ownerState:r}=e;return(0,a.A)({},t.typography.body1,{display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap"},!r.disableGutters&&{paddingLeft:16,paddingRight:16},r.divider&&{borderBottom:"1px solid ".concat((t.vars||t).palette.divider),backgroundClip:"padding-box"},{"&:hover":{textDecoration:"none",backgroundColor:(t.vars||t).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},["&.".concat(A.selected)]:{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / ").concat(t.vars.palette.action.selectedOpacity,")"):(0,l.X4)(t.palette.primary.main,t.palette.action.selectedOpacity),["&.".concat(A.focusVisible)]:{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / calc(").concat(t.vars.palette.action.selectedOpacity," + ").concat(t.vars.palette.action.focusOpacity,"))"):(0,l.X4)(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.focusOpacity)}},["&.".concat(A.selected,":hover")]:{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / calc(").concat(t.vars.palette.action.selectedOpacity," + ").concat(t.vars.palette.action.hoverOpacity,"))"):(0,l.X4)(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / ").concat(t.vars.palette.action.selectedOpacity,")"):(0,l.X4)(t.palette.primary.main,t.palette.action.selectedOpacity)}},["&.".concat(A.focusVisible)]:{backgroundColor:(t.vars||t).palette.action.focus},["&.".concat(A.disabled)]:{opacity:(t.vars||t).palette.action.disabledOpacity},["& + .".concat(g.A.root)]:{marginTop:t.spacing(1),marginBottom:t.spacing(1)},["& + .".concat(g.A.inset)]:{marginLeft:52},["& .".concat(h.A.root)]:{marginTop:0,marginBottom:0},["& .".concat(h.A.inset)]:{paddingLeft:36},["& .".concat(p.A.root)]:{minWidth:36}},!r.dense&&{[t.breakpoints.up("sm")]:{minHeight:"auto"}},r.dense&&(0,a.A)({minHeight:32,paddingTop:4,paddingBottom:4},t.typography.body2,{["& .".concat(p.A.root," svg")]:{fontSize:"1.25rem"}}))})),w=i.forwardRef((function(e,t){const r=(0,c.A)({props:e,name:"MuiMenuItem"}),{autoFocus:l=!1,component:u="li",dense:d=!1,divider:m=!1,disableGutters:g=!1,focusVisibleClassName:p,role:h="menuitem",tabIndex:b,className:_}=r,A=(0,s.A)(r,x),w=i.useContext(f.A),k=i.useMemo((()=>({dense:d||w.dense||!1,disableGutters:g})),[w.dense,d,g]),D=i.useRef(null);(0,y.A)((()=>{l&&D.current&&D.current.focus()}),[l]);const C=(0,a.A)({},r,{dense:k.dense,divider:m,disableGutters:g}),O=(e=>{const{disabled:t,dense:r,divider:s,disableGutters:i,selected:n,classes:l}=e,u={root:["root",r&&"dense",t&&"disabled",!i&&"gutters",s&&"divider",n&&"selected"]},d=(0,o.A)(u,V,l);return(0,a.A)({},l,d)})(r),E=(0,v.A)(D,t);let T;return r.disabled||(T=void 0!==b?b:-1),(0,F.jsx)(f.A.Provider,{value:k,children:(0,F.jsx)(S,(0,a.A)({ref:E,role:h,tabIndex:T,component:u,focusVisibleClassName:(0,n.A)(O.focusVisible,p),className:(0,n.A)(O.root,_)},A,{ownerState:C,classes:O}))})}))},9449:(e,t,r)=>{r.d(t,{mN:()=>De,xI:()=>G});var s=r(9950),a=e=>"checkbox"===e.type,i=e=>e instanceof Date,n=e=>null==e;const o=e=>"object"===typeof e;var l=e=>!n(e)&&!Array.isArray(e)&&o(e)&&!i(e),u=e=>l(e)&&e.target?a(e.target)?e.target.checked:e.target.value:e,d=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),c=e=>{const t=e.constructor&&e.constructor.prototype;return l(t)&&t.hasOwnProperty("isPrototypeOf")},f="undefined"!==typeof window&&"undefined"!==typeof window.HTMLElement&&"undefined"!==typeof document;function m(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(f&&(e instanceof Blob||e instanceof FileList)||!r&&!l(e))return e;if(t=r?[]:{},r||c(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=m(e[r]));else t=e}return t}var y=e=>Array.isArray(e)?e.filter(Boolean):[],v=e=>void 0===e,g=(e,t,r)=>{if(!t||!l(e))return r;const s=y(t.split(/[,[\].]+?/)).reduce(((e,t)=>n(e)?e:e[t]),e);return v(s)||s===e?v(e[t])?r:e[t]:s},p=e=>"boolean"===typeof e;const h={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},b={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},_="max",V="min",A="maxLength",F="minLength",x="pattern",S="required",w="validate",k=s.createContext(null),D=()=>s.useContext(k);var C=function(e,t,r){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const a=i;return t._proxyFormState[a]!==b.all&&(t._proxyFormState[a]=!s||b.all),r&&(r[a]=!0),e[a]}});return a},O=e=>l(e)&&!Object.keys(e).length,E=(e,t,r,s)=>{r(e);const{name:a,...i}=e;return O(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!s||b.all)))},T=e=>Array.isArray(e)?e:[e],j=(e,t,r)=>!e||!t||e===t||T(e).some((e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e))));function B(e){const t=s.useRef(e);t.current=e,s.useEffect((()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}}),[e.disabled])}var N=e=>"string"===typeof e,U=(e,t,r,s,a)=>N(e)?(s&&t.watch.add(e),g(r,e,a)):Array.isArray(e)?e.map((e=>(s&&t.watch.add(e),g(r,e)))):(s&&(t.watchAll=!0),r);var L=e=>/^\w*$/.test(e),M=e=>y(e.replace(/["|']|\]/g,"").split(/\.|\[/)),R=(e,t,r)=>{let s=-1;const a=L(t)?[t]:M(t),i=a.length,n=i-1;for(;++s<i;){const t=a[s];let i=r;if(s!==n){const r=e[t];i=l(r)||Array.isArray(r)?r:isNaN(+a[s+1])?{}:[]}e[t]=i,e=e[t]}return e};function I(e){const t=D(),{name:r,disabled:a,control:i=t.control,shouldUnregister:n}=e,o=d(i._names.array,r),l=function(e){const t=D(),{control:r=t.control,name:a,defaultValue:i,disabled:n,exact:o}=e||{},l=s.useRef(a);l.current=a,B({disabled:n,subject:r._subjects.values,next:e=>{j(l.current,e.name,o)&&d(m(U(l.current,r._names,e.values||r._formValues,!1,i)))}});const[u,d]=s.useState(r._getWatch(a,i));return s.useEffect((()=>r._removeUnmounted())),u}({control:i,name:r,defaultValue:g(i._formValues,r,g(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=D(),{control:r=t.control,disabled:a,name:i,exact:n}=e||{},[o,l]=s.useState(r._formState),u=s.useRef(!0),d=s.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),c=s.useRef(i);return c.current=i,B({disabled:a,next:e=>u.current&&j(c.current,e.name,n)&&E(e,d.current,r._updateFormState)&&l({...r._formState,...e}),subject:r._subjects.state}),s.useEffect((()=>(u.current=!0,d.current.isValid&&r._updateValid(!0),()=>{u.current=!1})),[r]),C(o,r,d.current,!1)}({control:i,name:r}),f=s.useRef(i.register(r,{...e.rules,value:l,...p(e.disabled)?{disabled:e.disabled}:{}}));return s.useEffect((()=>{const e=i._options.shouldUnregister||n,t=(e,t)=>{const r=g(i._fields,e);r&&(r._f.mount=t)};if(t(r,!0),e){const e=m(g(i._options.defaultValues,r));R(i._defaultValues,r,e),v(g(i._formValues,r))&&R(i._formValues,r,e)}return()=>{(o?e&&!i._state.action:e)?i.unregister(r):t(r,!1)}}),[r,i,o,n]),s.useEffect((()=>{g(i._fields,r)&&i._updateDisabledField({disabled:a,fields:i._fields,name:r,value:g(i._fields,r)._f.value})}),[a,r,i]),{field:{name:r,value:l,...p(a)||c.disabled?{disabled:c.disabled||a}:{},onChange:s.useCallback((e=>f.current.onChange({target:{value:u(e),name:r},type:h.CHANGE})),[r]),onBlur:s.useCallback((()=>f.current.onBlur({target:{value:g(i._formValues,r),name:r},type:h.BLUR})),[r,i]),ref:e=>{const t=g(i._fields,r);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:()=>!!g(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!g(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!g(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!g(c.validatingFields,r)},error:{enumerable:!0,get:()=>g(c.errors,r)}})}}const G=e=>e.render(I(e));var P=(e,t,r,s,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:a||!0}}:{},H=e=>({isOnSubmit:!e||e===b.onSubmit,isOnBlur:e===b.onBlur,isOnChange:e===b.onChange,isOnAll:e===b.all,isOnTouch:e===b.onTouched}),q=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const W=(e,t,r,s)=>{for(const a of r||Object.keys(e)){const r=g(e,a);if(r){const{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!s)break;if(e.ref&&t(e.ref,e.name)&&!s)break;W(i,t)}else l(i)&&W(i,t)}}};var X=(e,t,r)=>{const s=y(g(e,r));return R(s,"root",t[r]),R(e,r,s),e},z=e=>"file"===e.type,$=e=>"function"===typeof e,J=e=>{if(!f)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},K=e=>N(e),Q=e=>"radio"===e.type,Y=e=>e instanceof RegExp;const Z={value:!1,isValid:!1},ee={value:!0,isValid:!0};var te=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&&!v(e[0].attributes.value)?v(e[0].value)||""===e[0].value?ee:{value:e[0].value,isValid:!0}:ee:Z}return Z};const re={isValid:!1,value:null};var se=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),re):re;function ae(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"validate";if(K(e)||Array.isArray(e)&&e.every(K)||p(e)&&!e)return{type:r,message:K(e)?e:"",ref:t}}var ie=e=>l(e)&&!Y(e)?e:{value:e,message:""},ne=async(e,t,r,s,i)=>{const{ref:o,refs:u,required:d,maxLength:c,minLength:f,min:m,max:y,pattern:h,validate:b,name:k,valueAsNumber:D,mount:C,disabled:E}=e._f,T=g(t,k);if(!C||E)return{};const j=u?u[0]:o,B=e=>{s&&j.reportValidity&&(j.setCustomValidity(p(e)?"":e||""),j.reportValidity())},U={},L=Q(o),M=a(o),R=L||M,I=(D||z(o))&&v(o.value)&&v(T)||J(o)&&""===o.value||""===T||Array.isArray(T)&&!T.length,G=P.bind(null,k,r,U),H=function(e,t,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:A,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:F;const i=e?t:r;U[k]={type:e?s:a,message:i,ref:o,...G(e?s:a,i)}};if(i?!Array.isArray(T)||!T.length:d&&(!R&&(I||n(T))||p(T)&&!T||M&&!te(u).isValid||L&&!se(u).isValid)){const{value:e,message:t}=K(d)?{value:!!d,message:d}:ie(d);if(e&&(U[k]={type:S,message:t,ref:j,...G(S,t)},!r))return B(t),U}if(!I&&(!n(m)||!n(y))){let e,t;const s=ie(y),a=ie(m);if(n(T)||isNaN(T)){const r=o.valueAsDate||new Date(T),i=e=>new Date((new Date).toDateString()+" "+e),n="time"==o.type,l="week"==o.type;N(s.value)&&T&&(e=n?i(T)>i(s.value):l?T>s.value:r>new Date(s.value)),N(a.value)&&T&&(t=n?i(T)<i(a.value):l?T<a.value:r<new Date(a.value))}else{const r=o.valueAsNumber||(T?+T:T);n(s.value)||(e=r>s.value),n(a.value)||(t=r<a.value)}if((e||t)&&(H(!!e,s.message,a.message,_,V),!r))return B(U[k].message),U}if((c||f)&&!I&&(N(T)||i&&Array.isArray(T))){const e=ie(c),t=ie(f),s=!n(e.value)&&T.length>+e.value,a=!n(t.value)&&T.length<+t.value;if((s||a)&&(H(s,e.message,t.message),!r))return B(U[k].message),U}if(h&&!I&&N(T)){const{value:e,message:t}=ie(h);if(Y(e)&&!T.match(e)&&(U[k]={type:x,message:t,ref:o,...G(x,t)},!r))return B(t),U}if(b)if($(b)){const e=ae(await b(T,t),j);if(e&&(U[k]={...e,...G(w,e.message)},!r))return B(e.message),U}else if(l(b)){let e={};for(const s in b){if(!O(e)&&!r)break;const a=ae(await b[s](T,t),j,s);a&&(e={...a,...G(s,a.message)},B(a.message),r&&(U[k]=e))}if(!O(e)&&(U[k]={ref:j,...e},!r))return U}return B(!0),U};function oe(e,t){const r=Array.isArray(t)?t:L(t)?[t]:M(t),s=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=v(e)?s++:e[t[s++]];return e}(e,r),a=r.length-1,i=r[a];return s&&delete s[i],0!==a&&(l(s)&&O(s)||Array.isArray(s)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!v(e[t]))return!1;return!0}(s))&&oe(e,r.slice(0,-1)),e}var le=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},ue=e=>n(e)||!o(e);function de(e,t){if(ue(e)||ue(t))return e===t;if(i(e)&&i(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(i(r)&&i(e)||l(r)&&l(e)||Array.isArray(r)&&Array.isArray(e)?!de(r,e):r!==e)return!1}}return!0}var ce=e=>"select-multiple"===e.type,fe=e=>Q(e)||a(e),me=e=>J(e)&&e.isConnected,ye=e=>{for(const t in e)if($(e[t]))return!0;return!1};function ve(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Array.isArray(e);if(l(e)||r)for(const s in e)Array.isArray(e[s])||l(e[s])&&!ye(e[s])?(t[s]=Array.isArray(e[s])?[]:{},ve(e[s],t[s])):n(e[s])||(t[s]=!0);return t}function ge(e,t,r){const s=Array.isArray(e);if(l(e)||s)for(const a in e)Array.isArray(e[a])||l(e[a])&&!ye(e[a])?v(t)||ue(r[a])?r[a]=Array.isArray(e[a])?ve(e[a],[]):{...ve(e[a])}:ge(e[a],n(t)?{}:t[a],r[a]):r[a]=!de(e[a],t[a]);return r}var pe=(e,t)=>ge(e,t,ve(t)),he=(e,t)=>{let{valueAsNumber:r,valueAsDate:s,setValueAs:a}=t;return v(e)?e:r?""===e?NaN:e?+e:e:s&&N(e)?new Date(e):a?a(e):e};function be(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return z(t)?t.files:Q(t)?se(e.refs).value:ce(t)?[...t.selectedOptions].map((e=>{let{value:t}=e;return t})):a(t)?te(e.refs).value:he(v(t.value)?e.ref.value:t.value,e)}var _e=(e,t,r,s)=>{const a={};for(const i of e){const e=g(t,i);e&&R(a,i,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:s}},Ve=e=>v(e)?e:Y(e)?e.source:l(e)?Y(e.value)?e.value.source:e.value:e,Ae=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Fe(e,t,r){const s=g(e,r);if(s||L(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),i=g(t,s),n=g(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(n&&n.type)return{name:s,error:n};a.pop()}return{name:r}}var xe=(e,t,r,s,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?s.isOnBlur:a.isOnBlur)?!e:!(r?s.isOnChange:a.isOnChange)||e),Se=(e,t)=>!y(g(e,t)).length&&oe(e,t);const we={mode:b.onSubmit,reValidateMode:b.onChange,shouldFocusError:!0};function ke(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={...we,...t},s={submitCount:0,isDirty:!1,isLoading:$(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},o={},c=(l(r.defaultValues)||l(r.values))&&m(r.defaultValues||r.values)||{},_=r.shouldUnregister?{}:m(c),V={action:!1,mount:!1,watch:!1},A={mount:new Set,unMount:new Set,array:new Set,watch:new Set},F=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},S={values:le(),array:le(),state:le()},w=H(r.mode),k=H(r.reValidateMode),D=r.criteriaMode===b.all,C=async e=>{if(x.isValid||e){const e=r.resolver?O((await M()).errors):await I(o,!0);e!==s.isValid&&S.state.next({isValid:e})}},E=(e,t)=>{(x.isValidating||x.validatingFields)&&((e||Array.from(A.mount)).forEach((e=>{e&&(t?R(s.validatingFields,e,t):oe(s.validatingFields,e))})),S.state.next({validatingFields:s.validatingFields,isValidating:!O(s.validatingFields)}))},j=(e,t,r,s)=>{const a=g(o,e);if(a){const i=g(_,e,v(r)?g(c,e):r);v(i)||s&&s.defaultChecked||t?R(_,e,t?i:be(a._f)):K(e,i),V.mount&&C()}},B=(e,t,r,a,i)=>{let n=!1,l=!1;const u={name:e},d=!(!g(o,e)||!g(o,e)._f.disabled);if(!r||a){x.isDirty&&(l=s.isDirty,s.isDirty=u.isDirty=G(),n=l!==u.isDirty);const r=d||de(g(c,e),t);l=!(d||!g(s.dirtyFields,e)),r||d?oe(s.dirtyFields,e):R(s.dirtyFields,e,!0),u.dirtyFields=s.dirtyFields,n=n||x.dirtyFields&&l!==!r}if(r){const t=g(s.touchedFields,e);t||(R(s.touchedFields,e,r),u.touchedFields=s.touchedFields,n=n||x.touchedFields&&t!==r)}return n&&i&&S.state.next(u),n?u:{}},L=(r,a,i,n)=>{const o=g(s.errors,r),l=x.isValid&&p(a)&&s.isValid!==a;var u;if(t.delayError&&i?(u=()=>((e,t)=>{R(s.errors,e,t),S.state.next({errors:s.errors})})(r,i),e=e=>{clearTimeout(F),F=setTimeout(u,e)},e(t.delayError)):(clearTimeout(F),e=null,i?R(s.errors,r,i):oe(s.errors,r)),(i?!de(o,i):o)||!O(n)||l){const e={...n,...l&&p(a)?{isValid:a}:{},errors:s.errors,name:r};s={...s,...e},S.state.next(e)}},M=async e=>{E(e,!0);const t=await r.resolver(_,r.context,_e(e||A.mount,o,r.criteriaMode,r.shouldUseNativeValidation));return E(e),t},I=async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{valid:!0};for(const i in e){const n=e[i];if(n){const{_f:e,...o}=n;if(e){const o=A.array.has(e.name);E([i],!0);const l=await ne(n,_,D,r.shouldUseNativeValidation&&!t,o);if(E([i]),l[e.name]&&(a.valid=!1,t))break;!t&&(g(l,e.name)?o?X(s.errors,l,e.name):R(s.errors,e.name,l[e.name]):oe(s.errors,e.name))}o&&await I(o,t,a)}}return a.valid},G=(e,t)=>(e&&t&&R(_,e,t),!de(re(),c)),P=(e,t,r)=>U(e,A,{...V.mount?_:v(t)?c:N(e)?{[e]:t}:t},r,t),K=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=g(o,e);let i=t;if(s){const r=s._f;r&&(!r.disabled&&R(_,e,he(t,r)),i=J(r.ref)&&n(t)?"":t,ce(r.ref)?[...r.ref.options].forEach((e=>e.selected=i.includes(e.value))):r.refs?a(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)):z(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||S.values.next({name:e,values:{..._}})))}(r.shouldDirty||r.shouldTouch)&&B(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&te(e)},Q=(e,t,r)=>{for(const s in t){const a=t[s],n="".concat(e,".").concat(s),l=g(o,n);!A.array.has(e)&&ue(a)&&(!l||l._f)||i(a)?K(n,a,r):Q(n,a,r)}},Y=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=g(o,e),i=A.array.has(e),l=m(t);R(_,e,l),i?(S.array.next({name:e,values:{..._}}),(x.isDirty||x.dirtyFields)&&r.shouldDirty&&S.state.next({name:e,dirtyFields:pe(c,_),isDirty:G(e,l)})):!a||a._f||n(l)?K(e,l,r):Q(e,l,r),q(e,A)&&S.state.next({...s}),S.values.next({name:V.mount?e:void 0,values:{..._}})},Z=async t=>{V.mount=!0;const a=t.target;let i=a.name,n=!0;const l=g(o,i),d=e=>{n=Number.isNaN(e)||e===g(_,i,e)};if(l){let c,f;const m=a.type?be(l._f):u(t),y=t.type===h.BLUR||t.type===h.FOCUS_OUT,v=!Ae(l._f)&&!r.resolver&&!g(s.errors,i)&&!l._f.deps||xe(y,g(s.touchedFields,i),s.isSubmitted,k,w),p=q(i,A,y);R(_,i,m),y?(l._f.onBlur&&l._f.onBlur(t),e&&e(0)):l._f.onChange&&l._f.onChange(t);const b=B(i,m,y,!1),V=!O(b)||p;if(!y&&S.values.next({name:i,type:t.type,values:{..._}}),v)return x.isValid&&C(),V&&S.state.next({name:i,...p?{}:b});if(!y&&p&&S.state.next({...s}),r.resolver){const{errors:e}=await M([i]);if(d(m),n){const t=Fe(s.errors,o,i),r=Fe(e,o,t.name||i);c=r.error,i=r.name,f=O(e)}}else E([i],!0),c=(await ne(l,_,D,r.shouldUseNativeValidation))[i],E([i]),d(m),n&&(c?f=!1:x.isValid&&(f=await I(o,!0)));n&&(l._f.deps&&te(l._f.deps),L(i,f,c,b))}},ee=(e,t)=>{if(g(s.errors,t)&&e.focus)return e.focus(),1},te=async function(e){let t,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=T(e);if(r.resolver){const r=await(async e=>{const{errors:t}=await M(e);if(e)for(const r of e){const e=g(t,r);e?R(s.errors,r,e):oe(s.errors,r)}else s.errors=t;return t})(v(e)?e:n);t=O(r),a=e?!n.some((e=>g(r,e))):t}else e?(a=(await Promise.all(n.map((async e=>{const t=g(o,e);return await I(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||s.isValid)&&C()):a=t=await I(o);return S.state.next({...!N(e)||x.isValid&&t!==s.isValid?{}:{name:e},...r.resolver||!e?{isValid:t}:{},errors:s.errors}),i.shouldFocus&&!a&&W(o,ee,e?n:A.mount),a},re=e=>{const t={...V.mount?_:c};return v(e)?t:N(e)?g(t,e):e.map((e=>g(t,e)))},se=(e,t)=>({invalid:!!g((t||s).errors,e),isDirty:!!g((t||s).dirtyFields,e),isTouched:!!g((t||s).touchedFields,e),isValidating:!!g((t||s).validatingFields,e),error:g((t||s).errors,e)}),ae=(e,t,r)=>{const a=(g(o,e,{_f:{}})._f||{}).ref;R(s.errors,e,{...t,ref:a}),S.state.next({name:e,errors:s.errors,isValid:!1}),r&&r.shouldFocus&&a&&a.focus&&a.focus()},ie=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(const a of e?T(e):A.mount)A.mount.delete(a),A.array.delete(a),t.keepValue||(oe(o,a),oe(_,a)),!t.keepError&&oe(s.errors,a),!t.keepDirty&&oe(s.dirtyFields,a),!t.keepTouched&&oe(s.touchedFields,a),!t.keepIsValidating&&oe(s.validatingFields,a),!r.shouldUnregister&&!t.keepDefaultValue&&oe(c,a);S.values.next({values:{..._}}),S.state.next({...s,...t.keepDirty?{isDirty:G()}:{}}),!t.keepIsValid&&C()},ye=e=>{let{disabled:t,name:r,field:s,fields:a,value:i}=e;if(p(t)){const e=t?void 0:v(i)?be(s?s._f:g(a,r)._f):i;R(_,r,e),B(r,e,!1,!1,!0)}},ve=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=g(o,e);const a=p(t.disabled);return R(o,e,{...s||{},_f:{...s&&s._f?s._f:{ref:{name:e}},name:e,mount:!0,...t}}),A.mount.add(e),s?ye({field:s,disabled:t.disabled,name:e,value:t.value}):j(e,!0,t.value),{...a?{disabled:t.disabled}:{},...r.progressive?{required:!!t.required,min:Ve(t.min),max:Ve(t.max),minLength:Ve(t.minLength),maxLength:Ve(t.maxLength),pattern:Ve(t.pattern)}:{},name:e,onChange:Z,onBlur:Z,ref:a=>{if(a){ve(e,t),s=g(o,e);const r=v(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,i=fe(r),n=s._f.refs||[];if(i?n.find((e=>e===r)):r===s._f.ref)return;R(o,e,{_f:{...s._f,...i?{refs:[...n.filter(me),r,...Array.isArray(g(c,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),j(e,!1,void 0,r)}else s=g(o,e,{}),s._f&&(s._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!d(A.array,e)||!V.action)&&A.unMount.add(e)}}},ge=()=>r.shouldFocusError&&W(o,ee,A.mount),ke=(e,t)=>async a=>{let i;a&&(a.preventDefault&&a.preventDefault(),a.persist&&a.persist());let n=m(_);if(S.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await M();s.errors=e,n=t}else await I(o);if(oe(s.errors,"root"),O(s.errors)){S.state.next({errors:{}});try{await e(n,a)}catch(l){i=l}}else t&&await t({...s.errors},a),ge(),setTimeout(ge);if(S.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:O(s.errors)&&!i,submitCount:s.submitCount+1,errors:s.errors}),i)throw i},De=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=e?m(e):c,i=m(a),n=O(e),l=n?c:i;if(r.keepDefaultValues||(c=a),!r.keepValues){if(r.keepDirtyValues)for(const e of A.mount)g(s.dirtyFields,e)?R(l,e,g(_,e)):Y(e,g(l,e));else{if(f&&v(e))for(const e of A.mount){const t=g(o,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(J(e)){const t=e.closest("form");if(t){t.reset();break}}}}o={}}_=t.shouldUnregister?r.keepDefaultValues?m(c):{}:m(l),S.array.next({values:{...l}}),S.values.next({values:{...l}})}A={mount:r.keepDirtyValues?A.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},V.mount=!x.isValid||!!r.keepIsValid||!!r.keepDirtyValues,V.watch=!!t.shouldUnregister,S.state.next({submitCount:r.keepSubmitCount?s.submitCount:0,isDirty:!n&&(r.keepDirty?s.isDirty:!(!r.keepDefaultValues||de(e,c))),isSubmitted:!!r.keepIsSubmitted&&s.isSubmitted,dirtyFields:n?[]:r.keepDirtyValues?r.keepDefaultValues&&_?pe(c,_):s.dirtyFields:r.keepDefaultValues&&e?pe(c,e):{},touchedFields:r.keepTouched?s.touchedFields:{},errors:r.keepErrors?s.errors:{},isSubmitSuccessful:!!r.keepIsSubmitSuccessful&&s.isSubmitSuccessful,isSubmitting:!1})},Ce=(e,t)=>De($(e)?e(_):e,t);return{control:{register:ve,unregister:ie,getFieldState:se,handleSubmit:ke,setError:ae,_executeSchema:M,_getWatch:P,_getDirty:G,_updateValid:C,_removeUnmounted:()=>{for(const e of A.unMount){const t=g(o,e);t&&(t._f.refs?t._f.refs.every((e=>!me(e))):!me(t._f.ref))&&ie(e)}A.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,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(a&&r){if(V.action=!0,n&&Array.isArray(g(o,e))){const t=r(g(o,e),a.argA,a.argB);i&&R(o,e,t)}if(n&&Array.isArray(g(s.errors,e))){const t=r(g(s.errors,e),a.argA,a.argB);i&&R(s.errors,e,t),Se(s.errors,e)}if(x.touchedFields&&n&&Array.isArray(g(s.touchedFields,e))){const t=r(g(s.touchedFields,e),a.argA,a.argB);i&&R(s.touchedFields,e,t)}x.dirtyFields&&(s.dirtyFields=pe(c,_)),S.state.next({name:e,isDirty:G(e,t),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else R(_,e,t)},_updateDisabledField:ye,_getFieldArray:e=>y(g(V.mount?_:c,e,t.shouldUnregister?g(c,e,[]):[])),_reset:De,_resetDefaultValues:()=>$(r.defaultValues)&&r.defaultValues().then((e=>{Ce(e,r.resetOptions),S.state.next({isLoading:!1})})),_updateFormState:e=>{s={...s,...e}},_disableForm:e=>{p(e)&&(S.state.next({disabled:e}),W(o,((t,r)=>{let s=e;const a=g(o,r);a&&p(a._f.disabled)&&(s||(s=a._f.disabled)),t.disabled=s}),0,!1))},_subjects:S,_proxyFormState:x,_setErrors:e=>{s.errors=e,S.state.next({errors:s.errors,isValid:!1})},get _fields(){return o},get _formValues(){return _},get _state(){return V},set _state(e){V=e},get _defaultValues(){return c},get _names(){return A},set _names(e){A=e},get _formState(){return s},set _formState(e){s=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:te,register:ve,handleSubmit:ke,watch:(e,t)=>$(e)?S.values.subscribe({next:r=>e(P(void 0,t),r)}):P(e,t,!0),setValue:Y,getValues:re,reset:Ce,resetField:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(o,e)&&(v(t.defaultValue)?Y(e,m(g(c,e))):(Y(e,t.defaultValue),R(c,e,m(t.defaultValue))),t.keepTouched||oe(s.touchedFields,e),t.keepDirty||(oe(s.dirtyFields,e),s.isDirty=t.defaultValue?G(e,m(g(c,e))):G()),t.keepError||(oe(s.errors,e),x.isValid&&C()),S.state.next({...s}))},clearErrors:e=>{e&&T(e).forEach((e=>oe(s.errors,e))),S.state.next({errors:e?s.errors:{}})},unregister:ie,setError:ae,setFocus:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=g(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:se}}function De(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=s.useRef(),r=s.useRef(),[a,i]=s.useState({isDirty:!1,isValidating:!1,isLoading:$(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:$(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...ke(e),formState:a});const n=t.current.control;return n._options=e,B({subject:n._subjects.state,next:e=>{E(e,n._proxyFormState,n._updateFormState,!0)&&i({...n._formState})}}),s.useEffect((()=>n._disableForm(e.disabled)),[n,e.disabled]),s.useEffect((()=>{if(n._proxyFormState.isDirty){const e=n._getDirty();e!==a.isDirty&&n._subjects.state.next({isDirty:e})}}),[n,a.isDirty]),s.useEffect((()=>{e.values&&!de(e.values,r.current)?(n._reset(e.values,n._options.resetOptions),r.current=e.values,i((e=>({...e})))):n._resetDefaultValues()}),[e.values,n]),s.useEffect((()=>{e.errors&&n._setErrors(e.errors)}),[e.errors,n]),s.useEffect((()=>{n._state.mount||(n._updateValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()})),s.useEffect((()=>{e.shouldUnregister&&n._subjects.values.next({values:n._getWatch()})}),[e.shouldUnregister,n]),t.current.formState=C(a,n),t.current}}}]);