import{d as k}from"./BHEH7-GF.js";import{aa as C,ch as w,cG as T,bB as v,X as $,cS as t,a3 as s,a2 as i,c0 as l,c7 as e,W as _,aV as B,a1 as D,V as c,Y as b,bO as f,O as S}from"#entry";import{b as F,V as M}from"./RTCSF0Ks.js";import{V as N}from"./R1_j74h_.js";import{V as O}from"./C8MHOe0D.js";import{V as A}from"./C2L9cD_h.js";import{V as H}from"./BgQ5eU58.js";import{V as I}from"./VoZA954X.js";import"./Cpj98o6Y.js";import"./BKDgfSxC.js";import"./Cp3UUybv.js";import"./DmHQoNBb.js";import"./CEoxYnb5.js";import"./BbcaTmac.js";import"./BPHK4Dzs.js";import"./D_qxKlPu.js";const L=["innerHTML"],U=["src"],j=C({__name:"FollowMe",props:{isDialog:{type:Boolean,default:!1}},emits:["close"],setup(p){const r=f(""),u=f(!1),d=f({title:"",thumbnail:""}),m=f(!1),{data:h}=w("/api/ap_actors/stats","$lK_x30xEy1"),o=T("settings"),g=S(()=>`https://${r.value}/authorize_interaction?uri=${o.value.instance_name}@${o.value.hostname}`),y=k(()=>{if(!r.value)return;m.value=!0;const a=`https://${r.value}/api/v1/instance`;$fetch(a).then(n=>{d.value=n,u.value=!0,m.value=!1}).catch(n=>{d.value={},u.value=!1,m.value=!1})},300);return(a,n)=>(v(),$(M,null,{default:t(()=>[s(F,{class:"bg-primary"},{default:t(()=>[i(l(a.$t("common.follow_me_title")),1)]),_:1}),s(N,null,{default:t(()=>[s(O,{class:"mb-4",type:"info",border:"start",icon:"mdi-information"},{default:t(()=>[i(l(a.$t("admin.stats",e(h))),1)]),_:1}),_("p",{innerHTML:a.$t("event.follow_me_description",{title:e(o).title,account:`@${e(o).instance_name}@${e(o).hostname}`})},null,8,L),s(A,{modelValue:e(r),"onUpdate:modelValue":[n[0]||(n[0]=V=>B(r)?r.value=V:null),e(y)],rules:[a.$valid.required("common.url")],loading:e(m),label:a.$t("common.url")},D({append:t(()=>[_("p",null,[_("img",{class:"instance_thumb",src:e(d).thumbnail},null,8,U),i(" "+l(e(d).title),1)])]),_:2},[p.isDialog?void 0:{name:"prepend",fn:t(()=>[s(c,{variant:"text",disabled:!e(u),href:e(g),target:"_blank",loading:e(m),color:"primary"},{default:t(()=>[i(l(a.$t("common.follow")),1)]),_:1},8,["disabled","href","loading"])]),key:"0"}]),1032,["modelValue","rules","loading","label","onUpdate:modelValue"])]),_:1}),p.isDialog?(v(),$(H,{key:0},{default:t(()=>[s(c,{variant:"outlined",color:"info",onClick:n[1]||(n[1]=V=>a.$copyToClipboard(`@${e(o).instance_name}@${e(o).hostname}`))},{default:t(()=>[i(l(a.$t("common.copy"))+" @"+l(e(o).instance_name)+"@"+l(e(o).hostname),1)]),_:1}),s(I),p.isDialog?(v(),$(c,{key:0,variant:"outlined",color:"warning",onClick:n[2]||(n[2]=V=>a.$emit("close"))},{default:t(()=>[i(l(a.$t("common.cancel")),1)]),_:1})):b("",!0),s(c,{disabled:!e(u),variant:"outlined",href:e(g),target:"_blank",loading:e(m),color:"primary"},{default:t(()=>[i(l(a.$t("common.follow")),1)]),_:1},8,["disabled","href","loading"])]),_:1})):b("",!0)]),_:1}))}}),te=Object.assign(j,{__name:"FollowMe"});export{te as default};
