(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18566,(e,t,r)=>{t.exports=e.r(76562)},1147,e=>{"use strict";var t=e.i(43476);e.i(71645),e.s(["default",0,()=>(0,t.jsx)("div",{className:"spinner-container",children:(0,t.jsx)("div",{className:"spinner"})})])},77520,e=>{"use strict";var t=e.i(43476),r=e.i(55487),o=e.i(2319),i=e.i(71645),s=e.i(18566),a=e.i(3903),n=e.i(81949),c=e.i(1147),u=e.i(44039);function d({params:e}){let{chatPort:d}=(0,i.use)(e),h=(0,r.useDispatch)(),l=(0,s.useRouter)();return(0,i.useEffect)(()=>{try{if(/Mobi|Android|iPhone|iPad|iPod|Windows Phone/i.test(window.navigator.userAgent)||!d||!Array.isArray(d))return void l.push("/login");let e=d.join("&"),t=decodeURIComponent(e),r=new URLSearchParams(t),i=r.get("t"),s=r.get("u"),c=r.get("e"),p=r.get("i"),g=r.get("r"),f=r.get("w");if((!i||!s||!c||!p)&&!f)return void l.push("/login");(async()=>{try{let e=await (0,u.default)(),t=(await n.default.post("https://v5.vchat.ourprojectdemo.com/api/chatportal",{t:i,u:s,e:c,i:p,r:g,d:e},{headers:{"Content-Type":"application/json"}})).data;(0,a.setCookie)("token",t.token),(0,a.setCookie)("refreshToken",t.refreshToken),h((0,o.setUser)(t.user)),1===t.role?l.push("/company-management"):2===t.role?l.push("/brands"):l.push("/chat")}catch(e){l.push("/login")}})()}catch(e){console.error("Error fetching chat portal:",e)}},[]),(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(c.default,{})})}e.s(["default",()=>d])}]);