(function(){function g(e,s){this.slides=[],this.slider=e,this.options=s,this.timer=this.onTimer.bind(this),e[0].opt.fallbacks.disableFocusListener||p(window).on("focus.rsaddonbeforeafter",this.onFocus.bind(this)),e.one("revolution.slide.onloaded",this.onLoaded.bind(this)).one("rsBeforeAfterDestroyed",this.destroy.bind(this))}function w(e,s,t,r,h,o,n,i,a,f,l,u,d,c){this.id=e,this.bg=s,this.index=c,this.slide=r,this.inner=t,this.after=a,this.before=f,this.slider=l,this.videoBg=h,this.bgInner=n,this.globals=u,this.videoSolo=o,this.carousel=d,this.animateOut=i.out,this.direction=i.direction,this.moveto=i.moveto.split("|"),this.timing=.001*parseInt(i.time,10),this.delay=.001*parseInt(i.delay,10),e=i.easing.split("."),this.animation=punchgs[e[0]][e[1]],this.direction==="horizontal"?(this.normal=!0,this.axis="left",this.size="width"):(this.axis="top",this.size="height"),this.globals.hasOwnProperty("onClick")&&(e=this.globals.onClick.easing.split("."),this.time=.001*parseInt(this.globals.onClick.time,10),this.transition=punchgs[e[0]][e[1]]),this.mouseUp=this.onMouseUp.bind(this),this.mouseMove=this.onMouseMove.bind(this),this.mouseClick=this.onClick.bind(this),this.complete=this.onComplete.bind(this),i.hasOwnProperty("bounceArrows")&&(this.bounceArrows=i.bounceArrows,this.bounceDelay=parseInt(i.bounceDelay,10),this.readyArrows=this.arrowsReady.bind(this),this.bounceDelay&&(this.delayBounce=this.bounceReady.bind(this))),i.hasOwnProperty("shiftOffset")&&(this.shiftArrows=i.shiftOffset),this.videoBg&&!this.videoSolo&&(this.videoPlay=this.playVideo.bind(this)),this.createDrag(),p.data(r[0],"rs-addon-beforeafter",this)}function T(e){this.style.zIndex=(e+5).toString()}var p;window.RevSliderBeforeAfter=function(e,s,t){e&&s&&typeof punchgs<"u"&&(p=e,p.event.special.rsBeforeAfterDestroyed={remove:function(r){r.handler()}},new g(s,t))},g.prototype={init:function(){var s=this.slider[0].opt,e=s.responsiveLevels,s=s.gridwidth;Array.isArray(e)||(e=[e]),Array.isArray(s)||(s=[s]),this.levels=e,this.widths=s,this.resize=this.onResize.bind(this),this.slider.addClass("rs-before-after-addon").on("revolution.slide.onbeforeswap",this.beforeSwap.bind(this)).on("revolution.slide.onafterswap",this.afterSwap.bind(this))},onLoaded:function(){var e=this,s=this.slider[0].id,t=this.slider.find(".tp-static-layers");(this.carousel=this.options.carousel)&&this.slider.addClass("before-after-carousel"),t.length||(t=this.slider.find(".tp-revslider-mainul")),this.slider.data("before-after-placer",t).data("beforeafter-slides").each(function(){var r=p(this),n=r.find('.tp-caption[data-beforeafter="before"]').toArray().map(function(c){return p(c).closest(".tp-parallax-wrap")}),i=r.find('.tp-caption[data-beforeafter="after"]').toArray().map(function(c){return p(c).closest(".tp-parallax-wrap")}),h=r.data("beforeafter-options");r.addClass("rs-addon-beforeafter rs-addon-beforeafter-"+h.direction),e.carousel||r.find("*").attr("draggable",!1);var o=p('
').append(n);1'),i=p('').append(i)[0],a=document.createElement("div"),f=document.createElement("div"),l=h.bgType;if(l==="image"||l==="external")a.style.backgroundImage="url("+h.bgImage+")",a.style.backgroundPosition=h.bgPos,a.style.backgroundRepeat=h.bgRepeat,a.style.backgroundSize=h.bgFit;else if(l==="solid")a.style.background=h.bgColor;else if(l!=="trans"&&(l=r.data("beforeafter-video"))&&(l.closest(".tp-parallax-wrap").addClass("rs-video-beforeafter"),!e.carousel))var u=l,d=r.find(".rs-background-video-layer").length===0;r.attr("data-link")&&r.attr("data-slideindex")==="back"&&(o.addClass("rs-beforeafter-pointers"),n.addClass("rs-beforeafter-pointers")),l="rs-addon-beforeafter-bg-inner",h.filter&&(l+=" "+h.filter),f.className="rs-addon-beforeafter-bg",a.className=l,f.appendChild(a),r.find(".slotholder").append(f),n.append(i).insertBefore(o),e.slides[e.slides.length]=new w(s,f,i,r,u,d,a,h,n[0],o[0],e.slider,e.options,e.carousel,r.attr("data-index"))}),this.init()},beforeSwap:function(e,s){if(!this.checkRemoved()){this.slide=!1;var t;s.currentslide.length&&(t=p.data(s.currentslide[0],"rs-addon-beforeafter"))&&(t.removeEvents(),t[t.animateOut]()),(t=p.data(s.nextslide[0],"rs-addon-beforeafter"))&&t.setup&&t.reset()}},afterSwap:function(e,s){!this.checkRemoved()&&s.currentslide.hasClass("rs-addon-beforeafter")&&(this.slide=p.data(s.currentslide[0],"rs-addon-beforeafter"),this.slide.setup||(this.onResize(!1,!0),this.slide.onSetup(),this.slider.on("revolution.slide.afterdraw",this.resize)),this.slide.reset(!0),this.slide.reveal(),this.slide.addEvents())},checkRemoved:function(){return this.slider&&document.body.contains(this.slider[0])?!1:(this.destroy(),!0)},onVideoPlay:function(e,s){this.slide&&this.slide.videoBg&&!this.slide.videoSolo&&this.slide.playVideo()},destroy:function(){if(p(window).off(".rsaddonbeforeafter"),this.slides)for(;this.slides.length;)this.slides[0].destroy(),this.slides.shift();for(var e in this)this.hasOwnProperty(e)&&delete this[e]},onFocus:function(){clearTimeout(this.timer);for(var e=this.slides.length;e--;)this.slides[e].supress=!0;this.focusTimer=setTimeout(this.timer,100)},onTimer:function(){for(var e=this.slides.length;e--;)this.slides[e].supress=!1},onResize:function(e,s){if(e&&this.carousel)clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(this.resize,250);else{var t=this.slide;if(t){var r,h=0,o=this.levels.length;if(this.carousel)var n=t.slide.width(),i=t.slide.height();else n=this.slider.width(),i=this.slider.height();for(r=0;r',this.btn1=p(''),this.btn2=p(''),this.btn=p(i).on("mousedown touchstart",this.onMouseDown.bind(this)),this.btn[0].appendChild(this.btn1[0]),this.btn[0].appendChild(this.btn2[0]),n=parseInt(h.width,10),i=[],n&&(h='')[0],this.pixel=n%2===0?0:1,i[0]=this.revealLine),this.revealBtn=this.btn[0],i[i.length]=this.revealBtn,this.carousel?this.slide.append(i):p(i).insertAfter(this.slider.data("before-after-placer"))},onSetup:function(){var s=this.btn.outerWidth(!0),e=this.btn.outerHeight(!0),s=Math.max(s,e),t=e=0;this.revealLine&&(this.normal?e+=this.pixel:t+=this.pixel);var r=Math.floor(.5*s);this.buffer=r,this.setup=!0,this.btn.css({width:s,height:s,marginTop:-r+t,marginLeft:-r+e}),delete this.btn},addEvents:function(){var e=this.carousel?this.slide:this.slider;e.on("mouseup.rsaddonbeforeafter mouseleave.rsaddonbeforeafter touchend.rsaddonbeforeafter",this.mouseUp).on("mousemove.rsaddonbeforeafter touchmove.rsaddonbeforeafter",this.mouseMove),this.transition&&e.on("click.rsaddonbeforeafter",this.mouseClick)},removeEvents:function(){this.onMouseUp(),(this.carousel?this.slide:this.slider).off(".rsaddonbeforeafter"),this.shiftArrows&&this.btn1.off(".rsaddonbeforeafter"),this.bounceDelay&&clearTimeout(this.bounceTimer)},updateDrag:function(e,s){if(this.before){if(this.normal){var t=e,r=this.sliderWidth-e;s=Math.min(this.sliderHeight-this.buffer,Math.max(s,this.buffer))}else t=s,r=this.sliderHeight-s,e=Math.min(this.sliderWidth-this.buffer,Math.max(e,this.buffer));this.revealBtn.style.left=e+"px",this.revealBtn.style.top=s+"px",this.before.style[this.size]=t+"px",this.after.style[this.size]=r+"px",this.bg.style[this.size]=r+"px",this.revealLine&&(this.revealLine.style[this.axis]=t+"px")}},resetDrag:function(e,s){if(this.before){if(this.normal){var t=e,r=parseInt(e,10);r=e.search("%")!==-1?100-r+"%":this.sliderWidth-r+"px"}else t=s,r=parseInt(s,10),r=s.search("%")!==-1?100-r+"%":this.sliderHeight-r+"px";this.revealBtn.style.left=e,this.revealBtn.style.top=s,this.before.style[this.size]=t,this.after.style[this.size]=r,this.bg.style[this.size]=r,this.revealLine&&(this.revealLine.style[this.axis]=t)}},onMouseDown:function(e){this.canDrag=this.prevent=!0,this.slider.addClass("dragging"),this.shiftArrows&&(this.btn1.off(".rsaddonbeforeafter"),this.slider.addClass("rs-beforeafter-shift-arrows")),this.bounceArrows&&(this.bounceDelay&&clearTimeout(this.bounceTimer),this.slider.removeClass("rs-beforeafter-bounce-arrows")),this.carousel&&e.stopImmediatePropagation()},onMouseMove:function(e){if(!this.supress&&this.canDrag){var t=e.originalEvent.touches;t&&(e=t[0]);var s=(this.carousel?this.slide:this.slider).offset(),t=e.pageX-s.left;e=e.pageY-s.top,(this.normal?0').insertAfter(o.find(".rev-slidebg")),o.data("beforeafter-video",d))}if(i.hasOwnProperty("bounceArrows")){o=.001*parseInt(i.bounceSpeed,10);var f=i.bounceArrows!=="initial"?"infinite":"1",l=parseInt(i.bounceAmount,10),u=i.bounceType==="repel",c=Math.round(.5*l);i.direction==="horizontal"?(d="X",a=["left","right"]):(d="Y",a=["top","bottom"]);for(var b=0;2>b;b++){var m=u?b===0?"-":"":b===0?"":"-",L=e,v=a[b],y=o.toFixed(2),x=i.bounceEasing;e=L+("@-webkit-keyframes "+t+"-"+n+"-rs-beforeafter-bounce-"+v+" {0%, 20%, 50%, 80%, 100% {-webkit-transform: translate"+d+"(0);transform: translate"+d+"(0)}40% {-webkit-transform: translate"+d+"("+l+"px);transform: translate"+d+"("+m+l+"px)}60% {-webkit-transform: translate"+d+"("+c+"px);transform: translate"+d+"("+m+c+"px)}}@keyframes "+t+"-"+n+"-rs-beforeafter-bounce-"+v+" {0%, 20%, 50%, 80%, 100% {-webkit-transform: translate"+d+"(0);transform: translate"+d+"(0)}40% {-webkit-transform: translate"+d+"("+l+"px);transform: translate"+d+"("+m+l+"px)}60% {-webkit-transform: translate"+d+"("+c+"px);transform: translate"+d+"("+m+c+"px)}}.rs-beforeafter-bounce-arrows .rs-"+t+"-"+n+"-rs-beforeafter-bounce-"+v+" {-webkit-animation: "+t+"-"+n+"-rs-beforeafter-bounce-"+v+" "+y+"s "+x+" "+f+";animation: "+t+"-"+n+"-rs-beforeafter-bounce-"+v+" "+y+"s "+x+" "+f+"}")}}if(i.hasOwnProperty("shiftOffset"))for(o=.001*parseInt(i.shiftTiming,10),d=.001*parseInt(i.shiftDelay,10),a=0;2>a;a++)f=i.shiftEasing,e+=".rs-beforeafter-shift-arrows .rs-"+t+"-"+n+"-rs-beforeafter-shift {-webkit-transition: all "+o+"s "+f+" "+d+"s;transition: all "+o+"s "+f+" "+d+"s}"}),e){var h=document.createElement("style");h.type="text/css",h.innerHTML=e,document.head.appendChild(h)}s.data("beforeafter-slides",r)}})})();