import{An as M,Bo as kr,Dr as Rg,Fa as er,Ja as g,Mr as S,St as G,bs as pt,ea as ae,fc as vn,pi as Wn,ro as he,va as cf}from"./chunk-b0nJCs5_.js";import{r as b,t as H}from"./chunk-CswnO8Ym.js";var y=class i{authHttp=g(Wn);restService=g(Rg);restExtractor=g(er);static BASE_REDUNDANCY_URL=ae.apiUrl+`/api/v1/server/redundancy`;updateRedundancy(t,e){let r=i.BASE_REDUNDANCY_URL+`/`+t,o={redundancyAllowed:e};return this.authHttp.put(r,o).pipe(he(a=>this.restExtractor.handleError(a)))}listVideoRedundancies(t){let{pagination:e,sort:r,target:o}=t,a=new vn;return a=this.restService.addRestGetParams(a,e,r),o&&(a=a.append(`target`,o)),this.authHttp.get(i.BASE_REDUNDANCY_URL+`/videos`,{params:a}).pipe(he(b=>this.restExtractor.handleError(b)))}addVideoRedundancy(t){return this.authHttp.post(i.BASE_REDUNDANCY_URL+`/videos`,{videoId:t.id}).pipe(he(e=>this.restExtractor.handleError(e)))}removeVideoRedundancies(t){return kr(...t.redundancies.streamingPlaylists.map(r=>r.id).map(r=>this.removeRedundancy(r))).pipe(cf())}removeRedundancy(t){return this.authHttp.delete(i.BASE_REDUNDANCY_URL+`/videos/`+t).pipe(he(e=>this.restExtractor.handleError(e)))}static ɵfac=function(e){return new(e||i)};static ɵprov=S({token:i,factory:i.ɵfac})};var x=class i{authHttp=g(Wn);restExtractor=g(er);store=new Map;getVideoFileToken({videoUUID:t,videoPassword:e}){let r=this.store.get(t);return r?M(r):this.createVideoFileToken(t,e).pipe(pt(o=>this.store.set(t,{token:o.token,expires:new Date(o.expires)})))}createVideoFileToken(t,e){let r=b.buildVideoPasswordHeader(e);return this.authHttp.post(`${H.BASE_VIDEO_URL}/${t}/token`,{},{headers:r}).pipe(G(({files:o})=>o),he(o=>this.restExtractor.handleError(o)))}static ɵfac=function(e){return new(e||i)};static ɵprov=S({token:i,factory:i.ɵfac})};export{y as n,x as t};
//# debugId=be4c6603-d56a-551a-b37d-8f6c4bbf5d0b
//# sourceMappingURL=chunk-DUrVXBNc.js.map