import{b as D,c as N}from"./chunk-V4YGGZ4W.js";import{$c as m,B as p,C as R,S as x,Xc as v,Y as d,aa as c,j as E,n as f,q as l,uh as h,vg as A,zh as H}from"./chunk-GKQGDBUU.js";import{i as n}from"./chunk-QVFSZZWQ.js";var o=class o{authHttp=c(m);restService=c(H);restExtractor=c(h);updateRedundancy(t,i){let r=o.BASE_REDUNDANCY_URL+"/"+t,a={redundancyAllowed:i};return this.authHttp.put(r,a).pipe(p(e=>this.restExtractor.handleError(e)))}listVideoRedundancies(t){let{pagination:i,sort:r,target:a}=t,e=new v;return e=this.restService.addRestGetParams(e,i,r),a&&(e=e.append("target",a)),this.authHttp.get(o.BASE_REDUNDANCY_URL+"/videos",{params:e}).pipe(p(s=>this.restExtractor.handleError(s)))}addVideoRedundancy(t){return this.authHttp.post(o.BASE_REDUNDANCY_URL+"/videos",{videoId:t.id}).pipe(p(i=>this.restExtractor.handleError(i)))}removeVideoRedundancies(t){let i=t.redundancies.streamingPlaylists.map(r=>r.id).map(r=>this.removeRedundancy(r));return l(...i).pipe(R())}removeRedundancy(t){return this.authHttp.delete(o.BASE_REDUNDANCY_URL+"/videos/"+t).pipe(p(i=>this.restExtractor.handleError(i)))}};n(o,"BASE_REDUNDANCY_URL",A.apiUrl+"/api/v1/server/redundancy"),n(o,"\u0275fac",function(i){return new(i||o)}),n(o,"\u0275prov",d({token:o,factory:o.\u0275fac}));var y=o;var G=(()=>{let t=class t{authHttp=c(m);restExtractor=c(h);store=new Map;getVideoFileToken({videoUUID:r,videoPassword:a}){let e=this.store.get(r);return e?E(e):this.createVideoFileToken(r,a).pipe(x(s=>this.store.set(r,{token:s.token,expires:new Date(s.expires)})))}createVideoFileToken(r,a){let e=D.buildVideoPasswordHeader(a);return this.authHttp.post(`${N.BASE_VIDEO_URL}/${r}/token`,{},{headers:e}).pipe(f(({files:s})=>s),p(s=>this.restExtractor.handleError(s)))}};n(t,"\u0275fac",function(a){return new(a||t)}),n(t,"\u0275prov",d({token:t,factory:t.\u0275fac}));let u=t;return u})();export{y as a,G as b};
/**i18n:42345378061bf3c93df67acfa161b751a7b03cc91f3ede7c1f1cdf2bba62fe26*/
//# sourceMappingURL=chunk-UU6OPGXG.js.map
