define(["jquery"],function(a){var b=function(){a("body").on("change",".itemselect.ignoredirty",b.checkMoveMenuState),a("body").on("click",'[data-action="grade_edittree-index-bulkselect"]',b.toggleAllSelectItems),a("body").on("change",".weightoverride",b.toggleWeightInput),a("#menumoveafter").on("change",function(){var b=a(this).closest("form"),c=b.find("#bulkmoveinput");c.val(1),b.submit()}),b.checkMoveMenuState()};return b.toggleWeightInput=function(b){b.preventDefault();var c=a(this),d=c.closest("tr");a('input[name="weight_'+d.data("itemid")+'"]').prop("disabled",!c.prop("checked"))},b.toggleAllSelectItems=function(c){c.preventDefault();var d=a(this),e=d.closest("tr");a("."+e.data("category")+" .itemselect").prop("checked",d.data("checked")),b.checkMoveMenuState()},b.getMoveMenu=function(){return a("#menumoveafter")},b.checkMoveMenuState=function(){var c=b.getMoveMenu();if(!c.length)return!1;var d;return a(".itemselect").each(function(){return d=a(this).prop("checked"),!d}),c.prop("disabled",!d),d},{enhance:b}});