import{Bc as zn,Hs as se,Wa as g,Wt as Jn,fr as S,gt as G,or as Rg,pc as vn,ro as he,sn as M,y as Be}from"./chunk-B_pj7Jpm.js";import{i as z}from"./chunk-qQMrTuzm.js";import{t as H}from"./chunk-CagJEiiY.js";import{t as Z}from"./chunk-TcpfKQW12.js";var A=class o{authHttp=g(zn);restExtractor=g(Jn);restService=g(Rg);videoService=g(H);playlistService=g(Z);static BASE_SEARCH_URL=se.apiUrl+`/api/v1/search/`;searchVideos(c){let{search:i,uuids:a,componentPagination:s,advancedSearch:r,skipCount:l}=c;if(r?.resultType!==void 0&&r.resultType!==`videos`)return M({total:0,data:[]});let n=o.BASE_SEARCH_URL+`videos`,t;s&&(t=this.restService.componentToRestPagination(s));let e=new vn;if(e=this.restService.addRestGetParams(e,t),i&&(e=e.append(`search`,i)),l===!0&&(e=e.append(`skipCount`,!0)),a&&(e=this.restService.addArrayParams(e,`uuids`,a)),r){let p=r.toVideosAPIObject();e=this.restService.addObjectParams(e,p)}return e=this.videoService.buildNSFWParams(e,{}),this.authHttp.get(n,{params:e}).pipe(Be(p=>this.videoService.extractVideos(p)),he(p=>this.restExtractor.handleError(p)))}searchVideoChannels(c){let{search:i,advancedSearch:a,componentPagination:s,handles:r}=c;if(a?.resultType!==void 0&&a.resultType!==`channels`)return M({total:0,data:[]});let l=o.BASE_SEARCH_URL+`video-channels`,n;s&&(n=this.restService.componentToRestPagination(s));let t=new vn;if(t=this.restService.addRestGetParams(t,n),i&&(t=t.append(`search`,i)),r&&(t=this.restService.addArrayParams(t,`handles`,r)),a){let e=a.toChannelAPIObject();t=this.restService.addObjectParams(t,e)}return this.authHttp.get(l,{params:t}).pipe(G(e=>z.extractVideoChannels(e)),he(e=>this.restExtractor.handleError(e)))}searchVideoPlaylists(c){let{search:i,advancedSearch:a,componentPagination:s,uuids:r}=c;if(a?.resultType!==void 0&&a.resultType!==`playlists`)return M({total:0,data:[]});let l=o.BASE_SEARCH_URL+`video-playlists`,n;s&&(n=this.restService.componentToRestPagination(s));let t=new vn;if(t=this.restService.addRestGetParams(t,n),i&&(t=t.append(`search`,i)),r&&(t=this.restService.addArrayParams(t,`uuids`,r)),a){let e=a.toPlaylistAPIObject();t=this.restService.addObjectParams(t,e)}return this.authHttp.get(l,{params:t}).pipe(Be(e=>this.playlistService.extractPlaylists(e)),he(e=>this.restExtractor.handleError(e)))}static ɵfac=function(i){return new(i||o)};static ɵprov=S({token:o,factory:o.ɵfac})};export{A as t};
//# debugId=a3435690-1607-55d1-baf0-69b78c84438a
//# sourceMappingURL=chunk-FhARnEsq.js.map