import{T as k}from"./Input-b786da58.js";import{T}from"./Label-fda955a2.js";import{L as V}from"./LoadingButton-1a262643.js";import{T as C}from"./ValidationErrors-73f2ddd2.js";import{T as L}from"./AuthenticationCard-c0b50c6c.js";import{J as w}from"./AuthenticationCardLogo-9d12c785.js";import{_ as x,r as s,o as n,d as B,e as y,g as c,a as m,c as i,h as a,t as l,F as u,w as v}from"./app-32ed258c.js";import"./ApplicationMark-984b256c.js";const R={components:{TecInput:k,TecLabel:T,LoadingButton:V,TecValidationErrors:C,TecAuthenticationCard:L,TecAuthenticationCardLogo:w},data(){return{recovery:!1,form:this.$inertia.form({code:"",recovery_code:""})}},created(){document.title=this.$t("OTP")+" • "+this.$settings.name},mounted(){document.body.classList.add("spinner-normal")},unmounted(){document.body.classList.remove("spinner-normal")},methods:{toggleRecovery(){this.recovery^=!0,this.$nextTick(()=>{this.recovery?(this.$refs.recovery_code.focus(),this.form.code=""):(this.$refs.code.focus(),this.form.recovery_code="")})},submit(){this.form.post(this.route("two-factor.login"))}}},U={class:"mb-4 text-gray-600"},$={key:0},A={key:1},F={class:"flex items-center justify-end mt-4"};function N(t,o,P,E,e,d){const _=s("tec-authentication-card-logo"),g=s("tec-validation-errors"),f=s("tec-label"),p=s("tec-input"),h=s("loading-button"),b=s("tec-authentication-card");return n(),B(b,null,{logo:y(()=>[c(_)]),default:y(()=>[m("div",U,[e.recovery?(n(),i(u,{key:1},[a(l(t.$t("Please confirm access to your account by entering one of your emergency recovery codes.")),1)],64)):(n(),i(u,{key:0},[a(l(t.$t("Please confirm access to your account by entering the authentication code provided by your authenticator application.")),1)],64))]),c(g,{class:"mb-4"}),m("form",{onSubmit:o[3]||(o[3]=v((...r)=>d.submit&&d.submit(...r),["prevent"]))},[e.recovery?(n(),i("div",A,[c(f,{for:"recovery_code",value:t.$t("Recovery Code")},null,8,["value"]),c(p,{type:"text",id:"recovery_code",ref:"recovery_code",class:"mt-1 block w-full",modelValue:e.form.recovery_code,"onUpdate:modelValue":o[1]||(o[1]=r=>e.form.recovery_code=r),autocomplete:"one-time-code"},null,8,["modelValue"])])):(n(),i("div",$,[c(f,{for:"code",value:t.$t("Code")},null,8,["value"]),c(p,{autofocus:"",id:"code",ref:"code",type:"text",inputmode:"numeric",modelValue:e.form.code,"onUpdate:modelValue":o[0]||(o[0]=r=>e.form.code=r),class:"mt-1 block w-full",autocomplete:"one-time-code"},null,8,["modelValue"])])),m("div",F,[m("button",{type:"button",onClick:o[2]||(o[2]=v((...r)=>d.toggleRecovery&&d.toggleRecovery(...r),["prevent"])),class:"text-gray-600 py-3 px-4 rounded-md hover:text-gray-900 hover:bg-gray-200 cursor-pointer transition-all"},[e.recovery?(n(),i(u,{key:1},[a(l(t.$t("Use an authentication code")),1)],64)):(n(),i(u,{key:0},[a(l(t.$t("Use a recovery code")),1)],64))]),c(h,{type:"submit",class:"ml-2",loading:e.form.processing,disabled:e.form.processing},{default:y(()=>[a(l(t.$t("Login")),1)]),_:1},8,["loading","disabled"])])],32)]),_:1})}const z=x(R,[["render",N]]);export{z as default};
