import{I as w,_ as V}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-BAvimnpk.js";import{Q as h,x as b,c as g,Z as d,B as m,R as p,a9 as c,Y as A,U as l,S as a,G as x,$ as T,a1 as B,X as E,a0 as I,bq as y,ab as _,aq as M,W as C,bo as $,ao as N,a4 as D,w as L,o as S,aY as U,b as q}from"./index-DxANhO1k.js";import{C as Y}from"./Container-BWpo4_AD.js";import{T as F}from"./Toolbar-C8FmMECG.js";import"./MediaItemThumb-CFMeVmOC.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./marquee_text_sync-cD0dgLVZ.js";import"./VBtn-BKDLm-Pz.js";import"./VDialog-1mEV66nR.js";import"./layout-DxBddAEz.js";import"./ListItem-DOvPB9zZ.js";import"./VContainer-Dt14Bz2c.js";/* empty css              */import"./VToolbar-CF24PT7R.js";const G={style:{"margin-bottom":"10px"}},H={style:{width:"50px"}},P={key:0,class:"text-caption"},Q=h({__name:"Chapters",props:{itemDetails:{}},setup(v){const i=v,s=b(!0),e=function(){s.value=!s.value},f=g(()=>[{label:"tooltip.collapse_expand",icon:s.value?"mdi-chevron-up":"mdi-chevron-down",action:e,overflowAllowed:!1}]),n=function(t){!i.itemDetails||!y(i.itemDetails)||D.playMedia(i.itemDetails.uri,void 0,void 0,t.position.toString())};return(t,r)=>(a(),d("section",G,[m(F,{title:t.$t("chapters"),"menu-items":f.value,onTitleClicked:e},null,8,["title","menu-items"]),m(A),s.value?(a(),p(Y,{key:0},{default:l(()=>[m(B,null,{default:l(()=>{var u,k;return[(a(!0),d(x,null,T((k=(u=t.itemDetails)==null?void 0:u.metadata)==null?void 0:k.chapters,o=>(a(),p(E,{key:o.position,disabled:!I(y)(t.itemDetails),onClick:R=>n(o)},{prepend:l(()=>[C("div",H,[m($,null,{default:l(()=>[N(_(o.position),1)]),_:2},1024)])]),title:l(()=>[C("div",null,_(o.name),1)]),append:l(()=>[o.end?(a(),d("span",P,_(I(M)(o.end-o.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]}),_:1})]),_:1})):c("",!0)]))}}),ne=h({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(v){const i=v,s=b(!1),e=b(),f=async function(){e.value=await D.getAudiobook(i.itemId,i.provider)};return L(()=>i.itemId,n=>{n&&f()},{immediate:!0}),S(()=>{const n=D.subscribe(U.MEDIA_ITEM_UPDATED,t=>{var u;const r=t.data;((u=e.value)==null?void 0:u.uri)==r.uri&&(s.value=!0)});q(n)}),(n,t)=>{var r;return a(),d(x,null,[m(w,{item:e.value},null,8,["item"]),e.value&&((r=e.value.metadata)!=null&&r.chapters)?(a(),p(Q,{key:0,"item-details":e.value},null,8,["item-details"])):c("",!0),e.value?(a(),p(V,{key:1,"item-details":e.value},null,8,["item-details"])):c("",!0)],64)}}});export{ne as default};
