import{_ as d}from"./ItemsListing.vue_vue_type_style_index_0_lang-8114fc79.js";import{_ as w,a as I}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-fa22e869.js";import{v as T,r as n,c as g,w as D,o as A,L as i,ak as B,b as E,y as l,E as M,l as V,z as u,I as p,B as f,am as c}from"./index-20675090.js";import"./ListviewItem-ea07a19b.js";import"./VBadge-778cac01.js";import"./ListItem-e092a77b.js";import"./forwardRefs-67412654.js";import"./VMenu-ae4158ef.js";import"./VCheckboxBtn-bbfa74a1.js";import"./VSlideGroup-14bb6bf6.js";import"./VCard-30020028.js";import"./VCardText-5e149cd1.js";import"./VTooltip-cf009865.js";import"./PanelviewItem.vue_vue_type_style_index_0_lang-4e768a3d.js";import"./contextmenu-ec90c658.js";import"./Alert-daf9024b.js";import"./Container-e8fef44d.js";/* empty css              */import"./VToolbar-7174c765.js";import"./VTextField-8bb22937.js";import"./VVirtualScroll-b47ffb64.js";import"./layout-0badeb0a.js";import"./VDialog-d7f48b87.js";const $=f("br",null,null,-1),F=f("br",null,null,-1),te=T({__name:"TrackDetails",props:{itemId:{},provider:{},album:{}},setup(b){const o=b,k=n(""),s=n(!1),r=n(),_=g(()=>{var t;if(((t=r.value)==null?void 0:t.provider)!=="library")return[];const e=["library"];for(const a of c(r.value))e.push(a.provider_instance);return e}),m=async function(){r.value=await i.getTrack(o.itemId,o.provider,o.album),k.value="versions"};D(()=>o.itemId,e=>{e&&m()},{immediate:!0}),A(()=>{const e=i.subscribe(B.MEDIA_ITEM_ADDED,t=>{var v;const a=t.data;((v=r.value)==null?void 0:v.uri)==a.uri&&(s.value=!0)});E(e)});const h=async function(e){return await i.getTrackVersions(r.value.item_id,r.value.provider)},y=async function(e){let t=[];if(e.refresh&&await m(),!r.value)t=[];else if(e.providerFilter&&e.providerFilter!="library"){for(const a of c(r.value))if(a.provider_instance==e.providerFilter){t=await i.getTrackAlbums(a.item_id,a.provider_instance);break}}else t=await i.getTrackAlbums(r.value.item_id,r.value.provider);return s.value=!1,t};return(e,t)=>(l(),M("section",null,[V(w,{item:r.value,"active-provider":e.provider},null,8,["item","active-provider"]),r.value?(l(),u(d,{key:0,itemtype:"trackalbums","parent-item":r.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-library":!0,"show-track-number":!1,"load-items":y,"sort-keys":["provider","name","duration"],"update-available":s.value,title:e.$t("appears_on"),checksum:e.provider+e.itemId,"provider-filter":_.value},null,8,["parent-item","update-available","title","checksum","provider-filter"])):p("",!0),$,r.value?(l(),u(d,{key:1,itemtype:"trackversions","parent-item":r.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-library":!0,"show-track-number":!1,"load-items":h,"sort-keys":["provider","name","duration"],"update-available":s.value,title:e.$t("other_versions"),"hide-on-empty":!0,checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"])):p("",!0),F,r.value?(l(),u(I,{key:2,"item-details":r.value},null,8,["item-details"])):p("",!0)]))}});export{te as default};
