import{b,g as p,r as a,j as e,v,s as u}from"./main.js";import{d as j,B as N,b as w}from"./button-D4VgS8ri.js";import{I as h}from"./input-CbL6Bfs6.js";import{L as g}from"./label-Bemsalkj.js";import{C as y,a as S}from"./card-D6OLc_JP.js";import{L as C}from"./loader-circle-CEJBtRy6.js";import"./index-hZlSoXYO.js";function k(){const{t:s}=j(),t=b(),{authAdminRequest:l,stateLoaded:o,fetchState:i}=p(),[n,f]=a.useState(""),[c,d]=a.useState(!1),m=a.useRef(!1);a.useEffect(()=>{m.current||(m.current=!0,i())},[i]),a.useEffect(()=>{o&&l===!1&&t("/login",{replace:!0})},[o,l,t]);const x=async r=>{r.preventDefault(),d(!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{d(!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:x,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{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(g,{htmlFor:"password",className:"text-gray-700",children:s("login.pleaseInputPasswordTips")}),e.jsx(h,{id:"password",type:"password",value:n,onChange:r=>f(r.target.value),placeholder:"",className:"h-10 border-gray-200 focus:border-blue-400 focus:ring-blue-400"})]}),e.jsxs(N,{type:"submit",disabled:c,className:w("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{k as default};
