text: !function(f){function n(n,o,i){var r;return function(){var t=this,e=arguments,s=i&&!r;clearTimeout(r),r=setTimeout(function(){r=null,i||n.apply(t,e)},o),s&&n.apply(t,e)}}var o=function(t,e){var s=this;s.defaultOptions={snapOffset:0,snapAlignment:"left",snapLeeway:5,preventEdgeSnapping:!0,buttonType:"arrows",showIndicatorNumbers:!1,fadeObscured:!1,fadeOpacity:.5,animationLength:250,debounce:200};var n=f(t).data("carousel")||{};s.options=f.extend({},s.defaultOptions,n,e),s.carousel=t,s.$carousel=f(t),s.$container=s.$carousel.parent(),s.$carouselItems=s.$carousel.children(),s.viewportChangeHandler=f.proxy(s.viewportChangeHandler,s),s.scrollHandler=f.proxy(s.scrollHandler,s),s.init()};o.prototype.init=function(){var t=this;t.buttonGenerator(),t.viewportChangeHandler();var e=n(t.viewportChangeHandler,t.options.debounce),s=n(t.scrollHandler,t.options.debounce);f(window).on("resize",e),f(window).on("orientationchange",e),t.$carousel.on("scroll",s)},o.prototype.viewportChangeHandler=function(){var s=this;s.carouselWidth=s.$carousel.width(),s.carouselCenter=s.carouselWidth/2,s.carouselOffset=s.$carousel.offset().left,s.carouselScrollWidth=s.carousel.scrollWidth,s.childrenLeftBounds=s.$carouselItems.map(function(t,e){return f(e).offset().left+s.$carousel.scrollLeft()-s.carouselOffset}).get()},o.prototype.buttonGenerator=function(){var i=this;"arrows"===i.options.buttonType?(f("<button/>",{class:"sc__next-button sc__button",text:"next",click:function(){i.scrollHandler("right")}}).appendTo(i.$carousel),f("<button/>",{class:"sc__prev-button sc__button",text:"prev",click:function(){i.scrollHandler("left")}}).prependTo(i.$carousel)):"indicators"===i.options.buttonType&&(f("<div/>",{class:"sc__indicator-container"}).appendTo(i.$carousel),i.$carouselItems.each(function(t,e){f("<button/>",{class:"sc__indicator-button",text:t+1,click:function(){!function(t,e){var s,n,o=f(e);"left"===i.options.snapAlignment?(n=parseInt(o.css("marginLeft")),s=i.childrenLeftBounds[t]+i.options.snapOffset-n):"right"===i.options.snapAlignment?(n=parseInt(o.css("marginRight")),s=i.childrenLeftBounds[t]+o.outerWidth()+i.options.snapOffset+n-i.carouselWidth):"center"===i.options.snapAlignment&&(s=i.childrenLeftBounds[t]+o.outerWidth()/2+i.options.snapOffset-i.carouselWidth/2),i.animateScroll(s)}(t,e)}}).wrapInner("<span "+(i.options.showIndicatorNumbers?"":'class="visuallyhidden"')+" />").appendTo(f(".sc__indicator-container"))}))},o.prototype.animateScroll=function(t){var e=this;e.options.disableAnimation?e.$carousel.scrollLeft(t):e.$carousel.animate({scrollLeft:t},e.options.animationLength)},o.prototype.scrollHandler=function(a){"string"!=typeof a&&(a=null);var l,c,p=this,u=p.$carousel.scrollLeft();if(p.$carouselItems.each(function(t,e){var s=f(e).offset().left-p.carouselOffset,n=s+f(e).outerWidth();if(!0===p.options.fadeObscured&&(s<=-1||n>=p.carouselWidth+1?f(e).css("opacity",p.options.fadeOpacity):f(e).css("opacity",1)),"center"===p.options.snapAlignment){var o=p.alignCenter(t,e,u,s,l,a);o&&(l=o.closestDistance,c=o.scrollAdjust,o.snapIndex)}else if("left"===p.options.snapAlignment){var i=p.alignLeft(t,e,u,s,l,a);i&&(l=i.closestDistance,c=i.scrollAdjust,i.snapIndex)}else if("right"===p.options.snapAlignment){var r=p.alignRight(t,e,u,n,l,a);r&&(l=r.closestDistance,c=r.scrollAdjust,r.snapIndex)}}),!a&&(p.options.preventEdgeSnapping&&u<=2||p.options.preventEdgeSnapping&&u+p.carouselWidth>=p.carouselScrollWidth-2))return!1;l>=p.options.snapLeeway&&p.animateScroll(c)},o.prototype.alignCenter=function(t,e,s,n,o,i){var r=this,a=n+f(e).outerWidth()/2,l=r.carouselCenter-a,c=Math.abs(l);if("left"===i){if(0<Math.floor(l)&&(void 0===o||c<o))return{closestDistance:c,scrollAdjust:s-c+r.options.snapOffset,snapIndex:t}}else if("right"===i){if(Math.ceil(l)<0&&(void 0===o||c<o))return{closestDistance:c,scrollAdjust:s+c+r.options.snapOffset,snapIndex:t}}else if(0<a&&a<=r.carouselWidth&&(void 0===o||c<=o))return{closestDistance:c,scrollAdjust:s-l+r.options.snapOffset,snapIndex:t}},o.prototype.alignLeft=function(t,e,s,n,o,i){var r=parseInt(f(e).css("marginLeft")),a=Math.abs(n);if("left"===i){if(Math.ceil(n)-r<0&&(void 0===o||a<o))return{closestDistance:a,scrollAdjust:s-a+this.options.snapOffset-r,snapIndex:t}}else if("right"===i){if(0<Math.floor(n)-r&&(void 0===o||a<o))return{closestDistance:a,scrollAdjust:s+a+this.options.snapOffset-r,snapIndex:t}}else if(void 0===o||a<=o)return{closestDistance:a,scrollAdjust:s+n+this.options.snapOffset-r,snapIndex:t}},o.prototype.alignRight=function(t,e,s,n,o,i){var r=this.carouselWidth-n,a=parseInt(f(e).css("marginRight")),l=Math.abs(r);if("left"===i){if(0<Math.floor(r)-a&&(void 0===o||l<o))return{closestDistance:l,scrollAdjust:s-l+this.options.snapOffset+a,snapIndex:t}}else if("right"===i){if(Math.ceil(r)-a<0&&(void 0===o||l<o))return{closestDistance:l,scrollAdjust:s+l+this.options.snapOffset+a,snapIndex:t}}else if(void 0===o||l<=o)return{closestDistance:l,scrollAdjust:s-r+this.options.snapOffset+a,snapIndex:t}},f.fn.scrollCarousel=function(){for(var t=arguments[0],e=(Array.prototype.slice.call(arguments,1),this.length),s=0;s<e;s++){if("object"!=typeof t&&void 0!==t)throw new Error("Type of argument is not object");this[s].scrollCarousel=new o(this[s],t)}return this}}(jQuery),$(".sc__carousel").scrollCarousel({buttonType:"indicators"});