import{I as h}from"./InfoHeader-CuZUyPdA.js";import{_ as x}from"./ProviderDetails.vue_vue_type_style_index_0_lang-hk8Jt5sR.js";import{C as g}from"./Container-C8q3OdIF.js";import{T as w}from"./Toolbar-CpDb2XyG.js";import{J as D,o as V,a as _,E as A}from"./index-Cc0s9xHj.js";import{e as E,c as T,n as B,b as M}from"./vuetify-CvGbteJu.js";import{d as y,c as u,J as m,G as d,K as p,g as N,r as b,H as r,F as C,O as $,u as k,a4 as v,e as I,a2 as L,b as t,w as F,o as H,a3 as J}from"./lucide-C_a_D9Y7.js";import"./marquee_text_sync-C4anEqYx.js";import"./vue-router-lrCq0UAu.js";import"./MarqueeText-Dmids8zS.js";import"./MediaItemThumb-CN3YtoJY.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-7ardqVNw.js";import"./vue-i18n-COI_JhGQ.js";import"./ListItem-Ct4Nbn6d.js";import"./Button-CCvS9sA_.js";import"./index-kQIztB-E.js";import"./qrcode-DICVlH4J.js";import"./marked-D9eDbhZJ.js";import"./color-CqFg8eif.js";import"./vueuse-Blk5jQ0T.js";/* empty css            */import"./swiper-UowLVX5q.js";const S={style:{"margin-bottom":"10px"}},U={style:{width:"50px"}},G={key:0,class:"text-caption"},K=y({__name:"Chapters",props:{itemDetails:{}},setup(l){const a=l,o=b(!0),e=function(){o.value=!o.value},c=N(()=>[{label:"tooltip.collapse_expand",icon:o.value?"mdi-chevron-up":"mdi-chevron-down",action:e,overflowAllowed:!1}]),s=function(n){!a.itemDetails||!D(a.itemDetails)||_.playMedia(a.itemDetails.uri,void 0,void 0,n.position.toString())};return(n,f)=>(t(),u("section",S,[m(w,{title:n.$t("chapters"),"menu-items":c.value,onTitleClicked:e},null,8,["title","menu-items"]),m(E),o.value?(t(),d(g,{key:0},{default:r(()=>[m(M,null,{default:r(()=>[(t(!0),u(C,null,$(l.itemDetails?.metadata?.chapters,i=>(t(),d(T,{key:i.position,disabled:!k(D)(l.itemDetails),onClick:O=>s(i)},{prepend:r(()=>[I("div",U,[m(B,null,{default:r(()=>[L(v(i.position),1)]),_:2},1024)])]),title:r(()=>[I("div",null,v(i.name),1)]),append:r(()=>[i.end?(t(),u("span",G,v(k(V)(i.end-i.start)),1)):p("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):p("",!0)]))}}),pe=y({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(l){const a=l,o=b(!1),e=b(),c=async function(){e.value=await _.getAudiobook(a.itemId,a.provider)};return F(()=>a.itemId,s=>{s&&c()},{immediate:!0}),H(()=>{const s=_.subscribe(A.MEDIA_ITEM_UPDATED,n=>{const f=n.data;e.value?.uri==f.uri&&(e.value=f,o.value=!0)});J(s)}),(s,n)=>(t(),u(C,null,[m(h,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(t(),d(K,{key:0,"item-details":e.value},null,8,["item-details"])):p("",!0),e.value?(t(),d(x,{key:1,"item-details":e.value},null,8,["item-details"])):p("",!0)],64))}});export{pe as default};
