import{r as i,j as e,Q as p,m as f,a as g,at as S,z as j,q as m}from"./0-vendor-react-DWOJpYrt.js";import{B as E}from"./page-galeriaimagenes-Dnb019dP.js";import{m as N}from"./page-manual-viewer-DJEjbUOL.js";import"./1-vendor-utils-Delnuc0l.js";import"./2-vendor-markdown-BQlHAcA7.js";import"./page-ajustes-DgawOEJM.js";import"./component-markdown-S2Gzerbp.js";const z=()=>{const[x,b]=i.useState(new Set([1])),[u,v]=i.useState(new Set),[d,w]=i.useState(""),y=s=>{const r=new Set(x);r.has(s)?r.delete(s):r.add(s),b(r)},C=(s,r)=>{const o=`${s}-${r}`,t=new Set(u);t.has(o)?t.delete(o):t.add(o),v(t)},h=(s=>{if(!d.trim())return s;const r=d.toLowerCase();return s.map(o=>{const t=o.nombre.toLowerCase().includes(r),l=o.bloques.map(a=>{const n=a.nombre.toLowerCase().includes(r),q=a.capitulos.filter(c=>c.titulo.toLowerCase().includes(r)||c.palabrasClave.some(B=>B.toLowerCase().includes(r))||c.id.toLowerCase().includes(r)||t||n);return{...a,capitulos:q}}).filter(a=>a.capitulos.length>0);return{...o,bloques:l}}).filter(o=>o.bloques.length>0)})(N),k=s=>e.jsx(p,{className:"w-5 h-5"});return e.jsxs("div",{className:"space-y-6",children:[e.jsx(E,{to:"/",label:"Volver al inicio"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(p,{className:"w-8 h-8 text-primary"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Manual Completo TES"}),e.jsxs("p",{className:"text-muted-foreground",children:["Navega por todos los capítulos del manual (",N.reduce((s,r)=>s+r.bloques.reduce((o,t)=>o+t.capitulos.length,0),0)," capítulos)"]})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(f,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx("input",{type:"text",value:d,onChange:s=>w(s.target.value),placeholder:"Buscar capítulo, palabra clave...",className:"w-full h-12 pl-12 pr-4 bg-card border border-border rounded-xl text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary"})]}),e.jsxs(g,{to:"/galeria",className:"flex items-center gap-2 px-4 h-12 bg-card border border-border rounded-xl hover:bg-muted transition-colors text-foreground",children:[e.jsx(S,{className:"w-5 h-5"}),e.jsx("span",{className:"hidden sm:inline",children:"Galería"})]})]})]}),e.jsx("div",{className:"space-y-2",children:h.map(s=>{const r=x.has(s.id),o=s.bloques.reduce((t,l)=>t+l.capitulos.length,0);return e.jsxs("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>y(s.id),className:"w-full flex items-center gap-3 p-4 hover:bg-muted transition-colors text-left",children:[r?e.jsx(j,{className:"w-5 h-5 text-muted-foreground flex-shrink-0"}):e.jsx(m,{className:"w-5 h-5 text-muted-foreground flex-shrink-0"}),k(s.icono),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("h2",{className:"font-semibold text-foreground",children:["Parte ",s.id,": ",s.nombre]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.bloques.length," bloques • ",o," capítulos"]})]})]}),r&&e.jsx("div",{className:"border-t border-border",children:s.bloques.map(t=>{const l=`${s.id}-${t.id}`,a=u.has(l);return e.jsxs("div",{className:"border-b border-border last:border-b-0",children:[e.jsxs("button",{onClick:()=>C(s.id,t.id),className:"w-full flex items-center gap-3 p-3 pl-8 hover:bg-muted/50 transition-colors text-left",children:[a?e.jsx(j,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):e.jsx(m,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("h3",{className:"font-medium text-foreground",children:["Bloque ",t.id,": ",t.nombre]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.capitulos.length," capítulos"]})]})]}),a&&e.jsx("div",{className:"bg-muted/30",children:t.capitulos.map(n=>e.jsxs(g,{to:n.rutaUrl,className:"flex items-center gap-3 p-3 pl-12 hover:bg-muted transition-colors group",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:n.id}),e.jsx("span",{className:"font-medium text-foreground group-hover:text-primary transition-colors",children:n.titulo})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.tiempoLectura," min"]}),n.importancia==="alta"&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-red-500/20 text-red-600 dark:text-red-400 rounded",children:"Alta"})]})]}),e.jsx(m,{className:"w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]},n.id))})]},t.id)})})]},s.id)})}),d&&h.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(f,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No se encontraron resultados"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Intenta con otros términos de búsqueda"})]})]})};export{z as default};