1import{_ as I}from"./CvMVyTfu.js";import{_ as K}from"./DEtbj3yt.js";import O from"./DlUS4SxD.js";import{o as r,c as i,a as e,t as f,b as y,d as M,e as L,u as Q,r as J,f as $,w as W,g as X,n as h,h as o,i as g,j as D,_ as T,k as Y,F as E,l as z}from"./BXA5FzRJ.js";import{i as Z,_ as ee}from"./qmbnezf9.js";import{u as te,a as oe,b as re,c as se,e as ae}from"./90JIyfLa.js";import{u as ne,i as le,a as ie,b as de,c as ce,d as ue,e as me,f as ge,g as he}from"./DZFRiBcs.js";import{_ as fe}from"./DARA_DA3.js";import{f as B}from"./BBHjeOXq.js";import{u as ye}from"./DWqEPCzR.js";import"./Buwj1sW-.js";const ve={class:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-100 dark:border-gray-700 transition-colors duration-200"},xe={class:"flex justify-between mb-0"},be={class:"text-lg font-medium text-gray-700 dark:text-gray-200"},we={class:"h-10 w-10 rounded-lg bg-gradient-to-br from-blue-100 to-blue-100 dark:from-blue-900 dark:to-blue-900 flex items-center justify-center"},pe={class:"flex items-end justify-between"},_e={class:"text-3xl font-bold text-gray-900 dark:text-white"},ke={key:0,class:"flex items-end justify-between"},Se={class:"text-sm font-medium text-green-600 dark:text-green-400 flex items-center"},Ce={__name:"StatCard",props:{title:{type:String,required:!0},value:{type:String,required:!0},icon:{type:String,required:!0},trend:{type:String,required:!1}},setup(s){return(v,n)=>{const m=O;return r(),i("div",ve,[e("div",xe,[e("h3",be,f(s.title),1),e("div",we,[s.icon==="server"?(r(),y(m,{key:0,name:"feather:server",size:"25",class:"text-blue-600 dark:text-blue-300"})):s.icon==="users"?(r(),y(m,{key:1,name:"feather:users",size:"25",class:"text-blue-600 dark:text-blue-300"})):s.icon==="posts"?(r(),y(m,{key:2,name:"feather:image",size:"25",class:"text-blue-600 dark:text-blue-300"})):s.icon==="active"?(r(),y(m,{key:3,name:"feather:activity",size:"25",class:"text-blue-600 dark:text-blue-300"})):M("",!0)])]),e("div",pe,[e("div",_e,f(s.value),1)]),s.trend&&s.trend.length?(r(),i("div",ke,[e("div",Se,[n[0]||(n[0]=e("svg",{class:"h-4 w-4 mr-1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M5.293 9.707a1 1 0 010-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 01-1.414 1.414L11 7.414V15a1 1 0 11-2 0V7.414L6.707 9.707a1 1 0 01-1.414 0z","clip-rule":"evenodd"})],-1)),L(" "+f(s.trend),1)])])):M("",!0)])}}},$e={key:0,xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-yellow-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Le={key:1,xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Ae={key:0,class:"flex justify-center items-center h-64"},Ne={class:"animate-pulse flex space-x-4"},Fe={class:"flex-1 space-y-4 py-1"},je={class:"space-y-2"},Me={key:1,class:"text-red-500 text-center"},De={key:2,class:"w-full h-80"},qe={__name:"NetworkGrowthChart",props:{timeRange:{type:String,default:"month"},initialTheme:{type:String,default:"system"}},async setup(s){let v,n;ne([Z,le,ie,de,ce,ue,me,ge,he]);const m=s,x=Q(),l=J(x.value==="dark"),A=()=>{l.value=!l.value},N=async()=>{const d=await fetch("https://api.fedidb.org/v1/graphs");if(!d.ok)throw new Error("Network response was not ok");return d.json()},{data:w,suspense:p,isLoading:F,error:_}=te({queryKey:["fediNetworkGrowth",m.timeRange],queryFn:N}),b=$(()=>{if(!w.value)return[];const d=[...w.value].sort((t,a)=>new Date(t.date)-new Date(a.date));switch(m.timeRange){case"week":return d.slice(-7);case"month":return d.slice(-30);case"quarter":return d.slice(-90);case"all":return d.filter(t=>t.user_count>1e4);default:return d}}),j=$(()=>l.value?{textColor:"#FFFFFF",textColorSecondary:"rgba(255,255,255,0.7)",axisLineColor:"rgba(255,255,255,0.1)",backgroundColor:"rgba(15,23,42,0.9)",userCountColor:"rgb(124,58,237)",monthlyActiveColor:"rgb(255,137,4)",serverCountColor:"rgb(59,130,246)"}:{textColor:"#1F2937",textColorSecondary:"rgba(31,41,55,0.7)",axisLineColor:"rgba(31,41,55,0.1)",backgroundColor:"rgba(249,250,251,0.9)",userCountColor:"rgb(109,40,217)",monthlyActiveColor:"rgb(234,88,12)",serverCountColor:"rgb(37,99,235)"}),k=$(()=>{const d=b.value.map(a=>new Date(a.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})),t=j.value;return{title:{id:"network-stats",text:"Network Stats",show:!1,textStyle:{color:t.textColor}},tooltip:{trigger:"axis",backgroundColor:t.backgroundColor,textStyle:{color:t.textColor},axisPointer:{type:"cross"}},toolbox:{feature:{saveAsImage:{iconStyle:{borderColor:t.textColorSecondary}}}},legend:{textStyle:{color:t.textColorSecondary},data:["User Count","Monthly Active","Server Count"]},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}
1,xAxis:{type:"category",data:d,boundaryGap:!1,axisLine:{lineStyle:{color:t.axisLineColor}},axisLabel:{color:t.textColorSecondary,rotate:0},axisTick:{show:!1}},yAxis:{min:"dataMin",max:"dataMax",type:"log",logBase:2,axisLine:{lineStyle:{color:t.axisLineColor}},axisLabel:{color:t.textColorSecondary,formatter:a=>a>=1e6?(a/1e6).toFixed(1)+"M":a>=1e3?(a/1e3).toFixed(0)+"K":a},splitLine:{lineStyle:{color:t.axisLineColor}}},series:[{name:"User Count",type:"line",data:b.value.map(a=>a.user_count),smooth:!0,showSymbol:!1,lineStyle:{width:3,color:t.userCountColor},areaStyle:{opacity:.05,color:`${t.userCountColor}`}},{name:"Monthly Active",type:"line",data:b.value.map(a=>Math.floor(a.monthly_active)),smooth:!0,showSymbol:!1,lineStyle:{width:2,color:t.monthlyActiveColor},areaStyle:{opacity:.05,color:`${t.monthlyActiveColor}`}},{name:"Server Count",type:"line",data:b.value.map(a=>a.instance_count),smooth:!0,showSymbol:!1,lineStyle:{width:1,color:t.serverCountColor},areaStyle:{opacity:.1,color:`${t.serverCountColor}`}}]}});return W(x,()=>{l.value=x.preference==="dark"}),[v,n]=X(()=>p()),await v,n(),(d,t)=>{const a=ee;return r(),i("div",null,[e("div",{class:h(["flex justify-between items-center p-3",l.value?"bg-gray-900":"bg-gray-50"])},[e("h2",{class:h([l.value?"text-white":"text-gray-800","text-lg font-semibold"])},"Network Growth",2),e("button",{onClick:A,class:h(["p-2 rounded-full hover:bg-opacity-20",l.value?"hover:bg-gray-600":"hover:bg-gray-300"])},[l.value?(r(),i("svg",$e,[...t[0]||(t[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"},null,-1)])])):(r(),i("svg",Le,[...t[1]||(t[1]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"},null,-1)])]))],2)],2),e("div",{class:h([l.value?"bg-gray-800":"bg-white","flex flex-col items-center justify-center h-full p-3 transition-colors duration-300"])},[o(F)?(r(),i("div",Ae,[e("div",Ne,[e("div",{class:h([l.value?"bg-gray-300":"bg-gray-700","rounded-full h-10 w-10"])},null,2),e("div",Fe,[e("div",{class:h([l.value?"bg-gray-300":"bg-gray-700","h-4 rounded w-3/4"])},null,2),e("div",je,[e("div",{class:h([l.value?"bg-gray-300":"bg-gray-700","h-4 rounded"])},null,2),e("div",{class:h([l.value?"bg-gray-300":"bg-gray-700","h-4 rounded w-5/6"])},null,2)])])])])):o(_)?(r(),i("div",Me,[t[2]||(t[2]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-12 w-12 mx-auto mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})],-1)),e("p",null,f(o(_).message||"Failed to load data"),1)])):(r(),i("div",De,[g(a,{option:k.value,autoresize:"",class:"h-full w-full"},null,8,["option"])]))],2)])}}},Ee={class:"bg-white dark:bg-gray-800 rounded-xl shadow-md overflow-hidden transition-colors duration-200 hover:shadow-lg"},ze={class:"h-32 bg-gradient-to-r from-blue-500 to-sky-600 relative overflow-hidden"},Be=["src"],Te={class:"absolute bottom-3 left-4 right-4"},Ve={class:"text-xl font-bold text-white"},Ge={class:"text-sm text-gray-200 line-clamp-1"},Pe={class:"p-4"},Re={class:"flex justify-between items-center mb-3 gap-3"},Ue={class:"text-sm text-gray-500 dark:text-gray-400 line-clamp-1"},He={class:"flex items-center justify-between"},Ie={class:"text-lg font-semibold text-gray-900 dark:text-white"},Ke={__name:"ServerCard",props:{name:{type:String,required:!0},description:{type:String},domain:{type:String,required:!0},users:{type:String,required:!0},software:{type:String,required:!0},uptime:{type:String,required:!0},thumbnail:{type:String,default:null}},setup(s){return(v,n)=>{const m=T;return r(),i("div",Ee,[e("div",ze,[s.thumbnail?(r(),i("img",{key:0,src:s.thumbnail,alt:"",class:"w-full h-full object-cover opacity-50"},null,8,Be)):M("",!0),n[0]||(n[0]=e("div",{class:"absolute inset-0 bg-gradient-to-b from-transparent to-black opacity-60"},null,-1)),e("div",Te,[e("h3",Ve,f(s.domain),1),e("p",Ge,f(s.softw
1are),1)])]),e("div",Pe,[e("div",Re,[e("div",Ue,f(s.description),1)]),e("div",He,[e("div",null,[n[1]||(n[1]=e("div",{class:"text-sm text-gray-500 dark:text-gray-400"},"Accounts",-1)),e("div",Ie,f(s.users),1)]),g(m,{to:`/servers/${s.domain}`,class:"bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded-lg text-sm font-medium transition-colors"},{default:D(()=>[...n[2]||(n[2]=[L(" View Details ",-1)])]),_:1},8,["to"])])])])}}},Oe={class:"min-h-screen dark:bg-gray-900 bg-gray-50"},Qe={key:0,class:"flex items-center justify-center min-h-screen"},Je={key:2,class:"container max-w-6xl mx-auto px-4 py-8 dark:text-white"},We={class:"mb-12"},Xe={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-12"},Ye={class:"grid grid-cols-1 gap-8 mb-10"},Ze={class:"overflow-hidden rounded-xl border border-gray-100 dark:border-gray-700 shadow-md transition-colors duration-200"},et={class:"mb-12"},tt={class:"flex justify-between items-center mb-6"},ot={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},rt={class:"mb-12"},st={class:"flex justify-between items-center mb-6"},at={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},xt={__name:"index",setup(s){const v=Y(),{data:n,isLoading:m,isError:x,error:l,refetch:A}=oe(),{data:N,isLoading:w,isError:p,error:F,refetch:_}=re(),{data:b,isLoading:j,isError:k,error:d,refetch:t}=se(),a=$(()=>ae(N.value));function V(){A(),_(),t()}return ye(()=>({title:"FediDB: The Complete Fediverse Directory & Analytics Platform",meta:[{name:"description",content:"Discover and explore the Fediverse with FediDB - your comprehensive directory for Mastodon servers, apps, and analytics. Track growth trends, find communities, and stay connected across the decentralized social web"}]})),(S,c)=>{const G=I,P=K,C=Ce,R=qe,q=T,U=fe,H=Ke;return r(),i("div",Oe,[o(m)||o(w)||o(j)?(r(),i("div",Qe,[g(G)])):o(x)||o(p)||o(k)?(r(),y(P,{key:1,show:o(x)||o(p)||o(k),error:o(l)?.message||o(F)?.message||o(d)?.message||"Something went wrong.",onRetry:V,"show-go-back":!1},null,8,["show","error"])):(r(),i("main",Je,[e("section",We,[c[0]||(c[0]=e("h1",{class:"text-4xl md:text-5xl font-bold mb-2 dark:text-white"}," Fediverse Network Stats ",-1)),c[1]||(c[1]=e("p",{class:"text-lg text-gray-600 dark:text-gray-500 mb-8"}," Tracking the growth and activity of the ActivityPub fediverse. ",-1)),e("div",Xe,[g(C,{title:"Active Accounts",value:o(n).monthly_active_users.toLocaleString(),icon:"active"},null,8,["value"]),g(C,{title:"Active Servers",value:o(n).total_instances.toLocaleString(),icon:"server"},null,8,["value"]),g(C,{title:"Total Accounts",value:("formatNumber"in S?S.formatNumber:o(B))(o(n).total_users),icon:"users"},null,8,["value"]),g(C,{title:"Total Statuses",value:("formatNumber"in S?S.formatNumber:o(B))(o(n).total_statuses),icon:"posts"},null,8,["value"])]),e("div",Ye,[e("div",Ze,[g(R)])])]),e("section",et,[e("div",tt,[c[3]||(c[3]=e("h2",{class:"text-2xl font-bold dark:text-white"},"Popular Software",-1)),g(q,{to:"/software",class:"text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 font-medium transition-colors"},{default:D(()=>[...c[2]||(c[2]=[L(" View All â ",-1)])]),_:1})]),e("div",ot,[(r(!0),i(E,null,z(o(b).slice(0,6),u=>(r(),y(U,{key:u.id,software:u,onClick:nt=>o(v).push(`/software/${u.slug}`)},null,8,["software","onClick"]))),128))])]),e("section",rt,[e("div",st,[c[5]||(c[5]=e("h2",{class:"text-2xl font-bold dark:text-white"},"Popular Servers",-1)),g(q,{to:"/servers",class:"text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 font-medium transition-colors"},{default:D(()=>[...c[4]||(c[4]=[L(" View All â ",-1)])]),_:1})]),e("div",at,[(r(!0),i(E,null,z(a.value.slice(0,6),u=>(r(),y(H,{key:u.id,name:u.description,domain:u.domain,users:u.stats.user_count.toLocaleString(),software:u.software?.name||"Unknown software",uptime:u.uptime,thumbnail:u.thumbnail,description:u.description||"No server description available"},null,8,["name","domain","users","software","uptime","thumbnail","description"]))),128))])])]))])}}};export{xt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.