PageSourceSearch

https://www.straitstimes.com/assets/MySTPlus-ByL0fppF.js

js straitstimes.com collected 2026-09-24 07:43:59 UTC 23,598 bytes, 1 lines download raw bytes

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{b as o,l as s}from"./components-JSzoenoU.js";import{$r as c,Aa as l,Ba as u,Bi as d,Br as f,Dr as p,Dt as m,Fi as h,Ha as g,Ir as _,Jr as v,La as y,Lr as b,Mn as x,Mr as S,Nr as C,Or as ee,Pa as w,Pi as T,Pn as E,Pr as D,Qi as O,Qr as te,Rr as k,Rt as A,Sa as j,Sn as M,Tn as N,Ua as P,Va as F,Vi as ne,Wa as I,Z as L,an as R,da as z,ea as B,ei as V,ii as H,jn as re,jr as ie,ka as ae,kr as oe,ni as se,on as ce,qi as U,ra as le,ri as ue,ut as W,wn as G,yi as K,zi as q,zr as de,zt as fe}from"./Elements-BJgAzht_.js";import{n as pe,t as me}from"./ssr-CJ2n4bG3.js";import{i as he}from"./Header-7OxUsl6o.js";import{t as ge}from"./PageLayout-VSFjvclv.js";import{n as _e}from"./MetaTags-DxD1Vn5J.js";import{t as ve}from"./CardHelper-DdKjg6Aw.js";import{t as ye}from"./BlockHelper-CxA3Q3ex.js";import{t as be}from"./StatusHandler-BAQGTOm7.js";import{r as xe,t as Se}from"./adsHelper-D-PUDSBN.js";import{t as J}from"./MySTEmptyState-b5FtOa8S.js";var Y=function(e){return e.FOLLOWING=`Following`,e.RECOMMENDED=`Recommended`,e}({}),X=n(i(),1),Z=a();function Q({title:e,showContentBlockHeader:t,data:n,className:r,blockType:i,onAuthorClick:a,testId:o=`follow-author-test-id`}){let[s,c]=(0,X.useState)(1),[l,d]=(0,X.useState)(1),f=[];i===Y.FOLLOWING&&z(n)?t?f=C(n.filter(e=>e.followed),l,5):z(n)&&(f=ie(n)):i===Y.RECOMMENDED&&z(n)&&(t?f=C(n.filter(e=>!e.followed),s,5):z(n)&&(f=S(n)));let p=z(n)?n.filter(e=>e.followed).length:0,g=z(n)?n.filter(e=>!e.followed).length:0;return(0,Z.jsxs)(`div`,{className:u(`flex w-full p-00 flex-col items-start gap-16 desktop:pt-16`,r),"data-testid":o,children:[(0,Z.jsxs)(`div`,{className:`flex p-00 flex-col items-start gap-16 self-stretch`,children:[(0,Z.jsx)(`div`,{className:`flex p-00 flex-col items-start gap-16 self-stretch`,"data-testid":`with-content-block-header-test-id`,children:(0,Z.jsx)(E,{className:`w-full desktop:flex p-00`,testId:`content-block-header-strong`,title:e,icon:!1,divider:t,type:T.STRONG},`content-block-header`)}),(0,Z.jsx)(`div`,{className:`myst-author-button-group`,"data-testid":`follow-author-alldata-test-id`,children:f.length>0?f.map(e=>(0,Z.jsxs)(`div`,{className:`flex flex-col items-start self-stretch`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-12 self-stretch py-12 px-00`,children:(0,Z.jsxs)(Z.Fragment,{children:[e.photo&&(0,Z.jsx)(ue,{...we({author:e})}),(0,Z.jsx)(`div`,{className:`flex flex-col items-start gap-08 flex-grow flex-shrink flex-basis font-button-md-bold`,children:e.name}),(0,Z.jsx)(W,{...Ce({author:e,onAuthorClick:a,followed:!!e.followed})})]})}),(0,Z.jsx)(h,{className:`w-full h-01 mx-00 bg-border-default`,type:T.DEFAULT})]},e.id)):(0,Z.jsx)(U,{size:B.BASELINE,type:O.CAPTION,weight:le.THIRTY,testId:`empty-follow-author-test-id`,children:e===`Recommended`?b:_})})]}),i===Y.FOLLOWING&&t&&(0,Z.jsx)(m,{currentPage:l,totalItems:p,itemsPerPage:5,onPageChange:d,dataPerPage:z(f)?f.length:0}),i===Y.RECOMMENDED&&t&&(0,Z.jsx)(m,{currentPage:s,totalItems:g,itemsPerPage:5,onPageChange:c,dataPerPage:z(f)?f.length:0})]})}var Ce=({author:e,onAuthorClick:t,followed:n=!1})=>({className:n?`following`:`follow`,icon:{iconName:n?F.STATUS_SUCCESS_FILLED:F.ACTION_ADD,className:n?`status-success-icon`:``,iconWidth:g.SMALL},handler:()=>{e.id&&t(e.id)},variant:N.TOPICS,text:n?`Following`:`Follow`,action:n?G.ICON_LEFT:G.ICON_RIGHT,testId:`follow-author-${e.id}-test-id`,textClassName:n?`toggle-text-right`:`toggle-text-left`}),we=({author:e})=>({size:H.DEFAULT,src:e.photo,alt:e.name});function $({className:e,title:t,showContentBlockHeader:n,data:r,testId:i=`follow-topic-test-id`,blockType:a,onFollowClick:o}){let[s,c]=(0,X.useState)(1),[l,d]=(0,X.useState)(1),f=(e,t)=>{let n=(t-1)*10;return e.slice(n,n+10)},p=[];a===Y.FOLLOWING&&z(r)?p=n?f(r.filter(e=>e.followed),s):r.filter(e=>e.followed):a===Y.RECOMMENDED&&z(r)&&(n?p=f(r.filter(e=>!e.followed),l):z(r)&&(p=r.filter(e=>!e.followed)));let h=({topic:e,onFollowClick:t,followed:n=!1})=>({className:n?`following`:`follow`,icon:{iconName:n?F.STATUS_SUCCESS_FILLED:F.ACTION_ADD,className:n?`status-success-icon`:``,iconWidth:g.SMALL},handler:()=>{e.id&&t(e.id)},variant:N.TOPICS,text:e.name,action:n?G.ICON_LEFT:G.ICON_RIGHT,testId:`follow-topic-${e.id}-test-id`,textClassName:n?`toggle-text-right truncate max-w-[13ch]`:`toggle-text-left truncate max-w-[13ch]`}),_=z(r)?r.filter(e=>e.followed).length:0,v=z(r)?r.filter(e=>!e.followed).length:0;return(0,Z.jsxs)(`div`,{className:u(`flex w-full p-00 flex-col items-start gap-16 desktop:pt-16`,e),children:[(0,Z.jsx)(`div`,{className:`flex p-00 flex-col items-start gap-08 self-stretch`,"data-testid":`follow-topic-with-contentblockheader-test-id`,children:(0,Z.jsx)(E,{className:`w-full desktop:flex p-00`,testId:`content-block-header-strong`,title:t,icon:!1,divider:n,type:T.STRONG})}),(0,Z.jsx)(`div`,{className:`myst-button-group`,children:p.length>0?p.map((e,t)=>(0,Z.jsx)(`div`,{className:``,"data-testid":i,children:e.followed?(0,Z.jsx)(W,{...h({topic:e,onFollowClick:o,followed:!0})}):(0,Z.jsx)(W,{...h({topic:e,onFollowClick:o,followed:!1})})},t)):(0,Z.jsx)(U,{size:B.BASELINE,type:O.CAPTION,weight:le.THIRTY,testId:`empty-follow-topic-test-id`,children:t===`Recommended`?de:k})}),a===Y.FOLLOWING&&n&&(0,Z.jsx)(m,{currentPage:s,totalItems:_,itemsPerPage:10,onPageChange:c,dataPerPage:z(p)?p.length:0}),a===Y.RECOMMENDED&&n&&(0,Z.jsx)(m,{currentPage:l,totalItems:v,itemsPerPage:10,onPageChange:d,dataPerPage:z(p)?p.length:0})]})}var Te=()=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex w-full desktop:gap-32 tablet:gap-24 gap-00 items-start self-stretch flex-col-reverse tablet:flex-row card pt-08 tablet:pt-16`,children:[(0,Z.jsx)(`div`,{className:`flex flex-col items-start gap-16 p-16 self-stretch flex-1-0-0 tablet:p-00 tablet:basis-1/2 w-full tablet:w-6/12 mobile:px-00`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-08 self-stretch`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-00 desktop:gap-04 w-[15ch] h-14 background-shimmer`}),(0,Z.jsx)(`div`,{className:`h-20 self-stretch background-shimmer`}),(0,Z.jsx)(`div`,{className:`h-20 py-6 w-[20ch] self-stretch background-shimmer`})]})}),(0,Z.jsx)(`div`,{className:`tablet:basis-1/2 px-16 mobile:px-00 mobile:w-full pt-08 pb-00 tablet:p-00 tablet:w-6/12 w-screen tablet:max-w-50vw`,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(`div`,{className:`flex items-center justify-center bg-gray-200 font-bold leading-none background-shimmer desktop:h-331 mobile:h-232`,children:(0,Z.jsx)(se,{iconName:F.ST_INITIAL_LOGO_WHITE,iconWidth:`145px`,iconHeight:`133px`,className:`flex-shrink-0`})})})})]}),(0,Z.jsx)(`div`,{className:`pb-08`,children:(0,Z.jsx)(h,{className:`shimmer-divider`,type:T.DEFAULT})})]}),Ee=()=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex self-stretch mobile:gap-16 mobile:pt-24 tablet:gap-24 desktop:gap-32 desktop:py-24 w-full`,"data-testid":`headline-lg-card-test-id`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col flex-grow basis-1/2 items-start gap-08`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-00 desktop:gap-04 text-secondary`,"data-testid":`default-kicker-test-id`,children:(0,Z.jsx)(`div`,{className:`w-46 h-14 background-shimmer`})}),(0,Z.jsx)(`div`,{className:`h-14 self-stretch background-shimmer`}),(0,Z.jsx)(`div`,{className:`h-14 w-80 self-stretch background-shimmer`})]}),(0,Z.jsxs)(`div`,{className:`headline-lg-img-wrapper tablet:flex-grow 
1shrink-1 tablet:basis-1/4 desktop:basis-1/3`,children:[(0,Z.jsx)(`div`,{className:` items-center justify-center bg-gray-200 font-bold leading-none aspect-landscape background-shimmer flex-col relative tablet:flex headline-lg-img w-full mobile:hidden desktop:h-253`,children:(0,Z.jsx)(se,{iconName:F.ST_INITIAL_LOGO_WHITE,iconWidth:`145px`,iconHeight:`133px`,className:`flex-shrink-0`})}),(0,Z.jsx)(`div`,{className:`flex items-center justify-center bg-gray-200 font-bold leading-none tablet:hidden aspect-square mobile:h-100`,children:(0,Z.jsx)(se,{iconName:F.ST_INITIAL_LOGO_WHITE,iconWidth:`40px`,iconHeight:`33px`,className:`flex-shrink-0`})})]})]}),(0,Z.jsx)(h,{className:`w-full h-24 desktop:h-00 ml-00 mr-08`,type:T.DEFAULT})]});function De({count:e=1,cardType:t,testId:n=`shimmer-unit-test`}){return(0,Z.jsx)(Z.Fragment,{children:Array.from({length:e}).map((e,r)=>(0,Z.jsx)(`div`,{"data-testid":n,children:Oe(t)},r))})}var Oe=e=>{switch(e){case K.FEATURED_BLEED_LG:return(0,Z.jsx)(Te,{});case K.FEATURED_HEADLINE_LG:return(0,Z.jsx)(Ee,{});default:return null}},ke=({followedData:e,mySTpageType:t})=>{let[n,r]=(0,X.useState)({mystCards:[],total:0,page:1}),[i,a]=(0,X.useState)(!1);return{caasData:n,isLoading:i,getFollowingPaginatedData:(0,X.useCallback)(async n=>{a(!0);let i=ie(e).map(e=>e.name&&e.name.toString().toLowerCase().replace(/\s+/g,`-`));if(z(i)&&n>0)try{await D(`mySTArticleListing`,`POST`,{pageType:t,searchParam:i,page:n,followedData:e},!1).then(e=>{r({mystCards:e.cards,page:n,total:e.total}),a(!1)})}catch(e){a(!1),I(P.ERROR,`BAAS:: MyST Pagination API getting failed`,{err:e})}else a(!1)},[e,t])}};function Ae({followingAuthorCaasData:e,authorBaasData:t,isAuthorLoading:n,handleAuthorFollowToggle:r,testId:i=`following-author-modules-test-id`}){let a=(t&&t.filter(e=>e.followed===!0).length)??0,[o,s]=(0,X.useState)(e??[]);(0,X.useMemo)(()=>{!n&&z(e)?s(e):(a===0||e&&e.length===0)&&s([])},[a,e,n]);let{caasData:c,isLoading:l,getFollowingPaginatedData:f}=ke({followedData:t,mySTpageType:`author`}),{mystCards:p,page:m}=c;(0,X.useMemo)(()=>{z(o)&&o.length<m*10&&z(p)&&s([...o,...p])},[m,p]);let g=fe+ce.IMU2;return(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(`div`,{className:`top-story-block`,"data-testid":i,children:[(0,Z.jsxs)(`div`,{className:`left-col  w-full breakpoint:max-w-3/4`,children:[o.length===0&&a===0&&!n&&(0,Z.jsx)(J,{heading:`Authors followed`,content:`You are not following any author.`}),o.length===0&&a>0&&(0,Z.jsx)(J,{heading:`No results found`,content:`Please try with another keyword or filter`,hideExplore:!0}),n&&(0,Z.jsx)(De,{count:3,cardType:K.FEATURED_BLEED_LG}),z(o)&&o.map((e,t)=>(0,Z.jsxs)(Z.Fragment,{children:[t!==0&&(0,Z.jsx)(`div`,{className:`pb-08`,children:(0,Z.jsx)(h,{className:`tablet:flex w-full tablet:h-01 mobile:h-00 tablet:justify-center tablet:items-center tablet:self-stretch mobile:mx-00`,type:T.DEFAULT})}),ve({type:K.FEATURED_BLEED_LG,args:{...e,className:`myst-main-column-bleed-lg-card-with-padding`}})]},t)),o.length>0&&!n&&(0,Z.jsx)(`div`,{className:u(`w-full text-center py-32 mobile:pt-16 desktop:pt-32`,(o.length>=c.total&&m!==1||m===1&&o.length<10)&&`hidden`,`transition-all duration-100 ease-linear`),children:(0,Z.jsx)(V,{fill:q.OUTLINE,handler:()=>{f(m+1)},size:d.DEFAULT,text:`Load more`,isLoading:l,disabled:l})}),(0,Z.jsx)(`div`,{className:`flex py-24 px-0 flex-col items-center self-stretch desktop:hidden`,children:(0,Z.jsx)(`div`,{className:`flex p-16 flex-col items-center gap-10 self-stretch`,children:(0,Z.jsx)(A,{id:g,testId:g,className:`listing-ads`})})})]}),(0,Z.jsx)(h,{vertical:!0,className:`mx-00 w-01 h-unset flex flex-wrap self-stretch`}),(0,Z.jsx)(`div`,{className:`right-col w-full pb-24 mobile:hidden desktop:block self-stretch`,children:(0,Z.jsxs)(`div`,{"data-testid":`following-author-block-test-id`,className:`following-recommended-block`,children:[(0,Z.jsx)(Q,{title:`Following`,showContentBlockHeader:!0,data:t,blockType:Y.FOLLOWING,onAuthorClick:r}),(0,Z.jsx)(Q,{title:`Recommended`,showContentBlockHeader:!0,data:t,blockType:Y.RECOMMENDED,onAuthorClick:r}),(0,Z.jsx)(A,{id:g,testId:g,className:`listing-ads imu2-white-bg`})]})})]})})}
1function je({followingTopicCaasData:e,topicBaasData:t,isFollowingLoading:n,onFollowClick:r,testId:i=`following-topics-modules-test-id`}){let[a,o]=(0,X.useState)(e??[]),s=(t&&t.filter(e=>e.followed===!0).length)??0;(0,X.useMemo)(()=>{!n&&z(e)?o(e):(s===0||e&&e.length===0)&&o([])},[n,e,s]);let{caasData:c,isLoading:l,getFollowingPaginatedData:f}=ke({followedData:t,mySTpageType:`topic`}),{mystCards:p,page:m}=c,g=fe+ce.IMU2;return(0,X.useMemo)(()=>{z(a)&&a.length<m*10&&z(p)&&o([...a,...p])},[m,p]),(0,Z.jsxs)(`div`,{className:`top-story-block`,"data-testid":i,children:[(0,Z.jsxs)(`div`,{className:`left-col w-full breakpoint:max-w-3/4`,children:[a.length===0&&s===0&&!n&&(0,Z.jsx)(J,{heading:`Topics followed`,content:`You are not following any topic.`}),a.length===0&&s>0&&(0,Z.jsx)(J,{heading:`No results found`,content:`Please try with another keyword or filter`,hideExplore:!0}),n&&(0,Z.jsx)(De,{count:3,cardType:K.FEATURED_BLEED_LG}),z(a)&&a.map((e,t)=>(0,Z.jsxs)(Z.Fragment,{children:[t!==0&&(0,Z.jsx)(`div`,{className:`pb-08`,children:(0,Z.jsx)(h,{className:`tablet:flex w-full tablet:h-01 mobile:h-00 tablet:justify-center tablet:items-center tablet:self-stretch mobile:mx-00`,type:T.DEFAULT})}),ve({type:K.FEATURED_BLEED_LG,args:{...e,className:`myst-main-column-bleed-lg-card-with-padding`}})]},t)),a.length>0&&!n&&(0,Z.jsx)(`div`,{className:u(`w-full text-center py-32 mobile:pt-16 desktop:pt-32`,(a.length>=c.total&&m!==1||m===1&&a.length<10)&&`hidden`,`transition-all duration-100 ease-linear`),children:(0,Z.jsx)(V,{fill:q.OUTLINE,handler:()=>{f(m+1)},size:d.DEFAULT,text:`Load more`,isLoading:l,disabled:l})}),(0,Z.jsx)(`div`,{className:`flex py-24 px-0 flex-col items-center self-stretch desktop:hidden`,children:(0,Z.jsx)(`div`,{className:`flex p-16 flex-col items-center gap-10 self-stretch`,children:(0,Z.jsx)(A,{id:g,testId:g,className:`listing-ads`})})})]}),(0,Z.jsx)(h,{vertical:!0,className:`mx-00 w-01 h-unset flex flex-wrap self-stretch`}),(0,Z.jsx)(`div`,{className:`right-col w-full pb-24 mobile:hidden desktop:block self-stretch`,children:(0,Z.jsxs)(`div`,{"data-testid":`following-topic-block-test-id`,className:`following-recommended-block`,children:[(0,Z.jsx)($,{title:`Following`,showContentBlockHeader:!0,data:t,blockType:Y.FOLLOWING,onFollowClick:r}),(0,Z.jsx)($,{title:`Recommended`,showContentBlockHeader:!0,data:t,blockType:Y.RECOMMENDED,onFollowClick:r}),(0,Z.jsx)(A,{id:g,testId:g,className:`listing-ads imu2-white-bg`})]})})]})}function Me(){let{isUserLoading:e,userInfo:t}=l(e=>e),[n,r]=(0,X.useState)([]),[i,a]=(0,X.useState)([]),[o,s]=(0,X.useState)(v),[c,m]=(0,X.useState)([]),[h,g]=(0,X.useState)([]),[_,b]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!1),[T,E]=(0,X.useState)(!1),[O,te]=(0,X.useState)(!0),[k,A]=(0,X.useState)(!0),j=t?.usertype,M=t?.mysphw;(0,X.useEffect)(()=>{(async()=>{if(!e&&M){if(o===`Topics`)try{await D(`getTopicData`,`GET`,{},!1,{visitorID:M}).then(e=>{r(e.baasResponse),m(e.caasResponse),te(!1)})}catch(e){te(!1),I(P.ERROR,`BAAS:: Topic API request failed`,{err:e})}else if(o===`Authors`)try{await D(`getAuthorData`,`GET`,{},!1).then(e=>{a(e.baasResponse),g(e.caasResponse),A(!1)})}catch(e){A(!1),I(P.ERROR,`BAAS:: Author API request failed`,{err:e})}}})().then(()=>{})},[o,e,M]);let L=e=>{w(e===`Topics`?{eventCategory:y.MYST,eventAction:`Click`,eventLabel:`topics`}:{eventCategory:y.MYST,eventAction:`Click`,eventLabel:`authors`}),s(e)},R=e=>{oe(e,n,r,b,m,C,E,j,M)},B=e=>{ee(e,i,a,b,g,C,E,j,M)},{limitTitle:H,limitContent:ie}=p(o,T);return(0,Z.jsxs)(`div`,{className:`container`,children:[(0,Z.jsx)(`div`,{className:`myst-following-main-toggle`,children:(0,Z.jsxs)(`div`,{className:`myst-following-toggle`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-16`,"data-testid":`following-toggle-test-id`,children:z(f)&&f.map((e,t)=>(0,Z.jsx)(W,{action:G.TEXT_ONLY,text:e,variant:N.NAVIGATION,className:e===o?`button-primary active`:`layer-two`,textClassName:u(`flex pr-00 justify-center items-center gap-10`,e===o?`text-on-primary`:``),handler:()=>{L(e)}},`toggle-key-${t}`))}),(0,Z.jsx)(V,{fill:q.NONE,icon:{iconName:F.ACTION_EDIT,className:`mobile:size-24 tablet:size-32`},handler:()=>{w({eventCategory:y.MYST,eventAction:`Click`,eventLabel:`following::edit`}),document.body.style.setProperty(`overflow`,`hidden`,`important`),b(!0)},type:ne.ICON_ONLY,size:d.DEFAULT,className:`tablet:right-24 tablet:absolute p-00 desktop:hidden`,testId:`following-edit-button-test-id`})]})}),S&&(0,Z.jsx)(re,{mySTSubscriber:T,modalTitle:H,modalContent:ie,onModalClose:()=>{C(!1)}}),_&&(0,Z.jsx)(`div`,{className:`following-modal`,children:(0,Z.jsx)(x,{title:o==`Topics`?`Manage topics`:`Manage authors`,titleClassName:`tablet-header-XS-bold`,successButton:`asd`,cancelButton:`sd`,onClose:()=>{document.body.style.setProperty(`overflow`,``,`important`),b(!1)},children:(0,Z.jsx)(`div`,{className:`flex items-start gap-12 `,children:(0,Z.jsx)(`div`,{className:`flex mobile:w-full tablet:w-548 flex-col items-start gap-32 self-stretch `,children:o==`Topics`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{title:`Following`,showContentBlockHeader:!1,data:n,onFollowClick:R,className:`tablet:w-524`,blockType:Y.FOLLOWING}),(0,Z.jsx)($,{title:`Recommended`,showContentBlockHeader:!1,data:n,onFollowClick:R,blockType:Y.RECOMMENDED,className:`tablet:w-524`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{title:`Following`,showContentBlockHeader:!1,data:i,onAuthorClick:B,className:`tablet:w-524`,blockType:Y.FOLLOWING}),(0,Z.jsx)(Q,{title:`Recommended`,showContentBlockHeader:!1,data:i,onAuthorClick:B,className:`tablet:w-524`,blockType:Y.RECOMMENDED})]})})})})}),(0,Z.jsxs)(`div`,{"data-testid":`following-menu-topic-block-test-id`,children:[o&&o===`Topics`&&(0,Z.jsx)(je,{followingTopicCaasData:c,topicBaasData:n,isFollowingLoading:O,onFollowClick:R}),o&&o===`Authors`&&(0,Z.jsx)(Ae,{followingAuthorCaasData:h,authorBaasData:i,isAuthorLoading:k,handleAuthorFollowToggle:B})]})]})}function Ne(){if(!(typeof performance>`u`))return performance.getEntriesByType(`navigation`)[0]?.type}var Pe=!1;function Fe(){let e=r();if(e.type===me.CLIENT_ERROR||e.type===me.SERVER_ERROR)return(0,Z.jsx)(be,{response:e});let{results:t}=e.payload,n=z(e.payload.advertisements)?e.payload.advertisements:[],i=z(n)?n[0]:void 0;return Pe||=(Se(n),!0),(0,Z.jsx)(ge,{lb1Ad:i,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(M,{...o.mystplus}),z(t)&&t.map((e,t)=>(0,Z.jsx)(X.Fragment,{children:ye({...e})},t))]})})}var Ie=({visitorID:e})=>{let[t,n]=(0,X.useState)({caasCards:[],nextPage:1}),[r,i]=(0,X.useState)(!1),a=(0,X.useCallback)(o=>{if(i(!0),e===``)return{data:t,isLoading:r,getSavedPaginatedData:a};o>0?(async()=>{try{let e=await D(`getSavedArticles?page=${o}`,`GET`,{},!1);n({caasCards:e.bookmarks??[],nextPage:e.pagination?.next??1}),i(!1)}catch{i(!1)}})():i(!1)},[e]);return{SavedCaasData:t,isLoading:r,getSavedPaginatedData:a}};function Le({testId:e=`saved-page-test-id`}){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(!1),f=(0,X.useRef)(0),p=(0,X.useRef)(0),{isUserLoading:m,userInfo:g}=l(e=>e),_=g?.mysphw,[v,b]=(0,X.useState)(!0),[x,S]=(0,X.useState)(),{SavedCaasData:C,isLoading:ee,getSavedPaginatedData:E}=Ie({visitorID:_}),{caasCards:k,nextPage:j}=C;(0,X.useEffect)(()=>{w({eventCategory:y.MYST,eventAction:`Click`,eventLabel:`saved`});let e=()=>{let e=document.body.scrollTop||document.documentElement.scrollTop;e===0?o(!1):e>190&&!a?o(!0):a&&e<100&&o(!1)};return s&&window.addEventListener(`scroll`,e,{passive:!0}),()=>{s&&window.removeEventListener(`scroll`,e)}},[]),(0,X.useEffect)(()=>{!m&&_&&M()},[m,_]),(0,X.useMemo)(()=>{z(k)&&(S(e=>[...e??[],...k]),p.current=j)},[k,j]);let M=async()=>{try{await D(`getSavedArticles?page=1`,`GET`,{},!1,{visitorID:_}).then(e=>{S(e.bookmarks),b(!1),f.current=e.totalBookmarks,p.current=e.pagination?.next??0})}catch(e){I(P.ERROR,`BAAS:: Get Bookmarks article API request failed`,{err:e})}};
1async function N(e,t){if((await D(`deleteBookmarks`,`POST`,{},!1,{cueId:e,visitorId:t})).code===200&&x){let r=x.filter(t=>t.cueId!==e);S(r),i(!0),he(`delete`,e,t),n(!1),f.current!==void 0&&--f.current}}let L=()=>{w({eventCategory:y.MYST,eventAction:`Click`,eventLabel:`saved::edit`}),n(!t)},R=fe+ce.IMU2,H=0;return v||(H=x?.length??0),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:u(`main-toast-modal`,a?`top-90`:``),children:r&&(0,Z.jsx)(te,{type:c.SUCCESS,duration:3e3,message:`Removed successfully`,className:`toast-modal`,handler:()=>{i(!1)}})}),(0,Z.jsx)(`div`,{className:`container`,"data-testid":e,children:(0,Z.jsxs)(`div`,{className:`desktop:pt-32 flex-col items-center`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-16 gap-4 mobile:py-16 tablet:py-24 desktop:py-16`,children:[(0,Z.jsx)(`div`,{className:`col-start-1 col-end-5 flex items-center tablet:pl-00`,children:H>0&&(0,Z.jsxs)(U,{size:B.LG,type:O.KICKER,weight:le.FORTY,children:[f.current+` `,` of`,` `,60,` saved`]})}),(0,Z.jsx)(`div`,{className:`col-start-16 col-end-17 flex justify-end items-center tablet:pr-00`,children:H>0&&(0,Z.jsx)(V,{fill:q.NONE,icon:{iconName:F.ACTION_EDIT,className:`mobile:size-24 tablet:size-32`},handler:()=>{L()},type:ne.ICON_ONLY,size:d.DEFAULT,className:`p-00`})})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col desktop:flex-row grid`,children:[(0,Z.jsxs)(`div`,{className:`w-full col-start-1 col-end-17`,children:[v&&(0,Z.jsx)(De,{count:5,cardType:K.FEATURED_HEADLINE_LG}),H===0&&!v&&(0,Z.jsx)(J,{heading:`Saved`,content:`You haven't saved any article.`}),z(x)&&H>0&&x.map((e,n)=>(0,Z.jsx)(X.Fragment,{children:(0,Z.jsxs)(`div`,{"data-id":`${e.cueId}`,children:[n!==0&&(0,Z.jsx)(h,{className:`mobile:mx-16 tablet:mx-00  h-00`,type:T.DEFAULT}),(0,Z.jsxs)(`div`,{className:`main-saved-card`,children:[t&&(0,Z.jsx)(`div`,{className:`main-saved-edit-close-content-main`,children:(0,Z.jsx)(V,{fill:q.NONE,icon:{iconName:F.STATUS_ERROR_FILLED,className:`mobile:size-16 tablet:size-24 desktop:size-32`},handler:()=>{e.cueId&&N(e.cueId,_)},type:ne.ICON_ONLY,size:d.DEFAULT,className:`p-00`})}),ve({type:K.FEATURED_HEADLINE_LG,args:{...e.articleCard,refCode:`myst-saved`}})]})]},`${n}`)},n)),p.current>0&&(0,Z.jsx)(`div`,{className:`w-full text-center py-32 mobile:pt-16 desktop:pt-32`,children:(0,Z.jsx)(V,{fill:q.OUTLINE,handler:()=>{E(p.current)},size:d.DEFAULT,text:`Load more`,isLoading:ee,disabled:ee})})]}),(0,Z.jsx)(`div`,{className:`pt-24 hidden desktop:flex col-start-17 col-end-25`,children:(0,Z.jsx)(A,{id:R,testId:R,className:`listing-ads imu2-white-bg`})})]})]})})]})}var Re=!1;L.LISTING;function ze(){let e=xe(R.LISTING,`saved`),t=z(e)?e[0]:void 0;return Re||=(Se(e),!0),(0,Z.jsxs)(ge,{lb1Ad:t,children:[(0,Z.jsx)(M,{...o.mystplus}),(0,Z.jsx)(Le,{})]})}var Be=!1;L.LISTING;function Ve(){let e=xe(R.LISTING,`myst`),t=z(e)?e[0]:void 0;return Be||=(Se(e),!0),(0,Z.jsxs)(ge,{lb1Ad:t,children:[(0,Z.jsx)(M,{...o.mystplus}),(0,Z.jsx)(Me,{})]})}var He=e(function(){let{pathname:e}=t(),n=`myst`;return e.includes(`saved`)?n=`saved`:e.includes(`explore`)&&(n=`explore`),(0,X.useEffect)(()=>{if(s){let e=j.get(`mySPHUserType`),t=j.get(`onboarding_visited`)||`0`,r=j.get(`visitorcat`)||`0`;(e===ae.ANONYMOUS||e===``||!e||r===`4`||t===`0`)&&window.location.assign(`/myst/onboarding?from=`+n),Ne()===`back_forward`&&(n===`myst`||n===`saved`)&&window.location.reload()}},[n]),e.includes(`saved`)?(0,Z.jsx)(ze,{}):e.includes(`explore`)?(0,Z.jsx)(Fe,{}):(0,Z.jsx)(Ve,{})}),Ue=e=>{let t=e.loaderData;if(t.type===me.SUCCESS){let e=t.payload.metaData;return _e(e)}};async function We(e){let t=await pe(e);if(!t.context)return console.error(`Error occured during client-side routing for MyST, 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 MyST`),n}export{We as clientLoader,He as default,Ue 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.