"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[467],{4205:(e,r,a)=>{a.d(r,{w:()=>s});var t=a(24096);function s(e,r){(0,t.N)(()=>{if(e&&e.ref&&r)return e.ref.current=r.current,()=>{e.ref&&(e.ref.current=null)}})}},7588:(e,r,a)=>{a.d(r,{a:()=>s});var t=a(12115);function s(){let[e,r]=t.useState(void 0);return t.useEffect(()=>{let e=window.matchMedia("(max-width: 767px)"),a=()=>{r(window.innerWidth<768)};return e.addEventListener("change",a),r(window.innerWidth<768),()=>e.removeEventListener("change",a)},[]),!!e}},13892:(e,r,a)=>{a.d(r,{U:()=>s});var t=a(12115),s=(null==globalThis?void 0:globalThis.document)?t.useLayoutEffect:t.useEffect},17268:(e,r,a)=>{a.d(r,{WI:()=>d,aJ:()=>i,fA:()=>s,iW:()=>o,n_:()=>n});var t=a(95155);a(12115);let s=({size:e=24,width:r,height:a,...s})=>(0,t.jsxs)("svg",{fill:"none",height:a||e,viewBox:"0 0 24 24",width:r||e,xmlns:"http://www.w3.org/2000/svg",...s,children:[(0,t.jsx)("g",{id:"SVGRepo_bgCarrier",strokeWidth:"0"}),(0,t.jsx)("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("g",{id:"SVGRepo_iconCarrier",children:(0,t.jsx)("path",{d:"M6.49996 7C7.96131 5.53865 9.5935 4.41899 10.6975 3.74088C11.5021 3.24665 12.4978 3.24665 13.3024 3.74088C14.4064 4.41899 16.0386 5.53865 17.5 7C20.6683 10.1684 20.5 12 20.5 15C20.5 16.4098 20.3895 17.5988 20.2725 18.4632C20.1493 19.3726 19.3561 20 18.4384 20H17C15.8954 20 15 19.1046 15 18V16C15 15.2043 14.6839 14.4413 14.1213 13.8787C13.5587 13.3161 12.7956 13 12 13C11.2043 13 10.4413 13.3161 9.87864 13.8787C9.31603 14.4413 8.99996 15.2043 8.99996 16V18C8.99996 19.1046 8.10453 20 6.99996 20H5.56152C4.64378 20 3.85061 19.3726 3.72745 18.4631C3.61039 17.5988 3.49997 16.4098 3.49997 15C3.49997 12 3.33157 10.1684 6.49996 7Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})]}),o=({size:e,height:r,width:a,color:s})=>(0,t.jsx)("svg",{fill:s||"currentColor",height:e||r||16,viewBox:"0 0 256 256",width:e||a||16,xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z"})}),n=({size:e=24,width:r,height:a,...s})=>(0,t.jsxs)("svg",{fill:"none",height:a||e,viewBox:"0 0 24 24",width:r||e,xmlns:"http://www.w3.org/2000/svg",...s,children:[(0,t.jsx)("g",{id:"SVGRepo_bgCarrier",strokeWidth:"0"}),(0,t.jsx)("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("g",{id:"SVGRepo_iconCarrier",children:(0,t.jsx)("g",{id:"style=linear",children:(0,t.jsxs)("g",{id:"profile",children:[(0,t.jsx)("path",{d:"M12 11C14.4853 11 16.5 8.98528 16.5 6.5C16.5 4.01472 14.4853 2 12 2C9.51472 2 7.5 4.01472 7.5 6.5C7.5 8.98528 9.51472 11 12 11Z",id:"vector",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"}),(0,t.jsx)("path",{d:"M5 18.5714C5 16.0467 7.0467 14 9.57143 14H14.4286C16.9533 14 19 16.0467 19 18.5714C19 20.465 17.465 22 15.5714 22H8.42857C6.53502 22 5 20.465 5 18.5714Z",id:"rec",stroke:"currentColor",strokeWidth:"1.5"})]})})})]}),d=e=>(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",focusable:"false",height:"1em",role:"presentation",viewBox:"0 0 24 24",width:"1em",...e,children:[(0,t.jsx)("path",{d:"M11.5 21C16.7467 21 21 16.7467 21 11.5C21 6.25329 16.7467 2 11.5 2C6.25329 2 2 6.25329 2 11.5C2 16.7467 6.25329 21 11.5 21Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M22 22L20 20",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]}),i=({size:e=24,width:r,height:a,...s})=>(0,t.jsxs)("svg",{fill:"none",height:a||e,viewBox:"0 0 24 24",width:r||e,xmlns:"http://www.w3.org/2000/svg",...s,children:[(0,t.jsx)("g",{id:"SVGRepo_bgCarrier",strokeWidth:"0"}),(0,t.jsx)("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsxs)("g",{id:"SVGRepo_iconCarrier",children:[(0,t.jsx)("path",{d:"M2.23737 2.28845C1.84442 2.15746 1.41968 2.36983 1.28869 2.76279C1.15771 3.15575 1.37008 3.58049 1.76303 3.71147L2.02794 3.79978C2.70435 4.02524 3.15155 4.17551 3.481 4.32877C3.79296 4.47389 3.92784 4.59069 4.01426 4.71059C4.10068 4.83049 4.16883 4.99538 4.20785 5.33722C4.24907 5.69823 4.2502 6.17 4.2502 6.883L4.2502 9.55484C4.25018 10.9224 4.25017 12.0247 4.36673 12.8917C4.48774 13.7918 4.74664 14.5497 5.34855 15.1516C5.95047 15.7535 6.70834 16.0124 7.60845 16.1334C8.47542 16.25 9.57773 16.25 10.9453 16.25H18.0002C18.4144 16.25 18.7502 15.9142 18.7502 15.5C18.7502 15.0857 18.4144 14.75 18.0002 14.75H11.0002C9.56479 14.75 8.56367 14.7484 7.80832 14.6468C7.07455 14.5482 6.68598 14.3677 6.40921 14.091C6.17403 13.8558 6.00839 13.5398 5.9034 13H16.0222C16.9817 13 17.4614 13 17.8371 12.7522C18.2128 12.5045 18.4017 12.0636 18.7797 11.1817L19.2082 10.1817C20.0177 8.2929 20.4225 7.34849 19.9779 6.67422C19.5333 5.99996 18.5058 5.99996 16.4508 5.99996H5.74526C5.73936 5.69227 5.72644 5.41467 5.69817 5.16708C5.64282 4.68226 5.52222 4.2374 5.23112 3.83352C4.94002 3.42965 4.55613 3.17456 4.1137 2.96873C3.69746 2.7751 3.16814 2.59868 2.54176 2.38991L2.23737 2.28845Z",fill:"currentColor"}),(0,t.jsx)("path",{d:"M7.5 18C8.32843 18 9 18.6716 9 19.5C9 20.3284 8.32843 21 7.5 21C6.67157 21 6 20.3284 6 19.5C6 18.6716 6.67157 18 7.5 18Z",fill:"currentColor"}),(0,t.jsx)("path",{d:"M16.5 18.0001C17.3284 18.0001 18 18.6716 18 19.5001C18 20.3285 17.3284 21.0001 16.5 21.0001C15.6716 21.0001 15 20.3285 15 19.5001C15 18.6716 15.6716 18.0001 16.5 18.0001Z",fill:"currentColor"})]})]})},28973:(e,r,a)=>{a.d(r,{E:()=>d});var t=a(95155),s=a(90368),o=a(95684),n=a(12976);let d=({className:e,size:r=25,onClick:a})=>{let{t:d}=(0,n.k)();return(0,t.jsx)(o.T,{isIconOnly:!0,"aria-label":d("components.goBackButton.goBack","Go back"),className:`flex items-center bg-transparent gap-2 ${e||""}`,onPress:a,children:(0,t.jsx)(s.A,{size:r})})}},38199:(e,r,a)=>{a.d(r,{CZ:()=>i,Jz:()=>l,aK:()=>d});var t=a(25177),s=a(42950);async function o(e){let r=new TextEncoder().encode(e.trim().toLowerCase());return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",r))).map(e=>e.toString(16).padStart(2,"0")).join("")}async function n(e){let r={};return e.em&&(r.em=await o(e.em)),e.ph&&(r.ph=await o(e.ph)),e.fn&&(r.fn=await o(e.fn)),e.ln&&(r.ln=await o(e.ln)),e.ct&&(r.ct=await o(e.ct)),e.st&&(r.st=await o(e.st)),e.zp&&(r.zp=await o(e.zp)),e.country&&(r.country=await o(e.country)),e.external_id&&(r.external_id=e.external_id),r}async function d(){try{let e=s.pq?.MetaPixel??90,r=await (0,t.nr)(`${s.OA}?integrationType=${e}`,{method:"GET",requireAuth:!1,cache:"no-store"}),a=r?.[0];if(!a?.isEnabled||!a?.isConfigured)return null;let o=a.configuration?.META_PIXEL_ID;if(!o)return null;let n=a.configuration?.TEST_EVENT_CODE;return{pixelId:o,testEventCode:n}}catch(e){return console.error("[Meta CAPI] Failed to fetch config:",e),null}}async function i(e,r){var a,t,s,o,d;if(window.fbq)return;a=window,t=document,a.fbq||(s=a.fbq=function(){s.callMethod?s.callMethod.apply(s,arguments):s.queue.push(arguments)},a._fbq||(a._fbq=s),s.push=s,s.loaded=!0,s.version="2.0",s.queue=[],(o=t.createElement("script")).async=!0,o.src="https://connect.facebook.net/en_US/fbevents.js",(d=t.getElementsByTagName("script")[0]).parentNode.insertBefore(o,d));let i={};r&&(i=await n(r)),window.fbq("init",e,i),window.fbq("track","PageView")}function l(e,r,a){if(!window.fbq)return;let t={...r};"undefined"!=typeof sessionStorage&&sessionStorage.getItem("fb_test_event_code"),a?.eventID?window.fbq("track",e,t,{eventID:a.eventID}):window.fbq("track",e,t)}},67740:(e,r,a)=>{a.r(r),a.d(r,{default:()=>$});var t=a(95155),s=a(20726),o=a(70175),n=a(85986),d=a(74891),i=a(20063),l=a(12115),c=a(28973),u=a(22544),m=a(95684),g=a(67758),f=a(69127),h=a(12976),x=a(82721),p=a(21779);function b({onSwitchMode:e,onLoginSuccess:r}){let{t:a}=(0,h.k)(),s=(0,l.useRef)(null),{login:o}=(0,p.J)(),[n,d]=(0,l.useState)(!1),[i,c]=(0,l.useState)({email:"",password:""}),[b,w]=(0,l.useState)(!1),[v,k]=(0,l.useState)(""),[y,j]=(0,l.useState)(""),[C,N]=(0,l.useState)(""),[P,S]=(0,l.useState)(!1),[E,L]=(0,l.useState)(!1),[R,_]=(0,l.useState)(null),{config:T,loading:$}=(0,x.a)(),M=T?.basicEnabled===!0,q=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),A=async()=>{if(k(""),j(""),N(""),!i.email)return void j(a("auth.login.fillEmail","Please enter your email"));if(!q(i.email))return void j(a("auth.login.invalidEmail","Please enter a valid email address"));if(!i.password)return void N(a("auth.login.fillPassword","Please enter your password"));d(!0);try{let e=await fetch("/api/auth/customer-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:i.email,password:i.password}),credentials:"same-origin"});if(!e.ok){let r=await e.json().catch(()=>({}));throw Error(r.message||a("auth.login.loginFailed","Login failed. Please check your credentials"))}await o(),r&&r()}catch(e){k("string"==typeof e?.message?e.message:a("auth.login.loginFailed","Login failed. Please check your credentials"))}finally{d(!1)}},I=async()=>{if(j(""),_(null),!i.email)return void S(!1);if(!q(i.email)){j(a("auth.login.invalidEmail","Please enter a valid email address")),S(!1);return}S(!0),L(!0);try{_(!0)}catch(e){_(!1),j("string"==typeof e?.message?e.message:a("auth.login.userNotFound","No user found with this email")),S(!1)}finally{L(!1)}};return(0,t.jsxs)("div",{className:"space-y-4",children:[$&&!T&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"h-11 rounded-xl bg-muted/50 dark:bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-11 rounded-xl bg-muted/50 dark:bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"flex justify-end mt-1",children:(0,t.jsx)("div",{className:"h-4 w-24 rounded-full bg-muted/50 dark:bg-muted animate-pulse"})}),(0,t.jsx)("div",{className:"h-12 rounded-xl bg-muted/50 dark:bg-muted animate-pulse"}),(0,t.jsxs)("div",{className:"flex items-center justify-center my-6",children:[(0,t.jsx)("div",{className:"flex-grow h-px bg-muted/50 dark:bg-muted"}),(0,t.jsx)("span",{className:"mx-4 h-4 w-16 rounded-full bg-muted/50 dark:bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"flex-grow h-px bg-muted/50 dark:bg-muted"})]})]}),!$&&M&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.r,{ref:s,classNames:{input:["text-[16px]"],inputWrapper:["dark:bg-muted/50 bg-background shadow-sm border-2 border-border dark:border-border focus-within:!border-brand-primary dark:focus-within:!border-brand-primary transition-all duration-200","hover:border-border dark:hover:border-border hover:shadow-md","rounded-xl"],label:["font-semibold text-foreground dark:text-foreground"]},endContent:P?(0,t.jsx)(g.J,{loading:E,success:!0===R}):null,errorMessage:y,isInvalid:""!==y,label:a("auth.login.email","Email"),startContent:(0,t.jsx)("i",{className:"fas fa-envelope text-brand-primary dark:text-brand-primary"}),type:"email",value:i.email,onBlur:I,onChange:e=>c(r=>({...r,email:e.target.value}))}),(0,t.jsx)(u.r,{isClearable:!0,classNames:{input:["text-[16px]"],inputWrapper:["dark:bg-muted/50 bg-background shadow-sm border-2 border-border dark:border-border focus-within:!border-brand-primary dark:focus-within:!border-brand-primary transition-all duration-200","hover:border-border dark:hover:border-border hover:shadow-md","rounded-xl"],label:["font-semibold text-foreground dark:text-foreground"]},errorMessage:C,isInvalid:""!==C,label:a("auth.login.password","Password"),startContent:(0,t.jsx)("i",{className:"fas fa-lock text-brand-primary dark:text-brand-primary"}),type:"password",value:i.password,onChange:e=>c(r=>({...r,password:e.target.value})),onClear:()=>{N(""),c(e=>({...e,password:""}))}}),(0,t.jsx)("div",{className:"flex px-1 justify-end -mt-1",children:(0,t.jsx)("button",{className:"font-primary text-brand-primary dark:text-brand-primary hover:opacity-80 text-sm font-semibold transition-all hover:underline",onClick:()=>e("forgot"),children:a("auth.login.forgotPassword","Forgot password?")})}),v&&(0,t.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm text-center font-semibold bg-red-50 dark:bg-red-900/20 border-2 border-red-200 dark:border-red-800 p-3 rounded-xl animate-in slide-in-from-top-2 duration-300",children:[(0,t.jsx)("i",{className:"fas fa-exclamation-circle mr-2"}),v]}),(0,t.jsx)(m.T,{className:"w-full bg-brand-primary hover:opacity-90 text-white font-bold py-6 rounded-xl shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-[1.02] active:scale-[0.98]",isLoading:n,startContent:!n&&(0,t.jsx)("i",{className:"fas fa-sign-in-alt"}),onPress:A,children:a("auth.login.button","Login")}),(0,t.jsxs)("div",{className:"flex items-center justify-center my-6",children:[(0,t.jsx)("div",{className:"flex-grow h-px bg-gradient-to-r from-transparent via-border dark:via-border to-transparent"}),(0,t.jsx)("span",{className:"font-primary mx-4 text-muted-foreground dark:text-muted-foreground text-sm font-semibold bg-background dark:bg-brand-surfacedark px-2",children:a("auth.login.or","or")}),(0,t.jsx)("div",{className:"flex-grow h-px bg-gradient-to-r from-transparent via-border dark:via-border to-transparent"})]})]}),(0,t.jsx)(f.OAuthButtons,{variant:"flat",onSuccess:r}),!$&&M&&(0,t.jsx)("div",{className:"text-center mt-6 pt-4 border-t border-border dark:border-border",children:(0,t.jsx)("button",{className:"font-primary text-brand-primary dark:text-brand-primary hover:opacity-80 text-sm font-semibold transition-all hover:underline",onClick:()=>e("register"),children:a("auth.login.switchMode","Don't have an account? Register")})})]})}var w=a(25177);let v="https://api.komero.ge/CustomerAuth/";async function k(e){let r={firstName:e.firstName,lastName:e.lastName,email:e.email,password:e.password,verifyCode:e.verifyCode??0},a=await (0,w.nr)(`${v}register`,{method:"POST",body:JSON.stringify(r)});if(a&&(a.accessToken||a.AccessToken)){let e=a?.accessToken??a?.AccessToken,r=a?.refreshToken??a?.RefreshToken;if(!e||!r)throw Error("Invalid token payload");return{accessToken:e,refreshToken:r}}}async function y(e){let r=new URLSearchParams({email:e});await (0,w.nr)(`${v}send-code?${r.toString()}`,{method:"POST"})}async function j(e){await (0,w.nr)(`${v}forgot-password/request`,{method:"POST",body:JSON.stringify({email:e}),requireAuth:!1})}async function C(e){await (0,w.nr)(`${v}forgot-password/confirm`,{method:"POST",body:JSON.stringify(e),requireAuth:!1})}var N=a(38199);function P({onSwitchMode:e}){let{t:r}=(0,h.k)(),a=(0,l.useRef)(null),[s,o]=(0,l.useState)(!1),[n,d]=(0,l.useState)(!1),[i,c]=(0,l.useState)({username:"",email:"",password:"",confirmPassword:""}),[p,b]=(0,l.useState)(""),[w,v]=(0,l.useState)(""),[j,C]=(0,l.useState)(""),[P,S]=(0,l.useState)(""),[E,L]=(0,l.useState)(""),[R,_]=(0,l.useState)(!1),[T,$]=(0,l.useState)(""),[M]=(0,l.useState)(!1),[q]=(0,l.useState)(!1),[A]=(0,l.useState)(!1),[I]=(0,l.useState)(!1),[B]=(0,l.useState)(null),[W]=(0,l.useState)(null),{config:O,loading:z}=(0,x.a)(),V=O?.basicEnabled===!0,F=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),H=e=>{let a=[];return e.length<6&&a.push(r("auth.register.passwordRequirements.minChars","6+ characters")),/[0-9]/.test(e)||a.push(r("auth.register.passwordRequirements.digit","1 digit")),/[a-z]/.test(e)||a.push(r("auth.register.passwordRequirements.lower","Lowercase letter")),/[A-Z]/.test(e)||a.push(r("auth.register.passwordRequirements.upper","Uppercase letter")),/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(e)||a.push(r("auth.register.passwordRequirements.special","Special character")),{isValid:0===a.length,errors:a}},G=async()=>{b(""),C("");let{email:e}=i;if(!e)return void C(r("auth.register.fillEmail","Please enter your email"));if(!F(e))return void C(r("auth.register.invalidEmail","Please enter a valid email address"));d(!0);try{await y(e),_(!0)}catch(e){b("string"==typeof e?.message?e.message:"Failed to send code")}finally{d(!1)}},J=async()=>{b(""),v(""),C(""),L(""),S("");let{username:a,email:t,password:s,confirmPassword:n}=i;if(!a)return void v(r("auth.register.fillUsername","Please enter a username"));if(!t)return void C(r("auth.register.fillEmail","Please enter your email"));if(!F(t))return void C(r("auth.register.invalidEmail","Please enter a valid email address"));if(!s)return void b(r("auth.register.fillPassword","Please enter a password"));let d=H(s);if(!d.isValid)return void L(d.errors.join(", "));if(!n)return void S(r("auth.register.fillConfirmPassword","Please confirm your password"));if(s!==n)return void S(r("auth.register.passwordsDoNotMatch","Passwords do not match"));if(!R)return void b(r("auth.register.requestCodeFirst","Please request a verification code first"));if(!T)return void b(r("auth.register.enterCode","Please enter the verification code"));o(!0);try{await k({firstName:a,lastName:"",email:t,password:s,verifyCode:Number(T)||0}),(0,N.Jz)("CompleteRegistration",{content_name:"Customer Registration",status:!0}),e("login")}catch(e){b("string"==typeof e?.message?e.message:r("auth.register.registrationFailed","Registration failed. Please try again"))}finally{o(!1)}};return z&&!O?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"h-11 rounded-xl bg-muted/50 dark:bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-11 rounded-xl bg-muted/50 dark:bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-11 rounded-xl bg-muted/50 dark:bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-24 rounded-xl bg-muted/50 dark:bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-12 rounded-xl bg-muted/50 dark:bg-muted animate-pulse"}),(0,t.jsxs)("div",{className:"flex items-center justify-center my-6",children:[(0,t.jsx)("div",{className:"flex-grow h-px bg-muted/50 dark:bg-muted"}),(0,t.jsx)("span",{className:"mx-4 h-4 w-16 rounded-full bg-muted/50 dark:bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"flex-grow h-px bg-muted/50 dark:bg-muted"})]})]}):V?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(u.r,{ref:a,isClearable:!0,classNames:{input:["text-[16px]"],inputWrapper:["dark:bg-muted/50 bg-background shadow-sm border-2 border-border dark:border-border focus-within:!border-brand-primary dark:focus-within:!border-brand-primary transition-all duration-200","hover:border-border dark:hover:border-border hover:shadow-md","rounded-xl"],label:["font-semibold text-foreground dark:text-foreground"]},endContent:A?(0,t.jsx)(g.J,{loading:M,success:!0===B}):null,errorMessage:w,isInvalid:""!==w,label:r("auth.register.username","Username"),startContent:(0,t.jsx)("i",{className:"fas fa-user text-brand-primary dark:text-brand-primary"}),type:"text",value:i.username,onChange:e=>c(r=>({...r,username:e.target.value})),onClear:()=>{v(""),c(e=>({...e,username:""}))}}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(u.r,{isClearable:!0,classNames:{input:["text-[16px]"],inputWrapper:["dark:bg-muted/50 bg-background shadow-sm border-2 border-border dark:border-border focus-within:!border-brand-primary dark:focus-within:!border-brand-primary transition-all duration-200","hover:border-border dark:hover:border-border hover:shadow-md","rounded-xl"],label:["font-semibold text-foreground dark:text-foreground"]},errorMessage:E,isInvalid:""!==E,label:r("auth.register.password","Password"),startContent:(0,t.jsx)("i",{className:"fas fa-lock text-brand-primary dark:text-brand-primary"}),type:"password",value:i.password,onBlur:()=>{let{password:e}=i;if(!e)return;let r=H(e);L(r.isValid?"":r.errors.join(", "))},onChange:e=>c(r=>({...r,password:e.target.value})),onClear:()=>{L(""),c(e=>({...e,password:""}))}}),i.password&&(0,t.jsx)("div",{className:"px-2 py-1.5 bg-brand-primary/5 dark:bg-brand-primary/10 rounded-lg",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px]",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("i",{className:`fas fa-xs ${i.password.length>=6?"fa-check text-green-600 dark:text-green-400":"fa-times text-muted-foreground"}`}),(0,t.jsx)("span",{className:i.password.length>=6?"text-green-600 dark:text-green-400":"text-muted-foreground dark:text-muted-foreground",children:r("auth.register.passwordRequirements.minChars","6+ characters")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("i",{className:`fas fa-xs ${/[0-9]/.test(i.password)?"fa-check text-green-600 dark:text-green-400":"fa-times text-muted-foreground"}`}),(0,t.jsx)("span",{className:/[0-9]/.test(i.password)?"text-green-600 dark:text-green-400":"text-muted-foreground dark:text-muted-foreground",children:r("auth.register.passwordRequirements.digit","1 digit")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("i",{className:`fas fa-xs ${/[a-z]/.test(i.password)?"fa-check text-green-600 dark:text-green-400":"fa-times text-muted-foreground"}`}),(0,t.jsx)("span",{className:/[a-z]/.test(i.password)?"text-green-600 dark:text-green-400":"text-muted-foreground dark:text-muted-foreground",children:r("auth.register.passwordRequirements.lower","Lowercase letter")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("i",{className:`fas fa-xs ${/[A-Z]/.test(i.password)?"fa-check text-green-600 dark:text-green-400":"fa-times text-muted-foreground"}`}),(0,t.jsx)("span",{className:/[A-Z]/.test(i.password)?"text-green-600 dark:text-green-400":"text-muted-foreground dark:text-muted-foreground",children:r("auth.register.passwordRequirements.upper","Uppercase letter")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("i",{className:`fas fa-xs ${/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(i.password)?"fa-check text-green-600 dark:text-green-400":"fa-times text-muted-foreground"}`}),(0,t.jsx)("span",{className:/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(i.password)?"text-green-600 dark:text-green-400":"text-muted-foreground dark:text-muted-foreground",children:r("auth.register.passwordRequirements.special","Special character")})]})]})})]}),(0,t.jsx)(u.r,{isClearable:!0,classNames:{input:["text-[16px]"],inputWrapper:["dark:bg-muted/50 bg-background shadow-sm border-2 border-border dark:border-border focus-within:!border-brand-primary dark:focus-within:!border-brand-primary transition-all duration-200","hover:border-border dark:hover:border-border hover:shadow-md","rounded-xl"],label:["font-semibold text-foreground dark:text-foreground"]},errorMessage:P,isInvalid:""!==P,label:r("auth.register.confirmPassword","Confirm password"),startContent:(0,t.jsx)("i",{className:"fas fa-lock text-brand-primary dark:text-brand-primary"}),type:"password",value:i.confirmPassword,onBlur:()=>{let{password:e,confirmPassword:a}=i;a&&S(e!==a?r("auth.register.passwordsDoNotMatch","Passwords do not match"):"")},onChange:e=>c(r=>({...r,confirmPassword:e.target.value})),onClear:()=>{S(""),c(e=>({...e,confirmPassword:""}))}}),(0,t.jsx)(u.r,{isClearable:!0,classNames:{input:["text-[16px]"],inputWrapper:["dark:bg-muted/50 bg-background shadow-sm border-2 border-border dark:border-border focus-within:!border-brand-primary dark:focus-within:!border-brand-primary transition-all duration-200","hover:border-border dark:hover:border-border hover:shadow-md","rounded-xl"],label:["font-semibold text-foreground dark:text-foreground"]},endContent:I?(0,t.jsx)(g.J,{loading:q,success:!0===W}):null,errorMessage:j,isInvalid:""!==j,label:r("auth.register.email","Email"),startContent:(0,t.jsx)("i",{className:"fas fa-envelope text-brand-primary dark:text-brand-primary"}),type:"email",value:i.email,onChange:e=>c(r=>({...r,email:e.target.value})),onClear:()=>{C(""),c(e=>({...e,email:""}))}}),(0,t.jsxs)("div",{className:"space-y-2",children:[R&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-2",children:[(0,t.jsx)("i",{className:"fas fa-check-circle text-green-600 dark:text-green-400 text-sm"}),(0,t.jsx)("p",{className:"font-primary text-xs font-semibold text-green-800 dark:text-green-200",children:r("auth.register.codeSent","A verification code has been sent to your email")})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(u.r,{isClearable:!0,classNames:{input:["text-[16px] font-mono tracking-wider"],inputWrapper:[R?"dark:bg-muted/50 bg-background shadow-sm border-2 border-green-300 dark:border-green-700 focus-within:!border-green-500 dark:focus-within:!border-green-400 transition-all duration-200 hover:border-green-400 dark:hover:border-green-600 hover:shadow-md rounded-xl":"dark:bg-muted/50 bg-background shadow-sm border-2 border-border dark:border-border focus-within:!border-brand-primary dark:focus-within:!border-brand-primary transition-all duration-200 hover:border-border dark:hover:border-border hover:shadow-md rounded-xl"],label:["font-semibold text-foreground dark:text-foreground"]},label:r("auth.register.verificationCode","Verification code"),startContent:(0,t.jsx)("i",{className:`fas fa-key ${R?"text-green-500 dark:text-green-400":"text-brand-primary dark:text-brand-primary"}`}),type:"tel",value:T,onChange:e=>$(e.target.value),onClear:()=>$("")}),F(i.email)&&!R&&(0,t.jsx)(m.T,{className:"min-w-fit bg-gradient-to-r from-green-600 to-green-700 hover:from-green-700 hover:to-green-800 dark:from-green-500 dark:to-green-600 dark:hover:from-green-600 dark:hover:to-green-700 text-white font-bold px-4 rounded-xl shadow-md hover:shadow-lg transition-all duration-200 hover:scale-[1.02] active:scale-[0.98]",isLoading:n,onPress:G,children:!n&&(0,t.jsx)("i",{className:"fas fa-paper-plane"})})]})]}),p&&(0,t.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm text-center font-semibold bg-red-50 dark:bg-red-900/20 border-2 border-red-200 dark:border-red-800 p-3 rounded-xl animate-in slide-in-from-top-2 duration-300",children:[(0,t.jsx)("i",{className:"fas fa-exclamation-circle mr-2"}),p]}),(0,t.jsx)(m.T,{className:"w-full bg-brand-primary hover:opacity-90 text-white font-bold py-6 rounded-xl shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-[1.02] active:scale-[0.98]",isLoading:s,startContent:!s&&(0,t.jsx)("i",{className:R?"fas fa-check-circle":"fas fa-user-plus"}),onPress:J,children:R?r("auth.register.confirm","Confirm registration"):r("auth.register.button","Register")}),(0,t.jsxs)("div",{className:"flex items-center justify-center my-6",children:[(0,t.jsx)("div",{className:"flex-grow h-px bg-gradient-to-r from-transparent via-border dark:via-border to-transparent"}),(0,t.jsx)("span",{className:"font-primary mx-4 text-muted-foreground dark:text-muted-foreground text-sm font-semibold bg-background dark:bg-brand-surfacedark px-2",children:r("auth.register.or","or")}),(0,t.jsx)("div",{className:"flex-grow h-px bg-gradient-to-r from-transparent via-border dark:via-border to-transparent"})]}),(0,t.jsx)(f.OAuthButtons,{onSuccess:()=>e("login")}),(0,t.jsx)("div",{className:"text-center mt-6 pt-4 border-t border-border dark:border-border",children:(0,t.jsx)("button",{className:"font-primary text-brand-primary dark:text-brand-primary hover:opacity-80 text-sm font-semibold transition-all hover:underline",onClick:()=>e("login"),children:r("auth.register.switchMode","Already have an account? Login")})})]}):(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsx)(f.OAuthButtons,{onSuccess:()=>e("login")})})}let S={input:["text-[16px]"],inputWrapper:["dark:bg-muted/50 bg-background shadow-sm border-2 border-border dark:border-border focus-within:!border-brand-primary dark:focus-within:!border-brand-primary transition-all duration-200","hover:border-border dark:hover:border-border hover:shadow-md","rounded-xl"],label:["font-semibold text-foreground dark:text-foreground"]},E={input:["text-[16px] font-mono tracking-wider"],inputWrapper:["dark:bg-muted/50 bg-background shadow-sm border-2 border-green-300 dark:border-green-700 focus-within:!border-green-500 dark:focus-within:!border-green-400 transition-all duration-200","hover:border-green-400 dark:hover:border-green-600 hover:shadow-md","rounded-xl"],label:["font-semibold text-foreground dark:text-foreground"]};function L({onSwitchMode:e}){let{t:r}=(0,h.k)(),[a,s]=(0,l.useState)("email"),[o,n]=(0,l.useState)(""),[d,i]=(0,l.useState)(""),[c,f]=(0,l.useState)(!1),[x,p]=(0,l.useState)(""),[b,w]=(0,l.useState)(""),[v,k]=(0,l.useState)(""),[y,N]=(0,l.useState)(""),[P,L]=(0,l.useState)(0),[R,_]=(0,l.useState)(!1),[T,$]=(0,l.useState)(!1),[M,q]=(0,l.useState)(!1),A=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),I=e=>({minChars:e.length>=6,digit:/[0-9]/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),special:/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(e)}),B=I(v);(0,l.useEffect)(()=>{if(P<=0)return;let e=setTimeout(()=>L(e=>e-1),1e3);return()=>clearTimeout(e)},[P]);let W=(0,l.useCallback)(()=>{if(i(""),!o)return void $(!1);if(!A(o)){i(r("auth.login.invalidEmail","Please enter a valid email address")),$(!1);return}$(!0),q(!0),setTimeout(()=>q(!1),400)},[o,r]),O=async()=>{if(p(""),i(""),!o)return void i(r("auth.login.fillEmail","Please enter your email"));if(!A(o))return void i(r("auth.login.invalidEmail","Please enter a valid email address"));f(!0);try{await j(o),s("verify"),L(60)}catch(a){let e="string"==typeof a?.message?a.message:"";e.includes("403")||e.toLowerCase().includes("smtp")?p(r("auth.forgotPassword.smtpError","Password reset is not available at this time.")):p(e||"Something went wrong.")}finally{f(!1)}},z=async()=>{if(p(""),!b||6!==b.length)return void p("Please enter the 6-digit verification code.");if(!v||!y)return void p("Please fill in all password fields.");if(v!==y)return void p(r("auth.forgotPassword.passwordMismatch","Passwords do not match"));let e=I(v);if(!e.minChars||!e.digit||!e.lower||!e.upper||!e.special)return void p("Password does not meet requirements.");f(!0);try{await C({email:o,verificationCode:Number(b),newPassword:v,confirmNewPassword:y}),s("success")}catch(a){let e="string"==typeof a?.message?a.message:"Confirmation failed";e.toLowerCase().includes("expired")?(p(r("auth.forgotPassword.codeExpired","Code expired. Please request a new one.")),s("email")):p(e)}finally{f(!1)}},V=async()=>{p(""),_(!0);try{await j(o),L(60)}catch(e){p("string"==typeof e?.message?e.message:"Resend failed")}finally{_(!1)}};return"success"===a?(0,t.jsxs)("div",{className:"space-y-5 text-center py-4",children:[(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsx)("div",{className:"h-16 w-16 rounded-2xl bg-gradient-to-br from-green-100 to-green-200 dark:from-green-900/30 dark:to-green-800/20 flex items-center justify-center ring-1 ring-green-200/50 dark:ring-green-800/30",children:(0,t.jsx)("i",{className:"fas fa-check-circle text-green-600 dark:text-green-400 text-3xl"})})}),(0,t.jsx)("h3",{className:"text-lg font-bold text-foreground dark:text-foreground",children:r("auth.forgotPassword.successTitle","Password Reset!")}),(0,t.jsx)("p",{className:"font-primary text-muted-foreground dark:text-muted-foreground text-sm leading-relaxed",children:r("auth.forgotPassword.successText","Your password has been changed successfully. You can now log in with your new password.")}),(0,t.jsx)(m.T,{className:"w-full bg-brand-primary hover:opacity-90 text-white font-bold py-6 rounded-xl shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-[1.02] active:scale-[0.98]",startContent:(0,t.jsx)("i",{className:"fas fa-sign-in-alt"}),onPress:()=>e?.("login"),children:r("auth.forgotPassword.goToLogin","Go to Login")})]}):"verify"===a?(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-gradient-to-br from-brand-primary/5 to-brand-primary/10 dark:from-brand-primary/10 dark:to-brand-primary/15 rounded-xl border border-brand-primary/20 dark:border-brand-primary/30",children:[(0,t.jsx)("i",{className:"fas fa-envelope-open-text text-brand-primary dark:text-brand-primary text-xl mt-0.5"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-primary text-foreground dark:text-muted-foreground text-sm leading-relaxed font-semibold",children:r("auth.forgotPassword.codeSent","A 6-digit code has been sent to your email.")}),(0,t.jsxs)("p",{className:"font-primary text-muted-foreground dark:text-muted-foreground text-xs mt-1",children:[function(e){let[r,a]=e.split("@");if(!a)return e;let t=r.length<=2?r[0]+"***":r.slice(0,2)+"***";return`${t}@${a}`}(o)," \xb7"," ",r("auth.forgotPassword.codeExpiry","The code expires in 1 minute.")]})]})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(u.r,{classNames:E,label:r("auth.forgotPassword.verificationCode","Verification Code"),maxLength:6,placeholder:"000000",startContent:(0,t.jsx)("i",{className:"fas fa-key text-green-500 dark:text-green-400"}),type:"tel",value:b,onChange:e=>w(e.target.value.replace(/\D/g,""))}),(0,t.jsxs)(m.T,{className:"min-w-fit bg-gradient-to-r from-green-600 to-green-700 hover:from-green-700 hover:to-green-800 dark:from-green-500 dark:to-green-600 dark:hover:from-green-600 dark:hover:to-green-700 text-white font-bold px-4 rounded-xl shadow-md hover:shadow-lg transition-all duration-200 hover:scale-[1.02] active:scale-[0.98] self-end",isDisabled:P>0,isLoading:R,onPress:V,children:[!R&&(0,t.jsx)("i",{className:"fas fa-redo"}),(0,t.jsx)("span",{className:"hidden sm:inline ml-1",children:P>0?`${P}s`:r("auth.forgotPassword.resend","Resend")})]})]}),(0,t.jsx)(u.r,{classNames:S,label:r("auth.forgotPassword.newPassword","New Password"),placeholder:"••••••••",startContent:(0,t.jsx)("i",{className:"fas fa-lock text-brand-primary dark:text-brand-primary"}),type:"password",value:v,onChange:e=>k(e.target.value)}),(0,t.jsx)(u.r,{classNames:S,label:r("auth.forgotPassword.confirmPassword","Confirm New Password"),placeholder:"••••••••",startContent:(0,t.jsx)("i",{className:"fas fa-lock text-brand-primary dark:text-brand-primary"}),type:"password",value:y,onChange:e=>N(e.target.value)}),v&&(0,t.jsx)("div",{className:"px-2 py-1.5 bg-brand-primary/5 dark:bg-brand-primary/10 rounded-lg",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px]",children:[["minChars",B.minChars,"6+ characters"],["digit",B.digit,"1 digit"],["lower",B.lower,"Lowercase letter"],["upper",B.upper,"Uppercase letter"],["special",B.special,"Special character"]].map(([e,a,s])=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("i",{className:`fas fa-xs ${a?"fa-check text-green-600 dark:text-green-400":"fa-times text-muted-foreground"}`}),(0,t.jsx)("span",{className:a?"text-green-600 dark:text-green-400":"text-muted-foreground dark:text-muted-foreground",children:r(`auth.forgotPassword.passwordRequirements.${e}`,s)})]},e))})}),x&&(0,t.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm text-center font-semibold bg-red-50 dark:bg-red-900/20 border-2 border-red-200 dark:border-red-800 p-3 rounded-xl animate-in slide-in-from-top-2 duration-300",children:[(0,t.jsx)("i",{className:"fas fa-exclamation-circle mr-2"}),x]}),(0,t.jsx)(m.T,{className:"w-full bg-brand-primary hover:opacity-90 text-white font-bold py-6 rounded-xl shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-[1.02] active:scale-[0.98]",isLoading:c,startContent:!c&&(0,t.jsx)("i",{className:"fas fa-check-circle"}),onPress:z,children:c?r("auth.forgotPassword.resetting","Resetting..."):r("auth.forgotPassword.resetButton","Reset Password")})]}):(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-gradient-to-br from-brand-primary/5 to-brand-primary/10 dark:from-brand-primary/10 dark:to-brand-primary/15 rounded-xl border border-brand-primary/20 dark:border-brand-primary/30",children:[(0,t.jsx)("i",{className:"fas fa-info-circle text-brand-primary dark:text-brand-primary text-xl mt-0.5"}),(0,t.jsx)("p",{className:"font-primary text-foreground dark:text-muted-foreground text-sm leading-relaxed",children:r("auth.forgotPassword.subText","Enter your email address and we'll send you a 6-digit code to reset your password.")})]}),(0,t.jsx)(u.r,{classNames:S,endContent:T?(0,t.jsx)(g.J,{loading:M,success:!0}):null,errorMessage:d,isInvalid:""!==d,label:r("auth.forgotPassword.email","Email"),startContent:(0,t.jsx)("i",{className:"fas fa-envelope text-brand-primary dark:text-brand-primary"}),type:"email",value:o,onBlur:W,onChange:e=>n(e.target.value)}),x&&(0,t.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm text-center font-semibold bg-red-50 dark:bg-red-900/20 border-2 border-red-200 dark:border-red-800 p-3 rounded-xl animate-in slide-in-from-top-2 duration-300",children:[(0,t.jsx)("i",{className:"fas fa-exclamation-circle mr-2"}),x]}),(0,t.jsx)(m.T,{className:"w-full bg-brand-primary hover:opacity-90 text-white font-bold py-6 rounded-xl shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-[1.02] active:scale-[0.98]",isLoading:c,startContent:!c&&(0,t.jsx)("i",{className:"fas fa-paper-plane"}),onPress:O,children:c?r("auth.forgotPassword.sending","Sending..."):r("auth.forgotPassword.button","Send Reset Code")})]})}var R=a(90711),_=a(46253),T=a(7588);function $(){let{t:e}=(0,h.k)(),r=(0,i.usePathname)(),{isOpen:a,mode:u,close:m,setMode:g}=(0,_.X)(),f=(0,T.a)(),[x,p]=(0,l.useState)(!1),[w,v]=(0,l.useState)(""),k=r?.split("/")[1]||"";/^[a-z]{2,3}$/.test(k),(0,R.y)(a);let y=e=>{g(e)},j=()=>{m()};return(0,t.jsx)(s.Y,{classNames:{...f?{wrapper:"!transform-none h-[100lvh] p-0 m-0",base:"dark:bg-brand-surfacedark bg-background !rounded-none flex flex-col h-full max-h-full pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]",backdrop:"bg-black/40 backdrop-blur-sm"}:{base:"dark:bg-brand-surfacedark bg-brand-surface rounded-2xl shadow-2xl border border-border dark:border-border",backdrop:"bg-black/50 backdrop-blur-sm"}},hideCloseButton:f,isOpen:a,motionProps:{variants:{enter:{y:40*!f,opacity:0,scale:f?1:.96,transition:{duration:0}},center:{y:0,opacity:1,scale:1,transition:{type:"spring",stiffness:400,damping:32,mass:.8}},exit:{y:40*!f,opacity:0,scale:f?1:.96,transition:{duration:.18,ease:"easeIn"}}},initial:"enter",animate:"center",exit:"exit"},placement:f?"top":"center",size:f?"full":"sm",onClose:j,children:(0,t.jsx)(o.g,{className:"",children:()=>(0,t.jsxs)(t.Fragment,{children:[f?(0,t.jsxs)(n.c,{className:"relative flex items-center justify-between px-4 mb-5 pt-6 pb-2 mx-4 bg-background dark:bg-brand-surfacedark",children:[(0,t.jsx)("div",{className:"absolute left-4 top-6",children:(0,t.jsx)(c.E,{onClick:j})}),(0,t.jsx)("h2",{className:"font-heading absolute left-1/2 top-6 -translate-x-1/2 text-2xl font-bold text-foreground dark:text-foreground",children:"login"===u?e("auth.login.title","Login"):"register"===u?e("auth.register.title","Register"):e("auth.forgotPassword.title","Reset password")})]}):"forgot"===u?(0,t.jsxs)(n.c,{className:"flex items-center gap-2 px-6 pt-6 pb-4 z-50 border-b border-border dark:border-border",children:[(0,t.jsx)(c.E,{onClick:()=>y("login")}),(0,t.jsx)("h2",{className:"font-heading text-xl font-bold text-foreground dark:text-foreground ml-2",children:e("auth.forgotPassword.title","Reset password")})]}):(0,t.jsx)(n.c,{className:"flex flex-col items-center gap-2 pt-8 pb-6 border-b border-border dark:border-border",children:(0,t.jsx)("h2",{className:"font-heading text-2xl font-bold text-foreground dark:text-foreground",children:"login"===u?e("auth.login.title","Login"):"register"===u?e("auth.register.title","Register"):e("auth.forgotPassword.title","Reset password")})}),(0,t.jsxs)(d.h,{className:"px-6 py-6 overflow-y-auto max-h-[calc(100vh-12rem)] custom-scrollbar",children:["login"===u&&(0,t.jsx)(b,{onLoginSuccess:j,onSwitchMode:y}),"register"===u&&(0,t.jsx)(P,{onSwitchMode:y}),"forgot"===u&&(0,t.jsx)(L,{onSwitchMode:y})]})]})})})}},67758:(e,r,a)=>{a.d(r,{J:()=>n});var t=a(95155),s=a(95684),o=a(17268);let n=({loading:e,success:r})=>e?(0,t.jsx)(s.T,{isIconOnly:!0,className:"bg-transparent",isLoading:e}):r?(0,t.jsx)(o.iW,{color:"#00FF00",size:20}):(0,t.jsx)(t.Fragment,{})},69127:(e,r,a)=>{a.d(r,{OAuthButtons:()=>c});var t=a(95155),s=a(12115),o=a(18720),n=a(95684),d=a(21779),i=a(82721),l=a(12976);function c({onSuccess:e,variant:r="bordered",className:a}){let[c,u]=(0,s.useState)(null),{login:m}=(0,d.J)(),{config:g,loading:f,error:h}=(0,i.a)(),{t:x}=(0,l.k)(),p=async r=>{if(!g)return void o.oR.error(x("oauth.config_not_loaded","OAuth configuration not loaded yet"));let a=!!g.googleClientId&&!1!==g.googleEnabled,t=!!g.facebookClientId&&!1!==g.facebookEnabled;if("google"===r&&!a)return void o.oR.error(x("oauth.google_not_enabled","Google login is not enabled"));if("facebook"===r&&!t)return void o.oR.error(x("oauth.facebook_not_enabled","Facebook login is not enabled"));u(r);try{let a=window.screen.width/2-250,t=window.screen.height/2-300,s=b(r);if(!window.open(s,`${r}-oauth`,`width=500,height=600,left=${a},top=${t}`)){o.oR.error(x("oauth.allow_popups","Please allow popups to continue with OAuth login")),u(null);return}let n=async a=>{if(a.origin!==window.location.origin)return;let{type:t,provider:s,error:d}=a.data;"oauth-success"===t&&s===r?(await m(),o.oR.success(x("oauth.login_success","Successfully logged in with {provider}").replace("{provider}",r)),window.removeEventListener("message",n),u(null),e?.()):"oauth-error"===t&&s===r&&(o.oR.error(x("oauth.login_failed","{provider} login failed: {error}").replace("{provider}",r).replace("{error}",d)),window.removeEventListener("message",n),u(null))};window.addEventListener("message",n)}catch(e){o.oR.error(x("oauth.error","OAuth error: {message}").replace("{message}",e.message)),u(null)}},b=e=>{if(!g)return"";let r=`${window.location.origin}/api/auth/callback/${e}`;if("google"===e){let e=new URLSearchParams({client_id:g.googleClientId,redirect_uri:r,response_type:"token id_token",scope:"openid profile email",prompt:"select_account",nonce:Math.random().toString(36).substring(7)});return`https://accounts.google.com/o/oauth2/v2/auth?${e.toString()}`}let a=new URLSearchParams({client_id:g.facebookClientId,redirect_uri:r,response_type:"token",scope:"email,public_profile"});return`https://www.facebook.com/v18.0/dialog/oauth?${a.toString()}`},w=!!g?.googleClientId&&!1!==g.googleEnabled,v=!!g?.facebookClientId&&!1!==g.facebookEnabled;return!f||g||h?w||v?(0,t.jsxs)("div",{className:`flex flex-col gap-3 ${a||""}`,children:[w&&(0,t.jsx)(n.T,{isDisabled:!!c||!g,isLoading:"google"===c,startContent:!c&&(0,t.jsxs)("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),(0,t.jsx)("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),(0,t.jsx)("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),(0,t.jsx)("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),variant:r,onPress:()=>p("google"),children:"Continue with Google"}),v&&(0,t.jsx)(n.T,{isDisabled:!!c||!g,isLoading:"facebook"===c,startContent:!c&&(0,t.jsx)("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z",fill:"#1877F2"})}),variant:r,onPress:()=>p("facebook"),children:"Continue with Facebook"})]}):null:(0,t.jsxs)("div",{className:`flex flex-col gap-3 ${a||""}`,children:[(0,t.jsx)("div",{className:"h-11 rounded-xl bg-gray-200 dark:bg-gray-800 animate-pulse"}),(0,t.jsx)("div",{className:"h-11 rounded-xl bg-gray-200 dark:bg-gray-800 animate-pulse"})]})}},82721:(e,r,a)=>{a.d(r,{a:()=>d});var t=a(12115);let s=null,o=null;async function n(){let e=await fetch("/api/auth/oauth-config",{cache:"no-store"}),r=await e.json(),a={googleClientId:r.googleClientId??"",facebookClientId:r.facebookClientId??"",basicEnabled:"boolean"!=typeof r.basicEnabled||r.basicEnabled,googleEnabled:"boolean"==typeof r.googleEnabled?r.googleEnabled:!!r.googleClientId,facebookEnabled:"boolean"==typeof r.facebookEnabled?r.facebookEnabled:!!r.facebookClientId};return s=a,a}function d(){let[e,r]=(0,t.useState)(s),[a,d]=(0,t.useState)(!s),[i,l]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(s){r(s),d(!1);return}let e=!1;return o||(o=n().finally(()=>{o=null})),d(!0),o.then(a=>{e||(r(a),d(!1))}).catch(r=>{e||(l(r instanceof Error?r:Error("Failed to load auth config")),d(!1))}),()=>{e=!0}},[]),{config:e,loading:a,error:i}}},85986:(e,r,a)=>{a.d(r,{c:()=>c});var t=a(12395),s=a(12115),o=a(55657),n=a(95166),d=a(29930),i=a(95155),l=(0,o.Rf)((e,r)=>{let{as:a,children:o,className:l,...c}=e,{slots:u,classNames:m,headerId:g,setHeaderMounted:f}=(0,t.k)(),h=(0,n.zD)(r);return(0,s.useEffect)(()=>(f(!0),()=>f(!1)),[f]),(0,i.jsx)(a||"header",{ref:h,className:u.header({class:(0,d.cn)(null==m?void 0:m.header,l)}),id:g,...c,children:o})});l.displayName="HeroUI.ModalHeader";var c=l},90711:(e,r,a)=>{a.d(r,{y:()=>s});var t=a(12115);function s(e){let r=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(!e)return;r.current=window.scrollY||0;let a=document.body,t=document.documentElement,s=t.style.scrollBehavior;return t.style.scrollBehavior="auto",a.style.position="fixed",a.style.top=`-${r.current}px`,a.style.left="0",a.style.right="0",a.style.width="100%",a.style.overflow="hidden",a.style.touchAction="none",a.style.overscrollBehaviorY="contain",()=>{a.style.position="",a.style.top="",a.style.left="",a.style.right="",a.style.width="",a.style.overflow="",a.style.touchAction="",a.style.overscrollBehaviorY="",t.style.scrollBehavior=s,window.scrollTo(0,r.current)}},[e])}}}]);