import{_ as U,a as V}from"./B50g7Dgj.js";import{_ as k}from"./CW5dyef9.js";import{_ as C}from"./BpJC44XK.js";import{e as D}from"./B5iENo_P.js";import{v as F,s as R,m as E,A as O,n as T,G as N,r as y,_ as B,o as d,c as w,L as I,av as H,a as M,b as m,w as c,d as _,t as p,q as b,p as W,H as j}from"./CibDhUcP.js";import{u as q}from"./CIF28Dcq.js";import{u as A}from"./fWHo1AcK.js";import{u as h}from"./nOI-3DST.js";import"./CTMooejj.js";import"./CBXHUQO1.js";import"./5LXQy1qV.js";import"./BCJxuefG.js";const L=F({__name:"ResetPasswordFormStep3",setup(r,{expose:s}){s();const o=R(),e=E(),{t:f}=O(),i=T();o.signUpData.email.length===0&&(i.currentStep=0);const{passwordError:a,isPasswordValid:u}=q(),n=N().public.WHM_EXTRAS,l=y(!1),t=y(""),x=async()=>{if(!u())return;if(n&&!t.value){a.value=f("OTPCodeRequired");return}const P=n?t.value:o.signUpData.token,{error:v}=await o.passwordReset(P,o.signUpData.password);if(v){a.value=v;return}l.value=!0,h(()=>{e.push("/login"),h(()=>{o.clearData(),o.clearOtp(),i.currentStep=0},1e3)},5e3)},{tracker:g}=A();g("page_view","page","reset password step 3");const S={sStore:o,router:e,t:f,store:i,passwordError:a,isPasswordValid:u,isWhm:n,showSuccess:l,otpCode:t,setNewPassword:x,tracker:g,get VOtpInput(){return D}};return Object.defineProperty(S,"__isScriptSetup",{enumerable:!1,value:!0}),S}}),z={key:0,class:"mb-4"},G={key:1,class:"py-3 px-4 bg-emerald-100 outline outline-1 outline-green-500 rounded text-sm text-emerald-800"};function X(r,s,o,e,f,i){const a=U,u=V,n=k,l=C;return e.showSuccess?(d(),w("div",G,p(r.$t("PasswordSuccessFullyChanged")),1)):(d(),w("form",{key:0,onSubmit:j(e.setNewPassword,["prevent"])},[I(M("input",{id:"email","onUpdate:modelValue":s[0]||(s[0]=t=>e.sStore.signUpData.email=t),type:"email",class:"hidden"},null,512),[[H,e.sStore.signUpData.email]]),m(a,{modelValue:e.sStore.signUpData.password,"onUpdate:modelValue":s[1]||(s[1]=t=>e.sStore.signUpData.password=t),class:"mb-4",type:"password","id-":"new-password",autocomplete:"new-password"},{default:c(()=>[_(p(r.$t("Password")),1)]),_:1},8,["modelValue"]),e.isWhm?(d(),w("div",z,[m(u,null,{default:c(()=>[_(p(r.$t("EnterOTPCode")),1)]),_:1}),m(e.VOtpInput,{ref:"otpInput",value:e.otpCode,"onUpdate:value":s[2]||(s[2]=t=>e.otpCode=t),"input-classes":"otp-input","conditional-class":["one","two","three","four"],separator:"","input-type":"number","num-inputs":6,"should-auto-focus":!0,"should-focus-order":!0,placeholder:[],class:"flex gap-4"},null,8,["value"])])):b("",!0),e.passwordError?(d(),W(n,{key:1},{default:c(()=>[_(p(e.passwordError),1)]),_:1})):b("",!0),m(l,{size:"small",class:"px-8 py-2",type:"submit",tag:"button"},{default:c(()=>[_(p(r.$t("Finish")),1)]),_:1})],32))}const ne=Object.assign(B(L,[["render",X],["__file","ResetPasswordFormStep3.vue"]]),{__name:"ResetPasswordFormStep3"});export{ne as default};
