import{I,_ as w}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-Cn4WWbvY.js";import{I as v}from"./ItemsListing-XUXN-Um6.js";import{M as g}from"./MediaItemImages-DiXyyEvy.js";import{d as _,r as f,ae as h,m as A,v as l,a$ as V,q as D,c as M,b as B,h as m,e as u,a as n,u as E,o as s}from"./index-Bn2Tzsay.js";import"./Toolbar-Ba4dAxS1.js";import"./VToolbar-Z0nE2qFc.js";import"./VBtn-BQk37KYJ.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./marquee_text_sync-CHIyYfjU.js";import"./MediaItemThumb-B7hfZSf2.js";import"./VDialog-DRfRMr5_.js";import"./layout-kFqKNtL6.js";import"./Container-CEbFgC5b.js";import"./index-CBho6rsP.js";import"./VContainer-CRIwFZfO.js";/* empty css              */import"./ListItem-BNbxxrdg.js";import"./Button-r9Wpw3CQ.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-DCLVCnPO.js";import"./VInput-C_1AW61Q.js";import"./PanelviewItemCompact-By5cXXTW.js";import"./VSpacer-ygjaGObn.js";import"./VTextField-fPA0WAHx.js";import"./VInfiniteScroll-DvbiA0kw.js";import"./VRow-CNVApy9v.js";import"./VVirtualScroll-B56qZ1Y0.js";import"./VAlert-Bj5fXNhB.js";const ae=_({__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};h(()=>a.itemId,r=>{r&&b()},{immediate:!0}),A(()=>{const r=l.subscribe(V.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}}});D(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(),M("section",null,[B(I,{item:e.value,"active-provider":d.provider},null,8,["item","active-provider"]),e.value?(s(),m(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"&&E(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"])):u("",!0),t[1]||(t[1]=n("br",null,null,-1)),e.value?(s(),m(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},null,8,["parent-item","title"])):u("",!0),t[2]||(t[2]=n("br",null,null,-1)),e.value?.provider=="library"&&e.value?.metadata?.images?(s(),m(g,{key:2,modelValue:e.value.metadata.images,"onUpdate:modelValue":[t[0]||(t[0]=i=>e.value.metadata.images=i),k]},null,8,["modelValue"])):u("",!0),t[3]||(t[3]=n("br",null,null,-1)),e.value?(s(),m(w,{key:3,"item-details":e.value},null,8,["item-details"])):u("",!0),t[4]||(t[4]=n("br",null,null,-1))]))}});export{ae as default};
