import{i as R,l as h}from"./chunk-N7PC5CHF.js";import{f}from"./chunk-ZTKV4AIV.js";import{c as P}from"./chunk-5JDCLYZA.js";import{b as y,e as s,h as b}from"./chunk-73IMXZSJ.js";import{X as l,cb as d,ha as m,na as p,u as g}from"./chunk-FWZCAEAJ.js";function N(t){let e=new y;return e=e.append("page",t.page??0),e=e.append("size",t.size??10),t.sort&&(e=e.append("sort",t.sort)),t.query&&t.query.length>0&&(e=e.append("query",t.query)),e}function O(t,e=""){return t&&e!==""?`${t},${e}`:void 0}function $(t,e="desc"){let o=p(R),r=p(h),i=P(o.queryParamMap.pipe(g(n=>({page:n.get("page")?f(n.get("page")):0,size:n.get("size")?f(n.get("size")):20,sort:n.get("sort")??t,direction:n.get("direction")??e}))),{initialValue:{page:0,size:20,sort:t,direction:e}}),c=d(!0),a=d(0);return{params:i,loading:c,totalElements:a,activatedRoute:o,updateParams:n=>void r.navigate([],{relativeTo:o,queryParamsHandling:"merge",queryParams:n})}}var D=(()=>{let e=class e{constructor(){this.httpClient=p(b)}download$(r,i){return this.httpClient.get(r,{reportProgress:!0,observe:"events",responseType:"blob"}).pipe(j(c=>{let a=document.createElement("a"),u=URL.createObjectURL(c);a.href=u,a.download=i,a.click(),URL.revokeObjectURL(u)}))}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=m({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();function j(t){return e=>e.pipe(l((o,r)=>q(r)?{progress:r.total?Math.round(100*r.loaded/r.total):o.progress,state:"IN_PROGRESS"}:E(r)?(t&&r.body&&t(r.body),{progress:100,state:"DONE",content:r.body??void 0}):o,{state:"PENDING",progress:0}))}function E(t){return t.type===s.Response}function q(t){return t.type===s.DownloadProgress||t.type===s.UploadProgress}function S(t,e,o){if(o!=null)if(Array.isArray(o)){if(o.length>0)for(let r of o)t=t.append(e,r)}else t=t.append(e,`${o}`);return t}export{N as a,O as b,$ as c,D as d,S as e};
