+function(n){"use strict";var t,i;if(!n.fn.carousel)throw new Error("carousel-swipe required bootstrap carousel");t=function(i){this.$element=n(i);this.carousel=this.$element.data("bs.carousel");this.options=n.extend({},t.DEFAULTS,this.carousel.options);this.startX=this.startY=this.startTime=this.cycling=this.$active=this.$items=this.$next=this.$prev=this.dx=null;this.sliding=!1;this.$element.on("touchstart",n.proxy(this.touchstart,this)).on("touchmove",n.proxy(this.touchmove,this)).on("touchend",n.proxy(this.touchend,this)).on("slide.bs.carousel",n.proxy(this.sliding,this)).on("slid.bs.carousel",n.proxy(this.stopSliding,this))};t.DEFAULTS={swipe:50};t.prototype.sliding=function(){this.sliding=!0};t.prototype.stopSliding=function(){this.sliding=!1};t.prototype.touchstart=function(n){if(!this.sliding&&this.options.swipe){var t=n.originalEvent.touches?n.originalEvent.touches[0]:n;this.dx=0;this.startX=t.pageX;this.startY=t.pageY;this.cycling=null;this.width=this.$element.width();this.startTime=n.timeStamp}};t.prototype.touchmove=function(n){if(!this.sliding&&this.options.swipe){var t=n.originalEvent.touches?n.originalEvent.touches[0]:n,i=t.pageX-this.startX,r=t.pageY-this.startY;Math.abs(i)<Math.abs(r)||(this.cycling===null&&(this.cycling=!!this.carousel.interval,this.cycling&&this.carousel.pause()),n.preventDefault(),this.dx=i/(this.width||1)*100,this.swipe(this.dx))}};t.prototype.touchend=function(t){if(!this.sliding&&this.options.swipe&&this.$active){var i=n().add(this.$active).add(this.$prev).add(this.$next).carousel_transition(!0),u=(t.timeStamp-this.startTime)/1e3,r=Math.abs(this.dx/u);this.dx>40||this.dx>0&&r>this.options.swipe?this.carousel.prev():this.dx<-40||this.dx<0&&r>this.options.swipe?this.carousel.next():this.$active.one(n.support.transition.end,function(){i.removeClass("prev next")}).emulateTransitionEnd(this.$active.css("transition-duration").slice(0,-1)*1e3);i.css("transform","");this.cycling&&this.carousel.cycle();this.$active=null}};t.prototype.swipe=function(n){var t=this.$active||this.getActive();if(n<0){if(this.$prev.css("transform","translate3d(0,0,0)").removeClass("prev").carousel_transition(!0),!this.$next.length||this.$next.hasClass("active"))return;this.$next.carousel_transition(!1).addClass("next").css("transform","translate3d("+(n+100)+"%,0,0)")}else{if(this.$next.css("transform","").removeClass("next").carousel_transition(!0),!this.$prev.length||this.$prev.hasClass("active"))return;this.$prev.carousel_transition(!1).addClass("prev").css("transform","translate3d("+(n-100)+"%,0,0)")}t.carousel_transition(!1).css("transform","translate3d("+n+"%, 0, 0)")};t.prototype.getActive=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$next=this.$active.next(),!this.$next.length&&this.options.wrap&&(this.$next=this.$items.first()),this.$prev=this.$active.prev(),!this.$prev.length&&this.options.wrap&&(this.$prev=this.$items.last()),this.$active};i=n.fn.carousel;n.fn.carousel=function(){return i.apply(this,arguments),this.each(function(){var i=n(this),r=i.data("bs.carousel.swipe");r||i.data("bs.carousel.swipe",new t(this))})};n.extend(n.fn.carousel,i);n.fn.carousel_transition=function(t){return t=t?"":"none",this.each(function(){n(this).css("-webkit-transition",t).css("transition",t)})}}(jQuery)