import{_ as H}from"./BQ1rQp_p.js";import{h as I,u as N,k as T,j as W,q as Z,x as L,m as u,B as F,A as G,C as J,D as M,b as O,ac as Q,e as h,c as x,F as s,d,t as C,f as S,g as b,w as j,n as q,H as f,X,S as Y,Q as K,I as aa}from"./CMy8cRRO.js";import{c as ta}from"./BNA1-8g2.js";import{u as ea}from"./DqRmt5m0.js";import"./DNyoUGSK.js";import"./B-_kvV4S.js";import"./Bodsu7BH.js";const sa={key:0,class:"featured-post"},oa={class:"block w-full relative p-4 h-screen-head-jn-port md:h-screen-head-jn featured-post__image-container"},na=["srcset"],la=["src","alt"],ra={class:"text-center w-5/6 max-w-5xl mx-auto pb-8"},ia={key:0,class:"font-sans text-base uppercase tracking-wider mb-3 featured-post__category"},ca={class:"font-serif text-3xl md:text-4xl lg:text-5xl tracking-normal mb-3 featured-post__title"},ua={key:1,class:"font-serif text-2xl tracking-normal mb-6 featured-post__subtitle"},xa=I({__name:"index",async setup(da){var U,z;let a,n;const{client:_,filter:$}=N(),p=T(),r=W(),P=Z();P.value=!1;const V=L(),{data:y}=([a,n]=u(()=>f(()=>_.getSingle("journal",{lang:p.value[r.params.lang]}),"$WCZRAMB84V")),a=await a,n(),a),{data:o}=([a,n]=u(()=>f(()=>_.getByUID("journal_post",y.value.data.featured_post.uid,{lang:p.value[r.params.lang]}),"$SYUaJemfo6")),a=await a,n(),a);let k={};if(o.value){o.value.category=o.value.data.category_relation.uid;const{data:e}=([a,n]=u(()=>f(()=>_.getByUID("journal_category",o.value.data.category_relation.uid,{lang:p.value[r.params.lang]}),"$D9yrm7JyBV")),a=await a,n(),a);k=e}if(!((U=y.value)!=null&&U.data))throw F({statusCode:404,fatal:!0});const i=y.value.data,c=([a,n]=u(()=>ea()),a=await a,n(),a),{BASE_URL:w}=G().public,{data:A}=([a,n]=u(()=>f(()=>_.getAllByType("journal_category",{lang:p.value[r.params.lang]}),"$7WWFl5GBO7")),a=await a,n(),a),B=[...i.body];if(A.value!==null)for(const e of A.value){const{data:m}=([a,n]=u(()=>f(e.id,()=>_.get({filters:[$.at("document.type","journal_post"),$.at("my.journal_post.category_relation",e.id)],lang:p.value[r.params.lang]}),"$WEQEdj90Cx")),a=await a,n(),a);if(m.value&&"results"in m.value){const v=[...m.value.results];for(const t of v)t.image=t.data.post_image,t.video=t.data.post_video||{},t.title=((z=t.data.post_title[0])==null?void 0:z.text)||null,t.orientation=t.data.orientation,t.lang=t.lang.split("-")[0],t.category=t.data.category_relation.uid,t.url=t.url?t.url.replace(/^(\/[a-z]{2}-[a-z]{2}\/+)/g,`/${t.lang}/`):null,t.author_title=t.data.trainer_title,B.every(g=>{var E;return g.slice_type==="carousel_posts"&&g.primary.category.uid===e.uid?(g.items=(E=m.value)==null?void 0:E.results,!1):!0})}}const l=y.value;(l.data.social_cards&&l.data.social_cards[0]&&l.data.social_cards[0].social_card_image.facebook?Object.keys(l.data.social_cards[0].social_card_image.facebook).length===0:!0)?V.value={}:(l.data.sharing_url=w+r.path,l.data.sharing_locale=l.lang?l.lang.split("-")[0]+"_"+l.lang.split("-")[1].toUpperCase():"en_GB",V.value=l.data);const R=J(()=>"canonical"in i&&"uid"in i.canonical&&i.canonical.uid?w+M(i.canonical):w+r.path);O({htmlAttrs:{lang:r.params.lang},title:i.meta_title||(c==null?void 0:c.meta_title_default),meta:[{hid:"description",name:"description",content:i.meta_description||(c==null?void 0:c.meta_description_default)||""}],link:[{rel:"canonical",href:R}]});const D=Q();return D.value.length||B.find(e=>{e.slice_type==="carousel_posts"&&e.primary.category.type&&D.value.push(e.primary.category)}),(e,m)=>{const v=H,t=X,g=Y;return h(),x("div",null,[s(o)?(h(),x("article",sa,[d("div",oa,[d("picture",null,[d("source",{srcset:s(o).data.image.smallorientport.url,media:"(max-width: 767px)"},null,8,na),d("img",{class:"block object-cover h-full w-full featured-post__image",src:s(o).data.image.xlargeorientland.url,alt:s(o).data.image.alt||e.$prismic.asText(s(o).data.post_title)},null,8,la)])]),d("div",ra,[s(k)?(h(),x("h3",ia,C(e.$prismic.asText(s(k).data.category_title)),1)):S("",!0),b(v,{document:s(o)},{default:j(()=>[d("h3",ca,C(e.$prismic.asText(s(o).data.post_title)),1)]),_:1},8,["document"]),s(o).data.post_excerpt?(h(),x("h4",ua,C(e.$prismic.asText(s(o).data.post_excerpt)),1)):S("",!0),b(t,{btnstyle:"alternative",class:q([e.$styling("button__alternative"),"mx-auto featured-post__button"])},{default:j(()=>[b(v,{document:s(o)},{default:j(()=>[K(C(s(c).link_view||"View"),1)]),_:1},8,["document"])]),_:1},8,["class"])])])):S("",!0),b(g,{slices:B,components:s(aa)(s(ta))},null,8,["components"])])}}});export{xa as default};