1import{j as e}from"./vendor-ui-core.DP8knyZn.js";import{j as r,f as t,r as a}from"./vendor-react.BBoGJFYM.js";import{j as s,s as o,t as l,H as n,S as i,D as c,o as d,q as p,r as m}from"./index.CdjOtu-m.js";import{C as x}from"./checkbox.8aD27ZwB.js";import{u}from"./vendor-media.DY6E_qVO.js";import{p as g}from"./purify.es.COJDRNUs.js";import{Y as b,aN as h,g as f,O as j,b as y,Z as v,k as B,y as N,L as k,m as w}from"./vendor-icons.BjAWwE8z.js";import{o as T,s as C,l as _}from"./vendor-utils.BlEnRQrd.js";import"./vendor-supabase.DS-aP8MZ.js";import"./vendor-ui-forms.CjLBxE3d.js";import"./vendor-ui-display.BT2Z6Vpo.js";import"./vendor-query.CfjDb5WU.js";import"./vendor-motion.DCvbjL6b.js";import"./vendor-charts.RWeJ_I16.js";const S={dark:{sectionBg:"linear-gradient(160deg, #15002B 0%, #2A044C 50%, #1A0235 100%)",cardBg:"rgba(255,255,255,0.04)",cardBorder:"rgba(255,255,255,0.09)",inputBg:"rgba(255,255,255,0.06)",inputBorder:"rgba(255,255,255,0.14)",inputBorderFocus:"rgba(139,92,246,0.75)",inputBorderError:"rgba(239,68,68,0.75)",headlineColor:"#ffffff",bodyText:"rgba(255,255,255,0.65)",mutedText:"rgba(255,255,255,0.38)",labelText:"rgba(255,255,255,0.55)",accentText:"#a78bfa",accentBg:"rgba(139,92,246,0.18)",accentBorder:"rgba(139,92,246,0.40)",successText:"#6ee7b7",successBg:"rgba(16,185,129,0.15)",errorText:"rgba(252,165,165,0.90)",divider:"rgba(255,255,255,0.07)",gridLine:"rgba(255,255,255,0.022)",tagBg:"rgba(139,92,246,0.20)",tagBorder:"rgba(139,92,246,0.40)"},light:{sectionBg:"linear-gradient(160deg, #2D0550 0%, #5B1280 50%, #3D0A6E 100%)",cardBg:"rgba(255,255,255,0.07)",cardBorder:"rgba(255,255,255,0.14)",inputBg:"rgba(255,255,255,0.10)",inputBorder:"rgba(255,255,255,0.22)",inputBorderFocus:"rgba(167,139,250,0.85)",inputBorderError:"rgba(252,165,165,0.80)",headlineColor:"#ffffff",bodyText:"rgba(255,255,255,0.80)",mutedText:"rgba(255,255,255,0.50)",labelText:"rgba(255,255,255,0.65)",accentText:"#c4b5fd",accentBg:"rgba(167,139,250,0.20)",accentBorder:"rgba(167,139,250,0.50)",successText:"#a7f3d0",successBg:"rgba(16,185,129,0.18)",errorText:"rgba(254,202,202,0.95)",divider:"rgba(255,255,255,0.14)",gridLine:"rgba(255,255,255,0.038)",tagBg:"rgba(167,139,250,0.20)",tagBorder:"rgba(167,139,250,0.45)"}},D=T({name:C().trim().min(2,"Name must be at least 2 characters").max(100),email:C().trim().email("Invalid email address").max(255),phone:C().trim().min(7,"Invalid phone number").max(20),linkedin:C().trim().url("Invalid LinkedIn URL").optional().or(_("")),consent:_(!0,{errorMap:()=>({message:"You must consent to proceed"})})}),F=({icon:r,text:t,p:a})=>e.jsxs("span",{className:"flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-full",style:{background:a.tagBg,border:`1px solid ${a.tagBorder}`,color:a.bodyText},children:[e.jsx(r,{className:"h-3.5 w-3.5 flex-shrink-0",style:{color:a.accentText}}),t]}),E=({children:r,p:t})=>e.jsx("label",{className:"block text-[11px] font-bold uppercase tracking-[0.12em] mb-1.5",style:{color:t.labelText},children:r}),$=({type:r="text",value:t,onChange:a,placeholder:s,hasError:o,p:l})=>e.jsx("input",{type:r,value:t,onChange:a,placeholder:s,className:"w-full h-11 px-3 rounded-xl text-sm outline-none transition-all duration-200 placeholder:opacity-40",style:{background:l.inputBg,border:`1.5px solid ${o?l.inputBorderError:l.inputBorder}`,color:l.headlineColor,fontFamily:"'Inter','DM Sans',sans-serif"},onFocus:e=>{e.currentTarget.style.borderColor=o?l.inputBorderError:l.inputBorderFocus,e.currentTarget.style.boxShadow="0 0 0 3px rgba(139,92,246,0.15)"},onBlur:e=>{e.currentTarget.style.boxShadow="none",e.currentTarget.style.borderColor=o?l.inputBorderError:l.inputBorder}}),L=({msg:r,p:t})=>r?e.jsxs("p",{className:"flex items-center gap-1 text-xs mt-1.5",style:{color:t.errorText},children:[e.jsx(w,{className:"h-3 w-3 flex-shrink-0"})," ",r]}):null,A=()=>{const{jobId:w}=r(),T=t(),{resolvedTheme:C}=s(),_="light"===C?S.light:S.dark,[A,I]=a.useState(null),[R,P]=a.useState(!0),[M,O]=a.useState(!1),[q,z]=a.useState(!1),[Y,J]=a.useState(""),[X,G]=a.useState(""),[H,U]=a.useState(""),[W,Z]=a.useState(""),[K,Q]=a.use
1State(!1),[V,ee]=a.useState(null),[re,te]=a.useState({});a.useEffect(()=>{w&&(async()=>{const{data:e,error:r}=await o.from("jobs").select("*").eq("id",w).single();if(r||!e)return l({title:"Job not found",variant:"destructive"}),void T("/careers",{replace:!0});I(e),P(!1)})()},[w,T]);const ae=a.useCallback(e=>{var r;const t=e[0];if(!t)return;const a=null==(r=t.name.split(".").pop())?void 0:r.toLowerCase();["pdf","docx"].includes(a||"")?t.size>10485760?l({title:"File must be under 10MB",variant:"destructive"}):ee(t):l({title:"Only PDF and DOCX files are accepted",variant:"destructive"})},[]),{getRootProps:se,getInputProps:oe,isDragActive:le}=u({onDrop:ae,accept:{"application/pdf":[".pdf"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"]},maxFiles:1}),ne=()=>{J(""),G(""),U(""),Z(""),Q(!1),ee(null),te({})};if(R)return e.jsxs("div",{className:"min-h-screen flex flex-col",style:{background:_.sectionBg},children:[e.jsx(n,{}),e.jsx("main",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full animate-spin border-2 border-transparent",style:{borderTopColor:_.accentText,borderRightColor:_.accentBorder}}),e.jsx("p",{className:"text-sm",style:{color:_.mutedText},children:"Loading positionâ¦"})]})})]});if(!A)return null;if(!A.is_active)return e.jsxs("div",{className:"min-h-screen flex flex-col",style:{background:_.sectionBg},children:[e.jsx(n,{}),e.jsxs("main",{className:"flex-1 flex flex-col items-center justify-center text-center px-4 gap-5",children:[e.jsx("h1",{className:"text-3xl font-bold",style:{fontFamily:"'Roboto Slab',serif",color:_.headlineColor},children:A.title}),e.jsx("p",{style:{color:_.bodyText},children:"This position is no longer accepting applications."}),e.jsxs("button",{onClick:()=>T("/careers"),className:"flex items-center gap-2 px-5 py-2.5 rounded-xl text-sm font-semibold",style:{background:_.accentBg,border:`1px solid ${_.accentBorder}`,color:_.accentText},children:[e.jsx(b,{className:"w-4 h-4"})," Back to Careers"]})]})]});const ie=A.valid_until&&new Date(A.valid_until)<new Date;return e.jsxs("div",{className:"min-h-screen flex flex-col transition-colors duration-300",style:{background:_.sectionBg,fontFamily:"'Inter','DM Sans',sans-serif"},children:[e.jsx("div",{"aria-hidden":!0,className:"fixed inset-0 pointer-events-none",style:{backgroundImage:[`linear-gradient(${_.gridLine} 1px, transparent 1px)`,`linear-gradient(90deg, ${_.gridLine} 1px, transparent 1px)`].join(", "),backgroundSize:"40px 40px",zIndex:0}}),e.jsx(i,{title:`${A.title} â Careers | SmartMentor.ai`,description:`Apply for ${A.title}${A.location?` in ${A.location}`:""}. ${A.description.substring(0,120)}â¦`}),e.jsx(n,{}),e.jsxs("main",{className:"relative z-10 flex-1 w-full max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 pt-24 pb-12",children:[e.jsxs("button",{onClick:()=>T("/careers"),className:"flex items-center gap-2 mb-8 text-sm font-medium transition-all hover:scale-[1.02]",style:{color:_.mutedText},children:[e.jsx(b,{className:"w-4 h-4"})," Back to all positions"]}),e.jsxs("div",{className:"rounded-2xl p-6 mb-6",style:{background:_.cardBg,border:`1px solid ${_.cardBorder}`,backdropFilter:"blur(12px)"},children:[e.jsxs("div",{className:"flex flex-wrap items-start gap-3 mb-4",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold flex-1",style:{fontFamily:"'Roboto Slab',serif",color:_.headlineColor},children:A.title}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[A.employment_type&&e.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-semibold capitalize",style:{background:_.accentBg,border:`1px solid ${_.accentBorder}`,color:_.accentText},children:A.employment_type}),ie&&e.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-semibold",style:{background:"rgba(239,68,68,0.15)",border:"1px solid rgba(239,68,68,0.35)",color:"#fca5a5"},children:"Expired"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[A.location&&e.jsx(F,{icon:h,text:A.location,p:_}),A.department&&e.jsx(F,{icon:f,text:A.department,p:_}),A.experience_level&&e.jsx(F,{icon:j,text:A.experience_level,p:_}),A.valid_until&&e.jsx(F,{icon:y,text:`Apply by ${new Date(A.valid_until).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"})}`,p:_})]})]}),e.jsxs("div",{className:"rounded-2xl p-6 mb-6",style:{background:_.cardBg,border:`1px solid ${_.cardBorder}`,backdropFilter:"blur(12px)"},children:[e.jsx("h2",{className:"text-lg font-bold mb-4",style:{fontFamily:"'Roboto Slab',serif",color:_.headlineColor},children:"Job Description"}),e.jsx("div",{className:"prose prose-sm max-w-none leading-relaxed [&_h1]:text-xl [&_h1]:font-bold [&_h2]:text-lg [&_h2]:font-semibold [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5",style:{color:_.bodyText},dangerouslySetInnerHTML:{__html:g.sanitize(A.description,{ALLOWED_TAGS:["h1","h2","h3","h4","p","ul","ol","li","strong","em","b","i","u","br","a","span","div"],ALLOWED_ATTR:["href","target","rel"]})}})]}),!ie&&e.jsx("div",{className:"flex justify-center",children:e.jsxs("button",{onClick:()=>{O(!0),ne()},className:"flex items-center gap-2 px-8 py-3.5 rounded-xl text-base font-bold transition-all hover:scale-[1.03] active:scale-95",style:{background:"rgba(139,92,246,0.80)",border:`1px solid ${_.accentBorder}`,color:"#fff",boxShadow:"0 8px 24px rgba(139,92,246,0.35)"},children:["Apply for this position ",e.jsx(v,{className:"w-5 h-5"})]})})]}),e.jsx(c,{open:M,onOpenChange:e=>{e||(O(!1),ne())},children:e.jsxs(d,{className:"max-w-lg max-h-[90vh] overflow-y-auto rounded-2xl",style:{background:S.dark.sectionBg,border:`1px solid ${_.cardBorder}`},children:[e.jsx(p,{children:e.jsxs(m,{style:{fontFamily:"'Roboto Slab',serif",color:_.headlineColor},children:["Apply for: ",A.title]})}
1),e.jsxs("div",{className:"space-y-4 mt-2",children:[e.jsxs("div",{children:[e.jsx(E,{p:_,children:"Full Name *"}),e.jsx($,{value:Y,onChange:e=>J(e.target.value),placeholder:"John Doe",hasError:!!re.name,p:_}),e.jsx(L,{msg:re.name,p:_})]}),e.jsxs("div",{children:[e.jsx(E,{p:_,children:"Email *"}),e.jsx($,{type:"email",value:X,onChange:e=>G(e.target.value),placeholder:"[email protected]",hasError:!!re.email,p:_}),e.jsx(L,{msg:re.email,p:_})]}),e.jsxs("div",{children:[e.jsx(E,{p:_,children:"Contact Number *"}),e.jsx($,{value:H,onChange:e=>U(e.target.value),placeholder:"+91 9876543210",hasError:!!re.phone,p:_}),e.jsx(L,{msg:re.phone,p:_})]}),e.jsxs("div",{children:[e.jsx(E,{p:_,children:"LinkedIn Profile"}),e.jsx($,{value:W,onChange:e=>Z(e.target.value),placeholder:"https://linkedin.com/in/yourprofile",hasError:!!re.linkedin,p:_}),e.jsx(L,{msg:re.linkedin,p:_})]}),e.jsxs("div",{children:[e.jsx(E,{p:_,children:"Upload Resume (PDF / DOCX) *"}),e.jsxs("div",{...se(),className:"mt-1 border-2 border-dashed rounded-xl p-6 text-center cursor-pointer transition-all duration-200",style:{borderColor:le?_.accentBorder:re.resume?_.inputBorderError:_.inputBorder,background:le?_.accentBg:_.inputBg},children:[e.jsx("input",{...oe()}),V?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(B,{className:"w-4 h-4",style:{color:_.successText}}),e.jsx("span",{className:"text-sm font-medium",style:{color:_.headlineColor},children:V.name})]}):e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(N,{className:"w-6 h-6",style:{color:_.mutedText}}),e.jsx("p",{className:"text-sm",style:{color:_.mutedText},children:"Drag & drop or click to select"}),e.jsx("p",{className:"text-xs",style:{color:_.mutedText},children:"PDF or DOCX · max 10MB"})]})]}),e.jsx(L,{msg:re.resume,p:_})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(x,{id:"consent",checked:K,onCheckedChange:e=>Q(!0===e),className:"mt-0.5"}),e.jsx("label",{htmlFor:"consent",className:"text-sm leading-snug cursor-pointer",style:{color:_.bodyText},children:"I consent to SmartMentor.ai processing my personal information for recruitment purposes. *"})]}),e.jsx(L,{msg:re.consent,p:_}),e.jsx("button",{onClick:async()=>{const e=D.safeParse({name:Y,email:X,phone:H,linkedin:W,consent:K});if(!e.success){const r={};return e.error.errors.forEach(e=>{e.path[0]&&(r[e.path[0]]=e.message)}),void te(r)}if(V){if(A){te({}),z(!0);try{const{data:e,error:r}=await o.from("job_applications").select("id").eq("job_id",A.id).eq("candidate_email",X.trim()).eq("status","received").single();if(r&&"PGRST116"!==r.code)throw new Error("Failed to check existing application: "+r.message);if(e)return l({title:"Duplicate application",description:"You have already applied for this job.",variant:"destructive"}),void z(!1);const t=`${A.id}/${Date.now()}_${V.name}`,{error:a}=await o.storage.from("career-resumes").upload(t,V);if(a)throw new Error("Failed to upload resume: "+a.message);const{error:s}=await o.from("job_applications").insert({job_id:A.id,candidate_name:Y.trim(),candidate_email:X.trim(),candidate_phone:H.trim(),linkedin_url:W.trim()||null,resume_path:t,resume_filename:V.name,consent_given:!0});if(s)throw new Error("Failed to submit application: "+s.message);try{await o.functions.invoke("send-application-confirmation",{body:{candidate_name:Y.trim(),candidate_email:X.trim(),job_title:A.title}})}catch{}l({title:"Application submitted â",description:"You'll receive a confirmation email shortly."}),O(!1),ne()}catch(r){l({title:"Submission failed",description:r.message,variant:"destructive"})}finally{z(!1)}}}else te({resume:"Please upload your resume"})},disabled:q,className:"w-full flex items-center justify-center gap-2 py-3 rounded-xl text-sm font-bold transition-all hover:scale-[1.01] active:scale-95 disabled:opacity-50",style:{background:"rgba(139,92,246,0.80)",border:`1px solid ${_.accentBorder}`,color:"#fff",boxShadow:"0 4px 16px rgba(139,92,246,0.30)"},children:q?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"w-4 h-4 animate-spin"})," Submittingâ¦"]}):"Confirm & Submit Application"})]})]})})]})};export{A 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.