1var D=Object.defineProperty;var n=(s,x)=>D(s,"name",{value:x,configurable:!0});import{j as e,L as N,T as I,W as R,S as F,ba as $,an as J,R as O,m as W}from"./vendor-ui-CGbRblPw.js";import{g as q,d as z,r as a,L as b}from"./vendor-react-B7SHFsLe.js";import{h as G,A as v}from"./index-ClNjN171.js";import{P as H}from"./PasswordStrengthMeter-gUQeKdfa.js";import"./vendor-query-BpyaVjbq.js";const M=[.22,1,.36,1],y="w-full rounded-xl border border-border bg-muted/40 px-4 py-3 pr-10 text-sm text-foreground placeholder:text-muted-foreground outline-none transition-colors duration-200 focus:border-transparent focus:ring-2 focus:ring-primary";function u({children:s}){return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4 py-12",children:e.jsx(W.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.45,ease:M},className:"w-full max-w-md rounded-xl border border-border bg-card p-8 shadow-sm",children:s})})}n(u,"Shell");function Y(s){return s.length<8?"Password must be at least 8 characters":/[A-Z]/.test(s)?/[a-z]/.test(s)?/[0-9]/.test(s)?null:"Password must contain a number":"Password must contain a lowercase letter":"Password must contain an uppercase letter"}n(Y,"passwordProblem");function X(){G("Accept your invitation | Botvee");const{token:s}=q(),x=z(),[t,w]=a.useState(null),[f,h]=a.useState(""),[S,P]=a.useState(!0),[o,C]=a.useState(""),[c,E]=a.useState(""),[m,A]=a.useState(!1),[p,j]=a.useState(!1),[g,i]=a.useState(""),[k,T]=a.useState(!1);a.useEffect(()=>{let r=!1;return(async()=>{try{const d=await fetch(`${v}/api/staff-invite/${s}`),l=await d.json().catch(()=>({}));if(r)return;d.ok?w(l.invitation):h(l.error||"This invitation link is not valid.")}catch{r||h("We could not reach the server. Please try again.")}finally{r||P(!1)}})(),()=>{r=!0}},[s]);const L=n(async r=>{r.preventDefault(),i("");const d=Y(o);if(d){i(d);return}if(o!==c){i("Passwords do not match");return}j(!0);try{const l=await fetch(`${v}/api/staff-invite/${s}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:o})}),B=await l.json().catch(()=>({}));if(!l.ok){i(B.error||"Could not create your account.");return}T(!0),setTimeout(()=>x("/login"),2500)}catch{i("We could not reach the server. Please try again.")}finally{j(!1)}},"submit");return S?e.jsx(u,{children:e.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-sm text-muted-foreground",children:[e.jsx(N,{className:"h-4 w-4 animate-spin"})," Checking your invitationâ¦"]})}):f||!t?e.jsx(u,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10",children:e.jsx(I,{className:"h-6 w-6 text-destructive"})}),e.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Invitation unavailable"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:f}),e.jsx(b,{to:"/login",className:"mt-6 inline-block text-sm font-medium text-primary transition-colors duration-200 hover:underline",children:"Go to sign in"})]})}):k?e.jsx(u,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-success/10",children:e.jsx(R,{className:"h-6 w-6 text-success"})}),e.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Account created"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Your staff account is ready. Taking you to sign inâ¦"})]})}):e.jsxs(u,{children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-primary/10",children:e.jsx(F,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Join the Botvee team"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Set a password to activate your staff account."})]})]}),e.jsxs("dl",{className:"mb-6 space-y-2 rounded-xl border border-border bg-muted/30 p-4 text-sm",children:[e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Email"}),e.jsx("dd",{className:"truncate font-medium text-foreground",children:t.email})]}),t.fullName&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Name"}),e.jsx("dd",{className:"truncate font-medium text-foreground",children:t.fullName})]}),t.roleName&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Role"}),e.jsx("dd",{className:"truncate font-medium text-foreground",children:t.roleName})]}),t.departmentName&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Department"}),e.jsx("dd",{className:"truncate font-medium text-foreground",children:t.departmentName})]}),t.jobTitle&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Job title"}),e.jsx("dd",{className:"truncate font-medium text-foreground",children:t.jobTitle})]}),t.invitedByEmail&&e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Invited by"}),e.jsx("dd",{className:"truncate font-medium text-foreground",children:t.invitedByEmail})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Expires"}),e.jsx("dd",{className:"font-medium text-foreground",children:new Date(t.expiresAt).toLocaleDateString()})]})]}),e.jsxs("form",{onSubmit:L,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"staff-invite-password",className:"text-sm font-medium text-foreground",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:"staff-invite-password",type:m?"text":"password",value:o,onChange:n(r=>C(r.target.value),"onChange"),placeholder:"Create a password",autoComplete:"new-password",required:!0,className:y}),e.jsx("button",{type:"button",onClick:n(()=>A(r=>!r),"onClick"),"aria-label":m?"Hide password":"Show password",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors duration-200 hover:text-foreground",children:m?e.jsx($,{className:"h-4 w-4"}):e.jsx(J,{className:"h-4 w-4"})})]}),e.jsx(H,{password:o}),!o&&e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"At least 8 characters, with an uppercase letter, a lowercase letter and a number."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"staff-invite-confirm",className:"text-sm font-medium text-foreground",children:"Confirm password"}),e.jsx("input",{id:"staff-invite-confirm",type:m?"text":"password",value:c,onChange:n(r=>E(r.target.value),"onChange"),placeholder:"Repeat your password",autoComplete:"new-password",required:!0,className:y}),c&&c!==o&&e.jsx("p",{className:"text-[11px] text-destructive",children:"Passwords do not match"})]}),g&&e.jsx("p",{className:"rounded-xl border border-destructive/25 bg-destructive/10 p-3 text-sm text-destructive",children:g}),e.jsx("button",{type:"submit",disabled:p,className:"flex w-full items-center justify-center gap-2 rounded-xl bg-primary py-3 text-sm font-semibold text-white transition-colors duration-200 hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-60",children:p?e.jsx(N,{className:"h-4 w-4 animate-spin"}):e.jsxs(e.Fragment,{children:["Create account ",e.jsx(O,{className:"h-4 w-4"})]})})]}),e.jsxs("p",{className:"mt-6 text-center text-xs text-muted-foreground",children:["Already activated?"," ",e.jsx(b,{to:"/login",className:"font-medium text-primary transition-colors duration-200 hover:underline",children:"Sign in"})]})]})}n(X,"StaffInviteAccept");export{X 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.