import{f as o,a as e,c as $}from"../chunks/bmn8XlW7.js";import{o as z}from"../chunks/CJbqisBi.js";import{p as D,u as G,a as H,d as x,e as P,f as v,n as F,r as u,t as J,g as K}from"../chunks/DpkolLiq.js";import{s as O}from"../chunks/pfhwnV1O.js";import{i as b}from"../chunks/TXeUdaq1.js";import{p as t,b as Q,e as R}from"../chunks/DxBGAPM1.js";import{P as U}from"../chunks/MqDOSMkA.js";import{B as S,C as V}from"../chunks/SxayRmdi.js";import{P as A}from"../chunks/CYUyO3aA.js";var W=o("<!> New Profile",1),X=o('<div class="text-center py-12 text-muted-foreground">Loading profiles...</div>'),Z=o('<div class="text-center py-12 text-red-500 dark:text-red-400"> </div>'),rr=o("<!> Create Your First Profile",1),er=o('<p class="text-muted-foreground mb-4">No profiles configured yet.</p> <!>',1),tr=o('<div class="space-y-4"></div>'),or=o('<div class="space-y-6"><div class="flex items-center justify-between"><h1 class="text-2xl font-bold">Server Profiles</h1> <!></div> <!></div>');function pr(C,Y){D(Y,!0);let d=0,a=null;z(()=>{t.refresh(),Q.refresh();function r(){d=window.scrollY}return window.addEventListener("scroll",r,{passive:!0}),()=>{window.removeEventListener("scroll",r),a&&cancelAnimationFrame(a)}}),G(()=>{t.profiles,a&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=requestAnimationFrame(()=>{d>0&&Math.abs(window.scrollY-d)>50&&window.scrollTo({top:d,behavior:"instant"})})})});var _=or(),h=P(_),L=x(P(h),2);S(L,{href:"/profiles/new",children:(r,n)=>{var m=W(),g=v(m);A(g,{class:"w-4 h-4 mr-2"}),F(),e(r,m)},$$slots:{default:!0}}),u(h);var k=x(h,2);{var q=r=>{var n=X();e(r,n)},B=r=>{var n=$(),m=v(n);{var g=s=>{var i=Z(),w=P(i,!0);u(i),J(()=>O(w,t.error)),e(s,i)},E=s=>{var i=$(),w=v(i);{var M=l=>{V(l,{class:"p-12 text-center",children:(f,c)=>{var p=er(),j=x(v(p),2);S(j,{href:"/profiles/new",children:(I,ar)=>{var y=rr(),T=v(y);A(T,{class:"w-4 h-4 mr-2"}),F(),e(I,y)},$$slots:{default:!0}}),e(f,p)},$$slots:{default:!0}})},N=l=>{var f=tr();R(f,21,()=>t.profiles,c=>c.id,(c,p)=>{U(c,{get profile(){return K(p)}})}),u(f),e(l,f)};b(w,l=>{t.profiles.length===0?l(M):l(N,!1)},!0)}e(s,i)};b(m,s=>{t.error?s(g):s(E,!1)},!0)}e(r,n)};b(k,r=>{t.loading?r(q):r(B,!1)})}u(_),e(C,_),H()}export{pr as component};
