import{I as C,_ as h}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-DHRwPkTM.js";import{C as g}from"./Container-L7ytxuXf.js";import{T as w}from"./Toolbar-DMSWIhz4.js";import{aw as y,J as f,i as E,ax as m,ay as t,o as u,aG as d,az as c,aS as V,aD as l,ag as x,aE as A,aF as T,aH as B,aB as D,bK as k,aL as v,b5 as L,E as I,bI as M,bf as N,aN as _,L as $,a3 as S,b9 as F,a4 as H}from"./index-BeguICWm.js";import"./marquee_text_sync-Vcm7FleQ.js";import"./MediaItemThumb-B7Ks6j0U.js";import"./VDialog-3N5CnNiB.js";import"./ListItem-DzMz1Zx0.js";import"./Button-BjWxTVGU.js";import"./index-kQIztB-E.js";import"./VToolbar-DZP2Ylkv.js";const U={style:{"margin-bottom":"10px"}},z={style:{width:"50px"}},G={key:0,class:"text-caption"},J=y({__name:"Chapters",props:{itemDetails:{}},setup(r){const a=r,o=f(!0),e=function(){o.value=!o.value},p=E(()=>[{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",U,[u(w,{title:n.$t("chapters"),"menu-items":p.value,onTitleClicked:e},null,8,["title","menu-items"]),u(V),o.value?(t(),d(g,{key:0},{default:l(()=>[u(T,null,{default:l(()=>[(t(!0),m(x,null,A(r.itemDetails?.metadata?.chapters,i=>(t(),d(B,{key:i.position,disabled:!D(k)(r.itemDetails),onClick:K=>s(i)},{prepend:l(()=>[I("div",z,[u(M,null,{default:l(()=>[N(v(i.position),1)]),_:2},1024)])]),title:l(()=>[I("div",null,v(i.name),1)]),append:l(()=>[i.end?(t(),m("span",G,v(D(L)(i.end-i.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):c("",!0)]))}}),te=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}),S(()=>{const s=_.subscribe(F.MEDIA_ITEM_UPDATED,n=>{const b=n.data;e.value?.uri==b.uri&&(o.value=!0)});H(s)}),(s,n)=>(t(),m(x,null,[u(C,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(t(),d(J,{key:0,"item-details":e.value},null,8,["item-details"])):c("",!0),e.value?(t(),d(h,{key:1,"item-details":e.value},null,8,["item-details"])):c("",!0)],64))}});export{te as default};
