import{b as E,a as n,w as T,e as I,$ as b,h as l,t as _,u as s,z as w,A as S,B as j,s as A,i as k,j as y,G as $,F as B,H as F}from"./vue-y3KLWBaS.js";import{u as P}from"./widget-qjKd4HCd.js";import{M as U}from"./MkContainer-6laePfDX.js";import{S as R,n as V,Q as q,k as D,f as H,V as x}from"./app-JmgyQoR0.js";const L=["id","width","onContextmenu"],N=["id"],f="abcdefghijklmnopqrstuvwxyz",W=E({__name:"MkTagCloud",setup(C,{expose:p}){const h=!!window.TagCanvas,v=getComputedStyle(document.documentElement),e=Array.from(Array(16)).map(()=>f[Math.floor(Math.random()*f.length)]).join(""),i=Array.from(Array(16)).map(()=>f[Math.floor(Math.random()*f.length)]).join("");let o=n(!1),d=n(null),c=n(null),r=n(null),u=n(300);return T(o,()=>{try{window.TagCanvas.Start(e,i,{textColour:"#ffffff",outlineColour:R(v.getPropertyValue("--accent")).toHexString(),outlineRadius:10,initial:[-.03,-.01],frontSelect:!0,imageRadius:8,dragThreshold:3,wheelZoom:!1,reverse:!0,depth:.5,maxSpeed:.2,minSpeed:.003,stretchX:.8,stretchY:.8})}catch(m){}}),I(()=>{u.value=d.value.offsetWidth,h?o.value=!0:document.head.appendChild(Object.assign(document.createElement("script"),{async:!0,src:"/client-assets/tagcanvas.min.js"})).addEventListener("load",()=>o.value=!0)}),b(()=>{window.TagCanvas&&window.TagCanvas.Delete(e)}),p({update:()=>{window.TagCanvas.Update(e)}}),(m,t)=>(l(),_("div",{ref_key:"rootEl",ref:d,class:"meijqfqm"},[s("canvas",{id:w(e),ref_key:"canvasEl",ref:c,class:"canvas",width:u.value,height:"300",onContextmenu:S(()=>{},["prevent"])},null,40,L),s("div",{id:w(i),ref_key:"tagsEl",ref:r,class:"tags"},[s("ul",null,[j(m.$slots,"default",{},void 0,!0)])],8,N)],512))}}),z=V(W,[["__scopeId","data-v-d55aa3b1"]]),O={class:""},G=["onClick"],Q=["src"],M="instanceCloud",ee=E({__name:"instance-cloud",props:{widget:{}},emits:["updateProps"],setup(C,{expose:p,emit:h}){const v={transparent:{type:"boolean",default:!1}},e=C,i=h,{widgetProps:o,configure:d}=P(M,v,e,i),c=n();let r=A(null);function u(t){D(`/instance-info/${t.host}`)}q(()=>{H("federation/instances",{sort:"+lastCommunicatedAt",limit:25}).then(t=>{r.value=t,c.value&&c.value.update()})},1e3*60*3,{immediate:!0,afterMounted:!0});function m(t){var g,a;return(a=(g=x(t.iconUrl,"preview"))!=null?g:x(t.faviconUrl,"preview"))!=null?a:"/client-assets/dummy.png"}return p({name:M,configure:d,id:e.widget?e.widget.id:null}),(t,g)=>(l(),k(U,{naked:w(o).transparent,"show-header":!1,class:"mkw-instance-cloud"},{default:y(()=>[s("div",O,[r.value?(l(),k(z,{key:0},{default:y(()=>[(l(!0),_(B,null,$(r.value,a=>(l(),_("li",{key:a.id},[s("a",{onClick:S(X=>u(a),["prevent"])},[s("img",{style:{width:"32px"},src:m(a)},null,8,Q)],8,G)]))),128))]),_:1})):F("",!0)])]),_:1},8,["naked"]))}});export{ee as default};
