import{b as S,f as C,g as _,r as s,j as e,s as d}from"./main.js";import{d as E,B as k,b as L}from"./button-D4VgS8ri.js";import{I as b}from"./input-CbL6Bfs6.js";import{L as p}from"./label-Bemsalkj.js";import{C as P,a as z}from"./card-D6OLc_JP.js";import{E as I}from"./eye-off-pMzODnxR.js";import{E as R}from"./eye-xgHnmW9o.js";import{L as q}from"./loader-circle-CEJBtRy6.js";import"./index-hZlSoXYO.js";function G(){const{t:a}=E(),r=S(),{login:v,loading:m}=C(),{fetchState:u,fetchGuide:c,stateLoaded:f,loginPageEnabled:g,authAdminRequest:l,guideMsg:h}=_(),[i,j]=s.useState(""),[o,w]=s.useState(""),[n,y]=s.useState(!1),x=s.useRef(!1);s.useEffect(()=>{x.current||(x.current=!0,u(),c())},[u,c]),s.useEffect(()=>{f&&(g===!1&&l===!1&&r("/",{replace:!0}),l&&r("/register",{replace:!0}))},[f,g,l,r]);const N=async t=>{if(t.preventDefault(),!i.trim()){d.error(a("login.usernameRequired"));return}if(!o.trim()){d.error(a("login.passwordRequired"));return}await v(i,o)?r("/",{replace:!0}):d.error(a("login.invalidUsernameOrPassword"))};return e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50 via-sky-100 to-blue-100 animate-gradient-shift"}),e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,rgba(255,255,255,0.6),transparent_60%)]"}),e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_bottom_left,rgba(219,234,254,0.4),transparent_50%)]"}),e.jsx("div",{className:"absolute top-1/4 left-1/4 h-64 w-64 rounded-full bg-blue-200/30 blur-3xl animate-float"}),e.jsx("div",{className:"absolute bottom-1/4 right-1/4 h-80 w-80 rounded-full bg-sky-200/25 blur-3xl animate-float-delayed"}),e.jsx("div",{className:"absolute top-1/2 right-1/3 h-48 w-48 rounded-full bg-blue-100/30 blur-3xl animate-float"}),e.jsx(P,{className:"relative z-10 w-full max-w-4xl mx-4 overflow-hidden border-0 p-0 gap-0 shadow-2xl shadow-blue-200/40",children:e.jsx(z,{className:"p-0",children:e.jsxs("div",{className:"grid md:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col justify-center p-8 md:p-12 bg-gradient-to-br from-blue-500 to-blue-600 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-white/5 rounded-full translate-y-1/3 -translate-x-1/3"}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("img",{src:"./img/nacos-logo.svg",alt:"Nacos",className:"h-10 mb-2"}),e.jsx("p",{className:"text-xs text-white/60 mb-6",children:"Dynamic Naming and Configuration Service"}),e.jsx("p",{className:"text-sm text-white/85 leading-relaxed mb-8",children:a("login.productDesc")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-1 w-16 rounded-full bg-gradient-to-r from-white/50 to-transparent"}),e.jsx("div",{className:"h-1 w-24 rounded-full bg-gradient-to-r from-white/35 to-transparent"}),e.jsx("div",{className:"h-1 w-12 rounded-full bg-gradient-to-r from-white/20 to-transparent"})]})]})]}),e.jsxs("div",{className:"flex flex-col justify-center bg-white p-8 md:p-12",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-800 mb-1",children:a("login.login")}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:a("login.internalSysTip1")}),e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"username",className:"text-gray-700",children:a("login.pleaseInputUsername")}),e.jsx(b,{id:"username",type:"text",value:i,onChange:t=>j(t.target.value),placeholder:"",autoComplete:"username",className:"h-10 border-gray-200 focus:border-blue-400 focus:ring-blue-400"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"password",className:"text-gray-700",children:a("login.pleaseInputPassword")}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{id:"password",type:n?"text":"password",value:o,onChange:t=>w(t.target.value),placeholder:"",autoComplete:"current-password",className:"h-10 pr-10 border-gray-200 focus:border-blue-400 focus:ring-blue-400"}),e.jsx("button",{type:"button",onClick:()=>y(!n),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",children:n?e.jsx(I,{size:16}):e.jsx(R,{size:16})})]})]}),e.jsxs(k,{type:"submit",disabled:m,className:L("w-full h-10 bg-gradient-to-r from-blue-500 to-blue-600 text-white font-medium shadow-md shadow-blue-500/25","hover:from-blue-600 hover:to-blue-700 hover:-translate-y-0.5 hover:shadow-lg hover:shadow-blue-500/30 transition-all duration-200","disabled:opacity-50 disabled:hover:translate-y-0"),children:[m?e.jsx(q,{size:16,className:"animate-spin mr-2"}):null,a("login.login")]})]}),h&&e.jsx("div",{className:"mt-4 text-xs text-gray-500 leading-relaxed",dangerouslySetInnerHTML:{__html:h}})]})]})})}),e.jsx("style",{children:`
        @keyframes gradient-shift {
          0%, 100% { background-position: 0% 50%; }
          50% { background-position: 100% 50%; }
        }
        .animate-gradient-shift {
          background-size: 200% 200%;
          animation: gradient-shift 15s ease infinite;
        }
        @keyframes float {
          0%, 100% { transform: translateY(0) translateX(0); }
          50% { transform: translateY(-20px) translateX(10px); }
        }
        .animate-float {
          animation: float 8s ease-in-out infinite;
        }
        .animate-float-delayed {
          animation: float 10s ease-in-out 2s infinite;
        }
      `})]})}export{G as default};
