(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18566,(e,t,i)=>{t.exports=e.r(76562)},40334,e=>{"use strict";e.i(1465);var t=e.i(34991),i=e.i(59141);let s={PENDING:"Pending",APPROVED:"Approved"};async function n(e){let s=(0,i.getFirebaseDatabase)(),n=await (0,t.get)((0,t.ref)(s,`GAPUsers/${e}`));if(!n.exists())return null;let r=n.val();return"string"==typeof r?.status?r.status:null}function r(e){return e===s.APPROVED}e.s(["GAP_USER_STATUS",0,s,"getGapUserStatus",()=>n,"isApprovedGapUser",()=>r])},64949,e=>{"use strict";var t=e.i(71645),i=e.i(59141);function s(){return(0,t.useEffect)(()=>{(0,i.initFirebaseAnalytics)()},[]),null}e.s(["FirebaseAnalyticsInit",()=>s])},54149,e=>{"use strict";var t=e.i(43476),i=e.i(71645),s=e.i(18566);e.i(51718);var n=e.i(18357),r=e.i(59141),a=e.i(40334);function l(e){let t=e&&""!==e?e.length>1&&e.endsWith("/")?e.slice(0,-1):e:"/";return!!("/"===t||"/login"===t||t.startsWith("/signup"))}function u({children:e}){let u=(0,s.usePathname)(),c=(0,s.useRouter)(),[o,d]=(0,i.useState)(!1),[g,p]=(0,i.useState)(null),h=l(u);return((0,i.useEffect)(()=>{if(h)return void d(!0);d(!1);let e=!1;try{let t=(0,r.getFirebaseAuth)(),i=(0,n.onAuthStateChanged)(t,async i=>{if(!e){if(!i){p(null),d(!0);let e=window.location.search,t=(u||"/")+(e&&"?"!==e?e:"");c.replace(`/login/?returnTo=${encodeURIComponent(t)}`);return}try{let e=await (0,a.getGapUserStatus)(i.uid);if(!(0,a.isApprovedGapUser)(e)){await (0,n.signOut)(t),p(null),d(!0),c.replace("/login/?reason=pending");return}p(i),d(!0)}catch{await (0,n.signOut)(t),p(null),d(!0),c.replace("/login/")}}});return()=>{e=!0,i()}}catch{d(!0),c.replace("/login/")}},[h,u,c]),h)?(0,t.jsx)(t.Fragment,{children:e}):o?g?(0,t.jsx)(t.Fragment,{children:e}):(0,t.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-slate-950 px-6 text-sm text-slate-400",children:"Redirecting to sign in…"}):(0,t.jsxs)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3 bg-slate-950 px-6 text-slate-300",children:[(0,t.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-sky-400 border-t-transparent","aria-hidden":!0}),(0,t.jsx)("p",{className:"text-sm",children:"Checking your session…"})]})}e.s(["RequireAuth",()=>u,"isPublicPath",()=>l])}]);