1import{D as i,h as _,y as M,a,O as z,d as e,G as S,am as Y,A as w,B as v,an as p,ao as P,E as L,ap as x,aq as K,ar as H,as as $,J as j,j as F,a1 as q,n as J,ai as Q,a0 as Z}from"./index-528475f0.js";const k={RESEND:"RESEND",NO_SPAM:"NO_SPAM"},O={REQUIRED:{alert:{id:"6szUCa"},input:{id:"4pstCp"}},EXPIRED:{alertNoResend:{id:"FxCWo5"},alert:{id:"4OXir4"},input:{id:"soSvYl"}},INVALID:{alertNoResend:{id:"DuHfVi"},alert:{id:"1wIqwp"},input:{id:"BXizOH"}},RATE_LIMITED:{alert:{id:"1WKFws"}}},ee=(o,r)=>{const t=r?e._({id:"OMcfn6"}):e._({id:"nkIsAz"});return o===k.RESEND?e._({id:"Az+W6C",values:{verificationAttribute:t}}):o===k.NO_SPAM?e._({id:"yAqaMT",values:{verificationAttribute:t}}):e._({id:"RrBlXD",values:{verificationAttribute:t}})},ae=()=>a(p,{iconName:"IconEmail"}),ie=()=>a(p,{iconName:"IconInformation"}),U=({messageType:o,onSendEmail:r,onSubmit:t,onBack:d,canResend:u=!1,isLoading:R=!1,codeValidityLength:N=0,codeLength:f=0,email:m="",shouldExist:E=!1})=>{const[n,C]=_(""),[I,D]=_(""),[y,g]=_(""),c=({alert:s,alertNoResend:l,input:b}={})=>{D(!u&&l?e._(l):s&&e._(s)),g(b&&e._(b))},T=async()=>{try{await r(),c()}catch({message:s}){s.includes(P)?c(O.RATE_LIMITED):c({alert:e._(L[s]||s)})}},A=async s=>{if(s==null||s.preventDefault(),!n.length||n.length<f){c(O.REQUIRED);return}c();try{await t(n),c()}catch({message:l}){l.includes(x)||l.includes(K)?c(O.INVALID):l.includes(H)||l.includes($)?c(O.EXPIRED):c({alert:e._(L[l]||l)})}};return M(()=>{n.length&&n.length===f&&A()},[n]),a("form",{name:"verifyEmail",onSubmit:A,className:"check-email-for-code",noValidate:!0,children:[a(z,{className:"check-email-for-code__header","data-qa":"check-email-header",title:e._({id:"U8N77O"})}),a("p",{className:"check-email-for-code__info","data-qa":"check-email-body",children:ee(o,E)}),a("p",{className:"check-email-for-code__info","data-qa":"check-email-body",children:[e._({id:"FBcR77"})," ",!!N&&e._({id:"qM8Pat",values:{codeValidityLength:N}})]}),I&&a(S,{variation:"danger",size:"large",icon:a(ie,{}),"data-qa":"check-email-error",children:I}),a(Y,{value:n,onChange:s=>C(s.target.value.trim()),error:y,disabled:R,label:f?e._({id:"wEK/wj",values:{codeLength:f}}):e._({id:"EWPtMO"}),"data-qa":"check-email-code"}),m&&a(S,{size:"large",icon:a(ae,{}),variation:"neutral","data-qa":"check-email-alert",children:[a("div",{className:"check-email-for-code__email",children:e._({id:"WWp4Mk",values:{email:m}})}),a(w,{onClick:d,children:e._({id:"WqmIha"})})]}),!u&&a("p",{className:"check-email-for-code__info","data-qa":"check-email-body",children:E?e._({id:"fVRlIa"}):e._({id:"TtYe31"})}),a(v,{type:"submit",onSubmit:A,disabled:R,"data-qa":"check-email-confirm",fullWidth:!0,children:e._({id:"CMj4hw"})}),u&&a(v,{onClick:T,variation:"outline-standard",disabled:R,"data-qa":"check-email-resend",fullWidth:!0,children:e._({id:"mdeIOH"})})]})};U.propTypes={canResend:i.bool,isLoading:i.bool,email:i.string,info:i.string,codeValidityLength:i.number,codeLength:i.number,shouldExist:i.bool,onSubmit:i.func.isRequired,onSendEmail:i.func.isRequired,onBack:i.func.isRequired};const ne="/iam/assets/send-438042eb.svg",V={[k.RESEND]:{withEmail:{id:"MUDuiz"},withoutEmail:{id:"bD6FJT"}},[k.NO_SPAM]:{withEmail:{id:"KWnMlo"},withoutEmail:{id:"bPbUC2"}},default:{withEmail:{id:"RtIb6U"},withoutEmail:{id:"zaU5hM"}}},se=(o,r)=>{const{withEmail:t,withoutEmail:d}=V[r]||V.default;return e._(o?t:d)},oe=()=>a(p,{iconName:"IconEmail"}),te=()=>a(p,{iconName:"IconInformation"}),X=({shouldExist:o,canResend:r,isLoading:t,email:d,codeValidityLength:u,messageType:R,onSendEmail:N,onBack:f,toggleShowForCode:m})=>{const[E,n]=_(""),C=async()=>{try{await N(),n("")}catch({message:I}){I.includes(P)?n(e._({id:"D+7+N/"})):n(e._(L[I]||I))}};return a("div",{className:"check-email-for-link",children:[a("img",{alt:"send",src:ne}),a(z,{className:"check-email-for-link__header","data-qa":"check-email-header",title:e._({id:"5IXWmO"})}),a("p",{className:"check-email-for-link__info","data-qa":"check-email-body",children:se(d,R)}),E&&a("div",{className:"check-email-for-link__error",children:a(S,{variation:"danger",size:"large",icon:te,"data-qa":"check-email-error",children:E})}),d&&a(S,{size:"large",icon:a(oe,{}),variation:"neutral","data-qa":"check-email-alert",children:[a("div",{className:"check-email-for-code__email",children:e._({id:"y6zJGA",values:{email:d}})}),a(w,{onClick:f,children:e._({id:"WqmIha"})})]}),a("p",{className:"check-email-for-link__info","data-qa":"check-email-body",children:[o?e._({id:"Ths4qq"}):e._({id:"R95VA/"}
1),". ",!!u&&`${e._({id:"bYNXl2",values:{codeValidityLength:u}})}. `,!r&&(o?e._({id:"fVRlIa"}):e._({id:"TtYe31"}))]}),r&&a("div",{className:"check-email-for-link__resend",children:a(v,{onClick:C,"data-qa":"check-email-resend",variation:"outline-standard",disabled:t,fullWidth:!0,children:e._({id:"G42SNI"})})}),a("div",{className:"check-email-for-link__code",children:a(w,{onClick:m,children:e._({id:"mov7kA"})})})]})};X.propTypes={shouldExist:i.bool,canResend:i.bool,isLoading:i.bool,email:i.string,messageType:i.string,codeValidityLength:i.number,onSendEmail:i.func.isRequired,toggleShowForCode:i.func.isRequired};const W=1e3*60*5,ce=({onVerify:o,resendEmail:r,email:t="",autoSend:d="",shouldExist:u=!1,matches:R})=>{const[N]=j(),[f,m]=_(!1),[E,n]=_(!0),[C,I]=_({}),[D,y]=_(""),[g,c]=_(window.ENV.USE_EMAIL_VERIFICATION_CODE),T=t||N.email,A=async()=>{m(!0);try{const h=await r();I(h),Z(q,Date.now())}catch(h){throw h.message.includes(P)&&(n(!1),y(k.NO_SPAM)),h}finally{m(!1)}},s=async()=>{await A(),n(!1),y(k.RESEND)},l=async h=>{m(!0);try{await o(h)}finally{m(!1)}};return M(()=>{d&&d!=="false"&&(F(q)>Date.now()-W?(n(!1),y(k.NO_SPAM)):A().then(()=>n(!1)))},[]),M(()=>{if(!E){const h=F(q),B=Date.now()+W-h,G=setTimeout(()=>n(!0),B);return()=>clearTimeout(G)}return()=>{}},[E]),a(g?U:X,{shouldExist:u,canResend:E,isLoading:f,email:T,messageType:D,toggleShowForCode:()=>c(!g),onSubmit:l,onSendEmail:s,onBack:()=>J(Q,{query:R}),...C})};ce.propTypes={email:i.string,resendEmail:i.func.isRequired,onVerify:i.func.isRequired,autoSend:i.string,shouldExist:i.bool};export{ce as default};
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.