cdn-adm.pbstck.com
Open in
urlscan Pro
2606:4700:10::6816:15d
Public Scan
URL:
https://cdn-adm.pbstck.com/kleanads/js/kleanads-2409191205.js
Submission: On September 20 via api from IT — Scanned from IT
Submission: On September 20 via api from IT — Scanned from IT
Form analysis
0 forms found in the DOMText Content
var kleanads=function(e){"use strict";var t,i,n;!function(e){e.HISTORY_MUTATION="_pbstck_kleanads_historyMutation",e.PAGE_CHANGE="_pbstck_kleanads_pageChange",e.REFRESH_INIT="_pbstck_kleanads_refreshInit"}(t||(t={})),function(e){e.SPA_RELOAD="admSPAReload"}(i||(i={})),function(e){e.REPLACE_STATE="replaceState",e.PUSH_STATE="pushState"}(n||(n={}));const s=e=>{window.history[e]=new Proxy(window.history[e],{apply(i,n,s){const o=window.location.href,a=i.apply(n,s),r=new CustomEvent(t.HISTORY_MUTATION,{detail:{referrer:o,stateObj:s[0],title:s[1],url:s[2],type:e}});return dispatchEvent(r),a}})},o=()=>{s(n.REPLACE_STATE),s(n.PUSH_STATE)};var a;const r=/kleanads:debug/.test(window.location.href),d=!!(null===(a=window.localStorage)||void 0===a?void 0:a.getItem)&&null!==window.localStorage.getItem("kleanads");function l(){return r||d}function c(e,t){return`[${e}] [${performance.now().toFixed(2)}] ${t}`}function u(e,t,...i){l()&&console.log(c(e,t),...i)}function f(e,t,...i){l()&&console.debug(c(e,t),...i)}function h(e,t,...i){l()&&console.error(c(e,t),...i)}function g(e,t){const i={type:"customEvent",eventName:e,message:t};window.postMessage(i,"*")}function p(e){const t=document.createElement("meta");t.setAttribute("name","pbstck_context:pbstck_ab_test"),t.content=e,document.head.appendChild(t)}function v(e,t){const i=document.createElement("meta");i.setAttribute("name",`pbstck:${e}`),i.content=t,document.head.appendChild(i)}function m(e){const t={};e.document.querySelectorAll('meta[name^="ad:"]').forEach((e=>{const i=function(e){var t;const i=(null===(t=e.attributes.getNamedItem("name"))||void 0===t?void 0:t.value)||"";return i.startsWith("ad:")?i.slice(3):i}(e);i&&(t[i]=function(e){var t;const i=(null===(t=e.attributes.getNamedItem("content"))||void 0===t?void 0:t.value)||"";return i.split(",")}(e))}));const i=new URLSearchParams(e.location.search);for(const e of i.keys())e.startsWith("ad:")&&(u("kleanads-common",`Add key ${e} found in URL to metaTargetings`),t[e.slice(3)]=i.getAll(e));return t}function b(){const e=document.head.querySelector('meta[name="ad:no_cmp"]');return!!e&&"true"===e.content}var y;!function(e){e.Stop="stop",e.Continue="continue",e.InstantSecondChance="instantSecondChance"}(y||(y={}));const C={advertisers:[],orders:[],lineItems:[]},A="adm";class w{constructor(e,t,i,n=1){this.tagId=e,this.kleanadsVersion=t,this.throttling=n,this.device=i||"na"}handleMessage(e,t,i){const n={source:"kleanads",type:"log",level:e,message:t,tagId:this.tagId,kleanadsVersion:this.kleanadsVersion,href:window.location.href,device:this.device,...i};var s,o;s=n,o=this.throttling,100*Math.random()<o&&navigator.sendBeacon("https://intake.pbstck.com/v1/trace",JSON.stringify(s))}error(e){this.handleMessage("error",e)}warn(e){this.handleMessage("warn",e)}logWithPayload(e,t){this.handleMessage("info",e,t)}errorWithPayload(e,t){this.handleMessage("error",e,t)}}const S="kleanads";let I,k="na",E="na",$="na";function T(e){$=e}function O(e,...t){u(S,e,...t)}function R(e,...t){f(S,e,...t)}function _(e,...t){!function(e,t,...i){l()&&console.warn(c(e,t),...i)}(S,e,...t),null==I||I.warn(e)}function L(e,...t){h(S,e,...t),null==I||I.error(e),navigator.sendBeacon(`https://intake.pbstck.com/v1/intake/error?tId=${k}&v=${E}&s=${$}&c=1`,JSON.stringify([{message:e}]))}function U(e,t){null==I||I.logWithPayload(e,t)}function P(e){return null!==document.getElementById(e)}function x(e){const t=document.getElementById(e);if(t){return t.getBoundingClientRect().top}return O(`[DOM] div ${e} not found during get distance from top`),0}function N(e,t){return new Promise(((i,n)=>e().then(i).catch((i=>{return t>1?(s=100,new Promise((e=>setTimeout(e,s)))).then(N.bind(null,e,t-1)).then((e=>e)).catch(n):n(i);var s}))))}const j=async(e,t=3)=>N((()=>import(e)),t).then((e=>e)).catch((i=>{throw L(`Failed to load module ${e} after ${t} retries`,i),new Error("Too many failed attempt to load external module.")})),D=(e,t)=>{const i=function(e,t){const i=document.createElement("script");return i.setAttribute("src",e),i}(e);i.setAttribute("async","true"),i.setAttribute("data-kleanads","true"),document.head.append(i)};async function B(e,t){const{beforeStart:i}=t,n=function(e,t){var i;return(null!==(i=e.extraScripts)&&void 0!==i?i:[]).filter((i=>i.tagId===e.tagId&&!!i.beforeStart===t))}(e,i);if(n.length>0){O(i?"Loading extraScripts before config":"Loading extraScripts after consent");const e=n.filter((({synchronous:e})=>!e)).flatMap((e=>e.scripts)),t=n.filter((({synchronous:e})=>e)).flatMap((e=>e.scripts));O(`downloading async extra script ${e}`),e.forEach((e=>D(e))),O(`downloading sync extra script ${t}`);for(const e of t)try{await j(e)}catch(e){O("[extra-script] Error while loading sync extra script",e)}}}function M(e,t){return e.size<t.size?1:e.size>t.size?-1:0}function F(e){return e.filter(V)}function z(e){if("fluid"===e)return"fluid";const[t,i]=e.split("x");return[parseInt(t,10),parseInt(i,10)]}function W(e){return e>=100||e>=Math.floor(100*Math.random())+1}function V(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const G=["master","master-1","master-2","master-3","companion",void 0],H=(e,t)=>G.indexOf(e.roadblock)-G.indexOf(t.roadblock)||x(e.divId)-x(t.divId);var J;!function(e){e.USE_EXISTING_DIV="useExistingDiv",e.CREATE_NEW_DIV="createNewDiv"}(J||(J={}));const K=(e,t)=>"fluid"===e&&"fluid"===t||e[0]===t[0]&&e[1]===t[1],q=e=>!!e.sizes.find((e=>K(e,[1800,1e3])));function Y(e){var t;const i=null!==(t=e.values)&&void 0!==t?t:[];return e.value?e.value:i}const X=(e,t)=>({...e,bids:t.map((e=>({bidder:e.bidder,params:e.params}))),mediaTypes:{video:{mimes:["video/mp4","video/webm","application/javascript"],context:"instream",playerSize:[640,480]}}}),Q=(e,t)=>({...t,bids:e.bidders.filter((e=>e.mediaTypes.includes("Outstream"))).map((e=>({bidder:e.bidder,params:e.params}))),mediaTypes:{video:{context:"outstream",playerSize:[640,480],mimes:["video/mp4","video/ogg","video/webm","application/javascript"],protocols:[1,2,3,4,5,6,7,8,11,12,13,14],api:[1,2,3,5,6,7],playbackmethod:[2,3,4],skip:1,linearity:2,startdelay:0,placement:3,plcmt:4,maxduration:30,playVideoVisibleThreshold:25,nonViewableBehavior:"pause"}},renderer:{url:"https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js",options:{adText:"",aspectRatio:"16:9",skippable:{enabled:!0,skipButtonText:"SKIP"}}}}),Z=["adyoulike"],ee=(e,t,i)=>{const n=e.biddersSkin?i.filter((t=>{var i;return null===(i=e.biddersSkin)||void 0===i?void 0:i.includes(t.bidder)})):i,s={...t,bids:n.filter((e=>!Z.includes(e.bidder))).map((e=>({bidder:e.bidder,params:e.params}))),mediaTypes:{banner:{sizes:[[1800,1e3]]}}},o=F(e.sizes).filter((e=>!K(e,[1800,1e3])));if(o.length>0){return[{...t,bids:i,mediaTypes:{banner:{sizes:o}}},s]}return[s]},te=(e,t)=>({...t,bids:e.bidders.filter((e=>e.mediaTypes.includes("Banner"))).map((e=>({bidder:e.bidder,params:e.params}))),mediaTypes:{banner:{sizes:F(e.sizes)}}}),ie=(e,t)=>({...t,bids:e.bidders.filter((e=>e.mediaTypes.includes("Native"))).map((e=>({bidder:e.bidder,params:e.params}))),mediaTypes:{native:e.nativeParams}});function ne(e,t){var i;const n=e.floors;n&&t&&(n.values.banner=Math.max(n.values.banner,t));const s={code:e.divId,pubstack:{adUnitName:e.adServerAdUnitName,adUnitPath:se(e)},floors:n,ortb2Imp:e.ortb2Imp},o=e.getTargetings();if(o.find((e=>"ad_index"===e.key))){const e=null===(i=o.find((e=>"ad_index"===e.key)))||void 0===i?void 0:i.value;s.pubstack&&(s.pubstack.tags=[`ad_index:${e}`])}const a=e.mediaTypes;if(a.includes("Instream"))return[X(s,e.bidders)];const r=[];return a.includes("Banner")&&(q(e)?r.push(...ee(e,s,e.bidders)):r.push(te(e,s))),a.includes("Outstream")&&r.push(Q(e,s)),a.includes("Native")&&r.push(ie(e,s)),r}function se(e){var t;const i=[...e.getTargetings()],n=(null!==(t=e.pubstackDeclarationTargetingKeys)&&void 0!==t?t:[]).map((e=>{const t=i.find((t=>t.key===e));if(t)return t;{const t=m(window)[e];return t?{key:e,values:t}:void 0}})).filter((e=>!!e)).map((e=>`${e.key}=${function(e){const t=e.values?e.values.join(","):"";return e.value?e.value:t}(e)}`)).join("&"),s=e.adUnitPath.includes("?")?"&":"?";return n.length>0?`${e.adUnitPath}${s}${n}`:e.adUnitPath}class oe{constructor(){this.uprEnabled=!0,this.disableGptPreAuction=!1,this.kleanadsRunCount=1}setUprState(e,t){switch("true"===function(e,t){const i=`meta[name="${t}"]`,n=e.document.querySelector(i);return null!==n?n.getAttribute("content"):null}(window,"adm_feature:upr_disabled")&&(e="disabled"),e){case"disabled":this.uprEnabled=!1;break;case"tested":this.uprEnabled=W(null!=t?t:50),this.uprTested=!0;break;default:this.uprEnabled=!0}}setKleanadsRunCount(e){this.kleanadsRunCount=e}static getInstance(){return oe.instance||(oe.instance=new oe),oe.instance}}function ae(e){if("string"==typeof e)return!0;if(Array.isArray(e)){for(const t of e)if("string"!=typeof t)return!1;return!0}return!1}function re(e,t,i){const n=t.getTargeting(i);n&&n.length>0&&(O(`removing ${i} targeting from slot ${e}`),t.clearTargeting(i))}const de="bid_bidder",le="bid_size",ce="bid_mediatype",ue="[instream] [Dailymotion]";class fe{constructor(e,t,i,n){this.callbackAdded=!1,this.configSetOnce=!1,this.adReadyToFetchReceivedOnce=!1,this.adReadyToFetchCallback=()=>{},this.declaredAdUnit="",this.pubstackWindow=e,this.pageContext=t,this.device=i,this.targetings=ge(this.device,this.pubstackWindow),this.instreamType=null!=n?n:"dailymotion-v1"}declareAdUnit(e){"dailymotion-v3"===this.instreamType&&""===this.declaredAdUnit&&(this.declaredAdUnit=e.divId,this.executeWhenAdServerReady((()=>{const t=this.pubstackWindow.dailymotion;t?t.getPlayer(e.divId).then((t=>{var i;t.on(null===(i=this.pubstackWindow.dailymotion)||void 0===i?void 0:i.events.AD_READYTOFETCH,(()=>{O(`${ue} ${e.divId} event AD_READYTOFETCH received`),this.adReadyToFetchReceivedOnce||(this.adReadyToFetchReceivedOnce=!0),this.adReadyToFetchCallback()}))})):L(`${ue} unable to get dailymotion on the page`)})))}setApsTargetings(e){var t;if(0!==e.length){O(`${ue} putting targeting keys for aps auction of winning bidder`,e[0]);try{const i=null===(t=e[0].helpers)||void 0===t?void 0:t.qsParams();if(i)return void this.targetings.push(i.slice(1));const n=e[0].qsParams;if(n)return void this.targetings.push(n.slice(1))}catch(e){L(`${ue} error setting APS targetings`,e)}}}executeWhenAdServerReady(e){this.pubstackWindow.dailymotion?e():setTimeout(this.executeWhenAdServerReady.bind(this,e),100)}async callAdServer(e,t){var i,n,s;const o=e.divId;if("dailymotion-v3"===this.instreamType&&e.divId!==this.declaredAdUnit)return void L(`${ue} ${e.divId} call ad server but it is not the same divId as the one declared ${this.declaredAdUnit}`);O(`${ue} ${o} call ad server`);const a=await(null===(i=this.pubstackWindow.dailymotion)||void 0===i?void 0:i.getPlayer(o));if(!a)return void L(`${ue} no player found for ${o}`);O(`${ue} ${o} player:`,a);const r=await a.getState();switch(this.customConfig=function(e,t,i,n){var s,o;const a=function(e){return e.getTargetings().map(he)}(e);O(`${ue} adUnitTargetings`,a);const r=Array.from(i.entries()).filter((([,e])=>!!e)).map((([e,t])=>`${e}=${t}`)),d=a.concat(t).concat(r).join("&"),l={...null===(s=e.instreamParams)||void 0===s?void 0:s.vast,vpmute:n.playerIsMuted?1:0},c=Object.keys(l).map((function(e){return`${e}=${l[e]}`})).join("&"),u=null===(o=e.instreamParams)||void 0===o?void 0:o.adDeactivationContext;let f=!1;if(u){const e=i.get(u.key);f=!!e&&u.values.includes(e)}const h={dynamiciu:e.adUnitPath,keyvalues:d,keyvalues2:c};return f?{...h,premium:"true"}:h}(e,this.targetings,this.pageContext,r),O(`${ue} generated customConfig`,this.customConfig),this.instreamType){case"dailymotion-v1":O(`${ue} ${o} setCustomConfig`,this.customConfig),a.setCustomConfig(this.customConfig),O(`${ue} ad server called ${o}`),document.dispatchEvent(new CustomEvent("admDailymotionReady",{detail:{divId:o}})),O(`${ue} ${o} admDailymotionReady event dispatched`);break;case"dailymotion-v2":this.callbackAdded||(O(`${ue} ${o} add callback to event ${null===(n=this.pubstackWindow.dailymotion)||void 0===n?void 0:n.events.AD_READYTOFETCH}`),a.on(null===(s=this.pubstackWindow.dailymotion)||void 0===s?void 0:s.events.AD_READYTOFETCH,(()=>{O(`${ue} ${o} event AD_READYTOFETCH received, setCustomConfig`,this.customConfig),this.customConfig&&a.setCustomConfig(this.customConfig),t&&(O(`${ue} ${o} event AD_READYTOFETCH, call "onCallFinished"`),t())})),this.callbackAdded=!0);break;case"dailymotion-v3":!this.configSetOnce&&this.adReadyToFetchReceivedOnce?(O(`${ue} ${e.divId} event AD_READYTOFETCH already received, setting customConfig"`,this.customConfig),this.customConfig&&(a.setCustomConfig(this.customConfig),this.configSetOnce=!0),t&&(O(`${ue} ${e.divId} event AD_READYTOFETCH, call "onCallFinished"`),t())):this.adReadyToFetchCallback=()=>{O(`${ue} ${e.divId} event AD_READYTOFETCH callback, setting customConfig"`,this.customConfig),this.customConfig&&a.setCustomConfig(this.customConfig)}}}setPbjsTargetings(e,t){if(e){O(`${ue} put pbjs targeting keys for ${t.divId}`);const i=e.getAdserverTargetingForAdUnitCode(t.divId);for(const e of Object.keys(i)){const n=i[e];ae(n)?this.targetings.push(`${e}=${n}`):_(`${ue} [targeting] unable to set targeting ${e}=${n} on adUnit ${t.divId}`)}}else L(`${ue} no pbjs given: unable to put header bidding targetings`)}cleanTargetings(){this.targetings.splice(0),this.targetings.push(...ge(this.device,this.pubstackWindow))}}function he(e){const t=Y(e);return`${e.key}=${"string"==typeof t?t:t.join(",")}`}function ge(e,t){const i=[],n=m(t);Object.keys(n).forEach((e=>{const t=n[e].join(",");i.push(`${e}=${t}`)})),i.push(`${A}=1`),i.push(`device=${e}`);const s=oe.getInstance().grapeshotValues;(null==s?void 0:s.length)&&i.push(`gs_cat=${s.join(",")}`);try{const e=JSON.parse(t.localStorage._pdfps).slice(0,250).join(",");""!==e?i.push(`permutive=${e}`):O(`[${ue}] no permutive targeting found`)}catch(e){O(`[${ue}] error reading permutive targeting, ${e}`)}return i}const pe="adServerAdUnitName";function ve(e,t,i,n){const s=[];if("number"!=typeof t&&""===t||s.push(t),i&&0!==i.length){const e=function(e,t){return e.filter((e=>e!==pe)).map((e=>t.get(e))).filter((e=>e)).join("/")}(i,n);e&&s.push(e)}else _("Ad unit path config is missing for this site");const o=`/${s.join("/")}`;return i&&i.includes(pe)?`${o}/${e}`:`${o}`}function me(e){return new Promise(((t,i)=>{if(window.lucead_loaded)return void t();window.lucead_loaded=!0;const n=document.createElement("script");n.src=`https://s.lucead.com/prebid/${e}.js`,n.onload=()=>t(window.lucead_prebid),n.onerror=i,document.head.appendChild(n)}))}function be(e){return e&&"string"==typeof e?e:void 0}function ye(e){if(null!=e&&"number"==typeof e)return e}function Ce(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Ae(e){var t,i,n,s,o,a,r,d,l;if(!Ce(e))throw new Error("unable to parse JSON: adUnit is not valid");const c=we(e.divId,"divId"),u=we(e.adUnitName,"adUnitName"),f=function(e,t){if(!Array.isArray(e))throw new Error(`Unable to parse JSON: the ${t} field ${e} is not a valid list of Size`);return e}(e.sizes,"sizes"),h=function(e,t){if(!Array.isArray(e))throw new Error(`Unable to parse JSON: the ${t} field ${e} is not a valid list of PrebidBidder`);for(const t of e)if("string"!=typeof t.bidder)throw new Error(`Unable to parse JSON: the bidder field ${t.bidder} (inside bidders) is not a valid bidder name`);return e}(e.bidders,"bidders"),g=Se(e.parallax,"parallax",!1),p=Se(e.dynamic,"dynamic",!1),v=Ie(e.targeting,"targeting"),m=function(e,t){if(!e)return;if(!Array.isArray(e))throw new Error(`Unable to parse JSON: the ${t} field ${e} is not valid KeyValueTargeting list`);const i=[];for(const n of e){const e=Ie(n,t);e&&i.push(e)}return i}(e.extraTargetings,"extraTargetings");if(void 0!==e.floors&&!Ce(e.floors))throw new Error("unable to parse JSON: the floors field is not valid");if(void 0!==(null===(t=e.floors)||void 0===t?void 0:t.currency)&&"string"!=typeof(null===(i=e.floors)||void 0===i?void 0:i.currency))throw new Error("unable to parse JSON: the floors field is missing the currency");if(void 0!==(null===(n=e.floors)||void 0===n?void 0:n.schema)&&!Ce(null===(s=e.floors)||void 0===s?void 0:s.schema))throw new Error("unable to parse JSON: the floors field is missing the schema");if(e.floors){if("string"!=typeof(null===(o=e.floors.schema)||void 0===o?void 0:o.delimiter))throw new Error("unable to parse JSON: the floors schema field is missing the delimiter");if(!Array.isArray(null===(a=e.floors.schema)||void 0===a?void 0:a.fields))throw new Error("unable to parse JSON: the floors field schema delimiter is not an array");for(const t of e.floors.schema.fields)if(void 0===t||"string"!=typeof t)throw new Error("unable to parse JSON: the bidder field inside bidders array is not valid")}if(void 0!==(null===(r=e.floors)||void 0===r?void 0:r.values)&&"object"!=typeof(null===(d=e.floors)||void 0===d?void 0:d.values))throw new Error("unable to parse JSON: the floors field is missing the values or they are not well formed");if(void 0!==e.extraAdServerSizes&&!Array.isArray(e.extraAdServerSizes))throw new Error(`unable to parse JSON: the extraAdServerSizes field for adunit ${c} is not valid: ${e.extraAdServerSizes}`);let b,y,C,A;if(void 0!==e.canOutstream&&"boolean"!=typeof e.canOutstream)throw new Error("unable to parse JSON: the canOutstream field is not valid");if(b=e.canOutstream,void 0!==e.isInstream&&"boolean"!=typeof e.isInstream)throw new Error("unable to parse JSON: the isInstream field is not valid");if(y=e.isInstream,e.biddersOutstream){if(!Array.isArray(e.biddersOutstream))throw new Error(`unable to parse JSON: the biddersOutstream field for adunit ${c} is not valid: ${e.biddersOutstream}`);for(const t of e.biddersOutstream)if("string"!=typeof t)throw new Error("unable to parse JSON: the value inside biddersOutstream array is not valid")}switch(e.outOfPageType){case"interstitial":case"default":C=e.outOfPageType;break;default:C=void 0}switch(e.roadblock){case"master":case"master-1":case"master-2":case"master-3":case"companion":A=e.roadblock;break;default:A=void 0}return{divId:c,adUnitName:u,sizes:f,adServerAdUnitName:e.adServerAdUnitName,slotName:e.slotName,bidders:h,parallax:g,dynamic:p,targeting:v,extraTargetings:m,anchor:e.anchor,floors:e.floors,extraAdServerSizes:e.extraAdServerSizes,headerBiddingEnabled:Se(e.headerBiddingEnabled,"headerBiddingEnabled",!0),canOutstream:b,isInstream:y,biddersOutstream:null!==(l=e.biddersOutstream)&&void 0!==l?l:[],outOfPageType:C,roadblock:A}}function we(e,t){if("string"!=typeof e)throw new Error(`Unable to parse JSON: the ${t} field ${e} is not a valid string`);return e}function Se(e,t,i){if(void 0!==e&&"boolean"!=typeof e)throw new Error(`Unable to parse JSON: the ${t} field ${e} is not a valid boolean`);return null!=e?e:i}function Ie(e,t){if(!e)return;if(!Ce(e))throw new Error(`Unable to parse JSON: the ${t} field ${e} is not a valid KeyValueTargeting`);const i=we(e.key,t),n=be(e.value),s=function(e){if(e&&Array.isArray(e))return e}(e.values);if(!n&&!s)throw new Error(`Unable to parse JSON: targeting.value(s) is not valid for field ${t}`);return{key:i,value:n,values:s}}function ke(e){return e.startsWith("css:")?e.replace("css:",""):void 0}const Ee=(e,t,i)=>e.includes("Outstream")?i.includes(t.bidder)?[...e]:[...e.filter((e=>"Outstream"!==e))]:[...e],$e=e=>{var t;const i=(e=>{var t;const i=[];return e.isInstream?["Instream"]:((e.sizes.length>0||(null!==(t=e.extraAdServerSizes)&&void 0!==t?t:[]).length>0)&&i.push("Banner"),e.canOutstream&&i.push("Outstream"),e.canNative&&i.push("Native"),i)})(e);let n=e.bidders.map((t=>({mediaTypes:Ee(i,t,e.biddersOutstream),bidder:t.bidder,params:t.params})));if(i.includes("Native")&&(null===(t=e.biddersNative)||void 0===t?void 0:t.length)){n=n.map((e=>({...e,mediaTypes:e.mediaTypes.filter((e=>"Native"!==e))})));const t=e.biddersNative.map((e=>({mediaTypes:["Native"],bidder:e.bidder,params:e.params})));n.push(...t)}return{bidders:n,mediaTypes:i}};function Te(e,t,i,n,s){return e.flatMap((e=>{var o,a,r,d,l,c;const u=ve(e.adServerAdUnitName||e.divId,i,n,t);if(e.bidders.forEach((e=>{var t;if("lucead"===e.bidder&&(null===(t=e.params)||void 0===t?void 0:t.siteId)){const{siteId:t,...i}=e.params;e.params={...i,loader:me(t)}}})),e.dynamic)return function(e,t,i){return function(e){const t=ke(e.divId)||`[id^="${e.divId}"]`;try{return Array.from(document.querySelectorAll(t))}catch(e){return L(`${t} is not a valid CSS selector, ${e}`),[]}}(e).map((n=>{var s,o,a;const r=n.id;return r||L(`Unable to find an id on DOM element for adUnit.divId ${e.divId}`),{...e,...$e(e),divId:r,slotName:(null===(s=null==n?void 0:n.attributes.getNamedItem("data-aps-slotname"))||void 0===s?void 0:s.value)||e.slotName||t,dynamic:!1,adUnitPath:(null===(o=null==n?void 0:n.attributes.getNamedItem("data-adunitpath"))||void 0===o?void 0:o.value)||t,adServerAdUnitName:null!==(a=e.adServerAdUnitName)&&void 0!==a?a:e.divId,pubstackDeclarationTargetingKeys:null!=i?i:[],getTargetings:()=>[...[...e.targeting?[e.targeting]:[],...e.extraTargetings||[]],...[...Re(null==n?void 0:n.attributes),Oe(r)]]}}))}(e,u,s);{const t=function(e){const t=ke(e);try{return t?document.querySelector(t):document.getElementById(e)}catch(t){return L(`${e} is not a valid CSS selector, ${t}`),null}}(e.divId);if(t||"interstitial"===e.outOfPageType||(null===(o=e.anchor)||void 0===o?void 0:o.mode)===J.CREATE_NEW_DIV){t&&!(null==t?void 0:t.id)&&L(`Unable to find an id on DOM element for adUnit.divId ${e.divId}`);const i=(null===(a=null==t?void 0:t.attributes.getNamedItem("data-adunitpath"))||void 0===a?void 0:a.value)||u;return[{...e,...$e(e),divId:null!==(r=null==t?void 0:t.id)&&void 0!==r?r:e.divId,adUnitPath:i,slotName:(null===(d=null==t?void 0:t.attributes.getNamedItem("data-aps-slotname"))||void 0===d?void 0:d.value)||e.slotName||i,adServerAdUnitName:null!==(c=null!==(l=e.adServerAdUnitName)&&void 0!==l?l:null==t?void 0:t.id)&&void 0!==c?c:e.divId,pubstackDeclarationTargetingKeys:null!=s?s:[],getTargetings:()=>[...[...e.targeting?[e.targeting]:[],...e.extraTargetings||[]],...[...Re(null==t?void 0:t.attributes)]]}]}return O(`Div id missing for ${e.divId}, no further action on this ad unit`),[]}}))}function Oe(e){const t=new RegExp("\\D","g");return{key:"ad_index",value:e.replace(t,"")}}function Re(e){return Array.from(null!=e?e:[]).filter((e=>e.name.startsWith("data-ad-"))).map((e=>({key:e.name.replace("data-ad-",""),value:e.value})))}var _e,Le,Ue;function Pe(e){if(!e)return;if(!Ce(e))throw new Error("unable to parse JSON: lazyLoadingGoogle field is not valid");if(0===Object.keys(e).length||!e.googleFetchMarginPercent&&!e.googleRenderMarginPercent&&!e.googleMobileScaling)return{};const t={};return"number"==typeof e.googleFetchMarginPercent&&(t.googleFetchMarginPercent=e.googleFetchMarginPercent),"number"==typeof e.googleRenderMarginPercent&&(t.googleRenderMarginPercent=e.googleRenderMarginPercent),"number"==typeof e.googleMobileScaling&&(t.googleMobileScaling=e.googleMobileScaling),t}function xe(e){if(null==e)return;if(!Ce(e))throw new Error("unable to parse JSON: lazyLoadingKleanads field is not valid");let t;return"number"!=typeof e.viewportPercent?e.numberOfViewports&&"number"==typeof e.numberOfViewports?t=e.numberOfViewports:(_("unable to parse JSON: the lazyLoadingKleanads field is not valid, falling back to 0 viewport"),t=0):t=e.viewportPercent,{viewportPercent:t}}function Ne(e){if(null!=e){if(!Ce(e))throw new Error("unable to parse JSON: lazyLoading field is not valid");if("string"!=typeof e.configName)throw new Error("unable to parse JSON: the lazyLoading's configName field is not valid");return{configName:e.configName,lazyLoadingGoogle:Pe(e.lazyLoadingGoogle),lazyLoadingKleanads:xe(e.lazyLoadingKleanads)}}}function je(e){if(!Array.isArray(e))throw new Error("unable to parse JSON: the adUnits field is not valid");const t=[];for(const i of e)try{t.push(Ae(i))}catch(e){L("Invalid ad unit configuration",e)}return t}function De(e){if(!e)return;if(!Ce(e))throw new Error("unable to parse JSON: the refreshConfig field is not valid");if(!Array.isArray(e.adUnitConfig))throw new Error("unable to parse JSON: the refreshConfig field is not valid");const t=[];for(const i of e.adUnitConfig)try{t.push(Be(i))}catch(e){L("Invalid refresh configuration",e)}return{adUnitConfig:t}}function Be(e){if(!Ce(e))throw new Error("unable to parse JSON: the adUnitRefreshConfig field is not valid");if(!Array.isArray(e.specificRules))throw new Error("unable to parse JSON: the adUnitRefreshConfig specificRules field is not valid");if("number"!=typeof e.timer)throw new Error("unable to parse JSON: the adUnitRefreshConfig timer field is not valid");if(void 0===e.adUnitNames)throw new Error("unable to parse JSON: the adUnitRefreshConfig adUnitNames field is missing");if(!Array.isArray(e.adUnitNames))throw new Error("unable to parse JSON: the adUnitRefreshConfig adUnitNames field is not valid");if(void 0!==e.alwaysInView&&"boolean"!=typeof e.alwaysInView)throw new Error("unable to parse JSON: the adUnitRefreshConfig alwaysInView field is not valid");let t,i;if(void 0!==e.refreshBehaviorOnEmpty)switch(e.refreshBehaviorOnEmpty){case"continue":t=y.Continue;break;case"instantSecondChance":t=y.InstantSecondChance;break;case"stop":t=y.Stop;break;default:throw new Error("unable to parse JSON: the adUnitRefreshConfig refreshBehaviorOnEmpty field is not valid")}if(void 0!==e.refreshOutOfFocusConfig){if(!Ce(e.refreshOutOfFocusConfig))throw new Error("unable to parse JSON: the adUnitRefreshConfig refreshOutOfFocusConfig field is not valid");if(void 0===e.refreshOutOfFocusConfig.timerInView||"number"!=typeof e.refreshOutOfFocusConfig.timerInView)throw new Error("unable to parse JSON: the adUnitRefreshConfig refreshOutOfFocusConfig timerInView field is not valid");if(void 0!==e.refreshOutOfFocusConfig.refreshOutOfView&&"boolean"!=typeof e.refreshOutOfFocusConfig.refreshOutOfView)throw new Error("unable to parse JSON: the adUnitRefreshConfig refreshOutOfFocusConfig refreshOutOfView field is not valid");i={timerInView:e.refreshOutOfFocusConfig.timerInView,refreshOutOfView:e.refreshOutOfFocusConfig.refreshOutOfView}}return{adUnitNames:e.adUnitNames,timer:e.timer,capping:ye(e.capping),specificRules:e.specificRules,alwaysInView:e.alwaysInView,refreshBehaviorOnEmpty:t,refreshOutOfFocusConfig:i}}function Me(e){if(!function(e){if(!e)throw new Error("unable to parse JSON: prebidConfig field is not valid");return Object.keys(e).includes("adCallTimeout")&&Object.keys(e).includes("pbjsConfig")}(e))throw new Error("unable to parse JSON: prebidConfig field is not valid");if("number"!=typeof e.adCallTimeout)throw new Error("unable to parse JSON: the prebidConfig's adCallTimeout field is not valid");return{adCallTimeout:e.adCallTimeout,pbjsConfig:Fe(e.pbjsConfig)}}function Fe(e){if(!Ce(e))throw new Error("unable to parse JSON: pbjsConfig field is not valid");void 0===e.allowLocalStorage&&(e.allowLocalStorage=!0);const t=ze(e,"userSync"),i=ze(e,"outbrain"),n=ze(e,"realTimeData"),s=ze(e,"analytics"),o=ze(e,"currency"),a=ze(e,"bidderConfigs"),r=ze(e,"priceGranularity"),d=ze(e,"floors"),l=ze(e,"schain"),c=function(e){if(e&&Array.isArray(e))return e}(e.bidderAliases);return{...e,...c&&{bidderAliases:c},...t&&{userSync:t},...i&&{outbrain:i},...n&&{realTimeData:n},...s&&{analytics:s},...a&&{bidderConfigs:a},...o&&{currency:o},...r&&{priceGranularity:r},...d&&{floors:d},...l&&{schain:l}}}!function(e){e.DISABLED="DISABLED",e.ENABLED_ALL_SLOTS="ENABLED_ALL_SLOTS"}(_e||(_e={})),function(e){e.firstId="firstId",e.utiqId="utiqId",e.sharedId="sharedId"}(Le||(Le={})),function(e){e.id5id="id5Id"}(Ue||(Ue={}));const ze=(e,t)=>{if(!(t in e))return;const i=be(e[t]);if(i)try{return JSON.parse(i)}catch(e){L(`unable to parse JSON in pbjsConfigFromPartial: ${t} `,e)}};async function We(e,t,i,n){const s=function(e,t,i,n){const s=function(e,t,i,n,s){return`${e}/config/${t.scopeId.substring(0,8)}/${n.substring(0,8)}/${t.stackId}/${i}/${s}.json`}(e.configUrl,i,n,e.tagId,t);return s.replace(/([^:]\/)\/+/g,"$1")}(e,t,i,n);return new Promise((e=>{fetch(s).then((t=>{t.text().then((async t=>{const i=function(e){const t=JSON.parse(e);return{...t,lazyLoading:Ne(t.lazyLoading),adUnits:je(t.adUnits),prebidConfig:Me(t.prebidConfig),refreshConfig:De(t.refreshConfig)}}(t);e(i)}))})).catch((async t=>{L(`unable to load the configuration ${t}`),e(void 0)}))}))}var Ve,Ge,He;!function(e){e.BEGIN_INIT="begin_init",e.CMP_RESPONSE_AVAILABLE="cmp_response_available",e.MAIN_THREAD_END="main_thread_end",e.GOOGLETAG_READY="googletag_ready",e.APSTAG_READY="apstag_ready",e.PREBID_READY="prebid_ready"}(Ve||(Ve={})),function(e){e.BEGIN_CONFIGURE="begin_configure",e.BEGIN_START="begin_start",e.SPA_RELOAD="spa_reload"}(Ge||(Ge={})),function(e){e.START_AUCTION="start_auction",e.END_PBJS_AUCTION="end_pbjs_auction",e.END_APS_AUCTION="end_aps_auction",e.START_AD_SERVER_CALL="start_ad_server_call",e.SLOT_RENDER_ENDED_TIME="slot_render_ended_time",e.SLOT_RESPONSE_RECEIVED_TIME="slot_response_received_time"}(He||(He={}));const Je=[],Ke=[],qe="getEntriesByName"in performance&&"measure"in performance&&"mark"in performance;function Ye(e){Je.includes(e)||(ot(e),Je.push(e))}function Xe(e){ot(e)}function Qe(e,t){const i=st(e,t);Ke.includes(i)||(ot(i),Ke.push(i))}function Ze(e){return function(e){if(qe)return performance.getEntriesByName(e).map((e=>e.startTime));return[]}(e)}function et(e){if(Je.includes(e))return function(e){if(qe)return performance.getEntriesByName(e)[0].startTime;return}(e)}function tt(e,t){if(Je.includes(e)&&Je.includes(t))return at(e,t)}function it(e,t,i){const n=st(e,i);if(Je.includes(t)&&Ke.includes(n))return at(t,n)}function nt(e,t,i){const n=st(e,t),s=st(e,i);if(Ke.includes(n)&&Ke.includes(s))return at(n,s)}function st(e,t){return`${e}_${t}`}function ot(e){qe&&(performance.mark(e.toString()),O(`[performance] [mark] ${e}: ${performance.getEntriesByName(e)[0].startTime.toFixed(2)}`))}function at(e,t){if(qe){const i=`measure_${e}_${t}`,n=performance.getEntriesByName(i);if(0!==n.length&&"measure"===n[0].entryType)return n[0].duration;try{return performance.measure(i,e,t).duration}catch{return}}}var rt;!function(e){e.UNKNOWN="unknown",e.WAIT_USER_CONSENT="wait_user_consent",e.WAIT_USER_REFUSED="wait_user_refused"}(rt||(rt={}));let dt=rt.UNKNOWN;function lt(e){dt=e}const ct=[];function ut(e,t){ct.includes(e)||(U("[metric] adunit",{...gt(e,t)}),ct.push(e))}const ft=new Map;function ht(e){const t=function(e){const t=performance.getEntriesByName(e);return t.length>0&&"mark"===t[0].entryType}(Ve.GOOGLETAG_READY);ft.set(e,t)}function gt(e,t){return{adUnit:e,consentType:dt,eventOrigin:t,startAuctionFromConsent:it(e,Ve.CMP_RESPONSE_AVAILABLE,He.START_AUCTION),pbjsAuctionDuration:nt(e,He.START_AUCTION,He.END_PBJS_AUCTION),apsAuctionDuration:nt(e,He.START_AUCTION,He.END_APS_AUCTION),startAdServerCallFromConsent:it(e,Ve.CMP_RESPONSE_AVAILABLE,He.START_AD_SERVER_CALL),slotRenderEndedFromConsent:it(e,Ve.CMP_RESPONSE_AVAILABLE,He.SLOT_RENDER_ENDED_TIME),adServerResponseDuration:nt(e,He.START_AD_SERVER_CALL,He.SLOT_RESPONSE_RECEIVED_TIME),totalAdCallDuration:nt(e,He.START_AUCTION,He.SLOT_RENDER_ENDED_TIME),isGoogletagReadyAtPbjsAuctionEnd:ft.get(e)}}function pt(){const e=et(Ve.BEGIN_INIT),t=Ze(Ge.BEGIN_CONFIGURE),i=Ze(Ge.BEGIN_START),n=Ze(Ge.SPA_RELOAD),s=function(e){if(e.length>=2)return e[e.length-1]-e[e.length-2];return}(n),o={countSpaReloads:n.length,countConfigures:t.length,countStarts:i.length};e&&t.length>0&&(o.initToConfigure=t[t.length-1]-e),t.length>0&&i.length>0&&(o.configureToStart=i[i.length-1]-t[t.length-1]),s?o.diffSpaReload=s:t[0]&&n[0]&&(o.diffSpaReload=n[0]-t[0]),U("[metric] start",o)}function vt(e){return new Promise(((t,i)=>{!function(e,t,i){(n=e,new Promise(((e,t)=>mt(n,e)))).then((()=>{try{!function(e,t){const i=function(e){return e.__tcfapi}(e);i("addEventListener",2,(e=>{if(e&&("useractioncomplete"===e.eventStatus||"tcloaded"===e.eventStatus)){O("[consent] Consent status ",e.eventStatus),Ye(Ve.CMP_RESPONSE_AVAILABLE);const i=function(e){if(!e.purpose.consents||0===Object.keys(e.purpose.consents).length)return!1;for(const t in e.purpose.consents)if(!e.purpose.consents[t])return!1;return!0}(e);lt(i?rt.WAIT_USER_CONSENT:rt.WAIT_USER_REFUSED),t(i)}}))}(e,t)}catch(e){O("[consent] Error while loading tcf api"),i(e)}})).catch((e=>{O("[consent] Error while loading tcf api",e),i(e)}));var n}(e,t,i)}))}function mt(e,t,i){const n=e.__tcfapi;n&&function(e){if("function"!=typeof e)throw new Error("__tcfapi is not a function");return!0}(n)?t():setTimeout((()=>mt(e,t)),100)}function bt(e){return e.map((e=>({key:e.key.toLowerCase(),defaultValue:e.defaultValue?e.defaultValue.toLowerCase():void 0,otherValues:e.otherValues?e.otherValues.map((e=>e.toLowerCase())):[]})))}function yt(e,t,i){(function(e,t,i){const n=[],s=bt(t).filter((e=>void 0!==e.defaultValue)).map((e=>e.key.toLowerCase())),o=[];e.document.querySelectorAll('meta[name^="pbstck_context:"]').forEach((e=>{var t;const i=null===(t=e.attributes.getNamedItem("name"))||void 0===t?void 0:t.value.substring(15).toLowerCase();i&&o.push(i)}));for(const e of i)s.includes(e)&&!o.includes(e)&&n.push(e);return n})(e,t,i).forEach((e=>{_(`[context] Missing ${e} context key used in adunit path`)}))}const Ct={pbjsFinished:!1,apsFinished:!1},At="[executor] [instream]";class wt{constructor(e,t,i,n){this.rank=1,this.adServer=e,this.pbjs=t,this.aps=i,this.kleanadsRunCount=n}executeAdCall(e){setTimeout((()=>{ut(e.divId,"executorTimeout")}),2e4),this.adServer.declareAdUnit(e),this.adUnitAuctionStatus?_(`${At} cannot make a new ad call, existing one on ${e.divId}.`):(O(`${At} executeAdCall for adunit`,e),this.startAuction(e))}executeRefresh(e){this.adServer.cleanTargetings();const t={labels:["pubstackRefresh",`pubstackRefreshRank:${e.rank}`]};this.startAuction(e.adUnit,t)}startAuction(e,t){this.adUnitAuctionStatus=Ct,Qe(e.divId,He.START_AUCTION),O(`${At} starting auctions for ${e.divId}`);const i=oe.getInstance().kleanadsRunCount;if(this.pbjs){const n=this.pbjs.getPbjs();this.pbjs.startPbjsAuction([e],(()=>{this.kleanadsRunCount===i?this.pbjsFinished(n,e):O(`${At} kleanads run count has changed (from ${this.kleanadsRunCount} to ${i}), avoid calling pbjsFinished`)}),t)}this.aps&&this.aps.startApsAuction([e],(t=>{this.kleanadsRunCount===i?this.apsFinished(e,t):O(`${At} kleanads run count has changed (from ${this.kleanadsRunCount} to ${i}), avoid calling apsFinished`)})),this.pbjs||this.aps||this.adServer.executeWhenAdServerReady((()=>{this.kleanadsRunCount===i?this.callAdServer(e):O(`${At} kleanads run count has changed (from ${this.kleanadsRunCount} to ${i}), avoid calling AdServer`)}))}isAlreadyMonetized(){return!!this.adUnitAuctionStatus}pbjsFinished(e,t){O(`${At} pbjs end callback for ${t.divId}`,e.getAllPrebidWinningBids()),Qe(t.divId,He.END_PBJS_AUCTION),ht(t.divId),this.adServer.executeWhenAdServerReady((()=>{O(`${At} pbjs end callback ad server ready ${t.divId}`),this.adServer.setPbjsTargetings(e,t),this.adUnitAuctionStatus&&(this.adUnitAuctionStatus.pbjsFinished=!0),this.canCallAdServer()&&this.callAdServer(t)}))}apsFinished(e,t){O(`${At} aps end callback ${e.divId}`,t),Qe(e.divId,He.END_APS_AUCTION),this.adServer.executeWhenAdServerReady((()=>{O(`${At} aps end callback ad server ready ${e.divId}`),this.adServer.setApsTargetings(t),this.adUnitAuctionStatus&&(this.adUnitAuctionStatus.apsFinished=!0),this.canCallAdServer()&&this.callAdServer(e)}))}canCallAdServer(){const e=this.adUnitAuctionStatus;return this.aps&&!this.pbjs?e&&e.apsFinished:this.pbjs&&!this.aps?e&&e.pbjsFinished:this.pbjs&&this.aps?e&&e.apsFinished&&e.pbjsFinished:void 0}callAdServer(e){Qe(e.divId,He.START_AD_SERVER_CALL),this.adServer.callAdServer(e,(()=>{O(`${At} onCallFinished called, adding setTimeout to a new auction`),setTimeout((()=>{this.executeRefresh({adUnit:e,rank:this.rank}),this.rank++}),5e3)})),O(`${At} ad server called ${e.divId}`)}}for(var St,It=[],kt=0;kt<256;++kt)It.push((kt+256).toString(16).slice(1));var Et=new Uint8Array(16);function $t(){if(!St&&!(St="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return St(Et)}var Tt={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ot(e,t,i){if(Tt.randomUUID&&!t&&!e)return Tt.randomUUID();var n=(e=e||{}).random||(e.rng||$t)();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(e,t=0){return(It[e[t+0]]+It[e[t+1]]+It[e[t+2]]+It[e[t+3]]+"-"+It[e[t+4]]+It[e[t+5]]+"-"+It[e[t+6]]+It[e[t+7]]+"-"+It[e[t+8]]+It[e[t+9]]+"-"+It[e[t+10]]+It[e[t+11]]+It[e[t+12]]+It[e[t+13]]+It[e[t+14]]+It[e[t+15]]).toLowerCase()}(n)}const Rt="[pbjs] [sublime]";function _t(e,t){const i=function(e,t){var i,n;const s=null===(i=null==t?void 0:t.find((e=>"sublime"===e.bidderSource)))||void 0===i?void 0:i.bidderLabel,o=e.filter((e=>e.bidders.find((e=>"sublime"===e.bidder||e.bidder===s))));if(0===o.length)return;if(o.length>1)return void _(`${Rt} Sublime bidder has multiple adUnits ${o.map((e=>e.divId)).join("")}`,o);const a=null===(n=o[0].bidders.find((e=>"sublime"===e.bidder||e.bidder===s)))||void 0===n?void 0:n.params;if(a){const e=a.zoneId;if(e&&("string"==typeof e||"number"==typeof e))return`${e}`}else _(`${Rt} unable to extract Sublime zoneId from ${o[0].divId}`,o[0])}(e,t);if(i){const e=`https://sac.ayads.co/sublime/${i}/prebid`;O(`${Rt}[initPbjs] loading sublime script ${e}`),D(e)}}function Lt(e,t){var i;const n=function(){window.sublime=window.sublime||{};const e=window.sublime.notifyId||Ot();return window.sublime.notifyId=e,e}();return"sublime"===e.bidder||e.bidder===(null===(i=null==t?void 0:t.find((e=>"sublime"===e.bidderSource)))||void 0===i?void 0:i.bidderLabel)?(O(`${Rt} generate notify id`),{...e,params:{...e.params,notifyId:n}}):e}const Ut=(e,t)=>e.delimiter===t.delimiter&&"|"===e.delimiter&&e.fields.length+1===t.fields.length&&e.fields.every(((e,i)=>e===t.fields[i])),Pt=1900,xt="[pbjs]";function Nt(e,t=[]){const i=null==t?void 0:t.map((e=>e.bidderSource));return Array.from(new Set(e.flatMap((e=>e.bidders)).map((e=>e.bidder)).concat(i)))}function jt(e,t,i,n,s){var o,a,r,d,l,c,u,f,h,g,p;O(`${xt}[initPbjs] Start prebid initialization`);const{currency:v,userSync:m,priceGranularity:b,bidderAdjustments:y,bidderAliases:C,bidderConfigs:A,floors:w,analytics:S,schain:I,outbrain:k,realTimeData:E,allowLocalStorage:$,fledgeForGpt:T,paapi:R,dsaConfig:L,s2sConfig:P,enableTIDs:x}=i,N=Nt(t,C);if(e.setConfig(n),v&&(O(`${xt}[initPbjs] set currency config`,v),e.setConfig({currency:v,priceGranularity:"dense"}),b&&(O(`${xt}[initPbjs] set priceGranularity config`,b),e.setConfig({priceGranularity:b}))),P&&(O(`${xt}[initPbjs] set prebid server config`,P),e.setConfig({s2sConfig:P})),m){const t=Object.keys(null!==(a=null===(o=null==P?void 0:P.extPrebid)||void 0===o?void 0:o.aliases)&&void 0!==a?a:{}),i={filterSettings:{iframe:{bidders:Object.values(null!==(d=null===(r=null==P?void 0:P.extPrebid)||void 0===r?void 0:r.aliases)&&void 0!==d?d:{}).concat(null!==(c=null===(l=null==P?void 0:P.bidders)||void 0===l?void 0:l.filter((e=>!t.includes(e))))&&void 0!==c?c:[]).concat(["optidigital","richaudience","justpremium","impactify","smilewanted","onetag","connectad","adagio"]),filter:"include"},image:{bidders:"*",filter:"include"}},...m};O(`${xt}[initPbjs] set userSync config`,i),e.setConfig({userSync:i})}k&&(O(`${xt}[initPbjs] set Outbrain config:`,k),e.setConfig({outbrain:k})),E&&(O(`${xt}[initPbjs] set realTimeData config`,E),e.setConfig({realTimeData:E})),w&&(O(`${xt}[initPbjs] set floors config`,w),e.setConfig({floors:w}));const j=null==E?void 0:E.dataProviders.find((e=>"greenbidsRtdProvider"===e.name));if(S||j){const t=S||[];if(j){const e=null===(u=j.params)||void 0===u?void 0:u.pbuid;if(e&&!t.find((e=>"greenbids"===e.provider))){const i=function(e,t){return{provider:"greenbids",options:{pbuid:e,sampling:t}}}(e,null===(f=j.params)||void 0===f?void 0:f.sampling);t.push(i)}}O(`${xt}[initPbjs] enable analytics`,t),e.enableAnalytics(t)}if(I&&(O(`${xt}[initPbjs] set schain config`,I),e.setConfig({schain:I})),T&&e.setConfig({fledgeForGpt:{enabled:!0}}),R&&e.setConfig({paapi:R}),A){O(`${xt}[initPbjs] set bidder config`,A);for(const t of A)e.setBidderConfig(t)}const D={};if(y){O(`${xt}[initPbjs] set bidder adjustments config`,y);for(const e of y)D[e.bidder]={bidCpmAdjustment:function(t){return t*e.adjustment}}}if($)for(const e of N)D[e]={...D[e],storageAllowed:!0};if(D.standard={adserverTargeting:[{key:de,val:function(e){return e.bidderCode}},{key:"bid_id",val:function(e){return e.adId}},{key:"bid_cpm",val:function(e){return e.pbCg}},{key:le,val:function(e){return e.size}},{key:ce,val:function(e){return e.mediaType}},{key:"bid_videoId",val:function(e){return e.videoCacheKey}}]},s&&oe.getInstance().uprEnabled&&(D.standard={adserverTargeting:[...D.standard.adserverTargeting,{key:"prkv",val:e=>Dt(e,s)},{key:"ad_floor-rule",val:e=>Dt(e,s)}]}),Object.keys(D).length>0&&(e.bidderSettings=D),C){O(`${xt}[initPbjs] set alias bidder`,C);for(const t of C)e.aliasBidder(t.bidderSource,t.bidderLabel)}if(Mt(t,"sublime",C)&&_t(t,C),null===(h=e.installedModules)||void 0===h?void 0:h.includes("utiqSystem")){const t=localStorage.getItem("utiqPass");if(t)try{const i=JSON.parse(t),n=null!==(null===(p=null===(g=null==i?void 0:i.connectId)||void 0===g?void 0:g.idGraph)||void 0===p?void 0:p[0].atid);O(`${xt}[initPbjs] set Utiq key values isUtiqPresent=`,n),e.mergeConfig({ortb2:{site:{keywords:"isUtiqPresent="+n}}})}catch(e){_(`${xt}[initPbjs] Utiq config is not valid JSON, ${e}`,t)}}L&&(O(`${xt}[initPbjs] set DSA config`,L),e.mergeConfig({ortb2:{regs:{ext:{dsa:L}}}})),Mt(t,"criteo",C)&&e.setConfig({criteo:{fastBidVersion:"latest"}}),void 0!==x&&(O(`${xt}[initPbjs] setting enableTIDs to`,x),e.setConfig({enableTIDs:x})),oe.getInstance().disableGptPreAuction&&e.setConfig({gptPreAuction:{enabled:!1}}),Ye(Ve.PREBID_READY),U("[metric] pbjs",{consentType:dt,pbjsReady:tt(Ve.CMP_RESPONSE_AVAILABLE,Ve.PREBID_READY)}),O(`${xt}[initPbjs] Prebid is initialized`)}function Dt(e,t){const i=e.cpm,n=i>0?function(e,t){let i;if(t.forEach((t=>{const n=parseFloat(t.max);n>e&&(i=!i||n<parseFloat(i.max)?t:i)})),!i)return Math.max(...t.map((e=>parseFloat(e.max))));const n=parseFloat(i.increment);return parseFloat((Math.floor(e/n)*n).toFixed(2))}(i,t):0,s=Math.max(...t.map((e=>parseFloat(e.max))));return Math.min(n,s).toFixed(2)}function Bt(e,t,i,n){const[s,o,a]=function(e){const t=[],i=[],n=[];return e.forEach((e=>{e.headerBiddingEnabled&&e.bidders.length>0?(t.push(e),i.push(e.divId)):n.push(e.divId)})),[t,i.join(","),n.join(",")]}(t);if(s.length>0){const t=null==n?void 0:n.timeout,r=null==n?void 0:n.labels,d=function(e){const t=e.getConfig("bidderTimeout");if(t){if("number"==typeof t)return t+Pt;if(parseInt(t))return parseInt(t)+Pt}return 3e3+Pt}(e);let l=!1;setTimeout((()=>{l||(_(`${xt}prebid requestBids did not response before ${d}ms, calling callback`),l=!0,i())}),d);const c=()=>{l||(l=!0,i())};if(!(e=>1===new Set(e.map((e=>e.floors)).filter((e=>void 0!==e)).map((e=>[...e.schema.fields,e.schema.delimiter].join("")))).size)(s)){const e=(e=>e.map((e=>e.floors)).filter((e=>void 0!==e)).map((e=>e.schema)).reduce(((e,t)=>(e?t.fields.length>e.fields.length&&(e=t):e=t,e)),void 0))(s);e&&(O(`${xt}floors schema are not the same, unifying schema`),((e,t)=>{e.forEach((i=>{var n;if(i.floors&&(null===(n=i.floors)||void 0===n?void 0:n.schema)!==t){const n=i.floors.schema;if(Ut(n,t)){i.floors.schema=t;const e=i.floors.values;i.floors.values={};for(const t of Object.keys(e))i.floors.values[`${t}|*`]=e[t]}else L(`Unable to unify schema for adUnits ${e.map((e=>e.divId)).join(", ")}.`,t)}}))})(s,e))}const u=s.flatMap((t=>{if(t.dynamicPrebidFloor){const i=e.getHighestCpmBids(t.divId);if(i.length>0){const e=i[0].cpm;return ne(t,Math.floor(100*e)/100)}}return ne(t)}));O(`${xt}[executor] [pbjs] calling requestBids for ${u.map((e=>e.code)).join(",")}`),e.requestBids({timeout:t,adUnits:u,bidsBackHandler:c,labels:r}),O(`${xt}[executor] [pbjs] prebid auction started for [${o}] | prebid auction skipped for [${a}]`,s)}else O(`${xt}[executor] [pbjs] no prebid auction to start for [${a}]`),i()}function Mt(e,t,i){const n=e.flatMap((e=>e.bidders)).map((e=>e.bidder)),s=[...new Set(n)],o=[t,...(null==i?void 0:i.filter((e=>e.bidderSource===t)).map((e=>e.bidderLabel)))||[]];return s.some((e=>null==o?void 0:o.includes(e)))}class Ft{constructor(e){this.pbjs=e.getPbjs()}initPbjs(e,t,i,n){jt(this.pbjs,e,t,i,n)}extractUniqAdaptersName(e,t=[]){return Nt(e,t)}roundUpToNearestIncrement(e,t){return function(e,t){const i=e.sort(((e,t)=>e.max<t.max?-1:1)),n=i.filter((e=>t<=e.max));if(0===n.length)return O(`${xt}[Price granularity] round up - initial CpmValue : ${t} // rounded value : ${i[i.length-1].max} `),i[i.length-1].max.toFixed(2);const s=n[0].increment;let o=t%s==0?t:t+(s-t%s);const a=t.toString().split("."),r=a.length>1?a[1].split("").length:0;(o-s).toFixed(r)===t.toFixed(r)&&(o=t);const d=o.toFixed(2);return O(`${xt}[Price granularity] round up - initial CpmValue : ${t} // rounded value : ${d} `),d}(e,t)}startPbjsAuction(e,t,i){Bt(this.pbjs,e,t,i)}getPbjs(){return this.pbjs}setContextValuesAsTargeting(e,t,i){const n={};for(const[t,i]of e)n[t]=i;for(const e in t)1===t[e].length?n[e]=t[e][0]:n[e]=t[e];this.pbjs.setBidderConfig({bidders:i,config:{ortb2:{site:{ext:{data:n}}},appnexusAuctionKeywords:n}})}}let zt=4400;const Wt="[executor] [APS]";let Vt=!1,Gt=!1;function Ht(e){const t=e.apstag;if(t.kleanadsBlocker){O(`${Wt} getting apstag from blocker's methods`);const e=t;return{...t,fetchBids:e.fetchBidsKleanads,setDisplayBids:e.setDisplayBidsKleanads}}return t}class Jt{constructor(e,t){this.pubstackWindow=e,this.apsPubId=t}setEnableApsForTests(e){!function(e){L(`${Wt} this function should be used only for testing purpose`),Vt=e}(e)}load(){!function(e){function t(t,i){var n,s;null===(s=null===(n=Ht(e))||void 0===n?void 0:n._Q)||void 0===s||s.push([t,i])}Vt=!0,e.apstag||(O(`${Wt} overriding apstag`),e.apstag={_Q:[]}),O(`${Wt} overriding apstag functions`),e.apstag.init=(...e)=>t("i",e),O(`${Wt} init set!`,e.apstag.init),e.apstag.fetchBids=(...e)=>t("f",e),e.apstag.setDisplayBids=()=>{},e.apstag.targetingKeys=()=>[],D("//c.amazon-adsystem.com/aax2/apstag.js")}(this.pubstackWindow)}startApsAuction(e,t){if(!Vt)return O(`${Wt} skipping auction for adunits [${e.map((e=>e.divId)).join(",")}]`),void t([]);if(!Gt)return _(`${Wt} cannot start auction: apstag is not initialized`),void t([]);const i=Ht(this.pubstackWindow);if(!i)return _(`${Wt} cannot find apstag on the page`),void t([]);const n=function(e){return e.filter((e=>e.headerBiddingEnabled)).reduce(((e,t)=>{const i=t.mediaTypes;if(i.includes("Instream")){const t={slotID:"videoSlot",mediaType:"video",sizes:[[640,480]]};return[...e,t]}if(i.includes("Banner")){const i={slotID:t.divId,slotName:t.slotName,sizes:F(t.sizes)};return i.sizes.length?[...e,i]:e}if(i.includes("Outstream")){const i={slotID:t.divId,mediaType:"video",sizes:[[640,480]]};return[...e,i]}return[]}),[])}(e);if(O(`${Wt} apsSlots created`,n),0===n.length)return void t([]);O(`${Wt} calling fetchBids`);let s=!1;setTimeout((()=>{s||(_(`${Wt} fetchbids did not response before ${zt}ms, calling callback`),s=!0,t([]))}),zt),i.fetchBids({slots:n},(e=>{s||(s=!0,t(e))})),O(`${Wt} auction started`,n)}initAps(e,t){if(Vt){zt=e+1400,O(`${Wt} updating failsafe timeout to ${zt}`);const i=Ht(this.pubstackWindow);if(!i)return void _(`${Wt} cannot find apstag on the page`);i.init({pubID:this.apsPubId,adServer:"googletag",bidTimeout:e,deals:!0,videoAdServer:"DFP",schain:t},(()=>{O(`${Wt} apstag init done`),Ye(Ve.APSTAG_READY),U("[metric] apstag",{consentType:dt,apstagReady:tt(Ve.CMP_RESPONSE_AVAILABLE,Ve.APSTAG_READY)})})),Gt=!0}else O(`${Wt} apstag init skipped`)}}const Kt="[GAM]",qt="pbstck_ab_test",Yt="xp_variant",Xt={},Qt=[3,1];let Zt=!1;const ei=[];function ti(e){return new Promise(((t,i)=>ni(e,t,i)))}const ii=50;function ni(e,t,i){if(e.googletag)try{e.googletag.apiReady?t():setTimeout((()=>ni(e,t,i)),ii)}catch(e){i(e)}else setTimeout((()=>ni(e,t,i)),ii)}function si(e,t,i,n,s,o){ti(e).then((()=>{var a,r;O("googletag ready, starting initialization"),e.googletag.pubads().disableInitialLoad(),e.googletag.pubads().enableSingleRequest()||L("unable to enable single request"),function(e,t,i,n){const s=e.googletag.pubads();i.forEach(((e,t)=>{e&&s.setTargeting(t,e)}));const o=m(e);O("[targetings] here are the targetings",o),Object.keys(o).forEach((e=>{s.setTargeting(e,o[e])})),s.setTargeting(A,"1"),s.setTargeting("device",t);const a=oe.getInstance().grapeshotValues;(null==a?void 0:a.length)&&s.setTargeting("gs_cat",a);if(n&&n.length>0){const e=n[0].value;s.setTargeting("adm_ab_test",`poc:${e}`)}if(oe.getInstance().uprTested){O(`${Kt} setting xp_variant/pbstck_ab_test gam targeting value any previous value will be ignored`);const e=`floor_optimization:${oe.getInstance().uprEnabled}`;s.setTargeting(Yt,e),s.setTargeting(qt,e)}}(e,t,i,o),s&&s.ppidValue&&e.googletag.pubads().setPublisherProvidedId(s.ppidValue),s&&(null==s?void 0:s.threadYieldConfig)&&e.googletag.setConfig({threadYield:s.threadYieldConfig}),e.googletag.enableServices(),(null===(a=null==n?void 0:n.lazyLoadingGoogle)||void 0===a?void 0:a.googleFetchMarginPercent)&&(null===(r=null==n?void 0:n.lazyLoadingGoogle)||void 0===r?void 0:r.googleRenderMarginPercent)&&e.googletag.pubads().enableLazyLoad({fetchMarginPercent:n.lazyLoadingGoogle.googleFetchMarginPercent,renderMarginPercent:n.lazyLoadingGoogle.googleRenderMarginPercent,mobileScaling:n.lazyLoadingGoogle.googleMobileScaling}),e.googletag.pubads().setCentering(!0),O("googletag initialized"),Zt=!0,ei.forEach((e=>e())),Ye(Ve.GOOGLETAG_READY),U("[metric] googletag",{consentType:dt,googletagReady:tt(Ve.CMP_RESPONSE_AVAILABLE,Ve.GOOGLETAG_READY),adUnitWithAuctionEnded:Array.from(ft.keys())}),R("GAM","googletag slotRenderEnded listener added"),e.googletag.pubads().addEventListener("slotRenderEnded",oi),e.googletag.pubads().addEventListener("slotResponseReceived",ri),e.googletag.pubads().addEventListener("slotOnload",ai)}))}const oi=e=>{const t=e.slot,i=t.getSlotElementId();Qe(i,He.SLOT_RENDER_ENDED_TIME),ut(i,"slotRenderEnded"),function(e,t){re(e,t,"ad_floor-rule"),re(e,t,"prkv")}(i,t),O(`slot render ended for ${i}`)},ai=e=>{const t=e.slot.getSlotElementId();O(`slot onload received for ${t}`),setTimeout((()=>{const e=document.getElementById(t);if(e){const s=function(e){if(e.scrollHeight>e.clientHeight)return{overflow:"height",scroll:e.scrollHeight,client:e.clientHeight};if(e.scrollWidth>e.clientWidth)return{overflow:"width",scroll:e.scrollWidth,client:e.clientWidth};return}(e);if(s){const e=Xt[t];i=`${Kt} Overflow problem while rendering '${JSON.stringify(e)}' | ${JSON.stringify(s)}`,n={...e,size:`${e.size}`},h(S,i,n),null==I||I.errorWithPayload(i,n),navigator.sendBeacon(`https://intake.pbstck.com/v1/intake/error?tId=${k}&v=${E}&s=${$}&c=1`,JSON.stringify([{message:i}]))}}var i,n}),100)},ri=e=>{const t=e.slot.getSlotElementId();O(`slot response received for ${t}`),Qe(t,He.SLOT_RESPONSE_RECEIVED_TIME)};function di(e,t){for(const i of e.getTargetings()){const n=Y(i),s=i.key;t.setTargeting(s,n),O(`${Kt} adding targeting (${s}, ${n}) to adunit ${e.divId}`)}t.setTargeting("ad_adunitname",[e.adServerAdUnitName])}function li(e){Zt?e():ei.push(e)}class ci{constructor(e,t){this.pubstackWindow=e,this.prebidOrderIds=t}prebidReady(e){O(`${Kt} prebidReady`,e)}init(e,t,i,n,s){si(this.pubstackWindow,e,t,i,n,s)}declareAdUnits(e){return this.declareGoogleSlots(e)}cleanAdUnits(){this.executeWhenAdServerReady((()=>{O(`${Kt} cleaning slots`,this.pubstackWindow.googletag.pubads().getSlots().map((e=>e.getSlotElementId())),this.pubstackWindow.googletag.pubads().getSlots());const e=[];this.pubstackWindow.googletag.pubads().getSlots().forEach((t=>{const i=this.pubstackWindow.googletag.destroySlots([t]);R(`${Kt} slot ${t.getSlotElementId()} destroyed ? ${i}`),i||(e.push(t),O(`${Kt} slot ${t.getSlotElementId()} not destroyed, retrying later`))})),e.length?L(`${Kt} unable to destroy slot ${ui(e)}`):R(`${Kt} all slots destroyed`),this.pubstackWindow.googletag.pubads().removeEventListener("slotRenderEnded",oi),this.pubstackWindow.googletag.pubads().removeEventListener("slotResponseReceived",ri),this.pubstackWindow.googletag.pubads().removeEventListener("slotOnload",ai),ei.splice(0)}))}setPbjsTargetings(e,t){e?(O(`${Kt} try to put pbjs targeting keys for ${t.map((e=>e.divId)).join(",")}`),t.forEach((t=>{const i=this.getSlot(t,"setPbjsTargetings");i&&function(e,t,i){i.getTargetingKeys().forEach((e=>{"bid_"!==e.substring(0,4)&&"hb_"!==e.substring(0,3)||i.clearTargeting(e)}));const n=t.getAdserverTargetingForAdUnitCode(e.divId);for(const t of Object.keys(n)){const s=n[t];ae(s)?i.setTargeting(t,s):_(`[targeting] unable to set targeting ${t}=${s} on adUnit ${e.divId}`)}i.setTargeting("kuc_version","2408211643")}(t,e,i)}))):L(`${Kt} no pbjs given: unable to put header bidding targetings`)}setApsTargetings(e,t){O(`${Kt} putting targeting keys for aps auction`,t),function(e){var t;null===(t=Ht(e))||void 0===t||t.setDisplayBids()}(this.pubstackWindow)}setRefreshTargeting(e){const t=this.getSlot(e.adUnit,"setPbjsTargetings");var i,n;t&&(i=t,n=e.rank,i.setTargeting("ad_refresh","1"),i.setTargeting("pbstck_refresh","1"),i.setTargeting("ad_refresh-rank",function(e){return e<10?`${e}`:"10-more"}(n)))}callAdServer(e){O(`${Kt} preparing call to GAM for ${e.map((e=>e.divId)).join(",")}`,e);const t=this.pubstackWindow.googletag.pubads().getSlots(),i=e.map((e=>({adUnit:e,slot:t.find((t=>t.getSlotElementId()===e.divId))}))).filter((e=>!!e.slot));i.forEach((({adUnit:e,slot:t})=>di(e,t)));const n=i.map((({slot:e})=>e));O(`${Kt} calling GAM with ${n.length} slots`,ui(n),ui(t)),g("googletag:refresh",{slotIds:n.map((e=>e.getSlotElementId()))}),this.pubstackWindow.googletag.pubads().refresh(n)}executeWhenAdServerReady(e){Zt?e():ei.push(e)}renderListener(e){li((()=>{this.renderListenerCallback=t=>{const i=t.slot,n=t.campaignId,s={divId:i.getSlotElementId(),creativeId:t.creativeId,lineItemId:t.lineItemId,orderId:n,size:fi(t),isEmpty:t.isEmpty,advertiserId:t.advertiserId};if(n&&this.prebidOrderIds.includes(n)){const e=i.getTargeting(de);e&&(s.hb_bidder=Array.isArray(e)?e[0]:e);const t=i.getTargeting(le);t&&t[0]&&(s.size=z(t[0]));const n=i.getTargeting(ce);n&&(s.hb_mediaType=Array.isArray(n)?n[0]:n)}Xt[s.divId]=s,e(s)},this.pubstackWindow.googletag.pubads().addEventListener("slotRenderEnded",this.renderListenerCallback)}))}removeRenderListener(){this.renderListenerCallback&&(R("GAM","removing render listener"),this.pubstackWindow.googletag.pubads().removeEventListener("slotRenderEnded",this.renderListenerCallback))}getSlot(e,t){const i=this.pubstackWindow.googletag.pubads().getSlots().filter((t=>t.getSlotElementId()===e.divId));if(0!==i.length)return i.length>1&&L(`${Kt} multiple slot found for adunit ${e.divId} on operation ${t}`),i[0];L(`${Kt} slot not found for adunit ${e.divId} on operation ${t}`)}declareGoogleSlots(e){return new Promise((t=>{li((()=>{const i=e.sort(H),n=[];i.forEach((e=>{var t,i,s;if("interstitial"===e.outOfPageType){O(`${Kt} define slot interstitial for ${e.divId} (${e.adUnitPath})`);const t=window.googletag.defineOutOfPageSlot(e.adUnitPath,googletag.enums.OutOfPageFormat.INTERSTITIAL);t&&(O("slot interstitial created"),t.addService(googletag.pubads()),n.push(t),di(e,t))}else if(document.getElementById(e.divId)){let n;if("default"===e.outOfPageType)O(`${Kt} define slot out of page for ${e.divId} (${e.adUnitPath})`),n=null===(t=window.googletag.defineOutOfPageSlot(e.adUnitPath,e.divId))||void 0===t?void 0:t.addService(googletag.pubads());else{const t=[Qt,...e.sizes,...null!==(i=e.extraAdServerSizes)&&void 0!==i?i:[]];O(`${Kt} define slot for ${e.divId} (${e.adUnitPath})`),n=null===(s=window.googletag.defineSlot(e.adUnitPath,t,e.divId))||void 0===s?void 0:s.addService(googletag.pubads())}n?(O(`${Kt} slot created, displaying ${e.divId}`),googletag.display(e.divId)):L(`${Kt} unable to create slot for ${e.divId}`)}else O(`${Kt} unable to display ${e.divId}, the div does not exist`)})),n.forEach((e=>{O(`${Kt} calling googletag.display for interstitial slot`,e),googletag.display(e)})),n.length>0&&googletag.pubads().refresh(n);const s=oe.getInstance().declareXPLNTargetings;s&&s(),t()}))}))}}function ui(e){return e.map((e=>({id:e.getSlotElementId(),path:e.getAdUnitPath()})))}function fi(e){return e.size}const hi="[Local-AdServer]";class gi{constructor(){this.managedDivs=[],this.callbacks=[]}prebidReady(e){this.pbjs=e}callAdServer(e){this.pbjs?(O(`${hi} callAdServer`,e),e.forEach((e=>{if(this.managedDivs.includes(e.divId)){const t=this.pbjs.getHighestCpmBids(e.divId);if(t.length>0){const e=t[0];try{!function(e,t){var i,n;if(O(`${hi} renderOne`,t),!t||!t.adId)throw new Error(`${hi} no winning bid or adId provided ${t}`);{const s=document.getElementById(t.adUnitCode);if(!s)throw new Error(`${hi} unable to find div ${t.adUnitCode}`);{const o=s.getElementsByTagName("iframe");O(`${hi} found ${o.length} iframe to remove`),Array.from(o).forEach((e=>e.remove()));const a=document.createElement("iframe");a.scrolling="no",a.frameBorder="0",a.marginHeight="0",a.name=`prebid_ads_iframe_${t.adUnitCode}`,a.title="3rd party ad content",null===(i=a.sandbox)||void 0===i||i.add("allow-forms","allow-popups","allow-popups-to-escape-sandbox","allow-same-origin","allow-scripts","allow-top-navigation-by-user-activation"),a.setAttribute("aria-label","Advertisment"),a.style.setProperty("border","0"),a.style.setProperty("margin","0"),a.style.setProperty("overflow","hidden"),s.appendChild(a);const r=null===(n=a.contentWindow)||void 0===n?void 0:n.document;if(!r)throw new Error(`${hi} error while getting document from iframe`);{e.renderAd(r,t.adId);const i="/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */button,hr,input{overflow:visible}progress,sub,sup{vertical-align:baseline}[type=checkbox],[type=radio],legend{box-sizing:border-box;padding:0}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}details,main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:ButtonText dotted 1px}fieldset{padding:.35em .75em .625em}legend{color:inherit;display:table;max-width:100%;white-space:normal}textarea{overflow:auto}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}[hidden],template{display:none}",n=r.createElement("style");n.appendChild(r.createTextNode(i)),r.head.appendChild(n)}}}}(this.pbjs,e);const t={divId:e.adUnitCode,isEmpty:!1,hb_bidder:e.adserverTargeting.bid_bidder,hb_mediaType:e.adserverTargeting.bid_mediatype,size:e.adserverTargeting.bid_size?z(e.adserverTargeting.bid_size):null,advertiserId:null,lineItemId:null,orderId:null,creativeId:null};this.renderListenerCallback(t)}catch(e){L(`${hi} unable to render: ${e}`)}}else{const t={divId:e.divId,isEmpty:!0,size:null,advertiserId:null,lineItemId:null,orderId:null,creativeId:null};this.renderListenerCallback(t)}}}))):L(`${hi} pbjs is not available`)}cleanAdUnits(){O(`${hi} cleanAdUnits - START`),this.managedDivs.forEach((e=>{const t=document.getElementById(e);if(t){const e=t.getElementsByTagName("iframe");O(`${hi} found ${e.length} iframe to remove`),Array.from(e).forEach((e=>e.remove()))}})),this.managedDivs=[],O(`${hi} cleanAdUnits - END`,this.managedDivs)}declareAdUnits(e){return O(`${hi} declareAdUnits (adUnits, managedDivs)`,e,this.managedDivs),e.forEach((e=>{this.managedDivs.includes(e.divId)?L(`${hi} adUnit already declared ${e.divId}`):this.managedDivs.push(e.divId)})),Promise.resolve(void 0)}executeWhenAdServerReady(e){O(`${hi} executeWhenAdServerReady`,e),e()}init(e,t,i,n,s){O(`${hi} init (nothing to do), this are the input params:`,e,t,i,n,s)}removeRenderListener(){O(`${hi} removeRenderListener`),this.callbacks=[]}renderListenerCallback(e){O(`${hi} renderListenerCallback called event:`,e),this.callbacks.forEach((t=>t(e)))}renderListener(e){O(`${hi} renderListener`,e),this.callbacks.push(e)}setApsTargetings(){}setPbjsTargetings(){}setRefreshTargeting(){}}function pi(e,t,i,n,s){const o=`${n}_${s}`;navigator.sendBeacon(`https://intake.pbstck.com/v1/intake/gam-impression?sId=${t}&tId=${e}&c=1&s=${o}&v=${i}`)}class vi{constructor(){this.name="AdServer",this.scriptLoaded=!1,this.loaded=!1}get adServer(){return this._adServer}isLoaded(){return this.loaded}async load(){this.loaded=!0}async onAfterConsentRefused({config:e}){var t;if(!this._adServer)switch(e.consentlessMode){case"GAM":this._adServer=new ci(window,(null===(t=e.globalRefreshConfig)||void 0===t?void 0:t.prebidOrderIds)||[]),this._adServer.renderListener((t=>{t.isEmpty||pi(e.tagId,e.stack.scopeId,e.kleanadsVersion,e.stack.stackId,e.stackVersion)})),this.scriptLoaded||(D("https://pagead2.googlesyndication.com/tag/js/gpt.js"),this.scriptLoaded=!0);break;case"local":this._adServer=new gi;break;default:O("AdServerModule - onAfterConsentRefused - no ad server configured for consentless")}}async onAfterConsentAccepted({config:e}){var t;this._adServer||(this._adServer=new ci(window,(null===(t=e.globalRefreshConfig)||void 0===t?void 0:t.prebidOrderIds)||[]),this._adServer.renderListener((t=>{t.isEmpty||pi(e.tagId,e.stack.scopeId,e.kleanadsVersion,e.stack.stackId,e.stackVersion)})),this.scriptLoaded||(D("https://securepubads.g.doubleclick.net/tag/js/gpt.js"),this.scriptLoaded=!0))}async onStackConfigLoad({config:e,stackConfig:t}){this._adServer?this._adServer.init(e.device,e.pageContext,t.lazyLoading,t.gamConfig,t.runningABTest):L("AdServerModule - onStackConfigLoad - no ad server configured")}async onPrepareAdUnits({toPreparedAdUnits:e}){var t;const i=(null!=e?e:[]).filter((e=>!e.mediaTypes.includes("Instream")));return null===(t=this._adServer)||void 0===t?void 0:t.declareAdUnits(i)}async onAfterPrebidReady({prebid:e}){const t=e.getPbjs();this._adServer?this._adServer.prebidReady(t):L("AdServerModule - onAfterPrebidReady - no ad server configured")}async clean(){this._adServer?this._adServer.cleanAdUnits():L("AdServerModule - clean - no ad server configured")}}function mi(e,t,i,n,s,o){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var r,d=n.kind,l="getter"===d?"get":"setter"===d?"set":"value",c=!t&&e?n.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),f=!1,h=i.length-1;h>=0;h--){var g={};for(var p in n)g[p]="access"===p?{}:n[p];for(var p in n.access)g.access[p]=n.access[p];g.addInitializer=function(e){if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(e||null))};var v=(0,i[h])("accessor"===d?{get:u.get,set:u.set}:u[l],g);if("accessor"===d){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(r=a(v.get))&&(u.get=r),(r=a(v.set))&&(u.set=r),(r=a(v.init))&&s.unshift(r)}else(r=a(v))&&("field"===d?s.unshift(r):u[l]=r)}c&&Object.defineProperty(c,n.name,u),f=!0}function bi(e,t,i){for(var n=arguments.length>2,s=0;s<t.length;s++)i=n?t[s].call(e,i):t[s].call(e);return n?i:void 0}function yi(e,t,i){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:t})}function Ci(e){return function(t,i){return class extends t{constructor(){super(...arguments),this.deferLoadingTo=e}}}}"function"==typeof SuppressedError&&SuppressedError;let Ai=(()=>{let e,t,i=[Ci("onStackConfigLoad")],n=[];return t=class{constructor(){this.name="Aps"}get aps(){return this._aps}isLoaded(){return!!this._aps}async load({stackConfig:e}){var t;this._aps=function(e,t){if(e&&t.some((e=>e.headerBiddingEnabled&&(e.isInstream||e.canOutstream||e.sizes.some((e=>"fluid"!==e)))))){O("downloading amazon apstag");const t=new Jt(window,e);return t.load(),t}}(null===(t=e.tamConfig)||void 0===t?void 0:t.apsPubId,e.adUnits)}async onStackConfigLoad({config:e,stackConfig:t}){var i,n,s,o;const a=null===(i=t.prebidConfig)||void 0===i?void 0:i.pbjsConfig.schain;null===(n=this._aps)||void 0===n||n.initAps(null!==(o=null===(s=t.prebidConfig)||void 0===s?void 0:s.adCallTimeout)&&void 0!==o?o:e.adCallTimeout,a)}async clean(){}},yi(t,"ApsModule"),(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;mi(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),bi(t,n)})(),t})();const wi="ModuleService";class Si{constructor(e,t){this.modules=t,this.lifecycleState={config:e},O(`[${wi}] Init: ${this.modules.length} modules registered`);for(const e of this.modules)e.isLoaded()?O(`[${wi}] Module ${e.name} is already loaded`):O(`[${wi}] Registered module ${e.name}.${e.deferLoadingTo?`Deferred loading to ${e.deferLoadingTo}`:""}`)}getModules(){return this.modules}getLoadedModuleInstance(e){return this.modules.filter((e=>e.isLoaded())).find((t=>t instanceof e))}async loadModules(e){for(const t of e){O(wi,`Loading module ${t.name}`);try{await t.load(this.lifecycleState)}catch(e){L(wi,`Error while loading module ${t.name}`,e)}}}async loadInitialModules(){const e=this.modules.filter((e=>!e.deferLoadingTo&&!e.isLoaded()));O(`[${wi}] Loading initial modules. ${e.length} modules to load`),await this.loadModules(e)}async modulesDispatchEvent(e,...t){this.lifecycleState={...this.lifecycleState,...t[0]};const i=this.lifecycleState,n=this.modules.filter((t=>t.deferLoadingTo===e&&!t.isLoaded()));return O(`[${wi}] event call: ${e}. ${n.length} deferred modules to load`),await this.loadModules(n),new Promise((t=>{var n;const s=this.modules.filter((t=>t.isLoaded()&&t[e]&&"function"==typeof t[e]));O(`[${wi}] event call: ${e}. ${s.length} modules to call`);const o=[];for(const t of s){O(wi,`Calling ${e} on module ${t.name}`);const s=null===(n=t[e])||void 0===n?void 0:n.call(t,i);s instanceof Promise&&o.push(s)}t(o)}))}async modulesCleanUp(){const e=this.modules.filter((e=>e.isLoaded()));O(`[${wi}] Cleaning modules. ${e.length} modules cleanup started`);for(const t of e)O(wi,`Cleaning module ${t.name}`),await t.clean(this.lifecycleState);this.modules=[]}}let Ii=(()=>{let e,t,i=[Ci("onStackConfigLoad")],n=[];return t=class{constructor(){this.name="Prebid"}get pbjs(){return this._pbjs}isLoaded(){return!!this._pbjs}async load({config:e,stackConfig:t}){this._pbjs=await async function(e,t){if(t.some((e=>e.headerBiddingEnabled&&e.bidders.length)))try{const t=await j(e);return new Ft(t)}catch(e){return void O("[config] Error while loading the kleanadsPbjs module",e)}}(e.newPrebidUrl,t.adUnits),this._pbjs&&this.aliasWindowPbjs(window,this._pbjs.getPbjs())}async onStackConfigLoad({config:e,stackConfig:t}){var i,n,s;if(!this._pbjs)throw new Error("PrebidModule is not loaded");const o=null!==(n=null===(i=null==t?void 0:t.prebidConfig)||void 0===i?void 0:i.adCallTimeout)&&void 0!==n?n:e.adCallTimeout,a=t.prebidConfig.pbjsConfig,r={gdpr:{cmpApi:"iab",timeout:8e3,defaultGdprScope:!0}},d=this._pbjs.getPbjs().installedModules;d.includes("consentManagementUsp")&&(r.usp={cmpApi:"iab",timeout:8e3}),d.includes("consentManagementGpp")&&(r.gpp={cmpApi:"iab",timeout:8e3}),d.includes("anonymisedRtdProvider")&&(r.gdpr.rules=[{purpose:"storage",enforcePurpose:!0,enforceVendor:!0,vendorExceptions:["anonymised"]}]);const l={bidderTimeout:o,useBidCache:!0,maxRequestsPerOrigin:6,consentManagement:e.noCmp?void 0:r,enableSendAllBids:!1,pageUrl:document.location.href,cache:{url:"https://prebid.adnxs.com/pbc/v1/cache",ignoreBidderCacheKey:!0},timeoutBuffer:400};if(this._pbjs.initPbjs(t.adUnits,a,l,e.priceRuleBuckets),null===(s=null==a?void 0:a.targetingBehaviors)||void 0===s?void 0:s.sendKVTargetings){const i=m(window),n=this._pbjs.extractUniqAdaptersName(t.adUnits,a.bidderAliases).filter((e=>{var t;return!(null===(t=a.targetingBehaviors)||void 0===t?void 0:t.biddersBlackList.includes(e))}));this._pbjs.setContextValuesAsTargeting(e.pageContext,i,n)}}async clean(){var e;this.setDefaultPbjsConfig();const t=null===(e=this._pbjs)||void 0===e?void 0:e.getPbjs();t&&(t.bidderSettings={})}aliasWindowPbjs(e,t){e.pbjs=t}setDefaultPbjsConfig(){var e;null===(e=this._pbjs)||void 0===e||e.getPbjs().setConfig({bidderTimeout:3e3,enableSendAllBids:!0,useBidCache:!1,deviceAccess:!0,timeoutBuffer:400,disableAjaxTimeout:!1,maxNestedIframes:10,priceGranularity:"medium",customPriceBucket:{},mediaTypePriceGranularity:{},bidderSequence:"random",auctionOptions:{},userSync:{syncEnabled:!0,filterSettings:{image:{bidders:"*",filter:"include"}},syncsPerBidder:5,syncDelay:3e3,auctionDelay:0}})}},yi(t,"PrebidModule"),(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;mi(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),bi(t,n)})(),t})();class ki{constructor(e,t){this.pubstackWindow=e,this.rule=t}isDivIdMatchingRule(e){const t=document.getElementById(e);if(t){const e=t.getBoundingClientRect();return this.rule(this.pubstackWindow,e)}return!1}}const Ei=(e,t,i)=>{if(function(e){return 0===e.top&&0===e.bottom&&0===e.left&&0===e.right&&0===e.width&&0===e.height}(t))return!1;const n=-i*e.innerHeight,s=(1+i)*e.innerHeight>t.top,o=t.bottom>n;return s&&o};function $i(e,t,i,n){const s=e.filter((e=>e.roadblock)).filter((e=>!e.mediaTypes.includes("Instream"))).filter((e=>P(e.divId))),o=e.filter((e=>!e.roadblock)).filter((e=>!e.mediaTypes.includes("Instream"))).filter((e=>P(e.divId))),a=e.filter((e=>e.mediaTypes.includes("Instream"))).filter((e=>P(e.divId)));t.executeAdCallRoadblock(s),a.length>0&&(a.length>1&&_(`cannot monetize multiple instream adunits, using only the first one ${a[0].divId}`),null==i||i.executeAdCall(a[0]));const r=function(e){if(e&&e.lazyLoadingKleanads){const t=e.lazyLoadingKleanads.viewportPercent/100;return O(`[lazyloading] lazy loading enabled with ${t} viewports`),(e,i)=>Ei(e,i,t)}}(n);if(r){const e=new ki(window,r);s.length>0?setTimeout((()=>Ti(o,e,t)),1e3):Ti(o,e,t)}else s.length>0?setTimeout((()=>t.executeAdCall(o)),1e3):t.executeAdCall(o)}function Ti(e,t,i){const n=e.filter((e=>{var i;return(null===(i=e.anchor)||void 0===i?void 0:i.mode)||e.outOfPageType||t.isDivIdMatchingRule(e.divId)})),s=n.filter((e=>!i.isAlreadyMonetized(e)));i.executeAdCall(s),setTimeout((()=>Ti(e,t,i)),200)}const Oi="[optimization]",Ri=async e=>{try{const t=await _i();if(null==e?void 0:e.prebidConfig.adCallTimeout){const i=t.getTimeout(null==e?void 0:e.prebidConfig.adCallTimeout);O(`${Oi} Ad call timeout optimized from ${null==e?void 0:e.prebidConfig.adCallTimeout} to ${i}`),e.prebidConfig.adCallTimeout=i}}catch(e){L(`${Oi} Error while loading optimization engine`,e)}return e},_i=async()=>new Promise(((e,t)=>{try{const i={env:{}};WebAssembly.instantiateStreaming(fetch("https://cdn-adm.pbstck.com/kleanads/wasm/volt.wasm"),i).then((t=>{O(`${Oi} WebAssembly module loaded successfully`,t),e(t.instance.exports)})).catch((e=>{t(e)}))}catch(e){t(e)}}));function Li(e,t){var i;const n=null===(i=null==e?void 0:e.sites)||void 0===i?void 0:i[t],s=null==e?void 0:e.scope;return null!=n?n:s}function Ui(e,t){var i;if(t)return null!==(i=t[e])&&void 0!==i?i:t.type}function Pi(e){var t;const i=("; "+document.cookie).split("; "+e+"=");if(2===i.length)return null===(t=i.pop())||void 0===t?void 0:t.split(";").shift()}function xi(e,t){return t.flatMap((t=>[t,...e.filter((e=>e.bidderSource===t)).map((e=>e.bidderLabel))]))}class Ni{constructor(e,t){this.stackLoadedConfig={...e,runningABTest:[]},this.pocOverrides=t}withConvertToInstreamAdUnit(){const e=this.pocOverrides.convertToInstreamAdUnits;return e&&this.stackLoadedConfig.adUnits.forEach((t=>{const i=e[t.adUnitName];i&&(t.isInstream=!0,t.dynamic=!1,t.parallax=!1,t.anchor=void 0,t.canOutstream=!1,t.biddersOutstream=[],t.floors=i.floors,t.instreamParams=i.instreamParams)})),this}withConvertToNativeAdUnit(){const e=this.pocOverrides.convertToNativeAdUnits;return e&&this.stackLoadedConfig.adUnits.forEach((t=>{const i=e[t.adUnitName];i&&(t.canNative=!0,t.nativeParams=i.nativeParams,i.nativeOnly&&(t.sizes=[],t.extraAdServerSizes=[],t.isInstream=!1,t.parallax=!1,t.anchor=void 0,t.canOutstream=!1,t.biddersOutstream=[]))})),this}withFirstId(){var e,t,i;if(null===(e=this.pocOverrides)||void 0===e?void 0:e.firstId){const e=this.stackLoadedConfig.prebidConfig.pbjsConfig.bidderAliases||[],n=function(){const e=new RegExp("(?:(?:^|.*; *)firstid *= *([^;]*).*$)|^.*$","i"),t=document.cookie.match(e);return t&&t[1]?decodeURIComponent(t[1]):void 0}();if(n){const s=null!==(i=null===(t=this.stackLoadedConfig.prebidConfig.pbjsConfig.userSync)||void 0===t?void 0:t.userIds)&&void 0!==i?i:[];s.push({name:"pubProvidedId",bidders:xi(e,["appnexus","pubmatic","rubicon","ix","nexx360","criteo","smartadserver","mediasquare","ogury","freewheel-ssp","outbrain","taboola","adf"]),params:{eids:[{source:"first-id.fr",uids:[{id:n,atype:1,ext:{stype:"ppuid"}}]}]}}),this.stackLoadedConfig.prebidConfig.pbjsConfig.userSync={...this.stackLoadedConfig.prebidConfig.pbjsConfig.userSync,userIds:s}}}return this}withId5Id(){var e,t,i;if(null===(e=this.pocOverrides)||void 0===e?void 0:e.id5id){const e=localStorage.getItem(this.pocOverrides.id5id.pd);e&&(null!==(i=null===(t=this.stackLoadedConfig.prebidConfig.pbjsConfig.userSync)||void 0===t?void 0:t.userIds)&&void 0!==i?i:[]).forEach((t=>{"id5Id"===t.name&&(t.params||(t.params={}),t.params.pd=e)}))}return this}withConvertToInterstitialAdUnit(){const e=this.pocOverrides.convertToInterstitialAdUnits;return e&&this.stackLoadedConfig.adUnits.forEach((t=>{e.includes(t.adUnitName)&&(t.outOfPageType="interstitial",O(`Interstitial adUnit found: ${t.adUnitName}`))})),this}withSkinRenderingSettings(e,t){var i,n,s;const o=null===(i=this.pocOverrides)||void 0===i?void 0:i.skinRenderingSettings,a=null===(n=null==o?void 0:o.stackLevel)||void 0===n?void 0:n[t],r=null===(s=null==o?void 0:o.siteLevel)||void 0===s?void 0:s[e];return(null==r?void 0:r.disableSkinBids)||(null==a?void 0:a.disableSkinBids)?this.stackLoadedConfig.adUnits=this.stackLoadedConfig.adUnits.map((e=>({...e,sizes:e.sizes.filter((e=>!K(e,[1800,1e3])))}))):((null==r?void 0:r.biddersOverride)||(null==a?void 0:a.biddersOverride))&&(this.stackLoadedConfig.adUnits=this.stackLoadedConfig.adUnits.map((e=>{var t;return e.sizes.some((e=>K(e,[1800,1e3])))?{...e,biddersSkin:null!==(t=null==a?void 0:a.biddersOverride)&&void 0!==t?t:null==r?void 0:r.biddersOverride}:e}))),this}withRefreshOutOfFocus(e){var t,i;const n=null===(t=this.pocOverrides)||void 0===t?void 0:t.refreshOutOfFocus;if(n){const t=Li(n,e);t&&(null===(i=this.stackLoadedConfig.refreshConfig)||void 0===i||i.adUnitConfig.forEach((e=>{e.refreshOutOfFocusConfig=t})))}return this}withPpidSolution(e){var t;const i=Li(null===(t=this.pocOverrides)||void 0===t?void 0:t.ppidSolutions,e);if(i){const e=Array.isArray(i.ppidSolution)?i.ppidSolution:[i.ppidSolution],{type:t,value:n}=function(e){var t,i;for(const n of e)switch(n){case Le.firstId:return{type:"prebid",value:"first-id.fr"};case Le.sharedId:return{type:"prebid",value:"pubcid.org"};case Le.utiqId:return{type:"prebid",value:"utiq.com"};case Ue.id5id:{const e=localStorage.getItem("id5id");if(e)return{type:"other",value:(i=e,JSON.parse(decodeURIComponent(i)).gp)};break}default:{let e=localStorage.getItem(n);if(e)return{type:"other",value:e};if(e=null!==(t=Pi(n))&&void 0!==t?t:null,e)return{type:"other",value:e}}}return{type:"other",value:""}}(e);if("prebid"===t)this.stackLoadedConfig.prebidConfig.pbjsConfig.userSync={...this.stackLoadedConfig.prebidConfig.pbjsConfig.userSync,ppid:n};else this.stackLoadedConfig.gamConfig&&n&&(this.stackLoadedConfig.gamConfig.ppidValue=n)}return this}withRefreshAlwaysInView(){var e;const t=null===(e=this.pocOverrides)||void 0===e?void 0:e.refreshAlwaysInViewAdUnitNames;if(this.stackLoadedConfig.refreshConfig&&t&&t.length>0){const e=[];this.stackLoadedConfig.refreshConfig.adUnitConfig.forEach((i=>{t.forEach((t=>{var n;(null===(n=i.adUnitNames)||void 0===n?void 0:n.includes(t))&&(e.push({...i,alwaysInView:!0,adUnitNames:[t]}),i.adUnitNames.splice(i.adUnitNames.indexOf(t),1))}))})),this.stackLoadedConfig.refreshConfig.adUnitConfig=[...this.stackLoadedConfig.refreshConfig.adUnitConfig.filter((e=>(e.adUnitNames||[]).length>0)),...e]}return this}withrefreshBehaviorOnEmpty(){var e,t;const i=null===(e=this.pocOverrides)||void 0===e?void 0:e.refreshBehaviorOnEmpty;return i&&(null===(t=this.stackLoadedConfig.refreshConfig)||void 0===t||t.adUnitConfig.forEach((e=>{e.refreshBehaviorOnEmpty=i}))),this}withOutbrainConfig(e){var t;if(null===(t=this.pocOverrides)||void 0===t?void 0:t.outbrainConfig){const t=this.pocOverrides.outbrainConfig.find((t=>t.siteId===e)),i=this.pocOverrides.outbrainConfig.find((e=>!e.siteId)),n=t||i;n&&(this.stackLoadedConfig.prebidConfig.pbjsConfig.outbrain={bidderUrl:n.bidderUrl,usersyncUrl:n.usersyncUrl})}return this}withXplnConfig(e){const t=Li(this.pocOverrides.xplnConfig,e);return t&&(this.stackLoadedConfig.xplnConfig=t),this}withFloorEnforcement(e){var t,i,n,s,o,a;if(null===(t=this.pocOverrides)||void 0===t?void 0:t.floorEnforcement){const t=null===(s=null===(n=null===(i=this.pocOverrides)||void 0===i?void 0:i.floorEnforcement)||void 0===n?void 0:n.sites)||void 0===s?void 0:s[e],r=null===(a=null===(o=this.pocOverrides)||void 0===o?void 0:o.floorEnforcement)||void 0===a?void 0:a.scope;(t||r)&&(this.stackLoadedConfig.prebidConfig.pbjsConfig.floors={...this.stackLoadedConfig.prebidConfig.pbjsConfig.floors,enforcement:{...null!=t?t:r}})}return this}withDynamicPrebidFloors(e){var t,i,n,s,o,a;if(null===(t=this.pocOverrides)||void 0===t?void 0:t.dynamicPrebidFloors){const t=null===(s=null===(n=null===(i=this.pocOverrides)||void 0===i?void 0:i.dynamicPrebidFloors)||void 0===n?void 0:n.sites)||void 0===s?void 0:s[e],r=null===(a=null===(o=this.pocOverrides)||void 0===o?void 0:o.dynamicPrebidFloors)||void 0===a?void 0:a.scope;(t||r)&&this.stackLoadedConfig.adUnits.forEach((e=>{e.dynamicPrebidFloor=!0}))}return this}withFledgeForGpt(){var e,t;if(null===(e=this.pocOverrides)||void 0===e?void 0:e.fledgeForGpt){const e=xi(this.stackLoadedConfig.prebidConfig.pbjsConfig.bidderAliases||[],["criteo"]);this.stackLoadedConfig.adUnits.forEach((t=>{var i;t.bidders.find((t=>e.includes(t.bidder)))&&(t.ortb2Imp={...t.ortb2Imp,ext:{...null===(i=t.ortb2Imp)||void 0===i?void 0:i.ext,ae:1}})})),this.stackLoadedConfig.prebidConfig.pbjsConfig.bidderConfigs||(this.stackLoadedConfig.prebidConfig.pbjsConfig.bidderConfigs=[]);const i=this.stackLoadedConfig.prebidConfig.pbjsConfig.bidderConfigs.find((t=>Array.isArray(t.bidders)&&t.bidders.find((t=>e.includes(t)))));i&&i.config?i.config.fledgeEnabled=!0:null===(t=this.stackLoadedConfig.prebidConfig.pbjsConfig.bidderConfigs)||void 0===t||t.push({bidders:[...e],config:{fledgeEnabled:!0}}),this.stackLoadedConfig.prebidConfig.pbjsConfig={...this.stackLoadedConfig.prebidConfig.pbjsConfig,fledgeForGpt:!0}}return this}withRtbHousePaapi(){if(this.pocOverrides.rtbhousePaapi){const e=xi(this.stackLoadedConfig.prebidConfig.pbjsConfig.bidderAliases||[],["rtbhouse"]);this.stackLoadedConfig.adUnits.some((t=>t.bidders.some((t=>e.includes(t.bidder)))))&&(this.stackLoadedConfig.prebidConfig.pbjsConfig={...this.stackLoadedConfig.prebidConfig.pbjsConfig,paapi:{enabled:!0,bidders:[...e],defaultForSlots:1,gpt:{autoconfig:!0}}})}return this}withSkinFloor(e){var t,i,n;const s=null===(t=this.pocOverrides)||void 0===t?void 0:t.skinFloor;if(s){const t=null!==(n=null===(i=s.specificFloor)||void 0===i?void 0:i[e])&&void 0!==n?n:s.defaultFloor;this.stackLoadedConfig.adUnits.forEach((e=>{var i;if(e.sizes.some((e=>K(e,[1800,1e3]))))if(e.floors){const n=null===(i=e.floors)||void 0===i?void 0:i.values.banner;n?e.floors={...e.floors,schema:{delimiter:"|",fields:["mediaType","size"]},values:{"banner|*":n,"banner|1800x1000":t}}:L("no banner value found in floors, skin floor cannot be applied.",e.floors)}else e.floors={currency:s.currency,schema:{delimiter:"|",fields:["mediaType","size"]},values:{"banner|1800x1000":t}}}))}return this}withDsaConfig(){var e,t;return(null===(e=this.pocOverrides)||void 0===e?void 0:e.dsaConfig)&&(this.stackLoadedConfig.prebidConfig.pbjsConfig={...this.stackLoadedConfig.prebidConfig.pbjsConfig,dsaConfig:null===(t=this.pocOverrides)||void 0===t?void 0:t.dsaConfig}),this}withPrebidServerConfig(e){var t,i,n,s,o,a;if((null===(t=this.pocOverrides)||void 0===t?void 0:t.prebidServer)&&this.pocOverrides.prebidServer.siteIds.includes(e)){if(W(this.pocOverrides.prebidServer.ratio)){O("Run ABTest hybrid monetization PBJS + PBS");const e=W(void 0!==(null===(i=this.stackLoadedConfig.prebidConfig.pbjsConfig)||void 0===i?void 0:i.priceGranularity)&&this.pocOverrides.prebidServer.ratioPriceGranularity?this.pocOverrides.prebidServer.ratioPriceGranularity:0);this.stackLoadedConfig.prebidConfig.pbjsConfig={...this.stackLoadedConfig.prebidConfig.pbjsConfig,s2sConfig:{...this.pocOverrides.prebidServer.s2sConfig}};let t=null!==(n=this.pocOverrides.prebidServer.metaABTestServerSide)&&void 0!==n?n:"rule2";e&&(null===(o=null===(s=this.stackLoadedConfig.prebidConfig.pbjsConfig.s2sConfig)||void 0===s?void 0:s.extPrebid)||void 0===o?void 0:o.targeting)&&(this.stackLoadedConfig.prebidConfig.pbjsConfig.s2sConfig.extPrebid.targeting.priceGranularity=this.stackLoadedConfig.prebidConfig.pbjsConfig.priceGranularity,t=`${t}_with_pg`,O("Run ABTest for PriceGranularity on Prebid Server side")),p(t)}else p(null!==(a=this.pocOverrides.prebidServer.metaABTestClientSide)&&void 0!==a?a:"rule1")}return this}withPbjsAnalytics(e){var t;const i=Li(null===(t=this.pocOverrides)||void 0===t?void 0:t.pbjsAnalytics,e);if(i){const e=this.stackLoadedConfig.prebidConfig.pbjsConfig.analytics||[];this.stackLoadedConfig.prebidConfig.pbjsConfig.analytics=[...e,...i]}return this}withAnchorDesktop(e){var t;return Li(null===(t=this.pocOverrides)||void 0===t?void 0:t.anchorDesktop,e)&&this.stackLoadedConfig.adUnits.filter((e=>void 0!==e.anchor)).forEach((e=>e.anchorDesktop=!0)),this}withRoadblockOrder(e){var t;const i=Li(null===(t=this.pocOverrides)||void 0===t?void 0:t.roadblockOrder,e);return i&&this.stackLoadedConfig.adUnits.forEach((e=>{i[e.adUnitName]&&(e.roadblock=i[e.adUnitName])})),this}withDisableThreadYield(e){var t;const i=window.location.search,n=new URLSearchParams(i);return(Li(null===(t=this.pocOverrides)||void 0===t?void 0:t.disableThreadYield,e)||n.get("disableThreadYield"))&&this.stackLoadedConfig.gamConfig&&(this.stackLoadedConfig.gamConfig.threadYieldConfig=_e.DISABLED),this}withDisableGptPreAuction(e){var t;return Li(null===(t=this.pocOverrides)||void 0===t?void 0:t.disableGptPreAuction,e)&&(oe.getInstance().disableGptPreAuction=!0),this}build(){return this.stackLoadedConfig}}function ji(e,t,i,n){var s;const{pocOverrides:o,runningABTest:a}=function(e,t){var i;const{overrideABTest:n,...s}=e,o=(null===(i=null==n?void 0:n.sites)||void 0===i?void 0:i[t])||(null==n?void 0:n.scope);if(!o)return{pocOverrides:s,runningABTest:[]};const a=W(o.ratio),r=Object.keys(o.populationB);if(a){return{pocOverrides:Object.assign({...s},{...o.populationB}),runningABTest:r.map((e=>({name:e,value:"B"})))}}return{pocOverrides:s,runningABTest:r.map((e=>({name:e,value:"A"})))}}(null!==(s=t.pocOverrides)&&void 0!==s?s:{},t.tagId);return{...new Ni(e,o).withConvertToInstreamAdUnit().withConvertToNativeAdUnit().withFirstId().withId5Id().withSkinRenderingSettings(t.tagId,n.stackId).withRefreshAlwaysInView().withrefreshBehaviorOnEmpty().withRefreshOutOfFocus(t.tagId).withXplnConfig(t.tagId).withOutbrainConfig(t.tagId).withFledgeForGpt().withRtbHousePaapi().withSkinFloor(t.tagId).withDsaConfig().withPrebidServerConfig(t.tagId).withPpidSolution(t.tagId).withConvertToInterstitialAdUnit().withPbjsAnalytics(t.tagId).withFloorEnforcement(t.tagId).withDynamicPrebidFloors(t.tagId).withAnchorDesktop(t.tagId).withRoadblockOrder(t.tagId).withDisableThreadYield(t.tagId).withDisableGptPreAuction(t.tagId).build(),runningABTest:a}}const Di=e=>!!e.priority&&!!e.conditions,Bi=e=>!e.priority&&!e.conditions,Mi=e=>"elements"in e;const Fi={AND:({elements:e},t)=>e.every((e=>Wi(e,t))),OR:({elements:e},t)=>e.some((e=>Wi(e,t)))},zi={IN:({key:e,values:t},i)=>t.some((t=>t===i.get(e))),NOT_IN:({key:e,values:t},i)=>!t.some((t=>t===i.get(e)))};function Wi(e,t){return Mi(e)?Fi[e.op](e,t):zi[e.op](e,t)}const Vi=e=>{var t,i;if(null===(t=e.refreshConfig)||void 0===t?void 0:t.adUnitConfig.some((e=>e.refreshOutOfFocusConfig)))return e;return e.refreshConfig&&W(1)&&(null===(i=e.refreshConfig)||void 0===i||i.adUnitConfig.forEach((e=>{e.refreshOutOfFocusConfig={timerInView:1}}))),e},Gi={pbjsFinished:!1,apsFinished:!1},Hi="[executor] [buffered]";var Ji;!function(e){e[e.FirstCall=0]="FirstCall",e[e.Refresh=1]="Refresh"}(Ji||(Ji={}));class Ki{constructor(e,t,i,n){this.buffer=[],this.auctionRunning=!1,this.adUnitAuctionStatus=new Map,this.adServer=e,this.pbjs=t,this.aps=i,this.kleanadsRunCount=n}executeAdCall(e){if(0===e.length)return;setTimeout((()=>{e.forEach((e=>ut(e.divId,"executorTimeout")))}),2e4);const t=e.filter((e=>!this.adUnitAuctionStatus.has(e.divId))).sort(((e,t)=>x(e.divId)-x(t.divId)));this.logAlreadyMonetizedAdUnits(e,t),O(`${Hi} buffering adunits`,e),t.forEach((e=>{this.bufferAdUnits({adUnits:[e],origin:Ji.FirstCall})}))}executeAdCallRoadblock(e){if(0===e.length)return;setTimeout((()=>{e.forEach((e=>ut(e.divId,"executorTimeout")))}),2e4);const t=e.filter((e=>!this.adUnitAuctionStatus.has(e.divId))).sort(H);this.logAlreadyMonetizedAdUnits(e,t),O(`${Hi} buffering adunits`,e),g("executor:roadblock",{slotIds:t.map((e=>e.divId))}),this.bufferAdUnits({adUnits:t,origin:Ji.FirstCall})}bufferAdUnits(e){var t;switch(this.buffer.push(e),e.origin){case Ji.FirstCall:null===(t=e.adUnits)||void 0===t||t.forEach((e=>{this.adUnitAuctionStatus.set(e.divId,Gi)}));break;case Ji.Refresh:this.adUnitAuctionStatus.set(e.refreshableAdUnit.adUnit.divId,Gi);break;default:L(`${Hi} unknown buffer entry origin`)}this.startAuctionForBufferedAdUnits()}executeRefresh(e){this.bufferAdUnits({refreshableAdUnit:e,origin:Ji.Refresh})}startAuctionForBufferedAdUnits(){if(this.auctionRunning)return void O(`${Hi} auction already running, not starting a new one`);O(`${Hi} looking at buffer with ${this.buffer.length} entries`);const e=this.buffer.shift();if(O(`${Hi} adunits taken from buffer`,e),e)switch(e.origin){case Ji.FirstCall:this.startAuction(e.adUnits);break;case Ji.Refresh:this.startAuction([e.refreshableAdUnit.adUnit],{labels:["pubstackRefresh",`pubstackRefreshRank:${e.refreshableAdUnit.rank}`]});break;default:L(`${Hi} unknown buffer entry origin`)}else O(`${Hi} no more adunit to monetize in buffer`)}startAuction(e,t){this.auctionRunning=!0,e.forEach((e=>{Qe(e.divId,He.START_AUCTION)})),O(`${Hi} starting auctions for ${e.map((e=>e.divId))}`);const i=oe.getInstance().kleanadsRunCount;if(this.pbjs){const n=this.pbjs.getPbjs();this.pbjs.startPbjsAuction(e,(()=>{this.kleanadsRunCount===i?this.pbjsFinished(n,e):O(`${Hi} kleanads run count has changed (from ${this.kleanadsRunCount} to ${i}), avoid calling pbjsFinished`)}),t)}this.aps&&this.aps.startApsAuction(e,(t=>{this.kleanadsRunCount===i?this.apsFinished(e,t):O(`${Hi} kleanads run count has changed (from ${this.kleanadsRunCount} to ${i}), avoid calling apsFinished`)})),this.pbjs||this.aps||this.adServer.executeWhenAdServerReady((()=>{this.kleanadsRunCount===i?this.callAdServer(e):O(`${Hi} kleanads run count has changed (from ${this.kleanadsRunCount} to ${i}), avoid calling AdServer`)}))}isAlreadyMonetized(e){return this.adUnitAuctionStatus.has(e.divId)}logAlreadyMonetizedAdUnits(e,t){if(e.length!==t.length){const t=e.filter((e=>this.adUnitAuctionStatus.has(e.divId)));_(`${Hi} cannot make a new ad call, existing one on ${t.map((e=>e.divId)).join(",")}.`)}}pbjsFinished(e,t){O(`${Hi} pbjs end callback for ${t.map((e=>e.divId)).join(",")}`,e.getAllPrebidWinningBids()),t.forEach((e=>{Qe(e.divId,He.END_PBJS_AUCTION),ht(e.divId)})),this.adServer.executeWhenAdServerReady((()=>{O(`${Hi} pbjs end callback ad server ready ${t.map((e=>e.divId)).join(",")}`),this.adServer.setPbjsTargetings(e,t),t.forEach((e=>{const t=this.adUnitAuctionStatus.get(e.divId);t&&this.adUnitAuctionStatus.set(e.divId,{...t,pbjsFinished:!0})})),this.canCallAdServer(t)&&this.callAdServer(t)}))}apsFinished(e,t){O(`${Hi} aps end callback ${e.map((e=>e.divId)).join(",")}`,t),e.forEach((e=>Qe(e.divId,He.END_APS_AUCTION))),this.adServer.executeWhenAdServerReady((()=>{O(`${Hi} aps end callback ad server ready ${e.map((e=>e.divId)).join(",")}`),this.adServer.setApsTargetings(e,t),e.forEach((e=>{const t=this.adUnitAuctionStatus.get(e.divId);t&&this.adUnitAuctionStatus.set(e.divId,{...t,apsFinished:!0})})),this.canCallAdServer(e)&&this.callAdServer(e)}))}canCallAdServer(e){const t=e.filter((e=>{const t=this.adUnitAuctionStatus.get(e.divId);return this.aps&&!this.pbjs?t&&t.apsFinished:this.pbjs&&!this.aps?t&&t.pbjsFinished:this.pbjs&&this.aps?t&&t.apsFinished&&t.pbjsFinished:void 0}));return t.length>0&&t.length!==e.length&&L(`${Hi} cannot call ad server for ${e.map((e=>e.divId)).join(",")}, some ad units are not ready`),t.length>0}callAdServer(e){if(this.auctionRunning=!1,this.startAuctionForBufferedAdUnits(),e.forEach((e=>{Qe(e.divId,He.START_AD_SERVER_CALL)})),e.length>0){this.adServer.callAdServer(e);const t=e.map((e=>e.divId));O(`${Hi} ad server called ${t.join(",")}`)}}}class qi{constructor(e,t,i){this.stackConfig=e,this.kleanAdsConfig=t,this.pageContext=i,this.adUnits=[],this.callbacks=[]}alreadyUsedDivIds(){return this.adUnits.map((e=>e.divId))}setConfig(e,t,i){this.stackConfig=e,this.kleanAdsConfig=t,this.pageContext=i,this.adUnits=[],this.callbacks=[]}async executeWhenAdUnitsFound(e){const t=(i=this.stackConfig,n=this.kleanAdsConfig,s=this.pageContext,Yi(i.adUnits,i,n,s)).filter((e=>!this.alreadyUsedDivIds().includes(e.divId)));var i,n,s;if(this.adUnits.push(...t),await e(this.adUnits),this.callbacks.push(e),!this.adUnitObserver){const e=async e=>{const t=function(e,t,i,n){return Yi([e],t,i,n)}(e,this.stackConfig,this.kleanAdsConfig,this.pageContext).filter((e=>!this.alreadyUsedDivIds().includes(e.divId))).reduce(((e,t)=>(e.find((e=>e.divId===t.divId))?L(`We tried to prepare two times the same divId, skipping adUnit ${t.adServerAdUnitName} from the list`,t):(e.push(t),R("New adUnit dynamicaly loaded",t.divId)),e)),[]);t.length>0&&(this.adUnits.push(...t),this.callbacks.forEach((async e=>{await e(t)})))};this.startAdUnitObserver(e)}}cleanObserverAndAdUnits(){var e;null===(e=this.adUnitObserver)||void 0===e||e.disconnect(),this.adUnitObserver=void 0,this.adUnits=[]}startAdUnitObserver(e){const t=this.alreadyUsedDivIds(),i=this.stackConfig.adUnits.filter((e=>!t.includes(e.divId)||e.dynamic)),n=document.body,s=new MutationObserver(function(e,t){return(i,n)=>{i.filter((e=>"childList"===e.type&&e.addedNodes.length>0)).forEach((i=>{Array.from(i.addedNodes).filter((e=>e.nodeType===Node.ELEMENT_NODE)).forEach((i=>{e.forEach((e=>{const n=e.divId.startsWith("css:")?e.divId.replace("css:",""):e.dynamic?`[id^="${e.divId}"]`:`[id="${e.divId}"]`;(i.matches(n)||i.querySelectorAll(n).length>0)&&t(e)}))}))}))}}(i,e));s.observe(n,{childList:!0,subtree:!0}),this.adUnitObserver=s}}function Yi(e,t,i,n){var s,o;const a=null!==(o=null===(s=null==t?void 0:t.gamConfig)||void 0===s?void 0:s.adUnitPathConfig)&&void 0!==o?o:[];return Te(e,n,function(e,t){var i,n,s,o,a;const r=null!==(n=null===(i=null==t?void 0:t.gamConfig)||void 0===i?void 0:i.networkId)&&void 0!==n?n:e.networkId,d=(null===(s=null==t?void 0:t.gamConfig)||void 0===s?void 0:s.mcmIds)&&(null===(o=null==t?void 0:t.gamConfig)||void 0===o?void 0:o.mcmIds.length)>0?null===(a=null==t?void 0:t.gamConfig)||void 0===a?void 0:a.mcmIds:e.mcmIds;return r?d?[r,...d].join(","):r:""}(i,t),a,i.pubstackDeclarationTargetingKeys)}let Xi=(()=>{let e,t,i=[Ci("onStackConfigLoad")],n=[];return t=class{constructor(){this.name="AdUnitsManager"}get adUnitsManager(){return this._adUnitsManager}isLoaded(){return!!this._adUnitsManager}async load({config:e,stackConfig:t}){this._adUnitsManager=new qi(t,e,e.pageContext)}async onStackConfigLoad({config:e,stackConfig:t}){var i;null===(i=this._adUnitsManager)||void 0===i||i.setConfig(t,e,e.pageContext)}async clean(){var e;null===(e=this._adUnitsManager)||void 0===e||e.cleanObserverAndAdUnits()}},yi(t,"AdUnitsManagerModule"),(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;mi(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),bi(t,n)})(),t})();class Qi{constructor(e,t){this.element=e,this.dateIn=0,this.pastTimeInView=0,this.isInview=!1,this.alwaysInView=null!=t&&t,this.isTabActivated="visible"===window.document.visibilityState,this.isVisible=!window.document.hidden,this.resetAt=0,this.hasBeenReset=!1}getTimeInView(e){return this.hasBeenReset?e>=this.dateIn&&this.dateIn>0&&(this.isInview||this.alwaysInView)&&this.isTabActivated?this.pastTimeInView+(e-this.dateIn):this.pastTimeInView:0}getTimeOnPage(e){return this.hasBeenReset?e-this.resetAt:0}resetTimer(e){(this.isInview||this.alwaysInView)&&this.isTabActivated&&(this.dateIn=e),this.resetAt=e,this.hasBeenReset=!0,this.pastTimeInView=0}updateTimerOnInViewChange(e,t){this.isInview=e,this.updateTimer(t)}updateTimerOnTabStatusChange(e,t){this.isTabActivated=e,this.updateTimer(t)}updateTimerOnVisibleChange(e,t){this.isVisible=e,this.updateTimer(t)}updateTimer(e){if((this.isInview||this.alwaysInView)&&this.isTabActivated)return 0===this.dateIn?void(this.dateIn=e):this.dateIn>0?void 0:void(this.dateIn=e);this.dateIn>0&&(e>=this.dateIn&&(this.pastTimeInView=this.pastTimeInView+(e-this.dateIn)),this.dateIn=0)}}const Zi="kleanads-refresh";function en(e,...t){u(Zi,e,...t)}function tn(e,...t){f(Zi,e,...t)}const nn={root:null,rootMargin:"0px",threshold:.5};class sn{constructor(e,t){this.elements={},this.observer=new IntersectionObserver((e=>{this.handleIntersect(e,this),tn("AdUnitsObserver",this)}),nn),this.configAlwaysInView=t,e.forEach((e=>{this.elements[e.id]=new Qi(e,null==t?void 0:t[e.id]),this.observer.observe(e)})),addEventListener("visibilitychange",(()=>{tn("visibilitychange",window.document.visibilityState),"visible"===window.document.visibilityState?Object.keys(this.elements).forEach((e=>{this.elements[e].updateTimerOnTabStatusChange(!0,Date.now())})):Object.keys(this.elements).forEach((e=>{this.elements[e].updateTimerOnTabStatusChange(!1,Date.now())}))}))}isObserving(e){return e in this.elements}unobserve(e){this.isObserving(e)&&(this.observer.unobserve(this.elements[e].element),delete this.elements[e])}observe(e){var t;this.isObserving(e.id)||(this.elements[e.id]=new Qi(e,null===(t=this.configAlwaysInView)||void 0===t?void 0:t[e.id]),this.observer.observe(e))}getObservedDivIds(){return Object.keys(this.elements)}getTimeInView(e,t){return this.isObserving(e)?this.elements[e].getTimeInView(t):0}isInView(e){return!!this.isObserving(e)&&this.elements[e].isInview}getTimeOnPage(e,t){return this.isObserving(e)?this.elements[e].getTimeOnPage(t):0}resetTimers(e,t){e.forEach((e=>{this.isObserving(e)&&(tn(`reseting time for ${e}`),this.elements[e].resetTimer(t))}))}getAdUnitInViewTimer(e){return this.elements[e]}handleIntersect(e,t){e.forEach((e=>{const i=Date.now();t.elements[e.target.id].updateTimerOnInViewChange(e.isIntersecting,i),tn("AdUnitsObserver",e.target.id,t.elements[e.target.id])}))}}class on{constructor(e,t,i){this.adUnitsObserver=new sn(e,i),this.exclusions=t,this.lastRenderInfo={},this.refreshRank={},this.hasAuctionInProgress={},this.shouldRefreshBeforeTimerEnd={},this.consecutiveSecondChanceAttempts={},e.forEach((e=>{this.refreshRank[e.id]=0,this.hasAuctionInProgress[e.id]=!1,this.shouldRefreshBeforeTimerEnd[e.id]=!1,this.consecutiveSecondChanceAttempts[e.id]=0}))}unobserve(e){tn("refresh unobserve",e),this.adUnitsObserver.unobserve(e)}addAdUnits(e){e.forEach((e=>{tn("refresh addAdUnit",e.id),this.adUnitsObserver.observe(e),this.refreshRank[e.id]=0,this.hasAuctionInProgress[e.id]=!1}))}getTimeInView(e,t){return this.adUnitsObserver.getTimeInView(e,t)}getTimeOnPage(e,t){return this.adUnitsObserver.getTimeOnPage(e,t)}isInView(e){return this.adUnitsObserver.isInView(e)}needRefresh(e,t,i){var n,s;if(!this.adUnitsObserver.isObserving(e))return!1;if(this.cappingReached(e,i.capping))return!1;if(this.hasAuctionInProgress[e])return!1;if(this.shouldRefreshBeforeTimerEnd[e])return this.shouldRefreshBeforeTimerEnd[e]=!1,!0;const o=this.getTimeInView(e,t),a=this.getTimer(e,i.timer,i.refreshSpecificRules);!function(e,t,i,n,s,o){if(l()){const a=document.getElementById(t),r=null==a?void 0:a.parentElement,d="refresh_kleanads";let l=document.getElementById(`${d}_${t}-refresh-debug`);l||(l=document.createElement("div"),l.id=`${d}_${t}-refresh-debug`,l.style.position="absolute",l.style.bottom="5px",l.style.left="5px",l.style.zIndex="99999999",l.style.backdropFilter="blur(6px)",l.style.textShadow="1px 1px 1px rgba(0, 0, 0, 0.3)",l.style.fontFamily="Arial, sans-serif",l.style.borderRadius="5px",l.style.color="white",l.style.padding="8px 16px",l.style.display="flex",l.style.flexDirection="column",l.style.gap="5px",l.style.textAlign="left",l.style.border="1px solid white",l.style.transition="background-color 250ms linear",null==r||r.prepend(l));let c=document.getElementById(`${d}_${t}-refresh-div-id`);c||(c=document.createElement("span"),c.id=`${d}_${t}-refresh-div-id`,l.appendChild(c)),c.textContent=`${t}`,c.style.fontSize="1rem",c.style.fontWeight="bold";let u=document.getElementById(`${d}_${t}-refresh-debug-timer`);u||(u=document.createElement("span"),u.id=`${d}_${t}-refresh-debug-timer`,l.appendChild(u)),u.textContent=`Time in view : ${Math.floor(i/1e3).toString()}`,u.style.fontSize="1rem";let f=document.getElementById(`${d}_${t}-refresh-debug-refresh-rank`);f||(f=document.createElement("span"),f.id=`${d}_${t}-refresh-debug-refresh-rank`,l.appendChild(f));const h=null!=n?n:"∞";f.textContent=`Refresh rank : ${e.getRefreshRank(t).toString()} / ${h}`,f.style.fontSize="1rem",l.style.backgroundColor=s&&o?"rgba(55, 110, 79, 0.7)":"rgba(140, 71, 79, 0.7)"}}(this,e,o,i.capping,null===(n=this.adUnitsObserver.getAdUnitInViewTimer(e))||void 0===n?void 0:n.isTabActivated,null===(s=this.adUnitsObserver.getAdUnitInViewTimer(e))||void 0===s?void 0:s.isInview);const r=i.refreshOutOfFocusConfig,d=i.alwaysInView,c=this.getLastWinningMediaType(e);if(r&&!d&&"video"!==c){const i=this.getTimeOnPage(e,t),n=this.isInView(e),s=1e3*r.timerInView;return r.refreshOutOfView?o>=s&&i>=a:n&&o>=s&&i>=a}return o>=a}cappingReached(e,t){return!!t&&t<this.getRefreshRank(e)}getTimer(e,t,i){if("video"===this.getLastWinningMediaType(e))return 3e4;const n=this.getLastWinningBidder(e),s=this.getLastSize(e),o=[];return i.forEach((e=>{if(!e.timer)return;const t=!!n&&e.bidders.includes(n)&&0===e.sizes.length,i=s&&e.sizes.find((e=>K(e,s)))&&0===e.bidders.length,a=n&&s&&e.bidders.includes(n)&&e.sizes.find((e=>K(e,s)));(t||i||a)&&o.push(1e3*e.timer)})),o.length>0?Math.max(...o):1e3*t}getObservedDivIds(){return this.adUnitsObserver.getObservedDivIds()}getRefreshRank(e){const t=this.refreshRank[e];return this.adUnitsObserver.isObserving(e)&&t?t:0}updateAdUnitStatus(e,t){const i=e.divId;if(this.refreshRank[i]+=1,this.lastRenderInfo[i]=e,tn(`update status ${i} new refresh rank ${this.refreshRank[i]}`),e.isEmpty){if(t.refreshBehaviorOnEmpty===y.Continue)return;if(t.refreshBehaviorOnEmpty===y.InstantSecondChance)return void(this.consecutiveSecondChanceAttempts[t.divId]<1&&(this.consecutiveSecondChanceAttempts[t.divId]++,this.shouldRefreshBeforeTimerEnd[t.divId]=!0));tn(`${i} is excluded from refresh from now on (empty impression)`),this.unobserve(i)}else this.consecutiveSecondChanceAttempts[t.divId]=0;const n=t.refreshSpecificRules.filter((e=>!e.timer)),s=this.getLastWinningBidder(t.divId),o=this.getLastSize(t.divId);(!!n.find((e=>{const t=!!s&&e.bidders.includes(s),i=!!o&&!!e.sizes.find((e=>K(e,o))),n=t&&0===e.sizes.length,a=i&&0===e.bidders.length;return n||a||t&&i}))||this.isExcludedByConfig(t.divId)||this.cappingReached(i,t.capping))&&(tn(`${i} is excluded from refresh from now on`),this.unobserve(i))}getLastSize(e){var t;return(null===(t=this.lastRenderInfo[e])||void 0===t?void 0:t.size)||void 0}getLastAdvertiserId(e){var t;return(null===(t=this.lastRenderInfo[e])||void 0===t?void 0:t.advertiserId)||void 0}getLastWinningBidder(e){var t;return null===(t=this.lastRenderInfo[e])||void 0===t?void 0:t.hb_bidder}getLastWinningMediaType(e){var t;return null===(t=this.lastRenderInfo[e])||void 0===t?void 0:t.hb_mediaType}resetTimer(e,t){this.adUnitsObserver.resetTimers([e],t),this.hasAuctionInProgress[e]=!1}setAuctionInProgress(e){this.hasAuctionInProgress[e]=!0}isExcludedByConfig(e){const t=this.getLastAdvertiserId(e),i=this.getLastWinningLineItemId(e),n=this.getLastWinningOrderId(e),s=!!t&&this.exclusions.advertisers.includes(t),o=!!n&&this.exclusions.orders.includes(n),a=!!i&&this.exclusions.lineItems.includes(i);return s||o||a}getLastWinningLineItemId(e){var t;return(null===(t=this.lastRenderInfo[e])||void 0===t?void 0:t.lineItemId)||void 0}getLastWinningOrderId(e){var t;return(null===(t=this.lastRenderInfo[e])||void 0===t?void 0:t.orderId)||void 0}}async function an(e,i,n,s,o){const a=[],r=[],d={},l=new on([],s,d);e.executeWhenAdUnitsFound((async e=>{en("adUnits found for refresh",e),function(e,t){return e.flatMap((e=>{const i=e.adUnitNames.flatMap((e=>t.filter((t=>t.adUnitName.startsWith(e))))),n=e.specificRules.map((e=>e.bidder?{bidders:[e.bidder],sizes:[],timer:e.timer}:e));return i.filter((e=>!!e)).flatMap((t=>({...t,alwaysInView:e.alwaysInView,capping:e.capping,timer:e.timer,refreshSpecificRules:n,refreshBehaviorOnEmpty:e.refreshBehaviorOnEmpty,refreshOutOfFocusConfig:e.refreshOutOfFocusConfig})))}))}(n,e).forEach((e=>{a.push(e),e.alwaysInView&&(d[e.divId]=!0);const t=document.getElementById(e.divId);t?(r.push(t),l.addAdUnits([t])):en("element to refresh not found with id",e.divId)}))})),o.renderListener((e=>function(e,t,i){const n=e.divId,s=t.find((e=>e.divId===n));if(s){const t=e.hb_bidder;i.resetTimer(n,Date.now()),i.updateAdUnitStatus(e,s),t&&tn(`we have a winning bidder for ${n} that is from prebid: ${t}`),tn("render on",n)}}(e,a,l)));const c=()=>{const e=[],t=Date.now();l.getObservedDivIds().forEach((i=>{const n=a.find((e=>e.divId===i));n&&l.needRefresh(i,t,n)&&e.push(n)})),e.length>0&&e.forEach((e=>{const t=l.getRefreshRank(e.divId);en(`refresh on ${e.divId} with rank ${t}`);const n={adUnit:e,rank:t};o.setRefreshTargeting(n),i.executeRefresh(n),l.setAuctionInProgress(e.divId)})),l.getObservedDivIds().length>=0?setTimeout((()=>{c()}),100):en("There is no more adUnits observed, stop refreshCycle")};c();window.dispatchEvent(new CustomEvent(t.REFRESH_INIT,{detail:{stopRefresh:e=>{e&&Array.isArray(e)&&(null==e?void 0:e.length)>0?e.forEach((e=>{l.unobserve(e)})):l.getObservedDivIds().forEach((e=>{l.unobserve(e)}))}}}));const u=()=>{window.removeEventListener(t.PAGE_CHANGE,u),en("history mutation event received"),o.removeRenderListener(),r.forEach((e=>{l.resetTimer(e.id,Date.now()),l.unobserve(e.id)})),l.refreshRank={},l.lastRenderInfo={}};window.addEventListener(t.PAGE_CHANGE,u)}async function rn(e,t){var i,n,s,o,a,r,d;Xe(Ge.BEGIN_CONFIGURE),await B(e,{beforeStart:!0});const l=window;O(`Configure kleanads.js (version: ${e.kleanadsVersion}, run count: ${oe.getInstance().kleanadsRunCount})`);const c=function(e,t){const i=t.sort(M);for(const t of i)if(e>=t.size)return t.device;return"desktop"}(l.innerWidth,e.screenSizeBreakpoints);!function(e,t,i,n){I=new w(e,t,i,n),k=e,E=t}(e.tagId,e.kleanadsVersion,c,Li(null===(i=e.pocOverrides)||void 0===i?void 0:i.traceThrottling,e.tagId)),oe.getInstance().setUprState(null===(n=e.pocOverrides)||void 0===n?void 0:n.uprState,null===(s=e.pocOverrides)||void 0===s?void 0:s.uprRatio);const u=function(e,t){const i=bt(t),n=new Map(i.map((({key:e,defaultValue:t})=>[e,t])));e.document.querySelectorAll('meta[name^="pbstck_context:"]').forEach((e=>{var t,s;const o=null===(t=e.attributes.getNamedItem("name"))||void 0===t?void 0:t.value.substring(15).toLowerCase(),a=null===(s=e.attributes.getNamedItem("content"))||void 0===s?void 0:s.value.toLowerCase();if(o&&a){const e=i.find((({key:e})=>e===o));e&&(function(e,t){var i;return t.defaultValue===e||(null!==(i=t.otherValues)&&void 0!==i?i:[]).includes(e)}(a,e)?(n.set(o,a),O(`[context] found context ${o} with content ${a}`)):_(`[context] Unknown ${o} value ${a}`))}}));const s=new URLSearchParams(e.location.search);for(const e of s.keys())e.startsWith("pbstck_context:")&&(O(`[context] Add key ${e} found in URL to context`),n.set(e.slice(15),s.get(e)||""));return n}(l,e.context);0===u.size?O("[context] No context set"):(O("[context] The following context will be used:"),u.forEach(((e,t)=>{O(`[context] ${t} => ${e}`)})));const f=function(e,t){const i=e.filter(Di).sort(((e,t)=>e.priority-t.priority)),n=e.filter(Bi);0===n.length&&L("[stacks] Could not find default stack"),n.length>1&&L("[stacks] Multiple default stacks found");const s=n[0],o=i.find((e=>Wi(e.conditions,t))),a=null!=o?o:s;return a?O(`[stacks] served stack: ${a.stackId} ${a===s?"(default stack)":""}`,a):L("[stacks] No stack to serve"),a}(e.stacks,u);if(!f)return void L("No stack found, stopping monetization");const h=cn(f.versions).toString(),g={...e,device:c,stack:f,stackVersion:h,pageContext:u,consentlessMode:null===(o=e.pocOverrides)||void 0===o?void 0:o.consentlessMode,noCmp:b(),spaMode:null===(r=null===(a=e.spaConfig)||void 0===a?void 0:a[e.tagId])||void 0===r?void 0:r.mode,pubstackWindow:l,instreamType:Ui(e.tagId,null===(d=e.pocOverrides)||void 0===d?void 0:d.instreamConfig)},p=new Si(g,t);await p.loadInitialModules(),T(h);return{configPromise:dn(e,c,f,h,u),kleanAdsConfig:g,moduleService:p}}async function dn(e,t,i,n,s){return We(e,t,i,n).then((t=>{if(t){let s={...e.pocOverrides?ji(t,e,0,i):{...t,runningABTest:[]},stackId:i.stackId,version:n};return s=Vi(s),function(e){var t;const i=null!==(t=e.prebidConfig.pbjsConfig.bidderAliases)&&void 0!==t?t:[];return e.adUnits.forEach((e=>{e.bidders=e.bidders.map((e=>Lt(e,i)))})),e}(s)}return t}))}async function ln(e){var t,i,n,s,a,r,d;const{configPromise:l,kleanAdsConfig:{device:c,pageContext:u,...f},moduleService:h}=e;O("StartKleanAds"),Xe(Ge.BEGIN_START),pt();const g=f.noCmp||await vt(window);dt!==rt.UNKNOWN&&U("[metric] cmpResponseAvailable",{cmpResponseAvailable:et(Ve.CMP_RESPONSE_AVAILABLE),fromBeginCmpResponseAvailable:tt(Ve.BEGIN_INIT,Ve.CMP_RESPONSE_AVAILABLE),consentType:dt}),await h.modulesDispatchEvent("onAfterConsent"),await B(f,{beforeStart:!1});const p=f.stacks.find((e=>e.stackId===function(e){var t,i;return null===(i=null===(t=e.pocOverrides)||void 0===t?void 0:t.consentlessStacks)||void 0===i?void 0:i[e.tagId]}(f)));if(g){const e=await h.modulesDispatchEvent("onAfterConsentAccepted");await Promise.all(e)}else{O("Consent refused");const e=await h.modulesDispatchEvent("onAfterConsentRefused");await Promise.all(e),p&&(O("Consentless stack is the following",p),f.stack=p,f.stackVersion=cn(p.versions).toString(),T(f.stackVersion),O("Consent not given, using override consentless stack: ",p.stackId))}if(g||f.consentlessMode||p){await h.modulesDispatchEvent("onBeforeStackConfigLoad");const e=g?l:dn(f,c,f.stack,f.stackVersion);let o=await e;if(o&&(null===(t=f.pocOverrides)||void 0===t?void 0:t.optimizationModule)&&(o=await Ri(o),O("[pocOverrides] Optimization module finished")),O("[config] kleanAdsConfig:",f),O("[config] stackLoadedConfig:",o),o){if(f.pocOverrides&&f.pocOverrides.grapeshotTargetings){O("[pocOverrides] Poc Grapeshot enabled");const e=await async function(e){return new Promise((t=>{const i=`${e}${encodeURIComponent(window.location.href)}`,n=document.createElement("script");n.async=!0,n.src=i,n.onload=()=>t(window.gs_channels),setTimeout((()=>t(void 0)),3e3),n.onerror=()=>t(void 0),document.head.append(n)}))}(f.pocOverrides.grapeshotTargetings);oe.getInstance().grapeshotValues=e}await h.modulesDispatchEvent("onStackConfigLoad",{stackConfig:o});const e=null===(i=h.getLoadedModuleInstance(Ii))||void 0===i?void 0:i.pbjs;e&&(O("[config] Prebid is ready, onAfterPrebidReady is sent"),await h.modulesDispatchEvent("onAfterPrebidReady",{prebid:e}));const t=null===(n=h.getLoadedModuleInstance(Ai))||void 0===n?void 0:n.aps,l=null===(s=h.getLoadedModuleInstance(vi))||void 0===s?void 0:s.adServer;l&&await h.modulesDispatchEvent("onAfterAdServerReady",{adServer:l});const g=null===(a=h.getLoadedModuleInstance(Xi))||void 0===a?void 0:a.adUnitsManager;if(!l)return void L("no adServer found, stopping monetization");if(!g)return void L("no adUnitManager found, stopping monetization");yt(window,f.context,null!==(d=null===(r=o.gamConfig)||void 0===r?void 0:r.adUnitPathConfig)&&void 0!==d?d:[]);const p=oe.getInstance().kleanadsRunCount,v=new Ki(l,e,t,p),m=o.adUnits.some((e=>e.isInstream))?new wt(new fe(window,u,c,f.instreamType),e,t,p):void 0,b=async e=>{O("[config] adUnits to monetize:",e);const t=await h.modulesDispatchEvent("onPrepareAdUnits",{toPreparedAdUnits:e});Promise.all(t).then((()=>{O("[config] adUnits prepared"),h.modulesDispatchEvent("onAfterPrepareAdUnits",{preparedAdUnits:e})})),$i(e,v,m,o.lazyLoading)};await g.executeWhenAdUnitsFound(b);const y=o.refreshConfig,A=f.globalRefreshConfig;if(A&&y){const e=f.networkId&&A.hasExclusions?await gn(f.configUrl,f.networkId,f.stack.scopeId):C;an(g,v,y.adUnitConfig,e,l)}}else L("no input configuration, stopping monetization")}else O("consent not given, no monetization");switch(f.spaMode){case"manual":O("[SPA] manual SPA enabled"),hn((()=>{O("[SPA] manual page change requested, restarting kleanads.js"),un(f,h)}));break;case"auto":O("[SPA] auto SPA enabled"),o(),fn((()=>{O("[SPA] page change detected, restarting kleanads.js"),un(f,h)}))}Ye(Ve.MAIN_THREAD_END)}function cn(e){const t=e.sort(((e,t)=>e.ratio-t.ratio));return W(void 0!==t[0].ratio?t[0].ratio:100)?t[0].version:t[1].version}const un=async(e,t)=>{Xe(Ge.SPA_RELOAD);const i=oe.getInstance();i.setKleanadsRunCount(i.kleanadsRunCount+1),O("Unloading Kleanads, run cleanup on all modules");const n=t.getModules();await t.modulesCleanUp(),O("Kleanads unloaded, restarting");const s=await rn(e,n);s&&ln(s)},fn=e=>{const i=new MutationObserver((()=>{s()})),n=e=>{const t=e,n=new URL(t.detail.referrer),s=(o=t.detail.url)?`${o}`.startsWith("http")?new URL(o).pathname:`${o}`:"";var o;n.pathname!==s&&i.observe(document.head,{attributes:!0,childList:!0,subtree:!0})};window.addEventListener(t.HISTORY_MUTATION,n);const s=()=>{window.removeEventListener(t.HISTORY_MUTATION,n),i.disconnect(),window.dispatchEvent(new CustomEvent(t.PAGE_CHANGE)),e()}},hn=e=>{const n=()=>{s()};window.addEventListener(i.SPA_RELOAD,n);const s=()=>{window.removeEventListener(i.SPA_RELOAD,n),window.dispatchEvent(new CustomEvent(t.PAGE_CHANGE)),e()}},gn=async(e,t,i)=>await fetch(`${e}/refresh-exclusions/${t}/${i}/currentExclusions.json`).then((async e=>e.json().then((e=>e)).catch((e=>{L(`unable to extract line items with no refresh: ${e}`)})))).catch((e=>L(`unable to get line items with no refresh: ${e}`)));let pn=(()=>{let e,t,i=[Ci("onAfterConsent")],n=[];return t=class{constructor(){this.name="Collector",this._isLoaded=!1,this._scriptAdded=!1}isLoaded(){return this._isLoaded}async load(){this._isLoaded=!0}async onAfterConsent({config:e}){this._scriptAdded||(setTimeout((()=>{O("Downloading pubstack collector"),D(`https://boot.pbstck.com/v1/tag/${e.tagId}`)}),200),this._scriptAdded=!0)}async clean(){}},yi(t,"CollectorModule"),(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;mi(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),bi(t,n)})(),t})();const vn="[parallax]";class mn{constructor(e){this.id=e.divId;const t=document.getElementById(this.id);if(!t)throw _(`${vn} container not found for adUnit ${this.id}`),new Error(`container not found for adUnit ${this.id}`);const i=e.sizes.filter((e=>"fluid"!==e)).reduce(((e,[,t])=>t>e?t:e),0);this.adUnitContainerMaxHeightPx=Math.max(i,600)/2,this.minViewableHeightPx=Math.min(this.adUnitContainerMaxHeightPx+10,310),this.adUnitContainer=t;const n=this.adUnitContainer.attachShadow({mode:"open"});n.innerHTML=`\n <div id="${mn.PARALLAX_CLIP_ID}"><slot></slot></div>\n `,this.adUnitContainerShadowRoot=n,this.cacheLatestBidWon(),this.observeMutations(),O(`${vn} prepareGoodParallax for adUnit ${this.id}`)}getHighestChildRect(e){const t=e.children;if(0===t.length)return;const i=(e=>e.reduce(((e,t)=>{const i=getComputedStyle(e),n=getComputedStyle(t);return parseInt(n.height)>parseInt(i.height)?t:e}),e[0]))(Array.from(t));return i.getBoundingClientRect()}cacheLatestBidWon(){const e=null===window||void 0===window?void 0:window.kleanadsPbjs;if(e)try{e.onEvent("auctionEnd",(e=>{var t;(null===(t=e.adUnitCodes)||void 0===t?void 0:t.includes(this.id))&&(this.latestBidWonInfo=void 0)})),e.onEvent("bidWon",(t=>{if(t.adUnitCode===this.id){const{bidderCode:i,size:n}=t,s=mn.BLOCKED_BIDDERS.some((t=>{var n;return i===t||(null===(n=null==e?void 0:e.aliasRegistry)||void 0===n?void 0:n[i])===t})),o=mn.BLOCKED_SIZES.some((e=>e===n)),a="banner"===(null==t?void 0:t.mediaType);this.latestBidWonInfo={isParallaxable:a&&!o&&!s}}}))}catch(e){_(`${vn} unable to listen to bidWon event`,e)}else _(`${vn} pbjs not loaded, unable to listen to bidWon event`)}observeMutations(){this.resizeObserver=new ResizeObserver((e=>{const t=e.some((e=>{var t,i;return Array.from(null!==(i=null===(t=e.target.parentElement)||void 0===t?void 0:t.children)&&void 0!==i?i:[]).some((e=>e.getBoundingClientRect().height>this.adUnitContainerMaxHeightPx))}));(this.latestBidWonInfo?this.latestBidWonInfo.isParallaxable&&t:t)?this.renderParallax():this.cleanUp()})),this.mutationObserver=new MutationObserver((e=>{this.mutationDebounceTimeout&&clearTimeout(this.mutationDebounceTimeout),this.mutationDebounceTimeout=setTimeout((()=>{this.mutationDebounceTimeout=void 0,e.flatMap((e=>Array.from(e.addedNodes))).forEach((e=>{var t;e instanceof HTMLElement&&(null===(t=this.resizeObserver)||void 0===t||t.observe(e))})),e.flatMap((e=>Array.from(e.removedNodes))).forEach((e=>{var t;e instanceof HTMLElement&&(null===(t=this.resizeObserver)||void 0===t||t.unobserve(e))}))}),mn.MUTATION_DEBOUNCE_TIMEOUT_VALUE_MS)})),this.mutationObserver.observe(this.adUnitContainer,{childList:!0})}renderParallax(){var e,t,i;this.adUnitContainer.classList.add(mn.PARALLAX_ADUNIT_CONTAINER_CLASS),null===(e=this.adUnitContainerShadowRoot.getElementById(mn.PARALLAX_CLIP_ID))||void 0===e||e.classList.add(mn.PARALLAX_CLIP_ENABLED_CLASS);const n=this.getHighestChildRect(this.adUnitContainer),s=10+(window.innerHeight-(null!==(t=null==n?void 0:n.height)&&void 0!==t?t:0))/2,o=new CSSStyleSheet;o.insertRule(`#${mn.PARALLAX_CLIP_ID}.${mn.PARALLAX_CLIP_ENABLED_CLASS} { height: ${this.minViewableHeightPx}px; width: ${null!==(i=null==n?void 0:n.width)&&void 0!==i?i:0}px; clip-path: rect(0 auto ${this.minViewableHeightPx}px 0); position: relative; margin: 0 auto; } `),o.insertRule(`#${mn.PARALLAX_CLIP_ID}.${mn.PARALLAX_CLIP_ENABLED_CLASS} ::slotted(*) {\n position: fixed;\n top: ${s}px;\n }`),this.adUnitContainerShadowRoot.adoptedStyleSheets=[o]}cleanUp(){var e;this.adUnitContainer.classList.remove(mn.PARALLAX_ADUNIT_CONTAINER_CLASS),null===(e=this.adUnitContainerShadowRoot.getElementById(mn.PARALLAX_CLIP_ID))||void 0===e||e.classList.remove(mn.PARALLAX_CLIP_ENABLED_CLASS)}}mn.MUTATION_DEBOUNCE_TIMEOUT_VALUE_MS=40,mn.PARALLAX_ADUNIT_CONTAINER_CLASS="adm-parallax",mn.PARALLAX_CLIP_ID="adm-parallax-clip",mn.PARALLAX_CLIP_ENABLED_CLASS="adm-parallax-clip-enabled",mn.BLOCKED_BIDDERS=["invibes","seedtag","kargo"],mn.BLOCKED_SIZES=["1x1"];const bn=e=>new mn(e);var yn;class Cn extends HTMLElement{constructor(){super();const e=window.kleanadsPbjs;if(e)try{e.onEvent("bidWon",this.winningBid.bind(this))}catch(e){_("[pbstck-sticky] unable to listen to bidWon event",e)}else _("[pbstck-sticky] pbjs not loaded, unable to listen to bidWon event");this.attachShadow({mode:"open"}),this.mutationObserver=new MutationObserver((e=>{O("[pbstck-sticky] [mutationObs]",e),this.isAddingCreative(e)&&(O("[pbstck-sticky] [mutationObs] add element on nested"),yn.shouldDisplay=!0),this.updateShadowLayout()})),this.addEventListener("close",(()=>{O('[pbstck-sticky] event "close" caught, closing sticky component'),this.close()}))}winningBid(e){e.adUnitCode===this.id&&(O("[pbstck-sticky] [winningBid]",e),O("[pbstck-sticky] [winningBid]",e.bidderCode,e.adUnitCode),yn.biddersNotToDisplay.includes(e.bidderCode)&&(yn.shouldDisplay=!1,this.updateShadowLayout()))}close(){O("[pbstck-sticky] closing sticky component"),this.shadowRoot&&(this.mutationObserver.disconnect(),this.shadowRoot.innerHTML="\n <style>\n :host {\n display: none;\n }\n </style>")}isAddingCreative(e){var t,i,n;return(null===(t=e[0])||void 0===t?void 0:t.addedNodes[0])&&(null===(n=null===(i=e[0])||void 0===i?void 0:i.target.parentElement)||void 0===n?void 0:n.id)===this.id}connectedCallback(){this.isConnected&&(O("[pbstck-sticky] no-ad"),this.setAttribute("data-pbstck-component","no-ad"),this.setShadowDom("<div></div>"),this.updateShadowLayout(),this.mutationObserver.observe(this,{subtree:!0,childList:!0}))}disconnectedCallback(){this.mutationObserver.disconnect()}attributeChangedCallback(){this.updateShadowLayout()}getHighestChild(){const e=Array.from(this.children);if(0!==e.length)return An(e)}setShadowDom(e){this.shadowRoot&&(yn.shouldDisplay?this.shadowRoot.innerHTML=`\n <style> \n :host {\n display: block;\n max-height: ${yn.maxHeight}px;\n overflow: hidden;\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n margin: 0;\n padding: 0;\n z-index: 99999999;\n }\n .sticky-button {\n height: 28px;\n width: 28px;\n background: ${yn.backgroundColor};\n position: absolute;\n bottom: 0;\n right: 0;\n border-radius: 5px 0 0 0;\n box-shadow: rgba(0, 0, 0, 0.2) -2px -2px 3px -1px, rgba(0, 0, 0, 0.1) -1px -1px 2px -1px !important;\n }\n .sticky-button-container {\n height: 30px;\n position: relative;\n }\n .sticky-button-text {\n display: block;\n height: 22px;\n width: 22px;\n padding: 3px;\n }\n .sticky-container {\n background: ${yn.backgroundColor};\n padding: 8px 0;\n box-shadow: rgba(0, 0, 0, 0.2) 0px -1px 5px -1px, rgba(0, 0, 0, 0.1) 0px 1px 2px -1px !important;\n }\n .sticky-container slot > * {\n position: relative;\n }\n ::slotted(*) {\n position: relative;\n }\n .cross {\n display: block;\n }\n .sticky-container slot {\n width: fit-content;\n width: -moz-fit-content;\n block-size: fit-content;\n margin: 0 auto !important;\n display: block;\n }\n }\n </style>\n ${e}`:this.shadowRoot.innerHTML="\n <style>\n :host {\n display: block;\n width: 100%;\n height: 1px;\n background: transparent;\n position: fixed;\n bottom: 0;\n }\n </style><div></div>")}updateShadowLayout(){if(O(`[pbstck-sticky] updating element ${this.id}`),!this.shadowRoot)return;this.setAttribute("data-pbstck-component","sticky");const e=document.createElement("div");e.className="sticky-container";const t=document.createElement("slot");e.append(t),this.setShadowDom(`${e.outerHTML}`);const i=this.getHighestChild();if(i&&yn.shouldDisplay){i.style.display="block",i.style.margin="0 auto",i.style.bottom="0",i.style.maxHeight=`${yn.maxCreativeHeight}px`;const e=document.createElement("div");e.className="sticky-button-container";const t=document.createElement("div");t.className="sticky-button";const n=document.createElement("div");n.className="sticky-button-text",n.addEventListener("click",(()=>{O("[pbstck-sticky] Close button pressed, hiding the sticky adunit"),this.close()}));const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d","M 5.3,18.7 C 5.5,18.9 5.7,19 6,19 6.3,19 6.5,18.9 6.7,18.7 l 5.3,-5.3 5.3,5.3 c 0.2,0.2 0.5,0.3 0.7,0.3 0.2,0 0.5,-0.1 0.7,-0.3 0.4,-0.4 0.4,-1 0,-1.4 L 13.4,12 18.7,6.7 c 0.4,-0.4 0.4,-1 0,-1.4 -0.4,-0.4 -1,-0.4 -1.4,0 L 12,10.6 6.7,5.3 c -0.4,-0.4 -1,-0.4 -1.4,0 -0.4,0.4 -0.4,1 0,1.4 l 5.3,5.3 -5.3,5.3 c -0.4,0.4 -0.4,1 0,1.4 z");const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("class","cross"),o.setAttribute("height","22px"),o.setAttribute("width","22px"),o.setAttribute("fill","#333"),o.append(s),n.append(o),t.append(n),e.append(t),this.shadowRoot.prepend(e)}}}yn=Cn,Cn.backgroundColor="rgb(250, 250, 250)",Cn.maxCreativeHeight=216,Cn.buttonHeight=32,Cn.maxHeight=yn.maxCreativeHeight+yn.buttonHeight,Cn.shouldDisplay=!1,Cn.biddersNotToDisplay=["ogury","missena","seedtag","kargo","gumgum"];const An=e=>e.reduce(((e,t)=>t.offsetHeight>e.offsetHeight?t:e),e[0]);function wn(e){if(e.anchor){const t=e.divId,i=document.getElementById(t);if(O("[pbstck-sticky]",e),"pbstck-sticky"===(null==i?void 0:i.localName))return void O(`[pbstck-sticky] div ${t} already prepared`);const n=document.createElement("pbstck-sticky");n.id=t;const s=`adm-sticky-${t}`;if(i)O(`[pbstck-sticky] div ${t} existing`),i.id=s,i.appendChild(n);else{O(`[pbstck-sticky] div ${t} not existing`);const e=document.createElement("div");e.id=s,e.appendChild(n),document.body.appendChild(e)}}}let Sn=(()=>{let e,t,i=[Ci("onStackConfigLoad")],n=[];return t=class{constructor(){this.name="ContainersModule",this.loaded=!1,this.firstStickyDefined=!1}isLoaded(){return this.loaded}async load(){if("function"==typeof(null===customElements||void 0===customElements?void 0:customElements.define)&&"function"==typeof MutationObserver)try{customElements.define("pbstck-sticky",Cn)}catch(e){L(`[ContainersModule] unable to define custom elements, error "${e}"`)}else _('[ContainersModule] unable to define custom elements, error: "browser not compatible"');this.loaded=!0}async onPrepareAdUnits({config:e,toPreparedAdUnits:t}){for(const i of null!=t?t:[])i.parallax&&bn(i),"mobile"!==e.device&&!i.anchorDesktop||!i.anchor||this.firstStickyDefined||(wn(i),this.firstStickyDefined=!0)}async clean(){}},yi(t,"ContainersModule"),(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;mi(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),bi(t,n)})(),t})();const In="adm-ad-loading",kn="adm-ad-empty",En="adm-ad-rendered",$n="adm-ad-skin",Tn="data-adm-skin",On=["sublime","justpremium","gumgum","dspx"];let Rn=(()=>{let e,t,i=[Ci("onStackConfigLoad")],n=[];return t=class{constructor(){this.name="CssClass",this._isLoaded=!1}async load(){this._isLoaded=!0}async onAfterAdServerReady({adServer:e}){e.renderListener(this.applyClassBySlotRenderEndedEvent)}async onAfterPrebidReady({prebid:e}){O("[CssClassModule] onAfterPrebidReady event received"),e.getPbjs().onEvent("bidWon",this.applyClassByBidWon)}async applyClassBySlotRenderEndedEvent(e){var t;const i=e.divId,n=document.getElementById(i);n&&(e.isEmpty?(n.classList.replace(In,kn),O(`[CSS Class] slot empty: ${i}`)):(n.classList.replace(In,En),n.classList.replace(kn,En),(null===(t=e.size)||void 0===t?void 0:t.length)&&1800===e.size[0]&&1e3===e.size[1]?(n.classList.add($n),n.setAttribute(Tn,"gam"),O(`[CSS Class] slot rendered is skin: ${i}`)):(n.classList.remove($n),n.removeAttribute(Tn)),O(`[CSS Class] slot rendered: ${i}`)))}applyClassByBidWon(e){const t=document.getElementById(e.adUnitCode);"1800x1000"===e.size&&(null==t||t.classList.add($n),null==t||t.setAttribute(Tn,"prebid"),On.includes(e.bidderCode)||null==t||t.classList.add("adm-ad-skin-resizable"),O(`[CSS Class] bidWon is skin: ${e.adUnitCode}`))}async onPrepareAdUnits({toPreparedAdUnits:e}){e&&e.forEach((e=>{const t=document.getElementById(e.divId);t&&t.classList.add(In)}))}isLoaded(){return this._isLoaded}clean(){return this._isLoaded=!1,Promise.resolve(void 0)}},yi(t,"CssClassModule"),(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;mi(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),bi(t,n)})(),t})();let _n=(()=>{let e,t,i=[Ci("onAfterPrepareAdUnits")],n=[];return t=class{constructor(){this.name="XplnModule",this.loaded=!1}async load(){this.loaded=!0}async onStackConfigLoad({config:e,stackConfig:t}){var i,n;if((null===(i=t.xplnConfig)||void 0===i?void 0:i.enabled)&&(null===(n=t.xplnConfig)||void 0===n?void 0:n.publisherId)){const i=t.xplnConfig.publisherId;((e,t)=>{const i=e.document.createElement("script"),n=e.document.createElement("script");i.innerHTML=`(function(x,p,l,n,a,i) {\n a=p.createElement(l);a.async=!0;a.src=n;a.xpln=x;\n i=p.currentScript||p.getElementsByTagName(l)[0];i.parentNode.insertBefore(a,i);\n })({xid:'${t}'},document,'script','https://cdn.xpln.tech/page.js');`,n.innerHTML=`(function(x,p,l,n,a,i) {\n self.xpln_targeting=function(){};\n a=x.createElement(p);a.async=!0;\n a.src=l+'${t}'+'/'+location.hostname+'.js';\n i=x.currentScript||x.getElementsByTagName(p)[0];i.parentNode.insertBefore(a,i);\n })(document,'script','https://cdn.xpln.tech/');`,i.type="text/javascript",n.type="text/javascript",i.setAttribute("data-kleanads","true"),n.setAttribute("data-kleanads","true"),e.document.head.appendChild(i),e.document.head.appendChild(n)})(e.pubstackWindow,i)}}async onAfterPrepareAdUnits({config:e,stackConfig:t}){O("XplnModule declare xpln targeting when ready"),(null==t?void 0:t.xplnConfig)&&Un(e.pubstackWindow)}async clean(){this.loaded=!1}isLoaded(){return this.loaded}},yi(t,"XplnModule"),(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;mi(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),bi(t,n)})(),t})();const Ln=(e,t)=>{if(!(t>15))return e.xpln_targeting&&e.xpln_targeting.toString().length>100?(e.xpln_targeting(),void O("XPLN targeting called")):void setTimeout((()=>Ln(e,t+1)),300);_("Could not declare XPLN targetings, xpln_targeting function is undefined")},Un=e=>{Ln(e,0)};let Pn=(()=>{let e,i,n=[Ci("onStackConfigLoad")],s=[];return i=class{constructor(){this.name="PublicAccessModule",this._isLoaded=!1}isLoaded(){return this._isLoaded}async load({config:e,stackConfig:i}){e.pubstackWindow._pbstckKleanAds.getBootstrapConfig=()=>{const{pubstackWindow:t,...i}=e;return i},e.pubstackWindow._pbstckKleanAds.getStackConfig=()=>i,e.pubstackWindow._pbstckKleanAds.apiReady=!0,window.addEventListener(t.REFRESH_INIT,(t=>{e.pubstackWindow._pbstckKleanAds.stopRefresh=e=>{var i,n;null===(n=null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.stopRefresh)||void 0===n||n.call(i,e)},e.pubstackWindow._pbstckKleanAds.refreshApiReady=!0})),this._isLoaded=!0}async clean({config:e}){e.pubstackWindow._pbstckKleanAds.apiReady=!1,e.pubstackWindow._pbstckKleanAds.getBootstrapConfig=()=>{throw new Error("Not ready yet, wait for apiLoaded.")},e.pubstackWindow._pbstckKleanAds.getStackConfig=()=>{throw new Error("Not ready yet, wait for apiLoaded.")}}},yi(i,"PublicAccessModule"),(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;mi(null,e={value:i},n,{kind:"class",name:i.name,metadata:t},null,s),i=e.value,t&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t}),bi(i,s)})(),i})();let xn=(()=>{let e,t,i=[Ci("onStackConfigLoad")],n=[];var s=t=class{constructor(){this.name="SkinRendering",this._isLoaded=!1,this.eligibleForSkinRendering=!1}isLoaded(){return this._isLoaded}async load({config:e,stackConfig:t}){var i,n,s,o,a,r,d,l,c,u;if(this.eligibleForSkinRendering=function(e,t){var i,n,s,o,a,r,d,l,c;return!!(null===(o=null===(s=null===(n=null===(i=e.pocOverrides)||void 0===i?void 0:i.skinRenderingSettings)||void 0===n?void 0:n.siteLevel)||void 0===s?void 0:s[e.tagId])||void 0===o?void 0:o.enabledSkinRenderAdaptation)&&!(null===(l=null===(d=null===(r=null===(a=e.pocOverrides)||void 0===a?void 0:a.skinRenderingSettings)||void 0===r?void 0:r.stackLevel)||void 0===d?void 0:d[e.stack.stackId])||void 0===l?void 0:l.disableSkinRenderAdaptation)&&(null===(c=t.adUnits)||void 0===c?void 0:c.some((e=>e.sizes.some((e=>K(e,[1800,1e3]))))))}(e,t),this.eligibleForSkinRendering){const{maxHeaderHeightPx:t,marginTopPx:f,siteContentWidthPx:h,additionalSkinRenderingCss:g}=null!==(u=null!==(a=null===(o=null===(s=null===(n=null===(i=e.pocOverrides)||void 0===i?void 0:i.skinRenderingSettings)||void 0===n?void 0:n.stackLevel)||void 0===s?void 0:s[e.stack.stackId])||void 0===o?void 0:o.style)&&void 0!==a?a:null===(c=null===(l=null===(d=null===(r=e.pocOverrides)||void 0===r?void 0:r.skinRenderingSettings)||void 0===d?void 0:d.siteLevel)||void 0===l?void 0:l[e.tagId])||void 0===c?void 0:c.style)&&void 0!==u?u:{};this.configuredMaxHeaderHeightPx=t,this.configuredMarginTopPx=f,this.configuredSiteContentWidthPx=h,this.configuredAdditionalSkinRenderingCss=g,this._isLoaded=!0,O("[Skin] Configuration eligible for skin rendering.")}}async onAfterPrebidReady({prebid:e,config:{pubstackWindow:t}}){this.pbjs=e,this.eligibleForSkinRendering&&(this.onBidWonHandler=this.onBidWon.bind(this),this.pbjs.getPbjs().onEvent("bidWon",this.onBidWonHandler),li((()=>{this.onSlotRenderEndedHandler=this.onSlotRenderEnded.bind(this),t.googletag.pubads().addEventListener("slotRenderEnded",this.onSlotRenderEndedHandler)})))}async clean(){var e;this.onBidWonHandler&&(null===(e=this.pbjs)||void 0===e||e.getPbjs().offEvent("bidWon",this.onBidWonHandler),this.onBidWonHandler=void 0),this.onSlotRenderEndedHandler&&(window.googletag.pubads().removeEventListener("slotRenderEnded",this.onSlotRenderEndedHandler),this.onSlotRenderEndedHandler=void 0),this._isLoaded=!1}onBidWon(e){this.shouldApplyPrebidSkinRendering(e)?this.applySkinCSS(e.adUnitCode,"prebid"):this.removeSkinRendering(e.adUnitCode)}onSlotRenderEnded(e){this.isFromGAM(e)?this.applySkinCSS(e.slot.getSlotElementId(),"gam"):e.size&&!K(e.size,[3,1])&&this.removeSkinRendering(e.slot.getSlotElementId())}removeSkinRendering(e){const t=document.getElementById(e);t&&t.classList.remove(s.SKIN_RENDERING_CSS_CLASS)}shouldApplyPrebidSkinRendering(e){var t;const i=["sublime","justpremium","gumgum"],n=null===(t=this.pbjs)||void 0===t?void 0:t.getPbjs();if(n){const t=i.some((t=>e.bidderCode===t||n.aliasRegistry[e.bidderCode]===t));return"1800x1000"===e.size&&!t}return function(e,...t){h(Zi,e,...t)}("shouldApplyPrebidSkinRendering: unable to get aliasRegistry: prebid is not defined"),!1}isFromGAM(e){var t;return!!(null===(t=e.size)||void 0===t?void 0:t.length)&&1800===e.size[0]&&1e3===e.size[1]}applySkinCSS(e,t){var i,n,o,a;const r=document.getElementById(e);if(r){if("gam"===t)return;O(`[Skin] applying rendering for ${e} from ${t}`);const d=null!==(i=this.configuredMaxHeaderHeightPx)&&void 0!==i?i:250,l=null!==(n=this.configuredMarginTopPx)&&void 0!==n?n:0,c=null!==(o=this.configuredSiteContentWidthPx)&&void 0!==o?o:1e3,u=null!==(a=this.configuredAdditionalSkinRenderingCss)&&void 0!==a?a:"",f=1e3,h=(1800-c)/2,g=h+c,p=document.createElement("style");p.setAttribute("data-kleanads","true"),p.textContent=`\n #${e}.${s.SKIN_RENDERING_CSS_CLASS} {\n /* leave security margin to help display top of creative */\n height: ${d}px;\n /* set it properly in page flow */\n display: block;\n margin-top: ${l}px;\n }\n \n #${e}.${s.SKIN_RENDERING_CSS_CLASS} > div {\n /* horizontally center creative */\n transform: translateX(-50%);\n position: absolute;\n left: 50%;\n \n /* clipping out the unused part of the creative to leave content visible */\n clip-path: polygon(0 0, 0% 100%, ${h}px ${f}px, ${h}px ${d}px, ${g}px ${d}px, ${g}px 100%, 100% 100%, 100% 0%);\n }\n \n ${u}\n `,document.head.appendChild(p),r.classList.add(s.SKIN_RENDERING_CSS_CLASS)}else _(`skin rendering impossible - adUnitDiv not found for ${e}`)}};return yi(t,"SkinRenderingModule"),(()=>{const o="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;mi(null,e={value:t},i,{kind:"class",name:t.name,metadata:o},null,n),s=t=e.value,o&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})})(),t.SKIN_RENDERING_CSS_CLASS="pbstck_skin_rendering",bi(t,n),s=t})();const Nn=[class{constructor(){this.name="Metas",this._isLoaded=!1,this.customFields=[],this.targetings=[]}async load({config:e}){v("kleanads-version",e.kleanadsVersion),this.customFields.push("kleanads-version"),oe.getInstance().uprTested&&(v("xp_variant",`floor_optimization:${oe.getInstance().uprEnabled}`),this.customFields.push("xp_variant")),this._isLoaded=!0}async onStackConfigLoad({stackConfig:e}){var t;if(v("config-version",`${e.version}`),v("kleanads-stack-id",e.stackId),this.customFields.push("config-version","kleanads-stack-id"),function(e,t){const i=document.createElement("meta");i.setAttribute("name",`ad:${e}`),i.content=t,document.head.appendChild(i)}("adm_stack",`${e.stackId}_v${e.version}`),this.targetings.push("adm_stack"),e.runningABTest.length>0){v("adm_ab_test",`poc:${e.runningABTest[0].value}`),this.customFields.push("adm_ab_test")}if(e.runningABTest.forEach((e=>{v(e.name,e.value),this.customFields.push(e.name)})),e.refreshConfig){v("refresh-out-of-focus",`${null===(t=e.refreshConfig)||void 0===t?void 0:t.adUnitConfig.some((e=>!!e.refreshOutOfFocusConfig))}`),this.customFields.push("refresh-out-of-focus")}}isLoaded(){return this._isLoaded}async clean(){this.customFields.forEach((e=>{try{!function(e){const t=document.querySelector(`meta[name="pbstck:${e}"]`);t&&t.remove()}(e)}catch(t){_(`Unable to remove CustomField meta tag ${e}`,t)}})),this.customFields=[],this.targetings.forEach((e=>{try{!function(e){const t=document.querySelector(`meta[name="ad:${e}"]`);t&&t.remove()}(e)}catch(t){_(`Unable to remove targeting meta tag ${e}`,t)}})),this.targetings=[],this._isLoaded=!1}},Ii,Ai,Sn,vi,pn,Xi,xn,Rn,_n,Pn];class jn{static getModules(){return Nn}}async function Dn(e){var t,i,n;if(window._kleanadslock)return void O("kleanads.js already started");window._kleanadslock=!0,Ye(Ve.BEGIN_INIT);const s=async()=>{const t=await rn(e,jn.getModules().map((e=>new e)));t&&await ln(t)};if(null===(t=e.pocOverrides)||void 0===t?void 0:t.waitForEventToInit){const t=setTimeout((()=>{L("Wait for init event is too long")}),6e4),o=()=>{var i;window.removeEventListener((null===(i=e.pocOverrides)||void 0===i?void 0:i.waitForEventToInit)||"",o),clearTimeout(t),s()};O(`[INIT] wait for event ${null===(i=e.pocOverrides)||void 0===i?void 0:i.waitForEventToInit} to start kleanads`),window.addEventListener(null===(n=e.pocOverrides)||void 0===n?void 0:n.waitForEventToInit,o)}else await s()}return window._pbstckKleanAds={initKleanAds:Dn,apiReady:!1,getBootstrapConfig:()=>{throw new Error("Not ready yet, wait for apiReady.")},getStackConfig:()=>{throw new Error("Not ready yet, wait for apiReady.")},refreshApiReady:!1,stopRefresh:()=>{throw new Error("Not ready yet, wait for refreshApiReady.")}},e.initKleanAds=Dn,e}({});