1import{r as a,k as M,l as G,m as H,j as e,H as T,L as j,n as D,o as F,p as c,s as P}from"./index-CbvCveKN.js";import{A as W,s as K}from"./authStyles-DbAifnUO.js";import{o as R,s as v}from"./types-mFYcXcuq.js";const B=R({email:v().email({message:"Enter a valid email address"}),password:v().min(1,{message:"Enter your password"})}),U=` 2.ek-login .grid-bg{-webkit-mask-image:radial-gradient(ellipse 50% 60% at 50% 45%,#000 20%,transparent 100%);mask-image:radial-gradient(ellipse 50% 60% at 50% 45%,#000 20%,transparent 100%)} 3.ek-login .glow{top:-260px;left:50%;transform:translateX(-50%);width:900px;height:640px} 4.ek-login .center{position:relative;display:flex;align-items:center;justify-content:center;padding:64px 32px 96px} 5.ek-login .col{width:100%;max-width:400px;display:flex;flex-direction:column;gap:40px} 6.ek-login h1{font-size:38px;font-weight:600;letter-spacing:-.035em;line-height:1.05;margin:18px 0 0;white-space:nowrap} 7.ek-login h1 .l1{display:block;animation:ek-rise .9s cubic-bezier(.2,.7,.2,1) .1s both} 8.ek-login h1 .l2{display:block;color:var(--t3);animation:ek-rise .9s cubic-bezier(.2,.7,.2,1) .3s both} 9.ek-login form{gap:32px;animation:ek-rise 1s cubic-bezier(.2,.7,.2,1) .5s both} 10.ek-login .fields{gap:28px} 11.ek-login .under{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-top:14px;font-size:13px} 12.ek-login .remember{display:flex;align-items:center;gap:10px;cursor:pointer;color:var(--t2);background:none;border:0;padding:0;font:inherit;min-height:32px} 13.ek-login .box{width:16px;height:16px;border-radius:4px;border:1px solid #ffffff2a;background:transparent;display:flex;align-items:center;justify-content:center;transition:all .2s;flex:none} 14.ek-login .box.on{border-color:var(--accent);background:var(--accent)} 15.ek-login .box svg{opacity:0;transition:opacity .2s} 16.ek-login .box.on svg{opacity:1} 17.ek-login .forgot{color:var(--t3);text-decoration:none;min-height:32px;display:inline-flex;align-items:center} 18.ek-login .forgot:hover{color:var(--text)} 19.ek-login .secure{display:flex;justify-content:center;flex-wrap:wrap;gap:10px;font-size:12.5px;color:var(--t4);animation:ek-fade 1s 1s both} 20.ek-login .secure i{font-style:normal;color:#2f3947} 21@media (max-width:480px){ 22 .ek-login .center{padding:40px 20px 72px} 23 .ek-login h1{font-size:30px} 24 .ek-login .col{gap:32px} 25} 26@media (prefers-reduced-motion:reduce){ 27 .ek-login *{animation:none!important;transition:none!important} 28} 29`,_=t=>t<12?"GOOD MORNING":t<17?"GOOD AFTERNOON":"GOOD EVENING",Y=()=>{const[t,k]=a.useState(""),[g,N]=a.useState(""),[h,y]=a.useState(!1),[l,S]=a.useState(!0),[i,n]=a.useState({}),[d,o]=a.useState(!1),[C,E]=a.useState("SIGN IN"),z=M(),{toast:x}=G(),[A]=H(),p=A.get("next"),u=(()=>{if(!p||!p.startsWith("/")||p.includes("\\"))return"/dashboard";try{const s=new URL(p,window.location.origin);return s.origin===window.location.origin?s.pathname+s.search+s.hash:"/dashboard"}catch{return"/dashboard"}})();a.useEffect(()=>{E(_(new Date().getHours()))},[]);const I=async s=>{s.preventDefault();const r=B.safeParse({email:t,password:g});if(!r.success){const f={};for(const b of r.error.issues){const w=b.path[0];f[w]||(f[w]=b.message)}n(f);return}n({}),o(!0);const{error:m}=await F.auth.signInWithPassword({email:t.trim(),password:g});if(o(!1),m){/invalid login credentials/i.test(m.message)?n({password:"That email and password don't match."}):/email not confirmed/i.test(m.message)?n({email:"Confirm your email first. Check your inbox for the link."}):x({title:"Could not sign in",description:m.message,variant:"destructive"});return}c(!l),z(u)},L=async()=>{o(!0),c(!l);const s=await P(u);s&&(o(!1),c(!1),x({title:"Google sign-in error",description:s,variant:"destructive"}))},O=async()=>{o(!0),c(!l);const s=await K(u);s&&(o(!1),c(!1),x({title:"Apple sign-in error",description:s,variant:"destructive"}))};return e.jsxs("div",{className:"ek-auth ek-login",children:[e.jsxs(T,{children:[e.jsx("title",{children:"Sign in | EstimateKit"}),e.jsx("meta",{name:"description",content:"Sign in to EstimateKit to send estimates, schedule jobs, and get paid."}),e.jsx("meta",{name:"robots",content:"noindex, follow"})]}),e.jsx("style",{dangerouslySetInnerHTML:{__html:W+U}}),e.jsx("div",{className:"grid-bg","aria-hidden":!0}),e.jsx("div",{className:"glow","aria-hidden":!0}),e.jsxs("header",{className:"nav",children:[e.jsxs(j,{to:"/",style:{display:"flex",alignItems:"center",gap:10,color:"inherit",textDecoration:"none"},children:[e.jsx("img",{src:D,alt:"EstimateKit",style:{height:22,width:"auto",display:"block"}}),e.jsxs("span",{className:"brand-text",style:{fontWeight:700,fontSize:15,letterSpacing:"-0.01em"},children:["Estimate",e.jsx("span",{style:{color:"#f26a1b"},children:"Kit"})]})]}),e.jsx("div",{className:"signin",children:e.jsxs(e.Fragment,{children:["Don't have an account? ",e.jsx(j,{to:"/signup",children:"Start free trial"})]})})]}),e.jsx("div",{className:"center",children:e.jsxs("div",{className:"col",children:[e.jsxs("div",{children:[e.jsx("div",{className:"label mono",children:C}),e.jsxs("h1",{children:[e.jsx("span",{className:"l1",children:"Welcome back."}),e.jsx("span",{className:"l2",children:"Sign in to EstimateKit."})]})]}),e.jsxs("form",{onSubmit:I,noValidate:!0,children:[e.jsxs("div",{className:"providers",children:[e.jsxs("button",{type:"button",className:"google",onClick:O,disabled:d,children:[e.jsx("svg",{width:"17",height:"20",viewBox:"0 0 17 20","aria-hidden":!0,
29children:e.jsx("path",{fill:"currentColor",d:"M14.04 10.62c-.02-2.3 1.88-3.4 1.96-3.46-1.07-1.56-2.73-1.78-3.32-1.8-1.41-.14-2.76.83-3.48.83-.72 0-1.82-.81-3-.79-1.54.02-2.96.9-3.76 2.28-1.6 2.78-.41 6.9 1.15 9.16.76 1.1 1.67 2.34 2.86 2.3 1.15-.05 1.58-.74 2.97-.74 1.38 0 1.77.74 2.98.72 1.23-.02 2.01-1.12 2.76-2.23.87-1.28 1.23-2.52 1.25-2.58-.03-.01-2.4-.92-2.42-3.65zM11.77 3.86c.63-.77 1.06-1.83.94-2.89-.91.04-2.01.61-2.66 1.37-.58.67-1.09 1.75-.96 2.79 1.02.08 2.05-.52 2.68-1.27z"})}),"Continue with Apple"]}),e.jsxs("button",{type:"button",className:"google",onClick:L,disabled:d,children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 48 48","aria-hidden":!0,children:[e.jsx("path",{fill:"#EA4335",d:"M24 9.5c3.5 0 6.6 1.2 9.1 3.6l6.8-6.8C35.8 2.4 30.3 0 24 0 14.6 0 6.5 5.4 2.6 13.2l7.9 6.1C12.4 13.6 17.7 9.5 24 9.5z"}),e.jsx("path",{fill:"#4285F4",d:"M46.5 24.5c0-1.6-.1-3.1-.4-4.5H24v9h12.7c-.6 3-2.2 5.5-4.7 7.2l7.6 5.9c4.4-4.1 6.9-10.1 6.9-17.6z"}),e.jsx("path",{fill:"#FBBC05",d:"M10.5 28.7A14.6 14.6 0 0 1 9.5 24c0-1.6.3-3.2.8-4.7l-7.9-6.1A24 24 0 0 0 0 24c0 3.9.9 7.5 2.6 10.8l7.9-6.1z"}),e.jsx("path",{fill:"#34A853",d:"M24 48c6.3 0 11.7-2.1 15.6-5.7l-7.6-5.9c-2.1 1.4-4.8 2.3-8 2.3-6.3 0-11.6-4.1-13.5-9.9l-7.9 6.1C6.5 42.6 14.6 48 24 48z"})]}),"Continue with Google"]})]}),e.jsxs("div",{className:"or","aria-hidden":!0,children:[e.jsx("i",{}),e.jsx("span",{className:"mono",children:"OR CONTINUE WITH EMAIL"}),e.jsx("i",{})]}),e.jsxs("div",{className:"fields",children:[e.jsxs("div",{className:`field${i.email?" err":""}`,children:[e.jsx("label",{htmlFor:"login-email",className:"flabel mono",children:e.jsx("span",{children:"Email address"})}),e.jsx("input",{id:"login-email",className:"in",type:"email",inputMode:"email",autoComplete:"email",autoCapitalize:"none",placeholder:"[email protected]",value:t,onChange:s=>{k(s.target.value),n(r=>({...r,email:void 0}))},"aria-invalid":!!i.email}),i.email?e.jsx("p",{className:"msg mono",role:"alert",children:i.email}):null]}),e.jsxs("div",{className:`field${i.password?" err":""}`,children:[e.jsxs("div",{className:"flabel mono",children:[e.jsx("label",{htmlFor:"login-password",children:"Password"}),e.jsx("button",{type:"button",className:"mono",onClick:()=>y(s=>!s),"aria-pressed":h,children:h?"HIDE":"SHOW"})]}),e.jsx("input",{id:"login-password",className:"in",type:h?"text":"password",autoComplete:"current-password",placeholder:"Your password",value:g,onChange:s=>{N(s.target.value),n(r=>({...r,password:void 0}))},"aria-invalid":!!i.password}),i.password?e.jsx("p",{className:"msg mono",role:"alert",children:i.password}):null,e.jsxs("div",{className:"under",children:[e.jsxs("button",{type:"button",className:"remember",role:"checkbox","aria-checked":l,onClick:()=>S(s=>!s),children:[e.jsx("span",{className:`box${l?" on":""}`,"aria-hidden":!0,children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",children:e.jsx("path",{d:"M1.5 5.2l2.3 2.3 4.7-4.8",fill:"none",stroke:"#fff",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}),"Keep me signed in"]}),e.jsx(j,{to:"/forgot-password",className:"forgot",children:"Forgot password?"})]})]})]}),e.jsx("div",{className:"submit-wrap",children:e.jsx("button",{type:"submit",className:"submit",disabled:d,children:d?"Signing inâ¦":"Sign in â"})})]}),e.jsxs("div",{className:"secure",children:[e.jsx("span",{children:"Secure sign-in"}),e.jsx("i",{children:"·"}),e.jsx("span",{children:"Encrypted in transit and at rest"})]})]})})]})};export{Y 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.