//>>builtdefine(["require","./_base/kernel","./sniff"],function(z,q,l){functionr(b,c,a,d,e){if(d=c.match(/(.*):(.*)/))returnc=d[2],d=d[1],g.selector(d,c).call(e,b,a);l("touch")&&t.test(c)&&(a=u(a));if(b.addEventListener){varf=cinm,h=f?m[c]:c;b.addEventListener(h,a,f);return{remove:function(){b.removeEventListener(h,a,f)}}}throwError("Target must be an event emitter");}functionv(){this.cancelable=!1;this.defaultPrevented=!0}functionw(){this.bubbles=!1}l("dom")&&l("touch");varg=function(b,c,a,d){return"function"!=typeofb.on||"function"==typeofc||b.nodeType?g.parse(b,c,a,r,d,this):b.on(c,a)};g.pausable=function(b,c,a,d){vare;b=g(b,c,function(){if(!e)returna.apply(this,arguments)},d);b.pause=function(){e=!0};b.resume=function(){e=!1};returnb};g.once=function(b,c,a,d){vare=g(b,c,function(){e.remove();returna.apply(this,arguments)});returne};g.parse=function(b,c,a,d,e,f){varh;if(c.call)returnc.call(f,b,a);cinstanceofArray?h=c:-1<c.indexOf(",")&&(h=c.split(/\s*,\s*/));if(h){vark=[];c=0;for(varn;n=h[c++];)k.push(g.parse(b,n,a,d,e,f));k.remove=function(){for(vara=0;a<k.length;a++)k[a].remove()};returnk}returnd(b,c,a,e,f)};vart=/^touch/;g.matches=function(b,c,a,d,e){e=e&&"function"==typeofe.matches?e:q.query;d=!1!==d;1!=b.nodeType&&(b=b.parentNode);for(;!e.matches(b,c,a);)if(b==a||!1===d||!(b=b.parentNode)||1!=b.nodeType)return!1;returnb};g.selector=function(b,c,a){returnfunction(d,e){functionf(c){returng.matches(c,b,d,a,h)}varh="function"==typeofb?{matches:b}:this,k=c.bubble;returnk?g(d,k(f),e):g(d,c,function(a){varb=f(a.target);if(b)returna.selectorTarget=b,e.call(b,a)})}};varx=[].slice,y=g.emit=function(b,c,a){vard=x.call(arguments,2),e="on"+c;if("parentNode"inb){varf=d[0]={},g;for(gina)f[g]=a[g];f.preventDefault=v;f.stopPropagation=w;f.target=b;f.type=c;a=f}dob[e]&&b[e].apply(b,d);while(a&&a.bubbles&&(b=b.parentNode));returna&&a.cancelable&&a},m={};g.emit=function(b,c,a){if(b.dispatchEvent&&document.createEvent){vard=(b.ownerDocument||document).createEvent("HTMLEvents");d.initEvent(c,!!a.bubbles,!!a.cancelable);for(vareina)eind||(d[e]=a[e]);returnb.dispatchEvent(d)&&d}returny.apply(g,arguments)};if(l("touch"))varp=window.orientation,u=function(b){returnfunction(c){vara=c.corrected;if(!a){vard=c.type;try{deletec.type}catch(h){}if(c.type){vara={},e;for(einc)a[e]=c[e];a.preventDefault=function(){c.preventDefault()};a.stopPropagation=function(){c.stopPropagation()}}elsea=c,a.type=d;c.corrected=a;if("resize"==d){if(p==window.orientation)returnnull;p=window.orientation;a.type="orientationchange";returnb.call(this,a)}"rotation"ina||(a.rotation=0,a.scale=1);if(window.TouchEvent&&cinstanceofTouchEvent){vard=a.changedTouches[0],f;for(find)deletea[f],a[f]=d[f]}}returnb.call(this,a)}};returng});