import{C as s,Fe as f,Mg as y,Qf as p,S as h,Uc as d,Yc as E,Z as u,ba as c,dg as I,jf as b,jg as g,n as m,vg as S}from"./chunk-OX24XL2F.js";import{i as l}from"./chunk-FQ4ILEWG.js";var a=class a{authHttp=c(E);restService=c(g);restExtractor=c(I);serverService=c(S);importVideoUrl(t,r){let i=a.BASE_VIDEO_IMPORT_URL,e=this.buildImportVideoObject(r);e.targetUrl=t;let n=p(e);return this.authHttp.post(i,n).pipe(s(o=>this.restExtractor.handleError(o)))}importVideoTorrent(t,r){let i=a.BASE_VIDEO_IMPORT_URL,e=this.buildImportVideoObject(r);typeof t=="string"?e.magnetUri=t:e.torrentfile=t;let n=p(e);return this.authHttp.post(i,n).pipe(s(o=>this.restExtractor.handleError(o)))}getMyVideoImports(t,r,i){let e=new d;if(e=this.restService.addRestGetParams(e,t,r),i){let n=this.restService.parseQueryStringFilter(i,{videoChannelSyncId:{prefix:"videoChannelSyncId:"},targetUrl:{prefix:"targetUrl:"}});e=this.restService.addObjectParams(e,n)}return this.authHttp.get(y.BASE_USERS_URL+"me/videos/imports",{params:e}).pipe(h(n=>this.extractVideoImports(n)),s(n=>this.restExtractor.handleError(n)))}deleteVideoImport(t){return this.authHttp.delete(a.BASE_VIDEO_IMPORT_URL+t.id).pipe(s(r=>this.restExtractor.handleError(r)))}cancelVideoImport(t){return this.authHttp.post(a.BASE_VIDEO_IMPORT_URL+t.id+"/cancel",{}).pipe(s(r=>this.restExtractor.handleError(r)))}buildImportVideoObject(t){let r=t.language||null,i=t.licence||null,e=t.category||null,n=t.description||null,o=t.support||null,R=t.scheduleUpdate||null,O=t.originallyPublishedAt||null;return{name:t.name,category:e,licence:i,language:r,support:o,description:n,channelId:t.channelId,privacy:t.privacy,tags:t.tags,nsfw:t.nsfw,waitTranscoding:t.waitTranscoding,commentsPolicy:t.commentsPolicy,downloadEnabled:t.downloadEnabled,thumbnailfile:t.thumbnailfile,previewfile:t.previewfile,scheduleUpdate:R,originallyPublishedAt:O}}extractVideoImports(t){return this.serverService.getServerLocale().pipe(m(r=>(t.data.forEach(i=>i.state.label=f(i.state.label,r)),t)))}};l(a,"BASE_VIDEO_IMPORT_URL",b.apiUrl+"/api/v1/videos/imports/"),l(a,"\u0275fac",function(r){return new(r||a)}),l(a,"\u0275prov",u({token:a,factory:a.\u0275fac}));var U=a;export{U as a};
/**i18n:93ef1b86561141301263c1f349fa8abb749523958c3a6dfaf46ed36d22b0a506*/
//# sourceMappingURL=chunk-A2LXTI2G.js.map
