# Statistics Made Easier with STL

rogrammers developing financial, scientific, and numerical analysis applications often need to reinvent the wheel, implementing statistical functions for calculate mean, median, percentiles, and similar statistical data. This solution will show you how to implement some of these operations with a few useful STL algorithms.

How can you implement statistical functions for calculating mean, median, and similar operations?

Use the algorithms defined in the and libraries.

Mean and Lean
The operations required for calculating the average of a range of elements consist of summing up all the values within that range and dividing the result by the number of elements. This task can become unduly complex when you have to deal with various types of ranges and looping through containers in order to accumulate their sum. However, using the right STL algorithms, it’s a cinch.

The first step consists of summing up all the values in a range. For this purpose, use the accumulate() algorithm defined in . This algorithm accumulates all elements within a range into a single value. accumulate() has three overloaded versions, but for the sake of brevity, the first version is used here, with the following prototype:

``template T accumulate (InputIterator first,              InputIterator last,              T init);``

The first two parameters mark the boundaries of the range. The third argument is an initial value that is added to the result. Usually, it’s 0 but under certain conditions, you may need to provide a different initial value.

 Author’s Note: To avoid truncation and rounding problems, use the floating point datatype with the highest precision supported by your compiler?double or long double.

Suppose you have a container that stores students’ grades:

``vector  grades;grades.push_back(89);grades.push_back(74);grades.push_back(89);grades.push_back(63);grades.push_back(100);``

``double res=accumulate(grades.begin(), grades.end(),0);``

Next, calculate the average:

``res=res/grades.size();``

You can accomplish these two operations in one shot:

``double res= accumulate(grades.begin(),grades.end(),0)/double(grades.size());cout<<"the average grade is: "<``

`The grades needn't be stored in a container object; you can apply accumulate() (as well as every other algorithm) and use a built-in array:`

``int grades[]={89, 74, 89, 63, 100};size_t range_size=sizeof(grades)/sizeof(grades[0]); double res= accumulate(grades, grades+range_size, 0)/double(range_size); ``

`MedianA median is the value that splits a range in two halves: half of the values are lower than or equal to the median value, and another half of the values is higher than the median. For example, in the range {60, 70, 89, 95, 100} the median is 89. It's easier to calculate the median when the range is sorted. If you're using a self-sorting container such as priority_queue or the associative containers map, multimap etc., you don't need to worry about sorting. If however the results are stored in a vector, simply call the sort() algorithm first:`

``sort(grades.begin(), grades.end());``

`Next, calculate the median like this:`

``cout<<*(grades.begin()+grades.size()/2); //89``

`If, for some reason, you prefer not to sort the container (for example, if you modify the container frequently), you can use the nth_element() algorithm instead. nth_element() ensures that the nth element in the container contains the value that would be stored in that position if the container were sorted. In addition, this algorithm ensures that all elements prior to the nth position would also precede that position in an ordered collection, and that all elements following the nth position would also follow that position in an ordered collection. However, nth_element() doesn't sort the container:`

``nth_element(grades.begin(),            grades.begin()+grades.size()/2,             grades.end());median=*(grades.begin()+grades.size()/2);``

`Median is a specific case of the 50th percentile. To find the element that is at a different percentile, say the 25th percentile, use the following nth_element() call. For the range 60, 70, 89, 95, 100, the result should be 70 because 25 percent of the elements in the given range are below this value:`

