import{S as T,W as _,X as j,r as E,Y as A,s as N,Z as B,$ as U,y as I,a0 as D,a1 as k,k as L,a2 as F,a3 as P,a4 as H,E as b,a5 as O,a6 as V,a7 as W,q as z,a8 as M,a9 as $,aa as G}from"./BBNi_1TY.js";const Q=(...t)=>t.find(s=>s!==void 0);function X(t){const s=t.componentName||"NuxtLink";function y(e){return typeof e=="string"&&e.startsWith("#")}function C(e,n,h){const a=h??t.trailingSlash;if(!e||a!=="append"&&a!=="remove")return e;if(typeof e=="string")return R(e,a);const i="path"in e&&e.path!==void 0?e.path:n(e).path;return{...e,name:void 0,path:R(i,a)}}function q(e){const n=_(),h=W(),a=b(()=>!!e.target&&e.target!=="_self"),i=b(()=>{const f=e.to||e.href||"";return typeof f=="string"&&O(f,{acceptRelative:!0})}),x=L("RouterLink"),g=x&&typeof x!="string"?x.useLink:void 0,d=b(()=>{if(e.external)return!0;const f=e.to||e.href||"";return typeof f=="object"?!1:f===""||i.value}),l=b(()=>{const f=e.to||e.href||"";return d.value?f:C(f,n.resolve,e.trailingSlash)}),c=d.value||g==null?void 0:g({...e,to:l}),m=b(()=>{var S;const f=e.trailingSlash??t.trailingSlash;if(!l.value||i.value||y(l.value))return l.value;if(d.value){const p=typeof l.value=="object"&&"path"in l.value?P(l.value):l.value,r=typeof p=="object"?n.resolve(p).href:p;return R(r,f)}return typeof l.value=="object"?((S=n.resolve(l.value))==null?void 0:S.href)??null:R(V(h.app.baseURL,l.value),f)});return{to:l,hasTarget:a,isAbsoluteUrl:i,isExternal:d,href:m,isActive:(c==null?void 0:c.isActive)??b(()=>l.value===n.currentRoute.value.path),isExactActive:(c==null?void 0:c.isExactActive)??b(()=>l.value===n.currentRoute.value.path),route:(c==null?void 0:c.route)??b(()=>n.resolve(l.value)),async navigate(f){await z(m.value,{replace:e.replace,external:d.value||a.value})}}}return T({name:s,props:{to:{type:[String,Object],default:void 0,required:!1},href:{type:[String,Object],default:void 0,required:!1},target:{type:String,default:void 0,required:!1},rel:{type:String,default:void 0,required:!1},noRel:{type:Boolean,default:void 0,required:!1},prefetch:{type:Boolean,default:void 0,required:!1},prefetchOn:{type:[String,Object],default:void 0,required:!1},noPrefetch:{type:Boolean,default:void 0,required:!1},activeClass:{type:String,default:void 0,required:!1},exactActiveClass:{type:String,default:void 0,required:!1},prefetchedClass:{type:String,default:void 0,required:!1},replace:{type:Boolean,default:void 0,required:!1},ariaCurrentValue:{type:String,default:void 0,required:!1},external:{type:Boolean,default:void 0,required:!1},custom:{type:Boolean,default:void 0,required:!1},trailingSlash:{type:String,default:void 0,required:!1}},useLink:q,setup(e,{slots:n}){const h=_(),{to:a,href:i,navigate:x,isExternal:g,hasTarget:d,isAbsoluteUrl:l}=q(e),c=j(!1),m=E(null),f=r=>{var o;m.value=e.custom?(o=r==null?void 0:r.$el)==null?void 0:o.nextElementSibling:r==null?void 0:r.$el};function S(r){var o,u;return!c.value&&(typeof e.prefetchOn=="string"?e.prefetchOn===r:((o=e.prefetchOn)==null?void 0:o[r])??((u=t.prefetchOn)==null?void 0:u[r]))&&(e.prefetch??t.prefetch)!==!1&&e.noPrefetch!==!0&&e.target!=="_blank"&&!J()}async function p(r=A()){if(c.value)return;c.value=!0;const o=typeof a.value=="string"?a.value:g.value?P(a.value):h.resolve(a.value).fullPath,u=g.value?new URL(o,window.location.href).href:o;await Promise.all([r.hooks.callHook("link:prefetch",u).catch(()=>{}),!g.value&&!d.value&&H(a.value,h).catch(()=>{})])}if(S("visibility")){const r=A();let o,u=null;N(()=>{const v=Y();B(()=>{o=U(()=>{var w;(w=m==null?void 0:m.value)!=null&&w.tagName&&(u=v.observe(m.value,async()=>{u==null||u(),u=null,await p(r)}))})})}),I(()=>{o&&D(o),u==null||u(),u=null})}return()=>{var u;if(!g.value&&!d.value&&!y(a.value)){const v={ref:f,to:a.value,activeClass:e.activeClass||t.activeClass,exactActiveClass:e.exactActiveClass||t.exactActiveClass,replace:e.replace,ariaCurrentValue:e.ariaCurrentValue,custom:e.custom};return e.custom||(S("interaction")&&(v.onPointerenter=p.bind(null,void 0),v.onFocus=p.bind(null,void 0)),c.value&&(v.class=e.prefetchedClass||t.prefetchedClass),v.rel=e.rel||void 0),k(L("RouterLink"),v,n.default)}const r=e.target||null,o=Q(e.noRel?"":e.rel,t.externalRelAttribute,l.value||d.value?"noopener noreferrer":"")||null;return e.custom?n.default?n.default({href:i.value,navigate:x,prefetch:p,get route(){if(!i.value)return;const v=new URL(i.value,window.location.href);return{path:v.pathname,fullPath:v.pathname,get query(){return F(v.search)},hash:v.hash,params:{},name:void 0,matched:[],redirectedFrom:void 0,meta:{},href:i.value}},rel:o,target:r,isExternal:g.value||d.value,isActive:!1,isExactActive:!1}):null:k("a",{ref:m,href:i.value||null,rel:o,target:r,onClick:v=>{if(!(g.value||d.value))return v.preventDefault(),e.replace?h.replace(i.value):h.push(i.value)}},(u=n.default)==null?void 0:u.call(n))}}})}const ee=X(G);function R(t,s){const y=s==="append"?M:$;return O(t)&&!t.startsWith("http")?t:y(t,!0)}function Y(){const t=A();if(t._observer)return t._observer;let s=null;const y=new Map,C=(e,n)=>(s||(s=new IntersectionObserver(h=>{for(const a of h){const i=y.get(a.target);(a.isIntersecting||a.intersectionRatio>0)&&i&&i()}})),y.set(e,n),s.observe(e),()=>{y.delete(e),s==null||s.unobserve(e),y.size===0&&(s==null||s.disconnect(),s=null)});return t._observer={observe:C}}const Z=/2g/;function J(){const t=navigator.connection;return!!(t&&(t.saveData||Z.test(t.effectiveType)))}export{ee as _};
