1import{r,j as e}from"./react-vendor-Dc4PsQq0.js";import{A as C}from"./AuthShell-DGTZuPO_.js";import{t as n,a as o}from"./index-5nRfQ--P.js";import{L as d,I as m}from"./label-Doc1f-25.js";import{ae as w}from"./vendor-C0RMI9HL.js";import{a8 as u}from"./ui-vendor-BQj_Jcqx.js";import"./data-vendor-BDtrsGNX.js";function k(){const i=new URLSearchParams(window.location.search).get("token")||"",p=n.useUtils(),[t,x]=r.useState(""),[a,h]=r.useState(""),l=n.auth.claimInfo.useQuery({token:i},{enabled:i.length>=20,retry:!1}),s=n.auth.claim.useMutation({onSuccess:async()=>{await p.auth.me.invalidate(),window.location.href="/app"}}),g=c=>{c.preventDefault(),t===a&&s.mutate({token:i,password:t})};return e.jsx(C,{"data-loc":"client/src/pages/ClaimAccount.tsx:19",eyebrow:"One-time setup",title:"Claim your Authority Engine account",description:"Set a private password for the existing account. The link expires after 24 hours and can be used once.",children:l.isLoading?e.jsxs("div",{"data-loc":"client/src/pages/ClaimAccount.tsx:20",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(u,{"data-loc":"client/src/pages/ClaimAccount.tsx:20",className:"h-4 w-4 animate-spin"}),"Validating secure linkâ¦"]}):l.error||!i?e.jsxs("div",{"data-loc":"client/src/pages/ClaimAccount.tsx:20",className:"rounded-2xl border border-red-200 bg-red-50 p-5",children:[e.jsx("p",{"data-loc":"client/src/pages/ClaimAccount.tsx:20",className:"font-semibold text-red-800",children:"This claim link is invalid or expired."}),e.jsx("p",{"data-loc":"client/src/pages/ClaimAccount.tsx:20",className:"mt-2 text-sm text-red-700",children:"Ask the master administrator to create a fresh link."}),e.jsx(o,{"data-loc":"client/src/pages/ClaimAccount.tsx:20",asChild:!0,variant:"outline",className:"mt-4",children:e.jsx(w,{"data-loc":"client/src/pages/ClaimAccount.tsx:20",href:"/signin",children:"Back to sign in"})})]}):e.jsxs("form",{"data-loc":"client/src/pages/ClaimAccount.tsx:20",onSubmit:g,className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/pages/ClaimAccount.tsx:21",className:"rounded-xl border border-violet-100 bg-violet-50/70 p-4 text-sm",children:[e.jsx("p",{"data-loc":"client/src/pages/ClaimAccount.tsx:21",className:"font-semibold text-violet-950",children:l.data?.name||"Existing account"}),e.jsx("p",{"data-loc":"client/src/pages/ClaimAccount.tsx:21",className:"mt-1 text-violet-700",children:l.data?.email})]}),e.jsxs("div",{"data-loc":"client/src/pages/ClaimAccount.tsx:22",className:"space-y-2",children:[e.jsx(d,{"data-loc":"client/src/pages/ClaimAccount.tsx:22",htmlFor:"new-password",children:"New password"}),e.jsx(m,{"data-loc":"client/src/pages/ClaimAccount.tsx:22",id:"new-password",type:"password",autoComplete:"new-password",minLength:12,value:t,onChange:c=>x(c.target.value),required:!0,className:"h-12 rounded-xl"})]}),e.jsxs("div",{"data-loc":"client/src/pages/ClaimAccount.tsx:23",className:"space-y-2",children:[e.jsx(d,{"data-loc":"client/src/pages/ClaimAccount.tsx:23",htmlFor:"confirm-password",children:"Confirm password"}),e.jsx(m,{"data-loc":"client/src/pages/ClaimAccount.tsx:23",id:"confirm-password",type:"password",autoComplete:"new-password",minLength:12,value:a,onChange:c=>h(c.target.value),required:!0,className:"h-12 rounded-xl"})]}),a&&t!==a?e.jsx("p",{"data-loc":"client/src/pages/ClaimAccount.tsx:24",className:"text-sm text-red-700",children:"Passwords do not match."}):null,s.error?e.jsx("p",{"data-loc":"client/src/pages/ClaimAccount.tsx:25",role:"alert",className:"rounded-xl border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:s.error.message}):null,e.jsxs(o,{"data-loc":"client/src/pages/ClaimAccount.tsx:26",type:"submit",size:"lg",className:"h-12 w-full rounded-xl",disabled:t!==a||s.isPending,children:[s.isPending?e.jsx(u,{"data-loc":"client/src/pages/ClaimAccount.tsx:26",className:"mr-2 h-4 w-4 animate-spin"}):null,"Set password and continue"]})]})})}export{k 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.