module.exports=[73840,a=>{"use strict";let b=(0,a.i(45618).createClient)("https://ixrgjfluwrwkzpxoaocw.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Iml4cmdqZmx1d3J3a3pweG9hb2N3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQ3MjY3MTQsImV4cCI6MjA5MDMwMjcxNH0.XpWgQTUidHKlXUWRDnkpx6-ouhBvPArcpV-wDqEyuwg");a.s(["supabase",0,b])},10667,a=>{"use strict";var b=a.i(54143),c=a.i(37936),d=a.i(73840),e=a.i(18558);async function f(a=!1){try{let b=d.supabase.from("aliados").select("*").order("order_index",{ascending:!0}).order("created_at",{ascending:!1});a&&(b=b.eq("is_active",!0));let{data:c,error:e}=await b;if(e)throw e;return{success:!0,data:c}}catch(a){return console.error("Error fetching aliados:",a),{success:!1,error:a.message}}}async function g(a){try{let{error:b}=await d.supabase.from("aliados").insert([{name:a.name,image_url:a.image_url,is_active:a.is_active??!0,order_index:a.order_index??0}]);if(b)throw b;return(0,e.revalidatePath)("/"),(0,e.revalidatePath)("/gestion-corpadein/aliados"),{success:!0}}catch(a){return console.error("Error creating aliado:",a),{success:!1,error:a.message}}}async function h(a,b){try{let{error:c}=await d.supabase.from("aliados").update({is_active:!b}).eq("id",a);if(c)throw c;return(0,e.revalidatePath)("/"),(0,e.revalidatePath)("/gestion-corpadein/aliados"),{success:!0}}catch(a){return{success:!1,error:a.message}}}async function i(a,b){try{let{error:c}=await d.supabase.from("aliados").update(b).eq("id",a);if(c)throw c;return(0,e.revalidatePath)("/"),(0,e.revalidatePath)("/gestion-corpadein/aliados"),{success:!0}}catch(a){return console.error("Error updating aliado:",a),{success:!1,error:a.message}}}async function j(a,b){try{let{error:c}=await d.supabase.from("aliados").update({order_index:b}).eq("id",a);if(c)throw c;return(0,e.revalidatePath)("/"),(0,e.revalidatePath)("/gestion-corpadein/aliados"),{success:!0}}catch(a){return{success:!1,error:a.message}}}async function k(a){try{let{data:b}=await d.supabase.from("aliados").select("image_url").eq("id",a).single(),{error:c}=await d.supabase.from("aliados").delete().eq("id",a);if(c)throw c;if(b?.image_url&&b.image_url.includes("storage/v1/object/public/")){let a=b.image_url.split("/"),c=a.findIndex(a=>"public"===a)+1;if(c>0&&c<a.length){let b=a[c],e=a.slice(c+1).join("/");b&&e&&await d.supabase.storage.from(b).remove([e])}}return(0,e.revalidatePath)("/"),(0,e.revalidatePath)("/gestion-corpadein/aliados"),{success:!0}}catch(a){return{success:!1,error:a.message}}}(0,a.i(13095).ensureServerEntryExports)([f,g,h,i,j,k]),(0,c.registerServerReference)(f,"403c09f0b309264954f922812c41ca1ed1ae1f516b",null),(0,c.registerServerReference)(g,"40a2a6db0c0f7f1814158419e85c4fd148bbc57604",null),(0,c.registerServerReference)(h,"604b578b97dc3a1e87ce44e4f3bcfe7f2ba14ab79e",null),(0,c.registerServerReference)(i,"608ab14573e8981fad7acba42b2e5aa3aac93af605",null),(0,c.registerServerReference)(j,"606f64d2512ec75bf8d5a0a9446ac3651ac8724094",null),(0,c.registerServerReference)(k,"40729f03ddac975d36372445dc9fe485ad1864ef4c",null),a.s([],120),a.i(120),a.s(["403c09f0b309264954f922812c41ca1ed1ae1f516b",()=>f,"40729f03ddac975d36372445dc9fe485ad1864ef4c",()=>k,"408752d41840a9129533a279989e29f571a78e21c2",()=>b.getSiteSettings,"40a2a6db0c0f7f1814158419e85c4fd148bbc57604",()=>g,"604b578b97dc3a1e87ce44e4f3bcfe7f2ba14ab79e",()=>h,"606f64d2512ec75bf8d5a0a9446ac3651ac8724094",()=>j,"608ab14573e8981fad7acba42b2e5aa3aac93af605",()=>i],10667)}];

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