(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{172:(e,t,r)=>{"use strict";r.d(t,{default:()=>i});var n=r(5155),s=r(2115),l=r(1194),a=r(4465),o=r(2528);let c=e=>{let{isWarning:t,remainingSeconds:r,onStayLoggedIn:c,onLogout:i}=e,{logout:u}=(0,o.A)();return(0,s.useEffect)(()=>{},[t,r,c,i]),(0,n.jsx)(l.A,{isOpen:t,onClose:c,title:"Session Timeout Warning",closeOnEsc:!1,closeOnOverlayClick:!1,children:(0,n.jsxs)("div",{className:"text-center space-y-6",children:[(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Your session is about to expire"}),(0,n.jsx)("p",{className:"text-gray-600",children:"Due to inactivity, you will be automatically logged out in:"}),(0,n.jsx)("div",{className:"text-3xl font-bold text-red-600",children:(e=>{let t=Math.floor(e/60);return"".concat(t.toString().padStart(2,"0"),":").concat((e%60).toString().padStart(2,"0"))})(r)}),(0,n.jsx)("p",{className:"text-gray-600",children:"Would you like to stay logged in or log out now?"}),(0,n.jsxs)("div",{className:"flex justify-center space-x-4 pt-4",children:[(0,n.jsx)(a.A,{onClick:()=>{i&&i(),u()},variant:"secondary",children:"Log Out Now"}),(0,n.jsx)(a.A,{onClick:c,variant:"primary",children:"Stay Logged In"})]})]})})},i=()=>{let{user:e,logout:t}=(0,o.A)(),r=(0,s.useRef)(null),l=!!e,{isWarning:a,remainingSeconds:i,stayLoggedIn:u,logoutNow:d,resetTimer:m}=function(e){let{inactivityTimeout:t=18e5,warningTimeout:r=6e4,onWarning:n,onTimeout:l,enabled:a=!0}=e,[o,c]=(0,s.useState)(!1),[i,u]=(0,s.useState)(Math.floor(r/1e3)),d=(0,s.useRef)(null),m=(0,s.useRef)(null),x=(0,s.useRef)(null),h=(0,s.useRef)(Date.now()),f=(0,s.useRef)(!1),v=(0,s.useRef)(n),g=(0,s.useRef)(l);(0,s.useEffect)(()=>{v.current=n,g.current=l},[n,l]);let b=(0,s.useCallback)(()=>{d.current=setTimeout(()=>{c(!0),u(Math.floor(r/1e3)),v.current&&v.current()},t)},[t,r]),y=(0,s.useCallback)(()=>{h.current=Date.now(),d.current&&clearTimeout(d.current),m.current&&clearTimeout(m.current),x.current&&clearInterval(x.current),o?(c(!1),setTimeout(()=>{b()},100)):b()},[o,b]),w=(0,s.useCallback)(()=>{c(!1),m.current&&clearTimeout(m.current),x.current&&clearInterval(x.current),y()},[y]),p=(0,s.useCallback)(()=>{g.current&&g.current()},[]);return(0,s.useEffect)(()=>{if(!a){d.current&&(clearTimeout(d.current),d.current=null),m.current&&(clearTimeout(m.current),m.current=null),x.current&&(clearInterval(x.current),x.current=null),o&&c(!1);return}let e=["mousedown","mousemove","keydown","scroll","touchstart","click","focus"],t=()=>{o||y()};return e.forEach(e=>{window.addEventListener(e,t)}),f.current&&d.current||(f.current=!0,y()),()=>{e.forEach(e=>{window.removeEventListener(e,t)}),d.current&&clearTimeout(d.current),m.current&&clearTimeout(m.current),x.current&&clearInterval(x.current)}},[y,o,a]),(0,s.useEffect)(()=>{let e=e=>{if("lastActivityTimestamp"===e.key&&!o){let t=parseInt(e.newValue,10);!isNaN(t)&&t>h.current&&(h.current=t,y())}};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[y,o]),(0,s.useEffect)(()=>{o||localStorage.setItem("lastActivityTimestamp",h.current.toString())},[o]),(0,s.useEffect)(()=>{if(o){m.current=setTimeout(()=>{g.current&&g.current()},r);let e=Math.floor(r/1e3);return x.current=setInterval(()=>{u(--e),e<=0&&clearInterval(x.current)},1e3),()=>{m.current&&clearTimeout(m.current),x.current&&clearInterval(x.current)}}},[o,r]),{isWarning:o,remainingSeconds:i,stayLoggedIn:w,logoutNow:p,resetTimer:y}}({inactivityTimeout:9e5,warningTimeout:6e4,onWarning:()=>{},onTimeout:()=>{t()},enabled:l});return((0,s.useEffect)(()=>{!r.current&&e&&(m(),localStorage.removeItem("lastActivityTimestamp")),r.current=e},[e,m]),l)?(0,n.jsx)(c,{isWarning:a,remainingSeconds:i,onStayLoggedIn:u,onLogout:d}):null}},347:()=>{},519:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,6874,23)),Promise.resolve().then(r.t.bind(r,4917,23)),Promise.resolve().then(r.t.bind(r,5455,23)),Promise.resolve().then(r.t.bind(r,347,23)),Promise.resolve().then(r.bind(r,172)),Promise.resolve().then(r.bind(r,7939)),Promise.resolve().then(r.bind(r,2700)),Promise.resolve().then(r.bind(r,3611)),Promise.resolve().then(r.bind(r,2528))},1194:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(5155),s=r(2115),l=r(7650),a=r(4817);r(4465);let o=e=>{let{isOpen:t,onClose:r,title:o,children:c,footer:i,closeOnEsc:u=!0,closeOnOverlayClick:d=!0}=e,m=(0,s.useRef)(null),x=(0,s.useRef)(null);return((0,s.useEffect)(()=>{if(!t)return;let e=e=>{u&&"Escape"===e.key&&r()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,r,u]),(0,s.useEffect)(()=>{if(!t)return;if(x.current=document.activeElement,m.current){let e=m.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');e.length?e[0].focus():m.current.focus()}let e=e=>{if("Tab"!==e.key||!m.current)return;let t=Array.from(m.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(0===t.length)return;let r=t[0],n=t[t.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),n.focus()):e.shiftKey||document.activeElement!==n||(e.preventDefault(),r.focus())};return window.addEventListener("keydown",e),document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow="",x.current&&x.current.focus()}},[t]),t)?(0,l.createPortal)((0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:d?r:void 0,role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:(0,n.jsx)("div",{ref:m,onClick:e=>e.stopPropagation(),className:"w-full max-w-lg mx-4",tabIndex:-1,children:(0,n.jsx)(a.A,{title:o,children:(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsx)("div",{id:"modal-title",className:"sr-only",children:o}),(0,n.jsx)("div",{className:"modal-content max-h-[calc(100vh-300px)] overflow-y-auto",children:c}),i?(0,n.jsx)("div",{className:"modal-footer flex justify-end space-x-4",children:i}):null]})})})}),document.body):null}},2528:(e,t,r)=>{"use strict";r.d(t,{A:()=>c,AuthProvider:()=>o});var n=r(5155),s=r(2115),l=r(5695);let a=(0,s.createContext)(null),o=e=>{let{children:t}=e,[r,o]=(0,s.useState)(null),[c,i]=(0,s.useState)(null),[u,d]=(0,s.useState)(!0),m=(0,l.useRouter)();return(0,s.useEffect)(()=>{let e=localStorage.getItem("authToken");e&&(i(e),o({isAuthenticated:!0})),d(!1)},[]),(0,n.jsx)(a.Provider,{value:{user:r,token:c,login:e=>{localStorage.setItem("authToken",e),i(e),o({isAuthenticated:!0}),console.log("User logged in, token stored.")},logout:()=>{localStorage.removeItem("authToken"),i(null),o(null),console.log("User logged out, token removed."),m.push("/login")},isLoading:u},children:t})},c=()=>{let e=(0,s.useContext)(a);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}},2700:(e,t,r)=>{"use strict";r.d(t,{default:()=>a});var n=r(5155),s=r(6874),l=r.n(s);r(3611),r(2115);let a=()=>(0,n.jsxs)("footer",{className:"bg-mystic-950 text-white py-10 px-10 mt-auto",children:[(0,n.jsxs)("div",{className:"max-w-6xl mx-auto flex flex-col md:flex-row items-start text-center md:text-left",children:[(0,n.jsxs)("div",{className:"w-auto md:w-md flex-none flex flex-col items-center md:items-start mx-auto md:mx-0 md:mr-auto",children:[(0,n.jsxs)("span",{className:"text-2xl font-extrabold tracking-wide text-sand-300",children:["Prudence",(0,n.jsx)("span",{className:"text-danger-500",children:"Thirty"})]}),(0,n.jsx)("p",{className:"text-mystic-200 max-w-3xs md:max-w-xs mb-10 md:mb-0 md:ml-0 text-center md:text-justify md:text-center md:text-left text-sm mx-auto md:mr-auto",children:"Empowering your journey to freedom with smart insights, supportive guidance, and an epic adventure."})]}),(0,n.jsxs)("nav",{className:"w-full md:w-60 flex-none flex flex-col gap-2 text-mystic-100 text-sm font-medium items-center md:items-start",children:[(0,n.jsx)(l(),{href:"/about",className:"hover:text-sand-200 transition-colors",children:"About Prudence Thirty"}),(0,n.jsx)(l(),{href:"/contact",className:"hover:text-sand-200 transition-colors",children:"Contact Us"}),(0,n.jsx)(l(),{href:"/privacy",className:"hover:text-sand-200 transition-colors",children:"Privacy Policy"}),(0,n.jsx)(l(),{href:"/terms",className:"hover:text-sand-200 transition-colors",children:"Terms of Service"})]})]}),(0,n.jsxs)("div",{className:"mt-8 text-center text-xs text-mystic-300",children:["\xa9 ",new Date().getFullYear()," Prudence Thirty. All rights reserved."]})]})},3611:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>c});var n=r(5155),s=r(2115),l=r(6874),a=r.n(l),o=r(2528);let c=e=>{let{currentPage:t=null}=e,{user:r,logout:l}=(0,o.A)(),[c,i]=(0,s.useState)("release"),[u,d]=(0,s.useState)(!1),m=(0,s.useRef)(null);return(0,s.useEffect)(()=>{i("pre-early-access")},[]),(0,s.useEffect)(()=>{let e=e=>{m.current&&!m.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,n.jsx)("div",{className:"space-x-4 flex items-center",children:r?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a(),{href:"/progress",className:"".concat("progress"===t?"text-sand-400 font-bold":"hover:text-indigo-200"),children:"Progress"}),(0,n.jsx)(a(),{href:"/stats",className:"".concat("stats"===t?"text-sand-400 font-bold":"hover:text-indigo-200"),children:"Stats"}),(0,n.jsx)(a(),{href:"/inventory",className:"".concat("inventory"===t?"text-sand-400 font-bold":"hover:text-indigo-200"),children:"Inventory"}),(0,n.jsxs)("div",{className:"relative inline-block margin-top-[-4px] relative top-[2px]",ref:m,children:[(0,n.jsx)("button",{onClick:()=>d(!u),className:"flex items-center justify-center w-8 h-8 rounded-full bg-sand-600 hover:bg-sand-500 transition-colors cursor-pointer",children:(0,n.jsx)("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z",clipRule:"evenodd"})})}),u&&(0,n.jsxs)("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 z-50",children:[(0,n.jsx)(a(),{href:"/account",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",onClick:()=>d(!1),children:"Account"}),(0,n.jsx)(a(),{href:"/subscription",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",onClick:()=>d(!1),children:"Subscription"}),(0,n.jsx)("hr",{className:"my-1"}),(0,n.jsx)("button",{onClick:()=>{d(!1),l()},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",children:"Logout"})]})]})]}):(0,n.jsx)(n.Fragment,{children:"pre-early-access"!==c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a(),{href:"/signup",className:"hover:text-indigo-200",children:"Sign Up"}),(0,n.jsx)(a(),{href:"/login",className:"hover:text-indigo-200",children:"Login"})]})})})}},4465:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(5155);function s(e){let{children:t,type:r="button",disabled:s=!1,onClick:l,className:a="",mode:o="primary",style:c={}}=e,i="";switch(o){case"bland":i="text-white bg-gray-500 hover:bg-gray-400 disabled:bg-gray-500 disabled:text-white";break;case"primary":default:i="text-white bg-river-500 hover:bg-river-400 disabled:bg-river-500 disabled:text-white";break;case"danger":i="text-white bg-danger-500 hover:bg-danger-400 disabled:bg-danger-500 disabled:text-white";break;case"success":i="text-white bg-mystic-500 hover:bg-mystic-400 disabled:bg-mystic-500 disabled:text-white"}return(0,n.jsx)("button",{type:r,onClick:l,disabled:s,className:"w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium ".concat(i," focus:outline-none transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed ").concat(a),style:c,children:t})}},4817:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(5155);r(6766);let s=e=>{let{children:t,title:r,isFullWidth:s=!1,isFullContent:l=!1}=e;return(0,n.jsxs)("div",{className:"w-full ".concat(s?"max-w-full":"max-w-lg md:max-w-md lg:max-w-lg"," bg-white rounded-0 sm:rounded-lg shadow-md overflow-hidden border-x-mystic-600 border-x border-b-mystic-600 border-b"),children:[(0,n.jsx)("div",{className:"w-full text-left bg-linear-175 from-mystic-400 to-mystic-500 shadow-md border-b-mystic-600 border-b-2 border-t-mystic-300 border-t",children:(0,n.jsx)("h2",{className:"text-2xl font-bold text-white py-4 px-6",children:r})}),(0,n.jsx)("div",{className:"w-full ".concat(l?"p-0":"px-8 py-6 space-y-6"," "),children:t})]})}},4917:e=>{e.exports={style:{fontFamily:"'Geist', 'Geist Fallback'",fontStyle:"normal"},className:"__className_5cfdac",variable:"__variable_5cfdac"}},5455:e=>{e.exports={style:{fontFamily:"'Geist Mono', 'Geist Mono Fallback'",fontStyle:"normal"},className:"__className_9a8899",variable:"__variable_9a8899"}},7939:(e,t,r)=>{"use strict";r.d(t,{default:()=>a});var n=r(2115),s=r(5695),l=r(2528);let a=()=>{let e=(0,s.useRouter)(),t=(0,n.useRef)(null),{user:r}=(0,l.A)(),a=!!r;return(0,n.useEffect)(()=>{if(!a)return;let r=()=>{let e=new Date,t=new Date(e);return t.setDate(t.getDate()+1),t.setHours(0,0,0,0),t-e},n=()=>{console.log("Midnight reached, redirecting to check-in page"),e.push("/checkin"),s()},s=()=>{let e=r();console.log("Scheduling midnight redirect in ".concat(e,"ms")),t.current&&clearTimeout(t.current),t.current=setTimeout(n,e)};return s(),()=>{t.current&&clearTimeout(t.current)}},[e,a]),null}}},e=>{var t=t=>e(e.s=t);e.O(0,[854,244,766,441,684,358],()=>t(519)),_N_E=e.O()}]);