import{I as C,_ as x}from"./ProviderDetails.vue_vue_type_style_index_0_lang-CPJnCCao.js";import{C as V}from"./Container-C7DumkgJ.js";import{T as A}from"./Toolbar-CxAnowGj.js";import{ay as y,J as f,i as T,az as m,aA as t,o as u,aI as d,aB as c,aV as g,aG as l,ah as h,aH as w,aF as E,aJ as B,aD as D,bZ as k,aN as v,b8 as M,E as I,bT as N,bi as L,aP as _,L as $,a3 as F,bc as H,a4 as J}from"./index-D-FY8Yx2.js";import"./marquee_text_sync-OdthARHF.js";import"./MediaItemThumb-CzEoSAF3.js";import"./ListItem-CX5q61ih.js";import"./Button-B57MCuAc.js";import"./index-kQIztB-E.js";import"./VToolbar-BGzu4h11.js";const P={style:{"margin-bottom":"10px"}},S={style:{width:"50px"}},U={key:0,class:"text-caption"},z=y({__name:"Chapters",props:{itemDetails:{}},setup(r){const a=r,o=f(!0),e=function(){o.value=!o.value},p=T(()=>[{label:"tooltip.collapse_expand",icon:o.value?"mdi-chevron-up":"mdi-chevron-down",action:e,overflowAllowed:!1}]),s=function(n){!a.itemDetails||!k(a.itemDetails)||_.playMedia(a.itemDetails.uri,void 0,void 0,n.position.toString())};return(n,b)=>(t(),m("section",P,[u(A,{title:n.$t("chapters"),"menu-items":p.value,onTitleClicked:e},null,8,["title","menu-items"]),u(g),o.value?(t(),d(V,{key:0},{default:l(()=>[u(E,null,{default:l(()=>[(t(!0),m(h,null,w(r.itemDetails?.metadata?.chapters,i=>(t(),d(B,{key:i.position,disabled:!D(k)(r.itemDetails),onClick:G=>s(i)},{prepend:l(()=>[I("div",S,[u(N,null,{default:l(()=>[L(v(i.position),1)]),_:2},1024)])]),title:l(()=>[I("div",null,v(i.name),1)]),append:l(()=>[i.end?(t(),m("span",U,v(D(M)(i.end-i.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):c("",!0)]))}}),ee=y({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(r){const a=r,o=f(!1),e=f(),p=async function(){e.value=await _.getAudiobook(a.itemId,a.provider)};return $(()=>a.itemId,s=>{s&&p()},{immediate:!0}),F(()=>{const s=_.subscribe(H.MEDIA_ITEM_UPDATED,n=>{const b=n.data;e.value?.uri==b.uri&&(o.value=!0)});J(s)}),(s,n)=>(t(),m(h,null,[u(C,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(t(),d(z,{key:0,"item-details":e.value},null,8,["item-details"])):c("",!0),e.value?(t(),d(x,{key:1,"item-details":e.value},null,8,["item-details"])):c("",!0)],64))}});export{ee as default};
