import{_,f as b}from"./ItemsListing.vue_vue_type_style_index_0_lang-38bc2f50.js";import{_ as h,a as g}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-1829229a.js";import{l as D,r as u,w as I,o as E,H as a,ao as F,b as M,c as T,aq as m,v as l,A as B,j as $,x as d,D as v,I as y}from"./index-dcf0de03.js";import"./ListviewItem-2c46c8ee.js";import"./MediaItemThumb.vue_vue_type_style_index_0_lang-b38d9ae1.js";import"./ListItem-6dad7331.js";import"./VBtn-a0da5efe.js";import"./VMenu-3bdd1b96.js";import"./index-0afee102.js";import"./VListItem-943ee224.js";import"./VCheckboxBtn-d54a899d.js";import"./VCard-111cabcf.js";/* empty css                             */import"./PanelviewItem.vue_vue_type_style_index_0_lang-44df1bef.js";import"./contextmenu-ec34ccac.js";import"./eventbus-d154090d.js";import"./Alert-eb81bdeb.js";import"./Container-d623752d.js";/* empty css              */import"./VToolbar-dfba6de4.js";import"./VTextField-f81f9175.js";import"./VBadge-8be61727.js";import"./VRow-73379099.js";import"./layout-087be267.js";import"./VDialog-ccbfddc9.js";const C=y("br",null,null,-1),N=y("br",null,null,-1),oe=D({__name:"ArtistDetails",props:{itemId:{},provider:{}},setup(k){const s=k,n=u("library"),o=u(!1),t=u(),p=async function(){const e=n.value;n.value="",t.value=await a.getArtist(s.itemId,s.provider),n.value=e};I(()=>s.itemId,e=>{e&&p()},{immediate:!0}),E(()=>{const e=a.subscribe(F.MEDIA_ITEM_ADDED,r=>{var f;const i=r.data;((f=t.value)==null?void 0:f.uri)==i.uri&&(o.value=!0)});M(e)});const w=async function(e){let r=[];if(e.refresh&&(await p(),o.value=!1),!t.value)r=[];else if(e.providerFilter&&e.providerFilter!="library"){for(const i of m(t.value))if(i.provider_instance==e.providerFilter){r=await a.getArtistAlbums(i.item_id,i.provider_instance);break}}else r=await a.getArtistAlbums(t.value.item_id,t.value.provider);return b(r,e)},A=async function(e){let r=[];if(e.refresh&&(await p(),o.value=!1),!t.value)r=[];else if(e.providerFilter&&e.providerFilter!="library"){for(const i of m(t.value))if(i.provider_instance==e.providerFilter){r=await a.getArtistTracks(i.item_id,i.provider_instance);break}}else r=await a.getArtistTracks(t.value.item_id,t.value.provider);return b(r,e)},c=T(()=>{var r;if(((r=t.value)==null?void 0:r.provider)!=="library")return[];const e=["library"];for(const i of m(t.value))e.push(i.provider_instance);return e});return(e,r)=>(l(),B("section",null,[$(h,{item:t.value},null,8,["item"]),t.value?(l(),d(_,{key:0,itemtype:"artisttracks","parent-item":t.value,"show-provider":!1,"show-favorites-only-filter":!1,"show-track-number":!1,"load-data":A,"sort-keys":["timestamp_added DESC","sort_name","sort_album"],"update-available":o.value,title:e.$t("tracks"),"provider-filter":c.value,"allow-collapse":!0},null,8,["parent-item","update-available","title","provider-filter"])):v("",!0),C,t.value?(l(),d(_,{key:1,itemtype:"artistalbums","parent-item":t.value,"show-provider":!1,"show-favorites-only-filter":!1,"load-data":w,"sort-keys":["timestamp_added DESC","sort_name","year"],"update-available":o.value,title:e.$t("albums"),"provider-filter":c.value,"allow-collapse":!0},null,8,["parent-item","update-available","title","provider-filter"])):v("",!0),N,t.value?(l(),d(g,{key:2,"item-details":t.value},null,8,["item-details"])):v("",!0)]))}});export{oe as default};
