import{d as X,aT as u,W as i,a3 as a,u as e,X as c,bK as t,a2 as m,bh as n,F as f,bP as x,Q as _,b2 as g,r as $}from"./vendor-reka-Edfq1EPl.js";import{useForm as k,Head as V}from"./vendor/inertia-CR4tWtMT.js";import{A as h}from"./AuthLayout-Ck4KMD0f.js";import{n as w,d as C}from"./registry-DyIszw9-.js";import{_ as B,a as F,b as N,c as T}from"./CardContent.vue_vue_type_script_setup_true_lang-DPd7KJ8I.js";import{_ as j}from"./CardDescription.vue_vue_type_script_setup_true_lang-Ds2CuvUf.js";import{_ as p,a as b,b as y}from"./FormMessage.vue_vue_type_script_setup_true_lang-CIPMOSQA.js";import{_ as A}from"./Input.vue_vue_type_script_setup_true_lang-D6nVx0lb.js";import{_ as L,a as M,b as S}from"./InputOtpSlot.vue_vue_type_script_setup_true_lang-CO2_3WNM.js";const U={class:"flex min-h-screen items-center justify-center bg-muted/40"},I=X({layout:h,__name:"MfaChallenge",setup(D){const{t:o}=w(),d=$(!1),r=k({code:""});function v(){r.post("/admin/mfa/challenge")}return(E,l)=>(u(),i(f,null,[a(e(V),{title:e(o)("builder.mfa.title")},null,8,["title"]),c("div",U,[a(T,{class:"w-full max-w-sm"},{default:t(()=>[a(B,null,{default:t(()=>[a(F,{class:"text-xl"},{default:t(()=>[m(n(e(o)("builder.mfa.title")),1)]),_:1}),a(j,null,{default:t(()=>[d.value?(u(),i(f,{key:1},[m(n(e(o)("builder.mfa.enter_recovery")),1)],64)):(u(),i(f,{key:0},[m(n(e(o)("builder.mfa.enter_otp")),1)],64))]),_:1})]),_:1}),a(N,null,{default:t(()=>[c("form",{class:"space-y-4",onSubmit:x(v,["prevent"])},[d.value?(u(),_(p,{key:1},{default:t(()=>[a(b,{error:!!e(r).errors.code,for:"recovery"},{default:t(()=>[m(n(e(o)("builder.mfa.recovery_code")),1)]),_:1},8,["error"]),a(A,{id:"recovery",modelValue:e(r).code,"onUpdate:modelValue":l[2]||(l[2]=s=>e(r).code=s),type:"text",name:"code",autocomplete:"one-time-code",placeholder:"XXXXXXXX-XXXXXXXX",class:"font-mono tracking-widest"},null,8,["modelValue"]),a(y,{message:e(r).errors.code},null,8,["message"])]),_:1})):(u(),_(p,{key:0},{default:t(()=>[a(b,{error:!!e(r).errors.code,for:"otp"},{default:t(()=>[m(n(e(o)("builder.mfa.auth_code")),1)]),_:1},8,["error"]),a(L,{modelValue:e(r).code,"onUpdate:modelValue":l[0]||(l[0]=s=>e(r).code=s),length:6,onComplete:l[1]||(l[1]=s=>e(r).code=s.join(""))},{default:t(()=>[a(M,null,{default:t(()=>[(u(),i(f,null,g(6,s=>a(S,{key:s,index:s-1},null,8,["index"])),64))]),_:1})]),_:1},8,["modelValue"]),a(y,{message:e(r).errors.code},null,8,["message"])]),_:1})),a(C,{type:"submit",disabled:e(r).processing,class:"w-full"},{default:t(()=>[m(n(e(o)("builder.mfa.verify")),1)]),_:1},8,["disabled"]),c("button",{type:"button",class:"w-full text-center text-sm text-muted-foreground hover:text-foreground hover:underline",onClick:l[3]||(l[3]=s=>d.value=!d.value)},n(d.value?e(o)("builder.mfa.use_authenticator"):e(o)("builder.mfa.use_recovery")),1)],32)]),_:1})]),_:1})])],64))}});export{I as default};
