');e.insertAdjacentHTML(n,o)}return document.getElementById(t)},e.prototype._repeatDynamicAds=function(e){for(var t=[],i=this._removeRecipeCapExperiment.result&&"Recipe"===e.location?99:this.locationMaxLazySequence.get(e.location),o=e.lazy?C(i,0):0,r=e.max,a=e.lazyMax,s=0===o&&e.lazy?r+a:Math.min(Math.max(o-e.sequence+1,0),r+a),l=Math.max(r,s),c=0;c=r;t.push(n(n({},e),{sequence:u,lazy:d}))}return t},e.prototype._locationEnabled=function(e){var t=this._clsOptions.enabledLocations.includes(e.location),n=this._clsOptions.disableAds&&this._clsOptions.disableAds.all||document.body.classList.contains("adthrive-disable-all"),i=!document.body.classList.contains("adthrive-disable-content")&&!this._clsOptions.disableAds.reasons.has("content_plugin");return t&&!n&&i},e}(),Ce=function(e){function n(t,n){var i=e.call(this,t,"ClsVideoInsertion")||this;return i._videoConfig=t,i._clsOptions=n,i._IN_POST_SELECTOR=".adthrive-video-player",i._WRAPPER_BAR_HEIGHT=36,i._playersAddedFromPlugin=[],n.removeVideoTitleWrapper&&(i._WRAPPER_BAR_HEIGHT=0),i}return t(n,e),n.prototype.init=function(){this._initializePlayers()},n.prototype._wrapVideoPlayerWithCLS=function(e,t,n){if(void 0===n&&(n=0),e.parentNode){var i=e.offsetWidth*(9/16),o=this._createGenericCLSWrapper(i,t,n);return e.parentNode.insertBefore(o,e),o.appendChild(e),o}return null},n.prototype._createGenericCLSWrapper=function(e,t,n){var i=document.createElement("div");return i.id="cls-video-container-".concat(t),i.className="adthrive",i.style.minHeight="".concat(e+n,"px"),i},n.prototype._getTitleHeight=function(){var e=document.createElement("h3");e.style.margin="10px 0",e.innerText="Title",e.style.visibility="hidden",document.body.appendChild(e);var t=window.getComputedStyle(e),n=parseInt(t.height,10),i=parseInt(t.marginTop,10),o=parseInt(t.marginBottom,10);return document.body.removeChild(e),Math.min(n+o+i,50)},n.prototype._initializePlayers=function(){var e=document.querySelectorAll(this._IN_POST_SELECTOR);e.length&&this._initializeRelatedPlayers(e),this._shouldRunAutoplayPlayers()&&this._determineAutoplayPlayers()},n.prototype._createStationaryRelatedPlayer=function(e,t,n){var i="mobile"===this._device?[400,225]:[640,360],o=_.Video_In_Post_ClicktoPlay_SoundOn;if(t&&e.mediaOrPlaylistId){var r="".concat(e.mediaOrPlaylistId,"_").concat(n),a=this._wrapVideoPlayerWithCLS(t,r);this._playersAddedFromPlugin.push(e.mediaOrPlaylistId),a&&this._clsOptions.setInjectedVideoSlots({playerId:e.playerId,playerName:o,playerSize:i,element:a,type:"stationaryRelated"})}},n.prototype._createStickyRelatedPlayer=function(e,t){var n="mobile"===this._device?[400,225]:[640,360],i=_.Video_Individual_Autoplay_SOff;if(this._stickyRelatedOnPage=!0,this._videoConfig.mobileStickyPlayerOnPage="mobile"===this._device,t&&e.position&&e.mediaId){var o=document.createElement("div");t.insertAdjacentElement(e.position,o);var r=this._getTitleHeight(),a=this._wrapVideoPlayerWithCLS(o,e.mediaId,this._WRAPPER_BAR_HEIGHT+r);this._playersAddedFromPlugin.push(e.mediaId),a&&this._clsOptions.setInjectedVideoSlots({playlistId:e.playlistId,playerId:e.playerId,playerSize:n,playerName:i,element:o,type:"stickyRelated"})}},n.prototype._createPlaylistPlayer=function(e,t){var n=e.playlistId,i="mobile"===this._device?_.Video_Coll_SOff_Smartphone:_.Video_Collapse_Autoplay_SoundOff,o="mobile"===this._device?[400,225]:[640,360];this._videoConfig.mobileStickyPlayerOnPage=!0;var r=document.createElement("div");t.insertAdjacentElement(e.position,r);var a=this._WRAPPER_BAR_HEIGHT;e.title&&(a+=this._getTitleHeight());var s=this._wrapVideoPlayerWithCLS(r,n,a);this._playersAddedFromPlugin.push("playlist-".concat(n)),s&&this._clsOptions.setInjectedVideoSlots({playlistId:e.playlistId,playerId:e.playerId,playerSize:o,playerName:i,element:r,type:"stickyPlaylist"})},n.prototype._isVideoAllowedOnPage=function(){var e=this._clsOptions.disableAds;if(e&&e.video){var t="";e.reasons.has("video_tag")?t="video tag":e.reasons.has("video_plugin")?t="video plugin":e.reasons.has("video_page")&&(t="command queue");var n=t?"ClsVideoInsertionMigrated":"ClsVideoInsertion";return A.error(n,"isVideoAllowedOnPage",new Error("DBP: Disabled by publisher via ".concat(t||"other"))),!1}return!this._clsOptions.videoDisabledFromPlugin},n}(function(e){function o(t,n){var i=e.call(this)||this;return i._videoConfig=t,i._component=n,i._stickyRelatedOnPage=!1,i._relatedMediaIds=[],i._device=x()?"desktop":"mobile",i._potentialPlayerMap=i.setPotentialPlayersMap(),i}return t(o,e),o.prototype.setPotentialPlayersMap=function(){var e=this._videoConfig.players||[],t=this._filterPlayerMap(),n=e.filter((function(e){return"stationaryRelated"===e.type&&e.enabled}));return t.stationaryRelated=n,this._potentialPlayerMap=t,this._potentialPlayerMap},o.prototype._filterPlayerMap=function(){var e=this,t=this._videoConfig.players,n={stickyRelated:[],stickyPlaylist:[],stationaryRelated:[]};return t&&t.length?t.filter((function(t){var n;return null===(n=t.devices)||void 0===n?void 0:n.includes(e._device)})).reduce((function(t,n){return t[n.type]||(A.event(e._component,"constructor","Unknown Video Player Type detected",n.type),t[n.type]=[]),n.enabled&&t[n.type].push(n),t}),n):n},o.prototype._checkPlayerSelectorOnPage=function(e){var t=this,n=this._potentialPlayerMap[e].map((function(e){return{player:e,playerElement:t._getPlacementElement(e)}}));return n.length?n[0]:{player:null,playerElement:null}},o.prototype._getOverrideElement=function(e,t,n){if(e&&t){var i=document.createElement("div");t.insertAdjacentElement(e.position,i),n=i}else{var o=this._checkPlayerSelectorOnPage("stickyPlaylist"),r=o.player,a=o.playerElement;if(r&&a){i=document.createElement("div");a.insertAdjacentElement(r.position,i),n=i}}return n},o.prototype._shouldOverrideElement=function(e){var t=e.getAttribute("override-embed");return"true"===t||"false"===t?"true"===t:!!this._videoConfig.relatedSettings&&this._videoConfig.relatedSettings.overrideEmbedLocation},o.prototype._checkPageSelector=function(e,t,n){return void 0===n&&(n=[]),!e||!t||0!==n.length||(!("/"===window.location.pathname)&&A.event("VideoUtils","getPlacementElement",new Error("PSNF: ".concat(e," does not exist on the page"))),!1)},o.prototype._getElementSelector=function(e,t,n){return t&&t.length>n?t[n]:(A.event("VideoUtils","getPlacementElement",new Error("ESNF: ".concat(e," does not exist on the page"))),null)},o.prototype._getPlacementElement=function(e){var t=e.pageSelector,n=e.elementSelector,o=e.skip,r=I(t),a=r.valid,s=r.elements,l=i(r,["valid","elements"]),c=R(n),u=c.valid,d=c.elements,p=i(c,["valid","elements"]);return""===t||a?u?this._checkPageSelector(t,a,s)&&this._getElementSelector(n,d,o)||null:(A.error("VideoUtils","getPlacementElement",new Error("".concat(n," is not a valid selector")),p),null):(A.error("VideoUtils","getPlacementElement",new Error("".concat(t," is not a valid selector")),l),null)},o.prototype._getEmbeddedPlayerType=function(e){var t=e.getAttribute("data-player-type");return t&&"default"!==t||(t=this._videoConfig.relatedSettings?this._videoConfig.relatedSettings.defaultPlayerType:"static"),this._stickyRelatedOnPage&&(t="static"),t},o.prototype._getMediaId=function(e){var t=e.getAttribute("data-video-id");return!!t&&(this._relatedMediaIds.push(t),t)},o.prototype._createRelatedPlayer=function(e,t,n,i){"collapse"===t?this._createCollapsePlayer(e,n):"static"===t&&this._createStaticPlayer(e,n,i)},o.prototype._createCollapsePlayer=function(e,t){var i=this._checkPlayerSelectorOnPage("stickyRelated"),o=i.player,r=i.playerElement,a=o||this._potentialPlayerMap.stationaryRelated[0];a&&a.playerId?(this._shouldOverrideElement(t)&&(t=this._getOverrideElement(o,r,t)),t=document.querySelector("#cls-video-container-".concat(e," > div"))||t,this._createStickyRelatedPlayer(n(n({},a),{mediaId:e}),t)):A.error(this._component,"_createCollapsePlayer","No video player found")},o.prototype._createStaticPlayer=function(e,t,i){if(this._potentialPlayerMap.stationaryRelated.length&&this._potentialPlayerMap.stationaryRelated[0].playerId){var o=this._potentialPlayerMap.stationaryRelated[0];this._createStationaryRelatedPlayer(n(n({},o),{mediaOrPlaylistId:e}),t,i)}else A.error(this._component,"_createStaticPlayer","No video player found")},o.prototype._shouldRunAutoplayPlayers=function(){return!(!this._isVideoAllowedOnPage()||!this._potentialPlayerMap.stickyRelated.length&&!this._potentialPlayerMap.stickyPlaylist.length)},o.prototype._determineAutoplayPlayers=function(){var e=this._component,t="VideoManagerComponent"===e,n=this._config;if(this._stickyRelatedOnPage)A.event(e,"stickyRelatedOnPage",t&&{device:n&&n.context.device,isDesktop:this._device}||{});else{var i=this._checkPlayerSelectorOnPage("stickyPlaylist"),o=i.player,r=i.playerElement;o&&o.playerId&&o.playlistId&&r?this._createPlaylistPlayer(o,r):A.event(e,"noStickyPlaylist",t&&{vendor:"none",device:n&&n.context.device,isDesktop:this._device}||{})}},o.prototype._initializeRelatedPlayers=function(e){for(var t=new Map,n=0;n
Clicky