(function (d) {
    var f = /ui-checkbox|ui-radio/; d.widget("ui.checkBox", { options: { hideInput: !0, addVisualElement: !0, addLabel: !0, _delegated: !1 }, _create: function () {
        var b = this.options; if (!this.element.is(":radio,:checkbox")) { if (d.nodeName(this.element[0], "input")) return !1; this._addDelegate(); this.updateContainer(); return !1 } this.labels = d([]); this.hoverStatus = this.disabledStatus = this.checkedStatus = !1; this.radio = this.element.is(":radio"); this.visualElement = d([]); if (b.hideInput && (this.element.addClass("ui-helper-hidden-accessible"),
b.addVisualElement)) this.visualElement = d("<span />").addClass(this.radio ? "ui-radio" : "ui-checkbox"), this.element.after(this.visualElement[0]); if (b.addLabel) this.labels = d("label[for=" + this.element.attr("id") + "]").addClass(this.radio ? "ui-radio" : "ui-checkbox"); b._delegated || this._addEvents(); this.initialized = !0; this.reflectUI({ type: "initialReflect" })
    }, updateContainer: function () {
        !this.element.is(":radio,:checkbox") && !d.nodeName(this.element[0], "input") && d("input", this.element[0]).filter(function () {
            return !d.data(this,
"checkBox")
        }).checkBox(d.extend({}, this.options, { _delegated: !0 }))
    }, _addDelegate: function () {
        var b = this.options, c = function (a, e) { if (e) e.hover = !!("focus" == a.type || "mouseenter" == a.type || "focusin" == a.type || "mouseover" == a.type), e._changeStateClassChain.call(e) }; this.element.bind("click", function (a) { if (d.nodeName(a.target, "input")) { var e = (d.data(a.target) || {}).checkBox; e && e.reflectUI.call(e, a.target, a) } }).bind("focusin.checkBox focusout.checkBox", function (a) {
            if (d.nodeName(a.target, "input")) {
                var e = (d.data(a.target) ||
{}).checkBox; c(a, e)
            } 
        }); b.hideInput && this.element.bind("usermode", function (a) { a.enabled && d("input", this).each(function () { var a = (d.data(this) || {}).checkBox; a && a.destroy.call(a, !0) }) }); b.addVisualElement && this.element.bind("mouseover.checkBox mouseout.checkBox", function (a) { if (d.nodeName(a.target, "span")) { var e = (d.data(d(a.target).prev()[0]) || {}).checkBox; c(a, e) } }).bind("click.checkBox", function (a) { if (d.nodeName(a.target, "span") && f.test(a.target.className || "")) return d(a.target).prev()[0].click(), !1 });
        b.addLabel && this.element.delegate("label.ui-radio, label.ui-checkbox", "mouseenter.checkBox mouseleave.checkBox", function (a) { var e = (d.data(document.getElementById(d(this).attr("for"))) || {}).checkBox; c(a, e) })
    }, _addEvents: function () {
        var b = this, c = this.options, a = function (a) { if (b.disabledStatus) return !1; b.hover = "focus" == a.type || "mouseenter" == a.type; b._changeStateClassChain() }; this.element.bind("click.checkBox", d.proxy(this, "reflectUI")).bind("focus.checkBox blur.checkBox", a); c.hideInput && this.element.bind("usermode",
function (a) { a.enabled && b.destroy.call(b, !0) }); c.addVisualElement && this.visualElement.bind("mouseenter.checkBox mouseleave.checkBox", a).bind("click.checkBox", function () { b.element[0].click(); return !1 }); c.addLabel && this.labels.bind("mouseenter.checkBox mouseleave.checkBox", a)
    }, _changeStateClassChain: function () {
        function b() { var b = this.className.split(" "), c = !1; d.each(b, function (d, f) { if (0 === f.indexOf(e)) return c = !0, b[d] = a, !1 }); c || b.push(a); this.className = b.join(" ") } var c = this.labels.add(this.visualElement),
a = "", e = "ui-" + (this.radio ? "radio" : "checkbox"); this.checkedStatus ? (a += "-checked", c.addClass(e + "-checked")) : c.removeClass(e + "-checked"); this.disabledStatus ? (a += "-disabled", c.addClass(e + "-disabled")) : c.removeClass(e + "-disabled"); this.hover ? (a += "-hover", c.addClass(e + "-hover")) : c.removeClass(e + "-hover"); e += "-state"; a && (a = e + a); this.labels.each(b); this.visualElement.each(b)
    }, destroy: function (b) {
        this.element.removeClass("ui-helper-hidden-accessible"); this.visualElement.addClass("ui-helper-hidden"); b || (this.element.unbind(".checkBox"),
this.visualElement.remove(), this.labels.unbind(".checkBox").removeClass("ui-state-hover ui-state-checked ui-state-disabled"))
    }, disable: function () { this.element[0].disabled = !0; this.reflectUI({ type: "manuallyDisabled" }) }, enable: function () { this.element[0].disabled = !1; this.reflectUI({ type: "manuallyenabled" }) }, toggle: function (b) { this.changeCheckStatus(this.element.is(":checked") ? !1 : !0, b) }, changeCheckStatus: function (b, c) {
        if (c && "click" == c.type && this.element[0].disabled) return !1; this.element.attr({ checked: b });
        this.reflectUI(c || { type: "changeCheckStatus" })
    }, propagate: function (b, c, a) { if (!c || "initialReflect" != c.type) return this.radio && !a && d(document.getElementsByName(this.element.attr("name"))).checkBox("reflectUI", c, !0), this._trigger(b, c, { options: this.options, checked: this.checkedStatus, labels: this.labels, disabled: this.disabledStatus }) }, reflectUI: function (b) {
        var c = this.checkedStatus, a = this.disabledStatus; this.disabledStatus = this.element.is(":disabled"); this.checkedStatus = this.element.is(":checked"); if (this.disabledStatus !=
a || this.checkedStatus !== c) this._changeStateClassChain(), this.disabledStatus != a && this.propagate("disabledChange", b), this.checkedStatus !== c && this.propagate("change", b)
    } 
    })
})(jQuery);
