"use strict";(()=>{var e={};e.id=8940,e.ids=[8940],e.modules={2934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},4580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},5869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7147:e=>{e.exports=require("fs")},1017:e=>{e.exports=require("path")},4392:(e,t,r)=>{r.r(t),r.d(t,{headerHooks:()=>h,originalPathname:()=>f,patchFetch:()=>g,requestAsyncStorage:()=>d,routeModule:()=>l,serverHooks:()=>v,staticGenerationAsyncStorage:()=>p,staticGenerationBailout:()=>m});var a={};r.r(a),r.d(a,{POST:()=>u});var n=r(5419),o=r(9108),s=r(9678),i=r(2509),c=r(8070);async function u(){try{let e=await (0,i.e)(),{data:{user:t},error:r}=await e.auth.getUser();if(r||!t)return c.Z.json({error:"Unauthorized"},{status:401});let a=t.user_metadata||{};if(!a.avatar_url)return c.Z.json({success:!0,message:"No avatar_url found in user_metadata"});let{avatar_url:n,...o}=a,{error:s}=await e.auth.updateUser({data:o});if(s)return console.error("Error cleaning avatar_url:",s),c.Z.json({error:"Failed to clean avatar_url",details:s.message},{status:500});return c.Z.json({success:!0,message:"Avatar URL cleaned from user_metadata"})}catch(e){return console.error("Error in clean-avatar endpoint:",e),c.Z.json({error:"Internal server error"},{status:500})}}let l=new n.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/auth/clean-avatar/route",pathname:"/api/auth/clean-avatar",filename:"route",bundlePath:"app/api/auth/clean-avatar/route"},resolvedPagePath:"C:\\xampp\\htdocs\\AI Woo Chat\\src\\app\\api\\auth\\clean-avatar\\route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:d,staticGenerationAsyncStorage:p,serverHooks:v,headerHooks:h,staticGenerationBailout:m}=l,f="/api/auth/clean-avatar/route";function g(){return(0,s.patchFetch)({serverHooks:v,staticGenerationAsyncStorage:p})}},2509:(e,t,r)=>{r.d(t,{createAdminClient:()=>i,e:()=>s});var a=r(6874),n=r(7439),o=r(3950);async function s(){let e=await (0,n.cookies)();return(0,a.lx)("https://drmuwsxyvvfivdfsyydy.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRybXV3c3h5dnZmaXZkZnN5eWR5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njg0NjAwMDgsImV4cCI6MjA4NDAzNjAwOH0.kMsFG-VLNqwzIgl3cFW-owiRCWHcB47M6V6Ti4O4alY",{cookies:{get:t=>e.get(t)?.value,set(t,r,a){try{e.set({name:t,value:r,...a})}catch(e){}},remove(t,r){try{e.set({name:t,value:"",...r})}catch(e){}}}})}function i(){return(0,o.eI)("https://drmuwsxyvvfivdfsyydy.supabase.co",process.env.SUPABASE_SERVICE_ROLE_KEY,{auth:{autoRefreshToken:!1,persistSession:!1}})}(0,r(4113).C)()},4113:(e,t,r)=>{r.d(t,{C:()=>s});var a=r(7147),n=r(1017);let o=!1;function s(){if(!o)try{let e=process.cwd(),t=[(0,n.join)(e,".env.production"),(0,n.join)(e,"..",".env.production"),(0,n.join)(e,"..","..",".env.production"),(0,n.join)(e,"app",".env.production")],r=null,s=null;for(let e of t)try{s=(0,a.readFileSync)(e,"utf-8"),r=e,console.log("[EnvLoader] Found .env.production at:",e);break}catch{continue}if(!s||!r)throw Error(`Could not find .env.production. Tried: ${t.join(", ")}`);for(let e of s.split("\n")){let t=e.trim();if(!t||t.startsWith("#"))continue;let r=t.match(/^([^=]+)=(.*)$/);if(r){let e=r[1].trim(),t=r[2].trim();(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1)),process.env[e]||(process.env[e]=t)}}o=!0,console.log("[EnvLoader] Loaded environment variables from .env.production"),console.log("[EnvLoader] SUPABASE_DB_URL:",process.env.SUPABASE_DB_URL?"SET":"NOT SET")}catch(e){"ENOENT"===e.code?console.warn("[EnvLoader] .env.production file not found at:",envPath):console.warn("[EnvLoader] Could not load .env.production:",e.message)}}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[1638,9989,6206],()=>r(4392));module.exports=a})();