(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[520],{1396:(e,t,a)=>{Promise.resolve().then(a.bind(a,8111)),Promise.resolve().then(a.bind(a,670))},8111:(e,t,a)=>{"use strict";a.d(t,{AL:()=>l,As:()=>d,AuthShell:()=>h});var s=a(5155),r=a(8173),n=a.n(r);let i="AI Trading Coach";function l(){return(0,s.jsxs)(n(),{href:"/workspace",className:"auth-brand","aria-label":i,children:[(0,s.jsx)("div",{className:"brand-mark","aria-hidden":"true",children:"AI"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"brand-name",children:i}),(0,s.jsx)("div",{className:"brand-sub",children:"Discretionary trading, refined."})]})]})}function o(e){let{rightLink:t}=e;return(0,s.jsxs)("header",{className:"auth-topbar",children:[(0,s.jsx)(l,{}),(0,s.jsx)("span",{className:"topbar-spacer"}),t&&(0,s.jsxs)(n(),{className:"topbar-link",href:t.href,children:[t.label," →"]})]})}function c(){return(0,s.jsxs)("footer",{className:"auth-footer",children:[(0,s.jsx)("span",{children:"\xa9 2026 aitrading.coach"}),(0,s.jsx)("span",{className:"sep",children:"\xb7"}),(0,s.jsx)(n(),{href:"/legal/privacy",children:"Privacy"}),(0,s.jsx)("span",{className:"sep",children:"\xb7"}),(0,s.jsx)(n(),{href:"/legal/terms",children:"Terms"}),(0,s.jsx)("span",{className:"sep",children:"\xb7"}),(0,s.jsxs)("a",{href:"https://status.aitrading.coach",target:"_blank",rel:"noreferrer",children:[(0,s.jsx)("span",{className:"status-dot"}),"Status \xb7 all systems normal"]}),(0,s.jsx)("span",{className:"spacer"}),(0,s.jsx)("span",{children:"v1.4.2"})]})}function d(){return(0,s.jsxs)("span",{className:"trust-pill",children:[(0,s.jsx)("span",{className:"dot"}),"MT5 EA \xb7 ",(0,s.jsx)("strong",{children:"authenticated"})," \xb7 14ms"]})}function u(){return(0,s.jsxs)("div",{className:"auth-illust",style:{flexDirection:"column",gap:24},children:[(0,s.jsxs)("div",{style:{fontFamily:"var(--font-mono)",fontSize:9.5,textTransform:"uppercase",letterSpacing:"0.2em",color:"var(--accent)"},children:["\xa7 ",i]}),(0,s.jsxs)("div",{style:{fontFamily:"var(--font-display)",fontSize:38,lineHeight:1.1,letterSpacing:"-0.025em",color:"var(--ink)",maxWidth:380,fontWeight:400},children:["An AI coach that ",(0,s.jsx)("em",{style:{color:"var(--accent-2)"},children:"draws"})," on your chart."]}),(0,s.jsx)("div",{style:{fontFamily:"var(--font-display)",fontStyle:"italic",fontSize:16,color:"var(--ink-3)",maxWidth:380,lineHeight:1.55,fontWeight:350},children:"Discretionary trading, refined. Mark supply zones, FVG, and Wyckoff phases — without leaving the chart."}),(0,s.jsx)("div",{style:{marginTop:20},children:(0,s.jsx)(d,{})})]})}function h(e){let{children:t,rightLink:a}=e;return(0,s.jsxs)("div",{className:"auth-page",children:[(0,s.jsx)(o,{rightLink:a}),(0,s.jsxs)("main",{className:"auth-main",children:[(0,s.jsx)(u,{}),t]}),(0,s.jsx)(c,{})]})}},452:(e,t,a)=>{"use strict";a.d(t,{a:()=>n});var s=a(5155),r=a(3745);function n(e){let{label:t="Continue with Google",disabled:a}=e;return(0,s.jsxs)("button",{type:"button",onClick:()=>{a||window.location.assign(r.FH.googleSigninUrl())},disabled:a,className:"group flex w-full items-center justify-center gap-3 rounded-xl border border-slate-200 bg-white px-5 py-3 text-sm font-medium text-slate-700 shadow-sm transition hover:border-slate-300 hover:shadow disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100 dark:hover:border-slate-600",children:[(0,s.jsx)(i,{}),(0,s.jsx)("span",{children:t})]})}function i(){return(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",children:[(0,s.jsx)("path",{fill:"#4285F4",d:"M17.64 9.2045c0-.6381-.0573-1.2518-.1636-1.8409H9v3.4814h4.8436c-.2086 1.125-.8427 2.0782-1.7959 2.7164v2.2581h2.9087c1.7018-1.5668 2.6836-3.874 2.6836-6.615z"}),(0,s.jsx)("path",{fill:"#34A853",d:"M9 18c2.43 0 4.4673-.806 5.9564-2.1804l-2.9087-2.2581c-.806.54-1.8368.8595-3.0477.8595-2.344 0-4.3282-1.5831-5.036-3.7104H.9574v2.3318C2.4382 15.9831 5.4818 18 9 18z"}),(0,s.jsx)("path",{fill:"#FBBC05",d:"M3.964 10.71c-.18-.54-.2823-1.1168-.2823-1.71s.1023-1.17.2823-1.71V4.9582H.9573A8.9965 8.9965 0 0 0 0 9c0 1.4523.3477 2.8268.9573 4.0418L3.964 10.71z"}),(0,s.jsx)("path",{fill:"#EA4335",d:"M9 3.5795c1.3214 0 2.5077.4541 3.4405 1.346l2.5813-2.5814C13.4632.8918 11.426 0 9 0 5.4818 0 2.4382 2.0168.9573 4.9582L3.964 7.29C4.6718 5.1627 6.656 3.5795 9 3.5795z"})]})}},670:(e,t,a)=>{"use strict";a.d(t,{LoginForm:()=>u});var s=a(5155),r=a(2115),n=a(8173),i=a.n(n),l=a(6046),o=a(3745),c=a(1069),d=a(452);function u(){let e=(0,l.useRouter)(),{login:t,status:a}=(0,c.A)(),[n,u]=(0,r.useState)("credentials"),[h,m]=(0,r.useState)(""),[f,p]=(0,r.useState)(""),[g,x]=(0,r.useState)(""),[v,j]=(0,r.useState)(!1),[y,b]=(0,r.useState)(null);(0,r.useEffect)(()=>{"authenticated"===a&&e.replace("/workspace")},[a,e]);let w=async a=>{a.preventDefault(),b(null),j(!0);try{if((await t({email:h.trim(),password:f,twoFactorCode:"twofactor"===n?g.replace(/\s/g,""):void 0})).requiresTwoFactor){u("twofactor");return}e.replace("/workspace")}catch(t){let e=t instanceof o.UJ?Array.isArray(t.body.message)?t.body.message.join("; "):t.body.message:"Something went wrong. Try again.";b(e),"twofactor"===n&&/code/i.test(e)&&x("")}finally{j(!1)}};return(0,s.jsxs)("form",{className:"auth-card",onSubmit:w,noValidate:!0,children:[(0,s.jsxs)("div",{className:"auth-eyebrow",children:[(0,s.jsx)("span",{className:"sigil","aria-hidden":"true",children:"\xa7"})," Sign in"]}),(0,s.jsxs)("h1",{className:"auth-title",children:["Welcome ",(0,s.jsx)("em",{children:"back"}),"."]}),(0,s.jsx)("p",{className:"auth-sub",children:"Pick up where the chart left off."}),y&&(0,s.jsxs)("div",{className:"alert alert-error",role:"alert",children:[(0,s.jsx)("span",{className:"alert-icon","aria-hidden":"true",children:"!"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"twofactor"===n?"Code rejected.":"Sign-in failed."})," ",y,"credentials"===n&&(0,s.jsxs)(s.Fragment,{children:[" ",(0,s.jsx)(i(),{href:"/forgot",children:"Reset your password"}),"."]})]})]}),"credentials"===n&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"field",children:[(0,s.jsx)("label",{className:"field-label",htmlFor:"login-email",children:"Email"}),(0,s.jsx)("input",{id:"login-email",className:"input",type:"email",autoComplete:"email",placeholder:"you@example.com",required:!0,value:h,onChange:e=>m(e.target.value),disabled:v})]}),(0,s.jsxs)("div",{className:"field",children:[(0,s.jsxs)("label",{className:"field-label",htmlFor:"login-password",children:["Password",(0,s.jsx)("span",{className:"helper",children:(0,s.jsx)(i(),{href:"/forgot",children:"Forgot?"})})]}),(0,s.jsx)("input",{id:"login-password",className:"input",type:"password",autoComplete:"current-password",placeholder:"••••••••••",required:!0,minLength:10,value:f,onChange:e=>p(e.target.value),disabled:v})]}),(0,s.jsxs)("button",{type:"submit",className:"btn btn-primary",disabled:v||!h.trim()||f.length<10,children:[v?"Signing in…":"Log in",(0,s.jsx)("span",{className:"kbd","aria-hidden":"true",children:"↵"})]}),(0,s.jsx)("div",{className:"or-divider","aria-hidden":"true",children:"or"}),(0,s.jsx)(d.a,{label:"Sign in with Google",disabled:v})]}),"twofactor"===n&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"alert alert-info",children:[(0,s.jsx)("span",{className:"alert-icon","aria-hidden":"true",children:"2"}),(0,s.jsx)("div",{children:"Two-factor required. Enter the 6-digit code from your authenticator."})]}),(0,s.jsxs)("div",{className:"field",children:[(0,s.jsx)("label",{className:"field-label",htmlFor:"login-otp",children:"Authentication code"}),(0,s.jsx)("input",{id:"login-otp",className:"input input-otp",type:"text",inputMode:"numeric",autoComplete:"one-time-code",pattern:"[0-9 ]*",placeholder:"000 000",maxLength:7,autoFocus:!0,value:g,onChange:e=>x(e.target.value),disabled:v})]}),(0,s.jsxs)("button",{type:"submit",className:"btn btn-primary",disabled:v||6!==g.replace(/\s/g,"").length,children:[v?"Verifying…":"Verify & continue",(0,s.jsx)("span",{className:"kbd","aria-hidden":"true",children:"↵"})]}),(0,s.jsx)("div",{style:{textAlign:"center",marginTop:14,fontSize:12,color:"var(--ink-4)"},children:(0,s.jsx)("button",{type:"button",onClick:()=>{u("credentials"),x(""),b(null)},style:{background:"none",border:0,color:"var(--accent-2)",cursor:"pointer"},children:"← Use a different account"})})]}),(0,s.jsxs)("div",{className:"auth-meta",children:["Don't have an account? ",(0,s.jsx)(i(),{href:"/signup",children:"Start free trial"})]})]})}},3745:(e,t,a)=>{"use strict";a.d(t,{FH:()=>h,UJ:()=>r,iD:()=>o,ki:()=>l});let s="https://api.aitrading.coach";class r extends Error{constructor(e,t){super((Array.isArray(t.message)?t.message.join("; "):t.message)||"HTTP ".concat(e)),this.status=e,this.body=t,this.name="ApiException"}}let n=null,i=null;function l(e){n=e}function o(){return n}async function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{method:a="GET",body:r,signal:i,noRefresh:l,authenticated:o=!0}=t,c={};void 0!==r&&(c["Content-Type"]="application/json"),o&&n&&(c.Authorization="Bearer ".concat(n));let h=await fetch("".concat(s).concat(e),{method:a,headers:c,body:void 0===r?void 0:JSON.stringify(r),credentials:"include",signal:i});if(401===h.status&&o&&!l){let t=await u();if(t)return c.Authorization="Bearer ".concat(t),d(await fetch("".concat(s).concat(e),{method:a,headers:c,body:void 0===r?void 0:JSON.stringify(r),credentials:"include",signal:i}))}return d(h)}async function d(e){let t=await e.text(),a=t?JSON.parse(t):null;if(!e.ok){var s;let n=null!==(s=null==a?void 0:a.error)&&void 0!==s?s:{code:"unknown",message:t||e.statusText,statusCode:e.status};throw new r(e.status,n)}return a}async function u(){return i||(i=(async()=>{try{let e=await c("/v1/auth/refresh",{method:"POST",noRefresh:!0,authenticated:!1});return n=e.accessToken,e.accessToken}catch(e){return n=null,null}finally{i=null}})())}let h={signup:e=>c("/v1/auth/signup",{method:"POST",body:e,authenticated:!1}),verifyEmail:e=>c("/v1/auth/verify-email",{method:"POST",body:e,authenticated:!1}),login:e=>c("/v1/auth/login",{method:"POST",body:e,authenticated:!1}),refresh:()=>c("/v1/auth/refresh",{method:"POST",noRefresh:!0,authenticated:!1}),logout:()=>c("/v1/auth/logout",{method:"POST",noRefresh:!0,authenticated:!1}),forgot:e=>c("/v1/auth/forgot",{method:"POST",body:e,authenticated:!1}),reset:e=>c("/v1/auth/reset",{method:"POST",body:e,authenticated:!1}),enroll2fa:()=>c("/v1/auth/2fa/enroll",{method:"POST"}),verify2fa:e=>c("/v1/auth/2fa/verify",{method:"POST",body:e}),me:()=>c("/v1/auth/me"),redeemHandover:e=>c("/v1/auth/handover/".concat(encodeURIComponent(e)),{method:"POST",authenticated:!1,noRefresh:!0}),googleSigninUrl:()=>"".concat(s,"/v1/auth/google"),health:()=>c("/v1/health",{authenticated:!1,noRefresh:!0})}},1069:(e,t,a)=>{"use strict";a.d(t,{A:()=>o,AuthProvider:()=>l});var s=a(5155),r=a(2115),n=a(3745);let i=(0,r.createContext)(null);function l(e){let{children:t}=e,[a,l]=(0,r.useState)({status:"loading",user:null}),o=(0,r.useCallback)(async()=>{try{let{accessToken:e}=await n.FH.refresh();(0,n.ki)(e);let t=await n.FH.me();l({status:"authenticated",user:t})}catch(e){(0,n.ki)(null),l({status:"anonymous",user:null})}},[]);(0,r.useEffect)(()=>{o()},[o]);let c=(0,r.useCallback)(async e=>{let t=await n.FH.login(e);if("requiresTwoFactor"in t&&t.requiresTwoFactor)return{requiresTwoFactor:!0};if(!("accessToken"in t))throw new n.UJ(500,{code:"unexpected",message:"Login response missing access token",statusCode:500});return(0,n.ki)(t.accessToken),l({status:"authenticated",user:await n.FH.me()}),{}},[]),d=(0,r.useCallback)(async e=>{await n.FH.signup(e),l({status:"anonymous",user:null})},[]),u=(0,r.useCallback)(async()=>{try{await n.FH.logout()}finally{(0,n.ki)(null),l({status:"anonymous",user:null})}},[]),h=(0,r.useMemo)(()=>({...a,login:c,signup:d,logout:u,refresh:o}),[a,c,d,u,o]);return(0,s.jsx)(i.Provider,{value:h,children:t})}function o(){let e=(0,r.useContext)(i);if(!e)throw Error("useAuth must be used inside ");return e}},6046:(e,t,a)=>{"use strict";var s=a(6658);a.o(s,"useParams")&&a.d(t,{useParams:function(){return s.useParams}}),a.o(s,"useRouter")&&a.d(t,{useRouter:function(){return s.useRouter}}),a.o(s,"useSearchParams")&&a.d(t,{useSearchParams:function(){return s.useSearchParams}})}},e=>{var t=t=>e(e.s=t);e.O(0,[173,441,517,358],()=>t(1396)),_N_E=e.O()}]);