1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9915],{67590:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/new-courses/[id]/content/[subjectId]",function(){return n(52198)}])},52198:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return m}});var r=n(47568),c=n(29815),o=n(97582),s=n(85893),u=n(47041),a=n(11163),i=n(67294),l=n(99209),d=n(92817),p=n(74052),h=n(51067),f=n(72699),v=n(89885),C=n(29823),g=n(45508),b=n(93520),I=n(1533),w=n(14753),_=n(92175),S=n(24271),k=n(96486),N=n(58533);function m(e){var t=e.course,n=e.courseId,d=e.subjectId,g=e.chapters,m=e.api,x=e.lcId,E=(0,i.useState)("INITIAL"),y=E[0],R=E[1],j=(0,i.useState)(),A=j[0],O=j[1],T=(0,i.useState)(),Z=T[0],M=T[1],L=(0,i.useState)(),P=L[0],D=L[1],B=(0,i.useState)(),q=B[0],W=B[1],z=(0,i.useState)(!1),F=z[0],Q=z[1],U=(0,i.useState)(!1),V=U[0],X=U[1],Y=(0,i.useState)(0),G=Y[0],H=Y[1],J=(0,i.useRef)(new Map),K=(0,i.useRef)(null),$=(0,i.useContext)(v.Z).appConfig,ee=(0,a.useRouter)();(0,i.useEffect)((function(){$&&!(0,b.hb)($.isWindowsApp)&&"0"==t.view_in_web&&ee.replace("/purchases")}),[$]),(0,i.useEffect)((function(){(0,b.hb)(t.is_paid)||ee.replace("/new-courses/".concat(n))}),[t]),(0,i.useEffect)((function(){x&&(0,l.OF)({lcId:x,lcApi:m}).then((function(e){(0,k.isEmpty)(e)||(0,S.G5)(e,"[LINKEDCOURSE-".concat(11,"-").concat(x,"]"))})).catch((function(e){}))}),[x,m]);var te=(0,i.useCallback)(function(){var e=(0,r.Z)((function(e){var t,r,c,s,a,i,p,h,f,v,g=arguments;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:return t=g.length>1&&void 0!==g[1]?g[1]:{},r=t.force,c=void 0!==r&&r,s=null===e||void 0===e?void 0:e.topicid,c&&s&&J.current.delete(s),a=!c&&s?J.current.get(s):null,O(e),M(void 0),a?(D(a.concepts),W(a.records),H(a.start),Q(a.hasMore),R(a.screen),X(!1),[2]):(W([]),H(0),Q(!1),i=m||(0,u.getCookie)(C.z1),[4,(0,l.f4)(i,n,d,s)]);case 1:if((null===(p=o.sent())||void 0===p?void 0:p.length)>0)return D(p),R("CONCEPTS"),J.current.set(s,{concepts:p,records:[],start:0,hasMore:!1,screen:"CONCEPTS"}),[2];X(!0),o.label=2;case 2:return o.trys.push([2,4,5,6]),h=(0,b.hb)($.isWindowsApp),[4,(0,l.Q6)(i,$.web_apiurl,x,n,d,s,"",h,0)];case 3:return f=o.sent(),v=(null===f||void 0===f?void 0:f.data)||f||[],W(v),H(v.length),Q(v.length>0),R("RECORDS"),J.current.set(s,{concepts:[],records:v,start:v.length,hasMore:v.length>0,screen:"RECORDS"}),[3,6];case 4:return o.sent(),W([]),Q(!1),[3,6];case 5:return X(!1),[7];case 6:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}(),[m,$.isWindowsApp,$.web_apiurl,n,x,d]);(0,i.useEffect)((function(){var e=ee.query.topicId;if(e&&(null===g||void 0===g?void 0:g.length)&&K.current!==e){var t=g.find((function(t){return String(t.topicid)===String(e)}));t&&(K.current=e,te(t))}}),[ee.query.topicId,g,te]);var ne=(0,i.useCallback)(function(){var e=(0,r.Z)((function(e){var t,r,c,s,a,i,p,h,f,v,g=arguments;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:if(t=g.length>1&&void 0!==g[1]?g[1]:{},r=t.force,c=void 0!==r&&r,s=null===A||void 0===A?void 0:A.topicid,a=s?"".concat(s,":").concat(e.conceptid):null,c&&(a&&J.current.delete(a),s&&J.current.delete(s)),i=!c&&a?J.current.get(a):null,M(e),W([]),H(0),Q(!1),i)return W(i.records),H(i.start),Q(i.hasMore),R("RECORDS"),X(!1),[2];X(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),p=m||(0,u.getCookie)(C.z1),h=!!(0,b.hb)($.isWindowsApp)||null,[4,(0,l.Q6)(p,$.web_apiurl,x,n,d,s,e.conceptid,h,0)];case 2:return f=o.sent(),v=(null===f||void 0===f?void 0:f.data)||f||[],W(v),H(v.length),Q(v.length>0),R("RECORDS"),a&&(J.current.set(a,{records:v,start:v.length,hasMore:v.length>0}),J.current.set(s,{concepts:P,records:v,start:v.length,hasMore:v.length>0,screen:"RECORDS"})),[3,5];case 3:return o.sent(),W([]),Q(!1),[3,5];case 4:return X(!1),[7];case 5:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}(),[m,$.isWindowsApp,$.web_apiurl,P,n,x,null===A||void 0===A?void 0:A.topicid,d]),re=(0,i.useCallback)((0,r.Z)((function(){var e,t,r,s;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:if(V)return[2];X(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),e=m||(0,u.getCookie)(C.z1),t=!!(0,b.hb)($.isWindowsApp)||null,[4,(0,l.Q6)(e,$.web_apiurl,x,n,d,A.topicid,(null===Z||void 0===Z?void 0:Z.conceptid)||"",t,G)];case 2:return r=o.sent(),(s=(null===r||void 0===r?void 0:r.data)||r||[]).length>0?(W((function(e){var t=(0,c.Z)(e).concat((0,c.Z)(s)),n=null===A||void 0===A?void 0:A.topicid,r=(null===Z||void 0===Z?void 0:Z.conceptid)?"".concat(n,":").concat(Z.conceptid):null;return n&&J.current.set(n,{concepts:P,records:t,start:t.length,hasMore:!0,screen:"RECORDS"}),r&&J.current.set(r,{records:t,start:t.length,hasMore:!0}),t})),H((function(e){return e+s.length})),Q(!0)):Q(!1),[3,5];case 3:return o.sent(),Q(!1),[3,5];case 4:return X(!1),[7];case 5:return[2]}}))})),[m,$.isWindowsApp,$.web_apiurl,P,n,x,V,null===A||void 0===A?void 0:A.topicid,null===Z||void 0===Z?void 0:Z.conceptid,G,d]),ce={INITIAL:{title:"Select Chapter",component:function(){return(0,s.jsx)(p.Z,{chapters:g,onChapterSelected:te})},onBack:function(){return ee.back()}},CONCEPTS:{title:"Select Concept",component:function(){return(0,s.jsx)(h.Z,{concepts:P,onConceptSelected:ne})},onBack:function(){R("INITIAL"),H(0)}},RECORDS:{title:"".concat(Z?null===Z||void 0===Z?void 0:Z.concept_name:null===A||void 0===A?void 0:A.topic_name," - View Videos and PDF's"),component:function(){return 0!==q.length||F||V?(0,s.jsx)(N.Z,{className:"overflow-x-hidden overflow-y-auto",dataLength:q.length,next:re,hasMore:F,loader:(0,s.jsx)("div",{className:"text-center p-4",children:"Loading..."}),endMessage:null,children:(0,s.jsx)("div",{className:"flex flex-col gap-3 py-2",children:(0,s.jsx)(f.Z,{notCarousel:!0,records:q,courseId:n,refreshData:function(){return Z?ne(Z,{force:!0}):te(A,{force:!0})}})})}):(0,s.jsxs)("div",{className:"text-center p-4",children:["No records found for this ",Z?"concept":"chapter","."]})},onBack:function(){R(Z?"CONCEPTS":"INITIAL"),H(0)}}},oe="INITIAL"===y?[{label:t.course_name,onClick:function(){return ee.push("/new-courses/".concat(n,"/content"))}},{label:"Chapters"}]:"CONCEPTS"===y?[{label:t.course_name,onClick:function(){return ee.push("/new-courses/".concat(n,"/content"))}},{label:(null===A||void 0===A?void 0:A.topic_name)||"Chapter",onClick:ce.INITIAL.onBack},{label:"Concepts"}]:[{label:t.course_name,onClick:function(){return ee.push("/new-courses/".concat(n,"/content"))}}].concat((0,c.Z)(Z?[{label:(null===A||void 0===A?void 0:A.topic_name)||"Chapter",onClick:ce.CONCEPTS.onBack},{label:(null===Z||void 0===Z?void 0:Z.concept_name)||"Concept"}]:[{label:(null===A||void 0===A?void 0:A.topic_name)||"Chapter"}]));if((0,_.AU)($)){var se=ee.query.lcId?{api:ee.query.api,lcId:ee.query.lcId}:{},ue="INITIAL"===y?function(){return ee.push({pathname:"/new-courses/".concat(n,"/content"),query:se})}:ce[y].onBack;return(0,s.jsx)(w.Z,{course:t,courseId:n,subjectId:d,chapters:g,currentScreen:y,selectedChapter:A,selectedConcept:Z,concepts:P,records:q,hasMore:F,loading:V,loadMoreRecords:re,onChapterSelect:te,onConceptSelect:ne,onBack:ue,api:m,lcId:x,isFolderCourse:1})}return(0,s.jsxs)("div",{className:"mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 py-6 lg:gap-8 lg:py-12",children:[(0,s.jsx)(I.Z,{items:oe,onBack:ce[y].onBack}),(0,s.jsx)("div",{className:"rounded-2xl border border-border bg-secondary dark:bg-accent p-4",children:ce[y].component()})]})}m.getInitialProps=function(){var e=(0,r.Z)((function(e){var t,n,r,c,s;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:if(t=e.query,n=e.res,r=t.api?(0,g.NA)(t.api):(0,u.getCookie)(C.z1,e),!(0,u.getCookie)(C.JR,e))return[2,{statusCode:401}];c=[],o.label=1;case 1:return o.trys.push([1,3,,4]),[4,(0,d.Yt)(r,t.id,t.lcId,(0,u.getCookie)(C.z1,e))];case 2:return c=o.sent(),[3,4];case 3:return o.sent(),[3,4];case 4:if(!(null===c||void 0===c?void 0:c.length))return[2,{statusCode:404}];if(!(0,b.hb)(c[0].is_paid)){if(!n)return[2,{statusCode:1008,message:"Course Not Purchased",description:"You don't have access to this course"}];n.writeHead(307,{Location:"/new-courses/".concat(t.id)}),n.end()}s=[],o.label=5;case 5:return o.trys.push([5,7,,8]),[4,(0,l.Uo)(r,t.id,t.subjectId)];case 6:return s=o.sent(),[3,8];case 7:return o.sent(),[3,8];case 8:return s&&(null===s||void 0===s?void 0:s.length)?[2,{course:c[0],courseId:t.id,subjectId:t.subjectId,chapters:s,api:r||"",lcId:t.lcId}]:[2,{statusCode:404}]}}))}));return function(t){return e.apply(this,arguments)}}()}},function(e){e.O(0,[4885,9412,8534,7432,5495,614,5675,6436,2965,1483,8404,4288,6661,7340,1580,4028,8727,366,4898,5328,4380,7518,5531,445,9756,6157,3974,7131,4420,6086,2009,5689,797,9774,2888,179],(function(){return t=67590,e(e.s=t);var t}));var t=e.O();_N_E=t}]);
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.