System.register(["./index-legacy-BGUFxny_.js"],function(e,r){"use strict";var t,n,a,u,s,c,o,i,g,l,d,h,b,f,y,p,v,x,w,_,m;return{setters:[e=>{t=e.j,n=e.b9,a=e.bq,u=e.B,s=e.D,c=e.S,o=e.ah,i=e.c0,g=e.o,l=e.aK,d=e.ab,h=e.ag,b=e.aE,f=e.I,y=e.K,p=e.ao,v=e.a6,x=e.r,w=e.bt,_=e.bb,m=e.d9}],execute:function(){e("default",()=>{const{back:e}=t(),[r,$]=n(()=>a.post("/auth/2fa/generate")),k=g(),[q,I]=u(),[K,S]=u("");(async()=>{if(v().otp)return x.warning(k("users.2fa_already_enabled")),void e();const r=await $();w(r,I)})();const[j,D]=n(()=>a.post("/auth/2fa/verify",{code:K(),secret:q()?.secret})),E=async()=>{const r=await D();_(r,()=>{m({...v(),otp:!0}),e()})};return s(p,{get loading(){return r()},get children(){return s(c,{get when(){return q()},get children(){return s(o,{spacing:"$2",alignItems:"start",get children(){return[s(i,{get children(){return k("users.scan_qr")}}),s(l,{boxSize:"$xs",rounded:"$lg",get src(){return q()?.qr}}),s(i,{get children(){return[d(()=>k("users.or_manual")),":"," ",s(h,{get color(){return b()},get children(){return q()?.secret}})]}}),s(f,{maxW:"$xs",get placeholder(){return k("users.input_code")},get value(){return K()},onInput:e=>S(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&E()}}),s(y,{get loading(){return j()},onClick:E,get children(){return k("users.verify")}})]}})}})}})})}}});
