import{t as o,u as i,x as p}from"./chunk-I5MYHHJE.js";import{Z as c,ba as u}from"./chunk-CKLXM6EG.js";var d={production:!1,baseUrl:"https://erp.etqanerp.com/api/"};var g=class a{constructor(t){this.http=t}baseUrl=d.baseUrl;buildParams(t){return t instanceof i?t:t?new i({fromObject:Object.fromEntries(Object.entries(t).filter(([,r])=>r!=null&&r!==""))}):new i}buildHeaders(t){return t?new o(t):new o}request(t,r,e,n){let s={params:this.buildParams(n?.params),headers:this.buildHeaders(n?.headers)};return e!=null&&(s.body=e),this.http.request(t,this.baseUrl+r,s)}Get(t,r){return this.request("get",t,void 0,r)}GetById(t,r,e){return this.request("get",`${t}/${r}`,void 0,e)}Put(t,r,e){return this.request("put",t,r,e)}Patch(t,r,e){return this.request("patch",t,r,e)}Delete(t,r,e){return this.request("delete",t,r,e)}Post(t,r,e,n=!1){let s=n==!0?this.toFormData(r):r;return this.request("post",t,s,e)}toFormData(t,r=new FormData,e=null){return t==null||(t instanceof File?r.append(e??"file",t):Array.isArray(t)?t.forEach((n,s)=>{let l=e?`${e}[${s}]`:String(s);this.toFormData(n,r,l)}):typeof t=="object"?Object.keys(t).forEach(n=>{let s=e?`${e}[${n}]`:n;this.toFormData(t[n],r,s)}):e&&r.append(e,String(t))),r}static \u0275fac=function(r){return new(r||a)(u(p))};static \u0275prov=c({token:a,factory:a.\u0275fac,providedIn:"root"})};export{g as a};
