import{I as C,_ as V}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-bItMFJVo.js";import{C as w}from"./Container-CuH2YNr5.js";import{T as x}from"./Toolbar-iQxHKI_C.js";import{d as h,i as f,N as g,c as m,o as a,b as r,e as u,q as d,p as A,w as l,F as y,r as T,V as E,u as D,bv as k,t as v,aX as B,a as I,bs as M,b4 as N,h as $,m as _,ad as L,j as F,a_ as S,l as U}from"./index-LFx1jIjH.js";import"./MediaItemThumb-cYqdWFcl.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./marquee_text_sync-AxiznPti.js";import"./VBtn-BYKkZzw0.js";import"./VDialog-zNF2U_x9.js";import"./layout-C6GuZOkj.js";import"./ListItem-DhvO1M3C.js";import"./Button-SUce42c3.js";import"./VContainer-or1Uze2V.js";/* empty css              */import"./VToolbar-Dc2WDt1C.js";const j={style:{"margin-bottom":"10px"}},q={style:{width:"50px"}},H={key:0,class:"text-caption"},P=h({__name:"Chapters",props:{itemDetails:{}},setup(p){const i=p,s=f(!0),e=function(){s.value=!s.value},c=g(()=>[{label:"tooltip.collapse_expand",icon:s.value?"mdi-chevron-up":"mdi-chevron-down",action:e,overflowAllowed:!1}]),n=function(t){!i.itemDetails||!k(i.itemDetails)||_.playMedia(i.itemDetails.uri,void 0,void 0,t.position.toString())};return(t,b)=>(a(),m("section",j,[r(x,{title:t.$t("chapters"),"menu-items":c.value,onTitleClicked:e},null,8,["title","menu-items"]),r(A),s.value?(a(),u(w,{key:0},{default:l(()=>[r($,null,{default:l(()=>[(a(!0),m(y,null,T(t.itemDetails?.metadata?.chapters,o=>(a(),u(E,{key:o.position,disabled:!D(k)(t.itemDetails),onClick:X=>n(o)},{prepend:l(()=>[I("div",q,[r(M,null,{default:l(()=>[N(v(o.position),1)]),_:2},1024)])]),title:l(()=>[I("div",null,v(o.name),1)]),append:l(()=>[o.end?(a(),m("span",H,v(D(B)(o.end-o.start)),1)):d("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):d("",!0)]))}}),se=h({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(p){const i=p,s=f(!1),e=f(),c=async function(){e.value=await _.getAudiobook(i.itemId,i.provider)};return L(()=>i.itemId,n=>{n&&c()},{immediate:!0}),F(()=>{const n=_.subscribe(S.MEDIA_ITEM_UPDATED,t=>{const b=t.data;e.value?.uri==b.uri&&(s.value=!0)});U(n)}),(n,t)=>(a(),m(y,null,[r(C,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(a(),u(P,{key:0,"item-details":e.value},null,8,["item-details"])):d("",!0),e.value?(a(),u(V,{key:1,"item-details":e.value},null,8,["item-details"])):d("",!0)],64))}});export{se as default};
