!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:A.revertOnSpill,n=N||T,r=g(n),o=te(r);!1===o&&t&&(N?r&&r.removeChild(N):s.insertBefore(n,O)),o||t?B.emit("cancel",n,s,s):B.emit("drop",n,r,s,I),ee()}}function ee(){var e=N||T;G(),ce(),e&&i.rm(e,"gu-transit"),_&&clearTimeout(_),B.dragging=!1,Y&&B.emit("out",e,Y,s),B.emit("dragend",e),s=T=N=O=I=_=Y=null}function te(e,t){var r;return r=void 0!==t?t:n?I:w(N||T),e===s&&r===O}function ne(e,t,n){for(var r=e;r&&!o();)r=g(r);return r;function o(){if(!1===P(r))return!1;var o=ae(r,e),i=le(r,o,t,n);return!!te(r,i)||A.accepts(T,r,s,i)}}function re(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=d(n,t,r),a=ne(c,t,r),l=null!==a&&a!==Y;(l||null===a)&&(Y&&p("out"),Y=a,l&&p("over"));var f=g(u);if(a!==s||!N||A.copySortSource){var v,m=ae(a,c);if(null!==m)v=le(a,m,t,r);else{if(!0!==A.revertOnSpill||N)return void(N&&f&&f.removeChild(u));v=O,a=s}(null===v&&l||v!==u&&v!==w(u))&&(I=v,a.insertBefore(u,v),B.emit("shadow",u,a,s))}else f&&f.removeChild(u)}function p(e){B.emit(e,u,Y,s)}}function oe(e){i.rm(e,"gu-hide")}function ie(e){B.dragging&&i.add(e,"gu-hide")}function ue(){if(!n){var e=T.getBoundingClientRect();(n=T.cloneNode(!0)).style.width=p(e)+"px",n.style.height=h(e)+"px",i.rm(n,"gu-transit"),i.add(n,"gu-mirror"),A.mirrorContainer.appendChild(n),a(c,"add","mousemove",re),i.add(A.mirrorContainer,"gu-unselectable"),B.emit("cloned",n,T,"mirror")}}function ce(){n&&(i.rm(A.mirrorContainer,"gu-unselectable"),a(c,"remove","mousemove",re),g(n).removeChild(n),n=null)}function ae(e,t){for(var n=t;n!==e&&g(n)!==e;)n=g(n);return n===c?null:n}function le(e,t,n,r){var o="horizontal"===A.direction;return t!==e?function(){var e=t.getBoundingClientRect();if(o)return i(n>e.left+p(e)/2);return i(r>e.top+h(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}();function i(e){return e?w(t):t}}function fe(e,t){return"boolean"==typeof A.copy?A.copy:A.copy(e,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)}));