var k=Object.defineProperty;var y=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var w=(o,e,t)=>e in o?k(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,u=(o,e)=>{for(var t in e||(e={}))A.call(e,t)&&w(o,t,e[t]);if(y)for(var t of y(e))U.call(e,t)&&w(o,t,e[t]);return o};var _=(o,e,t)=>new Promise((c,s)=>{var n=r=>{try{i(t.next(r))}catch(a){s(a)}},p=r=>{try{i(t.throw(r))}catch(a){s(a)}},i=r=>r.done?c(r.value):Promise.resolve(r.value).then(n,p);i((t=t.apply(o,e)).next())});import"./element-plus-ClWnlNxy.js";import"./vxe-BJJKGxpR.js";import{F as b,aF as B,a9 as d,aG as E,aH as I,B as q}from"./Editor-DIkkoBrq-1sBJeaGq.js";import{useRoute as v}from"./vue-router-DLyhMsB6.js";import{x,az as f,I as F,D as C,u as l,E as R,U as $}from"./vue-Cs4cahp0.js";import{_ as g}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./@vueuse-DGhgU4Wj.js";import"./lodash-es-BxdYFYdv.js";import"./shared-Df95_Dth.js";import"./@element-plus-icons-vue-DfQfjj5s.js";import"./dayjs-GGXMDmCk.js";import"./monaco-editor-Bgo-w-Z8.js";import"./html2canvas-DNSjNh3_.js";import"./mockjs-CtuJnEp1.js";import"./marked--VTVY_DP.js";const G={class:"loading"},S=x({__name:"Auth",props:{remote:{},access:{},baseUrl:{default:"/"}},setup(o){return _(this,null,function*(){let e,t;const c=o,s=b(u(u({alert:d},B),c.access)),n=v(),p=a=>_(null,null,function*(){const h=`${c.remote||E}/api/open/user/${a}`,m=yield I(h).catch(()=>null);return m&&Array.isArray(m)?m:!m||!m.success?(yield d("登录失败"),null):m.data}),i=n.query.token,r=i?([e,t]=f(()=>p(i)),e=yield e,t(),e):null;if(r)try{s.login(r);const a=n.query.redirect;location.href=decodeURIComponent(a||c.baseUrl)}catch(a){location.reload()}else{[e,t]=f(()=>d("登录失败")),yield e,t();const a=n.query.redirect;location.href=decodeURIComponent(a||c.baseUrl)}return(a,h)=>(C(),F("div",G,"正在登录中..."))})}}),z=g(S,[["__scopeId","data-v-2cb061ca"]]),Z=x({__name:"auth",setup(o){return _(this,null,function*(){let e,t;const c=new q,s=([e,t]=f(()=>c.getExtension().catch(()=>null)),e=yield e,t(),e),n=s==null?void 0:s.remote,p=s==null?void 0:s.__ACCESS__;return(i,r)=>l(n)?(C(),R(l(z),{key:0,remote:l(n),access:l(p)},null,8,["remote","access"])):$("",!0)})}});export{Z as default};
