1import{k as R,af as v,D as w,M as S,j as e,U as E,V as N,W as k,Y as C,B as p,A as F,Z as I,E as L,a4 as d,b2 as D,b5 as f}from"./main-BLmo4jD8.js";import{R as _,G as A,u as B}from"./RedirectBanner-CnCNVyFO.js";import{u as O,a as T}from"./zod-CzLSOVbT.js";import{R as G}from"./ReferralBanner-ClOFt8m6.js";import{b as g,F as h,a as M,c as P,d as U}from"./field-h6kNcTCc.js";import{I as W}from"./input-D5qW8bOE.js";import{S as z}from"./skeleton-BGrA_9uR.js";import{S as V}from"./spinner-B3DsP1Dk.js";import{a as b}from"./auth-client-txgVuIX3.js";import{u as Y}from"./authQueryParams-ChXJ1zJC.js";import"./Trans-DfLujsBh.js";import"./label-Djup5fa9.js";import"./index-CrghIArQ.js";import"./loader-circle-XnsuZg02.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="99036855-9a16-4fd6-a564-44f2290ef912",s._sentryDebugIdIdentifier="sentry-dbid-99036855-9a16-4fd6-a564-44f2290ef912")}catch{}})();const q=S("/_withUser/_onboarding/login/"),H="login.email.input.error",K=L({email:D({error:H}).toLowerCase()}),Q=({method:s})=>{const{t:r}=R("onboarding"),a=v(),{referral:n,isLoading:t}=w(),{appsumo:o,invite:m}=q.useSearch(),{register:x,handleSubmit:j,formState:{errors:l,isSubmitting:c}}=O({resolver:T(K)}),y=async({email:i})=>{if(s==="otp"){if((await b.emailOtp.sendVerificationOtp({email:i,type:"sign-in"})).error){d.error(r("error.unknown",{ns:"common"}));return}a({to:"/login/verify-otp",search:{email:i}});return}const u=await b.signIn.magicLink({email:i});if(u.error){u.error.message==="BANNED_USER"?d.error(r("error.banned"),{duration:7e3}):d.error(r("error.unknown",{ns:"common"}));return}a({to:"/login/check",search:{email:i}})};return e.jsx("div",{className:"flex flex-col flex-1 justify-center",children:e.jsxs("section",{className:"w-full h-full flex flex-col items-center justify-center p-6 md:p-10 gap-6",children:[e.jsx(_,{appsumo:o,invite:m}),e.jsxs(E,{className:"w-full max-w-md",children:[e.jsx(N,{children:e.jsx(k,{children:r("login.header")})}),e.jsxs(C,{children:[e.jsx(A,{action:"login"}),e.jsx("div",{className:"text-center block relative my-6 before:h-[1px] before:content-[''] before:w-full before:bg-border before:absolute before:left-0 before:top-[50%]",children:e.jsx("span",{className:"px-5 bg-card text-sm relative",children:r("authMethod.separator")})}),e.jsx("form",{onSubmit:j(y),children:e.jsxs(g,{children:[e.jsxs(h,{"data-invalid":!!l.email?.message,children:[e.jsx(M,{htmlFor:"email",children:r("login.email.input.label")}),e.jsx(W,{...x("email"),autoComplete:"email",disabled:c,id:"email",placeholder:r("login.email.input.placeholder"),required:!0,type:"email"}),l.email?.message&&e.jsx(P,{children:r(l.email.message)})]}),e.jsx(g,{children:e.jsxs(h,{children:[e.jsxs(p,{disabled:c,type:"submit",children:[r("login.email.form.cta"),c&&e.jsx(V,{})]}),e.jsxs(U,{className:"px-6 text-center",children:[r("login.signup.prompt"),e.jsx(p,{asChild:!0,type:"button",variant:"link",children:e.jsx(F,{to:"/signup",search:{appsumo:o,invite:m,method:s},children:r("login.signup.link")})})]})]})})]})})]}),(t||n)&&e.jsxs(I,{className:"border-t border-border",children:[t&&e.jsx(z,{className:"h-20 w-full rounded-lg"}),n&&e.jsx(G,{referral:n,size:"compact"})]})]})]})})},me=()=>{const s=f.useSearch(),r=f.useNavigate(),a=()=>{r({search:({error:t,...o}
1)=>o,replace:!0})};B({error:s.error,onError:a});const n=()=>{r({search:({redirect:t,...o})=>t?.startsWith("/appsumo/welcome")?{...o,appsumo:!0}:t?.startsWith("/organization-invitation/")?{...o,invite:!0}:o,replace:!0})};return Y({redirectPath:s.redirect,onSetRedirect:n}),e.jsx(Q,{method:s.method})};export{me as component};
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.