"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["5676"],{64343:function(e,i,t){t.d(i,{Z:()=>d});var l=t(7409),a=t(99282),n=t(16584),r=t(64515);let d=e=>(0,n.tZ)(r.l,(0,a._)((0,l._)({},e),{name:"RightArrowIcon",svgParams:{height:20,width:20},children:(0,n.tZ)("path",{d:"M7.5 15L12.5 10L7.5 5",strokeWidth:"1.5",strokeLinecap:"round","stroke-linejoin":"round"})}))},94827:function(e,i,t){if(t.d(i,{Bk:()=>B,Rj:()=>_,xI:()=>S}),3270==t.j)var l=t(7409);if(3270==t.j)var a=t(98848);var n=t(16584),r=t(6400),d=t(30396),o=t(94184),s=t.n(o),c=t(32224),u=t(1852),p=t(16104),g=t(35047),h=t(94499),m=t(32582),v=t(95441),y=t(62514),Z=t(68833),k=t(98914),b=t(15771),f=t(38841);if(3270==t.j)var N=t(22419);var w=t(60308);if(3270==t.j)var C=t(47929);let x={desktop:15,mobile:6},_=e=>{let{className:i,hasFeatured:t,categories:l,categoryId:a,categoryIds:r,loadingCategoryId:o,ranking:p,onCategoryClicked:g,defaultExpanded:h}=e,[m,y]=(0,d.eJ)(h||!1),[Z,k]=(0,d.eJ)(new Set),f=x[(0,u.useMediaQuery)({query:"only screen and (max-width: 650px)"})?"mobile":"desktop"],{iString:N}=(0,v.M1)(),w=l?m?l:l.slice(0,f):[],C=e=>e.id===a||(null==r?void 0:r.includes(e.id)),_=e=>{k(i=>{let t=new Set(i);return t.has(e)?t.delete(e):t.add(e),t})};return(0,n.BX)("div",{className:s()("categories",i),children:[t&&(0,n.tZ)(b.zx,{priority:"featured"!==a||o&&"featured"!==o?"secondary":"primary-mono",loading:"featured"===o&&"featured"!==a,onClick:()=>{g({categoryId:"featured",ranking:"all",categories:l})},children:N("Featured")}),w.map(e=>{var i;let t=Z.has(e.id),r=e.subcategories&&e.subcategories.length>0,d=C(e)&&(!o||o===e.id),s=o===e.id&&a!==e.id;return(0,n.BX)(n.HY,{children:[(0,n.tZ)(b.zx,{priority:d?"primary-mono":"secondary-outline",loading:s,onClick:()=>{g({categoryId:e.id,ranking:p,categories:l}),r&&_(e.id)},className:d?"test-active":"test-inactive",children:N(e.name||"")}),t&&r&&(null==e?void 0:null===(i=e.subcategories)||void 0===i?void 0:i.map(e=>{let i=C(e)&&(!o||o===e.id),t=o===e.id&&a!==e.id;return(0,n.tZ)(b.zx,{priority:i?"primary-mono":"secondary",loading:t,onClick:()=>g({categoryId:e.id,ranking:p,categories:l}),children:N(e.name)},e.id)}))]})}),l&&l.length>f&&!m&&(0,n.tZ)(b.hU,{priority:"secondary-outline",onClick:()=>y(!0),children:(0,n.tZ)(c.Z,{size:20})})]})},B=e=>{let{publications:i,explanations:t,ranking:l,openInNew:a,startRankAt:r=0,source:d,onPublicationVisited:o=null,user:s,categoryId:c}=e,{language:u}=(0,v.M1)();return(0,n.tZ)(n.HY,{children:(0,n.tZ)("div",{className:"publications",children:i.map((e,i)=>{var p,h,m,v,y,k,b;let N;let x=t&&t[i];if(!e)return;x||(x=[]);let _=x.filter(e=>["posts.title","posts.subtitle"].includes(e.type)),B=!!(null===(v=_[0])||void 0===v?void 0:null===(m=v.posts)||void 0===m?void 0:null===(h=m[0])||void 0===h?void 0:null===(p=h[0])||void 0===p?void 0:p.slug);B&&(N=null===(b=_[0])||void 0===b?void 0:null===(k=b.posts)||void 0===k?void 0:null===(y=k[0])||void 0===y?void 0:y[0]);let X=x.filter(e=>"description"===e.type)[0],S=x.filter(e=>["name","subdomain","hero_text","custom_domain","author_name"].includes(e.type)).length>0||!X&&!N,j=x.filter(e=>"description"===e.type).map(e=>e.keyword),R=x.filter(e=>["posts.title","posts.subtitle"].includes(e.type)).map(e=>e.keyword),H=(0,w.TJI)(e,{params:{utm_source:d||C.b3.discover},signedIn:!!s});return(0,n.BX)("a",{className:"publication",href:H,native:!0,target:a?"_blank":void 0,onClick:()=>{(0,Z.x6)(e,d||"leaderboards",{position:i+1,category:c}),o&&o(e)},rel:"noopener",children:["paid"===l?(0,n.tZ)("div",{className:"publication-rank",children:i+1+r}):null,(0,n.BX)("div",{className:"publication-content",children:[(0,n.tZ)(f.wk,{pub:e,belowTheFold:!0}),(0,n.BX)("div",{className:"publication-text-area",children:[(0,n.tZ)("div",{className:"publication-title",children:e.name}),(S||N)&&(0,n.tZ)("div",{className:"publication-description",children:e.editorial_bio||I(e.hero_text,j)}),!S&&X&&!N&&(0,n.tZ)("div",{className:"publication-description",children:I(X.sentence,j)}),!S&&N&&(0,n.tZ)("div",{className:"publication-explanation-box",children:B&&(0,n.tZ)("a",{className:"title",href:(0,w.uRy)(e,N),children:(0,n.BX)("div",{className:"post-preview-content",children:[(0,n.BX)("div",{className:"left-flex",children:[(0,n.tZ)("p",{className:"title",children:I(N.title,R)}),(0,n.tZ)("p",{className:"subtitle",children:I(N.subtitle,R)})]}),(0,n.tZ)("div",{className:"right-flex",children:(0,n.tZ)("img",{src:N.cover_image,className:N.cover_image?"":"no-preview"})})]})})}),(0,n.tZ)("div",{className:"publication-author",children:(0,g.sv)(e,{language:u})})]})]})]},e.id)})})})};function I(e,i){if(!e)return"";let t=RegExp(i.join("|"),"ig"),l=e.split(t),a=[...e.matchAll(t)];return(0,n.tZ)("span",{children:l.map((e,i)=>(0,n.BX)(n.HY,{children:[e,i!==l.length-1&&(0,n.tZ)("b",{children:a[i]})]}))})}let X=e=>{let{onCategoryClicked:i,categoryId:t,ranking:l,loadingRanking:a,categories:r}=e;return"string"==typeof t&&["featured","twitter"].includes(t)?null:(0,n.BX)("div",{className:"ranking-toggle",children:[(0,n.tZ)(h.Z,{className:s()({active:"paid"===l&&!a||"paid"===a,loading:"paid"===a&&"paid"!==l}),onClick:()=>i({categoryId:t,ranking:"paid",categories:r}),children:"Top paid"})," \xb7 ",(0,n.tZ)(h.Z,{className:s()({active:"all"===l&&!a||"all"===a,loading:"all"===a&&"all"!==l}),onClick:()=>i({categoryId:t,ranking:"all",categories:r}),children:"All"})]})},S=e=>{var{Component:i=j}=e,t=(0,a._)(e,["Component"]);let r=(0,y.z)(t);return r.categories?(0,n.tZ)(i,(0,l._)({},r)):null};class j extends(3270==t.j?r.Component:null){componentDidUpdate(e){if(this.props.categorySlug===e.categorySlug&&this.props.rankingSlug===e.rankingSlug)return;let i=(0,N.Wq)(this.props.categorySlug,this.props.categories),t=this.props.rankingSlug||"paid";this.props.loadPublications({categoryId:i,ranking:t})}startReading(e){window.sessionStorage.setItem("initialJoinSubstack","true"),(0,Z.j)(Z.FP.HOMEPAGE_READER_LINK_CLICKED,{url:(0,w.HMK)()}),(0,k.uX)((0,w.HMK)(),{event:e})}render(e){let{categories:i,publications:t,categoryId:l,loadingCategoryId:a,ranking:r,loadingRanking:d,onCategoryClicked:o,hasMore:c,viewMore:u,featuredPublications:g,maxPublications:h,showTwitterBanner:v,user:y}=e,Z="featured"===l,k="twitter"===l,f=i.find(e=>e.id===l);return(0,n.tZ)("div",{className:s()("new-landing-page reader-landing-page page",{"category-featured":Z}),children:(0,n.BX)("div",{className:"container",children:[(0,n.BX)("div",{className:"landing-content",children:[(0,n.BX)("div",{className:"landing-section landing-publications",children:[(0,n.tZ)("div",{className:"publications-header not-mobile",children:(0,n.tZ)(X,{categories:i,categoryId:l,ranking:r,onCategoryClicked:o})}),(0,n.tZ)(B,{publications:t,ranking:Z?"all":r,categoryId:l}),"all"===r&&!Z&&!k&&!h&&c&&(0,n.tZ)("div",{className:"view-more",children:(0,n.tZ)(b.zx,{priority:"secondary-outline",onClick:u,children:"View more"})}),h&&"featured"!==l&&(0,n.tZ)("div",{className:"see-all",style:{paddingLeft:"all"===r?"108px":"146px"},children:(0,n.BX)("a",{href:Z?(0,w._P8)():(0,w._P8)(f,r),native:!0,children:["See all"," ",(0,n.tZ)(p.Z,{width:7,height:11,color:"var(--color-fg-primary-themed)",style:{marginLeft:"3px"}})]})})]}),(0,n.BX)("div",{className:"landing-section landing-categories",children:[(0,n.tZ)("div",{className:"only-mobile",children:(0,n.tZ)("div",{className:"mobile-toggle",children:(0,n.tZ)(X,{categories:i,categoryId:l,ranking:r,onCategoryClicked:o})})}),(0,n.tZ)(_,{hasFeatured:g&&g.length>0,categories:i,categoryId:l,loadingCategoryId:a,onCategoryClicked:o,ranking:r,loadingRanking:d})]})]}),!v||"featured"!==l||(null==y?void 0:y.has_linked_twitter)?null:(0,n.tZ)(m.PH,{})]})})}}}}]);