import{Ar as e,Dr as t,Ei as n,Hi as r,Ji as i,Oi as a,Qr as o,S as s,Si as c,V as l,Xr as u,Zi as d,bi as f,fi as p,gi as m,hi as h,ki as g,li as _,o as v,pi as y,rt as b,ui as x}from"./CWa6_HoJ.js";import"./Dyr8SJaL.js";import"./CuBO3oar.js";import"./Bl-TdfMY.js";import{t as S}from"./D71YoeuH.js";import{n as C,r as w,t as T}from"./DWnMeYoA.js";import{t as E}from"./CTjSelY7.js";var D={class:`flex h-full items-center justify-center overflow-y-auto bg-base-100 p-4`},O={class:`animate-spring-up mx-auto w-full max-w-md`},k={class:`mb-8 text-center`},A={class:`mb-4`},j={class:`mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-box bg-primary/12 text-primary`},M={class:`text-[0.9375rem] text-base-content/80`},N={key:0,class:`mt-6`},P={class:`mb-3 text-[0.8125rem] font-semibold tracking-widest text-base-content/70 uppercase`},F=[`onClick`],I={class:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-base-300 text-base-content/60`},L={class:`flex min-w-0 flex-1 flex-col gap-0.5`},R={class:`flex items-center gap-1.5`},z=[`value`,`placeholder`,`onInput`],B={key:0,class:`overflow-hidden pl-[1.125rem] text-[0.6875rem] text-ellipsis whitespace-nowrap text-base-content/50`},V=[`onClick`],H=c({__name:`setup`,setup(c){let{t:H}=t();u({title:p(()=>H(`setup`))});let U=o(),W=e(),G=r(null);function K(e){W.removeEndpoint(e)}function q(e,t){W.updateEndpoint(e,{label:t})}let J=r(null);return S(J,p({get:()=>W.endpointList,set:e=>W.setEndpointList(e)}),{handle:`.drag-handle`,animation:150,watchElement:!0}),n(async()=>{await G.value?.autoLogin(U.query,{tryDefault:!1})}),(e,t)=>{let n=w,r=C,o=T,c=E;return a(),m(`div`,D,[y(`div`,O,[f(n,{class:`mb-6`}),f(r,{class:`mb-6`}),f(o,{class:`mb-6`}),y(`div`,k,[y(`div`,A,[y(`div`,j,[f(i(s),{size:32})]),t[2]||=y(`h1`,{class:`text-3xl font-bold tracking-wide text-base-content uppercase sm:text-4xl`},[y(`span`,null,`metacube`),y(`span`,{class:`text-base-content/40`},`(`),y(`a`,{class:`text-primary no-underline transition-colors duration-200 hover:text-primary/80`,href:`https://github.com/metacubex/metacubexd`,target:`_blank`},` xd `),y(`span`,{class:`text-base-content/40`},`)`)],-1)]),y(`p`,M,d(i(H)(`setupDescription`)),1)]),f(c,{ref_key:`connectForm`,ref:G,"submit-label":i(H)(`add`)},null,8,[`submit-label`]),i(W).endpointList.length>0?(a(),m(`div`,N,[y(`h3`,P,d(i(H)(`savedEndpoints`)),1),y(`div`,{ref_key:`endpointListRef`,ref:J,class:`flex flex-col gap-3`},[(a(!0),m(x,null,g(i(W).endpointList,e=>(a(),m(`div`,{key:e.id,class:`group flex cursor-pointer items-center gap-2 rounded-xl border border-base-content/10 bg-base-200 p-3 transition-colors duration-200 hover:border-base-content/20 hover:bg-base-300`,onClick:t=>i(G)?.selectEndpoint(e.id)},[f(i(b),{class:`drag-handle shrink-0 cursor-grab text-base-content/30 transition-colors duration-200 hover:text-base-content/60 active:cursor-grabbing`,size:16,onClick:t[0]||=_(()=>{},[`stop`])}),y(`div`,I,[f(i(s),{size:16})]),y(`div`,L,[y(`div`,R,[f(i(l),{class:`shrink-0 text-base-content/30 transition-colors duration-200 group-hover:text-base-content/50`,size:12}),y(`input`,{value:e.label,type:`text`,class:`min-w-0 flex-1 border-none bg-transparent p-0 text-[0.8125rem] font-medium text-base-content transition-colors duration-200 placeholder:text-base-content/60 focus:outline-none`,placeholder:e.url,onClick:t[1]||=_(()=>{},[`stop`]),onInput:t=>q(e.id,t.target.value)},null,40,z)]),e.label?(a(),m(`span`,B,d(e.url),1)):h(``,!0)]),y(`button`,{class:`flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-base-content/50 transition-all duration-200 hover:bg-error/15 hover:text-error`,onClick:_(t=>K(e.id),[`stop`])},[f(i(v),{size:14})],8,V)],8,F))),128))],512)])):h(``,!0)])])}}});export{H as default};