1import{u as re,t as oe,b as g,a2 as ae,c,h as w,a5 as ne,aa as D,af as $,ae as P,bz as ce,j as t,e as q,a3 as A,bC as L,fr as de,bD as ue,gz as pe,bA as me,bw as be,bx as xe}from"./index-B9q78oLf.js";import{N as fe}from"./NextBtn-ePTLzLbY.js";import{B as he}from"./BackBtn-xtlpGWC4.js";import{S as ye}from"./SearchInputField-Xu2MeW4L.js";import{S as je}from"./SeachSkillInput-g_ejobd5.js";import{P as _e}from"./PostJobHeader-3aTMWW-u.js";import{C as ge}from"./index.esm-IK5lBCPW.js";import"./index.esm-Bhgyfkla.js";const Je=()=>{const v=re(),S=oe(),h=g(e=>e.auth.token),l=g(e=>e.postJobData),V=g(e=>e.postjobIndustry.industry),y=ae(),[k,B]=c.useState(0),[N,G]=c.useState(0),[j,_]=c.useState(!1),[M,F]=c.useState([]),[U,z]=c.useState([]),[O,W]=w.useState(!1),[K,we]=w.useState(!1),[u,R]=w.useState(!!(l?.jd_url&&l?.jd_url?.includes("pdf")||y?.state?.item?.jd_url?.includes("pdf"))),[ve,Se]=c.useState(""),s=y?.state?.item,[Q,H]=c.useState(!1),i=ne({initialValues:{job_title:{id:"",title:"",UserGenerated:!1},roles_responsibilities:"",skills:[],keywords:[]},validationSchema:D({job_title:D({title:P().required("Required")}).required("Required"),roles_responsibilities:P().min(100,"Roles and Responsibilty must have 100 characters").required("Required"),skills:$().min(1,"Minimum 1 skill required"),keywords:$().max(3,"Maximum 3 Keywords")}),onSubmit:e=>{!O&&!K&&(S(pe(e)),v("/employer/post-job/job-details"))},enableReinitialize:!0}),T=()=>{H(e=>!e)},I={toolbar:[["bold","italic","underline"],[{list:"bullet"}]]},X=e=>{if(typeof e=="object"){i.setFieldValue("job_title",e);return}const r={id:e?.id?e.id:"",title:e?.title?e.title:e,UserGenerated:!1};i.setFieldValue("job_title",r)},Y=e=>{const r=Array.isArray(i.values.skills)?i.values.skills:[],o=r.some(a=>a.name===e.name);let n;o?n=r.filter(a=>a.name!==e.name):n=[...r,e],i.setFieldValue("skills",n)},b=c.useRef(null),Z=e=>{k!==0&&clearTimeout(k);const r=setTimeout(()=>te(e),250);B(r)},ee=e=>{N!==0&&clearTimeout(N);const r=setTimeout(()=>se(e),250);G(r)},te=async e=>{try{const r=l?.industry?.id||l?.industry,o=await me(e,r,h);if(o?.data==null){F([]);return}else{const n=o.data?.filter(a=>{a.title!=e});F(o?.data)}}catch(r){console.error("Error:",r)}},se=async e=>{try{const r=await be(e,h),o=await xe(e,h);z(r?.data&&o?.data?[...r?.data,...o?.data?.data]:[])}catch(r){console.log(r,"ERROR")}};c.useEffect(()=>{if(l){const{job_title:e={id:"",title:"",user_generated:!1},roles:r="",skills:o=[],keywords:n=[]}=l,a={id:e?.id||"",title:e?.title||"",UserGenerated:e?.user_generated||!1};console.log(a,"-------");const x=Array.isArray(o)?o:[];i.setFieldValue("job_title",a),i.setFieldValue("roles_responsibilities",l?.roles),i.setFieldValue("skills",x),i.setFieldValue("keywords",n||[])}},[l]),c.useMemo(()=>{const e=i.values?.job_title?.title;Z(e),ee(e)},[i?.values?.job_title?.title]),c.useEffect(()=>{if(s?.id){const r=s?.keywords?.mandatory?.map(d=>({name:d})),o={id:"147d3656-bdb9-4d9a-9ec5-e5888be55e64",country_id:"d797732d-1ca2-4e60-8ea3-a4f835bd10c1",code:"USD"},n=d=>d<100?d*1e5:d,a=parseInt(s?.expected_salary?.min||0),x=parseInt(s?.expected_salary?.max||0),f=n(a).toString(),m=n(x).toString(),p={id:s?.id,job_title:s?.job_title,is_basic_job:s?.is_basic_job,is_draft:s?.is_draft,is_private:s?.is_private,roles:s?.roles,jd_url:s?.jd_url,skills:s?.skills,company:s?.company?.id,industry:s?.industry||V.id,industry_sub_domain:s?.industry?.title,employment_mode:s?.employment_mode,job_location:{id:s?.job_location?.id||"",city:s?.job_location?.name||"",state:s?.job_location?.state||"",country:s?.job_location?.country||""},job_type:s?.job_type,vacancies:parseInt(s.vacancies),job_space:s?.job_space,qualification_level:s?.qualification_level,qualification:s?.qualification,field_of_study:s?.fields_of_study,required_exp:s?.required_exp,salary_type:s?.salary_type,currency:s?.currency!==null?s?.currency:o,expected_salary:{visibility:s?.expected_salary?.visibility===!1},min_expected_salary:{id:s?.currency?.code==="INR"?f:s?.expected_salary?.min,salary:s?.currency?.code==="INR"?f:s?.expected_salary?.min},max_expected_salary:{id:s?.currency?.code==="INR"?m:s?.expected_salary?.max,salary:s?.currency?.code==="INR"?m:s?.expected_salary?.max},availability:s?.availability,is_edit:!0,keywords:r,field_of_study_pref:s?.f
1ield_of_study_pref,from_location_only:s?.from_location_only,include_relocation:s?.include_relocation,country:s?.country_details,is_international:s?.is_international};S(ce(p))}},[s]),c.useEffect(()=>{l?.id},[]);const ie=e=>{e.key==="Enter"&&e.preventDefault()},C=e=>{i.setFieldValue("roles_responsibilities",e)},E=(e,r)=>{if(!e||!r){console.log("Title or sector is empty. Skipping AI job description fetch.");return}i.values.roles_responsibilities="",console.log("Fetching AI job description..."),_(!0);let o=i.values.roles_responsibilities||"";const n=[];let a=!1;const x=()=>{for(;n.length>0;){_(!0);let p=n.shift();p=p.replace(/\n/g,"<br />"),o+=p;const d=b.current?b.current.getEditor().root.scrollTop:0;i.setFieldValue("roles_responsibilities",o),b.current&&(b.current.getEditor().root.scrollTop=d)}a=!1},f=new URLSearchParams({title:e}),m=new EventSource(`https://api.avua.com/autofill/external/v1/roles-responsiblities-stream?${f.toString()}`);m.onmessage=p=>{const d=JSON.parse(p.data),J=d.choices[0]?.delta?.content;J&&(n.push(J),a||(a=!0,x())),d.choices[0]?.finish_reason==="stop"&&(o=o.replace(/-\s\*\*(.+?)\*\*/g,"**$1**").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/(\<br\s*\/?\>)\s*-\s/g,"$1 ⢠"),i.setFieldValue("roles_responsibilities",o),m.close(),_(!1))},m.onerror=p=>{m.close(),console.log("Error in fetching job description:",p)}},le=e=>!e||typeof e!="string"?(console.log("Description is empty or invalid:",e),""):e.replace(/\n/g,"<br>").replace(/-\s\*\*(.+?)\*\*/g,"**$1**").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/(\<br\s*\/?\>)\s*-\s/g,"$1 ⢠");return t.jsxs("div",{className:"w-full h-screen",children:[t.jsx(_e,{saveJobPost:!1}),t.jsx("div",{className:"flex flex-col justify-start items-center h-fit w-full px-5",children:t.jsxs("form",{onSubmit:i.handleSubmit,onkeyup:ie,style:{height:"calc(100% - 100px)"},className:"flex flex-col text-[#000000] py-5 md:py-8 rounded-lg my-10 max-w-7xl w-full justify-center",children:[t.jsxs("div",{className:"w-full flex flex-col md:flex-row",children:[t.jsxs("div",{className:"w-full pr-0 sm:pr-5",children:[t.jsxs("p",{className:"font-poppins text-h5 md:text-h3 font-[500]",children:["Lets Start with a strong title"," "]}),t.jsx("p",{className:"text-caption md:text-body1 ",children:"Tip: Choose a standard job title. It helps the algorithm to identify candidates with similar job roles."})]}),t.jsxs("div",{className:`w-full flex flex-col space-y-4 ${u?"":l?.jd_url?"gap-[20px]":""}`,children:[t.jsx(ye,{name:"job_title",label:"Job Title",customClass:u&&l?.jd_url?"mb-[20px]":"",placeholder:"Enter Job Title",onChange:X,value:i.values?.job_title?.title||"",error:i.touched.job_title?.title&&i.errors.job_title?.title,onBlur:i.handleBlur,querySearchResults:M,mandatory:!0}),t.jsxs("div",{className:`w-full ${u?"h-auto":"h-[250px]"} relative flex flex-col items-center `,children:[t.jsxs("label",{htmlFor:"roles_responsibilities",className:"w-full text-start text-subtitle2 font-poppins flex justify-between items-center font-[500]",children:[t.jsxs("p",{className:"flex justify-center items-center",children:[" ","Roles & Responsibilities"]}),t.jsx("p",{className:"text-red text-[10px]",children:"min 100 characters *"})]}),!!l?.jd_url?.length&&l?.jd_url.includes("pdf")&&t.jsxs("div",{className:"w-full flex gap-[40px] border-b-[1px] border-[#A2A1A833] font-poppins font-[500] text-[14px] leading-[22px] mb-[10px] pt-[10px]",children:[t.jsx("div",{className:`${u?"border-b-[4px] border-black cursor-pointer":" cursor-pointer"}`,onClick:()=>{R(!0)},children:"Uploaded JD"}),t.jsx("div",{className:`${u?"cursor-pointer":"border-b-[4px] border-black cursor-pointer"}`,onClick:()=>{R(!1)},children:"Parsed details"})]}),!u&&t.jsxs(t.Fragment,{children:[Q?t.jsx("div",{className:"fixed inset-0 backdrop-blur-md flex justify-center shadow-lg z-50",children:t.jsxs("div",{className:"relative bg-[#F8F9FE] rounded-[10px] shadow-md md:w-[60%] w-[95%] md:mt-[60px] mt-[20px] mb-[20px] overflow-y-scroll scrollbar-none",children:[t.jsxs("div",{className:"flex justify-between w-full items-center",children:[t.jsxs("p",{className:"flex items-center font-poppins md:text-h5 text-h6 font-[500] p-[10px]",children:[" ","Roles & Responsibilities"]}),t.jsx("button",{title:"Exit Full Screen",onClick:T,className:"text-[20px] rounded-sm bg-[#ffffff] border border-[#d9d9d9] mr-[10px]",children:t.jsx(ge,{color:"#7b7b7b"})})]}),t.jsx(q,{ref:b,style:{height:"100%",width:"100%",wordBreak:""},theme:"snow",id:"roles_responsibilities",name:"roles_responsibilities",className:" bg-white pb-[40px]",placeholder:"Enter Roles & Responsibilities",onChange:e=>C(e),value:i.values.roles_responsibilities,modules:I}),t.jsx("button",{type:"button",className:"absolute md:top-[60px] top-[56px] right-2 flex justify-center items-center h-fit w-[120px] text-purple bg-lightPurple roun
1ded-md p-1 space-x-1 cursor-pointer hover:scale-[102%] active:scale-100 transition-all duration-300 text-caption",children:j?t.jsxs("div",{className:"flex w-fit justify-center items-center space-x-1",children:[t.jsx("p",{children:"Generating"}),t.jsx(A,{color:"#604289",height:15,width:15,strokeWidth:5})]}):t.jsxs("div",{className:"flex w-fit justify-center items-center space-x-1",onClick:()=>E(i.values.job_title.title,l?.industry?.title),children:[t.jsx(L,{}),t.jsx("p",{children:"Generate with AI"})]})})]})}):t.jsx(q,{ref:b,style:{height:"180px",width:"100%",wordBreak:""},theme:"snow",id:"roles_responsibilities",name:"roles_responsibilities",className:"mt-2 ",placeholder:"Enter Roles & Responsibilities",onChange:e=>C(e),value:le(i.values.roles_responsibilities),modules:I}),t.jsx("button",{title:"Maximize to Full Screen",type:"button",onClick:T,className:`absolute right-6 rounded-sm ${l?.jd_url&&l?.jd_url.includes("pdf")&&!u?" bottom-[-35px]":"bottom-2"} bg-[] border border-[#d9d9d9]`,children:t.jsx(de,{color:"#7b7b7b"})}),t.jsx("button",{type:"button",className:`absolute ${l?.jd_url&&l?.jd_url.includes("pdf")&&!u?"top-[85px]":"top-[38px]"} right-2 flex justify-center items-center h-fit w-[140px] text-purple bg-lightPurple rounded-md p-1 space-x-1 cursor-pointer hover:scale-[102%] active:scale-100 transition-all duration-300 text-caption`,children:j?t.jsxs("div",{className:"flex w-fit justify-center items-center space-x-1",children:[t.jsx("p",{children:"Generating"}),t.jsx(A,{color:"#604289",height:15,width:15,strokeWidth:5})]}):t.jsxs("div",{className:"flex w-fit justify-center items-center space-x-1",onClick:()=>E(i.values.job_title.title,l?.industry?.title),children:[t.jsx(L,{}),t.jsx("p",{children:"Generate with AI"})]})})]})]}),l?.jd_url&&l?.jd_url.includes("pdf")&&u&&t.jsx("div",{className:"border-[2px] border-lightGray",children:t.jsx("iframe",{title:"PDF Viewer",src:"application/pdf".includes(l?.jd_url?.split(".")?.[l?.jd_url?.split(".")?.length-1])?l?.jd_url:`https://docs.google.com/gview?url=${l?.jd_url}&embedded=true`,style:{width:"100%",height:"225px",border:"none"},allowFullScreen:!0,className:"border-[3px] border-black"})}),t.jsx("div",{className:"flex justify-between",children:t.jsx("p",{className:"text-caption text-red w-fit",children:i.touched.roles_responsibilities&&i.errors.roles_responsibilities})}),t.jsxs("div",{children:[t.jsx(je,{suggestedSkills:U,skills:i.values.skills,onSkillChange:Y,setSkillInputFocus:W,maxItems:30,postJob:!0}),t.jsx("p",{className:"text-caption text-red",children:i.touched.skills&&i.errors.skills})]})]})]}),t.jsxs("div",{className:"ml-auto flex space-x-2 mt-5 ",children:[y?.state?.showHide&&t.jsx(he,{handlePrevPage:()=>{v("/employer/post-job/get-started",{state:{is_basic_job:!!l?.is_basic_job}})}}),j?t.jsx("div",{className:"flex justify-center items-center ",children:t.jsx(ue,{visible:!0,height:"70",width:"100",color:"#4fa94d",ariaLabel:"line-wave-loading",wrapperStyle:{marginTop:"-30px"},wrapperClass:"",firstLineColor:"purple",middleLineColor:"purple",lastLineColor:"purple"})}):t.jsx(fe,{type:"submit"})]})]})})]})};export{Je as default}; 2//# sourceMappingURL=JobTitle-9Gykgj0S.js.map
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.