import{_ as U,m as y,a as w}from"./edtG_Qsv.js";import{_ as B}from"./CkkKLaS0.js";import{_ as I}from"./DJsAhCfb.js";import{_ as V}from"./BRV-2yWR.js";import{d as j,u as A,r as u,w as D,c as E,o as n,a as p,b as s,t as F,e as a,l as H,v as L,m as q,g as l,F as O,h as G,i as J,j as K,n as Q,k as W,f as X}from"./DGtjvSSZ.js";import{u as Y}from"./IoecnJiL.js";import{u as Z}from"./JLBoTV-x.js";const ee={class:"mt-24px pb-56px container"},ae={class:"grid mb-24px border-b border-b-neutral-300 pb-24px md:grid-cols-3"},te={class:"mb-24px border-b border-b-neutral-300 pb-24px text-center text-5 font-bold leading-5 tracking-widest uppercase md:col-start-2 md:mb-0 md:border-b-0 md:pb-0"},se={class:"flex justify-center md:justify-end"},oe={class:"flex border-t border-t-neutral-300 lg:border-t-0 lg:pt-32px"},re={key:0,class:"lg:w-full lg:border-r lg:border-r-neutral-300 lg:pr-32px"},ie={key:1,class:"lg:w-full lg:border-r lg:border-r-neutral-300 lg:pr-32px"},ne={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"},b=7,_e=j({__name:"[search]",async setup(le){var $;let m,h;const S=J().public.base,i=A(),d=u("date"),v=u(1);let x=!1;const{data:f}=([m,h]=D(()=>K(`/api/post/search?limit=${b}&order=${d.value}&s=${encodeURIComponent(i.params.search)}`,"$4RwldwHf72")),m=await m,h(),m);if(!f.value)throw E({message:"Error en la búsqueda",statusCode:404});const _=u(f.value.posts),C=u(f.value.total);($=_.value)!=null&&$.length||(x=!0);async function z(e){v.value=e;const t=e===1?0:(e-1)*b;await $fetch(`/api/post/search?limit=${b}&offset=${t}&order=${d.value}&s=${encodeURIComponent(i.params.search)}`).then(r=>{_.value=r.posts}).catch(r=>{console.log("error",r)})}function M(e){z(e)}const{setTargetType:k,setTargetCategory:P,targeting:g}=Y();return k("portada"),P("buscador"),Z({title:()=>`Página 7 | ${i.params.search}`,ogUrl:()=>`${S}/buscador/${encodeURIComponent(i.params.search)}`,ogTitle:()=>`Página 7 | ${i.params.search}`,twitterTitle:()=>`Página 7 | ${i.params.search}`}),(e,t)=>{const r=U,R=B,N=I,T=V;return n(),p("div",ee,[s("div",ae,[s("h1",te,F(a(i).params.search),1),s("div",se,[t[3]||(t[3]=s("p",null,"Ordenar por:",-1)),H(s("select",{"onUpdate:modelValue":t[0]||(t[0]=o=>q(d)?d.value=o:null),name:"order",class:"bg-transparent pl-10px",onChange:t[1]||(t[1]=o=>z(1))},t[2]||(t[2]=[s("option",{value:"date"},"Últimas publicadas",-1),s("option",{value:"relevance"},"Relevancia",-1)]),544),[[L,a(d)]])])]),l(r,{id:"movil_ad_middle2",path:"/1098385/pagina7cl/ad_middle2",dimensions:[300,250],"size-mapping":"mobileSizeMapping"in e?e.mobileSizeMapping:a(y),targeting:a(g),"show-frame":""},null,8,["size-mapping","targeting"]),s("div",oe,[a(x)?(n(),p("div",re,t[4]||(t[4]=[s("h3",{class:"mr-16px text-5.5 font-medium leading-6 font-garamond"},"No hay resultados",-1)]))):(n(),p("div",ie,[(n(!0),p(O,null,G(a(_),(o,c)=>(n(),p("div",{key:o.id},[l(R,{url:o.url,title:o.title,"featured-image":o.featuredImage,"main-category":o.mainCategory,"published-at":o.publishedAt,class:Q({"border-t border-t-neutral-300 pt-24px md:border-t-0 md:pt-0":c==3,"mb-24px md:mb-0":c==2,"lg:!mt-0":c==0})},null,8,["url","title","featured-image","main-category","published-at","class"]),c==2?(n(),W(r,{key:0,id:"movil_ad_middle3",path:"/1098385/pagina7cl/ad_middle3",dimensions:[300,250],"size-mapping":"mobileSizeMapping"in e?e.mobileSizeMapping:a(y),targeting:a(g),"show-frame":""},null,8,["size-mapping","targeting"])):X("",!0)]))),128)),l(N,{"num-posts":b,total:a(C),"current-page":a(v),onChangePage:M},null,8,["total","current-page"])])),s("div",ne,[l(r,{id:"desk_ad_box2",path:"/1098385/pagina7cl/ad_box2",dimensions:[300,250],"size-mapping":"asideSizeMapping"in e?e.asideSizeMapping:a(w),targeting:a(g)},null,8,["size-mapping","targeting"]),l(r,{id:"desk_ad_box3",path:"/1098385/pagina7cl/ad_box3",dimensions:[300,250],"size-mapping":"asideSizeMapping"in e?e.asideSizeMapping:a(w),targeting:a(g)},null,8,["size-mapping","targeting"]),l(T)])])])}}});export{_e as default};