var bind=function(t,i){return function(){return t.apply(i,arguments)}};!function(t){return this.FilmRoll=function(){function i(i){var e;return this.options=null!=i?i:{},this.rotateRight=bind(this.rotateRight,this),this.rotateLeft=bind(this.rotateLeft,this),this.resize=bind(this.resize,this),this.moveRight=bind(this.moveRight,this),this.moveLeft=bind(this.moveLeft,this),this.configureWidths=bind(this.configureWidths,this),this.configureSwipe=bind(this.configureSwipe,this),this.configureScroll=bind(this.configureScroll,this),this.configureLoad=bind(this.configureLoad,this),this.configureHover=bind(this.configureHover,this),this.clearScroll=bind(this.clearScroll,this),this.options.container&&(this.div=t(this.options.container),this.div.length)?(e=this.div.data("film_roll_instance"))?e:(e=this.configure(),this.div.data("film_roll_instance",e),e):void 0}return i.prototype.configure=function(){var e;return this.children=this.div.children(),this.children.wrapAll('<div class="film_roll_wrapper"></div>'),this.children.wrapAll('<div class="film_roll_shuttle"></div>'),this.wrapper=this.div.find(".film_roll_wrapper"),this.shuttle=this.div.find(".film_roll_shuttle"),this.rotation=[],this.shuttle.width(this.options.shuttle_width?parseInt(this.options.shuttle_width,10):1e4),this.options.start_height&&this.wrapper.height(parseInt(this.options.start_height,10)),this.options.vertical_center&&this.shuttle.addClass("vertical_center"),this.options.no_css===!0||document.film_roll_styles_added||(t("<style type='text/css'> .film_roll_wrapper{display:block;text-align:center;float:none;position:relative;top:auto;right:auto;bottom:auto;left:auto;z-index:auto;width:100%;height:100%;margin:0 !important;padding:0 !important;overflow:hidden;} .film_roll_shuttle{text-align:left;float:none;position:relative;top:0;left:0;right:auto;bottom:auto;height:100%;margin:0 !important;padding:0 !important;z-index:auto;} .film_roll_shuttle.vertical_center:before{content:'';display:inline-block;height:100%;vertical-align:middle;margin-right:-0.25em;} .film_roll_child{position:relative;display:inline-block;*display:inline;vertical-align:middle;zoom:1;} .film_roll_prev,.film_roll_next{position:absolute;top:48%;left:15px;margin:-20px 0 0 0;padding:0;font-weight:100;line-height:30px;color:white;text-align:center;} .film_roll_prev:hover,.film_roll_next:hover{color:white;text-decoration:none;opacity:0.9} .film_roll_next{left:auto;right:15px} .film_roll_pager{text-align:center;} .film_roll_pager a{width:5px;height:5px;border:2px solid #333;border-radius:5px;display:inline-block;margin:0 5px 0 0;transition:all 1s ease} .film_roll_pager a:hover{background:#666} .film_roll_pager a.active{background:#333} .film_roll_pager span{display:none} .film_roll_pager a,a.film_roll_prev,a.film_roll_next{-webkit-box-sizing: content-box;-moz-box-sizing: content-box;box-sizing: content-box;} </style>").appendTo("head"),document.film_roll_styles_added=!0),this.options.pager!==!1&&(this.pager=t('<div class="film_roll_pager">'),this.div.append(this.pager),this.children.each(function(i){return function(e,o){var r;return r=t("<a href='#' data-id='"+o.id+"'><span>"+(e+1)+"</span></a>"),i.pager.append(r),r.click(function(){return i.index=e,i.moveToIndex(i.index,"best",!0),!1})}}(this))),this.pager_links=this.div.find(".film_roll_pager a"),"scroll"===this.options.hover?(this.options.scroll=!1,this.hover_in=function(t){return function(){return clearTimeout(t.hover_timer),t.hover_timer=setTimeout(function(){return t.moveLeft(),t.configureScroll()},300)}}(this),this.hover_out=this.clearScroll):this.options.hover!==!1&&(this.hover_in=function(t){return function(){return clearTimeout(t.hover_timer),t.hover_timer=setTimeout(function(){return t.clearScroll()},300)}}(this),this.hover_out=this.configureScroll),this.options.hover!==!1&&(this.mouse_catcher=t('<div style="position:absolute; top:0; left: 0; height: 100%; width: 100%;" class="film_roll_mouse_catcher"></div>'),this.mouse_catcher.appendTo(this.wrapper).mousemove(function(t){return function(){return t.hover_in(),t.mouse_catcher.remove()}}(this))),e=null,this.children.each(function(i){return function(e,o){var r;return r=t(o),r.attr("data-film-roll-child-id",e),r.addClass("film_roll_child"),i.rotation.push(o)}}(this)),this.options.prev!==!1&&(this.options.prev&&this.options.next?this.prev=t(this.options.prev):(this.wrapper.append('<a class="film_roll_prev" href="#"><em class="fa fa-angle-left" aria-hidden="true"></em></a>'),this.prev=this.div.find(".film_roll_prev")),this.prev.click(function(t){return function(){return t.moveRight()}}(this))),this.options.next!==!1&&(this.options.next?this.next=t(this.options.next):(this.wrapper.append('<a class="film_roll_next ff" href="#"><em class="fa fa-angle-right" aria-hidden="true"></em></a>'),this.next=this.div.find(".film_roll_next")),this.next.click(function(t){return function(){return t.moveLeft()}}(this))),this.index=this.options.start_index||0,this.offset=this.options.offset||0,this.interval=this.options.interval||4e3,this.animation=this.options.animation||this.interval/4,this.easing=this.options.easing||i.default_easing,this.options.resize!==!1&&t(window).resize(function(t){return function(){return t.resize()}}(this)),this.options.configure_load?"function"==typeof this.options.configure_load?this.options.configure_load.apply(this,arguments):"number"==typeof this.options.configure_load?setTimeout(function(t){return function(){return t.configureLoad()}}(this),this.options.configure_load):this.configureLoad():t(window).load(this.configureLoad),this.options.swipe!==!1&&this.configureSwipe(),this.div.trigger(t.Event("film_roll:dom_ready")),this},i.prototype.bestDirection=function(i,e){return e||(e=t.inArray(i,this.rotation)),e<this.children.length/2?"right":"left"},i.prototype.cancelClick=function(i){return t(this).hasClass("fr-no-click")?(i.preventDefault(),!1):!0},i.prototype.childIndex=function(i){return t.inArray(i,this.children)},i.prototype.childWidth=function(i){var e;return e=this.childIndex(i),this.child_widths[e]||t(i).outerWidth(!0)},i.prototype.clearScroll=function(){return this.scrolled!==!1&&(clearInterval(this.timer),this.scrolled=!1),this},i.prototype.configureHover=function(){return this.div.hover(this.hover_in,this.hover_out),this.options.prev&&this.options.next?(this.prev.hover(this.hover_in,this.hover_out),this.next.hover(this.hover_in,this.hover_out)):void 0},i.prototype.configureLoad=function(){return this.configureWidths(),this.options.move_on_start!==!1&&this.moveToIndex(this.index,"right",!0),"scroll"===this.options.hover?(this.options.scroll=!1,this.configureHover()):this.options.scroll!==!1&&(this.configureScroll(),this.options.hover!==!1)?this.configureHover():void 0},i.prototype.configureScroll=function(){return this.scrolled!==!0&&(this.timer=setInterval(function(t){return function(){return t.moveLeft()}}(this),this.interval),this.scrolled=!0),this},i.prototype.configureSwipe=function(){return"undefined"!=typeof t.fn.swipe?(this.div.swipe({swipeStatus:function(i){return function(e,o,r,n){var s,h;if("up"===r||"down"===r)return!1;if("start"===o){if(h=i.wrapper.width(),h>=i.real_width||1===i.children.length)return!1;i.was_scrolled=i.scrolled,i.scrolled&&i.clearScroll(),i.active_half=i.child_widths[i.index]/2,s=t.inArray(i.children[i.index],i.rotation),i.offscreen_left=parseInt(i.shuttle.css("left"),10),i.offscreen_right=i.marginRight(s)-(h-i.child_widths[i.index])/2,i.div.find("a").addClass("fr-no-click")}else"move"===o?"left"===r?(n>i.active_half&&(t(i.children[i.index]).removeClass("active"),i.index=(i.index+1)%i.children.length,t(i.children[i.index]).addClass("active"),i.active_half+=i.child_widths[i.index]),n>i.offscreen_right&&(i.offscreen_left=i.rotateLeft()+n,i.offscreen_right+=i.childWidth(i.rotation[i.rotation.length-1])),i.shuttle.css("left",i.offscreen_left-n)):(n>i.active_half&&(t(i.children[i.index]).removeClass("active"),i.index-=1,i.index<0&&(i.index=i.children.length-1),t(i.children[i.index]).addClass("active"),i.active_half+=i.child_widths[i.index]),n+i.offscreen_left>0&&(i.offscreen_left=i.rotateRight()-n),i.shuttle.css("left",i.offscreen_left+n)):("end"===o?i.moveToIndex(i.index,r):"cancel"===o&&(i.moveToIndex(i.index,"right"===r?"left":"right"),i.div.find("a.fr-no-click").removeClass("fr-no-click")),i.was_scrolled&&i.configureScroll());return!0}}(this),excludedElements:"label, button, input, select, textarea, .noSwipe",allowPageScroll:"vertical"}),this.div.find("a").on("click",this.cancelClick)):void 0},i.prototype.configureWidths=function(){var i;return this.width=i=0,this.wrapper.css({height:"","min-height":0}),this.shuttle.width("").removeClass("film_roll_shuttle").addClass("film_roll_resizing"),this.children.width(""),this.div.trigger(t.Event("film_roll:resizing")),this.child_widths=[],this.options.height&&this.options.height.toString().match(/^\+/)?(this.options.height_padding=parseInt(this.options.height,10),this.options.height=null):this.options.height_padding=0,this.children.each(function(e){return function(o,r){var n,s,h;return n=t(r),n.width(n.outerWidth(!0)),h=n.outerWidth(!0),e.child_widths.push(h),e.width+=h,e.options.height||(s=n.outerHeight(!0),s>i&&(i=s)),r}}(this)),this.options.height?this.wrapper.height(this.options.height):(this.wrapper.height(""),this.wrapper.css("min-height",i+this.options.height_padding)),this.real_width=this.width,this.shuttle.width(2*this.real_width).removeClass("film_roll_resizing").addClass("film_roll_shuttle"),this.wrapper.width()>this.real_width?(this.options.force_buttons||this.options.prev===!1||this.prev.hide(),this.options.force_buttons||this.options.next===!1||this.next.hide()):(this.options.prev!==!1&&this.prev.show(),this.options.next!==!1&&this.next.show()),this},i.prototype.rotationIndex=function(i){return t.inArray(i,this.rotation)},i.prototype.marginLeft=function(t){var i,e,o,r,n,s;for(n=0,s=this.rotation,e=o=0,r=s.length;r>o;e=++o)i=s[e],t>e&&e>=0&&(n+=this.childWidth(i));return n},i.prototype.marginRight=function(t){var i,e,o,r,n,s,h;for(s=this.rotation.length-1,n=0,h=this.rotation,e=o=0,r=h.length;r>o;e=++o)i=h[e],e>t&&s>=e&&(n+=this.childWidth(i));return n},i.prototype.moveLeft=function(){return this.index=(this.index+1)%this.children.length,this.moveToIndex(this.index,"left",!0),!1},i.prototype.moveRight=function(){return this.index-=1,this.index<0&&(this.index=this.children.length-1),this.moveToIndex(this.index,"right",!0),!1},i.prototype.moveToChild=function(i){var e;return e=this.childIndex(t(i)[0]),e>-1?this.moveToIndex(e):void 0},i.prototype.moveToIndex=function(i,e,o){var r,n,s,h,l,a,d,c,f;if(null==o&&(o=!0),this.index=i,a=this.scrolled,this.clearScroll(),r=this.children[i],l=t.inArray(r,this.rotation),e&&"best"!==e||(e=this.bestDirection(r,l)),this.children.removeClass("active"),t(r).addClass("active").trigger(t.Event("film_roll:activate")),this.pager_links.removeClass("active"),t(this.pager_links[i]).addClass("active"),f=this.wrapper.width(),h=f-this.child_widths[i],d="left"===this.options.position?0+this.offset:"right"===this.options.position?f-this.child_widths[i]+this.offset:h/2+this.offset,c=h-d,f<this.real_width&&this.children.length>1||this.options.force_rotate)if("right"===e)for(;0===l||this.marginLeft(l)<d;)this.rotateRight(),l=t.inArray(r,this.rotation);else for(;l===this.children.length-1||this.marginRight(l)<c;)this.rotateLeft(),l=t.inArray(r,this.rotation);return s=-1*(this.marginLeft(l)-d),o?(n="moving_"+e,this.shuttle.addClass(n),this.div.trigger(t.Event("film_roll:moving")),this.shuttle.stop().animate({left:s},this.animation,this.easing,function(i){return function(){return i.shuttle.removeClass(n),i.div.trigger(t.Event("film_roll:moved"))}}(this))):(this.shuttle.css("left",s),this.div.trigger(t.Event("film_roll:moved"))),a&&this.configureScroll(),this},i.prototype.resize=function(){return clearTimeout(this.resize_timer),this.resize_timer=setTimeout(function(i){return function(){var e;return e=i.scrolled,i.clearScroll(),e&&i.configureScroll(),i.configureWidths(),i.moveToIndex(i.index,"best"),i.div.trigger(t.Event("film_roll:resized"))}}(this),200),this},i.prototype.rotateLeft=function(){var t,i,e,o;return t=this.shuttle.css("left"),o=t?parseInt(t,10):0,i=this.rotation.shift(),e=o+this.childWidth(i),this.rotation.push(i),this.shuttle.css("left",e),this.shuttle.append(this.shuttle.children().first().detach()),e},i.prototype.rotateRight=function(){var t,i,e,o;return t=this.shuttle.css("left"),o=t?parseInt(t,10):0,i=this.rotation.pop(),e=o-this.childWidth(i),this.rotation.unshift(i),this.shuttle.css("left",e),this.shuttle.prepend(this.shuttle.children().last().detach()),e},i}(),this.FilmRoll.default_easing="swing"}(jQuery);