import{r as a,m as it,j as e,z as s,F as v,S as X,T as rt,U as ot,x as $e,as as at,Q as He,a5 as Pe,at as st,a3 as Fe}from"./vendor-CT-JknSv.chunk.js";import{C as B,L as me}from"./LoadingConveyorSection-B4xh3KQa.chunk.js";import{bh as je,k as lt,b8 as Ge,bi as ct,bj as dt,bk as ut,X as Me,Y as Oe,aO as pt,bl as ae,a$ as ht,j as q,bm as ft,l as Y,f as We,bn as mt,aB as Ce,bo as De,a9 as gt,bp as Xe,aa as bt,ab as yt,ac as xt,a5 as qe,aD as Ie,bq as vt,br as V,i as ve,ay as re,bs as _t,V as P,bt as ge,a6 as U,bu as Ee,au as St,av as kt,bv as Be,bw as Rt,bx as Et,at as de,r as wt,by as Ye,bz as Ct,af as ne,ae as ce,a3 as Z,a4 as ee,W as Tt,a7 as Ke,bA as Lt,bb as Wt,bB as It,z as Bt,a as At,H as $t,bC as Ht,I as Ft,bD as Mt,P as Ne,R as j,G as Qe}from"./index-DDZqnj79.js";import{B as Ot}from"./Badge-DbIO_94P.chunk.js";const{hiddenAttr:se=void 0,visibilityChangeEvent:we=void 0}=typeof(document==null?void 0:document.hidden)<"u"?{hiddenAttr:"hidden",visibilityChangeEvent:"visibilitychange"}:typeof(document==null?void 0:document.webkitHidden)<"u"?{hiddenAttr:"webkitHidden",visibilityChangeEvent:"webkitvisibilitychange"}:{};function Dt(){const[t,n]=a.useState(()=>{var r;return!!se&&!!document&&((r=document[se])!=null?r:!1)});return a.useEffect(()=>{if(!se||!we)return;const r=()=>{var o;se&&n((o=document[se])!=null?o:!1)};return document.addEventListener(we,r),()=>{document.removeEventListener(we,r)}},[]),t}function Nt(t){return it(t,n=>`var(${n})`)}function xe({to:t,contentType:n,className:r}){const o=je();return e(lt,{tabIndex:-1,to:t,css:Ut,onClick:()=>{Ge()},onPointerEnter:()=>{n&&o(n)},className:r})}const Ut=s({position:"absolute",top:0,left:0,width:"100%",height:"100%"});function zt({item:t,className:n,showMeta:r=!0,showDate:o=!1,widthDefinition:k,"aria-describedby":m,tabIndex:g}){const _=a.useRef(null),y=ct(_,"100% 0px 100% 0px"),{publishedAt:h,pathname:x,typeAriaLabel:b,cardSubtitle:d,cardTitle:C,cardMeta:f}=dt(t),R=t.type==="video_episode",S=t.type==="video_channel",p=x;return v(pt,{ref:_,className:n,css:F.cardWrapper,children:[e(ut,{widthDefinition:k,item:t,inViewport:y,tabIndex:g,"aria-describedby":m,hideEngagement:!0,css:F.image}),v("div",{css:F.description,children:[R||S?e(ht,{item:t,inViewport:y,passive:!0}):null,v("div",{css:F.labels,children:[d?e("div",{css:F.subtitle,children:d}):null,e("h3",{title:C,css:F.title,children:C}),r?v("div",{css:F.metaWrapper,children:[e("div",{css:F.meta,children:f}),o&&h?v(a.Fragment,{children:[v(Me,{children:[b," published:"]}),e(Oe,{css:F.date,value:h,format:"calendar"})]}):null]}):o&&h?v("div",{css:F.dateWrapper,children:[v(Me,{children:[b," published:"]}),e(Oe,{value:h,format:"calendar"})]}):null,e(xe,{to:p,contentType:t.type})]})]})]})}const F={...ae,image:s({'&[tabindex="0"]:focus':{outline:"auto"},boxShadow:`0 32px 80px 0 ${q.neutral1000_50}`}),labels:s(ae.labels,{pointerEvents:"none",color:q.neutral0_60}),title:s(ae.title,ft({lineHeight:Y.header5.lineHeight,maxLineCount:1})),dateWrapper:s(ae.dateWrapper,{color:q.neutral0_60}),metaWrapper:s(ae.metaWrapper,{color:q.neutral0_60})},Vt=["avif","webp","png"];function Ue({image:t,alt:n,...r}){const{src:o,width:k,height:m}=t,[g,_]=a.useState(""),[y,h]=a.useState(""),x=G(o,"png","hero_logo_desktop"),b=G(o,"png","hero_logo_mobile");a.useEffect(()=>{_(x),h(b)},[x,b]);const d=Math.round(k*be.desktop),C=Math.round(m*be.desktop),f=Math.round(k*be.mobile),R=Math.round(m*be.mobile),{matches:S}=We(mt);return e(a.Fragment,{children:v("picture",{...r,children:[Vt.map(p=>v(a.Fragment,{children:[e("source",{srcSet:`
								${G(o,p,"hero_logo_desktop")} 1x,
								${G(o,p,"hero_logo_desktop_2x")} 2x
							`,sizes:d+"px",type:`image/${p}`,media:Gt(Ce)}),e("source",{srcSet:`
									${G(o,p,"hero_logo_mobile")},
									${G(o,p,"hero_logo_mobile_2x")} 2x,
									${G(o,p,"hero_logo_mobile_3x")} 3x
								`,sizes:f+"px",type:`image/${p}`,media:jt(Ce)})]},o+p)),e("img",{"data-fallback":!0,src:S?g:y,alt:n,width:S?d:f,height:S?C:R,css:Pt.fallback})]})})}const Pt={fallback:s({height:"auto"})},jt=t=>`(max-width: ${t}px)`,Gt=t=>`(min-width: ${t+1}px)`,be={mobile:.2,desktop:.325};function G(t,n,r){const o=new URL(t);return o.searchParams.set("format",n),o.searchParams.set("usage",r),o.toString()}const ue=480,Xt=.1;function qt({backgroundWide:t,backgroundWideFallback:n,backgroundNarrow:r,buttonText:o,attributes:k,title:m,flair:g,shortDescription:_,channelLogo:y,titleLogo:h,link:x,focusable:b,altText:d,intersectionObserverCallback:C,content:f,...R}){const S=a.useId(),p=a.useId(),i=a.useId(),u=t||De(n),z=f?De(r||t||n):r,D=a.useRef(null),A=a.useRef(null),$=a.useRef(C);$.current=C,a.useEffect(()=>{const W=D.current;if(!W)return;const ke=N=>{const I=CSS.supports(Ze)?.9:.6;return N<I?0:(N-I)/(1-I)},Q=new IntersectionObserver(([N])=>{var L;if(!W)return;const I=N.intersectionRect,J=N.boundingClientRect,l=Math.min(J.width,window.innerWidth),c=1-(l-I.width)/l;(L=$.current)==null||L.call($,c);const w=J.x<I.x||c===1;W.style.setProperty(O.opacity,c>.001?"1":"0");const H=(c-1)**2*Xt*l;W.style.setProperty(O.parallax,w?`${-1*H}px`:`${H}px`),W.style.setProperty(O.clipPath,c?w?"0px":`0px 0px 0px ${l-I.width}px`:"100%"),W.style.setProperty(O.reducedMotionCrossFade,w?"1":`${c}`);const T=ke(c);W.style.setProperty(O.textOpacity,`${T}`)},{threshold:X(2001).map(N=>N/2e3)});return Q.observe(W),()=>{Q.unobserve(W),Q.disconnect()}},[]);const{matches:pe}=We(vt),he=!!f&&pe,K=je(),_e=()=>{Ge()},fe=()=>{f&&K(f.type)},Se=()=>{f&&K(f.type)};return v("div",{ref:D,"data-theme-override":"dark","data-with-thumbnail-card":!!f,style:{[O.opacity]:"0",[O.clipPath]:"100%",[O.reducedMotionCrossFade]:"1",[O.textOpacity]:"1"},children:[v("div",{css:E.backgroundWrapper,children:[e(qe,{name:d,image:u,mobileImageBreakpoint:Ce,mobileImage:z,widthDefinition:`${gt} ${Xe}px, ${bt} 100vw, ${yt} 100vw, ${xt} 100vw`,css:E.background}),f?e("div",{css:E.blurredBackgroundOverlay,"data-background-fallback":!t&&!!n}):null,e("div",{css:E.gradientWrapperBottom})]}),v("div",{ref:A,css:E.contentWrapper,...R,children:[e(xe,{to:x,contentType:f==null?void 0:f.type}),v("div",{css:E.content,children:[v("div",{css:E.contentLabel,children:[y?e(Ue,{alt:"","aria-hidden":!0,image:y,css:E.channelLogo}):null,h?e(Ue,{"aria-hidden":!!m,image:h,alt:m!=null?m:"",id:S,css:E.titleLogo}):null,Yt(k)?e(Ot,{attributes:k,css:E.badge}):g?e("div",{css:E.flair,children:g}):null,!h&&m?e("div",{id:p,css:E.title,children:m}):null,_?e("div",{id:i,css:E.shortDescription,children:_}):null,e(xe,{to:x,contentType:f==null?void 0:f.type}),x&&o?e(Ie,{"aria-describedby":`${p} ${S} ${i}`,to:x,theme:"hero",tabIndex:b===!1||he?-1:0,css:E.ctaButton,onClick:_e,onFocus:Se,onPointerEnter:fe,children:o}):null]}),f?v("div",{css:E.contentCard,children:[e(zt,{css:f.type==="podcast_channel"||f.type==="podcast_episode"?[E.thumbnailCard,E.thumbnailCardSquare]:E.thumbnailCard,item:f,showDate:f.type==="video_episode"||f.type==="podcast_episode","aria-describedby":`${p} ${S} ${i}`,tabIndex:b===!1||!he?-1:0}),e(xe,{to:x,contentType:f==null?void 0:f.type,css:E.contentCardOverlay})]}):null]})]})]})}function Je({children:t,background:n,intersectionObserverCallback:r,...o}){return v("div",{...o,children:[e("div",{css:Qt.backgroundWrapper,children:n}),e("div",{css:E.contentWrapper,children:t})]})}const O={opacity:"--opacity",clipPath:"--clipPath",parallax:"--parallax",reducedMotionCrossFade:"--reduced-motion-cross-fade",textOpacity:"--text-opacity"},te=Nt(O);function Yt(t){return t.includes("nebula_first")||t.includes("nebula_originals")||t.includes("nebula_plus")||t.includes("nebula_classes")}const Ze="scroll-snap-type: x mandatory",Kt=`@supports not (${Ze})`,E={badge:s({marginBottom:"12px",display:"block",pointerEvents:"none"}),channelLogo:s({position:"relative",display:"block",marginBottom:"8px",pointerEvents:"none"}),titleLogo:s({display:"block",position:"relative",marginBottom:"32px",pointerEvents:"none"}),flair:s({marginBottom:"12px",fontWeight:Y.weight.book,fontSize:"14px",lineHeight:"18px",pointerEvents:"none",textTransform:"uppercase"}),title:s({marginBottom:"8px",fontWeight:Y.weight.semibold,pointerEvents:"none",maxWidth:"320px",fontSize:"20px",lineHeight:"24px",[V]:{maxWidth:"480px",fontSize:"28px",lineHeight:"32px"}}),shortDescription:s({fontWeight:Y.weight.book,fontSize:"14px",lineHeight:"18px",pointerEvents:"none",maxWidth:"320px",marginBottom:"20px",[V]:{maxWidth:"400px",marginBottom:"24px"}}),background:s({[qe.fallbackSelector]:{cursor:"pointer",height:"100%",objectFit:"cover",backgroundColor:ve.secondarySystemBackground,width:"100%"}}),contentWrapper:s({lineHeight:0,objectFit:"cover",width:"100%",height:ue,position:"relative",top:0,left:0,opacity:te.textOpacity,zIndex:1,maxWidth:re,margin:"0 auto"}),backgroundWrapper:s({clipPath:`inset(${te.clipPath})`,position:"absolute",top:0,left:0,opacity:te.opacity,height:ue,transform:`translateX(${te.parallax})`,width:"100%",[_t]:{clipPath:"none",transform:"none",opacity:te.reducedMotionCrossFade},[Kt]:{clipPath:"none",transform:"none",opacity:te.reducedMotionCrossFade}}),content:s({position:"absolute",color:ve.label,bottom:"32px",display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",width:"100%",margin:"0 auto",paddingLeft:P,paddingRight:P,[ge]:{flexDirection:"column-reverse",alignItems:"flex-end"},[V]:{flexDirection:"row",justifyContent:"space-between",bottom:"40px"}}),contentLabel:s({display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",flex:"1 1 0",textAlign:"center",[ge]:{textAlign:"left",alignSelf:"flex-start",justifyContent:"center",alignItems:"flex-start"},[V]:{alignSelf:"flex-end",alignItems:"flex-start"}}),contentCard:s({flex:"1 1 0",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",[ge]:{justifyContent:"flex-end",maxWidth:"none",paddingLeft:100},[V]:{alignItems:"flex-end"},pointerEvents:"none",position:"relative"}),thumbnailCard:s({maxWidth:240,flex:"0 0 auto",[V]:{maxWidth:490,flex:"1 1 0"}}),thumbnailCardSquare:s({maxWidth:240*U,[V]:{maxWidth:490*U}}),contentCardOverlay:s({[Ee]:{display:"none"}}),ctaButton:s({position:"relative",'[data-with-thumbnail-card="true"] &':{[Ee]:{display:"none"}}}),blurredBackgroundOverlay:s({pointerEvents:"none",position:"absolute",bottom:0,left:0,width:"100%",height:"100%",backgroundColor:q.neutral1000,opacity:.4,display:"none",[Ee]:{display:"block"},'&[data-background-fallback="true"]':{display:"block"}}),gradientWrapperBottom:s({position:"absolute",bottom:0,left:0,width:"100%",height:"100%",transitionProperty:"opacity",background:St,[ge]:{width:`${Xe}px`,background:kt},pointerEvents:"none",opacity:1,transition:Be}),observedElement:s({width:"100%",height:ue})},Qt={backgroundWrapper:s(E.backgroundWrapper,{backgroundColor:ve.secondarySystemBackground,width:"100%",height:"100%"})},ze=(()=>{const n=["15.1","15.2","15.3"].some(r=>navigator==null?void 0:navigator.userAgent.includes(`Version/${r}`));return(navigator==null?void 0:navigator.userAgent.includes("Safari"))&&n})(),Jt=navigator==null?void 0:navigator.userAgent.includes("Firefox"),Zt="0.5s",et={scrollable:"data-scrollable",isActiveDot:"data-active-dot"},en=Et(et),tt="--dot-opacity",Te="--direct-transition-left",Le="--direct-transition-duration";function Ae({children:t,scrollable:n=!0,...r}){const o=t.length,k=a.useRef(null),m=a.useRef(null),g=a.useRef([]),_=a.useRef([]);Rt(k);const y=a.useRef(null),h=a.useRef(null),x=o<=1,b=a.useRef(()=>{}),d=3,C=x||!n?[t]:new Array(d).fill(t),f=a.useRef(),R=a.useCallback(l=>{if(!m.current)return 0;const c=m.current.children[l+o];return c instanceof HTMLElement?c.offsetLeft:0},[o]),S=a.useCallback(l=>(l+o)%o,[o]),p=a.useCallback(()=>{if(!m.current)return 0;const{scrollLeft:l}=m.current,w=[...m.current.children].map(L=>L instanceof HTMLElement?L.offsetLeft:0).map(L=>Math.abs(l-L)),H=Math.min(...w);return w.findIndex(L=>L===H)-o},[o]),i=a.useCallback(()=>{if(!m.current)return!1;const{scrollLeft:l}=m.current,c=m.current.children[0];return l%c.offsetWidth>2},[]),u=a.useCallback(l=>{m.current&&(m.current.scrollLeft=R(l))},[R]),z=a.useCallback(()=>{y.current&&(y.current.hidden=!0)},[]),{matches:D}=We("(prefers-reduced-motion: reduce)"),A=a.useCallback(l=>{if(D){u(l);return}const c=S(p());if(!h.current||!y.current||!m.current||c===l)return;const w=[...h.current.children],H=w[c],T=w[l],L=l>c?"right":"left";y.current.hidden=!1;for(const oe of w){const nt=oe===H||oe===T;oe.hidden=!nt}h.current.style.setProperty(Le,"0s");const Re=L==="right"?"0":`-${T.offsetWidth}px`;h.current.style.setProperty(Te,Re),h.current.addEventListener("transitionend",z,{once:!0}),setTimeout(()=>{if(!h.current)return;h.current.style.setProperty(Le,Zt);const oe=L==="right"?`-${T.offsetWidth}px`:"0px";h.current.style.setProperty(Te,oe)},0),u(l)},[S,p,u,z,D]);a.useEffect(()=>{if(A)return()=>{var l;(l=h.current)==null||l.removeEventListener("transitionend",z)}},[A,z]);const $=a.useCallback(()=>{var l;u(p()),Jt&&((l=m.current)==null||l.scroll())},[u,p]);a.useEffect(()=>{k.current&&u(0)},[u]);const pe=a.useCallback(()=>{A(S(p()+1))},[A,S,p]),[he,K]=a.useState(!1),[_e,fe]=a.useState(!1),[Se,W]=a.useState(!1),ke=Dt(),Q=n&&!x&&!he&&!_e&&!Se&&!ke&&!D;a.useEffect(()=>{if(!Q)return;let l;const c=()=>{l=setTimeout(()=>{pe(),c()},8e3)};return c(),()=>{clearTimeout(l)}},[pe,Q]),a.useEffect(()=>{const l=k.current;if(!l)return;const c=rt($,50),w=new ResizeObserver(H=>{ot(H)&&c()});return w.observe(l),()=>{c.cancel(),w.disconnect()}},[$]);const N=()=>{J.current()},I=a.useCallback(()=>{var w;const l=p(),c=S(l);f.current&&clearTimeout(f.current),c!==l?u(c):((w=b.current)==null||w.call(b),b.current=()=>{})},[S,p,u]),J=a.useRef($e(I,150));return a.useEffect(()=>(J.current=$e(I,150),()=>{J.current.cancel()}),[I]),v("div",{css:M.wrapper,...r,onPointerEnter:l=>{var c;K(!0),(c=r.onPointerEnter)==null||c.call(r,l)},onPointerMove:l=>{var c;K(!0),(c=r.onPointerMove)==null||c.call(r,l)},onPointerLeave:l=>{var c;K(!1),(c=r.onPointerLeave)==null||c.call(r,l)},onTouchStart:l=>{var c;W(!0),(c=r.onTouchStart)==null||c.call(r,l)},onTouchEnd:l=>{var c;W(!1),(c=r.onTouchEnd)==null||c.call(r,l)},children:[v("div",{children:[e("div",{ref:k,css:M.fullWidthCentered,children:e("ul",{ref:m,onScroll:N,css:M.scrollElement,[et.scrollable]:n,children:C.map((l,c)=>{const w=x||c===1;return a.Children.map(l,(H,T)=>a.cloneElement(H,{focusable:w,intersectionObserverCallback:L=>{if(_.current[T]||(_.current[T]=[0,0,0]),_.current[T][c]=L,g.current[T]){const Re=at(_.current[T]);g.current[T].style.setProperty(tt,(.3+.7*Re).toString())}},"aria-hidden":!x&&c!==1,onFocus:()=>{f.current=setTimeout(()=>{u(T)},50),fe(!0)},onBlur:()=>{fe(!1)}}))})})}),n&&!D?e("div",{css:[M.fullWidthCentered,M.directTransitionWrapper],ref:y,hidden:!0,children:e("ul",{ref:h,css:[M.scrollElement,M.directTransitionScrollElement],children:t.map(l=>a.cloneElement(l,{focusable:!1,"aria-hidden":!0}))})}):null]}),t.length>1?e("div",{css:M.dotsWrapper,children:a.Children.map(t,(l,c)=>e(Ie,{type:"button",css:M.dotWrapper,tabIndex:-1,"aria-hidden":!0,onClick:()=>{if(n){if(i()){b.current=()=>{A(c)};return}A(c)}},children:e("div",{ref:w=>{g.current[c]=w},css:M.dot})}))}):null]})}const M={wrapper:s({width:"100%",maxWidth:"100%",background:q.neutral1000,[de]:{maxWidth:`${re}px`,background:"transparent"},margin:"0 auto",position:"relative",height:ue,transform:"scale(1)"}),fullWidthCentered:s({width:"100%",margin:"0 auto",position:"relative",[de]:{borderRadius:"40px"},zIndex:0,overflow:"hidden"}),directTransitionWrapper:s({top:0,left:0,position:"absolute",zIndex:1,pointerEvents:"none","*":{pointerEvents:"none"}}),dotsWrapper:s({textAlign:"center",margin:"0 auto",alignItems:"center",marginTop:"15px",justifyContent:"center",position:"absolute",bottom:0,left:0,right:0,marginBottom:"12px",display:"none",[V]:{display:"flex"},zIndex:1}),dotWrapper:s({width:"18px",height:"16px",cursor:"pointer",background:"none",border:"none",padding:0,":hover":{background:"none"}}),dot:s({borderRadius:"100%",margin:"4px 5px",width:"8px",height:"8px",outline:0,opacity:`var(${tt})`,backgroundColor:q.neutral0}),directTransitionScrollElement:s({overflow:"visible",marginLeft:`var(${Te})`,transition:`margin-left ease-in-out var(${Le})`}),scrollElement:s([{display:"flex",gridTemplateRows:"auto",height:ue,[de]:{borderRadius:"40px"},overflow:"hidden",[en.scrollable]:{overflow:"scroll",pointerEvents:"auto"},width:"100%",pointerEvents:"none",paddingBottom:"20px",[wt]:{paddingBottom:0},scrollSnapType:ze?"none":"x mandatory",scrollPadding:0,transition:`transform ease-in-out 0.6s,border-radius linear ${Be}`,"& > *":{scrollSnapAlign:"start",scrollSnapStop:ze?"normal":"always",boxSizing:"content-box",paddingLeft:0,width:"100%",outline:0,flexGrow:0,flexShrink:0,pointerEvents:"none","*":{pointerEvents:"auto"}}},Ye])};function tn({rail:t,items:n,analyticsCategory:r,isLoading:o}){const{trackEvent:k}=Lt(),m=Ct(n),g=i=>{const u=i.target;u instanceof HTMLElement&&u.closest("a[href]")&&k({category:r,action:"click",name:t.title})},{id:_,title:y,description:h,view_all:x,attributes:b,images:d,flair:C,button_text:f}=t,R=t.content_type==="video_episodes"&&t.size==="small"?"medium":t.size,S=on(m,n);if(o){const i=t.content_type==="podcast_channels"||t.content_type==="podcast_episodes"?ne:U,u=R==="large"?3:R==="medium"?4:5,z=i===ne?1:0,D=t.content_type==="video_episodes",A=t.content_type==="classes"||t.content_type==="lessons";return e(sn,{children:e(B,{size:R,heightToWidthRatio:i,children:X(u+z).map($=>e(ce,{index:$,heightToWidthRatio:i,withAvatar:D,withCaption:A},$))})})}const p=t.content_type==="video_episodes"&&S==="fadeOut"?m:n;if(!(p!=null&&p.length))return null;switch(t.content_type){case"podcast_channels":return e(ee,{title:y,flair:C,description:h,attributes:b,viewAllUrl:x,onClick:g,background:d==null?void 0:d.background,backgroundFallback:d==null?void 0:d.background_fallback,buttonText:f,children:e(B,{size:R,heightToWidthRatio:ne,children:p.map((i,u)=>e(Z,{"aria-setsize":p.length,"aria-posinset":u,role:"listitem",item:i},`${i.id}-${u}`))})});case"podcast_episodes":return e(ee,{title:y,flair:C,description:h,attributes:b,viewAllUrl:x,onClick:g,background:d==null?void 0:d.background,backgroundFallback:d==null?void 0:d.background_fallback,buttonText:f,children:e(B,{size:R,heightToWidthRatio:ne,children:p.map((i,u)=>e(Z,{"aria-setsize":p.length,"aria-posinset":u,role:"listitem",item:i,showDate:!0,dateFormat:"relative"},`${i.id}-${u}`))})});case"video_episodes":return e(Tt,{view:"featured",children:e(ee,{background:d==null?void 0:d.background,backgroundFallback:d==null?void 0:d.background_fallback,contentId:_,title:y,flair:C,description:h,attributes:b,viewAllUrl:x,css:an[S],onClick:g,buttonText:f,children:e(B,{size:R,children:p.map((i,u)=>e(Z,{"aria-setsize":p.length,"aria-posinset":u,showDate:!0,role:"listitem",item:i},`${i.id}-${u}`))})})});case"video_channels":return e(ee,{title:y,flair:C,description:h,attributes:b,viewAllUrl:x,onClick:g,background:d==null?void 0:d.background,backgroundFallback:d==null?void 0:d.background_fallback,buttonText:f,children:e(B,{size:R,children:p.map((i,u)=>e(Z,{item:i,showChannelAvatar:!1,"aria-setsize":p.length,"aria-posinset":u,engagementUI:R==="large"?"followButton":"contextMenu",role:"listitem"},`${i.id}-${u}`))})});case"classes":return e(ee,{title:y,flair:C,description:h,attributes:b,viewAllUrl:x,onClick:g,background:d==null?void 0:d.background,backgroundFallback:d==null?void 0:d.background_fallback,buttonText:f,children:e(B,{size:R,children:p.map((i,u)=>e(Z,{item:i,"aria-setsize":p.length,"aria-posinset":u,role:"listitem"},`${i.id}-${u}`))})});case"lessons":return e(ee,{title:y,flair:C,description:h,attributes:b,viewAllUrl:x,onClick:g,background:d==null?void 0:d.background,backgroundFallback:d==null?void 0:d.background_fallback,buttonText:f,children:e(B,{size:R,children:p.map((i,u)=>e(Z,{"aria-setsize":p.length,"aria-posinset":u,role:"listitem",item:i},`${i.id}-${u}`))})});default:return rn(t.content_type)}}function nn(t){return!!t.collection}function rn(t){return null}function on(t,n){return a.useMemo(()=>{if(t===void 0||n===void 0)return n?"show":"hide";const r=t.length===0,o=n.length===0;return r&&!o?"fadeIn":!r&&o?"fadeOut":o?"hide":"show"},[t,n])}const le={marginTop:0},an={fadeOut:s([le,{animationName:He({"0%":{maxHeight:"400px",opacity:1},"99%":{maxHeight:0,marginBottom:0,opacity:0},"100%":{maxHeight:0,marginBottom:0,opacity:0,display:"none"}}),animationTimingFunction:"ease-out",animationDuration:"1s",animationFillMode:"forwards",overflow:"hidden"}]),fadeIn:s([le,{animationName:He({"0%":{marginBottom:0,maxHeight:0,opacity:0},"100%":{maxHeight:"400px",opacity:1}}),animationTimingFunction:"ease-in",animationDuration:"1s",animationFillMode:"forwards",overflow:"hidden"}]),none:s([le,{opacity:1,maxHeight:"400px"}]),hide:s([le,{marginBottom:0,maxHeight:0,opacity:0,display:"none"}]),show:s([le,{}])};function sn({children:t}){return v("div",{css:Ve.wrapper,children:[e(Ke,{css:Ve.title}),t]})}const Ve={wrapper:s({margin:"0 auto 40px auto",maxWidth:`${re}px`,padding:`0 ${P}`}),title:s({height:18,width:160,borderRadius:4,margin:"0 0 14px 0"})},ye={chipsSection:s({display:"flex",width:"100%",margin:"0 auto 12px auto",[Wt]:{width:"100%",maxWidth:`${re}px`}}),chipsList:s([{display:"flex",overflowX:"auto",padding:`8px ${P} 12px ${P}`,scrollSnapType:"x mandatory",scrollPadding:`0 ${P}`},Ye]),li:s({scrollSnapAlign:"start",marginRight:8,"&:last-of-type":{marginRight:0}}),chipButton:s({whiteSpace:"nowrap",display:"inline-flex",flexDirection:"column","&:after":{height:0,visibility:"hidden",overflow:"hidden",userSelect:"none",pointerEvents:"none",fontWeight:Y.weight.semibold,content:"attr(data-title)","@media speech":{display:"none"}}})};function ln({pages:t,onClick:n}){const r=a.useRef(null),o=a.useRef(null),{slug:k}=Pe(),m=t==null?void 0:t.find(g=>g.slug===k);return a.useEffect(()=>{if(r.current&&o.current){const g=r.current,_=o.current,y=g.getBoundingClientRect(),h=_.getBoundingClientRect();if(!(h.left>=y.left&&h.right<=y.right)){const b=h.left+g.scrollLeft-y.left;g.scrollTo({left:b,behavior:"smooth"})}}},[m,t]),e("nav",{css:ye.chipsSection,"aria-label":"featured pages",children:e("ul",{ref:r,css:ye.chipsList,children:t==null?void 0:t.map(g=>{const _=m&&g.slug===m.slug;return e("li",{ref:_?o:null,css:ye.li,children:e(Ie,{to:{pathname:`/${g.slug}`,state:{[It]:!0}},theme:_?"primary":"chip",onClick:n,"aria-selected":_,css:ye.chipButton,"data-title":g.title,style:{fontWeight:_?Y.weight.semibold:Y.weight.medium},children:g.title})},g.slug)})})})}function vn(){var S,p;const{slug:t}=Pe(),{data:n,isInitialLoading:r,error:o,isPlaceholderData:k}=Bt({slug:t}),{pages:m,error:g,refetch:_}=At(),y=a.useContext($t),h=a.useMemo(()=>{var i;if((n==null?void 0:n.type)==="featured_page")return(i=n.rails)==null?void 0:i.filter(nn)},[n]),x=a.useMemo(()=>{var i;return(i=h==null?void 0:h.map(u=>({collectionUrl:u.collection,contentType:u.content_type,attributes:u.attributes})))!=null?i:[]},[h]),b=Ht(x),d=Ft((n==null?void 0:n.type)==="featured_page"?{url:`/${n.slug}`,title:n.title}:{url:`/${t}`}),C=a.useMemo(()=>{var i;return(n==null?void 0:n.type)!=="featured_page"||!((i=n.content_types)!=null&&i.length)?null:mn(n.content_types)},[n]),f=b.length>0&&b.every(i=>i.isError);if(o&&g||n&&(n==null?void 0:n.type)!=="featured_page")return v(Ne,{children:[e(Fe,{defer:!1,children:e("title",{children:"Error"})}),e(Qe,{error:o!=null?o:g})]});const R=b&&h&&!st(h)&&!k;return v(Ne,{css:{marginTop:-y+"px",[de]:{marginTop:24},position:"relative",transition:Be,transitionProperty:"margin"},children:[v(Fe,{defer:!1,children:[e("title",{children:n==null?void 0:n.title}),d,C]}),e("h1",{id:"home-header",css:Mt,children:n==null?void 0:n.title}),v("main",{"aria-labelledby":"home",children:[r||k?e(cn,{}):o?e(dn,{error:o}):e(Ae,{css:ie.heroRail,children:(p=(S=n==null?void 0:n.heroes)==null?void 0:S.filter(i=>!i.content_type||i.content_type==="video_episode"||i.content_type==="video_channel"||i.content_type==="class"||i.content_type==="podcast_channel"||i.content_type==="podcast_episode").map(i=>{var u;return e(qt,{attributes:i.attributes,buttonText:i.button_text,flair:i.flair,shortDescription:i.short_description,title:i.title,channelLogo:i.images.channel_logo,titleLogo:i.images.title_logo,backgroundWide:(u=i.images.background_wide)!=null?u:i.images.hero,backgroundWideFallback:i.images.background_wide_fallback,backgroundNarrow:i.images.background_narrow,altText:i.alt_text,link:i.url,content:i.content},i.id)}))!=null?p:[]}),e(ln,{pages:m,onClick:_}),e("div",{css:ie.railsWrapper,children:r||k?e("div",{css:ie.skeletonRailWrapper,children:e(fn,{})}):o||f?e("div",{css:ie.errorWrapper,children:e(pn,{})}):R?b.map((i,u)=>e(tn,{rail:h[u],items:i.data,isLoading:i.isLoading,analyticsCategory:`home-${t}-rail`},h[u].id)):null})]})]})}const ie={heroRail:s({marginBottom:16}),railsWrapper:s({margin:"0 auto"}),skeletonRailWrapper:s({padding:`0 ${P}`,maxWidth:re+"px",margin:"0 auto"}),errorWrapper:s({padding:`0 ${P}`,maxWidth:re+"px",margin:"0 auto"})};function cn(){return e(Ae,{scrollable:!1,css:ie.heroRail,children:X(5).map(t=>e(Je,{background:e(Ke,{})},t))})}function dn({error:t}){return e(Ae,{scrollable:!1,css:ie.heroRail,children:[e(Je,{children:e(Qe,{css:un.errorPage,error:t})},"error")]})}const un={errorPage:s({margin:"0 auto",paddingBottom:48,height:"100%",justifyContent:"flex-end",[de]:{paddingBottom:0,justifyContent:"center"}})};function pn(){return e("div",{css:hn,children:"Unable to load content"})}const hn=s({fontSize:"14px",lineHeight:"18px",color:ve.label300,textAlign:"center",margin:"40px auto"});function fn(){return v(a.Fragment,{children:[e(me,{children:e(B,{size:"medium",heightToWidthRatio:U,children:X(4).map(t=>e(ce,{index:t,heightToWidthRatio:U},t))})}),e(me,{children:e(B,{size:"large",heightToWidthRatio:U,children:X(3).map(t=>e(ce,{index:t,heightToWidthRatio:U},t))})}),e(me,{children:e(B,{size:"medium",heightToWidthRatio:ne,children:X(5).map(t=>e(ce,{index:t,heightToWidthRatio:ne},t))})}),e(me,{children:e(B,{size:"small",heightToWidthRatio:U,children:X(5).map(t=>e(ce,{index:t,heightToWidthRatio:U},t))})})]})}function mn(t){if(!t.length)return null;const n=new Set(t),r=[];return n.has("video_episodes")&&r.push({title:"Latest Videos",href:new URL("video.rss",j.NEBULA_RSS_BASE_URL).toString()},{title:"Latest Plus Videos",href:new URL("video.rss?plus=true",j.NEBULA_RSS_BASE_URL).toString()},{title:"Latest Nebula Originals",href:new URL("video/categories/originals.rss",j.NEBULA_RSS_BASE_URL).toString()}),n.has("video_channels")&&r.push({title:"Recently Added Channels",href:new URL("video/channels.rss",j.NEBULA_RSS_BASE_URL).toString()}),n.has("podcast_episodes")&&r.push({title:"Latest Podcast Episodes",href:new URL("podcast.rss",j.NEBULA_RSS_BASE_URL).toString()}),n.has("podcast_channels")&&r.push({title:"Recently Added Podcasts",href:new URL("podcast/channels.rss",j.NEBULA_RSS_BASE_URL).toString()}),n.has("classes")&&r.push({title:"Latest Classes",href:new URL("class.rss",j.NEBULA_RSS_BASE_URL).toString()}),r.length?r.map(o=>e("link",{rel:"alternate",type:"application/rss+xml",title:o.title,href:o.href},o.href)):null}export{vn as default};