!function(e){"use strict";e.fn.fusionImageCompare=function(){return this.each(function(){var t=e(this),i=void 0!==e(this).data("offset")?e(this).data("offset"):.5,o=void 0!==e(this).data("orientation")?e(this).data("orientation"):"horizontal",a=void 0!==e(this).data("move-slider-on-hover")&&e(this).data("move-slider-on-hover"),n=void 0===e(this).data("move-with-handle-only")||e(this).data("move-with-handle-only"),s=void 0!==e(this).data("click-to-move")&&e(this).data("click-to-move"),f=t.find("img:first"),r=t.find("img:last"),c=t.find(".fusion-image-before-after-handle"),d=e(".before-after-label-out-image-up-down"),u=0,l=0,h=0,m=0,v="",g=function(e){var t=f.width(),i=f.height();return{w:t+"px",h:i+"px",cw:e*t+"px",ch:e*i+"px"}},p=function(e){"vertical"===o?(f.css("clip","rect(0,"+e.w+","+e.ch+",0)"),r.hasClass("fusion-image-before-after-before")||r.css("clip","rect("+e.ch+","+e.w+","+e.h+",0)")):(f.css("clip","rect(0,"+e.cw+","+e.h+",0)"),r.hasClass("fusion-image-before-after-before")||r.css("clip","rect(0,"+e.w+","+e.h+","+e.cw+")")),t.css("height",e.h),d.addClass("visible")},w=function(e){var t=g(e);c.css("vertical"===o?"top":"left","vertical"===o?t.ch:t.cw),p(t)},b=function(e,t){var i,a,n;return i="vertical"===o?(t-l)/m:(e-u)/h,a=0,n=1,Math.max(a,Math.min(n,i))},C=function(e){(e.distX>e.distY&&e.distX<-e.distY||e.distX<e.distY&&e.distX>-e.distY)&&"vertical"!==o?e.preventDefault():(e.distX<e.distY&&e.distX<-e.distY||e.distX>e.distY&&e.distX>-e.distY)&&"vertical"===o&&e.preventDefault(),t.addClass("active"),u=t.offset().left,l=t.offset().top,h=f.width(),m=f.height()},y=function(e){t.hasClass("active")&&(i=b(e.pageX,e.pageY),w(i))},j=function(){t.removeClass("active")};e(window).on("resize.fusion-image-before-after",function(){w(i)}),(v=n?t:c).on("movestart",C),v.on("move",y),v.on("moveend",j),a&&(t.on("mouseenter",C),t.on("mousemove",y),t.on("mouseleave",j)),c.on("touchmove",function(e){e.preventDefault()}),t.find("img").on("mousedown",function(e){e.preventDefault()}),s&&t.on("click",function(e){var a;u=t.offset().left,l=t.offset().top,h=f.width(),m=f.height(),i=b(e.pageX,e.pageY),a=g(i),t.addClass("active"),"vertical"===o?c.stop(!0,!0).animate({top:a.ch},{queue:!1,duration:300,easing:"easeOutCubic",step:function(e){var t=g(e/m);p(t)},complete:function(){t.removeClass("active")}}):c.stop(!0,!0).animate({left:a.cw},{queue:!1,duration:300,easing:"easeOutCubic",step:function(e){var t=g(e/h);p(t)},complete:function(){t.removeClass("active")}})}),t.addClass("initialized"),e(window).trigger("resize.fusion-image-before-after")})}}(jQuery),jQuery(window).on("load",function(){jQuery(".fusion-image-before-after").fusionImageCompare()}),jQuery(window).on("fusion-dynamic-content-render",function(e,t){var i=jQuery(t).find(".fusion-image-before-after");0<i.length&&i.fusionImageCompare()}),jQuery(document).on("fusion-element-render-fusion_image_before_after fusion-column-resized",function(e,t){jQuery('div[data-cid="'+t+'"]').find(".fusion-image-before-after").each(function(){jQuery.cleanData(jQuery(this))}),jQuery('div[data-cid="'+t+'"]').find(".fusion-image-before-after").fusionImageCompare()});