/** * jQuery asGradient v0.3.3 * https://github.com/amazingSurge/jquery-asGradient * * Copyright (c) amazingSurge * Released under the LGPL-3.0 license */ !function(t,e){if("function"==typeof define&&define.amd)define("AsGradient",["exports","jquery","jquery-asColor"],e);else if("undefined"!=typeof exports)e(exports,require("jquery"),require("jquery-asColor"));else{var n={exports:{}};e(n.exports,t.jQuery,t.AsColor),t.AsGradient=n.exports}}(this,function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(){var t=window.navigator.userAgent,e="";return/MSIE/g.test(t)?e="-ms-":/Firefox/g.test(t)?e="-moz-":/(WebKit)/i.test(t)?e="-webkit-":/Opera/g.test(t)&&(e="-o-"),e}function s(t){var e={top:"bottom",right:"left",bottom:"top",left:"right","right top":"left bottom","top right":"bottom left","bottom right":"top left","right bottom":"left top","left bottom":"right top","bottom left":"top right","top left":"bottom right","left top":"right bottom"};return e.hasOwnProperty(t)?e[t]:t}function a(t){return/^(top|left|right|bottom)$/i.test(t)}Object.defineProperty(t,"__esModule",{value:!0});var u=r(e),l=r(n),p="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},f=function(){function t(t,e){for(var n=0;nthis.length)&&-1!==this.indexOf(t,e)});var c={"to top":0,"to right":90,"to bottom":180,"to left":270,"to right top":45,"to top right":45,"to bottom right":135,"to right bottom":135,"to left bottom":225,"to bottom left":225,"to top left":315,"to left top":315},v=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(c),g=function(){var t=/(?:rgba|rgb|hsla|hsl)\s*\([\s\d\.,%]+\)|#[a-z0-9]{3,6}|[a-z]+/i,e=/\d{1,3}%/i,n=/(?:to ){0,1}(?:(?:top|left|right|bottom)\s*){1,2}|\d+deg/i,r=new RegExp("("+t.source+")\\s*("+e.source+"){0,1}","i"),o=new RegExp(r.source,"gi"),i=new RegExp("(?:("+n.source+")){0,1}\\s*,{0,1}\\s*(.*?)\\s*","i");return{FULL:new RegExp("^(-webkit-|-moz-|-ms-|-o-){0,1}(linear|radial|repeating-linear)-gradient\\s*\\(\\s*("+i.source+")\\s*\\)$","i"),ANGLE:n,COLOR:t,POSITION:e,STOP:r,STOPS:o,PARAMETERS:new RegExp("^"+i.source+"$","i")}}(),d={matchString:function(t){var e=this.parseString(t);return!!(e&&e.value&&e.value.stops&&e.value.stops.length>1)},parseString:function(t){t=u.default.trim(t);var e=void 0;if(null!==(e=g.FULL.exec(t))){var n=this.parseParameters(e[3]);return{prefix:void 0===e[1]?null:e[1],type:e[2],value:n}}return!1},parseParameters:function(t){var e=void 0;if(null!==(e=g.PARAMETERS.exec(t))){var n=this.parseStops(e[2]);return{angle:void 0===e[1]?0:e[1],stops:n}}return!1},parseStops:function(t){var e=this,n=void 0,r=[];return null!==(n=t.match(g.STOPS))&&(u.default.each(n,function(t,n){var o=e.parseStop(n);o&&r.push(o)}),r)},formatStops:function(t,e){for(var n=void 0,r=[],o=[],i=[],s=void 0,a=0;a360?u%=360:u<0&&0!==(u%=-360)&&(u+=360),u},fixOldAngle:function(t){return t=parseFloat(t),t=Math.abs(450-t)%360,t=parseFloat(t.toFixed(3))},formatAngle:function(t,e,n){return t=parseInt(t,10),n&&v.hasOwnProperty(t)?(t=v[t],e&&(t=s(t.substr(3)))):(e&&(t=this.fixOldAngle(t)),t+="deg"),t}},y=function(){function t(e,n,r){o(this,t),this.color=(0,l.default)(e,r.options.color),this.position=d.parsePosition(n),this.id=++r._stopIdCount,this.gradient=r}return f(t,[{key:"setPosition",value:function(t){var e=d.parsePosition(t);this.position!==e&&(this.position=e,this.gradient.reorder())}},{key:"setColor",value:function(t){this.color.fromString(t)}},{key:"remove",value:function(){this.gradient.removeById(this.id)}}]),t}(),m={LINEAR:{parse:function(t){return{r:"%"===t[1].substr(-1)?parseInt(2.55*t[1].slice(0,-1),10):parseInt(t[1],10),g:"%"===t[2].substr(-1)?parseInt(2.55*t[2].slice(0,-1),10):parseInt(t[2],10),b:"%"===t[3].substr(-1)?parseInt(2.55*t[3].slice(0,-1),10):parseInt(t[3],10),a:1}},to:function(t,e,n){if(0===t.stops.length)return e.options.emptyString;if(1===t.stops.length)return t.stops[0].color.to(e.options.degradationFormat);var r=e.options.forceStandard,o=e._prefix;o||(r=!0),n&&-1!==u.default.inArray(n,e.options.prefixes)&&(r=!1,o=n);var i="linear-gradient("+d.formatAngle(t.angle,!r,e.options.angleUseKeyword)+", "+d.formatStops(t.stops,e.options.cleanPosition)+")";return r?i:o+i}}},b=function(){function t(e,n){o(this,t),"object"===(void 0===e?"undefined":p(e))&&void 0===n&&(n=e,e=void 0),this.value={angle:0,stops:[]},this.options=u.default.extend(!0,{},h,n),this._type="LINEAR",this._prefix=null,this.length=this.value.stops.length,this.current=0,this._stopIdCount=0,this.init(e)}return f(t,[{key:"init",value:function(t){t&&this.fromString(t)}},{key:"val",value:function(t){return void 0===t?this.toString():(this.fromString(t),this)}},{key:"angle",value:function(t){return void 0===t?this.value.angle:(this.value.angle=d.parseAngle(t),this)}},{key:"append",value:function(t,e){return this.insert(t,e,this.length)}},{key:"reorder",value:function(){this.length<2||(this.value.stops=this.value.stops.sort(function(t,e){return t.position-e.position}))}},{key:"insert",value:function(t,e,n){void 0===n&&(n=this.current);var r=new y(t,e,this);return this.value.stops.splice(n,0,r),this.length=this.length+1,this.current=n,r}},{key:"getById",value:function(t){if(this.length>0)for(var e in this.value.stops)if(t===this.value.stops[e].id)return this.value.stops[e];return!1}},{key:"removeById",value:function(t){var e=this.getIndexById(t);e&&this.remove(e)}},{key:"getIndexById",value:function(t){var e=0;for(var n in this.value.stops){if(t===this.value.stops[n].id)return e;e++}return!1}},{key:"getCurrent",value:function(){return this.value.stops[this.current]}},{key:"setCurrentById",value:function(t){var e=0;for(var n in this.value.stops)this.value.stops[n].id!==t?e++:this.current=e}},{key:"get",value:function(t){return void 0===t&&(t=this.current),t>=0&&t=0&&t