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 ee,Ft as o,Ia as s,Ii as c,J as l,Ma as u,Zr as d,bn as f,ja as p,ji as m,sa as h,wa as g,wn as _}from"./Elements-C-xYWSPQ.js";import{n as v,t as y}from"./ssr-CJ2n4bG3.js";import{t as b}from"./PageLayout-CMR1o20j.js";import{n as x}from"./MetaTags-BxzFdyK8.js";import{t as te}from"./CardHelper-B-fpEyo8.js";import{n as ne,t as S}from"./PaginationConstants-CNCeAp44.js";import{a as C,c as w,i as T,n as E,r as re,s as D,t as O}from"./usePagination-D0Cl4C4E.js";import{t as k}from"./StatusHandler-Bh1ghBjk.js";import{i as A,t as j}from"./adsHelper-DZxrkyG4.js";var M=n(i(),1),N=a(),P=!1,F=e=>{let t=e.loaderData;if(t.type===y.SUCCESS){let e=t.payload.metaData;return x(e)}},I=e(function(){let{pathname:e}=t(),n=r(),i=n.type===y.CLIENT_ERROR||n.type===y.SERVER_ERROR,a=(0,M.useRef)(!1),v=(0,M.useRef)(!1),x=(0,M.useRef)(null),F=i?[]:n.payload.cards,I=i?``:n.payload.uniqueName,[L,R]=(0,M.useState)(F),z=!i&&_(),B=!i&&z&&!z.isUserLoading,V=B?n.payload.tagId:``,H=B?z.visitorId:``,U=B&&typeof z.userInfo!=`string`?z.userInfo:``,{data:W,isLoading:G,getPaginatedData:K}=O({payload:I,pageType:S.TAGS,updatedDate:!i&&h(n.payload.cards)?n.payload.cards[0]?.articleCard?.publishedDate:``}),{cards:q,page:J,total:Y}=W,X=ne[S.TAGS];if((0,M.useMemo)(()=>{L.length<J*X&&h(q)&&(J>1&&v.current?(R([...F,...q]),v.current=!1):R([...L,...q]))},[J,q]),(0,M.useEffect)(()=>{if(i)return;let t=T(10);t?t>1&&(v.current=!0,K(t,void 0,2)):C()||E(e)},[i]),(0,M.useEffect)(()=>{i||a.current||!h(L)||T(10)&&(v.current||D(I)&&(a.current=!0))},[i,L,I]),(0,M.useEffect)(()=>{if(i)return;let e=x.current;if(!e)return;let t=e=>{let t=re(e);t&&w(t,I)};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}},[i,L,I]),n.type===y.CLIENT_ERROR||n.type===y.SERVER_ERROR)return(0,N.jsx)(k,{response:n});let{displayName:Z,total:ie,gaData:Q}=n.payload,ae=Y||ie,$=h(n.payload.advertisements)?n.payload.advertisements:[],oe=h($)?$[0]:void 0;return P||=(j($),!0),A(Z),h(L)?(0,N.jsxs)(b,{lb1Ad:oe,gaData:Q,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(f,{title:Z,url:e,visitorId:H,tagId:V,userInfo:U}),(0,N.jsx)(`div`,{className:s(`container`),children:(0,N.jsxs)(`div`,{className:`flex flex-col desktop:flex-row desktop:grid`,children:[(0,N.jsxs)(`div`,{className:`w-full col-start-1 col-end-17`,children:[(0,N.jsx)(`div`,{ref:x,children:L.map((e,t)=>{let n=`tags-latest-headline-card-${t}`;return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(`div`,{id:n,"data-card-element-id":n,children:te({type:e.cardType,args:{...e.articleCard,className:`py-24`}})}),t<L.length-1&&(0,N.jsx)(m,{className:`h-00 mx-00`})]},`tags-listing-latest-headline-headline-lg-${t}`)})}),(0,N.jsx)(`div`,{className:s(`w-full text-center py-32 mobile:pt-16 desktop:pt-32`,(J>=10||L.length>=ae||J===1&&L.length<X)&&`hidden`,`transition-all duration-100 ease-linear`),children:(0,N.jsx)(d,{fill:ee.OUTLINE,handler:()=>{let t=J+1;if(t>10){E(e);return}K(t);let n=new URLSearchParams(window.location.search);n.set(`page`,t.toString()),window.history.replaceState(null,``,`${e}${n.toString()?`?${n.toString()}`:``}`),Q&&p(u.VIRTUAL_PV,{contentcat:g.FREE,contenttype:l.LISTING,pagination:t.toString()})},size:c.DEFAULT,text:`Load more`,isLoading:G,disabled:G||J>=10})})]}),(0,N.jsx)(`div`,{className:`w-full pt-16 desktop:pt-24 col-start-17 col-end-25`,children:h($)&&$[1]&&(0,N.jsx)(o,{...$[1],className:`listing-ads ${$[1].type}-ad imu2-white-bg`,testId:`advertisement-block-test-id`})})]})})]}),(0,N.jsx)(`div`,{className:`pt-32`})]}):(0,N.jsx)(`div`,{})});async function L(e){let t=await v(e);if(!t.context)return console.error(`Error occured during client-side routing for tags listing, returning server Loader Data`),await e.serverLoader();let n=t.context;return(!n||typeof n!=`object`||!(`payload`in n)||typeof n.payload!=`object`)&&console.error(`Client Loader: fetchContext() returned an invalid payload for tags listing`),n}export{L as clientLoader,I as default,F 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.