'use strict';(()=>{$.support.touch='ontouchend'in document;if(!$.support.touch){return;}
const mouseProto=$.ui.mouse.prototype;const{_mouseInit,_mouseDestroy}=mouseProto;let touchHandled;function simulateMouseEvent(event,simulatedType){if(event.originalEvent.touches.length>1){return;}
const touch=event.originalEvent.changedTouches[0];const simulatedEvent=document.createEvent('MouseEvents');if($(touch.target).is('input')||$(touch.target).is('textarea')){event.stopPropagation();}else{event.preventDefault();}
simulatedEvent.initMouseEvent(simulatedType,true,true,window,1,touch.screenX,touch.screenY,touch.clientX,touch.clientY,false,false,false,false,0,null,);event.target.dispatchEvent(simulatedEvent);}
mouseProto._touchStart=function(event){if(touchHandled||!this._mouseCapture(event.originalEvent.changedTouches[0])){return;}
touchHandled=true;this._touchMoved=false;simulateMouseEvent(event,'mouseover');simulateMouseEvent(event,'mousemove');simulateMouseEvent(event,'mousedown');};mouseProto._touchMove=function(event){if(!touchHandled){return;}
this._touchMoved=true;simulateMouseEvent(event,'mousemove');};mouseProto._touchEnd=function(event){if(!touchHandled){return;}
simulateMouseEvent(event,'mouseup');simulateMouseEvent(event,'mouseout');if(!this._touchMoved){simulateMouseEvent(event,'click');}
touchHandled=false;};mouseProto._mouseInit=function(){this.element.on({touchstart:$.proxy(this,'_touchStart'),touchmove:$.proxy(this,'_touchMove'),touchend:$.proxy(this,'_touchEnd'),});_mouseInit.call(this);};mouseProto._mouseDestroy=function(){this.element.off({touchstart:$.proxy(this,'_touchStart'),touchmove:$.proxy(this,'_touchMove'),touchend:$.proxy(this,'_touchEnd'),});_mouseDestroy.call(this);};})();