1import{i as $,a0 as q,g as o,j as L,b as O,q as b}from"./BnowyiiT.js";import{_ as R}from"./BuFF0eT1.js";import{_ as W}from"./C8w-KsDs.js";import{_ as E}from"./Bu5CDnzZ.js";import{d as T}from"./Bh1tyPu7.js";import{_ as V}from"./B2YqjWf_.js";import{a2 as p,a5 as g,a3 as w,X as i,a8 as k,a6 as C,C as s,p as z,E as M,u as I,aj as X,W as G,j as x,z as v}from"./DGxlnW41.js";import{e as P}from"./p1QsUf6f.js";import"./_CHoJ0K5.js";import"./C3C-A3Zu.js";import"./SxxlrK1N.js";import"./pggHmpmL.js";import"./nLQdF57q.js";import"./CwpJWcVn.js";import"./Dmq4J0nM.js";import"./CbAtIVSG.js";import"./BirJEn2g.js";import"./CkMOyL3W.js";const H={class:"d-flex justify-content-xl-end"},J={__name:"LatestNews",props:{relatedPage:{type:Object},title:{type:String},featuredArticle:{type:Object,default:null},articles:{type:[Array,Object]}},setup(a){return(r,U)=>{const h=q,d=$,f=R,_=W,u=E,n=T;return p(),g(n,{class:"latest-news"},{default:w(({addToTimeline:l})=>[i(d,{onUpdated:l,class:"bold text-uppercase lh-1 pb-2 pb-md-3 pb-xl-4 px-1 px-md-0-875 px-xl-2-25",preset:"fadeUp",to:{delay:.1}},{default:w(()=>[i(h,{tag:"h2",text:a.title},null,8,["text"])]),_:1},8,["onUpdated"]),a.featuredArticle?(p(),g(d,{key:0,onUpdated:l,preset:"fadeUp",to:{delay:.25}},{default:w(()=>[i(f,{article:a.featuredArticle},null,8,["article"])]),_:1},8,["onUpdated"])):k("",!0),i(_,{class:"articles",items:a.articles,showDate:!0,showDescription:!0},null,8,["items"]),a.relatedPage?(p(),g(d,{key:1,onUpdated:l,preset:"fadeUp",to:{delay:.5},class:"px-1 px-md-0-875 px-xl-2-25 pt-4 pb-2 pt-md-2-75 py-xl-4-5"},{default:w(()=>[C("div",H,[i(u,{class:"color-black hover-black d-flex align-items-center p5 p3-1-md p2-xl",url:("useResolveUrl"in r?r.useResolveUrl:s(V))(("getCmsField"in r?r.getCmsField:s(o))(a.relatedPage,"page")),text:r.$t("read-more")},null,8,["url","text"])])]),_:1},8,["onUpdated"])):k("",!0)]),_:1})}}},K={key:0,class:"mb-1 px-1 px-md-0-875 px-xl-2-25"},Q={class:"mb-0"},ye={__name:"cms",props:{data:{type:Object,required:!0}},setup(a){const r=a,{title:U,relatedPage:h,featuredArticleComponent:d}=L(r.data),{$cms:f}=O(),_=v(()=>o(d,"featuredArticle")||null),u=x([]),n=x(null),l=x(!1),c=x(""),B=async()=>{if(!_.value)return;const t=_.value,e=b(t);if(!o(t,"title")&&e)try{const{items:j}=await f.fetchByType("newsArticle",{include:2,limit:1,"sys.id":e});n.value=j?.[0]||null}catch{c.value="We couldn't load the selected featured article."}else n.value=t},A=async()=>{if(!l.value){l.value=!0,await B();try{const t=await f.fetchByType("newsArticle",{include:2,limit:6,order:"-fields.date"});u.value=t?.items||[],c.value=""}catch{c.value="We couldn't load the latest news right now.",l.value=!1}}},F=()=>{c.value="",l.value=!1,A()};let m=null;z(()=>{if(typeof window.requestIdleCallback=="function"){m=window.requestIdleCallback(()=>{A()},{timeout:2e3});return}m=window.setTimeout(()=>{A()},1)}),M(()=>{m!==null&&(typeof window.requestIdleCallback=="function"?window.cancelIdleCallback(m):clearTimeout(m))});const N=v(()=>n.value&&o(n.value,"date")?n.value:u.value?.find(e=>!!o(e,"date"))||null),D=v(()=>P(N.value)),S=v(()=>{const t=b(D.value);return u.value?.filter(e=>!(b(e)===t||!o(e,"date"))).map(e=>P(e)).slice(0,5)||[]});return(t,e)=>{const y=J;return p(),I(G,null,[s(c)?(p(),I("div",K,[C("p",Q,X(s(c)),1),C("button",{type:"button",class:"link mt-1",onClick:F}," Try again ")])):k("",!0),i(y,{featuredArticle:s(D),title:s(U),articles:s(S),relatedPage:s(h)},null,8,["featuredArticle","title","articles","relatedPage"])],64)}}};export{ye 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.