1import{_ as we}from"./ldxbXCsm.js";import{d as Y,b as t,c as s,e,n as X,y as oe,t as x,f as y,_ as Q,g as m,F as D,l as O,j as T,s as B,Z as le,k as ae,m as U,x as _e,z as ie,h as K,v as re,r as w,$ as G,o as de,E as ue,u as ke,i as Z,a0 as $e,p as Ce,q as Ie,R as Pe}from"./CV4o8dNP.js";import{u as Se}from"./C60LYEUG.js";import{d as je,f as Le,S as Ae,r as Re,c as Be}from"./yevK1te-.js";import{u as Te}from"./CNKUj1PK.js";import{u as ze}from"./l_j4laDa.js";import{_ as Ee}from"./CWrQy81S.js";import{_ as Ue}from"./DnUSiTUu.js";import{c as Ne}from"./BuCzsSJk.js";import{_ as Fe}from"./BI7OUVHo.js";import{B as De}from"./M91qti2F.js";/* empty css */import"./DR-DPaVR.js";import"./89irubrF.js";import"./B589ah28.js";const Oe=["id"],Me={class:"line-clamp-2 px-2 leading-snug"},Ve={key:0,class:"text-brand-seventh flex animate-pulse items-center gap-0.5"},qe=Y({__name:"BookIndexSidebar",props:{item:{},activeItemId:{},currentAudioId:{},globalIsPlaying:{type:Boolean}},emits:["select-item","play-audio"],setup(l,{emit:S}){const p=l,d=S,r=B(()=>p.item.id===p.activeItemId),C=B(()=>p.globalIsPlaying&&p.item.id===p.currentAudioId),b=()=>{d("select-item",p.item.id)};return(c,_)=>{const k=Q,a=le("BookIndexSidebar",!0);return t(),s("div",{class:"space-y-1",id:"item-indice-"+l.item.id},[e("div",{style:oe({paddingLeft:l.item.depth?`${l.item.depth*12}px`:"0px"}),class:X(["group flex cursor-pointer items-center justify-between rounded-lg px-3 py-2 text-sm font-semibold transition-colors",[r.value?"bg-brand-seventh/10 text-brand-seventh border-brand-seventh border-l-4 pl-2 font-bold":"hover:text-brand-seventh border-l-4 border-transparent text-slate-600 hover:bg-slate-50"]]),onClick:b},[e("span",Me,x(l.item.titulo),1),C.value?(t(),s("span",Ve,[y(k,{name:"heroicons:speaker-wave",class:"h-4 w-4"})])):m("",!0)],6),l.item.children&&l.item.children.length>0?(t(!0),s(D,{key:0},O(l.item.children,g=>(t(),T(a,{key:g.id,item:g,"active-item-id":l.activeItemId,"current-audio-id":l.currentAudioId,"global-is-playing":l.globalIsPlaying,onSelectItem:_[0]||(_[0]=A=>d("select-item",A)),onPlayAudio:_[1]||(_[1]=A=>d("play-audio",A))},null,8,["item","active-item-id","current-audio-id","global-is-playing"]))),128)):m("",!0)],8,Oe)}}}),se=Object.assign(qe,{__name:"FeaturesLibrosBookIndexSidebar"}),We=["id"],He=Y({__name:"ContenidoItem",props:{item:{},libro:{}},setup(l){const S=p=>{if(!p)return"";let d=p.replace(/ /g," ");return d=d.replace(/src="\/assets\//g,'src="https://institutopacifico.pe/assets/'),d=d.replace(/src='\/assets\//g,"src='https://institutopacifico.pe/assets/"),d=Ne(d),d};return(p,d)=>{const r=Ee,C=Ue,b=le("ContenidoItem",!0);return t(),s("div",{class:"space-y-4 border-b border-slate-100 py-4 last:border-0",id:"item-"+l.item.id},[l.item.capitulo?(t(),T(r,{key:0,level:2,class:"leading-snug"},{default:ae(()=>[U(x(l.item.capitulo),1)]),_:1})):m("",!0),l.item.titulo?(t(),T(r,{key:1,level:3,tag:"h4",color:"inherit",class:"font-semibold leading-snug text-slate-800"},{default:ae(()=>[U(x(l.item.titulo),1)]),_:1})):m("",!0),l.item.contenido?(t(),T(C,{key:2,content:S(l.item.contenido),decode:!1,size:"sm"},null,8,["content"])):m("",!0),l.item.hijos&&l.item.hijos.length>0?(t(!0),s(D,{key:3},O(l.item.hijos,c=>(t(),T(b,{key:c.id,item:c,libro:l.libro},null,8,["item","libro"]))),128)):m("",!0)],8,We)}}}),Je=Object.assign(He,{__name:"FeaturesLibrosContenidoItem"}),Xe={key:0,class:"mb-6"},Ye={key:0,class:"shadow-xs flex items-center justify-between rounded-lg border border-slate-200/80 bg-slate-50 p-4"},Ze={class:"flex items-center gap-3"},Ge={key:0,class:"rounded-lg border border-slate-200 bg-white px-2.5 py-1 text-xs font-semibold text-slate-500"},Ke={key:1,class:"bg-brand-seventh/5 border-brand-seventh/20 shadow-xs flex items-center justify-between rounded-lg border p-4"},Qe=Y({__name:"InlineAudioPlayer",props:{item:{},currentAudioId:{},globalIsPlaying:{type:Boolean}},emits:["play-audio"],setup(l,{emit:S}){const p=l,d=S,r=B(()=>p.globalIsPlaying&&p.item.id===p.currentAudioId),C=()=>{p.item.id!=null&&d("play-audio",{...p.item,id:p.item.id})};return(b,c)=>{const _=Q;return l.item.audio?(t(),s("div",Xe,[r.value?(t(),s("div",Ke,[...c[1]||(c[1]=[_e('<div class="flex items-center gap-3" data-v-8c6a04e0><div class="bg-brand-seventh/10 text-brand-seventh flex h-10 w-10 items-center justify-center rounded-full" data-v-8c6a04e0><div class="flex h-4 items-end gap-0.5" data-v-8c6a04e0><span class="bg-brand-seventh rounded-xs animate-visualizer-bar-1 w-0.5" data-v-8c6a04e0></span><span class="bg-brand-seventh rounded-xs animate-visualizer-bar-2 w-0.5" data-v-8c6a04e0></span><span class="bg-brand-seventh rounded-xs animate-visualizer-bar-3 w-0.5" data-v-8c6a04e0></span><span class="bg-brand-seventh rounded-xs animate-visualizer-bar-4 w-0.5" data-v-8c6a04e0></span></div></div><div data-v-8c6a04e0><span class="text-brand-seventh block text-xs font-bold uppercase" data-v-8c6a04e0>Escuchando este capÃtulo</span><span class="text-brand-first text-sm font-bold" data-v-8c6a04e0>Reproduciendo audio...</span></div></div>',1)])])):(t(),s("div",Ye,[e("div",Ze,[e("button",{onClick:C,"aria-label":"Reproducir audio",class:"bg-brand-seventh flex h-10 w-10 items-center justify-center rounded-full text-white shadow-sm transition-transform hover:scale-105"},[y(_,{name:"heroicons:play-solid",class:"ml-0.5 h-5 w-5"})]),c[0]||(c[0]=e("div",null,[e("span",{class:"text-brand-seventh block text-xs font-bold uppercase"},"Escuchar este capÃtulo"),e("span",{class:"text-brand-first text-sm font-bold"},"Audio disponible")],-1))]),l.item.total_audio_duration?(t(),s("span",Ge,x(l.item.total_audio_duration),1)):m("",!0)]))])):m("",!0)}}}),et=Object.assign(ie(Qe,[["__scopeId","data-v-8c6a04e0"]]),{__name:"FeaturesLibrosInlineAudioPlayer"}),tt={class:"border-brand-seventh no-print fixed bottom-0 left-0 right-0 z-50 select-none border-t-2 bg-slate-900 text-white shadow-2xl"},at={class:"mx-auto flex max-w-7xl flex-col items-center justify-between gap-4 px-4 py-3 md:flex-row"},ot={class:"flex w-full min-w-0 items-center gap-3 md:w-1/4"},nt={class:"min-w-0"},st={class:"truncate text-xs text-slate-200"},lt={class:"mt-0.5 block truncate text-xs font-medium text-slate-400"},it={class:"w-full flex-grow px-0 md:max-w-2xl md:px-6"},rt={class:"mb-2 flex items-center justify-center gap-5"},dt={class:"flex items-center gap-3"},ut={class:"w-8 text-right font-mono text-xs text-slate-400"},ct={class:"relative h-1.5 w-full overflow-hidden rounded-full bg-slate-800"},vt={class:"w-8 font-mono text-xs text-slate-400"},mt={class:"relative flex w-full items-center justify-end gap-4 md:w-1/4"},pt={class:"relative"}
1,bt={key:0,class:"absolute bottom-full right-0 z-50 mb-2 w-24 overflow-hidden rounded-lg border border-slate-700 bg-slate-800 py-1 shadow-xl"},ht=["onClick"],ft=["src"],gt=Y({__name:"AudioPlayerLibro",props:{audioUrl:{},libro:{},chapterTitle:{},showNavigation:{type:Boolean,default:!0}},emits:["prev-chapter","next-chapter","ended","close","progress","play-state-change"],setup(l,{emit:S}){const p=l,d=S,r=w(!1),C=w(0),b=w(0),c=w(0),_=w(1),k=w(!1),a=w(null);K(()=>p.audioUrl,i=>{i&&G(()=>{a.value&&(a.value.load(),a.value.play().then(()=>{r.value=!0}).catch(v=>{console.error("Audio playback error:",v)}))})},{immediate:!0}),K(r,i=>{d("play-state-change",i)});const g=()=>{a.value&&(r.value?(a.value.pause(),r.value=!1):a.value.play().then(()=>{r.value=!0}).catch(i=>{console.error("Audio playback error on toggle:",i)}))},A=i=>{a.value&&(a.value.currentTime=Math.max(0,Math.min(a.value.duration,a.value.currentTime+i)))},q=()=>{a.value&&(C.value=a.value.currentTime,b.value>0&&(c.value=C.value/b.value*100,d("progress",c.value)))},F=()=>{a.value&&(b.value=a.value.duration,a.value.playbackRate=_.value)},R=()=>{r.value=!1,d("ended")},M=i=>{if(!a.value||b.value===0)return;const L=i.currentTarget.getBoundingClientRect(),P=i.clientX-L.left,j=Math.max(0,Math.min(1,P/L.width));a.value.currentTime=j*b.value},V=i=>{_.value=i,a.value&&(a.value.playbackRate=i),k.value=!1},W=i=>{if(!i||isNaN(i))return"0:00";const v=Math.floor(i/60),L=Math.floor(i%60);return`${v}:${L.toString().padStart(2,"0")}`};return re(()=>{a.value&&a.value.pause(),r.value=!1}),(i,v)=>{const L=Fe,P=Q;return t(),s("div",tt,[e("div",at,[e("div",ot,[y(L,{src:l.libro.portada,alt:l.libro.descripcion_imagen||l.libro.titulo,width:"40",height:"56",sizes:"40px",format:"webp",quality:"70",loading:"lazy",decoding:"async",class:"h-14 w-10 flex-shrink-0 rounded-lg border border-slate-800 object-cover"},null,8,["src","alt"]),e("div",nt,[e("h5",st,x(l.libro.titulo),1),e("span",lt,"CapÃtulo: "+x(l.chapterTitle),1)])]),e("div",it,[e("div",rt,[l.showNavigation?(t(),s("button",{key:0,onClick:v[0]||(v[0]=j=>d("prev-chapter")),class:"hover:text-brand-seventh text-slate-400 transition-colors",title:"CapÃtulo anterior","aria-label":"CapÃtulo anterior"},[y(P,{name:"heroicons:chevron-double-left-solid",class:"h-5 w-5"})])):m("",!0),e("button",{onClick:v[1]||(v[1]=j=>A(-10)),class:"hover:text-brand-seventh text-slate-400 transition-colors",title:"Retroceder 10s","aria-label":"Retroceder 10s"},[y(P,{name:"heroicons:arrow-path-solid",class:"h-5 w-5 -scale-x-100"})]),e("button",{onClick:g,class:"bg-brand-seventh flex h-12 w-12 items-center justify-center rounded-full text-white shadow-md transition-transform hover:scale-105","aria-label":"Isplaying ? "},[y(P,{name:r.value?"heroicons:pause-solid":"heroicons:play-solid",class:X(["h-6 w-6",{"ml-0.5":!r.value}])},null,8,["name","class"])]),e("button",{onClick:v[2]||(v[2]=j=>A(10)),class:"hover:text-brand-seventh text-slate-400 transition-colors",title:"Adelantar 10s","aria-label":"Adelantar 10s"},[y(P,{name:"heroicons:arrow-path-solid",class:"h-5 w-5"})]),l.showNavigation?(t(),s("button",{key:1,onClick:v[3]||(v[3]=j=>d("next-chapter")),class:"hover:text-brand-seventh text-slate-400 transition-colors",title:"Siguiente capÃtulo","aria-label":"Siguiente capÃtulo"},[y(P,{name:"heroicons:chevron-double-right-solid",class:"h-5 w-5"})])):m("",!0)]),e("div",dt,[e("span",ut,x(W(C.value)),1),e("div",{class:"group flex h-4 flex-grow cursor-pointer items-center",onClick:M},[e("div",ct,[e("div",{class:"bg-brand-seventh h-full rounded-full transition-all duration-100 ease-linear",style:oe({width:`${c.value}%`})},null,4)])]),e("span",vt,x(W(b.value)),1)])]),e("div",mt,[e("div",pt,[e("button",{onClick:v[4]||(v[4]=j=>k.value=!k.value),class:"hover:text-brand-seventh flex items-center gap-1 rounded-lg bg-slate-800 px-3 py-1.5 text-xs font-bold text-slate-300 transition-colors"},[v[6]||(v[6]=U(" Velocidad ",-1)),e("b",null,x(_.value)+"x",1),y(P,{name:"heroicons:chevron-up-solid",class:X(["h-3 w-3 transition-transform",{"rotate-180":k.value}])},null,8,["class"])]),k.value?(t(),s("div",bt,[(t(),s(D,null,O([1,1.25,1.5,2],j=>e("button",{key:j,onClick:H=>V(j),class:X(["hover:bg-brand-seventh w-full px-3 py-2 text-left text-xs font-semibold transition-colors hover:text-white",{"text-brand-seventh font-bold":_.value===j,"text-slate-300":_.value!==j}])},x(j)+"x ",11,ht)),64))])):m("",!0)]),e("button",{onClick:v[5]||(v[5]=j=>d("close")),class:"text-slate-400 transition-colors hover:text-red-400",title:"Cerrar reproductor","aria-label":"Cerrar reproductor"},[y(P,{name:"heroicons:x-circle-solid",class:"h-6 w-6"})])])]),e("audio",{ref_key:"audioElement",ref:a,src:l.audioUrl,onTimeupdate:q,onLoadedmetadata:F,onEnded:R},null,40,ft)])}}}),xt=Object.assign(gt,{__name:"FeaturesLibrosAudioPlayerLibro"}),yt={class:"pdf-reader select-none"},wt={key:0,class:"mb-4 flex flex-col gap-3 rounded-lg border border-slate-200/80 bg-white p-4 sm:flex-row sm:items-center sm:justify-between"},_t={class:"flex flex-wrap items-center gap-2"},kt=["disabled"],$t={class:"px-2 text-sm font-medium text-slate-500"},Ct=["disabled"],It={class:"flex items-center gap-2"},Pt=["disabled"],St={class:"min-w-12 text-center text-sm font-medium text-slate-500"},jt=["disabled"],Lt={key:1},At={key:2,class:"py-16 text-center"},Rt={class:"text-sm font-medium text-slate-500"},Bt={key:3,class:"rounded-lg border border-red-200 bg-red-50 p-6 text-center"},Tt={class:"mb-4 text-sm text-slate-600"},zt=Y({__name:"ReadPdf",props:{pdfSourceLink:{}},setup(l){const S=l,p=ue(),d=w(null),r=w(!0),C=w(null),b=w("Obteniendo PDF..."),c=w(1),_=w(0),k=w(100);let a=null,g=null,A=null;function q(){const h=typeof window<"u"?localStorage.getItem("auth-token"):null;return h?{Authorization:`Bearer ${h}`}:{}}async function F(h){document.querySelector(`script[src="${h}"]`)||await new Promise((I,z)=>{const N=document.createElement("script");N.src=h,N.onload=()=>I(),N.onerror=()=>z(new Error(`No se pudo cargar ${h}`)),document.head.appendChild(N)})}async function R(){typeof window.pdfjsLib<"u"||(await F("https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.min.js"),window.pdfjsLib.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.worker.min.js")}async function M(h){const I=p.public.API_WEB_URL,z=btoa(h),N=await $fetch(`${I}
1/api/pdfs/${z}`,{responseType:"blob",headers:q()});return g&&URL.revokeObjectURL(g),g=URL.createObjectURL(N),g}async function V(){if(!a||!d.value||!A)return;const h=await a.getPage(c.value),I=h.getViewport({scale:1.5});d.value.height=I.height,d.value.width=I.width,A.clearRect(0,0,d.value.width,d.value.height),await h.render({canvasContext:A,viewport:I}).promise}async function W(h){if(await R(),b.value="Procesando PDF...",await G(),!d.value)throw new Error("Canvas no disponible");A=d.value.getContext("2d"),a=await window.pdfjsLib.getDocument({url:h,disableWorker:!0}).promise,_.value=a.numPages,c.value=1,await V()}async function i(){if(!S.pdfSourceLink){C.value="No se proporcionó URL del PDF",r.value=!1;return}try{r.value=!0,C.value=null,b.value="Obteniendo PDF...";const h=await M(S.pdfSourceLink);await W(h)}catch(h){console.error("Error cargando PDF:",h),C.value="No se pudo cargar el documento PDF."}finally{r.value=!1}}async function v(){c.value<_.value&&(c.value+=1,await V())}async function L(){c.value>1&&(c.value-=1,await V())}function P(){k.value<120&&(k.value+=10)}function j(){k.value>60&&(k.value-=10)}function H(){a=null,c.value=1,_.value=0,k.value=100,i()}return K(()=>S.pdfSourceLink,h=>{h&&i()}),de(()=>{S.pdfSourceLink&&i()}),re(()=>{g&&URL.revokeObjectURL(g)}),(h,I)=>{const z=Q;return t(),s("div",yt,[C.value?m("",!0):(t(),s("div",wt,[e("div",_t,[e("button",{type:"button",class:"inline-flex items-center gap-1 rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 text-sm font-semibold text-slate-600 transition-colors hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:c.value<=1||r.value,onClick:L},[y(z,{name:"heroicons:arrow-left",class:"h-4 w-4"}),I[0]||(I[0]=U(" Atrás ",-1))],8,kt),e("span",$t," Página "+x(c.value)+" de "+x(_.value||"?"),1),e("button",{type:"button",class:"inline-flex items-center gap-1 rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 text-sm font-semibold text-slate-600 transition-colors hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:c.value>=_.value||r.value,onClick:v},[I[1]||(I[1]=U(" Siguiente ",-1)),y(z,{name:"heroicons:arrow-right",class:"h-4 w-4"})],8,Ct)]),e("div",It,[e("button",{type:"button",class:"inline-flex h-9 w-9 items-center justify-center rounded-lg border border-slate-200 bg-slate-50 text-slate-600 transition-colors hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:k.value<=60||r.value,"aria-label":"Reducir zoom",onClick:j},[y(z,{name:"heroicons:minus",class:"h-4 w-4"})],8,Pt),e("span",St,x(k.value)+"%",1),e("button",{type:"button",class:"inline-flex h-9 w-9 items-center justify-center rounded-lg border border-slate-200 bg-slate-50 text-slate-600 transition-colors hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:k.value>=120||r.value,"aria-label":"Aumentar zoom",onClick:P},[y(z,{name:"heroicons:plus",class:"h-4 w-4"})],8,jt)])])),C.value?m("",!0):(t(),s("div",Lt,[e("canvas",{ref_key:"pdfCanvas",ref:d,class:X(["mx-auto rounded-lg border border-slate-200 bg-white shadow-sm transition-transform duration-300",{invisible:r.value}]),style:oe({transform:`scale(${k.value/100})`,transformOrigin:"top center",maxWidth:"100%",width:"100%"})},null,6)])),r.value?(t(),s("div",At,[y(z,{name:"heroicons:arrow-path",class:"text-brand-seventh mx-auto mb-3 h-8 w-8 animate-spin"}),e("p",Rt,x(b.value),1)])):m("",!0),C.value?(t(),s("div",Bt,[I[2]||(I[2]=e("h3",{class:"ap-title-5 text-brand-first mb-2"},"Error al cargar el PDF",-1)),e("p",Tt,x(C.value),1),e("button",{type:"button",class:"bg-brand-seventh hover:bg-brand-sixth inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-bold text-white transition-colors",onClick:H}," Reintentar ")])):m("",!0)])}}}),Et=Object.assign(zt,{__name:"FeaturesLibrosReadPdf"}),Ut={class:"min-h-screen py-2"},Nt={class:"ap-container"},Ft={class:"mb-6"},Dt={key:1,class:"shadow-xs flex flex-col items-start justify-between gap-4 rounded-lg border border-blue-100/80 bg-blue-50 p-5 md:flex-row md:items-center"},Ot={class:"min-w-0 grow space-y-2"},Mt={class:"ap-title-4 text-brand-first mb-2 leading-tight"},Vt={class:"flex flex-wrap items-center gap-3 text-xs font-bold text-slate-500"},qt={key:0},Wt={key:0,class:"flex items-center gap-1.5"},Ht={key:0,class:"mt-3 text-sm leading-relaxed text-slate-600"},Jt={key:0,class:"shrink-0"},Xt={key:0},Yt={key:1,class:"grid grid-cols-1 items-start gap-8 lg:grid-cols-12"},Zt={class:"shadow-xs sticky top-24 hidden max-h-dvh overflow-y-auto rounded-lg border border-slate-200/80 bg-white p-4 lg:col-span-3 lg:block"},Gt={class:"space-y-1"},Kt={class:"shadow-xs min-w-0 rounded-lg border border-slate-200/80 bg-white p-6 md:p-8 lg:col-span-9"},Qt={class:"ap-prose mb-8"},ea={key:0,class:"mt-16 w-full border-t-2 border-slate-100 pb-8 pt-8"},ta={class:"space-y-4 font-light"},aa=["id"],oa={class:"text-brand-second min-w-5 font-bold"},na={class:"flex-1 leading-relaxed"},sa=["href"],la={class:"mt-8 flex items-center justify-between border-t border-slate-100 pt-6"},ia={class:"max-w-36 truncate text-left sm:max-w-64"},ra={key:1},da={class:"max-w-36 truncate text-right sm:max-w-64"},ua={key:3},ca={class:"mb-4 flex items-center justify-between border-b border-slate-100 pb-3"},va={class:"space-y-1"},ma=Y({__name:"[slug]",setup(l){const S=Ce(),p=Ie(),d=ue(),r=ke(),C=Se(),b=S.params.slug,{data:c}
1=ze({module:"LI",item:b});de(()=>{r.auth||p.push(`/login?from=/libros/${b}`)});const{data:_,pending:k}=C.getLibroDetail(b),a=B(()=>_.value?.libro||{}),g=B(()=>_.value?.indice||[]),A=B(()=>c.value?.image||a.value?.portada||je()),q=B(()=>c.value?.description||(a.value?.titulo?`${a.value.titulo}. Libro virtual de ${Pe.name}.`:"Libro virtual")),F=w(null),R=w({}),M=w(!1),V=o=>o?o.item?o.item:o.items&&!Array.isArray(o.items)?o.items:null:null,W=B(()=>{if(!a.value?.titulo&&!c.value?.title)return null;const o=c.value?.title||a.value.titulo||"",n=a.value.resumen||q.value,f=`${Ae.origin}/libros/${b}`,$=g.value[0]?.id,E=Le(g.value).map((u,J)=>({name:u.titulo,url:`${f}#item-${u.id}`,position:J+1,isAccessibleForFree:$!=null&&String(u.id)===String($)}));return Re({name:o,description:n,image:A.value,canonicalUrl:f,extra:Be({name:o,description:n,image:A.value,canonicalUrl:f,chapters:E.length?E:void 0})})});Te({title:()=>c.value?.title||a.value?.titulo||"",moduleLabel:()=>c.value?.title?void 0:"Libro virtual",description:q,path:`/libros/${b}`,type:"book",image:A,jsonLd:W,titleTemplate:"%s"});const i=w(null),v=w([]),L=w(!1),P=w(!1),j=B(()=>{if(!g.value||g.value.length===0)return!1;const o=n=>n.some(f=>f.audio?!0:f.children&&f.children.length>0?o(f.children):!1);return o(g.value)}),H=async o=>{if(!r.auth){p.push(`/login?from=/libros/${b}`);return}F.value=o,M.value=!0;try{const n=typeof window<"u"?localStorage.getItem("auth-token"):null,f={};n&&(f.Authorization=`Bearer ${n}`);const $=await $fetch(`${d.public.API_WEB_URL}/api/libro/${b}/${o}`,{headers:f}),E=V($);E&&(R.value=E)}catch(n){console.error("Error fetching chapter:",n)}finally{M.value=!1}await G(),N()};K(g,o=>{if(o&&o.length>0){const n=S.query.goTo;if(n)H(n);else{const f=o[0];f&&H(f.id)}}},{immediate:!0}),K(()=>S.query.goTo,o=>{o&&H(o)});const h=o=>{if(P.value=!1,String(F.value)===String(o)){N();return}p.push({query:{goTo:o}})},I=w(null),z=o=>{const n=o.getBoundingClientRect().top+window.scrollY-112;window.scrollTo({top:Math.max(0,n),behavior:"smooth"})},N=()=>{G(()=>{if(I.value){z(I.value);return}window.scrollTo({top:0,behavior:"smooth"})})},ce=o=>{const n=decodeURIComponent(o.replace(/^#/,""));n&&G(()=>{const f=document.getElementById(n);f&&z(f)})},ve=o=>{const f=o.target?.closest?.("a");if(!f)return;const $=f.getAttribute("href")||"",E=$.indexOf("#");if(E===-1)return;const u=$.slice(E);if(!(!u||u==="#")){try{const J=new URL($,window.location.origin);if(J.origin===window.location.origin&&J.pathname!==window.location.pathname)return}catch{}o.preventDefault(),o.stopPropagation(),ce(u)}},me=()=>{const o=[],n=f=>{f.forEach($=>{$.audio&&o.push($),$.children&&$.children.length>0&&n($.children)})};n(g.value),v.value=o,o.length>0&&(i.value=o[0]??null,L.value=!0)},pe=o=>{v.value=[o],i.value=o,L.value=!0},ne=()=>{if(!i.value)return;const o=v.value.findIndex(n=>n.id===i.value?.id);o>=0&&o<v.value.length-1&&(i.value=v.value[o+1]??null)},be=()=>{if(!i.value)return;const o=v.value.findIndex(n=>n.id===i.value?.id);o>0&&(i.value=v.value[o-1]??null)},he=()=>{ne()},fe=o=>{L.value=o},ge=()=>{i.value=null,L.value=!1},ee=B(()=>R.value?.previous),te=B(()=>R.value?.next),xe=B(()=>g.value.length===0&&!!a.value?.pdf),ye=B(()=>({modulo:{edicion:a.value?.titulo||b,slug:R.value?.slug||b,type:"libros",web:"AP",url:S.fullPath},user:{id:r.usuario_info?.id??"",email:r.usuario_info?.ficha?.email??"",name:r.usuario_info?.ficha?.nombre_completo??""}}));return(o,n)=>{const f=we,$=Q,E=$e;return t(),s("div",Ut,[e("div",Nt,[e("div",Ft,[Z(k)?(t(),T(f,{key:0,t
1ype:"article",lines:2})):a.value.titulo?(t(),s("div",Dt,[e("div",Ot,[e("h1",Mt,x(a.value.titulo),1),e("div",Vt,[(t(!0),s(D,null,O(a.value.campaigns,(u,J)=>(t(),s("span",{key:u.id},[U(x(u.campaign),1),Number(J)<(a.value.campaigns?.length??0)-1?(t(),s("span",qt,",")):m("",!0)]))),128)),a.value.categoria?(t(),s("span",Wt,[n[5]||(n[5]=e("span",{class:"h-1.5 w-1.5 rounded-full bg-slate-300"},null,-1)),U(" "+x(a.value.categoria.nombre),1)])):m("",!0)]),a.value.resumen?(t(),s("p",Ht,x(a.value.resumen),1)):m("",!0)]),j.value?(t(),s("div",Jt,[e("button",{onClick:me,class:"bg-brand-seventh hover:bg-brand-sixth shadow-xs inline-flex items-center gap-2 rounded-lg px-4 py-2.5 text-xs font-bold text-white transition-colors"},[y($,{name:"heroicons:speaker-wave",class:"h-4 w-4"}),n[6]||(n[6]=U(" Escuchar libro completo ",-1))])])):m("",!0)])):m("",!0)]),xe.value?(t(),s("div",Xt,[y(E,null,{default:ae(()=>[Z(r).auth?(t(),T(Et,{key:0,"pdf-source-link":a.value.pdf??""},null,8,["pdf-source-link"])):m("",!0)]),_:1})])):(t(),s("div",Yt,[e("div",Zt,[n[7]||(n[7]=e("h2",{class:"text-md mb-4 border-b border-slate-100 pb-2"},"Ãndice de libro",-1)),e("div",Gt,[(t(!0),s(D,null,O(g.value,u=>(t(),T(se,{key:u.id,item:u,"active-item-id":F.value,"current-audio-id":i.value?.id,"global-is-playing":L.value,onSelectItem:h},null,8,["item","active-item-id","current-audio-id","global-is-playing"]))),128))])]),e("div",Kt,[e("div",null,[M.value?(t(),T(f,{key:0,t
1ype:"article",lines:4})):R.value.id?(t(),s("div",{key:1,ref_key:"chapterHeadingRef",ref:I,class:"scroll-mt-28",onClickCapture:ve},[y(et,{item:R.value,"current-audio-id":i.value?.id,"global-is-playing":L.value,onPlayAudio:pe},null,8,["item","current-audio-id","global-is-playing"]),e("div",Qt,[(t(!0),s(D,null,O(R.value.contenido,u=>(t(),T(Je,{key:u.id,item:u,libro:a.value},null,8,["item","libro"]))),128))]),R.value.referencias?.length?(t(),s("div",ea,[n[9]||(n[9]=e("div",{class:"mb-6 flex items-center gap-2"},[e("h2",{class:"ap-title-5 text-brand-first leading-none"},"Referencias bibliográficas")],-1)),e("ul",ta,[(t(!0),s(D,null,O(R.value.referencias,u=>(t(),s("li",{key:u.id,id:u.href_id,class:"flex scroll-mt-28 gap-4 text-justify text-sm text-slate-600"},[e("span",oa,x(u.palabra_clave)+".",1),e("div",na,[U(x(u.contenido)+" ",1),u.sup_id?(t(),s("a",{key:0,href:"#"+u.sup_id,class:"hover:bg-brand-seventh ml-2 inline-flex items-center gap-1 rounded-full bg-slate-100 px-2 py-0.5 text-xs font-bold text-slate-500 transition-colors hover:text-white",title:"Volver al texto"},[y($,{name:"heroicons:arrow-up",class:"h-3 w-3"}),n[8]||(n[8]=U(" Volver ",-1))],8,sa)):m("",!0)])],8,aa))),128))])])):m("",!0),e("div",la,[ee.value?(t(),s("button",{key:0,onClick:n[0]||(n[0]=u=>h(ee.value.id)),class:"hover:text-brand-seventh group inline-flex items-center gap-1.5 text-xs font-bold text-slate-500 transition-colors"},[y($,{name:"heroicons:arrow-left",class:"h-4 w-4 transition-transform group-hover:-translate-x-1"}),e("span",ia,x(ee.value.titulo),1)])):(t(),s("div",ra)),te.value?(t(),s("button",{key:2,onClick:n[1]||(n[1]=u=>h(te.value.id)),class:"hover:text-brand-seventh group inline-flex items-center gap-1.5 text-xs font-bold text-slate-500 transition-colors"},[e("span",da,x(te.value.titulo),1),y($,{name:"heroicons:arrow-right",class:"h-4 w-4 transition-transform group-hover:translate-x-1"})])):(t(),s("div",ua))])],544)):m("",!0)])])]))]),!Z(k)&&g.value.length>0?(t(),s("button",{key:0,onClick:n[2]||(n[2]=u=>P.value=!0),"aria-label":"Abrir Ãndice",class:"bg-brand-seventh fixed bottom-6 right-6 z-40 flex h-12 w-12 items-center justify-center rounded-full text-white shadow-lg transition-transform hover:scale-105 lg:hidden"},[y($,{name:"heroicons:list-bullet-solid",class:"h-6 w-6"})])):m("",!0),P.value?(t(),s("div",{key:1,class:"backdrop-blur-xs fixed inset-0 z-50 bg-slate-900/40 transition-opacity lg:hidden",onClick:n[3]||(n[3]=u=>P.value=!1)})):m("",!0),e("div",{class:X(["fixed bottom-0 right-0 top-0 z-50 w-80 transform overflow-y-auto bg-white p-4 shadow-2xl transition-transform duration-300 ease-in-out lg:hidden",P.value?"translate-x-0":"translate-x-full"])},[e("div",ca,[n[10]||(n[10]=e("h3",{class:"text-brand-first text-sm"},"Ãndice de libro",-1)),e("button",{onClick:n[4]||(n[4]=u=>P.value=!1),"aria-label":"Cerrar Ãndice",class:"text-slate-400 hover:text-slate-600"},[y($,{name:"heroicons:x-mark-solid",class:"h-5 w-5"})])]),e("div",va,[(t(!0),s(D,null,O(g.value,u=>(t(),T(se,{key:u.id+"-mobile",item:u,"active-item-id":F.value,"current-audio-id":i.value?.id,"global-is-playing":L.value,onSelectItem:h},null,8,["item","active-item-id","current-audio-id","global-is-playing"]))),128))])],2),i.value?(t(),T(xt,{key:2,audioUrl:i.value.audio||"",libro:{portada:a.value.portada||"",titulo:a.value.titulo||"",descripcion_imagen:a.value.descripcion_imagen||""},chapterTitle:i.value.titulo||"",showNavigation:v.value.length>1,onNextChapter:ne,onPrevChapter:be,onEnded:he,onPlayStateChange:fe,onClose:ge},null,8,["audioUrl","libro","chapterTitle","showNavigation"])):m("",!0),Z(r).auth&&!Z(k)?(t(),T(De,{key:3,"info-send":ye.value},null,8,["info-send"])):m("",!0)])}}}),ja=ie(ma,[["__scopeId","data-v-13868511"]]);export{ja as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.