Files
2026-04-07 17:56:15 +02:00

2 lines
5.2 KiB
JavaScript

import{W as O,X as L,Y as q,Z as j,$ as E,a0 as N,a1 as U,a2 as I,a3 as P,r as _,a4 as H,a5 as D,a6 as F,a7 as V,a8 as T,a9 as W,aa as o,ab as z,ac as b,ad as B,ae as M,af as $,ag as G,ah as Q,C as X}from"./Dhg5knF6.js";const Y=(...t)=>t.find(c=>c!==void 0);function Z(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=X(),a=b(()=>!!o(e.target)&&o(e.target)!=="_self"),i=b(()=>{const u=o(e.to)||o(e.href)||"";return typeof u=="string"&&B(u,{acceptRelative:!0})}),m=_("RouterLink"),g=m&&typeof m!="string"?m.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)}),p=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?T(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:p,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(p.value,{replace:o(e.replace),external:f.value||a.value})}}}return O({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:m,isExternal:g,hasTarget:f,isAbsoluteUrl:r}=w(e),y=F(!1),p=V(null),u=s=>{p.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?T(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&&W(a.value,d).catch(()=>{})])}if(C("visibility")){const s=q();let h,n=null;j(()=>{const x=J();E(()=>{h=N(()=>{p?.value?.tagName&&(n=x.observe(p.value,async()=>{n?.(),n=null,await R(s)}))})})}),U(()=>{h&&I(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=Y(e.noRel?"":e.rel,t.externalRelAttribute,r.value||f.value?"noopener noreferrer":"")||null;return e.custom?l.default?l.default({href:i.value,navigate:m,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 H(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:p,href:i.value||null,rel:h,target:s,onClick:async n=>{if(!(g.value||f.value)){n.preventDefault();try{const x=D(i.value);return await(e.replace?d.replace(x):d.push(x))}finally{if(v(a.value)){const x=a.value.slice(1);let A=x;try{A=decodeURIComponent(x)}catch{}document.getElementById(A)?.focus()}}}}},l.default?.())}}})}const ne=Z($);function k(t,c){const v=c==="append"?G:Q;return B(t)&&!t.startsWith("http")?t:v(t,!0)}function J(){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 K=/2g/;function ee(){const t=navigator.connection;return!!(t&&(t.saveData||K.test(t.effectiveType)))}export{ne as _};