import{I as gt,bK as $e,r as Ot,ba as St,k as H,X as Re,R as P,N as J,b7 as k,l as _t,ak as We,Z as qe,aF as Vt,bL as F,bM as Et,aR as jt,J as At}from"./index-DGdp2baF.js";/** * vee-validate v4.12.5 * (c) 2024 Abdelrahman Awad * @license MIT */function M(e){return typeof e=="function"}function Qe(e){return e==null}const ee=e=>e!==null&&!!e&&typeof e=="object"&&!Array.isArray(e);function Ne(e){return Number(e)>=0}function wt(e){return typeof e=="object"&&e!==null}function Ft(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}function He(e){if(!wt(e)||Ft(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ue(e,t){return Object.keys(t).forEach(i=>{if(He(t[i])&&He(e[i])){e[i]||(e[i]={}),ue(e[i],t[i]);return}e[i]=t[i]}),e}function be(e){const t=e.split(".");if(!t.length)return"";let i=String(t[0]);for(let a=1;a<t.length;a++){if(Ne(t[a])){i+=`[${t[a]}]`;continue}i+=`.${t[a]}`}return i}const Pt={};function It(e){return Pt[e]}function Ge(e,t,i){typeof i.value=="object"&&(i.value=b(i.value)),!i.enumerable||i.get||i.set||!i.configurable||!i.writable||t==="__proto__"?Object.defineProperty(e,t,i):e[t]=i.value}function b(e){if(typeof e!="object")return e;var t=0,i,a,u,o=Object.prototype.toString.call(e);if(o==="[object Object]"?u=Object.create(e.__proto__||null):o==="[object Array]"?u=Array(e.length):o==="[object Set]"?(u=new Set,e.forEach(function(f){u.add(b(f))})):o==="[object Map]"?(u=new Map,e.forEach(function(f,h){u.set(b(h),b(f))})):o==="[object Date]"?u=new Date(+e):o==="[object RegExp]"?u=new RegExp(e.source,e.flags):o==="[object DataView]"?u=new e.constructor(b(e.buffer)):o==="[object ArrayBuffer]"?u=e.slice(0):o.slice(-6)==="Array]"&&(u=new e.constructor(e)),u){for(a=Object.getOwnPropertySymbols(e);t<a.length;t++)Ge(u,a[t],Object.getOwnPropertyDescriptor(e,a[t]));for(t=0,a=Object.getOwnPropertyNames(e);t<a.length;t++)Object.hasOwnProperty.call(u,i=a[t])&&u[i]===e[i]||Ge(u,i,Object.getOwnPropertyDescriptor(e,i))}return u||e}const Tt=Symbol("vee-validate-form"),Ct=typeof window<"u";function Rt(e){return M(e)&&!!e.__locatorRef}function G(e){return!!e&&M(e.parse)&&e.__type==="VVTypedSchema"}function et(e){return!!e&&M(e.validate)}function Nt(e){return e==="checkbox"||e==="radio"}function Bt(e){return ee(e)||Array.isArray(e)}function Mt(e){return Array.isArray(e)?e.length===0:ee(e)&&Object.keys(e).length===0}function Oe(e){return/^\[.+\]$/i.test(e)}function kt(e){return tt(e)&&e.multiple}function tt(e){return e.tagName==="SELECT"}function rt(e){return Be(e)&&e.target&&"submit"in e.target}function Be(e){return e?!!(typeof Event<"u"&&M(Event)&&e instanceof Event||e&&e.srcElement):!1}function le(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var i,a,u;if(Array.isArray(e)){if(i=e.length,i!=t.length)return!1;for(a=i;a--!==0;)if(!le(e[a],t[a]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a of e.entries())if(!t.has(a[0]))return!1;for(a of e.entries())if(!le(a[1],t.get(a[0])))return!1;return!0}if(Ke(e)&&Ke(t))return!(e.size!==t.size||e.name!==t.name||e.lastModified!==t.lastModified||e.type!==t.type);if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a of e.entries())if(!t.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(i=e.length,i!=t.length)return!1;for(a=i;a--!==0;)if(e[a]!==t[a])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();for(u=Object.keys(e),i=u.length,a=i;a--!==0;){var o=u[a];if(!le(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Ke(e){return Ct?e instanceof File:!1}function Me(e){return Oe(e)?e.replace(/\[|\]/gi,""):e}function D(e,t,i){return e?Oe(t)?e[Me(t)]:(t||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((u,o)=>Bt(u)&&o in u?u[o]:i,e):i}function q(e,t,i){if(Oe(t)){e[Me(t)]=i;return}const a=t.split(/\.|\[(\d+)\]/).filter(Boolean);let u=e;for(let o=0;o<a.length;o++){if(o===a.length-1){u[a[o]]=i;return}(!(a[o]in u)||Qe(u[a[o]]))&&(u[a[o]]=Ne(a[o+1])?[]:{}),u=u[a[o]]}}function Te(e,t){if(Array.isArray(e)&&Ne(t)){e.splice(Number(t),1);return}ee(e)&&delete e[t]}function Ye(e,t){if(Oe(t)){delete e[Me(t)];return}const i=t.split(/\.|\[(\d+)\]/).filter(Boolean);let a=e;for(let o=0;o<i.length;o++){if(o===i.length-1){Te(a,i[o]);break}if(!(i[o]in a)||Qe(a[i[o]]))break;a=a[i[o]]}const u=i.map((o,f)=>D(e,i.slice(0,f).join(".")));for(let o=u.length-1;o>=0;o--)if(Mt(u[o])){if(o===0){Te(e,i[0]);continue}Te(u[o-1],i[o-1])}}function B(e){return Object.keys(e)}function xe(e,t=0){let i=null,a=[];return function(...u){return i&&clearTimeout(i),i=setTimeout(()=>{const o=e(...u);a.forEach(f=>f(o)),a=[]},t),new Promise(o=>a.push(o))}}function Ut(e,t){let i;return async function(...u){const o=e(...u);i=o;const f=await o;return o!==i?f:(i=void 0,t(f,u))}}function Je(e){return Array.isArray(e)?e:e?[e]:[]}function pe(e,t){const i={};for(const a in e)t.includes(a)||(i[a]=e[a]);return i}function zt(e){let t=null,i=[];return function(...a){const u=k(()=>{if(t!==u)return;const o=e(...a);i.forEach(f=>f(o)),i=[],t=null});return t=u,new Promise(o=>i.push(o))}}function Dt(e,t,i){return t.slots.default?typeof e=="string"||!e?t.slots.default(i()):{default:()=>{var a,u;return(u=(a=t.slots).default)===null||u===void 0?void 0:u.call(a,i())}}:t.slots.default}function Ce(e){if(nt(e))return e._value}function nt(e){return"_value"in e}function Lt(e){return e.type==="number"||e.type==="range"?Number.isNaN(e.valueAsNumber)?e.value:e.valueAsNumber:e.value}function Xe(e){if(!Be(e))return e;const t=e.target;if(Nt(t.type)&&nt(t))return Ce(t);if(t.type==="file"&&t.files){const i=Array.from(t.files);return t.multiple?i:i[0]}if(kt(t))return Array.from(t.options).filter(i=>i.selected&&!i.disabled).map(Ce);if(tt(t)){const i=Array.from(t.options).find(a=>a.selected);return i?Ce(i):t.value}return Lt(t)}function $t(e){const t={};return Object.defineProperty(t,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),e?ee(e)&&e._$$isNormalized?e:ee(e)?Object.keys(e).reduce((i,a)=>{const u=Wt(e[a]);return e[a]!==!1&&(i[a]=Ze(u)),i},t):typeof e!="string"?t:e.split("|").reduce((i,a)=>{const u=qt(a);return u.name&&(i[u.name]=Ze(u.params)),i},t):t}function Wt(e){return e===!0?[]:Array.isArray(e)||ee(e)?e:[e]}function Ze(e){const t=i=>typeof i=="string"&&i[0]==="@"?Ht(i.slice(1)):i;return Array.isArray(e)?e.map(t):e instanceof RegExp?[e]:Object.keys(e).reduce((i,a)=>(i[a]=t(e[a]),i),{})}const qt=e=>{let t=[];const i=e.split(":")[0];return e.includes(":")&&(t=e.split(":").slice(1).join(":").split(",")),{name:i,params:t}};function Ht(e){const t=i=>D(i,e)||i[e];return t.__locatorRef=e,t}const Gt={generateMessage:({field:e})=>`${e} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0};let Kt=Object.assign({},Gt);const ae=()=>Kt;async function Yt(e,t,i={}){const a=i==null?void 0:i.bails,u={name:(i==null?void 0:i.name)||"{field}",rules:t,label:i==null?void 0:i.label,bails:a??!0,formData:(i==null?void 0:i.values)||{}},f=(await xt(u,e)).errors;return{errors:f,valid:!f.length}}async function xt(e,t){if(G(e.rules)||et(e.rules))return Xt(t,e.rules);if(M(e.rules)||Array.isArray(e.rules)){const f={field:e.label||e.name,name:e.name,label:e.label,form:e.formData,value:t},h=Array.isArray(e.rules)?e.rules:[e.rules],m=h.length,c=[];for(let g=0;g<m;g++){const _=h[g],S=await _(t,f);if(!(typeof S!="string"&&!Array.isArray(S)&&S)){if(Array.isArray(S))c.push(...S);else{const C=typeof S=="string"?S:at(f);c.push(C)}if(e.bails)return{errors:c}}}return{errors:c}}const i=Object.assign(Object.assign({},e),{rules:$t(e.rules)}),a=[],u=Object.keys(i.rules),o=u.length;for(let f=0;f<o;f++){const h=u[f],m=await Zt(i,t,{name:h,params:i.rules[h]});if(m.error&&(a.push(m.error),e.bails))return{errors:a}}return{errors:a}}function Jt(e){return!!e&&e.name==="ValidationError"}function it(e){return{__type:"VVTypedSchema",async parse(i){var a;try{return{output:await e.validate(i,{abortEarly:!1}),errors:[]}}catch(u){if(!Jt(u))throw u;if(!(!((a=u.inner)===null||a===void 0)&&a.length)&&u.errors.length)return{errors:[{path:u.path,errors:u.errors}]};const o=u.inner.reduce((f,h)=>{const m=h.path||"";return f[m]||(f[m]={errors:[],path:m}),f[m].errors.push(...h.errors),f},{});return{errors:Object.values(o)}}}}}async function Xt(e,t){const a=await(G(t)?t:it(t)).parse(e),u=[];for(const o of a.errors)o.errors.length&&u.push(...o.errors);return{errors:u}}async function Zt(e,t,i){const a=It(i.name);if(!a)throw new Error(`No such validator '${i.name}' exists.`);const u=Qt(i.params,e.formData),o={field:e.label||e.name,name:e.name,label:e.label,value:t,form:e.formData,rule:Object.assign(Object.assign({},i),{params:u})},f=await a(t,u,o);return typeof f=="string"?{error:f}:{error:f?void 0:at(o)}}function at(e){const t=ae().generateMessage;return t?t(e):"Field is invalid"}function Qt(e,t){const i=a=>Rt(a)?a(t):a;return Array.isArray(e)?e.map(i):Object.keys(e).reduce((a,u)=>(a[u]=i(e[u]),a),{})}async function er(e,t){const a=await(G(e)?e:it(e)).parse(b(t)),u={},o={};for(const f of a.errors){const h=f.errors,m=(f.path||"").replace(/\["(\d+)"\]/g,(c,g)=>`[${g}]`);u[m]={valid:!h.length,errors:h},h.length&&(o[m]=h[0])}return{valid:!a.errors.length,results:u,errors:o,values:a.value}}async function tr(e,t,i){const u=B(e).map(async c=>{var g,_,S;const E=(g=i==null?void 0:i.names)===null||g===void 0?void 0:g[c],C=await Yt(D(t,c),e[c],{name:(E==null?void 0:E.name)||c,label:E==null?void 0:E.label,values:t,bails:(S=(_=i==null?void 0:i.bailsMap)===null||_===void 0?void 0:_[c])!==null&&S!==void 0?S:!0});return Object.assign(Object.assign({},C),{path:c})});let o=!0;const f=await Promise.all(u),h={},m={};for(const c of f)h[c.path]={valid:c.valid,errors:c.errors},c.valid||(o=!1,m[c.path]=c.errors[0]);return{valid:o,results:h,errors:m}}let rr=0;const ge=["bails","fieldsCount","id","multiple","type","validate"];function lt(e){const t=Object.assign({},F((e==null?void 0:e.initialValues)||{})),i=J(e==null?void 0:e.validationSchema);return i&&G(i)&&M(i.cast)?b(i.cast(t)||{}):b(t)}function nr(e){var t;const i=rr++;let a=0;const u=H(!1),o=H(!1),f=H(0),h=[],m=Re(lt(e)),c=H([]),g=H({}),_=H({}),S=zt(()=>{_.value=c.value.reduce((n,r)=>(n[be(F(r.path))]=r,n),{})});function E(n,r){const l=O(n);if(!l){typeof n=="string"&&(g.value[be(n)]=Je(r));return}if(typeof n=="string"){const s=be(n);g.value[s]&&delete g.value[s]}l.errors=Je(r),l.valid=!l.errors.length}function C(n){B(n).forEach(r=>{E(r,n[r])})}e!=null&&e.initialErrors&&C(e.initialErrors);const X=P(()=>{const n=c.value.reduce((r,l)=>(l.errors.length&&(r[l.path]=l.errors),r),{});return Object.assign(Object.assign({},g.value),n)}),K=P(()=>B(X.value).reduce((n,r)=>{const l=X.value[r];return l!=null&&l.length&&(n[r]=l[0]),n},{})),oe=P(()=>c.value.reduce((n,r)=>(n[r.path]={name:r.path||"",label:r.label||""},n),{})),se=P(()=>c.value.reduce((n,r)=>{var l;return n[r.path]=(l=r.bails)!==null&&l!==void 0?l:!0,n},{})),te=Object.assign({},(e==null?void 0:e.initialErrors)||{}),ce=(t=e==null?void 0:e.keepValuesOnUnmount)!==null&&t!==void 0?t:!1,{initialValues:L,originalInitialValues:$,setInitialValues:de}=ar(c,m,e),fe=ir(c,m,$,K),ve=P(()=>c.value.reduce((n,r)=>{const l=D(m,r.path);return q(n,r.path,l),n},{})),T=e==null?void 0:e.validationSchema;function Z(n,r){var l,s;const v=P(()=>D(L.value,F(n))),d=_.value[F(n)],y=(r==null?void 0:r.type)==="checkbox"||(r==null?void 0:r.type)==="radio";if(d&&y){d.multiple=!0;const N=a++;return Array.isArray(d.id)?d.id.push(N):d.id=[d.id,N],d.fieldsCount++,d.__flags.pendingUnmount[N]=!1,d}const j=P(()=>D(m,F(n))),V=F(n),w=U.findIndex(N=>N===V);w!==-1&&U.splice(w,1);const p=P(()=>{var N,ie,Fe,Le,Pe,Ie;return G(T)?(Fe=(ie=(N=T).describe)===null||ie===void 0?void 0:ie.call(N,F(n)).required)!==null&&Fe!==void 0?Fe:!1:G(r==null?void 0:r.schema)&&(Ie=(Pe=(Le=r==null?void 0:r.schema).describe)===null||Pe===void 0?void 0:Pe.call(Le).required)!==null&&Ie!==void 0?Ie:!1}),A=a++,I=Re({id:A,path:n,touched:!1,pending:!1,valid:!0,validated:!!(!((l=te[V])===null||l===void 0)&&l.length),required:p,initialValue:v,errors:At([]),bails:(s=r==null?void 0:r.bails)!==null&&s!==void 0?s:!1,label:r==null?void 0:r.label,type:(r==null?void 0:r.type)||"default",value:j,multiple:!1,__flags:{pendingUnmount:{[A]:!1},pendingReset:!1},fieldsCount:1,validate:r==null?void 0:r.validate,dirty:P(()=>!le(J(j),J(v)))});return c.value.push(I),_.value[V]=I,S(),K.value[V]&&!te[V]&&k(()=>{x(V,{mode:"silent"})}),We(n)&&qe(n,N=>{S();const ie=b(j.value);_.value[N]=I,k(()=>{q(m,N,ie)})}),I}const me=xe(De,5),he=xe(De,5),re=Ut(async n=>await(n==="silent"?me():he()),(n,[r])=>{const l=B(z.errorBag.value),v=[...new Set([...B(n.results),...c.value.map(d=>d.path),...l])].sort().reduce((d,y)=>{var j;const V=y,w=O(V)||R(V),p=((j=n.results[V])===null||j===void 0?void 0:j.errors)||[],A=F(w==null?void 0:w.path)||V,I=lr({errors:p,valid:!p.length},d.results[A]);return d.results[A]=I,I.valid||(d.errors[A]=I.errors[0]),w&&g.value[A]&&delete g.value[A],w?(w.valid=I.valid,r==="silent"||r==="validated-only"&&!w.validated||E(w,I.errors),d):(E(A,p),d)},{valid:n.valid,results:{},errors:{}});return n.values&&(v.values=n.values),v});function Y(n){c.value.forEach(n)}function O(n){const r=typeof n=="string"?be(n):n;return typeof r=="string"?_.value[r]:r}function R(n){return c.value.filter(l=>n.startsWith(l.path)).reduce((l,s)=>l?s.path.length>l.path.length?s:l:s,void 0)}let U=[],ne;function ut(n){return U.push(n),ne||(ne=k(()=>{[...U].sort().reverse().forEach(l=>{Ye(m,l)}),U=[],ne=null})),ne}function ke(n){return function(l,s){return function(d){return d instanceof Event&&(d.preventDefault(),d.stopPropagation()),Y(y=>y.touched=!0),u.value=!0,f.value++,Q().then(y=>{const j=b(m);if(y.valid&&typeof l=="function"){const V=b(ve.value);let w=n?V:j;return y.values&&(w=y.values),l(w,{evt:d,controlledValues:V,setErrors:C,setFieldError:E,setTouched:Ee,setFieldTouched:ye,setValues:_e,setFieldValue:W,resetForm:je,resetField:Ue})}!y.valid&&typeof s=="function"&&s({values:j,evt:d,errors:y.errors,results:y.results})}).then(y=>(u.value=!1,y),y=>{throw u.value=!1,y})}}}const Se=ke(!1);Se.withControlled=ke(!0);function ot(n,r){const l=c.value.findIndex(v=>v.path===n&&(Array.isArray(v.id)?v.id.includes(r):v.id===r)),s=c.value[l];if(!(l===-1||!s)){if(k(()=>{x(n,{mode:"silent",warn:!1})}),s.multiple&&s.fieldsCount&&s.fieldsCount--,Array.isArray(s.id)){const v=s.id.indexOf(r);v>=0&&s.id.splice(v,1),delete s.__flags.pendingUnmount[r]}(!s.multiple||s.fieldsCount<=0)&&(c.value.splice(l,1),ze(n),S(),delete _.value[n])}}function st(n){B(_.value).forEach(r=>{r.startsWith(n)&&delete _.value[r]}),c.value=c.value.filter(r=>!r.path.startsWith(n)),k(()=>{S()})}const z={formId:i,values:m,controlledValues:ve,errorBag:X,errors:K,schema:T,submitCount:f,meta:fe,isSubmitting:u,isValidating:o,fieldArrays:h,keepValuesOnUnmount:ce,validateSchema:J(T)?re:void 0,validate:Q,setFieldError:E,validateField:x,setFieldValue:W,setValues:_e,setErrors:C,setFieldTouched:ye,setTouched:Ee,resetForm:je,resetField:Ue,handleSubmit:Se,useFieldModel:yt,defineInputBinds:bt,defineComponentBinds:pt,defineField:we,stageInitialValue:mt,unsetInitialValue:ze,setFieldInitialValue:Ae,createPathState:Z,getPathState:O,unsetPathValue:ut,removePathState:ot,initialValues:L,getAllPathStates:()=>c.value,destroyPath:st,isFieldTouched:dt,isFieldDirty:ft,isFieldValid:vt};function W(n,r,l=!0){const s=b(r),v=typeof n=="string"?n:n.path;O(v)||Z(v),q(m,v,s),l&&x(v)}function ct(n,r=!0){B(m).forEach(l=>{delete m[l]}),B(n).forEach(l=>{W(l,n[l],!1)}),r&&Q()}function _e(n,r=!0){ue(m,n),h.forEach(l=>l&&l.reset()),r&&Q()}function Ve(n,r){const l=O(F(n))||Z(n);return P({get(){return l.value},set(s){var v;const d=F(n);W(d,s,(v=F(r))!==null&&v!==void 0?v:!1)}})}function ye(n,r){const l=O(n);l&&(l.touched=r)}function dt(n){const r=O(n);return r?r.touched:c.value.filter(l=>l.path.startsWith(n)).some(l=>l.touched)}function ft(n){const r=O(n);return r?r.dirty:c.value.filter(l=>l.path.startsWith(n)).some(l=>l.dirty)}function vt(n){const r=O(n);return r?r.valid:c.value.filter(l=>l.path.startsWith(n)).every(l=>l.valid)}function Ee(n){if(typeof n=="boolean"){Y(r=>{r.touched=n});return}B(n).forEach(r=>{ye(r,!!n[r])})}function Ue(n,r){var l;const s=r&&"value"in r?r.value:D(L.value,n),v=O(n);v&&(v.__flags.pendingReset=!0),Ae(n,b(s),!0),W(n,s,!1),ye(n,(l=r==null?void 0:r.touched)!==null&&l!==void 0?l:!1),E(n,(r==null?void 0:r.errors)||[]),k(()=>{v&&(v.__flags.pendingReset=!1)})}function je(n,r){let l=b(n!=null&&n.values?n.values:$.value);l=r!=null&&r.force?l:ue($.value,l),l=G(T)&&M(T.cast)?T.cast(l):l,de(l),Y(s=>{var v;s.__flags.pendingReset=!0,s.validated=!1,s.touched=((v=n==null?void 0:n.touched)===null||v===void 0?void 0:v[s.path])||!1,W(s.path,D(l,s.path),!1),E(s.path,void 0)}),r!=null&&r.force?ct(l,!1):_e(l,!1),C((n==null?void 0:n.errors)||{}),f.value=(n==null?void 0:n.submitCount)||0,k(()=>{Q({mode:"silent"}),Y(s=>{s.__flags.pendingReset=!1})})}async function Q(n){const r=(n==null?void 0:n.mode)||"force";if(r==="force"&&Y(d=>d.validated=!0),z.validateSchema)return z.validateSchema(r);o.value=!0;const l=await Promise.all(c.value.map(d=>d.validate?d.validate(n).then(y=>({key:d.path,valid:y.valid,errors:y.errors})):Promise.resolve({key:d.path,valid:!0,errors:[]})));o.value=!1;const s={},v={};for(const d of l)s[d.key]={valid:d.valid,errors:d.errors},d.errors.length&&(v[d.key]=d.errors[0]);return{valid:l.every(d=>d.valid),results:s,errors:v}}async function x(n,r){var l;const s=O(n);if(s&&(r==null?void 0:r.mode)!=="silent"&&(s.validated=!0),T){const{results:v}=await re((r==null?void 0:r.mode)||"validated-only");return v[n]||{errors:[],valid:!0}}return s!=null&&s.validate?s.validate(r):(!s&&(l=r==null?void 0:r.warn),Promise.resolve({errors:[],valid:!0}))}function ze(n){Ye(L.value,n)}function mt(n,r,l=!1){Ae(n,r),q(m,n,r),l&&!(e!=null&&e.initialValues)&&q($.value,n,b(r))}function Ae(n,r,l=!1){q(L.value,n,b(r)),l&&q($.value,n,b(r))}async function De(){const n=J(T);if(!n)return{valid:!0,results:{},errors:{}};o.value=!0;const r=et(n)||G(n)?await er(n,m):await tr(n,m,{names:oe.value,bailsMap:se.value});return o.value=!1,r}const ht=Se((n,{evt:r})=>{rt(r)&&r.target.submit()});_t(()=>{if(e!=null&&e.initialErrors&&C(e.initialErrors),e!=null&&e.initialTouched&&Ee(e.initialTouched),e!=null&&e.validateOnMount){Q();return}z.validateSchema&&z.validateSchema("silent")}),We(T)&&qe(T,()=>{var n;(n=z.validateSchema)===null||n===void 0||n.call(z,"validated-only")}),Vt(Tt,z);function we(n,r){const l=M(r)||r==null?void 0:r.label,s=O(F(n))||Z(n,{label:l}),v=()=>M(r)?r(pe(s,ge)):r||{};function d(){var p;s.touched=!0,((p=v().validateOnBlur)!==null&&p!==void 0?p:ae().validateOnBlur)&&x(s.path)}function y(){var p;((p=v().validateOnInput)!==null&&p!==void 0?p:ae().validateOnInput)&&k(()=>{x(s.path)})}function j(){var p;((p=v().validateOnChange)!==null&&p!==void 0?p:ae().validateOnChange)&&k(()=>{x(s.path)})}const V=P(()=>{const p={onChange:j,onInput:y,onBlur:d};return M(r)?Object.assign(Object.assign({},p),r(pe(s,ge)).props||{}):r!=null&&r.props?Object.assign(Object.assign({},p),r.props(pe(s,ge))):p});return[Ve(n,()=>{var p,A,I;return(I=(p=v().validateOnModelUpdate)!==null&&p!==void 0?p:(A=ae())===null||A===void 0?void 0:A.validateOnModelUpdate)!==null&&I!==void 0?I:!0}),V]}function yt(n){return Array.isArray(n)?n.map(r=>Ve(r,!0)):Ve(n)}function bt(n,r){const[l,s]=we(n,r);function v(){s.value.onBlur()}function d(j){const V=Xe(j);W(F(n),V,!1),s.value.onInput()}function y(j){const V=Xe(j);W(F(n),V,!1),s.value.onChange()}return P(()=>Object.assign(Object.assign({},s.value),{onBlur:v,onInput:d,onChange:y,value:l.value}))}function pt(n,r){const[l,s]=we(n,r),v=O(F(n));function d(y){l.value=y}return P(()=>{const y=M(r)?r(pe(v,ge)):r||{};return Object.assign({[y.model||"modelValue"]:l.value,[`onUpdate:${y.model||"modelValue"}`]:d},s.value)})}return Object.assign(Object.assign({},z),{values:Et(m),handleReset:()=>je(),submitForm:ht})}function ir(e,t,i,a){const u={touched:"some",pending:"some",valid:"every"},o=P(()=>!le(t,J(i)));function f(){const m=e.value;return B(u).reduce((c,g)=>{const _=u[g];return c[g]=m[_](S=>S[g]),c},{})}const h=Re(f());return jt(()=>{const m=f();h.touched=m.touched,h.valid=m.valid,h.pending=m.pending}),P(()=>Object.assign(Object.assign({initialValues:J(i)},h),{valid:h.valid&&!B(a.value).length,dirty:o.value}))}function ar(e,t,i){const a=lt(i),u=H(a),o=H(b(a));function f(h,m=!1){u.value=ue(b(u.value)||{},b(h)),o.value=ue(b(o.value)||{},b(h)),m&&e.value.forEach(c=>{if(c.touched)return;const _=D(u.value,c.path);q(t,c.path,b(_))})}return{initialValues:u,originalInitialValues:o,setInitialValues:f}}function lr(e,t){return t?{valid:e.valid&&t.valid,errors:[...e.errors,...t.errors]}:e}const ur=gt({name:"Form",inheritAttrs:!1,props:{as:{type:null,default:"form"},validationSchema:{type:Object,default:void 0},initialValues:{type:Object,default:void 0},initialErrors:{type:Object,default:void 0},initialTouched:{type:Object,default:void 0},validateOnMount:{type:Boolean,default:!1},onSubmit:{type:Function,default:void 0},onInvalidSubmit:{type:Function,default:void 0},keepValues:{type:Boolean,default:!1}},setup(e,t){const i=$e(e,"validationSchema"),a=$e(e,"keepValues"),{errors:u,errorBag:o,values:f,meta:h,isSubmitting:m,isValidating:c,submitCount:g,controlledValues:_,validate:S,validateField:E,handleReset:C,resetForm:X,handleSubmit:K,setErrors:oe,setFieldError:se,setFieldValue:te,setValues:ce,setFieldTouched:L,setTouched:$,resetField:de}=nr({validationSchema:i.value?i:void 0,initialValues:e.initialValues,initialErrors:e.initialErrors,initialTouched:e.initialTouched,validateOnMount:e.validateOnMount,keepValuesOnUnmount:a}),fe=K((O,{evt:R})=>{rt(R)&&R.target.submit()},e.onInvalidSubmit),ve=e.onSubmit?K(e.onSubmit,e.onInvalidSubmit):fe;function T(O){Be(O)&&O.preventDefault(),C(),typeof t.attrs.onReset=="function"&&t.attrs.onReset()}function Z(O,R){return K(typeof O=="function"&&!R?O:R,e.onInvalidSubmit)(O)}function me(){return b(f)}function he(){return b(h.value)}function re(){return b(u.value)}function Y(){return{meta:h.value,errors:u.value,errorBag:o.value,values:f,isSubmitting:m.value,isValidating:c.value,submitCount:g.value,controlledValues:_.value,validate:S,validateField:E,handleSubmit:Z,handleReset:C,submitForm:fe,setErrors:oe,setFieldError:se,setFieldValue:te,setValues:ce,setFieldTouched:L,setTouched:$,resetForm:X,resetField:de,getValues:me,getMeta:he,getErrors:re}}return t.expose({setFieldError:se,setErrors:oe,setFieldValue:te,setValues:ce,setFieldTouched:L,setTouched:$,resetForm:X,validate:S,validateField:E,resetField:de,getValues:me,getMeta:he,getErrors:re,values:f,meta:h,errors:u}),function(){const R=e.as==="form"?e.as:e.as?Ot(e.as):null,U=Dt(R,t,Y);return R?St(R,Object.assign(Object.assign(Object.assign({},R==="form"?{novalidate:!0}:{}),t.attrs),{onSubmit:ve,onReset:T}),U):U}}}),cr=ur;export{cr as F};