!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("ngx-bootstrap/utils"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-bootstrap/carousel",["exports","@angular/core","ngx-bootstrap/utils","@angular/common"],t):t(((e=e||self)["ngx-bootstrap"]=e["ngx-bootstrap"]||{},e["ngx-bootstrap"].carousel={}),e.ng.core,e.utils,e.ng.common)}(this,function(e,t,i,s){"use strict";function n(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,n,r=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return o}function r(){for(var e=[],t=0;tthis.itemsPerSlide&&this.play()},e.prototype.removeSlide=function(e){var t=this,i=this._slides.indexOf(e);if(this._currentActiveSlide===i){var s=void 0;this._slides.length>1&&(s=this.isLast(i)?this.noWrap?i-1:0:i),this._slides.remove(i),setTimeout(function(){t._select(s)},0)}else{this._slides.remove(i);var n=this.getCurrentSlideIndex();setTimeout(function(){t._currentActiveSlide=n,t.activeSlideChange.emit(t._currentActiveSlide)},0)}},e.prototype.nextSlideFromInterval=function(e){void 0===e&&(e=!1),this.move(l.NEXT,e)},e.prototype.nextSlide=function(e){void 0===e&&(e=!1),this.isPlaying&&this.restartTimer(),this.move(l.NEXT,e)},e.prototype.previousSlide=function(e){void 0===e&&(e=!1),this.isPlaying&&this.restartTimer(),this.move(l.PREV,e)},e.prototype.getFirstVisibleIndex=function(){return this.slides.findIndex(this.getActive)},e.prototype.getLastVisibleIndex=function(){return function(e,t){for(var i=e.length;i--;)if(t(e[i],i,e))return i;return-1}(this.slides,this.getActive)},e.prototype.move=function(e,t){void 0===t&&(t=!1);var i=this.getFirstVisibleIndex(),s=this.getLastVisibleIndex();this.noWrap&&(e===l.NEXT&&this.isLast(s)||e===l.PREV&&0===i)||(this.multilist?this.moveMultilist(e):this.activeSlide=this.findNextSlideIndex(e,t))},e.prototype.keydownPress=function(e){if(13===e.keyCode||"Enter"===e.key||32===e.keyCode||"Space"===e.key)return this.nextSlide(),void e.preventDefault();37!==e.keyCode&&"LeftArrow"!==e.key?39!==e.keyCode&&"RightArrow"!==e.key||this.nextSlide():this.previousSlide()},e.prototype.onMouseLeave=function(){this.pauseOnFocus||this.play()},e.prototype.onMouseUp=function(){this.pauseOnFocus||this.play()},e.prototype.pauseFocusIn=function(){this.pauseOnFocus&&(this.isPlaying=!1,this.resetTimer())},e.prototype.pauseFocusOut=function(){this.play()},e.prototype.selectSlide=function(e){this.isPlaying&&this.restartTimer(),this.multilist?this.selectSlideRange(this.indicatorsByChunk?e*this.itemsPerSlide:e):this.activeSlide=this.indicatorsByChunk?e*this.itemsPerSlide:e},e.prototype.play=function(){this.isPlaying||(this.isPlaying=!0,this.restartTimer())},e.prototype.pause=function(){this.noPause||(this.isPlaying=!1,this.resetTimer())},e.prototype.getCurrentSlideIndex=function(){return this._slides.findIndex(this.getActive)},e.prototype.isLast=function(e){return e+1>=this._slides.length},e.prototype.isFirst=function(e){return 0===e},e.prototype.indicatorsSlides=function(){var e=this;return this.slides.filter(function(t,i){return!e.indicatorsByChunk||i%e.itemsPerSlide==0})},e.prototype.selectInitialSlides=function(){var e=this.startFromIndex<=this._slides.length?this.startFromIndex:0;if(this.hideSlides(),this.singleSlideOffset){if(this._slidesWithIndexes=this.mapSlidesAndIndexes(),this._slides.length-e0?this._currentActiveSlide-1:!t&&this.noWrap?this._currentActiveSlide:this._slides.length-1;break;default:throw new Error("Unknown direction")}return i}},e.prototype.mapSlidesAndIndexes=function(){return this.slides.slice().map(function(e,t){return{index:t,item:e}})},e.prototype.selectSlideRange=function(e){if(!this.isIndexInRange(e)){if(this.hideSlides(),this.singleSlideOffset){var t=this.isIndexOnTheEdges(e)?e:e-this.itemsPerSlide+1,i=this.isIndexOnTheEdges(e)?e+this.itemsPerSlide:e+1;this._slidesWithIndexes=this.mapSlidesAndIndexes().slice(t,i),this.makeSlidesConsistent(this._slidesWithIndexes),this._slidesWithIndexes.forEach(function(e){return e.item.active=!0})}else this.selectRangeByNestedIndex(e);this.slideRangeChange.emit(this.getVisibleIndexes())}},e.prototype.selectRangeByNestedIndex=function(e){var t=this._chunkedSlides.map(function(e,t){return{index:t,list:e}}).find(function(t){return void 0!==t.list.find(function(t){return t.index===e})});this._currentVisibleSlidesIndex=t.index,this._chunkedSlides[t.index].forEach(function(e){e.item.active=!0})},e.prototype.isIndexOnTheEdges=function(e){return e+1-this.itemsPerSlide<=0||e+this.itemsPerSlide<=this._slides.length},e.prototype.isIndexInRange=function(e){return this.singleSlideOffset?this._slidesWithIndexes.map(function(e){return e.index}).indexOf(e)>=0:e<=this.getLastVisibleIndex()&&e>=this.getFirstVisibleIndex()},e.prototype.hideSlides=function(){this.slides.forEach(function(e){return e.active=!1})},e.prototype.isVisibleSlideListLast=function(){return this._currentVisibleSlidesIndex===this._chunkedSlides.length-1},e.prototype.isVisibleSlideListFirst=function(){return 0===this._currentVisibleSlidesIndex},e.prototype.moveSliderByOneItem=function(e){var t,i,s,n;if(this.noWrap){t=this.getFirstVisibleIndex(),i=this.getLastVisibleIndex(),s=e===l.NEXT?t:i,n=e!==l.NEXT?t-1:this.isLast(i)?0:i+1,this._slides.get(s).active=!1,this._slides.get(n).active=!0;var o=this.mapSlidesAndIndexes().filter(function(e){return e.item.active});this.makeSlidesConsistent(o),this.slideRangeChange.emit(this.getVisibleIndexes())}else{var d=void 0;t=this._slidesWithIndexes[0].index,i=this._slidesWithIndexes[this._slidesWithIndexes.length-1].index,e===l.NEXT?(this._slidesWithIndexes.shift(),d=this.isLast(i)?0:i+1,this._slidesWithIndexes.push({index:d,item:this._slides.get(d)})):(this._slidesWithIndexes.pop(),d=this.isFirst(t)?this._slides.length-1:t-1,this._slidesWithIndexes=r([{index:d,item:this._slides.get(d)}],this._slidesWithIndexes)),this.hideSlides(),this._slidesWithIndexes.forEach(function(e){return e.item.active=!0}),this.makeSlidesConsistent(this._slidesWithIndexes),this.slideRangeChange.emit(this._slidesWithIndexes.map(function(e){return e.index}))}},e.prototype.moveMultilist=function(e){this.singleSlideOffset?this.moveSliderByOneItem(e):(this.hideSlides(),this.noWrap?this._currentVisibleSlidesIndex=e===l.NEXT?this._currentVisibleSlidesIndex+1:this._currentVisibleSlidesIndex-1:e===l.NEXT?this._currentVisibleSlidesIndex=this.isVisibleSlideListLast()?0:this._currentVisibleSlidesIndex+1:this._currentVisibleSlidesIndex=this.isVisibleSlideListFirst()?this._chunkedSlides.length-1:this._currentVisibleSlidesIndex-1,this._chunkedSlides[this._currentVisibleSlidesIndex].forEach(function(e){return e.item.active=!0}),this.slideRangeChange.emit(this.getVisibleIndexes()))},e.prototype.getVisibleIndexes=function(){return this.singleSlideOffset?this._slidesWithIndexes.map(function(e){return e.index}):this._chunkedSlides[this._currentVisibleSlidesIndex].map(function(e){return e.index})},e.prototype._select=function(e){if(isNaN(e))this.pause();else{if(!this.multilist){var t=this._slides.get(this._currentActiveSlide);t&&(t.active=!1)}var i=this._slides.get(e);i&&(this._currentActiveSlide=e,i.active=!0,this.activeSlide=e,this.activeSlideChange.emit(e))}},e.prototype.restartTimer=function(){var e=this;this.resetTimer();var t=+this.interval;!isNaN(t)&&t>0&&(this.currentInterval=this.ngZone.runOutsideAngular(function(){return setInterval(function(){var t=+e.interval;e.ngZone.run(function(){e.isPlaying&&!isNaN(e.interval)&&t>0&&e.slides.length?e.nextSlideFromInterval():e.pause()})},t)}))},Object.defineProperty(e.prototype,"multilist",{get:function(){return this.itemsPerSlide>1},enumerable:!0,configurable:!0}),e.prototype.resetTimer=function(){this.currentInterval&&(clearInterval(this.currentInterval),this.currentInterval=void 0)},e.decorators=[{type:t.Component,args:[{selector:"carousel",template:'\n'}]}],e.ctorParameters=function(){return[{type:o},{type:t.NgZone}]},e.propDecorators={noWrap:[{type:t.Input}],noPause:[{type:t.Input}],showIndicators:[{type:t.Input}],pauseOnFocus:[{type:t.Input}],indicatorsByChunk:[{type:t.Input}],itemsPerSlide:[{type:t.Input}],singleSlideOffset:[{type:t.Input}],activeSlideChange:[{type:t.Output}],slideRangeChange:[{type:t.Output}],activeSlide:[{type:t.Input}],startFromIndex:[{type:t.Input}],interval:[{type:t.Input}]},e}(),h=function(){function e(e){this.itemWidth="100%",this.order=0,this.addClass=!0,this.carousel=e}return e.prototype.ngOnInit=function(){this.carousel.addSlide(this),this.itemWidth=100/this.carousel.itemsPerSlide+"%"},e.prototype.ngOnDestroy=function(){this.carousel.removeSlide(this)},e.decorators=[{type:t.Component,args:[{selector:"slide",template:'\n
\n \n
\n ',host:{"[attr.aria-hidden]":"!active"}}]}],e.ctorParameters=function(){return[{type:d}]},e.propDecorators={active:[{type:t.HostBinding,args:["class.active"]},{type:t.Input}],itemWidth:[{type:t.HostBinding,args:["style.width"]}],order:[{type:t.HostBinding,args:["style.order"]}],addClass:[{type:t.HostBinding,args:["class.item"]},{type:t.HostBinding,args:["class.carousel-item"]}]},e}(),a=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[]}},e.decorators=[{type:t.NgModule,args:[{imports:[s.CommonModule],declarations:[h,d],exports:[h,d],providers:[o]}]}],e}();e.CarouselComponent=d,e.CarouselConfig=o,e.CarouselModule=a,e.SlideComponent=h,Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=ngx-bootstrap-carousel.umd.min.js.map