"use strict";(()=>{var e={};e.id=8802,e.ids=[8802],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")},63266:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>P,patchFetch:()=>j,requestAsyncStorage:()=>v,routeModule:()=>h,serverHooks:()=>g,staticGenerationAsyncStorage:()=>f});var i={};t.r(i),t.d(i,{PUT:()=>m,dynamic:()=>q});var o=t(49790),s=t(60540),n=t(82273),a=t(19096),u=t(13670),p=t(27489),d=t(64451),l=t(92795),c=t(4355),x=t(78049);let q="force-dynamic",y={openai:"aiOpenaiKey",anthropic:"aiAnthropicKey",gemini:"aiGeminiKey",mistral:"aiMistralKey",groq:"aiGroqKey",deepseek:"aiDeepseekKey",xai:"aiXaiKey",cohere:"aiCohereKey",perplexity:"aiPerplexityKey",ollama:"aiOllamaKey"};async function m(e){if(!(0,x.zs)(u.cookies().get(x.uQ)?.value))return a.NextResponse.json({error:"Session expired. Please sign in again."},{status:401});let r=await (0,p.getServerSession)(d.L),t=r?.user?.id;if(!t)return a.NextResponse.json({error:"Unauthorized"},{status:401});let i=await e.json().catch(()=>({})),o={};if(i.aiProvider){if(!c.aA.includes(i.aiProvider))return a.NextResponse.json({error:"Invalid provider"},{status:400});o.aiProvider=i.aiProvider}for(let e of(void 0!==i.aiModel&&(o.aiModel=(String(i.aiModel)||"").trim()||null),c.aA)){let r=`${e}Key`,t=y[e];if(!(r in i))continue;let s=i[r];null===s?o[t]=null:"string"==typeof s&&s.trim()&&(o[t]=s.trim())}if(0===Object.keys(o).length)return a.NextResponse.json({ok:!0,noop:!0});let s=await l._.user.update({where:{id:t},data:o,select:{aiProvider:!0,aiModel:!0}});return s?a.NextResponse.json({ok:!0,aiProvider:s.aiProvider,aiModel:s.aiModel}):a.NextResponse.json({error:"User not found"},{status:404})}let h=new o.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/account/ai/route",pathname:"/api/account/ai",filename:"route",bundlePath:"app/api/account/ai/route"},resolvedPagePath:"/Users/andrasgyenes/Desktop/MrQuery 2026/HyreMe/Archive/hyreme-app/app/api/account/ai/route.ts",nextConfigOutput:"standalone",userland:i}),{requestAsyncStorage:v,staticGenerationAsyncStorage:f,serverHooks:g}=h,P="/api/account/ai/route";function j(){return(0,n.patchFetch)({serverHooks:g,staticGenerationAsyncStorage:f})}},78049:(e,r,t)=>{t.d(r,{QI:()=>a,d6:()=>s,uQ:()=>o,zs:()=>n});var i=t(84770);let o="hyreme_runtime_id",s=(0,i.randomUUID)();function n(e){return!!e&&e===s}function a(){return{httpOnly:!0,sameSite:"lax",secure:!0,path:"/",maxAge:43200}}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),i=r.X(0,[9085,400,8664,7764,2795,7486],()=>t(63266));module.exports=i})();