!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).dragula=e()}}((function(){return function e(t,n,r){function o(u,c){if(!n[u]){if(!t[u]){var a="function"==typeof require&&require;if(!c&&a)return a(u,!0);if(i)return i(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var f=n[u]={exports:{}};t[u][0].call(f.exports,(function(e){return o(t[u][1][e]||e)}),f,f.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u0?e:Y.revertOnSpill,n=N||T,r=h(n),o=J(r);!1===o&&t&&(N?r&&r.removeChild(N):y.insertBefore(n,O)),o||t?A.emit("cancel",n,y,y):A.emit("drop",n,r,y,I),G()}}function G(){var e=N||T;K(),n&&(i.rm(Y.mirrorContainer,"gu-unselectable"),a(c,"remove","mousemove",W),h(n).removeChild(n),n=null),e&&i.rm(e,"gu-transit"),_&&clearTimeout(_),A.dragging=!1,L&&A.emit("out",e,L,y),A.emit("dragend",e),y=T=N=O=I=_=L=null}function J(e,t){var r;return r=void 0!==t?t:n?I:w(N||T),e===y&&r===O}function Q(e,t,n){for(var r=e;r&&!o();)r=h(r);return r;function o(){if(!1===B(r))return!1;var o=Z(r,e),i=ee(r,o,t,n);return!!J(r,i)||Y.accepts(T,r,y,i)}}function W(e){if(n){e.preventDefault();var t=b("clientX",e)||0,r=b("clientY",e)||0,o=t-E,i=r-x;n.style.left=o+"px",n.style.top=i+"px";var u=N||T,c=s(n,t,r),a=Q(c,t,r),l=null!==a&&a!==L;(l||null===a)&&(L&&m("out"),L=a,l&&m("over"));var f=h(u);if(a!==y||!N||Y.copySortSource){var d,v=Z(a,c);if(null!==v)d=ee(a,v,t,r);else{if(!0!==Y.revertOnSpill||N)return void(N&&f&&f.removeChild(u));d=O,a=y}(null===d&&l||d!==u&&d!==w(u))&&(I=d,a.insertBefore(u,d),A.emit("shadow",u,a,y))}else f&&f.removeChild(u)}function m(e){A.emit(e,u,L,y)}}function Z(e,t){for(var n=t;n!==e&&h(n)!==e;)n=h(n);return n===c?null:n}function ee(e,t,n,r){var o="horizontal"===Y.direction,i=t!==e?function(){var e=t.getBoundingClientRect();if(o)return u(n>e.left+m(e)/2);return u(r>e.top+p(e)/2)}():function(){var t,i,u,c=e.children.length;for(t=0;tn)return i;if(!o&&u.top+u.height/2>r)return i}return null}();return i;function u(e){return e?w(t):t}}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./classes":1,"contra/emitter":5,crossvent:6}],3:[function(e,t,n){t.exports=function(e,t){return Array.prototype.slice.call(e,t)}},{}],4:[function(e,t,n){"use strict";var r=e("ticky");t.exports=function(e,t,n){e&&r((function(){e.apply(n||null,t||[])}))}},{ticky:10}],5:[function(e,t,n){"use strict";var r=e("atoa"),o=e("./debounce");t.exports=function(e,t){var n=t||{},i={};return void 0===e&&(e={}),e.on=function(t,n){return i[t]?i[t].push(n):i[t]=[n],e},e.once=function(t,n){return n._once=!0,e.on(t,n),e},e.off=function(t,n){var r=arguments.length;if(1===r)delete i[t];else if(0===r)i={};else{var o=i[t];if(!o)return e;o.splice(o.indexOf(n),1)}return e},e.emit=function(){var t=r(arguments);return e.emitterSnapshot(t.shift()).apply(this,t)},e.emitterSnapshot=function(t){var u=(i[t]||[]).slice(0);return function(){var i=r(arguments),c=this||e;if("error"===t&&!1!==n.throws&&!u.length)throw 1===i.length?i[0]:i;return u.forEach((function(r){n.async?o(r,i,c):r.apply(c,i),r._once&&e.off(t,r)})),e}},e}},{"./debounce":4,atoa:3}],6:[function(e,t,n){(function(n){"use strict";var r=e("custom-event"),o=e("./eventmap"),i=n.document,u=function(e,t,n,r){return e.addEventListener(t,n,r)},c=function(e,t,n,r){return e.removeEventListener(t,n,r)},a=[];function l(e,t,n){var r=function(e,t,n){var r,o;for(r=0;r1)for(var n=1;n=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n.setImmediate="function"==typeof t?t:function(e){var t=a++,r=!(arguments.length<2)&&u.call(arguments,1);return c[t]=!0,o((function(){c[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))})),t},n.clearImmediate="function"==typeof r?r:function(e){delete c[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":9,timers:11}]},{},[2])(2)}));