WordPress.org

Make WordPress Core

Ticket #22475: 22475.diff

File 22475.diff, 40.7 KB (added by lessbloat, 3 years ago)
  • wp-admin/js/iris.min.js

     
    11/*! Iris - v0.9.10 - 2012-11-07 
    22* https://github.com/Automattic/Iris 
    33* Copyright (c) 2012 Matt Wiebe; Licensed GPL */ 
    4 (function(e,t){function u(){if(r)i="filter";else{var t=e('<div id="iris-gradtest" />'),n="linear-gradient(top,#fff,#000)";e.each(s,function(e,r){t.css("backgroundImage",r+n);if(t.css("backgroundImage").match("gradient"))return i=e,!1}),e.browser.webkit&&i===!1&&(t.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"),t.css("backgroundImage").match("gradient")&&(i="webkit")),t.remove()}}function a(t,n){return t=t==="top"?"top":"left",n=e.isArray(n)?n:Array.prototype.slice.call(arguments,1),i==="webkit"?l(t,n):s[i]+"linear-gradient("+t+", "+n.join(", ")+")"}function f(t,n){t=t==="top"?"top":"left",n=e.isArray(n)?n:Array.prototype.slice.call(arguments,1);var r=t==="top"?0:1,i=e(this),s=n.length-1,o=parseInt(e.browser.version,10)>=8?"-ms-filter":"filter";o="filter";var u=r===1?"left":"top",a=r===1?"right":"bottom",f=r===1?"height":"width",l='<div class="iris-ie-gradient-shim" style="position:absolute;'+f+":100%;"+u+":%start%;"+a+":%end%;"+o+':%filter%;" data-color:"%color%"></div>',h="";i.css("position")==="static"&&i.css({position:"relative"}),n=c(n),e.each(n,function(e,t){if(e===s)return!1;var i=n[e+1];if(t.stop===i.stop)return;var o=100-parseFloat(i.stop)+"%";t.octoHex=(new Color(t.color)).toIEOctoHex(),i.octoHex=(new Color(i.color)).toIEOctoHex();var u="progid:DXImageTransform.Microsoft.Gradient(GradientType="+r+", StartColorStr='"+t.octoHex+"', EndColorStr='"+i.octoHex+"')";h+=l.replace("%start%",t.stop).replace("%end%",o).replace("%filter%",u)}),i.find(".iris-ie-gradient-shim").remove(),e(h).prependTo(i)}function l(t,n){var r=[];return t=t==="top"?"0% 0%,0% 100%,":"0% 100%,100% 100%,",n=c(n),e.each(n,function(e,t){r.push("color-stop("+parseFloat(t.stop)/100+", "+t.color+")")}),"-webkit-gradient(linear,"+t+r.join(",")+")"}function c(t){var n=[],r=[],i=[],s=t.length-1;return e.each(t,function(e,t){var i=t,s=!1,o=t.match(/1?[0-9]{1,2}%$/);o&&(i=t.replace(/\s?1?[0-9]{1,2}%$/,""),s=o.shift()),n.push(i),r.push(s)}),r[0]===!1&&(r[0]="0%"),r[s]===!1&&(r[s]="100%"),r=h(r),e.each(r,function(e){i[e]={color:n[e],stop:r[e]}}),i}function h(t){var n=0,r=t.length-1,i=0,s=!1,o,u,a,f;if(t.length<=2||e.inArray(!1,t)<0)return t;while(i<t.length-1)!s&&t[i]===!1?(n=i-1,s=!0):s&&t[i]!==!1&&(r=i,i=t.length),i++;u=r-n,f=parseInt(t[n].replace("%"),10),o=(parseFloat(t[r].replace("%"))-f)/u,i=n+1,a=1;while(i<r)t[i]=f+a*o+"%",a++,i++;return h(t)}var n='<div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="#"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div>',r=!!(e.browser.msie&&parseInt(e.browser.version,10)<10),i=!1,s=["-moz-","-webkit-","-o-","-ms-"],o='.iris-picker{display:block;position:relative}.iris-error{background-color:#ffafaf}.iris-border{border-radius:3px;border:1px solid #aaa;width:200px;background-color:#fff}.iris-picker-inner{position:absolute;top:0;right:0;left:0;bottom:0}.iris-border .iris-picker-inner{top:10px;right:10px;left:10px;bottom:10px}.iris-picker .iris-square-inner{position:absolute;left:0;right:0;top:0;bottom:0}.iris-picker .iris-square,.iris-picker .iris-slider,.iris-picker .iris-square-inner,.iris-picker .iris-palette{border-radius:3px;-webkit-box-shadow:inset 0 0 5px rgba(0,0,0,0.4);-moz-box-shadow:inset 0 0 5px rgba(0,0,0,0.4);box-shadow:inset 0 0 5px rgba(0,0,0,0.4);height:100%;width:12.5%;float:left;margin-right:5%}.iris-picker .iris-square{width:76%;margin-right:10%;position:relative}.iris-picker .iris-square-inner{width:auto;margin:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-square-inner,.iris-ie-9 .iris-palette{box-shadow:none;border-radius:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-palette{outline:1px solid rgba(0,0,0,.1)}.iris-ie-lt9 .iris-square,.iris-ie-lt9 .iris-slider,.iris-ie-lt9 .iris-square-inner,.iris-ie-lt9 .iris-palette{outline:1px solid #aaa}.iris-ie-lt9 .iris-square .ui-slider-handle{outline:1px solid #aaa;background-color:#fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"}.iris-ie-lt9 .iris-square .iris-square-handle{background:none;border:3px solid #fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"}.iris-picker .iris-strip{margin-right:0;position:relative}.iris-picker .iris-strip .ui-slider-handle{position:absolute;background:none;right:-3px;left:-3px;border:4px solid #aaa;border-width:4px 3px;width:auto;height:6px;border-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.2);opacity:.9;z-index:5}.iris-strip .ui-slider-handle:before{content:" ";position:absolute;left:-2px;right:-2px;top:-3px;bottom:-3px;border:2px solid #fff;-webkit-border-radius:3px;border-radius:3px}.iris-picker .iris-slider-offset{position:absolute;top:11px;left:0;right:0;bottom:-3px}.iris-picker .iris-square-handle{background:transparent;border:5px solid #aaa;-webkit-border-radius:6px;-moz-border-radius:50%;border-radius:50%;border-color:rgba(128,128,128,.5);box-shadow:none;width:12px;height:12px;position:absolute;left:-10px;top:-10px;cursor:move;opacity:1;z-index:10}.iris-picker .ui-state-focus .iris-square-handle{opacity:.8}.iris-picker .iris-square-handle:hover{border-color:#999}.iris-picker .iris-square-handle:hover::after{border-color:#fff}.iris-picker .iris-square-handle::after{position:absolute;bottom:-4px;right:-4px;left:-4px;top:-4px;border:3px solid #f9f9f9;border-color:rgba(255,255,255,.8);border-radius:50%;content:" "}.iris-picker .iris-square-value{width:8px;height:8px;position:absolute}.iris-ie-lt9 .iris-square-value,.iris-mozilla .iris-square-value{width:1px;height:1px}.iris-palette-container{position:absolute;bottom:0;left:0;margin:0;padding:0}.iris-border .iris-palette-container{left:10px;bottom:10px}.iris-picker .iris-palette{margin:0;list-style-type:none;cursor:pointer}';if(r&&parseInt(e.browser.version,10)<=7)return e.fn.iris=e.noop;e.fn.gradient=function(t){var n=arguments;return this.each(function(){r?f.apply(this,n):e(this).css("backgroundImage",a.apply(this,n))})},e.fn.raninbowGradient=function(t,n){t=t||"top";var r=e.extend({},{s:100,l:50},n),i="hsl(%h%,"+r.s+"%,"+r.l+"%)",s=0,o=[];while(s<=360)o.push(i.replace("%h%",s)),s+=30;return this.each(function(){e(this).gradient(t,o)})};var p={options:{color:!1,mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"},hide:!0,border:!0,target:!1,width:200,palettes:!1},_palettes:["#000","#fff","#d33","#d93","#ee2","#81d742","#1e73be","#8224e3"],_inited:!1,_scale:{h:360,s:100,l:100,v:100},_create:function(){var t=this,r=t.element,s=t.options.color||r.val(),o;i===!1&&u(),r.is("input")?(t.options.target?t.picker=e(n).appendTo(t.options.target):t.picker=e(n).insertAfter(r),t._addInputListeners(r)):(r.append(n),t.picker=r.find(".iris-picker"));if(e.browser.mozilla)t.picker.addClass("iris-mozilla");else if(e.browser.msie){var a=parseInt(e.browser.version,10);a===9?t.picker.addClass("iris-ie-9"):a<=8&&t.picker.addClass("iris-ie-lt9")}t.options.palettes&&t._addPalettes(),t.color=(new Color(s)).setHSpace(t.options.mode),t.options.color=t.color.toString(),t.controls={square:t.picker.find(".iris-square"),squareDrag:t.picker.find(".iris-square-value"),horiz:t.picker.find(".iris-square-horiz"),vert:t.picker.find(".iris-square-vert"),strip:t.picker.find(".iris-strip"),stripSlider:t.picker.find(".iris-strip .iris-slider-offset")},t.options.mode==="hsv"&&t.options.controls.vert==="l"&&(t.options.controls={horiz:"h",vert:"v",strip:"s"}),t.hue=t.color.h(),t.options.hide&&t.picker.hide(),t.options.border&&t.picker.addClass("iris-border"),t._initControls(),t.active="external",t._dimensions(),t._change()},_addPalettes:function(){var t=e("<ul class='iris-palette-container' />"),n=e("<li class='iris-palette' />"),r=e.isArray(this.options.palettes)?this.options.palettes:this._palettes;e.each(r,function(e,r){n.clone().data("color",r).css("backgroundColor",r).appendTo(t).height(10).width(10)}),this.picker.append(t)},_paint:function(){var e=this;e._paintDimension("top","strip"),e._paintDimension("top","vert"),e._paintDimension("left","horiz")},_paintDimension:function(e,t){var n=this,r=n.color,i=n.options.mode,s=n._getHSpaceColor(),o=n.controls[t],u=n.options.controls,a;if(t===n.active||n.active==="square"&&t!=="strip")return;switch(u[t]){case"h":if(i==="hsv"){s=r.clone();switch(t){case"horiz":s[u.vert](100);break;case"vert":s[u.horiz](100);break;case"strip":s.setHSpace("hsl")}a=s.toHsl()}else t==="strip"?a={s:s.s,l:s.l}:a={s:100,l:s.l};o.raninbowGradient(e,a);break;case"s":i==="hsv"?t==="vert"?a=[r.clone().a(0).s(0).toCSS("rgba"),r.clone().a(1).s(0).toCSS("rgba")]:t==="strip"?a=[r.clone().s(100).toCSS("hsl"),r.clone().s(0).toCSS("hsl")]:t==="horiz"&&(a=["#fff","hsl("+s.h+",100%,50%)"]):t==="vert"&&n.options.controls.horiz==="h"?a=["hsla(0, 0%, "+s.l+"%, 0)","hsla(0, 0%, "+s.l+"%, 1)"]:a=["hsl("+s.h+",0%,50%)","hsl("+s.h+",100%,50%)"],o.gradient(e,a);break;case"l":t==="strip"?a=["hsl("+s.h+",100%,100%)","hsl("+s.h+", "+s.s+"%,50%)","hsl("+s.h+",100%,0%)"]:a=["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"],o.gradient(e,a);break;case"v":t==="strip"?a=[r.clone().v(100).toCSS(),r.clone().v(0).toCSS()]:a=["rgba(0,0,0,0)","#000"],o.gradient(e,a);break;default:}},_getHSpaceColor:function(){return this.options.mode==="hsv"?this.color.toHsv():this.color.toHsl()},_dimensions:function(t){var n=this,r=n.options,i=n.picker.find(".iris-picker-inner"),s=n.controls,o=s.square,u=n.picker.find(".iris-strip"),a="77.5%",f="12%",l=20,c=r.border?r.width-l:r.width,h,p=e.isArray(r.palettes)?r.palettes.length:n._palettes.length,d,v,m;t&&(o.css("width",""),u.css("width",""),n.picker.removeAttr("style")),a=c*(parseFloat(a)/100),f=c*(parseFloat(f)/100),h=r.border?a+l:a,o.width(a).height(a),u.height(a).width(f),n.picker.css({width:r.width,height:h});if(!r.palettes)return;d=a*2/100,m=a-(p-1)*d,v=m/p,n.picker.find(".iris-palette").each(function(t,n){var r=t===0?0:d;e(this).css({width:v,height:v,marginLeft:r})}),n.picker.css("paddingBottom",v+d),u.height(v+d+a)},_addInputListeners:function(e){var t=this;e.on("change",function(n){var r=new Color(e.val()),i=e.val().replace(/^#/,"");e.removeClass("iris-error"),r.error?i!==""&&e.addClass("iris-error"):t._setOption("color",r.toString())})},_initControls:function(){var t=this,n=t.controls,r=n.square,i=t.options.controls,s=t._scale[i.strip];n.stripSlider.slider({orientation:"vertical",max:s,slide:function(e,n){t.active="strip",i.strip==="h"&&(n.value=s-n.value),t.color[i.strip](n.value),t._change.apply(t,arguments)}}),n.squareDrag.draggable({containment:"parent",zIndex:1e3,cursor:"move",drag:function(e,n){t._squareDrag(e,n)},start:function(){r.addClass("iris-dragging"),e(this).addClass("ui-state-focus")},stop:function(){r.removeClass("iris-dragging"),e(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(n){n.preventDefault();var r="ui-state-focus";n.type==="mousedown"?(t.picker.find("."+r).removeClass(r).blur(),e(this).addClass(r)):e(this).removeClass("ui-state-focus")}),r.mousedown(function(n){if(n.which!==1)return;if(!e(n.target).is("div"))return;var r=t.controls.square.offset(),i={top:n.pageY-r.top,left:n.pageX-r.left};n.preventDefault(),t._squareDrag(n,{position:i}),n.target=t.controls.squareDrag.get(0),t.controls.squareDrag.css(i).trigger(n)}),t.options.palettes&&t.picker.find(".iris-palette-container").on("click",".iris-palette",function(n){t.color.fromCSS(e(this).data("color")),t.active="external",t._change()})},_squareDrag:function(e,t){var n=this,r=n.options.controls,i=n._squareDimensions(),s=Math.round((i.h-t.position.top)/i.h*n._scale[r.vert]),o=n._scale[r.horiz]-Math.round((i.w-t.position.left)/i.w*n._scale[r.horiz]);n.color[r.horiz](o)[r.vert](s),n.active="square",n._change.apply(n,arguments)},_setOption:function(e,t){var n=this.options[e];if(e==="color"){t=""+t;var r=t.replace(/^#/,""),i=(new Color(t)).setHSpace(this.options.mode);i.error||(this.color=i,this.options.color=this.options[e]=this.color.toString(),this.active="external",this._change())}},_squareDimensions:function(e){var n=this.controls.square,r,i;return e!==t&&n.data("dimensions")?n.data("dimensions"):(i=this.controls.squareDrag,r={w:n.width(),h:n.height()},n.data("dimensions",r),r)},_isNonHueControl:function(e,t){return e==="square"&&this.options.controls.strip==="h"?!0:t==="external"||t==="h"&&e==="strip"?!1:!0},_change:function(t,n){var r=this,i=r.controls,s=r._getHSpaceColor(),o=r.color.toString(),u=["square","strip"],a=r.options.controls,f=a[r.active]||"external",l=r.hue;r.active==="strip"?u=[]:r.active!=="external"&&u.pop(),e.each(u,function(e,t){var n;if(t!==r.active)switch(t){case"strip":n=a.strip==="h"?r._scale[a.strip]-s[a.strip]:s[a.strip],i.stripSlider.slider("value",n);break;case"square":var o=r._squareDimensions(),u={left:s[a.horiz]/r._scale[a.horiz]*o.w,top:o.h-s[a.vert]/r._scale[a.vert]*o.h};r.controls.squareDrag.css(u)}}),s.h!==l&&r._isNonHueControl(r.active,f)&&r.color.h(l),r.hue=r.color.h(),r.options.color=r.color.toString(),r._inited&&r._trigger("change",{type:r.active},{color:r.color}),r.element.is(":input")&&!r.color.error&&r.element.val(r.color.toString()).removeClass("iris-error"),r._paint(),r._inited=!0,r.active=!1},show:function(){this.picker.show()},hide:function(){this.picker.hide()},toggle:function(){this.picker.toggle()}};e.widget("a8c.iris",p),e('<style id="iris-css">'+o+"</style>").appendTo("head")})(jQuery),function(e,t){var n=function(e,t){return this instanceof n?this._init(e,t):new n(e,t)};n.fn=n.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(e){var n="noop";switch(typeof e){case"object":return e.a!==t&&this.a(e.a),n=e.r!==t?"fromRgb":e.l!==t?"fromHsl":e.v!==t?"fromHsv":n,this[n](e);case"string":return this.fromCSS(e);case"number":return this.fromInt(parseInt(e,10))}return this},clone:function(){var e=new n(this.toInt()),t=["_alpha","_hSpace","_hsl","_hsv","error"];for(var r=t.length-1;r>=0;r--)e[t[r]]=this[t[r]];return e},setHSpace:function(e){return this._hSpace=e==="hsv"?"hsv":"hsl",this},noop:function(){return this},fromCSS:function(e){var t,n;return this.error=!1,e.match(/^(rgb|hsl)a?/)?(n=e.replace(/(\s|%)/g,"").replace(/^(rgb|hsl)a?\(/,"").replace(/\);?$/,"").split(","),n.length===4&&this.a(parseFloat(n.pop())),e.match(/^rgb/)?this.fromRgb({r:parseInt(n[0],10),g:parseInt(n[1],10),b:parseInt(n[2],10)}):this.fromHsl({h:parseInt(n[0],10),s:parseInt(n[1],10),l:parseInt(n[2],10)})):this.fromHex(e)},fromRgb:function(e,n){return typeof e!="object"||e.r===t||e.g===t||e.b===t?(this.error=!0,this):(this.error=!1,this.fromInt(parseInt((e.r<<16)+(e.g<<8)+e.b,10),n))},fromHex:function(e){return e=e.replace(/^#/,"").replace(/^0x/,""),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),this.error=!/^[0-9A-F]{6}$/i.test(e),this.fromInt(parseInt(e,16))},fromHsl:function(e){var n,r,i,s,o,u,a,f;return typeof e!="object"||e.h===t||e.s===t||e.l===t?(this.error=!0,this):(this._hsl=e,this._hSpace="hsl",u=e.h/360,a=e.s/100,f=e.l/100,a===0?n=r=i=f:(s=f<.5?f*(1+a):f+a-f*a,o=2*f-s,n=this.hue2rgb(o,s,u+1/3),r=this.hue2rgb(o,s,u),i=this.hue2rgb(o,s,u-1/3)),this.fromRgb({r:n*255,g:r*255,b:i*255},!0))},fromHsv:function(e){var n,r,i,s,o,u,a,f,l,c,h;if(typeof e!="object"||e.h===t||e.s===t||e.v===t)return this.error=!0,this;this._hsv=e,this._hSpace="hsv",n=e.h/360,r=e.s/100,i=e.v/100,a=Math.floor(n*6),f=n*6-a,l=i*(1-r),c=i*(1-f*r),h=i*(1-(1-f)*r);switch(a%6){case 0:s=i,o=h,u=l;break;case 1:s=c,o=i,u=l;break;case 2:s=l,o=i,u=h;break;case 3:s=l,o=c,u=i;break;case 4:s=h,o=l,u=i;break;case 5:s=i,o=l,u=c}return this.fromRgb({r:s*255,g:o*255,b:u*255},!0)},fromInt:function(e,n){return this._color=parseInt(e,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),n===t&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},toString:function(){var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e},toCSS:function(e,t){e=e||"hex",t=parseFloat(t||this._alpha);switch(e){case"rgb":case"rgba":var n=this.toRgb();return t<1?"rgba( "+n.r+", "+n.g+", "+n.b+", "+t+" )":"rgb( "+n.r+", "+n.g+", "+n.b+" )";case"hsl":case"hsla":var r=this.toHsl();return t<1?"hsla( "+r.h+", "+r.s+"%, "+r.l+"%, "+t+" )":"hsl( "+r.h+", "+r.s+"%, "+r.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),s=Math.min(t,n,r),o,u,a=(i+s)/2;if(i===s)o=u=0;else{var f=i-s;u=a>.5?f/(2-i-s):f/(i+s);switch(i){case t:o=(n-r)/f+(n<r?6:0);break;case n:o=(r-t)/f+2;break;case r:o=(t-n)/f+4}o/=6}return o=Math.round(o*360),o===0&&this._hsl.h!==o&&(o=this._hsl.h),u=Math.round(u*100),u===0&&this._hsl.s&&(u=this._hsl.s),{h:o,s:u,l:Math.round(a*100)}},toHsv:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),s=Math.min(t,n,r),o,u,a=i,f=i-s;u=i===0?0:f/i;if(i===s)o=u=0;else{switch(i){case t:o=(n-r)/f+(n<r?6:0);break;case n:o=(r-t)/f+2;break;case r:o=(t-n)/f+4}o/=6}return o=Math.round(o*360),o===0&&this._hsv.h!==o&&(o=this._hsv.h),u=Math.round(u*100),u===0&&this._hsv.s&&(u=this._hsv.s),{h:o,s:u,v:Math.round(a*100)}},toInt:function(){return this._color},toIEOctoHex:function(){var e=this.toString(),t=parseInt(255*this._alpha,10).toString(16);return t.length===1&&(t="0"+t),"#"+t+e.replace(/^#/,"")},toLuminosity:function(){var e=this.toRgb();return.2126*Math.pow(e.r/255,2.2)+.7152*Math.pow(e.g/255,2.2)+.0722*Math.pow(e.b/255,2.2)},getDistanceLuminosityFrom:function(e){if(e instanceof n){var t=this.toLuminosity(),r=e.toLuminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)}throw"getDistanceLuminosityFrom requires a Color object"},getMaxContrastColor:function(){var e=this.toLuminosity(),t=e>=.5?"000000":"ffffff";return new n(t)},getGrayscaleContrastingColor:function(e){if(!e)return this.getMaxContrastColor();var t=e<5?5:e,n=this.getMaxContrastColor();e=n.getDistanceLuminosityFrom(this);if(e<=t)return n;var r=0===n.toInt()?1:-1;while(e>t)n=n.incrementLightness(r),e=n.getDistanceLuminosityFrom(this);return n},getReadableContrastingColor:function(e,r){if(!e instanceof n)return this;var i=r===t?5:r,s=e.getDistanceLuminosityFrom(this),o=e.getMaxContrastColor(),u=o.getDistanceLuminosityFrom(e);if(u<=i)return o;if(s>=i)return this;var a=0===o.toInt()?-1:1;while(s<i){this.incrementLightness(a),s=this.getDistanceLuminosityFrom(e);if(this._color===0||this._color===16777215)break}return this},a:function(e){return e===t?this._alpha:(this._alpha=parseFloat(e),this)},darken:function(e){return e=e||5,this.l(-e,!0)},lighten:function(e){return e=e||5,this.l(e,!0)},saturate:function(e){return e=e||15,this.s(e,!0)},desaturate:function(e){return e=e||15,this.s(-e,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)},getComplement:function(){return this.h(180,!0)},getSplitComplement:function(e){e=e||1;var t=180+e*30;return this.h(t,!0)},getAnalog:function(e){e=e||1;var t=e*30;return this.h(t,!0)},getTetrad:function(e){e=e||1;var t=e*60;return this.h(t,!0)},getTriad:function(e){e=e||1;var t=e*120;return this.h(t,!0)},_partial:function(e){var n=r[e];return function(r,i){var s=this._spaceFunc("to",n.space);return r===t?s[e]:(i===!0&&(r=s[e]+r),n.mod&&(r%=n.mod),n.range&&(r=r<n.range[0]?n.range[0]:r>n.range[1]?n.range[1]:r),s[e]=r,this._spaceFunc("from",n.space,s))}},_spaceFunc:function(e,t,n){var r=t||this._hSpace,i=e+r.charAt(0).toUpperCase()+r.substr(1);return this[i](n)}};var r={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var i in r)r.hasOwnProperty(i)&&(n.fn[i]=n.fn._partial(i));e.Color=n}(typeof exports=="object"&&exports||this); 
    5  No newline at end of file 
     4(function(d,i){function k(a,f){var a="top"===a?"top":"left",f=d.isArray(f)?f:Array.prototype.slice.call(arguments,1),c;if("webkit"===b){var h=a,e=f,n=[];c=(h="top"===h?"0% 0%,0% 100%,":"0% 100%,100% 100%,",e=p(e),d.each(e,function(a,g){n.push("color-stop("+parseFloat(g.stop)/100+", "+g.color+")")}),"-webkit-gradient(linear,"+h+n.join(",")+")")}else c=j[b]+"linear-gradient("+a+", "+f.join(", ")+")";return c}function q(a,f){var a="top"===a?"top":"left",f=d.isArray(f)?f:Array.prototype.slice.call(arguments, 
     51),c="top"===a?0:1,b=d(this),e=f.length-1;parseInt(d.browser.version,10);var n='<div class="iris-ie-gradient-shim" style="position:absolute;'+(1===c?"height":"width")+":100%;"+(1===c?"left":"top")+":%start%;"+(1===c?"right":"bottom")+':%end%;filter:%filter%;" data-color:"%color%"></div>',l="";"static"===b.css("position")&&b.css({position:"relative"});f=p(f);d.each(f,function(a,g){if(a===e)return!1;var b=f[a+1];if(g.stop!==b.stop){var h=100-parseFloat(b.stop)+"%";g.octoHex=(new Color(g.color)).toIEOctoHex(); 
     6b.octoHex=(new Color(b.color)).toIEOctoHex();b="progid:DXImageTransform.Microsoft.Gradient(GradientType="+c+", StartColorStr='"+g.octoHex+"', EndColorStr='"+b.octoHex+"')";l+=n.replace("%start%",g.stop).replace("%end%",h).replace("%filter%",b)}});b.find(".iris-ie-gradient-shim").remove();d(l).prependTo(b)}function p(g){var f=[],c=[],b=[],e=g.length-1;return d.each(g,function(a,g){var b=g,e=!1,h=g.match(/1?[0-9]{1,2}%$/);h&&(b=g.replace(/\s?1?[0-9]{1,2}%$/,""),e=h.shift());f.push(b);c.push(e)}),!1=== 
     7c[0]&&(c[0]="0%"),!1===c[e]&&(c[e]="100%"),c=a(c),d.each(c,function(a){b[a]={color:f[a],stop:c[a]}}),b}function a(g){var f=0,c=g.length-1,b=0,e=!1,n;if(2>=g.length||0>d.inArray(!1,g))return g;for(;b<g.length-1;)!e&&!1===g[b]?(f=b-1,e=!0):e&&!1!==g[b]&&(c=b,b=g.length),b++;b=c-f;e=parseInt(g[f].replace("%"),10);n=(parseFloat(g[c].replace("%"))-e)/b;b=f+1;for(f=1;b<c;)g[b]=e+f*n+"%",f++,b++;return a(g)}var c=!!(d.browser.msie&&10>parseInt(d.browser.version,10)),b=!1,j=["-moz-","-webkit-","-o-","-ms-"]; 
     8if(c&&7>=parseInt(d.browser.version,10))return d.fn.iris=d.noop;d.fn.gradient=function(a){var b=arguments;return this.each(function(){c?q.apply(this,b):d(this).css("backgroundImage",k.apply(this,b))})};d.fn.raninbowGradient=function(a,b){for(var a=a||"top",c=d.extend({},{s:100,l:50},b),c="hsl(%h%,"+c.s+"%,"+c.l+"%)",h=0,e=[];360>=h;)e.push(c.replace("%h%",h)),h+=30;return this.each(function(){d(this).gradient(a,e)})};d.widget("a8c.iris",{options:{color:!1,mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"}, 
     9hide:!0,border:!0,target:!1,width:200,palettes:!1},_palettes:"#000 #fff #d33 #d93 #ee2 #81d742 #1e73be #8224e3".split(" "),_inited:!1,_scale:{h:360,s:100,l:100,v:100},_create:function(){var a=this.element,f=this.options.color||a.val();if(!1===b)if(c)b="filter";else{var m=d('<div id="iris-gradtest" />');d.each(j,function(a,g){m.css("backgroundImage",g+"linear-gradient(top,#fff,#000)");if(m.css("backgroundImage").match("gradient"))return b=a,!1});d.browser.webkit&&!1===b&&(m.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"), 
     10m.css("backgroundImage").match("gradient")&&(b="webkit"));m.remove()}a.is("input")?(this.options.target?this.picker=d('<div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="#"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div>').appendTo(this.options.target): 
     11this.picker=d('<div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="#"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div>').insertAfter(a),this._addInputListeners(a)):(a.append('<div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="#"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div>'), 
     12this.picker=a.find(".iris-picker"));d.browser.mozilla?this.picker.addClass("iris-mozilla"):d.browser.msie&&(a=parseInt(d.browser.version,10),9===a?this.picker.addClass("iris-ie-9"):8>=a&&this.picker.addClass("iris-ie-lt9"));this.options.palettes&&this._addPalettes();this.color=(new Color(f)).setHSpace(this.options.mode);this.options.color=this.color.toString();this.controls={square:this.picker.find(".iris-square"),squareDrag:this.picker.find(".iris-square-value"),horiz:this.picker.find(".iris-square-horiz"), 
     13vert:this.picker.find(".iris-square-vert"),strip:this.picker.find(".iris-strip"),stripSlider:this.picker.find(".iris-strip .iris-slider-offset")};"hsv"===this.options.mode&&"l"===this.options.controls.vert&&(this.options.controls={horiz:"h",vert:"v",strip:"s"});this.hue=this.color.h();this.options.hide&&this.picker.hide();this.options.border&&this.picker.addClass("iris-border");this._initControls();this.active="external";this._dimensions();this._change()},_addPalettes:function(){var a=d("<ul class='iris-palette-container' />"), 
     14b=d("<li class='iris-palette' />"),c=d.isArray(this.options.palettes)?this.options.palettes:this._palettes;d.each(c,function(c,e){b.clone().data("color",e).css("backgroundColor",e).appendTo(a).height(10).width(10)});this.picker.append(a)},_paint:function(){this._paintDimension("top","strip");this._paintDimension("top","vert");this._paintDimension("left","horiz")},_paintDimension:function(a,c){var b=this.color,h=this.options.mode,e=this._getHSpaceColor(),d=this.controls[c],l=this.options.controls, 
     15j;if(!(c===this.active||"square"===this.active&&"strip"!==c))switch(l[c]){case "h":if("hsv"===h){e=b.clone();switch(c){case "horiz":e[l.vert](100);break;case "vert":e[l.horiz](100);break;case "strip":e.setHSpace("hsl")}j=e.toHsl()}else"strip"===c?j={s:e.s,l:e.l}:j={s:100,l:e.l};d.raninbowGradient(a,j);break;case "s":"hsv"===h?"vert"===c?j=[b.clone().a(0).s(0).toCSS("rgba"),b.clone().a(1).s(0).toCSS("rgba")]:"strip"===c?j=[b.clone().s(100).toCSS("hsl"),b.clone().s(0).toCSS("hsl")]:"horiz"===c&&(j= 
     16["#fff","hsl("+e.h+",100%,50%)"]):"vert"===c&&"h"===this.options.controls.horiz?j=["hsla(0, 0%, "+e.l+"%, 0)","hsla(0, 0%, "+e.l+"%, 1)"]:j=["hsl("+e.h+",0%,50%)","hsl("+e.h+",100%,50%)"];d.gradient(a,j);break;case "l":"strip"===c?j=["hsl("+e.h+",100%,100%)","hsl("+e.h+", "+e.s+"%,50%)","hsl("+e.h+",100%,0%)"]:j=["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"];d.gradient(a,j);break;case "v":"strip"===c?j=[b.clone().v(100).toCSS(),b.clone().v(0).toCSS()]:j=["rgba(0,0,0,0)","#000"], 
     17d.gradient(a,j)}},_getHSpaceColor:function(){return"hsv"===this.options.mode?this.color.toHsv():this.color.toHsl()},_dimensions:function(a){var c=this.options;this.picker.find(".iris-picker-inner");var b=this.controls.square,h=this.picker.find(".iris-strip"),e="77.5%",j="12%",l=c.border?c.width-20:c.width,i=d.isArray(c.palettes)?c.palettes.length:this._palettes.length,k,r;a&&(b.css("width",""),h.css("width",""),this.picker.removeAttr("style"));e=l*(parseFloat(e)/100);j=l*(parseFloat(j)/100);a=c.border? 
     18e+20:e;b.width(e).height(e);h.height(e).width(j);this.picker.css({width:c.width,height:a});c.palettes&&(k=2*e/100,r=(e-(i-1)*k)/i,this.picker.find(".iris-palette").each(function(a){a=0===a?0:k;d(this).css({width:r,height:r,marginLeft:a})}),this.picker.css("paddingBottom",r+k),h.height(r+k+e))},_addInputListeners:function(a){var c=this;a.on("change",function(){var b=new Color(a.val()),h=a.val().replace(/^#/,"");a.removeClass("iris-error");b.error?""!==h&&a.addClass("iris-error"):c._setOption("color", 
     19b.toString())})},_initControls:function(){var a=this,c=a.controls,b=c.square,h=a.options.controls,e=a._scale[h.strip];c.stripSlider.slider({orientation:"vertical",max:e,slide:function(c,b){a.active="strip";"h"===h.strip&&(b.value=e-b.value);a.color[h.strip](b.value);a._change.apply(a,arguments)}});c.squareDrag.draggable({containment:"parent",zIndex:1E3,cursor:"move",drag:function(c,b){a._squareDrag(c,b)},start:function(){b.addClass("iris-dragging");d(this).addClass("ui-state-focus")},stop:function(){b.removeClass("iris-dragging"); 
     20d(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(c){c.preventDefault();"mousedown"===c.type?(a.picker.find(".ui-state-focus").removeClass("ui-state-focus").blur(),d(this).addClass("ui-state-focus")):d(this).removeClass("ui-state-focus")}).on("keydown",function(c){var b,f=d(".iris-square-value"),e=d(".iris-square");b=f.position();switch(c.keyCode){case 37:b.left-=1;break;case 38:b.top-=1;break;case 39:b.left+=1;break;case 40:b.top+=1;break;default:return!0}0<=b.left&&(0<=b.top&& 
     21b.left+f.width()<=e.width()&&b.top+f.height()<=e.height())&&f.css(b);b=e.offset();f={top:f.offset().top-b.top,left:f.offset().left-b.left};a._squareDrag(c,{position:f});c.preventDefault()});b.mousedown(function(b){if(1===b.which&&d(b.target).is("div")){var c=a.controls.square.offset(),c={top:b.pageY-c.top,left:b.pageX-c.left};b.preventDefault();a._squareDrag(b,{position:c});b.target=a.controls.squareDrag.get(0);a.controls.squareDrag.css(c).trigger(b)}});a.options.palettes&&a.picker.find(".iris-palette-container").on("click", 
     22".iris-palette",function(){a.color.fromCSS(d(this).data("color"));a.active="external";a._change()})},_squareDrag:function(a,b){var c=this.options.controls,h=this._squareDimensions(),e=Math.round((h.h-b.position.top)/h.h*this._scale[c.vert]),h=this._scale[c.horiz]-Math.round((h.w-b.position.left)/h.w*this._scale[c.horiz]);this.color[c.horiz](h)[c.vert](e);this.active="square";this._change.apply(this,arguments)},_setOption:function(a,b){if("color"===a){b=""+b;b.replace(/^#/,"");var c=(new Color(b)).setHSpace(this.options.mode); 
     23c.error||(this.color=c,this.options.color=this.options[a]=this.color.toString(),this.active="external",this._change())}},_squareDimensions:function(a){var b=this.controls.square,c;return a!==i&&b.data("dimensions")?b.data("dimensions"):(c={w:b.width(),h:b.height()},b.data("dimensions",c),c)},_isNonHueControl:function(a,b){return"square"===a&&"h"===this.options.controls.strip?!0:"external"===b||"h"===b&&"strip"===a?!1:!0},_change:function(){var a=this,b=a.controls,c=a._getHSpaceColor(),h=["square", 
     24"strip"],e=a.options.controls,j=e[a.active]||"external",i=a.hue;"strip"===a.active?h=[]:"external"!==a.active&&h.pop();d.each(h,function(j,h){var d;if(h!==a.active)switch(h){case "strip":d="h"===e.strip?a._scale[e.strip]-c[e.strip]:c[e.strip];b.stripSlider.slider("value",d);break;case "square":d=a._squareDimensions(),a.controls.squareDrag.css({left:c[e.horiz]/a._scale[e.horiz]*d.w,top:d.h-c[e.vert]/a._scale[e.vert]*d.h})}});c.h!==i&&a._isNonHueControl(a.active,j)&&a.color.h(i);a.hue=a.color.h();a.options.color= 
     25a.color.toString();a._inited&&a._trigger("change",{type:a.active},{color:a.color});a.element.is(":input")&&!a.color.error&&a.element.val(a.color.toString()).removeClass("iris-error");a._paint();a._inited=!0;a.active=!1},show:function(){this.picker.show()},hide:function(){this.picker.hide()},toggle:function(){this.picker.toggle()}});d('<style id="iris-css">.iris-picker{display:block;position:relative}.iris-error{background-color:#ffafaf}.iris-border{border-radius:3px;border:1px solid #aaa;width:200px;background-color:#fff}.iris-picker-inner{position:absolute;top:0;right:0;left:0;bottom:0}.iris-border .iris-picker-inner{top:10px;right:10px;left:10px;bottom:10px}.iris-picker .iris-square-inner{position:absolute;left:0;right:0;top:0;bottom:0}.iris-picker .iris-square,.iris-picker .iris-slider,.iris-picker .iris-square-inner,.iris-picker .iris-palette{border-radius:3px;-webkit-box-shadow:inset 0 0 5px rgba(0,0,0,0.4);-moz-box-shadow:inset 0 0 5px rgba(0,0,0,0.4);box-shadow:inset 0 0 5px rgba(0,0,0,0.4);height:100%;width:12.5%;float:left;margin-right:5%}.iris-picker .iris-square{width:76%;margin-right:10%;position:relative}.iris-picker .iris-square-inner{width:auto;margin:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-square-inner,.iris-ie-9 .iris-palette{box-shadow:none;border-radius:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-palette{outline:1px solid rgba(0,0,0,.1)}.iris-ie-lt9 .iris-square,.iris-ie-lt9 .iris-slider,.iris-ie-lt9 .iris-square-inner,.iris-ie-lt9 .iris-palette{outline:1px solid #aaa}.iris-ie-lt9 .iris-square .ui-slider-handle{outline:1px solid #aaa;background-color:#fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"}.iris-ie-lt9 .iris-square .iris-square-handle{background:none;border:3px solid #fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"}.iris-picker .iris-strip{margin-right:0;position:relative}.iris-picker .iris-strip .ui-slider-handle{position:absolute;background:none;right:-3px;left:-3px;border:4px solid #aaa;border-width:4px 3px;width:auto;height:6px;border-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.2);opacity:.9;z-index:5}.iris-strip .ui-slider-handle:before{content:" ";position:absolute;left:-2px;right:-2px;top:-3px;bottom:-3px;border:2px solid #fff;-webkit-border-radius:3px;border-radius:3px}.iris-picker .iris-slider-offset{position:absolute;top:11px;left:0;right:0;bottom:-3px}.iris-picker .iris-square-handle{background:transparent;border:5px solid #aaa;-webkit-border-radius:6px;-moz-border-radius:50%;border-radius:50%;border-color:rgba(128,128,128,.5);box-shadow:none;width:12px;height:12px;position:absolute;left:-10px;top:-10px;cursor:move;opacity:1;z-index:10}.iris-picker .ui-state-focus .iris-square-handle{opacity:.8}.iris-picker .iris-square-handle:hover{border-color:#999}.iris-picker .iris-square-handle:hover::after{border-color:#fff}.iris-picker .iris-square-handle::after{position:absolute;bottom:-4px;right:-4px;left:-4px;top:-4px;border:3px solid #f9f9f9;border-color:rgba(255,255,255,.8);border-radius:50%;content:" "}.iris-picker .iris-square-value{width:8px;height:8px;position:absolute}.iris-ie-lt9 .iris-square-value,.iris-mozilla .iris-square-value{width:1px;height:1px}.iris-palette-container{position:absolute;bottom:0;left:0;margin:0;padding:0}.iris-border .iris-palette-container{left:10px;bottom:10px}.iris-picker .iris-palette{margin:0;list-style-type:none;cursor:pointer}</style>').appendTo("head")})(jQuery); 
     26(function(d,i){var k=function(a,c){return this instanceof k?this._init(a,c):new k(a,c)};k.fn=k.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(a){var c="noop";switch(typeof a){case "object":return a.a!==i&&this.a(a.a),c=a.r!==i?"fromRgb":a.l!==i?"fromHsl":a.v!==i?"fromHsv":c,this[c](a);case "string":return this.fromCSS(a);case "number":return this.fromInt(parseInt(a,10))}return this},clone:function(){for(var a=new k(this.toInt()),c=["_alpha", 
     27"_hSpace","_hsl","_hsv","error"],b=c.length-1;0<=b;b--)a[c[b]]=this[c[b]];return a},setHSpace:function(a){return this._hSpace="hsv"===a?"hsv":"hsl",this},noop:function(){return this},fromCSS:function(a){var c;return this.error=!1,a.match(/^(rgb|hsl)a?/)?(c=a.replace(/(\s|%)/g,"").replace(/^(rgb|hsl)a?\(/,"").replace(/\);?$/,"").split(","),4===c.length&&this.a(parseFloat(c.pop())),a.match(/^rgb/)?this.fromRgb({r:parseInt(c[0],10),g:parseInt(c[1],10),b:parseInt(c[2],10)}):this.fromHsl({h:parseInt(c[0], 
     2810),s:parseInt(c[1],10),l:parseInt(c[2],10)})):this.fromHex(a)},fromRgb:function(a,c){return"object"!=typeof a||a.r===i||a.g===i||a.b===i?(this.error=!0,this):(this.error=!1,this.fromInt(parseInt((a.r<<16)+(a.g<<8)+a.b,10),c))},fromHex:function(a){return a=a.replace(/^#/,"").replace(/^0x/,""),3===a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),this.error=!/^[0-9A-F]{6}$/i.test(a),this.fromInt(parseInt(a,16))},fromHsl:function(a){var c,b,j,g,f,d,h,e;return"object"!=typeof a||a.h===i||a.s===i||a.l===i? 
     29(this.error=!0,this):(this._hsl=a,this._hSpace="hsl",d=a.h/360,h=a.s/100,e=a.l/100,0===h?c=b=j=e:(g=0.5>e?e*(1+h):e+h-e*h,f=2*e-g,c=this.hue2rgb(f,g,d+1/3),b=this.hue2rgb(f,g,d),j=this.hue2rgb(f,g,d-1/3)),this.fromRgb({r:255*c,g:255*b,b:255*j},!0))},fromHsv:function(a){var c,b,d,g,f,m,h,e;if("object"!=typeof a||a.h===i||a.s===i||a.v===i)return this.error=!0,this;this._hsv=a;this._hSpace="hsv";c=a.h/360;b=a.s/100;a=a.v/100;m=Math.floor(6*c);h=6*c-m;c=a*(1-b);e=a*(1-h*b);b=a*(1-(1-h)*b);switch(m%6){case 0:d= 
     30a;g=b;f=c;break;case 1:d=e;g=a;f=c;break;case 2:d=c;g=a;f=b;break;case 3:d=c;g=e;f=a;break;case 4:d=b;g=c;f=a;break;case 5:d=a,g=c,f=e}return this.fromRgb({r:255*d,g:255*g,b:255*f},!0)},fromInt:function(a,c){return this._color=parseInt(a,10),isNaN(this._color)&&(this._color=0),16777215<this._color?this._color=16777215:0>this._color&&(this._color=0),c===i&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(a,c,b){return 0>b&&(b+=1),1<b&&(b-=1),b<1/6?a+6*(c-a)*b:0.5>b?c:b<2/ 
     313?a+6*(c-a)*(2/3-b):a},toString:function(){var a=parseInt(this._color,10).toString(16);if(this.error)return"";if(6>a.length)for(var c=6-a.length-1;0<=c;c--)a="0"+a;return"#"+a},toCSS:function(a,c){a=a||"hex";c=parseFloat(c||this._alpha);switch(a){case "rgb":case "rgba":var b=this.toRgb();return 1>c?"rgba( "+b.r+", "+b.g+", "+b.b+", "+c+" )":"rgb( "+b.r+", "+b.g+", "+b.b+" )";case "hsl":case "hsla":return b=this.toHsl(),1>c?"hsla( "+b.h+", "+b.s+"%, "+b.l+"%, "+c+" )":"hsl( "+b.h+", "+b.s+"%, "+b.l+ 
     32"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var a=this.toRgb(),c=a.r/255,b=a.g/255,a=a.b/255,d=Math.max(c,b,a),g=Math.min(c,b,a),f,i=(d+g)/2;if(d===g)f=g=0;else{var h=d-g,g=0.5<i?h/(2-d-g):h/(d+g);switch(d){case c:f=(b-a)/h+(b<a?6:0);break;case b:f=(a-c)/h+2;break;case a:f=(c-b)/h+4}f/=6}return f=Math.round(360*f),0===f&&this._hsl.h!==f&&(f=this._hsl.h),g=Math.round(100*g),0===g&&this._hsl.s&&(g=this._hsl.s), 
     33{h:f,s:g,l:Math.round(100*i)}},toHsv:function(){var a=this.toRgb(),c=a.r/255,b=a.g/255,a=a.b/255,d=Math.max(c,b,a),g=Math.min(c,b,a),f,i,h=d-g;i=0===d?0:h/d;if(d===g)f=i=0;else{switch(d){case c:f=(b-a)/h+(b<a?6:0);break;case b:f=(a-c)/h+2;break;case a:f=(c-b)/h+4}f/=6}return f=Math.round(360*f),0===f&&this._hsv.h!==f&&(f=this._hsv.h),i=Math.round(100*i),0===i&&this._hsv.s&&(i=this._hsv.s),{h:f,s:i,v:Math.round(100*d)}},toInt:function(){return this._color},toIEOctoHex:function(){var a=this.toString(), 
     34c=parseInt(255*this._alpha,10).toString(16);return 1===c.length&&(c="0"+c),"#"+c+a.replace(/^#/,"")},toLuminosity:function(){var a=this.toRgb();return 0.2126*Math.pow(a.r/255,2.2)+0.7152*Math.pow(a.g/255,2.2)+0.0722*Math.pow(a.b/255,2.2)},getDistanceLuminosityFrom:function(a){if(a instanceof k){var c=this.toLuminosity(),a=a.toLuminosity();return c>a?(c+0.05)/(a+0.05):(a+0.05)/(c+0.05)}throw"getDistanceLuminosityFrom requires a Color object";},getMaxContrastColor:function(){var a=0.5<=this.toLuminosity()? 
     35"000000":"ffffff";return new k(a)},getGrayscaleContrastingColor:function(a){if(!a)return this.getMaxContrastColor();var c=5>a?5:a,b=this.getMaxContrastColor(),a=b.getDistanceLuminosityFrom(this);if(a<=c)return b;for(var d=0===b.toInt()?1:-1;a>c;)b=b.incrementLightness(d),a=b.getDistanceLuminosityFrom(this);return b},getReadableContrastingColor:function(a,c){if(!a instanceof k)return this;var b=c===i?5:c,d=a.getDistanceLuminosityFrom(this),g=a.getMaxContrastColor();if(g.getDistanceLuminosityFrom(a)<= 
     36b)return g;if(d>=b)return this;for(g=0===g.toInt()?-1:1;d<b&&!(this.incrementLightness(g),d=this.getDistanceLuminosityFrom(a),0===this._color||16777215===this._color););return this},a:function(a){return a===i?this._alpha:(this._alpha=parseFloat(a),this)},darken:function(a){return a=a||5,this.l(-a,!0)},lighten:function(a){return a=a||5,this.l(a,!0)},saturate:function(a){return a=a||15,this.s(a,!0)},desaturate:function(a){return a=a||15,this.s(-a,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)}, 
     37getComplement:function(){return this.h(180,!0)},getSplitComplement:function(a){return this.h(180+30*(a||1),!0)},getAnalog:function(a){return this.h(30*(a||1),!0)},getTetrad:function(a){return this.h(60*(a||1),!0)},getTriad:function(a){return this.h(120*(a||1),!0)},_partial:function(a){var c=q[a];return function(b,d){var g=this._spaceFunc("to",c.space);return b===i?g[a]:(!0===d&&(b=g[a]+b),c.mod&&(b%=c.mod),c.range&&(b=b<c.range[0]?c.range[0]:b>c.range[1]?c.range[1]:b),g[a]=b,this._spaceFunc("from", 
     38c.space,g))}},_spaceFunc:function(a,c,b){c=c||this._hSpace;return this[a+c.charAt(0).toUpperCase()+c.substr(1)](b)}};var q={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}},p;for(p in q)q.hasOwnProperty(p)&&(k.fn[p]=k.fn._partial(p));d.Color=k})("object"==typeof exports&&exports||this); 
     39 No newline at end of file