1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.5P7x-FkO.js","assets/react-vendor.B75MsAI9.js","assets/AuthModalContainer.D3JsQqnf.js","assets/AuthModalContainer-BhQ3rY72.css","assets/clsx.BeLtu-UY.js","assets/index-CEjUv-hM.css"])))=>i.map(i=>d[i]); 2import{s as e,w as l,a as s,u as a,t as o,D as r,r as i,p as t,b0 as n,z as d,fP as c,f6 as u,f1 as p,f7 as m,f3 as f,R as g,cb as _,fQ as h,fR as v,U as w,O as x,q as j,aO as b,o as k,f9 as y,Q as $,V as N,an as T,fS as I,cJ as L,L as C,aQ as S,cB as D,i as E,S as F,cr as R,E as P,a2 as M,aY as B,df as A,M as z,ab as H,aR as U,F as G,e_ as O,f0 as J,aX as V,aZ as W,di as q,b2 as Q,a7 as X,f2 as Y,H as Z,dU as K,fT as ee,aB as le,cE as se}from"./AuthModalContainer.D3JsQqnf.js";import{j as ae,r as oe}from"./react-vendor.B75MsAI9.js";import{B as re}from"./Block.v-v90TCf.js";import{R as ie}from"./Rowifier.kY14g1gd.js";import{C as te}from"./CsfLevelItem.5n1ZahIu.js";import{e as ne,F as de,B as ce,I as ue,A as pe,a as me,g as fe}from"./main.DrmgIV4z.js";import{S as ge}from"./SectionBlock.CYiEdDTE.js";import{D as _e}from"./DownloadModal.EPdLYrl-.js";import{F as he}from"./FlpEnrolModalContainer.kRbE69cD.js";import{J as ve}from"./JotformModal.Btugo52C.js";import{i as we}from"./isEmpty.CnTxIE1l.js";import"./RTLProvider.Bmr48mpV.js";import"./LazyFontLoader.5DGfhuFK.js";import"./indianStatesDistricts.Dup4ED2A.js";const xe=new URLSearchParams(window.location.search).get("language")||"en",je=({title:a,similarBooks:o,viewport:r,program:i,userId:t,userType:n})=>{const d=e();return ae.jsx("div",{className:"pb-csf-similar-books__wrapper",children:ae.jsx(ge,{background:"transparent",title:a,children:ae.jsx(ne,{cellWidth:"book-card",viewport:r,children:(c=o,u=e=>{d(`/foundational-literacy/resource/${e}?language=${xe}`),window.dataLayer.push({event:s.clickedResource,category:"flp"===i?`${l.flpMerge}_${xe}`:`FLP_classroom_${xe}`,label:`explore_resource_${e}`,item_type:null,item_id:null,item_value:null,user_id:t,user_profile:n})},c.map((e,l)=>ae.jsx(te,{book:e,onClick:()=>u(e.id)},l)))})})});var c,u},be=oe.lazy(()=>le(()=>import("./index.5P7x-FkO.js"),__vite__mapDeps([0,1,2,3,4,5]))),ke=new URLSearchParams(window.location.search),ye=ke.get("language")||"en",$e=ke.get("ps"),Ne=E(ye),Te=({program:E="csf"})=>{var le,te,ne,xe,ke;const Te=a(),Ie=o();e();const{slug:Le}=r(),[Ce]=i(),Se=Ce.get("language")||ye,[De,Ee]=oe.useState(null),[Fe,Re]=oe.useState(!1),[Pe,Me]=oe.useState({download:!1}),[Be,Ae]=oe.useState(!1),[ze,He]=oe.useState(!1),[Ue,Ge]=oe.useState(!1),Oe=t(e=>e.viewport),Je=t(e=>e.csf),Ve=t(e=>e.flpHome),We=t(e=>e.book),qe=t(e=>e.user),Qe=t(e=>e.network),Xe=null==(le=qe.profile)?void 0:le.email,Ye=null==(te=qe.profile)?void 0:te.id,Ze=null==(ne=qe.profile)?void 0:ne.profile_type,Ke=null==(xe=qe.profile)?void 0:xe.profile_type,el=null==(ke=qe.profile)?void 0:ke.roles,ll=null==el?void 0:el.includes(n.CONTENT_MANAGER),sl=qe.isLoggedIn,al=Qe.online,ol="flp"===E?Ve.isFetchingResource:Je.isFetchingResource,rl="flp"===E?Ve.resourceDetails:Je.resourceDetails,il=Je.isFetchingDownloadLevel,tl=Ve.isDownloading,nl=Je.similarBooks,dl=We.book,cl=We.isFetchingAssets,ul=We.isSupplementary,pl=Ve.isFetchingSimilarGrades,ml=Ve.similarGrades,fl=Ve.enrollmentDetails,gl=Ve.isFlpUserEnrolled,_l=Ve.isJotformVisible,hl=Ve.jotformUrl,vl=Ve.jotformType,wl=Ve.worksheetDetails,xl=Ve.isFlpEnrolModalVisible,jl=Ve.grades,bl=Ve.stage,kl=Ve.story,yl=Ve.pdf,$l=Ve.self,Nl=Ve.showSuccessAnimation,Tl=Ve.nagCount,Il="foundational-literacy-programme"===window.location.pathname.replace(`/${d}`,"").replace(/\/([^/]*).*$/,"$1"),Ll="foundational-literacy"===window.location.pathname.replace(`/${d}`,"").replace(/\/([^/]*).*$/,"$1");oe.useEffect(()=>{"flp"===E&&Le?(Ie(c({bookId:Le,locale:Se,userId:Ye})).then(e=>{const l=(null==e?void 0:e.data)||e;if(null==l?void 0:l.gradeNumber){const e=l.gradeNumber;Ie(u({locale:Se,grade:e,supp:null,userId:Ye})),Ye&&Ie(p({id:Ye,locale:Se})),Ie(m({locale:Se,grade:e,supp:!0})),sl&&Il&&(Ie(f({userId:Ye,locale:Se,grade:e})),Ie(g()))}}).catch(e=>{}),Ie(_({slug:Le,isFlp:Ll}))):Le&&(Ie(h({bookId:Le,locale:Se})).then(e=>{const l=(null==e?void 0:e.data)||e;(null==l?void 0:l.level_number)&&Ie(v({id:Le,level:l.level_number,locale:Se}))}).catch(e=>{}),Ie(_({slug:Le,isCsf:"csf"===E,isFlp:Ll})))},[Ie,Le,Se,E,Ye,sl,Il,Ll]),oe.useEffect(()=>{sl&&Il&&Ye&&(null==rl?void 0:rl.gradeNumber)&&(Ie(f({userId:Ye,locale:Se,grade:rl.gradeNumber})),Ie(c({bookId:Le,locale:Se,userId:Ye})),Ie(p({id:Ye,locale:Se})),Ie(g()))},[Ie,sl,Il,Ye,Se,Le,null==rl?void 0:rl.gradeNumber]),oe.useEffect(()=>{Ke&&Le&&Ie(c({bookId:Le,locale:Se,userId:Ye}))},[Ie,Ke,Le,Se,Ye]),oe.useEffect(()=>{Nl&&"flp"===E&&(null==rl?void 0:rl.gradeNumber)&&(Ge(!0),setTimeout(()=>{Ge(!1),Ie(f({userId:Ye,locale:Se,grade:rl.gradeNumber})).then(()=>{localStorage.setItem("sw-jotform","jotform"+Math.random())})},1500))},[Ie,Nl,E,null==rl?void 0:rl.gradeNumber,Ye,Se]);const Cl=(e,s)=>{e?(Re(!0),Ee(e),window.dataLayer.push({event:"Lesson Plan"===s?"clicked_lesson_plan":"clicked_view_poster",category:"flp"===E?`${l.flpMerge}_${Se}`:`FLP_classroom_${Se}`,label:"Lesson Plan"===s?"book_resources":"reading_strategy",item_type:"lesson_plan_id",item_id:null==rl?void 0:rl.id,item_value:null,user_id:Ye,user_profile:Ze})):Re(!1)},Sl=(e,l,s=!1)=>{const a=[null==Tl?void 0:Tl.grade_1,null==Tl?void 0:Tl.grade_2,null==Tl?void 0:Tl.grade_3];e&&e.preventDefault(),sl&&!(sl&&!gl&&a[parseInt(null==rl?void 0:rl.gradeNumber,10)-1]>=0)||"flp"!==E||s?Dl(l,!1,s):Ie(y({nag:!0,self:!1,story:l,pdf:null}))},Dl=(e,l=!1,a=!1)=>{U.shouldShowMandatoryLogin()&&al?Ie(P({stage:G.mandatoryLogin})):(gl&&(null==fl?void 0:fl.flpEnrollmentId)&&(null==rl?void 0:rl.gradeNumber)&&Ie(O({enrollmentId:fl.flpEnrollmentId,locale:Se,grade:rl.gradeNumber})).then(s=>{const a=(null==s?void 0:s.data)||s;(null==a?void 0:a.storiesStatus)&&("finished"===a.storiesStatus[e.id]||l||Ie(J({storyId:e.id,enrollmentId:fl.flpEnrollmentId,status:"continue",locale:Se})))}).catch(e=>{}),Ae(l),He(a),Ie(V({slug:e.slug,isAudio:l,ignoreCount:!1,isCsf:"csf"===E,isFlpHome:Ll&&"flp"===E,isStem:!1})).then(()=>{Ie(W({book:e,storyId:e.id,showAudioBookReader:l,showAttributionPage:!1,readSource:"flp"===E?B.flpHome:B.csf,readingProgramBook:!0,flpBook:!0,enrollmentId:(null==fl?void 0:fl.flpEnrollmentId)||null}))}).then(()=>{Ye&&Ie(p({id:Ye,locale:Se}))}),window.dataLayer.push({event:l?s.listen:s.startReading,category:"flp"===E?B.flpHome:`FLP_classroom_${Se}`,label:"book_resources",item_type:"book_language_level",item_id:null==rl?void 0:rl.id,item_value:`${null==rl?void 0:rl.language}_${null==rl?void 0:rl.level_number}`,user_id:Ye,user_profile:Ze}),U.storyRead(e.slug))},El=e=>{const{static_content:a}=rl||{};if("flp"===E){if(!sl||!Ye)return void Ie(P());const e=`<a href="mailto:[email protected]">${X.helpMailId}</a>`,o=`<p>${Te("Book.request-is-under-process",{email:X.helpMailId}).replace(X.helpMailId,e)}</p>`;return void Ie(Y({storyId:rl.id,userId:Ye,locale:Se})).then(e=>{e.ok?(window.open(e.url),window.dataLayer.push({event:s.storyDownload,category:`${l.flpMerge}_${Se}`,label:`grade_${rl.gradeNumber}`,item_type:null,item_id:rl.id,item_value:null,user_id:Ye,user_profile:Ze}),Ie(Z({type:"success",content:e.msg||(null==a?void 0:a.downloadSuccessText)||"Download started"}))):e.showStoryGatingFormPdf?Ie(K({showStoryGatingFormPdf:!0,storyId:rl.id,format:"pdf"})):e.showStoryGatingPopupPdf?Ie(Z({id:"Book.request-is-under-process",content:ae.jsx("div",{dangerouslySetInnerHTML:{__html:o}})})):Ie(Z({type:"danger",content:e.msg||(null==a?void 0:a.downloadErrorText)||(null==jl?void 0:jl.downloadError)||"Download failed"}))}).catch(()=>{Ie(Z({type:"danger",content:(null==a?void 0:a.downloadErrorText)||(null==jl?void 0:jl.downloadError)||"Download failed"}))})}Ie(ee({user_id:Ye,level_number:e,locale:Se})).then(s=>{s.ok?(window.open(s.url),Ie(Z({type:"success",content:(null==a?void 0:a.downloadSuccessText)||"Download started"})),window.dataLayer.push({event:"file download (GA recomended)",category:`FLP_classroom_${Se}`,label:l.booksResources,item_type:"level",item_value:e,item_id:null,user_id:Ye,user_profile:Ze})):Ie(Z({type:"danger",content:(null==a?void 0:a.downloadErrorText)||"Download failed"}))})},Fl="pb-csf-resource-container",Rl=[null==Tl?void 0:Tl.grade_1,null==Tl?void 0:Tl.grade_2,null==Tl?void 0:Tl.grade_3];if(ol||!rl||we(rl))return ae.jsx(w,{});const{static_content:Pl,coverImage:Ml,lesson_plan_link:Bl,lessonPlanLink:Al,linkToPoster:zl,worksheetLink:
2Hl,jotformLink:Ul}=rl,Gl=[{title:Pl.breadcrumbHomeText,href:x.home(),isInternal:!0},{title:Pl.breadcrumbFlpText,href:x.csf(Se),isInternal:!0,isLast:!0}],Ol=[{title:Pl.breadcrumbHomeText,href:x.home(),isInternal:!0},{title:Pl.breadcrumbFlpText,href:x.flpHome(Se,$e),isInternal:!0},{title:rl.gradeName,href:x.flpHomeGrades(Se,rl.gradeNumber,$e),isInternal:!0,isLast:!0}],Jl=wl&&wl.includes(rl.id),Vl=Ul&&Ul.split(".").slice(-1)[0],Wl=Ke&&[j[b.STUDENT],j[b.PARENT]].includes(Ke.toLowerCase()),ql=(Wl?!Ul:!Hl)||Wl&&"pdf"!==Vl&&Jl,Ql={[`${Fl}__read-cta-wrapper`]:Oe.medium,[`${Fl}--wc-complete`]:Jl&&Wl},Xl=ae.jsxs("div",{className:`${Fl}__actions-wrapper`,children:[ae.jsx(de,{float:!Oe.large,children:ae.jsx("div",{className:`${Fl}__cta-wrapper`,children:ae.jsxs("div",{className:Oe.medium?null:`${Fl}__action-btns-container`,children:[ae.jsx(k,{fullWidth:Oe.medium,label:Pl.read_story,variant:"primary",onClick:()=>{(!sl||sl&&!gl&&Rl[parseInt(rl.gradeNumber,10)-1]>=0)&&"flp"===E?Ie(y({nag:!0,self:!1,story:dl,pdf:null})):Dl(dl)},loading:cl&&!Be&&!ze&&!ul,size:"m"}),"flp"===E&&rl.isAudio&&"audio_published"===rl.audioStatus&&ae.jsx(k,{fullWidth:Oe.medium,label:Pl.readAlongText,variant:"primary",onClick:()=>Dl(dl,!0),loading:cl&&Be&&!ze&&!ul,size:"m"})]})})}),"flp"===E?ae.jsxs("div",{className:`${Fl}__action-main-container`,children:[Hl&&ae.jsx(k,{variant:ql?"flp-disable":"flp",disabled:ql,onClick:()=>(e=>{const{worksheetLink:l,jotformLink:s}=rl||{};if(sl)if(gl){const a=s&&s.split(".").slice(-1)[0];if(Ke&&[j[b.STUDENT],j[b.PARENT]].includes(Ke.toLowerCase())&&"pdf"!==a){let l;l=window.location.host.includes("storyweaver.org.in")?s:H.dummyJotforms.worksheetDefault,Ie(q({url:`${l}?enrollment_id=${(null==fl?void 0:fl.flpEnrollmentId)||null}&story_id=${e.id}`,type:"worksheet"}))}else Cl(l,Q.worksheet)}else Ie(y({nag:!0,self:!0,pdf:!0}));else Ie(P())})(dl),parentClassName:$(Ql),label:(Wl||!gl&&Ke===j[b.STUDENT])&&Ul&&"pdf"!==Vl?Jl?Pl.worksheetCompletedText:Pl.startWorksheetText:Pl.worksheetText}),Al&&!Wl&&ae.jsx(k,{variant:"flp",onClick:()=>{return e=Al,l=Q.lessonPlan,void(sl?gl?Cl(e,l):Ie(y({nag:!0,self:!0,pdf:!0})):Ie(P()));var e,l},parentClassName:Oe.medium?`${Fl}__read-cta-wrapper`:null,label:Pl.lesson_plan_button})]}):ae.jsxs("div",{className:`${Fl}__action-main-container`,children:[Bl&&ae.jsx(k,{variant:"flp",onClick:()=>Cl(Bl,Q.lessonPlan),parentClassName:Oe.medium?`${Fl}__read-cta-wrapper`:null,label:Pl.lesson_plan_button}),zl&&ae.jsx(k,{variant:"flp",parentClassName:Oe.medium?`${Fl}__read-along-cta-wrapper`:null,onClick:()=>Cl(zl,Q.poster),label:Pl.posterButton})]})]}),Yl=ml&&ml.stories?ml.stories.filter(e=>e&&null!==e.lesson_plan_link).sort((e,l)=>e.flpLevel<l.flpLevel?-1:1):[],Zl=ml&&ml.stories?ml.stories.filter(e=>e&&null===e.lesson_plan_link).sort((e,l)=>e.flpLevel<l.flpLevel?-1:1):[],Kl=ml&&ml.stories?ml.stories.slice().sort((e,l)=>e.flpLevel<l.flpLevel?-1:1):[],es=Wl?Kl:Yl.concat(Zl);return ae.jsxs("div",{className:`${Fl}`,children:[ae.jsxs(N,{children:[ae.jsx("meta",{property:"og:title",content:rl.name}),ae.jsx("meta",{property:"og:description",content:rl.description}),ae.jsx("meta",{property:"og:image",content:T(Ml.sizes).url}),ae.jsx("meta",{property:"og:url",content:window.location.href}),ae.jsx("meta",{name:"twitter:card",content:I(Ml.sizes).url})]}),Pl&&ae.jsx(ce,{paths:"flp"===E?Ol:Gl,parentClassName:`${Fl}__brd-crumb`}),ae.jsxs(re,{parentClassName:`${Fl}`,children:[ae.jsxs("div",{className:`${Fl}__wrapper`,children:[ae.jsxs("div",{className:`${Fl}__image-wrapper`,children:[ae.jsx(ue,{parentClassName:`${Fl}__image`,image:Ml,alt:"title",lazyLoad:!0,sizes:L.grid4up}),ae.jsx("div",{className:`${Fl}__tag-el`,children:ae.jsx("span",{children:Pl.level})}),ae.jsx(C,{isInternal:!1,parentClassName:`${Fl}__link`,onClick:e=>Sl(e,dl,!1),href:x.resourceDetails(rl.id,Se,$e)})]}),ae.jsxs("div",{className:`${Fl}__resource-wrapper`,children:[ae.jsx("h1",{className:`${Fl}__title`,children:rl.name}),ae.jsx("p",{children:rl.description}),"flp"===E&&ae.jsxs("div",{className:`${Fl}__outcome`,children:[ae.jsx("p",{className:`${Fl}__outcome-title`,children:Pl.learningOutcomeText}),ae.jsx("p",{children:rl.learningOutcome})]}),!Oe.medium&&Xl,ae.jsx(ie,{separator:!0,borderTop:!0,borderBottom:!Oe.medium,children:ae.jsxs(S,{inline:!0,parentClassName:`${Fl}__actions`,children:["flp"===E&&!Wl&&ae.jsx("div",{className:`${Fl}__reading-strategies`,children:ae.jsx(D,{align:"left",toggleEl:ae.jsx(C,{children:ae.jsx(F,{name:"information",size:"m"})}),children:ae.jsxs(S,{nowrap:!0,alignRight:Ne,children:[ae.jsx("p",{className:`${Fl}__reading-heading`,children:Pl.useBookText}),ae.jsx("div",{className:`${Fl}__reading-menu`,children:rl.readingStrategies&&rl.readingStrategies.map((e,l)=>ae.jsxs("div",{className:`${Fl}__read-menu`,children:[ae.jsx("div",{children:ae.jsx("img",{src:e.image,alt:"reading-strategy-svg"})}),ae.jsx("p",{children:e.name})]},l))})]})})}
2),"flp"===E?sl?ae.jsxs(C,{onClick:()=>El(),children:[tl?ae.jsx(R,{}):ae.jsx(F,{name:"download",title:Te("SvgTitle.download"),size:"m",pushRight:!0}),Pl.download_stories]}):ae.jsx(pe,{t:Te,baseClassName:Fl,align:"left",parentClassName:`${Fl}__auth-dropdown`,openAuthModal:()=>Ie(P()),toggleEl:ae.jsxs(C,{children:[ae.jsx(F,{name:"download",title:Te("SvgTitle.download"),size:"m",pushRight:!0}),Pl.download_stories]}),loginText:Te("DownloadsDropdown.please-log-in"),isRtl:Ne}):ll&&ae.jsxs(C,{onClick:()=>El(rl.level_number),children:[il?ae.jsx(R,{}):ae.jsx(F,{name:"download",title:Te("SvgTitle.download"),size:"m",pushRight:!0}),Pl.download_stories]}),ae.jsx(me,{csfTitle:Pl.share_button,title:rl.name,viewport:Oe,align:"right",onClick:e=>{window.dataLayer.push({label:`share_${null==rl?void 0:rl.id}`,category:"flp"===E?l.flpHome:`FLP_classroom_${Se}`,event:`clicked_${e.slice(5).toLowerCase()}`,item_type:null,item_id:null,item_value:null,user_profile:Ze,user_id:Ye||"00000"})},shareText:Pl.share_button,href:"flp"===E?encodeURIComponent(window.location.href):window.location.origin+x.csfLevelshareUrl(rl.level_number,Se),whatsAppDisplayText:Pl.whatsappText,twitterDisplayText:Pl.twitterText,facebookDisplayText:Pl.facebookText,telegramDisplayText:Pl.telegramText})]})})]}),Oe.medium&&Xl]}),"flp"===E?ml&&ml.stories&&!pl&&ae.jsx("div",{className:`${Fl}__similar`,children:ae.jsx(ge,{background:"transparent",title:Pl.similar_stories,children:ae.jsx(M,{variant:Oe.medium?"5up":"2up-6up",children:es&&es.length>0?es.map(e=>ae.jsx(fe,{book:e,resource:!Wl&&e.lesson_plan_link,nag:!1,hideDeleteOfflineRpIcon:!0,eventCategory:`${l.flpMerge}_${Se}`,eventLabel:`grade_${rl.gradeNumber}`,readSource:B.flpHome,flpBook:!0,isSupplementary:!0,flpLevel:e.flpLevel,onClick:l=>Sl(l,e,!0)},e.slug)):ae.jsx(w,{})})})}):nl&&ae.jsx(je,{t:Te,viewport:Oe,title:Pl.similar_stories,similarBooks:nl,program:E,userId:Ye,userType:Ze})]}),Fe&&ae.jsx(oe.Suspense,{fallback:null,children:ae.jsx(be,{pdfFile:De,viewport:Oe,onClose:()=>Cl("")})}),_l&&ae.jsx(ve,{url:hl,viewport:Oe,closeJotformModal:()=>Ie(A()),lang:Se,grade:rl.gradeNumber,enrollmentDetails:fl,jotformType:vl,checkFlpEnrollStatus:(e,l,s)=>Ie(f({userId:e,locale:l,grade:s})),userId:Ye}),xl?ae.jsx(he,{nag:bl,selfNag:$l,story:kl,pdf:yl,enrollmentData:null==jl?void 0:jl.enrollmentFormDailog,grade:rl.gradeNumber,locale:Se,ps:$e,onClose:()=>((e=null,l=null)=>{l?Ie(se()):(Ie(se()),e&&Dl(e,!1,null))})(kl,yl),count:Rl[parseInt(rl.gradeNumber,10)-1]}):null,Ue?ae.jsx(z,{noContentPadding:!0,parentClassName:`${Fl}__modal-lottie`,lottie:!0,children:ae.jsx("img",{className:`${Fl}__success-gif`,src:H.animation,alt:"success"})}):null,ae.jsx(_e,{isVisible:Pe.download,onCloseClicked:()=>{return e="download",void Me(l=>({...l,[e]:!1}));var e},onFormLinkClicked:()=>{Me(e=>({...e,download:!1}))},userEmail:Xe})]})};export{Te as default};
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.