"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[978],{6561:function(e,t,a){a.d(t,{A:function(){return u}});var s=a(641),n=a(33);const i={class:"no-items-container"};function l(e,t,a,l,o,d){return(0,s.uX)(),(0,s.CE)("div",i,[(0,s.Lk)("div",{class:(0,n.C4)(["no-items fade-in",{shadow:a.withShadow}])},[(0,s.RG)(e.$slots,"default",{},void 0,!0)],2)])}var o={name:"NoItems",props:{withShadow:{type:Boolean,default:!0}}},d=a(6262);const r=(0,d.A)(o,[["render",l],["__scopeId","data-v-4856c4d7"]]);var u=r},978:function(e,t,a){a.r(t),a.d(t,{default:function(){return E}});var s=a(641),n=a(33);const i={class:"media-youtube-playlist"},l={key:1,class:"playlist-container"},o={class:"header"},d={class:"banner"},r=["src"],u={class:"row info-container"},m={class:"info"},c={class:"row"},h=["href"],p={key:1,class:"title"},y={class:"n-items"},g={key:0,class:"row"},v={class:"description"},k={key:1,class:"row"},f={class:"channel"},w=["href"];function L(e,t,a,L,_,b){const C=(0,s.g2)("Loading"),P=(0,s.g2)("NoItems"),A=(0,s.g2)("Results");return(0,s.uX)(),(0,s.CE)("div",i,[b.showLoading?((0,s.uX)(),(0,s.Wv)(C,{key:0})):((0,s.uX)(),(0,s.CE)("div",l,[(0,s.Lk)("div",o,[(0,s.Lk)("div",d,[a.metadata?.image?.length?((0,s.uX)(),(0,s.CE)("img",{key:0,src:a.metadata?.image},null,8,r)):(0,s.Q3)("",!0)]),(0,s.Lk)("div",u,[(0,s.Lk)("div",m,[(0,s.Lk)("div",c,[a.metadata?.url?((0,s.uX)(),(0,s.CE)("a",{key:0,class:"title",href:a.metadata?.url,target:"_blank",rel:"noopener noreferrer"},(0,n.v_)(b.name),9,h)):((0,s.uX)(),(0,s.CE)("span",p,(0,n.v_)(b.name),1)),(0,s.Lk)("div",y,(0,n.v_)(b.nItems)+" videos",1)]),a.metadata?.description?((0,s.uX)(),(0,s.CE)("div",g,[(0,s.Lk)("div",v,(0,n.v_)(a.metadata?.description),1)])):(0,s.Q3)("",!0),a.metadata?.channel_url?((0,s.uX)(),(0,s.CE)("div",k,[(0,s.Lk)("div",f,[t[9]||(t[9]=(0,s.eW)(" Uploaded by ")),(0,s.Lk)("a",{href:a.metadata.channel_url,target:"_blank",rel:"noopener noreferrer"},(0,n.v_)(a.metadata?.channel),9,w)])])):(0,s.Q3)("",!0)])])]),b.nItems?((0,s.uX)(),(0,s.Wv)(A,{key:1,results:_.items,sources:{youtube:!0},filter:a.filter,playlist:a.id,"selected-result":_.selectedResult,onAddToPlaylist:t[0]||(t[0]=t=>e.$emit("add-to-playlist",t)),onDownload:t[1]||(t[1]=t=>e.$emit("download",t)),onDownloadAudio:t[2]||(t[2]=t=>e.$emit("download-audio",t)),onOpenChannel:t[3]||(t[3]=t=>e.$emit("open-channel",t)),onPlay:t[4]||(t[4]=t=>e.$emit("play",t)),onPlayWithOpts:t[5]||(t[5]=t=>e.$emit("play-with-opts",t)),onRemoveFromPlaylist:t[6]||(t[6]=t=>e.$emit("remove-from-playlist",t)),onScrollEnd:b.loadItems,onSelect:t[7]||(t[7]=e=>_.selectedResult=e),onView:t[8]||(t[8]=t=>e.$emit("view",t))},null,8,["results","filter","playlist","selected-result","onScrollEnd"])):((0,s.uX)(),(0,s.Wv)(P,{key:0,"with-shadow":!1},{default:(0,s.k6)((()=>t[10]||(t[10]=[(0,s.eW)(" No videos found. ")]))),_:1}))]))])}var _=a(6561),b=a(9828),C=a(3149),P=a(2002),A={mixins:[P.A],emits:["add-to-playlist","download","download-audio","open-channel","play","play-with-opts","remove-from-playlist","view"],components:{Loading:b.A,NoItems:_.A,Results:C.A},props:{id:{type:String,required:!0},filter:{type:String,default:null},metadata:{type:Object,default:null}},data(){return{initialLoading:!0,items:[],loading:!1,nextPageToken:null,renderedPageTokens:{},selectedResult:null}},computed:{name(){return this.metadata?.title||this.metadata?.name},nItems(){return this.metadata?.videos||this.items?.length||0},showLoading(){return this.loading&&this.initialLoading}},methods:{async loadItems(){if(!this.loading){this.loading=!0;try{if(this.renderedPageTokens[this.nextPageToken])return;this.items=[...this.items,...(await this.request("youtube.get_playlist",{id:this.id,page:this.nextPageToken})).map((e=>({...e,type:"youtube"})))],this.initialLoading=!1,this.renderedPageTokens[this.nextPageToken]=!0,this.items.length&&(this.nextPageToken=this.items[this.items.length-1].next_page_token)}finally{this.loading=!1}}}},mounted(){this.setUrlArgs({playlist:this.id}),this.loadItems()},unmounted(){this.setUrlArgs({playlist:null})}},I=a(6262);const X=(0,I.A)(A,[["render",L],["__scopeId","data-v-32ebcce6"]]);var E=X}}]);
//# sourceMappingURL=978.ff5efc1a.js.map