import{I as w}from"./InfoHeader-3c46ysj1.js";import{I as v}from"./ItemsListing-Bq7dQOiw.js";import{M as g}from"./MediaItemImages-UQ1vUOOt.js";import{_ as h}from"./ProviderDetails.vue_vue_type_style_index_0_lang-CddUl0Gg.js";import{f as l,E as A,b as _}from"./index-DkCrJWiT.js";import{d as D,w as V,o as M,r as f,a0 as E,b as B,H as T,D as u,I as m,f as n,u as b,e as s}from"./lucide-CCrbsyJI.js";import"./Toolbar-Cm8ayNM7.js";import"./vuetify-DEtiqX2e.js";import"./marquee_text_sync-CYFWBA-S.js";import"./vue-router-D-D-f2lE.js";import"./MediaItemThumb-BOlp6GIr.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-hy1bGinH.js";import"./vue-i18n-krBRuO6q.js";import"./Container-ht6g3SFE.js";import"./index-kQIztB-E.js";import"./userPreferences-CvP8TO0n.js";import"./Button-C0-5VNWx.js";import"./ListItem-DbXLF-gF.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-ZEWdOjMC.js";import"./PanelviewItemCompact-CXjnVwrs.js";import"./color-CcshWhNz.js";import"./qrcode-CCHMWIXh.js";import"./marked-i_gIkIP3.js";import"./vueuse-FEBxOGD_.js";/* empty css            */import"./swiper-YiD1SI-4.js";const ae=D({__name:"AlbumDetails",props:{itemId:{},provider:{}},setup(d){const a=d,e=f(),o=f(!1),y=async function(){o.value=!0,e.value=await l.getAlbum(a.itemId,a.provider),o.value=!1};V(()=>a.itemId,r=>{r&&y()},{immediate:!0}),M(()=>{const r=l.subscribe(A.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}}});E(r)});const c=async function(r){return await l.getAlbumTracks(a.itemId,a.provider,r.libraryOnly)},k=async function(r){return await l.getAlbumVersions(e.value.item_id,e.value.provider)},I=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(),B("section",null,[T(w,{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":k,"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&&b(_).isAdmin()?(s(),u(g,{key:2,modelValue:e.value.metadata.images,"onUpdate:modelValue":[t[0]||(t[0]=i=>e.value.metadata.images=i),I]},null,8,["modelValue"])):m("",!0),t[3]||(t[3]=n("br",null,null,-1)),e.value?(s(),u(h,{key:3,"item-details":e.value},null,8,["item-details"])):m("",!0),t[4]||(t[4]=n("br",null,null,-1))]))}});export{ae as default};
