import{f as e,d as s,c as r,k as a}from"./router.chunk.YsRm4bSN.js";import{_ as __}from"./wordpress.chunk.BVds2GcU.js";import{w as u,aw as t,ax as n,bf as i}from"./main.chunk.N-eZ2ybB.js";const c=e=>r({queryKey:["Pledges",e],queryFn:()=>(e=>t.get(n.PLEDGES,{params:i(e)}).then(e=>e.data))(e),placeholderData:a}),d=e=>t.post(n.PLEDGES,e),o=()=>{const r=e();return s({mutationFn:d,onSuccess(){r.invalidateQueries({queryKey:["Pledges"]}),u.success(__("Pledges created successfully","growfund"))}})},l=e=>r({queryKey:["PledgeDetails",e],queryFn:()=>(e=>t.get(n.PLEDGES_WITH_ID(e)).then(e=>e.data))(e)}),g=({id:e,is_permanent:s})=>t.delete(n.PLEDGES_WITH_ID(e),{params:{is_permanent:s}}),y=()=>{const r=e();return s({mutationFn:g,onSuccess(e,s){u.success(__("Pledge deleted successfully.","growfund")),r.invalidateQueries({queryKey:["Pledges"]}),r.invalidateQueries({queryKey:["Pledges",s]})},onError(e){u.error(e.message)}})},P=()=>t.post(n.EMPTY_PLEDGES_TRASH),m=()=>{const r=e();return s({mutationFn:P,onSuccess(){u.success(__("Trash emptied successfully.","growfund")),r.invalidateQueries({queryKey:["Pledges"]})},onError(e){u.error(e.message)}})},p=e=>t.patch(n.PLEDGES_BULK_ACTIONS,e),E=()=>{const r=e();return s({mutationFn:p,onSuccess(){r.invalidateQueries({queryKey:["Pledges"]})},onError(e){u.error(e.message)}})},f=({id:e,status:s})=>t.patch(n.PLEDGES_WITH_ID(e),{action:s}),_=()=>{const r=e();return s({mutationFn:f,onSuccess(){r.invalidateQueries({queryKey:["Pledges"]}),r.invalidateQueries({queryKey:["PledgeDetails"]}),r.invalidateQueries({queryKey:["Timelines"]}),u.success(__("Pledge status updated successfully","growfund"))}})},D=({pledgeId:e})=>t.post(n.CHARGE_BACKER(e)),S=()=>{const r=e();return s({mutationFn:D,onSuccess(){r.invalidateQueries({queryKey:["PledgeDetails"]}),u.success(__("Backer is scheduled for charging.","growfund"))}})},K=({pledgeId:e})=>t.post(n.RETRY_FAILED_PAYMENT(e)),q=()=>{const r=e();return s({mutationFn:K,onSuccess(){r.invalidateQueries({queryKey:["PledgeDetails"]}),u.success(__("Payment is scheduled for retrying.","growfund"))}})},h=({pledgeId:e})=>t.post(n.MARK_AS_READY_FOR_PICKUP(e)),F=()=>{const r=e();return s({mutationFn:h,onSuccess(){r.invalidateQueries({queryKey:["PledgeDetails"]}),u.success(__("Marked as ready for pickup.","growfund"))}})};export{m as a,E as b,o as c,_ as d,S as e,q as f,y as g,F as h,l as i,c as u};
