1import{r as t,R as S,j as e,H as L,ap as E,y as C,K as P,M as I,N as k,z as B,B as D}from"./index-Cn6AmDcL.js";import{I as h}from"./input-pp0WQH1r.js";import{L as p}from"./label-BhSQ8SeX.js";import{L as f}from"./loader-circle-BHhVKQpw.js";import{L as g}from"./lock-2IcKHC3w.js";import{U as F}from"./user-W_9JvacK.js";import{E as H}from"./eye-off-DtwgqFIR.js";import{E as U}from"./eye-BmivSMG8.js";function K(){const[n,j]=t.useState(""),[l,w]=t.useState(""),[a,b]=t.useState(!1),[i,d]=t.useState(""),[c,m]=t.useState(!1),{login:y,isAuthenticated:u,user:r,isLoading:N}=S();t.useEffect(()=>{u&&r&&(window.location.href=r.role==="referral_partner"?"/portal/partner":"/portal/admin")},[u,r]);const v=async s=>{var x;s.preventDefault(),d(""),m(!0);const o=await y(n,l);o.success?window.location.href=((x=o.user)==null?void 0:x.role)==="referral_partner"?"/portal/partner":"/portal/admin":(d(o.message||"Login failed"),m(!1))};return N?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 flex items-center justify-center",children:e.jsx(f,{className:"w-8 h-8 animate-spin text-blue-600"})}):e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 flex items-center justify-center p-4 relative",children:[e.jsx(L,{children:e.jsx("meta",{name:"robots",content:"noindex, nofollow"})}),e.jsxs("a",{href:"/",className:"absolute top-6 left-6 flex items-center gap-2 hover:opacity-80 transition-opacity","data-testid":"link-home",children:[e.jsx("img",{src:E,alt:"BridgeWave Logo",className:"h-10 w-auto"}),e.jsx("span",{className:"text-[24px] font-semibold",style:{fontFamily:"Inter, Arial, Helvetica, sans-serif",letterSpacing:"-0.01em",color:"rgb(0, 123, 255)"},children:"BridgeWave"})]}
1),e.jsxs(C,{className:"w-full max-w-md shadow-xl",children:[e.jsxs(P,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 w-16 h-16 bg-gradient-to-r from-blue-600 to-blue-700 rounded-full flex items-center justify-center",children:e.jsx(g,{className:"w-8 h-8 text-white"})}),e.jsx(I,{className:"text-2xl font-bold",children:"Partner Portal"}),e.jsx(k,{children:"Sign in to access your dashboard"})]}),e.jsxs(B,{children:[e.jsxs("form",{onSubmit:v,className:"space-y-4",children:[i&&e.jsx("div",{className:"p-3 bg-red-50 border border-red-200 text-red-700 rounded-lg text-sm","data-testid":"error-message",children:i}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"username",children:"Username"}),e.jsxs("div",{className:"relative",children:[e.jsx(F,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx(h,{id:"username",type:"text",placeholder:"Enter your username",value:n,onChange:s=>j(s.target.value),className:"pl-10",required:!0,"data-testid":"input-username"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(g,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx(h,{id:"password",type:a?"text":"password",placeholder:"Enter your password",value:l,onChange:s=>w(s.target.value),className:"pl-10 pr-10",required:!0,"data-testid":"input-password"}),e.jsx("button",{type:"button",tabIndex:-1,onMouseDown:s=>s.preventDefault(),onTouchStart:s=>s.preventDefault(),onClick:()=>b(!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",style:{outline:"none",boxShadow:"none",border:"none"},"data-testid":"button-toggle-password","aria-label":a?"Hide password":"Show password",children:a?e.jsx(H,{className:"w-4 h-4"}):e.jsx(U,{className:"w-4 h-4"})})]})]}),e.jsx(D,{type:"submit",className:"w-full bg-blue-600 hover:bg-blue-700",disabled:c,"data-testid":"button-login",children:c?e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in..."]}):"Sign In"}),e.jsx("div",{className:"text-center",children:e.jsx("a",{href:"/portal/forgot-password",className:"text-sm text-blue-600 hover:text-blue-700","data-testid":"link-forgot-password",children:"Forgot your password?"})})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsx("a",{href:"/",className:"text-sm text-gray-500 hover:text-gray-700",children:"â Back to main site"})})]})]})]})}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.