import{f as e,d as s,c as a,k as n}from"./router.chunk.YsRm4bSN.js";import{_ as __}from"./wordpress.chunk.BVds2GcU.js";import{w as r,aw as t,ax as o,bf as i}from"./main.chunk.N-eZ2ybB.js";const u=e=>t.patch(o.DONATIONS_BULK_ACTIONS,e),c=()=>{const a=e();return s({mutationFn:u,onSuccess(){a.invalidateQueries({queryKey:["Donations"]}),a.invalidateQueries({queryKey:["DonationDetails"]}),a.invalidateQueries({queryKey:["Funds"]})},onError(e){r.error(e.message)}})},d=e=>a({queryKey:["Donations",e],queryFn:()=>(e=>t.get(o.DONATIONS,{params:i(e)}).then(e=>e.data))(e),placeholderData:n}),y=e=>t.post(o.DONATIONS,e),l=()=>{const a=e();return s({mutationFn:y,onSuccess(){a.invalidateQueries({queryKey:["Donations"]}),r.success(__("Donations created successfully","growfund"))},onError(e){r.error(e.message)}})},D=e=>a({queryKey:["DonationDetails",e],queryFn:()=>(e=>t.get(o.DONATIONS_WITH_ID(e)).then(e=>e.data))(e)}),m=()=>t.delete(o.EMPTY_DONATIONS_TRASH),T=()=>{const a=e();return s({mutationFn:m,onSuccess(){r.success(__("Trash emptied successfully.","growfund")),a.invalidateQueries({queryKey:["Donations"]})},onError(e){r.error(e.message)}})},p=({id:e,status:s})=>t.patch(o.DONATIONS_WITH_ID(e),{action:s}),q=()=>{const a=e();return s({mutationFn:p,onSuccess(){a.invalidateQueries({queryKey:["Donations"]}),a.invalidateQueries({queryKey:["DonationDetails"]}),a.invalidateQueries({queryKey:["Timelines"]}),r.success(__("Donation status updated successfully","growfund"))},onError(e){r.error(e.message)}})},N=({id:e,is_permanent:s})=>t.delete(o.DONATIONS_WITH_ID(e),{params:{is_permanent:s}}),O=()=>{const a=e();return s({mutationFn:N,onSuccess(){a.invalidateQueries({queryKey:["Donations"]}),a.invalidateQueries({queryKey:["DonationDetails"]}),a.invalidateQueries({queryKey:["Timelines"]}),r.success(__("Donation deleted successfully.","growfund"))}})};export{c as a,T as b,d as c,q as d,O as e,D as f,l as u};
