;!function(v){v.fn.multiSwitch=function(t){var o=v.extend({textChecked:"Checked",textNotChecked:"NotChecked",functionOnChange:function(t){console.log("# multi-switch callback: ",arguments)}},t),h=v("<div />").addClass("multi-switch");h.css("width",o.width);var e=v("<div />").addClass("switch-content");e.append(v("<div />").addClass("switch-circle")),h.append(e);this.each(function(){var e=h.clone(),n=!0,t=v(this),i=t.clone();if(t.attr("checked-value")&&!t.prop("disabled")){var a="initial";if(t.val()===t.attr("checked-value")?a="active":t.val()===t.attr("unchecked-value")&&(a="deactivated"),"initial"===a){var c=v('<span class="info-slide deactivated" title="'+o.textNotChecked+'"/>'),d=v('<span class="info-slide active" title="'+o.textChecked+'"/>');e.find(".switch-content").append(c),e.find(".switch-content").append(d),c.click(function(){var t=v(e).find("input");t.val(v(t).attr("checked-value")),v(e).find("span").html(o.textChecked),v(e).find(".switch-content").addClass("active"),v(e).find(".switch-content").removeClass("deactivated"),n=!0,v(e).find(".info-slide").remove()}),c.hover(function(){v(e).find(".switch-content").addClass("deactivated"),v(e).find(".switch-content").removeClass("initial")},function(){v(e).find(".switch-content").addClass("initial"),v(e).find(".switch-content").removeClass("deactivated")}),d.click(function(){var t=v(e).find("input");t.val(v(t).attr("unchecked-value")),v(e).find("span").html(o.textChecked),v(e).find(".switch-content").addClass("deactivated"),v(e).find(".switch-content").removeClass("active"),n=!0,v(e).find(".info-slide").remove()}),d.hover(function(){v(e).find(".switch-content").addClass("active"),v(e).find(".switch-content").removeClass("initial")},function(){v(e).find(".switch-content").addClass("initial"),v(e).find(".switch-content").removeClass("active")}),n=!1}e.find(".switch-content").addClass(a).addClass(t.prop("disabled")?"disabled":""),e.append(i)}else{var s=t.prop("checked");e.find("span").html(s?o.textChecked:o.textNotChecked),e.find(".switch-content").addClass(s?"active":"deactivated").addClass(t.prop("disabled")?"disabled":""),e.append(i)}e.click(function(){var t=v(this);if(n){var e=t.find("input");if(!e.prop("disabled")){var i=null;if(v(e).attr("checked-value")){var a=t.find(".switch-content").hasClass("active");i=!a,a?e.val(v(e).attr("unchecked-value")):e.val(v(e).attr("checked-value"))}else i=!e.prop("checked"),e.prop("checked",i);t.find(".switch-content").removeClass("initial"),i?(t.find("span").html(o.textChecked),t.find(".switch-content").addClass("active").removeClass("deactivated")):(t.find("span").html(o.textNotChecked),t.find(".switch-content").addClass("deactivated").removeClass("active"))}}}),e.change(function(){var t=v(this),e=t.find("input");if(!e.prop("disabled")){var i=null;if(v(e).attr("checked-value")){var a=t.find(".switch-content").hasClass("active");i=!a,a?e.val(v(e).attr("unchecked-value")):e.val(v(e).attr("checked-value"))}else i=!e.prop("checked"),e.prop("checked",i);t.find(".switch-content").removeClass("initial"),i?(t.find("span").html(o.textChecked),t.find(".switch-content").addClass("active"),t.find(".switch-content").removeClass("deactivated")):(t.find("span").html(o.textNotChecked),t.find(".switch-content").addClass("deactivated"),t.find(".switch-content").removeClass("active"))}});var l=new MutationObserver(function(t){t.forEach(function(t){o.functionOnChange(v(t.target))})});try{l.observe(i.get(0),{attributes:!0,attributeOldValue:!0,attributeFilter:["value"]})}catch(t){if(!(t instanceof TypeError))throw t;console.warn(t)}t.after(e),t.remove()})}}(jQuery);