1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[95278,1847],{99846:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/parent-portal",function(){return t(73383)}])},73383:function(e,s,t){"use strict";t.r(s),t.d(s,{__N_SSP:function(){return L}});var r=t(11527),i=t(80199),o=t(31248),n=t(50959),u=t(76686),l=t(43864),a=t(81776),d=t(13318),c=t(54487),_=t(81048),p=t(9238),h=t(17511),f=t(75143),m=t(89852),y=t(40217),g=t(84283),w=t(12312),v=t(48779),j=t(27604),S=t(5768),x=t(77856),k=t(12452),P=t(94259),A=t(18968),b=t(35802),C=t(43763),E=t(31135),N=t(14224),L=!0;s.default=e=>{let{cookieRegion:s}=e,{user:t,userProfile:L,isSubscribed:U,switchUser:O,selectedChildId:R,token:D,setSelectedChildId:M,isAuthCompleted:X}=(0,_.Ry)(),{cardModal:$,setCardModal:T}=(0,d.wh)(),[Z,I]=(0,n.useState)(S.H),[Q,B]=(0,n.useState)({isError:!1,errorInfo:"",title:""}),{tabModal:W,setTabModal:q}=(0,c.l)(),H=(0,o.useRouter)(),{query:J}=H,Y=(0,n.useRef)([]),[G,K]=(0,n.useState)(""),[V,z]=(0,n.useState)([]);Y.current=V;let[F,ee]=(0,n.useState)(void 0);(0,n.useEffect)(()=>{let e=Array.isArray(J.user_id)?J.user_id[0]:J.user_id;e&&0!==V.length&&V.some(s=>s.user_id===Number(e))&&Number(e)!==R&&M(Number(e))},[J.user_id,V,R,M]),(0,n.useEffect)(()=>{F&&(F.studyplan_id&&Array.isArray(F.studyplan_id)&&F.studyplan_id.length>0&&"my_courses"!==J.view?q(x.AO.Activity):q(x.AO.MyCourses))},[J.view,F,q]);let es=(0,n.useCallback)(async(e,s)=>{let r=await (0,E.Nh)(e.toString(),s);if(r.success){var i;K(`https://www.studypug.com${N.env.NEXT_PUBLIC_BASE_PATH??""}${(0,P.VQ)(P.qX.SIGNIN_MIDDLEWARE,null==t?void 0:t.getRegion())}?${l.SW}=${e}&${l.Dc}=${null===(i=r.data)||void 0===i?void 0:i.token}`)}},[t]);(0,n.useEffect)(()=>{($===d.sj.UserQRCode||$===d.sj.ShareAccessLink)&&R&&D&&es(R,D)},[R,D,$,es]),(0,n.useEffect)(()=>{if(!L||!R||!D)return;let e=!1;return(async()=>{let[s,t]=await Promise.all([(0,E.wA)(R,D).catch(e=>null),(0,E.et)(R,D).catch(e=>null)]);if(!e){if((null==s?void 0:s.success)&&(0,C.DX)(s.data)){let e=s.data.my_courses_info,t=s.data.my_courses,r=[];for(let s of t){let t=e.filter(e=>e.studyplan_id===s);t.length>0&&r.push(t[0])}r.length>0&&I(r[r.length-1])}if((null==t?void 0:t.success)&&(0,C.DX)(t.data)){let e=t.data,s=e.misc_json?JSON.parse(e.misc_json):{},r=Object.entries(s.my_course_data??{}).map(e=>{let[s,t]=e;return{...t,studyplan_id:s}});ee({user_id:e.id,first_name:e.first_name,last_name:e.last_name,photo_url:e.photo_url,photo_key:e.photo_key,primary_role:e.primary_role,email:e.email,grade:e.grade,studyplan_id:s.my_courses??[],user_guid:e.guid,daily_access:e.daily_access,has_pw:e.has_pw,region:e.region,sso_apple:e.sso_apple,sso_google:e.sso_google,sso_facebook:e.sso_facebook,my_course_data:r})}}})(),()=>{e=!0}},[R,D,L]);let et=(0,n.useMemo)(()=>({src:(0,C.DX)(null==L?void 0:L.photo_url)?null==L?void 0:L.photo_url:void 0,title:"Parent Portal | StudyPug",description:"Manage your children's StudyPug accounts, monitor progress, and switch between profiles from the parent portal.",overflowX:"hidden",overflowY:"hidden",position:"relative",height:"100%",id:"dashboadContainer",headerBg:v.kx.beige[300],userProfileList:V,setChildProfileList:z}),[null==L?void 0:L.photo_url,V]),er=(0,n.useMemo)(()=>({user_id:(null==L?void 0:L.user_id)??0,first_name:(null==L?void 0:L.first_name)??"",photo_key:(null==L?void 0:L.photo_key)??null,photo_url:(null==L?void 0:L.photo_url)??null}),[null==L?void 0:L.user_id,null==L?void 0:L.first_name,null==L?void 0:L.photo_url,null==L?void 0:L.photo_key]),ei=async(e,s)=>{(0,A.D$)("parentUserProfile",L?JSON.stringify(er):"");let t=await (0,E.Zl)(e,s);t.success&&O(t.data.apikey,e=>{e&&(T(d.sj.Empty),window.location.assign(a.Cu))})},eo=(0,n.useMemo)(()=>({sx:{borderRadius:"16px",background:"transparent",maxHeight:"90vh",maxWidth:$===d.sj.UserList?"95vw":void 0,minWidth:$===d.sj.UserList?{xs:"95vw",sm:"400px",md:"500px"}:void 0,margin:0,overflow:"auto"}}),[$]),en=(0,n.useMemo)(()=>{switch(W){case x.AO.MyCourses:if(!F)return null;return(0,r.jsx)(g.default,{userProfile:F});case x.AO.Assessment:return(0,r.jsx)(y.default,{studyplan_id:Z.studyplan_i
1d});case x.AO.Activity:default:return(0,r.jsx)(m.Z,{currentStudyPlan:Z})}},[W,F,Z]);return((0,n.useEffect)(()=>{if(X&&t&&L){if(!U){H.push(a.bC+(L.region||"us"));return}if(t.isStudent()){H.push(a.Cu);return}if(t.isTeacher()){H.push(a.J_);return}if(!(J.user_id||H.pathname.includes("/profiles"))&&0===V.length&&0===R){let e=setTimeout(()=>{0===Y.current.length&&H.push(a.Bq)},500);return()=>clearTimeout(e)}}},[X,U,L,t,R,V.length,s]),L&&D)?(0,r.jsxs)(h.Z,{...et,children:[(0,r.jsx)("h1",{style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:"Parent Portal"}),en,(0,r.jsxs)(i.default,{open:$===d.sj.UserSwitch||$===d.sj.UserQRCode||$===d.sj.ShareAccessLink||$===d.sj.UserList,onClose:()=>T(d.sj.Empty),PaperProps:eo,children:[F?(0,r.jsx)(p.ZP,{isSubscribed:U,display:$===d.sj.UserSwitch||$===d.sj.UserQRCode||$===d.sj.ShareAccessLink?"flex":"none",userProfile:F,authStudent:()=>{F&&ei(F.user_guid,D),(0,k.Yo)("click_swith_to_profile","learning_on_device",a.mp)},onClick:()=>{(0,b._)(t,T,j.N.qrCode,a.mp)},QRLink:G}):$!==d.sj.Empty&&$!==d.sj.ParentAuth&&$!==d.sj.UserList&&(0,r.jsx)(w.$K,{flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",gap:16,padding:"32px",children:(0,r.jsx)(u.Z,{width:"100px"})}),(0,r.jsx)(f.Z,{display:$===d.sj.UserList?"flex":"none"})]})]}):(0,r.jsx)(u.Z,{width:"100%"})}}},function(e){e.O(0,[2510,18881,85139,45374,46514,37630,79874,42748,15908,37394,89521,82014,31851,38908,31513,30027,38722,17165,30808,36157,81307,66237,65669,92481,54530,92888,49774,40179],function(){return e(e.s=99846)}),_N_E=e.O()}]);
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.