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