/*
	Copyright (c) 2004-2016, The JS Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

//>>built
define("dojo/touch","./_base/kernel ./aspect ./dom ./dom-class ./_base/lang ./on ./has ./mouse ./domReady ./_base/window".split(" "),function(M,D,E,v,N,h,r,t,F,e){function q(b,c,d){return z&&d?function(m,n){return h(m,d,n)}:O?function(m,n){var a=h(m,c,function(f){n.call(this,f);u=(new Date).getTime()}),g=h(m,b,function(f){(!u||(new Date).getTime()>u+1E3)&&n.call(this,f)});return{remove:function(){a.remove();g.remove()}}}:function(m,n){return h(m,b,n)}}function P(b){do if(void 0!==b.dojoClick)return b;
while(b=b.parentNode)}function G(b,c,d){if(!t.isRight(b)){var m=P(b.target);if(k=!b.target.disabled&&m&&m.dojoClick)if(x=(w="useTarget"==k)?m:b.target,w&&b.preventDefault(),H=b.changedTouches?b.changedTouches[0].pageX-e.global.pageXOffset:b.clientX,I=b.changedTouches?b.changedTouches[0].pageY-e.global.pageYOffset:b.clientY,J=("object"==typeof k?k.x:"number"==typeof k?k:0)||4,K=("object"==typeof k?k.y:"number"==typeof k?k:0)||4,!L){L=!0;var n=function(a){k=w?E.isDescendant(e.doc.elementFromPoint(a.changedTouches?
a.changedTouches[0].pageX-e.global.pageXOffset:a.clientX,a.changedTouches?a.changedTouches[0].pageY-e.global.pageYOffset:a.clientY),x):k&&(a.changedTouches?a.changedTouches[0].target:a.target)==x&&Math.abs((a.changedTouches?a.changedTouches[0].pageX-e.global.pageXOffset:a.clientX)-H)<=J&&Math.abs((a.changedTouches?a.changedTouches[0].pageY-e.global.pageYOffset:a.clientY)-I)<=K};e.doc.addEventListener(c,function(a){t.isRight(a)||(n(a),w&&a.preventDefault())},!0);e.doc.addEventListener(d,function(a){if(!t.isRight(a)&&
(n(a),k)){A=(new Date).getTime();var g=w?x:a.target;"LABEL"===g.tagName&&(g=E.byId(g.getAttribute("for"))||g);var f=a.changedTouches?a.changedTouches[0]:a,C=function(Q){var B=document.createEvent("MouseEvents");B._dojo_click=!0;B.initMouseEvent(Q,!0,!0,a.view,a.detail,f.screenX,f.screenY,f.clientX,f.clientY,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,0,null);return B},R=C("mousedown"),S=C("mouseup"),T=C("click");setTimeout(function(){h.emit(g,"mousedown",R);h.emit(g,"mouseup",S);h.emit(g,"click",T);A=
(new Date).getTime()},0)}},!0);b=function(a){e.doc.addEventListener(a,function(g){var f=g.target;k&&!g._dojo_click&&(new Date).getTime()<=A+1E3&&("INPUT"!=f.tagName||!v.contains(f,"dijitOffScreen"))&&(g.stopPropagation(),g.stopImmediatePropagation&&g.stopImmediatePropagation(),"click"==a&&("INPUT"!=f.tagName||"radio"==f.type&&(v.contains(f,"dijitCheckBoxInput")||v.contains(f,"mblRadioButton"))||"checkbox"==f.type&&(v.contains(f,"dijitCheckBoxInput")||v.contains(f,"mblCheckBox")))&&"TEXTAREA"!=f.tagName&&
"AUDIO"!=f.tagName&&"VIDEO"!=f.tagName&&g.preventDefault())},!0)};b("click");b("mousedown");b("mouseup")}}}var y=5>r("ios"),z=r("pointer-events")||r("MSPointer"),l=function(){var b={},c;for(c in{down:1,move:1,up:1,cancel:1,over:1,out:1})b[c]=r("MSPointer")?"MSPointer"+c.charAt(0).toUpperCase()+c.slice(1):"pointer"+c;return b}(),O=r("touch-events"),L,k,w=!1,x,H,I,J,K,A,u,p;r("touch")&&(z?F(function(){e.doc.addEventListener(l.down,function(b){G(b,l.move,l.up)},!0)}):F(function(){function b(c){var d=
N.delegate(c,{bubbles:!0});6<=r("ios")&&(d.touches=c.touches,d.altKey=c.altKey,d.changedTouches=c.changedTouches,d.ctrlKey=c.ctrlKey,d.metaKey=c.metaKey,d.shiftKey=c.shiftKey,d.targetTouches=c.targetTouches);return d}p=e.body();e.doc.addEventListener("touchstart",function(c){u=(new Date).getTime();var d=p;p=c.target;h.emit(d,"dojotouchout",{relatedTarget:p,bubbles:!0});h.emit(p,"dojotouchover",{relatedTarget:d,bubbles:!0});G(c,"touchmove","touchend")},!0);h(e.doc,"touchmove",function(c){u=(new Date).getTime();
var d=e.doc.elementFromPoint(c.pageX-(y?0:e.global.pageXOffset),c.pageY-(y?0:e.global.pageYOffset));d&&(p!==d&&(h.emit(p,"dojotouchout",{relatedTarget:d,bubbles:!0}),h.emit(d,"dojotouchover",{relatedTarget:p,bubbles:!0}),p=d),h.emit(d,"dojotouchmove",b(c))||c.preventDefault())});h(e.doc,"touchend",function(c){u=(new Date).getTime();var d=e.doc.elementFromPoint(c.pageX-(y?0:e.global.pageXOffset),c.pageY-(y?0:e.global.pageYOffset))||e.body();h.emit(d,"dojotouchend",b(c))})}));D={press:q("mousedown",
"touchstart",l.down),move:q("mousemove","dojotouchmove",l.move),release:q("mouseup","dojotouchend",l.up),cancel:q(t.leave,"touchcancel",z?l.cancel:null),over:q("mouseover","dojotouchover",l.over),out:q("mouseout","dojotouchout",l.out),enter:t._eventHandler(q("mouseover","dojotouchover",l.over)),leave:t._eventHandler(q("mouseout","dojotouchout",l.out))};return M.touch=D});