import{aA as u,d as I,r as h,$ as A,b as N,w as P,o as m,C as z,A as d,f as i,B as v,E as B,c as w,F as U,D as g,a as D,X as $,Y as j,_ as E,__tla as F}from"./index-286756b9.js";import{_ as L,__tla as X}from"./XTextButton-3e07ae17.js";import{S as k}from"./constants-637baed6.js";import{g as Y,__tla as G}from"./profile-c4763599.js";import{u as H,__tla as J}from"./useMessage-084b1e70.js";import{__tla as K}from"./XTextButton.vue_vue_type_style_index_0_scoped_bd4a9e34_lang-6af260a5.js";let C,M=Promise.all([(()=>{try{return F}catch{}})(),(()=>{try{return X}catch{}})(),(()=>{try{return G}catch{}})(),(()=>{try{return J}catch{}})(),(()=>{try{return K}catch{}})()]).then(async()=>{let _,y;_=["src"],y={class:"mr-5"},C=E(I({name:"UserSocial",__name:"UserSocial",props:{activeName:{type:String,required:!0}},emits:["update:activeName"],setup(O,{emit:b}){const f=H(),n=h([]),o=h(),c=A(),S=b,q=()=>{const a=(t="type",new URL(decodeURIComponent(location.href)).searchParams.get(t)??"");var t;const e=c.query.code,s=c.query.state;e&&((l,r,p)=>u.post({url:"/system/social-user/bind",data:{type:l,code:r,state:p}}))(a,e,s).then(()=>{f.success("\u7ED1\u5B9A\u6210\u529F"),S("update:activeName","userSocial")})},x=a=>{const t=location.origin+"/user/profile?"+encodeURIComponent(`type=${a.type}`);((e,s)=>u.get({url:"/system/auth/social-auth-redirect?type="+e+"&redirectUri="+s}))(a.type,encodeURIComponent(t)).then(e=>{window.location.href=e})},R=async a=>{var t,e;await(t=a.type,e=a.openid,u.delete({url:"/system/social-user/unbind",data:{type:t,openid:e}}))&&(a.openid=void 0),f.success("\u89E3\u7ED1\u6210\u529F")};return N(async()=>{await(async()=>{var t;n.value=[];const a=await Y();o.value=a;for(const e in k){const s={...k[e]};if(n.value.push(s),(t=o.value)==null?void 0:t.socialUsers){for(const l in o.value.socialUsers)if(s.type===o.value.socialUsers[l].type){s.openid=o.value.socialUsers[l].openid;break}}}})()}),P(()=>c,()=>{q()},{immediate:!0}),(a,t)=>{const e=$,s=L,l=j;return m(),z(l,{data:D(n),"show-header":!1},{default:d(()=>[i(e,{fixed:"left",title:"\u5E8F\u53F7",type:"seq",width:"60"}),i(e,{align:"left",label:"\u793E\u4EA4\u5E73\u53F0",width:"120"},{default:d(({row:r})=>[v("img",{src:r.img,alt:"",class:"h-5 align-middle"},null,8,_),v("p",y,B(r.title),1)]),_:1}),i(e,{align:"center",label:"\u64CD\u4F5C"},{default:d(({row:r})=>[r.openid?(m(),w(U,{key:0},[g(" \u5DF2\u7ED1\u5B9A "),i(s,{class:"mr-5",title:"(\u89E3\u7ED1)",type:"primary",onClick:p=>R(r)},null,8,["onClick"])],64)):(m(),w(U,{key:1},[g(" \u672A\u7ED1\u5B9A "),i(s,{class:"mr-5",title:"(\u7ED1\u5B9A)",type:"primary",onClick:p=>x(r)},null,8,["onClick"])],64))]),_:1})]),_:1},8,["data"])}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/Profile/components/UserSocial.vue"]])});export{M as __tla,C as default};