1import{j as e,cs as v,e as N,r as n,cm as b,cr as y,i as h,aJ as u,c3 as w,P as I}from"./index-CiJ62xMb.js";import{f as S}from"./format-BZ_WV4pM.js";const p=t=>{const a=document.createElement("textarea");return a.innerHTML=t,a.value},z=t=>t.replace(/<[^>]*>/g,"").trim(),C=({slug:t,title:a,excerpt:i,imageUrl:c,date:l})=>e.jsxs(v,{to:`/blog/${t}`,className:"group rounded-2xl border border-border bg-card overflow-hidden transition-all hover:shadow-lg hover:shadow-primary/10 hover:-translate-y-1",children:[e.jsx("div",{className:"aspect-video overflow-hidden bg-muted",children:c?e.jsx("img",{src:c,alt:p(a),className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105",loading:"lazy"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground text-sm",children:"Sin imagen"})}),e.jsxs("div",{className:"p-5 space-y-3",children:[e.jsx("time",{className:"text-xs text-muted-foreground",children:S(new Date(l),"d 'de' MMMM, yyyy",{locale:N})}),e.jsx("h2",{className:"text-lg font-semibold text-foreground leading-snug line-clamp-2 group-hover:text-primary transition-colors",children:p(a)}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3",children:z(p(i))})]})]}),E=()=>{const[t,a]=n.useState([]),[i,c]=n.useState(!0),[l,j]=n.useState(null),[d,x]=n.useState(1),[g,f]=n.useState(1);return n.useEffect(()=>{(async()=>{c(!0),j(null);const o=`https://qtjwzfbinsrmnvlsgvtw.supabase.co/functions/v1/get-wp-posts?page=${d}`;try{const r=await(await fetch(o,{headers:{apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InF0and6ZmJpbnNybW52bHNndnR3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjU5NzY4MDUsImV4cCI6MjA4MTU1MjgwNX0.gvLt5ggffAwHp-HbBAqyGa18HuNZzJ5AHD6p4q6dk7E"}})).json();if(r.error)throw new Error(r.error);a(r.posts||[]),f(r.totalPages||1)}catch(m){j(m.message||"Error al cargar el blog")}finally{c(!1)}})()},[d]),e.jsxs(b,{children:[e.jsx(y,{title:"Blog â Disruptivaa",description:"ArtÃculos, guÃas y novedades sobre marketing digital, CRM HubSpot, Shopify, automatización con IA y crecimiento de negocios.",path:"/blog"}),e.jsx("section",{className:"py-20 px-6",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-14",children:[e.jsx("h1",{className:"text-4xl font-bold text-foreground mb-4",children:"Blog"}),e.jsx("p",{className:"text-muted-foreground text-lg max-w-2xl mx-auto",children:"ArtÃculos, guÃas y novedades sobre marketing digital, tecnologÃa y negocios."})]}),l&&e.jsxs("div",{className:"text-center py-16",children:[e.jsx("p",{className:"text-destructive mb-4",children:l}),e.jsx(h,{variant:"outline",onClick:()=>x(1),children:"Reintentar"})]}),i&&e.jsx("div",{className:"grid gap-8 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6}).map((s,o)=>e.jsxs("div",{className:"rounded-2xl border border-border bg-card overflow-hidden",children:[e.jsx(u,{className:"aspect-video w-full"}),e.jsxs("div",{className:"p-5 space-y-3",children:[e.jsx(u,{className:"h-3 w-24"}),e.jsx(u,{className:"h-5 w-full"}),e.jsx(u,{className:"h-4 w-full"}),e.jsx(u,{className:"h-4 w-3/4"})]})]},o))}),!i&&!l&&t.length===0&&e.jsx("p",{className:"text-center text-muted-foreground py-16",children:"No hay artÃculos publicados todavÃa."}),!i&&!l&&t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid gap-8 sm:grid-cols-2 lg:grid-cols-3",children:t.map(s=>{var o,m,r;return e.jsx(C,{slug:s.slug,title:s.title.rendered,excerpt:s.excerpt.rendered,imageUrl:(r=(m=(o=s._embedded)==null?void 0:o["wp:featuredmedia"])==null?void 0:m[0])==null?void 0:r.source_url,date:s.date},s.slug)})}),g>1&&e.jsxs("div",{className:"flex justify-center items-center gap-4 mt-12",children:[e.jsxs(h,{variant:"outline",size:"sm",disabled:d<=1,onClick:()=>x(s=>s-1),children:[e.jsx(w,{size:16})," Anterior"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Página ",d," de ",g]}),e.jsxs(h,{variant:"outline",size:"sm",disabled:d>=g,onClick:()=>x(s=>s+1),children:["Siguiente ",e.jsx(I,{size:16})]})]})]})]})})]})};export{E 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.