1import{r as e,j as t}from"./google-maps-Dsi9asJS.js";import{t as s}from"./signupPrefill-D0OH0329.js";import{y as r,e as a,s as n,f as o}from"./index-bG1liPr7.js";import{useGraceToolsAuth as i}from"./useGraceToolsAuth-DBIzJxY-.js";import{s as l}from"./gracetoolsAttribution-4bv_xoT8.js";import{b as c,P as d}from"./publicSiteUrl-jn7-nPm-.js";import{E as m}from"./eye-off-BmLoFidp.js";import{E as u}from"./eye-CKBvw7rP.js";const x="https://moxnvwhuxobtszhwxmxs.supabase.co/storage/v1/object/public/article-images",h=[{src:x+"/retirement-financial-wellness-hero-1280.webp",pos:"72% center"},{src:x+"/retirement-relationships-hero-1280.webp",pos:"center"},{src:x+"/retirement-health-wellbeing-hero2-1280.webp",pos:"75% center"},{src:x+"/retirement-purpose-legacy-hero-1280.webp",pos:"center"},{src:x+"/retirement-lifestyle-adventure-hero-1280.webp",pos:"38% center"}];function g(){const[x]=r(),[g]=e.useState(()=>s()),p=x.get("email")||g.email||"",f=x.get("partner_id")||"",b=x.get("advisor")||"",y=x.get("redirect")||"",j=x.get("plan")||"";let w=y.startsWith("/gracetools/")?y:"/gracetools/home";"/gracetools/home"!==w&&j&&(w+=(w.includes("?")?"&":"?")+"plan="+encodeURIComponent(j));const[v,N]=e.useState(p);e.useEffect(()=>{(f||b)&&l({partnerId:f,advisorSlug:b||void 0})},[f,b]);const[k,C]=e.useState(""),[F,E]=e.useState(!1),[S,A]=e.useState(""),[B,I]=e.useState(!1),[P,M]=e.useState(!1),[_,T]=e.useState(!1),[W,G]=e.useState("email"),[U,D]=e.useState(""),[z,R]=e.useState(""),[K,q]=e.useState(!1),[H,L]=e.useState(0),O=e.useRef(!1),V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Y=a(),{signIn:$,signInWithGoogle:J,user:Z,loading:Q}=i();if(e.useEffect(()=>{if(O.current)return;let e=!1;const t=setTimeout(()=>{if(e)return;O.current=!0;let t=1;const s=()=>{!e&&t<h.length&&((new Image).src=h[t].src,t++,setTimeout(s,200))};s()},2e3);return()=>{e=!0,clearTimeout(t)}},[]),e.useEffect(()=>{if(V)return;const e=setInterval(()=>{L(e=>(e+1)%h.length)},7e3);return()=>clearInterval(e)},[V]),e.useEffect(()=>{let e=!1;return(async()=>{var t,s,r;const{data:{session:a}}=await n.auth.getSession();if(!a||e)return;const{error:o}=await n.auth.getUser();if(o&&!e){const e=o.status;(401===e||403===e||(null==(t=o.message)?void 0:t.includes("invalid"))||(null==(s=o.message)?void 0:s.includes("expired"))||(null==(r=o.message)?void 0:r.includes("malformed")))&&await n.auth.signOut()}})(),()=>{e=!0}},[]),e.useEffect(()=>{!Q&&Z&&Y(w,{replace:!0})},[Z,Q,Y,w]),Q)return t.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center",children:t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[#B87A5F]"})});if(Z)return null;const X=async()=>{A(""),T(!1);const e=(e=>{const t=e.trim().startsWith("+"),s=e.replace(/[^\d]/g,"");return t?"+"+s:10===s.length?"+1"+s:11===s.length&&s.startsWith("1")||s?"+"+s:""})(U);if(/^\+\d{10,15}$/.test(e)){I(!0);try{const{error:t}=await n.auth.signInWithOtp({phone:e,options:{shouldCreateUser:!1}});if(t){if(/not.*found|no.*user|signups?.*not.*allowed|not allowed/i.test(t.message))throw Error("We couldn't find an account for that number. Use the number you talked to Grace with, or create an account below.");if(429===t.status||/rate/i.test(t.message))throw Error("Please wait a minute before requesting another code.");throw Error(t.message||"Could not send the code.")}D(e),q(!0)}catch(t){A(t.message||"Could not send the code.")}finally{I(!1)}}else A("Enter your mobile number. For a US number, just the 10 digits.")},ee=async()=>{if(A(""),/^\d{4,8}$/.test(z.trim())){I(!0);try{const{data:e,error:t}=await n.auth.verifyOtp({phone:U.trim(),token:z.trim(),type:"sms"});if(t||!e.session)throw Error((null==t?void 0:t.message)||"That code did not match. Try again.");Y(w)}catch(e){A(e.message||"That code did not match. Try again.")}finally{I(!1)}}else A("Enter the code we texted you.")};return t.jsx("div",{className:"min-h-screen bg-white",children:t.jsxs("div",{className:"grid min-h-screen w-full grid-cols-1 lg:grid-cols-2",children:[t.jsx("div",{className:"relative order-2 h-52 overflow-hidden bg-[#1a232e] sm:h-72 lg:
1order-2 lg:h-auto lg:min-h-screen",children:h.map((e,s)=>t.jsx("img",{src:e.src,alt:"","aria-hidden":s!==H,className:"absolute inset-0 h-full w-full object-cover ease-in-out",style:{objectPosition:e.pos,opacity:s===H?1:0,transitionProperty:"opacity",transitionDuration:"2200ms"}},e.src))}),t.jsxs("div",{className:"order-1 mx-auto flex w-full max-w-lg flex-col justify-center gap-5 px-8 py-10 sm:px-12 lg:order-1",children:[t.jsxs("div",{children:[t.jsxs("h1",{className:"text-4xl sm:text-5xl leading-tight mb-3 text-[#1a1a2e]",style:{fontFamily:"Georgia, serif",fontWeight:400},children:["Access Your",t.jsx("br",{}),"Planning"," ",t.jsx("span",{className:"text-[#B87A5F]",children:"Journey"})]}),t.jsxs("p",{className:"text-lg sm:text-xl text-[#1a1a2e]/65 leading-relaxed max-w-lg",style:{fontFamily:"Georgia, serif"},children:["Your journey to ",t.jsx("span",{className:"text-[#00122b] font-semibold",children:"clarity, purpose, and peace"})," starts with one honest conversation."]})]}),t.jsxs("div",{className:"w-full max-w-md",children:[t.jsx("p",{className:"text-lg mb-6 text-[#2c3e50]",style:{fontFamily:"Georgia, serif"},children:"Sign in to continue with Grace"}),t.jsxs("div",{className:"flex gap-2 mb-6",children:[t.jsxs("button",{type:"button",onClick:()=>{A(""),G("email")},className:"flex-1 inline-flex items-center justify-center gap-2 rounded-lg py-2.5 text-sm font-semibold transition-all "+("email"===W?"bg-white text-[#00122b] ring-1 ring-[#B87A5F]/50 shadow-[0_2px_10px_rgba(184,122,95,0.22)]":"bg-gray-100 text-[#2c3e50]/70 hover:bg-gray-200"),children:[t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[t.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.7"}),t.jsx("path",{d:"M4 7l8 6 8-6",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Email"]}),t.jsxs("button",{type:"button",onClick:()=>{A(""),q(!1),R(""),G("phone")},className:"flex-1 inline-flex items-center justify-center gap-2 rounded-lg py-2.5 text-sm font-semibold transition-all "+("phone"===W?"bg-white text-[#00122b] ring-1 ring-[#B87A5F]/50 shadow-[0_2px_10px_rgba(184,122,95,0.22)]":"bg-gray-100 text-[#2c3e50]/70 hover:bg-gray-200"),children:[t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{filter:"drop-shadow(0 0 4px rgba(184,122,95,0.65))"},children:t.jsx("path",{d:"M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.6.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1C11.3 21 3 12.7 3 2.5c0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.2.2 2.4.6 3.6.1.3 0 .7-.2 1l-2.3 2.2z",fill:"#B87A5F"})}),"Phone"]})]}),t.jsxs("button",{type:"button",onClick:J,className:"w-full flex items-center justify-center gap-3 px-4 py-3.5 bg-white border border-gray-200 rounded-xl text-[#2c3e50] font-medium hover:bg-gray-50 transition-colors text-base",children:[t.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[t.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),t.jsx("path",{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",fill:"#34A853"}),t.jsx("path",{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",fill:"#FBBC05"}),t.jsx("path",{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",fill:"#EA4335"})]}),"Continue with Google"]}),t.jsxs("div",{className:"flex items-center gap-3 my-1",children:[t.jsx("div",{className:"flex-1 h-px bg-gray-200"}),t.jsx("span",{className:"text-sm text-gray-400",children:"or"}),t.jsx("div",{className:"flex-1 h-px bg-gray-200"})]}),"email"===W?t.jsxs("form",{onSubmit:async e=>{var t,s,r;e.preventDefault(),I(!0),A(""),M(!1),T(!1);try{const{data:e,error:a}=await $(v,k);if(a){if((null==(t=a.message)?void 0:t.includes("Email not confirmed"))||(null==(s=a.message)?void 0:s.includes("not confirmed")))throw M(!0),Error("Please check your email and click the confirmation link before signing in.");
1if(null==(r=a.message)?void 0:r.includes("Invalid login credentials"))throw Error("Invalid email or password. Please try again.");throw Error(a.message||"Login failed")}if(!e.user)throw Error("No user data returned");Y(w)}catch(a){A(a.message||"Failed to log in. Please check your credentials and try again.")}finally{I(!1)}},className:"space-y-5",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-[#2c3e50] text-sm font-medium mb-1.5",children:"Email"}),t.jsx("input",{type:"email",value:v,onChange:e=>N(e.target.value),className:"w-full px-4 py-3 bg-white border border-gray-200 rounded-xl text-[#2c3e50] placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-[#B87A5F]/20 focus:border-[#B87A5F] transition-colors text-base",placeholder:"Enter your email",required:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-[#2c3e50] text-sm font-medium mb-1.5",children:"Password"}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:F?"text":"password",value:k,onChange:e=>C(e.target.value),className:"w-full px-4 py-3 pr-12 bg-white border border-gray-200 rounded-xl text-[#2c3e50] placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-[#B87A5F]/20 focus:border-[#B87A5F] transition-colors text-base",placeholder:"Enter your password",required:!0}),t.jsx("button",{type:"button",onClick:()=>E(!F),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",children:F?t.jsx(m,{className:"w-5 h-5"}):t.jsx(u,{className:"w-5 h-5"})})]})]}),t.jsx("div",{className:"text-right -mt-2",children:t.jsx(o,{to:"/gracetools/forgot-password",className:"text-sm text-gray-400 hover:text-[#B87A5F] transition-colors",children:"Forgot password?"})}),_&&t.jsxs("div",{className:"text-green-700 text-sm text-center bg-green-50 p-3 rounded-lg",children:["Confirmation email sent to ",t.jsx("strong",{children:v}),". Check your inbox."]}),S&&t.jsxs("div",{className:"text-red-600 text-sm text-center bg-red-50 p-3 rounded-lg",children:[S,P&&!_&&t.jsx("button",{type:"button",onClick:async()=>{if(v){I(!0);try{const{error:e}=await n.auth.resend({type:"signup",email:v,options:{emailRedirectTo:window.location.origin+"/gracetools/myplan"}});if(e)throw e;T(!0),A("")}catch(e){A(e.message||"Could not resend confirmation email.")}finally{I(!1)}}},disabled:B,className:"block mx-auto mt-2 text-[#B87A5F] hover:text-[#A0694F] font-semibold text-sm disabled:opacity-50",children:B?"Sending...":"Resend confirmation email"})]}),t.jsx("button",{type:"submit",disabled:B,className:"mpk-btn w-full py-3.5 text-base",children:B?"Signing In...":"Sign In"})]}):t.jsx("div",{className:"space-y-5",children:K?t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-[#2c3e50] text-sm font-medium mb-1.5",children:"Enter your code"}),t.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"one-time-code",value:z,autoFocus:!0,onChange:e=>R(e.target.value.replace(/\D/g,"").slice(0,8)),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ee())},placeholder:"â¢â¢â¢â¢â¢â¢",className:"w-full px-4 py-3 bg-white border border-gray-200 rounded-xl text-center text-[1.3rem] tracking-[0.4em] text-[#2c3e50] focus:outline-none focus:ring-2 focus:ring-[#B87A5F]/20 focus:border-[#B87A5F] transition-colors"}),t.jsxs("p",{className:"mt-1.5 text-xs text-gray-400",children:["We texted a code to ",U,"."]})]}),S&&t.jsx("div",{className:"text-red-600 text-sm text-center bg-red-50 p-3 rounded-lg",children:S}),t.jsx("button",{type:"button",onClick:ee,disabled:B,className:"mpk-btn w-full py-3.5 text-base",children:B?"Signing Inâ¦":"Verify and sign in"}),t.jsx("button",{type:"button",onClick:()=>{q(!1),R(""),A("")},className:"mpk-btn-ghost w-full",children:"Use a different number"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-[#2c3e50] text-sm font-medium mb-1.5",children:"Mobile number"}),t.jsx("input",{type:"tel",inputMode:"tel",autoComplete:"tel",value:U,onChange:e=>D(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),X())},placeholder:"(555) 555-0123",className:"w-full px-4 py-3 bg-white border border-gray-200 rounded-xl text-[#2c3e50] placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-[#B87A5F]/20 focus:border-[#B87A5F] transition-colors text-base"}),t.jsx("p",{className:"mt-1.5 text-xs text-gray-400",children:"Use the number you talked to Grace with. US numbers work as-is."})]}),t.jsx("p",{className:"text-[11px] leading-4 text-gray-400",children:"By continuing you agree that My Plan Keeper Inc. may send you a one time verification code by text. Message and data rates may apply. We do not share your mobile information with third parties for marketing."}),S&&t.jsx("div",{className:"text-red-600 text-sm text-center bg-red-50 p-3 rounded-lg",children:S}),t.jsx("button",{type:"button",onClick:X,disabled:B,className:"mpk-btn w-full py-3.5 text-base",children:B?"Sendingâ¦":"Text me a code"})]})}),t.jsxs("div",{className:"text-center mt-5 pt-5 border-t border-gray-100",children:[t.jsx("p",{className:"text-gray-500 text-sm mb-1",children:"Don't have an account?"}),t.jsx(o,{to:"/gracetools/signup"+(f&&"master-admin"!==f&&"mpkai"!==f?"?partner_id="+f:""),className:"text-[#B87A5F] hover:text-[#A0694F] font-semibold text-sm",children:"Create your My Plan Keeper account"})]}),t.jsxs("div",{className:"text-center mt-3 text-[10px] text-gray-400",children:[t.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#2c3e50] transition-colors",children:"Terms"})," ","â¢"," ",t.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#2c3e50] transition-colors",children:"Privacy"}),t.jsx("span",{className:"block mt-1 text-gray-300",children:"My Plan Keeper Inc. All Rights Reserved."})]})]})]})]})})}export{g 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.