define(["angular","jquery.tiny","jquery.ripple","jquery.vclick"],function(e,t,$){!function(S,M,v){if(void 0===M)throw Error("angular-jqev: AngularJS is undefined but is necessary.");if(void 0===t)throw Error("angular-jqev: jQuery is undefined but is necessary.");function d(e){var t=v(e);t.on("touchstart",o),t.on("touchend touchcancel",i),r.push(e)}function h(e){var t=v(e);t.off("touchstart",o),t.off("touchend touchcancel",i),t.removeClass("mob");var n=r.indexOf(e);-1<n&&r.splice(n,1)}var n=M.module("hmTouchEvents",[]),r=[],o=function(e){if(!(-1<e.originalEvent.type.indexOf("mouse"))){var t=this;setTimeout(function(){a||(v(t).addClass("mob"),e.originalEvent.type.indexOf("mouse")<0?v(t).addClass("touch"):v(t).removeClass("touch"))})}},i=function(){var e=this;setTimeout(function(){v(e).removeClass("touch")},80)},a=!1;v(S).on("scrollstart",function(){for(var e in a=!0,r)v(r[e]).removeClass("touch")}),v(S).on("scrollstop",function(){a=!1}),v(S).on("scrollend",function(){a=!1}),v(document).on("touchend touchcancel",function(){for(var e in r)setTimeout(function(){v(r[e]).removeClass("touch")},80)}),M.forEach(["hmTap:vclick","vClick:vclick","vMouseover:vmouseover","vMouseout:vmouseout","vMousedown:vmousedown"],function(e){var t=e.split(":"),f=t[0],m=t[1];n.directive(f,["$parse","$window","$viewport","$timeout",function(u,e,i,p){return{restrict:"A",scope:!1,priority:1,link:function(a,s,c){function e(e){e.element=s;var t=u(c[f]).bind(null,a);if(l.ripple||l.delay){function n(){e.isPropagationStopped()||t({$event:e,$element:s})}"delay"in l&&!l.delay?(n(),e.isPropagationStopped()||(a.$$phase?a.$applyAsync(i):a.$apply())):p(n,l.delay||100)}else if(!e.isPropagationStopped()){var r;if(e.target&&e.target.tagName){var o=e.target.tagName.toLowerCase();r="label"==o||"input"==o}if(r||l.direct){var i=function(){t({$event:e,$element:s})};a.$$phase?a.$applyAsync(i):(i(),a.$apply())}else a.$applyAsync(function(){t({$event:e,$element:s})})}}var t=c.hmOptions&&M.isObject(a.$eval(c.hmOptions))?a.$eval(c.hmOptions):{},n=i.data("android"),l=M.extend({normal:!1,ripple:n,delay:n?100:0},t);n&&"androiddelay"in l&&(l.delay=l.androiddelay);var r=l.normal&&"vclick"==m?"click":m;if(s&&0<s.length){h(s),"vclick"==r&&(l.ripple?($.add(s,"center"==l.ripple),s.addClass("a-ripple")):d(s)),v(s).on(r,e);function o(){v(s).off(r,e),"vclick"==r&&(h(s),l.ripple&&($.remove(s),s.removeClass("a-ripple")))}a.$on("$destroy",o),s.one("$destroy",o)}}}}])}),n.directive("hmUrl",["$parse","$httpParamSerializer","$timeout",function(t,f,r){return{restrict:"A",scope:!1,link:function(a,s,c){function e(e){e.preventDefault()}var l=t(c.hmUrlClicked).bind(null,a),u=t(c.hmUrlIntercept).bind(null,a),n=t(c.hmUrlChange).bind(null,a),p=a.$eval(c.hmUrl);a.$on("$destroy",function(){s.off("vclick").off("click",e)}),s.one("$destroy",function(){s.off("vclick").off("click",e)}),s.on("vclick",function(t){var e=a.$eval(c.hmUrlParams),n=s.attr("href")||"",r=s.attr("target")||"_parent";if(e){e=f(e);var o,i=n;-1<n.indexOf("#")&&(o=(i=n.split("#"))[1],n=i[0]),e&&(-1<n.indexOf("?")?n+="&"+e:n+="?"+e),o&&(n+="#"+o)}try{t.preventDefault()}catch(e){}p&&t.stopPropagation(),a.$applyAsync(function(){var e=u({$link:n});"boolean"==typeof e&&!e||(l({$event:t,$url:n}),S.open(n,r))})}).on("click",e),c.hmUrlChange&&"ngHref"in c&&a.$watch(function(e){return c.ngHref},function(t){r(function(){var e=n({$url:t});s.attr("href",e)})})}}}]),n.directive("hmHighlight",["$viewport",function(i){return{restrict:"A",scope:!1,priority:1,link:function(e,t,n){var r=n.hmHighlight&&M.isObject(e.$eval(n.hmHighlight))?e.$eval(n.hmHighlight):{},o=M.extend({ripple:i.data("android")},r);d(t),o.ripple?$.add(t,"center"==o.ripple):d(t),e.$on("$destroy",function(){o.ripple?$.remove(t):h(t)}),t.one("$destroy",function(){o.ripple?$.remove(t):h(t)})}}}]).directive("hmSwipeRemove",["$parse","$animateCss","$document",function(x,e,C){return{restrict:"A",scope:!1,link:function(i,e,t){var a,s=x(t.hmSwipeRemove).bind(null,i),c=M.merge({direction:"right",enabled:!0,minspeed:180,maxspeed:100},i.$eval(t.hmSwipeRemoveOptions)),l=e,u={x:0,perc:0,prev:!1,prevent:!1},p={},n=c.enabled,f=c.direction,m=c.maxspeed,v=c.maxspeed;if(n){function d(e){e.stopPropagation()}function r(e){clearTimeout($),C.off("vmousemove",w);var t=(new Date).getTime(),n=Math.max(0,v-Math.round(100*(t-y))/100);if(p.started){if(a){a.removeClass("grab");function r(e){var t=Math.max(v,e||Math.min(m,n));a.animate3({translate3d:o+"%,0,0"},{duration:t,complete:function(){l.css({"transition-duration":"0s","-webkit-transition-duration":"0s"}),i.$applyAsync(function(){s()}),setTimeout(function(){l.css({transform:"","-webkit-transform":"","transition-duration":"","-webkit-transition-duration":""})})}})}var o="left"==f?-100:100;"left"==f&&-70<u.perc||"right"==f&&u.perc<70?(a.removeClass("grab reset"),g?r():a.animate3({translate3d:"0%,0,0"},{duration:m,complete:function(){l.css({transform:"","-webkit-transform":""})}}),u.perc=0,u.x=0,u.prev=0):(r(m),a.removeClass("grab reset"),c.keep||a.triggerHandler("$destroy")),l.oneFirst("click",d),a=!1}p.started=!1}}function o(){c["max-window-size"];var e=S.innerWidth;b=e<=880}var h,$,g=!1,y=0,w=function(e){if(a&&!(Math.abs(e.clientX-p.startX)<30))if(25<=Math.abs(e.clientY-p.startY)&&!p.started)C.off("vmousemove",w);else{p.started=!0,e.preventDefault(),a.removeClass("reset"),a.addClass("grab"),M.element(S).trigger("scrollstart");var t=e.clientX;u.prev||(u.prev=t),u.x+=t-u.prev,u.perc=100*u.x/S.innerWidth,"left"==f?(0<u.x&&(u.x=0),0<u.perc&&(u.perc=0)):(u.x<0&&(u.x=0),u.perc<0&&(u.perc=0)),a.css({transform:"translate3d("+u.perc+"%,0,0)","-webkit-transform":"translate3d("+u.perc+"%,0,0)"}),clearTimeout(h),g="left"==f?t<u.prev:t>u.prev,h=setTimeout(function(){g=!1},200),y=y||(new Date).getTime(),$=setTimeout(function(){y=(new Date).getTime()},v),u.prev=t}},b=!0;l.addClass("touch-element-swipeh-cl"),l.on("vmousedown",function(e){if(!b)return!0;e.button&&2==e.button||((a=l).off("click",d),C.on("vmousemove",w),p.startX=e.clientX,p.startY=e.clientY)}),l.on("vmouseup",r),C.on("vmouseup",r),l.on("$destroy",function(){l.off("vmousedown").off("vmouseup"),C.off("vmouseup",r).off("vmousemove",w),l.removeClass("grab reset").removeClass("touch-element-swipeh-cl"),M.element(S).off("resize",o)}),c["max-window-size"]&&(M.element(S).on("resize",o),o()),i.$on("$destroy",function(){l.triggerHandler("$destroy"),M.element(S).off("resize",o)})}}}}]).directive("hmSwipe",["$parse","$animateCss","$document",function(T,e,A){return{restrict:"A",scope:!1,link:function(n,e,t){var r,o=T(t.hmSwipe).bind(null,n),i=T(t.hmSwipeThreshold).bind(null,n),a=T(t.hmSwipeThresholdReset).bind(null,n),s=T(t.hmSwipeStart).bind(null,n),c=T(t.hmSwipeEnd).bind(null,n),l=M.merge({direction:"both",enabled:!0,minspeed:180,maxspeed:100,threshold:70},n.$eval(t.hmSwipeOptions)),u=e,p={x:0,perc:0,prev:!1,prevent:!1},f={},m=l.enabled,v=l.direction,d=(l.maxspeed,l.maxspeed);if(!m)return!1;function h(e){e.stopPropagation()}function $(e){clearTimeout(w),A.off("vmousemove",C);var t=(new Date).getTime();Math.max(0,d-Math.round(100*(t-x))/100),f.started&&(r&&(r.removeClass("grab"),"left"==v&&p.perc>-1*l.threshold||"right"==v&&p.perc<l.threshold?(r.removeClass("grab reset"),b?n.$applyAsync(function(){i({$event:e,$moved:p.perc})}):n.$applyAsync(function(){a({$event:e,$moved:p.perc})}),p.perc=0,p.x=0,p.prev=0):(r.removeClass("grab reset"),n.$applyAsync(function(){i({$event:e,$moved:p.perc})})),u.oneFirst("click",h),r=!1),f.started=!1,n.$applyAsync(function(){c({$event:e})}))}function g(){var e=l["max-window-size"],t=S.innerWidth;k=!e||t<=e}var y,w,b=!1,x=0,C=function(e){if(r&&!(Math.abs(e.clientX-f.startX)<30))if(25<=Math.abs(e.clientY-f.startY)&&!f.started)A.off("vmousemove",C);else{f.started||n.$applyAsync(function(){s({$event:e})}),f.started=!0,e.preventDefault(),r.removeClass("reset"),r.addClass("grab"),M.element(S).trigger("scrollstart");var t=e.clientX;p.prev||(p.prev=t),p.x+=t-p.prev,p.perc=100*p.x/S.innerWidth,"left"==v?(0<p.x&&(p.x=0),0<p.perc&&(p.perc=0)):"right"==v&&(p.x<0&&(p.x=0),p.perc<0&&(p.perc=0)),n.$applyAsync(function(){o({$event:e,$moved:p.perc})}),clearTimeout(y),b="left"==v?t<p.prev:"right"==v?t>p.prev:t!=p.prev,y=setTimeout(function(){b=!1},200),x=x||(new Date).getTime(),w=setTimeout(function(){x=(new Date).getTime()},d),p.prev=t}},k=!0;u.addClass("touch-element-swipeh-cl"),u.on("vmousedown",function(e){if(!k)return!0;e.button&&2==e.button||((r=u).off("click",h),A.on("vmousemove",C),f.startX=e.clientX,f.startY=e.clientY)}),u.on("vmouseup",$),A.on("vmouseup",$),u.on("$destroy",function(){u.off("vmousedown").off("vmouseup"),A.off("vmouseup",$).off("vmousemove",C),u.removeClass("grab reset").removeClass("touch-element-swipeh-cl"),M.element(S).off("resize",g)}),l["max-window-size"]&&(M.element(S).on("resize",g),g()),n.$on("$destroy",function(){u.triggerHandler("$destroy"),M.element(S).off("resize",g)})}}}])}(window,e,t)});