import{_ as k,f as y}from"./ItemsListing.vue_vue_type_script_setup_true_lang-436cf3d3.js";import{_ as D}from"./InfoHeader.vue_vue_type_style_index_0_lang-36a95710.js";import{l as B,r as _,w as E,o as T,O as m,af as g,b as L,q as s,y as v,j as n,v as c,x as f,F as z,z as N,A as I,M as b,ah as F,L as h}from"./index-e9211ef1.js";import{L as $,a as w}from"./Container-349a0ac0.js";import{a as P}from"./VCard-138864fc.js";import"./ListviewItem-b7a4258b.js";import"./MediaItemThumb.vue_vue_type_style_index_0_lang-278977b5.js";import"./VMenu-bc0cce60.js";import"./VDivider-336c24cd.js";import"./VBtn-68784d55.js";import"./VListItem-230d1393.js";import"./VDialog-5f240a62.js";import"./VToolbar-daf2b89f.js";import"./VSelect-04a129eb.js";/* empty css                             */import"./PanelviewItem.vue_vue_type_style_index_0_lang-fefd2afe.js";import"./Alert-55091fd0.js";import"./VSpacer-bdf2f653.js";import"./VBadge-9fa94f29.js";import"./VRow-e8f3e51e.js";/* empty css              */import"./layout-4499d5bc.js";const oe=B({__name:"AlbumDetails",props:{itemId:{},provider:{},forceProviderVersion:{}},setup(A){const o=A,l=_(!1),t=_(),u=async function(){t.value=await m.getAlbum(o.itemId,o.provider)};E(()=>o.itemId,e=>{e&&u()},{immediate:!0}),T(()=>{const e=m.subscribe(g.MEDIA_ITEM_ADDED,a=>{var i;const r=a.data;((i=t.value)==null?void 0:i.uri)==r.uri&&(l.value=!0)});L(e)});const C=async function(e,a,r,i,d=!0){const p=await m.getAlbumTracks(o.itemId,o.provider);return y(p,e,a,r,i,d)},V=async function(e,a,r,i,d=!0){const p=await m.getAlbumVersions(o.itemId,o.provider);return y(p,e,a,r,i,d)};return(e,a)=>(s(),v("section",null,[n(D,{item:t.value,"active-provider":e.provider},null,8,["item","active-provider"]),n(k,{itemtype:"albumtracks","parent-item":t.value,"show-provider":!1,"show-favorites-only-filter":!1,"load-data":C,"sort-keys":["track_number","sort_name","duration"],"update-available":l.value,onRefreshClicked:a[0]||(a[0]=r=>{u(),l.value=!1}),title:e.$t("tracks"),checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"]),n(k,{itemtype:"albumversions","parent-item":t.value,"show-provider":!0,"show-favorites-only-filter":!1,"load-data":V,"sort-keys":["provider","sort_name","year"],"update-available":l.value,onRefreshClicked:a[1]||(a[1]=r=>{u(),l.value=!1}),title:e.$t("other_versions"),"hide-on-empty":!0,checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"]),t.value&&t.value.provider=="library"?(s(),c(P,{key:0,style:{"margin-left":"20px","margin-right":"20px"}},{default:f(()=>[(s(!0),v(z,null,N(I(F)(t.value),r=>(s(),v("div",{key:r.provider_instance},[[r.provider_domain,r.provider_instance].includes(e.provider)?b("",!0):(s(),c($,{key:0,onClick:i=>e.$router.replace({name:"album",params:{itemId:r.item_id,provider:r.provider_instance}}),subtitle:e.$t("check_item_on_provider",[t.value.name,I(m).providerManifests[r.provider_domain].name])},{prepend:f(()=>[h("div",null,[n(w,{domain:r.provider_domain,size:30},null,8,["domain"])])]),_:2},1032,["onClick","subtitle"])),e.provider!="library"&&t.value.provider=="library"?(s(),c($,{key:1,onClick:a[2]||(a[2]=i=>e.$router.replace({name:"album",params:{itemId:t.value.item_id,provider:t.value.provider}})),subtitle:e.$t("check_item_in_library",[t.value.name])},{prepend:f(()=>[h("div",null,[n(w,{domain:"library",size:30})])]),_:1},8,["subtitle"])):b("",!0)]))),128))]),_:1})):b("",!0)]))}});export{oe as default};
