import{u as j}from"./useDefaults-DESCdb0p-CFLjYrdG.js";import{x as a,l as q,V as B,B as N,R as m,ao as S,I as _,c as w,o as K,w as E,J as F,L as G,D as y,G as V,P as J,ap as z,aq as M}from"./index-D02r7Zsc.js";import{p as Q}from"./object-0ALvRU0O-3BORTTD-.js";import{t as U}from"./stringUtils-gJJ6T6UC-g5BZrMym.js";const W=o=>!!(o.href||o.to),ne=(o,t)=>{const C=B(N(t)),e=B(N(o)),c=a(()=>W(e.value)),l=a(()=>c.value?Q(e.value,C.value??["active","activeClass","append","exactActiveClass","href","rel","replace","routerComponentName","target","to","variant","opacity","opacityHover","underlineVariant","underlineOffset","underlineOffsetHover","underlineOpacity","underlineOpacityHover"]):{});return{computedLink:c,computedLinkProps:l}},X=({to:o,disabled:t,href:C,replace:e,routerComponentName:c})=>{const l=J(),O=l?.appContext?.app?.config?.globalProperties?.$router,g=l?.appContext?.app?.config?.globalProperties?.$route,i=V("RouterLink"),x=i&&typeof i!="string"&&"useLink"in i?i.useLink:null,r=a(()=>m(o)||""),v=B(N(e)),f=a(()=>U(m(c))),d=a(()=>!(l?.appContext?.app?.component(f.value)!==void 0)||m(t)||!r.value?"a":f.value),s=a(()=>d.value==="RouterLink"),k=a(()=>s.value&&typeof l?.appContext?.app?.$nuxt<"u"),L=a(()=>d.value!=="a"&&!s.value&&!k.value),$=a(()=>s.value||k.value),H=a(()=>({to:r.value,replace:v.value})),P=x?.({to:r,replace:v}),h=a(()=>$.value?P:null),R=a(()=>{if(h.value?.href.value)return h.value.href.value;const p="#",u=m(C);if(u)return u;if(typeof r.value=="string")return r.value||p;const n=r.value;if(n!==void 0&&"path"in n){const b=n.path||"",D=n.query?`?${Object.keys(n.query).map(A=>`${A}=${n.query?.[A]}`).join("=")}`:"",I=!n.hash||n.hash.charAt(0)==="#"?n.hash||"":`#${n.hash}`;return`${b}${D}${I}`||p}return p});return{isNonStandardTag:L,tag:d,isRouterLink:s,isNuxtLink:k,computedHref:R,routerName:f,router:O,route:g,link:h,linkProps:H}},Y=o=>a(()=>{const t=m(o);return{[`link-${t.variant}`]:t.variant!==null,[`link-opacity-${t.opacity}`]:t.opacity!==void 0,[`link-opacity-${t.opacityHover}-hover`]:t.opacityHover!==void 0,[`link-underline-${t.underlineVariant}`]:t.underlineVariant!==null,[`link-offset-${t.underlineOffset}`]:t.underlineOffset!==void 0,[`link-offset-${t.underlineOffsetHover}-hover`]:t.underlineOffsetHover!==void 0,"link-underline":t.underlineVariant===null&&(t.underlineOpacity!==void 0||t.underlineOpacityHover!==void 0),[`link-underline-opacity-${t.underlineOpacity}`]:t.underlineOpacity!==void 0,[`link-underline-opacity-${t.underlineOpacityHover}-hover`]:t.underlineOpacityHover!==void 0,"icon-link":t.icon===!0}}),T="active",oe=q({__name:"BLink",props:{active:{type:Boolean,default:void 0},activeClass:{default:"router-link-active"},disabled:{type:Boolean,default:!1},exactActiveClass:{default:"router-link-exact-active"},href:{default:void 0},icon:{type:Boolean,default:!1},noRel:{type:Boolean,default:!1},opacity:{default:void 0},opacityHover:{default:void 0},prefetch:{type:Boolean,default:void 0},prefetchOn:{default:void 0},noPrefetch:{type:Boolean,default:void 0},prefetchedClass:{default:void 0},rel:{default:void 0},replace:{type:Boolean,default:!1},routerComponentName:{default:"router-link"},routerTag:{default:"a"},stretched:{type:Boolean,default:!1},target:{default:void 0},to:{default:void 0},underlineOffset:{default:void 0},underlineOffsetHover:{default:void 0},underlineOpacity:{default:void 0},underlineOpacityHover:{default:void 0},underlineVariant:{default:null},variant:{default:null}},emits:["click"],setup(o,{emit:t}){const e=j(o,"BLink"),c=t,l=S(),{computedHref:O,tag:g,link:i,isNuxtLink:x,isRouterLink:r,linkProps:v,isNonStandardTag:f}=X({routerComponentName:()=>e.routerComponentName,disabled:()=>e.disabled,to:()=>e.to,replace:()=>e.replace,href:()=>e.href}),d=_(z,null),s=_(M,null),k=Y(e),L=a(()=>[k.value,l.class,$.value,{[T]:e.active,[e.activeClass]:i.value?.isActive.value||!1,[e.exactActiveClass]:i.value?.isExactActive.value||!1,"stretched-link":e.stretched===!0}]),$=a(()=>({[T]:e.active,disabled:e.disabled})),H=u=>{if(e.disabled){u.preventDefault(),u.stopImmediatePropagation();return}(d?.isNav?.value===!0&&s===null||s!==null&&s.noAutoClose?.value!==!0)&&d?.hide?.(),c("click",u)},P=a(()=>e.target==="_blank"?!e.rel&&e.noRel?"noopener":e.rel:void 0),h=a(()=>e.disabled?"-1":typeof l.tabindex>"u"?null:l.tabindex),R=a(()=>({prefetch:e.prefetch,noPrefetch:e.noPrefetch,prefetchOn:e.prefetchOn,prefetchedClass:e.prefetchedClass,...v.value})),p=a(()=>({...r.value?v.value:void 0,...x.value||f.value?R.value:void 0}));return(u,n)=>(K(),w(V(y(g)),G({class:L.value,target:y(e).target,href:y(O),rel:P.value,tabindex:h.value,"aria-disabled":y(e).disabled?!0:null},p.value,{onClick:n[0]||(n[0]=b=>{H(b),y(i)?.navigate(b)})}),{default:E(()=>[F(u.$slots,"default")]),_:3},16,["class","target","href","rel","tabindex","aria-disabled"]))}});export{oe as _,Y as a,ne as u};
