1import{c as M,Y as T,Z as q,r as c,j as e,C as P,ar as E,as as R,at as A,f as F,I as N,aN as B,B as v,L as z,A as D,a as I,a7 as O,G as Z,z as J,k as Y,ao as K,s as L}from"./index-DMpD5zQ4.js";import{L as y}from"./label-CAB3OdUz.js";import{L as Q}from"./log-in-D7HGr1uz.js";import{o as W,s as C}from"./types-RbQuTuSg.js";import{C as V}from"./circle-check-NQcbTjaT.js";import{B as X}from"./briefcase-Hwi-bO0X.js";import{Z as $}from"./zap-k9RUzm2a.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const U=M("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]),ee=W({email:C().trim().email({message:"Invalid email address"}),password:C().min(6,{message:"Password must be at least 6 characters"})});function se({onSwitchToSignup:l}){const h=T(),{signIn:m}=q(),[u,b]=c.useState(!1),[n,o]=c.useState({}),[p,j]=c.useState({email:"",password:""}),f=async a=>{a.preventDefault(),b(!0),o({});try{const i=ee.safeParse(p);if(!i.success){const w={};i.error.errors.forEach(S=>{w[S.path[0]]=S.message}),o(w),b(!1);return}const{error:t}=await m(p.email,p.password);t||h("/dashboard")}catch(i){console.error("Login error:",i)}finally{b(!1)}};return e.jsxs(P,{className:"glass-card border-border/50 overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-brand-blue/5 to-transparent"}),e.jsxs(E,{className:"relative",children:[e.jsxs(R,{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-brand-blue to-brand-purple flex items-center justify-center",children:e.jsx(Q,{className:"w-5 h-5 text-white"})}),"Welcome Back"]}),e.jsx(A,{children:"Enter your credentials to access your account"})]}),e.jsxs("form",{onSubmit:f,children:[e.jsxs(F,{className:"space-y-4 relative",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"login-email",children:"Email"}),e.jsx(N,{id:"login-email",type:"email",placeholder:"[email protected]",value:p.email,onChange:a=>j(i=>({...i,email:a.target.value})),required:!0,className:"bg-background/50 border-border/50 focus:border-brand-blue transition-colors"}),n.email&&e.jsx("p",{className:"text-sm text-destructive",children:n.email})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"login-password",children:"Password"}),e.jsx(N,{id:"login-password",type:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:p.password,onChange:a=>j(i=>({...i,password:a.target.value})),required:!0,className:"bg-background/50 border-border/50 focus:border-brand-blue transition-colors"}),n.password&&e.jsx("p",{className:"text-sm text-destructive",children:n.password})]})]}),e.jsxs(B,{className:"relative flex flex-col gap-3",children:[e.jsx(v,{type:"submit",className:"w-full hero-gradient group",disabled:u,children:u?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in..."]}):e.jsxs(e.Fragment,{children:["Sign In",e.jsx(D,{className:"ml-2 h-4 w-4 transition-transform group-hover:translate-x-1"})]})}),e.jsx(v,{type:"button",variant:"ghost",className:"w-full",onClick:l,children:"Don't have an account? Sign up"})]})]})]})}function re({id:l,title:h,description:m,icon:u,benefits:b,selected:n,onSelect:o,gradient:p}){return e.jsxs("button",{type:"button",onClick:()=>o(l),className:I("relative p-4 rounded-xl border-2 text-left transition-all duration-300 group","hover:shadow-lg hover:-translate-y-1",n?"border-primary bg-primary/5 shadow-md":"border-border/50 bg-card/50 hover:border-primary/50"),children:[n&&e.jsx("div",{className:"absolute top-3 right-3 w-5 h-5 rounded-full bg-primary flex items-center justify-center",children:e.jsx("svg",{className:"w-3 h-3 text-primary-foreground",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsx("div",{className:I("w-12 h-12 rounded-xl flex items-center justify-center mb-3 transition-transform group-hover:scale-110",p),children:e.jsx(u,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"font-semibold text-foreground mb-1",children:h}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:m}),e.jsx("ul",{className:"space-y-1",children:b.map((j,f)=>e.jsxs("li",{className:"text-xs text-muted-foreground flex items-center gap-2",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),j]},f))})]})}const ae=W({email:C().trim().email({message:"Invalid email address"}).max(255),password:C().min(6,{message:"Password must be at least 6 characters"}).max(72),confirmPassword:C(),fullName:C().trim().min(2,{message:"Full name must be at least 2 characters"}).max(100)}).refine(l=>l.password===l.confirmPassword,{message:"Passwords don't match",path:["confirmPassword"]}),k=[{id:"student",title:"Student / Learner",description:"Learn new skills and advance your career",icon:Z,gradient:"bg-gradient-to-br from-blue-500 to-blue-600",benefits:["Access courses & tutorials","Earn certificates","Track your progress"]},{id:"instructor",title:"Instructor",description:"Share your knowledge and teach others",icon:J,gradient:"bg-gradient-to-br from-purple-500 to-purple-600",benefits:["Create & sell courses","Build your audience","Earn from teaching"]},{id:"freelancer",title:"Freelancer",description:"Find projects and grow your freelance career",icon:X,gradient:"bg-gradient-to-br from-green-500 to-green-600",benefits:["Browse job listings","Submit proposals","Get hired for projects"]},{id:"client",title:"Client / Employer",description:"Hire talented freelancers for your projects",icon:Y,gradient:"bg-gradient-to-br from-orange-500 to-orange-600",benefits:["Post job listings","Review proposals","Hire skilled talent"]}];function te({onSwitchToLogin:l}){const h=T(),{signUp:m}=q(),{toast:u}=O(),[b,n]=c.useState("role"),[o,p]=c.useState(["student"]),[j,f]=c.useState(!1),[a,i]=c.useState({}),[t,w]=c.useState({email:"",password:"",confirmPassword:"",fullName:""}),S=r=>{p(s=>r==="student"?s.includes("student")&&s.length>1?s.filter(x=>x!=="student"):s:s.includes(r)?s.filter(x=>x!==r):[...s,r])},_=async r=>{r.preventDefault(),f(!0),i({});try{const s=ae.safeParse(t);if(!s.success){const d={};
6s.error.errors.forEach(g=>{d[g.path[0]]=g.message}),i(d),f(!1);return}const{error:x}=await m(t.email,t.password,t.fullName);if(x){f(!1);return}await new Promise(d=>setTimeout(d,1e3));const{data:{user:H}}=await L.auth.getUser();if(H){const d=o.filter(g=>g!=="student");for(const g of d)await L.from("user_roles").insert({user_id:H.id,role:g})}L.functions.invoke("send-email",{body:{template:"signup_welcome",data:{email:t.email,full_name:t.fullName,role:o.map(d=>{var g;return((g=k.find(G=>G.id===d))==null?void 0:g.title)||d}).join(", ")}}}).catch(d=>console.warn("welcome email failed",d)),n("success"),setTimeout(()=>{h("/dashboard")},2e3)}catch(s){console.error("Signup error:",s),u({title:"Error",description:"Something went wrong. Please try again.",variant:"destructive"})}finally{f(!1)}};return b==="success"?e.jsxs(P,{className:"glass-card border-border/50 overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-500/5 to-transparent"}),e.jsxs(F,{className:"relative pt-12 pb-12 text-center",children:[e.jsx("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-gradient-to-br from-green-500 to-green-600 flex items-center justify-center animate-pulse",children:e.jsx(V,{className:"w-10 h-10 text-white"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Account Created!"}),e.jsxs("p",{className:"text-muted-foreground mb-4",children:["Welcome to SkilliHire, ",t.fullName.split(" ")[0],"!"]}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:o.map(r=>{const s=k.find(x=>x.id===r);return s?e.jsx("span",{className:"px-3 py-1 rounded-full bg-primary/10 text-primary text-sm font-medium",children:s.title},r):null})}),e.jsx("p",{className:"text-sm text-muted-foreground mt-6",children:"Redirecting to your dashboard..."})]})]}):b==="role"?e.jsxs(P,{className:"glass-card border-border/50 overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-brand-purple/5 to-transparent"}),e.jsxs(E,{className:"relative",children:[e.jsxs(R,{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-brand-purple to-brand-orange flex items-center justify-center",children:e.jsx(U,{className:"w-5 h-5 text-white"})}),"What brings you here?"]}),e.jsx(A,{children:"Select one or more roles that describe you (you can change this later)"})]}),e.jsx(F,{className:"relative",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:k.map(r=>e.jsx(re,{...r,selected:o.includes(r.id),onSelect:S},r.id))})}),e.jsxs(B,{className:"relative flex gap-3",children:[e.jsx(v,{variant:"outline",className:"flex-1",onClick:l,children:"Already have an account?"}),e.jsxs(v,{className:"flex-1 bg-gradient-to-r from-brand-purple to-brand-orange hover:opacity-90 group",onClick:()=>n("details"),disabled:o.length===0,children:["Continue",e.jsx(D,{className:"ml-2 h-4 w-4 transition-transform group-hover:translate-x-1"})]})]})]}):e.jsxs(P,{className:"glass-card border-border/50 overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-brand-purple/5 to-transparent"}),e.jsxs(E,{className:"relative",children:[e.jsxs(v,{variant:"ghost",size:"sm",className:"absolute left-4 top-4",onClick:()=>n("role"),children:[e.jsx(K,{className:"h-4 w-4 mr-1"}),"Back"]}),e.jsxs(R,{className:"flex items-center gap-2 pt-8",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-brand-purple to-brand-orange flex items-center justify-center",children:e.jsx(U,{className:"w-5 h-5 text-white"})}),"Create Your Account"]}),e.jsx(A,{children:"Fill in your details to get started"}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:o.map(r=>{const s=k.find(x=>x.id===r);return s?e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-primary/10 text-primary text-xs font-medium",children:s.title},r):null})})]}),e.jsxs("form",{onSubmit:_,children:[e.jsxs(F,{className:"space-y-4 relative",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"signup-name",children:"Full Name"}),e.jsx(N,{id:"signup-name",type:"text",placeholder:"John Doe",value:t.fullName,onChange:r=>w(s=>({...s,fullName:r.target.value})),required:!0,className:"bg-background/50 border-border/50 focus:border-brand-purple transition-colors"}),a.fullName&&e.jsx("p",{className:"text-sm text-destructive",children:a.fullName})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"signup-email",children:"Email"}),e.jsx(N,{id:"signup-email",type:"email",placeholder:"[email protected]",value:t.email,onChange:r=>w(s=>({...s,email:r.target.value})),required:!0,className:"bg-background/50 border-border/50 focus:border-brand-purple transition-colors"}),a.email&&e.jsx("p",{className:"text-sm text-destructive",children:a.email})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"signup-password",children:"Password"}),e.jsx(N,{id:"signup-password",type:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:t.password,onChange:r=>w(s=>({...s,password:r.target.value})),required:!0,className:"bg-background/50 border-border/50 focus:border-brand-purple transition-colors"}),a.password&&e.jsx("p",{className:"text-sm text-destructive",children:a.password})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"signup-confirm",children:"Confirm Password"}),e.jsx(N,{id:"signup-confirm",type:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:t.confirmPassword,onChange:r=>w(s=>({...s,confirmPassword:r.target.value})),required:!0,className:"bg-background/50 border-border/50 focus:border-brand-purple transition-colors"}),a.confirmPassword&&e.jsx("p",{className:"text-sm text-destructive",children:a.confirmPassword})]})]}),e.jsx(B,{className:"relative",children:e.jsx(v,{type:"submit",className:"w-full bg-gradient-to-r from-brand-purple to-brand-orange hover:opacity-90 group",disabled:j,children:j?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating account..."]}):e.jsxs(e.Fragment,{children:["Create Account",e.jsx(D,{className:"ml-2 h-4 w-4 transition-transform group-hover:translate-x-1"})]})})})]})]})}function ue(){const l=T(),{user:h}=q(),[m,u]=c.useState("login");return c.useEffect(()=>{h&&l("/dashboard")},[h,l]),e.jsxs("div",{className:"min-h-screen relative flex items-center justify-center p-4 pt-24",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-brand-blue/5 via-trans
6parent to-brand-purple/5"}),e.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-brand-blue/10 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-brand-purple/10 rounded-full blur-3xl"}),e.jsxs("div",{className:"w-full max-w-xl relative z-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-brand-blue/10 border border-brand-blue/20 mb-6",children:[e.jsx($,{className:"h-4 w-4 text-brand-blue"}),e.jsx("span",{className:"text-sm font-medium text-brand-blue",children:m==="login"?"Welcome Back":"Join Our Community"})]}),e.jsx("h1",{className:"text-4xl font-bold mb-2",children:e.jsx("span",{className:"gradient-text-brand",children:"SkilliHire"})}),e.jsx("p",{className:"text-muted-foreground",children:m==="login"?"Access your AI-powered workspace":"Start your journey with us today"})]}),m==="login"?e.jsx(se,{onSwitchToSignup:()=>u("signup")}):e.jsx(te,{onSwitchToLogin:()=>u("login")})]})]})}export{ue 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.