import{I as C,_ as x}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-Chq_R5dV.js";import{C as w}from"./Container-ClW3AMEw.js";import{T as V}from"./Toolbar-B7AWyK9d.js";import{d as I,r as f,O as g,c as u,b as m,h as d,e as c,y as A,w as l,o as t,F as h,g as T,V as E,u as D,bw as k,t as v,aY as B,a as y,bt as M,b5 as $,l as N,v as _,ae as L,m as F,a$ as S,q as U}from"./index-CD7iYaFT.js";import"./marquee_text_sync-gz0T_gx6.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./MediaItemThumb-BVMzVj0K.js";import"./VBtn-B0XatuYF.js";import"./VDialog-3VB6G7S5.js";import"./layout-BCm0QQDS.js";import"./ListItem-C-HNqEeC.js";import"./Button-BUjpiwEZ.js";import"./index-CBho6rsP.js";import"./VContainer-DFqPxZ0T.js";/* empty css              */import"./VToolbar-BQejIjUR.js";const q={style:{"margin-bottom":"10px"}},H={style:{width:"50px"}},O={key:0,class:"text-caption"},P=I({__name:"Chapters",props:{itemDetails:{}},setup(r){const a=r,o=f(!0),e=function(){o.value=!o.value},p=g(()=>[{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(),u("section",q,[m(V,{title:n.$t("chapters"),"menu-items":p.value,onTitleClicked:e},null,8,["title","menu-items"]),m(A),o.value?(t(),d(w,{key:0},{default:l(()=>[m(N,null,{default:l(()=>[(t(!0),u(h,null,T(r.itemDetails?.metadata?.chapters,i=>(t(),d(E,{key:i.position,disabled:!D(k)(r.itemDetails),onClick:Y=>s(i)},{prepend:l(()=>[y("div",H,[m(M,null,{default:l(()=>[$(v(i.position),1)]),_:2},1024)])]),title:l(()=>[y("div",null,v(i.name),1)]),append:l(()=>[i.end?(t(),u("span",O,v(D(B)(i.end-i.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):c("",!0)]))}}),ne=I({__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 L(()=>a.itemId,s=>{s&&p()},{immediate:!0}),F(()=>{const s=_.subscribe(S.MEDIA_ITEM_UPDATED,n=>{const b=n.data;e.value?.uri==b.uri&&(o.value=!0)});U(s)}),(s,n)=>(t(),u(h,null,[m(C,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(t(),d(P,{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{ne as default};
