import{_ as v}from"./ItemsListing.vue_vue_type_style_index_0_lang-8114fc79.js";import{_ as h,a as w}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-fa22e869.js";import{v as A,r as d,c as g,w as I,o as D,L as o,ak as B,b as E,y as l,E as M,l as V,z as n,I as u,B as f,am as c}from"./index-20675090.js";import"./ListviewItem-ea07a19b.js";import"./VBadge-778cac01.js";import"./ListItem-e092a77b.js";import"./forwardRefs-67412654.js";import"./VMenu-ae4158ef.js";import"./VCheckboxBtn-bbfa74a1.js";import"./VSlideGroup-14bb6bf6.js";import"./VCard-30020028.js";import"./VCardText-5e149cd1.js";import"./VTooltip-cf009865.js";import"./PanelviewItem.vue_vue_type_style_index_0_lang-4e768a3d.js";import"./contextmenu-ec90c658.js";import"./Alert-daf9024b.js";import"./Container-e8fef44d.js";/* empty css              */import"./VToolbar-7174c765.js";import"./VTextField-8bb22937.js";import"./VVirtualScroll-b47ffb64.js";import"./layout-0badeb0a.js";import"./VDialog-d7f48b87.js";const T=f("br",null,null,-1),$=f("br",null,null,-1),te=A({__name:"AlbumDetails",props:{itemId:{},provider:{},forceProviderVersion:{}},setup(b){const s=b,a=d(!1),e=d(),_=g(()=>{var r;if(((r=e.value)==null?void 0:r.provider)!=="library")return[];const t=["library"];for(const i of c(e.value))t.push(i.provider_instance);return t}),m=async function(){e.value=await o.getAlbum(s.itemId,s.provider)};I(()=>s.itemId,t=>{t&&m()},{immediate:!0}),D(()=>{const t=o.subscribe(B.MEDIA_ITEM_ADDED,r=>{var p;const i=r.data;((p=e.value)==null?void 0:p.uri)==i.uri&&(a.value=!0)});E(t)});const y=async function(t){let r=[];if(t.refresh&&(await m(),a.value=!1),!e.value)r=[];else if(t.providerFilter&&t.providerFilter!="library"){for(const i of c(e.value))if(i.provider_instance==t.providerFilter){r=await o.getAlbumTracks(i.item_id,i.provider_instance);break}}else r=await o.getAlbumTracks(e.value.item_id,e.value.provider);return a.value=!1,r},k=async function(t){return await o.getAlbumVersions(e.value.item_id,e.value.provider)};return(t,r)=>(l(),M("section",null,[V(h,{item:e.value,"active-provider":t.provider},null,8,["item","active-provider"]),e.value?(l(),n(v,{key:0,itemtype:"albumtracks","parent-item":e.value,"show-provider":!1,"show-favorites-only-filter":!1,"load-items":y,"sort-keys":["track_number","name","duration"],"update-available":a.value,title:t.$t("tracks"),"provider-filter":_.value},null,8,["parent-item","update-available","title","provider-filter"])):u("",!0),T,e.value?(l(),n(v,{key:1,itemtype:"albumversions","parent-item":e.value,"show-provider":!0,"show-favorites-only-filter":!1,"load-items":k,"sort-keys":["provider","name","year"],"update-available":a.value,title:t.$t("other_versions"),"hide-on-empty":!0},null,8,["parent-item","update-available","title"])):u("",!0),$,e.value?(l(),n(w,{key:2,"item-details":e.value},null,8,["item-details"])):u("",!0)]))}});export{te as default};
