import{a as e,g as t,s as n,t as r}from"./api-Duu96wkE.js";import{G as i}from"./index-DyQEyT-0.js";function a(t=!1){return e({queryKey:[`ledger`,`accounts`,t],queryFn:async()=>(await r.get(`/ledger/accounts`,{params:{postable_only:t||void 0}})).data.data})}function o(n){return e({queryKey:[`ledger`,`journals`,n],queryFn:async()=>{let e=await r.get(`/ledger/journals`,{params:n});return{entries:e.data.data,meta:e.data.meta}},placeholderData:t})}function s(t){return e({queryKey:[`ledger`,`trial-balance`,t],queryFn:async()=>(await r.get(`/ledger/trial-balance`,{params:t})).data.data})}function c(t){return e({queryKey:[`ledger`,`income-statement`,t],queryFn:async()=>(await r.get(`/ledger/income-statement`,{params:t})).data.data})}function l(){return e({queryKey:[`ledger`,`cash-position`],queryFn:async()=>(await r.get(`/ledger/cash-position`)).data.data})}function u(t,n=!0){return e({queryKey:[`applicants`,t,`statement`],queryFn:async()=>(await r.get(`/applicants/${t}/statement`)).data.data,enabled:!!t&&n})}function d(e){let t=n();return i({mutationFn:e,onSuccess:()=>{t.invalidateQueries({queryKey:[`ledger`]}),t.invalidateQueries({queryKey:[`applicants`]})}})}function f(){return d(e=>r.post(`/ledger/journals`,e))}function p(){return d(({id:e,reason:t})=>r.post(`/ledger/journals/${e}/reverse`,{reason:t}))}function m(t){return e({queryKey:[`ledger`,`balance-sheet`,t],queryFn:async()=>(await r.get(`/ledger/balance-sheet`,{params:{as_at:t}})).data.data})}function h(){return e({queryKey:[`ledger`,`receivables-aging`],queryFn:async()=>(await r.get(`/ledger/receivables-aging`)).data.data})}function g(t){return e({queryKey:[`ledger`,`profitability`,t],queryFn:async()=>(await r.get(`/ledger/profitability`,{params:t})).data.data})}function _(t,n){return e({queryKey:[`ledger`,`revenue-by`,t,n],queryFn:async()=>(await r.get(`/ledger/revenue-by/${t}`,{params:n})).data.data})}function v(){return e({queryKey:[`ledger`,`periods`],queryFn:async()=>(await r.get(`/ledger/periods`)).data.data})}function y(){return d(e=>r.post(`/ledger/years`,e))}function b(){return d(({id:e,action:t,...n})=>r.post(`/ledger/periods/${e}/${t}`,n))}export{c as a,y as c,g as d,h as f,s as h,v as i,b as l,p as m,m as n,o,_ as p,l as r,a as s,u as t,f as u};