!function(t){"use strict";t.fn.twentytwenty=function(e){e=t.extend({default_offset_pct:.5,orientation:"horizontal",before_label:"Before",after_label:"After",no_overlay:!1,move_slider_on_hover:!1,move_with_handle_only:!0,click_to_move:!1},e);return this.each(function(){var n=e.default_offset_pct,i=t(this),a=e.orientation,o="vertical"===a?"down":"left",s="vertical"===a?"up":"right";if(i.wrap("<div class='twentytwenty-wrapper twentytwenty-"+a+"'></div>"),!e.no_overlay){i.append("<div class='twentytwenty-overlay'></div>");var c=i.find(".twentytwenty-overlay");c.append("<div class='twentytwenty-before-label' data-content='"+e.before_label+"'></div>"),c.append("<div class='twentytwenty-after-label' data-content='"+e.after_label+"'></div>")}var r=i.find("img:first"),d=i.find("img:last");i.append("<div class='twentytwenty-handle'></div>");var l=i.find(".twentytwenty-handle");l.append("<span class='twentytwenty-"+o+"-arrow'></span>"),l.append("<span class='twentytwenty-"+s+"-arrow'></span>"),i.addClass("twentytwenty-container"),r.addClass("twentytwenty-before"),d.addClass("twentytwenty-after");var w=function(t){var e,n,o,s=(e=t,n=r.width(),o=r.height(),{w:n+"px",h:o+"px",cw:e*n+"px",ch:e*o+"px"});l.css("vertical"===a?"top":"left","vertical"===a?s.ch:s.cw),function(t){"vertical"===a?(r.css("clip","rect(0,"+t.w+","+t.ch+",0)"),d.css("clip","rect("+t.ch+","+t.w+","+t.h+",0)")):(r.css("clip","rect(0,"+t.cw+","+t.h+",0)"),d.css("clip","rect(0,"+t.w+","+t.h+","+t.cw+")")),i.css("height",t.h)}(s)},f=function(t,e){var n,i,o;return n="vertical"===a?(e-p)/h:(t-v)/y,i=0,o=1,Math.max(i,Math.min(o,n))};t(window).on("resize.twentytwenty",function(t){w(n)});var v=0,p=0,y=0,h=0,u=function(t){((t.distX>t.distY&&t.distX<-t.distY||t.distX<t.distY&&t.distX>-t.distY)&&"vertical"!==a||(t.distX<t.distY&&t.distX<-t.distY||t.distX>t.distY&&t.distX>-t.distY)&&"vertical"===a)&&t.preventDefault(),i.addClass("active"),v=i.offset().left,p=i.offset().top,y=r.width(),h=r.height()},_=function(t){i.hasClass("active")&&(n=f(t.pageX,t.pageY),w(n))},m=function(){i.removeClass("active")},g=e.move_with_handle_only?l:i;g.on("movestart",u),g.on("move",_),g.on("moveend",m),e.move_slider_on_hover&&(i.on("mouseenter",u),i.on("mousemove",_),i.on("mouseleave",m)),l.on("touchmove",function(t){t.preventDefault()}),i.find("img").on("mousedown",function(t){t.preventDefault()}),e.click_to_move&&i.on("click",function(t){v=i.offset().left,p=i.offset().top,y=r.width(),h=r.height(),n=f(t.pageX,t.pageY),w(n)}),t(window).trigger("resize.twentytwenty")})}}(jQuery);