import{v as a,h as t}from"./element-plus-DSMJnpwa.js";import{g as s,c as e,l as o,s as n}from"./index-mv7arXuk.js";import{B as c,aB as i,m as r,n as d,V as l,u,H as m,L as w,d as f}from"./vue-vendor-DZekML78.js";import"./utils-cPVb2Haz.js";const h={class:"social-callback"},y=c({__name:"index",setup(c){const y=i(),p=f(!0),v=y.query.code,g=y.query.state,x=y.query.source,b=JSON.parse(atob(g)),j=b.tenantId?b.tenantId:"000000",I=b.domain,q=async a=>{if(200!==a.code)throw new Error(a.msg);null!==a.data&&n(a.data.access_token),t.success(a.msg),setTimeout(()=>{location.href="/index"},2e3)},S=a=>{t.error(a.message),setTimeout(()=>{location.href="/index"},2e3)},T=async()=>{const a=window.location.host;if(I!==a){const a=new URL(window.location.href);return a.host=I,void(window.location.href=a.toString())}const t={socialCode:v,socialState:g,tenantId:j,source:x,clientId:"e5cd7e4891bf95d1d19206ce24a7b32e",grantType:"social"};s()?await(async a=>{try{const t=await e(a);await q(t),p.value=!1}catch(t){S(t)}})(t):await(async a=>{try{const t=await o(a);await q(t),p.value=!1}catch(t){S(t)}})(t)};return r(()=>{d(()=>{T()})}),(t,s)=>{const e=a;return l((m(),w("div",h,null,512)),[[e,u(p)]])}}});export{y as default};
