import{t as x,z as b,r as a,j as e}from"./vendor-react.js";import{b as j,d as v,t as u}from"./main.js";import{B as w,c as N}from"./button.js";import{I as h}from"./input.js";import{L as p}from"./label.js";import{C as y,a as S}from"./card.js";import{s as C}from"./vendor-icons.js";import"./vendor-monaco.js";import"./vendor-ui.js";function A(){const{t:s}=x(),t=b(),{authAdminRequest:o,stateLoaded:l,fetchState:i}=j(),[n,g]=a.useState(""),[c,m]=a.useState(!1),d=a.useRef(!1);a.useEffect(()=>{d.current||(d.current=!0,i())},[i]),a.useEffect(()=>{l&&o===!1&&t("/login",{replace:!0})},[l,o,t]);const f=async r=>{r.preventDefault(),m(!0);try{await v.admin({username:"nacos",password:n}),u.success(s("common.success")),t("/login",{replace:!0})}catch{u.error(s("common.failed"))}finally{m(!1)}};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"}),e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,rgba(255,255,255,0.6),transparent_60%)]"}),e.jsx(y,{className:"relative z-10 w-full max-w-md mx-4 border-0 bg-white shadow-2xl shadow-blue-200/40",children:e.jsxs(S,{className:"p-8",children:[e.jsx("div",{className:"flex items-center gap-3 mb-6",children:e.jsx("img",{src:"./img/nacos-logo-dark.svg",alt:"Nacos",className:"h-8"})}),e.jsx("h2",{className:"text-xl font-bold text-gray-800 mb-1",children:s("login.initPassword")}),e.jsx("p",{className:"text-sm text-gray-600 mb-2",children:s("login.internalSysTip3")}),e.jsx("p",{className:"text-xs text-gray-500 mb-6",children:s("login.internalSysTip4")}),e.jsxs("form",{onSubmit:f,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{className:"text-gray-700",children:"Username"}),e.jsx(h,{value:"nacos",disabled:!0,className:"h-10 bg-gray-50 border-gray-200"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"password",className:"text-gray-700",children:s("login.pleaseInputPasswordTips")}),e.jsx(h,{id:"password",type:"password",value:n,onChange:r=>g(r.target.value),placeholder:s("login.pleaseInputPassword"),className:"h-10 border-gray-200 focus:border-blue-400 focus:ring-blue-400"})]}),e.jsxs(w,{type:"submit",disabled:c,className:N("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:shadow-lg hover:shadow-blue-500/30 transition-all duration-200"),children:[c&&e.jsx(C,{size:16,className:"animate-spin mr-2"}),s("login.submit")]})]})]})})]})}export{A as default};
