!function(e,o){"function"==typeof define&&define.amd?define(["angular"],o):"object"==typeof module&&module.exports?module.exports=o(require("angular")):e.angularClipboard=o(e.angular)}(this,function(r){return r.module("angular-clipboard",[]).factory("clipboard",["$document","$window",function(n,r){return{copyText:function(e,o){var t,e=(t=e,(e=n[0].createElement("textarea")).style.position="absolute",e.textContent=t,e.style.left="-10000px",e.style.top=(r.pageYOffset||n[0].documentElement.scrollTop)+"px",e);n[0].body.appendChild(e),function(e){try{n[0].body.style.webkitUserSelect="initial";var o=n[0].getSelection();if(o.removeAllRanges(),e.select(),!n[0].execCommand("copy"))throw"failure copy";o.removeAllRanges()}finally{n[0].body.style.webkitUserSelect=""}}(e),n[0].body.removeChild(e)},supported:"queryCommandSupported"in n[0]&&n[0].queryCommandSupported("copy")}}]).directive("clipboard",["clipboard",function(n){return{restrict:"A",scope:{onCopied:"&",onError:"&",text:"=",supported:"=?"},link:function(o,t){o.supported=n.supported,t.on("click",function(e){try{n.copyText(o.text,t[0]),r.isFunction(o.onCopied)&&o.$evalAsync(o.onCopied())}catch(e){r.isFunction(o.onError)&&o.$evalAsync(o.onError({err:e}))}})}}}])});