(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18566,(e,a,t)=>{a.exports=e.r(76562)},23293,e=>{e.v("/_next/static/media/loginimage.fd3d0343.png")},1147,e=>{"use strict";var a=e.i(43476);e.i(71645),e.s(["default",0,()=>(0,a.jsx)("div",{className:"spinner-container",children:(0,a.jsx)("div",{className:"spinner"})})])},81511,e=>{"use strict";let a={src:e.i(23293).default,width:316,height:289,blurWidth:8,blurHeight:7,blurDataURL:"data:image/webp;base64,UklGRkwBAABXRUJQVlA4TEABAAAvB4ABEM1VICICHgiADQIAAIA8XD2AC4ByIAAHAAB3AAACB1EBACEACQAKOQAAIICiR5YIAgAAnaAEAADAA0FZYQAAADj/dxewxQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADavuV80CKchAAAADO/y03KwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWEnd90AwYBAAAADOf5VCAAAE/pADQAAAEAcAAAAAEK4AAAApAIIEAggggIBAAIQgCXeVdOAh+AySI3cRANYLu8UTv5WKjEJjbNE2aIYYJDQ5X4yenywqM5fqxxV14wyXf4mSUSdERY4IGXKryVEF1GRfBY2EtZlZ3C9s4IAdfDVE4YO7cZ3pzagndd9f3jdF36TX868yz1j+9b61mNHdYffhtZyTu6+28vkOCw=="};e.s(["default",0,a])},81694,e=>{"use strict";var a=e.i(43476),t=e.i(71645),s=e.i(18566),A=e.i(3903),i=e.i(55487),l=e.i(2319),n=e.i(56610),r=e.i(1147),o=e.i(81511),d=e.i(44039);e.s(["default",0,()=>{let[e,c]=(0,t.useState)(""),[u,m]=(0,t.useState)(""),[p,h]=(0,t.useState)(""),[f,g]=(0,t.useState)(!0),j=(0,s.useRouter)(),x=(0,i.useDispatch)();(0,i.useSelector)(e=>e.user.status);let v=(0,A.getCookie)("token"),y=(0,i.useSelector)(e=>e.user.userInfo),[N,b]=(0,t.useState)();(0,t.useEffect)(()=>{v?y.length>0?(w(y.role),g(!1)):(g(!0),x((0,l.verifyUserRole)(v)).then(e=>{e.payload&&w(e.payload.role)})):(g(!1),x((0,n.reset)()))},[]);let w=e=>{1===e?j.push("/company-management"):2===e?j.push("/brands"):j.push("/chat")},C=async a=>{a.preventDefault(),g(!0);let t=await (0,d.default)();try{let a=await fetch("https://v5.vchat.ourprojectdemo.com/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:u,device_id:t})});if(a.ok){let{accessToken:e,refreshToken:t}=await a.json(),s={httpOnly:!1,sameSite:"strict",path:"/",maxAge:86400};(0,A.setCookie)("token",e,{...s}),(0,A.setCookie)("refreshToken",t,{...s}),x((0,l.verifyUserRole)(e)).then(e=>{e.payload&&w(e.payload.role)})}else{let e=await a.json();g(!1),h(e.message||"Something went wrong")}}catch(e){h("Failed to log in")}finally{}};return f?(0,a.jsx)(r.default,{}):(0,a.jsx)("div",{className:"limiter d-flex justify-content-center align-items-center min-vh-100",children:(0,a.jsx)("div",{className:"container-login100",children:(0,a.jsxs)("div",{className:"wrap-login100 shadow",children:[(0,a.jsx)("div",{className:"login100-pic js-tilt","data-tilt":!0,children:(0,a.jsx)("img",{src:o.default.src,alt:"IMG"})}),(0,a.jsxs)("form",{className:"login100-form validate-form",onSubmit:C,children:[(0,a.jsx)("span",{className:"login100-form-title",children:"Member Login"}),p&&(0,a.jsx)("div",{className:"alert alert-danger p-1 py-2 px-2",children:p}),(0,a.jsxs)("div",{className:"wrap-input100 validate-input mb-3","data-validate":"Valid email is required: ex@abc.xyz",children:[(0,a.jsx)("input",{className:" form-control input100",type:"text",name:"email",placeholder:"Email",value:e,onChange:e=>c(e.target.value)}),(0,a.jsx)("span",{className:"focus-input100"}),(0,a.jsx)("span",{className:"symbol-input100",children:(0,a.jsx)("i",{className:"fa fa-envelope","aria-hidden":"true"})})]}),(0,a.jsxs)("div",{className:"wrap-input100 validate-input mb-3","data-validate":"Password is required",children:[(0,a.jsx)("input",{className:"form-control input100 ",type:"password",name:"pass",placeholder:"Password",value:u,onChange:e=>m(e.target.value)}),(0,a.jsx)("span",{className:"focus-input100"}),(0,a.jsx)("span",{className:"symbol-input100",children:(0,a.jsx)("i",{className:"fa fa-lock","aria-hidden":"true"})})]}),(0,a.jsx)("div",{className:"container-login100-form-btn",children:(0,a.jsx)("button",{className:"login100-form-btn btn btn-primary w-100 mt-3",children:"Login"})})]})]})})})}])}]);