const e=require("../_util/type.js"),t=require("../_util/classNames.js"),n=require("../_util/props-util/initDefaultProps.js"),r=require("../config-provider/hooks/useConfigInject.js"),i=require("./context.js");let a=require("vue");var o=()=>({prefixCls:String,href:String,title:e.anyType(),target:String,customTitleProps:e.objectType()}),s=(0,a.defineComponent)({compatConfig:{MODE:3},name:`AAnchorLink`,inheritAttrs:!1,props:n.default(o(),{href:`#`}),slots:Object,setup(e,{slots:n,attrs:o}){let s=null,{handleClick:c,scrollTo:l,unregisterLink:u,registerLink:d,activeLink:f}=i.useInjectAnchor(),{prefixCls:p}=r.default(`anchor`,e),m=t=>{let{href:n}=e;c(t,{title:s,href:n}),l(n)};return(0,a.watch)(()=>e.href,(e,t)=>{(0,a.nextTick)(()=>{u(t),d(e)})}),(0,a.onMounted)(()=>{d(e.href)}),(0,a.onBeforeUnmount)(()=>{u(e.href)}),()=>{let{href:r,target:i,title:c=n.title,customTitleProps:l={}}=e,u=p.value;s=typeof c==`function`?c(l):c;let d=f.value===r,h=t.default(`${u}-link`,{[`${u}-link-active`]:d},o.class),g=t.default(`${u}-link-title`,{[`${u}-link-title-active`]:d});return(0,a.createVNode)(`div`,{...o,class:h},[(0,a.createVNode)(`a`,{class:g,href:r,title:typeof s==`string`?s:``,target:i,onClick:m},[n.customTitle?n.customTitle(l):s]),n.default?.()])}}});exports.anchorLinkProps=o,exports.default=s;