1import{ai as m,l as h,r as l,j as e,b5 as u,C as p,b as j,N as g,d as w,b7 as f,B as a,e as v,J as N}from"./index-YBp21Rl7.js";import{L as y,U as C}from"./user-check-BihiSGNV.js";function P(){const[b,x]=m("/license/accept/:token"),{token:t}=x||{},{user:k,isAuthenticated:r}=h(),[s,c]=l.useState("loading"),[d,n]=l.useState("");return l.useEffect(()=>{document.title="Accept License Invitation - Labrador"},[]),l.useEffect(()=>{(async()=>{if(!t){c("error"),n("Invalid invitation link.");return}if(!r){c("auth-required"),n("Welcome! Please sign in or create an account to join the team.");return}try{const i=await N("POST",`/api/licenses/accept/${t}`,{});if(i.ok){const o=await i.json();c("success"),n(o.message||"License accepted successfully!"),setTimeout(()=>{window.location.href=o.redirectTo||"/projects"},3e3)}else{const o=await i.json();c("error"),n(o.message||"Failed to accept license invitation.")}}catch(i){console.error("Error accepting license:",i),c("error"),n("An unexpected error occurred. Please try again.")}})()},[t,r]),e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-100 via-purple-50 to-pink-200",children:[e.jsx("header",{className:"bg-white shadow-sm border-b border-gray-200",children:e.jsx("nav",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"flex justify-between items-center h-16",children:e.jsx("div",{className:"flex items-center",children:e.jsx(u,{})})})})}),e.jsx("main",{id:"main-content",tabIndex:-1,className:"max-w-md mx-auto py-12 px-4 focus:outline-none",children:e.jsxs(p,{children:[e.jsx(j,{children:e.jsxs(g,{className:"text-center",children:[s==="loading"&&"Processing License Invitation...",s==="success"&&"License Accepted Successfully!",s==="auth-required"&&"You're Invited to Join the Team!",s==="error"&&"Invitation Error"]})}),e.jsxs(w,{className:"text-center space-y-4",children:[s==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"h-12 w-12 text-blue-600 mx-auto animate-spin"}),e.jsx("p",{className:"text-gray-600",children:"Please wait while we process your license invitation..."})]}),s==="success"&&e.jsxs("div",{role:"alert","aria-live":"assertive",children:[e.jsx(f,{className:"h-12 w-12 text-green-600 mx-auto","aria-hidden":"true"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-green-700 font-medium",children:d}),e.jsx("p",{className:"text-gray-600 text-sm",children:"You will be redirected to your projects shortly."})]}),e.jsx(a,{onClick:()=>window.location.href="/projects",className:"mt-4",children:"Go to Projects"})]}),s==="auth-required"&&e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"h-12 w-12 text-blue-600 mx-auto"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-blue-700 font-medium",children:d}),e.jsx("p",{className:"text-gray-600 text-sm",children:"Sign in with your existing account or create a new one to get started."})]}),e.jsxs("div",{className:"flex flex-col space-y-2 mt-4",children:[e.jsx(a,{onClick:()=>window.location.href=`/login?redirect=${encodeURIComponent(`/license/accept/${t}`)}`,children:"Sign In"}),e.jsx(a,{onClick:()=>window.location.href=`/signup?redirect=${encodeURIComponent(`/license/accept/${t}`)}`,variant:"outline",children:"Create Account"})]})]}),s==="error"&&e.jsxs("div",{role:"alert","aria-live":"assertive",children:[e.jsx(v,{className:"h-12 w-12 text-red-600 mx-auto","aria-hidden":"true"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-red-700 font-medium",children:d}),r?e.jsx("p",{className:"text-gray-600 text-sm",children:"Please contact the person who sent you this invitation for assistance."}):e.jsx("p",{className:"text-gray-600 text-sm",children:"You'll need to sign in with the account that received this invitation, or create a new account with that email address."})]}),r?e.jsxs("div",{className:"flex flex-col space-y-2 mt-4",children:[e.jsx(a,{onClick:()=>window.location.reload(),variant:"outline",children:"Try Again"}),e.jsx(a,{onClick:()=>window.location.href="/projects",children:"Go to Projects"})]}):e.jsxs("div",{className:"flex flex-col space-y-2 mt-4",children:[e.jsx(a,{onClick:()=>window.location.href=`/login?redirect=${encodeURIComponent(`/license/accept/${t}`)}`,children:"Sign In"}),e.jsx(a,{onClick:()=>window.location.href=`/signup?redirect=${encodeURIComponent(`/license/accept/${t}`)}`,variant:"outline",children:"Create Account"})]})]})]})]})})]})}export{P 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.