(function(){"use strict";function e(e,t){t.support.touch="ontouchend"in document;if(!t.support.touch){return}var o=t.ui.mouse.prototype;var u=o._mouseInit;var n=o._mouseDestroy;var r;function c(t,o,u){if(t.originalEvent.touches.length>1){return}if(!u){u=t.target}t.preventDefault();var n=t.originalEvent.changedTouches[0];var r=document.createEvent("MouseEvents");r.initMouseEvent(o,true,true,e,1,n.screenX,n.screenY,n.clientX,n.clientY,false,false,false,false,0,null);r.simulated="touchpunch";u.dispatchEvent(r)}o._touchStart=function(e){var t=this;if(r||!t._mouseCapture(e.originalEvent.changedTouches[0])){return}r=true;t._touchMoved=false;this._overElement=i(e);c(e,"mouseover");c(e,"mousemove");c(e,"mousedown")};o._touchMove=function(e){if(!r){return}var t=i(e);if(t!=this._overElement){c(e,"mouseout",this._overElement);c(e,"mouseover",t);this._overElement=t}this._touchMoved=true;c(e,"mousemove")};o._touchEnd=function(e){if(!r){return}c(e,"mouseup");c(e,"mouseout");if(!this._touchMoved){c(e,"click")}r=false};o._mouseInit=function(){var e=this;e.element.bind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")});u.call(e)};o._mouseDestroy=function(){var e=this;e.element.unbind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")});n.call(e)};function i(t){var o=t.originalEvent.changedTouches[0];return e.document.elementFromPoint(o.clientX,o.clientY)}}u8.Base._Window.extend("jquery.touchPunch",function(t){var o=t.$;if(o){e(t,o)}})})();