1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,846010,e=>{"use strict";e.i(247167);var t=e.i(843476),r=e.i(271645),s=e.i(657688),a=e.i(618566),i=e.i(511795),l=e.i(857034),n=e.i(458837),o=e.i(890592),c=e.i(515931),u=e.i(761520),d=e.i(103812),m=e.i(78691),h=e.i(737560),f=e.i(659544),g=e.i(370921),x=e.i(539816);e.s(["AuthForm",0,function(){let e=(0,a.useRouter)(),p=(0,a.useSearchParams)(),w=(0,r.useMemo)(()=>(0,i.createClient)(),[]),y=(0,x.getSafeInternalRedirect)(p.get("redirect"),"/dashboard"),[v,j]=(0,r.useState)(""),[b,P]=(0,r.useState)(""),[S,C]=(0,r.useState)(null),[N,T]=(0,r.useState)(null),[k,A]=(0,r.useState)(!1),[I,R]=(0,r.useState)(null),[U,E]=(0,r.useState)(!1),[B,F]=(0,r.useState)(!1),[G,L]=(0,r.useState)(0),[W,$]=(0,r.useState)(0);(0,r.useEffect)(()=>{(async function(){let{data:{user:t}}=await w.auth.getUser();t&&e.push(y)})(),"success"===new URLSearchParams(window.location.search).get("password_reset")&&(C(null),T("Password reset successful! You can now log in with your new password."),window.history.replaceState({},"",window.location.pathname),setTimeout(()=>{T(null)},5e3))},[y,e,w]),(0,r.useEffect)(()=>{if(0===W)return;let e=setInterval(()=>{L(e=>e<=1?0:e-1)},1e3);return()=>clearInterval(e)},[W]);let _=async t=>{t.preventDefault(),C(null),T(null),E(!1),A(!0);try{let t=await (0,c.verifyTurnstileToken)(I,"login");if(!t.success){C(t.error||"Security verification failed."),E(!0),R(null),A(!1);return}let{data:r,error:s}=await w.auth.signInWithPassword({email:v,password:b});if(s){let t=s.message.toLowerCase();if(t.includes("email not confirmed")||t.includes("email_not_confirmed")||t.includes("confirm your email")||t.includes("email confirmation"))return void e.push(`/confirm-signup?email=${encodeURIComponent(v)}&from=login`);throw s}e.push(y)}catch(e){C(e.message||"An error occurred. Please try again.")}finally{A(!1)}},D=async()=>{C(null),T(null),A(!0);try{sessionStorage.setItem("contentgrove_from_login","true");let{error:e}=await w.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${(0,l.getSiteUrl)()}login/callback?redirect=${encodeURIComponent(y)}`}});if(e)throw e}catch(e){C(e.message||"An error occurred. Please try again."),A(!1)}},M=async()=>{if(!v){C("Please enter your email address first"),T(null);return}if(!(G>0)){C(null),T(null),A(!0);try{let{error:e}=await w.auth.resend({type:"signup",email:v});if(e){C(e.message||"Failed to resend confirmation email. Please try again."),A(!1);return}T("Confirmation email sent! Please check your inbox for the confirmation code."),L(60),$(e=>e+1)}catch(e){C(e.message||"Failed to resend confirmation email. Please try again.")}finally{A(!1)}}},O=async e=>{if(e.preventDefault(),!v){C("Please enter your email address first"),T(null);return}C(null),T(null),E(!1),A(!0);try{let e=await (0,c.verifyTurnstileToken)(I,"forgot-password");if(!e.success){C(e.error||"Please complete the security verification before requesting a password reset."),E(!0),R(null),A(!1);return}let{error:t}=await w.auth.resetPasswordForEmail(v,{redirectTo:`${(0,l.getSiteUrl)()}login/reset-password`});if(t){let e=t.message.toLowerCase();if(e.includes("oauth")||e.includes("google")||e.includes("provider")||e.includes("social")||e.includes("external provider")){C("This email is associated with a Google account. Please sign in using Google instead."),T(null);return}throw t}C(null),T("Password reset email sent! Check your inbox.")}catch(t){let e=t.message?.toLowerCase()||"";e.includes("oauth")||e.includes("google")||e.includes("provider")||e.includes("social")||e.includes("external provider")?C("This email is associated with a Google account. Please sign in using Google instead."):C(t.message||"An error occurred. Please try again."),T(null)}finally{A(!1)}};return(0,t.jsx)("div",{className:"bg-white text-neutral-900 min-h-dvh flex items-center justify-center px-6 py-10",children:(0,t.jsxs)("div",{className:"w-full max-w-[500px]",children:[(0,t.jsx)("div",{className:"mb-8 flex justify-center",children:(0,t.jsx)(s.default,{src:"/contentgrove-logo.svg",alt:"Contentgrove",width:200,height:45,className:"h-auto w-60 object-contain",priority:!0})}),(0,t.jsxs)(u.AuthCard,{children:[(0,t.jsxs)("form",{onSubmit:_,className:"flex flex-col gap-[15px]",children:[(0,t.jsx)(g.Heading,{as:"h2",variant:"display",className:"sm:text-3xl",children:"Welcome back"}),(0,t.jsx)("a",{href:"/get-started",className:"text-xs text-neutral-500 hover:text-primary transition-colors underline underline-offset-2 w-fit",children:"Don't have an account? Sign up"}),S&&(0,t.jsxs)(m.AlertMessage,{variant:"error",children:[S,B&&(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)("button",{type:"button",onClick:M,disabled:k||G>0,className:"text-xs font-medium text-primary underline underline-offset-2 hover:text-primary-hover disabled:opacity-50 disabled:cursor-not-allowed",children:G>0?`Resend confirmation email (${G}s)`:"Resend confirmation email"})})]}),N&&(0,t.jsx)(m.AlertMessage,{variant:"success",children:N}),(0,t.jsx)("div",{className:"w-full",children:(0,t.jsx)(n.GoogleSignInButton,{type:"button",onClick:D,disabled:k,style:{width:"100%",maxWidth:"100%"}})}),(0,t.jsx)(h.Divider,{label:"or"}),(0,t.jsxs)("div",{className:"flex flex-col gap-[5px]",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-black",children:"Email"}
1),(0,t.jsx)(d.Input,{type:"email",value:v,onChange:e=>{j(e.target.value),(S||N)&&(C(null),T(null),F(!1))},placeholder:"Enter your email"})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-[5px]",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-black",children:"Password"}),(0,t.jsx)(d.Input,{type:"password",value:b,onChange:e=>P(e.target.value),placeholder:"Enter your password"})]}),(0,t.jsx)("a",{href:"#",onClick:O,className:"text-xs font-medium text-primary underline underline-offset-2 w-fit",children:"Forgot Password?"}),(0,t.jsx)(o.TurnstileWrapper,{onTokenChange:R,onErrorChange:E}),U&&(0,t.jsx)("p",{className:"text-xs text-red-600 -mt-2",children:"Security verification couldn't be completed. Please reload the page and try again."}),(0,t.jsx)(f.Button,{type:"submit",disabled:k,className:"mt-[10px] w-full",children:k?"Please wait...":"Login"})]}),(0,t.jsx)("div",{className:"mt-2 flex justify-center",children:(0,t.jsx)("a",{href:"https://contentgrove.io",className:"text-xs text-neutral-500 hover:text-primary transition-colors underline underline-offset-2",children:"â Back to home"})})]})]})})}])},761520,e=>{"use strict";var t=e.i(843476),r=e.i(549838);e.s(["AuthCard",0,function({children:e,className:s}){return(0,t.jsx)("div",{className:(0,r.cn)("bg-white rounded-md shadow-card p-[30px]",s),children:e})}])}]);
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.