import{d as B,aC as N,Y as l,b as c,Z as R,ae as S,c as g,F as I,p as z,a as x,n as _,e as D,o as p,k as E,cm as U,g as w,w as V,s as F,j as H,t as W,Q as j,_ as A}from"./v5WcX6fg.js";const M={class:"text-nowrap"},Q=B({__name:"NavTabs",props:{links:{},query:{}},setup(k){const n=N(),v=k,C=l(null),s=l(4),i=l(4),r=l(4),d=l(4),u=l(-1),f=l(!1),m=c(()=>v.links.filter(t=>t.shown===void 0?!0:t.shown)),L=c(()=>`${s.value}px`),T=c(()=>`${i.value}px`),q=c(()=>`${r.value}px`),$=c(()=>`${d.value}px`),b=l();function y(){let t=-1;f.value=!1;for(let e=m.value.length-1;e>=0;e--){const o=m.value[e];if(v.query){if(n.query[v.query]===o.href||!n.query[v.query]&&!o.href){t=e;break}}else if(decodeURIComponent(n.path)===o.href){t=e;break}else if(decodeURIComponent(n.path).includes(o.href)||o.subpages&&o.subpages.some(a=>decodeURIComponent(n.path).includes(a))){t=e,f.value=!0;break}}u.value=t,u.value!==-1?P():(s.value=0,r.value=0)}function P(){var o;const t=(o=b.value[u.value])==null?void 0:o.$el;if(!t||!t.offsetParent)return;const e={left:t.offsetLeft,top:t.offsetTop,right:t.offsetParent.offsetWidth-t.offsetLeft-t.offsetWidth,bottom:t.offsetParent.offsetHeight-t.offsetTop-t.offsetHeight};s.value===4&&r.value===4?(s.value=e.left,r.value=e.right,i.value=e.top,d.value=e.bottom):(e.left{r.value=e.right},200)):(r.value=e.right,setTimeout(()=>{s.value=e.left},200)),e.top{d.value=e.bottom},200)):(d.value=e.bottom,setTimeout(()=>{i.value=e.top},200)))}return R(()=>{y()}),S(()=>[n.path,n.query],()=>y()),(t,e)=>{const o=j;return p(),g("nav",{ref_key:"scrollContainer",ref:C,class:"card-shadow experimental-styles-within relative flex w-fit overflow-x-auto rounded-full bg-bg-raised p-1 text-sm font-bold"},[(p(!0),g(I,null,z(m.value,(a,h)=>E((p(),w(o,{key:h,ref_for:!0,ref_key:"tabLinkElements",ref:b,to:t.query?a.href?`?${t.query}=${a.href}`:"?":a.href,class:_(["button-animation z-[1] flex flex-row items-center gap-2 px-4 py-2 focus:rounded-full",{"text-button-textSelected":u.value===h&&!f.value,"text-contrast":u.value===h&&f.value}])},{default:V(()=>[a.icon?(p(),w(F(a.icon),{key:0,class:"size-5"})):H("",!0),x("span",M,W(a.label),1)]),_:2},1032,["to","class"])),[[U,a.shown===void 0?!0:a.shown]])),128)),x("div",{class:_(`navtabs-transition pointer-events-none absolute h-[calc(100%-0.5rem)] overflow-hidden rounded-full p-1 ${f.value?"bg-button-bg":"bg-button-bgSelected"}`),style:D({left:L.value,top:T.value,right:q.value,bottom:$.value,opacity:s.value===4&&s.value===r.value||u.value===-1?0:1}),"aria-hidden":"true"},null,6)],512)}}}),Z=A(Q,[["__scopeId","data-v-147b93b3"]]);export{Z as N};