1import{ab as x,Z as i,U as e,L as o,g as d,c as u,v as h}from"./index-BMeCVODT.js";import{C as f}from"./circle-check-CpiowtTv.js";import{U as g}from"./users-CIlEuXLD.js";function w(){const[,m]=x(),[n,a]=i.useState("loading"),[l,r]=i.useState(""),s=i.useMemo(()=>{var t;return((t=new URLSearchParams(window.location.search).get("token"))==null?void 0:t.trim())??""},[]);return i.useEffect(()=>{if(!s){a("error"),r("Missing invitation token.");return}(async()=>{try{const t=await fetch("/api/account/team/accept-invitation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:s})});if(t.status===401){a("needs-login"),r("Sign in â or create your account â with the email address that received this invitation. You'll join the team's Starter workspace automatically.");return}if(!t.ok){const c=await t.json().catch(()=>({}));a("error"),r((c==null?void 0:c.message)||"This invitation could not be accepted.");return}a("accepted"),setTimeout(()=>m("/account?section=team"),1200)}catch{a("error"),r("Network error. Try the invitation link again.")}})()},[m,s]),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 neu-card p-8 text-center",children:[e.jsx("div",{className:"mb-6",children:e.jsxs(o,{href:"/",className:"inline-flex items-center gap-2",children:[e.jsx("img",{src:"/icon.png",alt:"",className:"h-7 w-7"}),e.jsx("span",{className:"font-bold text-foreground text-lg",children:"LongMile"})]})}),n==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"h-10 w-10 text-primary animate-spin mx-auto mb-3"}),e.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Accepting invitation"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This only takes a moment."})]}),n==="accepted"&&e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"h-12 w-12 text-emerald-500 mx-auto mb-3"}),e.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Invitation accepted"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Taking you to your team workspace."})]}),n==="needs-login"&&e.jsxs(e.Fragment,{children:[e.jsx(g,{className:"h-12 w-12 text-primary mx-auto mb-3"}),e.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Sign in to accept"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:l}),e.jsxs(o,{href:`/signup?next=${encodeURIComponent(`/team/accept?token=${s}`)}`,className:"neu-btn-primary mt-6 h-11 px-4 text-sm font-medium inline-flex items-center justify-center gap-2 w-full",children:["Create account",e.jsx(u,{className:"h-4 w-4"})]}),e.jsx(o,{href:`/login?next=${encodeURIComponent(`/team/accept?token=${s}`)}`,className:"neu-btn mt-2 h-11 px-4 text-sm font-medium inline-flex items-center justify-center gap-2 w-full",children:"I already have an account"})]}),n==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"h-12 w-12 text-amber-500 mx-auto mb-3"}),e.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Invitation unavailable"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:l}),e.jsx("p",{className:"text-sm text-muted-foreground mt-5",children:e.jsx(o,{href:"/account?section=team",className:"text-primary hover:underline font-medium",children:"Back to team settings"})})]})]})})}export{w 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.