module.exports=[89910,a=>{"use strict";var b=a.i(37936),c=a.i(45618),d=a.i(18558),e=a.i(13095);let f=(0,c.createClient)("https://ixrgjfluwrwkzpxoaocw.supabase.co",process.env.SUPABASE_SERVICE_ROLE_KEY,{auth:{persistSession:!1}});async function g(a){try{let b=a.password||Math.random().toString(36).slice(-10)+"C1!",{data:c,error:e}=await f.auth.admin.createUser({email:a.correo,password:b,email_confirm:!0});if(e&&e.message.includes("already been registered")){let{data:b,error:d}=await f.auth.admin.listUsers();if(d)throw Error("Error verificando usuario existente: "+d.message);let e=b.users.find(b=>b.email?.toLowerCase()===a.correo.toLowerCase());if(!e)throw Error("No se pudo encontrar el usuario existente.");c={user:e}}else if(e)throw Error("Error creando usuario en Auth: "+e.message);let g=c?.user?.id;if(g){let{error:b}=await f.from("profiles").upsert({id:g,role:a.role,nombre:a.nombre,correo:a.correo});if(b)throw Error("Error creando/actualizando perfil: "+b.message)}return(0,d.revalidatePath)("/gestion-corpadein/usuarios"),{success:!0,password:b}}catch(a){return{success:!1,error:a.message}}}async function h(a,b){try{let{error:c}=await f.auth.admin.updateUserById(a,{password:b});if(c)throw c;return{success:!0}}catch(a){return{success:!1,error:a.message}}}(0,e.ensureServerEntryExports)([g,h]),(0,b.registerServerReference)(g,"4020321960004b317c089dac60deb2af0e4d3ebbfe",null),(0,b.registerServerReference)(h,"60624bd7f64d334310abc5d0d044535acb54827581",null),a.s(["createAdminUser",()=>g,"updateUserPassword",()=>h])},83484,a=>{"use strict";var b=a.i(54143),c=a.i(89910);a.s([],24655),a.i(24655),a.s(["4020321960004b317c089dac60deb2af0e4d3ebbfe",()=>c.createAdminUser,"408752d41840a9129533a279989e29f571a78e21c2",()=>b.getSiteSettings],83484)}];

//# sourceMappingURL=_a6b0d7f7._.js.map