"use strict";(()=>{var e={};e.id=7054,e.ids=[7054],e.modules={72934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},27790:e=>{e.exports=require("assert")},78893:e=>{e.exports=require("buffer")},84770:e=>{e.exports=require("crypto")},17702:e=>{e.exports=require("events")},92048:e=>{e.exports=require("fs")},32615:e=>{e.exports=require("http")},35240:e=>{e.exports=require("https")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},86624:e=>{e.exports=require("querystring")},17360:e=>{e.exports=require("url")},21764:e=>{e.exports=require("util")},71568:e=>{e.exports=require("zlib")},92761:e=>{e.exports=require("node:async_hooks")},17718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},15673:e=>{e.exports=require("node:events")},87561:e=>{e.exports=require("node:fs")},93977:e=>{e.exports=require("node:fs/promises")},70612:e=>{e.exports=require("node:os")},49411:e=>{e.exports=require("node:path")},97742:e=>{e.exports=require("node:process")},25997:e=>{e.exports=require("node:tty")},47261:e=>{e.exports=require("node:util")},67412:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>j,patchFetch:()=>T,requestAsyncStorage:()=>k,routeModule:()=>x,serverHooks:()=>S,staticGenerationAsyncStorage:()=>v});var n={};r.r(n),r.d(n,{POST:()=>w,dynamic:()=>f,maxDuration:()=>y});var o=r(49790),a=r(60540),i=r(82273),s=r(19096),l=r(27489),c=r(64451),p=r(92795),d=r(4355),u=r(20237),m=r(3896);let f="force-dynamic",y=60;async function h(e){try{let t=await fetch(e,{redirect:"follow",headers:{"User-Agent":"Mozilla/5.0 (compatible; HyreMeBot/1.0; +https://hyreme.app)",Accept:"text/html,application/xhtml+xml"}});if(!t.ok)return"";return(await t.text()).replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<noscript[\s\S]*?<\/noscript>/gi," ").replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,2e4)}catch(e){return console.error("fetch page err",e),""}}let g={name:"job_extract",strict:!0,schema:{type:"object",additionalProperties:!1,properties:{title:{type:"string"},company:{type:"string"},location:{type:"string"},description:{type:"string"},requirements:{type:"array",items:{type:"string"}},keywords:{type:"array",items:{type:"string"}}},required:["title","company","location","description","requirements","keywords"]}};async function b(e,t,r){let n=(0,u.D)(),o={fullName:r?.fullName,email:r?.email,phone:r?.phone,location:r?.location,linkedinUrl:r?.linkedinUrl,websiteUrl:r?.websiteUrl,summary:r?.summary,skills:r?.skills,experience:r?.experience,education:r?.education,certifications:r?.certifications,projects:r?.projects,languages:r?.languages},a=await (0,m.g5)("job_analyze_system",{currentDate:n}),i=`Analyze fit between the candidate resume and the job listing below. The current date is ${n}.

Return in this exact format:

FIT SCORE: <0-100>/100

OVERVIEW:
Short paragraph summary.

STRENGTHS:
- ...

GAPS:
- ...

RECRUITER INSIGHTS:
- ...

TOP KEYWORDS TO ADD:
- ...

TAILORING RECOMMENDATIONS:
1. ...

JOB LISTING:
Title: ${t?.title}
Company: ${t?.company}
Location: ${t?.location}
Description:
${t?.description}

CANDIDATE PROFILE (JSON):
${JSON.stringify(o,null,2)}`,s=await (0,d.cp)(e,{messages:[{role:"system",content:a},{role:"user",content:i}],maxTokens:2500}),l=s.match(/FIT\s*SCORE\s*:\s*(\d{1,3})/i),c=l?Math.min(100,parseInt(l[1],10)):null;return await p._.jobListing.update({where:{id:t.id},data:{fitScore:c,fitAnalysis:s}}),{score:c,fullText:s}}async function w(e){let t=await (0,l.getServerSession)(c.L),r=t?.user?.id;if(!r)return s.NextResponse.json({error:"Unauthorized"},{status:401});try{let t;let{url:n,pastedText:o}=await e.json();if(!n&&!o)return s.NextResponse.json({error:"Provide url or pastedText"},{status:400});let a=o||"";if(!a&&n&&(a=await h(n)),!a||a.length<80)return s.NextResponse.json({error:function(e){let t=String(e||"").toLowerCase();return t.includes("linkedin.com")?"LinkedIn usually blocks automated page reads. Paste the job description text and keep the URL for reference.":t.includes("indeed.com")?"Indeed often serves anti-bot pages instead of the real listing. Paste the description text from the listing page and keep the URL for reference.":"Some job boards block automated reads. Paste the description text to continue while keeping the URL for reference."}(n),needPaste:!0,blockedUrl:n||""},{status:422});try{let e=await (0,m.g5)("job_ingest_extract_system");t=await (0,d.cp)(r,{messages:[{role:"system",content:e},{role:"user",content:`Source URL: ${n||"(pasted)"}

JOB PAGE TEXT:
${a.slice(0,18e3)}`}],maxTokens:2500,jsonSchema:g})}catch(t){if(t instanceof d.Q7)return s.NextResponse.json({error:t.message,code:t.code},{status:400});let e=(0,d.Cw)(t,"The AI provider could not parse the job listing.");return console.error("job ingest llm err",e,t),s.NextResponse.json({error:`Failed to parse job listing: ${e}`},{status:500})}let i={};try{i=JSON.parse(t||"{}")}catch{i={}}let l=await p._.jobListing.create({data:{userId:r,url:n||"",title:i?.title??"",company:i?.company??"",location:i?.location??"",rawContent:a.slice(0,15e3),description:i?.description??""}}),c=await p._.profile.findUnique({where:{userId:r}}),u=null,f=null;if(c)try{let e=await b(r,{id:l.id,title:l.title,company:l.company,location:l.location,description:l.description},c);u=e.score,f=e.fullText}catch(e){if(e instanceof d.Q7)return s.NextResponse.json({error:e.message,code:e.code},{status:400});console.error("job ingest analyze err",(0,d.Cw)(e,"The AI provider failed during fit analysis."),e)}return s.NextResponse.json({id:l.id,title:l.title,company:l.company,location:l.location,keywords:i?.keywords??[],requirements:i?.requirements??[],fitScore:u,fitAnalysis:f})}catch(e){return console.error("job ingest err",e),s.NextResponse.json({error:"Failed to ingest job listing"},{status:500})}}let x=new o.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/job/ingest/route",pathname:"/api/job/ingest",filename:"route",bundlePath:"app/api/job/ingest/route"},resolvedPagePath:"/Users/andrasgyenes/Desktop/MrQuery 2026/HyreMe/Archive/hyreme-app/app/api/job/ingest/route.ts",nextConfigOutput:"standalone",userland:n}),{requestAsyncStorage:k,staticGenerationAsyncStorage:v,serverHooks:S}=x,j="/api/job/ingest/route";function T(){return(0,i.patchFetch)({serverHooks:S,staticGenerationAsyncStorage:v})}},20237:(e,t,r)=>{r.d(t,{D:()=>n});function n(e="America/Toronto"){return new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"long",day:"numeric"}).format(new Date)}},15259:(e,t,r)=>{r.d(t,{ef:()=>a,u7:()=>n});let n=[{key:"profile_analyze_system",label:"Profile: ATS Analysis",description:"System prompt for resume profile analysis and scoring.",defaultContent:'You are an expert resume optimization reviewer focused on recruiter readability and ATS compatibility. Today\'s date is {{currentDate}}. Assess resumes based on standard section headers, keyword richness, action verbs, quantified achievements, reverse-chronological experience, skills relevance, formatting simplicity, contact info, spelling, and job title alignment. Treat any populated websiteUrl as the candidate portfolio and any populated linkedinUrl as the LinkedIn profile. Do not claim either is missing when it is present in the provided profile JSON. When reviewing chronology, use {{currentDate}} as the current date and do not call dates in 2026 "future" unless they are actually after {{currentDate}}. Do not tell the user to merge roles at the same company when the titles are different and the entries are not exact duplicates. Only call out duplicate roles when title, company, dates, and bullets are materially the same. Complete every required section. If you need to save tokens, shorten bullets rather than omitting a section.'},{key:"profile_rewrite_score_system",label:"Profile: Rewrite Scoring",description:"System prompt that scores the current profile before and after rewrites.",defaultContent:"You are an ATS evaluator. Today's date is {{currentDate}}. Score a resume profile from 0 to 100 for ATS effectiveness. Treat websiteUrl as the candidate portfolio when present. Do not claim a portfolio or LinkedIn profile is missing if the field is populated. When assessing chronology, use {{currentDate}} as the current date. Return JSON only."},{key:"profile_rewrite_system",label:"Profile: Rewrite",description:"System prompt for ATS-focused profile rewriting.",defaultContent:"You are an elite resume writer optimizing for modern ATS and recruiters. Today's date is {{currentDate}}. Rewrite the candidate's summary, skills, experience bullets, and projects to be highly ATS-friendly: strong action verbs, quantified achievements (numbers, percentages, $), industry keywords, single-column plain text, no symbols or emojis. Preserve truthful facts-only reword, never invent roles or metrics not implied. Use {{currentDate}} as the current date if chronology is relevant. Return JSON only."},{key:"profile_parse_pdf_system",label:"Profile: PDF Parse",description:"System prompt for refining resume PDF parsing into structured JSON.",defaultContent:"You are an expert resume parser. Extract the resume into structured JSON. Preserve every role, school, project, certification, language, and hard skill you can find. Do not summarize away jobs. Capture portfolio/website URL when present. Prefer experience titles such as Frontend Designer, Creative Lead, Design Lead, Lead UX Designer, and Art Director when they appear before a dash. Move certificates or exams out of education into certifications. Normalize dates to YYYY-MM when possible. Return JSON only."},{key:"profile_import_linkedin_system",label:"Profile: LinkedIn Import",description:"System prompt for turning public LinkedIn text into structured resume data.",defaultContent:"You are an expert profile parser. Extract a LinkedIn profile into structured resume JSON. Preserve all roles, companies, dates, education, projects, certifications, languages, and skills you can find. If contact data or portfolio links are absent from the page text, leave them blank rather than inventing them. Return JSON only."},{key:"job_analyze_system",label:"Job Match: ATS Analysis",description:"System prompt for ATS fit analysis between profile and job listing.",defaultContent:"You are a senior recruiter and ATS expert. Today's date is {{currentDate}}. Using your knowledge of current recruiter preferences for the job's field and location, evaluate how well a candidate's resume fits a specific job listing. Be practical and honest. Reference typical expectations for this role and region. Treat websiteUrl as the candidate portfolio when present. When judging chronology, use {{currentDate}} as the current date and do not mark 2026 dates as future unless they are actually after {{currentDate}}. Do not recommend merging roles at the same company unless the title, dates, and accomplishments are materially identical duplicates."},{key:"job_ingest_extract_system",label:"Job Match: Job Parse",description:"System prompt for extracting structured job data from raw listing text.",defaultContent:"Extract job listing structured data from raw text. Be accurate with title, company and location. Description should be the core job description cleaned up. Requirements should be clear bullet strings. Keywords should be ATS-relevant skills, technologies, and recruiter search terms."},{key:"job_tailor_system",label:"Job Match: Tailored CV",description:"System prompt for tailoring the resume/CV to a specific job listing.",defaultContent:"You are an elite resume writer and recruiter. Tailor a candidate's resume to perfectly fit a target job listing. Optimize for ATS: use the role's exact keywords, strong action verbs, quantified achievements. Preserve all truthful facts. Do not invent employers, roles, or metrics not present in the source. Also write a tailored, human, 3-4 paragraph cover letter body. Return JSON only."},{key:"job_cover_letter_system",label:"Job Match: Cover Letter Fallback",description:"System prompt for regenerating a complete cover letter when the first pass is incomplete.",defaultContent:"You are an expert cover letter writer. Write a complete, polished, truthful cover letter body only. Use 4 full paragraphs, tailored to the target role, with no markdown, no JSON, and no surrounding explanation. Include a greeting in the first paragraph and a professional closing sentence in the final paragraph. Preserve the candidate facts only."}],o=new Map(n.map(e=>[e.key,e]));function a(e){let t=o.get(e);if(!t)throw Error(`Unknown prompt key: ${e}`);return t}},3896:(e,t,r)=>{r.d(t,{Wm:()=>p,cB:()=>s,dk:()=>l,g5:()=>c,ue:()=>d});var n=r(92795),o=r(15259);async function a(e){let t=(0,o.ef)(e),r=await n._.promptTemplate.findUnique({where:{key:e}});if(r){let o={};return(r.label!==t.label&&(o.label=t.label),r.description!==t.description&&(o.description=t.description),r.defaultContent!==t.defaultContent&&(o.defaultContent=t.defaultContent),Object.keys(o).length)?n._.promptTemplate.update({where:{key:e},data:o}):r}let a=await n._.promptTemplate.create({data:{key:t.key,label:t.label,description:t.description,defaultContent:t.defaultContent,activeContent:t.defaultContent}});return await n._.promptTemplateVersion.create({data:{promptKey:t.key,version:1,content:t.defaultContent,updatedBy:"system-default"}}),a}async function i(){for(let e of o.u7)await a(e.key)}async function s(){return await i(),await n._.promptTemplate.findMany({orderBy:{label:"asc"}})}async function l(e){return{prompt:await a(e),versions:await n._.promptTemplateVersion.findMany({where:{promptKey:e},orderBy:{version:"desc"}})}}async function c(e,t={}){let r=await a(e);return String(r.activeContent||r.defaultContent||"").replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(e,r)=>{let n=t[r];return null==n?"":String(n)})}async function p(e,t,r){let o=String(t||"").trim();if(!o)throw Error("Prompt content cannot be empty.");await a(e);let i=await n._.promptTemplateVersion.findMany({where:{promptKey:e},orderBy:{version:"desc"},take:1}),s=Number(i?.[0]?.version||0)+1,l=await n._.promptTemplate.update({where:{key:e},data:{activeContent:o}});return await n._.promptTemplateVersion.create({data:{promptKey:e,version:s,content:o,updatedBy:r||"admin"}}),l}async function d(e,t){let r=(0,o.ef)(e);return p(e,r.defaultContent,t||"admin-reset")}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[9085,400,8664,7764,2795,7486],()=>r(67412));module.exports=n})();