(function(e){"function"===typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports&&"object"==typeof module?module.exports=e:e(jQuery)})(function(e,Da){function ua(r,f,n,m){for(var u=[],t=0;t<r.length;t++){var q=r[t];if(q){var v=tinycolor(q),D=.5>v.toHsl().l?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light",D=D+(tinycolor.equals(f,q)?" sp-thumb-active":""),q=v.toString(m.preferredFormat||"rgb"),da=Ea?"background-color:"+v.toRgbString():"filter:"+v.toFilter();u.push('<span title="'+
q+'" data-color="'+v.toRgbString()+'" class="'+D+'"><span class="sp-thumb-inner" style="'+da+';" /></span>')}else u.push(e("<div />").append(e('<span data-color="" style="background-color:transparent;" class="sp-clear-display"></span>').attr("title",m.noColorSelectedText)).html())}return"<div class='sp-cf "+n+"'>"+u.join("")+"</div>"}function Ma(r,f){var n=e.extend({},$,r);n.callbacks={move:E(n.move,f),change:E(n.change,f),show:E(n.show,f),hide:E(n.hide,f),beforeShow:E(n.beforeShow,f)};return n}function va(r,
f){function n(){k.showPaletteOnly&&(k.showPalette=!0);wa.text(k.showPaletteOnly?k.togglePaletteMoreText:k.togglePaletteLessText);if(k.palette){la=k.palette.slice(0);A=e.isArray(la[0])?la:[la];ma={};for(var a=0;a<A.length;a++)for(var b=0;b<A[a].length;b++){var c=tinycolor(A[a][b]).toRgbString();ma[c]=!0}}p.toggleClass("sp-flat",H);p.toggleClass("sp-input-disabled",!k.showInput);p.toggleClass("sp-alpha-enabled",k.showAlpha);p.toggleClass("sp-clear-enabled",V);p.toggleClass("sp-buttons-disabled",!k.showButtons);
p.toggleClass("sp-palette-buttons-disabled",!k.togglePaletteOnly);p.toggleClass("sp-palette-disabled",!k.showPalette);p.toggleClass("sp-palette-only",k.showPaletteOnly);p.toggleClass("sp-initial-disabled",!k.showInitial);p.addClass(k.className).addClass(k.containerClassName);F()}function m(){if(l&&window.localStorage){try{var a=window.localStorage[l].split(",#");1<a.length&&(delete window.localStorage[l],e.each(a,function(a,b){u(b)}))}catch(b){}try{I=window.localStorage[l].split(";")}catch(c){}}}
function u(a){if(O){a=tinycolor(a).toRgbString();if(!ma[a]&&-1===e.inArray(a,I))for(I.push(a);I.length>$;)I.shift();if(l&&window.localStorage)try{window.localStorage[l]=I.join(";")}catch(b){}}}function t(){var a=[];if(k.showPalette)for(var b=0;b<I.length;b++){var c=tinycolor(I[b]).toRgbString();ma[c]||a.push(I[b])}return a.reverse().slice(0,k.maxSelectionSize)}function q(){var a=z(),b=e.map(A,function(b,c){return ua(b,a,"sp-palette-row sp-palette-row-"+c,k)});m();I&&b.push(ua(t(),a,"sp-palette-row sp-palette-row-selection",
k));Fa.html(b.join(""))}function v(){if(k.showInitial){var a=W,b=z();Ga.html(ua([a,b],b,"sp-palette-row-initial",k))}}function D(){(0>=x||0>=P||0>=c)&&F();X=!0;p.addClass("sp-dragging");Q=null;w.trigger("dragstart.spectrum",[z()])}function da(){X=!1;p.removeClass("sp-dragging");w.trigger("dragstop.spectrum",[z()])}function xa(){var a=J.val();null!==a&&""!==a||!V?(a=tinycolor(a),a.isValid()?(K(a),C(!0)):J.addClass("sp-validation-error")):(K(null),C(!0))}function Y(){g?L():Z()}function Z(){var a=e.Event("beforeShow.spectrum");
if(g)F();else if(w.trigger(a,[z()]),!1!==y.beforeShow(z())&&!a.isDefaultPrevented()){for(a=0;a<R.length;a++)R[a]&&R[a].hide();g=!0;e(ea).bind("keydown.spectrum",G);e(ea).bind("click.spectrum",Ha);e(window).bind("resize.spectrum",aa);ba.addClass("sp-active");p.removeClass("sp-hidden");F();N();W=z();v();y.show(W);w.trigger("show.spectrum",[W])}}function G(a){27===a.keyCode&&L()}function Ha(a){2==a.button||X||(Na?C(!0):K(W,!0),L())}function L(){g&&!H&&(g=!1,e(ea).unbind("keydown.spectrum",G),e(ea).unbind("click.spectrum",
Ha),e(window).unbind("resize.spectrum",aa),ba.removeClass("sp-active"),p.addClass("sp-hidden"),y.hide(z()),w.trigger("hide.spectrum",[z()]))}function K(a,b){if(tinycolor.equals(a,z()))N();else{var c,d;!a&&V?S=!0:(S=!1,c=tinycolor(a),d=c.toHsv(),h=d.h%360/360,fa=d.s,ga=d.v,M=d.a);N();c&&c.isValid()&&!b&&(ha=ya||c.getFormat())}}function z(a){a=a||{};return V&&S?null:tinycolor.fromRatio({h:h,s:fa,v:ga,a:Math.round(100*M)/100},{format:a.format||ha})}function T(){N();y.move(z());w.trigger("move.spectrum",
[z()])}function N(){J.removeClass("sp-validation-error");s();var a=tinycolor.fromRatio({h:h,s:1,v:1});na.css("background-color",a.toHexString());a=ha;!(1>M)||0===M&&"name"===a||"hex"!==a&&"hex3"!==a&&"hex6"!==a&&"name"!==a||(a="rgb");var b=z({format:a}),c="";ca.removeClass("sp-clear-display");ca.css("background-color","transparent");if(!b&&V)ca.addClass("sp-clear-display");else{var c=b.toHexString(),d=b.toRgbString();Ea||1===b.alpha?ca.css("background-color",d):(ca.css("background-color","transparent"),
ca.css("filter",b.toFilter()));if(k.showAlpha){d=b.toRgb();d.a=0;var d=tinycolor(d).toRgbString(),g="linear-gradient(left, "+d+", "+c+")";U?ia.css("filter",tinycolor(d).toFilter({gradientType:1},c)):(ia.css("background","-webkit-"+g),ia.css("background","-moz-"+g),ia.css("background","-ms-"+g),ia.css("background","linear-gradient(to right, "+d+", "+c+")"))}c=b.toString(a)}k.showInput&&J.val(c);k.showPalette&&q();v()}function s(){var g=fa,k=ga;V&&S?(oa.hide(),pa.hide(),qa.hide()):(oa.show(),pa.show(),
qa.show(),g*=P,k=x-k*x,g=Math.max(-a,Math.min(P-a,g-a)),k=Math.max(-a,Math.min(x-a,k-a)),qa.css({top:k+"px",left:g+"px"}),oa.css({left:M*b-d/2+"px"}),pa.css({top:h*c-Ia+"px"}))}function C(a){var b=z(),c="",d=!tinycolor.equals(b,W);b&&(c=b.toString(ha),u(b));ra&&w.val(c);a&&d&&(y.change(b),w.trigger("change",[b]))}function F(){P=na.width();x=na.height();a=qa.height();za.width();c=za.height();Ia=pa.height();b=Ja.width();d=oa.width();H||(p.css("position","absolute"),k.offset?p.offset(k.offset):p.offset(Oa(p,
ja)));s();k.showPalette&&q();w.trigger("reflow.spectrum")}function E(){L();Aa=!0;w.attr("disabled",!0);ja.addClass("sp-disabled")}var k=Ma(f,r),H=k.flat,O=k.showSelectionPalette,l=k.localStorageKey,B=k.theme,y=k.callbacks,aa=Pa(F,10),g=!1,X=!1,P=0,x=0,a=0,c=0,b=0,d=0,Ia=0,h=0,fa=0,ga=0,M=1,la=[],A=[],ma={},I=k.selectionPalette.slice(0),$=k.maxSelectionSize,Q=null,ea=r.ownerDocument,w=e(r),Aa=!1,p=e(Qa,ea).addClass(B),va=p.find(".sp-picker-container"),na=p.find(".sp-color"),qa=p.find(".sp-dragger"),
za=p.find(".sp-hue"),pa=p.find(".sp-slider"),ia=p.find(".sp-alpha-inner"),Ja=p.find(".sp-alpha"),oa=p.find(".sp-alpha-handle"),J=p.find(".sp-input"),Fa=p.find(".sp-palette"),Ga=p.find(".sp-initial"),Ka=p.find(".sp-cancel"),Ba=p.find(".sp-clear"),La=p.find(".sp-choose"),wa=p.find(".sp-palette-toggle"),ra=w.is("input"),Ra=ra&&"color"===w.attr("type")&&e.fn.spectrum.inputTypeColorSupport(),Ca=ra&&!H,ba=Ca?e("<div class='sp-replacer'><div class='sp-preview'><div class='sp-preview-inner'></div></div><div class='sp-dd'>&#9660;</div></div>").addClass(B).addClass(k.className).addClass(k.replacerClassName):
e([]),ja=Ca?ba:w,ca=ba.find(".sp-preview-inner"),ka=k.color||ra&&w.val(),W=!1,ya=k.preferredFormat,ha=ya,Na=!k.showButtons||k.clickoutFiresChange,S=!ka,V=k.allowEmpty&&!Ra;(function(){function a(b){b.data&&b.data.ignore?(K(e(b.target).closest(".sp-thumb-el").data("color")),T()):(K(e(b.target).closest(".sp-thumb-el").data("color")),T(),C(!0),k.hideAfterPaletteSelect&&L());return!1}U&&p.find("*:not(input)").attr("unselectable","on");n();Ca&&w.after(ba).hide();V||Ba.hide();if(H)w.after(p).hide();else{var d=
"parent"===k.appendTo?w.parent():e(k.appendTo);1!==d.length&&(d=e("body"));d.append(p)}m();ja.bind("click.spectrum touchstart.spectrum",function(a){Aa||Y();a.stopPropagation();e(a.target).is("input")||a.preventDefault()});(w.is(":disabled")||!0===k.disabled)&&E();p.click(Sa);J.change(xa);J.bind("paste",function(){setTimeout(xa,1)});J.keydown(function(a){13==a.keyCode&&xa()});Ka.text(k.cancelText);Ka.bind("click.spectrum",function(a){a.stopPropagation();a.preventDefault();K(W,!0);L()});Ba.attr("title",
k.clearText);Ba.bind("click.spectrum",function(a){a.stopPropagation();a.preventDefault();S=!0;T();H&&C(!0)});La.text(k.chooseText);La.bind("click.spectrum",function(a){a.stopPropagation();a.preventDefault();U&&J.is(":focus")&&J.trigger("change");J.hasClass("sp-validation-error")||(C(!0),L())});wa.text(k.showPaletteOnly?k.togglePaletteMoreText:k.togglePaletteLessText);wa.bind("click.spectrum",function(a){a.stopPropagation();a.preventDefault();k.showPaletteOnly=!k.showPaletteOnly;k.showPaletteOnly||
H||p.css("left","-="+(va.outerWidth(!0)+5));n()});sa(Ja,function(a,c,d){M=a/b;S=!1;d.shiftKey&&(M=Math.round(10*M)/10);T()},D,da);sa(za,function(a,b){h=parseFloat(b/c);S=!1;k.showAlpha||(M=1);T()},D,da);sa(na,function(a,b,c){c.shiftKey?Q||(c=x-ga*x,Q=Math.abs(a-fa*P)>Math.abs(b-c)?"x":"y"):Q=null;c=!Q||"y"===Q;Q&&"x"!==Q||(fa=parseFloat(a/P));c&&(ga=parseFloat((x-b)/x));S=!1;k.showAlpha||(M=1);T()},D,da);ka?(K(ka),N(),ha=ya||tinycolor(ka).format,u(ka)):N();H&&Z();d=U?"mousedown.spectrum":"click.spectrum touchstart.spectrum";
Fa.delegate(".sp-thumb-el",d,a);Ga.delegate(".sp-thumb-el:nth-child(1)",d,{ignore:!0},a)})();var ta={show:Z,hide:L,toggle:Y,reflow:F,option:function(a,b){if(a===Da)return e.extend({},k);if(b===Da)return k[a];k[a]=b;n()},enable:function(){Aa=!1;w.attr("disabled",!1);ja.removeClass("sp-disabled")},disable:E,offset:function(a){k.offset=a;F()},set:function(a){K(a);C()},get:z,destroy:function(){w.show();ja.unbind("click.spectrum touchstart.spectrum");p.remove();ba.remove();R[ta.id]=null},container:p};
ta.id=R.push(ta)-1;return ta}function Oa(r,f){var n=r.outerWidth(),m=r.outerHeight(),u=f.outerHeight(),t=r[0].ownerDocument,q=t.documentElement,v=q.clientWidth+e(t).scrollLeft(),t=q.clientHeight+e(t).scrollTop(),q=f.offset();q.top+=u;q.left-=Math.min(q.left,q.left+n>v&&v>n?Math.abs(q.left+n-v):0);q.top-=Math.min(q.top,q.top+m>t&&t>m?Math.abs(m+u-0):0);return q}function A(){}function Sa(e){e.stopPropagation()}function E(e,f){var n=Array.prototype.slice,m=n.call(arguments,2);return function(){return e.apply(f,
m.concat(n.call(arguments)))}}function sa(r,f,n,m){function u(e){e.stopPropagation&&e.stopPropagation();e.preventDefault&&e.preventDefault();e.returnValue=!1}function t(e){if(D){if(U&&9>v.documentMode&&!e.button)return q();var n=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0],m=n&&n.pageY||e.pageY,n=Math.max(0,Math.min((n&&n.pageX||e.pageX)-A.left,Y)),m=Math.max(0,Math.min(m-A.top,E));Z&&u(e);f.apply(r,[n,m,e])}}function q(){D&&(e(v).unbind(G),e(v.body).removeClass("sp-dragging"),
setTimeout(function(){m.apply(r,arguments)},0));D=!1}f=f||function(){};n=n||function(){};m=m||function(){};var v=document,D=!1,A={},E=0,Y=0,Z="ontouchstart"in window,G={};G.selectstart=u;G.dragstart=u;G["touchmove mousemove"]=t;G["touchend mouseup"]=q;e(r).bind("touchstart mousedown",function(f){(f.which?3==f.which:2==f.button)||D||!1===n.apply(r,arguments)||(D=!0,E=e(r).height(),Y=e(r).width(),A=e(r).offset(),e(v).bind(G),e(v.body).addClass("sp-dragging"),t(f),u(f))})}function Pa(e,f,n){var m;return function(){var u=
this,t=arguments,q=function(){m=null;e.apply(u,t)};n&&clearTimeout(m);if(n||!m)m=setTimeout(q,f)}}var $={beforeShow:A,move:A,change:A,show:A,hide:A,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",
clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:["#ffffff #000000 #ff0000 #ff8000 #ffff00 #008000 #0000ff #4b0082 #9400d3".split(" ")],selectionPalette:[],disabled:!1,offset:null},R=[],U=!!/msie/i.exec(window.navigator.userAgent),Ea=function(){var e=document.createElement("div").style;e.cssText="background-color:rgba(0,0,0,.5)";return!!~(""+e.backgroundColor).indexOf("rgba")||
!!~(""+e.backgroundColor).indexOf("hsla")}(),Qa=function(){var e="";if(U)for(var f=1;6>=f;f++)e+="<div class='sp-"+f+"'></div>";return["<div class='sp-container sp-hidden'><div class='sp-palette-container'><div class='sp-palette sp-thumb sp-cf'></div><div class='sp-palette-button-container sp-cf'><button type='button' class='sp-palette-toggle'></button></div></div><div class='sp-picker-container'><div class='sp-top sp-cf'><div class='sp-fill'></div><div class='sp-top-inner'><div class='sp-color'><div class='sp-sat'><div class='sp-val'><div class='sp-dragger'></div></div></div></div><div class='sp-clear sp-clear-display'></div><div class='sp-hue'><div class='sp-slider'></div>",
e,"</div></div><div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div></div><div class='sp-input-container sp-cf'><input class='sp-input' type='text' spellcheck='false'  /></div><div class='sp-initial sp-thumb sp-cf'></div><div class='sp-button-container sp-cf'><a class='sp-cancel' href='#'></a><button type='button' class='sp-choose'></button></div></div></div>"].join("")}();e.fn.spectrum=function(r,f){if("string"==typeof r){var n=this,m=Array.prototype.slice.call(arguments,
1);this.each(function(){var f=R[e(this).data("spectrum.id")];if(f){var t=f[r];if(!t)throw Error("Spectrum: no such method: '"+r+"'");"get"==r?n=f.get():"container"==r?n=f.container:"option"==r?n=f.option.apply(f,m):"destroy"==r?(f.destroy(),e(this).removeData("spectrum.id")):t.apply(f,m)}});return n}return this.spectrum("destroy").each(function(){var f=e.extend({},r,e(this).data()),f=va(this,f);e(this).data("spectrum.id",f.id)})};e.fn.spectrum.load=!0;e.fn.spectrum.loadOpts={};e.fn.spectrum.draggable=
sa;e.fn.spectrum.defaults=$;e.fn.spectrum.inputTypeColorSupport=function f(){if("undefined"===typeof f._cachedResult){var n=e("<input type='color'/>")[0];f._cachedResult="color"===n.type&&""!==n.value}return f._cachedResult};e.spectrum={};e.spectrum.localization={};e.spectrum.palettes={};e.fn.spectrum.processNativeColorInputs=function(){var f=e("input[type=color]");f.length&&!e.fn.spectrum.inputTypeColorSupport()&&f.spectrum({preferredFormat:"hex6"})};(function(){function e(a,c,b){a=s(a,255);c=s(c,
255);b=s(b,255);var d=y(a,c,b),g=B(a,c,b),h,k=(d+g)/2;if(d==g)h=g=0;else{var f=d-g,g=.5<k?f/(2-d-g):f/(d+g);switch(d){case a:h=(c-b)/f+(c<b?6:0);break;case c:h=(b-a)/f+2;break;case b:h=(a-c)/f+4}h/=6}return{h:h,s:g,l:k}}function n(a,c,b){function d(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)*c:.5>c?b:c<2/3?a+(b-a)*(2/3-c)*6:a}a=s(a,360);c=s(c,100);b=s(b,100);if(0===c)b=c=a=b;else{var e=.5>b?b*(1+c):b+c-b*c,h=2*b-e;b=d(h,e,a+1/3);c=d(h,e,a);a=d(h,e,a-1/3)}return{r:255*b,g:255*c,b:255*a}}
function m(a,c,b){a=s(a,255);c=s(c,255);b=s(b,255);var d=y(a,c,b),e=B(a,c,b),h,g=d-e;if(d==e)h=0;else{switch(d){case a:h=(c-b)/g+(c<b?6:0);break;case c:h=(b-a)/g+2;break;case b:h=(a-c)/g+4}h/=6}return{h:h,s:0===d?0:g/d,v:d}}function u(a,c,b,d){a=[C(l(a).toString(16)),C(l(c).toString(16)),C(l(b).toString(16))];return d&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function t(a,c,b,d){return[C(Math.round(255*
parseFloat(d)).toString(16)),C(l(a).toString(16)),C(l(c).toString(16)),C(l(b).toString(16))].join("")}function q(a,c){c=0===c?0:c||10;var b=g(a).toHsl();b.s-=c/100;b.s=B(1,y(0,b.s));return g(b)}function v(a,c){c=0===c?0:c||10;var b=g(a).toHsl();b.s+=c/100;b.s=B(1,y(0,b.s));return g(b)}function A(a){return g(a).desaturate(100)}function E(a,c){c=0===c?0:c||10;var b=g(a).toHsl();b.l+=c/100;b.l=B(1,y(0,b.l));return g(b)}function R(a,c){c=0===c?0:c||10;var b=g(a).toRgb();b.r=y(0,B(255,b.r-l(255*-(c/100))));
b.g=y(0,B(255,b.g-l(255*-(c/100))));b.b=y(0,B(255,b.b-l(255*-(c/100))));return g(b)}function Y(a,c){c=0===c?0:c||10;var b=g(a).toHsl();b.l-=c/100;b.l=B(1,y(0,b.l));return g(b)}function Z(a,c){var b=g(a).toHsl(),d=(l(b.h)+c)%360;b.h=0>d?360+d:d;return g(b)}function G(a){a=g(a).toHsl();a.h=(a.h+180)%360;return g(a)}function U(a){var c=g(a).toHsl(),b=c.h;return[g(a),g({h:(b+120)%360,s:c.s,l:c.l}),g({h:(b+240)%360,s:c.s,l:c.l})]}function L(a){var c=g(a).toHsl(),b=c.h;return[g(a),g({h:(b+90)%360,s:c.s,
l:c.l}),g({h:(b+180)%360,s:c.s,l:c.l}),g({h:(b+270)%360,s:c.s,l:c.l})]}function K(a){var c=g(a).toHsl(),b=c.h;return[g(a),g({h:(b+72)%360,s:c.s,l:c.l}),g({h:(b+216)%360,s:c.s,l:c.l})]}function z(a,c,b){c=c||6;b=b||30;var d=g(a).toHsl();b=360/b;a=[g(a)];for(d.h=(d.h-(b*c>>1)+720)%360;--c;)d.h=(d.h+b)%360,a.push(g(d));return a}function T(a,c){c=c||6;for(var b=g(a).toHsv(),d=b.h,e=b.s,b=b.v,h=[],k=1/c;c--;)h.push(g({h:d,s:e,v:b})),b=(b+k)%1;return h}function N(a){a=parseFloat(a);if(isNaN(a)||0>a||1<
a)a=1;return a}function s(a,c){var b=a;"string"==typeof b&&-1!=b.indexOf(".")&&1===parseFloat(b)&&(a="100%");b="string"===typeof a&&-1!=a.indexOf("%");a=B(c,y(0,parseFloat(a)));b&&(a=parseInt(a*c,10)/100);return 1E-6>O.abs(a-c)?1:a%c/parseFloat(c)}function C(a){return 1==a.length?"0"+a:""+a}function F(a){1>=a&&(a=100*a+"%");return a}var $=/^[\s,#]+/,k=/\s+$/,H=0,O=Math,l=O.round,B=O.min,y=O.max,aa=O.random,g=function(a,c){var b,d,e,h,f;a=a?a:"";c=c||{};if(a instanceof g)return a;if(!(this instanceof
g))return new g(a,c);d=a;f={r:0,g:0,b:0};var q=1;e=b=!1;if("string"==typeof d)a:{d=d.replace($,"").replace(k,"").toLowerCase();var m=!1;if(X[d])d=X[d],m=!0;else if("transparent"==d){d={r:0,g:0,b:0,a:0,format:"name"};break a}d=(h=x.rgb.exec(d))?{r:h[1],g:h[2],b:h[3]}:(h=x.rgba.exec(d))?{r:h[1],g:h[2],b:h[3],a:h[4]}:(h=x.hsl.exec(d))?{h:h[1],s:h[2],l:h[3]}:(h=x.hsla.exec(d))?{h:h[1],s:h[2],l:h[3],a:h[4]}:(h=x.hsv.exec(d))?{h:h[1],s:h[2],v:h[3]}:(h=x.hsva.exec(d))?{h:h[1],s:h[2],v:h[3],a:h[4]}:(h=x.hex8.exec(d))?
{a:parseInt(h[1],16)/255,r:parseInt(h[2],16),g:parseInt(h[3],16),b:parseInt(h[4],16),format:m?"name":"hex8"}:(h=x.hex6.exec(d))?{r:parseInt(h[1],16),g:parseInt(h[2],16),b:parseInt(h[3],16),format:m?"name":"hex"}:(h=x.hex3.exec(d))?{r:parseInt(h[1]+""+h[1],16),g:parseInt(h[2]+""+h[2],16),b:parseInt(h[3]+""+h[3],16),format:m?"name":"hex"}:!1}if("object"==typeof d){if(d.hasOwnProperty("r")&&d.hasOwnProperty("g")&&d.hasOwnProperty("b"))f=d.g,b=d.b,f={r:255*s(d.r,255),g:255*s(f,255),b:255*s(b,255)},b=
!0,e="%"===String(d.r).substr(-1)?"prgb":"rgb";else if(d.hasOwnProperty("h")&&d.hasOwnProperty("s")&&d.hasOwnProperty("v")){d.s=F(d.s);d.v=F(d.v);e=d.h;m=d.s;f=d.v;e=6*s(e,360);m=s(m,100);f=s(f,100);b=O.floor(e);var t=e-b;e=f*(1-m);h=f*(1-t*m);m=f*(1-(1-t)*m);b%=6;f={r:255*[f,h,e,e,m,f][b],g:255*[m,f,f,h,e,e][b],b:255*[e,e,m,f,f,h][b]};b=!0;e="hsv"}else d.hasOwnProperty("h")&&d.hasOwnProperty("s")&&d.hasOwnProperty("l")&&(d.s=F(d.s),d.l=F(d.l),f=n(d.h,d.s,d.l),b=!0,e="hsl");d.hasOwnProperty("a")&&
(q=d.a)}q=N(q);d=d.format||e;e=B(255,y(f.r,0));h=B(255,y(f.g,0));f=B(255,y(f.b,0));this._originalInput=a;this._r=e;this._g=h;this._b=f;this._a=q;this._roundA=l(100*this._a)/100;this._format=c.format||d;this._gradientType=c.gradientType;1>this._r&&(this._r=l(this._r));1>this._g&&(this._g=l(this._g));1>this._b&&(this._b=l(this._b));this._ok=b;this._tc_id=H++};g.prototype={isDark:function(){return 128>this.getBrightness()},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},
getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var a=this.toRgb();return(299*a.r+587*a.g+114*a.b)/1E3},setAlpha:function(a){this._a=N(a);this._roundA=l(100*this._a)/100;return this},toHsv:function(){var a=m(this._r,this._g,this._b);return{h:360*a.h,s:a.s,v:a.v,a:this._a}},toHsvString:function(){var a=m(this._r,this._g,this._b),c=l(360*a.h),b=l(100*a.s),a=l(100*a.v);return 1==this._a?"hsv("+
c+", "+b+"%, "+a+"%)":"hsva("+c+", "+b+"%, "+a+"%, "+this._roundA+")"},toHsl:function(){var a=e(this._r,this._g,this._b);return{h:360*a.h,s:a.s,l:a.l,a:this._a}},toHslString:function(){var a=e(this._r,this._g,this._b),c=l(360*a.h),b=l(100*a.s),a=l(100*a.l);return 1==this._a?"hsl("+c+", "+b+"%, "+a+"%)":"hsla("+c+", "+b+"%, "+a+"%, "+this._roundA+")"},toHex:function(a){return u(this._r,this._g,this._b,a)},toHexString:function(a){return"#"+this.toHex(a)},toHex8:function(){return t(this._r,this._g,this._b,
this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:l(this._r),g:l(this._g),b:l(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+l(this._r)+", "+l(this._g)+", "+l(this._b)+")":"rgba("+l(this._r)+", "+l(this._g)+", "+l(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:l(100*s(this._r,255))+"%",g:l(100*s(this._g,255))+"%",b:l(100*s(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+l(100*s(this._r,
255))+"%, "+l(100*s(this._g,255))+"%, "+l(100*s(this._b,255))+"%)":"rgba("+l(100*s(this._r,255))+"%, "+l(100*s(this._g,255))+"%, "+l(100*s(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":1>this._a?!1:P[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(a){var c="#"+t(this._r,this._g,this._b,this._a),b=c,d=this._gradientType?"GradientType = 1, ":"";a&&(b=g(a).toHex8String());return"progid:DXImageTransform.Microsoft.gradient("+d+"startColorstr="+c+",endColorstr="+
b+")"},toString:function(a){var c=!!a;a=a||this._format;var b=!1,d=1>this._a&&0<=this._a;if(!c&&d&&("hex"===a||"hex6"===a||"hex3"===a||"name"===a))return"name"===a&&0===this._a?this.toName():this.toRgbString();"rgb"===a&&(b=this.toRgbString());"prgb"===a&&(b=this.toPercentageRgbString());if("hex"===a||"hex6"===a)b=this.toHexString();"hex3"===a&&(b=this.toHexString(!0));"hex8"===a&&(b=this.toHex8String());"name"===a&&(b=this.toName());"hsl"===a&&(b=this.toHslString());"hsv"===a&&(b=this.toHsvString());
return b||this.toHexString()},_applyModification:function(a,c){var b=a.apply(null,[this].concat([].slice.call(c)));this._r=b._r;this._g=b._g;this._b=b._b;this.setAlpha(b._a);return this},lighten:function(){return this._applyModification(E,arguments)},brighten:function(){return this._applyModification(R,arguments)},darken:function(){return this._applyModification(Y,arguments)},desaturate:function(){return this._applyModification(q,arguments)},saturate:function(){return this._applyModification(v,arguments)},
greyscale:function(){return this._applyModification(A,arguments)},spin:function(){return this._applyModification(Z,arguments)},_applyCombination:function(a,c){return a.apply(null,[this].concat([].slice.call(c)))},analogous:function(){return this._applyCombination(z,arguments)},complement:function(){return this._applyCombination(G,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(K,arguments)},triad:function(){return this._applyCombination(U,
arguments)},tetrad:function(){return this._applyCombination(L,arguments)}};g.fromRatio=function(a,c){if("object"==typeof a){var b={},d;for(d in a)a.hasOwnProperty(d)&&(b[d]="a"===d?a[d]:F(a[d]));a=b}return g(a,c)};g.equals=function(a,c){return a&&c?g(a).toRgbString()==g(c).toRgbString():!1};g.random=function(){return g.fromRatio({r:aa(),g:aa(),b:aa()})};g.mix=function(a,c,b){b=0===b?0:b||50;a=g(a).toRgb();c=g(c).toRgb();b/=100;var d=2*b-1,e=c.a-a.a,d=((-1==d*e?d:(d+e)/(1+d*e))+1)/2,e=1-d;return g({r:c.r*
d+a.r*e,g:c.g*d+a.g*e,b:c.b*d+a.b*e,a:c.a*b+a.a*(1-b)})};g.readability=function(a,c){var b=g(a),d=g(c),e=b.toRgb(),h=d.toRgb(),b=b.getBrightness(),d=d.getBrightness(),e=Math.max(e.r,h.r)-Math.min(e.r,h.r)+Math.max(e.g,h.g)-Math.min(e.g,h.g)+Math.max(e.b,h.b)-Math.min(e.b,h.b);return{brightness:Math.abs(b-d),color:e}};g.isReadable=function(a,c){var b=g.readability(a,c);return 125<b.brightness&&500<b.color};g.mostReadable=function(a,c){for(var b=null,d=0,e=!1,h=0;h<c.length;h++){var f=g.readability(a,
c[h]),k=125<f.brightness&&500<f.color,f=f.brightness/125*3+f.color/500;if(k&&!e||k&&e&&f>d||!k&&!e&&f>d)e=k,d=f,b=g(c[h])}return b};var X=g.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",
crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",
firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",
lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",
mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",
sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},P=g.hexNames=function(a){var c={},b;for(b in a)a.hasOwnProperty(b)&&(c[a[b]]=b);return c}(X),x={rgb:/rgb[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,
rgba:/rgba[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,hsl:/hsl[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,hsla:/hsla[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,
hsv:/hsv[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,hsva:/hsva[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};
window.tinycolor=g})();e(function(){e.fn.spectrum.load&&e.fn.spectrum.processNativeColorInputs()})});
