import{_ as d,f as v}from"./ItemsListing.vue_vue_type_style_index_0_lang-17edc154.js";import{_ as w,a as A}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-293d6364.js";import{l as g,r as c,c as I,w as D,o as M,L as o,a9 as V,b as B,y as l,I as E,j as T,z as n,H as u,D as b}from"./index-c2905444.js";import{n as f}from"./utils-a855eb36.js";import"./ListviewItem-90d92dc7.js";import"./ListItem-e72ce29c.js";import"./VImg-ee22af0e.js";import"./VMenu-8ba8f078.js";import"./VTooltip-54e33c2a.js";import"./VCheckboxBtn-020d02eb.js";import"./PanelviewItem.vue_vue_type_style_index_0_lang-74d21d61.js";import"./VCard-a2a52f2b.js";import"./contextmenu-c9d825c5.js";import"./eventbus-d154090d.js";import"./Alert-854e6197.js";import"./Container-920d5187.js";/* empty css              */import"./VToolbar-0b568cf9.js";import"./VTextField-b3baf9d7.js";import"./VBadge-78c551e8.js";import"./VRow-a177c0dd.js";import"./VVirtualScroll-da9f2ada.js";import"./layout-cc3c7cd6.js";import"./VDialog-d570b2c9.js";const $=b("br",null,null,-1),F=b("br",null,null,-1),ie=g({__name:"AlbumDetails",props:{itemId:{},provider:{},forceProviderVersion:{}},setup(_){const s=_,a=c(!1),t=c(),y=I(()=>{var r;if(((r=t.value)==null?void 0:r.provider)!=="library")return[];const e=["library"];for(const i of f(t.value))e.push(i.provider_instance);return e}),p=async function(){t.value=await o.getAlbum(s.itemId,s.provider)};D(()=>s.itemId,e=>{e&&p()},{immediate:!0}),M(()=>{const e=o.subscribe(V.MEDIA_ITEM_ADDED,r=>{var m;const i=r.data;((m=t.value)==null?void 0:m.uri)==i.uri&&(a.value=!0)});B(e)});const k=async function(e){let r=[];if(e.refresh&&(await p(),a.value=!1),!t.value)r=[];else if(e.providerFilter&&e.providerFilter!="library"){for(const i of f(t.value))if(i.provider_instance==e.providerFilter){r=await o.getAlbumTracks(i.item_id,i.provider_instance);break}}else r=await o.getAlbumTracks(t.value.item_id,t.value.provider);return a.value=!1,v(r,e)},h=async function(e){return v(await o.getAlbumVersions(t.value.item_id,t.value.provider),e)};return(e,r)=>(l(),E("section",null,[T(w,{item:t.value,"active-provider":e.provider},null,8,["item","active-provider"]),t.value?(l(),n(d,{key:0,itemtype:"albumtracks","parent-item":t.value,"show-provider":!1,"show-favorites-only-filter":!1,"load-data":k,"sort-keys":["track_number","name","duration"],"update-available":a.value,title:e.$t("tracks"),"provider-filter":y.value},null,8,["parent-item","update-available","title","provider-filter"])):u("",!0),$,t.value?(l(),n(d,{key:1,itemtype:"albumversions","parent-item":t.value,"show-provider":!0,"show-favorites-only-filter":!1,"load-data":h,"sort-keys":["provider","name","year"],"update-available":a.value,title:e.$t("other_versions"),"hide-on-empty":!0},null,8,["parent-item","update-available","title"])):u("",!0),F,t.value?(l(),n(A,{key:2,"item-details":t.value},null,8,["item-details"])):u("",!0)]))}});export{ie as default};
