import{f as e,d as s,c as a,k as r}from"./router.chunk.YsRm4bSN.js";import{_ as __}from"./wordpress.chunk.BVds2GcU.js";import{w as n,aw as u,ax as i,bf as t}from"./main.chunk.N-eZ2ybB.js";const o=e=>a({queryKey:["Campaigns",e],queryFn:()=>(e=>u.get(i.CAMPAIGNS,{params:t(e)}).then(e=>e.data))(e),placeholderData:r}),c=e=>a({queryKey:["CampaignDetails",e],queryFn:()=>(e=>u.get(i.CAMPAIGNS_WITH_ID(e)).then(e=>e.data))(e)}),d=()=>u.post(i.CAMPAIGNS).then(e=>e.data),m=()=>{const a=e();return s({mutationFn:d,onSuccess(){a.invalidateQueries({queryKey:["Campaigns"]})},onError(e){n.error(e.message)}})},l=({id:e,...s})=>u.put(i.CAMPAIGNS_WITH_ID(e),s),g=()=>{const a=e();return s({mutationFn:l,onSuccess(){n.success(__("Campaign updated successfully.","growfund")),a.invalidateQueries({queryKey:["CampaignDetails"]}),a.invalidateQueries({queryKey:["Campaigns"]}),a.invalidateQueries({queryKey:["CampaignRewards"]}),a.invalidateQueries({queryKey:["CampaignCollaborators"]})},onError(e){n.error(e.message)}})},p=e=>u.patch(i.CAMPAIGNS_BULK_ACTIONS,e),y=()=>{const a=e();return s({mutationFn:p,onSuccess(){a.invalidateQueries({queryKey:["Campaigns"]}),a.invalidateQueries({queryKey:["CampaignDetails"]})},onError(e){n.error(e.message)}})},C=e=>u.patch(i.CAMPAIGNS_WITH_ID(e),{status:"published"}),A=({id:e,decline_reason:s})=>u.patch(i.CAMPAIGNS_WITH_ID(e),{status:"declined",decline_reason:s}),_=()=>{const a=e();return s({mutationFn:C,onSuccess(){n.success(__("Campaign approved successfully.","growfund")),a.invalidateQueries({queryKey:["Campaigns"]})},onError(e){n.error(e.message)}})},S=()=>{const a=e();return s({mutationFn:A,onSuccess(){n.success(__("Campaign declined successfully.","growfund")),a.invalidateQueries({queryKey:["Campaigns"]})},onError(e){n.error(e.message)}})},I=e=>u.delete(i.CAMPAIGNS_WITH_ID(e)),K=()=>{const a=e();return s({mutationFn:I,onSuccess(){n.success(__("Campaign deleted successfully.","growfund")),a.invalidateQueries({queryKey:["Campaigns"]})},onError(e){n.error(e.message)}})},f=()=>u.delete(i.EMPTY_CAMPAIGNS_TRASH),q=()=>{const a=e();return s({mutationFn:f,onSuccess(){n.success(__("Trash emptied successfully.","growfund")),a.invalidateQueries({queryKey:["Campaigns"]})},onError(e){n.error(e.message)}})},v=({id:e,...s})=>u.patch(i.CAMPAIGNS_WITH_ID(e),s),Q=()=>{const a=e();return s({mutationFn:v,onSuccess(){n.success(__("Campaign status updated successfully.","growfund")),a.invalidateQueries({queryKey:["Campaigns"]}),a.invalidateQueries({queryKey:["CampaignDetails"]})},onError(e){n.error(e.message)}})},h=({id:e,...s})=>u.patch(i.CAMPAIGN_UPDATE_SECONDARY_STATUS(e),s),D=()=>{const a=e();return s({mutationFn:h,onSuccess(e){n.success(e.message),a.invalidateQueries({queryKey:["CampaignDetails"]}),a.invalidateQueries({queryKey:["Campaigns"]})}})},E=({campaign_id:e})=>u.post(i.CHARGE_BACKERS(e)),P=()=>{const a=e();return s({mutationFn:E,onSuccess(){n.success(__("Backers are scheduled for charging.","growfund")),a.invalidateQueries({queryKey:["CampaignDetails"]}),a.invalidateQueries({queryKey:["Campaigns"]})},onError(e){n.error(e.message)}})},F=e=>u.post(i.CAMPAIGN_MARK_AS_READY_FOR_PICKUP(e)),M=()=>{const a=e();return s({mutationFn:F,onSuccess(){n.success(__("Ready for pickup mail sent successfully.","growfund")),a.invalidateQueries({queryKey:["Campaigns"]})},onError(e){n.error(e.message)}})};export{P as a,Q as b,K as c,M as d,y as e,S as f,o as g,q as h,_ as i,m as j,g as k,c as l,D as u};
