!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define("vAnchor",[],t):"object"===typeof exports?exports.vAnchor=t():e.vAnchor=t()}("undefined"!==typeof self?self:this,(function(){return function(){"use strict";var e={};let t={cssClasses:{outer:"v-anchor--html",inner:"v-anchor"},body:null,offset:0};const o=e=>{let o=document.querySelector(e);o?t.body.scrollTop=o.offsetTop-t.offset:console.warn("[v-anchor]",`Invalid anchor: ${e}`)},n=(e,n,s)=>{let{value:d,arg:r,modifiers:c}=s;switch(r){case"href":n.dataset.href=d,n[`${e}EventListener`]("click",(()=>{o(d)}));break;case"id":n.setAttribute("id",d)}c.html&&n.classList[e](t.cssClasses.outer)},s=function(e){let n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelectorAll(`.${t.cssClasses.outer} .${t.cssClasses.inner}`);n.length&&n.forEach((t=>{t[`${e}EventListener`]("click",(()=>{o(t.dataset.href)}))}))},d={name:"anchor",beforeMount(e,t){n("add",e,t)},mounted(e,o){((e,o)=>{let{value:n,modifiers:s}=o;Object.keys(s).length&&(t.body=s.bodyElement?e:document.documentElement||document.body,t.offset=s.offset?n:t.body.dataset.vanchorOffset||0)})(e,o),o.modifiers.html&&s("add")},updated(e,t,o){t.modifiers.html&&s("add",o.el)},beforeUnmount(e,o){e===t.body&&(t.body=document.documentElement||document.body),n("remove",e,o),o.modifiers.html&&s("remove")}};return e.default=d,e=e.default}()}));