1"use strict";(self.webpackChunkcertification_sim_frontend=self.webpackChunkcertification_sim_frontend||[]).push([[4119,4244,9810],{51452(e,t,o){o.d(t,{p:()=>l});o(9950);var i=o(27321),n=o(20900),r=o(6503),a=o(7636),s=o(44414);const l=e=>{let{children:t,loading:o=!1}=e;return(0,s.jsxs)(i.A,{sx:{display:"flex",minHeight:"100vh",width:"100%",bgcolor:"#FFFFFF"},children:[(0,s.jsxs)(i.A,{"data-testid":"login-split-hero",sx:{display:{xs:"none",md:"flex"},flex:"1 1 46%",position:"relative",backgroundImage:"url(".concat(a.ln,")"),backgroundSize:"cover",backgroundPosition:"center",alignItems:"flex-start",justifyContent:"flex-start",p:4},children:[(0,s.jsx)(i.A,{sx:{position:"absolute",inset:0,background:"linear-gradient(180deg, rgba(15,23,42,0.35) 0%, rgba(15,23,42,0.12) 40%, rgba(15,23,42,0.28) 100%)"}}),(0,s.jsxs)(i.A,{sx:{position:"relative",zIndex:1,display:"flex",alignItems:"center",gap:1},children:[(0,s.jsx)(i.A,{component:"img",src:a.N5,alt:a.Az,sx:{width:a.Kd,height:a.Kd,objectFit:"contain",filter:"drop-shadow(0 2px 8px rgba(0,0,0,0.35))"}}),(0,s.jsx)(n.A,{sx:{color:"#fff",fontWeight:800,fontSize:"1.5rem",letterSpacing:"-0.03em",textShadow:"0 1px 8px rgba(0,0,0,0.35)"},children:a.Az})]})]}),(0,s.jsx)(i.A,{sx:{flex:{xs:"1 1 100%",md:"1 1 54%"},display:"flex",alignItems:{xs:"flex-start",sm:"center"},justifyContent:"center",px:{xs:2.5,sm:4,md:6},py:{xs:3,sm:4},bgcolor:"#FFFFFF",overflowY:"auto",minHeight:"100vh",WebkitOverflowScrolling:"touch"},children:o?(0,s.jsx)(r.A,{}):(0,s.jsx)(i.A,{sx:{width:"100%",maxWidth:440},children:t})})]})}},38152(e,t,o){o.d(t,{R:()=>s});o(9950);var i=o(27321),n=o(20900),r=o(7636),a=o(44414);const s=e=>{let{size:t=r.Kd,withWordmark:o=!1,wordmarkColor:s}=e;return(0,a.jsxs)(i.A,{sx:{display:"flex",alignItems:"center",gap:.5,minWidth:0},children:[(0,a.jsx)(i.A,{component:"img",src:r.N5,alt:r.Az,sx:{width:t,height:t,objectFit:"contain",flexShrink:0,display:"block",transform:"translateY(-1px)"}}),o&&(0,a.jsx)(n.A,{component:"span",sx:{fontWeight:800,fontSize:{xs:"1rem",md:"1.125rem"},letterSpacing:"-0.03em",color:s||"text.primary",lineHeight:1},children:r.Az})]})}},74119(e,t,o){o.r(t),o.d(t,{default:()=>Y,enterpriseRegisterFailureMessage:()=>V});var i=o(89379),n=o(9950),r=o(27321),a=o(6503),s=o(20900),l=o(55547),c=o(52036),d=o(32284),g=o(22403),u=o(34244),p=o(91651),h=o(5352),m=o(71500),f=o(55884),y=o(7356),v=o(20615),x=o(39872),w=o(20599),A=o(23590),b=o(68272),S=o(55030),_=o(49708),z=o(13271),C=o(19658),j=o(29344),L=o(63229),I=o(66337),P=o(51673),k=o(98323),E=o(1234),R=o(8649),O=o(86548),U=o(32856),D=o(51452),F=o(38152),M=o(30869),T=o(49810),B=o(44414);const N=e=>!!e&&(e=>{const t=e.replace("#","");return(.299*parseInt(t.substr(0,2),16)+.587*parseInt(t.substr(2,2),16)+.114*parseInt(t.substr(4,2),16))/255})(e)>.7,W={color:"#111111",fontWeight:700},J={"& .MuiInputBase-input":{color:"#111111"},"& .MuiInputLabel-root":{color:"rgba(17, 17, 17, 0.6)"},"& .MuiInputLabel-root.Mui-focused":{color:"#111111"},"& .MuiOutlinedInput-root":{"& .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(17, 17, 17, 0.23)"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(17, 17, 17, 0.87)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#111111"}}},q=(e,t)=>(0,i.A)({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:"100%",position:{xs:"fixed",sm:"relative"},top:{xs:0,sm:"auto"},left:{xs:0,sm:"auto"},right:{xs:0,sm:"auto"},bottom:{xs:0,sm:"auto"},minHeight:{xs:"auto",sm:"100vh"},overflow:{xs:"hidden",sm:"visible"},overscrollBehavior:{xs:"none",sm:"auto"},background:e,boxSizing:"border-box",px:{xs:2,sm:3},py:{xs:1.5,sm:4}},t),H=e=>{let{branded:t,background:o,children:i}=e;return t?(0,B.jsx)(r.A,{sx:q(o),children:(0,B.jsx)(r.A,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",width:"100%",maxWidth:440,mx:"auto",position:"relative",zIndex:1},children:i})}):(0,B.jsx)(D.p,{children:(0,B.jsxs)(r.A,{children:[(0,B.jsx)(r.A,{sx:{display:{xs:"flex",md:"none"},justifyContent:"center",mb:3},children:(0,B.jsx)(F.R,{withWordmark:!0})}),i]})})},K=()=>(0,B.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,B.jsx)("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),(0,B.jsx)("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),(0,B.jsx)("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),(0,B.jsx)("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]});function V(e,t,o){const i=null===t||void 0===t?void 0:t.code,n=(null===t||void 0===t?void 0:t.domain)||o,r={invali
1d_domain:n?e("auth.login.enterpriseRegisterInvalidDomain",{domain:n}):void 0,already_member:e("auth.login.enterpriseRegisterAlreadyMember"),already_registered:e("auth.login.enterpriseRegisterAlreadyRegistered"),inactive:e("auth.login.enterpriseRegisterInactive"),no_seats:e("auth.login.enterpriseRegisterNoSeats"),unavailable:e("auth.login.enterpriseRegisterUnavailable"),invalid_email:e("auth.login.enterpriseRegisterInvalidEmail"),invalid_name:e("auth.login.enterpriseRegisterInvalidName"),rate_limit:e("auth.login.enterpriseRegisterRateLimit")};return i&&r[i]||(null===t||void 0===t?void 0:t.error)||e("auth.login.enterpriseRegisterFailed")}const Y=()=>{var e,t,F,Y,G,X,Z,Q,$,ee,te,oe,ie,ne,re;const[ae,se]=(0,n.useState)(""),[le,ce]=(0,n.useState)(""),[de,ge]=(0,n.useState)(""),[ue,pe]=(0,n.useState)(!1),[he,me]=(0,n.useState)(R.F),[fe,ye]=(0,n.useState)(!1),[ve,xe]=(0,n.useState)(""),[we,Ae]=(0,n.useState)(""),[be,Se]=(0,n.useState)(null),[_e,ze]=(0,n.useState)(null),[Ce,je]=(0,n.useState)(null),[Le,Ie]=(0,n.useState)(!1),[Pe,ke]=(0,n.useState)(!1),[Ee,Re]=(0,n.useState)(!1),[Oe,Ue]=(0,n.useState)(!1),[De,Fe]=(0,n.useState)(!1),[Me,Te]=(0,n.use
1State)(""),[Be,Ne]=(0,n.useState)(""),[We,Je]=(0,n.useState)(""),qe=(0,n.useContext)(k.cy),He=(0,b.Zp)(),{t:Ke}=(0,S.Bd)(),Ve=(0,y.A)(),Ye=(0,v.A)(Ve.breakpoints.down("sm")),{organization:Ge,isOrganizationContext:Xe,isLoading:Ze,slug:Qe}=(0,E.Z5)(),$e=We||(null===Ge||void 0===Ge||null===(e=Ge.login_settings)||void 0===e?void 0:e.self_register_domain)||"",[et,tt]=(0,n.useState)(null),ot="undefined"!==typeof window&&window.__IS_ORG_SUBDOMAIN;(0,n.useEffect)(()=>{if(!Ye||!Xe)return;const e=document.body.style.overflow,t=document.documentElement.style.overflow;return document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",()=>{document.body.style.overflow=e,document.documentElement.style.overflow=t}},[Ye,Xe]),(0,n.useEffect)(()=>{Xe&&(P.A.debug("[Login] Organization context detected, forcing English"),O.default.changeLanguage("en"))},[Xe]),(0,n.useEffect)(()=>{if("true"===sessionStorage.getItem("oauth_in_progress")&&j.Ii.isNativePlatform()){P.A.debug("[Login] OAuth in progress detected, showing loading..."),Ie(!0);const e=setTimeout(()=>{P.A.debug("[Login] SSO timeout reached, clearing flag"),sessionStorage.removeItem("oauth_in_progress"),Ie(!1)},3e4);return()=>clearTimeout(e)}},[]),(0,n.useEffect)(()=>{if(Qe&&Ze)try{const e=localStorage.getItem("org_branding_".concat(Qe));if(e){const t=JSON.parse(e);tt({primary:t.primary_color,secondary:t.secondary_color})}}catch(e){P.A.warn("[Login] Failed to load cached colors")}else tt(null)},[Qe,Ze]);const it=Xe&&((null===Ge||void 0===Ge||null===(t=Ge.branding)||void 0===t?void 0:t.primary_color)||(null===et||void 0===et?void 0:et.primary))||"#667eea",nt=Xe&&((null===Ge||void 0===Ge||null===(F=Ge.branding)||void 0===F?void 0:F.secondary_color)||(null===et||void 0===et?void 0:et.secondary))||"#764ba2",rt=Xe?"linear-gradient(135deg, ".concat(it," 0%, ").concat(nt," 100%)"):"#FFFFFF",at={height:48,py:0,fontWeight:500,fontSize:"0.8125rem",lineHeight:1.2,letterSpacing:0,textTransform:"none","& .MuiButton-startIcon":{marginRight:1,"& svg":{width:18,height:18,fontSize:18}}},st=Xe&&N(it),lt=null===Ge||void 0===Ge||null===(Y=Ge.branding)||void 0===Y?void 0:Y.logo_url,ct=(null===Ge||void 0===Ge||null===(G=Ge.branding)||void 0===G?void 0:G.company_name)||(null===Ge||void 0===Ge?void 0:Ge.name),dt=(null===Ge||void 0===Ge||null===(X=Ge.branding)||void 0===X?void 0:X.logo_position)||"outside",gt=(null===Ge||void 0===Ge||null===(Z=Ge.branding)||void 0===Z?void 0:Z.logo_size)||"medium",ut=(e,t)=>{const o={small:"outside"===t?40:30,medium:"outside"===t?60:40,large:"outside"===t?80:60,original:"outside"===t?100:80};return o[e]||o.medium};(0,n.useEffect)(()=>{Xe&&P.A.debug("[Login] Organization Context:",{isOrganizationContext:Xe,organization:null===Ge||void 0===Ge?void 0:Ge.name,slug:null===Ge||void 0===Ge?void 0:Ge.slug,logoUrl:lt,companyName:ct,hasBranding:!(null===Ge||void 0===Ge||!Ge.branding)})},[Xe,Ge,lt,ct]),(0,n.useEffect)(()=>{qe||me("Authentication service is not available. Please try again later.")},[qe]),(0,n.useEffect)(()=>{const{user:e,isLoading:t}=qe||{};!t&&e&&(P.A.debug("[Login] Already authenticated, redirecting"),He((0,M.D2)(),{replace:!0}))},[qe,He]);const pt=null===qe||void 0===qe?void 0:qe.signIn,ht=null===qe||void 0===qe?void 0:qe.completeNewPassword;(0,n.useEffect)(()=>{try{localStorage.getItem("stripe_redirect_after_login")&&P.A.debug("[Login] Stripe redirect flag detected");const e=sessionStorage.getItem("login_error");e&&(P.A.debug("[Login] Showing stored error:",e),ge(e),sessionStorage.removeItem("login_error"));const t=sessionStorage.getItem("login_info");t&&(P.A.debug("[Login] Showing stored info:",t),ge(t),sessionStorage.removeItem("login_info"))}catch(e){P.A.error("[Login] Error reading session data:",e)}},[]);if(Qe&&Ze)return(0,B.jsx)(r.A,{sx:q(null!==et&&void 0!==et&&et.primary?"linear-gradient(135deg, ".concat(et.primary," 0%, ").concat(et.secondary||et.primary," 100%)"):"linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%)"),children:(0,B.jsx)(a.A,{size:48,sx:{color:(null===et||void 0===et?void 0:et.primary)||"#2563EB"}})});if(null!==qe&&void 0!==qe&&qe.isLoading)return Xe?(0,B.jsx)(r.A,{sx:q(rt),children:(0,B.jsx)(a.A,{size:48,sx:{color:"#fff"}})}):(0,B.jsx)(D.p,{loading:!0});if(Le)return Xe?(0,B.jsxs)(r.A,{sx:q(rt,{gap:3}),children:[(0,B.jsx)(a.A,{size:60,sx:{color:"white"}}),(0,B.jsx)(s.A,{variant:"h6",sx:{color:"white",fontWeight:600,textAlign:"center"},children:"Completing sign in..."}),(0,B.jsx)(s.A,{variant:"body2",sx:{color:"rgba(255,255,255,0.8)",textAlign:"center"},children:"Please wait while we verify your credentials"})]}):(0,B.jsx)(D.p,{children:(0,B.jsxs)(r.A,{sx:{textAlign:"center"},children:[(0,B.jsx)(a.A,{size:48}),(0,B.jsx)(s.A,{variant:"h6",sx:{mt:2,fontWeight:600},children:"Completing sign in..."}),(0,B.jsx)(s.A,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"Please wait while we verify your credentials"})]})});const mt="https://app.certsim.ai/login",ft=Ke("auth.login.title"),yt="Sign in to CertSim - AI-assisted certification exam simulator for AWS, Azure, GCP and more.",vt=!fe&&!ot&&!Xe&&!(0,I.Ji)(),xt=!fe&&!De&&(!Xe||!1!==(null===Ge||void 0===Ge||null===(Q=Ge.login_settings)||void 0===Q?void 0:Q.allow_email_login)),wt=Boolean(Xe&&(null===Ge||void 0===Ge||null===($=Ge.login_settings)||void 0===$?void 0:$.self_register_enabled)&&!1!==(null===Ge||void 0===Ge||null===(ee=Ge.login_settings)||void 0===ee?void 0:ee.allow_email_login)&&!(null!==Ge&&void 0!==Ge&&null!==(te=Ge.login_settings)&&void 0!==te&&te.sso_only));return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(U.mg,{children:[(0,B.jsxs)("title",{children:[ft," | CertSim"]}),(0,B.jsx)("meta",{name:"description",content:yt}),(0,B.jsx)("link",{rel:"canonical",href:mt}),(0,B.jsx)("meta",{property:"og:type",content:"website"}),(0,B.jsx)("meta",{property:"og:url",content:mt}),(0,B.jsx)("meta",{property:"og:title",content:"".concat(ft," | CertSim")}),(0,B.jsx)("meta",{property:"og:description",content:yt}),(0,B.jsx)("meta",{property:"og:image",content:"https://app.certsim.ai/og-image.png"}),(0,B.jsx)("meta",{property:"og:site_name",content:"CertSim"}),(0,B.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,B.jsx)("meta",{name:"twitter:url",content:mt}),(0,B.jsx)("meta",{name:"twitter:title",content:"".concat(ft," | CertSim")}),(0,B.jsx)("meta",{name:"twitter:description",content:yt}),(0,B.jsx)("meta",{name:"twitter:image",content:"https://app.certsim.ai/og-image.png"})]}),(0,B.jsxs)(H,{branded:Xe,background:rt,children:[Xe&<&&"outside"===dt&&(0,B.jsx)(r.A,{sx:{mb:{xs:2,sm:3}}
1,children:(0,B.jsx)("img",{src:lt,alt:ct||"Logo",style:{height:ut(gt,"outside"),objectFit:"contain",filter:"drop-shadow(0 2px 4px rgba(0,0,0,0.3))"},onLoad:()=>P.A.debug("[Login] Logo (outside) loaded successfully"),onError:e=>P.A.error("[Login] Logo (outside) failed to load:",e)})}),(0,B.jsx)(l.A,{sx:{width:"100%",alignSelf:"stretch",borderRadius:3,boxShadow:Xe?{xs:"0 4px 24px rgba(0,0,0,0.08)",md:"0 8px 32px rgba(0,0,0,0.12)"}:"none",border:Xe?"1px solid rgba(0,0,0,0.06)":"none"},elevation:0,children:(0,B.jsxs)(c.A,{sx:{p:{xs:2.5,sm:4}},children:[(P.A.debug("[Login] Render check:",{isOrganizationContext:Xe,logoUrl:lt,companyName:ct,logoPosition:dt}),Xe&<&&"inside"===dt?(0,B.jsx)(r.A,{sx:{display:"flex",justifyContent:"center",mb:{xs:1.5,sm:2}},children:(0,B.jsx)("img",{src:lt,alt:ct||"Logo",style:{height:ut(gt,"inside"),objectFit:"contain"},onLoad:()=>P.A.debug("[Login] Logo (inside) loaded successfully"),onError:e=>P.A.error("[Login] Logo (inside) failed to load:",e)})}):null),(0,B.jsx)(s.A,{variant:"h5",align:"center",gutterBottom:!0,sx:{fontWeight:700,mb:.5,fontSize:{xs:"1.5rem",sm:"1.75rem"}},children:fe?"Change Your Password":Ke("auth.login.title")}),(0,B.jsx)(s.A,{variant:"body2",align:"center",color:"text.secondary",sx:{mb:{xs:2,sm:2.5},fontSize:"0.9375rem"},children:fe?"Please set a new password to continue":Ke("auth.login.subtitle")}),he&&(0,B.jsx)(d.A,{severity:"warning",sx:{mb:{xs:1.25,sm:2}},action:(0,B.jsx)(g.A,{color:"inherit",size:"small",onClick:()=>window.location.reload(),children:"Reload"}),children:he}),de&&!he&&(0,B.jsx)(d.A,{severity:"error",sx:{mb:{xs:1.25,sm:2}},children:de}),Ce&&(0,B.jsxs)(d.A,{severity:"info",sx:{mb:{xs:1.25,sm:2}},children:["Your password has been set. This account belongs to an organization."," ",(0,B.jsx)(u.A,{href:Ce,sx:{fontWeight:600},children:"Click here to sign in to your organization"})]}),fe&&!Xe&&(0,B.jsx)(d.A,{severity:"warning",sx:{mb:{xs:1.25,sm:2}},children:"This account was invited by an organization. Please use your organization's login page to set your password. Check your invitation email for the link."}),fe&&Xe&&(0,B.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),ht&&be)if(ve===we)if(ve.length<8)ge("Password must be at least 8 characters");else{ge(""),pe(!0);try{if(await ht(be,ve),P.A.debug("[Login] Password changed successfully"),_e){P.A.debug("[Login] Validating user for organization after password change");try{const e=(await Promise.resolve().then(o.bind(o,82932))).default;if(!(await e.get("/organizations/slug/".concat(_e,"/validate-user"),{params:{email:ae}})).data.allowed){P.A.warn("[Login] User not authorized for organization:",_e);const{Auth:e}=await o.e(6433).then(o.bind(o,6433));return await e.signOut({global:!0}),ge("You are not authorized to access this organization. Please contact your administrator."),void pe(!1)}P.A.debug("[Login] User validated for organization:",_e)}catch(t){P.A.error("[Login] Organization validation failed:",t);const{Auth:e}=await o.e(6433).then(o.bind(o,6433));return await e.signOut({global:!0}),ge(t.message||"You are not authorized to access this organization."),void pe(!1)}}P.A.debug("[Login] Password change complete, waiting for session to establish..."),ye(!1),pe(!0),await new Promise(e=>setTimeout(e,2e3)),P.A.debug("[Login] Session established, redirecting..."),P.A.info("[Login] \xf0\u0178\u0161\u20ac Attempting redirect to /app");const e=localStorage.getItem("stripe_redirect_after_login");e&&!(0,I.Ji)()?(P.A.debug("[Login] Redirecting to subscription page for Stripe"),localStorage.removeItem("stripe_redirect_after_login"),He("/subscription",{replace:!0})):(e&&localStorage.removeItem("stripe_redirect_after_login"),P.A.debug("[Login] Redirecting after password change"),He((0,M.D2)(),{replace:!0}))}catch(i){P.A.error("[Login] Password change failed:",i),i.isEnterpriseRedirect&&i.enterpriseUrl?(je(i.enterpriseUrl),ye(!1)):ge(i.message||"Failed to change password. Please try again."),pe(!1)}}else ge("Passwords do not match");else ge("Authentication service is not available. Please refresh the page.")},children:[(0,B.jsx)(d.A,{severity:"info",sx:{mb:{xs:1.25,sm:2}},children:"This is your first login. Please create a new password."}),(0,B.jsx)(p.A,{fullWidth:!0,label:"Email",type:"email",value:ae,disabled:!0,sx:st?(0,i.A)({mt:{xs:1,sm:2}},J):{mt:{xs:1,sm:2}}}),(0,B.jsx)(p.A,{fullWidth:!0,label:"New Password",type:Ee?"text":"password",value:ve,onChange:e=>xe(e.target.value),required:!0,disabled:ue,helperText:"Must be at least 8 characters with uppercase, lowercase, number and special character",sx:st?(0,i.A)({mt:{xs:1,sm:2}},J):{mt:{xs:1,sm:2}},InputProps:{endAdornment:(0,B.jsx)(h.A,{position:"end",children:(0,B.jsx)(m.A,{onClick:()=>Re(!Ee),edge:"end",size:"small",children:Ee?(0,B.jsx)(w.A,{}):(0,B.jsx)(x.A,{})})})}}),(0,B.jsx)(p.A,{fullWidth:!0,label:"Confirm New Password",type:Oe?"text":"password",value:we,onChange:e=>Ae(e.target.value),required:!0,disabled:ue,sx:st?(0,i.A)({mt:{xs:1,sm:2}},J):{mt:{xs:1,sm:2}},InputProps:{endAdornment:(0,B.jsx)(h.A,{position:"end",children:(0,B.jsx)(m.A,{onClick:()=>Ue(!Oe),edge:"end",size:"small",children:Oe?(0,B.jsx)(w.A,{}):(0,B.jsx)(x.A,{})})})}}),(0,B.jsx)(g.A,{fullWidth:!0,variant:"contained",type:"submit",disabled:ue,sx:{mt:{xs:1.5,sm:3},py:{xs:1.1,sm:1.5}},children:ue?(0,B.jsx)(a.A,{size:24}):"Change Password"})]}),!fe&&Xe&&(null===Ge||void 0===Ge?void 0:Ge.sso_enabled)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(g.A,{fullWidth:!0,variant:"contained",onClick:async()=>{const e="auth.certsim.io",t="29f43r8t98onib1283h0jt3jf4";const o=j.Ii.isNativePlatform(),i=o?"certsim://oauth":"".concat(window.location.origin,"/callback"),n="https://".concat(e,"/oauth2/authorize?identity_provider=Microsoft&redirect_uri=").concat(encodeURIComponent(i),"&response_type=code&client_id=").concat(t,"&scope=").concat("email+openid+profile+phone+aws.
1cognito.signin.user.admin");P.A.debug("[Login] Redirecting to Microsoft SSO:",n),o?await L.P.open({url:n}):window.location.href=n},disabled:ue||!!he,sx:{py:{xs:1.1,sm:1.5},mb:{xs:1.25,sm:2},bgcolor:"#0078d4","&:hover":{bgcolor:"#106ebe"}},children:(0,B.jsxs)(r.A,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,B.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 23 23",fill:"none",children:[(0,B.jsx)("path",{d:"M11 0H0V11H11V0Z",fill:"#F25022"}),(0,B.jsx)("path",{d:"M23 0H12V11H23V0Z",fill:"#7FBA00"}),(0,B.jsx)("path",{d:"M11 12H0V23H11V12Z",fill:"#00A4EF"}),(0,B.jsx)("path",{d:"M23 12H12V23H23V12Z",fill:"#FFB900"})]}),(0,B.jsx)("span",{children:"Sign in with Microsoft"})]})}),!1!==(null===Ge||void 0===Ge||null===(oe=Ge.login_settings)||void 0===oe?void 0:oe.allow_email_login)&&(0,B.jsx)(f.A,{sx:{my:{xs:1.25,sm:2}},children:(0,B.jsx)(s.A,{variant:"body2",color:"text.secondary",children:"OR"})})]}),!fe&&De&&wt&&(0,B.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),Qe){ge(""),Ne(""),pe(!0);try{const e=await T.organizationService.registerForOrganization(Qe,{email:ae.trim(),name:Me.trim()});"pending"===e.status?Ne(Ke("auth.login.enterpriseRegisterPending")):"existing"===e.status?Ne(Ke("auth.login.enterpriseRegisterExisting")):Ne(Ke("auth.login.enterpriseRegisterCreated"))}catch(n){var t,o,i;const e=null===n||void 0===n||null===(t=n.response)||void 0===t||null===(o=t.data)||void 0===o?void 0:o.domain;"string"===typeof e&&e&&Je(e),ge(V(Ke,null===n||void 0===n||null===(i=n.response)||void 0===i?void 0:i.data,$e))}finally{pe(!1)}}},children:[(0,B.jsx)(s.A,{variant:"body2",color:"text.secondary",sx:{mb:2},children:$e?Ke("auth.login.enterpriseRegisterDomain",{domain:$e}):Ke("auth.login.enterpriseRegisterAnyEmail")}),Be&&(0,B.jsx)(d.A,{severity:"success",sx:{mb:2},children:Be}),Be&&(0,B.jsx)(g.A,{fullWidth:!0,variant:"outlined",type:"button","data-testid":"enterprise-register-back",onClick:()=>{Fe(!1),Ne(""),ge("")},sx:(0,i.A)({py:1.5,fontWeight:600},st?{color:"#111111",borderColor:"rgba(17, 17, 17, 0.23)"}:{}),children:Ke("auth.login.enterpriseRegisterBack")}),!Be&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(p.A,{fullWidth:!0,label:Ke("auth.login.enterpriseRegisterName"),value:Me,onChange:e=>Te(e.target.value),required:!0,sx:st?(0,i.A)({mb:1.5},J):{mb:1.5}}),(0,B.jsx)(p.A,{fullWidth:!0,label:Ke("auth.email"),type:"email",value:ae,onChange:e=>se(e.target.value),required:!0,sx:st?J:void 0}),(0,B.jsx)(g.A,{fullWidth:!0,variant:"contained",type:"submit","data-testid":"enterprise-register-submit",disabled:ue,sx:{mt:2,py:1.5,fontWeight:600},children:ue?(0,B.jsx)(a.A,{size:24}):Ke("auth.login.enterpriseRegisterSubmit")}),(0,B.jsx)(s.A,{align:"center",variant:"body2",sx:{mt:2},children:(0,B.jsx)(u.A,{component:"button",type:"button",underline:"hover",onClick:()=>{Fe(!1),Ne(""),ge("")},sx:st?W:void 0,children:Ke("auth.login.enterpriseRegisterBack")})})]})]}),!fe&&xt&&(0,B.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),pt){P.A.debug("[Login] Attempting login for:",ae),ge(""),pe(!0);try{await pt(ae,le,Qe||void 0),P.A.debug("[Login] Login successful, account verified");const e=localStorage.getItem("stripe_redirect_after_login");if(e&&!(0,I.Ji)()){P.A.debug("[Login] Waiting for session to establish..."),await new Promise(e=>setTimeout(e,1e3));const e=localStorage.getItem("stripe_selected_plan")||"monthly";localStorage.removeItem("stripe_redirect_after_login"),localStorage.removeItem("stripe_selected_plan");let o=_.Pq.PRO_MONTHLY;try{var t;o=(null===(t=(await(0,z.wi)()).plans[e])||void 0===t?void 0:t.priceId)||_.Pq.PRO_MONTHLY}catch(c){P.A.warn("[Login] Could not load pricing config, falling back to default monthly")}P.A.debug("[Login] Redirecting to Stripe checkout with",{selectedPlan:e,priceId:o});try{await(0,_.SC)(o)}catch(d){P.A.error("[Login] Stripe redirect failed:",d),He((0,M.D2)())}}else e&&localStorage.removeItem("stripe_redirect_after_login"),P.A.debug("[Login] Navigating after login"),He((0,M.D2)())}catch(g){var o,i,n,r,a,s;if(P.A.error("[Login] Login failed:",g),g.needsPasswordChange)return Xe?(P.A.debug("[Login] Password change required, showing form"),Se(g.cognitoUser),ze(g.orgSlug||Qe||null),ye(!0),void pe(!1)):(P.A.warn("[Login] Enterprise first-login on main domain, blocking form"),ge("This account was invited by an organization. Please use your organization's login page to set your password. Check your invitation email for the link."),void pe(!1));if("PasswordResetRequiredException"===g.code||"NEW_PASSWORD_REQUIRED"===g.code)return P.A.debug("[Login] Password change required"),sessionStorage.setItem("tempCredentials",JSON.stringify({email:ae,password:le})),void He("/change-password-required");if(g.needsPhoneVerification&&g.phoneNumber){P.A.debug("[Login] Phone not verified, redirecting to verification...");try{return await C.N.verifyCurrentUserAttribute("phone_number"),sessionStorage.setItem("pendingConfirmation",JSON.stringify({email:ae,phone:g.phoneNumber,resumeFromLogin:!0,skipToPhone:!0,phoneEntered:!0})),pe(!1),void He("/register?resume=true&step=phone")}catch(u){return P.A.error("[Login] Failed to send SMS:",u),ge("Failed to send verification code. Please try again."),void pe(!1)}}if("UserNotConfirmedException"===g.code||null!==(o=g.message)&&void 0!==o&&o.includes("confirm your email")||null!==(i=g.message)&&void 0!==i&&i.includes("User is not confirmed"))return P.A.debug("[Login] User email not confirmed, redirecting to confirmation..."),sessionStorage.setItem("pendingConfirmation",JSON.stringify({email:ae,resumeFromLogin:!0})),void He("/register?resume=true");if(null!==(n=g.message)&&void 0!==n&&n.includes("Phone number not verified")||null!==(r=g.message)&&void 0!==r&&r.includes("phone_number_verified")){P.A.debug("[Login] Phone not verified, getting p
1hone from Cognito...");try{var l;const e=null===(l=(await C.N.currentAuthenticatedUser()).attributes)||void 0===l?void 0:l.phone_number;e?(P.A.debug("[Login] Found phone number, sending SMS..."),await C.N.verifyCurrentUserAttribute("phone_number"),sessionStorage.setItem("pendingConfirmation",JSON.stringify({email:ae,phone:e,resumeFromLogin:!0,skipToPhone:!0,phoneEntered:!0})),He("/register?resume=true&step=phone")):(P.A.debug("[Login] No phone found, need to collect it"),sessionStorage.setItem("pendingConfirmation",JSON.stringify({email:ae,resumeFromLogin:!0,skipToPhone:!0,phoneEntered:!1})),He("/register?resume=true&step=phone"))}catch(p){P.A.error("[Login] Failed to get user phone:",p),sessionStorage.setItem("pendingConfirmation",JSON.stringify({email:ae,resumeFromLogin:!0,skipToPhone:!0})),He("/register?resume=true&step=phone")}return}"ResourceNotFoundException"===g.code||null!==(a=g.message)&&void 0!==a&&a.includes("User pool client")||null!==(s=g.message)&&void 0!==s&&s.includes("does not exist")?ge("User not found. If you belong to an organization, please use your company login page."):ge(g.message||"Login failed. Please try again.")}finally{pe(!1)}}else ge("Authentication service is not available. Please refresh the page.")},children:[(0,B.jsx)(p.A,{fullWidth:!0,label:Ke("auth.email"),type:"email",value:ae,onChange:e=>se(e.target.value),required:!0,disabled:ue||!!he,sx:st?J:void 0}),(0,B.jsx)(p.A,{fullWidth:!0,label:Ke("auth.password"),type:Pe?"text":"password",value:le,onChange:e=>ce(e.target.value),required:!0,disabled:ue||!!he,sx:st?(0,i.A)({mt:1.5},J):{mt:1.5},InputProps:{endAdornment:(0,B.jsx)(h.A,{position:"end",children:(0,B.jsx)(m.A,{onClick:()=>ke(!Pe),edge:"end",size:"small",children:Pe?(0,B.jsx)(w.A,{}):(0,B.jsx)(x.A,{})})})}}),(!Xe||!(null!==Ge&&void 0!==Ge&&null!==(ie=Ge.login_settings)&&void 0!==ie&&ie.hide_forgot_password))&&(0,B.jsx)(r.A,{sx:{textAlign:"right",mt:1},children:(0,B.jsx)(u.A,{onClick:()=>He("/forgot-password"),underline:"hover",variant:"body2",sx:st?(0,i.A)((0,i.A)({},W),{},{cursor:"pointer"}):{cursor:"pointer"},children:Ke("auth.login.forgotPassword")})}),(0,B.jsx)(g.A,{fullWidth:!0,variant:"contained",type:"submit",disabled:ue||!!he,sx:{mt:2,py:1.5,fontWeight:600,fontSize:"1rem"},children:ue?(0,B.jsx)(a.A,{size:24}):Ke("auth.login.signIn")})]}),!fe&&vt&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(f.A,{sx:{my:2},children:(0,B.jsx)(s.A,{variant:"body2",color:"text.secondary",sx:{px:1},children:Ke("auth.login.orSocial")})}),(0,B.jsx)(g.A,{fullWidth:!0,variant:"outlined","data-testid":"login-google",onClick:async()=>{try{P.A.debug("[Login] Initiating Google SSO...");const e=j.Ii.isNativePlatform();e&&(sessionStorage.setItem("oauth_in_progress","true"),Ie(!0)),P.A.debug("[Login] Cleaning localStorage before SSO...");const t=[];for(let l=0;l<localStorage.length;l++){const e=localStorage.key(l);e&&(e.startsWith("CognitoIdentityServiceProvider")||e.includes("Token")||e.includes("amplify"))&&t.push(e)}t.forEach(e=>localStorage.removeItem(e)),P.A.debug("[Login] Cleared",t.length,"stale localStorage items");const o="auth.certsim.io",i="29f43r8t98onib1283h0jt3jf4";if(!o||!i)throw new Error("Missing Cognito configuration for SSO");const n=e?"certsim://oauth":"".concat(window.location.origin,"/callback"),r=encodeURIComponent(n),a="email+openid+profile+phone+aws.cognito.signin.user.admin",s="https://".concat(o,"/oauth2/authorize?identity_provider=Google&redirect_uri=").concat(r,"&response_type=code&client_id=").concat(i,"&scope=").concat(a);P.A.debug("[Login] Redirecting to:",s),P.A.debug("[Login] redirect_uri (raw):",n),P.A.debug("[Login] redirect_uri (encoded):",r),e?(P.A.debug("[Login] Opening SSO in system browser (native)"),await L.P.open({url:s})):window.location.href=s}catch(e){P.A.error("[Login] Google SSO failed:",e),sessionStorage.removeItem("oauth_in_progress"),Ie(!1),ge("Google login failed. Please try again.")}},disabled:ue||!!he,startIcon:(0,B.jsx)(K,{}),sx:(0,i.A)((0,i.A)({},at),{},{mb:1.5,borderColor:"#dadce0",color:"#3c4043","&:hover":{borderColor:"#bdc1c6",backgroundColor:"rgba(60, 64, 67, 0.04)"}}),children:Ke("auth.login.continueWithGoogle")}),(0,B.jsx)(g.A,{fullWidth:!0,variant:"contained","data-testid":"login-apple",onClick:async()=>{try{P.A.debug("[Login] Initiating Apple SSO...");const e=j.Ii.isNativePlatform();e&&(sessionStorage.setItem("oauth_in_progress","true"),Ie(!0));const t=[];for(let l=0;l<localStorage.length;l++){const e=localStorage.key(l);
1e&&(e.startsWith("CognitoIdentityServiceProvider")||e.includes("Token")||e.includes("amplify"))&&t.push(e)}t.forEach(e=>localStorage.removeItem(e)),P.A.debug("[Login] Cleared",t.length,"stale localStorage items");const o="auth.certsim.io",i="29f43r8t98onib1283h0jt3jf4";if(!o||!i)throw new Error("Missing Cognito configuration for SSO");const n=e?"certsim://oauth":"".concat(window.location.origin,"/callback"),r=encodeURIComponent(n),a="email+openid+profile+phone+aws.cognito.signin.user.admin",s="https://".concat(o,"/oauth2/authorize?identity_provider=SignInWithApple&redirect_uri=").concat(r,"&response_type=code&client_id=").concat(i,"&scope=").concat(a);P.A.debug("[Login] Redirecting to:",s),e?(P.A.debug("[Login] Opening Apple SSO in system browser (native)"),await L.P.open({url:s})):window.location.href=s}catch(e){P.A.error("[Login] Apple SSO failed:",e),sessionStorage.removeItem("oauth_in_progress"),Ie(!1),ge("Apple login failed. Please try again.")}},disabled:ue||!!he,startIcon:(0,B.jsx)(A.A,{}),sx:(0,i.A)((0,i.A)({},at),{},{bgcolor:"#000000",color:"#ffffff","&:hover":{bgcolor:"#1a1a1a"}}),children:Ke("auth.login.continueWithApple")})]}),!fe&&!De&&!(0,I.Ji)()&&(!ot||wt)&&(wt||!Xe||!(null!==Ge&&void 0!==Ge&&null!==(ne=Ge.login_settings)&&void 0!==ne&&ne.hide_register))&&(0,B.jsxs)(s.A,{align:"center",variant:"body2",sx:{mt:2.5},children:[Ke("auth.login.noAccount")," ",wt?(0,B.jsx)(u.A,{component:"button",type:"button","data-testid":"enterprise-register-open",underline:"hover",onClick:()=>{Fe(!0),ge(""),Ne("")},sx:st?W:{fontWeight:700},children:Ke("auth.login.registerHere")}):(0,B.jsx)(u.A,{href:"/register",underline:"hover",sx:st?W:{fontWeight:700},children:Ke("auth.login.registerHere")})]}),!fe&&Xe&&!1===(null===Ge||void 0===Ge||null===(re=Ge.login_settings)||void 0===re?void 0:re.allow_email_login)&&!(null!==Ge&&void 0!==Ge&&Ge.sso_enabled)&&(0,B.jsx)(d.A,{severity:"warning",children:"Login is currently not available. Please contact your administrator."})]})})]})]})}},23492(e,t,o){o.d(t,{Lg:()=>c,Mm:()=>l,Rd:()=>g,S1:()=>u,_v:()=>p,ah:()=>s,eX:()=>a,fM:()=>d,ow:()=>r,uE:()=>n,v$:()=>i});const i=90,n=!0,r="yearly",a={USD:{monthly:14,quarterly:29,yearly:79},BRL:{monthly:49,quarterly:99,yearly:229}},s={USD:19,BRL:59},l={USD:12,BRL:39},c={USD:{monthly:"price_1ULmDXC5JoOtxKfCrV5PPh0a",quarterly:"price_1ULmDdC5JoOtxKfCYqkH2SMK",yearly:"price_1ULmDiC5JoOtxKfC4SrMmIA2"},BRL:{monthly:"price_1ULmDUC5JoOtxKfCEYYfebZc",quarterly:"price_1ULmDaC5JoOtxKfCWW9faK4G",yearly:"price_1ULmDgC5JoOtxKfCUm9k0Ca7"}},d={USD:"price_1ULmDLC5JoOtxKfCANdNs1GR",BRL:"price_1ULmDJC5JoOtxKfCAGybC7X5"},g={USD:"price_1ULmDRC5JoOtxKfCUITD52pE",BRL:"price_1ULmDOC5JoOtxKfCZOV0mrVm"},u=(new Set(["price_1TXPD2C5JoOtxKfCFSQmpXuv","price_1TXPD4C5JoOtxKfCHeDuAh1Q","price_1TXPD3C5JoOtxKfCqUBh40na","price_1TXPD5C5JoOtxKfCEiWdtb24","price_1TXPD3C5JoOtxKfCNc6bNLZQ","price_1TXPD6C5JoOtxKfCFOh1ve2i","price_1U4oyEC5JoOtxKfCVJ8havEC","price_1U4oyvC5JoOtxKfCI2XpuDkC","price_1U57HAC5JoOtxKfCJfm4GeAY","price_1U57I8C5JoOtxKfCBkHxFSL5"]),e=>"BRL"===e?"R$":"$"),p=(e,t)=>{const o="yearly"===t?12:"quarterly"===t?3:1;if(1===o)return 0;const i=a[e],n=i.monthly*o;return Math.round((n-i[t])/n*100)}},7636(e,t,o){o.d(t,{Az:()=>s,Kd:()=>r,N5:()=>n,ln:()=>a,vg:()=>i});const i="/brand/certsim-icon.png",n="/brand/certsim-mark.png",r=24,a="/landing_people/team-working.webp",s="CertSim"},49810(e,t,o){o.d(t,{A:()=>a,organizationService:()=>r});var i=o(82932),n=o(51673);const r={async checkSlugAvailability(e){try{return(await i.api.get("/organizations/check-slug/".concat(e))).data}catch(t){throw n.A.error("[organizationService] Error checking slug:",t),t}},async createOrganization(e){try{const t=await i.api.post("/organizations",e);return n.A.info("[organizationService] Organization created:",t.data.slug),t.data}catch(t){throw n.A.error("[organizationService] Error creating organization:",t),t}},async getUserOrganizations(){try{return(await i.api.get("/organizations/me")).data}catch(e){throw n.A.error("[organizationService] Error fetching user organizations:",e),e}},async getOrganization(e){try{return(await i.api.get("/organizations/".concat(e))).data}catch(t){throw n.A.error("[organizationService] Error fetching organization:",t),t}},async updateOrganization(e,t){try{const o=await i.api.patch("/organizations/".concat(e),t);return n.A.info("[organizationService] Organization updated:",e),o.data}catch(o){throw n.A.error("[organizationService] Error updating organization:",o),o}},async listAllowedUsers(e){try{return(await i.api.get("/organizations/".concat(e,"/users"))).data}catch(t){throw n.A.error("[organizationService] Error listing allowed users:",t),t}},async addAllowedUser(e,t){try{const o=await i.api.post("/organizations/".concat(e,"/users"),t);return n.A.info("[organizationService] User added to organization:",t.email),o.data}catch(o){throw n.A.error("[organizationService] Error adding user:",o),o}},async listSignupRequests(e){try{return(await i.api.get("/organizations/".concat(e,"/signup-requests"))).data}catch(t){throw n.A.error("[organizationService] Error listing signup requests:",t),t}},async approveSignupRequest(e,t){try{return(await i.api.post("/organizations/".concat(e,"/signup-requests/").concat(t,"/approve"))).data}catch(o){throw n.A.error("[organizationService] Error approving signup request:",o),o}},async rejectSignupRequest(e,t){try{return(await i.api.post("/organizations/".concat(e,"/signup-requests/").concat(t,"/reject"))).data}catch(o){throw n.A.error("[organizationService] Error rejecting signup request:",o),o}},async registerForOrganization(e,t){try{return(await i.api.post("/organizations/slug/".concat(e,"/register"),t)).data}catch(o){throw n.A.error("[organizationService] Error registering for organization:",o),o}},async removeAllowedUser(e,t){try{await i.api.delete("/organizations/".concat(e,"/users/").concat(t)),n.A.info("[organizationService] User removed from organization:",t)}catch(o){throw n.A.error("[organizationService] Error removing user:",o),o}},async resetUserPassword(e,t){try{await i.api.post("/organizations/".concat(e,"/users/").concat(t,"/reset-password")),n.A.info("[organizationService] Password reset for user:",t)}catch(o){throw n.A.error("[organizationService] Error resetting password:",o),o}},async updateAllowedUser(e,t,o){try{const r=await i.api.patch("/organizations/".concat(e,"/users/").concat(t),o);return n.A.info("[organizationService] User updated:",t),r.data}catch(r){throw n.A.error("[organizationService] Error updating user:",r),r}},async getLogoUploadUrl(e){try{return(await i.api.post("/organizations/".concat(e,"/logo/upload-url"))).data}catch(t){throw n.A.error("[organizationService] Error getting logo upload URL:",t),t}},async uploadLogo(e,t){try{const{upload_url:o,public_url:i}=await this.getLogoUploadUrl(e);await fetch(o,{method:"PUT",body:t,headers:{"Content-Type":t.type||"image/png"}});const r="".concat(i,"?t=").concat(Date.now());return await this.updateOrganization(e,{branding:{logo_url:r}}),n.A.info("[organizationService] Logo uploaded for org:",e),r}catch(o){throw n.A.error("[organizationService] Error uploading logo:",o),o}},async deleteOrganization(e){try{await i.api.delete("/organizations/".concat(e)),n.A.info("[organizationService] Organization deleted:",e)}catch(t){throw n.A.error("[organizationService] Error deleting organization:",t),t}},async checkDnsStatus(e){try{return(await i.api.get("/organizations/".concat(e,"/dns-status"))).data}catch(t){throw n.A.error("[organizationService] Error checking DNS status:",t),t}},async getOrganizationBySlug(e){try{return(await i.api.get("/organizations/by-slug/".concat(e,"/public"))).data}catch(o){var t;if(404===(null===(t=o.response)||void 0===t?void 0:t.status))return null;throw n.A.error("[organizationService] Error getting org by slug:",o),o}},async getAnalytics(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;try{return(await i.api.get("/organizations/".concat(e,"/analytics?days=").concat(t,"&page=").concat(o,"&page_size=").concat(r))).data}catch(a){throw n.A.error("[organizationService] Error getting analytics:",a),a}},async notifyEnterpriseLogin(){try{const e=await i.api.post("/organizations/enterprise-login");return n.A.debug("[organizationService] Enterprise login notified:",e.data),e.data}catch(e){return n.A.error("[organizationService] Error notifying enterprise login:",e),{enterprise_user:!1}}},async getRanking(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"weekly",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"points",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50;try{return(await i.api.get("/organizations/".concat(e,"/ranking?period=").concat(t,"&category=").concat(o,"&limit=").concat(r))).data}catch(a){throw n.A.error("[organizationService] Error getting ranking:",a),a}},async getMyPosition(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"weekly";try{return(await i.api.get("/organizations/".concat(e,"/ranking/my-position?period=").concat(t))).data}catch(o){throw n.A.error("[organizationService] Error getting my position:",o),o}},async getTodayMissions(e){try{return(await i.api.get("/organizations/".concat(e,"/missions/today"))).data}catch(t){throw n.A.error("[organizationService] Error getting today missions:",t),t}},async checkin(e){try{return(await i.api.post("/organizations/".concat(e,"/missions/checkin"))).data}catch(t){throw n.A.error("[organizationService] Error checking in:",t),t}},async getStreak(e){try{return(await i.api.get("/organizations/".concat(e,"/missions/streak"))).data}catch(t){throw n.A.error("[organizationService] Error getting streak:",t),t}},async getMonthlyChampions(e){try{return(await i.api.get("/organizations/".concat(e,"/ranking/champions"))).data}catch(t){throw n.A.error("[organizationService] Error getting monthly champions:",t),t}},async getOrganizationJourneys(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";try{return(await i.api.get("/organizations/".concat(e,"/journeys"),{params:{period:t}})).data}catch(o){throw n.A.error("[organizationService] Error getting organization journeys:",o),o}},async checkEmailEnterpriseStatus(e){try{return(await i.api.get("/organizations/check-email-enterprise",{params:{email:e.toLowerCase().trim()}})).data}catch(t){return n.A.error("[organizationService] Error checking email enterprise status:",t),{is_enterprise:!1}}}},a=r},49708(e,t,o){o.d(t,{KH:()=>f,Pq:()=>y,SC:()=>m});var i=o(29246),n=o(29344),r=o(63229),a=o(23492),s=o(80747);const l="/api/v1",c="already_subscribed",d="https://app.certsim.ai",g=new Set(["certsim.io","www.certsim.io","certsim.app","www.certsim.app","certsim.ai","www.certsim.ai","app.certsim.io","app.certsim.app"]),u=()=>{return e=n.Ii.isNativePlatform(),t=window.location.hostname,o=window.location.origin,e||g.has(t.toLowerCase())?d:o;var e,t,o},p=async(e,t,r)=>{const a=u(),s=n.Ii.isNativePlatform(),d=Boolean(t),g=s?"certsim://payment-success":d?"".concat(a,"/app?pass_success=true&certification=").concat(encodeURIComponent(t)):"".concat(a,"/app?subscription_success=true&sub_flow=paid"),p=s?"certsim://payment-cancel":"".concat(a,"/subscription?canceled=true"),{Auth:h}=await Promise.all([o.e(9658),o.e(6433)]).then(o.bind(o,6433));let m;try{m=(await h.currentSession()).getIdToken().getJwtToken()}catch(y){console.warn("[Stripe] Session expired, attempting refresh");try{const e=await h.currentAuthenticatedUser({bypassCache:!0});m=await new Promise((t,o)=>{e.getSession((e,i)=>{e?o(e):t(i.getIdToken().getJwtToken())})})}catch(v){throw console.error("[Stripe] Failed to refresh session, user must re-login"),new Error("Session expired. Please log in again to subscribe.")}}const f={priceId:e,success_url:g,cancel_url:p};d&&(f.certificationType=t),r&&(f.launch_promo_cert=r);try{return(await i.A.post("".concat(l,"/stripe/create-checkout-session"),f,{headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(m)}})).data}catch(x){throw(e=>{var t;const o=null===e||void 0===e?void 0:e.response;if(409===(null===o||void 0===o?void 0:o.status)&&(null===o||void 0===o||null===(t=o.data)||void 0===t?void 0:t.error)===c){const e=new Error(c);return e.name="AlreadySubscribedError",e}return e instanceof Error?e:new Error("Failed to create checkout session")})(x)}},h=async()=>{const{Auth:e}=await Promise.all([o.e(9658),o.e(6433)]).then(o.bind(o,6433)),t=(await e.currentSession()).getIdToken().getJwtToken();return(await i.A.post("".concat(l,"/stripe/create-portal-session"),{return_url:"".concat(u(),"/app/dashboard")},{headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})).data},m=async(e,t,i)=>{try{const{url:a}=await p(e,t,i);t&&(0,s.RZ)(t);const l=t?"/app?pass_success=true&certification=".concat(encodeURIComponent(t)):"/app?subscription_success=true&sub_flow=paid";if(n.Ii.isNativePlatform()){const{backupAuthToPreferences:e}=await o.e(1680).then(o.bind(o,51680));
1await e(),console.log("[Stripe] Session backed up before opening browser");let t=null,i=!1,n=!1,s=!1;const c=()=>{i||(i=!0,t&&clearInterval(t))},d=await r.P.addListener("browserFinished",()=>{s=!0,c(),d.remove();const e="true"===sessionStorage.getItem("stripe_payment_success"),t="true"===sessionStorage.getItem("stripe_payment_canceled");sessionStorage.removeItem("stripe_payment_success"),sessionStorage.removeItem("stripe_payment_canceled"),n||e?(console.log("[Stripe] Browser closed after payment - redirecting to success"),window.location.href=l):t?(console.log("[Stripe] Browser closed with cancel deep link"),window.location.href="/subscription?canceled=true"):(console.log("[Stripe] Browser closed without payment - returning to subscription page"),window.location.href="/subscription?canceled=true")});await r.P.open({url:a,toolbarColor:"#667eea"});const{default:g}=await Promise.resolve().then(o.bind(o,82932)),u=Date.now();t=setInterval(async()=>{if(!i&&!s){if(Date.now()-u>18e4)return c(),d.remove(),void console.log("[Stripe] Payment polling timeout - 3 minutes elapsed");try{var e;if(null!==(e=(await g.post("/payments/activate")).data)&&void 0!==e&&e.activated){n=!0,c(),d.remove(),console.log("[Stripe] Payment confirmed - closing browser and redirecting");try{await r.P.close()}catch(t){}window.location.href=l}}catch(o){}}},3e3)}else window.location.href=a}catch(a){throw console.error("[Stripe] Error redirecting to checkout:",a),a}},f=async()=>{try{const{url:e}=await h();n.Ii.isNativePlatform()?await r.P.open({url:e}):window.location.href=e}catch(e){throw console.error("[Stripe] Error redirecting to portal:",e),e}},y={PRO_MONTHLY:a.Lg.USD.monthly,USD:a.Lg.USD,BRL:a.Lg.BRL,PASS:{usd:a.fM.USD,brl:a.fM.BRL},PASS_ADD:{usd:a.Rd.USD,brl:a.Rd.BRL}}},13271(e,t,o){o.d(t,{DL:()=>r,Ls:()=>a,Pq:()=>s,dq:()=>g,wi:()=>u});var i=o(23492),n=o(51673);const r=i.eX,a=i.ah,s=i.Lg,l=e=>{const t=r[e],o=s[e];return{currency:e,symbol:(0,i.S1)(e),countryCode:"BRL"===e?"BR":"US",plans:{monthly:{priceId:o.monthly,amount:t.monthly,period:"/month",periodLabel:"Monthly"},quarterly:{priceId:o.quarterly,amount:t.quarterly,period:"/3 months",periodLabel:"Quarterly",savings:(0,i._v)(e,"quarterly"),recommended:"quarterly"===i.ow},yearly:{priceId:o.yearly,amount:t.yearly,period:"/year",periodLabel:"Annual",savings:(0,i._v)(e,"yearly"),recommended:"yearly"===i.ow}}}};s.USD.monthly,(0,i.S1)("USD"),String(r.USD.monthly),s.BRL.monthly,(0,i.S1)("BRL"),String(r.BRL.monthly);let c=null;const d=()=>{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;n.A.debug("[Currency] Timezone detected:",e);return e.includes("Sao_Paulo")||e.includes("Brasilia")||e.includes("Manaus")||e.includes("Fortaleza")||e.includes("Recife")||e.includes("Bahia")||e.includes("America/Sao_Paulo")||e.includes("America/Fortaleza")?"BR":"US"},g=async()=>c||(c=d(),n.A.debug("[Currency] Detected country from timezone:",c),c),u=async()=>{const e=await g();return l("BR"===e?"BRL":"USD")}},80747(e,t,o){o.d(t,{BK:()=>u,M3:()=>d,RZ:()=>a,__:()=>l,lr:()=>g,nQ:()=>c,oy:()=>s});var i=o(94587);const n=["AWS","AZURE","GOOGLE","DATABRICKS","SALESFORCE","CISCO","SAP","LPI","ANTHROPIC","GITHUB","OTHER"],r="pending_pass_certification";function a(e){"undefined"!==typeof window&&e&&sessionStorage.setItem(r,e)}function s(e){const t=new URLSearchParams(e),o=t.get("certification"),i="undefined"===typeof window?null:sessionStorage.getItem(r);return{success:"true"===t.get("pass_success"),certification:o||i}}function l(){"undefined"!==typeof window&&sessionStorage.removeItem(r)}function c(){if("undefined"===typeof document)return;const e=document.getElementById("root");null===e||void 0===e||e.removeAttribute("aria-hidden"),null===e||void 0===e||e.removeAttribute("data-aria-hidden"),document.body.style.removeProperty("overflow"),document.body.style.removeProperty("padding-right")}function d(e){var t,o;if(null===e||void 0===e||!e.length)return null;const i=e.filter(e=>Boolean(e.certification_type)&&("passed"===e.status||"failed"===e.status));if(i.sort((e,t)=>{const o=e.completed_at?new Date(e.completed_at).getTime():0;return(t.completed_at?new Date(t.completed_at).getTime():0)-o}),null!==(t=i[0])&&void 0!==t&&t.certification_type)return i[0].certification_type;const n=e.filter(e=>"in_progress"===e.status&&Boolean(e.certification_type));return n.sort((e,t)=>
1{const o=e.started_at?new Date(e.started_at).getTime():0;return(t.started_at?new Date(t.started_at).getTime():0)-o}),(null===(o=n[0])||void 0===o?void 0:o.certification_type)||null}function g(e){const t=new Map;return e.forEach(e=>{const o=(0,i.WC)(e.certification_id),n=t.get(o)||[];n.push(e),t.set(o,n)}),n.filter(e=>t.has(e)).map(e=>({provider:e,label:(0,i.xr)(e)||e,certifications:t.get(e)||[]}))}function u(e){var t,o;const n=e.certificationIds.filter(Boolean);if(0===n.length)return null;const r=new Set(e.ownedCertificationIds||[]),a=n.filter(e=>!r.has(e));if(0===a.length)return null;if(e.lastTaken&&a.includes(e.lastTaken))return e.lastTaken;if(e.lastTaken){const t=(0,i.WC)(e.lastTaken),o=a.find(e=>(0,i.WC)(e)===t);if(o)return o}return(null===(t=g(a.map(e=>({certification_id:e})))[0])||void 0===t||null===(o=t.certifications[0])||void 0===o?void 0:o.certification_id)||a[0]}},30869(e,t,o){o.d(t,{D2:()=>a,l7:()=>n,nL:()=>r});const i="post_auth_redirect";function n(e){try{sessionStorage.setItem(i,e)}catch(t){}}function r(){try{const e=sessionStorage.getItem(i);return e&&sessionStorage.removeItem(i),e}catch(e){return null}}function a(){return r()||"/app"}},23590(e,t,o){o.d(t,{A:()=>r});o(9950);var i=o(47666),n=o(44414);const r=(0,i.A)((0,n.jsx)("path",{d:"M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z"}),"Apple")},39872(e,t,o){o.d(t,{A:()=>r});var i=o(47666),n=o(44414);const r=(0,i.A)((0,n.jsx)("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"}),"Visibility")},20599(e,t,o){o.d(t,{A:()=>r});var i=o(47666),n=o(44414);const r=(0,i.A)((0,n.jsx)("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"}),"VisibilityOff")},5352(e,t,o){o.d(t,{A:()=>S});var i=o(89379),n=o(80045),r=o(9950),a=o(72004),s=o(65698),l=o(4927),c=o(20900),d=o(38593),g=o(92073),u=o(96195),p=o(25853),h=o(48802),m=o(54212),f=o(43396);function y(e){return(0,f.Ay)("MuiInputAdornment",e)}const v=(0,m.A)("MuiInputAdornment",["root","filled","standard","outlined","positionStart","positionEnd","disablePointerEvents","hiddenLabel","sizeSmall"]);var x=o(44414);const w=["children","className","component","disablePointerEvents","disableTypography","position","variant"];var A;const b=(0,u.Ay)("div",{name:"MuiInputAdornment",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,t["position".concat((0,l.A)(o.position))],!0===o.disablePointerEvents&&t.disablePointerEvents,t[o.variant]]}})((0,p.A)(e=>{let{theme:t}=e;return{display:"flex",maxHeight:"2em",alignItems:"center",whiteSpace:"nowrap",color:(t.vars||t).palette.action.active,variants:[{props:{variant:"filled"},style:{["&.".concat(v.positionStart,"&:not(.").concat(v.hiddenLabel,")")]:{marginTop:16}}},{props:{position:"start"},style:{marginRight:8}},{props:{position:"end"},style:{marginLeft:8}},{props:{disablePointerEvents:!0},style:{pointerEvents:"none"}}]}})),S=r.forwardRef(function(e,t){const o=(0,h.b)({props:e,name:"MuiInputAdornment"}),{children:u,className:p,component:m="div",disablePointerEvents:f=!1,disableTypography:v=!1,position:S,variant:_}=o,z=(0,n.A)(o,w),C=(0,g.A)()||{};let j=_;_&&C.variant,C&&!j&&(j=C.variant);const L=(0,i.A)((0,i.A)({},o),{},{hiddenLabel:C.hiddenLabel,size:C.size,disablePointerEvents:f,position:S,variant:j}),I=(e=>{const{classes:t,disablePointerEvents:o,hiddenLabel:i,position:n,size:r,variant:a}=e,c={root:["root",o&&"disablePointerEvents",n&&"position".concat((0,l.A)(n)),a,i&&"hiddenLabel",r&&"size".concat((0,l.A)(r))]};return(0,s.A)(c,y,t)})(L);return(0,x.jsx)(d.A.Provider,{value:null,children:(0,x.jsx)(b,(0,i.A)((0,i.A)({as:m,ownerState:L,className:(0,a.A)(I.root,p),ref:t},z),{},{children:"string"!==typeof u||v?(0,x.jsxs)(r.Fragment,{children:["start"===S?A||(A=(0,x.jsx)("span",{className:"notranslate","aria-hidden":!0,
1children:"\u200b"})):null,u]}):(0,x.jsx)(c.A,{color:"textSecondary",children:u})}))})})},34244(e,t,o){o.d(t,{A:()=>j});var i=o(89379),n=o(80045),r=o(9950),a=o(72004),s=o(65698),l=o(29754),c=o(4927),d=o(96195),g=o(7356),u=o(25853),p=o(87673),h=o(48802),m=o(20900),f=o(54212),y=o(43396);function v(e){return(0,y.Ay)("MuiLink",e)}const x=(0,f.A)("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]);var w=o(26732),A=o(8840);const b=e=>{let{theme:t,ownerState:o}=e;const i=o.color;if("colorSpace"in t&&t.colorSpace){const e=(0,w.Yn)(t,"palette.".concat(i,".main"))||(0,w.Yn)(t,"palette.".concat(i))||o.color;return t.alpha(e,.4)}const n=(0,w.Yn)(t,"palette.".concat(i,".main"),!1)||(0,w.Yn)(t,"palette.".concat(i),!1)||o.color,r=(0,w.Yn)(t,"palette.".concat(i,".mainChannel"))||(0,w.Yn)(t,"palette.".concat(i,"Channel"));return"vars"in t&&r?"rgba(".concat(r," / 0.4)"):(0,A.X4)(n,.4)};var S=o(44414);const _=["className","color","component","onBlur","onFocus","TypographyClasses","underline","variant","sx"],z={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},C=(0,d.Ay)(m.A,{name:"MuiLink",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,t["underline".concat((0,c.A)(o.underline))],"button"===o.component&&t.button]}})((0,u.A)(e=>{let{theme:t}=e;return{variants:[{props:{underline:"none"},style:{textDecoration:"none"}},{props:{underline:"hover"},style:{textDecoration:"none","&:hover":{textDecoration:"underline"}}},{props:{underline:"always"},style:{textDecoration:"underline","&:hover":{textDecorationColor:"inherit"}}},{props:e=>{let{underline:t,ownerState:o}=e;return"always"===t&&"inherit"!==o.color},style:{textDecorationColor:"var(--Link-underlineColor)"}},{props:e=>{let{underline:t,ownerState:o}=e;return"always"===t&&"inherit"===o.color},style:t.colorSpace?{textDecorationColor:t.alpha("currentColor",.4)}:null},...Object.entries(t.palette).filter((0,p.A)()).map(e=>{let[o]=e;return{props:{underline:"always",color:o},style:{"--Link-underlineColor":t.alpha((t.vars||t).palette[o].main,.4)}}}),{props:{underline:"always",color:"textPrimary"},style:{"--Link-underlineColor":t.alpha((t.vars||t).palette.text.primary,.4)}},{props:{underline:"always",color:"textSecondary"},style:{"--Link-underlineColor":t.alpha((t.vars||t).palette.text.secondary,.4)}},{props:{underline:"always",color:"textDisabled"},style:{"--Link-underlineColor":(t.vars||t).palette.text.disabled}},{props:{component:"button"},style:{position:"relative",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none","&::-moz-focus-inner":{borderStyle:"none"},["&.".concat(x.focusVisible)]:{outline:"auto"}}}]}})),j=r.forwardRef(function(e,t){const o=(0,h.b)({props:e,name:"MuiLink"}),d=(0,g.A)(),{className:u,color:p="primary",component:m="a",onBlur:f,onFocus:y,TypographyClasses:x,underline:w="always",variant:A="inherit",sx:j}=o,L=(0,n.A)(o,_),[I,P]=r.useState(!1),k=(0,i.A)((0,i.A)({},o),{},{color:p,component:m,focusVisible:I,underline:w,variant:A}),E=(e=>{const{classes:t,component:o,focusVisible:i,underline:n}=e,r={root:["root","underline".concat((0,c.A)(n)),"button"===o&&"button",i&&"focusVisible"]};return(0,s.A)(r,v,t)})(k);return(0,S.jsx)(C,(0,i.A)((0,i.A)({color:p,className:(0,a.A)(E.root,u),classes:x,component:m,onBlur:e=>{(0,l.A)(e.target)||P(!1),f&&f(e)},onFocus:e=>{(0,l.A)(e.target)&&P(!0),y&&y(e)},ref:t,ownerState:k,variant:A},L),{},{sx:[...void 0===z[p]?[{color:p}]:[],...Array.isArray(j)?j:[j]],style:(0,i.A)((0,i.A)({},L.style),"always"===w&&"inherit"!==p&&!z[p]&&{"--Link-underlineColor":b({theme:d,ownerState:k})})}))})}}]);
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.