(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6071],{95684:function(e,r,s){Promise.resolve().then(s.bind(s,32179))},32179:function(e,r,s){"use strict";s.r(r);var n=s(27573),i=s(88280),t=s(41664);r.default=function(){return(0,n.jsx)(i.Z,{children:(0,n.jsx)(t.Z,{})})}},41664:function(e,r,s){"use strict";s.d(r,{Z:function(){return f}});var n=s(27573),i=s(7653),t=s(1930),a=s(97747),l=s(88146),o=s(36531),d=s(93296),c=s(39e3),u=s(412);function f(){let e=(0,u.I0)(),[r,s]=(0,i.useState)(""),[f,g]=(0,i.useState)(""),[p,m]=(0,i.useState)("");async function x(){try{d.ZP.loading("Logging in...",{id:"login-loading"}),console.log("email",r),console.log("password",f);let s=await fetch("/webui_api/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,password:f})});if(console.log("response",s),401===s.status){m("Invalid email or password"),d.ZP.error("Invalid email or password",{id:"login-error"}),d.ZP.dismiss("login-loading"),e((0,c.v)({token:""}));return}if(200===s.status){let r=await s.json();console.log("response.data",r),e((0,c.v)(r)),console.log("Login successful"),window.location.assign("/webui"),d.ZP.success("Login successful.",{id:"login-success",duration:3e3,style:{backgroundColor:"#10B981",color:"#fff"}}),d.ZP.dismiss("login-loading")}else{let r=await s.text()||"An error occurred while loading!";m(r),e((0,c.v)({token:""})),d.ZP.error(r,{id:"login-error"}),d.ZP.dismiss("login-loading")}}catch(r){console.error("An error occurred:",r),d.ZP.error("An error occurred. Please try again later.",{id:"login-error"}),d.ZP.dismiss("login-loading"),e((0,c.v)({token:""}))}}return(0,n.jsx)("div",{className:"w-full lg:grid lg:min-h-[600px] lg:grid-cols-1 place-items-center",children:(0,n.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,n.jsxs)("div",{className:"mx-auto grid w-[350px] gap-6",children:[(0,n.jsx)("div",{className:"grid gap-2 text-center",children:(0,n.jsx)("div",{className:"flex h-auto shrink-0 items-center pb-4",children:(0,n.jsx)("a",{href:"/webui",children:(0,n.jsx)("img",{className:"h-auto w-auto",src:"/webui_asset/purple-dark.png",alt:"SuperDuperDB Inc."})})})}),(0,n.jsxs)("div",{className:"grid gap-4",children:[(0,n.jsxs)("div",{className:"grid gap-2",children:[(0,n.jsx)(a._,{htmlFor:"email",children:"Username or email"}),(0,n.jsx)(t.I,{id:"email",type:"email",placeholder:"m@example.com",required:!0,value:r,onChange:e=>s(e.target.value)})]}),(0,n.jsxs)("div",{className:"grid gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(a._,{htmlFor:"password",children:"Password"}),(0,n.jsx)(l.default,{href:"/webui/support",className:"ml-auto inline-block text-sm underline",children:"Forgot your password?"})]}),(0,n.jsx)(t.I,{id:"password",type:"password",required:!0,value:f,onChange:e=>g(e.target.value)})]}),p&&(0,n.jsx)("p",{className:"text-red-500",children:p}),(0,n.jsx)(o.z,{id:"login-button-homepage",className:"w-full",onClick:x,children:"Log in"})]}),(0,n.jsxs)("div",{className:"mt-4 text-center text-sm",children:["Don't have an account?"," ",(0,n.jsx)(l.default,{href:"/webui/support",className:"underline",children:"Contact Enterprise Support"})]})]})})})}},1930:function(e,r,s){"use strict";s.d(r,{I:function(){return a}});var n=s(27573),i=s(7653),t=s(18580);let a=i.forwardRef((e,r)=>{let{className:s,type:i,...a}=e;return(0,n.jsx)("input",{type:i,className:(0,t.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:r,...a})});a.displayName="Input"},97747:function(e,r,s){"use strict";s.d(r,{_:function(){return d}});var n=s(27573),i=s(7653),t=s(1001),a=s(85145),l=s(18580);let o=(0,a.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=i.forwardRef((e,r)=>{let{className:s,...i}=e;return(0,n.jsx)(t.f,{ref:r,className:(0,l.cn)(o(),s),...i})});d.displayName=t.f.displayName},88146:function(e,r,s){"use strict";s.d(r,{default:function(){return i.a}});var n=s(16340),i=s.n(n)},1001:function(e,r,s){"use strict";s.d(r,{f:function(){return l}});var n=s(7653),i=s(78378),t=s(27573),a=n.forwardRef((e,r)=>(0,t.jsx)(i.WV.label,{...e,ref:r,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||(null===(s=e.onMouseDown)||void 0===s||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));a.displayName="Label";var l=a}},function(e){e.O(0,[3296,8320,6340,3696,1293,1528,1744],function(){return e(e.s=95684)}),_N_E=e.O()}]);