``nth_element(grades.begin(),            grades.begin()+int((grades.size()*0.25),             grades.end());int p_25=*(grades.begin()+int(grades.size()*.25)); cout<``

`Note that some compilers can't interpret the second argument of nth_element() without the explicit conversion to int.`

`PartitionsSometimes you need to divide a range into two parts: all elements that satisfy a certain criterion, followed by all elements that don't. For example, to find out how many grades below 60 the range {20,30, 60,100} contains, use the partition() algorithm. partition() takes two iterators indicating the range's boundaries and a predicate. In this example, the predicate object is called smaller_than_sixty. partition() returns an iterator that is one past the end of the group of elements that satisfy this predicate:`

``for (vector::iterator it=grades.begin();     it < part;     it++){ cout<<*it<<" is smaller than 60"<``

`Without Deviating from the StandardAlthough C++ doesn't have a statistics package, the and libraries contain many useful algorithms that significantly simplify the implementation of such a home-made library, as shown in this solution.`

` `

## `About Our Editorial Process`

`At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.`

`See our full editorial policy.`

## `About Our Journalist`

` EU accuses Elon Musk’s X of violating DSA April Isaacs July 18, 2024 5:42 PM `
` Samsung Galaxy Watch 7 offers minor upgrades April Isaacs July 18, 2024 5:36 PM `
` A call to reform scientific publishing Cameron Wiggins July 18, 2024 5:32 PM `
` Using Consumer Trust to Help Build Brands On Major Social Platforms Rashan Dixon July 18, 2024 3:39 PM `
` Secret Service increases security for Trump Noah Nguyen July 18, 2024 3:31 PM `
` How to Create a Professional Blog for Your Business Using WordPress Kyle Lewis July 18, 2024 3:06 PM `
` Tesla hiring 800 employees after mass layoffs Johannah Lopez July 18, 2024 3:01 PM `
` Cassini data reveals dynamic Titan seas Johannah Lopez July 18, 2024 1:53 PM `
` Perseid meteor shower delights skywatchers worldwide Noah Nguyen July 18, 2024 1:52 PM `
` Anthropic releases Claude AI app for Android Rashan Dixon July 18, 2024 1:11 PM `
` TicWatch Pro 5 Enduro price drops Johannah Lopez July 18, 2024 11:28 AM `
` Australian surfer saved by smartwatch call Johannah Lopez July 18, 2024 8:53 AM `
` Elon Musk relocates SpaceX and X headquarters Noah Nguyen July 18, 2024 8:20 AM `
` CMA investigates Microsoft’s hire of Inflection AI staff Johannah Lopez July 18, 2024 7:27 AM `
` Experts discuss AI’s impact on cybersecurity April Isaacs July 17, 2024 5:55 PM `
` Taliban urges Imams to combat climate change Noah Nguyen July 17, 2024 5:52 PM `
` Climate change’s economic impact is growing Noah Nguyen July 17, 2024 5:50 PM `
` Air pollution severely affects beneficial insects Rashan Dixon July 17, 2024 5:25 PM `
` NIST releases first quantum-resistant encryption algorithms Noah Nguyen July 17, 2024 3:57 PM `
` Musk plans human colony on Mars Rashan Dixon July 17, 2024 3:48 PM `
` Wilmington’s nCino named top fintech company Johannah Lopez July 17, 2024 3:38 PM `
` New study reveals sex, gender brain differences April Isaacs July 17, 2024 3:27 PM `
` AI-generated jokes funnier than human-created ones Cameron Wiggins July 17, 2024 3:15 PM `
` Neuralink prepares for second human trial Cameron Wiggins July 17, 2024 3:05 PM `
` New Jersey experiences rapid temperature increase April Isaacs July 17, 2024 1:04 PM `
` Show More `
` `
``` 'use strict';(function(){function v(c,a){function b(){this.constructor=c}if("function"!==typeof a&&null!==a)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");N(c,a);c.prototype=null===a?Object.create(a):(b.prototype=a.prototype,new b)}function S(c,a){var b={},d;for(d in c)Object.prototype.hasOwnProperty.call(c,d)&&0>a.indexOf(d)&&(b[d]=c[d]);if(null!=c&&"function"===typeof Object.getOwnPropertySymbols){var e=0;for(d=Object.getOwnPropertySymbols(c);e<d.length;e++)0>a.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(c,d[e])&&(b[d[e]]=c[d[e]])}return b}function I(c,a,b,d){var e=arguments.length,f=3>e?a:null===d?d=Object.getOwnPropertyDescriptor(a,b):d,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(c,a,b,d);else for(var h=c.length-1;0<=h;h--)if(g=c[h])f=(3>e?g(f):3<e?g(a,b,f):g(a,b))||f;return 3<e&&f&&Object.defineProperty(a,b,f),f}function B(c,a){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(c,a)}function L(c){var a="function"===typeof Symbol&&Symbol.iterator,b=a&&c[a],d=0;if(b)return b.call(c);if(c&&"number"===typeof c.length)return{next:function(){c&&d>=c.length&&(c=void 0);return{value:c&&c[d++],done:!c}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.");}function r(c,a){var b="function"===typeof Symbol&&c[Symbol.iterator];if(!b)return c;c=b.call(c);var d,e=[];try{for(;(void 0===a||0<a--)&&!(d=c.next()).done;)e.push(d.value)}catch(g){var f={error:g}}finally{try{d&&!d.done&&(b=c["return"])&&b.call(c)}finally{if(f)throw f.error;}}return e}function w(c,a,b){if(b||2===arguments.length)for(var d=0,e=a.length,f;d<e;d++)!f&&d in a||(f||(f=Array.prototype.slice.call(a,0,d)),f[d]=a[d]);return c.concat(f||Array.prototype.slice.call(a))}function T(c,a){void 0===a&&(a={});a=a.insertAt;if(c&&"undefined"!==typeof document){var b=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.type="text/css";"top"===a?b.firstChild?b.insertBefore(d,b.firstChild):b.appendChild(d):b.appendChild(d);d.styleSheet?d.styleSheet.cssText=c:d.appendChild(document.createTextNode(c))}}window.adthriveCLS.buildDate="2024-07-18";var N=function(c,a){N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,d){b.__proto__=d}||function(b,d){for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(b[e]=d[e])};return N(c,a)},y=function(){y=Object.assign||function(c){for(var a,b=1,d=arguments.length;b<d;b++){a=arguments[b];for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&(c[e]=a[e])}return c};return y.apply(this,arguments)};"function"===typeof SuppressedError?SuppressedError:function(c,a,b){b=Error(b);return b.name="SuppressedError",b.error=c,b.suppressed=a,b};var z=function(c){var a={};return function(){for(var b=[],d=0;d<arguments.length;d++)b[d]=arguments[d];d=JSON.stringify(b);if(a[d])return a[d];b=c.apply(this,b);return a[d]=b}},q=new(function(){function c(){}c.prototype.info=function(a,b){for(var d=[],e=2;e<arguments.length;e++)d[e-2]=arguments[e];this.call.apply(this,w([console.info,a,b],r(d),!1))};c.prototype.warn=function(a,b){for(var d=[],e=2;e<arguments.length;e++)d[e-2]=arguments[e];this.call.apply(this,w([console.warn,a,b],r(d),!1))};c.prototype.error=function(a,b){for(var d=[],e=2;e<arguments.length;e++)d[e-2]=arguments[e];this.call.apply(this,w([console.error,a,b],r(d),!1));this.sendErrorLogToCommandQueue.apply(this,w([a,b],r(d),!1))};c.prototype.event=function(a,b){for(var d,e=2;e<arguments.length;e++);"debug"===(null===(d=window.adthriveCLS)||void 0===d?void 0:d.bucket)&&this.info(a,b)};c.prototype.sendErrorLogToCommandQueue=function(a,b){for(var d=[],e=2;e<arguments.length;e++)d[e-2]=arguments[e];window.adthrive=window.adthrive||{};window.adthrive.cmd=window.adthrive.cmd||[];window.adthrive.cmd.push(function(){void 0!==window.adthrive.logError&&"function"===typeof window.adthrive.logError&&window.adthrive.logError(a,b,d)})};c.prototype.call=function(a,b,d){for(var e=[],f=3;f<arguments.length;f++)e[f-3]=arguments[f];f=["%c".concat(b,"::").concat(d," ")];var g=["color: #999; font-weight: bold;"];0<e.length&&"string"===typeof e[0]&&f.push(e.shift());g.push.apply(g,w([],r(e),!1));try{Function.prototype.apply.call(a,console,w([f.join("")],r(g),!1))}catch(h){console.error(h)}};return c}()),u=function(c,a){return null==c||c!==c?a:c},oa=function(c){var a=c.clientWidth;getComputedStyle&&(c=getComputedStyle(c,null),a-=parseFloat(c.paddingLeft||"0")+parseFloat(c.paddingRight||"0"));return a},pa=function(c){var a=c.offsetHeight,b=c.offsetWidth,d=c.getBoundingClientRect(),e=document.body,f=document.documentElement;c=Math.round(d.top+(window.pageYOffset||f.scrollTop||e.scrollTop)-(f.clientTop||e.clientTop||0));d=Math.round(d.left+(window.pageXOffset||f.scrollLeft||e.scrollLeft)-(f.clientLeft||e.clientLeft||0));return{top:c,left:d,bottom:c+a,right:d+b,width:b,height:a}},qa=function(c){void 0===c&&(c=window.location.search);var a=0===c.indexOf("?")?1:0;return c.slice(a).split("&").reduce(function(b,d){d=r(d.split("="),2);b.set(d[0],d[1]);return b},new Map)},ra=function(c){var a={},b=qa().get(c);if(b)try{var d=decodeURIComponent(b).replace(/\+/g,"");a=JSON.parse(d);q.event("ExperimentOverridesUtil","getExperimentOverrides",c,a)}catch(e){}return a},sa=z(function(c){void 0===c&&(c=navigator.userAgent);return/Windows NT|Macintosh/i.test(c)}),E=z(function(){var c=navigator.userAgent,a=/Tablet|iPad|Playbook|Nook|webOS|Kindle|Android (?!.*Mobile).*Safari|CrOS/i.test(c);return/Mobi|iP(hone|od)|Opera Mini/i.test(c)&&!a}),ta=function(c){void 0===c&&(c=document);return(c===document?document.body:c).getBoundingClientRect().top},ua=function(c){return c.includes(",")?c.split(","):[c]},va=function(c){void 0===c&&(c=document);c=c.querySelectorAll("article");return 0===c.length?null:(c=Array.from(c).reduce(function(a,b){return b.offsetHeight>a.offsetHeight?b:a}))&&c.offsetHeight>1.5*window.innerHeight?c:null},wa=function(c,a,b){void 0===b&&(b=document);var d=va(b),e=d?[d]:[],f=[];c.forEach(function(h){var k=Array.from(b.querySelectorAll(h.elementSelector)).slice(0,h.skip);ua(h.elementSelector).forEach(function(l){var p=b.querySelectorAll(l);l=function(t){var n=p[t];if(a.map.some(function(x){return x.el.isEqualNode(n)}))return"continue";(t=n&&n.parentElement)&&t!==document.body?e.push(t):e.push(n);-1===k.indexOf(n)&&f.push({dynamicAd:h,element:n})};for(var m=0;m<p.length;m++)l(m)})});var g=ta(b);c=f.sort(function(h,k){return h.element.getBoundingClientRect().top-g-(k.element.getBoundingClientRect().top-g)});return[e,c]},xa=function(c,a,b){void 0===b&&(b=document);a=r(wa(c,a,b),2);c=a[0];a=a[1];if(0===c.length)throw Error("No Main Content Elements Found");return[Array.from(c).reduce(function(d,e){return e.offsetHeight>d.offsetHeight?e:d})||document.body,a]},M=new(function(){function c(){var a=this;this.name="StorageHandler";this.disable=!1;this.removeLocalStorageValue=function(b){window.localStorage.removeItem("adthrive_".concat(b.toLowerCase()))};this.getLocalStorageValue=function(b,d,e,f,g){void 0===d&&(d=!0);void 0===e&&(e=!0);if(a.disable)return null;try{var h=window.localStorage.getItem("".concat(d?"adthrive_":"").concat(e?b.toLowerCase():b));if(h){var k=JSON.parse(h),l=void 0!==f&&Date.now()-k.created>=f;if(k&&!l)return g&&a.setLocalStorageValue(b,k.value,d),k.value}}catch(p){}return null};this.setLocalStorageValue=function(b,d,e){void 0===e&&(e=!0);try{e=e?"adthrive_":"";var f={value:d,created:Date.now()};window.localStorage.setItem("".concat(e).concat(b.toLowerCase()),JSON.stringify(f))}catch(g){}};this.isValidABGroupLocalStorageValue=function(b){return void 0!==b&&null!==b&&!("number"===typeof b&&isNaN(b))};this.getOrSetLocalStorageValue=function(b,d,e,f,g,h,k){void 0===f&&(f=!0);void 0===g&&(g=!0);void 0===k&&(k=!0);e=a.getLocalStorageValue(b,k,f,e,g);if(null!==e)return e;d=d();a.setLocalStorageValue(b,d,k);h&&h(d);return d};this.getOrSetABGroupLocalStorageValue=function(b,d,e,f,g){var h;void 0===f&&(f=!0);e=a.getLocalStorageValue("abgroup",!0,!0,e,f);if(null!==e&&(f=e[b],a.isValidABGroupLocalStorageValue(f)))return f;d=d();b=y(y({},e),(h={},h[b]=d,h));a.setLocalStorageValue("abgroup",b);g&&g();return d}}c.prototype.init=function(){};return c}()),D;(function(c){c.amznbid="amznbid";c.amzniid="amzniid";c.amznp="amznp";c.amznsz="amznsz"})(D||(D={}));var U;(function(c){c.ThirtyThreeAcross="33across";c.Adform="adform";c.Aidem="aidem";c.AidemServer="aidem_ss";c.AppNexus="appnexus";c.AmazonTAM="amazon";c.AmazonUAM="AmazonUAM";c.AmazonASR="AmazonASR";c.Colossus="colossus";c.ColossusServer="col_ss";c.Conversant="conversant";c.Concert="concert";c.Criteo="criteo";c.GumGum="gumgum";c.ImproveDigital="improvedigital";c.ImproveDigitalServer="improve_ss";c.IndexExchange="ix";c.Kargo="kargo";c.KargoServer="krgo_ss";c.MediaGrid="grid";c.MediaGridVideo="gridvid";c.Nativo="nativo";c.OpenX="openx";c.Ogury="ogury";c.OpenXServer="opnx_ss";c.Ozone="ozone";c.Pubmatic="pubmatic";c.PubmaticServer="pubm_ss";c.ResetDigital="resetdigital";c.Rtbhouse="rtbhouse";c.Rubicon="rubicon";c.RubiconServer="rubi_ss";c.Sharethrough="sharethrough";c.Teads="teads";c.Triplelift="triplelift";c.TripleliftServer="tripl_ss";c.TTD="ttd";c.Undertone="undertone";c.UndertoneServer="under_ss";c.Unruly="unruly";c.YahooSSP="yahoossp";c.YahooSSPServer="yah_ss";c.Verizon="verizon";c.Yieldmo="yieldmo"})(U||(U={}));var V;(function(c){c.Prebid="prebid";c.GAM="gam";c.Amazon="amazon";c.Marmalade="marmalade";c.Floors="floors";c.CMP="cmp";c.Optable="optable"})(V||(V={}));var W;(function(c){c.cm="cm";c.fbrap="fbrap";c.rapml="rapml"})(W||(W={}));var X;(function(c){c.lazy="lazy";c.raptive="raptive";c.refresh="refresh";c.session="session";c.crossDomain="crossdomain";c.highSequence="highsequence";c.lazyBidPool="lazyBidPool"})(X||(X={}));var Y;(function(c){c.lazy="l";c.raptive="rapml";c.refresh="r";c.session="s";c.crossdomain="c";c.highsequence="hs";c.lazyBidPool="lbp"})(Y||(Y={}));var Z;(function(c){c.Version="Version";c.SharingNotice="SharingNotice";c.SaleOptOutNotice="SaleOptOutNotice";c.SharingOptOutNotice="SharingOptOutNotice";c.TargetedAdvertisingOptOutNotice="TargetedAdvertisingOptOutNotice";c.SensitiveDataProcessingOptOutNotice="SensitiveDataProcessingOptOutNotice";c.SensitiveDataLimitUseNotice="SensitiveDataLimitUseNotice";c.SaleOptOut="SaleOptOut";c.SharingOptOut="SharingOptOut";c.TargetedAdvertisingOptOut="TargetedAdvertisingOptOut";c.SensitiveDataProcessing="SensitiveDataProcessing";c.KnownChildSensitiveDataConsents="KnownChildSensitiveDataConsents";c.PersonalDataConsents="PersonalDataConsents";c.MspaCoveredTransaction="MspaCoveredTransaction";c.MspaOptOutOptionMode="MspaOptOutOptionMode";c.MspaServiceProviderMode="MspaServiceProviderMode";c.SubSectionType="SubsectionType";c.Gpc="Gpc"})(Z||(Z={}));var aa;(function(c){c[c.NA=0]="NA";c[c.OptedOut=1]="OptedOut";c[c.OptedIn=2]="OptedIn"})(aa||(aa={}));var C;(function(c){c.AdDensity="addensity";c.AdLayout="adlayout";c.FooterCloseButton="footerclose";c.Interstitial="interstitial";c.RemoveVideoTitleWrapper="removevideotitlewrapper";c.StickyOutstream="stickyoutstream";c.StickyOutstreamOnStickyPlayer="sospp";c.VideoAdvancePlaylistRelatedPlayer="videoadvanceplaylistrp";c.MobileStickyPlayerPosition="mspp"})(C||(C={}));var J;(function(c){c.Desktop="desktop";c.Mobile="mobile"})(J||(J={}));var G;(function(c){c.Video_Collapse_Autoplay_SoundOff="Video_Collapse_Autoplay_SoundOff";c.Video_Individual_Autoplay_SOff="Video_Individual_Autoplay_SOff";c.Video_Coll_SOff_Smartphone="Video_Coll_SOff_Smartphone";c.Video_In_Post_ClicktoPlay_SoundOn="Video_In-Post_ClicktoPlay_SoundOn"})(G||(G={}));var ba;(ba||(ba={})).None="none";var ca;(function(c){c.Default="default";c.AZ_Animals="5daf495ed42c8605cfc74b0b";c.Natashas_Kitchen="55bccc97303edab84afd77e2";c.RecipeTin_Eats="55cb7e3b4bc841bd0c4ea577";c.Sallys_Baking_Recipes="566aefa94856897050ee7303";c.Spend_With_Pennies="541917f5a90318f9194874cf"})(ca||(ca={}));var ya=function(c,a){var b=c.adDensityEnabled;c=c.adDensityLayout.pageOverrides.find(function(d){return!!document.querySelector(d.pageSelector)&&(d[a].onePerViewport||"number"===typeof d[a].adDensity)});return b?!c:!0},da=function(c){try{return{valid:!0,elements:document.querySelectorAll(c)}}catch(a){return y({valid:!1},a)}},ea=function(c){return""===c?{valid:!0}:da(c)},za=function(c){var a=c.reduce(function(b,d){return d.weight?d.weight+b:b},0);return 0<c.length&&c.every(function(b){var d=b.value;b=b.weight;return!(void 0===d||null===d||"number"===typeof d&&isNaN(d)||!b)})&&100===a},Aa=["siteId","siteName","adOptions","breakpoints","adUnits"];z=function(){function c(){this._timeOrigin=0}c.prototype.resetTimeOrigin=function(){this._timeOrigin=window.performance.now()};c.prototype.now=function(){try{return Math.round(window.performance.now()-this._timeOrigin)}catch(a){return 0}};return c}();window.adthrive.windowPerformance=window.adthrive.windowPerformance||new z;z=window.adthrive.windowPerformance;var O=z.now.bind(z),Ba=function(c){function a(b){var d=c.call(this)||this;d._featureRollouts=b.enabled?b.siteAds.featureRollouts||{}:{};return d}v(a,c);return a}(function(){function c(){this._featureRollouts={}}Object.defineProperty(c.prototype,"siteFeatureRollouts",{get:function(){return this._featureRollouts},enumerable:!1,configurable:!0});c.prototype.isRolloutEnabled=function(a){return this._featureRollouts&&this._featureRollouts[a]?this._featureRollouts[a].enabled:!1};c.prototype.getSiteRolloutConfig=function(a){var b;return this.isRolloutEnabled(a)?null!==(b=this._featureRollouts[a].data)&&void 0!==b?b:{}:{}};return c}()),fa=function(){function c(){this._clsGlobalData=window.adthriveCLS}Object.defineProperty(c.prototype,"enabled",{get:function(){var a;if(a=!!this._clsGlobalData&&!!this._clsGlobalData.siteAds)a:{a=this._clsGlobalData.siteAds;var b=void 0;void 0===b&&(b=Aa);if(a){for(var d=0;d<b.length;d++)if(!a[b[d]]){a=!1;break a}a=!0}else a=!1}return a},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"error",{get:function(){return!(!this._clsGlobalData||!this._clsGlobalData.error)},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"siteAds",{get:function(){return this._clsGlobalData.siteAds},set:function(a){this._clsGlobalData.siteAds=a},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"disableAds",{get:function(){return this._clsGlobalData.disableAds},set:function(a){this._clsGlobalData.disableAds=a},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"enabledLocations",{get:function(){return this._clsGlobalData.enabledLocations},set:function(a){this._clsGlobalData.enabledLocations=a},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"injectedFromPlugin",{get:function(){return this._clsGlobalData.injectedFromPlugin},set:function(a){this._clsGlobalData.injectedFromPlugin=a},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"injectedFromSiteAds",{get:function(){return this._clsGlobalData.injectedFromSiteAds},set:function(a){this._clsGlobalData.injectedFromSiteAds=a},enumerable:!1,configurable:!0});c.prototype.overwriteInjectedSlots=function(a){this._clsGlobalData.injectedSlots=a};c.prototype.setInjectedSlots=function(a){this._clsGlobalData.injectedSlots=this._clsGlobalData.injectedSlots||[];this._clsGlobalData.injectedSlots.push(a)};Object.defineProperty(c.prototype,"injectedSlots",{get:function(){return this._clsGlobalData.injectedSlots},enumerable:!1,configurable:!0});c.prototype.setInjectedVideoSlots=function(a){this._clsGlobalData.injectedVideoSlots=this._clsGlobalData.injectedVideoSlots||[];this._clsGlobalData.injectedVideoSlots.push(a)};Object.defineProperty(c.prototype,"injectedVideoSlots",{get:function(){return this._clsGlobalData.injectedVideoSlots},enumerable:!1,configurable:!0});c.prototype.setInjectedScripts=function(a){this._clsGlobalData.injectedScripts=this._clsGlobalData.injectedScripts||[];this._clsGlobalData.injectedScripts.push(a)};Object.defineProperty(c.prototype,"getInjectedScripts",{get:function(){return this._clsGlobalData.injectedScripts},enumerable:!1,configurable:!0});c.prototype.setExperiment=function(a,b,d){void 0===d&&(d=!1);this._clsGlobalData.experiments=this._clsGlobalData.experiments||{};this._clsGlobalData.siteExperiments=this._clsGlobalData.siteExperiments||{};(d?this._clsGlobalData.siteExperiments:this._clsGlobalData.experiments)[a]=b};c.prototype.getExperiment=function(a,b){void 0===b&&(b=!1);return(b=b?this._clsGlobalData.siteExperiments:this._clsGlobalData.experiments)&&b[a]};c.prototype.setWeightedChoiceExperiment=function(a,b,d){void 0===d&&(d=!1);this._clsGlobalData.experimentsWeightedChoice=this._clsGlobalData.experimentsWeightedChoice||{};this._clsGlobalData.siteExperimentsWeightedChoice=this._clsGlobalData.siteExperimentsWeightedChoice||{};(d?this._clsGlobalData.siteExperimentsWeightedChoice:this._clsGlobalData.experimentsWeightedChoice)[a]=b};c.prototype.getWeightedChoiceExperiment=function(a,b){var d,e;void 0===b&&(b=!1);return(b=b?null===(d=this._clsGlobalData)||void 0===d?void 0:d.siteExperimentsWeightedChoice:null===(e=this._clsGlobalData)||void 0===e?void 0:e.experimentsWeightedChoice)&&b[a]};Object.defineProperty(c.prototype,"branch",{get:function(){return this._clsGlobalData.branch},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"bucket",{get:function(){return this._clsGlobalData.bucket},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"videoDisabledFromPlugin",{get:function(){return this._clsGlobalData.videoDisabledFromPlugin},set:function(a){this._clsGlobalData.videoDisabledFromPlugin=a},enumerable:!1,configurable:!0});Object.defineProperty(c.prototype,"targetDensityLog",{get:function(){return this._clsGlobalData.targetDensityLog},set:function(a){this._clsGlobalData.targetDensityLog=a},enumerable:!1,configurable:!0});c.prototype.shouldHalveIOSDensity=function(){var a=new Ba(this),b=void 0;void 0===b&&(b=navigator.userAgent);return/iP(hone|od|ad)/i.test(b)&&a.isRolloutEnabled("iOS-Resolution")};c.prototype.getTargetDensity=function(a){return this.shouldHalveIOSDensity()?a/2:a};Object.defineProperty(c.prototype,"removeVideoTitleWrapper",{get:function(){return this._clsGlobalData.siteAds.adOptions.removeVideoTitleWrapper},enumerable:!1,configurable:!0});return c}(),Ca=function(){function c(){}c.getScrollTop=function(){return(window.pageYOffset||document.documentElement.scrollTop)-(document.documentElement.clientTop||0)};c.getScrollBottom=function(){return this.getScrollTop()+(document.documentElement.clientHeight||0)};c.shufflePlaylist=function(a){for(var b=a.length,d,e;0!==b;)e=Math.floor(Math.random()*a.length),--b,d=a[b],a[b]=a[e],a[e]=d;return a};c.isMobileLandscape=function(){return window.matchMedia("(orientation: landscape) and (max-height: 480px)").matches};c.playerViewable=function(a){a=a.getBoundingClientRect();return this.isMobileLandscape()?window.innerHeight>a.top+a.height/2&&0<a.top+a.height/2:window.innerHeight>a.top+a.height/2};c.createQueryString=function(a){return Object.keys(a).map(function(b){return"".concat(b,"=").concat(a[b])}).join("&")};c.createEncodedQueryString=function(a){return Object.keys(a).map(function(b){return"".concat(b,"=").concat(encodeURIComponent(a[b]))}).join("&")};c.setMobileLocation=function(a){a=a||"bottom-right";"top-left"===a?a="adthrive-collapse-top-left":"top-right"===a?a="adthrive-collapse-top-right":"bottom-left"===a?a="adthrive-collapse-bottom-left":"bottom-right"===a?a="adthrive-collapse-bottom-right":"top-center"===a&&(a=E()?"adthrive-collapse-top-center":"adthrive-collapse-bottom-right");return a};c.addMaxResolutionQueryParam=function(a){var b=E()?"320":"1280";b="max_resolution=".concat(b);var d=r(String(a).split("?"),2);a=d[0];b=(d=d[1])?d+"&".concat(b):b;return"".concat(a,"?").concat(b)};return c}(),Da=function(){return function(c){this._clsOptions=c;this.removeVideoTitleWrapper=u(this._clsOptions.siteAds.adOptions.removeVideoTitleWrapper,!1);c=this._clsOptions.siteAds.videoPlayers;this.footerSelector=u(c&&c.footerSelector,"");this.players=u(c&&c.players.map(function(a){a.mobileLocation=Ca.setMobileLocation(a.mobileLocation);return a}),[]);this.relatedSettings=c&&c.contextual}}(),Ea=function(){return function(c){this.relatedPlayerAdded=this.playlistPlayerAdded=this.mobileStickyPlayerOnPage=!1;this.footerSelector="";this.removeVideoTitleWrapper=!1;this.videoAdOptions=new Da(c);this.players=this.videoAdOptions.players;this.relatedSettings=this.videoAdOptions.relatedSettings;this.removeVideoTitleWrapper=this.videoAdOptions.removeVideoTitleWrapper;this.footerSelector=this.videoAdOptions.footerSelector}}();D=function(){return function(){}}();var H=function(c){function a(b){var d=c.call(this)||this;d._probability=b;return d}v(a,c);a.prototype.get=function(){if(0>this._probability||1<this._probability)throw Error("Invalid probability: ".concat(this._probability));return Math.random()<this._probability};return a}(D);z=function(){function c(){this._clsOptions=new fa;this.shouldUseCoreExperimentsConfig=!1}c.prototype.setExperimentKey=function(a){void 0===a&&(a=!1);this._clsOptions.setExperiment(this.abgroup,this.result,a)};return c}();var Fa=function(c){function a(){var b=c.call(this)||this;b._result=!1;b._choices=[{choice:!0},{choice:!1}];b.key="RemoveLargeSize";b.abgroup="smhd100";b._result=b.run();b.setExperimentKey();return b}v(a,c);Object.defineProperty(a.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});a.prototype.run=function(){return(new H(.1)).get()};return a}(z),ha=function(c,a,b,d,e,f){c=Math.round(f-e);a=[];e=[];a.push("(",b.map(function(){return"%o"}).join(", "),")");e.push.apply(e,w([],r(b),!1));void 0!==d&&(a.push(" => %o"),e.push(d));a.push(" %c(".concat(c,"ms)"));e.push("color: #999;")},ia=function(c,a,b){var d=void 0!==b.get?b.get:b.value;return function(){for(var e=[],f=0;f<arguments.length;f++)e[f]=arguments[f];try{var g=O(),h=d.apply(this,e);if(h instanceof Promise)return h.then(function(l){var p=O();ha(c,a,e,l,g,p);return Promise.resolve(l)}).catch(function(l){l.logged||(q.error(c,a,l),l.logged=!0);throw l;});var k=O();ha(c,a,e,h,g,k);return h}catch(l){throw l.logged||(q.error(c,a,l),l.logged=!0),l;}}},P=function(c,a){void 0===a&&(a=!1);return function(b){var d,e=Object.getOwnPropertyNames(b.prototype).filter(function(m){return a||0!==m.indexOf("_")}).map(function(m){return[m,Object.getOwnPropertyDescriptor(b.prototype,m)]});try{for(var f=L(e),g=f.next();!g.done;g=f.next()){var h=r(g.value,2),k=h[0],l=h[1];void 0!==l&&"function"===typeof l.value?b.prototype[k]=ia(c,k,l):void 0!==l&&void 0!==l.get&&"function"===typeof l.get&&Object.defineProperty(b.prototype,k,y(y({},l),{get:ia(c,k,l)}))}}catch(m){var p={error:m}}finally{try{g&&!g.done&&(d=f.return)&&d.call(f)}finally{if(p)throw p.error;}}}},Ga=function(c){function a(b){var d=c.call(this)||this;d._result=!1;d.key="ParallaxAdsExperiment";d.abgroup="parallax";d._choices=[{choice:!0},{choice:!1}];d.weight=.5;E()&&b.largeFormatsMobile&&(d._result=d.run(),d.setExperimentKey());return d}v(a,c);Object.defineProperty(a.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});a.prototype.run=function(){return(new H(this.weight)).get()};return a=I([P("ParallaxAdsExperiment"),B("design:paramtypes",[Object])],a)}(z),Ha=function(c){function a(){var b=c.call(this)||this;b._result=!1;b._choices=[{choice:!0},{choice:!1}];b.key="mrsf";b.abgroup="mrsf";E()&&(b._result=b.run(),b.setExperimentKey());return b}v(a,c);Object.defineProperty(a.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});a.prototype.run=function(){return(new H(1)).get()};return a}(z),Ia=[[728,90],[300,250],[300,600],[320,50],[970,250],[160,600],[300,1050],[336,280],[970,90],[300,50],[320,100],[468,60],[250,250],[120,240],[1,1],[300,300],[552,334],[300,420],[728,250],[320,300],[300,390]],Ja=[[300,600],[160,600]],Ka=new Map([["Footer",1],["Header",2],["Sidebar",3],["Content",4],["Recipe",5],["Sidebar_sticky",6],["Below Post",7]]),La=function(c){return Ia.filter(function(a){a=r(a,2);var b=a[0],d=a[1];return c.some(function(e){e=r(e,2);var f=e[1];return b===e[0]&&d===f})})},Ma=function(c,a,b,d,e){a=r(a,2);var f=a[0],g=a[1],h=c.location;a=c.sequence;return"Footer"===h?!("phone"===b&&320===f&&100===g):"Header"===h?!(100<g&&d.result):"Recipe"===h?!(e.result&&"phone"===b&&(300===f&&390===g||320===f&&300===g)):"Sidebar"===h?(b=c.adSizes.some(function(k){return 300>=r(k,2)[1]}),(d=300<g)&&!b?!0:9===a?!0:a&&5>=a?d?c.sticky:!0:!d):!0},Na=function(c,a){var b=c.location;c=c.sticky;if("Recipe"===b&&a){var d=a.recipeMobile;a=a.recipeDesktop;if(E()&&(null===d||void 0===d?0:d.enabled)||!E()&&(null===a||void 0===a?0:a.enabled))return!0}return"Footer"===b||c},Oa=function(c,a){var b=a.adUnits,d=a.adTypes?(new Ga(a.adTypes)).result:!1,e=new Fa,f=new Ha;return b.filter(function(g){return void 0!==g.dynamic&&g.dynamic.enabled}).map(function(g){var h=g.location.replace(/\s+/g,"_"),k="Sidebar"===h?0:2;return{auctionPriority:Ka.get(h)||8,location:h,sequence:u(g.sequence,1),sizes:La(g.adSizes).filter(function(l){return Ma(g,l,c,e,f)}).concat(d&&"Content"===g.location?Ja:[]),devices:g.devices,pageSelector:u(g.dynamic.pageSelector,"").trim(),elementSelector:u(g.dynamic.elementSelector,"").trim(),position:u(g.dynamic.position,"beforebegin"),max:Math.floor(u(g.dynamic.max,0)),spacing:u(g.dynamic.spacing,0),skip:Math.floor(u(g.dynamic.skip,0)),every:Math.max(Math.floor(u(g.dynamic.every,1)),1),classNames:g.dynamic.classNames||[],sticky:Na(g,a.adOptions.stickyContainerConfig),stickyOverlapSelector:u(g.stickyOverlapSelector,"").trim(),autosize:g.autosize,special:u(g.targeting,[]).filter(function(l){return"special"===l.key}).reduce(function(l,p){return l.concat.apply(l,w([],r(p.value),!1))},[]),lazy:u(g.dynamic.lazy,!1),lazyMax:u(g.dynamic.lazyMax,k),lazyMaxDefaulted:0===g.dynamic.lazyMax?!1:!g.dynamic.lazyMax,name:g.name}})},ja=function(c,a){var b=oa(a),d=c.sticky&&"Sidebar"===c.location;return c.sizes.filter(function(e){var f=d?e[1]<=window.innerHeight-100:!0;return(c.autosize?e[0]<=b||320>=e[0]:!0)&&f})},Pa=function(){return function(c){this.clsOptions=c;this.enabledLocations=["Below_Post","Content","Recipe","Sidebar"]}}(),Qa=function(c){var a=document.body;c="adthrive-device-".concat(c);if(!a.classList.contains(c))try{a.classList.add(c)}catch(b){q.error("BodyDeviceClassComponent","init",{message:b.message}),a="classList"in document.createElement("_"),q.error("BodyDeviceClassComponent","init.support",{support:a})}},Q=function(c){return"adthrive-".concat(c.location.replace("_","-").toLowerCase())},ka=function(c){return"".concat(Q(c),"-").concat(c.sequence)},Ra=function(c){return T('\n .adthrive-device-phone .adthrive-sticky-content {\n height: 450px !important;\n margin-bottom: 100px !important;\n }\n .adthrive-content.adthrive-sticky {\n position: -webkit-sticky;\n position: sticky !important;\n top: 42px !important;\n margin-top: 42px !important;\n }\n .adthrive-content.adthrive-sticky:after {\n content: "\u2014 Advertisement. Scroll down to continue. \u2014";\n font-size: 10pt;\n margin-top: 5px;\n margin-bottom: 5px;\n display:block;\n color: #888;\n }\n .adthrive-sticky-container {\n position: relative;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n min-height:'.concat(c?c:400,"px !important;\n margin: 10px 0 10px 0;\n background-color: #FAFAFA;\n padding-bottom:0px;\n }\n "))},la=function(c){return c.some(function(a){return null!==document.querySelector(a)})},Sa=function(c){function a(){var b=c.call(this)||this;b._result=!1;b._choices=[{choice:!0},{choice:!1}];b.key="RemoveRecipeCap";b.abgroup="rrc";b._result=b.run();b.setExperimentKey();return b}v(a,c);Object.defineProperty(a.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});a.prototype.run=function(){return(new H(1)).get()};return a}(z),R=function(c){function a(b,d){void 0===b&&(b=[]);var e=c.call(this)||this;e._choices=b;e._default=d;return e}v(a,c);a.fromArray=function(b,d){return new a(b.map(function(e){e=r(e,2);return{choice:e[0],weight:e[1]}}),d)};a.prototype.addChoice=function(b,d){this._choices.push({choice:b,weight:d})};a.prototype.get=function(){var b,d=100*Math.random(),e=0;try{for(var f=L(this._choices),g=f.next();!g.done;g=f.next()){var h=g.value,k=h.choice;e+=h.weight;if(e>=d)return k}}catch(p){var l={error:p}}finally{try{g&&!g.done&&(b=f.return)&&b.call(f)}finally{if(l)throw l.error;}}return this._default};Object.defineProperty(a.prototype,"totalWeight",{get:function(){return this._choices.reduce(function(b,d){return b+d.weight},0)},enumerable:!1,configurable:!0});return a}(D),Ta=function(c){for(var a=5381,b=c.length;b;)a=33*a^c.charCodeAt(--b);return a>>>0},ma=function(){return function(c,a,b){var d=b.value;d&&(b.value=function(){for(var e=this,f=[],g=0;g<arguments.length;g++)f[g]=arguments[g];g=Array.isArray(this._choices)?Ta(JSON.stringify(this._choices)).toString(16):null;var h=this._expConfigABGroup?this._expConfigABGroup:this.abgroup;h=h?h.toLowerCase():this.key?this.key.toLowerCase():"";g=g?"".concat(h,"_").concat(g):h;g=this.localStoragePrefix?"".concat(this.localStoragePrefix,"-").concat(g):g;h=M.getLocalStorageValue("branch");!1===(h&&h.enabled)&&M.removeLocalStorageValue(g);return M.getOrSetABGroupLocalStorageValue(g,function(){return d.apply(e,f)},864E5)})}};D=function(c){function a(){var b=c.apply(this,w([],r(arguments),!1))||this;b._resultValidator=function(){return!0};return b}v(a,c);a.prototype._isValidResult=function(b){var d=this;return c.prototype._isValidResult.call(this,b,function(){return d._resultValidator(b)||"control"===b})};a.prototype.run=function(){if(!this.enabled)return q.error("CLSWeightedChoiceSiteExperiment","run","() => %o","No experiment config found. Defaulting to control."),"control";if(!this._mappedChoices||0===this._mappedChoices.length)return q.error("CLSWeightedChoiceSiteExperiment","run","() => %o","No experiment variants found. Defaulting to control."),"control";var b=(new R(this._mappedChoices)).get();if(this._isValidResult(b))return b;q.error("CLSWeightedChoiceSiteExperiment","run","() => %o","Invalid result from experiment choices. Defaulting to control.");return"control"};return a}(function(){function c(){}Object.defineProperty(c.prototype,"enabled",{get:function(){return void 0!==this.experimentConfig},enumerable:!1,configurable:!0});c.prototype._isValidResult=function(a,b){void 0===b&&(b=function(){return!0});return b()&&M.isValidABGroupLocalStorageValue(a)};return c}());var na=function(){function c(a){var b=this,d,e;this.siteExperiments=[];this._clsOptions=a;this._device=E()?"mobile":"desktop";this.siteExperiments=null!==(e=null===(d=this._clsOptions.siteAds.siteExperiments)||void 0===d?void 0:d.filter(function(f){var g=f.key;var h=b._device;if(f){var k=!!f.enabled,l=null==f.dateStart||Date.now()>=f.dateStart,p=null==f.dateEnd||Date.now()<=f.dateEnd,m=null===f.selector||""!==f.selector&&!!document.querySelector(f.selector),t="mobile"===f.platform&&"mobile"===h;h="desktop"===f.platform&&"desktop"===h;t=null===f.platform||"all"===f.platform||t||h;(h="bernoulliTrial"===f.experimentType?1===f.variants.length:za(f.variants))||q.error("SiteTest","validateSiteExperiment","experiment presented invalid choices for key:",f.key,f.variants);f=k&&l&&p&&m&&t&&h}else f=!1;a:switch(k=b._clsOptions.siteAds,g){case C.AdDensity:var n=ya(k,b._device);break a;case C.StickyOutstream:var x,A;n=(g=null===(A=null===(x=null===(n=k.videoPlayers)||void 0===n?void 0:n.partners)||void 0===x?void 0:x.stickyOutstream)||void 0===A?void 0:A.blockedPageSelectors)?!document.querySelector(g):!0;break a;case C.Interstitial:n=(n=k.adOptions.interstitialBlockedPageSelectors)?!document.querySelector(n):!0;break a;default:n=!0}return f&&n}))&&void 0!==e?e:[]}c.prototype.getSiteExperimentByKey=function(a){var b=this.siteExperiments.filter(function(f){return f.key.toLowerCase()===a.toLowerCase()})[0],d=ra("at_site_features"),e=typeof((null===b||void 0===b?0:b.variants[1])?null===b||void 0===b?void 0:b.variants[1].value:null===b||void 0===b?void 0:b.variants[0].value)===typeof d[a];b&&d[a]&&e&&(b.variants=[{displayName:"test",value:d[a],weight:100,id:0}]);return b};return c}(),Ua=function(c){function a(b){var d=c.call(this)||this;d._choices=[];d._mappedChoices=[];d._result="";d._resultValidator=function(e){return"string"===typeof e};d.key=C.AdLayout;d.abgroup=C.AdLayout;d._clsSiteExperiments=new na(b);d.experimentConfig=d._clsSiteExperiments.getSiteExperimentByKey(d.key);d.enabled&&d.experimentConfig&&(d._choices=d.experimentConfig.variants,d._mappedChoices=d._mapChoices(),d._result=d.run(),b.setWeightedChoiceExperiment(d.abgroup,d._result,!0));return d}v(a,c);Object.defineProperty(a.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});a.prototype.run=function(){if(!this.enabled)return q.error("CLSAdLayoutSiteExperiment","run","() => %o","No experiment config found. Defaulting to empty class name."),"";var b=(new R(this._mappedChoices)).get();if(this._isValidResult(b))return b;q.error("CLSAdLayoutSiteExperiment","run","() => %o","Invalid result from experiment choices. Defaulting to empty class name.");return""};a.prototype._mapChoices=function(){return this._choices.map(function(b){return{weight:b.weight,choice:b.value}})};I([ma(),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",void 0)],a.prototype,"run",null);return a}(D),Va=function(c){function a(b){var d=c.call(this)||this;d._choices=[];d._mappedChoices=[];d._result="control";d._resultValidator=function(e){return"number"===typeof e};d.key=C.AdDensity;d.abgroup=C.AdDensity;d._clsSiteExperiments=new na(b);d.experimentConfig=d._clsSiteExperiments.getSiteExperimentByKey(d.key);d.enabled&&d.experimentConfig&&(d._choices=d.experimentConfig.variants,d._mappedChoices=d._mapChoices(),d._result=d.run(),b.setWeightedChoiceExperiment(d.abgroup,d._result,!0));return d}v(a,c);Object.defineProperty(a.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});a.prototype.run=function(){if(!this.enabled)return q.error("CLSTargetAdDensitySiteExperiment","run","() => %o","No experiment config found. Defaulting to control."),"control";var b=(new R(this._mappedChoices)).get();if(this._isValidResult(b))return b;q.error("CLSTargetAdDensitySiteExperiment","run","() => %o","Invalid result from experiment choices. Defaulting to control.");return"control"};a.prototype._mapChoices=function(){return this._choices.map(function(b){var d=b.value;return{weight:b.weight,choice:"number"===typeof d?(d||0)/100:"control"}})};I([ma(),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",void 0)],a.prototype,"run",null);return a}(D),Wa=function(c){function a(){var b=c.call(this)||this;b._result=!1;b.abgroup="scae";b.key="StickyContainerAds";b._choices=[{choice:!0},{choice:!1}];b.weight=.99;b._result=b.run();b.setExperimentKey();return b}v(a,c);Object.defineProperty(a.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});a.prototype.run=function(){return(new H(this.weight)).get()};return a=I([P("StickyContainerAdsExperiment"),B("design:paramtypes",[])],a)}(z),Xa=function(c){function a(){var b=c.call(this)||this;b._result=!1;b.abgroup="scre";b.key="StickyContainerRecipe";b._choices=[{choice:!0},{choice:!1}];b.weight=.99;b._result=b.run();b.setExperimentKey();return b}v(a,c);Object.defineProperty(a.prototype,"result",{get:function(){return this._result},enumerable:!1,configurable:!0});a.prototype.run=function(){return(new H(this.weight)).get()};return a=I([P("StickyContainerRecipeExperiment"),B("design:paramtypes",[])],a)}(z),\$a=function(){function c(a,b){this._clsOptions=a;this._adInjectionMap=b;this._mainContentHeight=this._recipeCount=0;this._mainContentDiv=null;this._totalAvailableElements=[];this._minDivHeight=250;this._densityDevice=J.Desktop;this._pubLog={onePerViewport:!1,targetDensity:0,targetDensityUnits:0,combinedMax:0};this._densityMax=.99;this._smallerIncrementAttempts=0;this._absoluteMinimumSpacingByDevice=250;this._usedAbsoluteMinimum=!1;this._infPageEndOffset=0;this.locationMaxLazySequence=new Map([["Recipe",5]]);this.locationToMinHeight={Below_Post:"250px",Content:"250px",Recipe:"250px",Sidebar:"250px"};b=this._clsOptions.siteAds.breakpoints;var d=b.tablet;var e=window.innerWidth;b=e>=b.desktop?"desktop":e>=d?"tablet":"phone";this._device=b;this._config=new Pa(a);this._clsOptions.enabledLocations=this._config.enabledLocations;this._clsTargetAdDensitySiteExperiment=this._clsOptions.siteAds.siteExperiments?new Va(this._clsOptions):null;this._stickyContainerAdsExperiment=new Wa;this._stickyContainerRecipeExperiment=new Xa;this._removeRecipeCapExperiment=new Sa}c.prototype.start=function(){var a=this,b,d,e,f;try{Qa(this._device);var g=new Ua(this._clsOptions);if(g.enabled){var h=g.result,k=h.startsWith(".")?h.substring(1):h;if(/^[-_a-zA-Z]+[-_a-zA-Z0-9]*\$/.test(k))try{document.body.classList.add(k)}catch(m){q.error("ClsDynamicAdsInjector","start","Uncaught CSS Class error: ".concat(m))}else q.error("ClsDynamicAdsInjector","start","Invalid class name: ".concat(k))}var l=Oa(this._device,this._clsOptions.siteAds).filter(function(m){return a._locationEnabled(m)}).filter(function(m){return m.devices.includes(a._device)}).filter(function(m){return 0===m.pageSelector.length||null!==document.querySelector(m.pageSelector)}),p=this.inject(l);(null===(d=null===(b=this._clsOptions.siteAds.adOptions.stickyContainerConfig)||void 0===b?void 0:b.content)||void 0===d?0:d.enabled)&&this._stickyContainerAdsExperiment.result&&!la(this._clsOptions.siteAds.adOptions.stickyContainerConfig.blockedSelectors||[])&&Ra(null===(f=null===(e=this._clsOptions.siteAds.adOptions.stickyContainerConfig)||void 0===e?void 0:e.content)||void 0===f?void 0:f.minHeight);p.forEach(function(m){return a._clsOptions.setInjectedSlots(m)})}catch(m){q.error("ClsDynamicAdsInjector","start",m)}};c.prototype.inject=function(a,b){void 0===b&&(b=document);this._densityDevice="desktop"===this._device?J.Desktop:J.Mobile;this._overrideDefaultAdDensitySettingsWithSiteExperiment();var d=this._clsOptions.siteAds,e=u(d.adDensityEnabled,!0),f=d.adDensityLayout&&e;d=a.filter(function(g){return f?"Content"!==g.location:g});a=a.filter(function(g){return f?"Content"===g.location:null});return w(w([],r(d.length?this._injectNonDensitySlots(d,b):[]),!1),r(a.length?this._injectDensitySlots(a,b):[]),!1)};c.prototype._injectNonDensitySlots=function(a,b){var d,e=this,f,g,h;void 0===b&&(b=document);var k=[],l=[];this._stickyContainerRecipeExperiment.result&&a.some(function(n){return"Recipe"===n.location&&n.sticky})&&!la((null===(f=this._clsOptions.siteAds.adOptions.stickyContainerConfig)||void 0===f?void 0:f.blockedSelectors)||[])&&(f=this._clsOptions.siteAds.adOptions.stickyContainerConfig,f="phone"===this._device?null===(g=null===f||void 0===f?void 0:f.recipeMobile)||void 0===g?void 0:g.minHeight:null===(h=null===f||void 0===f?void 0:f.recipeDesktop)||void 0===h?void 0:h.minHeight,T("\n .adthrive-recipe.adthrive-sticky {\n position: -webkit-sticky;\n position: sticky !important;\n top: 42px !important;\n margin-top: 42px !important;\n }\n .adthrive-recipe-sticky-container {\n position: relative;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n min-height:".concat(f?f:400,"px !important;\n margin: 10px 0 10px 0;\n background-color: #FAFAFA;\n padding-bottom:0px;\n }\n ")));try{for(var p=L(a),m=p.next();!m.done;m=p.next())this._insertNonDensityAds(m.value,k,l,b)}catch(n){var t={error:n}}finally{try{m&&!m.done&&(d=p.return)&&d.call(p)}finally{if(t)throw t.error;}}l.forEach(function(n){n.element.style.minHeight=e.locationToMinHeight[n.location]});return k};c.prototype._injectDensitySlots=function(a,b){void 0===b&&(b=document);try{this._calculateMainContentHeightAndAllElements(a,b)}catch(h){return[]}var d=this._getDensitySettings(a,b);a=d.onePerViewport;var e=d.targetAll,f=d.targetDensityUnits,g=d.combinedMax;d=d.numberOfUnits;this._absoluteMinimumSpacingByDevice=a?window.innerHeight:this._absoluteMinimumSpacingByDevice;if(!d)return[];this._adInjectionMap.filterUsed();this._findElementsForAds(d,a,e,g,f,b);return this._insertAds()};c.prototype._overrideDefaultAdDensitySettingsWithSiteExperiment=function(){var a;if(null===(a=this._clsTargetAdDensitySiteExperiment)||void 0===a?0:a.enabled)a=this._clsTargetAdDensitySiteExperiment.result,"number"===typeof a&&(this._clsOptions.siteAds.adDensityEnabled=!0,this._clsOptions.siteAds.adDensityLayout[this._densityDevice].adDensity=a)};c.prototype._getDensitySettings=function(a,b){void 0===b&&(b=document);var d=this._clsOptions.siteAds.adDensityLayout,e=this._determineOverrides(d.pageOverrides);e=e.length?e[0]:d[this._densityDevice];d=this._clsOptions.getTargetDensity(e.adDensity);e=e.onePerViewport;var f=this._shouldTargetAllEligible(d),g=this._getTargetDensityUnits(d,f);a=this._getCombinedMax(a,b);b=Math.min.apply(Math,w([],r(w([this._totalAvailableElements.length,g],r(0<a?[a]:[]),!1)),!1));this._pubLog={onePerViewport:e,targetDensity:d,targetDensityUnits:g,combinedMax:a};return{onePerViewport:e,targetAll:f,targetDensityUnits:g,combinedMax:a,numberOfUnits:b}};c.prototype._determineOverrides=function(a){var b=this;return a.filter(function(d){var e=ea(d.pageSelector);return""===d.pageSelector||e.elements&&e.elements.length}).map(function(d){return d[b._densityDevice]})};c.prototype._shouldTargetAllEligible=function(a){return a===this._densityMax};c.prototype._getTargetDensityUnits=function(a,b){return b?this._totalAvailableElements.length:Math.floor(a*this._mainContentHeight/(1-a)/this._minDivHeight)-this._recipeCount};c.prototype._getCombinedMax=function(a,b){void 0===b&&(b=document);return u(a.filter(function(d){try{var e=b.querySelector(d.elementSelector)}catch(f){}return e}).map(function(d){return Number(d.max)+Number(d.lazyMaxDefaulted?0:d.lazyMax)}).sort(function(d,e){return e-d})[0],0)};c.prototype._elementLargerThanMainContent=function(a){return a.offsetHeight>=this._mainContentHeight&&1<this._totalAvailableElements.length};c.prototype._elementDisplayNone=function(a){var b=window.getComputedStyle(a,null).display;return b&&"none"===b||"none"===a.style.display};c.prototype._isBelowMaxes=function(a,b){return this._adInjectionMap.map.length<a&&this._adInjectionMap.map.length<b};c.prototype._findElementsForAds=function(a,b,d,e,f,g){var h=this;void 0===g&&(g=document);this._clsOptions.targetDensityLog={onePerViewport:b,combinedMax:e,targetDensityUnits:f,targetDensityPercentage:this._pubLog.targetDensity,mainContentHeight:this._mainContentHeight,recipeCount:this._recipeCount,numberOfEls:this._totalAvailableElements.length};var k=function(l){var p;try{for(var m=L(h._totalAvailableElements),t=m.next();!t.done;t=m.next()){var n=t.value,x=n.dynamicAd,A=n.element;h._logDensityInfo(A,x.elementSelector,l);if(!(!d&&h._elementLargerThanMainContent(A)||h._elementDisplayNone(A)))if(h._isBelowMaxes(e,f))h._checkElementSpacing({dynamicAd:x,element:A,insertEvery:l,targetAll:d,target:g});else break}}catch(K){var F={error:K}}finally{try{t&&!t.done&&(p=m.return)&&p.call(m)}finally{if(F)throw F.error;}}!h._usedAbsoluteMinimum&&5>h._smallerIncrementAttempts&&(++h._smallerIncrementAttempts,k(h._getSmallerIncrement(l)))};a=this._getInsertEvery(a,b,f);k(a)};c.prototype._getSmallerIncrement=function(a){a*=.6;a<=this._absoluteMinimumSpacingByDevice&&(a=this._absoluteMinimumSpacingByDevice,this._usedAbsoluteMinimum=!0);return a};c.prototype._insertNonDensityAds=function(a,b,d,e){void 0===e&&(e=document);var f=0,g=0,h=0;0<a.spacing&&(g=f=window.innerHeight*a.spacing);for(var k=this._repeatDynamicAds(a),l=this.getElements(a.elementSelector,e),p=function(n){if(h+1>k.length)return"break";var x=l[n];if(0<f){n=pa(x).bottom;if(n<=g)return"continue";g=n+f}n=k[h];var A="".concat(n.location,"_").concat(n.sequence);b.some(function(Ya){return Ya.name===A})&&(h+=1);var F=m.getDynamicElementId(n),K=Q(a),Za=ka(a);K=w(["Sidebar"===a.location&&a.sticky&&a.sequence&&5>=a.sequence?"adthrive-sticky-sidebar":"",m._stickyContainerRecipeExperiment.result&&"Recipe"===a.location&&a.sticky?"adthrive-recipe-sticky-container":"",K,Za],r(a.classNames),!1);if(x=m.addAd(x,F,a.position,K))F=ja(n,x),F.length&&(b.push({clsDynamicAd:a,dynamicAd:n,element:x,sizes:F,name:A,infinite:e!==document}),d.push({location:n.location,element:x}),"Recipe"===a.location&&++m._recipeCount,h+=1)},m=this,t=a.skip;t<l.length&&"break"!==p(t);t+=a.every);};c.prototype._insertAds=function(){var a=this,b=[];this._adInjectionMap.filterUsed();this._adInjectionMap.map.forEach(function(d,e){var f=d.el,g=d.dynamicAd;d=d.target;e=Number(g.sequence)+e;var h=g.max;h=g.lazy&&e>h;g.sequence=e;g.lazy=h;if(f=a._addContentAd(f,g,d))g.used=!0,b.push(f)});return b};c.prototype._getInsertEvery=function(a,b,d){this._moreAvailableElementsThanUnitsToInject(d,a)?(this._usedAbsoluteMinimum=!1,a=this._useWiderSpacing(d,a)):(this._usedAbsoluteMinimum=!0,a=this._useSmallestSpacing(b));return b&&window.innerHeight>a?window.innerHeight:a};c.prototype._useWiderSpacing=function(a,b){return this._mainContentHeight/Math.min(a,b)};c.prototype._useSmallestSpacing=function(a){return a&&window.innerHeight>this._absoluteMinimumSpacingByDevice?window.innerHeight:this._absoluteMinimumSpacingByDevice};c.prototype._moreAvailableElementsThanUnitsToInject=function(a,b){return this._totalAvailableElements.length>a||this._totalAvailableElements.length>b};c.prototype._logDensityInfo=function(a,b,d){a=this._pubLog;a.onePerViewport;a.targetDensity;a.combinedMax};c.prototype._checkElementSpacing=function(a){var b=a.dynamicAd,d=a.element,e=a.insertEvery,f=a.targetAll;a=a.target;a=void 0===a?document:a;(this._isFirstAdInjected()||this._hasProperSpacing(d,b,f,e))&&this._markSpotForContentAd(d,y({},b),a)};c.prototype._isFirstAdInjected=function(){return!this._adInjectionMap.map.length};c.prototype._markSpotForContentAd=function(a,b,d){void 0===d&&(d=document);this._adInjectionMap.add(a,this._getElementCoords(a,"beforebegin"===b.position||"afterbegin"===b.position),b,d);this._adInjectionMap.sort()};c.prototype._hasProperSpacing=function(a,b,d,e){var f="beforebegin"===b.position||"afterbegin"===b.position;b="beforeend"===b.position||"afterbegin"===b.position;d=d||this._isElementFarEnoughFromOtherAdElements(a,e,f);f=b||this._isElementNotInRow(a,f);a=-1===a.id.indexOf("AdThrive_".concat("Below_Post"));return d&&f&&a};c.prototype._isElementFarEnoughFromOtherAdElements=function(a,b,d){a=this._getElementCoords(a,d);var e=!1;for(d=0;d<this._adInjectionMap.map.length&&!(e=this._adInjectionMap.map[d+1]&&this._adInjectionMap.map[d+1].coords,e=a-b>this._adInjectionMap.map[d].coords&&(!e||a+b<e));d++);return e};c.prototype._isElementNotInRow=function(a,b){var d=a.previousElementSibling,e=a.nextElementSibling;return(b=b?!d&&e||d&&a.tagName!==d.tagName?e:d:e)&&0===a.getBoundingClientRect().height?!0:b?a.getBoundingClientRect().top!==b.getBoundingClientRect().top:!0};c.prototype._calculateMainContentHeightAndAllElements=function(a,b){void 0===b&&(b=document);a=r(xa(a,this._adInjectionMap,b),2);b=a[1];this._mainContentDiv=a[0];this._totalAvailableElements=b;a=this._mainContentDiv;b=void 0;void 0===b&&(b="div #comments, section .comments");this._mainContentHeight=(b=a.querySelector(b))?a.offsetHeight-b.offsetHeight:a.offsetHeight};c.prototype._getElementCoords=function(a,b){void 0===b&&(b=!1);a=a.getBoundingClientRect();return(b?a.top:a.bottom)+window.scrollY};c.prototype._addContentAd=function(a,b,d){var e,f;void 0===d&&(d=document);var g=null,h=Q(b),k=ka(b),l=(null===(f=null===(e=this._clsOptions.siteAds.adOptions.stickyContainerConfig)||void 0===e?void 0:e.content)||void 0===f?0:f.enabled)&&this._stickyContainerAdsExperiment.result?"adthrive-sticky-container":"";if(a=this.addAd(a,this.getDynamicElementId(b),b.position,w([l,h,k],r(b.classNames),!1)))e=ja(b,a),e.length&&(a.style.minHeight=this.locationToMinHeight[b.location],g="".concat(b.location,"_").concat(b.sequence),g={clsDynamicAd:b,dynamicAd:b,element:a,sizes:e,name:g,infinite:d!==document});return g};c.prototype.getDynamicElementId=function(a){return"".concat("AdThrive","_").concat(a.location,"_").concat(a.sequence,"_").concat(this._device)};c.prototype.getElements=function(a,b){void 0===b&&(b=document);return b.querySelectorAll(a)};c.prototype.addAd=function(a,b,d,e){void 0===e&&(e=[]);document.getElementById(b)||(e='<div id="'.concat(b,'" class="adthrive-ad ').concat(e.join(" "),'"></div>'),a.insertAdjacentHTML(d,e));return document.getElementById(b)};c.prototype._repeatDynamicAds=function(a){var b=[],d=this._removeRecipeCapExperiment.result&&"Recipe"===a.location?99:this.locationMaxLazySequence.get(a.location),e=a.lazy?u(d,0):0;d=a.max;var f=a.lazyMax;e=Math.max(d,0===e&&a.lazy?d+f:Math.min(Math.max(e-a.sequence+1,0),d+f));for(f=0;f<e;f++){var g=Number(a.sequence)+f,h=a.lazy&&f>=d;b.push(y(y({},a),{sequence:g,lazy:h}))}return b};c.prototype._locationEnabled=function(a){a=this._clsOptions.enabledLocations.includes(a.location);var b=this._clsOptions.disableAds&&this._clsOptions.disableAds.all||document.body.classList.contains("adthrive-disable-all"),d=!document.body.classList.contains("adthrive-disable-content")&&!this._clsOptions.disableAds.reasons.has("content_plugin");return a&&!b&&d};return c}(),ab=function(c){function a(b,d){var e=c.call(this,b,"ClsVideoInsertion")||this;e._videoConfig=b;e._clsOptions=d;e._IN_POST_SELECTOR=".adthrive-video-player";e._WRAPPER_BAR_HEIGHT=36;e._playersAddedFromPlugin=[];d.removeVideoTitleWrapper&&(e._WRAPPER_BAR_HEIGHT=0);return e}v(a,c);a.prototype.init=function(){this._initializePlayers()};a.prototype._wrapJWPlayerWithCLS=function(b,d,e){void 0===e&&(e=0);return b.parentNode?(d=this._createGenericCLSWrapper(.5625*b.offsetWidth,d,e),b.parentNode.insertBefore(d,b),d.appendChild(b),d):null};a.prototype._createGenericCLSWrapper=function(b,d,e){var f=document.createElement("div");f.id="cls-video-container-".concat(d);f.className="adthrive";f.style.minHeight="".concat(b+e,"px");return f};a.prototype._getTitleHeight=function(b){b.innerText="Title";b.style.visibility="hidden";document.body.appendChild(b);var d=window.getComputedStyle(b),e=parseInt(d.height,10),f=parseInt(d.marginTop,10);d=parseInt(d.marginBottom,10);document.body.removeChild(b);return Math.min(e+d+f,50)};a.prototype._initializePlayers=function(){var b=document.querySelectorAll(this._IN_POST_SELECTOR);b.length&&this._initializeRelatedPlayers(b);this._shouldRunAutoplayPlayers()&&this._determineAutoplayPlayers()};a.prototype._createStationaryRelatedPlayer=function(b,d,e){var f="mobile"===this._device?[400,225]:[640,360],g=G.Video_In_Post_ClicktoPlay_SoundOn;d&&b.mediaOrPlaylistId&&(e="".concat(b.mediaOrPlaylistId,"_").concat(e),d=this._wrapJWPlayerWithCLS(d,e),this._playersAddedFromPlugin.push(b.mediaOrPlaylistId),d&&this._clsOptions.setInjectedVideoSlots({playerId:b.playerId,playerName:g,playerSize:f,element:d,type:"stationaryRelated"}))};a.prototype._createStickyRelatedPlayer=function(b,d){var e="mobile"===this._device?[400,225]:[640,360],f=G.Video_Individual_Autoplay_SOff;this._stickyRelatedOnPage=!0;this._videoConfig.mobileStickyPlayerOnPage="mobile"===this._device;if(d&&b.position&&b.mediaId){var g=document.createElement("div");d.insertAdjacentElement(b.position,g);d=document.createElement("h3");d.style.margin="10px 0";d=this._getTitleHeight(d);d=this._wrapJWPlayerWithCLS(g,b.mediaId,this._WRAPPER_BAR_HEIGHT+d);this._playersAddedFromPlugin.push(b.mediaId);d&&this._clsOptions.setInjectedVideoSlots({playlistId:b.playlistId,playerId:b.playerId,playerSize:e,playerName:f,element:g,type:"stickyRelated"})}};a.prototype._createPlaylistPlayer=function(b,d){var e=b.playlistId,f="mobile"===this._device?G.Video_Coll_SOff_Smartphone:G.Video_Collapse_Autoplay_SoundOff,g="mobile"===this._device?[400,225]:[640,360];this._videoConfig.mobileStickyPlayerOnPage=!0;var h=document.createElement("div");d.insertAdjacentElement(b.position,h);d=this._wrapJWPlayerWithCLS(h,e,this._WRAPPER_BAR_HEIGHT);this._playersAddedFromPlugin.push("playlist-".concat(e));d&&this._clsOptions.setInjectedVideoSlots({playlistId:b.playlistId,playerId:b.playerId,playerSize:g,playerName:f,element:h,type:"stickyPlaylist"})};a.prototype._isVideoAllowedOnPage=function(){var b=this._clsOptions.disableAds;if(b&&b.video){var d="";b.reasons.has("video_tag")?d="video tag":b.reasons.has("video_plugin")?d="video plugin":b.reasons.has("video_page")&&(d="command queue");q.error(d?"ClsVideoInsertionMigrated":"ClsVideoInsertion","isVideoAllowedOnPage",Error("DBP: Disabled by publisher via ".concat(d||"other")));return!1}return this._clsOptions.videoDisabledFromPlugin?!1:!0};return a}(function(c){function a(b,d){var e=c.call(this)||this;e._videoConfig=b;e._component=d;e._stickyRelatedOnPage=!1;e._relatedMediaIds=[];e._device=sa()?"desktop":"mobile";e._potentialPlayerMap=e.setPotentialPlayersMap();return e}v(a,c);a.prototype.setPotentialPlayersMap=function(){var b=this._videoConfig.players||[],d=this._filterPlayerMap();b=b.filter(function(e){return"stationaryRelated"===e.type&&e.enabled});d.stationaryRelated=b;return this._potentialPlayerMap=d};a.prototype._filterPlayerMap=function(){var b=this,d=this._videoConfig.players,e={stickyRelated:[],stickyPlaylist:[],stationaryRelated:[]};return d&&d.length?d.filter(function(f){var g;return null===(g=f.devices)||void 0===g?void 0:g.includes(b._device)}).reduce(function(f,g){f[g.type]||(q.event(b._component,"constructor","Unknown Video Player Type detected",g.type),f[g.type]=[]);g.enabled&&f[g.type].push(g);return f},e):e};a.prototype._checkPlayerSelectorOnPage=function(b){var d=this;b=this._potentialPlayerMap[b].map(function(e){return{player:e,playerElement:d._getPlacementElement(e)}});return b.length?b[0]:{player:null,playerElement:null}};a.prototype._getOverrideElement=function(b,d,e){b&&d?(e=document.createElement("div"),d.insertAdjacentElement(b.position,e)):(d=this._checkPlayerSelectorOnPage("stickyPlaylist"),b=d.player,d=d.playerElement,b&&d&&(e=document.createElement("div"),d.insertAdjacentElement(b.position,e)));return e};a.prototype._shouldOverrideElement=function(b){b=b.getAttribute("override-embed");return"true"===b||"false"===b?"true"===b:this._videoConfig.relatedSettings?this._videoConfig.relatedSettings.overrideEmbedLocation:!1};a.prototype._checkPageSelector=function(b,d,e){void 0===e&&(e=[]);return b&&d&&0===e.length?("/"!==window.location.pathname&&q.event("VideoUtils","getPlacementElement",Error("PSNF: ".concat(b," does not exist on the page"))),!1):!0};a.prototype._getElementSelector=function(b,d,e){if(d&&d.length>e)return d[e];q.event("VideoUtils","getPlacementElement",Error("ESNF: ".concat(b," does not exist on the page")));return null};a.prototype._getPlacementElement=function(b){var d=b.pageSelector,e=b.elementSelector;b=b.skip;var f=ea(d),g=f.valid,h=f.elements;f=S(f,["valid","elements"]);var k=da(e),l=k.valid,p=k.elements;k=S(k,["valid","elements"]);return""===d||g?l?this._checkPageSelector(d,g,h)?this._getElementSelector(e,p,b)||null:null:(q.error("VideoUtils","getPlacementElement",Error("".concat(e," is not a valid selector")),k),null):(q.error("VideoUtils","getPlacementElement",Error("".concat(d," is not a valid selector")),f),null)};a.prototype._getEmbeddedPlayerType=function(b){(b=b.getAttribute("data-player-type"))&&"default"!==b||(b=this._videoConfig.relatedSettings?this._videoConfig.relatedSettings.defaultPlayerType:"static");this._stickyRelatedOnPage&&(b="static");return b};a.prototype._getMediaId=function(b){return(b=b.getAttribute("data-video-id"))?(this._relatedMediaIds.push(b),b):!1};a.prototype._createRelatedPlayer=function(b,d,e,f){"collapse"===d?this._createCollapsePlayer(b,e):"static"===d&&this._createStaticPlayer(b,e,f)};a.prototype._createCollapsePlayer=function(b,d){var e=this._checkPlayerSelectorOnPage("stickyRelated"),f=e.player;e=e.playerElement;var g=f?f:this._potentialPlayerMap.stationaryRelated[0];g&&g.playerId?(this._shouldOverrideElement(d)&&(d=this._getOverrideElement(f,e,d)),d=document.querySelector("#cls-video-container-".concat(b," > div"))||d,this._createStickyRelatedPlayer(y(y({},g),{mediaId:b}),d)):q.error(this._component,"_createCollapsePlayer","No video player found")};a.prototype._createStaticPlayer=function(b,d,e){this._potentialPlayerMap.stationaryRelated.length&&this._potentialPlayerMap.stationaryRelated[0].playerId?this._createStationaryRelatedPlayer(y(y({},this._potentialPlayerMap.stationaryRelated[0]),{mediaOrPlaylistId:b}),d,e):q.error(this._component,"_createStaticPlayer","No video player found")};a.prototype._shouldRunAutoplayPlayers=function(){return this._isVideoAllowedOnPage()&&(this._potentialPlayerMap.stickyRelated.length||this._potentialPlayerMap.stickyPlaylist.length)?!0:!1};a.prototype._determineAutoplayPlayers=function(){var b=this._component,d="VideoManagerComponent"===b,e=this._config;if(this._stickyRelatedOnPage)q.event(b,"stickyRelatedOnPage",d&&{device:e&&e.context.device,isDesktop:this._device}||{});else{var f=this._checkPlayerSelectorOnPage("stickyPlaylist"),g=f.player;f=f.playerElement;g&&g.playerId&&g.playlistId&&f?this._createPlaylistPlayer(g,f):q.event(b,"noStickyPlaylist",d&&{vendor:"none",device:e&&e.context.device,isDesktop:this._device}||{})}};a.prototype._initializeRelatedPlayers=function(b){for(var d=new Map,e=0;e<b.length;e++){var f=b[e],g=f.offsetParent,h=this._getEmbeddedPlayerType(f),k=this._getMediaId(f);g&&k&&(g=(d.get(k)||0)+1,d.set(k,g),this._createRelatedPlayer(k,h,f,g))}};return a}(function(){function c(){}Object.defineProperty(c.prototype,"enabled",{get:function(){return!0},enumerable:!1,configurable:!0});return c}())),bb=function(c){function a(){return null!==c&&c.apply(this,arguments)||this}v(a,c);return a}(function(){function c(){this._map=[]}c.prototype.add=function(a,b,d,e){void 0===e&&(e=document);this._map.push({el:a,coords:b,dynamicAd:d,target:e})};Object.defineProperty(c.prototype,"map",{get:function(){return this._map},enumerable:!1,configurable:!0});c.prototype.sort=function(){this._map.sort(function(a,b){return a.coords-b.coords})};c.prototype.filterUsed=function(){this._map=this._map.filter(function(a){return!a.dynamicAd.used})};c.prototype.reset=function(){this._map=[]};return c}());try{(function(){var c=new fa;c&&c.enabled&&((new \$a(c,new bb)).start(),(new ab(new Ea(c),c)).init())})()}catch(c){q.error("CLS","pluginsertion-iife",c),window.adthriveCLS&&(window.adthriveCLS.injectedFromPlugin=!1)}})()(function(){var clsElements=document.querySelectorAll("script[id^='cls-']");window.adthriveCLS&&clsElements&&clsElements.length===0?window.adthriveCLS.injectedFromPlugin=false:"";})(); ```