finform-react-builder 1.5.7 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +3 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";var pa=e=>{throw TypeError(e)};var Xn=(e,t,r)=>t.has(e)||pa("Cannot "+r);var v=(e,t,r)=>(Xn(e,t,"read from private field"),r?r.call(e):t.get(e)),oe=(e,t,r)=>t.has(e)?pa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),X=(e,t,r,n)=>(Xn(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),me=(e,t,r)=>(Xn(e,t,"access private method"),r);var un=(e,t,r,n)=>({set _(i){X(e,t,i,r)},get _(){return v(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react/jsx-runtime"),M=require("react"),P=require("@mui/material"),pl=require("@emotion/styled");require("@emotion/react");function fl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ae=fl(M);var tn=e=>e.type==="checkbox",Qt=e=>e instanceof Date,Be=e=>e==null;const Bs=e=>typeof e=="object";var je=e=>!Be(e)&&!Array.isArray(e)&&Bs(e)&&!Qt(e),Ls=e=>je(e)&&e.target?tn(e.target)?e.target.checked:e.target.value:e,ml=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,qs=(e,t)=>e.has(ml(t)),hl=e=>{const t=e.constructor&&e.constructor.prototype;return je(t)&&t.hasOwnProperty("isPrototypeOf")},qi=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ie(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(qi&&(e instanceof Blob||n))&&(r||je(e)))if(t=r?[]:{},!r&&!hl(e))t=e;else for(const i in e)e.hasOwnProperty(i)&&(t[i]=Ie(e[i]));else return e;return t}var Bn=e=>/^\w*$/.test(e),Fe=e=>e===void 0,Ui=e=>Array.isArray(e)?e.filter(Boolean):[],Wi=e=>Ui(e.replace(/["|']|\]/g,"").split(/\.|\[/)),q=(e,t,r)=>{if(!t||!je(e))return r;const n=(Bn(t)?[t]:Wi(t)).reduce((i,a)=>Be(i)?i:i[a],e);return Fe(n)||n===e?Fe(e[t])?r:e[t]:n},Ke=e=>typeof e=="boolean",ve=(e,t,r)=>{let n=-1;const i=Bn(t)?[t]:Wi(t),a=i.length,s=a-1;for(;++n<a;){const o=i[n];let l=r;if(n!==s){const p=e[o];l=je(p)||Array.isArray(p)?p:isNaN(+i[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=l,e=e[o]}};const On={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},at={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},gt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Us=M.createContext(null);Us.displayName="HookFormContext";const Hi=()=>M.useContext(Us);var Ws=(e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(i,a,{get:()=>{const s=a;return t._proxyFormState[s]!==at.all&&(t._proxyFormState[s]=!n||at.all),r&&(r[s]=!0),e[s]}});return i};const Ki=typeof window<"u"?Ae.useLayoutEffect:Ae.useEffect;function gl(e){const t=Hi(),{control:r=t.control,disabled:n,name:i,exact:a}=e||{},[s,o]=M.useState(r._formState),l=M.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ki(()=>r._subscribe({name:i,formState:l.current,exact:a,callback:p=>{!n&&o({...r._formState,...p})}}),[i,n,a]),M.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),M.useMemo(()=>Ws(s,r,l.current,!1),[s,r])}var ht=e=>typeof e=="string",Hs=(e,t,r,n,i)=>ht(e)?(n&&t.watch.add(e),q(r,e,i)):Array.isArray(e)?e.map(a=>(n&&t.watch.add(a),q(r,a))):(n&&(t.watchAll=!0),r);function yl(e){const t=Hi(),{control:r=t.control,name:n,defaultValue:i,disabled:a,exact:s}=e||{},o=M.useRef(i),[l,p]=M.useState(r._getWatch(n,o.current));return Ki(()=>r._subscribe({name:n,formState:{values:!0},exact:s,callback:d=>!a&&p(Hs(n,r._names,d.values||r._formValues,!1,o.current))}),[n,r,a,s]),M.useEffect(()=>r._removeUnmounted()),l}function vl(e){const t=Hi(),{name:r,disabled:n,control:i=t.control,shouldUnregister:a}=e,s=qs(i._names.array,r),o=yl({control:i,name:r,defaultValue:q(i._formValues,r,q(i._defaultValues,r,e.defaultValue)),exact:!0}),l=gl({control:i,name:r,exact:!0}),p=M.useRef(e),d=M.useRef(i.register(r,{...e.rules,value:o,...Ke(e.disabled)?{disabled:e.disabled}:{}})),f=M.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!q(l.errors,r)},isDirty:{enumerable:!0,get:()=>!!q(l.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!q(l.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!q(l.validatingFields,r)},error:{enumerable:!0,get:()=>q(l.errors,r)}}),[l,r]),m=M.useCallback(b=>d.current.onChange({target:{value:Ls(b),name:r},type:On.CHANGE}),[r]),x=M.useCallback(()=>d.current.onBlur({target:{value:q(i._formValues,r),name:r},type:On.BLUR}),[r,i._formValues]),g=M.useCallback(b=>{const y=q(i._fields,r);y&&b&&(y._f.ref={focus:()=>b.focus&&b.focus(),select:()=>b.select&&b.select(),setCustomValidity:T=>b.setCustomValidity(T),reportValidity:()=>b.reportValidity()})},[i._fields,r]),c=M.useMemo(()=>({name:r,value:o,...Ke(n)||l.disabled?{disabled:l.disabled||n}:{},onChange:m,onBlur:x,ref:g}),[r,n,l.disabled,m,x,g,o]);return M.useEffect(()=>{const b=i._options.shouldUnregister||a;i.register(r,{...p.current.rules,...Ke(p.current.disabled)?{disabled:p.current.disabled}:{}});const y=(T,j)=>{const A=q(i._fields,T);A&&A._f&&(A._f.mount=j)};if(y(r,!0),b){const T=Ie(q(i._options.defaultValues,r));ve(i._defaultValues,r,T),Fe(q(i._formValues,r))&&ve(i._formValues,r,T)}return!s&&i.register(r),()=>{(s?b&&!i._state.action:b)?i.unregister(r):y(r,!1)}},[r,i,s,a]),M.useEffect(()=>{i._setDisabledField({disabled:n,name:r})},[n,r,i]),M.useMemo(()=>({field:c,formState:l,fieldState:f}),[c,l,f])}const lt=e=>e.render(vl(e));var Ks=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},Ur=e=>Array.isArray(e)?e:[e],fa=()=>{let e=[];return{get observers(){return e},next:i=>{for(const a of e)a.next&&a.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(a=>a!==i)}}),unsubscribe:()=>{e=[]}}},yi=e=>Be(e)||!Bs(e);function _t(e,t){if(yi(e)||yi(t))return e===t;if(Qt(e)&&Qt(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r){const a=e[i];if(!n.includes(i))return!1;if(i!=="ref"){const s=t[i];if(Qt(a)&&Qt(s)||je(a)&&je(s)||Array.isArray(a)&&Array.isArray(s)?!_t(a,s):a!==s)return!1}}return!0}var Ue=e=>je(e)&&!Object.keys(e).length,Qi=e=>e.type==="file",st=e=>typeof e=="function",Tn=e=>{if(!qi)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Qs=e=>e.type==="select-multiple",Gi=e=>e.type==="radio",xl=e=>Gi(e)||tn(e),ei=e=>Tn(e)&&e.isConnected;function bl(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Fe(e)?n++:e[t[n++]];return e}function wl(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fe(e[t]))return!1;return!0}function De(e,t){const r=Array.isArray(t)?t:Bn(t)?[t]:Wi(t),n=r.length===1?e:bl(e,r),i=r.length-1,a=r[i];return n&&delete n[a],i!==0&&(je(n)&&Ue(n)||Array.isArray(n)&&wl(n))&&De(e,r.slice(0,-1)),e}var Gs=e=>{for(const t in e)if(st(e[t]))return!0;return!1};function Cn(e,t={}){const r=Array.isArray(e);if(je(e)||r)for(const n in e)Array.isArray(e[n])||je(e[n])&&!Gs(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Cn(e[n],t[n])):Be(e[n])||(t[n]=!0);return t}function Ys(e,t,r){const n=Array.isArray(e);if(je(e)||n)for(const i in e)Array.isArray(e[i])||je(e[i])&&!Gs(e[i])?Fe(t)||yi(r[i])?r[i]=Array.isArray(e[i])?Cn(e[i],[]):{...Cn(e[i])}:Ys(e[i],Be(t)?{}:t[i],r[i]):r[i]=!_t(e[i],t[i]);return r}var Mr=(e,t)=>Ys(e,t,Cn(t));const ma={value:!1,isValid:!1},ha={value:!0,isValid:!0};var Zs=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Fe(e[0].attributes.value)?Fe(e[0].value)||e[0].value===""?ha:{value:e[0].value,isValid:!0}:ha:ma}return ma},Js=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Fe(e)?e:t?e===""?NaN:e&&+e:r&&ht(e)?new Date(e):n?n(e):e;const ga={isValid:!1,value:null};var Xs=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,ga):ga;function ya(e){const t=e.ref;return Qi(t)?t.files:Gi(t)?Xs(e.refs).value:Qs(t)?[...t.selectedOptions].map(({value:r})=>r):tn(t)?Zs(e.refs).value:Js(Fe(t.value)?e.ref.value:t.value,e)}var Sl=(e,t,r,n)=>{const i={};for(const a of e){const s=q(t,a);s&&ve(i,a,s._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}},_n=e=>e instanceof RegExp,zr=e=>Fe(e)?e:_n(e)?e.source:je(e)?_n(e.value)?e.value.source:e.value:e,va=e=>({isOnSubmit:!e||e===at.onSubmit,isOnBlur:e===at.onBlur,isOnChange:e===at.onChange,isOnAll:e===at.all,isOnTouch:e===at.onTouched});const xa="AsyncFunction";var El=e=>!!e&&!!e.validate&&!!(st(e.validate)&&e.validate.constructor.name===xa||je(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===xa)),kl=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ba=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Wr=(e,t,r,n)=>{for(const i of r||Object.keys(e)){const a=q(e,i);if(a){const{_f:s,...o}=a;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],i)&&!n)return!0;if(s.ref&&t(s.ref,s.name)&&!n)return!0;if(Wr(o,t))break}else if(je(o)&&Wr(o,t))break}}};function wa(e,t,r){const n=q(e,r);if(n||Bn(r))return{error:n,name:r};const i=r.split(".");for(;i.length;){const a=i.join("."),s=q(t,a),o=q(e,a);if(s&&!Array.isArray(s)&&r!==a)return{name:r};if(o&&o.type)return{name:a,error:o};if(o&&o.root&&o.root.type)return{name:`${a}.root`,error:o.root};i.pop()}return{name:r}}var Ol=(e,t,r,n)=>{r(e);const{name:i,...a}=e;return Ue(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(s=>t[s]===(!n||at.all))},Tl=(e,t,r)=>!e||!t||e===t||Ur(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),Cl=(e,t,r,n,i)=>i.isOnAll?!1:!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:(r?n.isOnChange:i.isOnChange)?e:!0,_l=(e,t)=>!Ui(q(e,t)).length&&De(e,t),Al=(e,t,r)=>{const n=Ur(q(e,r));return ve(n,"root",t[r]),ve(e,r,n),e},wn=e=>ht(e);function Sa(e,t,r="validate"){if(wn(e)||Array.isArray(e)&&e.every(wn)||Ke(e)&&!e)return{type:r,message:wn(e)?e:"",ref:t}}var dr=e=>je(e)&&!_n(e)?e:{value:e,message:""},Ea=async(e,t,r,n,i,a)=>{const{ref:s,refs:o,required:l,maxLength:p,minLength:d,min:f,max:m,pattern:x,validate:g,name:c,valueAsNumber:b,mount:y}=e._f,T=q(r,c);if(!y||t.has(c))return{};const j=o?o[0]:s,A=O=>{i&&j.reportValidity&&(j.setCustomValidity(Ke(O)?"":O||""),j.reportValidity())},w={},N=Gi(s),Q=tn(s),ne=N||Q,G=(b||Qi(s))&&Fe(s.value)&&Fe(T)||Tn(s)&&s.value===""||T===""||Array.isArray(T)&&!T.length,u=Ks.bind(null,c,n,w),F=(O,I,V,B=gt.maxLength,K=gt.minLength)=>{const le=O?I:V;w[c]={type:O?B:K,message:le,ref:s,...u(O?B:K,le)}};if(a?!Array.isArray(T)||!T.length:l&&(!ne&&(G||Be(T))||Ke(T)&&!T||Q&&!Zs(o).isValid||N&&!Xs(o).isValid)){const{value:O,message:I}=wn(l)?{value:!!l,message:l}:dr(l);if(O&&(w[c]={type:gt.required,message:I,ref:j,...u(gt.required,I)},!n))return A(I),w}if(!G&&(!Be(f)||!Be(m))){let O,I;const V=dr(m),B=dr(f);if(!Be(T)&&!isNaN(T)){const K=s.valueAsNumber||T&&+T;Be(V.value)||(O=K>V.value),Be(B.value)||(I=K<B.value)}else{const K=s.valueAsDate||new Date(T),le=z=>new Date(new Date().toDateString()+" "+z),fe=s.type=="time",de=s.type=="week";ht(V.value)&&T&&(O=fe?le(T)>le(V.value):de?T>V.value:K>new Date(V.value)),ht(B.value)&&T&&(I=fe?le(T)<le(B.value):de?T<B.value:K<new Date(B.value))}if((O||I)&&(F(!!O,V.message,B.message,gt.max,gt.min),!n))return A(w[c].message),w}if((p||d)&&!G&&(ht(T)||a&&Array.isArray(T))){const O=dr(p),I=dr(d),V=!Be(O.value)&&T.length>+O.value,B=!Be(I.value)&&T.length<+I.value;if((V||B)&&(F(V,O.message,I.message),!n))return A(w[c].message),w}if(x&&!G&&ht(T)){const{value:O,message:I}=dr(x);if(_n(O)&&!T.match(O)&&(w[c]={type:gt.pattern,message:I,ref:s,...u(gt.pattern,I)},!n))return A(I),w}if(g){if(st(g)){const O=await g(T,r),I=Sa(O,j);if(I&&(w[c]={...I,...u(gt.validate,I.message)},!n))return A(I.message),w}else if(je(g)){let O={};for(const I in g){if(!Ue(O)&&!n)break;const V=Sa(await g[I](T,r),j,I);V&&(O={...V,...u(I,V.message)},A(V.message),n&&(w[c]=O))}if(!Ue(O)&&(w[c]={ref:j,...O},!n))return w}}return A(!0),w};const Fl={mode:at.onSubmit,reValidateMode:at.onChange,shouldFocusError:!0};function jl(e={}){let t={...Fl,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:st(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const n={};let i=je(t.defaultValues)||je(t.values)?Ie(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:Ie(i),s={action:!1,mount:!1,watch:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,p=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...d};const m={array:fa(),state:fa()},x=t.criteriaMode===at.all,g=h=>S=>{clearTimeout(p),p=setTimeout(h,S)},c=async h=>{if(!t.disabled&&(d.isValid||f.isValid||h)){const S=t.resolver?Ue((await Q()).errors):await G(n,!0);S!==r.isValid&&m.state.next({isValid:S})}},b=(h,S)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((h||Array.from(o.mount)).forEach($=>{$&&(S?ve(r.validatingFields,$,S):De(r.validatingFields,$))}),m.state.next({validatingFields:r.validatingFields,isValidating:!Ue(r.validatingFields)}))},y=(h,S=[],$,Z,E=!0,C=!0)=>{if(Z&&$&&!t.disabled){if(s.action=!0,C&&Array.isArray(q(n,h))){const U=$(q(n,h),Z.argA,Z.argB);E&&ve(n,h,U)}if(C&&Array.isArray(q(r.errors,h))){const U=$(q(r.errors,h),Z.argA,Z.argB);E&&ve(r.errors,h,U),_l(r.errors,h)}if((d.touchedFields||f.touchedFields)&&C&&Array.isArray(q(r.touchedFields,h))){const U=$(q(r.touchedFields,h),Z.argA,Z.argB);E&&ve(r.touchedFields,h,U)}(d.dirtyFields||f.dirtyFields)&&(r.dirtyFields=Mr(i,a)),m.state.next({name:h,isDirty:F(h,S),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ve(a,h,S)},T=(h,S)=>{ve(r.errors,h,S),m.state.next({errors:r.errors})},j=h=>{r.errors=h,m.state.next({errors:r.errors,isValid:!1})},A=(h,S,$,Z)=>{const E=q(n,h);if(E){const C=q(a,h,Fe($)?q(i,h):$);Fe(C)||Z&&Z.defaultChecked||S?ve(a,h,S?C:ya(E._f)):V(h,C),s.mount&&c()}},w=(h,S,$,Z,E)=>{let C=!1,U=!1;const se={name:h};if(!t.disabled){if(!$||Z){(d.isDirty||f.isDirty)&&(U=r.isDirty,r.isDirty=se.isDirty=F(),C=U!==se.isDirty);const ue=_t(q(i,h),S);U=!!q(r.dirtyFields,h),ue?De(r.dirtyFields,h):ve(r.dirtyFields,h,!0),se.dirtyFields=r.dirtyFields,C=C||(d.dirtyFields||f.dirtyFields)&&U!==!ue}if($){const ue=q(r.touchedFields,h);ue||(ve(r.touchedFields,h,$),se.touchedFields=r.touchedFields,C=C||(d.touchedFields||f.touchedFields)&&ue!==$)}C&&E&&m.state.next(se)}return C?se:{}},N=(h,S,$,Z)=>{const E=q(r.errors,h),C=(d.isValid||f.isValid)&&Ke(S)&&r.isValid!==S;if(t.delayError&&$?(l=g(()=>T(h,$)),l(t.delayError)):(clearTimeout(p),l=null,$?ve(r.errors,h,$):De(r.errors,h)),($?!_t(E,$):E)||!Ue(Z)||C){const U={...Z,...C&&Ke(S)?{isValid:S}:{},errors:r.errors,name:h};r={...r,...U},m.state.next(U)}},Q=async h=>{b(h,!0);const S=await t.resolver(a,t.context,Sl(h||o.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return b(h),S},ne=async h=>{const{errors:S}=await Q(h);if(h)for(const $ of h){const Z=q(S,$);Z?ve(r.errors,$,Z):De(r.errors,$)}else r.errors=S;return S},G=async(h,S,$={valid:!0})=>{for(const Z in h){const E=h[Z];if(E){const{_f:C,...U}=E;if(C){const se=o.array.has(C.name),ue=E._f&&El(E._f);ue&&d.validatingFields&&b([Z],!0);const Pe=await Ea(E,o.disabled,a,x,t.shouldUseNativeValidation&&!S,se);if(ue&&d.validatingFields&&b([Z]),Pe[C.name]&&($.valid=!1,S))break;!S&&(q(Pe,C.name)?se?Al(r.errors,Pe,C.name):ve(r.errors,C.name,Pe[C.name]):De(r.errors,C.name))}!Ue(U)&&await G(U,S,$)}}return $.valid},u=()=>{for(const h of o.unMount){const S=q(n,h);S&&(S._f.refs?S._f.refs.every($=>!ei($)):!ei(S._f.ref))&&ee(h)}o.unMount=new Set},F=(h,S)=>!t.disabled&&(h&&S&&ve(a,h,S),!_t(z(),i)),O=(h,S,$)=>Hs(h,o,{...s.mount?a:Fe(S)?i:ht(h)?{[h]:S}:S},$,S),I=h=>Ui(q(s.mount?a:i,h,t.shouldUnregister?q(i,h,[]):[])),V=(h,S,$={})=>{const Z=q(n,h);let E=S;if(Z){const C=Z._f;C&&(!C.disabled&&ve(a,h,Js(S,C)),E=Tn(C.ref)&&Be(S)?"":S,Qs(C.ref)?[...C.ref.options].forEach(U=>U.selected=E.includes(U.value)):C.refs?tn(C.ref)?C.refs.forEach(U=>{(!U.defaultChecked||!U.disabled)&&(Array.isArray(E)?U.checked=!!E.find(se=>se===U.value):U.checked=E===U.value||!!E)}):C.refs.forEach(U=>U.checked=U.value===E):Qi(C.ref)?C.ref.value="":(C.ref.value=E,C.ref.type||m.state.next({name:h,values:Ie(a)})))}($.shouldDirty||$.shouldTouch)&&w(h,E,$.shouldTouch,$.shouldDirty,!0),$.shouldValidate&&de(h)},B=(h,S,$)=>{for(const Z in S){if(!S.hasOwnProperty(Z))return;const E=S[Z],C=h+"."+Z,U=q(n,C);(o.array.has(h)||je(E)||U&&!U._f)&&!Qt(E)?B(C,E,$):V(C,E,$)}},K=(h,S,$={})=>{const Z=q(n,h),E=o.array.has(h),C=Ie(S);ve(a,h,C),E?(m.array.next({name:h,values:Ie(a)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&$.shouldDirty&&m.state.next({name:h,dirtyFields:Mr(i,a),isDirty:F(h,C)})):Z&&!Z._f&&!Be(C)?B(h,C,$):V(h,C,$),ba(h,o)&&m.state.next({...r}),m.state.next({name:s.mount?h:void 0,values:Ie(a)})},le=async h=>{s.mount=!0;const S=h.target;let $=S.name,Z=!0;const E=q(n,$),C=ue=>{Z=Number.isNaN(ue)||Qt(ue)&&isNaN(ue.getTime())||_t(ue,q(a,$,ue))},U=va(t.mode),se=va(t.reValidateMode);if(E){let ue,Pe;const rt=S.type?ya(E._f):Ls(h),Ze=h.type===On.BLUR||h.type===On.FOCUS_OUT,Rr=!kl(E._f)&&!t.resolver&&!q(r.errors,$)&&!E._f.deps||Cl(Ze,q(r.touchedFields,$),r.isSubmitted,se,U),Ut=ba($,o,Ze);ve(a,$,rt),Ze?(E._f.onBlur&&E._f.onBlur(h),l&&l(0)):E._f.onChange&&E._f.onChange(h);const Ot=w($,rt,Ze),Pr=!Ue(Ot)||Ut;if(!Ze&&m.state.next({name:$,type:h.type,values:Ie(a)}),Rr)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?Ze&&c():Ze||c()),Pr&&m.state.next({name:$,...Ut?{}:Ot});if(!Ze&&Ut&&m.state.next({...r}),t.resolver){const{errors:cr}=await Q([$]);if(C(rt),Z){const Ir=wa(r.errors,n,$),ur=wa(cr,n,Ir.name||$);ue=ur.error,$=ur.name,Pe=Ue(cr)}}else b([$],!0),ue=(await Ea(E,o.disabled,a,x,t.shouldUseNativeValidation))[$],b([$]),C(rt),Z&&(ue?Pe=!1:(d.isValid||f.isValid)&&(Pe=await G(n,!0)));Z&&(E._f.deps&&de(E._f.deps),N($,Pe,ue,Ot))}},fe=(h,S)=>{if(q(r.errors,S)&&h.focus)return h.focus(),1},de=async(h,S={})=>{let $,Z;const E=Ur(h);if(t.resolver){const C=await ne(Fe(h)?h:E);$=Ue(C),Z=h?!E.some(U=>q(C,U)):$}else h?(Z=(await Promise.all(E.map(async C=>{const U=q(n,C);return await G(U&&U._f?{[C]:U}:U)}))).every(Boolean),!(!Z&&!r.isValid)&&c()):Z=$=await G(n);return m.state.next({...!ht(h)||(d.isValid||f.isValid)&&$!==r.isValid?{}:{name:h},...t.resolver||!h?{isValid:$}:{},errors:r.errors}),S.shouldFocus&&!Z&&Wr(n,fe,h?E:o.mount),Z},z=h=>{const S={...s.mount?a:i};return Fe(h)?S:ht(h)?q(S,h):h.map($=>q(S,$))},W=(h,S)=>({invalid:!!q((S||r).errors,h),isDirty:!!q((S||r).dirtyFields,h),error:q((S||r).errors,h),isValidating:!!q(r.validatingFields,h),isTouched:!!q((S||r).touchedFields,h)}),L=h=>{h&&Ur(h).forEach(S=>De(r.errors,S)),m.state.next({errors:h?r.errors:{}})},Y=(h,S,$)=>{const Z=(q(n,h,{_f:{}})._f||{}).ref,E=q(r.errors,h)||{},{ref:C,message:U,type:se,...ue}=E;ve(r.errors,h,{...ue,...S,ref:Z}),m.state.next({name:h,errors:r.errors,isValid:!1}),$&&$.shouldFocus&&Z&&Z.focus&&Z.focus()},J=(h,S)=>st(h)?m.state.subscribe({next:$=>h(O(void 0,S),$)}):O(h,S,!0),ae=h=>m.state.subscribe({next:S=>{Tl(h.name,S.name,h.exact)&&Ol(S,h.formState||d,kt,h.reRenderRoot)&&h.callback({values:{...a},...r,...S})}}).unsubscribe,ie=h=>(s.mount=!0,f={...f,...h.formState},ae({...h,formState:f})),ee=(h,S={})=>{for(const $ of h?Ur(h):o.mount)o.mount.delete($),o.array.delete($),S.keepValue||(De(n,$),De(a,$)),!S.keepError&&De(r.errors,$),!S.keepDirty&&De(r.dirtyFields,$),!S.keepTouched&&De(r.touchedFields,$),!S.keepIsValidating&&De(r.validatingFields,$),!t.shouldUnregister&&!S.keepDefaultValue&&De(i,$);m.state.next({values:Ie(a)}),m.state.next({...r,...S.keepDirty?{isDirty:F()}:{}}),!S.keepIsValid&&c()},ce=({disabled:h,name:S})=>{(Ke(h)&&s.mount||h||o.disabled.has(S))&&(h?o.disabled.add(S):o.disabled.delete(S))},R=(h,S={})=>{let $=q(n,h);const Z=Ke(S.disabled)||Ke(t.disabled);return ve(n,h,{...$||{},_f:{...$&&$._f?$._f:{ref:{name:h}},name:h,mount:!0,...S}}),o.mount.add(h),$?ce({disabled:Ke(S.disabled)?S.disabled:t.disabled,name:h}):A(h,!0,S.value),{...Z?{disabled:S.disabled||t.disabled}:{},...t.progressive?{required:!!S.required,min:zr(S.min),max:zr(S.max),minLength:zr(S.minLength),maxLength:zr(S.maxLength),pattern:zr(S.pattern)}:{},name:h,onChange:le,onBlur:le,ref:E=>{if(E){R(h,S),$=q(n,h);const C=Fe(E.value)&&E.querySelectorAll&&E.querySelectorAll("input,select,textarea")[0]||E,U=xl(C),se=$._f.refs||[];if(U?se.find(ue=>ue===C):C===$._f.ref)return;ve(n,h,{_f:{...$._f,...U?{refs:[...se.filter(ei),C,...Array.isArray(q(i,h))?[{}]:[]],ref:{type:C.type,name:h}}:{ref:C}}}),A(h,!1,void 0,C)}else $=q(n,h,{}),$._f&&($._f.mount=!1),(t.shouldUnregister||S.shouldUnregister)&&!(qs(o.array,h)&&s.action)&&o.unMount.add(h)}}},H=()=>t.shouldFocusError&&Wr(n,fe,o.mount),te=h=>{Ke(h)&&(m.state.next({disabled:h}),Wr(n,(S,$)=>{const Z=q(n,$);Z&&(S.disabled=Z._f.disabled||h,Array.isArray(Z._f.refs)&&Z._f.refs.forEach(E=>{E.disabled=Z._f.disabled||h}))},0,!1))},D=(h,S)=>async $=>{let Z;$&&($.preventDefault&&$.preventDefault(),$.persist&&$.persist());let E=Ie(a);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:C,values:U}=await Q();r.errors=C,E=U}else await G(n);if(o.disabled.size)for(const C of o.disabled)ve(E,C,void 0);if(De(r.errors,"root"),Ue(r.errors)){m.state.next({errors:{}});try{await h(E,$)}catch(C){Z=C}}else S&&await S({...r.errors},$),H(),setTimeout(H);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ue(r.errors)&&!Z,submitCount:r.submitCount+1,errors:r.errors}),Z)throw Z},pe=(h,S={})=>{q(n,h)&&(Fe(S.defaultValue)?K(h,Ie(q(i,h))):(K(h,S.defaultValue),ve(i,h,Ie(S.defaultValue))),S.keepTouched||De(r.touchedFields,h),S.keepDirty||(De(r.dirtyFields,h),r.isDirty=S.defaultValue?F(h,Ie(q(i,h))):F()),S.keepError||(De(r.errors,h),d.isValid&&c()),m.state.next({...r}))},Re=(h,S={})=>{const $=h?Ie(h):i,Z=Ie($),E=Ue(h),C=E?i:Z;if(S.keepDefaultValues||(i=$),!S.keepValues){if(S.keepDirtyValues){const U=new Set([...o.mount,...Object.keys(Mr(i,a))]);for(const se of Array.from(U))q(r.dirtyFields,se)?ve(C,se,q(a,se)):K(se,q(C,se))}else{if(qi&&Fe(h))for(const U of o.mount){const se=q(n,U);if(se&&se._f){const ue=Array.isArray(se._f.refs)?se._f.refs[0]:se._f.ref;if(Tn(ue)){const Pe=ue.closest("form");if(Pe){Pe.reset();break}}}}for(const U of o.mount)K(U,q(C,U))}a=Ie(C),m.array.next({values:{...C}}),m.state.next({values:{...C}})}o={mount:S.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!S.keepIsValid||!!S.keepDirtyValues,s.watch=!!t.shouldUnregister,m.state.next({submitCount:S.keepSubmitCount?r.submitCount:0,isDirty:E?!1:S.keepDirty?r.isDirty:!!(S.keepDefaultValues&&!_t(h,i)),isSubmitted:S.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:E?{}:S.keepDirtyValues?S.keepDefaultValues&&a?Mr(i,a):r.dirtyFields:S.keepDefaultValues&&h?Mr(i,h):S.keepDirty?r.dirtyFields:{},touchedFields:S.keepTouched?r.touchedFields:{},errors:S.keepErrors?r.errors:{},isSubmitSuccessful:S.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Et=(h,S)=>Re(st(h)?h(a):h,S),ln=(h,S={})=>{const $=q(n,h),Z=$&&$._f;if(Z){const E=Z.refs?Z.refs[0]:Z.ref;E.focus&&(E.focus(),S.shouldSelect&&st(E.select)&&E.select())}},kt=h=>{r={...r,...h}},qt={control:{register:R,unregister:ee,getFieldState:W,handleSubmit:D,setError:Y,_subscribe:ae,_runSchema:Q,_focusError:H,_getWatch:O,_getDirty:F,_setValid:c,_setFieldArray:y,_setDisabledField:ce,_setErrors:j,_getFieldArray:I,_reset:Re,_resetDefaultValues:()=>st(t.defaultValues)&&t.defaultValues().then(h=>{Et(h,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:u,_disableForm:te,_subjects:m,_proxyFormState:d,get _fields(){return n},get _formValues(){return a},get _state(){return s},set _state(h){s=h},get _defaultValues(){return i},get _names(){return o},set _names(h){o=h},get _formState(){return r},get _options(){return t},set _options(h){t={...t,...h}}},subscribe:ie,trigger:de,register:R,handleSubmit:D,watch:J,setValue:K,getValues:z,reset:Et,resetField:pe,clearErrors:L,unregister:ee,setError:Y,setFocus:ln,getFieldState:W};return{...qt,formControl:qt}}function $l(e={}){const t=M.useRef(void 0),r=M.useRef(void 0),[n,i]=M.useState({isDirty:!1,isValidating:!1,isLoading:st(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:st(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!st(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...o}=jl(e);t.current={...o,formState:n}}const a=t.current.control;return a._options=e,Ki(()=>{const s=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(o=>({...o,isReady:!0})),a._formState.isReady=!0,s},[a]),M.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),M.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),M.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),M.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),M.useEffect(()=>{if(a._proxyFormState.isDirty){const s=a._getDirty();s!==n.isDirty&&a._subjects.state.next({isDirty:s})}},[a,n.isDirty]),M.useEffect(()=>{e.values&&!_t(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values,i(s=>({...s}))):a._resetDefaultValues()},[a,e.values]),M.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=Ws(n,a),t.current}const ka=(e,t,r)=>{if(e&&"reportValidity"in e){const n=q(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},eo=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?ka(n.ref,r,e):n&&n.refs&&n.refs.forEach(i=>ka(i,r,e))}},Dl=(e,t)=>{t.shouldUseNativeValidation&&eo(e,t);const r={};for(const n in e){const i=q(t.fields,n),a=Object.assign(e[n]||{},{ref:i&&i.ref});if(Rl(t.names||Object.keys(e),n)){const s=Object.assign({},q(r,n));ve(s,"root",a),ve(r,n,s)}else ve(r,n,a)}return r},Rl=(e,t)=>{const r=Oa(t);return e.some(n=>Oa(n).match(`^${r}\\.\\d+`))};function Oa(e){return e.replace(/\]|\[/g,"")}function Pl(e,t,r){return r===void 0&&(r={}),function(n,i,a){try{return Promise.resolve(function(s,o){try{var l=(t!=null&&t.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e[r.mode==="sync"?"validateSync":"validate"](n,Object.assign({abortEarly:!1},t,{context:i}))).then(function(p){return a.shouldUseNativeValidation&&eo({},a),{values:r.raw?Object.assign({},n):p,errors:{}}}))}catch(p){return o(p)}return l&&l.then?l.then(void 0,o):l}(0,function(s){if(!s.inner)throw s;return{values:{},errors:Dl((o=s,l=!a.shouldUseNativeValidation&&a.criteriaMode==="all",(o.inner||[]).reduce(function(p,d){if(p[d.path]||(p[d.path]={message:d.message,type:d.type}),l){var f=p[d.path].types,m=f&&f[d.type];p[d.path]=Ks(d.path,l,p,d.type,m?[].concat(m,d.message):d.message)}return p},{})),a)};var o,l}))}catch(s){return Promise.reject(s)}}}var rn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ar=typeof window>"u"||"Deno"in globalThis;function We(){}function Il(e,t){return typeof e=="function"?e(t):e}function vi(e){return typeof e=="number"&&e>=0&&e!==1/0}function to(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zt(e,t){return typeof e=="function"?e(t):e}function Xe(e,t){return typeof e=="function"?e(t):e}function Ta(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:a,queryKey:s,stale:o}=e;if(s){if(n){if(t.queryHash!==Yi(s,t.options))return!1}else if(!Qr(t.queryKey,s))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ca(e,t){const{exact:r,status:n,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(Kr(t.options.mutationKey)!==Kr(a))return!1}else if(!Qr(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function Yi(e,t){return((t==null?void 0:t.queryKeyHashFn)||Kr)(e)}function Kr(e){return JSON.stringify(e,(t,r)=>wi(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function Qr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Qr(e[r],t[r])):!1}function xi(e,t){if(e===t)return e;const r=_a(e)&&_a(t);if(r||wi(e)&&wi(t)){const n=r?e:Object.keys(e),i=n.length,a=r?t:Object.keys(t),s=a.length,o=r?[]:{},l=new Set(n);let p=0;for(let d=0;d<s;d++){const f=r?d:a[d];(!r&&l.has(f)||r)&&e[f]===void 0&&t[f]===void 0?(o[f]=void 0,p++):(o[f]=xi(e[f],t[f]),o[f]===e[f]&&e[f]!==void 0&&p++)}return i===s&&p===i?e:o}return t}function bi(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function _a(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function wi(e){if(!Aa(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Aa(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Aa(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ml(e){return new Promise(t=>{setTimeout(t,e)})}function Si(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return xi(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return xi(e,t)}return t}function zl(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Vl(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var An=Symbol();function ro(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===An&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===An?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Nl(e,t){return typeof e=="function"?e(...t):!!e}var Gt,At,br,$s,Bl=($s=class extends rn{constructor(){super();oe(this,Gt);oe(this,At);oe(this,br);X(this,br,t=>{if(!ar&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){v(this,At)||this.setEventListener(v(this,br))}onUnsubscribe(){var t;this.hasListeners()||((t=v(this,At))==null||t.call(this),X(this,At,void 0))}setEventListener(t){var r;X(this,br,t),(r=v(this,At))==null||r.call(this),X(this,At,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){v(this,Gt)!==t&&(X(this,Gt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof v(this,Gt)=="boolean"?v(this,Gt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Gt=new WeakMap,At=new WeakMap,br=new WeakMap,$s),Zi=new Bl,wr,Ft,Sr,Ds,Ll=(Ds=class extends rn{constructor(){super();oe(this,wr,!0);oe(this,Ft);oe(this,Sr);X(this,Sr,t=>{if(!ar&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){v(this,Ft)||this.setEventListener(v(this,Sr))}onUnsubscribe(){var t;this.hasListeners()||((t=v(this,Ft))==null||t.call(this),X(this,Ft,void 0))}setEventListener(t){var r;X(this,Sr,t),(r=v(this,Ft))==null||r.call(this),X(this,Ft,t(this.setOnline.bind(this)))}setOnline(t){v(this,wr)!==t&&(X(this,wr,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return v(this,wr)}},wr=new WeakMap,Ft=new WeakMap,Sr=new WeakMap,Ds),Fn=new Ll;function Ei(){let e,t;const r=new Promise((i,a)=>{e=i,t=a});r.status="pending",r.catch(()=>{});function n(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{n({status:"fulfilled",value:i}),e(i)},r.reject=i=>{n({status:"rejected",reason:i}),t(i)},r}function ql(e){return Math.min(1e3*2**e,3e4)}function no(e){return(e??"online")==="online"?Fn.isOnline():!0}var io=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ti(e){return e instanceof io}function ao(e){let t=!1,r=0,n=!1,i;const a=Ei(),s=c=>{var b;n||(m(new io(c)),(b=e.abort)==null||b.call(e))},o=()=>{t=!0},l=()=>{t=!1},p=()=>Zi.isFocused()&&(e.networkMode==="always"||Fn.isOnline())&&e.canRun(),d=()=>no(e.networkMode)&&e.canRun(),f=c=>{var b;n||(n=!0,(b=e.onSuccess)==null||b.call(e,c),i==null||i(),a.resolve(c))},m=c=>{var b;n||(n=!0,(b=e.onError)==null||b.call(e,c),i==null||i(),a.reject(c))},x=()=>new Promise(c=>{var b;i=y=>{(n||p())&&c(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var c;i=void 0,n||(c=e.onContinue)==null||c.call(e)}),g=()=>{if(n)return;let c;const b=r===0?e.initialPromise:void 0;try{c=b??e.fn()}catch(y){c=Promise.reject(y)}Promise.resolve(c).then(f).catch(y=>{var N;if(n)return;const T=e.retry??(ar?0:3),j=e.retryDelay??ql,A=typeof j=="function"?j(r,y):j,w=T===!0||typeof T=="number"&&r<T||typeof T=="function"&&T(r,y);if(t||!w){m(y);return}r++,(N=e.onFail)==null||N.call(e,r,y),Ml(A).then(()=>p()?void 0:x()).then(()=>{t?m(y):g()})})};return{promise:a,cancel:s,continue:()=>(i==null||i(),a),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?g():x().then(g),a)}}var Ul=e=>setTimeout(e,0);function Wl(){let e=[],t=0,r=o=>{o()},n=o=>{o()},i=Ul;const a=o=>{t?e.push(o):i(()=>{r(o)})},s=()=>{const o=e;e=[],o.length&&i(()=>{n(()=>{o.forEach(l=>{r(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||s()}return l},batchCalls:o=>(...l)=>{a(()=>{o(...l)})},schedule:a,setNotifyFunction:o=>{r=o},setBatchNotifyFunction:o=>{n=o},setScheduler:o=>{i=o}}}var Me=Wl(),Yt,Rs,so=(Rs=class{constructor(){oe(this,Yt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vi(this.gcTime)&&X(this,Yt,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ar?1/0:5*60*1e3))}clearGcTimeout(){v(this,Yt)&&(clearTimeout(v(this,Yt)),X(this,Yt,void 0))}},Yt=new WeakMap,Rs),Er,Zt,Je,Jt,ze,Zr,Xt,nt,xt,Ps,Hl=(Ps=class extends so{constructor(t){super();oe(this,nt);oe(this,Er);oe(this,Zt);oe(this,Je);oe(this,Jt);oe(this,ze);oe(this,Zr);oe(this,Xt);X(this,Xt,!1),X(this,Zr,t.defaultOptions),this.setOptions(t.options),this.observers=[],X(this,Jt,t.client),X(this,Je,v(this,Jt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,X(this,Er,Kl(this.options)),this.state=t.state??v(this,Er),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=v(this,ze))==null?void 0:t.promise}setOptions(t){this.options={...v(this,Zr),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&v(this,Je).remove(this)}setData(t,r){const n=Si(this.state.data,t,this.options);return me(this,nt,xt).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){me(this,nt,xt).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,i;const r=(n=v(this,ze))==null?void 0:n.promise;return(i=v(this,ze))==null||i.cancel(t),r?r.then(We).catch(We):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(v(this,Er))}isActive(){return this.observers.some(t=>Xe(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===An||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zt(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!to(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=v(this,ze))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=v(this,ze))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),v(this,Je).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(v(this,ze)&&(v(this,Xt)?v(this,ze).cancel({revert:!0}):v(this,ze).cancelRetry()),this.scheduleGc()),v(this,Je).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||me(this,nt,xt).call(this,{type:"invalidate"})}fetch(t,r){var p,d,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(v(this,ze))return v(this,ze).continueRetry(),v(this,ze).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(x=>x.options.queryFn);m&&this.setOptions(m.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,i=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(X(this,Xt,!0),n.signal)})},a=()=>{const m=ro(this.options,r),g=(()=>{const c={client:v(this,Jt),queryKey:this.queryKey,meta:this.meta};return i(c),c})();return X(this,Xt,!1),this.options.persister?this.options.persister(m,g,this):m(g)},o=(()=>{const m={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:v(this,Jt),state:this.state,fetchFn:a};return i(m),m})();(p=this.options.behavior)==null||p.onFetch(o,this),X(this,Zt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&me(this,nt,xt).call(this,{type:"fetch",meta:(f=o.fetchOptions)==null?void 0:f.meta});const l=m=>{var x,g,c,b;ti(m)&&m.silent||me(this,nt,xt).call(this,{type:"error",error:m}),ti(m)||((g=(x=v(this,Je).config).onError)==null||g.call(x,m,this),(b=(c=v(this,Je).config).onSettled)==null||b.call(c,this.state.data,m,this)),this.scheduleGc()};return X(this,ze,ao({initialPromise:r==null?void 0:r.initialPromise,fn:o.fetchFn,abort:n.abort.bind(n),onSuccess:m=>{var x,g,c,b;if(m===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(y){l(y);return}(g=(x=v(this,Je).config).onSuccess)==null||g.call(x,m,this),(b=(c=v(this,Je).config).onSettled)==null||b.call(c,m,this.state.error,this),this.scheduleGc()},onError:l,onFail:(m,x)=>{me(this,nt,xt).call(this,{type:"failed",failureCount:m,error:x})},onPause:()=>{me(this,nt,xt).call(this,{type:"pause"})},onContinue:()=>{me(this,nt,xt).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),v(this,ze).start()}},Er=new WeakMap,Zt=new WeakMap,Je=new WeakMap,Jt=new WeakMap,ze=new WeakMap,Zr=new WeakMap,Xt=new WeakMap,nt=new WeakSet,xt=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...oo(n.data,this.options),fetchMeta:t.meta??null};case"success":return X(this,Zt,void 0),{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return ti(i)&&i.revert&&v(this,Zt)?{...v(this,Zt),fetchStatus:"idle"}:{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),Me.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),v(this,Je).notify({query:this,type:"updated",action:t})})},Ps);function oo(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:no(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Kl(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var pt,Is,Ql=(Is=class extends rn{constructor(t={}){super();oe(this,pt);this.config=t,X(this,pt,new Map)}build(t,r,n){const i=r.queryKey,a=r.queryHash??Yi(i,r);let s=this.get(a);return s||(s=new Hl({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){v(this,pt).has(t.queryHash)||(v(this,pt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=v(this,pt).get(t.queryHash);r&&(t.destroy(),r===t&&v(this,pt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Me.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return v(this,pt).get(t)}getAll(){return[...v(this,pt).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Ta(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Ta(t,n)):r}notify(t){Me.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Me.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Me.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},pt=new WeakMap,Is),ft,Ve,er,mt,Tt,Ms,Gl=(Ms=class extends so{constructor(t){super();oe(this,mt);oe(this,ft);oe(this,Ve);oe(this,er);this.mutationId=t.mutationId,X(this,Ve,t.mutationCache),X(this,ft,[]),this.state=t.state||Yl(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){v(this,ft).includes(t)||(v(this,ft).push(t),this.clearGcTimeout(),v(this,Ve).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){X(this,ft,v(this,ft).filter(r=>r!==t)),this.scheduleGc(),v(this,Ve).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){v(this,ft).length||(this.state.status==="pending"?this.scheduleGc():v(this,Ve).remove(this))}continue(){var t;return((t=v(this,er))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,s,o,l,p,d,f,m,x,g,c,b,y,T,j,A,w,N,Q,ne;const r=()=>{me(this,mt,Tt).call(this,{type:"continue"})};X(this,er,ao({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(G,u)=>{me(this,mt,Tt).call(this,{type:"failed",failureCount:G,error:u})},onPause:()=>{me(this,mt,Tt).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>v(this,Ve).canRun(this)}));const n=this.state.status==="pending",i=!v(this,er).canStart();try{if(n)r();else{me(this,mt,Tt).call(this,{type:"pending",variables:t,isPaused:i}),await((s=(a=v(this,Ve).config).onMutate)==null?void 0:s.call(a,t,this));const u=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t));u!==this.state.context&&me(this,mt,Tt).call(this,{type:"pending",context:u,variables:t,isPaused:i})}const G=await v(this,er).start();return await((d=(p=v(this,Ve).config).onSuccess)==null?void 0:d.call(p,G,t,this.state.context,this)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,G,t,this.state.context)),await((g=(x=v(this,Ve).config).onSettled)==null?void 0:g.call(x,G,null,this.state.variables,this.state.context,this)),await((b=(c=this.options).onSettled)==null?void 0:b.call(c,G,null,t,this.state.context)),me(this,mt,Tt).call(this,{type:"success",data:G}),G}catch(G){try{throw await((T=(y=v(this,Ve).config).onError)==null?void 0:T.call(y,G,t,this.state.context,this)),await((A=(j=this.options).onError)==null?void 0:A.call(j,G,t,this.state.context)),await((N=(w=v(this,Ve).config).onSettled)==null?void 0:N.call(w,void 0,G,this.state.variables,this.state.context,this)),await((ne=(Q=this.options).onSettled)==null?void 0:ne.call(Q,void 0,G,t,this.state.context)),G}finally{me(this,mt,Tt).call(this,{type:"error",error:G})}}finally{v(this,Ve).runNext(this)}}},ft=new WeakMap,Ve=new WeakMap,er=new WeakMap,mt=new WeakSet,Tt=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Me.batch(()=>{v(this,ft).forEach(n=>{n.onMutationUpdate(t)}),v(this,Ve).notify({mutation:this,type:"updated",action:t})})},Ms);function Yl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var bt,it,Jr,zs,Zl=(zs=class extends rn{constructor(t={}){super();oe(this,bt);oe(this,it);oe(this,Jr);this.config=t,X(this,bt,new Set),X(this,it,new Map),X(this,Jr,0)}build(t,r,n){const i=new Gl({mutationCache:this,mutationId:++un(this,Jr)._,options:t.defaultMutationOptions(r),state:n});return this.add(i),i}add(t){v(this,bt).add(t);const r=dn(t);if(typeof r=="string"){const n=v(this,it).get(r);n?n.push(t):v(this,it).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(v(this,bt).delete(t)){const r=dn(t);if(typeof r=="string"){const n=v(this,it).get(r);if(n)if(n.length>1){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}else n[0]===t&&v(this,it).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=dn(t);if(typeof r=="string"){const n=v(this,it).get(r),i=n==null?void 0:n.find(a=>a.state.status==="pending");return!i||i===t}else return!0}runNext(t){var n;const r=dn(t);if(typeof r=="string"){const i=(n=v(this,it).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Me.batch(()=>{v(this,bt).forEach(t=>{this.notify({type:"removed",mutation:t})}),v(this,bt).clear(),v(this,it).clear()})}getAll(){return Array.from(v(this,bt))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Ca(r,n))}findAll(t={}){return this.getAll().filter(r=>Ca(t,r))}notify(t){Me.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return Me.batch(()=>Promise.all(t.map(r=>r.continue().catch(We))))}},bt=new WeakMap,it=new WeakMap,Jr=new WeakMap,zs);function dn(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Fa(e){return{onFetch:(t,r)=>{var d,f,m,x,g;const n=t.options,i=(m=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,a=((x=t.state.data)==null?void 0:x.pages)||[],s=((g=t.state.data)==null?void 0:g.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const p=async()=>{let c=!1;const b=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},y=ro(t.options,t.fetchOptions),T=async(j,A,w)=>{if(c)return Promise.reject();if(A==null&&j.pages.length)return Promise.resolve(j);const Q=(()=>{const F={client:t.client,queryKey:t.queryKey,pageParam:A,direction:w?"backward":"forward",meta:t.options.meta};return b(F),F})(),ne=await y(Q),{maxPages:G}=t.options,u=w?Vl:zl;return{pages:u(j.pages,ne,G),pageParams:u(j.pageParams,A,G)}};if(i&&a.length){const j=i==="backward",A=j?Jl:ja,w={pages:a,pageParams:s},N=A(n,w);o=await T(w,N,j)}else{const j=e??a.length;do{const A=l===0?s[0]??n.initialPageParam:ja(n,o);if(l>0&&A==null)break;o=await T(o,A),l++}while(l<j)}return o};t.options.persister?t.fetchFn=()=>{var c,b;return(b=(c=t.options).persister)==null?void 0:b.call(c,p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=p}}}function ja(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Jl(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var _e,jt,$t,kr,Or,Dt,Tr,Cr,Vs,Xl=(Vs=class{constructor(e={}){oe(this,_e);oe(this,jt);oe(this,$t);oe(this,kr);oe(this,Or);oe(this,Dt);oe(this,Tr);oe(this,Cr);X(this,_e,e.queryCache||new Ql),X(this,jt,e.mutationCache||new Zl),X(this,$t,e.defaultOptions||{}),X(this,kr,new Map),X(this,Or,new Map),X(this,Dt,0)}mount(){un(this,Dt)._++,v(this,Dt)===1&&(X(this,Tr,Zi.subscribe(async e=>{e&&(await this.resumePausedMutations(),v(this,_e).onFocus())})),X(this,Cr,Fn.subscribe(async e=>{e&&(await this.resumePausedMutations(),v(this,_e).onOnline())})))}unmount(){var e,t;un(this,Dt)._--,v(this,Dt)===0&&((e=v(this,Tr))==null||e.call(this),X(this,Tr,void 0),(t=v(this,Cr))==null||t.call(this),X(this,Cr,void 0))}isFetching(e){return v(this,_e).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return v(this,jt).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=v(this,_e).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=v(this,_e).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(zt(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return v(this,_e).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=v(this,_e).get(n.queryHash),a=i==null?void 0:i.state.data,s=Il(t,a);if(s!==void 0)return v(this,_e).build(this,n).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return Me.batch(()=>v(this,_e).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=v(this,_e).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=v(this,_e);Me.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=v(this,_e);return Me.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Me.batch(()=>v(this,_e).findAll(e).map(i=>i.cancel(r)));return Promise.all(n).then(We).catch(We)}invalidateQueries(e,t={}){return Me.batch(()=>(v(this,_e).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=Me.batch(()=>v(this,_e).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,r);return r.throwOnError||(a=a.catch(We)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(We)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=v(this,_e).build(this,t);return r.isStaleByTime(zt(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(We).catch(We)}fetchInfiniteQuery(e){return e.behavior=Fa(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(We).catch(We)}ensureInfiniteQueryData(e){return e.behavior=Fa(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Fn.isOnline()?v(this,jt).resumePausedMutations():Promise.resolve()}getQueryCache(){return v(this,_e)}getMutationCache(){return v(this,jt)}getDefaultOptions(){return v(this,$t)}setDefaultOptions(e){X(this,$t,e)}setQueryDefaults(e,t){v(this,kr).set(Kr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...v(this,kr).values()],r={};return t.forEach(n=>{Qr(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){v(this,Or).set(Kr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...v(this,Or).values()],r={};return t.forEach(n=>{Qr(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...v(this,$t).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Yi(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===An&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...v(this,$t).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){v(this,_e).clear(),v(this,jt).clear()}},_e=new WeakMap,jt=new WeakMap,$t=new WeakMap,kr=new WeakMap,Or=new WeakMap,Dt=new WeakMap,Tr=new WeakMap,Cr=new WeakMap,Vs),qe,he,Xr,Ne,tr,_r,Rt,Pt,en,Ar,Fr,rr,nr,It,jr,xe,Nr,ki,Oi,Ti,Ci,_i,Ai,Fi,lo,Ns,ec=(Ns=class extends rn{constructor(t,r){super();oe(this,xe);oe(this,qe);oe(this,he);oe(this,Xr);oe(this,Ne);oe(this,tr);oe(this,_r);oe(this,Rt);oe(this,Pt);oe(this,en);oe(this,Ar);oe(this,Fr);oe(this,rr);oe(this,nr);oe(this,It);oe(this,jr,new Set);this.options=r,X(this,qe,t),X(this,Pt,null),X(this,Rt,Ei()),this.options.experimental_prefetchInRender||v(this,Rt).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(v(this,he).addObserver(this),$a(v(this,he),this.options)?me(this,xe,Nr).call(this):this.updateResult(),me(this,xe,Ci).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ji(v(this,he),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ji(v(this,he),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,xe,_i).call(this),me(this,xe,Ai).call(this),v(this,he).removeObserver(this)}setOptions(t){const r=this.options,n=v(this,he);if(this.options=v(this,qe).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Xe(this.options.enabled,v(this,he))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");me(this,xe,Fi).call(this),v(this,he).setOptions(this.options),r._defaulted&&!bi(this.options,r)&&v(this,qe).getQueryCache().notify({type:"observerOptionsUpdated",query:v(this,he),observer:this});const i=this.hasListeners();i&&Da(v(this,he),n,this.options,r)&&me(this,xe,Nr).call(this),this.updateResult(),i&&(v(this,he)!==n||Xe(this.options.enabled,v(this,he))!==Xe(r.enabled,v(this,he))||zt(this.options.staleTime,v(this,he))!==zt(r.staleTime,v(this,he)))&&me(this,xe,ki).call(this);const a=me(this,xe,Oi).call(this);i&&(v(this,he)!==n||Xe(this.options.enabled,v(this,he))!==Xe(r.enabled,v(this,he))||a!==v(this,It))&&me(this,xe,Ti).call(this,a)}getOptimisticResult(t){const r=v(this,qe).getQueryCache().build(v(this,qe),t),n=this.createResult(r,t);return rc(this,n)&&(X(this,Ne,n),X(this,_r,this.options),X(this,tr,v(this,he).state)),n}getCurrentResult(){return v(this,Ne)}trackResult(t,r){return new Proxy(t,{get:(n,i)=>(this.trackProp(i),r==null||r(i),Reflect.get(n,i))})}trackProp(t){v(this,jr).add(t)}getCurrentQuery(){return v(this,he)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=v(this,qe).defaultQueryOptions(t),n=v(this,qe).getQueryCache().build(v(this,qe),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return me(this,xe,Nr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),v(this,Ne)))}createResult(t,r){var G;const n=v(this,he),i=this.options,a=v(this,Ne),s=v(this,tr),o=v(this,_r),p=t!==n?t.state:v(this,Xr),{state:d}=t;let f={...d},m=!1,x;if(r._optimisticResults){const u=this.hasListeners(),F=!u&&$a(t,r),O=u&&Da(t,n,r,i);(F||O)&&(f={...f,...oo(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:c,status:b}=f;x=f.data;let y=!1;if(r.placeholderData!==void 0&&x===void 0&&b==="pending"){let u;a!=null&&a.isPlaceholderData&&r.placeholderData===(o==null?void 0:o.placeholderData)?(u=a.data,y=!0):u=typeof r.placeholderData=="function"?r.placeholderData((G=v(this,Fr))==null?void 0:G.state.data,v(this,Fr)):r.placeholderData,u!==void 0&&(b="success",x=Si(a==null?void 0:a.data,u,r),m=!0)}if(r.select&&x!==void 0&&!y)if(a&&x===(s==null?void 0:s.data)&&r.select===v(this,en))x=v(this,Ar);else try{X(this,en,r.select),x=r.select(x),x=Si(a==null?void 0:a.data,x,r),X(this,Ar,x),X(this,Pt,null)}catch(u){X(this,Pt,u)}v(this,Pt)&&(g=v(this,Pt),x=v(this,Ar),c=Date.now(),b="error");const T=f.fetchStatus==="fetching",j=b==="pending",A=b==="error",w=j&&T,N=x!==void 0,ne={status:b,fetchStatus:f.fetchStatus,isPending:j,isSuccess:b==="success",isError:A,isInitialLoading:w,isLoading:w,data:x,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:c,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>p.dataUpdateCount||f.errorUpdateCount>p.errorUpdateCount,isFetching:T,isRefetching:T&&!j,isLoadingError:A&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:A&&N,isStale:Ji(t,r),refetch:this.refetch,promise:v(this,Rt),isEnabled:Xe(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const u=I=>{ne.status==="error"?I.reject(ne.error):ne.data!==void 0&&I.resolve(ne.data)},F=()=>{const I=X(this,Rt,ne.promise=Ei());u(I)},O=v(this,Rt);switch(O.status){case"pending":t.queryHash===n.queryHash&&u(O);break;case"fulfilled":(ne.status==="error"||ne.data!==O.value)&&F();break;case"rejected":(ne.status!=="error"||ne.error!==O.reason)&&F();break}}return ne}updateResult(){const t=v(this,Ne),r=this.createResult(v(this,he),this.options);if(X(this,tr,v(this,he).state),X(this,_r,this.options),v(this,tr).data!==void 0&&X(this,Fr,v(this,he)),bi(r,t))return;X(this,Ne,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!v(this,jr).size)return!0;const s=new Set(a??v(this,jr));return this.options.throwOnError&&s.add("error"),Object.keys(v(this,Ne)).some(o=>{const l=o;return v(this,Ne)[l]!==t[l]&&s.has(l)})};me(this,xe,lo).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,xe,Ci).call(this)}},qe=new WeakMap,he=new WeakMap,Xr=new WeakMap,Ne=new WeakMap,tr=new WeakMap,_r=new WeakMap,Rt=new WeakMap,Pt=new WeakMap,en=new WeakMap,Ar=new WeakMap,Fr=new WeakMap,rr=new WeakMap,nr=new WeakMap,It=new WeakMap,jr=new WeakMap,xe=new WeakSet,Nr=function(t){me(this,xe,Fi).call(this);let r=v(this,he).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(We)),r},ki=function(){me(this,xe,_i).call(this);const t=zt(this.options.staleTime,v(this,he));if(ar||v(this,Ne).isStale||!vi(t))return;const n=to(v(this,Ne).dataUpdatedAt,t)+1;X(this,rr,setTimeout(()=>{v(this,Ne).isStale||this.updateResult()},n))},Oi=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(v(this,he)):this.options.refetchInterval)??!1},Ti=function(t){me(this,xe,Ai).call(this),X(this,It,t),!(ar||Xe(this.options.enabled,v(this,he))===!1||!vi(v(this,It))||v(this,It)===0)&&X(this,nr,setInterval(()=>{(this.options.refetchIntervalInBackground||Zi.isFocused())&&me(this,xe,Nr).call(this)},v(this,It)))},Ci=function(){me(this,xe,ki).call(this),me(this,xe,Ti).call(this,me(this,xe,Oi).call(this))},_i=function(){v(this,rr)&&(clearTimeout(v(this,rr)),X(this,rr,void 0))},Ai=function(){v(this,nr)&&(clearInterval(v(this,nr)),X(this,nr,void 0))},Fi=function(){const t=v(this,qe).getQueryCache().build(v(this,qe),this.options);if(t===v(this,he))return;const r=v(this,he);X(this,he,t),X(this,Xr,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},lo=function(t){Me.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(v(this,Ne))}),v(this,qe).getQueryCache().notify({query:v(this,he),type:"observerResultsUpdated"})})},Ns);function tc(e,t){return Xe(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function $a(e,t){return tc(e,t)||e.state.data!==void 0&&ji(e,t,t.refetchOnMount)}function ji(e,t,r){if(Xe(t.enabled,e)!==!1&&zt(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Ji(e,t)}return!1}function Da(e,t,r,n){return(e!==t||Xe(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ji(e,r)}function Ji(e,t){return Xe(t.enabled,e)!==!1&&e.isStaleByTime(zt(t.staleTime,e))}function rc(e,t){return!bi(e.getCurrentResult(),t)}var co=Ae.createContext(void 0),nc=e=>{const t=Ae.useContext(co);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ic=({client:e,children:t})=>(Ae.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),k.jsx(co.Provider,{value:e,children:t})),uo=Ae.createContext(!1),ac=()=>Ae.useContext(uo);uo.Provider;function sc(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var oc=Ae.createContext(sc()),lc=()=>Ae.useContext(oc),cc=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},uc=e=>{Ae.useEffect(()=>{e.clearReset()},[e])},dc=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&e.data===void 0||Nl(r,[e.error,n])),pc=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},fc=(e,t)=>e.isLoading&&e.isFetching&&!t,mc=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ra=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function hc(e,t,r){var f,m,x,g,c;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=ac(),i=lc(),a=nc(),s=a.defaultQueryOptions(e);(m=(f=a.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||m.call(f,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=n?"isRestoring":"optimistic",pc(s),cc(s,i),uc(i);const o=!a.getQueryCache().get(s.queryHash),[l]=Ae.useState(()=>new t(a,s)),p=l.getOptimisticResult(s),d=!n&&e.subscribed!==!1;if(Ae.useSyncExternalStore(Ae.useCallback(b=>{const y=d?l.subscribe(Me.batchCalls(b)):We;return l.updateResult(),y},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Ae.useEffect(()=>{l.setOptions(s)},[s,l]),mc(s,p))throw Ra(s,l,i);if(dc({result:p,errorResetBoundary:i,throwOnError:s.throwOnError,query:a.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw p.error;if((g=(x=a.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||g.call(x,s,p),s.experimental_prefetchInRender&&!ar&&fc(p,n)){const b=o?Ra(s,l,i):(c=a.getQueryCache().get(s.queryHash))==null?void 0:c.promise;b==null||b.catch(We).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?p:l.trackResult(p)}function gc(e,t){return hc(e,ec)}const po=({src:e,alt:t,width:r="100%",height:n="auto",style:i,className:a,onClick:s})=>k.jsx(P.Box,{sx:{textAlign:"center"},children:k.jsx("img",{src:e||"/placeholder-image.png",alt:t||"Image",width:r,height:n,style:{maxWidth:"100%",height:"auto",borderRadius:"8px",cursor:s?"pointer":"default",...i},className:a,onClick:s,onError:o=>{o.currentTarget.src="/placeholder-image.png"}})});async function fo(e,t,r,n){try{const{endpoint:i,method:a="GET",valueField:s="value",labelField:o="label",headers:l={},params:p={},body:d,transform:f,dependsOn:m}=e;let x=i;if(t&&!i.startsWith("http")&&(x=`${t}${i.startsWith("/")?i:`/${i}`}`),m&&n){const A=n[m];A&&(x=x.replace(`{${m}}`,encodeURIComponent(A)))}const g=new URLSearchParams;Object.entries(p).forEach(([A,w])=>{w!=null&&g.append(A,String(w))}),g.toString()&&(x+=`${x.includes("?")?"&":"?"}${g.toString()}`);const c={"Content-Type":"application/json",...r,...l},b={method:a,headers:c};(a==="POST"||a==="PUT")&&d&&(b.body=JSON.stringify(d));const y=await fetch(x,b);if(!y.ok)throw new Error(`API request failed: ${y.status} ${y.statusText}`);const T=await y.json();if(f)return f(Array.isArray(T)?T:T.data||T);const j=Array.isArray(T)?T:T.data||T;if(!Array.isArray(j))throw new Error("API response is not an array");return j.map(A=>({label:A[o]||A.name||A.title||String(A[s]||""),value:A[s]||A.id||A.value||""}))}catch(i){throw console.error("API fetch error:",i),new Error(`Failed to fetch data: ${i instanceof Error?i.message:"Unknown error"}`)}}function mo(e,t,r,n,i=!1){const a=M.useMemo(()=>{if(!(e!=null&&e.dependsOn)||!n)return null;const o=n[e.dependsOn];return o!==void 0?o:null},[e==null?void 0:e.dependsOn,n]),s=M.useMemo(()=>["api-data",e==null?void 0:e.endpoint,e==null?void 0:e.method,e==null?void 0:e.valueField,e==null?void 0:e.labelField,t,a],[e==null?void 0:e.endpoint,e==null?void 0:e.method,e==null?void 0:e.valueField,e==null?void 0:e.labelField,t,a]);return gc({queryKey:s,queryFn:()=>{if(!e)throw new Error("API config is required");return fo(e,t,r,n)},enabled:i&&!!e,staleTime:15*60*1e3,gcTime:30*60*1e3,retry:3,retryDelay:o=>Math.min(1e3*2**o,3e4),refetchOnWindowFocus:!1,refetchOnReconnect:!0,refetchOnMount:!1})}function Ht(e){return!!(e.apiConfig||e.api_endpoint)}function Xi(e){return e.apiConfig?e.apiConfig:e.api_endpoint?{endpoint:e.api_endpoint,method:e.api_method||"GET",valueField:e.value_field||"value",labelField:e.label_field||"label",dependsOn:e.depends_on,conditional:e.conditional}:null}function yc(e,t){const r=Xi(e);if(!(r!=null&&r.conditional)&&!e.conditional)return!0;if(r!=null&&r.dependsOn||e.depends_on){const n=(r==null?void 0:r.dependsOn)||e.depends_on;if(n){const i=t[n];return i!=null&&i!==""}}return!0}const ho=({field:e,control:t,errors:r,baseUrl:n,apiHeaders:i,formData:a})=>{const s=r[e.name],o=!!s,[l,p]=M.useState(!1),d=M.useRef(!1),f=()=>{var O;return e.required!==void 0?e.required:((O=e.validation)==null?void 0:O.required)!==void 0?e.validation.required:!1},m=O=>f()?`${O} *`:O,x=()=>e.value!==void 0?e.value:e.type==="checkbox"?!1:e.type==="select"&&e.default?e.default:e.type==="autocomplete"&&e.multiple?[]:"",g=M.useMemo(()=>Xi(e),[e.apiConfig,e.api_endpoint,e.api_method,e.value_field,e.label_field,e.depends_on,e.conditional]),c=M.useRef(null),b=g!=null&&g.dependsOn?a==null?void 0:a[g.dependsOn]:null,y=M.useMemo(()=>{if(!(g!=null&&g.dependsOn))return!1;const O=b,I=c.current,V=O!==I;return V&&(c.current=O),V},[g==null?void 0:g.dependsOn,b]),T=M.useMemo(()=>!0,[]),j=M.useMemo(()=>l&&Ht(e)&&(!(g!=null&&g.dependsOn)||b),[l,e,g==null?void 0:g.dependsOn,b]),A=M.useMemo(()=>{if(!(g!=null&&g.dependsOn)||!a)return{};const O={};return g.dependsOn&&a[g.dependsOn]!==void 0&&(O[g.dependsOn]=a[g.dependsOn]),O},[g==null?void 0:g.dependsOn,a]),{data:w=[],isLoading:N,error:Q}=mo(g,n,i,A,j),ne=M.useCallback(()=>{Ht(e)&&!d.current&&(d.current=!0,p(!0))},[e]),G=M.useCallback(()=>{Ht(e)&&!d.current&&(d.current=!0,p(!0))},[e]);M.useEffect(()=>{if(Ht(e)&&!d.current){const O=a==null?void 0:a[e.name];O!=null&&O!==""&&(d.current=!0,p(!0))}},[e,a]),M.useEffect(()=>{Ht(e)&&(g!=null&&g.dependsOn)&&y&&d.current&&(d.current=!1,p(!1))},[y,g==null?void 0:g.dependsOn]);const u=M.useCallback(()=>Ht(e)?w:e.type==="select"||e.type==="toggle"||e.type==="radio"||e.type==="autocomplete"?e.options||[]:[],[e,w]);if(!T)return null;const F=()=>{switch(e.type){case"title":return k.jsx(P.Typography,{variant:e.variant||"h4",component:"h1",color:e.color,align:e.align||"left",sx:{mb:3,fontWeight:600,...e.sx},children:e.label});case"section":return k.jsx(P.Typography,{variant:e.variant||"h6",component:"h3",color:e.color,align:e.align||"left",sx:{mb:2,fontWeight:600,color:"text.primary",...e.sx},children:e.label});case"text":case"email":case"password":case"tel":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:B})=>k.jsx(P.TextField,{...B,id:e.id,fullWidth:!0,label:m(e.label),type:e.type,placeholder:e.placeholder,disabled:e.disabled,error:o,helperText:s==null?void 0:s.message})});case"number":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:B})=>k.jsx(P.TextField,{...B,id:e.id,fullWidth:!0,label:m(e.label),type:"number",placeholder:e.placeholder,disabled:e.disabled,error:o,helperText:s==null?void 0:s.message,inputProps:{min:e.min,max:e.max}})});case"select":const O=u();return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:B})=>k.jsxs(P.FormControl,{fullWidth:!0,error:o||!!Q,children:[k.jsx(P.InputLabel,{id:e.id,children:m(e.label)}),k.jsx(P.Select,{...B,labelId:e.id,label:m(e.label),disabled:e.disabled||N,endAdornment:N?k.jsx(P.CircularProgress,{size:20}):void 0,onOpen:ne,children:N?k.jsx(P.MenuItem,{disabled:!0,children:k.jsxs(P.Box,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"},children:[k.jsx(P.CircularProgress,{size:16}),k.jsx(P.Typography,{variant:"body2",children:"Fetching data..."})]})}):O.length>0?O.map(K=>k.jsx(P.MenuItem,{value:K.value,children:K.label},K.value)):l&&!N?k.jsx(P.MenuItem,{disabled:!0,children:k.jsx(P.Typography,{variant:"body2",color:"text.secondary",children:"No options available"})}):k.jsx(P.MenuItem,{disabled:!0,children:k.jsx(P.Typography,{variant:"body2",color:"text.secondary",children:"Click to load options"})})}),(o||Q)&&k.jsx(P.FormHelperText,{children:(s==null?void 0:s.message)||(Q==null?void 0:Q.message)})]})});case"checkbox":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:B})=>k.jsxs(P.Box,{sx:{mt:1,mb:0},children:[k.jsx(P.FormControlLabel,{control:k.jsx(P.Checkbox,{...B,id:e.id,checked:B.value,disabled:e.disabled}),label:m(e.label)}),o&&k.jsx(P.FormHelperText,{error:!0,sx:{ml:0},children:s==null?void 0:s.message})]})});case"toggle":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:B})=>k.jsxs(P.FormControl,{component:"fieldset",error:o,children:[k.jsx(P.Typography,{variant:"body2",component:"legend",sx:{mb:1},children:m(e.label)}),k.jsx(P.RadioGroup,{...B,row:!0,children:e.options.map(K=>k.jsx(P.FormControlLabel,{value:K.value,control:k.jsx(P.Radio,{}),label:K.label},K.value))}),o&&k.jsx(P.FormHelperText,{error:!0,children:s==null?void 0:s.message})]})});case"radio":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:B})=>k.jsxs(P.FormControl,{component:"fieldset",error:o,children:[k.jsx(P.Typography,{variant:"body2",component:"legend",sx:{mb:1},children:m(e.label)}),k.jsx(P.RadioGroup,{...B,children:e.options.map(K=>k.jsx(P.FormControlLabel,{value:K.value,control:k.jsx(P.Radio,{}),label:K.label},K.value))}),o&&k.jsx(P.FormHelperText,{error:!0,children:s==null?void 0:s.message})]})});case"switch":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:B})=>k.jsxs(P.Box,{sx:{mt:1,mb:0},children:[k.jsx(P.FormControlLabel,{control:k.jsx(P.Switch,{...B,id:e.id,checked:B.value,disabled:e.disabled}),label:m(e.label)}),o&&k.jsx(P.FormHelperText,{error:!0,sx:{ml:0},children:s==null?void 0:s.message})]})});case"autocomplete":const I=u(),V=!!(e.disabled||N||g!=null&&g.dependsOn&&!b);return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:B})=>{const K=B.value,le=e.multiple===!0,fe=(g==null?void 0:g.valueField)||e.value_field||"value",de=(g==null?void 0:g.labelField)||e.label_field||"label",z=L=>{if(L!=null){if(typeof L=="string"||typeof L=="number")return L;if(typeof L=="object"){if(L[fe]!==void 0)return L[fe];if(L.value!==void 0)return L.value;if(L.id!==void 0)return L.id}}},W=(()=>{if(le)return(Array.isArray(K)?K:[]).map(Y=>{const J=I.find(ae=>{const ie=z(ae);return ie!==void 0&&ie===Y});return J||{[fe]:Y,[de]:`Selected: ${Y}`,value:Y,label:`Selected: ${Y}`}});{if(K==null||K==="")return null;const L=I.find(Y=>{const J=z(Y);return J!==void 0&&J===K});return L||{[fe]:K,[de]:`Selected: ${K}`,value:K,label:`Selected: ${K}`}}})();return k.jsx(P.Autocomplete,{...B,id:e.id,options:I,value:W,getOptionLabel:L=>typeof L=="string"?L:L[de]||L.label||L.name||"",isOptionEqualToValue:(L,Y)=>{const J=z(L),ae=z(Y);return J===void 0||ae===void 0?!1:J===ae},multiple:e.multiple,disableCloseOnSelect:le,freeSolo:e.freeSolo,filterOptions:e.filterOptions===!1?()=>I:void 0,disabled:V,loading:N,onOpen:G,renderOption:(L,Y,{selected:J})=>{const ae=typeof Y=="string"?Y:Y[de]||Y.label||Y.name||"";return k.jsxs("li",{...L,children:[le&&k.jsx(P.Checkbox,{style:{marginRight:8},checked:J}),ae]})},renderTags:le?(L,Y)=>{const ae=L.slice(0,2).map((ee,ce)=>{const R=typeof ee=="string"?ee:ee[de]||ee.label||ee.name||"",H=Y({index:ce});return M.createElement(P.Chip,{...H,key:ce,label:R,size:"small"})}),ie=L.length-2;return ie>0&&ae.push(k.jsx(P.Chip,{label:`+${ie} more`,size:"small"},"more")),ae}:void 0,renderInput:L=>k.jsx(P.TextField,{...L,label:m(e.label),placeholder:V&&(g!=null&&g.dependsOn)&&!b?`Please select ${g.dependsOn.replace(/_/g," ")} first`:e.placeholder,error:o||!!Q,helperText:(s==null?void 0:s.message)||(Q==null?void 0:Q.message)||"",InputProps:{...L.InputProps,endAdornment:k.jsxs(k.Fragment,{children:[N?k.jsx(P.CircularProgress,{color:"inherit",size:20}):null,L.InputProps.endAdornment]})}}),onChange:(L,Y)=>{const J=(g==null?void 0:g.valueField)||e.value_field||"value";if(le){const ie=(Array.isArray(Y)?Y:[]).map(ee=>typeof ee=="object"&&(ee[J]||ee.value||ee.id)||ee);B.onChange(ie)}else{let ae;Y&&typeof Y=="object"?ae=Y[J]||Y.value||Y.id||Y:ae=Y,B.onChange(ae)}},noOptionsText:V&&(g!=null&&g.dependsOn)&&!b?`Please select ${g.dependsOn.replace(/_/g," ")} first`:N?"Fetching data...":l&&!N&&I.length===0?"No options available":"Click to load options"})}});case"date":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:B})=>k.jsx(P.TextField,{...B,id:e.name,fullWidth:!0,label:m(e.label),type:"date",disabled:e.disabled,error:o,helperText:s==null?void 0:s.message,InputLabelProps:{shrink:!0},inputProps:{min:e.minDate,max:e.maxDate}})});case"image":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:B})=>k.jsx(po,{src:B.value||e.defaultValue||e.src,alt:e.alt||e.label,width:e.width,height:e.height,style:e.style,className:e.className,onClick:e.onClick})});default:return null}};return k.jsx(P.Box,{children:F()})};function ea(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ri,Pa;function vc(){if(Pa)return ri;Pa=1;function e(y){this._maxSize=y,this.clear()}e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(y){return this._values[y]},e.prototype.set=function(y,T){return this._size>=this._maxSize&&this.clear(),y in this._values||this._size++,this._values[y]=T};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,r=/^\d+$/,n=/^\d/,i=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,o=new e(s),l=new e(s),p=new e(s);ri={Cache:e,split:f,normalizePath:d,setter:function(y){var T=d(y);return l.get(y)||l.set(y,function(A,w){for(var N=0,Q=T.length,ne=A;N<Q-1;){var G=T[N];if(G==="__proto__"||G==="constructor"||G==="prototype")return A;ne=ne[T[N++]]}ne[T[N]]=w})},getter:function(y,T){var j=d(y);return p.get(y)||p.set(y,function(w){for(var N=0,Q=j.length;N<Q;)if(w!=null||!T)w=w[j[N++]];else return;return w})},join:function(y){return y.reduce(function(T,j){return T+(x(j)||r.test(j)?"["+j+"]":(T?".":"")+j)},"")},forEach:function(y,T,j){m(Array.isArray(y)?y:f(y),T,j)}};function d(y){return o.get(y)||o.set(y,f(y).map(function(T){return T.replace(a,"$2")}))}function f(y){return y.match(t)||[""]}function m(y,T,j){var A=y.length,w,N,Q,ne;for(N=0;N<A;N++)w=y[N],w&&(b(w)&&(w='"'+w+'"'),ne=x(w),Q=!ne&&/^\d+$/.test(w),T.call(j,w,ne,Q,N,y))}function x(y){return typeof y=="string"&&y&&["'",'"'].indexOf(y.charAt(0))!==-1}function g(y){return y.match(n)&&!y.match(r)}function c(y){return i.test(y)}function b(y){return!x(y)&&(g(y)||c(y))}return ri}var ir=vc(),ni,Ia;function xc(){if(Ia)return ni;Ia=1;const e=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=d=>d.match(e)||[],r=d=>d[0].toUpperCase()+d.slice(1),n=(d,f)=>t(d).join(f).toLowerCase(),i=d=>t(d).reduce((f,m)=>`${f}${f?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return ni={words:t,upperFirst:r,camelCase:i,pascalCase:d=>r(i(d)),snakeCase:d=>n(d,"_"),kebabCase:d=>n(d,"-"),sentenceCase:d=>r(n(d," ")),titleCase:d=>t(d).map(r).join(" ")},ni}var ii=xc(),pn={exports:{}},Ma;function bc(){if(Ma)return pn.exports;Ma=1,pn.exports=function(i){return e(t(i),i)},pn.exports.array=e;function e(i,a){var s=i.length,o=new Array(s),l={},p=s,d=r(a),f=n(i);for(a.forEach(function(x){if(!f.has(x[0])||!f.has(x[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});p--;)l[p]||m(i[p],p,new Set);return o;function m(x,g,c){if(c.has(x)){var b;try{b=", node was:"+JSON.stringify(x)}catch{b=""}throw new Error("Cyclic dependency"+b)}if(!f.has(x))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(x));if(!l[g]){l[g]=!0;var y=d.get(x)||new Set;if(y=Array.from(y),g=y.length){c.add(x);do{var T=y[--g];m(T,f.get(T),c)}while(g);c.delete(x)}o[--s]=x}}}function t(i){for(var a=new Set,s=0,o=i.length;s<o;s++){var l=i[s];a.add(l[0]),a.add(l[1])}return Array.from(a)}function r(i){for(var a=new Map,s=0,o=i.length;s<o;s++){var l=i[s];a.has(l[0])||a.set(l[0],new Set),a.has(l[1])||a.set(l[1],new Set),a.get(l[0]).add(l[1])}return a}function n(i){for(var a=new Map,s=0,o=i.length;s<o;s++)a.set(i[s],s);return a}return pn.exports}var wc=bc();const Sc=ea(wc),Ec=Object.prototype.toString,kc=Error.prototype.toString,Oc=RegExp.prototype.toString,Tc=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Cc=/^Symbol\((.*)\)(.*)$/;function _c(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function za(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const r=typeof e;if(r==="number")return _c(e);if(r==="string")return t?`"${e}"`:e;if(r==="function")return"[Function "+(e.name||"anonymous")+"]";if(r==="symbol")return Tc.call(e).replace(Cc,"Symbol($1)");const n=Ec.call(e).slice(8,-1);return n==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):n==="Error"||e instanceof Error?"["+kc.call(e)+"]":n==="RegExp"?Oc.call(e):null}function Vt(e,t){let r=za(e,t);return r!==null?r:JSON.stringify(e,function(n,i){let a=za(this[n],t);return a!==null?a:i},2)}function go(e){return e==null?[]:[].concat(e)}let yo,vo,xo,Ac=/\$\{\s*(\w+)\s*\}/g;yo=Symbol.toStringTag;class Va{constructor(t,r,n,i){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[yo]="Error",this.name="ValidationError",this.value=r,this.path=n,this.type=i,this.errors=[],this.inner=[],go(t).forEach(a=>{if(He.isError(a)){this.errors.push(...a.errors);const s=a.inner.length?a.inner:[a];this.inner.push(...s)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}vo=Symbol.hasInstance;xo=Symbol.toStringTag;class He extends Error{static formatError(t,r){const n=r.label||r.path||"this";return r=Object.assign({},r,{path:n,originalPath:r.path}),typeof t=="string"?t.replace(Ac,(i,a)=>Vt(r[a])):typeof t=="function"?t(r):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,r,n,i,a){const s=new Va(t,r,n,i);if(a)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[xo]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,He)}static[vo](t){return Va[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let dt={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:n})=>{const i=n!=null&&n!==r?` (cast from the value \`${Vt(n,!0)}\`).`:".";return t!=="mixed"?`${e} must be a \`${t}\` type, but the final value was: \`${Vt(r,!0)}\``+i:`${e} must match the configured type. The validated value was: \`${Vt(r,!0)}\``+i}},Le={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Ct={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},$i={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Di={isValue:"${path} field must be ${value}"},Sn={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Fc={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},jc={notType:e=>{const{path:t,value:r,spec:n}=e,i=n.types.length;if(Array.isArray(r)){if(r.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${r.length} for value: \`${Vt(r,!0)}\``;if(r.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${r.length} for value: \`${Vt(r,!0)}\``}return He.formatError(dt.notType,e)}};Object.assign(Object.create(null),{mixed:dt,string:Le,number:Ct,date:$i,object:Sn,array:Fc,boolean:Di,tuple:jc});const ta=e=>e&&e.__isYupSchema__;class jn{static fromOptions(t,r){if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:i,otherwise:a}=r,s=typeof n=="function"?n:(...o)=>o.every(l=>l===n);return new jn(t,(o,l)=>{var p;let d=s(...o)?i:a;return(p=d==null?void 0:d(l))!=null?p:l})}constructor(t,r){this.fn=void 0,this.refs=t,this.refs=t,this.fn=r}resolve(t,r){let n=this.refs.map(a=>a.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),i=this.fn(n,t,r);if(i===void 0||i===t)return t;if(!ta(i))throw new TypeError("conditions must return a schema object");return i.resolve(r)}}const fn={context:"$",value:"."};class or{constructor(t,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===fn.context,this.isValue=this.key[0]===fn.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?fn.context:this.isValue?fn.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&ir.getter(this.path,!0),this.map=r.map}getValue(t,r,n){let i=this.isContext?n:this.isValue?t:r;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(t,r){return this.getValue(t,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}or.prototype.__isYupRef=!0;const ot=e=>e==null;function pr(e){function t({value:r,path:n="",options:i,originalValue:a,schema:s},o,l){const{name:p,test:d,params:f,message:m,skipAbsent:x}=e;let{parent:g,context:c,abortEarly:b=s.spec.abortEarly,disableStackTrace:y=s.spec.disableStackTrace}=i;function T(F){return or.isRef(F)?F.getValue(r,g,c):F}function j(F={}){const O=Object.assign({value:r,originalValue:a,label:s.spec.label,path:F.path||n,spec:s.spec,disableStackTrace:F.disableStackTrace||y},f,F.params);for(const V of Object.keys(O))O[V]=T(O[V]);const I=new He(He.formatError(F.message||m,O),r,O.path,F.type||p,O.disableStackTrace);return I.params=O,I}const A=b?o:l;let w={path:n,parent:g,type:p,from:i.from,createError:j,resolve:T,options:i,originalValue:a,schema:s};const N=F=>{He.isError(F)?A(F):F?l(null):A(j())},Q=F=>{He.isError(F)?A(F):o(F)};if(x&&ot(r))return N(!0);let G;try{var u;if(G=d.call(w,r,w),typeof((u=G)==null?void 0:u.then)=="function"){if(i.sync)throw new Error(`Validation test of type: "${w.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(G).then(N,Q)}}catch(F){Q(F);return}N(G)}return t.OPTIONS=e,t}function $c(e,t,r,n=r){let i,a,s;return t?(ir.forEach(t,(o,l,p)=>{let d=l?o.slice(1,o.length-1):o;e=e.resolve({context:n,parent:i,value:r});let f=e.type==="tuple",m=p?parseInt(d,10):0;if(e.innerType||f){if(f&&!p)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(r&&m>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${o}, in the path: ${t}. because there is no value at that index. `);i=r,r=r&&r[m],e=f?e.spec.types[m]:e.innerType}if(!p){if(!e.fields||!e.fields[d])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${s} which is a type: "${e.type}")`);i=r,r=r&&r[d],e=e.fields[d]}a=d,s=l?"["+o+"]":"."+o}),{schema:e,parent:i,parentPath:a}):{parent:i,parentPath:t,schema:e}}class $n extends Set{describe(){const t=[];for(const r of this.values())t.push(or.isRef(r)?r.describe():r);return t}resolveAll(t){let r=[];for(const n of this.values())r.push(t(n));return r}clone(){return new $n(this.values())}merge(t,r){const n=this.clone();return t.forEach(i=>n.add(i)),r.forEach(i=>n.delete(i)),n}}function vr(e,t=new Map){if(ta(e)||!e||typeof e!="object")return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let n=0;n<e.length;n++)r[n]=vr(e[n],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,i]of e.entries())r.set(n,vr(i,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e)r.add(vr(n,t))}else if(e instanceof Object){r={},t.set(e,r);for(const[n,i]of Object.entries(e))r[n]=vr(i,t)}else throw Error(`Unable to clone ${e}`);return r}class Ye{constructor(t){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new $n,this._blacklist=new $n,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(dt.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(r=>{r.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeCheck=this._typeCheck,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.internalTests=Object.assign({},this.internalTests),r.exclusiveTests=Object.assign({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=vr(Object.assign({},this.spec,t)),r}label(t){let r=this.clone();return r.spec.label=t,r}meta(...t){if(t.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},t[0]),r}withMutation(t){let r=this._mutate;this._mutate=!0;let n=t(this);return this._mutate=r,n}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let r=this,n=t.clone();const i=Object.assign({},r.spec,n.spec);return n.spec=i,n.internalTests=Object.assign({},r.internalTests,n.internalTests),n._whitelist=r._whitelist.merge(t._whitelist,t._blacklist),n._blacklist=r._blacklist.merge(t._blacklist,t._whitelist),n.tests=r.tests,n.exclusiveTests=r.exclusiveTests,n.withMutation(a=>{t.tests.forEach(s=>{a.test(s.OPTIONS)})}),n.transforms=[...r.transforms,...n.transforms],n}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let r=this;if(r.conditions.length){let n=r.conditions;r=r.clone(),r.conditions=[],r=n.reduce((i,a)=>a.resolve(i,t),r),r=r.resolve(t)}return r}resolveOptions(t){var r,n,i,a;return Object.assign({},t,{from:t.from||[],strict:(r=t.strict)!=null?r:this.spec.strict,abortEarly:(n=t.abortEarly)!=null?n:this.spec.abortEarly,recursive:(i=t.recursive)!=null?i:this.spec.recursive,disableStackTrace:(a=t.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(t,r={}){let n=this.resolve(Object.assign({value:t},r)),i=r.assert==="ignore-optionality",a=n._cast(t,r);if(r.assert!==!1&&!n.isType(a)){if(i&&ot(a))return a;let s=Vt(t),o=Vt(a);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}".
|
|
2
2
|
|
|
3
3
|
attempted value: ${s}
|
|
4
|
-
`+(o!==s?`result of cast: ${o}`:""))}return a}_cast(t,r){let n=t===void 0?t:this.transforms.reduce((i,a)=>a.call(this,i,t,this),t);return n===void 0&&(n=this.getDefault(r)),n}_validate(t,r={},n,i){let{path:a,originalValue:s=t,strict:o=this.spec.strict}=r,l=t;o||(l=this._cast(l,Object.assign({assert:!1},r)));let p=[];for(let d of Object.values(this.internalTests))d&&p.push(d);this.runTests({path:a,value:l,originalValue:s,options:r,tests:p},n,d=>{if(d.length)return i(d,l);this.runTests({path:a,value:l,originalValue:s,options:r,tests:this.tests},n,i)})}runTests(t,r,n){let i=!1,{tests:a,value:s,originalValue:o,path:l,options:p}=t,d=c=>{i||(i=!0,r(c,s))},f=c=>{i||(i=!0,n(c,s))},m=a.length,x=[];if(!m)return f([]);let g={value:s,originalValue:o,path:l,options:p,schema:this};for(let c=0;c<a.length;c++){const b=a[c];b(g,d,function(T){T&&(Array.isArray(T)?x.push(...T):x.push(T)),--m<=0&&f(x)})}}asNestedTest({key:t,index:r,parent:n,parentPath:i,originalParent:a,options:s}){const o=t??r;if(o==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof o=="number";let p=n[o];const d=Object.assign({},s,{strict:!0,parent:n,value:p,originalValue:a[o],key:void 0,[l?"index":"key"]:o,path:l||o.includes(".")?`${i||""}[${l?o:`"${o}"`}]`:(i?`${i}.`:"")+t});return(f,m,x)=>this.resolve(d)._validate(p,d,m,x)}validate(t,r){var n;let i=this.resolve(Object.assign({},r,{value:t})),a=(n=r==null?void 0:r.disableStackTrace)!=null?n:i.spec.disableStackTrace;return new Promise((s,o)=>i._validate(t,r,(l,p)=>{He.isError(l)&&(l.value=p),o(l)},(l,p)=>{l.length?o(new He(l,p,void 0,void 0,a)):s(p)}))}validateSync(t,r){var n;let i=this.resolve(Object.assign({},r,{value:t})),a,s=(n=r==null?void 0:r.disableStackTrace)!=null?n:i.spec.disableStackTrace;return i._validate(t,Object.assign({},r,{sync:!0}),(o,l)=>{throw He.isError(o)&&(o.value=l),o},(o,l)=>{if(o.length)throw new He(o,t,void 0,void 0,s);a=l}),a}isValid(t,r){return this.validate(t,r).then(()=>!0,n=>{if(He.isError(n))return!1;throw n})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(n){if(He.isError(n))return!1;throw n}}_getDefault(t){let r=this.spec.default;return r==null?r:typeof r=="function"?r.call(this,t):vr(r)}getDefault(t){return this.resolve(t||{})._getDefault(t)}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,r){const n=this.clone({nullable:t});return n.internalTests.nullable=pr({message:r,name:"nullable",test(i){return i===null?this.schema.spec.nullable:!0}}),n}optionality(t,r){const n=this.clone({optional:t});return n.internalTests.optionality=pr({message:r,name:"optionality",test(i){return i===void 0?this.schema.spec.optional:!0}}),n}optional(){return this.optionality(!0)}defined(t=dt.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=dt.notNull){return this.nullability(!1,t)}required(t=dt.required){return this.clone().withMutation(r=>r.nonNullable(t).defined(t))}notRequired(){return this.clone().withMutation(t=>t.nullable().optional())}transform(t){let r=this.clone();return r.transforms.push(t),r}test(...t){let r;if(t.length===1?typeof t[0]=="function"?r={test:t[0]}:r=t[0]:t.length===2?r={name:t[0],test:t[1]}:r={name:t[0],message:t[1],test:t[2]},r.message===void 0&&(r.message=dt.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),i=pr(r),a=r.exclusive||r.name&&n.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(n.exclusiveTests[r.name]=!!r.exclusive),n.tests=n.tests.filter(s=>!(s.OPTIONS.name===r.name&&(a||s.OPTIONS.test===i.OPTIONS.test))),n.tests.push(i),n}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let n=this.clone(),i=go(t).map(a=>new or(a));return i.forEach(a=>{a.isSibling&&n.deps.push(a.key)}),n.conditions.push(typeof r=="function"?new jn(i,r):jn.fromOptions(i,r)),n}typeError(t){let r=this.clone();return r.internalTests.typeError=pr({message:t,name:"typeError",skipAbsent:!0,test(n){return this.schema._typeCheck(n)?!0:this.createError({params:{type:this.schema.type}})}}),r}oneOf(t,r=dt.oneOf){let n=this.clone();return t.forEach(i=>{n._whitelist.add(i),n._blacklist.delete(i)}),n.internalTests.whiteList=pr({message:r,name:"oneOf",skipAbsent:!0,test(i){let a=this.schema._whitelist,s=a.resolveAll(this.resolve);return s.includes(i)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:s}})}}),n}notOneOf(t,r=dt.notOneOf){let n=this.clone();return t.forEach(i=>{n._blacklist.add(i),n._whitelist.delete(i)}),n.internalTests.blacklist=pr({message:r,name:"notOneOf",test(i){let a=this.schema._blacklist,s=a.resolveAll(this.resolve);return s.includes(i)?this.createError({params:{values:Array.from(a).join(", "),resolved:s}}):!0}}),n}strip(t=!0){let r=this.clone();return r.spec.strip=t,r}describe(t){const r=(t?this.resolve(t):this).clone(),{label:n,meta:i,optional:a,nullable:s}=r.spec;return{meta:i,label:n,optional:a,nullable:s,default:r.getDefault(t),type:r.type,oneOf:r._whitelist.describe(),notOneOf:r._blacklist.describe(),tests:r.tests.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,p,d)=>d.findIndex(f=>f.name===l.name)===p)}}}Ye.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])Ye.prototype[`${e}At`]=function(t,r,n={}){const{parent:i,parentPath:a,schema:s}=$c(this,t,r,n.context);return s[e](i&&i[a],Object.assign({},n,{parent:i,path:t}))};for(const e of["equals","is"])Ye.prototype[e]=Ye.prototype.oneOf;for(const e of["not","nope"])Ye.prototype[e]=Ye.prototype.notOneOf;const Dc=()=>!0;function bo(e){return new wo(e)}class wo extends Ye{constructor(t){super(typeof t=="function"?{type:"mixed",check:t}:Object.assign({type:"mixed",check:Dc},t))}}bo.prototype=wo.prototype;function So(){return new Eo}class Eo extends Ye{constructor(){super({type:"boolean",check(t){return t instanceof Boolean&&(t=t.valueOf()),typeof t=="boolean"}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(n.spec.coerce&&!n.isType(t)){if(/^(true|1)$/i.test(String(t)))return!0;if(/^(false|0)$/i.test(String(t)))return!1}return t})})}isTrue(t=Di.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return ot(r)||r===!0}})}isFalse(t=Di.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return ot(r)||r===!1}})}default(t){return super.default(t)}defined(t){return super.defined(t)}optional(){return super.optional()}required(t){return super.required(t)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(t){return super.nonNullable(t)}strip(t){return super.strip(t)}}So.prototype=Eo.prototype;const Rc=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Pc(e){const t=Ri(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return t.z!=="Z"&&t.plusMinus!==void 0&&(r=t.hourOffset*60+t.minuteOffset,t.plusMinus==="+"&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}function Ri(e){var t,r;const n=Rc.exec(e);return n?{year:yt(n[1]),month:yt(n[2],1)-1,day:yt(n[3],1),hour:yt(n[4]),minute:yt(n[5]),second:yt(n[6]),millisecond:n[7]?yt(n[7].substring(0,3)):0,precision:(t=(r=n[7])==null?void 0:r.length)!=null?t:void 0,z:n[8]||void 0,plusMinus:n[9]||void 0,hourOffset:yt(n[10]),minuteOffset:yt(n[11])}:null}function yt(e,t=0){return Number(e)||t}let Ic=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Mc=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,zc=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Vc="^\\d{4}-\\d{2}-\\d{2}",Nc="\\d{2}:\\d{2}:\\d{2}",Bc="(([+-]\\d{2}(:?\\d{2})?)|Z)",Lc=new RegExp(`${Vc}T${Nc}(\\.\\d+)?${Bc}$`),qc=e=>ot(e)||e===e.trim(),Uc={}.toString();function Br(){return new ko}class ko extends Ye{constructor(){super({type:"string",check(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce||n.isType(t)||Array.isArray(t))return t;const i=t!=null&&t.toString?t.toString():t;return i===Uc?t:i})})}required(t){return super.required(t).withMutation(r=>r.test({message:t||dt.required,name:"required",skipAbsent:!0,test:n=>!!n.length}))}notRequired(){return super.notRequired().withMutation(t=>(t.tests=t.tests.filter(r=>r.OPTIONS.name!=="required"),t))}length(t,r=Le.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(n){return n.length===this.resolve(t)}})}min(t,r=Le.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n.length>=this.resolve(t)}})}max(t,r=Le.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:t},skipAbsent:!0,test(n){return n.length<=this.resolve(t)}})}matches(t,r){let n=!1,i,a;return r&&(typeof r=="object"?{excludeEmptyString:n=!1,message:i,name:a}=r:i=r),this.test({name:a||"matches",message:i||Le.matches,params:{regex:t},skipAbsent:!0,test:s=>s===""&&n||s.search(t)!==-1})}email(t=Le.email){return this.matches(Ic,{name:"email",message:t,excludeEmptyString:!0})}url(t=Le.url){return this.matches(Mc,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=Le.uuid){return this.matches(zc,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let r="",n,i;return t&&(typeof t=="object"?{message:r="",allowOffset:n=!1,precision:i=void 0}=t:r=t),this.matches(Lc,{name:"datetime",message:r||Le.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||Le.datetime_offset,params:{allowOffset:n},skipAbsent:!0,test:a=>{if(!a||n)return!0;const s=Ri(a);return s?!!s.z:!1}}).test({name:"datetime_precision",message:r||Le.datetime_precision,params:{precision:i},skipAbsent:!0,test:a=>{if(!a||i==null)return!0;const s=Ri(a);return s?s.precision===i:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=Le.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:qc})}lowercase(t=Le.lowercase){return this.transform(r=>ot(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>ot(r)||r===r.toLowerCase()})}uppercase(t=Le.uppercase){return this.transform(r=>ot(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>ot(r)||r===r.toUpperCase()})}}Br.prototype=ko.prototype;let Wc=e=>e!=+e;function Oo(){return new To}class To extends Ye{constructor(){super({type:"number",check(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!Wc(t)}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce)return t;let i=t;if(typeof i=="string"){if(i=i.replace(/\s/g,""),i==="")return NaN;i=+i}return n.isType(i)||i===null?i:parseFloat(i)})})}min(t,r=Ct.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n>=this.resolve(t)}})}max(t,r=Ct.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(n){return n<=this.resolve(t)}})}lessThan(t,r=Ct.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:t},skipAbsent:!0,test(n){return n<this.resolve(t)}})}moreThan(t,r=Ct.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:t},skipAbsent:!0,test(n){return n>this.resolve(t)}})}positive(t=Ct.positive){return this.moreThan(0,t)}negative(t=Ct.negative){return this.lessThan(0,t)}integer(t=Ct.integer){return this.test({name:"integer",message:t,skipAbsent:!0,test:r=>Number.isInteger(r)})}truncate(){return this.transform(t=>ot(t)?t:t|0)}round(t){var r;let n=["ceil","floor","round","trunc"];if(t=((r=t)==null?void 0:r.toLowerCase())||"round",t==="trunc")return this.truncate();if(n.indexOf(t.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+n.join(", "));return this.transform(i=>ot(i)?i:Math[t](i))}}Oo.prototype=To.prototype;let Co=new Date(""),Hc=e=>Object.prototype.toString.call(e)==="[object Date]";function ra(){return new nn}class nn extends Ye{constructor(){super({type:"date",check(t){return Hc(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,r,n)=>!n.spec.coerce||n.isType(t)||t===null?t:(t=Pc(t),isNaN(t)?nn.INVALID_DATE:new Date(t)))})}prepareParam(t,r){let n;if(or.isRef(t))n=t;else{let i=this.cast(t);if(!this._typeCheck(i))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);n=i}return n}min(t,r=$i.min){let n=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(i){return i>=this.resolve(n)}})}max(t,r=$i.max){let n=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(i){return i<=this.resolve(n)}})}}nn.INVALID_DATE=Co;ra.prototype=nn.prototype;ra.INVALID_DATE=Co;function Kc(e,t=[]){let r=[],n=new Set,i=new Set(t.map(([s,o])=>`${s}-${o}`));function a(s,o){let l=ir.split(s)[0];n.add(l),i.has(`${o}-${l}`)||r.push([o,l])}for(const s of Object.keys(e)){let o=e[s];n.add(s),or.isRef(o)&&o.isSibling?a(o.path,s):ta(o)&&"deps"in o&&o.deps.forEach(l=>a(l,s))}return Sc.array(Array.from(n),r).reverse()}function Na(e,t){let r=1/0;return e.some((n,i)=>{var a;if((a=t.path)!=null&&a.includes(n))return r=i,!0}),r}function _o(e){return(t,r)=>Na(e,t)-Na(e,r)}const Qc=(e,t,r)=>{if(typeof e!="string")return e;let n=e;try{n=JSON.parse(e)}catch{}return r.isType(n)?n:e};function En(e){if("fields"in e){const t={};for(const[r,n]of Object.entries(e.fields))t[r]=En(n);return e.setFields(t)}if(e.type==="array"){const t=e.optional();return t.innerType&&(t.innerType=En(t.innerType)),t}return e.type==="tuple"?e.optional().clone({types:e.spec.types.map(En)}):"optional"in e?e.optional():e}const Gc=(e,t)=>{const r=[...ir.normalizePath(t)];if(r.length===1)return r[0]in e;let n=r.pop(),i=ir.getter(ir.join(r),!0)(e);return!!(i&&n in i)};let Ba=e=>Object.prototype.toString.call(e)==="[object Object]";function La(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(n=>r.indexOf(n)===-1)}const Yc=_o([]);function Ao(e){return new Fo(e)}class Fo extends Ye{constructor(t){super({type:"object",check(r){return Ba(r)||typeof r=="function"}}),this.fields=Object.create(null),this._sortErrors=Yc,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,r={}){var n;let i=super._cast(t,r);if(i===void 0)return this.getDefault(r);if(!this._typeCheck(i))return i;let a=this.fields,s=(n=r.stripUnknown)!=null?n:this.spec.noUnknown,o=[].concat(this._nodes,Object.keys(i).filter(f=>!this._nodes.includes(f))),l={},p=Object.assign({},r,{parent:l,__validating:r.__validating||!1}),d=!1;for(const f of o){let m=a[f],x=f in i;if(m){let g,c=i[f];p.path=(r.path?`${r.path}.`:"")+f,m=m.resolve({value:c,context:r.context,parent:l});let b=m instanceof Ye?m.spec:void 0,y=b==null?void 0:b.strict;if(b!=null&&b.strip){d=d||f in i;continue}g=!r.__validating||!y?m.cast(i[f],p):i[f],g!==void 0&&(l[f]=g)}else x&&!s&&(l[f]=i[f]);(x!==f in l||l[f]!==i[f])&&(d=!0)}return d?l:i}_validate(t,r={},n,i){let{from:a=[],originalValue:s=t,recursive:o=this.spec.recursive}=r;r.from=[{schema:this,value:s},...a],r.__validating=!0,r.originalValue=s,super._validate(t,r,n,(l,p)=>{if(!o||!Ba(p)){i(l,p);return}s=s||p;let d=[];for(let f of this._nodes){let m=this.fields[f];!m||or.isRef(m)||d.push(m.asNestedTest({options:r,key:f,parent:p,parentPath:r.path,originalParent:s}))}this.runTests({tests:d,value:p,originalValue:s,options:r},n,f=>{i(f.sort(this._sortErrors).concat(l),p)})})}clone(t){const r=super.clone(t);return r.fields=Object.assign({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(t){let r=super.concat(t),n=r.fields;for(let[i,a]of Object.entries(this.fields)){const s=n[i];n[i]=s===void 0?a:s}return r.withMutation(i=>i.setFields(n,[...this._excludedEdges,...t._excludedEdges]))}_getDefault(t){if("default"in this.spec)return super._getDefault(t);if(!this._nodes.length)return;let r={};return this._nodes.forEach(n=>{var i;const a=this.fields[n];let s=t;(i=s)!=null&&i.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[n]})),r[n]=a&&"getDefault"in a?a.getDefault(s):void 0}),r}setFields(t,r){let n=this.clone();return n.fields=t,n._nodes=Kc(t,r),n._sortErrors=_o(Object.keys(t)),r&&(n._excludedEdges=r),n}shape(t,r=[]){return this.clone().withMutation(n=>{let i=n._excludedEdges;return r.length&&(Array.isArray(r[0])||(r=[r]),i=[...n._excludedEdges,...r]),n.setFields(Object.assign(n.fields,t),i)})}partial(){const t={};for(const[r,n]of Object.entries(this.fields))t[r]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(t)}deepPartial(){return En(this)}pick(t){const r={};for(const n of t)this.fields[n]&&(r[n]=this.fields[n]);return this.setFields(r,this._excludedEdges.filter(([n,i])=>t.includes(n)&&t.includes(i)))}omit(t){const r=[];for(const n of Object.keys(this.fields))t.includes(n)||r.push(n);return this.pick(r)}from(t,r,n){let i=ir.getter(t,!0);return this.transform(a=>{if(!a)return a;let s=a;return Gc(a,t)&&(s=Object.assign({},a),n||delete s[t],s[r]=i(a)),s})}json(){return this.transform(Qc)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||Sn.exact,test(r){if(r==null)return!0;const n=La(this.schema,r);return n.length===0||this.createError({params:{properties:n.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,r=Sn.noUnknown){typeof t!="boolean"&&(r=t,t=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:r,test(i){if(i==null)return!0;const a=La(this.schema,i);return!t||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return n.spec.noUnknown=t,n}unknown(t=!0,r=Sn.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>{if(!r)return r;const n={};for(const i of Object.keys(r))n[t(i)]=r[i];return n})}camelCase(){return this.transformKeys(ii.camelCase)}snakeCase(){return this.transformKeys(ii.snakeCase)}constantCase(){return this.transformKeys(t=>ii.snakeCase(t).toUpperCase())}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);n.fields={};for(const[a,s]of Object.entries(r.fields)){var i;let o=t;(i=o)!=null&&i.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[a]})),n.fields[a]=s.describe(o)}return n}}Ao.prototype=Fo.prototype;const jo=e=>{const t={};return e.forEach(r=>{var a,s,o;let n;switch(r.type){case"text":case"textarea":case"tel":n=Br(),r.validation?n=Wt(n,r,"string"):(r.minLength&&(n=n.min(r.minLength,`${r.label} must be at least ${r.minLength} characters`)),r.maxLength&&(n=n.max(r.maxLength,`${r.label} must be at most ${r.maxLength} characters`)),r.pattern&&(n=n.test("pattern",`${r.label} format is invalid`,l=>l?new RegExp(r.pattern).test(l):!0)));break;case"email":n=Br().email(((a=r.validation)==null?void 0:a.message)||`${r.label} must be a valid email address`),r.validation&&(n=Wt(n,r,"string"));break;case"password":n=Br(),r.validation?n=Wt(n,r,"string"):(r.minLength&&(n=n.min(r.minLength,`${r.label} must be at least ${r.minLength} characters`)),r.maxLength&&(n=n.max(r.maxLength,`${r.label} must be at most ${r.maxLength} characters`)),r.pattern&&(n=n.test("pattern",`${r.label} format is invalid`,l=>l?new RegExp(r.pattern).test(l):!0)));break;case"number":n=Oo().typeError(`${r.label} must be a number`),r.validation?n=Wt(n,r,"number"):(r.min!==void 0&&(n=n.min(r.min,`${r.label} must be at least ${r.min}`)),r.max!==void 0&&(n=n.max(r.max,`${r.label} must be at most ${r.max}`)));break;case"select":n=Br(),r.validation&&(n=Wt(n,r,"string"));break;case"checkbox":n=So(),r.validation&&(n=Wt(n,r,"boolean"));break;case"date":n=ra().typeError(`${r.label} must be a valid date`),r.validation?n=Wt(n,r,"date"):(r.minDate&&(n=n.min(new Date(r.minDate),`${r.label} must be after ${r.minDate}`)),r.maxDate&&(n=n.max(new Date(r.maxDate),`${r.label} must be before ${r.maxDate}`)));break;default:n=bo()}if(((s=r.validation)==null?void 0:s.required)!==void 0?r.validation.required:r.required){const l=((o=r.validation)==null?void 0:o.message)||`${r.label} is required`;n=n.required(l)}t[r.name]=n}),Ao().shape(t)},Wt=(e,t,r)=>{const n=t.validation;if(!n)return e;if(r==="string"){if(n.minLength!==void 0){const i=n.message||`${t.label} must be at least ${n.minLength} characters`;e=e.min(n.minLength,i)}if(n.maxLength!==void 0){const i=n.message||`${t.label} must be at most ${n.maxLength} characters`;e=e.max(n.maxLength,i)}}if(r==="number"){if(n.min!==void 0){const i=n.message||`${t.label} must be at least ${n.min}`;e=e.min(n.min,i)}if(n.max!==void 0){const i=n.message||`${t.label} must be at most ${n.max}`;e=e.max(n.max,i)}}if(n.pattern){const i=typeof n.pattern=="string"?new RegExp(n.pattern):n.pattern,a=n.message||`${t.label} format is invalid`;e=e.test("pattern",a,s=>s?i.test(s):!0)}return n.custom&&(e=e.test("custom",n.message||`${t.label} is invalid`,i=>{const a=n.custom(i);return typeof a=="boolean"?a:!1})),e},$o=({currentStep:e,totalSteps:t,onStepChange:r,stepTitles:n=[],showStepTitles:i=!0,completedSteps:a=[]})=>{const s=M.useMemo(()=>Array.from({length:t},(d,f)=>f+1),[t]),o=M.useMemo(()=>Math.round(e/t*100),[e,t]),l=d=>n[d-1]||`Step ${d}`,p=d=>d===e||a.includes(d)||d===e+1&&a.includes(e);return k.jsxs(P.Card,{sx:{mb:1,p:1,boxShadow:"0px 1px 4px 0px #00000014",background:"#F8F8F8",borderRadius:"4px"},children:[k.jsxs(P.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[k.jsx(P.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap"},children:s.map((d,f)=>{const m=d===e,x=d<e||a.includes(d),g=m||x?"primary.main":"#8F97A4";return k.jsxs(P.Box,{sx:{display:"flex",alignItems:"center"},children:[k.jsxs(P.Box,{onClick:()=>p(d)&&r(d),sx:{display:"flex",alignItems:"center",cursor:p(d)?"pointer":"default"},children:[k.jsx(P.Box,{sx:{width:24,height:24,borderRadius:"50%",border:m||x?"2px solid":"1px solid",borderColor:m||x?"primary.main":"#8F97A4",display:"flex",alignItems:"center",justifyContent:"center",mr:.5,color:g,fontWeight:m||x?600:500,fontSize:"12px"},children:d}),i&&k.jsx(P.Typography,{sx:{fontSize:"12px",fontWeight:600,color:g},children:l(d)})]}),f<s.length-1&&k.jsx(P.Box,{sx:{width:40,height:2,mx:1,borderRadius:1,backgroundColor:d<e?"primary.main":"#DFE3E8"}})]},d)})}),k.jsx(P.Typography,{sx:{color:"#8F97A4",fontSize:"12px",fontWeight:500},children:`Step ${e} of ${t}, ${o}% complete`})]}),k.jsx(P.LinearProgress,{variant:"determinate",value:o,sx:{height:4,borderRadius:"50px",backgroundColor:d=>d.palette.grey[300],"& .MuiLinearProgress-bar":{backgroundColor:"primary.main",borderRadius:5}}})]})},Do=({buttons:e,disabled:t=!1})=>{const r=o=>{o.onClick&&o.onClick()},n=e.filter(o=>o.position==="left"||!o.position),i=e.filter(o=>o.position==="center"),a=e.filter(o=>o.position==="right"),s=(o,l)=>{const p=(o.text||"").toLowerCase(),d=o.type==="submit"||p.includes("submit")||p.includes("save")||p.includes("next"),f=o.position==="left"||p.includes("cancel")||p.includes("back")||p.includes("draft"),m=o.type?o.type:d?"submit":"button",x=f?"outlined":"contained",g=o.disabled||t,c=b=>b&&["primary","secondary","error","info","success","warning"].includes(b)?b:"primary";return k.jsxs(P.Button,{type:m,variant:x,color:c(o.color),size:o.size||"large",disabled:g,onClick:o.onClick?()=>r(o):void 0,sx:o.sx,children:[o.loading&&k.jsx(P.CircularProgress,{size:20,sx:{mr:1}}),o.text]},`${o.text}-${l}`)};return k.jsxs(P.Box,{sx:{mt:3,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsx(P.Box,{sx:{display:"flex",gap:2},children:n.map((o,l)=>s(o,l))}),k.jsx(P.Box,{sx:{display:"flex",gap:2},children:i.map((o,l)=>s(o,l))}),k.jsx(P.Box,{sx:{display:"flex",gap:2},children:a.map((o,l)=>s(o,l))})]})},Zc=({config:e,onSubmit:t,onStepChange:r,currentStep:n=1,totalSteps:i=1,isMultiStep:a=!1,formData:s})=>{const{buttons:o,position:l="right",layout:p="horizontal",spacing:d=2,sx:f}=e,m=y=>{let T="button",j="contained";return y.type?T=y.type:y.text.toLowerCase().includes("submit")||y.text.toLowerCase().includes("save")||y.text.toLowerCase().includes("next")?T="submit":(y.text.toLowerCase().includes("reset")||y.text.toLowerCase().includes("clear"))&&(T="reset"),(y.text.toLowerCase().includes("cancel")||y.text.toLowerCase().includes("back")||y.text.toLowerCase().includes("draft"))&&(j="outlined"),{buttonType:T,buttonVariant:j}},x=y=>["primary","secondary","error","warning","info","success"].includes(y||"")?y:"primary",g=y=>{const{buttonType:T}=m(y);y.onClick?y.onClick():T==="submit"&&t?t(s):a&&r&&(y.text.toLowerCase().includes("next")?r(n+1,i):(y.text.toLowerCase().includes("back")||y.text.toLowerCase().includes("previous"))&&r(n-1,i))},c=(y,T)=>{const{buttonType:j,buttonVariant:A}=m(y),w=x(y.color);return k.jsx(P.Button,{type:j,variant:A,color:w,size:y.size||"medium",disabled:y.disabled,onClick:()=>g(y),sx:y.sx,children:y.text},T)},b=()=>{const y={display:"flex",gap:d,...f};switch(l){case"left":return{...y,justifyContent:"flex-start"};case"center":return{...y,justifyContent:"center"};case"right":return{...y,justifyContent:"flex-end"};case"space-between":return{...y,justifyContent:"space-between"};default:return{...y,justifyContent:"flex-end"}}};return p==="vertical"?k.jsx(P.Box,{sx:b(),children:o.map((y,T)=>k.jsx(P.Box,{sx:{width:"100%"},children:c(y,T)},T))}):k.jsx(P.Box,{sx:b(),children:k.jsx(P.ButtonGroup,{variant:"outlined",size:"medium",children:o.map((y,T)=>c(y,T))})})},Jc=new Xl({defaultOptions:{queries:{staleTime:15*60*1e3,gcTime:30*60*1e3,retry:3,retryDelay:e=>Math.min(1e3*2**e,3e4),refetchOnWindowFocus:!1,refetchOnReconnect:!0}}}),Xc=e=>k.jsx(ic,{client:Jc,children:k.jsx(eu,{...e})}),eu=({id:e,theme:t,fields:r,onSubmit:n,onChange:i,submitButtonText:a="Submit",onSubmitClick:s,defaultValues:o,showSubmitButton:l=!0,buttons:p,buttonGroup:d,baseUrl:f,apiHeaders:m,stepNavigationProps:x})=>{var ee,ce;const g=[...new Set(r.map(R=>R.step).filter(R=>R!=null&&R>0))].sort((R,H)=>(R||0)-(H||0)),c=g.length>1,b=g.length||1,[y,T]=M.useState(1),j=c?r.filter(R=>R.step===y):r,A=M.useMemo(()=>jo(j),[j]),{control:w,handleSubmit:N,formState:{errors:Q},watch:ne,resetField:G,trigger:u}=$l({resolver:Pl(A),mode:"onChange",defaultValues:o}),F=ne(),O=M.useRef({});M.useEffect(()=>{const R=[];for(const H of r){const te=H.depends_on;te&&typeof H.name=="string"&&R.push({dependentField:H.name,dependencyName:te})}if(R.length!==0)for(const{dependentField:H,dependencyName:te}of R){const D=O.current[te],pe=F==null?void 0:F[te];if(D!==pe)try{G(H)}catch{}O.current[te]=pe}},[r,F,G]);const I=M.useRef(i);M.useEffect(()=>{I.current=i},[i]);const V=M.useMemo(()=>{try{return JSON.stringify(F)}catch{return String(Date.now())}},[F]),B=M.useRef(null);M.useEffect(()=>{I.current&&B.current!==V&&(B.current=V,I.current(F))},[V]);const K=async()=>{if(!c)return!0;const R=r.filter(te=>te.step===y);for(const te of R)if(te.required){const D=F[te.name];let pe=!0;if(te.type==="checkbox"?pe=D===!0:Array.isArray(D)?pe=D.length>0:pe=D!=null&&D!=="",!pe)return!1}return await u()?!0:Object.keys(Q).filter(D=>R.some(pe=>pe.name===D)).map(D=>{const pe=Q[D];return typeof(pe==null?void 0:pe.message)=="string"?pe.message:`${D} is invalid`}).length===0},le=M.useMemo(()=>{if(!c)return!0;const R=r.filter(te=>te.step===y);for(const te of R)if(te.required){const D=F[te.name];let pe=!0;if(te.type==="checkbox"?pe=D===!0:Array.isArray(D)?pe=D.length>0:pe=D!=null&&D!=="",!pe)return!1}return Object.keys(Q).filter(te=>R.some(D=>D.name===te)).length===0},[c,y,r,F,Q]),fe=M.useMemo(()=>{if(c)return le;for(const R of r)if(R.required){const H=F[R.name];let te=!0;if(R.type==="checkbox"?te=H===!0:te=H!=null&&H!==""&&!(Array.isArray(H)&&H.length===0),!te)return!1}return Object.keys(Q).length===0},[c,le,r,F,Q]),de=async R=>{R<1||R>b||R>y&&c&&!await K()||T(R)},z=async R=>{if(c&&y<b){console.warn("Form submission attempted on non-final step");return}s&&s(R),n(R)},W=async R=>{R&&(R.preventDefault(),R.stopPropagation()),c&&y<b&&await K()&&de(y+1)},L=R=>{R&&(R.preventDefault(),R.stopPropagation()),c&&y>1&&de(y-1)},Y=R=>R.col?R.col:(R.xs||R.sm||R.md||R.lg||R.xl)&&(R.xs||R.sm||R.md||R.lg||R.xl)||12,J=t?P.createTheme({palette:{primary:{main:t.primaryColor||"#1976d2"},secondary:{main:t.secondaryColor||"#dc004e"},background:{default:t.backgroundColor||"#ffffff"},text:{primary:t.textColor||"#000000"}},shape:{borderRadius:t.borderRadius||4},spacing:t.spacing||8,typography:{fontFamily:((ee=t.typography)==null?void 0:ee.fontFamily)||"Roboto, Arial, sans-serif",fontSize:typeof((ce=t.typography)==null?void 0:ce.fontSize)=="number"?t.typography.fontSize:14}}):void 0,ae=()=>{if(d&&d.buttons&&d.buttons.length>0){const R={...d,buttons:d.buttons.map(H=>{const te=(H.text||"").toLowerCase(),D=H.type==="submit"||te.includes("submit")||te.includes("save")||te.includes("finish")||te.includes("complete"),pe=te.includes("next");let Re=!1;return c?(D||pe)&&(Re=!le):D&&(Re=!fe),{...H,disabled:H.disabled||Re}})};return k.jsx(P.Box,{sx:{mt:3},children:k.jsx(Zc,{config:R,onSubmit:z,onStepChange:de,currentStep:y,totalSteps:b,isMultiStep:c,formData:F})})}if(p&&p.length>0){const R=p.map(H=>{const te=(H.text||"").toLowerCase(),D=H.type==="submit"||te.includes("submit")||te.includes("save")||te.includes("finish")||te.includes("complete"),pe=te.includes("next");let Re=!1;return c?(D||pe)&&(Re=!le):D&&(Re=!fe),{...H,disabled:H.disabled||Re}});return k.jsx(Do,{buttons:R})}return l?k.jsx(P.Box,{sx:{mt:3,display:"flex",justifyContent:"flex-end",flexDirection:"column",alignItems:"flex-end"},children:k.jsxs(P.Box,{sx:{display:"flex",gap:2},children:[c&&y>1&&k.jsx(P.Button,{type:"button",variant:"outlined",onClick:L,children:"Previous"}),c?y<b?k.jsx(P.Button,{type:"button",variant:"contained",color:"primary",size:"large",disabled:!le,onClick:W,children:"Next"}):k.jsx(P.Button,{type:"submit",variant:"contained",color:"primary",size:"large",disabled:!le,children:a}):k.jsx(P.Button,{type:"submit",variant:"contained",color:"primary",size:"large",disabled:!fe,children:a})]})}):null},ie=k.jsxs(P.Box,{component:"form",onSubmit:R=>{if(c&&y<b){R.preventDefault(),R.stopPropagation(),le&&W();return}N(z)(R)},id:e,onKeyDown:R=>{R.key==="Enter"&&c&&y<b&&(R.preventDefault(),le&&W())},children:[c&&k.jsx($o,{currentStep:y,totalSteps:b,onStepChange:de,stepTitles:x==null?void 0:x.stepTitles,showStepTitles:(x==null?void 0:x.showStepTitles)!==!1}),k.jsx(P.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",gap:2},children:j.map(R=>{const H=Y(R);return k.jsx(P.Box,{sx:{gridColumn:`span ${H}`},children:k.jsx(ho,{field:R,control:w,errors:Q,baseUrl:f,apiHeaders:m,formData:F})},R.name)})}),ae()]});return J?k.jsx(P.ThemeProvider,{theme:J,children:ie}):ie},qa=e=>e,tu=()=>{let e=qa;return{configure(t){e=t},generate(t){return e(t)},reset(){e=qa}}},ru=tu();function Nt(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}function sr(e){if(typeof e!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":Nt(7));return e.charAt(0).toUpperCase()+e.slice(1)}var mn={exports:{}},hn={exports:{}},ge={};/** @license React v16.13.1
|
|
4
|
+
`+(o!==s?`result of cast: ${o}`:""))}return a}_cast(t,r){let n=t===void 0?t:this.transforms.reduce((i,a)=>a.call(this,i,t,this),t);return n===void 0&&(n=this.getDefault(r)),n}_validate(t,r={},n,i){let{path:a,originalValue:s=t,strict:o=this.spec.strict}=r,l=t;o||(l=this._cast(l,Object.assign({assert:!1},r)));let p=[];for(let d of Object.values(this.internalTests))d&&p.push(d);this.runTests({path:a,value:l,originalValue:s,options:r,tests:p},n,d=>{if(d.length)return i(d,l);this.runTests({path:a,value:l,originalValue:s,options:r,tests:this.tests},n,i)})}runTests(t,r,n){let i=!1,{tests:a,value:s,originalValue:o,path:l,options:p}=t,d=c=>{i||(i=!0,r(c,s))},f=c=>{i||(i=!0,n(c,s))},m=a.length,x=[];if(!m)return f([]);let g={value:s,originalValue:o,path:l,options:p,schema:this};for(let c=0;c<a.length;c++){const b=a[c];b(g,d,function(T){T&&(Array.isArray(T)?x.push(...T):x.push(T)),--m<=0&&f(x)})}}asNestedTest({key:t,index:r,parent:n,parentPath:i,originalParent:a,options:s}){const o=t??r;if(o==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof o=="number";let p=n[o];const d=Object.assign({},s,{strict:!0,parent:n,value:p,originalValue:a[o],key:void 0,[l?"index":"key"]:o,path:l||o.includes(".")?`${i||""}[${l?o:`"${o}"`}]`:(i?`${i}.`:"")+t});return(f,m,x)=>this.resolve(d)._validate(p,d,m,x)}validate(t,r){var n;let i=this.resolve(Object.assign({},r,{value:t})),a=(n=r==null?void 0:r.disableStackTrace)!=null?n:i.spec.disableStackTrace;return new Promise((s,o)=>i._validate(t,r,(l,p)=>{He.isError(l)&&(l.value=p),o(l)},(l,p)=>{l.length?o(new He(l,p,void 0,void 0,a)):s(p)}))}validateSync(t,r){var n;let i=this.resolve(Object.assign({},r,{value:t})),a,s=(n=r==null?void 0:r.disableStackTrace)!=null?n:i.spec.disableStackTrace;return i._validate(t,Object.assign({},r,{sync:!0}),(o,l)=>{throw He.isError(o)&&(o.value=l),o},(o,l)=>{if(o.length)throw new He(o,t,void 0,void 0,s);a=l}),a}isValid(t,r){return this.validate(t,r).then(()=>!0,n=>{if(He.isError(n))return!1;throw n})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(n){if(He.isError(n))return!1;throw n}}_getDefault(t){let r=this.spec.default;return r==null?r:typeof r=="function"?r.call(this,t):vr(r)}getDefault(t){return this.resolve(t||{})._getDefault(t)}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,r){const n=this.clone({nullable:t});return n.internalTests.nullable=pr({message:r,name:"nullable",test(i){return i===null?this.schema.spec.nullable:!0}}),n}optionality(t,r){const n=this.clone({optional:t});return n.internalTests.optionality=pr({message:r,name:"optionality",test(i){return i===void 0?this.schema.spec.optional:!0}}),n}optional(){return this.optionality(!0)}defined(t=dt.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=dt.notNull){return this.nullability(!1,t)}required(t=dt.required){return this.clone().withMutation(r=>r.nonNullable(t).defined(t))}notRequired(){return this.clone().withMutation(t=>t.nullable().optional())}transform(t){let r=this.clone();return r.transforms.push(t),r}test(...t){let r;if(t.length===1?typeof t[0]=="function"?r={test:t[0]}:r=t[0]:t.length===2?r={name:t[0],test:t[1]}:r={name:t[0],message:t[1],test:t[2]},r.message===void 0&&(r.message=dt.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),i=pr(r),a=r.exclusive||r.name&&n.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(n.exclusiveTests[r.name]=!!r.exclusive),n.tests=n.tests.filter(s=>!(s.OPTIONS.name===r.name&&(a||s.OPTIONS.test===i.OPTIONS.test))),n.tests.push(i),n}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let n=this.clone(),i=go(t).map(a=>new or(a));return i.forEach(a=>{a.isSibling&&n.deps.push(a.key)}),n.conditions.push(typeof r=="function"?new jn(i,r):jn.fromOptions(i,r)),n}typeError(t){let r=this.clone();return r.internalTests.typeError=pr({message:t,name:"typeError",skipAbsent:!0,test(n){return this.schema._typeCheck(n)?!0:this.createError({params:{type:this.schema.type}})}}),r}oneOf(t,r=dt.oneOf){let n=this.clone();return t.forEach(i=>{n._whitelist.add(i),n._blacklist.delete(i)}),n.internalTests.whiteList=pr({message:r,name:"oneOf",skipAbsent:!0,test(i){let a=this.schema._whitelist,s=a.resolveAll(this.resolve);return s.includes(i)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:s}})}}),n}notOneOf(t,r=dt.notOneOf){let n=this.clone();return t.forEach(i=>{n._blacklist.add(i),n._whitelist.delete(i)}),n.internalTests.blacklist=pr({message:r,name:"notOneOf",test(i){let a=this.schema._blacklist,s=a.resolveAll(this.resolve);return s.includes(i)?this.createError({params:{values:Array.from(a).join(", "),resolved:s}}):!0}}),n}strip(t=!0){let r=this.clone();return r.spec.strip=t,r}describe(t){const r=(t?this.resolve(t):this).clone(),{label:n,meta:i,optional:a,nullable:s}=r.spec;return{meta:i,label:n,optional:a,nullable:s,default:r.getDefault(t),type:r.type,oneOf:r._whitelist.describe(),notOneOf:r._blacklist.describe(),tests:r.tests.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,p,d)=>d.findIndex(f=>f.name===l.name)===p)}}}Ye.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])Ye.prototype[`${e}At`]=function(t,r,n={}){const{parent:i,parentPath:a,schema:s}=$c(this,t,r,n.context);return s[e](i&&i[a],Object.assign({},n,{parent:i,path:t}))};for(const e of["equals","is"])Ye.prototype[e]=Ye.prototype.oneOf;for(const e of["not","nope"])Ye.prototype[e]=Ye.prototype.notOneOf;const Dc=()=>!0;function bo(e){return new wo(e)}class wo extends Ye{constructor(t){super(typeof t=="function"?{type:"mixed",check:t}:Object.assign({type:"mixed",check:Dc},t))}}bo.prototype=wo.prototype;function So(){return new Eo}class Eo extends Ye{constructor(){super({type:"boolean",check(t){return t instanceof Boolean&&(t=t.valueOf()),typeof t=="boolean"}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(n.spec.coerce&&!n.isType(t)){if(/^(true|1)$/i.test(String(t)))return!0;if(/^(false|0)$/i.test(String(t)))return!1}return t})})}isTrue(t=Di.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return ot(r)||r===!0}})}isFalse(t=Di.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return ot(r)||r===!1}})}default(t){return super.default(t)}defined(t){return super.defined(t)}optional(){return super.optional()}required(t){return super.required(t)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(t){return super.nonNullable(t)}strip(t){return super.strip(t)}}So.prototype=Eo.prototype;const Rc=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Pc(e){const t=Ri(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return t.z!=="Z"&&t.plusMinus!==void 0&&(r=t.hourOffset*60+t.minuteOffset,t.plusMinus==="+"&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}function Ri(e){var t,r;const n=Rc.exec(e);return n?{year:yt(n[1]),month:yt(n[2],1)-1,day:yt(n[3],1),hour:yt(n[4]),minute:yt(n[5]),second:yt(n[6]),millisecond:n[7]?yt(n[7].substring(0,3)):0,precision:(t=(r=n[7])==null?void 0:r.length)!=null?t:void 0,z:n[8]||void 0,plusMinus:n[9]||void 0,hourOffset:yt(n[10]),minuteOffset:yt(n[11])}:null}function yt(e,t=0){return Number(e)||t}let Ic=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Mc=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,zc=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Vc="^\\d{4}-\\d{2}-\\d{2}",Nc="\\d{2}:\\d{2}:\\d{2}",Bc="(([+-]\\d{2}(:?\\d{2})?)|Z)",Lc=new RegExp(`${Vc}T${Nc}(\\.\\d+)?${Bc}$`),qc=e=>ot(e)||e===e.trim(),Uc={}.toString();function Br(){return new ko}class ko extends Ye{constructor(){super({type:"string",check(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce||n.isType(t)||Array.isArray(t))return t;const i=t!=null&&t.toString?t.toString():t;return i===Uc?t:i})})}required(t){return super.required(t).withMutation(r=>r.test({message:t||dt.required,name:"required",skipAbsent:!0,test:n=>!!n.length}))}notRequired(){return super.notRequired().withMutation(t=>(t.tests=t.tests.filter(r=>r.OPTIONS.name!=="required"),t))}length(t,r=Le.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(n){return n.length===this.resolve(t)}})}min(t,r=Le.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n.length>=this.resolve(t)}})}max(t,r=Le.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:t},skipAbsent:!0,test(n){return n.length<=this.resolve(t)}})}matches(t,r){let n=!1,i,a;return r&&(typeof r=="object"?{excludeEmptyString:n=!1,message:i,name:a}=r:i=r),this.test({name:a||"matches",message:i||Le.matches,params:{regex:t},skipAbsent:!0,test:s=>s===""&&n||s.search(t)!==-1})}email(t=Le.email){return this.matches(Ic,{name:"email",message:t,excludeEmptyString:!0})}url(t=Le.url){return this.matches(Mc,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=Le.uuid){return this.matches(zc,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let r="",n,i;return t&&(typeof t=="object"?{message:r="",allowOffset:n=!1,precision:i=void 0}=t:r=t),this.matches(Lc,{name:"datetime",message:r||Le.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||Le.datetime_offset,params:{allowOffset:n},skipAbsent:!0,test:a=>{if(!a||n)return!0;const s=Ri(a);return s?!!s.z:!1}}).test({name:"datetime_precision",message:r||Le.datetime_precision,params:{precision:i},skipAbsent:!0,test:a=>{if(!a||i==null)return!0;const s=Ri(a);return s?s.precision===i:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=Le.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:qc})}lowercase(t=Le.lowercase){return this.transform(r=>ot(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>ot(r)||r===r.toLowerCase()})}uppercase(t=Le.uppercase){return this.transform(r=>ot(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>ot(r)||r===r.toUpperCase()})}}Br.prototype=ko.prototype;let Wc=e=>e!=+e;function Oo(){return new To}class To extends Ye{constructor(){super({type:"number",check(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!Wc(t)}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce)return t;let i=t;if(typeof i=="string"){if(i=i.replace(/\s/g,""),i==="")return NaN;i=+i}return n.isType(i)||i===null?i:parseFloat(i)})})}min(t,r=Ct.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n>=this.resolve(t)}})}max(t,r=Ct.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(n){return n<=this.resolve(t)}})}lessThan(t,r=Ct.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:t},skipAbsent:!0,test(n){return n<this.resolve(t)}})}moreThan(t,r=Ct.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:t},skipAbsent:!0,test(n){return n>this.resolve(t)}})}positive(t=Ct.positive){return this.moreThan(0,t)}negative(t=Ct.negative){return this.lessThan(0,t)}integer(t=Ct.integer){return this.test({name:"integer",message:t,skipAbsent:!0,test:r=>Number.isInteger(r)})}truncate(){return this.transform(t=>ot(t)?t:t|0)}round(t){var r;let n=["ceil","floor","round","trunc"];if(t=((r=t)==null?void 0:r.toLowerCase())||"round",t==="trunc")return this.truncate();if(n.indexOf(t.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+n.join(", "));return this.transform(i=>ot(i)?i:Math[t](i))}}Oo.prototype=To.prototype;let Co=new Date(""),Hc=e=>Object.prototype.toString.call(e)==="[object Date]";function ra(){return new nn}class nn extends Ye{constructor(){super({type:"date",check(t){return Hc(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,r,n)=>!n.spec.coerce||n.isType(t)||t===null?t:(t=Pc(t),isNaN(t)?nn.INVALID_DATE:new Date(t)))})}prepareParam(t,r){let n;if(or.isRef(t))n=t;else{let i=this.cast(t);if(!this._typeCheck(i))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);n=i}return n}min(t,r=$i.min){let n=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(i){return i>=this.resolve(n)}})}max(t,r=$i.max){let n=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(i){return i<=this.resolve(n)}})}}nn.INVALID_DATE=Co;ra.prototype=nn.prototype;ra.INVALID_DATE=Co;function Kc(e,t=[]){let r=[],n=new Set,i=new Set(t.map(([s,o])=>`${s}-${o}`));function a(s,o){let l=ir.split(s)[0];n.add(l),i.has(`${o}-${l}`)||r.push([o,l])}for(const s of Object.keys(e)){let o=e[s];n.add(s),or.isRef(o)&&o.isSibling?a(o.path,s):ta(o)&&"deps"in o&&o.deps.forEach(l=>a(l,s))}return Sc.array(Array.from(n),r).reverse()}function Na(e,t){let r=1/0;return e.some((n,i)=>{var a;if((a=t.path)!=null&&a.includes(n))return r=i,!0}),r}function _o(e){return(t,r)=>Na(e,t)-Na(e,r)}const Qc=(e,t,r)=>{if(typeof e!="string")return e;let n=e;try{n=JSON.parse(e)}catch{}return r.isType(n)?n:e};function En(e){if("fields"in e){const t={};for(const[r,n]of Object.entries(e.fields))t[r]=En(n);return e.setFields(t)}if(e.type==="array"){const t=e.optional();return t.innerType&&(t.innerType=En(t.innerType)),t}return e.type==="tuple"?e.optional().clone({types:e.spec.types.map(En)}):"optional"in e?e.optional():e}const Gc=(e,t)=>{const r=[...ir.normalizePath(t)];if(r.length===1)return r[0]in e;let n=r.pop(),i=ir.getter(ir.join(r),!0)(e);return!!(i&&n in i)};let Ba=e=>Object.prototype.toString.call(e)==="[object Object]";function La(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(n=>r.indexOf(n)===-1)}const Yc=_o([]);function Ao(e){return new Fo(e)}class Fo extends Ye{constructor(t){super({type:"object",check(r){return Ba(r)||typeof r=="function"}}),this.fields=Object.create(null),this._sortErrors=Yc,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,r={}){var n;let i=super._cast(t,r);if(i===void 0)return this.getDefault(r);if(!this._typeCheck(i))return i;let a=this.fields,s=(n=r.stripUnknown)!=null?n:this.spec.noUnknown,o=[].concat(this._nodes,Object.keys(i).filter(f=>!this._nodes.includes(f))),l={},p=Object.assign({},r,{parent:l,__validating:r.__validating||!1}),d=!1;for(const f of o){let m=a[f],x=f in i;if(m){let g,c=i[f];p.path=(r.path?`${r.path}.`:"")+f,m=m.resolve({value:c,context:r.context,parent:l});let b=m instanceof Ye?m.spec:void 0,y=b==null?void 0:b.strict;if(b!=null&&b.strip){d=d||f in i;continue}g=!r.__validating||!y?m.cast(i[f],p):i[f],g!==void 0&&(l[f]=g)}else x&&!s&&(l[f]=i[f]);(x!==f in l||l[f]!==i[f])&&(d=!0)}return d?l:i}_validate(t,r={},n,i){let{from:a=[],originalValue:s=t,recursive:o=this.spec.recursive}=r;r.from=[{schema:this,value:s},...a],r.__validating=!0,r.originalValue=s,super._validate(t,r,n,(l,p)=>{if(!o||!Ba(p)){i(l,p);return}s=s||p;let d=[];for(let f of this._nodes){let m=this.fields[f];!m||or.isRef(m)||d.push(m.asNestedTest({options:r,key:f,parent:p,parentPath:r.path,originalParent:s}))}this.runTests({tests:d,value:p,originalValue:s,options:r},n,f=>{i(f.sort(this._sortErrors).concat(l),p)})})}clone(t){const r=super.clone(t);return r.fields=Object.assign({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(t){let r=super.concat(t),n=r.fields;for(let[i,a]of Object.entries(this.fields)){const s=n[i];n[i]=s===void 0?a:s}return r.withMutation(i=>i.setFields(n,[...this._excludedEdges,...t._excludedEdges]))}_getDefault(t){if("default"in this.spec)return super._getDefault(t);if(!this._nodes.length)return;let r={};return this._nodes.forEach(n=>{var i;const a=this.fields[n];let s=t;(i=s)!=null&&i.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[n]})),r[n]=a&&"getDefault"in a?a.getDefault(s):void 0}),r}setFields(t,r){let n=this.clone();return n.fields=t,n._nodes=Kc(t,r),n._sortErrors=_o(Object.keys(t)),r&&(n._excludedEdges=r),n}shape(t,r=[]){return this.clone().withMutation(n=>{let i=n._excludedEdges;return r.length&&(Array.isArray(r[0])||(r=[r]),i=[...n._excludedEdges,...r]),n.setFields(Object.assign(n.fields,t),i)})}partial(){const t={};for(const[r,n]of Object.entries(this.fields))t[r]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(t)}deepPartial(){return En(this)}pick(t){const r={};for(const n of t)this.fields[n]&&(r[n]=this.fields[n]);return this.setFields(r,this._excludedEdges.filter(([n,i])=>t.includes(n)&&t.includes(i)))}omit(t){const r=[];for(const n of Object.keys(this.fields))t.includes(n)||r.push(n);return this.pick(r)}from(t,r,n){let i=ir.getter(t,!0);return this.transform(a=>{if(!a)return a;let s=a;return Gc(a,t)&&(s=Object.assign({},a),n||delete s[t],s[r]=i(a)),s})}json(){return this.transform(Qc)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||Sn.exact,test(r){if(r==null)return!0;const n=La(this.schema,r);return n.length===0||this.createError({params:{properties:n.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,r=Sn.noUnknown){typeof t!="boolean"&&(r=t,t=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:r,test(i){if(i==null)return!0;const a=La(this.schema,i);return!t||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return n.spec.noUnknown=t,n}unknown(t=!0,r=Sn.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>{if(!r)return r;const n={};for(const i of Object.keys(r))n[t(i)]=r[i];return n})}camelCase(){return this.transformKeys(ii.camelCase)}snakeCase(){return this.transformKeys(ii.snakeCase)}constantCase(){return this.transformKeys(t=>ii.snakeCase(t).toUpperCase())}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);n.fields={};for(const[a,s]of Object.entries(r.fields)){var i;let o=t;(i=o)!=null&&i.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[a]})),n.fields[a]=s.describe(o)}return n}}Ao.prototype=Fo.prototype;const jo=e=>{const t={};return e.forEach(r=>{var a,s,o;let n;switch(r.type){case"text":case"textarea":case"tel":n=Br(),r.validation?n=Wt(n,r,"string"):(r.minLength&&(n=n.min(r.minLength,`${r.label} must be at least ${r.minLength} characters`)),r.maxLength&&(n=n.max(r.maxLength,`${r.label} must be at most ${r.maxLength} characters`)),r.pattern&&(n=n.test("pattern",`${r.label} format is invalid`,l=>l?new RegExp(r.pattern).test(l):!0)));break;case"email":n=Br().email(((a=r.validation)==null?void 0:a.message)||`${r.label} must be a valid email address`),r.validation&&(n=Wt(n,r,"string"));break;case"password":n=Br(),r.validation?n=Wt(n,r,"string"):(r.minLength&&(n=n.min(r.minLength,`${r.label} must be at least ${r.minLength} characters`)),r.maxLength&&(n=n.max(r.maxLength,`${r.label} must be at most ${r.maxLength} characters`)),r.pattern&&(n=n.test("pattern",`${r.label} format is invalid`,l=>l?new RegExp(r.pattern).test(l):!0)));break;case"number":n=Oo().typeError(`${r.label} must be a number`),r.validation?n=Wt(n,r,"number"):(r.min!==void 0&&(n=n.min(r.min,`${r.label} must be at least ${r.min}`)),r.max!==void 0&&(n=n.max(r.max,`${r.label} must be at most ${r.max}`)));break;case"select":n=Br(),r.validation&&(n=Wt(n,r,"string"));break;case"checkbox":n=So(),r.validation&&(n=Wt(n,r,"boolean"));break;case"date":n=ra().typeError(`${r.label} must be a valid date`),r.validation?n=Wt(n,r,"date"):(r.minDate&&(n=n.min(new Date(r.minDate),`${r.label} must be after ${r.minDate}`)),r.maxDate&&(n=n.max(new Date(r.maxDate),`${r.label} must be before ${r.maxDate}`)));break;default:n=bo()}if(((s=r.validation)==null?void 0:s.required)!==void 0?r.validation.required:r.required){const l=((o=r.validation)==null?void 0:o.message)||`${r.label} is required`;n=n.required(l)}t[r.name]=n}),Ao().shape(t)},Wt=(e,t,r)=>{const n=t.validation;if(!n)return e;if(r==="string"){if(n.minLength!==void 0){const i=n.message||`${t.label} must be at least ${n.minLength} characters`;e=e.min(n.minLength,i)}if(n.maxLength!==void 0){const i=n.message||`${t.label} must be at most ${n.maxLength} characters`;e=e.max(n.maxLength,i)}}if(r==="number"){if(n.min!==void 0){const i=n.message||`${t.label} must be at least ${n.min}`;e=e.min(n.min,i)}if(n.max!==void 0){const i=n.message||`${t.label} must be at most ${n.max}`;e=e.max(n.max,i)}}if(n.pattern){const i=typeof n.pattern=="string"?new RegExp(n.pattern):n.pattern,a=n.message||`${t.label} format is invalid`;e=e.test("pattern",a,s=>s?i.test(s):!0)}return n.custom&&(e=e.test("custom",n.message||`${t.label} is invalid`,i=>{const a=n.custom(i);return typeof a=="boolean"?a:!1})),e},$o=({currentStep:e,totalSteps:t,onStepChange:r,stepTitles:n=[],showStepTitles:i=!0,completedSteps:a=[]})=>{const s=M.useMemo(()=>Array.from({length:t},(d,f)=>f+1),[t]),o=M.useMemo(()=>Math.round(e/t*100),[e,t]),l=d=>n[d-1]||`Step ${d}`,p=d=>d===e||a.includes(d)||d===e+1&&a.includes(e);return k.jsxs(P.Card,{sx:{mb:2,p:2,boxShadow:"0px 1px 4px 0px #00000014",background:"#F8F8F8",borderRadius:"4px"},children:[k.jsxs(P.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[k.jsx(P.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap"},children:s.map((d,f)=>{const m=d===e,x=d<e||a.includes(d),g=m||x?"primary.main":"#8F97A4";return k.jsxs(P.Box,{sx:{display:"flex",alignItems:"center"},children:[k.jsxs(P.Box,{onClick:()=>p(d)&&r(d),sx:{display:"flex",alignItems:"center",cursor:p(d)?"pointer":"default"},children:[k.jsx(P.Box,{sx:{width:24,height:24,borderRadius:"50%",border:m||x?"2px solid":"1px solid",borderColor:m||x?"primary.main":"#8F97A4",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:m||x?"primary.main":"transparent",mr:.5,color:g,fontWeight:m||x?600:500,fontSize:"12px"},children:d}),i&&k.jsx(P.Typography,{sx:{fontSize:"12px",fontWeight:600,color:g},children:l(d)})]}),f<s.length-1&&k.jsx(P.Box,{sx:{width:40,height:2,mx:1,borderRadius:1,backgroundColor:d<e?"primary.main":"#DFE3E8"}})]},d)})}),k.jsx(P.Typography,{sx:{color:"#8F97A4",fontSize:"12px",fontWeight:500},children:`Step ${e} of ${t}, ${o}% complete`})]}),k.jsx(P.LinearProgress,{variant:"determinate",value:o,sx:{height:4,borderRadius:"50px",backgroundColor:d=>d.palette.grey[300],"& .MuiLinearProgress-bar":{backgroundColor:"primary.main",borderRadius:5}}})]})},Do=({buttons:e,disabled:t=!1})=>{const r=o=>{o.onClick&&o.onClick()},n=e.filter(o=>o.position==="left"||!o.position),i=e.filter(o=>o.position==="center"),a=e.filter(o=>o.position==="right"),s=(o,l)=>{const p=(o.text||"").toLowerCase(),d=o.type==="submit"||p.includes("submit")||p.includes("save")||p.includes("next"),f=o.position==="left"||p.includes("cancel")||p.includes("back")||p.includes("draft"),m=o.type?o.type:d?"submit":"button",x=f?"outlined":"contained",g=o.disabled||t,c=b=>b&&["primary","secondary","error","info","success","warning"].includes(b)?b:"primary";return k.jsxs(P.Button,{type:m,variant:x,color:c(o.color),size:o.size||"large",disabled:g,onClick:o.onClick?()=>r(o):void 0,sx:o.sx,children:[o.loading&&k.jsx(P.CircularProgress,{size:20,sx:{mr:1}}),o.text]},`${o.text}-${l}`)};return k.jsxs(P.Box,{sx:{mt:3,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsx(P.Box,{sx:{display:"flex",gap:2},children:n.map((o,l)=>s(o,l))}),k.jsx(P.Box,{sx:{display:"flex",gap:2},children:i.map((o,l)=>s(o,l))}),k.jsx(P.Box,{sx:{display:"flex",gap:2},children:a.map((o,l)=>s(o,l))})]})},Zc=({config:e,onSubmit:t,onStepChange:r,currentStep:n=1,totalSteps:i=1,isMultiStep:a=!1,formData:s})=>{const{buttons:o,position:l="right",layout:p="horizontal",spacing:d=2,sx:f}=e,m=y=>{let T="button",j="contained";return y.type?T=y.type:y.text.toLowerCase().includes("submit")||y.text.toLowerCase().includes("save")||y.text.toLowerCase().includes("next")?T="submit":(y.text.toLowerCase().includes("reset")||y.text.toLowerCase().includes("clear"))&&(T="reset"),(y.text.toLowerCase().includes("cancel")||y.text.toLowerCase().includes("back")||y.text.toLowerCase().includes("draft"))&&(j="outlined"),{buttonType:T,buttonVariant:j}},x=y=>["primary","secondary","error","warning","info","success"].includes(y||"")?y:"primary",g=y=>{const{buttonType:T}=m(y);y.onClick?y.onClick():T==="submit"&&t?t(s):a&&r&&(y.text.toLowerCase().includes("next")?r(n+1,i):(y.text.toLowerCase().includes("back")||y.text.toLowerCase().includes("previous"))&&r(n-1,i))},c=(y,T)=>{const{buttonType:j,buttonVariant:A}=m(y),w=x(y.color);return k.jsx(P.Button,{type:j,variant:A,color:w,size:y.size||"medium",disabled:y.disabled,onClick:()=>g(y),sx:y.sx,children:y.text},T)},b=()=>{const y={display:"flex",gap:d,...f};switch(l){case"left":return{...y,justifyContent:"flex-start"};case"center":return{...y,justifyContent:"center"};case"right":return{...y,justifyContent:"flex-end"};case"space-between":return{...y,justifyContent:"space-between"};default:return{...y,justifyContent:"flex-end"}}};return p==="vertical"?k.jsx(P.Box,{sx:b(),children:o.map((y,T)=>k.jsx(P.Box,{sx:{width:"100%"},children:c(y,T)},T))}):k.jsx(P.Box,{sx:b(),children:k.jsx(P.ButtonGroup,{variant:"outlined",size:"medium",children:o.map((y,T)=>c(y,T))})})},Jc=new Xl({defaultOptions:{queries:{staleTime:15*60*1e3,gcTime:30*60*1e3,retry:3,retryDelay:e=>Math.min(1e3*2**e,3e4),refetchOnWindowFocus:!1,refetchOnReconnect:!0}}}),Xc=e=>k.jsx(ic,{client:Jc,children:k.jsx(eu,{...e})}),eu=({id:e,theme:t,fields:r,onSubmit:n,onChange:i,submitButtonText:a="Submit",onSubmitClick:s,defaultValues:o,showSubmitButton:l=!0,buttons:p,buttonGroup:d,baseUrl:f,apiHeaders:m,stepNavigationProps:x})=>{var ee,ce;const g=[...new Set(r.map(R=>R.step).filter(R=>R!=null&&R>0))].sort((R,H)=>(R||0)-(H||0)),c=g.length>1,b=g.length||1,[y,T]=M.useState(1),j=c?r.filter(R=>R.step===y):r,A=M.useMemo(()=>jo(j),[j]),{control:w,handleSubmit:N,formState:{errors:Q},watch:ne,resetField:G,trigger:u}=$l({resolver:Pl(A),mode:"onChange",defaultValues:o}),F=ne(),O=M.useRef({});M.useEffect(()=>{const R=[];for(const H of r){const te=H.depends_on;te&&typeof H.name=="string"&&R.push({dependentField:H.name,dependencyName:te})}if(R.length!==0)for(const{dependentField:H,dependencyName:te}of R){const D=O.current[te],pe=F==null?void 0:F[te];if(D!==pe)try{G(H)}catch{}O.current[te]=pe}},[r,F,G]);const I=M.useRef(i);M.useEffect(()=>{I.current=i},[i]);const V=M.useMemo(()=>{try{return JSON.stringify(F)}catch{return String(Date.now())}},[F]),B=M.useRef(null);M.useEffect(()=>{I.current&&B.current!==V&&(B.current=V,I.current(F))},[V]);const K=async()=>{if(!c)return!0;const R=r.filter(te=>te.step===y);for(const te of R)if(te.required){const D=F[te.name];let pe=!0;if(te.type==="checkbox"?pe=D===!0:Array.isArray(D)?pe=D.length>0:pe=D!=null&&D!=="",!pe)return!1}return await u()?!0:Object.keys(Q).filter(D=>R.some(pe=>pe.name===D)).map(D=>{const pe=Q[D];return typeof(pe==null?void 0:pe.message)=="string"?pe.message:`${D} is invalid`}).length===0},le=M.useMemo(()=>{if(!c)return!0;const R=r.filter(te=>te.step===y);for(const te of R)if(te.required){const D=F[te.name];let pe=!0;if(te.type==="checkbox"?pe=D===!0:Array.isArray(D)?pe=D.length>0:pe=D!=null&&D!=="",!pe)return!1}return Object.keys(Q).filter(te=>R.some(D=>D.name===te)).length===0},[c,y,r,F,Q]),fe=M.useMemo(()=>{if(c)return le;for(const R of r)if(R.required){const H=F[R.name];let te=!0;if(R.type==="checkbox"?te=H===!0:te=H!=null&&H!==""&&!(Array.isArray(H)&&H.length===0),!te)return!1}return Object.keys(Q).length===0},[c,le,r,F,Q]),de=async R=>{R<1||R>b||R>y&&c&&!await K()||T(R)},z=async R=>{if(c&&y<b){console.warn("Form submission attempted on non-final step");return}s&&s(R),n(R)},W=async R=>{R&&(R.preventDefault(),R.stopPropagation()),c&&y<b&&await K()&&de(y+1)},L=R=>{R&&(R.preventDefault(),R.stopPropagation()),c&&y>1&&de(y-1)},Y=R=>R.col?R.col:(R.xs||R.sm||R.md||R.lg||R.xl)&&(R.xs||R.sm||R.md||R.lg||R.xl)||12,J=t?P.createTheme({palette:{primary:{main:t.primaryColor||"#1976d2"},secondary:{main:t.secondaryColor||"#dc004e"},background:{default:t.backgroundColor||"#ffffff"},text:{primary:t.textColor||"#000000"}},shape:{borderRadius:t.borderRadius||4},spacing:t.spacing||8,typography:{fontFamily:((ee=t.typography)==null?void 0:ee.fontFamily)||"Roboto, Arial, sans-serif",fontSize:typeof((ce=t.typography)==null?void 0:ce.fontSize)=="number"?t.typography.fontSize:14}}):void 0,ae=()=>{if(d&&d.buttons&&d.buttons.length>0){const R={...d,buttons:d.buttons.map(H=>{const te=(H.text||"").toLowerCase(),D=H.type==="submit"||te.includes("submit")||te.includes("save")||te.includes("finish")||te.includes("complete"),pe=te.includes("next");let Re=!1;return c?(D||pe)&&(Re=!le):D&&(Re=!fe),{...H,disabled:H.disabled||Re}})};return k.jsx(P.Box,{sx:{mt:3},children:k.jsx(Zc,{config:R,onSubmit:z,onStepChange:de,currentStep:y,totalSteps:b,isMultiStep:c,formData:F})})}if(p&&p.length>0){const R=p.map(H=>{const te=(H.text||"").toLowerCase(),D=H.type==="submit"||te.includes("submit")||te.includes("save")||te.includes("finish")||te.includes("complete"),pe=te.includes("next");let Re=!1;return c?(D||pe)&&(Re=!le):D&&(Re=!fe),{...H,disabled:H.disabled||Re}});return k.jsx(Do,{buttons:R})}return l?k.jsx(P.Box,{sx:{mt:3,display:"flex",justifyContent:"flex-end",flexDirection:"column",alignItems:"flex-end"},children:k.jsxs(P.Box,{sx:{display:"flex",gap:2},children:[c&&y>1&&k.jsx(P.Button,{type:"button",variant:"outlined",onClick:L,children:"Previous"}),c?y<b?k.jsx(P.Button,{type:"button",variant:"contained",color:"primary",size:"large",disabled:!le,onClick:W,children:"Next"}):k.jsx(P.Button,{type:"submit",variant:"contained",color:"primary",size:"large",disabled:!le,children:a}):k.jsx(P.Button,{type:"submit",variant:"contained",color:"primary",size:"large",disabled:!fe,children:a})]})}):null},ie=k.jsxs(P.Box,{component:"form",onSubmit:R=>{if(c&&y<b){R.preventDefault(),R.stopPropagation(),le&&W();return}N(z)(R)},id:e,onKeyDown:R=>{R.key==="Enter"&&c&&y<b&&(R.preventDefault(),le&&W())},children:[c&&k.jsx($o,{currentStep:y,totalSteps:b,onStepChange:de,stepTitles:x==null?void 0:x.stepTitles,showStepTitles:(x==null?void 0:x.showStepTitles)!==!1}),k.jsx(P.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",gap:2},children:j.map(R=>{const H=Y(R);return k.jsx(P.Box,{sx:{gridColumn:`span ${H}`},children:k.jsx(ho,{field:R,control:w,errors:Q,baseUrl:f,apiHeaders:m,formData:F})},R.name)})}),ae()]});return J?k.jsx(P.ThemeProvider,{theme:J,children:ie}):ie},qa=e=>e,tu=()=>{let e=qa;return{configure(t){e=t},generate(t){return e(t)},reset(){e=qa}}},ru=tu();function Nt(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}function sr(e){if(typeof e!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":Nt(7));return e.charAt(0).toUpperCase()+e.slice(1)}var mn={exports:{}},hn={exports:{}},ge={};/** @license React v16.13.1
|
|
5
5
|
* react-is.production.min.js
|
|
6
6
|
*
|
|
7
7
|
* Copyright (c) Facebook, Inc. and its affiliates.
|