import{u as o,b as q}from"./query-QCek5MsK.js";import{u as x,t as y}from"./app-BBdow7GJ.js";function j({mutationFn:C,successToast:a,errorToast:p,invalidateKeys:n,onSuccess:m,onError:f,...M}){const Q=o(),{pushToast:A}=x();return q({...M,mutationFn:async t=>{try{return await C(t)}catch(u){throw y(u)}},onSuccess:async(t,u,w,h)=>{n!=null&&n.length&&await Promise.all(n.map(g=>Q.invalidateQueries({queryKey:g})));const i=a==null?void 0:a(t,u);i&&A({...i,variant:"success"}),await(m==null?void 0:m(t,u,w,h))},onError:async(t,u,w,h)=>{const i=p==null?void 0:p(t,u);i&&A({...i,variant:"error"}),await(f==null?void 0:f(t,u,w,h))}})}export{j as u};
