/*! * clipboard.js v1.7.1 * https://zenorocha.github.io/clipboard.js * * licensed mit 漏 zeno rocha */ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function i(a,c){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var s=new error("cannot find module '"+a+"'");throw s.code="module_not_found",s}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return i(n||t)},u,u.exports,t,e,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a0&&void 0!==arguments[0]?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedtext=""}},{key:"initselection",value:function t(){this.text?this.selectfake():this.target&&this.selecttarget()}},{key:"selectfake",value:function t(){var e=this,n="rtl"==document.documentelement.getattribute("dir");this.removefake(),this.fakehandlercallback=function(){return e.removefake()},this.fakehandler=this.container.addeventlistener("click",this.fakehandlercallback)||!0,this.fakeelem=document.createelement("textarea"),this.fakeelem.style.fontsize="12pt",this.fakeelem.style.border="0",this.fakeelem.style.padding="0",this.fakeelem.style.margin="0",this.fakeelem.style.position="absolute",this.fakeelem.style[n?"right":"left"]="-9999px";var o=window.pageyoffset||document.documentelement.scrolltop;this.fakeelem.style.top=o+"px",this.fakeelem.setattribute("readonly",""),this.fakeelem.value=this.text,this.container.appendchild(this.fakeelem),this.selectedtext=(0,i.default)(this.fakeelem),this.copytext()}},{key:"removefake",value:function t(){this.fakehandler&&(this.container.removeeventlistener("click",this.fakehandlercallback),this.fakehandler=null,this.fakehandlercallback=null),this.fakeelem&&(this.container.removechild(this.fakeelem),this.fakeelem=null)}},{key:"selecttarget",value:function t(){this.selectedtext=(0,i.default)(this.target),this.copytext()}},{key:"copytext",value:function t(){var e=void 0;try{e=document.execcommand(this.action)}catch(t){e=!1}this.handleresult(e)}},{key:"handleresult",value:function t(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedtext,trigger:this.trigger,clearselection:this.clearselection.bind(this)})}},{key:"clearselection",value:function t(){this.trigger&&this.trigger.focus(),window.getselection().removeallranges()}},{key:"destroy",value:function t(){this.removefake()}},{key:"action",set:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new error('invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!==(void 0===e?"undefined":r(e))||1!==e.nodetype)throw new error('invalid "target" value, use a valid element');if("copy"===this.action&&e.hasattribute("disabled"))throw new error('invalid "target" attribute. please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasattribute("readonly")||e.hasattribute("disabled")))throw new error('invalid "target" attribute. you can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function t(){return this._target}}]),t}();t.exports=c})},{select:5}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if(void 0!==o)r(n,e("./clipboard-action"),e("tiny-emitter"),e("good-listener"));else{var a={exports:{}};r(a,i.clipboardaction,i.tinyemitter,i.goodlistener),i.clipboard=a.exports}}(this,function(t,e,n,o){"use strict";function i(t){return t&&t.__esmodule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new typeerror("cannot call a class as a function")}function a(t,e){if(!t)throw new referenceerror("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new typeerror("super expression must either be null or a function, not "+typeof e);t.prototype=object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(object.setprototypeof?object.setprototypeof(t,e):t.__proto__=e)}function l(t,e){var n="data-clipboard-"+t;if(e.hasattribute(n))return e.getattribute(n)}var s=i(e),u=i(n),f=i(o),d="function"==typeof symbol&&"symbol"==typeof symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof symbol&&t.constructor===symbol&&t!==symbol.prototype?"symbol":typeof t},h=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultaction,this.target="function"==typeof e.target?e.target:this.defaulttarget,this.text="function"==typeof e.text?e.text:this.defaulttext,this.container="object"===d(e.container)?e.container:document.body}},{key:"listenclick",value:function t(e){var n=this;this.listener=(0,f.default)(e,"click",function(t){return n.onclick(t)})}},{key:"onclick",value:function t(e){var n=e.delegatetarget||e.currenttarget;this.clipboardaction&&(this.clipboardaction=null),this.clipboardaction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),container:this.container,trigger:n,emitter:this})}},{key:"defaultaction",value:function t(e){return l("action",e)}},{key:"defaulttarget",value:function t(e){var n=l("target",e);if(n)return document.queryselector(n)}},{key:"defaulttext",value:function t(e){return l("text",e)}},{key:"destroy",value:function t(){this.listener.destroy(),this.clipboardaction&&(this.clipboardaction.destroy(),this.clipboardaction=null)}}],[{key:"issupported",value:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],n="string"==typeof e?[e]:e,o=!!document.querycommandsupported;return n.foreach(function(t){o=o&&!!document.querycommandsupported(t)}),o}}]),e}(u.default);t.exports=p})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)});