1import{d as W,ai as X,aE as Y,H as I,a4 as Z,z as ee,G as ae,J as le,o as i,j as b,w as x,a as O,u as e,h as y,c as A,F as Q,b as P,g as te,f as T,K as se,r as n,l as re}from"./DjtN09aq.js";import{_ as ne}from"./COMg61qY.js";import{_ as oe}from"./CPFCT09N.js";import{_ as ie}from"./DPgD-kUD.js";import{_ as ue}from"./CRC722Oe.js";import"./jlE778bT.js";import"./Bu52Y127.js";import"./otH78XZw.js";import"./VexNxrIz.js";import"./C8oKskU6.js";import"./0xmjySIm.js";import"./Ca6eoOej.js";import"./6F1xq6wi.js";const ce={class:"w-full mt-12 mb-4 text-center text-clear"},ge={class:"pb-8 bg-surface news-listing"},de={key:3,class:"w-full px-4 mt-12 mb-4 text-center text-clear"},ve={key:4,class:"w-full px-4 mt-12 mb-4 text-center text-clear"},Ae=W({name:"ListingsNews",__name:"index",props:{slots:{default:()=>({adSlot:void 0})},widget:{default:()=>({complexCardStyle:!1})}},setup(N){const F=N,D=X(),j=Y(),R=I(),B=Z(),{$gc:_}=ee(),{defaultProperty:C,property:f,propertyIds:k}=ae(B),{setProperty:G}=B,u=n(!0),E=n(1),v=n(),c=n([]),H=n(null),o=n([]),p=n(null),w=n(),V=n(!0),h=n(!1),g=n(10),J={label:"All",slug:""},m=re(()=>{var d;const a=((d=D.params)==null?void 0:d.slug)||"",l=D.hash.substring(1);if(typeof a=="string")return c.value.find(s=>s.slug.replace("/","")===a);if(a.length===1&&l)return c.value.find(s=>s.slug.replace("/","")===l.toLowerCase());if(a.length===2&&k.value.includes(a[1]))return{label:"All",slug:""};if(a.length===3&&k.value.includes(a[1]))return c.value.find(s=>s.slug.replace("/","")===a[2]);if(a.length===2&&k.value.includes(a[1])&&l)return c.value.find(s=>s.slug.replace("/","")===l.toLowerCase());if(a.length===1)return J;const t=c.value.find(s=>s.slug.replace("/","")===a[1]);return(t==null?void 0:t.childFriendly)!==void 0&&I().setChildFriendly(t==null?void 0:t.childFriendly),t}),K=async(a={page:{size:g.value,number:1},sort:"publishedDateTime:desc"})=>{var s,S,z;const l=((s=m.value)==null?void 0:s.label)==="All",t=f.value||C.value||void 0,d=t?`propertyID:${t}`:void 0;if(l){try{const r=await _().news.web().getLatest(d,a);o.value=a.page.number!==1?o.value.concat(r):r,w.value=!1}catch(r){console.error("Error fetching latest news",r),p.value=r,w.value=!1}u.value=!1}else try{const r=await _().news.web().getByCategory((S=m.value)==null?void 0:S.slug,a,d);o.value=a.page.number!==1?o.value.concat(r):r,w.value=!1}catch(r){console.error("Error fetching news for category:",(z=m.value)==null?void 0:z.slug,r),w.value=!1,p.value=r}finally{u.value=!1}};return le(async()=>{(()=>{const a=D.params.slug[1];k.value.includes(a)?G(a):G(f.value||C.value)})(),await(async()=>{try{const a=(await _().news.web().getCategories({pageSize:100,propertyID:f.value||C.value})).map(l=>({label:l.newsCategory,slug:l.newsCategoryID,childFriendly:l.childFriendly}));c.value=[J,...a]}catch(a){console.error("Error fetching news categories",a),H.value=a}})(),await(async()=>{var a;if(F.slots.adSlot)return h.value=!0,void(g.value=10);try{const l=await _().advertising.web().getAdvertisingSlots("news_page_slot");v.value=(a=l==null?void 0:l.attributes)==null?void 0:a.adverts,h.value=v.value.length>=1||R.useManagedAds,g.value=h.value?10:12}catch(l){console.error("Error fetching news_page_slot ads",l),h.value=!1,g.value=12}})(),await K()}),(a,l)=>{const t=te,d=ne,s=oe,S=ie,z=se,r=ue;return i(),b(r,null,{error:x(({error:L})=>[O("div",ce,[P(t,{tag:"h5"},{default:x(()=>[...l[2]||(l[2]=[T(" Sorry, something went wrong! Please try again later. ",-1)])]),_:1})])]),default:x(()=>{var L,M,U;return[O("div",ge,[e(H)?y("",!0):(i(),b(d,{key:0,"show-arrows":"dynamic",class:"px-4 group bg-surface-high text-clear row-contained","show-fade":!1,"active-tab":(L=e(m))==null?void 0:L.slug,items:e(c),onTabUpdated:l[0]||(l[0]=q=>{return $=q.slug,I(),void(f.value===C.value?j.push(`/news${$}`):j.push(`/news/${f.value}${$}`));var $})},null,8,["active-tab","items"])),(M=F.widget)!=null&&M.complexCardStyle?y("",!0):(i(),A(Q,{key:1},[e(u)||!e(p)&&e(o).length?(i(),b(s,{key:0,loading:e(u),list:e(o),"show-ads":e(h),"page-size":e(g),"has-adverts":e(v)&&e(v).length>=1,"ad-position":4},null,8,["loading","list","show-ads","page-size","has-adverts"])):y("",!0)],64)),(U=F.widget)!=null&&U.complexCardStyle?(i(),A(Q,{key:2},[e(m)&&e(u)||!e(p)&&e(o).length?(i(),b(S,{key:0,loading:e(u),"ad-slot":N.slots.adSlot,"news-list":e(o),"show-ads":e(h),"page-size":e(g),"page-number":e(E),"has-adverts":e(v)&&e(v).length>=1,"ad-position":4,category:e(m)},null,8,["loading","ad-slot","news-list","show-ads","page-size","page-number","has-adverts","category"])):y("",!0)],64)):!e(u)&&e(p)?(i(),A("div",de,[P(t,{tag:"h5"},{default:x(()=>[...l[3]||(l[3]=[T(" Sorry, something went wrong! Please try again later. ",-1)])]),_:1})])):e(u)||e(o).length?y("",!0):(i(),A("div",ve,[P(t,{tag:"h5"},{default:x(()=>[...l[4]||(l[4]=[T(" No news articles found for this category! ",-1)])]),_:1})])),e(o).length&&!e(p)&&e(V)?(i(),b(z,{key:5,class:"w-full mx-auto max-w-fit",content:"Load more news",icon:"article","icon-pack":"fan",loading:e(w),onClicked:l[1]||(l[1]=q=>(async()=>{w.value=!0,E.value+=1,await K({page:{size:g.value,number:E.value},sort:"publishedDateTime:desc"})})())},null,8,["loading"])):y("",!0)])]}),_:1})}}});
1export{Ae 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.