import{a as g}from"./chunk-VUFRXBL5.js";import{g as a,h as o,j as l}from"./chunk-72CHOCZD.js";import{S as u,X as p}from"./chunk-56X5LYJH.js";var d=class i{constructor(t){this.http=t}baseUrl=g.apiBaseUrl;buildParams(t){return t?new o({fromObject:Object.fromEntries(Object.entries(t).filter(([,r])=>r!=null&&r!==""))}):new o}buildHeaders(t){return t?new a(t):new a}request(t,r,e,s){let n={params:this.buildParams(s?.params),headers:this.buildHeaders(s?.headers)};return e!=null&&(n.body=e),this.http.request(t,this.baseUrl+r,n)}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,s=!0,n=!1){let c=(s&&r instanceof FormData,r),m=n?"post":"put",f=s==!0?this.toFormData(r):r;return this.request(m,t,f,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,s=!0){let n=s==!0?this.toFormData(r):r;return this.request("post",t,n,e)}toFormData(t,r=new FormData,e=null){return t==null||(t instanceof File?r.append(e??"file",t):Array.isArray(t)?t.forEach((s,n)=>{let c=e?`${e}[${n}]`:String(n);this.toFormData(s,r,c)}):typeof t=="object"?Object.keys(t).forEach(s=>{let n=e?`${e}[${s}]`:s;this.toFormData(t[s],r,n)}):e&&r.append(e,String(t))),r}static \u0275fac=function(r){return new(r||i)(p(l))};static \u0275prov=u({token:i,factory:i.\u0275fac,providedIn:"root"})};export{d as a};
