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