{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/modules/copy-link.js"],"names":["Module","Component","e","link","ev"],"mappings":"kJAEA,MAAMA,UAAeC,WAAU,CAC7B,eAAgB,CACd,KAAK,IAAM,CACT,KAAM,KAAK,EACb,CACF,CAEA,cAAe,CACb,KAAK,IAAI,KAAK,iBAAiB,QAAS,KAAK,SAAS,KAAK,KAAK,IAAI,IAAI,CAAC,CAC3E,CAEA,SAASC,EAAG,CACVA,EAAE,eAAe,EACjB,MAAMC,EAAOD,EAAE,OAAO,QAAQ,GAAG,EAAE,aAAa,MAAM,EAEtD,UAAU,UAAU,UAAUC,CAAI,EAAE,KAAK,IAAM,CAE7CD,EAAE,OAAO,QAAQ,GAAG,EAAE,UAAU,IAAI,mBAAmB,EACvD,WAAW,IAAI,CACbA,EAAE,OAAO,QAAQ,GAAG,EAAE,UAAU,OAAO,mBAAmB,CAC5D,EAAG,GAAI,CACT,CAAC,EAAE,MAAME,GAAM,CACb,QAAQ,IAAIA,CAAE,CAChB,CAAC,CACH,CACF,CAEA,UAAeJ,C","file":"scripts/564.da0960b9.js","sourcesContent":["import { Component } from '@verndale/core';\n\nclass Module extends Component {\n setupDefaults() {\n this.dom = {\n $btn: this.el\n };\n }\n\n addListeners() {\n this.dom.$btn.addEventListener('click', this.copyLink.bind(this.dom.$btn));\n }\n\n copyLink(e) {\n e.preventDefault();\n const link = e.target.closest(\"a\").getAttribute('href');\n\n navigator.clipboard.writeText(link).then(() => {\n // Do not interrupt or lose focus from the page during the copy, devtools breakpoints can cause problems too.\n e.target.closest(\"a\").classList.add('copy-link--copied');\n setTimeout(()=>{\n e.target.closest(\"a\").classList.remove('copy-link--copied');\n }, 2000)\n }).catch(ev => {\n console.log(ev);\n });\n }\n}\n\nexport default Module;\n"],"sourceRoot":""}