import{l as L,r as _,w as N,o as E,O as l,af as g,b as z,q as p,y as k,j as i,x as s,v as b,F,z as P,M as y,L as C,ai as R,K as h,N as c,A as S,ah as j}from"./index-a5bb9833.js";import{_ as V,f as w}from"./ItemsListing.vue_vue_type_script_setup_true_lang-83c47556.js";import{_ as q}from"./InfoHeader.vue_vue_type_style_index_0_lang-ffdc6f99.js";import{C as I,L as H,a as K}from"./Container-4773c160.js";import{V as O}from"./VToolbar-b79315e8.js";import{V as U}from"./VDivider-df9414f0.js";import{V as G}from"./VMenu-240a4406.js";import{a as J}from"./VCard-04ae357c.js";import{l as Q}from"./VBtn-629f5316.js";import"./ListviewItem-e2342ce8.js";import"./MediaItemThumb.vue_vue_type_style_index_0_lang-a35ce75a.js";import"./VDialog-667c0916.js";import"./VListItem-39677d21.js";import"./VSelect-4d69c543.js";/* empty css                             */import"./PanelviewItem.vue_vue_type_style_index_0_lang-d218249a.js";import"./Alert-a5ce795e.js";import"./VBadge-f7d58168.js";import"./VRow-7d86481a.js";/* empty css              */import"./layout-ff13c6fd.js";const W=C("br",null,null,-1),X=C("br",null,null,-1),_e=L({__name:"AlbumDetails",props:{itemId:{},provider:{},forceProviderVersion:{}},setup(A){const o=A,m=_(!1),n=_(),v=async function(){n.value=await l.getAlbum(o.itemId,o.provider)};N(()=>o.itemId,e=>{e&&v()},{immediate:!0}),E(()=>{const e=l.subscribe(g.MEDIA_ITEM_ADDED,a=>{var t;const r=a.data;((t=n.value)==null?void 0:t.uri)==r.uri&&(m.value=!0)});z(e)});const $=async function(e,a,r,t,u=!0){const d=await l.getAlbumTracks(o.itemId,o.provider);return w(d,e,a,r,t,u)},D=async function(e,a,r,t,u=!0){const d=[];if(o.provider=="library"){const f=await l.getAlbumVersions(o.itemId,o.provider);d.push(...f)}for(const f of R(n.value)){const B=await l.getAlbumVersions(f.item_id,f.provider_instance);d.push(...B)}return w(d,e,a,r,t,u)},T=function(e){window.open(e,"_blank")};return(e,a)=>(p(),k("section",null,[i(q,{item:n.value,"active-provider":e.provider},null,8,["item","active-provider"]),i(I,null,{default:s(()=>[i(V,{itemtype:"albumtracks","parent-item":n.value,"show-provider":!1,"show-favorites-only-filter":!1,"load-data":$,"sort-keys":["track_number","sort_name","duration"],"update-available":m.value,onRefreshClicked:a[0]||(a[0]=r=>{v(),m.value=!1}),title:e.$t("tracks"),checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"]),W,i(V,{itemtype:"albumversions","parent-item":n.value,"show-provider":!0,"show-favorites-only-filter":!1,"load-data":D,"sort-keys":["provider","sort_name","year"],"update-available":m.value,onRefreshClicked:a[1]||(a[1]=r=>{v(),m.value=!1}),title:e.$t("other_versions"),"hide-on-empty":!0,checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"]),X,e.provider=="library"?(p(),b(J,{key:0,style:{"margin-bottom":"10px"}},{default:s(()=>[i(O,{color:"transparent",title:e.$t("mapped_providers"),style:{height:"55px"}},null,8,["title"]),i(U),i(I,null,{default:s(()=>[i(G,null,{default:s(()=>{var r;return[(p(!0),k(F,null,P((r=n.value)==null?void 0:r.provider_mappings,t=>(p(),b(H,{key:t.provider_instance,onClick:u=>e.$router.push({name:"album",params:{itemId:t.item_id,provider:t.provider_instance}})},{prepend:s(()=>[i(K,{domain:t.provider_domain,size:30},null,8,["domain"])]),title:s(()=>[h(c(S(l).providerManifests[t.provider_domain].name),1)]),subtitle:s(()=>[h(c(t.item_id)+" | "+c(t.audio_format.content_type)+" | "+c(t.audio_format.sample_rate/1e3)+"kHz/"+c(t.audio_format.bit_depth)+" bits ",1)]),append:s(()=>[t.url?(p(),b(Q,{key:0,variant:"plain",icon:"mdi-open-in-new",onClick:j(u=>T(t.url),["prevent"])},null,8,["onClick"])):y("",!0)]),_:2},1032,["onClick"]))),128))]}),_:1})]),_:1})]),_:1})):y("",!0)]),_:1})]))}});export{_e as default};
