import{v as K}from"./chunk-DfTn_VfD.js";import{m as j,a}from"./chunk-DhYw-kuD.js";function L(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}function P(t,r){return(t.aliasOf||t)===(r.aliasOf||r)}function q(t,r){for(const s in r){const e=r[s],u=t[s];if(typeof e=="string"){if(e!==u)return!1}else if(Array.isArray(u)===!1||u.length!==e.length||e.some((g,d)=>g!==u[d]))return!1}return!0}function O(t,r){return Array.isArray(r)===!0?t.length===r.length&&t.every((s,e)=>s===r[e]):t.length===1&&t[0]===r}function B(t,r){return Array.isArray(t)===!0?O(t,r):Array.isArray(r)===!0?O(r,t):t===r}function M(t,r){if(Object.keys(t).length!==Object.keys(r).length)return!1;for(const s in t)if(B(t[s],r[s])===!1)return!1;return!0}const V={to:[String,Object],replace:Boolean,href:String,target:String,disable:Boolean},H={...V,exact:Boolean,activeClass:{type:String,default:"q-router-link--active"},exactActiveClass:{type:String,default:"q-router-link--exact-active"}};function T({fallbackTag:t,useDisableForRouterLinkProps:r=!0}={}){const s=j(),{props:e,proxy:u,emit:g}=s,d=K(s),h=a(()=>e.disable!==!0&&e.href!==void 0),$=r===!0?a(()=>d===!0&&e.disable!==!0&&h.value!==!0&&e.to!==void 0&&e.to!==null&&e.to!==""):a(()=>d===!0&&h.value!==!0&&e.to!==void 0&&e.to!==null&&e.to!==""),f=a(()=>$.value===!0?A(e.to):null),o=a(()=>f.value!==null),m=a(()=>h.value===!0||o.value===!0),C=a(()=>e.type==="a"||m.value===!0?"a":e.tag||t||"div"),S=a(()=>h.value===!0?{href:e.href,target:e.target}:o.value===!0?{href:f.value.href,target:e.target}:{}),k=a(()=>{if(o.value===!1)return-1;const{matched:n}=f.value,{length:l}=n,i=n[l-1];if(i===void 0)return-1;const c=u.$route.matched;if(c.length===0)return-1;const v=c.findIndex(P.bind(null,i));if(v!==-1)return v;const x=L(n[l-2]);return l>1&&L(i)===x&&c[c.length-1].path!==x?c.findIndex(P.bind(null,n[l-2])):v}),p=a(()=>o.value===!0&&k.value!==-1&&q(u.$route.params,f.value.params)),y=a(()=>p.value===!0&&k.value===u.$route.matched.length-1&&M(u.$route.params,f.value.params)),I=a(()=>o.value===!0?y.value===!0?` ${e.exactActiveClass} ${e.activeClass}`:e.exact===!0?"":p.value===!0?` ${e.activeClass}`:"":"");function A(n){try{return u.$router.resolve(n)}catch{}return null}function R(n,{returnRouterError:l,to:i=e.to,replace:c=e.replace}={}){if(e.disable===!0)return n.preventDefault(),Promise.resolve(!1);if(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey||n.button!==void 0&&n.button!==0||e.target==="_blank")return Promise.resolve(!1);n.preventDefault();const v=u.$router[c===!0?"replace":"push"](i);return l===!0?v:v.then(()=>{}).catch(()=>{})}function b(n){if(o.value===!0){const l=i=>R(n,i);g("click",n,l),n.defaultPrevented!==!0&&l()}else g("click",n)}return{hasRouterLink:o,hasHrefLink:h,hasLink:m,linkTag:C,resolvedLink:f,linkIsActive:p,linkIsExactActive:y,linkClass:I,linkAttrs:S,getLink:A,navigateToRouterLink:R,navigateOnClick:b}}export{T as a,V as b,H as u};
