1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8567],{38567:function(e,t,r){r.r(t),r.d(t,{MfaAuthVerifyFlowScreen:function(){return n},default:function(){return n}});var s=r(27573),o=r(7653),a=r(36170),i=r(17231);r(69021),r(26996),r(97347),r(7220),r(61899);let n={component:()=>{let{user:e}=(0,a.u)(),{data:t}=(0,a.a)(),[r,n]=(0,o.useState)(e?.mfaMethods[0]),[c,f]=(0,o.useState)(!1),[l,u]=(0,o.useState)(),[d,h]=(0,o.useState)();if((0,o.useEffect)(()=>{n(e?.mfaMethods[0])},[e?.mfaMethods]),!t?.mfaVerify)throw Error("Missing modal data for MFA verification screen.");let{onFailure:y,onSuccess:m,generateOptions:k,verifyTotpCode:p,verifyPasskey:v,verifySmsCode:w,sendSmsCode:S}=t.mfaVerify,g=async e=>{if("passkey"!==e)try{n(e),"sms"===e&&(n(e),await S()),"totp"===e&&n(e)}catch(e){console.error(e)}else try{n(e);let t=await k();if(!t)throw Error("something went wrong");u(t),await v(t),f(!0),h(void 0),m()}catch(e){h((0,i.t)(e))}},M=async e=>{h(void 0);try{if(!e||!r)return;if("passkey"===r){if(!l)throw Error("Missing passkey challenge");await v(l)}else"sms"===r?await w(e):"totp"===r&&await p(e);h(void 0),f(!0),m()}catch(e){throw(0,i.t)(e).error}},C=()=>{d||!c?y(d?.error??Error("Canceled MFA verification.")):m()},E=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{!E.current&&r&&(E.current=!0,g(r).finally(()=>{E.current=!1}))},[open]),e?"passkey"===r?(0,s.jsx)(i.V,{account:e.linkedAccounts.filter(e=>"passkey"===e.type&&e.enrolledInMfa).sort((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf())[0],submitSuccess:c,hasBlockingError:d?.isBlocking??!1,error:d?.error,onClose:C,onBack:()=>{n(void 0),h(void 0)},handleSubmit:()=>M(l).catch(h)}):"sms"===r||"totp"===r?(0,s.jsx)(i.a,{selectedMethod:r,submitSuccess:c,hasBlockingError:d?.isBlocking??!1,handleSubmitCode:M,onClose:C,onBack:e.mfaMethods.length>1?()=>n(void 0):void 0}):(0,s.jsx)(i.b,{user:e,onSelect:g,handleClose:C}):null}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.