!function(i,e){var o={options:{defaultColor:!1,change:!1,clear:!1,hide:!0,palettes:!0,width:255,mode:"hsv"},_create:function(){var t,o;i.support.iris&&(o=(t=this).element,i.extend(t.options,o.data()),t.close=i.proxy(t.close,t),t.initialValue=o.val(),o.addClass("wp-color-picker").hide().wrap('
'),t.wrap=o.parent(),t.toggler=i('').insertBefore(o).css({backgroundColor:t.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),t.pickerContainer=i('
').insertAfter(o),t.button=i(''),t.options.defaultColor?t.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString):t.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),o.wrap('').after(t.button),o.iris({target:t.pickerContainer,hide:t.options.hide,width:t.options.width,mode:t.options.mode,palettes:t.options.palettes,change:function(o,e){t.toggler.css({backgroundColor:e.color.toString()}),i.isFunction(t.options.change)&&t.options.change.call(this,o,e)}}),o.val(t.initialValue),t._addListeners(),t.options.hide||t.toggler.click())},_addListeners:function(){var t=this;t.wrap.on("click.wpcolorpicker",function(o){o.stopPropagation()}),t.toggler.click(function(){t.toggler.hasClass("wp-picker-open")?t.close():t.open()}),t.element.change(function(o){var e=i(this).val();""!==e&&"#"!==e||(t.toggler.css("backgroundColor",""),i.isFunction(t.options.clear)&&t.options.clear.call(this,o))}),t.toggler.on("keyup",function(o){13!==o.keyCode&&32!==o.keyCode||(o.preventDefault(),t.toggler.trigger("click").next().focus())}),t.button.click(function(o){var e=i(this);e.hasClass("wp-picker-clear")?(t.element.val(""),t.toggler.css("backgroundColor",""),i.isFunction(t.options.clear)&&t.options.clear.call(this,o)):e.hasClass("wp-picker-default")&&t.element.val(t.options.defaultColor).change()})},open:function(){this.element.show().iris("toggle").focus(),this.button.removeClass("hidden"),this.wrap.addClass("wp-picker-active"),this.toggler.addClass("wp-picker-open"),i("body").trigger("click.wpcolorpicker").on("click.wpcolorpicker",this.close)},close:function(){this.element.hide().iris("toggle"),this.button.addClass("hidden"),this.wrap.removeClass("wp-picker-active"),this.toggler.removeClass("wp-picker-open"),i("body").off("click.wpcolorpicker",this.close)},color:function(o){if(o===e)return this.element.iris("option","color");this.element.iris("option","color",o)},defaultColor:function(o){if(o===e)return this.options.defaultColor;this.options.defaultColor=o}};i.widget("wp.wpColorPicker",o)}(jQuery);