/*
 Copyright 2011-2017 Adobe Systems Incorporated. All Rights Reserved.
*/
(function(c){"function"===typeof define&&define.amd&&define.amd.jQuery?define(["jquery","museutils"],c):c(jQuery)})(function(c){c.fn.museOverlay=function(b){var d=c.extend({autoOpen:!0,offsetLeft:0,offsetTop:0,$overlaySlice:c(),$slides:c(),$overlayWedge:c(),duration:300,overlayExtraWidth:0,overlayExtraHeight:0,$elasticContent:c()},b);return this.each(function(){var a=c(this).data("museOverlay");if(a&&a[b]!==void 0)return a[b].apply(this,Array.prototype.slice.call(arguments,1));var a=d.slideshow.options.isResponsive,
f=(d.slideshow.options.slideClassName=="Container"||d.slideshow.options.slideClassName=="SSSlide")&&a,h=c("body"),g=c("<div/>").appendTo(h).css({position:"fixed",top:0,left:0,zIndex:100001}).hide(),l=c("<div/>").append(d.$overlaySlice).appendTo(g).css({position:"absolute",top:0,left:0});c(this).css({position:"absolute",left:0,top:0,outline:"none"}).attr({role:"dialog",tabindex:"0"});Muse.Utils.appendChildren(g,c(this));var j=c(this);a&&(Muse.Utils.moveElementsOutsideViewport(d.slideshow.$element.parents()),
j.css({width:d.slideshow.$element.width()+"px"}),Muse.Utils.moveElementsInsideViewport(d.slideshow.$element.parents()));var k=g.siblings("div"),i=c(window),m,n,q=null,a=g.find("a, button, [tabindex], input, textarea, [contenteditable]"),p=a[0],o=a[a.length-1],r=d.$elasticContent,s=r.length?parseInt(r.css("padding-left"))+parseInt(r.css("padding-right"))+parseInt(r.css("border-left-width"))+parseInt(r.css("border-right-width")):0,v=r.length?parseInt(r.css("padding-top"))+parseInt(r.css("padding-bottom"))+
parseInt(r.css("border-top-width"))+parseInt(r.css("border-bottom-width")):0,x=d.$overlaySlice.outerWidth(),w=d.$overlaySlice.outerHeight(),t={isOpen:!1,reuseAcrossBPs:function(){d.reuseAcrossBPs=!0},handleClose:function(){t.close()},open:function(){if(!t.isOpen){if(!d.reuseAcrossBPs&&d.slideshow.$bp){if(!d.slideshow.$bp.hasClass("active"))return;d.slideshow.breakpoint.swapPlaceholderNodesRecursively(g);d.slideshow.breakpoint.activateIDs(g);c(window).trigger("lightboxresize")}Muse.Utils.showWidgetsWhenReady(g);
m=i.width();n=i.height();t.positionContent(m,n);g.show();l.css({opacity:0}).stop(!0);j.css({opacity:0}).stop(!0);k.attr("aria-hidden","true");window.setTimeout(function(){l.bind("click",t.handleClose)},300);l.animate({opacity:0.99},{queue:!1,duration:d.duration,complete:function(){l.css({opacity:""});j.animate({opacity:1},{queue:!1,duration:d.duration,complete:function(){j.css({opacity:""});t.applyPageDimensions();window.setTimeout(function(){j[0].focus()},void 0)}})}});c(document).bind("keydown",
t.onKeyDown);t.doLayout(m,n);t.isOpen=!0;i.bind("resize",t.onWindowResize);c("body").bind("muse_bp_deactivate",t.onBreakpointChange);t.onWindowResize(null,!0)}},close:function(a){l.unbind("click",t.handleClose);i.unbind("resize",t.onWindowResize);c("body").unbind("muse_bp_deactivate",t.onBreakpointChange);c(document).unbind("keydown",t.onKeyDown);if(d.onClose)d.onClose();l.css({opacity:0.99}).stop(!0);j.css({opacity:0.99}).stop(!0);j.animate({opacity:0},{queue:!1,duration:a?0:d.duration,complete:function(){l.animate({opacity:0},
{queue:!1,duration:a?0:d.duration,complete:function(){g.hide();j.css({opacity:""});l.css({opacity:""});k.removeAttr("aria-hidden")}})}});t.isOpen=!1},next:function(){if(d.onNext)d.onNext()},previous:function(){if(d.onPrevious)d.onPrevious()},focusTrap:function(a){a.keyCode===9&&(a.shiftKey?a.target===p&&o.focus():a.target===o&&p.focus())},onBreakpointChange:function(){t.close(!0)},onKeyDown:function(a){switch(a.which||a.keyCode){case 37:case 38:j.is(":focus")&&t.previous();break;case 39:case 41:j.is(":focus")&&
t.next();break;case 27:t.close()}t.focusTrap(a)},onWindowResize:function(a,b){var c=i.width(),d=i.height();(b||m!=c||n!=d)&&q==null&&(q=setTimeout(function(){m=i.width();n=i.height();t.doLayout(m,n);t.positionContent(m,n);q=null},10))},doLayout:function(a,b){g.css({width:0,height:0});d.$overlayWedge.css({width:0,height:0});var c=a-s,f=b-v;r.length&&r.hasClass("fullwidth")&&(r.width(c),d.resizeSlidesFn&&d.resizeSlidesFn(c,f));t.applyPageDimensions();Muse.Utils.updateSlideshow_fstpOffsetSize(d.slideshow)},
applyPageDimensions:function(){function a(){var b=document.createElement("div");b.style.overflow="scroll";b.style.visibility="hidden";b.style.position="absolute";b.style.width="100px";b.style.height="100px";document.body.appendChild(b);var c=b.offsetWidth-b.clientWidth;document.body.removeChild(b);return{width:c}}var b=c(document),h=b.width(),i=b.height(),b=j[0],k=c(b).find("."+d.slideshow.options.viewClassName),k=c(k[0]),l=document.documentElement||document.body;l.clientWidth!=l.offsetWidth&&(h=
l.scrollWidth-1);l.clientHeight!=l.offsetHeight&&i<l.scrollHeight&&(i=l.scrollHeight-1);g.css({width:h,height:i});d.$overlayWedge.css({width:h-x,height:i-w});f||j.css("height","");Muse.Utils.moveElementsOutsideViewport(d.slideshow.slides.$element);Muse.Utils.resizeImages(j,d.slideshow.$element.attr("id"));Muse.Utils.adjustTargetAndSlideHeights(k,d.slideshow.options.contentLayout_runtime);d.slideshow.options.elastic!="fullScreen"&&(h=k.closest(".popup_anchor"),i=c(h.children()[0]),h.height(i.outerHeight()));
Muse.Utils.moveElementsInsideViewport(d.slideshow.slides.$element);h=j.css("width");f?(Muse.Utils.moveElementsOutsideViewport(d.slideshow.$element.parents()),j.css("width",c("#page").width()*j.attr("lightbox-Ratio-WithPage")/100+"px"),Muse.Utils.moveElementsInsideViewport(d.slideshow.$element.parents())):(j.css("width",d.slideshow.$element.width()+"px"),j.css("height",d.slideshow.$element.height()+"px"));var i=d.$elasticContent,o,p;d.slideshow.options.contentLayout_runtime=="lightbox"&&i.length&&
i.hasClass("fullwidth")&&(o=i.length?parseInt(i.css("padding-left"))+parseInt(i.css("padding-right"))+parseInt(i.css("border-left-width"))+parseInt(i.css("border-right-width")):0,p=i.length?parseInt(i.css("padding-top"))+parseInt(i.css("padding-bottom"))+parseInt(i.css("border-top-width"))+parseInt(i.css("border-bottom-width")):0,o=c(window).width()-o,p=c(window).height()-p);d.slideshow.$clip&&c(d.slideshow.$clip[0]).height(d.slideshow.slides.$element.outerHeight()+"px");d.slideshow.$view&&d.slideshow.$view.height(d.slideshow.slides.$element.outerHeight()+
"px");d.slideshow._fstpPositionSlides&&(d.slideshow.options.contentLayout_runtime=="lightbox"&&i.length&&i.hasClass("fullwidth")?d.slideshow._fstpPositionSlides(o,p):d.slideshow._fstpPositionSlides());o=d.slideshow.options.isResponsive;b=c(c(b).find("."+d.slideshow.options.viewClassName)[0]);if(b.length)o?(b.attr("data-slidewidth"),p=c(j[0]).width()*parseFloat(b.attr("data-slidewidth"))/100):p=d.slideshow.slides.$element.outerWidth(),i=d.slideshow.slides.$element.outerHeight(),d.slideshow.options&&
d.slideshow.options.transitionStyle&&d.slideshow.options.transitionStyle!=="vertical"&&i&&i>c(window).height()?(i=a(),o?(o=(p+i.width)/c(j[0]).width()*100+"%",b.width(o),b.parent().hasClass("wp-slideshow-clip")?b.parent().css({maxHeight:"100vh",overflowY:"auto"}):b.css({maxHeight:"100vh",overflowY:"auto"})):(j[0].childNodes[0].style.width=p+i.width+"px",j[0].childNodes[0].style.maxHeight="100vh",j[0].childNodes[0].style.overflowY="auto")):o?b.width(p/c(j[0]).width()*100+"%"):j[0].childNodes[0].style.width=
p+"px";h!=j.css("width")&&(c(window).trigger("lightboxresize"),t.doLayout(m,n),t.positionContent(m,n))},positionContent:function(a,b){var g=0,h=0;d.slideshow.options.isResponsive?(h=d.$slides.filter(".wp-panel-active"),f&&h!==void 0&&h.length>0?(g=-(d.$slides.outerWidth()/2+(h.offset().left-j.offset().left)),h=-(d.$slides.outerHeight()/2+(h.offset().top-j.offset().top))):(g=-j.outerWidth()/2,h=-j.outerHeight()/2)):(g=-d.$slides.outerWidth()/2,h=-d.$slides.outerHeight()/2);g=Math.max(0,a/2+g);h=Math.max(0,
b/2+h);d.$slides.outerHeight()>b&&(h=0);j.css({top:h,left:g});r.length&&r.hasClass("fullwidth")&&r.css("left",-g);g=a-s;h=b-v;if(r.length){r.width(g);r.hasClass("fullscreen")&&r.height(h);if(d.slideshow.options.contentLayout_runtime==="lightbox"&&d.slideshow.options.elastic==="fullScreen"&&!d.slideshow.options.isResponsive){var i=c(j[0]).find("."+d.slideshow.options.viewClassName),i=c(i[0]);Muse.Utils.adjustTargetAndSlideHeights(i,d.slideshow.options.contentLayout_runtime)}d.resizeSlidesFn&&d.resizeSlidesFn(g,
h)}}};j.data("museOverlay",t);d.autoShow&&t.open()})}});
;(function(){if(!("undefined"==typeof Muse||"undefined"==typeof Muse.assets)){var a=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]==b)return c;return-1}(Muse.assets.required,"jquery.museoverlay.js");if(-1!=a){Muse.assets.required.splice(a,1);for(var a=document.getElementsByTagName("meta"),b=0,c=a.length;b<c;b++){var d=a[b];if("generator"==d.getAttribute("name")){"2018.0.0.379"!=d.getAttribute("content")&&Muse.assets.outOfDate.push("jquery.museoverlay.js");break}}}}})();
