(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[52720],{51:(r,t,e)=>{"use strict";e.r(t),e.d(t,{default:()=>w});var a=e(95155),o=e(12115),n=e(98500),s=e.n(n),c=e(16099),i=e(67972),h=e(39267),l=e(88020);function w(){let[r,t]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let r,e,{accessToken:a,refreshToken:o}=(e=(r=window.location.hash?.startsWith("#")?window.location.hash.slice(1):"")?new URLSearchParams(r):null,{accessToken:e?.get("accessToken")??null,refreshToken:e?.get("refreshToken")??null});a&&o?(0,l.yO)(a,o)?(window.history.replaceState({},"",window.location.pathname),h.jp().then(r=>{r?.role==="ADMIN"?window.location.replace(c.bw.ADMIN):window.location.replace((0,i.pF)())}).catch(()=>{(0,l.Jw)(),t("Session could not be restored. Please try logging in again.")})):t("Unable to save session on this device. Please try again."):t("Missing login tokens. Please try again.")},[]),(0,a.jsx)("div",{className:"min-h-screen bg-gradient-to-b from-white via-[#fff5f6] to-[#fde8ea] flex items-center justify-center px-4",children:(0,a.jsx)("div",{className:"w-full max-w-sm rounded-none border border-gray-200 bg-white shadow-md p-6",children:r?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Google login failed"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:r}),(0,a.jsx)(s(),{className:"text-sm font-medium text-primary-700 hover:underline",href:c.bw.LOGIN,children:"Go to login"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Signing you in…"}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"Please wait."})]})})})}},39267:(r,t,e)=>{"use strict";e.d(t,{BD:()=>y,Be:()=>w,E$:()=>S,Ji:()=>d,RY:()=>c,Ty:()=>i,az:()=>g,ec:()=>p,iD:()=>h,jp:()=>u,kz:()=>s,r7:()=>m,ri:()=>l,xw:()=>E});var a=e(59185),o=e(76541),n=e(16099);let s=async r=>{try{let t=await o.uE.post(n.Sn.AUTH.REGISTER,r);return(0,o.yH)(t)}catch(r){throw Error((0,o.hS)(r))}},c=async r=>{try{let t=await o.uE.post(n.Sn.AUTH.VERIFY_OTP,r);return(0,o.yH)(t)}catch(r){throw Error((0,o.hS)(r))}},i=async(r,t)=>{try{await o.uE.post(n.Sn.AUTH.RESEND_OTP,{email:r,...t&&{otpChannel:t}})}catch(r){throw Error((0,o.hS)(r))}},h=async r=>{try{let t=await o.uE.post(n.Sn.AUTH.LOGIN,r);return(0,o.yH)(t)}catch(r){throw Error((0,o.hS)(r))}},l=async()=>{try{await o.uE.post(n.Sn.AUTH.LOGOUT)}catch(r){throw Error((0,o.hS)(r))}},w=async r=>{try{let t=await o.uE.post(n.Sn.AUTH.REFRESH_TOKEN,r);return(0,o.yH)(t)}catch(r){throw Error((0,o.hS)(r))}},y=async r=>{try{await o.uE.post(n.Sn.AUTH.FORGOT_PASSWORD,r)}catch(r){throw Error((0,o.hS)(r))}},E=async r=>{try{await o.uE.post(n.Sn.AUTH.RESET_PASSWORD,r)}catch(r){throw Error((0,o.hS)(r))}},u=async()=>{try{let r=await o.uE.get(n.Sn.AUTH.ME),t=(0,o.yH)(r);if(t.workspaceSlug){let{persistWorkspaceSlug:r}=await Promise.resolve().then(e.bind(e,57496));r(t.workspaceSlug)}return t.user}catch(r){if(a.A.isAxiosError(r))throw r;throw Error((0,o.hS)(r))}},S=async()=>{try{let r=await o.uE.get(n.Sn.AUTH.PROFILE);return(0,o.yH)(r)}catch(r){throw Error((0,o.hS)(r))}},d=async()=>{try{let r=await o.uE.get(n.Sn.AUTH.PARENT_DASHBOARD);return(0,o.yH)(r)}catch(r){throw Error((0,o.hS)(r))}},g=async r=>{try{let t=await o.uE.post(n.Sn.AUTH.LINK_CHILD,{studentCode:r});return(0,o.yH)(t)}catch(r){throw Error((0,o.hS)(r))}},m=async r=>{try{let t=await o.uE.put(n.Sn.AUTH.PROFILE,r);return(0,o.yH)(t)}catch(r){throw Error((0,o.hS)(r))}},p=async r=>{try{await o.uE.post(n.Sn.AUTH.CHANGE_PASSWORD,r)}catch(r){throw Error((0,o.hS)(r))}}},72251:(r,t,e)=>{Promise.resolve().then(e.bind(e,51))}},r=>{r.O(0,[92619,59185,98500,76541,28441,93794,77358],()=>r(r.s=72251)),_N_E=r.O()}]);