"use strict";(()=>{var e={};e.id=9155,e.ids=[9155],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")},62060:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>N,patchFetch:()=>D,requestAsyncStorage:()=>k,routeModule:()=>S,serverHooks:()=>j,staticGenerationAsyncStorage:()=>v});var n={};r.r(n),r.d(n,{POST:()=>x,dynamic:()=>y,maxDuration:()=>h});var i=r(49790),a=r(60540),o=r(82273),s=r(19096),l=r(27489),u=r(64451),c=r(92795),p=r(4355),d=r(71281),m=r(10274),f=r(20237),g=r(3896);let y="force-dynamic",h=120;function b(e){let t=String(e||"").trim();if(!t)return{};try{return JSON.parse(t)}catch{let e=t.match(/```(?:json)?\s*([\s\S]*?)```/i);if(e?.[1])try{return JSON.parse(e[1].trim())}catch{}return{}}}async function w(e,t){let r=(0,f.D)(),n=await (0,g.g5)("profile_rewrite_score_system",{currentDate:r}),i=b(await (0,p.cp)(e,{messages:[{role:"system",content:`${n}

Return only a valid JSON object with this shape: {"score": 0-100 integer, "reasoning": "short explanation"}`},{role:"user",content:`Score this profile for ATS effectiveness. The current date is ${r}. Return only the numeric ATS score and short reasoning.

PROFILE JSON:
${JSON.stringify({fullName:t?.fullName??"",email:t?.email??"",phone:t?.phone??"",location:t?.location??"",linkedinUrl:t?.linkedinUrl??"",websiteUrl:t?.websiteUrl??"",summary:t?.summary??"",skills:t?.skills??[],experience:t?.experience??[],education:t?.education??[],certifications:t?.certifications??[],projects:t?.projects??[],languages:t?.languages??[]},null,2)}`}],maxTokens:500})),a=Number(i?.score);return Number.isFinite(a)?Math.max(0,Math.min(100,Math.round(a))):0}async function x(){let e;let t=await (0,l.getServerSession)(u.L),r=t?.user?.id;if(!r)return s.NextResponse.json({error:"Unauthorized"},{status:401});let n=await c._.profile.findUnique({where:{userId:r}});if(!n)return s.NextResponse.json({error:"No profile"},{status:404});let i=(0,f.D)(),a=JSON.stringify({summary:n?.summary,skills:n?.skills,experience:n?.experience,projects:n?.projects},null,2);try{let t=await (0,g.g5)("profile_rewrite_system",{currentDate:i});e=await (0,p.cp)(r,{messages:[{role:"system",content:`${t}

Return only a valid JSON object with this shape: {"summary":"string","skills":[{"name":"string","level":"string"}],"experience":[{"title":"string","company":"string","location":"string","startDate":"string","endDate":"string","current":true,"bullets":["string"]}],"projects":[{"name":"string","description":"string","link":"string","bullets":["string"]}],"notes":"string"}`},{role:"user",content:`Rewrite this profile for maximum ATS score. The current date is ${i}. Keep the same roles and dates. Return JSON only.

Profile:
${a}`}],maxTokens:3500})}catch(e){if(e instanceof p.Q7)return s.NextResponse.json({error:e.message,code:e.code},{status:400});return console.error("rewrite err",e?.message),s.NextResponse.json({error:"Rewrite failed: "+(e?.message||"unknown")},{status:500})}let o=b(e),y=(0,m.X4)({fullName:n.fullName??"",email:n.email??"",phone:n.phone??"",location:n.location??"",linkedinUrl:n.linkedinUrl??"",websiteUrl:n.websiteUrl??"",summary:o?.summary??n.summary??"",skills:o?.skills??n.skills??[],experience:o?.experience??n.experience??[],education:n.education??[],certifications:n.certifications??[],projects:o?.projects??n.projects??[],languages:n.languages??[],atsScore:n.atsScore??null,lastAnalysis:n.lastAnalysis??null}),h="number"==typeof n.atsScore?n.atsScore:null;null==h&&(h=await w(r,n));let x=await w(r,y);if(x<=h)return s.NextResponse.json({ok:!0,applied:!1,message:"No significant upgrades could be applied without reducing the current ATS score.",baselineScore:h,candidateScore:x,notes:o?.notes??""});await (0,d.gX)(r,{fullName:n.fullName??"",email:n.email??"",phone:n.phone??"",location:n.location??"",linkedinUrl:n.linkedinUrl??"",websiteUrl:n.websiteUrl??"",summary:n.summary??"",skills:n.skills??[],experience:n.experience??[],education:n.education??[],certifications:n.certifications??[],projects:n.projects??[],languages:n.languages??[],atsScore:n.atsScore??null,lastAnalysis:n.lastAnalysis??null});let S=await c._.profile.update({where:{userId:r},data:{summary:y.summary,skills:y.skills,experience:y.experience,projects:y.projects,atsScore:x}});return s.NextResponse.json({ok:!0,applied:!0,notes:o?.notes??"",profile:(0,m.X4)(S),baselineScore:h,candidateScore:x,message:"Rewrite applied with an improved ATS score."})}let S=new i.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/profile/rewrite/route",pathname:"/api/profile/rewrite",filename:"route",bundlePath:"app/api/profile/rewrite/route"},resolvedPagePath:"/Users/andrasgyenes/Desktop/MrQuery 2026/HyreMe/Archive/hyreme-app/app/api/profile/rewrite/route.ts",nextConfigOutput:"standalone",userland:n}),{requestAsyncStorage:k,staticGenerationAsyncStorage:v,serverHooks:j}=S,N="/api/profile/rewrite/route";function D(){return(0,o.patchFetch)({serverHooks:j,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)}},10274:(e,t,r)=>{r.d(t,{X4:()=>h});var n=r(43265),i=r(69824);let a=[/^accurate$/i,/^independent$/i,/^experienced$/i,/^old-school$/i,/^full\s+g\s+driver['’]s?\s+license$/i],o=[[/\bidenPties\b/gi,"identities"],[/\bcueng-edge\b/gi,"cutting-edge"],[/\bmulP country\b/gi,"multi-country"]],s={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,sept:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function l(e){return String(e).padStart(2,"0")}function u(e,t,r){if(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(r)||e<1900||e>2100||t<1||t>12||r<1||r>31)return!1;let n=new Date(Date.UTC(e,t-1,r));return n.getUTCFullYear()===e&&n.getUTCMonth()===t-1&&n.getUTCDate()===r}function c(e){let t=String(e||"").trim();if(!t||/^(present|current|ongoing|now)$/i.test(t))return"";let r=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(r){let e=Number(r[1]),t=Number(r[2]);if(u(e,t,Number(r[3])))return`${e}-${l(t)}`}let n=t.match(/^(\d{4})-(\d{2})$/);if(n){let e=Number(n[1]),t=Number(n[2]);if(u(e,t,1))return`${e}-${l(t)}`}let i=t.match(/^(\d{4})[./](\d{2})$/);if(i){let e=Number(i[1]),t=Number(i[2]);if(u(e,t,1))return`${e}-${l(t)}`}let a=t.match(/^(\d{2})\/(\d{4})$/);if(a){let e=Number(a[1]),t=Number(a[2]);if(u(t,e,1))return`${t}-${l(e)}`}let o=t.match(/^(\d{4})\.(\d{2})$/);if(o){let e=Number(o[1]),t=Number(o[2]);if(u(e,t,1))return`${e}-${l(t)}`}let c=t.replace(/\D/g,"");if(6===c.length){let e=Number(c.slice(0,2)),t=Number(c.slice(2,6));if(u(t,e,1))return`${t}-${l(e)}`}let p=t.match(/^(\d{4})(\d{2})$/);if(p){let e=Number(p[1]),t=Number(p[2]);if(u(e,t,1))return`${e}-${l(t)}`}let d=t.match(/^([A-Za-z]{3,9})\s+(\d{4})$/);if(d){let e=s[d[1].toLowerCase()],t=Number(d[2]);if(e&&u(t,e,1))return`${t}-${l(e)}`}return""}function p(e){if(e?.current||c(e?.startDate)&&!c(e?.endDate))return"9999-12-31";let t=c(e?.endDate);return t?t:c(e?.startDate)||""}function d(e){return c(e?.startDate)}function m(e){return"top"===e||"soft"===e||"hard"===e?e:"hard"}function f(e){let t=String(e||"").trim();for(let[e,r]of o)t=t.replace(e,r);return t}function g(e){switch(m(e)){case"top":return 3;case"hard":return 2;case"soft":return 1;default:return 0}}function y(e){return String(e||"").replace(/\s+/g," ").trim().toLowerCase()}function h(e){let t={...n.e,...e||{}},r=(t.languages??[]).map(e=>({...e,name:(0,i.s)(e?.name),proficiency:(0,i.s)(e?.proficiency)})),o=new Set(r.map(e=>String(e.name||"").replace(/\s+/g," ").trim().toLowerCase()).filter(Boolean));return{...t,fullName:f(t.fullName),email:String(t.email||"").trim(),phone:f(t.phone),location:f(t.location),linkedinUrl:String(t.linkedinUrl||"").trim(),websiteUrl:String(t.websiteUrl||"").trim(),summary:f(t.summary),skills:function(e){let t=new Map;for(let r of e??[]){let e=(0,i.s)(r?.name);if(!e||a.some(t=>t.test(e)))continue;let n={name:e,level:(0,i.s)(r?.level),group:m(r?.group)},o=(0,i.j)(e),s=t.get(o);if(!s){t.set(o,n);continue}t.set(o,{name:s.name.length>=n.name.length?s.name:n.name,level:s.level&&s.level.length>=(n.level||"").length?s.level:n.level,group:g(n.group)>g(s.group)?n.group:s.group})}return Array.from(t.values()).sort((e,t)=>{let r=g(t.group)-g(e.group);return 0!==r?r:e.name.localeCompare(t.name)})}(t.skills??[]),experience:[...function(e){let t=new Set,r=[];for(let n of e??[]){let e=[y(n?.title),y(n?.location),c(n?.startDate??""),c(n?.endDate??""),(n?.bullets??[]).map(e=>y(e)).join("|")].join("||");e.replace(/\|/g,"")&&(t.has(e)||(t.add(e),r.push(n)))}return r}((t.experience??[]).map(e=>({...e,title:f(e?.title),company:f(e?.company),location:f(e?.location),startDate:c(e?.startDate??""),endDate:c(e?.endDate??""),current:!!e?.current||!!c(e?.startDate??"")&&!c(e?.endDate??""),bullets:(e?.bullets??[]).map(e=>f(e))})))].sort((e,t)=>{let r=c(e?.startDate),n=c(e?.endDate),i=c(t?.startDate),a=c(t?.endDate),o=!!e?.current||!!r&&!n,s=!!t?.current||!!i&&!a,l=!!r||!!n||o;if(l!==(!!i||!!a||s))return l?-1:1;if(o!==s)return o?-1:1;let u=p(t).localeCompare(p(e));if(0!==u)return u;let m=d(t).localeCompare(d(e));return 0!==m?m:String(t?.title||"").localeCompare(String(e?.title||""))}),education:(t.education??[]).map(e=>({...e,degree:f(e?.degree),school:f(e?.school),location:f(e?.location),gpa:f(e?.gpa),startDate:c(e?.startDate??""),endDate:c(e?.endDate??"")})),certifications:(t.certifications??[]).map(e=>({...e,name:f((0,i.s)(e?.name)),issuer:f((0,i.s)(e?.issuer)),date:c(e?.date??"")})).filter(e=>!function(e,t){let r=`${e?.name||""} ${e?.issuer||""}`.replace(/\s+/g," ").trim().toLowerCase();if(!r||!/\b(language|exam|goethe|telc|testdaf|dsh|ösd|osd|toefl|ielts|cambridge|proficiency)\b/.test(r))return!1;for(let e of t)if(e&&r.includes(e))return!0;return!1}(e,o)),projects:(t.projects??[]).map(e=>({...e,name:f(e?.name),description:f(e?.description),link:String(e?.link||"").trim(),bullets:(e?.bullets??[]).map(e=>f(e))})),languages:r.map(e=>({...e,name:f(e.name),proficiency:f(e.proficiency)}))}}},71281:(e,t,r)=>{r.d(t,{FA:()=>b,Uj:()=>g,gJ:()=>h,R5:()=>f,gX:()=>y});let n=require("fs/promises");var i=r.n(n),a=r(55315),o=r.n(a);let s=(0,r(63095).t3)(),l=o().join(s,"resumes"),u=o().join(s,"rewrite-snapshots");async function c(e){await i().mkdir(e,{recursive:!0})}function p(e){return o().join(l,`${e}.pdf`)}function d(e){return o().join(l,`${e}.json`)}function m(e){return o().join(u,`${e}.json`)}async function f(e,t,r,n){await c(l),await i().writeFile(p(e),n),await i().writeFile(d(e),JSON.stringify({fileName:t,contentType:r},null,2),"utf8")}async function g(e){try{let[t,r]=await Promise.all([i().readFile(p(e)),i().readFile(d(e),"utf8")]);return{buffer:t,meta:JSON.parse(r)}}catch{return null}}async function y(e,t){await c(u),await i().writeFile(m(e),JSON.stringify(t,null,2),"utf8")}async function h(e){try{let t=await i().readFile(m(e),"utf8");return JSON.parse(t)}catch{return null}}async function b(e){try{await i().unlink(m(e))}catch{}}},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."}],i=new Map(n.map(e=>[e.key,e]));function a(e){let t=i.get(e);if(!t)throw Error(`Unknown prompt key: ${e}`);return t}},3896:(e,t,r)=>{r.d(t,{Wm:()=>c,cB:()=>s,dk:()=>l,g5:()=>u,ue:()=>p});var n=r(92795),i=r(15259);async function a(e){let t=(0,i.ef)(e),r=await n._.promptTemplate.findUnique({where:{key:e}});if(r){let i={};return(r.label!==t.label&&(i.label=t.label),r.description!==t.description&&(i.description=t.description),r.defaultContent!==t.defaultContent&&(i.defaultContent=t.defaultContent),Object.keys(i).length)?n._.promptTemplate.update({where:{key:e},data:i}):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 o(){for(let e of i.u7)await a(e.key)}async function s(){return await o(),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 u(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 c(e,t,r){let i=String(t||"").trim();if(!i)throw Error("Prompt content cannot be empty.");await a(e);let o=await n._.promptTemplateVersion.findMany({where:{promptKey:e},orderBy:{version:"desc"},take:1}),s=Number(o?.[0]?.version||0)+1,l=await n._.promptTemplate.update({where:{key:e},data:{activeContent:i}});return await n._.promptTemplateVersion.create({data:{promptKey:e,version:s,content:i,updatedBy:r||"admin"}}),l}async function p(e,t){let r=(0,i.ef)(e);return c(e,r.defaultContent,t||"admin-reset")}},69824:(e,t,r)=>{function n(e){return String(e||"").replace(/\bWordtiress\b/gi,"WordPress").replace(/\s+/g," ").trim()}function i(e){let t=n(e).toLowerCase().replace(/\bux\/user experience\b/gi,"user experience").replace(/\buser experience\/ux\b/gi,"user experience").replace(/\bui\/user interface\b/gi,"user interface").replace(/\buser interface\/ui\b/gi,"user interface").replace(/\bux\/ui\b/gi,"user experience user interface").replace(/\bui\/ux\b/gi,"user interface user experience").replace(/\bux\b/gi,"user experience").replace(/\bui\b/gi,"user interface").replace(/&/g," and ").replace(/[+/|]/g," ").replace(/[^a-z0-9\s-]/g," ").replace(/\btools?\b/g," ").replace(/\bsoftware\b/g," ").replace(/\bplatforms?\b/g," ").replace(/\btechnologies\b/g," technology ").replace(/\s+/g," ").trim();if(!t)return"";let r=t.split(" "),i=[];for(let e of r)e&&i[i.length-1]!==e&&i.push(e);return i.join(" ")}r.d(t,{j:()=>i,s:()=>n})},43265:(e,t,r)=>{r.d(t,{e:()=>n});let n={fullName:"",email:"",phone:"",location:"",linkedinUrl:"",websiteUrl:"",summary:"",skills:[],experience:[],education:[],certifications:[],projects:[],languages:[],atsScore:null,lastAnalysis:null}}};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(62060));module.exports=n})();