/*! * TinyGradient 0.4.3 * Copyright 2014-2018 Damien "Mistic" Sorel (http://www.strangeplanet.fr) * Licensed under MIT (http://opensource.org/licenses/MIT) */ !function(a,b){"undefined"!=typeof module&&module.exports?module.exports=b(require("tinycolor2")):"function"==typeof define&&define.amd?define(["tinycolor2"],b):a.tinygradient=b(a.tinycolor)}(this,function(a){"use strict";function b(a,b,c){var d={};for(var e in a)a.hasOwnProperty(e)&&(d[e]=0===c?0:(b[e]-a[e])/c);return d}function c(a,b,c,d){var e={};for(var f in b)b.hasOwnProperty(f)&&(e[f]=a[f]*c+b[f],e[f]=e[f]<0?e[f]+d[f]:1!==d[f]?e[f]%d[f]:e[f]);return e}function d(d,e,f){for(var g,i=d.color.toRgb(),j=e.color.toRgb(),k=[d.color],l=b(i,j,f),m=1;m=l.h&&g?l.h-k.h:g?360-l.h+k.h:360-k.h+l.h,n.h=Math.pow(-1,g?1:0)*Math.abs(h)/f;for(var o=1;o1)throw new Error("Position must be between 0 and 1");for(var h,i,j=0,k=d.length;j=d[j].pos&&e1)throw new Error("Color stops positions must be between 0 and 1");if(b.pos<=e)throw new Error("Color stops positions are not ordered");e=b.pos}else b={color:a(b),pos:f/(d-1)};return b}),0!==this.stops[0].pos&&this.stops.unshift({color:this.stops[0].color,pos:0}),1!==this.stops[this.stops.length-1].pos&&this.stops.push({color:this.stops[this.stops.length-1].color,pos:1})};j.prototype.reverse=function(){var a=[];return this.stops.forEach(function(b){a.push({color:b.color,pos:1-b.pos})}),new j(a.reverse())},j.prototype.rgb=function(a){for(var b=f(this.stops,a),c=[],e=0,g=this.stops.length;eg.h&&c.h-g.h>180),l=0===c.s||0===g.s?l.concat(d(this.stops[m],this.stops[m+1],i[m])):l.concat(e(this.stops[m],this.stops[m+1],i[m],"long"===b&&h||"short"===b&&!h||!k&&j));return l.push(this.stops[n-1].color),l},j.prototype.css=function(a,b){a=a||"linear",b=b||("linear"===a?"to right":"ellipse at center");var c=a+"-gradient("+b;return this.stops.forEach(function(a){c+=", "+a.color.toRgbString()+" "+100*a.pos+"%"}),c+=")"},j.prototype.rgbAt=function(a){return g(this.stops,a,"toRgb",h)},j.prototype.hsvAt=function(a){return g(this.stops,a,"toHsv",i)};var k={rgb:1,hsv:2,css:2,rgbAt:1,hsvAt:1};return Object.keys(k).forEach(function(a){j[a]=function(){var b=Array.prototype.slice.call(arguments),c=b.splice(-k[a]),d=new j(b);return d[a].apply(d,c)}}),j});