import{_ as v}from"./ItemsListing.vue_vue_type_style_index_0_lang-6fa46e09.js";import{_ as h,a as w}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-2ad91279.js";import{l as A,r as d,c as g,w as D,o as I,J as o,ai as B,b as M,v as l,B as V,j as E,x as n,G as u,z as f,ak as c}from"./index-e5db0b73.js";import"./ListviewItem-7c178b7a.js";import"./VBadge-efd00f67.js";import"./ListItem-ac3869d3.js";import"./VImg-7a057c50.js";import"./VMenu-d9833a31.js";import"./VCheckboxBtn-46446b67.js";import"./VCard-c9b9f4e9.js";import"./VTooltip-71530943.js";import"./PanelviewItem.vue_vue_type_style_index_0_lang-221d4edc.js";import"./contextmenu-8eac6b44.js";import"./Alert-1172b8fb.js";import"./Container-238e2d02.js";import"./VToolbar-4e8dded4.js";import"./VTextField-46667b30.js";import"./VVirtualScroll-01555b84.js";import"./layout-3130552d.js";import"./VDialog-cda0f95b.js";const T=f("br",null,null,-1),$=f("br",null,null,-1),Y=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}),p=async function(){e.value=await o.getAlbum(s.itemId,s.provider)};D(()=>s.itemId,t=>{t&&p()},{immediate:!0}),I(()=>{const t=o.subscribe(B.MEDIA_ITEM_ADDED,r=>{var m;const i=r.data;((m=e.value)==null?void 0:m.uri)==i.uri&&(a.value=!0)});M(t)});const y=async function(t){let r=[];if(t.refresh&&(await p(),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(),V("section",null,[E(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{Y as default};
