"use strict";(()=>{var e={};e.id=7277,e.ids=[7277],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")},95864:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>x,patchFetch:()=>v,requestAsyncStorage:()=>g,routeModule:()=>h,serverHooks:()=>b,staticGenerationAsyncStorage:()=>w});var n={};r.r(n),r.d(n,{POST:()=>y,dynamic:()=>m,maxDuration:()=>f});var a=r(49790),o=r(60540),i=r(82273),s=r(27489),l=r(64451),c=r(92795),p=r(4355),u=r(20237),d=r(3896);let m="force-dynamic",f=60;async function y(){let e;let t=await (0,s.getServerSession)(l.L),r=t?.user?.id;if(!r)return new Response("Unauthorized",{status:401});let n=await c._.profile.findUnique({where:{userId:r}});if(!n)return new Response("No profile",{status:404});let a=(0,u.D)(),o=await (0,d.g5)("profile_analyze_system",{currentDate:a}),i=JSON.stringify({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},null,2),m=`Analyze the following resume profile for optimization. The current date is ${a}. Return this exact structure and finish every section:

SCORE: <number>/100

Strengths
- five concise bullets

Weaknesses / Gaps
- five concise bullets

Actionable Improvement Recommendations
1. numbered recommendation
2. numbered recommendation
3. numbered recommendation

Missing keywords or sections to add for the targeted role
- concise bullets

Be direct and concrete. When checking chronology, compare dates against ${a}. Resume profile JSON:

${i}`;try{e=await (0,p._C)(r,{messages:[{role:"system",content:o},{role:"user",content:m}],maxTokens:5e3})}catch(t){if(t instanceof p.Q7)return new Response(t.message,{status:400});let e=(0,p.Cw)(t,"The AI provider failed before analysis could start.");return console.error("analyze llm err",e,t),new Response(`LLM error: ${e}`,{status:500})}let f=new TextEncoder,y="";return new Response(new ReadableStream({async start(t){try{for await(let r of e)y+=r,t.enqueue(f.encode(JSON.stringify({type:"chunk",content:r})+"\n"));let n=y.match(/(?:ATS\s+)?SCORE\s*:\s*(\d{1,3})/i),a=n?Math.min(100,parseInt(n[1],10)):null;await c._.profile.update({where:{userId:r},data:{atsScore:a,lastAnalysis:y}}),t.enqueue(f.encode(JSON.stringify({type:"done",score:a,full:y})+"\n"))}catch(r){let e=(0,p.Cw)(r,"The AI provider stopped during streaming analysis.");console.error("analyze stream err",e,r),t.enqueue(f.encode(JSON.stringify({type:"error",error:e})+"\n"))}finally{t.close()}}}),{headers:{"Content-Type":"application/x-ndjson; charset=utf-8","Cache-Control":"no-cache"}})}let h=new a.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/profile/analyze/route",pathname:"/api/profile/analyze",filename:"route",bundlePath:"app/api/profile/analyze/route"},resolvedPagePath:"/Users/andrasgyenes/Desktop/MrQuery 2026/HyreMe/Archive/hyreme-app/app/api/profile/analyze/route.ts",nextConfigOutput:"standalone",userland:n}),{requestAsyncStorage:g,staticGenerationAsyncStorage:w,serverHooks:b}=h,x="/api/profile/analyze/route";function v(){return(0,i.patchFetch)({serverHooks:b,staticGenerationAsyncStorage:w})}},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:()=>o,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."}],a=new Map(n.map(e=>[e.key,e]));function o(e){let t=a.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:()=>u});var n=r(92795),a=r(15259);async function o(e){let t=(0,a.ef)(e),r=await n._.promptTemplate.findUnique({where:{key:e}});if(r){let a={};return(r.label!==t.label&&(a.label=t.label),r.description!==t.description&&(a.description=t.description),r.defaultContent!==t.defaultContent&&(a.defaultContent=t.defaultContent),Object.keys(a).length)?n._.promptTemplate.update({where:{key:e},data:a}):r}let o=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"}}),o}async function i(){for(let e of a.u7)await o(e.key)}async function s(){return await i(),await n._.promptTemplate.findMany({orderBy:{label:"asc"}})}async function l(e){return{prompt:await o(e),versions:await n._.promptTemplateVersion.findMany({where:{promptKey:e},orderBy:{version:"desc"}})}}async function c(e,t={}){let r=await o(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 a=String(t||"").trim();if(!a)throw Error("Prompt content cannot be empty.");await o(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:a}});return await n._.promptTemplateVersion.create({data:{promptKey:e,version:s,content:a,updatedBy:r||"admin"}}),l}async function u(e,t){let r=(0,a.ef)(e);return p(e,r.defaultContent,t||"admin-reset")}},49790:(e,t,r)=>{e.exports=r(30517)}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[9085,400,7764,2795,7486],()=>r(95864));module.exports=n})();