1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.CdjOtu-m.js","assets/vendor-ui-core.DP8knyZn.js","assets/vendor-react.BBoGJFYM.js","assets/vendor-supabase.DS-aP8MZ.js","assets/vendor-ui-forms.CjLBxE3d.js","assets/vendor-utils.BlEnRQrd.js","assets/vendor-icons.BjAWwE8z.js","assets/vendor-ui-display.BT2Z6Vpo.js","assets/vendor-query.CfjDb5WU.js","assets/vendor-media.DY6E_qVO.js","assets/vendor-charts.RWeJ_I16.js","assets/vendor-motion.DCvbjL6b.js","assets/index.5-rfuBO2.css"])))=>i.map(i=>d[i]); 2import{j as e}from"./vendor-ui-core.DP8knyZn.js";import{r}from"./vendor-react.BBoGJFYM.js";import{s as t,t as i,a as n,d as o,S as a,J as l,C as s,E as d,F as c,G as g}from"./index.CdjOtu-m.js";import{_ as p}from"./vendor-supabase.DS-aP8MZ.js";import{u}from"./vendor-media.DY6E_qVO.js";import{k as x,y as b,a5 as h,X as m,R as v,aR as f,g as y,bJ as j,x as B,b4 as T,T as w}from"./vendor-icons.BjAWwE8z.js";import"./vendor-ui-forms.CjLBxE3d.js";import"./vendor-utils.BlEnRQrd.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="#10b981",k=["0-1 years","2-5 years","6-10 years","11-15 years","16-20 years","20+ years"],C=({children:r,p:t,required:i})=>e.jsxs("p",{style:{fontSize:11.5,fontWeight:600,color:t.labelText,margin:"0 0 5px",display:"flex",gap:3},children:[r,i&&e.jsx("span",{style:{color:S,fontSize:10},children:"*"})]}),A=({value:t,onChange:i,placeholder:n,p:o,disabled:a})=>{const[l,s]=r.useState(!1);return e.jsx("input",{value:t,onChange:e=>i(e.target.value),placeholder:n,disabled:a,onFocus:()=>s(!0),onBlur:()=>s(!1),style:{width:"100%",boxSizing:"border-box",background:o.inputBg,border:`1px solid ${l?S:o.inputBorder}`,borderRadius:9,padding:"8px 12px",fontSize:12.5,color:o.inputText,outline:"none",transition:"border-color 150ms",opacity:a?.5:1}})},I=({value:t,onChange:i,children:n,p:o})=>{const[a,l]=r.useState(!1);return e.jsx("select",{value:t,onChange:e=>i(e.target.value),onFocus:()=>l(!0),onBlur:()=>l(!1),style:{width:"100%",boxSizing:"border-box",background:o.inputBg,border:`1px solid ${a?S:o.inputBorder}`,borderRadius:9,padding:"8px 12px",fontSize:12.5,color:o.inputText,outline:"none",cursor:"pointer",transition:"border-color 150ms",appearance:"auto"},children:n})},R=({value:t,onChange:i,placeholder:n,rows:o=4,p:a})=>{const[l,s]=r.useState(!1);return e.jsx("textarea",{value:t,onChange:e=>i(e.target.value),placeholder:n,rows:o,onFocus:()=>s(!0),onBlur:()=>s(!1),style:{width:"100%",boxSizing:"border-box",background:a.inputBg,border:`1px solid ${l?S:a.inputBorder}`,borderRadius:9,padding:"8px 12px",fontSize:12.5,color:a.inputText,outline:"none",resize:"vertical",fontFamily:"inherit",transition:"border-color 150ms",lineHeight:1.55}})},D=({isManualEntry:t,onToggle:i,p:n})=>{const[o,a]=r.useState(!1);return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,justifyContent:"center",padding:"2px 0 6px"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:t?n.inputText:n.labelText,transition:"color 150ms"},children:"Manual"}),e.jsx("button",{onClick:i,onMouseEnter:()=>a(!0),onMouseLeave:()=>
2a(!1),style:{width:42,height:23,borderRadius:12,background:t?n.toggleTrackOff:n.toggleTrackOn,border:`1px solid ${o?S:"transparent"}`,cursor:"pointer",position:"relative",transition:"background 200ms, border-color 150ms",padding:0,outline:"none",flexShrink:0},children:e.jsx("span",{style:{position:"absolute",top:3,left:t?3:22,width:15,height:15,borderRadius:"50%",background:n.toggleKnob,transition:"left 200ms",boxShadow:"0 1px 4px rgba(0,0,0,0.35)"}})}),e.jsx("span",{style:{fontSize:12,fontWeight:600,color:t?n.labelText:n.inputText,transition:"color 150ms"},children:"Upload"})]})},z=({value:r,max:t,p:i})=>e.jsxs("span",{style:{fontSize:10,color:r.length>.9*t?"#f87171":i.labelText,marginLeft:"auto"},children:[r.length,"/",t]}),H=({label:r,required:t,charMax:i,value:n,children:o,p:a})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:5},children:[e.jsx(C,{p:a,required:t,children:r}),void 0!==i&&void 0!==n&&e.jsx(z,{value:n,max:i,p:a})]}),o]}),_=({corporateId:n,userId:o,onCreated:a,palette:l})=>{const[s,d]=r.useState(!1),[c,g]=r.useState(""),[v,f]=r.useState(""),[y,j]=r.useState(""),[B,T]=r.useState(""),[w,z]=r.useState("overall"),[_,P]=r.useState("30"),[M,L]=r.useState("2-5 years"),[q,O]=r.useState(""),[$,W]=r.useState(""),[J,F]=r.useState(!0),[U,N]=r.useState(""),[K,V]=r.useState(""),[Y,Q]=r.useState(!1),G=r.useCallback(async e=>{const r=e[0];if(r){Q(!0);try{if("text/plain"===r.type||r.name.toLowerCase().endsWith(".txt")){const e=await r.text();N(e),V(r.name)}else{const{data:{session:e}}=await t.auth.getSession(),{SUPABASE_URL:i,SUPABASE_PUBLISHABLE_KEY:n}=await p(async()=>{const{SUPABASE_URL:e,SUPABASE_PUBLISHABLE_KEY:r}=await import("./index.CdjOtu-m.js").then(e=>e.a6);return{SUPABASE_URL:e,SUPABASE_PUBLISHABLE_KEY:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),o=await r.arrayBuffer(),a=await fetch(`${i}/functions/v1/parse-document?filename=${encodeURIComponent(r.name)}`,{method:"POST",headers:{Authorization:`Bearer ${null==e?void 0:e.access_token}`,apikey:n,"Content-Type":"application/octet-stream"},body:new Uint8Array(o)});if(!a.ok)throw new Error(`Parse failed (${a.status})`);const l=await a.json();if(!(null==l?void 0:l.success)||!l.content)throw new Error((null==l?void 0:l.error)||"No content extracted");N(l.content),V(r.name)}i({title:"File uploaded",description:`${r.name} loaded successfully.`})}catch(n){const e=n instanceof Error?n.message:"Could not read the file.";i({title:"Upload failed",description:e,variant:"destructive"})}Q(!1)}},[]),{getRootProps:X,getInputProps:Z,isDragActive:ee}=u({onDrop:G,accept:{"text/plain":[".txt"],"application/pdf":[".pdf"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"]},maxFiles:1}),re=c.trim()&&q.trim()&&$.trim()&&(J?v.trim()&&y.trim()&&B.trim():U.trim());return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(H,{label:"Job Title",required:!0,p:l,children:e.jsx(A,{value:c,onChange:g,placeholder:"Position Name",p:l})}),e.jsx(H,{label:"Interview Type",required:!0,p:l,children:e.jsxs(I,{value:w,onChange:z,p:l,children:[e.jsx("option",{value:"overall",children:"360° Interview"}),e.jsx("option",{value:"technical",children:"Technical"}),e.jsx("option",{value:"behavioral",children:"Behavioral"}),e.jsx("option",{value:"panel",children:"Panel"})]})})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(H,{label:"Duration",required:!0,p:l,children:e.jsxs(I,{value:_,onChange:P,p:l,children:[e.jsx("option",{value:"5",children:"5 min"}),e.jsx("option",{value:"15",children:"15 min"}),e.jsx("option",{value:"30",children:"30 min"}),e.jsx("option",{value:"45",children:"45 min"}),e.jsx("option",{value:"60",children:"60 min"}),e.jsx("option",{value:"90",children:"90 min"})]})}),e.jsx(H,{label:"Experience Level",required:!0,p:l,children:e.jsx(I,{value:M,onChange:L,p:l,children:k.map(r=>e.jsx("option",{value:r,children:r},r))})})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(H,{label:"Location",required:!0,p:l,children:e.jsx(A,{value:q,onChange:O,placeholder:"City Name / Hybrid",p:l})}),e.jsx(H,{label:"Hiring Manager",required:!0,p:l,children:e.jsx(A,{value:$,onChange:W,placeholder:"Manager Name",p:l})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{flex:1,height:1,background:l.sectionDivider}}
2),e.jsx("span",{style:{fontSize:10,color:l.labelText,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Job Description"}),e.jsx("div",{style:{flex:1,height:1,background:l.sectionDivider}})]}),e.jsx(D,{isManualEntry:J,onToggle:()=>F(e=>!e),p:l}),J?e.jsxs(e.Fragment,{children:[e.jsx(H,{label:"Role Overview",required:!0,value:v,charMax:500,p:l,children:e.jsx(R,{value:v,onChange:f,placeholder:"Brief role summaryâ¦",rows:2,p:l})}),e.jsx(H,{label:"Key Responsibilities",required:!0,value:y,charMax:1500,p:l,children:e.jsx(R,{value:y,onChange:j,placeholder:"⢠Lead the development ofâ¦\n⢠Collaborate with cross-functional teamsâ¦",rows:5,p:l})}),e.jsx(H,{label:"Qualifications & Skills",required:!0,value:B,charMax:1500,p:l,children:e.jsx(R,{value:B,onChange:T,placeholder:"⢠3+ years of experience inâ¦\n⢠Proficiency inâ¦",rows:5,p:l})})]}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx(C,{p:l,required:!0,children:"Upload Job Description"}),e.jsxs("div",{...X(),style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:"28px 20px",borderRadius:12,background:ee?"rgba(16,185,129,0.08)":U?"rgba(16,185,129,0.05)":l.uploadAreaBg,border:`2px dashed ${ee?S:U?"rgba(16,185,129,0.50)":l.uploadAreaBorder}`,cursor:"pointer",transition:"border-color 200ms, background 200ms"},children:[e.jsx("input",{...Z()}),Y?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",border:`2px solid ${l.sectionDivider}`,borderTopColor:S,animation:"jr-spin 0.8s linear infinite"}}),e.jsx("p",{style:{fontSize:12,color:l.uploadAreaText,margin:0},children:"Reading fileâ¦"})]}):U?e.jsxs(e.Fragment,{children:[e.jsx(x,{style:{width:28,height:28,color:S}}),e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("p",{style:{fontSize:12,color:S,fontWeight:700,margin:"0 0 2px"},children:K}),e.jsx("p",{style:{fontSize:11,color:l.uploadAreaText,margin:0},children:"Drop another file to replace"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(b,{style:{width:26,height:26,color:l.uploadAreaText}}),e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("p",{style:{fontSize:12.5,color:l.uploadAreaText,fontWeight:500,margin:"0 0 3px"},children:ee?"Drop it here!":"Drag & drop or click to upload"}),e.jsx("p",{style:{fontSize:10.5,color:l.labelText,margin:0},children:"Supports .txt, .pdf, .docx"})]})]})]}),U&&e.jsxs("div",{style:{position:"relative",background:l.inputBg,border:`1px solid ${l.inputBorder}`,borderRadius:10,padding:"10px 12px",maxHeight:160,overflowY:"auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[e.jsx(h,{style:{width:12,height:12,color:S}}),e.jsx("span",{style:{fontSize:10.5,color:l.labelText,fontWeight:600},children:"Preview"}),e.jsx("button",{onClick:()=>{N(""),V("")},style:{marginLeft:"auto",background:"none",border:"none",color:l.labelText,cursor:"pointer",display:"flex",alignItems:"center",padding:2},children:e.jsx(m,{style:{width:12,height:12}})})]}),e.jsxs("p",{style:{fontSize:11,color:l.uploadAreaText,margin:0,whiteSpace:"pre-wrap",lineHeight:1.5},children:[U.slice(0,600),U.length>600?"â¦":""]})]})]}),!re&&(c||q||$)&&e.jsx("p",{style:{fontSize:11,color:"rgba(248,113,113,0.75)",margin:"0",textAlign:"center"},children:"All required fields must be filled to create a job role."}),e.jsx(E,{onClick:async()=>{const e=J?[v.trim()?`**Role Overview:**\n${v.trim()}`:"",y.trim()?`**Key Responsibilities:**\n${y.trim()}`:"",B.trim()?`**Qualifications & Skills:**\n${B.trim()}`:""].filter(Boolean).join("\n\n"):U;if(!c.trim())return void i({title:"Missing fields",description:"Job Title is required.",variant:"destructive"});if(!e.trim())return void i({title:"Missing fields",description:"Job description content is required.",variant:"destructive"});if(!n||!o)return void i({title:"Error",description:"Corporate account not found.",variant:"destructive"});d(!0);const{error:r}=await t.from("job_roles").insert({corporate_id:n,created_by:o,title:c,description:v||null,job_description:e,interview_type:w,duration_minutes:parseInt(_)||30,experience_level:M,location:q||null,hiring_manager:$||null});r?i({title:"Error",description:r.message,variant:"destructive"}):(i({title:"Job role created!"}),a()),d(!1)},disabled:s||!re,p:l,children:s?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{display:"inline-block",width:13,height:13,borderRadius:"50%",border:"2px s
2olid rgba(255,255,255,0.3)",borderTopColor:"#fff",animation:"jr-spin 0.8s linear infinite"}}),"Creatingâ¦"]}):"Create Job Role"}),e.jsx("style",{children:"@keyframes jr-spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }"})]})},E=({onClick:t,disabled:i,children:n,p:o})=>{const[a,l]=r.useState(!1);return e.jsx("button",{onClick:i?void 0:t,disabled:i,onMouseEnter:()=>!i&&l(!0),onMouseLeave:()=>l(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,width:"100%",padding:"10px 16px",borderRadius:10,background:i?"rgba(16,185,129,0.35)":a?o.btnPrimaryHoverBg:o.btnPrimaryBg,border:"none",color:o.btnPrimaryText,fontSize:13,fontWeight:700,cursor:i?"not-allowed":"pointer",transition:"background 150ms",marginTop:2,letterSpacing:"0.01em"},children:n})},P="#10b981",M=["0-1 years","2-5 years","6-10 years","11-15 years","16-20 years","20+ years"],L=({children:r,p:t,required:i})=>e.jsxs("p",{style:{fontSize:11.5,fontWeight:600,color:t.labelText,margin:"0 0 5px",display:"flex",gap:3},children:[r,i&&e.jsx("span",{style:{color:P,fontSize:10},children:"*"})]}),q=({value:t,onChange:i,placeholder:n,p:o})=>{const[a,l]=r.useState(!1);return e.jsx("input",{value:t,onChange:e=>i(e.target.value),placeholder:n,onFocus:()=>l(!0),onBlur:()=>l(!1),style:{width:"100%",boxSizing:"border-box",background:o.inputBg,border:`1px solid ${a?P:o.inputBorder}`,borderRadius:9,padding:"8px 12px",fontSize:12.5,color:o.inputText,outline:"none",transition:"border-color 150ms"}})},O=({value:t,onChange:i,children:n,p:o})=>{const[a,l]=r.useState(!1);return e.jsx("select",{value:t,onChange:e=>i(e.target.value),onFocus:()=>l(!0),onBlur:()=>l(!1),style:{width:"100%",boxSizing:"border-box",background:o.inputBg,border:`1px solid ${a?P:o.inputBorder}`,borderRadius:9,padding:"8px 12px",fontSize:12.5,color:o.inputText,outline:"none",cursor:"pointer",transition:"border-color 150ms",appearance:"auto"},children:n})},$=({value:t,onChange:i,placeholder:n,rows:o=4,p:a})=>{const[l,s]=r.useState(!1);return e.jsx("textarea",{value:t,onChange:e=>i(e.target.value),placeholder:n,rows:o,onFocus:()=>s(!0),onBlur:()=>s(!1),style:{width:"100%",boxSizing:"border-box",background:a.inputBg,border:`1px solid ${l?P:a.inputBorder}`,borderRadius:9,padding:"8px 12px",fontSize:12.5,color:a.inputText,outline:"none",resize:"vertical",fontFamily:"inherit",transition:"border-color 150ms",lineHeight:1.55}})},W=({value:r,max:t,p:i})=>e.jsxs("span",{style:{fontSize:10,color:r.length>.9*t?"#f87171":i.labelText},children:[r.length,"/",t]}),J=({label:r,required:t,charMax:i,value:n,children:o,p:a})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:5},children:[e.jsx(L,{p:a,required:t,children:r}),void 0!==i&&void 0!==n&&e.jsx(W,{value:n,max:i,p:a})]}),o]}),F=({label:r,p:t})=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{flex:1,height:1,background:t.sectionDivider}}),e.jsx("span",{style:{fontSize:10,color:t.labelText,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:r}),e.jsx("div",{style:{flex:1,height:1,background:t.sectionDivider}})]}),U=({isActive:r,p:t})=>e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:20,background:r?"rgba(16,185,129,0.12)":"rgba(255,255,255,0.06)",border:"1px solid "+(r?"rgba(16,185,129,0.30)":"rgba(255,255,255,0.12)"),fontSize:10.5,fontWeight:700,color:r?P:t.labelText},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:r?P:t.labelText,boxShadow:r?`0 0 6px ${P}`:"none"}}),r?"Active":"Inactive"]}),N=({jobRole:n,onUpdated:o,palette:a})=>{const[l,s]=r.useState(!1),[d,c]=r.useState(n.title),[g,p]=r.useState(n.description||""),[u,x]=r.useState(n.job_description),[b,h]=r.useState(n.interview_type),[m,v]=r.useState(String(n.duration_minutes)),[f,y]=r.useState(n.experience_level||"2-5 years"),[j,B]=r.useState(n.location||""),[T,w]=r.useState(n.hiring_manager||""),S=d.trim()&&u.trim();return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("p",{style:{fontSize:11,color:a.labelText,margin:0},children:["Editing role ID: ",e.jsxs("span",{style:{color:a.inputText,fontFamily:"monospace",fontSize:10},children:[n.id.slice(0,8),"â¦"]})]}),e.jsx(U,{isActive:!!n.is_active,p:a})]}),e.jsx(F,{label:"Role Details",p:a}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(J,{label:"Job Title",required:!0,value:d,charMax:120,p:a,children:e.jsx(q,{value:d,onChange:c,placeholder:"Position Name",p:a})}),e.jsx(J,{label:"Interview Type",required:!0,p:a,children:e.jsxs(O,{value:b,onChange:h,p:a,children:[e.jsx("option",{value:"overall",children:"360° Interview"}),e.jsx("option",{value:"technical",children:"Technical"}),e.jsx("option",{value:"behavioral",children:"Behavioral"}),e.jsx("option",{value:"panel",children:"Panel"})]})})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(J,{label:"Duration",required:!0,p:a,children:e.jsxs(O,{value:m,onChange:v,p:a,children:[e.jsx("option",{value:"5",children:"5 min"}),e.jsx("option",{value:"15",children:"15 min"}),e.jsx("option",{value:"30",children:"30 min"}),e.jsx("option",{value:"45",children:"45 min"}),e.jsx("option",{value:"60",children:"60 min"}),e.jsx("option",{value:"90",children:"90 min"})]})}),e.jsx(J,{label:"Experience Level",required:!0,p:a,children:e.jsx(O,{value:f,onChange:y,p:a,children:M.map(r=>e.jsx("option",{value:r,children:r},r))})})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(J,{label:"Location",p:a,children:e.jsx(q,{value:j,onChange:B,placeholder:"City Name / Hybrid",p:a})}),e.jsx(J,{label:"Hiring Manager",p:a,children:e.jsx(q,{value:T,onChange:w,placeholder:"Manager Name",p:a})})]}),e.jsx(F,{label:"Job Description",p:a}),e.jsx(J,{label:"Role Overview",value:g,charMax:500,p:a,children:e.jsx($,{value:g,onChange:p,placeholder:"Brief role summaryâ¦",rows:2,p:a})}),e.jsx(J,{label:"Full Job Description",required:!0,value:u,charMax:5e3,p:a,children:e.jsx($,{value:u,onChange:x,placeholder:"Full job description including responsibilities, requirements, and any other detailsâ¦",rows:10,p:a})}),!S&&e.jsx("p",{style:{fontSize:11,color:"rgba(248,113,113,0.75)",margin:0,textAlign:"center"},children:"Job Title and Job Description are required."}),e.jsx(K,{onClick:async()=>
2{if(!S)return void i({title:"Missing fields",description:"Title and Job Description are required.",variant:"destructive"});s(!0);const{error:e}=await t.from("job_roles").update({title:d,description:g||null,job_description:u,interview_type:b,duration_minutes:parseInt(m)||30,experience_level:f,location:j||null,hiring_manager:T||null}).eq("id",n.id);e?i({title:"Error",description:e.message,variant:"destructive"}):(i({title:"Job role updated!"}),o()),s(!1)},disabled:l||!S,p:a,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{display:"inline-block",width:13,height:13,borderRadius:"50%",border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"#fff",animation:"jr-spin 0.8s linear infinite"}}),"Savingâ¦"]}):"Save Changes"}),e.jsx("style",{children:"@keyframes jr-spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }"})]})},K=({onClick:t,disabled:i,children:n,p:o})=>{const[a,l]=r.useState(!1);return e.jsx("button",{onClick:i?void 0:t,disabled:i,onMouseEnter:()=>!i&&l(!0),onMouseLeave:()=>l(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,width:"100%",padding:"10px 16px",borderRadius:10,background:i?"rgba(16,185,129,0.35)":a?o.btnPrimaryHoverBg:o.btnPrimaryBg,border:"none",color:o.btnPrimaryText,fontSize:13,fontWeight:700,cursor:i?"not-allowed":"pointer",transition:"background 150ms",marginTop:2,letterSpacing:"0.01em"},children:n})},V={dark:{cardBg:"rgba(255,255,255,0.04)",cardBorder:"rgba(16,185,129,0.14)",cardHoverBg:"rgba(16,185,129,0.07)",cardHoverBorder:"rgba(16,185,129,0.30)",cardHoverShadow:"0 8px 32px rgba(16,185,129,0.12)",titleText:"rgba(255,255,255,0.92)",subText:"rgba(255,255,255,0.45)",metaText:"rgba(255,255,255,0.38)",sectionTitle:"rgba(255,255,255,0.80)",rowBg:"rgba(255,255,255,0.04)",rowLabelText:"rgba(255,255,255,0.50)",rowValueText:"rgba(255,255,255,0.90)",badgeActiveBg:"rgba(16,185,129,0.18)",badgeActiveText:"#10b981",badgeActiveBorder:"rgba(16,185,129,0.35)",badgeInactiveBg:"rgba(255,255,255,0.06)",badgeInactiveText:"rgba(255,255,255,0.40)",badgeInactiveBorder:"rgba(255,255,255,0.12)",countBadgeBg:"rgba(16,185,129,0.14)",countBadgeText:"#10b981",emptyCardBg:"rgba(255,255,255,0.03)",emptyCardBorder:"rgba(255,255,255,0.07)",emptyText:"rgba(255,255,255,0.30)",selectBg:"rgba(255,255,255,0.06)",selectBorder:"rgba(16,185,129,0.20)",selectText:"rgba(255,255,255,0.80)",inputBg:"rgba(255,255,255,0.06)",inputBorder:"rgba(16,185,129,0.22)",inputText:"rgba(255,255,255,0.88)",inputPlaceholder:"rgba(255,255,255,0.30)",labelText:"rgba(255,255,255,0.58)",toggleTrackOff:"rgba(255,255,255,0.12)",toggleTrackOn:"rgba(16,185,129,0.75)",toggleKnob:"#ffffff",uploadAreaBg:"rgba(16,185,129,0.03)",uploadAreaBorder:"rgba(16,185,129,0.20)",uploadAreaText:"rgba(255,255,255,0.42)",sectionDivider:"rgba(255,255,255,0.07)",divider:"rgba(255,255,255,0.06)",shimmerBase:"rgba(255,255,255,0.04)",shimmerHighlight:"rgba(255,255,255,0.07)",sectionIconActive:"rgba(16,185,129,0.85)",sectionIconInact:"rgba(255,255,255,0.30)",btnPrimaryBg:"#10b981",btnPrimaryText:"#fff",btnPrimaryHoverBg:"#0ea572",btnOutlineBg:"rgba(255,255,255,0.05)",btnOutlineBorder:"rgba(255,255,255,0.14)",btnOutlineText:"rgba(255,255,255,0.70)",btnOutlineHoverBg:"rgba(255,255,255,0.09)",btnOutlineHoverText:"rgba(255,255,255,0.92)",btnDangerText:"rgba(248,113,113,0.80)",btnDangerHoverBg:"rgba(248,113,113,0.10)",btnDangerHoverText:"#f87171",overlayBg:"rgba(0,0,0,0.72)",modalBg:"#0f1a15",modalBorder:"rgba(16,185,129,0.22)",modalTitleText:"rgba(255,255,255,0.92)",modalSubText:"rgba(255,255,255,0.45)",modalCloseBg:"rgba(255,255,255,0.06)",modalCloseHoverBg:"rgba(255,255,255,0.12)",modalCloseText:"rgba(255,255,255,0.55)",confirmDangerBg:"rgba(239,68,68,0.14)",confirmDangerBorder:"rgba(239,68,68,0.28)",confirmDangerText:"#f87171",confirmDangerHoverBg:"rgba(239,68,68,0.24)"},light:{cardBg:"rgba(16,185,129,0.06)",cardBorder:"rgba(16,185,129,0.22)",cardHoverBg:"rgba(16,185,129,0.12)",cardHoverBorder:"rgba(16,185,129,0.45)",cardHoverShadow:"0 8px 32px rgba(16,185,129,0.18)",titleText:"rgba(255,255,255,0.96)",subText:"rgba(255,255,255,0.60)",metaText:"rgba(255,255,255,0.50)",sectionTitle:"rgba(255,255,255,0.90)",rowBg:"rgba(255,255,255,0.08)",rowLabelText:"rgba(255,255,255,0.65)",rowValueText:"rgba(255,255,255,0.95)",badgeActiveBg:"rgba(16,185,129,0.25)",badgeActiveText:"#10b981",badgeActiveBorder:"rgba(16,185,129,0.50)",badgeInactiveBg:"rgba(255,255,255,0.10)",badgeInactiveText:"rgba(255,255,255,0.55)",badgeInactiveBorder:"rgba(255,255,255,0.20)",countBadgeBg:"rgba(16,185,129,0.20)",countBadgeText:"#10b981",emptyCardBg:"rgba(255,255,255,0.05)",emptyCardBorder:"rgba(16,185,129,0.15)",emptyText:"rgba(255,255,255,0.45)",selectBg:"rgba(16,185,129,0.12)",selectBorder:"rgba(16,185,129,0.35)",selectText:"rgba(255,255,255,0.90)",inputBg:"rgba(16,185,129,0.10)",inputBorder:"rgba(16,185,129,0.35)",inputText:"rgba(255,255,255,0.92)",inputPlaceholder:"rgba(255,255,255,0.42)",labelText:"rgba(255,255,255,0.70)",toggleTrackOff:"rgba(255,255,255,0.18)",toggleTrackOn:"#10b981",toggleKnob:"#ffffff",uploadAreaBg:"rgba(16,185,129,0.06)",uploadAreaBorder:"rgba(16,185,129,0.28)",uploadAreaText:"rgba(255,255,255,0.52)",sectionDivider:"rgba(16,185,129,0.14)",divider:"rgba(16,185,129,0.18)",shimmerBase:"rgba(255,255,255,0.06)",shimmerHighlight:"rgba(255,255,255,0.10)",sectionIconActive:"#10b981",sectionIconInact:"rgba(255,255,255,0.45)",btnPrimaryBg:"#10b981",btnPrimaryText:"#fff",btnPrimaryHoverBg:"#0ea572",btnOutlineBg:"rgba(16,185,129,0.10)",btnOutlineBorder:"rgba(16,185,129,0.28)",btnOutlineText:"rgba(255,255,255,0.75)",btnOutlineHoverBg:"rgba(16,185,129,0.18)",btnOutlineHoverText:"rgba(255,255,255,0.95)",btnDangerText:"rgba(248,113,113,0.85)",btnDangerHoverBg:"rgba(248,113,113,0.15)",btnDangerHoverText:"#f87171",overlayBg:"rgba(0,0,0,0.60)",modalBg:"#132318",modalBorder:"rgba(16,185,129,0.30)",modalTitleText:"rgba(255,255,255,0.95)",modalSubText:"rgba(255,255,255,0.60)",modalCloseBg:"rgba(255,255,255,0.08)",modalCloseHoverBg:"rgba(255,255,255,0.15)",modalCloseText:"rgba(255,255,255,0.65)",confirmDangerBg:"rgba(239,68,68,0.18)",confirmDangerBorder:"rgba(239,68,68,0.35)",confirmDangerText:"#f87171",confirmDangerHoverBg:"rgba(239,68,68,0.28)"}},Y="#10b981";const Q=({open:t,onClose:i,title:n,children:o,p:a,wide:l=!1})=>{const[s,d]=r.useState(!1);return r.useEffect(()=>(document.body.style.overflow=t?"hidden":"",()=>{document.body.style.overflow=""}),[t]),r.useEffect(()=>{if(!t)return;const e=e=>{"Escape"===e.key&&i()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,i]),t?e.jsx("div",{style:{position:"fixed",inset:0,zIndex:1e3,background:a.overlayBg,display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",backdropFilter:"blur(4px)"},onClick:e=>{e.target===e.currentTarget&&i()},children:e.jsxs("div",{style:{background:a.modalBg,border:`1px solid ${a.modalBorder}`,borderRadius:18,width:"100%",maxWidth:l?680:420,maxHeight:"90vh",overflowY:"auto",boxShadow:"0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(16,185,129,0.08)",display:"flex",flexDirection:"column"},onClick:e=>e.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 22px 14px",position:"sticky",top:0,background:a.modalBg,zIndex:1,borderBottom:`1px solid ${a.modalBorder}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:Y,boxShadow:`0 0 8px ${Y}`}}),e.jsx("h2",{style:{fontSize:15,fontWeight:700,color:a.modalTitleText,margin:0,letterSpacing:"-0.2px"},children:n})]}),e.jsx("button",{onClick:i,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,border:"none",background:s?a.modalCloseHoverBg:a.modalCloseBg,color:a.modalCloseText,cursor:"pointer",transition:"background 150ms",flexShrink:0},children:e.jsx(m,{style:{width:14,height:14}})})]}),e.jsx("div",{style:{padding:"18px 22px 22px",flex:1},children:o})]})}):null},G=({open:t,onClose:i,onConfirm:n,title:o,description:a,confirmLabel:l="Confirm",dangerous:s=!1,disabled:d=!1,p:c})=>{const[g,p]=r.useState(!1),[u,x]=r.useState(!1);return r.useEffect(()=>{if(!t)return;const e=e=>{"Escape"===e.key&&i()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,i]),t?e.jsx("div",{style:{position:"fixed",inset:0,zIndex:1100,background:c.overlayBg,display:"flex",alignItems:"center",justifyContent:"center",padding:16,backdropFilter:"blur(4px)"},children:e.jsxs("div",{style:{background:c.modalBg,border:`1px solid ${c.modalBorder}`,borderRadius:16,width:"100%",maxWidth:380,padding:"22px 24px",boxShadow:"0 32px 80px rgba(0,0,0,0.6)"},children:[e.jsx("h3",{style:{fontSize:14,fontWeight:700,color:c.modalTitleText,margin:"0 0 8px"},children:o}),e.jsx("p",{style:{fontSize:12.5,color:c.modalSubText,margin:"0 0 20px",lineHeight:1.5},children:a}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:i,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),style:{padding:"7px 16px",borderRadius:8,background:u?c.btnOutlineHoverBg:c.btnOutlineBg,border:`1px solid ${c.btnOutlineBorder}`,color:u?c.btnOutlineHoverText:c.btnOutlineText,fontSize:12,fontWeight:600,cursor:"pointer",transition:"background 150ms, color 150ms"},children:"Cancel"}),e.jsx("button",{onClick:d?void 0:n,disabled:d,onMouseEnter:()=>!d&&p(!0),onMouseLeave:()=>p(!1),style:{padding:"7px 16px",borderRadius:8,fontSize:12,fontWeight:700,cursor:d?"not-allowed":"pointer",opacity:d?.45:1,transition:"background 150ms",...s?{background:g?c.confirmDangerHoverBg:c.confirmDangerBg,border:`1px solid ${c.confirmDangerBorder}`,color:c.confirmDangerText}:{background:g?c.btnPrimaryHoverBg:c.btnPrimaryBg,border:`1px solid ${Y}`,color:c.btnPrimaryText}},children:l})]})]})}):null},X=({value:r,onValueChange:t,p:i,placeholder:n,children:o,width:a=190})=>e.jsxs(s,{value:r,onValueChange:t,children:[e.jsx(d,{style:{width:a,background:i.selectBg,border:`1px solid ${i.selectBorder}`,color:i.selectText,borderRadius:9,fontSize:12,height:34,paddingLeft:10,paddingRight:8,boxShadow:"none"},children:e.jsx(c,{placeholder:n})}),e.jsx(g,{children:o})]}),Z=({onClick:t,children:i,variant:n="outline",p:o,disabled:a=!1})=>{const[l,s]=r.useState(!1),d={display:"inline-flex",alignItems:"center",gap:5,height:30,padding:"0 10px",borderRadius:8,fontSize:11.5,fontWeight:600,cursor:a?"not-allowed":"pointer",opacity:a?.45:1,border:"1px solid transparent",transition:"background 180ms, color 180ms, border-color 180ms",outline:"none",flexShrink:0},c={primary:{background:l?o.btnPrimaryHoverBg:o.btnPrimaryBg,color:o.btnPrimaryText,border:`1px solid ${Y}`},outline:{background:l?o.btnOutlineHoverBg:o.btnOutlineBg,color:l?o.btnOutlineHoverText:o.btnOutlineText,border:`1px solid ${o.btnOutlineBorder}`},danger:{background:l?o.btnDangerHoverBg:"transparent",color:l?o.btnDangerHoverText:o.btnDangerText,border:"1px solid "+(l?"rgba(248,113,113,0.35)":"rgba(248,113,113,0.18)")}};return e.jsx("button",{onClick:a?void 0:t,disabled:a,style:{...d,...c[n]},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:i})},ee=({p:r})=>e.jsxs("div",{style:{background:r.cardBg,border:`1px solid ${r.cardBorder}`,borderRadius:14,padding:"14px 14px 12px",display:"flex",flexDirection:"column",gap:10},children:[e.jsx("style",{children:"\n @keyframes jr-shimmer { 0%{opacity:.5} 50%{opacity:1} 100%{opacity:.5} }\n .jr-shimmer { animation: jr-shimmer 1.5s ease-in-out infinite; }\n "}),e.jsx("div",{className:"jr-shimmer",style:{height:13,width:"65%",borderRadius:6,background:r.shimmerHighlight}}),e.jsx("div",{className:"jr-shimmer",style:{height:10,width:"42%",borderRadius:6,background:r.shimmerBase}}),[1,2,3].map(t=>e.jsx("div",{className:"jr-shimmer",style:{height:22,borderRadius:7,background:r.shimmerBase}},t)),e.jsx("div",{style:{display:"flex",gap:6},children:[1,2].map(t=>e.jsx("div",{className:"jr-shimmer",style:{height:28,flex:1,borderRadius:8,background:r.shimmerBase}},t))})]}),re=({role:t,p:i,onEdit:n,onToggleActive:o,onArchive:a,onDeleteRequest:l,isArchiveMode:s})=>{const[d,c]=r.useState(!1),g=t.is_active??!0,p=t.candidate_count||0;return e.jsxs("div",{onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{background:d?i.cardHoverBg:i.cardBg,border:`1px solid ${d?i.cardHoverBorder:i.cardBorder}`,boxShadow:d?i.cardHoverShadow:"none",borderRadius:14,padding:"14px 14px 12px",display:"flex",flexDirection:"column",gap:0,transition:"background 200ms, border-color 200ms, box-shadow 200ms, transform 200ms",transform:d?"translateY(-2px)":"translateY(0)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,minHeight:42},children:[e.jsx("p",{style:{fontSize:12.5,fontWeight:700,lineHeight:1.35,color:i.titleText,display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",flex:1,margin:0},children:t.title}),e.jsx("span",{style:{display:"inline-flex",alignItems:"center",fontSize:9,fontWeight:700,padding:"2px 7px",borderRadius:6,flexShrink:0,background:g?i.badgeActiveBg:i.badgeInactiveBg,color:g?i.badgeActiveText:i.badgeInactiveText,border:`1px solid ${g?i.badgeActiveBorder:i.badgeInactiveBorder}`,lineHeight:1.5},children:g?"Active":"Inactive"})]}),e.jsx("p",{style:{fontSize:10.5,color:i.subText,marginTop:3,marginBottom:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}
2,children:[t.location,t.experience_level].filter(Boolean).join(" · ")||" "}),t.hiring_manager&&e.jsxs("p",{style:{fontSize:10.5,color:i.metaText,margin:"1px 0 0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["HM: ",t.hiring_manager]}),e.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.06)",margin:"10px 0 8px"}}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[{label:"Candidates",value:p,icon:e.jsx(B,{style:{width:12,height:12,color:Y}})},{label:"Interview",value:"360°"},{label:"Duration",value:`${t.duration_minutes} min`}].map(({label:r,value:t,icon:n})=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:i.rowBg,borderRadius:7,padding:"4px 8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[n,e.jsx("span",{style:{fontSize:10.5,color:i.rowLabelText},children:r})]}),e.jsx("span",{style:{fontSize:12,fontWeight:700,color:i.rowValueText},children:t})]},r))}),e.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.06)",margin:"10px 0 8px"}}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[e.jsxs(Z,{variant:"outline",p:i,onClick:()=>n(t),children:[e.jsx(T,{style:{width:11,height:11}})," Edit"]}),e.jsx(Z,{variant:"outline",p:i,onClick:()=>o(t.id,g),children:g?"Deactivate":"Activate"}),s?e.jsxs(Z,{variant:"danger",p:i,onClick:()=>a(t.id),children:[e.jsx(j,{style:{width:11,height:11}})," Archive"]}):e.jsxs(Z,{variant:"danger",p:i,onClick:()=>l(t),children:[e.jsx(w,{style:{width:11,height:11}})," Delete"]})]})]})},te=({title:r,icon:t,roles:i,loading:n,p:o,emptyMessage:a,onEdit:l,onToggleActive:s,onArchive:d,onDeleteRequest:c,isArchiveMode:g,hideHeader:p})=>e.jsxs("section",{style:{display:"flex",flexDirection:"column",gap:12},children:[!p&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{display:"flex",alignItems:"center"},children:t}),e.jsx("h2",{style:{fontSize:14,fontWeight:700,color:o.sectionTitle,margin:0},children:r}),!n&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",fontSize:10,fontWeight:700,padding:"1px 8px",borderRadius:20,background:o.countBadgeBg,color:o.countBadgeText},children:i.length})]}),n?e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(210px, 1fr))",gap:10},children:[1,2,3,4].map(r=>e.jsx(ee,{p:o},r))}):0===i.length?e.jsx("div",{style:{background:o.emptyCardBg,border:`1px solid ${o.emptyCardBorder}`,borderRadius:12,padding:"24px 16px",textAlign:"center",color:o.emptyText,fontSize:12.5},children:a}):e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(210px, 1fr))",gap:10},children:i.map(r=>e.jsx(re,{role:r,p:o,onEdit:l,onToggleActive:s,onArchive:d,onDeleteRequest:c,isArchiveMode:g},r.id))})]}),ie=()=>{const{user:s}=n(),{corporateId:d}=o(),c=function(){const e=r.useCallback(()=>{var e;if("undefined"!=typeof document){const e=document.documentElement.getAttribute("data-theme")??document.documentElement.getAttribute("class")??"";if(e.includes("light"))return"light";if(e.includes("dark"))return"dark"}return"undefined"!=typeof window&&(null==(e=window.matchMedia)?void 0:e.call(window,"(prefers-color-scheme: light)").matches)?"light":"dark"},[]),[t,i]=r.useState(e);return r.useEffect(()=>{const r=new MutationObserver(()=>i(e()));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]}),()=>r.disconnect()},[e]),t}(),g=V[c],[p,u]=r.useState([]),[x,b]=r.useState(!0),[h,m]=r.useState(!1),[B,T]=r.useState(!1),[w,S]=r.useState(null),[k,C]=r.useState(null),[A,I]=r.useState("all"),R=r.useMemo(()=>[...new Set(p.map(e=>e.hiring_manager).filter(Boolean))].sort(),[p]),D=r.useMemo(()=>"all"===A?p:p.filter(e=>e.hiring_manager===A),[p,A]);r.useEffect(()=>{d?z():b(!1)},[d]);const z=async()=>{if(!d)return;b(!0);const{data:e,error:r}=await t.from("job_roles").select("*").eq("corporate_id",d).order("created_at",{ascending:!0});if(r)i({title:"Error",description:r.message,variant:"destructive"});else{const r=await Promise.all((e||[]).map(async e=>{const{count:r}=await t.from("candidate_profiles").select("*",{count:"exact",head:!0}).eq("job_role_id",e.id);return{...e,candidate_count:r||0}}));u(r)}b(!1)},H=r.useCallback(()=>{m(!1),z()},[d]),E=async(e,r)=>{const{error:n}=await t.from("job_roles").update({is_active:!r}).eq("id",e);n?i({title:"Error",description:n.message,variant:"destructive"}):z()},P=async e=>{const{error:r}=await t.from("job_roles").update({is_active:!1}).eq("id",e);r?i({title:"Error",description:r.message,variant:"destructive"}
2):(i({title:"Job role archived"}),z())},M=D.filter(e=>e.is_active),L=D.filter(e=>!e.is_active),q={inputBg:g.inputBg,inputBorder:g.inputBorder,inputText:g.inputText,inputPlaceholder:g.inputPlaceholder,labelText:g.labelText,toggleTrackOff:g.toggleTrackOff,toggleTrackOn:g.toggleTrackOn,toggleKnob:g.toggleKnob,uploadAreaBg:g.uploadAreaBg,uploadAreaBorder:g.uploadAreaBorder,uploadAreaText:g.uploadAreaText,sectionDivider:g.sectionDivider,btnPrimaryBg:g.btnPrimaryBg,btnPrimaryText:g.btnPrimaryText,btnPrimaryHoverBg:g.btnPrimaryHoverBg,modalBg:g.modalBg,subText:g.subText,rowBg:g.rowBg,rowLabelText:g.rowLabelText,rowValueText:g.rowValueText,cardBorder:g.cardBorder};return e.jsxs(e.Fragment,{children:[e.jsx(a,{title:"Job Roles Management | Corporate Portal",description:"Manage job roles for Hiring"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0,width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",flexWrap:"wrap",gap:12,marginBottom:18},children:[e.jsxs("div",{children:[e.jsxs("h1",{style:{fontSize:17,fontWeight:800,color:"rgba(255,255,255,0.92)",margin:0,letterSpacing:"-0.3px"},children:["Job Roles ",e.jsx("span",{style:{color:Y,fontWeight:700},children:"/ Management"})]}),e.jsx("p",{style:{fontSize:11.5,color:"rgba(255,255,255,0.40)",marginTop:2,marginBottom:0},children:"Create and manage hiring positions"})]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[R.length>0&&e.jsxs(X,{value:A,onValueChange:I,p:g,placeholder:"Hiring Manager",width:190,children:[e.jsx(l,{value:"all",children:"All Hiring Managers"}),R.map(r=>e.jsx(l,{value:r,children:r},r))]}),e.jsxs(Z,{variant:"outline",p:g,onClick:z,disabled:x,children:[e.jsx(v,{style:{width:12,height:12,...x?{animation:"spin 1s linear infinite"}:{}}}),"Refresh"]}),e.jsxs("button",{onClick:()=>m(!0),style:{display:"inline-flex",alignItems:"center",gap:6,height:34,padding:"0 14px",borderRadius:9,fontSize:12,fontWeight:700,cursor:"pointer",background:g.btnPrimaryBg,color:g.btnPrimaryText,border:`1px solid ${Y}`,transition:"background 180ms",outline:"none"},onMouseEnter:e=>{e.currentTarget.style.background=g.btnPrimaryHoverBg},onMouseLeave:e=>{e.currentTarget.style.background=g.btnPrimaryBg},children:[e.jsx(f,{style:{width:13,height:13}}),"Create Job Role"]})]})]}),e.jsx("div",{style:{height:1,background:g.divider,marginBottom:20}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx(y,{style:{width:15,height:15,color:g.sectionIconActive}}),e.jsx("h2",{style:{fontSize:14,fontWeight:700,color:g.sectionTitle,margin:0},children:"Active Job Roles"}),!x&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",fontSize:10,fontWeight:700,padding:"1px 8px",borderRadius:20,background:g.countBadgeBg,color:g.countBadgeText},children:M.length})]}),e.jsx(te,{title:"Active Job Roles",icon:e.jsx(y,{style:{width:15,height:15,color:g.sectionIconActive}}),roles:M,loading:x,p:g,emptyMessage:"No active job roles. Create one to start inviting candidates.",onEdit:e=>{S(e),T(!0)},onToggleActive:E,onArchive:P,onDeleteRequest:C,isArchiveMode:!0,hideHeader:!0}),e.jsx("div",{style:{height:1,background:g.divider,margin:"20px 0"}}),e.jsx(te,{title:"Inactive / Archived Roles",icon:e.jsx(j,{style:{width:15,height:15,color:g.sectionIconInact}}),roles:L,loading:x,p:g,emptyMessage:"No inactive roles.",onEdit:e=>{S(e),T(!0)},onToggleActive:E,onArchive:P,onDeleteRequest:C,isArchiveMode:!1}),e.jsx("div",{style:{height:16}})]}),e.jsx(Q,{open:h,onClose:()=>m(!1),title:"Create New Job Role",p:g,wide:!0,children:e.jsx(_,{corporateId:d,userId:null==s?void 0:s.id,onCreated:H,palette:q})}),e.jsx(Q,{open:B,onClose:()=>{T(!1),S(null)},title:"Edit Job Role",p:g,wide:!0,children:w&&e.jsx(N,{jobRole:w,onUpdated:()=>{T(!1),S(null),z()},palette:q})}),e.jsx(G,{open:!!k,onClose:()=>C(null),onConfirm:async()=>{if(!k)return;if((k.candidate_count||0)>0)return i({title:"Cannot delete",description:"Remove all candidates first.",variant:"destructive"}),void C(null);const{error:e}=await t.from("job_roles").delete().eq("id",k.id);e?i({title:"Error",description:e.message,variant:"destructive"}):(i({title:"Job role permanently deleted"}),z()),C(null)},title:`Permanently delete "${null==k?void 0:k.title}
2"?`,description:((null==k?void 0:k.candidate_count)||0)>0?`This role has ${null==k?void 0:k.candidate_count} candidate(s). Remove all candidates before deleting.`:"This action cannot be undone. The job role will be permanently removed.",confirmLabel:"Delete Permanently",dangerous:!0,disabled:((null==k?void 0:k.candidate_count)||0)>0,p:g}),e.jsx("style",{children:"@keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }"})]})};export{ie 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.