window.wpfront_notification_bar=function(e,t){function i(t,i,s){if(i=i||a.noop,s&&(g=!0),0==t){if(m)return;m=!0}else{if(!m)return;m=!1}0==t&&e.keep_closed&&s&&(e.keep_closed_for>0?Cookies.set(r,1,{path:"/",expires:e.keep_closed_for}):Cookies.set(r,1,{path:"/"})),0!==t&&e.set_max_views&&(c=Cookies.get(f),c=void 0===c?0:parseInt(c),e.max_views_for>0?Cookies.set(f,c+1,{path:"/",expires:e.max_views_for}):Cookies.set(f,c+1,{path:"/"}),n("Setting view count to "+(c+1)+"."));var _=i;i=function(){_(),t>0&&(0==e.height&&p.height("auto"),e.display_open_button&&(n("Setting reopen button state to hidden."),d.addClass("hidden")),m=!1),0==t&&e.display_open_button&&(n("Setting reopen button state to visible."),d.removeClass("hidden"))},n(t>0?"Setting notification bar state to visible.":"Setting notification bar state to hidden."),e.animate_delay>0?p.stop().animate({height:t+"px"},{duration:1e3*e.animate_delay,easing:"swing",complete:function(){e.fixed_position&&l.height(t),o(t),i()},step:function(t){e.fixed_position&&l.height(t),o(t)}}):(p.height(t),e.fixed_position&&l.height(t),o(t),i())}function o(t){if(!y)return 0;if(!0!==t){clearInterval(k);var i=0;k=setInterval(function(){o(!0),i++,i>100&&clearInterval(k)},10)}if(0==a(e.theme_sticky_selector).length)return 0;1==e.position&&(null===x&&(x=a(e.theme_sticky_selector).position().top),p.is(":visible")?a(e.theme_sticky_selector).css("top",p.height()+p.position().top+"px"):a(e.theme_sticky_selector).css("top",x+"px")),2==e.position&&(null===x&&(x=a(e.theme_sticky_selector).height()+parseFloat(a(e.theme_sticky_selector).css("bottom"))),p.is(":visible")?a(e.theme_sticky_selector).css("bottom",p.height()+parseFloat(p.css("bottom"))+"px"):a(e.theme_sticky_selector).css("bottom",x+"px"))}var n=function(t){e.log&&console.log(e.log_prefix+" "+t)};if("undefined"==typeof jQuery||e.keep_closed&&"undefined"==typeof Cookies||e.set_max_views&&"undefined"==typeof Cookies)return n("Waiting for "+("undefined"==typeof jQuery?"jQuery.":"Cookies.")),void setTimeout(function(){wpfront_notification_bar(e,t)},100);if(2!=e.position||!0===t){var s=function(t){return t+e.id_suffix},a=jQuery,r=e.keep_closed_cookie,c=0,f=e.max_views_cookie,l=a(s("#wpfront-notification-bar-spacer")).removeClass("hidden"),p=a(s("#wpfront-notification-bar")),d=a(s("#wpfront-notification-bar-open-button"));if(1==e.position){n("Setting notification bar at top.");var _=0;e.fixed_position&&e.is_admin_bar_showing&&(_=a("html").css("margin-top"),"0px"==_&&(_=a("html").css("padding-top")),_=parseInt(_)),e.fixed_position&&(_+=e.position_offset),p.css("top",_+"px"),d.css("top",_+"px"),l.css("top",e.position_offset+"px");var u=a("body"),h=u.children().first();if(h.hasClass("wpfront-notification-bar-spacer"))for(;;){var b=h.next();if(!b.hasClass("wpfront-notification-bar-spacer")){h.after(l);break}h=b}else u.prepend(l);a(function(){u.children().first().hasClass("wpfront-notification-bar-spacer")||e.fixed_position&&!u.children().first().is(l)&&u.prepend(l)})}else n("Setting notification bar at bottom."),u=a("body"),u.children().last().is(l)||u.append(l),a(function(){u.children().last().is(l)||u.append(l)});var v=p.height();e.height>0&&(v=e.height,p.find("table, tbody, tr").css("height","100%")),p.height(0).css({position:e.fixed_position?"fixed":"relative",visibility:"visible"}),d.css({position:e.fixed_position?"fixed":"absolute"});var m=!1,g=!1,x=null,k=0,y=e.fixed_position&&""!=e.theme_sticky_selector;if(y&&a(window).on("scroll resize",function(){o()}),e.close_button&&l.on("click",".wpfront-close",function(){i(0,null,!0)}),e.button_action_close_bar&&l.on("click",".wpfront-button",function(){i(0,null,!0)}),e.display_open_button&&l.on("click",s("#wpfront-notification-bar-open-button"),function(){i(v)}),e.keep_closed&&Cookies.get(r))return n("Keep closed enabled and keep closed cookie exists. Hiding notification bar."),void i(0,function(){p.removeClass("keep-closed")});if(p.removeClass("keep-closed"),e.set_max_views&&(c=Cookies.get(f),void 0===c&&(c=0),c>=e.max_views))return n("Reached max views, hiding notification bar."),void i(0,function(){p.removeClass("max-views-reached")});p.removeClass("max-views-reached"),m=!0,e.display_scroll?(n("Display on scroll enabled. Hiding notification bar."),i(0),a(window).on("scroll",function(){g||(a(this).scrollTop()>e.display_scroll_offset?i(v):i(0))})):(n("Setting notification bar open event after "+e.display_after+" second(s)."),setTimeout(function(){i(v,function(){e.auto_close_after>0&&(n("Setting notification bar auto close event after "+e.auto_close_after+" second(s)."),setTimeout(function(){i(0,null,!0)},1e3*e.auto_close_after))})},1e3*e.display_after))}else jQuery(function(){wpfront_notification_bar(e,!0)})};