1import{r as l,j as e}from"./vendor-query-BNJGOXGz.js";import{i as B,V as H,T as D,j as M,n as U,o as z,q as J,k as V,l as u}from"./index-CXKNDLxW.js";import{I as h}from"./input-iYDCH84P.js";import{L as g}from"./label-zF1gFdX1.js";import{T as $,a as K,b as k}from"./tabs-Busr65CM.js";import{A as P,a as L}from"./alert-DicjY0rE.js";import{S as Y}from"./separator-zpk58xvL.js";import{L as T}from"./loader-circle-DncPvz8c.js";import{E}from"./eye-off-CjOq5IoR.js";import{E as _}from"./eye-qXwV_Sow.js";import"./vendor-react-BN0qJr-I.js";import"./dialog-CY2ppsCv.js";import"./Combination-DKjw7csT.js";import"./index-BvziCUOS.js";import"./index-Bs_owbNO.js";/** 2 * @license lucide-react v0.453.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Q=B("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),W="your_google_client_id.apps.googleusercontent.com",X="your_github_client_id",Z="https://fsnews.fly.dev";function pe(){const[,F]=H(),[o,x]=l.useState("login"),[n,i]=l.useState(!1),[c,v]=l.useState(null),[w,r]=l.useState(null),[N,p]=l.useState(null),[d,b]=l.useState(!1),j=new URLSearchParams(window.location.search).get("returnTo")||"/",[m,y]=l.useState(""),[f,C]=l.useState(""),[S,O]=l.useState("");l.useEffect(()=>{["https://accounts.google.com","https://github.com"].forEach(a=>{if(!document.querySelector(`link[rel="preconnect"][href="${a}"]`)){const t=document.createElement("link");t.rel="preconnect",t.href=a,document.head.appendChild(t)}})},[]);const A=async s=>{s.preventDefault(),r(null),i(!0);try{const a=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:m,password:f})}),t=await a.json();if(!a.ok){r(t.error||"Login failed");return}F(j),window.location.reload()}catch{r("Network error. Please try again.")}finally{i(!1)}},R=async s=>{s.preventDefault(),r(null),i(!0);try{const a=await fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:m,password:f,name:S})}),t=await a.json();if(!a.ok){r(t.error||"Registration failed");return}p("Account created! Please check your email to verify your account."),x("login")}catch{r("Network error. Please try again.")}finally{i(!1)}},G=async s=>{s.preventDefault(),r(null),i(!0);try{const a=await fetch("/api/auth/forgot-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:m})}),t=await a.json();if(!a.ok){r(t.error||"Request failed");return}p(t.message)}catch{r("Network error. Please try again.")}finally{i(!1)}},I=()=>{v("google");const s=`${Z}/api/auth/google/callback`,a=JSON.stringify({returnTo:j}),t=new URL("https://accounts.google.com/o/oauth2/v2/auth");t.searchParams.set("client_id",W),t.searchParams.set("redirect_uri",s),t.searchParams.set("response_type","code"),t.searchParams.set("scope","openid email profile"),t.searchParams.set("access_type","offline"),t.searchParams.set("state",a),window.location.href=t.toString()},q=()=>{v("github");const s=JSON.stringify({returnTo:j}),a=new URL("https://github.com/login/oauth/authorize");a.searchParams.set("client_id",X),a.searchParams.set("scope","user:email"),a.searchParams.set("state",s),window.location.href=a.toString()};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md
6space-y-6",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-8 w-8 text-orange-500"}),e.jsx("span",{className:"text-2xl font-bold",children:"FutureSignal"})]}),e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Real-time news meets prediction markets"})]}),e.jsxs(M,{children:[e.jsx(U,{className:"pb-4",children:o==="forgot"?e.jsxs(e.Fragment,{children:[e.jsx(z,{children:"Reset password"}),e.jsx(J,{children:"Enter your email and we'll send you a reset link."})]}):e.jsx($,{value:o,onValueChange:s=>{x(s),r(null),p(null)},children:e.jsxs(K,{className:"w-full",children:[e.jsx(k,{value:"login",className:"flex-1",children:"Sign in"}),e.jsx(k,{value:"register",className:"flex-1",children:"Create account"})]})})}),e.jsxs(V,{className:"space-y-4",children:[w&&e.jsx(P,{variant:"destructive",children:e.jsx(L,{children:w})}),N&&e.jsx(P,{children:e.jsx(L,{children:N})}),o!=="forgot"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(u,{variant:"outline",onClick:I,className:"w-full",disabled:c!==null,children:[c==="google"?e.jsx(T,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsxs("svg",{className:"mr-2 h-4 w-4",viewBox:"0 0 24 24",children:[e.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"}),e.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"}),e.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"}),e.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"})]}),c==="google"?"Redirecting...":"Google"]}),e.jsxs(u,{variant:"outline",onClick:q,className:"w-full",disabled:c!==null,children:[c==="github"?e.jsx(T,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Q,{className:"mr-2 h-4 w-4"}),c==="github"?"Redirecting...":"GitHub"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx(Y,{})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"or continue with email"})})]})]}),o==="login"&&e.jsxs("form",{onSubmit:A,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"email",children:"Email"}),e.jsx(h,{id:"email",type:"email",placeholder:"[email protected]",value:m,onChange:s=>y(s.target.value),required:!0,autoComplete:"email"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(g,{htmlFor:"password",children:"Password"}),e.jsx("button",{type:"button",className:"text-xs text-orange-500 hover:underline",onClick:()=>{x("forgot"),r(null),p(null)},children:"Forgot password?"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(h,{id:"password",type:d?"text":"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:f,onChange:s=>C(s.target.value),required:!0,autoComplete:"current-password"}),e.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",onClick:()=>b(!d),children:d?e.jsx(E,{className:"h-4 w-4"}):e.jsx(_,{className:"h-4 w-4"})})]})]}),e.jsx(u,{type:"submit",className:"w-full bg-orange-500 hover:bg-orange-600",disabled:n,children:n?"Signing in...":"Sign in"})]}),o==="register"&&e.jsxs("form",{onSubmit:R,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"name",children:"Full name"}),e.jsx(h,{id:"name",type:"text",placeholder:"Your name",value:S,onChange:s=>O(s.target.value),required:!0,autoComplete:"name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"reg-email",children:"Email"}),e.jsx(h,{id:"reg-email",type:"email",placeholder:"[email protected]",value:m,onChange:s=>y(s.target.value),required:!0,autoComplete:"email"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"reg-password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(h,{id:"reg-password",type:d?"text":"password",placeholder:"At least 8 characters",value:f,onChange:s=>C(s.target.value),required:!0,minLength:8,autoComplete:"new-password"}),e.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",onClick:()=>b(!d),children:d?e.jsx(E,{className:"h-4 w-4"}):e.jsx(_,{className:"h-4 w-4"})})]})]}),e.jsx(u,{type:"submit",className:"w-full bg-orange-500 hover:bg-orange-600",disabled:n,children:n?"Creating account...":"Create account"}),e.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["By creating an account, you agree to our"," ",e.jsx("a",{href:"/terms",className:"text-orange-500 hover:underline",children:"Terms of Service"})," ","and"," ",e.jsx("a",{href:"/privacy",className:"text-orange-500 hover:underline",children:"Privacy Policy"}),"."]})]}),o==="forgot"&&e.jsxs("form",{onSubmit:G,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"forgot-email",children:"Email"}),e.jsx(h,{id:"forgot-email",type:"email",placeholder:"[email protected]",value:m,onChange:s=>y(s.target.value),required:!0})]}),e.jsx(u,{type:"submit",className:"w-full bg-orange-500 hover:bg-orange-600",disabled:n,children:n?"Sending...":"Send reset link"}),e.jsx(u,{type:"button",variant:"ghost",className:"w-full",onClick:()=>{x("login"),r(null),p(null)},children:"Back to sign in"})]})]})]})]})})}export{pe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.