steal("jquery/class",function(e){e.Class("MP.BootstrapSelect",{setSelected:function(a){a.prop("selected",!0);a.closest("select").next(".bootstrap-select").find(".filter-option").text(a.text())},setDisabled:function(a,b){"undefined"==typeof b&&(b=!0);var c=a.closest("select"),d=a.prop("index"),c=c.next(".bootstrap-select").find('ul[data-select-id="'+c.prop("id")+'"] > li[rel="'+d+'"] > a');b?c.attr("data-disabled",""):c.removeAttr("data-disabled")},appendOption:function(a,b){var c=e("<li />",{rel:b.prop("index")}),
d=e("<a />",{tabindex:"-1",href:"#",text:b.text()});"undefined"!=typeof b.attr("data-disabled")&&d.attr("data-disabled","");d.appendTo(c);a.next(".bootstrap-select").find('ul[data-select-id="'+a.prop("id")+'"]').append(c)},removeOption:function(a){var b=a.closest("select");if(1<b.find("option").length){var c=a.prop("index"),c=b.next(".bootstrap-select").find('ul[data-select-id="'+b.prop("id")+'"] > li[rel="'+c+'"]');c.nextAll("li").each(function(){e(this).attr("rel",parseInt(e(this).attr("rel"))-
1)});c.remove();a.parent().is("optgroup")&&!a.siblings("option").length?(a.parent("optgroup").remove(),1==b.children("optgroup").length&&(a=b.find("optgroup:first option:last").prop("index"),b.next(".bootstrap-select").find('ul[data-select-id="'+b.prop("id")+'"] > li[rel="'+a+'"]').removeClass("optgroup-div"))):a.remove();setSelected(b.find("option:first"))}},updateOptionText:function(a,b){var c=a.closest("select"),d=a.prop("index"),c=c.next(".bootstrap-select").find('ul[data-select-id="'+c.prop("id")+
'"] > li[rel="'+d+'"] > a');a.text(b);c.text(b)}},{})});
