1import{_ as S}from"./CXj0T_85.js";import{_ as T}from"./D4_s-5G-.js";import{E}from"./B73xvBgv.js";import{_ as R}from"./lmYVFA5A.js";import{e as V,ar as j,j as F,A as D,B as z,z as H,f as g,m as L,u as M,as as U,c as i,o as s,b as m,a as q,h as r,F as G,x as J,s as v,v as K,P as a,w as x,d as b,at as O}from"./Hywlf5_Z.js";import{u as Q}from"./DiY-bKXy.js";import"./DUMDuhfM.js";import"./DknOSgo0.js";import"./DqJxUJX6.js";import"./CG7d7SrY.js";const W={class:"mb-20"},X={class:"container mx-auto px-4 sm:px-6 lg:px-8 my-10"},Y={key:0,style:{"min-height":"500px"}},Z={key:1},ee={class:"blog-pagination flex justify-between items-center my-4 mx-auto"},me=V({__name:"index",async setup(te){let n,d;const I=j(),t=F(),$=D(),k=H(),{blogCategories:u}=z($),w=k.public.algoliaBlogIndex,c=g(()=>t.query.page||"1"),{data:B,pending:P,error:C,refresh:oe}=([n,d]=L(async()=>Q("blogPosts",async()=>{let e='{"articles": *[_type == "post" && contentfulArchived != true',o={firstItem:(c.value-1)*10,lastItem:c.value*10};t.query.category&&(e+=" && references($categoryId)",o.categoryId=t.query.category),e+='] | order(_createdAt desc) [$firstItem...$lastItem]{...,"excerpt": array::join(string::split(pt::text(content), "")[0..266], "")}}';const{articles:l}=await I.fetch(O`${e}`,o);return l.filter(p=>p.slug)},{watch:[()=>t.query]})),n=await n,d(),n),y=g(()=>{let e="";return t.query.category&&u.value&&(e=u.value.find(o=>o._id===t.query.category)?.title),e}),_=g(()=>y.value?y.value+" Posts":"Blog");return M(()=>{let e=_.value;return t.query.page&&t.query.page!=="1"&&(e+=" - Page "+t.query.page),{title:e+" | Eiffel Trading"}}),U(()=>{window.scrollTo(0,0)}),(e,o)=>{const l=S,p=T,A=E,f=R;return s(),i("div",W,[m(l,{title:r(_)},null,8,["title"]),m(p,{placeholder:"Search articles...","index-name":r(w),"suggestion-attribute":"title","results-route":"blog-search"},null,8,["index-name"]),q("div",X,[r(P)?(s(),i("p",Y,"Fetching page content...")):r(C)?(s(),i("p",Z,"An error occurred :(")):(s(!0),i(G,{key:2},J(r(B),(h,N)=>(s(),v(A,{key:h._id,post:h,excerpt:!0,index:N,page:parseInt(r(c)),categories:r(u)},null,8,["post","index","page","categories"]))),128)),q("section",ee,[(e._.provides[a]||e.$route).query.page>1?(s(),v(f,{key:0,to:{name:"blog",query:{page:parseInt((e._.provides[a]||e.$route).query.page||"1")-1,category:(e._.provides[a]||e.$route).query.category}},class:"blog-post-more-left"},{default:x(()=>[...o[0]||(o[0]=[b("Previous page",-1)])]),_:1},8,["to"])):K("",!0),m(f,{to:{name:"blog",query:{page:parseInt((e._.provides[a]||e.$route).query.page||"1")+1,category:(e._.provides[a]||e.$route).query.category}},class:"blog-post-more-right"},{default:x(()=>[...o[1]||(o[1]=[b("Next page",-1)])]),_:1},8,["to"])])])])}}});export{me 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.