function Swipe(a,b){"use strict";function m(){var c,d;for(g=f.children,j=g.length,g.length<2&&(b.continuous=!1),e.transitions&&b.continuous&&g.length<3&&(f.appendChild(g[0].cloneNode(!0)),f.appendChild(f.children[1].cloneNode(!0)),g=f.children),h=new Array(g.length),i=a.getBoundingClientRect().width||a.offsetWidth,f.style.width=g.length*i+"px",c=g.length;c--;)d=g[c],d.style.width=i+"px",d.setAttribute("data-index",c),e.transitions&&(d.style.left=c*-i+"px",r(c,k>c?-i:c>k?i:0,0));b.continuous&&e.transitions&&(r(p(k-1),-i,0),r(p(k+1),i,0)),e.transitions||(f.style.left=k*-i+"px"),a.style.visibility="visible"}function n(){b.continuous?q(k-1):k&&q(k-1)}function o(){b.continuous?q(k+1):kk?a:k)-m-1),i*f,0);a=p(a),r(k,i*f,c||l),r(a,0,c||l),b.continuous&&r(p(a-f),-(i*f),0)}else a=p(a),t(k*-i,a*-i,c||l);k=a,d(b.callback&&b.callback(k,g[k]))}}function r(a,b,c){s(a,b,c),h[a]=b}function s(a,b,c){var d=g[a],e=d&&d.style;e&&(e.webkitTransitionDuration=e.MozTransitionDuration=e.msTransitionDuration=e.OTransitionDuration=e.transitionDuration=c+"ms",e.webkitTransform="translate("+b+"px,0)"+"translateZ(0)",e.msTransform=e.MozTransform=e.OTransform="translateX("+b+"px)")}function t(a,c,d){var e,h;return d?(e=+new Date,h=setInterval(function(){var i=+new Date-e;return i>d?(f.style.left=c+"px",u&&w(),b.transitionEnd&&b.transitionEnd.call(event,k,g[k]),clearInterval(h),void 0):(f.style.left=(c-a)*(Math.floor(100*(i/d))/100)+a+"px",void 0)},4),void 0):(f.style.left=c+"px",void 0)}function w(){v=setTimeout(o,u)}function x(){u=0,clearTimeout(v)}var f,g,h,i,j,k,l,u,v,y,z,A,B,c=function(){},d=function(a){setTimeout(a||c,0)},e={addEventListener:!!window.addEventListener,touch:"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,transitions:function(a){var c,b=["transitionProperty","WebkitTransition","MozTransition","OTransition","msTransition"];for(c in b)if(void 0!==a.style[b[c]])return!0;return!1}(document.createElement("swipe"))};if(a)return f=a.children[0],b=b||{},k=parseInt(b.startSlide,10)||0,l=b.speed||300,b.continuous=void 0!==b.continuous?b.continuous:!0,u=b.auto||0,y={},z={},B={handleEvent:function(a){switch(a.type){case"touchstart":this.start(a);break;case"touchmove":this.move(a);break;case"touchend":d(this.end(a));break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":d(this.transitionEnd(a));break;case"resize":d(m)}b.stopPropagation&&a.stopPropagation()},start:function(a){var b=a.touches[0];y={x:b.pageX,y:b.pageY,time:+new Date},A=void 0,z={},f.addEventListener("touchmove",this,!1),f.addEventListener("touchend",this,!1)},move:function(a){if(!(a.touches.length>1||a.scale&&1!==a.scale)){b.disableScroll&&a.preventDefault();var c=a.touches[0];z={x:c.pageX-y.x,y:c.pageY-y.y},"undefined"==typeof A&&(A=!!(A||Math.abs(z.x)0||k==g.length-1&&z.x<0?Math.abs(z.x)/i+1:1),s(k-1,z.x+h[k-1],0),s(k,z.x+h[k],0),s(k+1,z.x+h[k+1],0)))}},end:function(){var j,c=+new Date-y.time,d=Number(c)<250&&Math.abs(z.x)>20||Math.abs(z.x)>i/2,e=!k&&z.x>0||k==g.length-1&&z.x<0;b.continuous&&(e=!1),j=z.x<0,A||(d&&!e?(j?(b.continuous?(r(p(k-1),-i,0),r(p(k+2),i,0)):r(k-1,-i,0),r(k,h[k]-i,l),r(p(k+1),h[p(k+1)]-i,l),k=p(k+1)):(b.continuous?(r(p(k+1),i,0),r(p(k-2),-i,0)):r(k+1,i,0),r(k,h[k]+i,l),r(p(k-1),h[p(k-1)]+i,l),k=p(k-1)),b.callback&&b.callback(k,g[k])):b.continuous?(r(p(k-1),-i,l),r(k,0,l),r(p(k+1),i,l)):(r(k-1,-i,l),r(k,0,l),r(k+1,i,l))),f.removeEventListener("touchmove",B,!1),f.removeEventListener("touchend",B,!1)},transitionEnd:function(a){parseInt(a.target.getAttribute("data-index"),10)==k&&(u&&w(),b.transitionEnd&&b.transitionEnd.call(a,k,g[k]))}},m(),u&&w(),e.addEventListener?(e.touch&&f.addEventListener("touchstart",B,!1),e.transitions&&(f.addEventListener("webkitTransitionEnd",B,!1),f.addEventListener("msTransitionEnd",B,!1),f.addEventListener("oTransitionEnd",B,!1),f.addEventListener("otransitionend",B,!1),f.addEventListener("transitionend",B,!1)),window.addEventListener("resize",B,!1)):window.onresize=function(){m()},{setup:function(){m()},slide:function(a,b){x(),q(a,b)},prev:function(){x(),n()},next:function(){x(),o()},stop:function(){x()},getPos:function(){return k},getNumSlides:function(){return j},kill:function(){var a,b;for(x(),f.style.width="",f.style.left="",a=g.length;a--;)b=g[a],b.style.width="",b.style.left="",e.transitions&&s(a,0,0);e.addEventListener?(f.removeEventListener("touchstart",B,!1),f.removeEventListener("webkitTransitionEnd",B,!1),f.removeEventListener("msTransitionEnd",B,!1),f.removeEventListener("oTransitionEnd",B,!1),f.removeEventListener("otransitionend",B,!1),f.removeEventListener("transitionend",B,!1),window.removeEventListener("resize",B,!1)):window.onresize=null}}}(window.jQuery||window.Zepto)&&function(a){a.fn.Swipe=function(b){return this.each(function(){a(this).data("Swipe",new Swipe(a(this)[0],b))})}}(window.jQuery||window.Zepto);