import{$ as e,C as t,G as n,S as r,Wt as i,dt as a,h as o,st as s,u as c,ut as l,vt as u,y as d,z as f}from"./vue.runtime.esm-bundler-DAWRyTnP.js";import{a as p,i as m}from"./vue-router-Bna4o8ws.js";import{n as h}from"./vue-i18n-C4HYJWrq.js";import{$ as g,J as _,K as v,Mn as y,W as b,Z as x}from"./main-CVDkKXbu.js";import{t as S}from"./auth-B4jNfdH2.js";import{t as C}from"./global-BOUhEpPg.js";var w={__name:`ResetPassword`,setup(w){let T=m(),E=p(),D=S(),{t:O}=h(),k=l({email:``,password:``,password_confirmation:``});C();let A=a(!1),j=a(!1),M=y(o(()=>({email:{required:b.withMessage(O(`validation.required`),x),email:b.withMessage(O(`validation.email_incorrect`),v)},password:{required:b.withMessage(O(`validation.required`),x),minLength:b.withMessage(O(`validation.password_min_length`,{count:8}),_(8))},password_confirmation:{sameAsPassword:b.withMessage(O(`validation.password_incorrect`),g(k.password))}})),k);async function N(e){if(M.value.$touch(),!M.value.$invalid){let e={email:k.email,password:k.password,password_confirmation:k.password_confirmation,token:T.params.token};j.value=!0;let t=D.resetPassword(e,T.params.company);j.value=!1,t.data&&E.push({name:`customer.login`})}}return(a,o)=>{let l=n(`BaseInput`),p=n(`BaseInputGroup`),m=n(`BaseIcon`),h=n(`BaseButton`);return f(),d(`form`,{id:`loginForm`,onSubmit:c(N,[`prevent`])},[t(p,{error:u(M).email.$error&&u(M).email.$errors[0].$message,label:a.$t(`login.email`),class:`mb-4`,required:``},{default:e(()=>[t(l,{modelValue:k.email,"onUpdate:modelValue":o[0]||=e=>k.email=e,type:`email`,name:`email`,invalid:u(M).email.$error,onInput:o[1]||=e=>u(M).email.$touch()},null,8,[`modelValue`,`invalid`])]),_:1},8,[`error`,`label`]),t(p,{error:u(M).password.$error&&u(M).password.$errors[0].$message,label:a.$t(`login.password`),class:`mb-4`,required:``},{default:e(()=>[t(l,{modelValue:k.password,"onUpdate:modelValue":o[3]||=e=>k.password=e,type:u(A)?`text`:`password`,name:`password`,invalid:u(M).password.$error,onInput:o[4]||=e=>u(M).password.$touch()},{right:e(()=>[t(m,{name:u(A)?`EyeIcon`:`EyeSlashIcon`,class:`mr-1 text-gray-500 cursor-pointer`,onClick:o[2]||=e=>s(A)?A.value=!u(A):A=!u(A)},null,8,[`name`])]),_:1},8,[`modelValue`,`type`,`invalid`])]),_:1},8,[`error`,`label`]),t(p,{error:u(M).password_confirmation.$error&&u(M).password_confirmation.$errors[0].$message,label:a.$t(`login.retype_password`),class:`mb-4`,required:``},{default:e(()=>[t(l,{modelValue:k.password_confirmation,"onUpdate:modelValue":o[5]||=e=>k.password_confirmation=e,type:`password`,name:`password`,invalid:u(M).password_confirmation.$error,onInput:o[6]||=e=>u(M).password_confirmation.$touch()},null,8,[`modelValue`,`invalid`])]),_:1},8,[`error`,`label`]),t(h,{type:`submit`,variant:`primary`},{default:e(()=>[r(i(a.$t(`login.reset_password`)),1)]),_:1})],32)}}};export{w as default};