1import{a4 as j,b as y,r as n,f as N,a6 as h,j as e,B as x}from"./index-DfyJ78f7.js";import{F as w}from"./Footer-MXy4jaOc.js";import"./SocialIcons-DPrjw7F-.js";import"./useTranslation-DZUoPLtO.js";function C(){const{token:s}=j(),a=y(),[t,u]=n.useState(null),[p,o]=n.useState(!0),[g,l]=n.useState(!1),[i,d]=n.useState(!1),{addToast:m}=N(),r=!!localStorage.getItem("token");n.useEffect(()=>{if(!s){l(!0),o(!1);return}h.preview(s).then(c=>{u(c)}).catch(()=>l(!0)).finally(()=>o(!1))},[s]);const b=async()=>{if(!(!s||i)){d(!0);try{await h.accept(s),m("Friend request accepted!","success"),a("/home")}catch(c){m(c.message||"Failed to accept invite","error")}finally{d(!1)}}},f=()=>{a(`/login?invite=${s}`)};if(p)return e.jsx("div",{className:"flex items-center justify-center min-h-screen bg-theme-body",children:e.jsx(x,{size:36,className:"animate-pulse"})});const v=(t==null?void 0:t.status)==="accepted"||(t==null?void 0:t.status)==="expired";return e.jsxs("div",{className:"min-h-screen bg-theme-body flex flex-col",children:[e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center px-6",children:e.jsxs("div",{className:"max-w-md w-full",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx(x,{size:64,className:"mx-auto mb-4"}),e.jsx("h1",{className:"hidden text-2xl font-bold text-theme-heading ds-heading",children:"spilo"})]}),e.jsx("div",{className:"bg-theme-card rounded-theme-card shadow-theme-card p-8",children:g?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-center text-theme-secondary mb-6",children:"This invite link is no longer valid."}),e.jsx("button",{onClick:()=>a("/login"),className:"w-full py-3 rounded-theme-button bg-theme-inverse text-white font-medium hover:bg-theme-secondary transition-colors",children:"Sign up anyway"})]}):v?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-center text-theme-secondary mb-2",children:["This invite has already been ",(t==null?void 0:t.status)==="accepted"?"accepted":"expired","."]}),e.jsx("button",{onClick:()=>a(r?"/home":"/login"),className:"w-full py-3 rounded-theme-button bg-theme-inverse text-white font-medium hover:bg-theme-secondary transition-colors mt-4",children:r?"Go to spilo":"Sign up"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-emerald-50 dark:bg-emerald-950/30 mb-3",children:e.jsx("svg",{className:"w-6 h-6 text-emerald-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 002.625.372 9.337 9.337 0 004.121-.952 4.125 4.125 0 00-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 018.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0111.964-1.997M12 6.375a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zm8.25 2.25a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z"})})}),e.jsx("h2",{className:"text-xl font-bold text-theme-heading mb-1",children:t!=null&&t.inviter_name?`${t.inviter_name} wants to connect!`:"You've been invited!"}),e.jsx("p",{className:"text-sm text-theme-secondary",children:"Accept to become friends on spilo and start sharing lists and content."})]}),r?e.jsx("button",{onClick:b,disabled:i,className:"w-full py-3 rounded-theme-button bg-theme-inverse text-white font-medium hover:bg-theme-secondary disabled:opacity-50 transition-colors",children:i?"Accepting...":"Accept friend request"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:f,className:"w-full py-3 rounded-theme-button bg-theme-inverse text-white font-medium hover:bg-theme-secondary transition-colors",children:"Sign up to accept"}),e.jsx("p",{className:"text-[12px] text-theme-muted text-center mt-3",children:"Sign up and you'll be connected automatically"})]})]})})]})}),e.jsx(w,{})," "]})}export{C as InvitePage};
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.