1import{l as K,m as Q,p as W,c as i,r as k,w as X,M as I,j as l,h as n,e as m,s as a,t as Y,f as t,O as Z,q as g,v as z,H as L,y as tt,S as R,T as H,x as et,d as O}from"./XkugP5Em.js";import st from"./DW71svsZ.js";import{A as P}from"./tBPHRfYS.js";import{a as ot,u as at}from"./DWGHjdwy.js";import"./DazraYYU.js";import"./cOnVkv8w.js";const nt={class:"blog-card-items"},lt={key:0,class:"blog-card-items__headline grid-container"},it={class:"blog-card-items__headline-text"},ct={key:0,class:"blog-card-items__group"},rt={class:"blog-card-items__group-header"},dt={class:"blog-card-items__group-actions"},ut={key:0,class:"blog-card-items__navigation"},_t=["disabled"],gt=["disabled"],mt={class:"blog-card-items__grid"},bt={key:1,class:"blog-card-items__group"},pt={class:"blog-card-items__group-header"},vt={class:"blog-card-items__group-actions"},ht={key:0,class:"blog-card-items__navigation"},ft=["disabled"],kt=["disabled"],Pt={class:"blog-card-items__grid"},yt={class:"blog-card-items__shape"},c=2,xt=6,jt={__name:"BlockBlogPosts",props:{block:{type:Object,default:()=>({})}},async setup(y){var D;let v,C;const x=y,S=Q(),{siteUrl:T}=S.public,N=W(),q=i(()=>x.block.posts||x.block.items||[]),E=i(()=>x.block.projects||[]),B=k([]),M=k([]),r=k(0),d=k(0),[U,F]=([v,C]=X(()=>Promise.all([ot({}),at()])),v=await v,C(),v);B.value=U.data||[],M.value=((D=F.data.value)==null?void 0:D.data)||[];const V=(o,e,b)=>{const h=o.length?o:e,p=new Map(e.slice(0,3).map((s,f)=>[Number(s.id),f]));return h.map(s=>({...s,is_pinned:p.has(Number(s.id))})).sort((s,f)=>{const j=p.get(Number(s.id)),w=p.get(Number(f.id));return j!==void 0||w!==void 0?j===void 0?1:w===void 0?-1:j-w:b(f)-b(s)}).slice(0,xt)},u=i(()=>V(B.value,q.value,o=>new Date(o.publication_date||0))),_=i(()=>V(M.value,E.value,o=>new Date(o.start_date||o.end_date||0))),$=i(()=>Math.ceil(u.value.length/c)),A=i(()=>Math.ceil(_.value.length/c)),G=i(()=>{const o=r.value*c;return u.value.slice(o,o+c)}),J=i(()=>{const o=d.value*c;return _.value.slice(o,o+c)});return I(u,()=>{r.value=Math.max(0,Math.min(r.value,$.value-1))}),I(_,()=>{d.value=Math.max(0,Math.min(d.value,A.value-1))}),(o,e)=>{const b=tt,h=st,p=et;return n(),l("section",nt,[y.block.title?(n(),l("div",lt,[a("h2",it,Y(y.block.title),1)])):m("",!0),t(u).length||t(_).length?(n(),l("div",{key:1,class:Z(["blog-card-items__sections grid-container",{"blog-card-items__sections--single":!t(u).length||!t(_).length}])},[t(u).length?(n(),l("section",ct,[a("div",rt,[e[5]||(e[5]=a("h3",null,"Posts",-1)),a("div",dt,[g(b,{to:t(N)("/blog"),class:"blog-card-items__more"},{default:z(()=>[...e[4]||(e[4]=[L(" View more ",-1)])]),_:1},8,["to"]),t(u).length>c?(n(),l("div",ut,[a("button",{type:"button",class:"blog-card-items__navigation-button blog-card-items__navigation-button--previous","aria-label":"Previous home blog posts",disabled:t(r)===0,onClick:e[0]||(e[0]=s=>r.value-=1)},[g(t(P),{filled:""})],8,_t),a("button",{type:"button",class:"blog-card-items__navigation-button","aria-label":"Next home blog posts",disabled:t(r)>=t($)-1,onClick:e[1]||(e[1]=s=>r.value+=1)},[g(t(P),{filled:""})],8,gt)])):m("",!0)])]),a("div",mt,[(n(!0),l(R,null,H(t(G),s=>(n(),O(h,{key:s.id,card:s,type:"post"},null,8,["card"]))),128))])])):m("",!0),t(_).length?(n(),l("section",bt,[a("div",pt,[e[7]||(e[7]=a("h3",null,"Projects",-1)),a("div",vt,[g(b,{to:`${t(N)("/blog")}?view=projects`,class:"blog-card-items__more"},{default:z(()=>[...e[6]||(e[6]=[L(" View more ",-1)])]),_:1},8,["to"]),t(_).length>c?(n(),l("div",ht,[a("button",{type:"button",class:"blog-card-items__navigation-button blog-card-items__navigation-button--previous","aria-label":"Previous home projects",disabled:t(d)===0,onClick:e[2]||(e[2]=s=>d.value-=1)},[g(t(P),{filled:""})],8,ft),a("button",{type:"button",class:"blog-card-items__navigation-button","aria-label":"Next home projects",disabled:t(d)>=t(A)-1,onClick:e[3]||(e[3]=s=>d.value+=1)},[g(t(P),{filled:""})],8,kt)])):m("",!0)])]),a("div",Pt,[(n(!0),l(R,null,H(t(J),s=>(n(),O(h,{key:s.id,card:s,type:"project"},null,8,["card"]))),128))])])):m("",!0)],2)):m("",!0),a("div",yt,[g(p,{src:t(T)+"/img/shape-mask.png",format:"webp",alt:"Decorative shape",loading:"lazy"},null,8,["src"])])])}}},$t=K(jt,[["__scopeId","data-v-43e6514c"]]);export{$t 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.