1import{r as e,j as a}from"./react-vendor.B75MsAI9.js";import{u as l,a as t,O as s,q as n,aO as i,z as r,aP as o,Q as c,L as u,a3 as d,aQ as m,a6 as g}from"./AuthModalContainer.CwDh3qj_.js";import{i as v}from"./isEmpty.B73GR3ul.js";const p=({parentClassName:p,isRtl:f,location:_,viewport:h,open:b,user:x,filters:y,fetchAllListsFiltersWorkflow:j,fetchAllReadalongFiltersWorkflow:E,raFilters:$})=>{var w;const L=l(),N=p,[k,A]=e.useState(null),[q,C]=e.useState(null),[M,V]=e.useState(0),[B,S]=e.useState(!1),[R,F]=e.useState(!1),[O,P]=e.useState(!1),[T,W]=e.useState(!1);function H(e){const a=document.getElementsByClassName("pb-toggle-sidebar--right")[0],l=document.getElementsByClassName("pb-toggle-sidebar__content")[0];a&&l&&(a.style.top=e-l.scrollTop+"px")}e.useEffect(()=>{z()},[_]),e.useEffect(()=>{if(h.medium||function(){const e=document.getElementsByTagName("body")[0];b?e.classList.add("pb-toggle-sidebar__body-scroll"):e.classList.remove("pb-toggle-sidebar__body-scroll")}(),h.medium&&b){const e=document.getElementsByClassName("pb-toggle-sidebar__content")[0];e&&e.addEventListener("scroll",H,{passive:!0})}return()=>{if(h.medium&&b){const e=document.getElementsByClassName("pb-toggle-sidebar__content")[0];e&&e.removeEventListener("scroll",H)}}},[b,h]),e.useEffect(()=>{3===q&&H(288),2===q&&H(240),4===q&&H(340)},[q]);const Q=[{index:0,text:x.profile_type!==n[i.STUDENT]?L("global.explore"):L("global.for-me"),url:s.studentHome(),action:t.clickedForMe},{index:1,text:L("global.all-book",2),url:s.allBooks(void 0,x.languagePreferences,x.readingLevels),action:t.clickedBooks},{index:2,text:L("global.readalongs"),url:s.allAudioBooks(void 0,(U=x.languagePreferences,U&&Array.isArray($)&&$.length>0?U.filter(e=>$.map(e=>e.queryValue).includes(e)):[]),x.readingLevels),action:t.clickedReadalongs},{index:3,text:L("global.reading-program"),url:s.rp("en"),action:t.clickedRp},{index:4,text:L("global.reading-list",2),url:s.allLists(),action:t.clickedReadingList}];var U;const z=()=>{Q.forEach(e=>{"undefined"!=typeof window&&window.location.pathname.replace(`/${r}`,"").startsWith("/reading-programme")?A(3):"undefined"!=typeof window&&e.url.replace(`/${r}`,"").split("?")[0]===window.location.pathname.replace(`/${r}`,"")&&A(e.index)})},D=Array.isArray(y)&&y.length>0?null==(w=y.filter(e=>"Language"===e.name)[0])?void 0:w.queryValues:null,G=(e=>{let a=[];return a=e&&e.filter(e=>"English"===e.label).concat(o(e.filter(e=>"English"!==e.label),e=>e.label)),a})(Object.values(g.siteHeaderLinks)).map(e=>({label:e.label,value:s.rp(e.value),lang:e.value,active:"reading-programme"})),I=Array.isArray($)&&$.length>0&&$.filter(e=>"English"===e.queryValue).concat(o($.filter(e=>"English"!==e.queryValue),e=>e.queryValue)).map(e=>({label:e.name,value:s.allAudioBooks(void 0,e.queryValue,null==x?void 0:x.readingLevels),lang:e.name,active:"audios"}));let J=null;D&&(J=D.filter(e=>"English"===e.queryValue).concat(o(D.filter(e=>"English"!==e.queryValue),e=>e.queryValue)).map(e=>({label:e.name,value:s.allLists({language:e.queryValue}),lang:e.name,active:"lists"})));const K=e=>{C(e)},X=()=>{y&&!v(y)||j()},Y=()=>{$&&!v($)||E()},Z={[`${N}--right`]:!0,[`${N}--right--rtl`]:f},ee=({data:e})=>{if("undefined"==typeof window)return null;const l=new URLSearchParams(window.location.search).getAll("language");return a.jsx(m,{parentClassName:`${N}--drp-list`,children:e&&e.map(e=>{const t=window.location.pathname.replace(`/${r}`,"").split("/")[1],s=l.includes(e.lang)&&e.active===t;return a.jsx(u,{fullWidth:!0,parentClassName:s?`${N}__lang-list ${N}__lang-list--active`:`${N}__lang-list`,href:e.value,children:e.label},e.label)})})};return a.jsxs(e.Fragment,{children:[2===q&&h.medium&&a.jsx("div",{className:c(Z),onMouseEnter:()=>K(2),onMouseLeave:()=>K(null),children:a.jsx(ee,{data:I})}),3===q&&h.medium&&a.jsx("div",{className:c(Z),onMouseEnter:()=>K(3),onMouseLeave:()=>K(null),children:a.jsx(ee,{data:G})}),4===q&&h.medium&&a.jsx("div",{className:c(Z),onMouseEnter:()=>K(4),onMouseLeave:()=>K(null),children:a.jsx(ee,{data:J})}),Q.map((e,l)=>{const t=e.text===L("global.reading-program"),s=e.text===L("global.readalongs"),n=e.text===L("global.reading-list",2),i={[`${N}__nav-section-title--focus`]:l===k,[`${N}__nav-section-title--focus--rtl`]:l===k&&f,[`${N}__nav-section-title`]:!0,[`${N}__nav-section-title--hover`]:q===l,[`${N}__nav-section-title--rtl-hover`]:q===l&&f,[`${N}__nav-section-title--rtl`]:l!==k&&f};return a.jsx(u,{href:t||s||n?void 0:e.url,onClick:()=>{(e=>{switch(V(e),e){case 2:return P(!O),F(!1),W(!1);case 3:return P(!1),F(!R),W(!1);case 4:P(!1),F(!1),W(!T)}})(l),S(!B)},parentClassName:`${N}__nav-link`,children:a.jsxs("div",{className:`${N}__nav-section`,children:[a.jsxs("div",{className:`${N}__nav-section--active`,children:[l===k&&a.jsx("img",{className:f?`${N}__nav-section-img ${N}__nav-section-img--rtl`:`${N}__nav-section-img`,src:d.specialAssets.asset2,alt:"bird"}),a.jsx("h3",{className:c(i),onMouseOver:()=>{K(l),n&&X(),s&&Y()},onMouseOut:()=>{K(null)},onClick:()=>{n&&X(),s&&Y()},children:e.text})]}),M===l&&!h.medium&&R&&a.jsx(ee,{data:G}),M===l&&!h.medium&&O&&a.jsx(ee,{data:I}),M===l&&!h.medium&&T&&a.jsx(ee,{data:J})]})},l)})]})};export{p as default}; 2//# sourceMappingURL=SideMenu.BrJEcKg9.js.map
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.