import{l as U,r as b,w as z,o as R,O as l,af as F,b as P,q as d,y as k,j as s,x as m,v as h,F as S,z as j,M as w,L as A,ai as y,K as V,N as c,A as I,D as q,ah as H}from"./index-a5bb9833.js";import{_ as T,f as $}from"./ItemsListing.vue_vue_type_script_setup_true_lang-83c47556.js";import{_ as K}from"./InfoHeader.vue_vue_type_style_index_0_lang-ffdc6f99.js";import{C,L as O,a as G}from"./Container-4773c160.js";import{V as J}from"./VToolbar-b79315e8.js";import{V as Q}from"./VDivider-df9414f0.js";import{V as W}from"./VMenu-240a4406.js";import{a as X}from"./VCard-04ae357c.js";import{l as Y}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 Z=A("br",null,null,-1),M=A("br",null,null,-1),x=["src"],ye=U({__name:"TrackDetails",props:{itemId:{},provider:{},album:{}},setup(D){const a=D,g=b(""),p=b(!1),n=b(),f=async function(){console.log("props",a),n.value=await l.getTrack(a.itemId,a.provider,a.album),g.value="versions"};z(()=>a.itemId,e=>{e&&f()},{immediate:!0}),R(()=>{const e=l.subscribe(F.MEDIA_ITEM_ADDED,r=>{var t;const o=r.data;((t=n.value)==null?void 0:t.uri)==o.uri&&(p.value=!0)});P(e)});const B=async function(e,r,o,t,v=!0){const u=[];if(a.provider=="library"){const i=await l.getTrackVersions(a.itemId,a.provider);u.push(...i)}for(const i of y(n.value)){const _=await l.getTrackVersions(i.item_id,i.provider_instance);u.push(..._)}return $(u,e,r,o,t,v)},L=async function(e,r,o,t,v=!0){const u=[];if(a.provider=="library"){const i=await l.getTrackAlbums(a.itemId,a.provider);u.push(...i)}for(const i of y(n.value)){const _=await l.getTrackAlbums(i.item_id,i.provider_instance);u.push(..._)}return $(u,e,r,o,t,v)},N=function(e){window.open(e,"_blank")},E=function(e,r){return`${l.baseUrl}/preview?provider=${e}&item_id=${encodeURIComponent(r)}`};return(e,r)=>(d(),k("section",null,[s(K,{item:n.value,"active-provider":e.provider},null,8,["item","active-provider"]),s(C,null,{default:m(()=>[s(T,{itemtype:"trackalbums","parent-item":n.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-library":!0,"show-track-number":!1,"load-data":L,"sort-keys":["provider","sort_name","duration"],"update-available":p.value,onRefreshClicked:r[0]||(r[0]=o=>{f(),p.value=!1}),title:e.$t("appears_on"),checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"]),Z,s(T,{itemtype:"trackversions","parent-item":n.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-library":!0,"show-track-number":!1,"load-data":B,"sort-keys":["provider","sort_name","duration"],"update-available":p.value,onRefreshClicked:r[1]||(r[1]=o=>{f(),p.value=!1}),title:e.$t("other_versions"),"hide-on-empty":!0,checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"]),M,e.provider=="library"?(d(),h(X,{key:0,style:{"margin-bottom":"10px"}},{default:m(()=>[s(J,{color:"transparent",title:e.$t("mapped_providers"),style:{height:"55px"}},null,8,["title"]),s(Q),s(C,null,{default:m(()=>[s(W,null,{default:m(()=>{var o;return[(d(!0),k(S,null,j((o=n.value)==null?void 0:o.provider_mappings,t=>(d(),h(O,{key:t.provider_instance},{prepend:m(()=>[s(G,{domain:t.provider_domain,size:30},null,8,["domain"])]),title:m(()=>[V(c(I(l).providerManifests[t.provider_domain].name),1)]),subtitle:m(()=>[V(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:m(()=>[I(q)("bp1")?(d(),k("audio",{key:0,name:"preview",title:"preview",controls:"",src:E(t.provider_domain,t.item_id)},null,8,x)):w("",!0),t.url?(d(),h(Y,{key:1,variant:"plain",icon:"mdi-open-in-new",onClick:H(v=>N(t.url),["prevent"])},null,8,["onClick"])):w("",!0)]),_:2},1024))),128))]}),_:1})]),_:1})]),_:1})):w("",!0)]),_:1})]))}});export{ye as default};
