import{_ as X}from"./Cy9H0zxg.js";import{_ as G}from"./Cuxhuhxe.js";import{_ as H,m as w,a as B}from"./edtG_Qsv.js";import{_ as J}from"./CkkKLaS0.js";import{_ as K}from"./DJsAhCfb.js";import{_ as O}from"./BxmJ02Bh.js";import{_ as Q}from"./BRV-2yWR.js";import{d as W,u as Y,r as i,w as Z,c as N,o as s,a as o,b as p,t as ee,e as t,F as l,h as v,f as u,g as d,i as te,j as ae,k as z,n as se}from"./DGtjvSSZ.js";import{u as oe}from"./IoecnJiL.js";import{u as ie}from"./JLBoTV-x.js";const ne={class:"mt-24px pb-56px container"},re={class:"mb-24px border-b border-b-neutral-300 pb-24px text-center text-5 font-bold leading-5 tracking-widest uppercase"},le={key:0,class:"md:hidden"},de={class:"flex border-t border-t-neutral-300 lg:border-t-0 lg:pt-32px"},ge={class:"lg:border-r lg:border-r-neutral-300 lg:pr-32px"},me={class:"hidden lg:box-border lg:box-border lg:w-332px lg:flex lg:flex-shrink-0 lg:basis-332px lg:flex-col lg:pl-32px"},ce={key:0},_=7,Se=W({__name:"[slug]",async setup(pe){var P;let f,S;const L=te().public.base,k=Y(),C=i(1),{data:n,error:T}=([f,S]=Z(()=>ae(`/api/categories/${k.params.slug}?limit=${_}`,"$dGjUxJ3XMX")),f=await f,S(),f);if(((P=T.value)==null?void 0:P.statusCode)===404)throw N({message:"La categoría no existe",statusCode:404});if(!n.value)throw N({message:"Categoría no encontrada",statusCode:404});const g=i(n.value.category),A=i(n.value.posts.slice(0,2)),M=i(n.value.posts.slice(2)),q=i(n.value.total),b=i(n.value.sponsorBox),$=i(null);async function D(a){const m=a===1?2:(a-1)*_,r=a===1?_-2:_;await $fetch(`/api/categories/${k.params.slug}?limit=${r}&offset=${m}`).then(c=>{M.value=c.posts}).catch(c=>{console.log("error",c)})}function F(a){var m,r;C.value=a,D(a),a>1?(m=$.value)==null||m.classList.add("hidden"):(r=$.value)==null||r.classList.remove("hidden")}const{setTargetType:V,setTargetCategory:j,targeting:h}=oe();return V("portada"),j(k.params.slug.toString()),ie({title:()=>`Página 7 | ${g.value.name}`,ogUrl:()=>`${L}/categorias/${g.value.slug}`,ogTitle:()=>`Página 7 | ${g.value.name}`,twitterTitle:()=>`Página 7 | ${g.value.name}`}),(a,m)=>{const r=X,c=G,y=H,E=J,I=K,R=O,U=Q;return s(),o("div",ne,[p("h1",re,ee(t(g).name),1),p("div",{ref_key:"firstsPosts",ref:$,class:"grid md:grid-cols-2 md:gap-x-12 md:border-b md:border-b-neutral-300"},[(s(!0),o(l,null,v(t(A),e=>(s(),z(r,{key:e.id,url:e.url,title:e.title,"featured-image":e.featuredImage,"main-category":e.mainCategory,"published-at":e.publishedAt},null,8,["url","title","featured-image","main-category","published-at"]))),128)),t(b)?(s(),o("div",le,[(s(!0),o(l,null,v(t(b),e=>(s(),o(l,{key:e.queryBox.id},[e.posts.length>0?(s(),z(c,{key:0,posts:e.posts,sponsor:e.queryBox},null,8,["posts","sponsor"])):u("",!0)],64))),128))])):u("",!0)],512),d(y,{id:"movil_ad_middle2",path:"/1098385/pagina7cl/ad_middle2",dimensions:[300,250],"size-mapping":"mobileSizeMapping"in a?a.mobileSizeMapping:t(w),targeting:t(h),"show-frame":""},null,8,["size-mapping","targeting"]),p("div",de,[p("div",ge,[(s(!0),o(l,null,v(t(M),(e,x)=>(s(),o("div",{key:e.id},[d(E,{url:e.url,title:e.title,"featured-image":e.featuredImage,"main-category":e.mainCategory,"published-at":e.publishedAt,class:se({"border-t border-t-neutral-300 pt-24px md:border-t-0 md:pt-0":x==3,"mb-24px md:mb-0":x==2,"lg:!mt-0":x==0})},null,8,["url","title","featured-image","main-category","published-at","class"]),x==2?(s(),z(y,{key:0,id:"movil_ad_middle3",path:"/1098385/pagina7cl/ad_middle3",dimensions:[300,250],"size-mapping":"mobileSizeMapping"in a?a.mobileSizeMapping:t(w),targeting:t(h),"show-frame":""},null,8,["size-mapping","targeting"])):u("",!0)]))),128)),d(I,{"num-posts":_,total:t(q),"current-page":t(C),onChangePage:F},null,8,["total","current-page"])]),p("div",me,[t(b)?(s(),o("div",ce,[(s(!0),o(l,null,v(t(b),e=>(s(),o(l,{key:e.queryBox.id},[e.posts.length>0?(s(),z(R,{key:0,class:"mb-24px lg:mt-24px",posts:e.posts,sponsor:e.queryBox},null,8,["posts","sponsor"])):u("",!0)],64))),128))])):u("",!0),d(y,{id:"desk_ad_box2",path:"/1098385/pagina7cl/ad_box2",dimensions:[300,250],"size-mapping":"asideSizeMapping"in a?a.asideSizeMapping:t(B),targeting:t(h)},null,8,["size-mapping","targeting"]),d(y,{id:"desk_ad_box3",path:"/1098385/pagina7cl/ad_box3",dimensions:[300,250],"size-mapping":"asideSizeMapping"in a?a.asideSizeMapping:t(B),targeting:t(h)},null,8,["size-mapping","targeting"]),d(U)])])])}}});export{Se as default};