(function(c){"function"===typeof define&&define.amd?define(["jquery","./core","./widget"],c):c(jQuery)})(function(c){var g,k=function(){var a=c(this);setTimeout(function(){a.find(":ui-button").button("refresh")},1)},h=function(a){var b=a.name,d=a.form,e=c([]);b&&(b=b.replace(/'/g,"\\'"),e=d?c(d).find("[name='"+b+"'][type=radio]"):c("[name='"+b+"'][type=radio]",a.ownerDocument).filter(function(){return!this.form}));return e};c.widget("ui.button",{version:"1.11.4",defaultElement:"<button>",options:{disabled:null,
text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,k);"boolean"!==typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled);this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var a=this,b=this.options,d="checkbox"===this.type||"radio"===this.type,e=d?"":"ui-state-active";null===
b.label&&(b.label="input"===this.type?this.buttonElement.val():this.buttonElement.html());this._hoverable(this.buttonElement);this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter"+this.eventNamespace,function(){b.disabled||this===g&&c(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){b.disabled||c(this).removeClass(e)}).bind("click"+this.eventNamespace,function(a){b.disabled&&(a.preventDefault(),
a.stopImmediatePropagation())});this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}});d&&this.element.bind("change"+this.eventNamespace,function(){a.refresh()});"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(b.disabled)return!1}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(b.disabled)return!1;c(this).addClass("ui-state-active");
a.buttonElement.attr("aria-pressed","true");var d=a.element[0];h(d).not(d).map(function(){return c(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){if(b.disabled)return!1;c(this).addClass("ui-state-active");g=this;a.document.one("mouseup",function(){g=null})}).bind("mouseup"+this.eventNamespace,function(){if(b.disabled)return!1;c(this).removeClass("ui-state-active")}).bind("keydown"+this.eventNamespace,
function(a){if(b.disabled)return!1;a.keyCode!==c.ui.keyCode.SPACE&&a.keyCode!==c.ui.keyCode.ENTER||c(this).addClass("ui-state-active")}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){c(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(a){a.keyCode===c.ui.keyCode.SPACE&&c(this).click()}));this._setOption("disabled",b.disabled);this._resetButton()},_determineButtonType:function(){var a,b;this.element.is("[type=checkbox]")?
this.type="checkbox":this.element.is("[type=radio]")?this.type="radio":this.element.is("input")?this.type="input":this.type="button";"checkbox"===this.type||"radio"===this.type?(a=this.element.parents().last(),b="label[for='"+this.element.attr("id")+"']",this.buttonElement=a.find(b),this.buttonElement.length||(a=a.length?a.siblings():this.element.siblings(),this.buttonElement=a.filter(b),this.buttonElement.length||(this.buttonElement=a.find(b))),this.element.addClass("ui-helper-hidden-accessible"),
(a=this.element.is(":checked"))&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",a)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-active ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());
this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(a,b){this._super(a,b);"disabled"===a?(this.widget().toggleClass("ui-state-disabled",!!b),this.element.prop("disabled",!!b),b&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active"))):this._resetButton()},refresh:function(){var a=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");
a!==this.options.disabled&&this._setOption("disabled",a);"radio"===this.type?h(this.element[0]).each(function(){c(this).is(":checked")?c(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):c(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed",
"false"))},_resetButton:function(){if("input"===this.type)this.options.label&&this.element.val(this.options.label);else{var a=this.buttonElement.removeClass("ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only"),b=c("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&
f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&a.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>"),d.secondary&&a.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>"),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||a.attr("title",c.trim(b)))):f.push("ui-button-text-only");a.addClass(f.join(" "))}}});c.widget("ui.buttonset",{version:"1.11.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},
_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(a,b){"disabled"===a&&this.buttons.button("option",a,b);this._super(a,b)},refresh:function(){var a="rtl"===this.element.css("direction"),b=this.element.find(this.options.items),d=b.filter(":ui-button");b.not(":ui-button").button();d.button("refresh");this.buttons=b.map(function(){return c(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(a?
"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(a?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return c(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}});return c.ui.button});