(function() { var preEngineFunc={ preEngineJS: function (loaderParams) {var pageBody=getElementAttributeValueBySelector("body","class"),bodyNoAds=!1;pageBody&&pageBody.includes("noad")&&(loaderParams.e.sc.ms=0,bodyNoAds=!0);pageBody=getElementAttributeValueBySelector("body","class");var isPinsPage="/pins/"===window.location.pathname;bodyNoAds=!1;function addPageCSS(e){var t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style"),i=document.createTextNode(e);r.type="text/css",r.styleSheet?r.styleSheet.cssText=i.nodeValue:r.appendChild(i),t.appendChild(r)}function getFilteredCompatibleSizesfromBrowsiSpot(e,t){if(e){var r=JSON.parse(e);return t.filter(function(e){return r.find(function(t){return t.w===e.w&&t.h===e.h})})}return t}function getElementAttributeValue(e,t){var r=e.getAttribute(t);return r?r.toLowerCase():null}function getElementAttributeValueBySelector(e,t){var r=document.querySelector(e);return r?getElementAttributeValue(r,t):null}function getFilteredCompatibleSizes(e,t){var r=e.map(function(e){return e&&2===e.length?{w:e[0],h:e[1]}:""}),i=[];return i=r.length?t.filter(function(e){return r.find(function(t){return t.w===e.w&&t.h===e.h})}):t,r.find(function(e){return 300===e.w&&600===e.h})&&i.push({adSizeType:"narrow",h:600,minSizeForWrapping:1,optionalEmbeddings:["break"],selectedEmbedding:"break",w:300}),i}function sortByDomLocation(e){return e.sort(function(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING?1:-1})}function buildYieldFunction(e,t){return r=t,function(){return e+r++};var r}pageBody&&pageBody.includes("noad")&&(loaderParams.e.sc.ms=0,bodyNoAds=!0);var positionsStack={RIGHT:buildYieldFunction("RIGHT",11),LEADER_BOARD:buildYieldFunction("LEADER_BOARD",1),PROMO:buildYieldFunction("PROMO",1),PREMIUM_BANNER:buildYieldFunction("PREMIUM_BANNER",1),PREMIUM_DISPLAY:buildYieldFunction("PREMIUM_DISPLAY",1),AUTO_INCREASE:buildYieldFunction("AUTO_INCREASE",1)};function replaceAscendingKeys(e){e=sortByDomLocation(e);for(var t=0;t1&&"/"===e[0]?t+"/Web/"+e.slice(1).replace(/\s+/g,"_"):t+"/Web/"+e.replace(/\s+/g,"_"):t+"/Web/home"}function hasFixedChilds(e){return!!e.querySelector("div.gmgAd")}function findFixedSpots(){var e=Array.from(document.querySelectorAll('main.flexible > div[class*="scGrid"]'));if(e.length>1&&(e=e.slice(4)),e.length>0)var t=e.filter(function(t,r){return 0===r?!hasFixedChilds(t):r>0?!hasFixedChilds(t)&&!hasFixedChilds(e[r-1]):void 0}).filter(function(e){return e.clientHeight>50}),r=!0,i=t.filter(function(e,i){return r||i>0&&t[i-1].getBoundingClientRect().height>600?(r=!1,!0):(r=!0,!1)});var n=[{type:"publisher",selector:"div.gmgAd"}];bodyNoAds||(n.push({type:"browsi",elements:i,sizes:'[{"w": 728, "h":90},{"w": 0, "h":0}]',pos:"AUTO_INCREASE",style:"grid-column"}),n.push({type:"browsiRailHomeSections",selector:"main.flexible > aside > div.sticky",pos:"RIGHT"})),addFixedSpots(n)}function getPageTargetings(){var e=[],t=getElementAttributeValueBySelector('meta[property="article:tag"]',"content");t&&(t=t.replace(/[^\w\s\,]/gi,"").split(","));var r=getElementAttributeValueBySelector('meta[name="coid"]',"value"),i=getElementAttributeValueBySelector('meta[name="type"]',"value");return t&&e.push({k:"tags",v:t}),r&&e.push({k:"coid",v:r}),i&&e.push({k:"type",v:i}),e.push({k:"view",v:window.matchMedia("(max-width: 1200)").matches?"desktop":["desktop","wide"]}),e}loaderParams.externalFlowHandler={engineInitiator:function(e,t){function r(){clearTimeout(n),findFixedSpots(),t()}function i(){if("complete"===document.readyState)if(document.removeEventListener("readystatechange",i),isPinsPage){var e,t=setInterval(function(){window.top.document.querySelector("div.pin-category > div.preview > div.pin-wrap")&&(clearInterval(t),clearTimeout(e),r())},100);e=setTimeout(function(){clearInterval(t),r()},1e4)}else r()}document.addEventListener("readystatechange",i),i();var n=setTimeout(function(){document.removeEventListener("readystatechange",i),findFixedSpots(),t()},2e4)},preDemand:function(e){e.filter(function(e){return["dynamic","dynamic_mc"].indexOf(e.type.toLowerCase())>-1}).forEach(function(e){return e.ref.setAttribute("data-generated-key","AUTO_INCREASE")}),replaceAscendingKeys(e.map(function(e){return e.ref}))},preFetch:function(e,t,r){if("header_bidding"===t.providerName||"dfp"===t.providerName){r.kv=(r.kv||[]).concat(getPageTargetings()),r.kv.push({k:"pos",v:e.ref.getAttribute("data-generated-key")});var i="header_bidding"===e.providerName?r.c.d:r.c,n=getElementAttributeValue(e.ref.parentElement,"class");if(n&&n.indexOf("gmgad")>-1&&(r.ri=null),["fixed","fixed_mc"].indexOf(e.type.toLowerCase())>-1){if("BROWSISPOT"===e.ref.tagName)if(e.ref.parentElement.hasAttribute("data-gmgAd")){var a=JSON.parse(e.ref.parentElement.getAttribute("data-gmgad"));i.au=a.unitname.replace(/\s+/g,"_"),e.compatibleSizes=getFilteredCompatibleSizes(a.desktop_size,e.compatibleSizes),0===e.compatibleSizes.length&&console.log("[browsi]: sizes do not match placement",e.ref.parentElement)}else{if(-1!==e.ref.getAttribute("style").indexOf("grid-column")){var o=getElementAttributeValue(e.ref.nextElementSibling,"class"),s=o&&-1!==o.indexOf("full-width")?" {grid-column: 1 / 7;}":" {grid-column: 1 / 5;}";addPageCSS('div[id^="browsi_adWrapper_ai_'+e.adIndex+'_"]'+s)}e.ref.hasAttribute("data-generated-key")&&(i.au=getAdUnit(),e.compatibleSizes=getFilteredCompatibleSizesfromBrowsiSpot(e.ref.getAttribute("sizes"),e.compatibleSizes))}}else i.au=getAdUnit()}},postFetch:function(e,t){"BROWSISPOT"===e.ref.tagName&&(e.ref.style="");var r=getElementAttributeValue(e.ref.parentElement,"class"),i=!1;if(["right","left"].includes(e.selectedSize.selectedEmbedding)){i=!0;var n=e.browsiAd.wrapper.style.getPropertyValue("float"),a=e.browsiAd.wrapper.style.getPropertyValue("margin-right"),o=e.browsiAd.wrapper.style.getPropertyValue("margin-left")}r?-1===r.indexOf("gmgad")?(e.browsiAd.wrapper.setAttribute("class","gmgAdBrowsi"),e.browsiAd.wrapper.style="",i&&n&&o&&a&&(e.browsiAd.wrapper.style.setProperty("float",n),e.browsiAd.wrapper.style.setProperty("margin-right",a),e.browsiAd.wrapper.style.setProperty("margin-left",o))):e.browsiAd.wrapper.style="":(e.browsiAd.wrapper.setAttribute("class","gmgAdBrowsi"),e.browsiAd.wrapper.style="",i&&n&&o&&a?(e.browsiAd.wrapper.style.setProperty("float",n),e.browsiAd.wrapper.style.setProperty("margin-right",a),e.browsiAd.wrapper.style.setProperty("margin-left",o)):e.browsiAd.wrapper.style.setProperty("text-align","center"))}};}}; window["__browsiLoadFunc"](window["__browsiLoadObject"], preEngineFunc); })();