PageSourceSearch

https://argus.360cyberx.com/assets/Login-BBqdiO2l.js

js 360cyberx.com collected 2026-10-06 16:17:38 UTC 27,007 bytes, 1 lines download raw bytes

1import{j as e}from"./query-Cd4R38ht.js";import{r as l,h as we}from"./vendor-KI3_YM0_.js";import{i as Le,j as Re,k as Ae,l as Te,a as De,m as he,n as Ge,b as Ie,S as T,C as fe,u as be,o as ee,q as $,w as ve,z as He}from"./index-cYoSSA0q.js";import{S as E}from"./Spinner-utowHqLH.js";import{C as m}from"./Caption1-C4GSJSr-.js";import{t as o,C as ke,m as Ee}from"./Card-DK1KIq3z.js";import{ai as xe,a as Pe,m as J,S as oe,p as U,aj as We,E as Xe,i as Oe,ak as $e,al as Be,am as Ue}from"./ui-RSzmhUhL.js";import{T as ye}from"./Title3-7-Y3JXTn.js";import{B as Ce}from"./Body1-C0PtTAx_.js";import{B as v}from"./Button-aYtLslhR.js";import{S as H}from"./Subtitle2-CQmr-MWi.js";import{D as je}from"./Divider-CQyz63O8.js";import{M as Q,a as Z}from"./MessageBarBody-6B-CTvpm.js";import{F as X}from"./Field-C2zjG4Dl.js";import{I as O}from"./Input-BCNYXJ9K.js";import{C as ze}from"./Checkbox-BD146PB2.js";import"./charts-kmEeFAH3.js";import"./Label-Dn7YFqg0.js";import"./keys-BH0sHvId.js";import"./useTimeout-K898qoR5.js";import"./useBrowserTimer-Cq2U1JyX.js";import"./useARIAButtonProps-Wb8a9tVz.js";import"./useEventCallback-Las2pN9z.js";import"./chunk-24-Bs6phtmf.js";import"./createFluentIcon-BOCg9ebo.js";import"./chunk-28-C-rRfZ4r.js";import"./MotionRefForwarder-G0UddMvp.js";import"./useFieldControlProps-CIdw3HBY.js";import"./FieldContext-BIrkS-RN.js";import"./chunk-24-v0YS_BM5.js";import"./chunk-16-BQ-TozzL.js";const D=Ee({page:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:o.colorNeutralBackground2,position:"relative",overflow:"hidden",padding:o.spacingHorizontalL},shell:{width:"100%",maxWidth:"440px",position:"relative",zIndex:1},brand:{display:"flex",flexDirection:"column",alignItems:"center",rowGap:o.spacingVerticalS,marginBottom:o.spacingVerticalXXL,textAlign:"center"},logoBadge:{width:"64px",height:"64px",borderRadius:o.borderRadiusXLarge,backgroundColor:o.colorBrandBackground2,color:o.colorBrandForeground2,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},logoImg:{width:"100%",height:"100%",objectFit:"contain"},card:{padding:o.spacingHorizontalXXL,backgroundColor:o.colorNeutralBackground1},form:{display:"flex",flexDirection:"column",rowGap:o.spacingVerticalM},iconBtn:{cursor:"pointer",border:"none",backgroundColor:"transparent",color:o.colorNeutralForeground3,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0},ssoButton:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",columnGap:o.spacingHorizontalS,paddingTop:o.spacingVerticalS,paddingBottom:o.spacingVerticalS},rowBetween:{display:"flex",alignItems:"center",justifyContent:"space-between"},forgotLink:{background:"transparent",border:"none",cursor:"pointer",color:o.colorBrandForeground1,fontSize:o.fontSizeBase200,padding:0},dividerText:{color:o.colorNeutralForeground3,paddingLeft:o.spacingHorizontalS,paddingRight:o.spacingHorizontalS},ssoGrid:{display:"grid",columnGap:o.spacingHorizontalM,rowGap:o.spacingHorizontalM},ssoGrid2:{gridTemplateColumns:"1fr 1fr"},ssoGrid1:{gridTemplateColumns:"1fr"},ssoSecondaryBtn:{display:"flex",alignItems:"center",justifyContent:"center",columnGap:o.spacingHorizontalXS},centerText:{textAlign:"center"},loadingPage:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:o.colorNeutralBackground2},loadingWrap:{display:"flex",flexDirection:"column",alignItems:"center",rowGap:o.spacingVerticalM},errorBadgeLarge:{width:"64px",height:"64px",borderRadius:o.borderRadiusXLarge,backgroundColor:o.colorPaletteRedBackground2,color:o.colorPaletteRedForeground1,display:"inline-flex",alignItems:"center",justifyContent:"center",marginBottom:o.spacingVerticalM},mfaHeader:{display:"flex",flexDirection:"column",alignItems:"center",rowGap:o.spacingVerticalS,marginBottom:o.spacingVerticalL,textAlign:"center"},mfaBadge:{width:"48px",height:"48px",borderRadius:o.borderRadiusXLarge,backgroundColor:o.colorBrandBackground2,color:o.colorBrandForeground2,display:"inline-flex",alignItems:"center",justifyContent:"center"},mfaTabBar:{display:"flex",columnGap:o.spacingHorizontalXS,padding:o.spacingHorizontalXXS,backgroundColor:o.colorNeutralBackgroun
1d3,borderRadius:o.borderRadiusMedium,marginBottom:o.spacingVerticalM},mfaTab:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",columnGap:o.spacingHorizontalXS,paddingTop:o.spacingVerticalS,paddingBottom:o.spacingVerticalS,borderRadius:o.borderRadiusSmall,fontSize:o.fontSizeBase200,fontWeight:o.fontWeightMedium,cursor:"pointer",border:"none",backgroundColor:"transparent",color:o.colorNeutralForeground3},mfaTabActive:{backgroundColor:o.colorBrandBackground,color:o.colorNeutralForegroundOnBrand},otpRow:{display:"flex",columnGap:o.spacingHorizontalS,justifyContent:"center"},otpCell:{width:"40px",height:"48px",textAlign:"center",fontSize:o.fontSizeBase500,fontWeight:o.fontWeightBold,fontFamily:"monospace",borderRadius:o.borderRadiusMedium,backgroundColor:o.colorNeutralBackground1,borderTopWidth:"2px",borderRightWidth:"2px",borderBottomWidth:"2px",borderLeftWidth:"2px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:o.colorNeutralStroke1,borderRightColor:o.colorNeutralStroke1,borderBottomColor:o.colorNeutralStroke1,borderLeftColor:o.colorNeutralStroke1,color:o.colorNeutralForeground1,caretColor:"transparent",":focus":{outlineStyle:"none",borderTopColor:o.colorBrandStroke1,borderRightColor:o.colorBrandStroke1,borderBottomColor:o.colorBrandStroke1,borderLeftColor:o.colorBrandStroke1}},otpCellFilled:{borderTopColor:o.colorBrandStroke1,borderRightColor:o.colorBrandStroke1,borderBottomColor:o.colorBrandStroke1,borderLeftColor:o.colorBrandStroke1},otpCellDisabled:{opacity:.5,cursor:"not-allowed"},modalOverlay:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.5)",zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",padding:o.spacingHorizontalL},modalCard:{width:"100%",maxWidth:"380px",backgroundColor:o.colorNeutralBackground1,padding:o.spacingHorizontalXXL},modalActions:{display:"flex",columnGap:o.spacingHorizontalS,marginTop:o.spacingVerticalM},successBadge:{width:"48px",height:"48px",borderRadius:o.borderRadiusCircular,backgroundColor:o.colorPaletteGreenBackground2,color:o.colorPaletteGreenForeground1,display:"inline-flex",alignItems:"center",justifyContent:"center",marginBottom:o.spacingVerticalM}});function Se({value:r,onChange:g,disabled:p}){const a=D(),n=l.useRef([]),i=r.padEnd(6,"").split("").slice(0,6),c=(t,s)=>{var d,y,f;if(s.key==="Backspace")if(i[t]){const u=[...i];u[t]="",g(u.join("").trimEnd())}else t>0&&((d=n.current[t-1])==null||d.focus());s.key==="ArrowLeft"&&t>0&&((y=n.current[t-1])==null||y.focus()),s.key==="ArrowRight"&&t<5&&((f=n.current[t+1])==null||f.focus())},j=(t,s)=>{var f;const d=s.replace(/\D/g,"").slice(-1);if(!d)return;const y=[...i];y[t]=d,g(y.join("")),t<5&&((f=n.current[t+1])==null||f.focus())},w=t=>{var d;t.preventDefault();const s=t.clipboardData.getData("text").replace(/\D/g,"").slice(0,6);if(s){g(s);const y=Math.min(s.length,5);(d=n.current[y])==null||d.focus()}};return e.jsx("div",{className:a.otpRow,children:Array.from({length:6}).map((t,s)=>e.jsx("input",{ref:d=>{n.current[s]=d},type:"text",inputMode:"numeric",maxLength:1,value:i[s]||"",onChange:d=>j(s,d.target.value),onKeyDown:d=>c(s,d),onPaste:w,disabled:p,className:ee(a.otpCell,i[s]&&a.otpCellFilled,p&&a.otpCellDisabled)},s))})}function Ne({provider:r,tenantSlug:g,primary:p}){const a=D(),n=typeof r=="string"?r:r.provider_type,i=typeof r=="string"?r:r.display_name||r.provider_type,c=()=>{const t=g||"";window.location.href=`/api/v1/auth/sso/${n}?slug=${encodeURIComponent(t)}`},j={microsoft:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 23 23",children:[e.jsx("path",{fill:"#f25022",d:"M1 1h10v10H1z"}),e.jsx("path",{fill:"#00a4ef",d:"M1 12h10v10H1z"}),e.jsx("path",{fill:"#7fba00",d:"M12 1h10v10H12z"}),e.jsx("path",{fill:"#ffb900",d:"M12 12h10v10H12z"})]}),google:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",children:[e.jsx("path",{fill:"#4285f4",d:"M23.745 12.27c0-.79-.07-1.54-.19-2.27h-11.3v4.51h6.47c-.29 1.48-1.14 2.73-2.4 3.58v2.97h3.86c2.26-2.09 3.56-5.17 3.56-8.79z"}),e.jsx("path",{fill:"#34a853",d:"M12.255 24c3.24 0 5.95-1.08 7.93-2.91l
1-3.86-2.97c-1.08.72-2.45 1.16-4.07 1.16-3.13 0-5.78-2.11-6.73-4.96h-3.98v3.06C3.515 21.29 7.565 24 12.255 24z"}),e.jsx("path",{fill:"#fbbc05",d:"M5.525 14.29c-.25-.72-.38-1.49-.38-2.29s.14-1.57.38-2.29V6.65h-3.98a11.86 11.86 0 000 10.7l3.98-3.06z"}),e.jsx("path",{fill:"#ea4335",d:"M12.255 4.75c1.77 0 3.35.61 4.6 1.8l3.42-3.42C18.205 1.19 15.495 0 12.255 0c-4.69 0-8.74 2.71-10.71 6.65l3.98 3.06c.95-2.85 3.6-4.96 6.73-4.96z"})]}),okta:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"#007DC1"}),e.jsx("circle",{cx:"12",cy:"12",r:"4",fill:"white"})]})},w={microsoft:"Continue with Microsoft",google:"Continue with Google",okta:"Continue with Okta"};return e.jsx(v,{type:"button",appearance:p?"primary":"outline",size:"large",onClick:c,icon:j[n]||e.jsx(oe,{size:20}),className:a.ssoButton,children:w[n]||`Continue with ${i}`})}function qe({config:r}){const g=D(),p=r.login_page_config||{};return e.jsxs("div",{className:g.form,children:[e.jsxs("div",{style:{textAlign:"center",marginBottom:o.spacingVerticalM},children:[e.jsx("div",{className:g.mfaBadge,style:{marginBottom:o.spacingVerticalS},children:e.jsx(oe,{size:24})}),e.jsx(H,{style:{display:"block"},children:p.welcome_title||`Sign in to ${r.tenant_name}`}),e.jsx(m,{style:{color:o.colorNeutralForeground3,display:"block",marginTop:o.spacingVerticalXS},children:p.welcome_subtitle||"Use your organization's identity provider to continue"})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",rowGap:o.spacingVerticalS},children:r.sso_providers.map(a=>e.jsx(Ne,{provider:a,tenantSlug:r.slug,primary:r.sso_providers.length===1},a.id))}),p.support_email&&e.jsxs(m,{style:{color:o.colorNeutralForeground3,textAlign:"center",marginTop:o.spacingVerticalL,display:"block"},children:["Need help? Contact"," ",e.jsx("a",{href:`mailto:${p.support_email}`,style:{color:o.colorBrandForeground1},children:p.support_email})]})]})}function Ke({onMFARequired:r,onSuccess:g,tenantSlug:p,ssoProviders:a,tenantName:n,branding:i}){const c=D(),[j,w]=l.useState(""),[t,s]=l.useState(""),[d,y]=l.useState(!1),[f,u]=l.useState(!1),[z,k]=l.useState(""),[N,M]=l.useState(""),[_,B]=l.useState(!1),[G,P]=l.useState(""),[q,L]=l.useState(!1),[h,F]=l.useState(!1),[I,R]=l.useState(""),{setAuth:te}=be(),V=we(),W=async x=>{var C,ae,se,ie,le,ce,de,pe,ge;x.preventDefault(),u(!0),k(""),M("");try{const S=(await $.login(j,t)).data;if(S.mfa_required&&S.challenge_token){r(S.challenge_token,j);return}te(S.user,S.tenant,S.csrf_token,S.access_token);{const A=ve((C=S.user)==null?void 0:C.role);A?window.location.href=A:V(((ae=S.user)==null?void 0:ae.role)==="super_admin"?"/admin/dashboard":"/dashboard",{replace:!0})}g()}catch(b){const S=(se=b==null?void 0:b.response)==null?void 0:se.status,A=(le=(ie=b==null?void 0:b.response)==null?void 0:ie.data)==null?void 0:le.error;if(S===403&&((de=(ce=b==null?void 0:b.response)==null?void 0:ce.data)!=null&&de.sso_only)){k("Password login is disabled for this organization. Use SSO to sign in.");return}if(S===423||S===429){const ue=(ge=(pe=b==null?void 0:b.response)==null?void 0:pe.data)==null?void 0:ge.locked_until;if(ue){const Ve=new Date(ue),me=Math.ceil((Ve.getTime()-Date.now())/6e4);M(`Account locked. Try again in ${me} minute${me!==1?"s":""}.`)}else M(A||"Account temporarily locked due to too many failed attempts.");return}if(S===401){k(A||"Invalid credentials. Please try again.");return}k(A||"Unable to connect. Please try again.")}finally{u(!1)}},re=x=>{const C=p||"";window.location.href=`/api/v1/auth/sso/${x}?slug=${encodeURIComponent(C)}`},K=(i==null?void 0:i.show_microsoft_sso)!==!1&&(a?a.some(x=>x.provider_type==="microsoft"):!1),Y=(i==null?void 0:i.show_google_sso)!==!1&&(a?a.some(x=>x.provider_type==="google"):!1),ne=a&&a.length>0&&(K||Y),Fe=(i==null?void 0:i.show_forgot_password)!==!1,Me=(i==null?void 0:i.show_register_link)!==!1,_e=(i==null?void 0:i.show_remember_me)!==!1;return e.jsxs(e.Fragment,{children:[e.jsx(H,{style:{display:"block",marginBottom:o.spacingVerticalXS},children:n?`Sign in to ${n}`:"Sign in to your account"}),n&&e.jsx(m,{style:{color:o.colorNeutralForeground3,display:"block",marginBottom:o.spacingVerticalL},children:"Enter your credentials to access the platform"}),!n&&e.jsx("div",{style:{marginBottom:o.spacingVerticalL}}),ne&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"flex",flexDirection:"column",rowGap:o.spacingVerticalS,marginBottom:o.spacingVerticalM},children:a.map(x=>e.jsx(Ne,{provider:x,tenantSlug:p},x.id))}),e.jsx(je,{style:{marginBottom:o.spacingVerticalM},children:e.jsx(m,{className:c.dividerText,children:"or sign in with password"})})]}),N&&e.jsx(Q,{intent:"warning",style:{marginBottom:o.spacingVerticalM},children:e.jsx(Z,{children:N})}),z&&e.jsx(Q,{intent:"error",style:{marginBottom:o.spacingVerticalM},children:e.jsx(Z,{children:z})}),e.jsxs("form",{onSubmit:W,className:c.form,children:[e.jsx(X,{label:"Email",required:!0,children:e.jsx(O,{type:"email",value:j,onChange:(x,C)=>w(C.value),placeholder:"[email protected]",required:!0,contentBefore:e.jsx(U,{size:16})})}),e.jsx(X,{label:"Password",required:!0,children:e.jsx(O,{type:d?"text":"password",value:t,onChange:(x,C)=>s(C.value),placeholder:"Enter password",required:!0,contentBefore:e.jsx(Oe,{size:16}),contentAfter:e.jsx("button",{type:"button",onClick:()=>y(!d),className:c.iconBtn,"aria-label":d?"Hide password":"Show password",children:d?e.jsx(We,{size:16}):e.jsx(Xe,{size:16})})})}),e.jsxs("div",{className:c.rowBetween,children:[_e&&e.jsx(ze,{label:e.jsx(m,{children:"Remember me"}),size:"medium"}),Fe&&e.jsx("button",{type:"button",onClick:()=>B(!0),className:c.forgotLink,style:{marginLeft:"auto"},children:"Forgot password?"})]}),e.jsx(v,{type:"submit",appearance:"primary",size:"large",disabled:f||!!N,icon:f?e.jsx(E,{size:"tiny"}):void 0,style:{width:"100%"},children:f?"Authenticating...":"Sign In"})]}),ne&&e.jsxs(e.Fragment,{children:[e.jsx(je,{style:{marginTop:o.spacingVerticalL,marginBottom:o.spacingVerticalL},children:e.jsx(m,{className:c.dividerText,children:"or continue with"})}),e.jsxs("div",{className:ee(c.ssoGrid,K&&Y?c.ssoGrid2:c.ssoGrid1),children:[K&&e.jsx(v,{type:"button",appearance:"outline",onClick:()=>re("microsoft"),icon:e.jsxs("svg",{width:16,height:16,viewBox:"0 0 23 23",children:[e.jsx("path",{fill:"#f25022",d:"M1 1h10v10H1z"}),e.jsx("path",{fill:"#00a4ef",d:"M1 12h10v10H1z"}),e.jsx("path",{fill:"#7fba00",d:"M12 1h10v10H12z"}),e.jsx("path",{fill:"#ffb900",d:"M12 12h10v10H12z"})]}),children:"Microsoft"}),Y&&e.jsx(v,{type:"button",appearance:"outline",onClick:()=>re("google"),icon:e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",children:[e.jsx("path",{fill:"#4285f4",d:"M23.745 12.27c0-.79-.07-1.54-.19-2.27h-11.3v4.51h6.47c-.29 1.48-1.14 2.73-2.4 3.58v2.97h3.86c2.26-2.09 3.56-5.17 3.56-8.79z"}),e.jsx("path",{fill:"#34a853",d:"M12.255 24c3.24 0 5.95-1.08 7.93-2.91l
1-3.86-2.97c-1.08.72-2.45 1.16-4.07 1.16-3.13 0-5.78-2.11-6.73-4.96h-3.98v3.06C3.515 21.29 7.565 24 12.255 24z"}),e.jsx("path",{fill:"#fbbc05",d:"M5.525 14.29c-.25-.72-.38-1.49-.38-2.29s.14-1.57.38-2.29V6.65h-3.98a11.86 11.86 0 000 10.7l3.98-3.06z"}),e.jsx("path",{fill:"#ea4335",d:"M12.255 4.75c1.77 0 3.35.61 4.6 1.8l3.42-3.42C18.205 1.19 15.495 0 12.255 0c-4.69 0-8.74 2.71-10.71 6.65l3.98 3.06c.95-2.85 3.6-4.96 6.73-4.96z"})]}),children:"Google"})]})]}),Me&&e.jsxs("div",{style:{marginTop:o.spacingVerticalL,textAlign:"center",display:"flex",flexDirection:"column",rowGap:o.spacingVerticalXS},children:[e.jsxs(m,{style:{color:o.colorNeutralForeground3},children:["Don't have an account?"," ",e.jsx("a",{href:"/register",style:{color:o.colorBrandForeground1,fontWeight:o.fontWeightMedium,textDecoration:"none"},children:"Create organization"})]}),e.jsxs(m,{style:{color:o.colorNeutralForeground3},children:["or"," ",e.jsx("a",{href:"/request-demo",style:{color:o.colorBrandForeground1,fontWeight:o.fontWeightMedium,textDecoration:"none"},children:"request a demo"})]})]}),_&&e.jsx("div",{className:c.modalOverlay,onClick:()=>{B(!1),L(!1)},children:e.jsx(ke,{className:c.modalCard,onClick:x=>x.stopPropagation(),children:q?e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{className:c.successBadge,children:e.jsx(U,{size:24})}),e.jsx(H,{style:{display:"block",marginBottom:o.spacingVerticalXS},children:"Check your email"}),e.jsxs(Ce,{style:{color:o.colorNeutralForeground3,display:"block",marginBottom:o.spacingVerticalM},children:["We've sent a password reset link to"," ",e.jsx("span",{style:{fontWeight:o.fontWeightSemibold},children:G})]}),e.jsx(v,{appearance:"primary",size:"large",onClick:()=>{B(!1),L(!1)},style:{width:"100%"},children:"Back to Sign In"})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{style:{display:"block",marginBottom:o.spacingVerticalXS},children:"Reset your password"}),e.jsx(m,{style:{color:o.colorNeutralForeground3,display:"block",marginBottom:o.spacingVerticalM},children:"Enter your email and we'll send you a reset link."}),e.jsxs("form",{onSubmit:async x=>{x.preventDefault(),F(!0),R("");try{await $.forgotPassword(G),L(!0)}catch{R("Something went wrong. Please try again.")}finally{F(!1)}},children:[e.jsx(X,{label:"Email",required:!0,children:e.jsx(O,{type:"email",value:G,onChange:(x,C)=>P(C.value),required:!0,placeholder:"[email protected]"})}),I&&e.jsx(m,{style:{color:o.colorPaletteRedForeground1,display:"block",marginTop:o.spacingVerticalXS},children:I}),e.jsxs("div",{className:c.modalActions,children:[e.jsx(v,{type:"button",appearance:"secondary",onClick:()=>{B(!1),R("")},style:{flex:1},children:"Cancel"}),e.jsx(v,{type:"submit",appearance:"primary",disabled:h,icon:h?e.jsx(E,{size:"tiny"}):void 0,style:{flex:1},children:h?"Sending...":"Send Reset Link"})]})]})]})})})]})}const Ye=[{key:"authenticator",label:"Authenticator App",icon:$e,description:"Enter code from your authenticator app"},{key:"email",label:"Email",icon:U,description:"We'll send a code to your email"},{key:"phone",label:"Phone (SMS)",icon:Be,description:"We'll text a code to your phone"}];function Je({challengeToken:r,accountEmail:g,onBack:p}){const a=D(),[n,i]=l.useState("authenticator"),[c,j]=l.useState(""),[w,t]=l.useState(!1),[s,d]=l.useState(!1),[y,f]=l.useState(""),[u,z]=l.useState(""),[k,N]=l.useState(!1),[M,_]=l.useState(!1),{setAuth:B}=be(),G=we(),P=async h=>{d(!0),f("");try{await $.sendMFACode(r,h),N(!0),He.success(h==="email"?`Verification code sent to ${g}`:"Verification code sent to your phone")}catch{f(`Failed to send code via ${h}. Please try another method.`)}finally{d(!1)}},q=async h=>{var I,R;h.preventDefault();const F=n==="recovery"?u.trim():c;if(F){t(!0),f("");try{const V=(await $.verifyMFAChallenge(r,F,M)).data;B(V.user,V.tenant,V.csrf_token,V.access_token);{const W=ve((I=V.user)==null?void 0:I.role);W?window.location.href=W:G(((R=V.user)==null?void 0:R.role)==="super_admin"?"/admin/dashboard":"/dashboard",{replace:!0})}}catch{f("Invalid verification code. Please try again.")}finally{t(!1)}}},L=h=>{i(h),f(""),j(""),z(""),N(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:a.mfaHeader,children:[e.jsx("div",{className:a.mfaBadge,children:e.jsx(oe,{size:24})}),e.jsx(H,{children:"Two-Factor Authentication"}),e.jsxs(m,{style:{color:o.colorNeutralForeground3},children:["Signed in as"," ",e.jsx("span",{style:{fontWeight:o.fontWeightSemibold},children:g})]})]}),y&&e.jsx(Q,{intent:"error",style:{marginBottom:o.spacingVerticalM},children:e.jsx(Z,{children:y})}),n!=="recovery"&&e.jsx("div",{className:a.mfaTabBar,children:Ye.map(h=>e.jsxs("button",{type:"button",onClick:()=>L(h.key),className:ee(a.mfaTab,n===h.key&&a.mfaTabActive),children:[e.jsx(h.icon,{size:14}),h.label]},h.key))}),e.jsxs("form",{onSubmit:q,style:{display:"flex",flexDirection:"column",rowGap:o.spacingVerticalL},children:[n==="recovery"?e.jsx(X,{label:"Recovery code",children:e.jsx(O,{type:"text",value:u,onChange:(h,F)=>
1z(F.value),placeholder:"xxxxxxxx-xxxx",autoFocus:!0,style:{fontFamily:"monospace"}})}):n==="authenticator"?e.jsxs("div",{style:{display:"flex",flexDirection:"column",rowGap:o.spacingVerticalS},children:[e.jsx(m,{style:{color:o.colorNeutralForeground3,textAlign:"center"},children:"Enter the 6-digit code from your authenticator app"}),e.jsx(Se,{value:c,onChange:j,disabled:w})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",rowGap:o.spacingVerticalS},children:k?e.jsxs(e.Fragment,{children:[e.jsxs(m,{style:{color:o.colorNeutralForeground3,textAlign:"center"},children:["Enter the 6-digit code sent to your ",n==="email"?"email":"phone"]}),e.jsx(Se,{value:c,onChange:j,disabled:w}),e.jsx("button",{type:"button",onClick:()=>P(n),disabled:s,className:a.forgotLink,style:{textAlign:"center",display:"block",width:"100%"},children:s?"Resending...":"Didn't receive a code? Resend"})]}):e.jsxs("div",{style:{textAlign:"center",display:"flex",flexDirection:"column",rowGap:o.spacingVerticalS},children:[e.jsx(m,{style:{color:o.colorNeutralForeground3},children:n==="email"?"We'll send a verification code to your email address":"We'll send a verification code via SMS to your registered phone number"}),e.jsx(v,{type:"button",appearance:"outline",size:"large",onClick:()=>P(n),disabled:s,icon:s?e.jsx(E,{size:"tiny"}):n==="email"?e.jsx(U,{size:16}):e.jsx(Be,{size:16}),style:{width:"100%"},children:s?"Sending...":"Send Verification Code"})]})}),(n==="authenticator"||n==="recovery"||k)&&e.jsxs(e.Fragment,{children:[e.jsx(ze,{checked:M,onChange:(h,F)=>_(!!F.checked),label:e.jsx(m,{children:"Remember this device for 30 days"}),size:"medium"}),e.jsx(v,{type:"submit",appearance:"primary",size:"large",disabled:w||n!=="recovery"&&c.length<6||n==="recovery"&&!u.trim(),icon:w?e.jsx(E,{size:"tiny"}):void 0,style:{width:"100%"},children:w?"Verifying...":"Verify"})]})]}),e.jsxs("div",{style:{marginTop:o.spacingVerticalL,display:"flex",flexDirection:"column",alignItems:"center",rowGap:o.spacingVerticalS},children:[e.jsx("button",{type:"button",onClick:()=>L(n==="recovery"?"authenticator":"recovery"),className:a.forgotLink,children:n==="recovery"?"Use a verification code instead":"Use a recovery code instead"}),e.jsxs("button",{type:"button",onClick:p,className:a.forgotLink,style:{display:"inline-flex",alignItems:"center",columnGap:o.spacingHorizontalXS,color:o.colorNeutralForeground3},children:[e.jsx(Ue,{size:14}),"Back to login"]})]})]})}function Qe(){var p;const r=Ie(a=>a.theme),g=r==="dark"||r!=="light"&&typeof window<"u"&&((p=window.matchMedia)==null?void 0:p.call(window,"(prefers-color-scheme: dark)").matches);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",rowGap:6,marginBottom:8},children:[e.jsx("a",{href:T.companyUrl,target:"_blank",rel:"noopener noreferrer","aria-label":`${T.company} website (opens in a new tab)`,title:`${T.company} — main website`,children:e.jsx("img",{src:g?fe.onDark:fe.onLight,alt:T.company,width:171,height:42,style:{height:32,width:"auto",display:"block"}})}),e.jsxs(m,{style:{color:o.colorNeutralForeground3,letterSpacing:"0.08em",textTransform:"uppercase"},children:[T.name," · a ",T.company," product"]})]})}function _o(){Le();const r=D(),[g,p]=l.useState("loading"),[a,n]=l.useState(""),[i,c]=l.useState(""),j=Re(),w=Ae(),{config:t,isLoading:s,error:d}=Te(j||void 0),y=!s&&w.detected&&!t&&!!d;l.useEffect(()=>{var _;if(!s&&!y)if(t!=null&&t.sso_only&&((_=t.sso_providers)==null?void 0:_.length)>0){if(t.sso_providers.length===1){const B=t.sso_providers[0];window.location.href=`/api/v1/auth/sso/${B.provider_type}?slug=${encodeURIComponent(t.slug)}`;return}p("sso-only")}else p("password")},[s,t,y]);const f=(_,B)=>{n(_),c(B),p("mfa")},u=De(),z=u.logo_url,k=u.org_name||"Sign In",[N,M]=l.useState(!1);return g==="loading"?e.jsx("div",{className:r.loadingPage,children:e.jsxs("div",{className:r.loadingWrap,children:[e.jsx(E,{size:"medium"}),e.jsx(m,{style:{color:o.colorNeutralForeground3},children:"Loading..."})]})}):y?e.jsx("div",{className:r.page,children:e.jsxs("div",{className:r.shell,style:{maxWidth:"400px",textAlign:"center"},children:[e.jsx("div",{className:r.errorBadgeLarge,style:{margin:"0 auto",marginBottom:o.spacingVerticalM},children:e.jsx(xe,{size:32})}),e.jsx(ye,{style:{display:"block",marginBottom:o.spacingVerticalS},children:"Organization Not Found"}),e.jsxs(Ce,{style:{color:o.colorNeutralForeground3,display:"block",marginBottom:o.spacingVerticalL},children:["No organization is registered at"," ",e.jsx("span",{style:{fontFamily:"monospace"},children:window.location.hostname})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",rowGap:o.spacingVerticalS},children:[e.jsx(v,{as:"a",href:he("/signin"),appearance:"primary",size:"large",children:"Find Your Organization"}),e.jsx(v,{as:"a",href:he("/"),appearance:"secondary",size:"large",children:"Visit Platform Home"})]})]})}):e.jsx("div",{className:r.page,children:e.jsxs("div",{className:r.shell,children:[e.jsxs("div",{className:r.brand,children:[!u.is_tenant_branded&&e.jsx(Qe,{}),z&&!N&&e.jsx("div",{className:r.logoBadge,children:e.jsx("img",{src:z,alt:k,className:r.logoImg,onError:()=>M(!0)})}),(!z||N)&&u.is_tenant_branded&&e.jsx("div",{className:r.logoBadge,children:e.jsx(xe,{size:32})}),e.jsx(ye,{children:k}),e.jsx(m,{style:{color:o.colorNeutralForeground3},children:u.welcome_subtitle||(u.is_tenant_branded?"Sign in to your account":"Sign in to continue")})]}),e.jsx(ke,{className:r.card,children:e.jsx(Pe,{mode:"wait",children:g==="sso-only"&&t?e.jsx(J.div,{initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},transition:{duration:.25},children:e.jsx(qe,{config:t})},"sso-only"):g==="password"?e.jsx(J.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.25},children:e.jsx(Ke,{onMFARequired:f,onSuccess:()=>{},tenantSlug:(t==null?void 0:t.slug)||j||void 0,ssoProviders:t==null?void 0:t.sso_providers,tenantName:t==null?void 0:t.tenant_name,branding:u})},"password"):g==="mfa"?e.jsx(J.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.25},children:e.jsx(Je,{challengeToken:a,accountEmail:i,onBack:()=>p("password")})},"mfa"):null})}),e.jsxs("div",{style:{textAlign:"center",marginTop:o.spacingVerticalL,display:"flex",flexDirection:"column",rowGap:o.spacingVerticalXS},children:[u.support_email&&e.jsxs(m,{style:{color:o.colorNeutralForeground3},children:["Need help?"," ",e.jsx("a",{href:`mailto:${u.support_email}`,style:{color:o.colorBrandForeground1},children:u.support_email})]}),Ge()&&!j&&e.jsx(m,{style:{color:o.colorNeutralForeground3},children:e.jsx("a",{href:"/signin",style:{color:o.colorBrandForeground1},children:"Find your organization"})})]})]})})}export{_o as Login,_o 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.