import{I,_ as w}from"./ProviderDetails.vue_vue_type_style_index_0_lang-ClXR5oFa.js";import{I as v}from"./ItemsListing-D6AMqIYc.js";import{M as g}from"./MediaItemImages-DIQ1BhUp.js";import{c as l,E as _}from"./index-CxiRlsCY.js";import{d as h,r as f,w as A,o as D,a0 as V,b as E,e as s,H as M,D as u,I as m,f as n,u as B}from"./lucide-C2DU1LFb.js";import"./Toolbar-MwYpbj3t.js";import"./vuetify-RelkxOq-.js";import"./marquee_text_sync-BtOjTSaq.js";import"./vue-router-BgJK_hRC.js";import"./MediaItemThumb-C7OhU3lK.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-C17dV9_V.js";import"./Container-CwfZ2VgM.js";import"./index-kQIztB-E.js";import"./ListItem-DzUpG5Dm.js";import"./Button-DBt8j7D4.js";import"./vue-i18n-DySrp6mW.js";import"./utils-CDN07tui.js";import"./userPreferences-ln7cf3P6.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-D7lqdhVg.js";import"./PanelviewItemCompact-Cjl_ij1h.js";import"./qrcode-DSFhiIp2.js";import"./marked-C0Rlrcoy.js";import"./color-BTziYnFN.js";import"./vueuse-DIaEWNCo.js";/* empty css            */import"./swiper-Jy9GbtzK.js";const re=h({__name:"AlbumDetails",props:{itemId:{},provider:{}},setup(d){const a=d,e=f(),o=f(!1),b=async function(){o.value=!0,e.value=await l.getAlbum(a.itemId,a.provider),o.value=!1};A(()=>a.itemId,r=>{r&&b()},{immediate:!0}),D(()=>{const r=l.subscribe(_.MEDIA_ITEM_UPDATED,t=>{const i=t.data;if(e.value?.uri==i.uri)o.value=!0,e.value=i,o.value=!1;else if("provider_mappings"in i){for(const p of i.provider_mappings)if(p.item_id==a.itemId&&[p.provider_instance,p.provider_domain].includes(a.provider)){o.value=!0,e.value=i,o.value=!1;break}}});V(r)});const c=async function(r){return await l.getAlbumTracks(a.itemId,a.provider,r.libraryOnly)},y=async function(r){return await l.getAlbumVersions(e.value.item_id,e.value.provider)},k=async function(){e.value&&(e.value=await l.sendCommand("music/albums/update",{item_id:e.value.item_id,update:e.value,overwrite:!0}))};return(r,t)=>(s(),E("section",null,[M(I,{item:e.value,"active-provider":d.provider},null,8,["item","active-provider"]),e.value?(s(),u(v,{key:0,itemtype:"albumtracks","parent-item":e.value,"show-provider":!0,"show-track-number":!0,"show-favorites-only-filter":!0,"show-library-only-filter":e.value.provider=="library"&&B(l).hasStreamingProviders.value,"show-refresh-button":!1,"allow-key-hooks":!0,"load-items":c,"sort-keys":["track_number","name","sort_name","duration","duration_desc"],title:r.$t("tracks")},null,8,["parent-item","show-library-only-filter","title"])):m("",!0),t[1]||(t[1]=n("br",null,null,-1)),e.value?(s(),u(v,{key:1,itemtype:"albumversions","parent-item":e.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-refresh-button":!1,"load-items":y,"sort-keys":["provider","name","year"],title:r.$t("other_versions"),"hide-on-empty":!0,"refresh-on-parent-update":!0},null,8,["parent-item","title"])):m("",!0),t[2]||(t[2]=n("br",null,null,-1)),e.value?.provider=="library"&&e.value?.metadata?.images?(s(),u(g,{key:2,modelValue:e.value.metadata.images,"onUpdate:modelValue":[t[0]||(t[0]=i=>e.value.metadata.images=i),k]},null,8,["modelValue"])):m("",!0),t[3]||(t[3]=n("br",null,null,-1)),e.value?(s(),u(w,{key:3,"item-details":e.value},null,8,["item-details"])):m("",!0),t[4]||(t[4]=n("br",null,null,-1))]))}});export{re as default};
