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