!function(){function t(t,e){for(var i in e)t[i]=e[i];return t}function e(e,i){this.element="string"==typeof e?document.querySelector(e):e,this.$element=$(this.element),this.options=t({},this.options),t(this.options,i),this._create()}function i(t,e){t.x=void 0!==e.pageX?e.pageX:e.clientX,t.y=void 0!==e.pageY?e.pageY:e.clientY}function n(e,i){this.element="string"==typeof e?document.querySelector(e):e,this.$element=$(this.element),this.options=t({},this.options),t(this.options,i),this._create()}for(var o,s=0,r="webkit moz ms o".split(" "),h=window.requestAnimationFrame,p=window.cancelAnimationFrame,a=0;athis.options.helperShowDistance&&(this.helper=this.options.helper?this.options.helper():this.element,this.helper.style.position="absolute",this._getHelperSize(),this.position.x=this.startPosition.x,this.position.y=this.startPosition.y,this.setLeftTop(),this.helper.style.zIndex=this.options.zIndex?this.options.zIndex.toString():this.helper.style.zIndex,this.helper.style.display="block",this.visible=!0,this.$element.trigger("dragStart",[this]),$(".droppable").trigger("drag",[this]),this.animate()),this.position.x=this.startPosition.x+n,this.position.y=this.startPosition.y+o,this.dragPoint.x=n,this.dragPoint.y=o,this.$element.trigger("dragMove",[this])},e.prototype.onmouseup=function(t){this.dragEnd(t,t)},e.prototype.ontouchend=function(t){var e=this._getTouch(t);e&&this.dragEnd(t,e)},e.prototype.onMSPointerUp=e.prototype.onpointerup=function(t){this.pointerIdentifier===t.pointerId&&this.dragEnd(t,t)},e.prototype.dragEnd=function(t,e){return Draggables.isDragging=null,this.isDragging=!1,this.visible=!1,this.pointerIdentifier=null,this._unbindEvents(),!(!this.helper||"none"===this.helper.style.display)&&(g&&(this.helper.style[g]="",this.setLeftTop()),this.options.zIndex&&this.options.initialZIndex&&this.helper&&"none"!==this.helper.style.display&&(this.helper.style.zIndex=this.options.initialZIndex.toString()),this.options.removeHelper&&this.helper.parentNode.removeChild(this.helper),void this.$element.trigger("dragEnd",[this]))},e.prototype.onMSPointerCancel=e.prototype.onpointercancel=function(t){t.pointerId===this.pointerIdentifier&&this.dragEnd(t,t)},e.prototype.ontouchcancel=function(t){var e=this._getTouch(t);e&&this.dragEnd(t,e)},e.prototype.animate=function(){if(this.isDragging){this.positionDrag();var t=this;window.requestAnimationFrame((function(){t.animate()}))}};var f=u?function(t,e){return"translate3d( "+t+"px, "+e+"px, 0)"}:function(t,e){return"translate( "+t+"px, "+e+"px)"};e.prototype.setLeftTop=function(){this.helper.style.left=this.position.x+"px",this.helper.style.top=this.position.y+"px"},e.prototype.positionDrag=g?function(){this.helper.style[g]=f(this.dragPoint.x,this.dragPoint.y)}:e.prototype.setLeftTop,e.prototype.enable=function(){this.isEnabled=!0},e.prototype.disable=function(){this.isEnabled=!1,this.isDragging&&this.dragEnd()},e.prototype.destroy=function(){this.removeHandlerListeners(),this.$element.off()},window.Draggable=e,window.Droppables={isOverPtr:null},n.prototype.options={tolerance:"intersect"},n.prototype._create=function(){this.position={},this.size={},this._getPosition(),this._getSize(),this.isOver=!1,this.blocker=null,this._listen(),this.element.className+=" droppable",this.enabled=!0;var t=this;this.$element.on("resized",(function(e){t._getPosition(),t._getSize()}))},n.prototype._getPosition=function(){var t=l(this.element);if("absolute"===t.position)this.position={x:parseInt(t.left,10),y:parseInt(t.top,10)};else{var e=this.element.getBoundingClientRect();this.position={x:e.left,y:e.top}}},n.prototype._getSize=function(){var t=l(this.element),e=parseInt(t.width,10),i=parseInt(t.height,10);this.size.width=isNaN(e)?0:e,this.size.height=isNaN(i)?0:i},n.prototype._listen=function(){var t=this;this.dragEnd=function(e,i){n.prototype._onDragEnd.apply(t,[e,i])};var e=function(e,i){n.prototype._onDragMove.apply(t,[i,e])};this.$element.on("drag",(function(i,n){return void 0!==n&&void 0!==n.element&&void(t.enabled&&(null!==t.blocker&&t.blocker===n.helper&&(t.blocker=null),t._accept(n.element)&&(n.$element.on("dragMove",e),n.$element.one("dragEnd",t.dragEnd))))})),this.$element.on("dragEnd",(function(e,i){t.element===i.element&&t._getPosition()}))},n.prototype.startListeningToDrag=function(t){var e=this;t.$element.on("dragMove",(function(t,i){n.prototype._onDragMove.apply(e,[i])})),t.$element.one("dragEnd",this.dragEnd)},n.prototype._onDragMove=function(t){if(this.enabled){if(null!==Droppables.isOverPtr&&Droppables.isOverPtr!==this)return;this._checkIntersection(t)?this._over(t):this.isOver&&this._out(t)}else this.destroy()},n.prototype._onDragEnd=function(t,e){if(e.$element.off("dragMove"),null!==this.dragEnd&&e.$element.off("dragEnd",this.dragEnd),this.enabled){if(0==e.dragPoint.x&&0==e.dragPoint.y)return;this.isOver&&null===this.blocker&&this._drop(e)}else this.destroy()},n.prototype._accept=function(t){return!(this.$element.data("ptr")&&this.$element.data("ptr").draggable.isDragging||null===this.$element||this.element===t||this.options.acceptOne&&null!==this.blocker&&(this.element.parentNode.contains(this.blocker)&&this._checkIntersection($(this.blocker).data("ptr").draggable)||(this.blocker=null,0)))},n.prototype._over=function(t){this.isOver=!0,t.isOver=!0,Droppables.isOverPtr=this,this._trigger("droppableOver",t)},n.prototype._out=function(t){this.isOver=!1,t.isOver=!1,Droppables.isOverPtr=null,this.options.acceptOne&&(this.blocker=null),this._trigger("droppableOut",t)},n.prototype._drop=function(t){this.options.acceptOne&&(this.blocker=t.helper),Droppables.isOverPtr=null,this._trigger("droppableDrop",t)},n.prototype._trigger=function(t,e){null!==this.$element?this.$element.trigger(t,[e]):($(document).trigger("draggableDroppedFix",[e]),this.destroy())},n.prototype._checkIntersection=function(t){var e=this.position.x,i=this.position.y,n=e+this.size.width,o=i+this.size.height,s=t.size.width,r=t.size.height,h=t.position.x,p=h+s,a=t.position.y,l=a+r;return"touch"===this.options.tolerance?(a>=i&&a<=o||l>=i&&l<=o||ao)&&(h>=e&&h<=n||p>=e&&p<=n||hn):e)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<%=(.+?)%>/g,"',$1,'").split("<%").join("');").split("%>").join("p.push('")+"');}return p.join('');",n=new Function("obj",i);return e?n(e):n}}();