1import{A as e,E as t,I as n,T as r,j as i}from"./chunk-KS7C4IRE-DIkipulk.js";import{t as a}from"./jsx-runtime-CsaOnxTR.js";import{Fi as o,Ft as s,Ia as c,Ii as l,J as u,Ma as d,Zr as f,ja as p,ji as m,nt as h,sa as g}from"./Elements-C-xYWSPQ.js";import{n as _,t as v}from"./ssr-CJ2n4bG3.js";import{t as y}from"./PageLayout-CMR1o20j.js";import{n as b}from"./MetaTags-BxzFdyK8.js";import{t as x}from"./CardHelper-B-fpEyo8.js";import{n as S,t as C}from"./PaginationConstants-CNCeAp44.js";import{a as w,c as T,i as E,n as D,r as O,s as k,t as A}from"./usePagination-D0Cl4C4E.js";import{t as j}from"./StatusHandler-Bh1ghBjk.js";import{t as M}from"./adsHelper-DZxrkyG4.js";var N=n(i(),1),P=a(),F=new Set,I=C.LANGUAGE,L=e=>e.replace(/^\//,``).split(`/`)[0],R=e(function(){let{pathname:e}=t(),n=r(),i=n.type===v.CLIENT_ERROR||n.type===v.SERVER_ERROR,a=h(L(e)),_=(0,N.useRef)(!1),b=(0,N.useRef)(!1),C=(0,N.useRef)(null),R=i?[]:n.payload.cards,[z,B]=(0,N.useState)(R),{data:V,isLoading:H,getPaginatedData:U}=A({payload:a?.path??``,pageType:I,updatedDate:!i&&g(n.payload.cards)?n.payload.cards[0]?.articleCard?.publishedDate:``}),{cards:W,page:G,total:K}=V,q=S[I],J=a?.path??`language`;if((0,N.useMemo)(()=>{z.length<G*q&&g(W)&&(G>1&&b.current?(B([...R,...W]),b.current=!1):B([...z,...W]))},[G,W]),(0,N.useEffect)(()=>{if(i)return;let t=E(10);t?t>1&&(b.current=!0,U(t,void 0,2)):w()||D(e)},[i]),(0,N.useEffect)(()=>{i||_.current||!g(z)||E(10)&&(b.current||k(J)&&(_.current=!0))},[i,z,J]),(0,N.useEffect)(()=>{if(i)return;let e=C.current;if(!e)return;let t=e=>{let t=O(e);t&&T(t,J)};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}},[i,z,J]),n.type===v.CLIENT_ERROR||n.type===v.SERVER_ERROR)return(0,P.jsx)(j,{response:n});if(!a)return(0,P.jsx)(j,{response:{type:v.CLIENT_ERROR,statusCode:404,payload:`Language configuration not found`}});let Y=g(n.payload.advertisements)?n.payload.advertisements:[],X=g(Y)?Y[0]:void 0;F.has(a.path)||(M(Y),F.add(a.path));let{total:Z}=n.payload,Q=K||Z;return g(z)?(0,P.jsxs)(y,{lb1Ad:X,children:[(0,P.jsxs)(`div`,{className:c(a.listingTypographyClass),children:[(0,P.jsx)(`div`,{className:`border-b border-subtle`,children:(0,P.jsx)(`div`,{className:`container flex items-center h-56`,children:(0,P.jsx)(`h1`,{className:`font-secondary-title-lg-bold text-primary`,children:a.heroTitle})})}),(0,P.jsx)(`div`,{className:c(`container`),children:(0,P.jsxs)(`div`,{className:`flex flex-col desktop:flex-row desktop:grid`,children:[(0,P.jsxs)(`div`,{className:`w-full col-start-1 col-end-17`,children:[(0,P.jsx)(`div`,{ref:C,children:z.map((e,t)=>{let n=`${a.path}-latest-headline-card-${t}`;return(0,P.jsxs)(N.Fragment,{children:[(0,P.jsx)(`div`,{id:n,"data-card-element-id":n,children:x({type:e.cardType,args:{...e.articleCard,className:`py-24`}})}),t<z.length-1&&(0,P.jsx)(m,{className:`h-00 mx-00`})]},`${a.path}-listing-latest-headline-lg-${t}`)})}),(0,P.jsx)(`div`,{className:c(`w-full text-center py-32 mobile:pt-16 desktop:pt-32`,(G>=10||z.length>=Q||G===1&&z.length<q)&&`hidden`,`transition-all duration-100 ease-linear`),children:(0,P.jsx)(f,{fill:o.OUTLINE,handler:()=>{let t=G+1;if(t>10){D(e);return}U(t);let n=new URLSearchParams(window.location.search);n.set(`page`,t.toString()),window.history.replaceState(null,``,`${e}${n.toString()?`?${n.toString()}`:``}`),p(d.VIRTUAL_PV,{contenttype:u.LISTING,pagination:t.toString()})},size:l.DEFAULT,text:a.loadMoreText,isLoading:H,disabled:H||G>=10})})]}),(0,P.jsx)(`div`,{className:`w-full pt-16 desktop:pt-24 col-start-17 col-end-25`,children:g(Y)&&Y[1]&&(0,P.jsx)(s,{...Y[1],className:`listing-ads ${Y[1].type}-ad imu2-white-bg`,testId:`advertisement-block-test-id`})})]})})]}),(0,P.jsx)(`div`,{className:`pt-32`})]}):(0,P.jsx)(`div`,{})}),z=e=>{let t=e.loaderData;if(t.type===v.SUCCESS){let e=t.payload.metaData;return b(e)}};async function B(e){let t=await _(e);if(!t.context)return console.error(`Error fetching context for language landing, returning server Loader Data`),await e.serverLoader();let n=t.context;return`type`in n?n:(console.error(`Client Loader: fetchContext() returned an invali
1d payload for language landing`),await e.serverLoader())}export{B as clientLoader,R as default,z as meta};
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.