import{u,b as s,c as n}from"./vendor-data-D4F9-7cQ.js";import{s as o}from"./index-E4maWKVN.js";function l(){return u({queryKey:["blog-categories"],queryFn:async()=>{const{data:e,error:r}=await o.from("blog_categories").select("*").order("name",{ascending:!0});if(r)throw r;return e}})}function y(){const e=s();return n({mutationFn:async r=>{const{data:t,error:a}=await o.from("blog_categories").insert([r]).select().single();if(a)throw a;return t},onSuccess:()=>{e.invalidateQueries({queryKey:["blog-categories"]})}})}function d(){const e=s();return n({mutationFn:async({id:r,...t})=>{const{data:a,error:i}=await o.from("blog_categories").update(t).eq("id",r).select().single();if(i)throw i;return a},onSuccess:()=>{e.invalidateQueries({queryKey:["blog-categories"]}),e.invalidateQueries({queryKey:["blog-category"]})}})}function f(){const e=s();return n({mutationFn:async r=>{const{error:t}=await o.from("blog_categories").delete().eq("id",r);if(t)throw t},onSuccess:()=>{e.invalidateQueries({queryKey:["blog-categories"]})}})}export{y as a,d as b,f as c,l as u};