1 !function(a
,b
){"use strict";b
.module("ui.sortable",[]).value("uiSortableConfig",{}).directive("uiSortable",["uiSortableConfig","$timeout","$log",function(a
,c
,d
){return{require
:"?ngModel",link:function(e
,f
,g
,h
){function i(a
,b
){return b
&&"function"==typeof b
?function(c
,d
){a(c
,d
),b(c
,d
)}:a
}function j(a
,b
){var c
=a
.sortable("option","helper");return"clone"===c
||"function"==typeof c
&&b
.item
.sortable
.isCustomHelperUsed()}var k
,l
={},m
={receive
:null,remove
:null,start
:null,stop
:null,update
:null},n
={helper
:null};return b
.extend(l
,a
,e
.$eval(g
.uiSortable
)),b
.element
.fn
&&b
.element
.fn
.jquery
?(h
?(e
.$watch(g
.ngModel
+".length",function(){c(function(){f
.data("ui-sortable")&&f
.sortable("refresh")})}),m
.start=function(a
,b
){b
.item
.sortable
={index
:b
.item
.index(),cancel:function(){b
.item
.sortable
._isCanceled
=!0},isCanceled:function(){return b
.item
.sortable
._isCanceled
},isCustomHelperUsed:function(){return!!b
.item
.sortable
._isCustomHelperUsed
},_isCanceled
:!1,_isCustomHelperUsed
:b
.item
.sortable
._isCustomHelperUsed
}},m
.activate=function(){k
=f
.contents();var a
=f
.sortable("option","placeholder");if(a
&&a
.element
&&"function"==typeof a
.element
){var c
=a
.element();c
=b
.element(c
);var d
=f
.find('[class="'+c
.attr("class")+'"]');k
=k
.not(d
)}},m
.update=function(a
,b
){b
.item
.sortable
.received
||(b
.item
.sortable
.dropindex
=b
.item
.index(),b
.item
.sortable
.droptarget
=b
.item
.parent(),f
.sortable("cancel")),j(f
,b
)&&!b
.item
.sortable
.received
&&"parent"===f
.sortable("option","appendTo")&&(k
=k
.not(k
.last())),k
.appendTo(f
),b
.item
.sortable
.received
&&(k
=null),b
.item
.sortable
.received
&&!b
.item
.sortable
.isCanceled()&&e
.$apply(function(){h
.$modelValue
.splice(b
.item
.sortable
.dropindex
,0,b
.item
.sortable
.moved
)})},m
.stop=function(a
,b
){!b
.item
.sortable
.received
&&"dropindex"in b
.item
.sortable
&&!b
.item
.sortable
.isCanceled()?e
.$apply(function(){h
.$modelValue
.splice(b
.item
.sortable
.dropindex
,0,h
.$modelValue
.splice(b
.item
.sortable
.index
,1)[0])}):"dropindex"in b
.item
.sortable
&&!b
.item
.sortable
.isCanceled()||j(f
,b
)||k
.appendTo(f
),k
=null},m
.receive=function(a
,b
){b
.item
.sortable
.received
=!0},m
.remove=function(a
,b
){"dropindex"in b
.item
.sortable
||(f
.sortable("cancel"),b
.item
.sortable
.cancel()),b
.item
.sortable
.isCanceled()||e
.$apply(function(){b
.item
.sortable
.moved
=h
.$modelValue
.splice(b
.item
.sortable
.index
,1)[0]})},n
.helper=function(a
){return a
&&"function"==typeof a
?function(b
,c
){var d
=a(b
,c
);return c
.sortable
._isCustomHelperUsed
=c
!==d
,d
}:a
},e
.$watch(g
.uiSortable
,function(a
){f
.data("ui-sortable")&&b
.forEach(a
,function(a
,b
){m
[b
]?("stop"===b
&&(a
=i(a
,function(){e
.$apply()})),a
=i(m
[b
],a
)):n
[b
]&&(a
=n
[b
](a
)),f
.sortable("option",b
,a
)})},!0),b
.forEach(m
,function(a
,b
){l
[b
]=i(a
,l
[b
])})):d
.info("ui.sortable: ngModel not provided!",f
),void f
.sortable(l
)):void d
.error("ui.sortable: jQuery should be included before AngularJS!")}}}])}(window
,window
.angular
);