Healthy

The Best Healthy Carrot Cake You’ll Ever Eat (gluten free!)




[]

Over the past few years, carrot cake has become my favorite cake on the planet. I love that it’s packed with spices, super moist, full of incredible flavor and plenty of texture thanks to carrots, coconut, raisins and nuts.

Where my carrot cake lovers at?!

As most of you know, I LOVE baking cake recipes for special occasions: paleo chocolate caketahini chocolate chip cake, my strawberry shortcake cake and my peanut butter banana cake are just a few of my favorites.

So I thought to myself, why not make a healthier, paleo-friendly and gluten free carrot cake that’s absolutely perfect for spring time and especially Easter. To make it healthier, I used natural unrefined sweeteners, grain free nutrient-dense flours and a few other special ingredients to keep it deliciously moist and true to the carrot cake flavor we all know and love.

This is truly the BEST healthy carrot cake you’ll ever eat!

healthy gluten free carrot cake topped with pecans

What you’ll need to make this healthy gluten free carrot cake

This healthy carrot cake requires a few specialty ingredients, but trust me when I say that this will absolutely be the BEST healthy carrot cake you’ll EVER eat. Here’s what you need:

  • Almond flour: I recommend using a fine blanched almond flour. Make sure you pack the almond flour like you would with brown sugar!
  • Coconut flour: this is a great gluten free flour to help absorb moisture in recipes and also add fiber and nutrition. No need to pack the coconut flour though.
  • Finely shredded unsweetened coconut: in my opinion, this cake requires shredded coconut for texture. I haven’t made it without the shredded coconut so please don’t skip it, it’s crucial for texture.
  • Spices: no carrot cake is complete without the addition of cinnamon and a little nutmeg.
  • Vanilla extract: just an essential.
  • Eggs: this recipe uses four eggs to help with consistency and texture. I’ve added some notes below if you’re interested in making this vegan.
  • Pure maple syrup: WOW is all I can say. The maple syrup is just a nice touch to this recipe and adds so much flavor and additional moisture.
  • Tahini: while it’s only a small amount, the tahini is crucial to the recipe. I think you can add almond butter or cashew butter instead but tahini is INCREDIBLE and has a unique drippy texture, unlike other nut butters. Just trust me and make the cake as is!
  • Coconut oil: If you don’t want to use coconut oil, you can always use melted butter.
  • Almond milk: please know that any dairy free milk will work.
  • Carrots: this recipe uses 3 cups of grated carrots! I like small or medium grate for my carrot cake recipes.
  • Mix-ins: I love adding raisins and chopped pecans or chopped walnuts!

How to make paleo carrot cake

To make this carrot cake paleo and dairy free, simply use a dairy free cream cheese and a paleo friendly powdered sugar option. You can also use Simple Mills frosting.

ingredients for healthy carrot cake on a board

Can I make this cake vegan?

I haven’t tried making this healthy carrot cake vegan, but if you want to try you can use 4 flax eggs (4 tablespoons flaxseed meal + 12 tablespoons water). Let me know in the comments how it works out!

Can I use all purpose flour?

Unfortunately, no, I would not recommend using all purpose flour or any alternative flours in this recipe as the texture and consistency of the carrot cake will change.

healthy gluten free carrot cake on a cake stand

Tips for making this gluten free carrot cake

  1. Use medium grated carrots. You can grate the carrots in your food processor with the grate blade, or you can use a hand grater.
  2. Pack the almond flour. You’ll want to make sure you pack the almond flour just like you would with brown sugar. Do not pack the coconut flour.
  3. Use room temp ingredients: be sure to let the eggs come to room temperature before using them in the recipe, otherwise the coconut oil will coagulate the batter. The coconut oil should be melted but not HOT, but rather closer to room temperature.
  4. Make it ahead of time. You can make this cake 1-2 days ahead of time and it will still be absolutely delicious!

serving spatula pulling away a slice of healthy carrot cake from the full cake on a cake stand

Tricks for beautiful frosting

Frosting a whole cake can seem daunting, but with these couple of tips you’ll have a beautifully frosted healthy carrot cake in no time:

  1. Cool before frosting. Make sure you follow the directions as written and wait until the cakes are completely cool before frosting them. After they are frosted, I recommend storing carrot cake in the fridge for optimal freshness.
  2. Do a crumb coat. Do a crumb coat for the frosting first by frosting the layers as you normally would and then coat the outside of the cake with a very thin layer of frosting then place in the fridge for 10-15 minutes before you finish frosting. This is so that the crumbs stick to this layer of frosting and not your main layer.

How to store & freeze this healthy carrot cake

One of the best parts about this healthy carrot cake recipe is that you can make it 1-2 days ahead of time. I like to make the cakes ahead of time and keep them in the fridge for easy assembly, but you can also store it after you’ve frosted the cake, too!

  • To store: I recommend storing the cake covered in the refrigerator for up to 5 days.
  • To freeze: feel free to freeze this carrot cake either frosted or unfrosted for up to 2 months. I recommend freezing it unfrosted in individual layers for the best results. First, wrap each individual layer in plastic wrap, then aluminum foil and then place the cakes in a zip-top freezer bag. When you’re ready to serve it, simply thaw it in the refrigerator overnight and then let the cake come to room temperature before serving.

slice of gluten free carrot cake on a plate

Recommended tools

More cake recipes you’ll love

Get all of our amazing cake recipes here!

I know you’re going to love this healthy gluten free carrot cake, please let me know if you make it by leaving a comment and rating the recipe below. I’d love to hear from you and it helps encourage others to make the recipe too! xo.

P.S. feel free to listen to my cinnamon carrot cake playlist on spotify while you bake this!

The Best Healthy Carrot Cake You’ll Ever Eat (gluten free & paleo-friendly!)

healthy gluten free carrot cake on a cake stand

The BEST moist healthy carrot cake you’ll ever eat made with almond and coconut flour and naturally sweetened with pure maple syrup. Packed with coconut, raisins and pecans and topped with a delicious cream cheese frosting that’s easily dairy free! This paleo-friendly gluten free carrot cake will be your new favorite carrot cake recipe.

  • Dry Ingredients:
  • 2 cups packed super fine blanched almond flour (I use Bob’s Red Mill)
  • ½ cup coconut flour (do not pack)
  • ½ cup unsweetened finely shredded coconut (I use Bob’s Red Mill)
  • 1 teaspoon baking soda
  • 1 tablespoon ground cinnamon
  • ¼ teaspoon ground nutmeg
  • 1/2 teaspoon salt
  • Wet ingredients:
  • 4 large eggs, at room temperature
  • 3/4 cup pure maple syrup
  • 1/3 cup drippy tahini (or sub almond butter but tahini has better flavor for this cake!)
  • 1/4 cup unsweetened almond milk
  • 1 teaspoon vanilla extract
  • 1/3 cup melted and cooled coconut oil
  • 3 cups shredded carrots (medium grate)
  • Optional mix-ins:
  • ½ cup raisins
  • ½ cup chopped pecans or walnuts
  • For the frosting:
  • ½ cup salted butter, at room temperature (or sub vegan buttery stick)
  • 8 ounces cream cheese, at room temperature (or sub dairy free cream cheese)
  • 3 cups powdered sugar
  • 2 teaspoons pure vanilla extract
  • 1 tablespoon unsweetened almond milk (any milk will work)
  • For the topping:
  • Extra pecans and shredded coconut
  1. Preheat oven to 350 degrees F. Line the bottom of three 6-inch round cake pans or two 8-inch round cake pans with parchment paper rounds. Spray parchment paper and sides of pan with nonstick cooking spray. YOU SHOULD USE PARCHMENT PAPER or the cake is likely to stick. Please do not forget.
  2. In a large bowl, whisk the almond flour, coconut flour, unsweetened shredded coconut, baking soda, cinnamon, nutmeg and salt together. Set aside.
  3. In a large bowl, whisk together the eggs, pure maple syrup, tahini, almond milk, vanilla extract until smooth.
  4. Slowly whisk in the melted and cooled coconut oil until it’s well incorporated, then stir in the carrots. Note: It is important that your eggs are at room temperature otherwise the coconut oil with coagulate. The coconut oil should be melted but not HOT, but rather closer to room temp.
  5. Add dry ingredients to wet ingredients and mix with a wooden spoon until well combined. Stir in raisins and nuts, if using.
  6. Divide batter evenly between pans and spread out with a spatula to smooth the tops. Bake for 22-32 minutes in the two 8-inch pans and 30-40 minutes for three 6-inch pans.
  7. Cakes are done when a tester comes out clean or with just a few crumbs attached. Allow cake to cool completely before frosting or removing from the pans. The cake should be room temperature when you frost it. This is very important. Cakes can be made a day ahead if you’d like.
  8. Make your frosting: In the bowl of an electric mixer, add the softened butter and cream cheese and whip on high until light and fluffy. Add powdered sugar, vanilla extract and milk and beat for 2-3 minutes more.
  9. Now it’s time to frost the cake: place about 1 tablespoon down onto onto the cake stand and spread out. Invert cake onto the cake stand, add about ½ heaping cup frosting between each layer, repeat with each cake, then frost the top and sides of the cake with the remaining frosting.
  10. Decorate cake with pecans and shredded coconut on top. Once you are done frosting, place the cake to the fridge. Cake will stay good for 5-7 days in the fridge, and should be covered to ensure freshness. Serves 16.

To make dairy free/paleo: use vegan butter (I recommend Earth Balance) and a dairy free cream cheese such as Kite Hill. You may also need to use a paleo powdered sugar. You can also use Simple Mills Frosting as an alternative.

To make vegan: I haven’t tried making this cake vegan, but if you want to try you can use 4 flax eggs (4 tablespoons flaxseed meal + 12 tablespoons water).

How to store carrot cake: I recommend storing the cake covered in the refrigerator for up to 5 days. See the full post for freezing instructions!

Recipe by: Monique Volz // Ambitious Kitchen | Photography by: Eat Love Eats

This recipe was originally published on April 1, 2019, republished on April 6, 2020 and updated & republished again on March 26, 2021.

Shop This Post

Turn on your JavaScript to view content

Download My FREE 7-Day Meal Plan

Download My FREE 7-Day Meal Plan

Join the AK email list and get my brand new, FREE Simple & Nourishing 7-day Meal Plan delivered to your inbox.

pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length – 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label = o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? “Object is not iterable.” : “Symbol.iterator is not defined.”); } function __read$1(o, n) { var m = typeof Symbol === “function” && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n– > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i[“return”])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread$1() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i])); return ar; } var Operation = (function () { function Operation() { } return Operation; }()); var BernoulliTrial = (function (_super) { __extends$1(BernoulliTrial, _super); function BernoulliTrial(_probability) { var _this = _super.call(this) || this; _this._probability = _probability; return _this; } BernoulliTrial.prototype.get = function () { if (this._probability 1) { throw new Error(‘Invalid probability’); } return Math.random() = desktop) { return ‘desktop’; } if (width >= tablet) { return ‘tablet’; } return ‘phone’; }; var elementInnerWidth = function (element) { var width = element.clientWidth; if (getComputedStyle) { var cs = getComputedStyle(element, null); width -= parseFloat(cs.paddingLeft || ‘0’) + parseFloat(cs.paddingRight || ‘0’); } return width; }; var elementOffset = function (element) { var height = element.offsetHeight; var width = element.offsetWidth; var boundingClientRectangle = element.getBoundingClientRect(); var bodyEl = document.body; var docEl = document.documentElement; var scrollTop = window.pageYOffset || docEl.scrollTop || bodyEl.scrollTop; var scrollLeft = window.pageXOffset || docEl.scrollLeft || bodyEl.scrollLeft; var clientTop = docEl.clientTop || bodyEl.clientTop || 0; var clientLeft = docEl.clientLeft || bodyEl.clientLeft || 0; var top = Math.round(boundingClientRectangle.top + scrollTop – clientTop); var left = Math.round(boundingClientRectangle.left + scrollLeft – clientLeft); return { top: top, left: left, bottom: top + height, right: left + width, width: width, height: height, }; }; var getClsGlobal = function () { return window.adthriveCLS; }; var isDesktop = function () { return /Windows NT|Macintosh/i.test(navigator.userAgent); }; var validCssSelector = function (selector) { try { return { valid: true, elements: document.querySelectorAll(selector) }; } catch (err) { return __assign({ valid: false }, err); } }; var allowablePageSelector = function (selector) { if (selector === ”) { return { valid: true }; } return validCssSelector(selector); }; var ClsOptions = (function () { function ClsOptions() { this._clsGlobalData = getClsGlobal(); } Object.defineProperty(ClsOptions.prototype, “enabled”, { get: function () { return this._clsGlobalData && this._clsGlobalData.siteAds; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “siteAds”, { get: function () { return this._clsGlobalData.siteAds; }, set: function (data) { this._clsGlobalData.siteAds = data; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “disableAds”, { get: function () { return this._clsGlobalData.disableAds; }, set: function (data) { this._clsGlobalData.disableAds = data; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “enabledLocations”, { get: function () { return this._clsGlobalData.enabledLocations; }, set: function (data) { this._clsGlobalData.enabledLocations = data; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “injectedFromPlugin”, { get: function () { return this._clsGlobalData.injectedFromPlugin; }, set: function (status) { this._clsGlobalData.injectedFromPlugin = status; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “injectedFromSiteAds”, { get: function () { return this._clsGlobalData.injectedFromSiteAds; }, set: function (status) { this._clsGlobalData.injectedFromSiteAds = status; }, enumerable: false, configurable: true }); ClsOptions.prototype.setInjectedSlots = function (slot) { this._clsGlobalData.injectedSlots.push(slot); }; Object.defineProperty(ClsOptions.prototype, “injectedSlots”, { get: function () { return this._clsGlobalData.injectedSlots; }, enumerable: false, configurable: true }); ClsOptions.prototype.setInjectedScripts = function (script) { this._clsGlobalData.injectedScripts = this._clsGlobalData.injectedScripts || []; this._clsGlobalData.injectedScripts.push(script); }; Object.defineProperty(ClsOptions.prototype, “getInjectedScripts”, { get: function () { return this._clsGlobalData.injectedScripts; }, enumerable: false, configurable: true }); ClsOptions.prototype.setExperiment = function (key, val) { this._clsGlobalData.experiments = this._clsGlobalData.experiments || []; this._clsGlobalData.experiments[key] = val; }; ClsOptions.prototype.getExperiment = function (key) { return this._clsGlobalData.experiments && this._clsGlobalData.experiments[key]; }; Object.defineProperty(ClsOptions.prototype, “branch”, { get: function () { return this._clsGlobalData.branch; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “bucket”, { get: function () { return this._clsGlobalData.bucket; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “videoDisabledFromPlugin”, { get: function () { return this._clsGlobalData.videoDisabledFromPlugin; }, set: function (status) { this._clsGlobalData.videoDisabledFromPlugin = status; }, enumerable: false, configurable: true }); Object.defineProperty(ClsOptions.prototype, “targetDensityLog”, { get: function () { return this._clsGlobalData.targetDensityLog; }, set: function (data) { this._clsGlobalData.targetDensityLog = data; }, enumerable: false, configurable: true }); return ClsOptions; }()); var PluginExperiment = (function () { function PluginExperiment() { this._clsOptions = new ClsOptions(); } PluginExperiment.prototype.setExperimentKey = function () { this._clsOptions.setExperiment(this.key, this.result); }; return PluginExperiment; }()); var LightLogger = (function () { function LightLogger() { } LightLogger.prototype.info = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.info, className, methodName], args)); }; LightLogger.prototype.warn = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.warn, className, methodName], args)); }; LightLogger.prototype.error = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.error, className, methodName], args)); this.sendErrorLogToCommandQueue.apply(this, __spread$1([className, methodName], args)); }; LightLogger.prototype.event = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } this.info(className, methodName); }; LightLogger.prototype.sendErrorLogToCommandQueue = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } window.adthrive = window.adthrive || {}; window.adthrive.cmd = window.adthrive.cmd || []; window.adthrive.cmd.push((function () { if (window.adthrive.logError !== undefined && typeof window.adthrive.logError === ‘function’) { window.adthrive.logError(className, methodName, args); } }).bind(className, methodName, args)); }; LightLogger.prototype.call = function (logFunction, className, methodName) { var args = []; for (var _i = 3; _i 0 && typeof args[0] === ‘string’) { message.push(args.shift()); } params.push.apply(params, __spread$1(args)); try { Function.prototype.apply.call(logFunction, console, __spread$1([message.join(”)], params)); } catch (err) { console.error(err); return; } }; return LightLogger; }()); var logger$1 = new LightLogger(); var TargetDensityExperiment = (function (_super) { __extends$1(TargetDensityExperiment, _super); function TargetDensityExperiment() { var _this = _super.call(this) || this; _this._result = false; _this._choices = [{ choice: true }, { choice: false }]; _this.key = ‘adsp7’; logger$1.info(‘CLSTargetDensityExperiment’, ‘result siteAds.adDensityLayout’, _this._clsOptions, _this._clsOptions.siteAds, _this._clsOptions.siteAds.adDensityLayout); var adthriveCLSSiteAds = _this._clsOptions.siteAds; var adDensityEnabled = defaultTo(adthriveCLSSiteAds.adDensityEnabled, true); if (adthriveCLSSiteAds.adDensityLayout && adDensityEnabled) { logger$1.info(‘CLSTargetDensityExperiment’, ‘_result’, ‘Setting Experiment Value’); _this._result = _this.run(); _this.setExperimentKey(); } logger$1.info(‘CLSTargetDensityExperiment ‘, ‘result’, _this._result); return _this; } Object.defineProperty(TargetDensityExperiment.prototype, “result”, { get: function () { return this._result; }, enumerable: false, configurable: true }); TargetDensityExperiment.prototype.run = function () { return new BernoulliTrial(1).get(); }; return TargetDensityExperiment; }(PluginExperiment)); var VideoUtils = (function () { function VideoUtils() { } VideoUtils.getScrollTop = function () { return (window.pageYOffset || document.documentElement.scrollTop) – (document.documentElement.clientTop || 0); }; VideoUtils.shufflePlaylist = function (playlist) { var currentIndex = playlist.length; var tempValue; var randomIndex; while (0 !== currentIndex) { randomIndex = Math.floor(Math.random() * playlist.length); currentIndex -= 1; tempValue = playlist[currentIndex]; playlist[currentIndex] = playlist[randomIndex]; playlist[randomIndex] = tempValue; } return playlist; }; VideoUtils.playerInView = function (playerElement) { var boundingRect = playerElement.getBoundingClientRect(); return window.innerHeight > boundingRect.top + boundingRect.height / 2; }; VideoUtils.createQueryString = function (params) { return Object.keys(params) .map(function (key) { return key + “=” + params[key]; }) .join(‘&’); }; VideoUtils.createEncodedQueryString = function (params) { return Object.keys(params) .map(function (key) { return key + “=” + encodeURIComponent(params[key]); }) .join(‘&’); }; VideoUtils.setMobileLocation = function (mobileLocation) { mobileLocation = mobileLocation || ‘bottom-right’; if (mobileLocation === ‘top-left’) { mobileLocation = “adthrive-collapse-top-left” ; } else if (mobileLocation === ‘top-right’) { mobileLocation = “adthrive-collapse-top-right” ; } else if (mobileLocation === ‘bottom-left’) { mobileLocation = “adthrive-collapse-bottom-left” ; } else if (mobileLocation === ‘bottom-right’) { mobileLocation = “adthrive-collapse-bottom-right” ; } return mobileLocation; }; return VideoUtils; }()); var VideoAdOptions = (function () { function VideoAdOptions(_clsOptions) { this._clsOptions = _clsOptions; this.removeVideoTitleWrapper = defaultTo(this._clsOptions.siteAds.adOptions.removeVideoTitleWrapper, false); var videoPlayers = this._clsOptions.siteAds.videoPlayers; this.footerSelector = defaultTo(videoPlayers && videoPlayers.footerSelector, ”); this.players = defaultTo(videoPlayers && videoPlayers.players.map(function (player) { player.mobileLocation = VideoUtils.setMobileLocation(player.mobileLocation); return player; }), []); this.contextualSettings = videoPlayers && videoPlayers.contextual; } return VideoAdOptions; }()); var Video = (function () { function Video(clsOptions) { this.mobileStickyPlayerOnPage = false; this.playlistPlayerAdded = false; this.contextualPlayerAdded = false; this.sekindoPlayerAdded = false; this.footerSelector = ”; this.removeVideoTitleWrapper = false; this.videoAdOptions = new VideoAdOptions(clsOptions); this.players = this.videoAdOptions.players; this.contextualSettings = this.videoAdOptions.contextualSettings; this.removeVideoTitleWrapper = this.videoAdOptions.removeVideoTitleWrapper; this.footerSelector = this.videoAdOptions.footerSelector; } return Video; }()); var Config = (function () { function Config(clsOptions) { this.clsOptions = clsOptions; this.enabledLocations = [‘Below_Post’, ‘Content’, ‘Recipe’, ‘Sidebar’]; } return Config; }()); var commonjsGlobal = typeof globalThis !== ‘undefined’ ? globalThis : typeof window !== ‘undefined’ ? window : typeof global !== ‘undefined’ ? global : typeof self !== ‘undefined’ ? self : {}; var Reflect$1; (function (Reflect) { (function (factory) { var root = typeof commonjsGlobal === “object” ? commonjsGlobal : typeof self === “object” ? self : typeof this === “object” ? this : Function(“return this;”)(); var exporter = makeExporter(Reflect); if (typeof root.Reflect === “undefined”) { root.Reflect = Reflect; } else { exporter = makeExporter(root.Reflect, exporter); } factory(exporter); function makeExporter(target, previous) { return function (key, value) { if (typeof target[key] !== “function”) { Object.defineProperty(target, key, { configurable: true, writable: true, value: value }); } if (previous) previous(key, value); }; } })(function (exporter) { var hasOwn = Object.prototype.hasOwnProperty; var supportsSymbol = typeof Symbol === “function”; var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== “undefined” ? Symbol.toPrimitive : “@@toPrimitive”; var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== “undefined” ? Symbol.iterator : “@@iterator”; var supportsCreate = typeof Object.create === “function”; var supportsProto = { __proto__: [] } instanceof Array; var downLevel = !supportsCreate && !supportsProto; var HashMap = { create: supportsCreate ? function () { return MakeDictionary(Object.create(null)); } : supportsProto ? function () { return MakeDictionary({ __proto__: null }); } : function () { return MakeDictionary({}); }, has: downLevel ? function (map, key) { return hasOwn.call(map, key); } : function (map, key) { return key in map; }, get: downLevel ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } : function (map, key) { return map[key]; }, }; var functionPrototype = Object.getPrototypeOf(Function); var usePolyfill = typeof process === “object” && process.env && process.env[“REFLECT_METADATA_USE_MAP_POLYFILL”] === “true”; var _Map = !usePolyfill && typeof Map === “function” && typeof Map.prototype.entries === “function” ? Map : CreateMapPolyfill(); var _Set = !usePolyfill && typeof Set === “function” && typeof Set.prototype.entries === “function” ? Set : CreateSetPolyfill(); var _WeakMap = !usePolyfill && typeof WeakMap === “function” ? WeakMap : CreateWeakMapPolyfill(); var Metadata = new _WeakMap(); function decorate(decorators, target, propertyKey, attributes) { if (!IsUndefined(propertyKey)) { if (!IsArray(decorators)) throw new TypeError(); if (!IsObject(target)) throw new TypeError(); if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) throw new TypeError(); if (IsNull(attributes)) attributes = undefined; propertyKey = ToPropertyKey(propertyKey); return DecorateProperty(decorators, target, propertyKey, attributes); } else { if (!IsArray(decorators)) throw new TypeError(); if (!IsConstructor(target)) throw new TypeError(); return DecorateConstructor(decorators, target); } } exporter(“decorate”, decorate); function metadata(metadataKey, metadataValue) { function decorator(target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) throw new TypeError(); OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); } return decorator; } exporter(“metadata”, metadata); function defineMetadata(metadataKey, metadataValue, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); } exporter(“defineMetadata”, defineMetadata); function hasMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryHasMetadata(metadataKey, target, propertyKey); } exporter(“hasMetadata”, hasMetadata); function hasOwnMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); } exporter(“hasOwnMetadata”, hasOwnMetadata); function getMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryGetMetadata(metadataKey, target, propertyKey); } exporter(“getMetadata”, getMetadata); function getOwnMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); } exporter(“getOwnMetadata”, getOwnMetadata); function getMetadataKeys(target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryMetadataKeys(target, propertyKey); } exporter(“getMetadataKeys”, getMetadataKeys); function getOwnMetadataKeys(target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryOwnMetadataKeys(target, propertyKey); } exporter(“getOwnMetadataKeys”, getOwnMetadataKeys); function deleteMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); var metadataMap = GetOrCreateMetadataMap(target, propertyKey, false); if (IsUndefined(metadataMap)) return false; if (!metadataMap.delete(metadataKey)) return false; if (metadataMap.size > 0) return true; var targetMetadata = Metadata.get(target); targetMetadata.delete(propertyKey); if (targetMetadata.size > 0) return true; Metadata.delete(target); return true; } exporter(“deleteMetadata”, deleteMetadata); function DecorateConstructor(decorators, target) { for (var i = decorators.length – 1; i >= 0; –i) { var decorator = decorators[i]; var decorated = decorator(target); if (!IsUndefined(decorated) && !IsNull(decorated)) { if (!IsConstructor(decorated)) throw new TypeError(); target = decorated; } } return target; } function DecorateProperty(decorators, target, propertyKey, descriptor) { for (var i = decorators.length – 1; i >= 0; –i) { var decorator = decorators[i]; var decorated = decorator(target, propertyKey, descriptor); if (!IsUndefined(decorated) && !IsNull(decorated)) { if (!IsObject(decorated)) throw new TypeError(); descriptor = decorated; } } return descriptor; } function GetOrCreateMetadataMap(O, P, Create) { var targetMetadata = Metadata.get(O); if (IsUndefined(targetMetadata)) { if (!Create) return undefined; targetMetadata = new _Map(); Metadata.set(O, targetMetadata); } var metadataMap = targetMetadata.get(P); if (IsUndefined(metadataMap)) { if (!Create) return undefined; metadataMap = new _Map(); targetMetadata.set(P, metadataMap); } return metadataMap; } function OrdinaryHasMetadata(MetadataKey, O, P) { var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return true; var parent = OrdinaryGetPrototypeOf(O); if (!IsNull(parent)) return OrdinaryHasMetadata(MetadataKey, parent, P); return false; } function OrdinaryHasOwnMetadata(MetadataKey, O, P) { var metadataMap = GetOrCreateMetadataMap(O, P, false); if (IsUndefined(metadataMap)) return false; return ToBoolean(metadataMap.has(MetadataKey)); } function OrdinaryGetMetadata(MetadataKey, O, P) { var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return OrdinaryGetOwnMetadata(MetadataKey, O, P); var parent = OrdinaryGetPrototypeOf(O); if (!IsNull(parent)) return OrdinaryGetMetadata(MetadataKey, parent, P); return undefined; } function OrdinaryGetOwnMetadata(MetadataKey, O, P) { var metadataMap = GetOrCreateMetadataMap(O, P, false); if (IsUndefined(metadataMap)) return undefined; return metadataMap.get(MetadataKey); } function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { var metadataMap = GetOrCreateMetadataMap(O, P, true); metadataMap.set(MetadataKey, MetadataValue); } function OrdinaryMetadataKeys(O, P) { var ownKeys = OrdinaryOwnMetadataKeys(O, P); var parent = OrdinaryGetPrototypeOf(O); if (parent === null) return ownKeys; var parentKeys = OrdinaryMetadataKeys(parent, P); if (parentKeys.length <= 0) return ownKeys; if (ownKeys.length <= 0) return parentKeys; var set = new _Set(); var keys = []; for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { var key = ownKeys_1[_i]; var hasKey = set.has(key); if (!hasKey) { set.add(key); keys.push(key); } } for (var _a = 0, parentKeys_1 = parentKeys; _a = 0 && index = this._keys.length) { this._index = -1; this._keys = arraySentinel; this._values = arraySentinel; } else { this._index++; } return { value: result, done: false }; } return { value: undefined, done: true }; }; MapIterator.prototype.throw = function (error) { if (this._index >= 0) { this._index = -1; this._keys = arraySentinel; this._values = arraySentinel; } throw error; }; MapIterator.prototype.return = function (value) { if (this._index >= 0) { this._index = -1; this._keys = arraySentinel; this._values = arraySentinel; } return { value: value, done: true }; }; return MapIterator; }()); return (function () { function Map() { this._keys = []; this._values = []; this._cacheKey = cacheSentinel; this._cacheIndex = -2; } Object.defineProperty(Map.prototype, “size”, { get: function () { return this._keys.length; }, enumerable: true, configurable: true }); Map.prototype.has = function (key) { return this._find(key, false) >= 0; }; Map.prototype.get = function (key) { var index = this._find(key, false); return index >= 0 ? this._values[index] : undefined; }; Map.prototype.set = function (key, value) { var index = this._find(key, true); this._values[index] = value; return this; }; Map.prototype.delete = function (key) { var index = this._find(key, false); if (index >= 0) { var size = this._keys.length; for (var i = index + 1; i < size; i++) { this._keys[i – 1] = this._keys[i]; this._values[i – 1] = this._values[i]; } this._keys.length–; this._values.length–; if (key === this._cacheKey) { this._cacheKey = cacheSentinel; this._cacheIndex = -2; } return true; } return false; }; Map.prototype.clear = function () { this._keys.length = 0; this._values.length = 0; this._cacheKey = cacheSentinel; this._cacheIndex = -2; }; Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; Map.prototype[“@@iterator”] = function () { return this.entries(); }; Map.prototype[iteratorSymbol] = function () { return this.entries(); }; Map.prototype._find = function (key, insert) { if (this._cacheKey !== key) { this._cacheIndex = this._keys.indexOf(this._cacheKey = key); } if (this._cacheIndex < 0 && insert) { this._cacheIndex = this._keys.length; this._keys.push(key); this._values.push(undefined); } return this._cacheIndex; }; return Map; }()); function getKey(key, _) { return key; } function getValue(_, value) { return value; } function getEntry(key, value) { return [key, value]; } } function CreateSetPolyfill() { return (function () { function Set() { this._map = new _Map(); } Object.defineProperty(Set.prototype, “size”, { get: function () { return this._map.size; }, enumerable: true, configurable: true }); Set.prototype.has = function (value) { return this._map.has(value); }; Set.prototype.add = function (value) { return this._map.set(value, value), this; }; Set.prototype.delete = function (value) { return this._map.delete(value); }; Set.prototype.clear = function () { this._map.clear(); }; Set.prototype.keys = function () { return this._map.keys(); }; Set.prototype.values = function () { return this._map.values(); }; Set.prototype.entries = function () { return this._map.entries(); }; Set.prototype[“@@iterator”] = function () { return this.keys(); }; Set.prototype[iteratorSymbol] = function () { return this.keys(); }; return Set; }()); } function CreateWeakMapPolyfill() { var UUID_SIZE = 16; var keys = HashMap.create(); var rootKey = CreateUniqueKey(); return (function () { function WeakMap() { this._key = CreateUniqueKey(); } WeakMap.prototype.has = function (target) { var table = GetOrCreateWeakMapTable(target, false); return table !== undefined ? HashMap.has(table, this._key) : false; }; WeakMap.prototype.get = function (target) { var table = GetOrCreateWeakMapTable(target, false); return table !== undefined ? HashMap.get(table, this._key) : undefined; }; WeakMap.prototype.set = function (target, value) { var table = GetOrCreateWeakMapTable(target, true); table[this._key] = value; return this; }; WeakMap.prototype.delete = function (target) { var table = GetOrCreateWeakMapTable(target, false); return table !== undefined ? delete table[this._key] : false; }; WeakMap.prototype.clear = function () { this._key = CreateUniqueKey(); }; return WeakMap; }()); function CreateUniqueKey() { var key; do key = “@@[email protected]@” + CreateUUID(); while (HashMap.has(keys, key)); keys[key] = true; return key; } function GetOrCreateWeakMapTable(target, create) { if (!hasOwn.call(target, rootKey)) { if (!create) return undefined; Object.defineProperty(target, rootKey, { value: HashMap.create() }); } return target[rootKey]; } function FillRandomBytes(buffer, size) { for (var i = 0; i < size; ++i) buffer[i] = Math.random() * 0xff | 0; return buffer; } function GenRandomBytes(size) { if (typeof Uint8Array === “function”) { if (typeof crypto !== “undefined”) return crypto.getRandomValues(new Uint8Array(size)); if (typeof msCrypto !== “undefined”) return msCrypto.getRandomValues(new Uint8Array(size)); return FillRandomBytes(new Uint8Array(size), size); } return FillRandomBytes(new Array(size), size); } function CreateUUID() { var data = GenRandomBytes(UUID_SIZE); data[6] = data[6] & 0x4f | 0x40; data[8] = data[8] & 0xbf | 0x80; var result = “”; for (var offset = 0; offset < UUID_SIZE; ++offset) { var byte = data[offset]; if (offset === 4 || offset === 6 || offset === 8) result += “-“; if (byte = o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? “Object is not iterable.” : “Symbol.iterator is not defined.”); } function __read(o, n) { var m = typeof Symbol === “function” && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n– > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i[“return”])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } var INJECTION_TOKEN_METADATA_KEY = “injectionTokens”; function getParamInfo(target) { var params = Reflect.getMetadata(“design:paramtypes”, target) || []; var injectionTokens = Reflect.getOwnMetadata(INJECTION_TOKEN_METADATA_KEY, target) || {}; Object.keys(injectionTokens).forEach(function (key) { params[+key] = injectionTokens[key]; }); return params; } function isClassProvider(provider) { return !!provider.useClass; } function isFactoryProvider(provider) { return !!provider.useFactory; } var DelayedConstructor = (function () { function DelayedConstructor(wrap) { this.wrap = wrap; this.reflectMethods = [ “get”, “getPrototypeOf”, “setPrototypeOf”, “getOwnPropertyDescriptor”, “defineProperty”, “has”, “set”, “deleteProperty”, “apply”, “construct” ]; } DelayedConstructor.prototype.createProxy = function (createObject) { var _this = this; var target = {}; var init = false; var value; var delayedObject = function () { if (!init) { value = createObject(_this.wrap()); init = true; } return value; }; return new Proxy(target, this.createHandler(delayedObject)); }; DelayedConstructor.prototype.createHandler = function (delayedObject) { var handler = {}; var install = function (name) { handler[name] = function () { var args = []; for (var _i = 0; _i 0; }; RegistryBase.prototype.clear = function () { this._registryMap.clear(); }; RegistryBase.prototype.ensure = function (key) { if (!this._registryMap.has(key)) { this._registryMap.set(key, []); } }; return RegistryBase; }()); var Registry = (function (_super) { __extends(Registry, _super); function Registry() { return _super !== null && _super.apply(this, arguments) || this; } return Registry; }(RegistryBase)); var ResolutionContext = (function () { function ResolutionContext() { this.scopedResolutions = new Map(); } return ResolutionContext; }()); function formatDependency(params, idx) { if (params === null) { return “at position #” + idx; } var argName = params.split(“,”)[idx].trim(); return “”” + argName + “” at position #” + idx; } function composeErrorMessage(msg, e, indent) { if (indent === void 0) { indent = ” “; } return __spread([msg], e.message.split(“n”).map(function (l) { return indent + l; })).join(“n”); } function formatErrorCtor(ctor, paramIdx, error) { var _a = __read(ctor.toString().match(/constructor(([w, ]+))/) || [], 2), _b = _a[1], params = _b === void 0 ? null : _b; var dep = formatDependency(params, paramIdx); return composeErrorMessage(“Cannot inject the dependency ” + dep + ” of “” + ctor.name + “” constructor. Reason:”, error); } var PreResolutionInterceptors = (function (_super) { __extends(PreResolutionInterceptors, _super); function PreResolutionInterceptors() { return _super !== null && _super.apply(this, arguments) || this; } return PreResolutionInterceptors; }(RegistryBase)); var PostResolutionInterceptors = (function (_super) { __extends(PostResolutionInterceptors, _super); function PostResolutionInterceptors() { return _super !== null && _super.apply(this, arguments) || this; } return PostResolutionInterceptors; }(RegistryBase)); var Interceptors = (function () { function Interceptors() { this.preResolution = new PreResolutionInterceptors(); this.postResolution = new PostResolutionInterceptors(); } return Interceptors; }()); var typeInfo = new Map(); var InternalDependencyContainer = (function () { function InternalDependencyContainer(parent) { this.parent = parent; this._registry = new Registry(); this.interceptors = new Interceptors(); } InternalDependencyContainer.prototype.register = function (token, providerOrConstructor, options) { if (options === void 0) { options = { lifecycle: Lifecycle$1.Transient }; } var provider; if (!isProvider(providerOrConstructor)) { provider = { useClass: providerOrConstructor }; } else { provider = providerOrConstructor; } if (isTokenProvider(provider)) { var path = [token]; var tokenProvider = provider; while (tokenProvider != null) { var currentToken = tokenProvider.useToken; if (path.includes(currentToken)) { throw new Error(“Token registration cycle detected! ” + __spread(path, [currentToken]).join(” -> “)); } path.push(currentToken); var registration = this._registry.get(currentToken); if (registration && isTokenProvider(registration.provider)) { tokenProvider = registration.provider; } else { tokenProvider = null; } } } if (options.lifecycle === Lifecycle$1.Singleton || options.lifecycle == Lifecycle$1.ContainerScoped || options.lifecycle == Lifecycle$1.ResolutionScoped) { if (isValueProvider(provider) || isFactoryProvider(provider)) { throw new Error(“Cannot use lifecycle “” + Lifecycle$1[options.lifecycle] + “” with ValueProviders or FactoryProviders”); } } this._registry.set(token, { provider: provider, options: options }); return this; }; InternalDependencyContainer.prototype.registerType = function (from, to) { if (isNormalToken(to)) { return this.register(from, { useToken: to }); } return this.register(from, { useClass: to }); }; InternalDependencyContainer.prototype.registerInstance = function (token, instance) { return this.register(token, { useValue: instance }); }; InternalDependencyContainer.prototype.registerSingleton = function (from, to) { if (isNormalToken(from)) { if (isNormalToken(to)) { return this.register(from, { useToken: to }, { lifecycle: Lifecycle$1.Singleton }); } else if (to) { return this.register(from, { useClass: to }, { lifecycle: Lifecycle$1.Singleton }); } throw new Error(‘Cannot register a type name as a singleton without a “to” token’); } var useClass = from; if (to && !isNormalToken(to)) { useClass = to; } return this.register(from, { useClass: useClass }, { lifecycle: Lifecycle$1.Singleton }); }; InternalDependencyContainer.prototype.resolve = function (token, context) { if (context === void 0) { context = new ResolutionContext(); } var registration = this.getRegistration(token); if (!registration && isNormalToken(token)) { throw new Error(“Attempted to resolve unregistered dependency token: “” + token.toString() + “””); } this.executePreResolutionInterceptor(token, “Single”); if (registration) { var result = this.resolveRegistration(registration, context); this.executePostResolutionInterceptor(token, result, “Single”); return result; } if (isConstructorToken(token)) { var result = this.construct(token, context); this.executePostResolutionInterceptor(token, result, “Single”); return result; } throw new Error(“Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.”); }; InternalDependencyContainer.prototype.executePreResolutionInterceptor = function (token, resolutionType) { var e_1, _a; if (this.interceptors.preResolution.has(token)) { var remainingInterceptors = []; try { for (var _b = __values(this.interceptors.preResolution.getAll(token)), _c = _b.next(); !_c.done; _c = _b.next()) { var interceptor = _c.value; if (interceptor.options.frequency != “Once”) { remainingInterceptors.push(interceptor); } interceptor.callback(token, resolutionType); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } this.interceptors.preResolution.setAll(token, remainingInterceptors); } }; InternalDependencyContainer.prototype.executePostResolutionInterceptor = function (token, result, resolutionType) { var e_2, _a; if (this.interceptors.postResolution.has(token)) { var remainingInterceptors = []; try { for (var _b = __values(this.interceptors.postResolution.getAll(token)), _c = _b.next(); !_c.done; _c = _b.next()) { var interceptor = _c.value; if (interceptor.options.frequency != “Once”) { remainingInterceptors.push(interceptor); } interceptor.callback(token, result, resolutionType); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_2) throw e_2.error; } } this.interceptors.postResolution.setAll(token, remainingInterceptors); } }; InternalDependencyContainer.prototype.resolveRegistration = function (registration, context) { if (registration.options.lifecycle === Lifecycle$1.ResolutionScoped && context.scopedResolutions.has(registration)) { return context.scopedResolutions.get(registration); } var isSingleton = registration.options.lifecycle === Lifecycle$1.Singleton; var isContainerScoped = registration.options.lifecycle === Lifecycle$1.ContainerScoped; var returnInstance = isSingleton || isContainerScoped; var resolved; if (isValueProvider(registration.provider)) { resolved = registration.provider.useValue; } else if (isTokenProvider(registration.provider)) { resolved = returnInstance ? registration.instance || (registration.instance = this.resolve(registration.provider.useToken, context)) : this.resolve(registration.provider.useToken, context); } else if (isClassProvider(registration.provider)) { resolved = returnInstance ? registration.instance || (registration.instance = this.construct(registration.provider.useClass, context)) : this.construct(registration.provider.useClass, context); } else if (isFactoryProvider(registration.provider)) { resolved = registration.provider.useFactory(this); } else { resolved = this.construct(registration.provider, context); } if (registration.options.lifecycle === Lifecycle$1.ResolutionScoped) { context.scopedResolutions.set(registration, resolved); } return resolved; }; InternalDependencyContainer.prototype.resolveAll = function (token, context) { var _this = this; if (context === void 0) { context = new ResolutionContext(); } var registrations = this.getAllRegistrations(token); if (!registrations && isNormalToken(token)) { throw new Error(“Attempted to resolve unregistered dependency token: “” + token.toString() + “””); } this.executePreResolutionInterceptor(token, “All”); if (registrations) { var result_1 = registrations.map(function (item) { return _this.resolveRegistration(item, context); }); this.executePostResolutionInterceptor(token, result_1, “All”); return result_1; } var result = [this.construct(token, context)]; this.executePostResolutionInterceptor(token, result, “All”); return result; }; InternalDependencyContainer.prototype.isRegistered = function (token, recursive) { if (recursive === void 0) { recursive = false; } return (this._registry.has(token) || (recursive && (this.parent || false) && this.parent.isRegistered(token, true))); }; InternalDependencyContainer.prototype.reset = function () { this._registry.clear(); this.interceptors.preResolution.clear(); this.interceptors.postResolution.clear(); }; InternalDependencyContainer.prototype.clearInstances = function () { var e_3, _a; try { for (var _b = __values(this._registry.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = __read(_c.value, 2), token = _d[0], registrations = _d[1]; this._registry.setAll(token, registrations .filter(function (registration) { return !isValueProvider(registration.provider); }) .map(function (registration) { registration.instance = undefined; return registration; })); } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_3) throw e_3.error; } } }; InternalDependencyContainer.prototype.createChildContainer = function () { var e_4, _a; var childContainer = new InternalDependencyContainer(this); try { for (var _b = __values(this._registry.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = __read(_c.value, 2), token = _d[0], registrations = _d[1]; if (registrations.some(function (_a) { var options = _a.options; return options.lifecycle === Lifecycle$1.ContainerScoped; })) { childContainer._registry.setAll(token, registrations.map(function (registration) { if (registration.options.lifecycle === Lifecycle$1.ContainerScoped) { return { provider: registration.provider, options: registration.options }; } return registration; })); } } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_4) throw e_4.error; } } return childContainer; }; InternalDependencyContainer.prototype.beforeResolution = function (token, callback, options) { if (options === void 0) { options = { frequency: “Always” }; } this.interceptors.preResolution.set(token, { callback: callback, options: options }); }; InternalDependencyContainer.prototype.afterResolution = function (token, callback, options) { if (options === void 0) { options = { frequency: “Always” }; } this.interceptors.postResolution.set(token, { callback: callback, options: options }); }; InternalDependencyContainer.prototype.getRegistration = function (token) { if (this.isRegistered(token)) { return this._registry.get(token); } if (this.parent) { return this.parent.getRegistration(token); } return null; }; InternalDependencyContainer.prototype.getAllRegistrations = function (token) { if (this.isRegistered(token)) { return this._registry.getAll(token); } if (this.parent) { return this.parent.getAllRegistrations(token); } return null; }; InternalDependencyContainer.prototype.construct = function (ctor, context) { var _this = this; if (ctor instanceof DelayedConstructor) { return ctor.createProxy(function (target) { return _this.resolve(target, context); }); } var paramInfo = typeInfo.get(ctor); if (!paramInfo || paramInfo.length === 0) { if (ctor.length === 0) { return new ctor(); } else { throw new Error(“TypeInfo not known for “” + ctor.name + “””); } } var params = paramInfo.map(this.resolveParams(context, ctor)); return new (ctor.bind.apply(ctor, __spread([void 0], params)))(); }; InternalDependencyContainer.prototype.resolveParams = function (context, ctor) { var _this = this; return function (param, idx) { var _a, _b, _c; try { if (isTokenDescriptor(param)) { if (isTransformDescriptor(param)) { return param.multiple ? (_a = _this.resolve(param.transform)).transform.apply(_a, __spread([_this.resolveAll(param.token)], param.transformArgs)) : (_b = _this.resolve(param.transform)).transform.apply(_b, __spread([_this.resolve(param.token, context)], param.transformArgs)); } else { return param.multiple ? _this.resolveAll(param.token) : _this.resolve(param.token, context); } } else if (isTransformDescriptor(param)) { return (_c = _this.resolve(param.transform, context)).transform.apply(_c, __spread([_this.resolve(param.token, context)], param.transformArgs)); } return _this.resolve(param, context); } catch (e) { throw new Error(formatErrorCtor(ctor, idx, e)); } }; }; return InternalDependencyContainer; }()); new InternalDependencyContainer(); function injectable() { return function (target) { typeInfo.set(target, getParamInfo(target)); }; } if (typeof Reflect === “undefined” || !Reflect.getMetadata) { throw new Error(“tsyringe requires a reflect polyfill. Please add ‘import “reflect-metadata”‘ to the top of your entry point.”); } var Emitter = (function () { function Emitter() { this._listeners = new Set(); this._emitted = 0; } Emitter.prototype.on = function (listener) { var _this = this; this._listeners.add(listener); return function () { _this.off(listener); }; }; Emitter.prototype.off = function (listener) { this._listeners.delete(listener); }; Emitter.prototype.once = function () { var _this = this; return new Promise(function (resolve) { var off = _this.on(function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } off(); return resolve(args); }); }); }; Emitter.prototype.emit = function (value) { return __awaiter(this, void 0, void 0, function () { var _this = this; return __generator(this, function (_a) { return [2 , Promise.all(__spread$1(this._listeners).map(function (listener) { return listener(value); })).then(function (result) { _this._emitted++; return result; })]; }); }); }; Emitter.prototype.clear = function () { this._listeners.clear(); }; Object.defineProperty(Emitter.prototype, “count”, { get: function () { return this._listeners.size; }, enumerable: false, configurable: true }); Object.defineProperty(Emitter.prototype, “emitted”, { get: function () { return this._emitted; }, enumerable: false, configurable: true }); return Emitter; }()); var Logger = (function () { function Logger() { this.sending = new Emitter(); this.logQueue = []; this.supressedEventLogNames = new Map([[‘SlotRenderEnded’, ‘adImpression’]]); this.disableLogging = false; this.queueLogs = false; } Logger.prototype.init = function (adthrive) { this.logFilter = adthrive.loggerFilters || []; this.siteId = adthrive.siteAds.siteId; this.siteName = adthrive.siteAds.siteName; this.bucket = adthrive.bucket; this.branch = adthrive.branch; this.deployment = adthrive.deployment; this.debug = adthrive.debug; }; Logger.prototype.log = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.log, className, methodName], args)); }; Logger.prototype.info = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.info, className, methodName], args)); }; Logger.prototype.warn = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.warn, className, methodName], args)); }; Logger.prototype.error = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.error, className, methodName], args)); this.makeRequest.apply(this, __spread$1([‘send’, ‘error’, className, methodName], args)).catch(function (err) { console.error(err); }); }; Logger.prototype.event = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } var shouldLog = this.debug || !this.supressedEventLogNames.has(className) || this.supressedEventLogNames.get(className) !== methodName; if (shouldLog) { this.call.apply(this, __spread$1([console.log, className, methodName], args)); } this.makeRequest.apply(this, __spread$1([‘send’, ‘event’, className, methodName], args)).catch(function (err) { console.error(err); }); }; Logger.prototype.fetchEvent = function (className, methodName) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i – 2] = arguments[_i]; } this.call.apply(this, __spread$1([console.log, className, methodName], args)); this.makeRequest.apply(this, __spread$1([‘fetch’, ‘event’, className, methodName], args)).catch(function (err) { console.error(err); }); }; Logger.prototype.call = function (logFunction, className, methodName) { var args = []; for (var _i = 3; _i -1) { return; } var message = [“%c” + className + “::” + methodName + ” “]; var params = [‘color: #999; font-weight: bold;’]; if (args.length > 0 && typeof args[0] === ‘string’) { message.push(args.shift()); } params.push.apply(params, __spread$1(args)); try { Function.prototype.apply.call(logFunction, console, __spread$1([message.join(”)], params)); } catch (err) { console.error(err); return; } }; Logger.prototype.buildRequestUrl = function (type, className, methodName, args) { var baseUrl = “https://logger.adthrive.com/” + type; var message = [className + “::” + methodName + ” “]; if (args.length > 0 && typeof args[0] === ‘string’) { message.push(args.shift()); } var body = args.map(function (arg) { if (arg && arg.error) { arg = arg.error; } if (arg instanceof Error) { arg = { name: arg.name, message: arg.message, stack: arg.stack, }; } return arg; }); if (this.data) { body.push(this.data); } var payload = [ “siteId=” + encodeURIComponent(this.siteId || ”), “siteName=” + encodeURIComponent(this.siteName || ”), “bucket=” + encodeURIComponent(this.bucket || ”), “branch=” + encodeURIComponent(this.branch || ”), “deployment=” + encodeURIComponent(this.deployment || ”), “message=” + encodeURIComponent(message.join(”).trim()), “pageurl=” + encodeURIComponent(window.location.origin + window.location.pathname), “body=” + encodeURIComponent(JSON.stringify(body)), ]; return baseUrl + “?” + payload.join(‘&’); }; Logger.prototype.clearLogQueue = function (sendLogs) { var _this = this; this.info(‘Logger’, ‘gdprEnforcement’, ‘clearLogQueue’, sendLogs); if (sendLogs) { this.logQueue.forEach(function (log) { if (log.action === ‘send’) { _this.sendRequest.apply(_this, __spread$1([log.type, log.className, log.methodName], log.args)).catch(function () { }); } if (log.action === ‘fetch’) { _this.fetchRequest.apply(_this, __spread$1([log.type, log.className, log.methodName], log.args)).catch(function () { }); } }); } this.logQueue = []; this.queueLogs = false; }; Logger.prototype.makeRequest = function (action, type, className, methodName) { var args = []; for (var _i = 4; _i < arguments.length; _i++) { args[_i – 4] = arguments[_i]; } return __awaiter(this, void 0, void 0, function () { var log; return __generator(this, function (_a) { if (this.disableLogging) { this.info(‘Logger’, ‘gdprEnforcement’, ‘logging disabled’); return [2 , Promise.resolve(false)]; } if (this.queueLogs) { log = { action: action, type: type, className: className, methodName: methodName, args: args }; this.logQueue.push(log); this.info(‘Logger’, ‘gdprEnforcement’, ‘log queued’); return [2 , Promise.resolve(true)]; } if (action === ‘send’) { return [2 , this.sendRequest.apply(this, __spread$1([type, className, methodName], args))]; } else { return [2 , this.fetchRequest.apply(this, __spread$1([type, className, methodName], args))]; } }); }); }; Logger.prototype.sendRequest = function (type, className, methodName) { var args = []; for (var _i = 3; _i maxCloudFrontUrlSize) { return [2 , this.sendRequest(type, className, methodName, ‘Error query too large’).catch(function (err) { console.error(err); })]; } return [2 , new Promise(function (resolve, reject) { var request = new XMLHttpRequest(); request.open(‘get’, requestUrl); request.addEventListener(‘load’, function () { if (request.status !== 200) { return reject(new Error(“Logger send request failed ” + request.status)); } return resolve(request.responseText); }); request.addEventListener(‘error’, function () { return reject(new Error(‘Logger send request failed’)); }); request.send(); })]; }); }); }; Logger.prototype.fetchRequest = function (type, className, methodName) { var args = []; for (var _i = 3; _i < arguments.length; _i++) { args[_i – 3] = arguments[_i]; } return __awaiter(this, void 0, void 0, function () { var requestUrl; return __generator(this, function (_a) { this.sending.emit().catch(function () { }); requestUrl = this.buildRequestUrl(type, className, methodName, args); return [2 , fetch(requestUrl, { method: ‘GET’, keepalive: true, referrerPolicy: ‘no-referrer-when-downgrade’ })]; }); }); }; Logger = __decorate([ injectable() ], Logger); return Logger; }()); var logger = new Logger(); var addBodyClass = function (device) { var body = document.body; var className = “adthrive-device-” + device; if (!body.classList.contains(className)) { try { body.classList.add(className); } catch (err) { logger.error(‘BodyDeviceClassComponent’, ‘init’, { message: err.message }); var support = ‘classList’ in document.createElement(‘_’); logger.error(‘BodyDeviceClassComponent’, ‘init.support’, { support: support }); } } }; var DensityDevice; (function (DensityDevice) { DensityDevice[“Desktop”] = “desktop”; DensityDevice[“Mobile”] = “mobile”; })(DensityDevice || (DensityDevice = {})); var RemoveLargeSizeExperiment = (function (_super) { __extends$1(RemoveLargeSizeExperiment, _super); function RemoveLargeSizeExperiment() { var _this = _super.call(this) || this; _this._result = false; _this._choices = [{ choice: true }, { choice: false }]; _this.key = ‘smhd100’; _this._result = _this.run(); _this.setExperimentKey(); logger$1.info(‘CLSRemoveLargeSizeExperiment’, ‘result’, _this._result); return _this; } Object.defineProperty(RemoveLargeSizeExperiment.prototype, “result”, { get: function () { return this._result; }, enumerable: false, configurable: true }); RemoveLargeSizeExperiment.prototype.run = function () { return new BernoulliTrial(0.1).get(); }; return RemoveLargeSizeExperiment; }(PluginExperiment)); var supportedSizes = [ [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], ]; var adUnitAuctionPriorityMap = new Map([ [‘Footer’, 1], [‘Header’, 2], [‘Sidebar’, 3], [‘Content’, 4], [‘Recipe’, 5], [‘Sidebar_sticky’, 6], [‘Below Post’, 7], ]); var getDynamicAds = function (device, adUnits) { var removeLargeSizeExperiment = new RemoveLargeSizeExperiment(); return adUnits .filter(function (adUnit) { return adUnit.dynamic !== undefined && adUnit.dynamic.enabled; }) .map(function (adUnit) { var location = adUnit.location.replace(/s+/g, ‘_’); return { auctionPriority: adUnitAuctionPriorityMap.get(location) || 8, location: location, sequence: defaultTo(adUnit.sequence, 1), sizes: onlySupportedAdSizes(adUnit.adSizes).filter(function (size) { return excludeTallSizeFromHeaderFooter(adUnit.location, size, device, removeLargeSizeExperiment); }), devices: adUnit.devices, pageSelector: defaultTo(adUnit.dynamic.pageSelector, ”).trim(), elementSelector: defaultTo(adUnit.dynamic.elementSelector, ”).trim(), position: defaultTo(adUnit.dynamic.position, ‘beforebegin’), min: Math.floor(defaultTo(adUnit.dynamic.min, 0)), max: Math.floor(defaultTo(adUnit.dynamic.max, 0)), spacing: defaultTo(adUnit.dynamic.spacing, 0), skip: Math.floor(defaultTo(adUnit.dynamic.skip, 0)), every: Math.max(Math.floor(defaultTo(adUnit.dynamic.every, 1)), 1), classNames: adUnit.dynamic.classNames || [], sticky: adUnit.location === ‘Footer’ ? true : adUnit.sticky, stickyOverlapSelector: defaultTo(adUnit.stickyOverlapSelector, ”).trim(), autosize: adUnit.autosize, special: defaultTo(adUnit.targeting, []) .filter(function (targeting) { return targeting.key === ‘special’; }) .reduce(function (values, targeting) { return values.concat.apply(values, __spread$1(targeting.value)); }, []), lazy: defaultTo(adUnit.dynamic.lazy, false), lazyMax: defaultTo(adUnit.dynamic.lazyMax, 2), lazyMaxDefaulted: adUnit.dynamic.lazyMax === 0 ? false : !adUnit.dynamic.lazyMax, }; }); }; var filterAdUnitSizes = function (dynamicAd, element) { var width = elementInnerWidth(element); var stickySidebar = dynamicAd.sticky && dynamicAd.location === ‘Sidebar’; return dynamicAd.sizes.filter(function (size) { var autosize = dynamicAd.autosize ? size[0] <= width || size[0] <= 320 : true; var stickyFit = stickySidebar ? size[1] 100 && removeLargeSizeExperiment.result)); }; var slotMinHeight = ‘250px’; var ClsDynamicAdsInjector = (function () { function ClsDynamicAdsInjector(_clsOptions, targetDensityExperiment) { this._clsOptions = _clsOptions; this.targetDensityExperiment = targetDensityExperiment; this._totalContentInserted = 0; this._recipeCount = 0; this._mainContentHeight = 0; this._mainContentDiv = null; this._firstContentDiv = null; this._totalAvailableElements = 0; this._minDivHeight = 250; this._densityDevice = DensityDevice.Desktop; this._pubLog = { onePerViewport: false, targetDensity: 0, targetDensityUnits: 0, combinedMax: 0 }; this._densityMax = 0.99; this._infPageEndOffset = 0; this.locationMaxLazySequence = new Map([ [‘Recipe’, 5], [‘Below_Post’, 1], ]); this.locationToMinHeight = { Below_Post: slotMinHeight, Content: slotMinHeight, Recipe: slotMinHeight, Sidebar: slotMinHeight, }; var _a = this._clsOptions.siteAds.breakpoints, tablet = _a.tablet, desktop = _a.desktop; this._device = deviceByBreakpoint(tablet, desktop); this._config = new Config(_clsOptions); this._clsOptions.enabledLocations = this._config.enabledLocations; } ClsDynamicAdsInjector.prototype.start = function () { var _this = this; try { addBodyClass(this._device); var dynamicAds = getDynamicAds(this._device, this._clsOptions.siteAds.adUnits) .filter(function (dynamicAd) { return _this._locationEnabled(dynamicAd); }) .filter(function (dynamicAd) { return forDevice(dynamicAd, _this._device); }) .filter(function (dynamicAd) { return forPage(dynamicAd); }); var dynamicSlots = this.inject(dynamicAds); dynamicSlots.forEach(function (slot) { return _this._clsOptions.setInjectedSlots(slot); }); } catch (error) { logger$1.error(‘ClsDynamicAdsInjector’, ‘start’, error); } }; ClsDynamicAdsInjector.prototype.inject = function (dynamicAds, target) { if (target === void 0) { target = document; } var targetDensityEnabled = this.targetDensityExperiment.result; var nonDensitySlots = dynamicAds.filter(function (dynamicAd) { return (targetDensityEnabled ? dynamicAd.location !== ‘Content’ : dynamicAd); }); var densitySlots = dynamicAds.filter(function (dynamicAd) { return (targetDensityEnabled ? dynamicAd.location === ‘Content’ : null); }); return __spread$1((nonDensitySlots.length ? this._injectNonDensitySlots(nonDensitySlots, target) : []), (densitySlots.length ? this._injectDensitySlots(densitySlots, target) : [])); }; ClsDynamicAdsInjector.prototype._injectNonDensitySlots = function (dynamicAds, target) { var e_1, _a; var _this = this; if (target === void 0) { target = document; } var slots = []; var insertedElements = []; try { for (var dynamicAds_1 = __values$1(dynamicAds), dynamicAds_1_1 = dynamicAds_1.next(); !dynamicAds_1_1.done; dynamicAds_1_1 = dynamicAds_1.next()) { var dynamicAd = dynamicAds_1_1.value; var spacing = 0; var nextAfter = 0; var totalAds = 0; if (dynamicAd.spacing > 0) { spacing = window.innerHeight * dynamicAd.spacing; nextAfter = spacing; } var repeatedDynamicAds = this._repeatDynamicAds(dynamicAd); var elements = this.getElements(dynamicAd.elementSelector, target); logger$1.info(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, dynamicAd.location + ” – Found ” + elements.length + ” elements for selector ” + dynamicAd.pageSelector + ” ” + dynamicAd.elementSelector, dynamicAd); if (dynamicAd.skip > 0) { logger$1.info(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, ‘Skipping %d element(s)’, dynamicAd.skip); } for (var elementIndex = dynamicAd.skip; elementIndex repeatedDynamicAds.length) { logger$1.info(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, ‘Max ads displayed %d’, totalAds); break; } var element = elements[elementIndex]; if (spacing > 0) { var bottom = elementOffset(element).bottom; if (bottom %d)’, bottom, nextAfter); nextAfter = bottom + spacing; } var min = elementIndex 1) { logger$1.info(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, ‘Attempting to add %d extra to satisfy the minimum’, min – 1); spacing = 0; } var _loop_1 = function () { var repeatedDynamicAd = repeatedDynamicAds[totalAds]; var name_1 = repeatedDynamicAd.location + “_” + repeatedDynamicAd.sequence; if (slots.some(function (slot) { return slot.name === name_1; })) { totalAds += 1; logger$1.warn(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, “Skipping duplicate slot ” + name_1); return “continue”; } var dynamicElementId = this_1.getDynamicElementId(repeatedDynamicAd); var locationClassName = “adthrive-” + dynamicAd.location.replace(‘_’, ‘-‘).toLowerCase(); var locationSequenceClassName = locationClassName + “-” + dynamicAd.sequence; var classNames = __spread$1([locationClassName, locationSequenceClassName], dynamicAd.classNames); var dynamicElement = this_1.addAd(element, dynamicElementId, dynamicAd.position, classNames); if (dynamicElement) { var sizes = filterAdUnitSizes(repeatedDynamicAd, dynamicElement); if (sizes.length) { var slotDataObj = { clsDynamicAd: dynamicAd, dynamicAd: repeatedDynamicAd, element: dynamicElement, sizes: sizes, name: name_1, infinite: target !== document, }; slots.push(slotDataObj); insertedElements.push({ location: repeatedDynamicAd.location, element: dynamicElement }); if (dynamicAd.location === ‘Recipe’) { ++this_1._recipeCount; } totalAds += 1; } else { logger$1.info(‘ClsDynamicAdsInjector’, ‘injectNonDensitySlots’, “Skipped ad unit ” + repeatedDynamicAd.location + “_” + repeatedDynamicAd.sequence + “. It does not fit in the element.”); } element = dynamicElement; } }; var this_1 = this; for (; min > 0; min–) { _loop_1(); } } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (dynamicAds_1_1 && !dynamicAds_1_1.done && (_a = dynamicAds_1.return)) _a.call(dynamicAds_1); } finally { if (e_1) throw e_1.error; } } insertedElements.forEach(function (_a) { var location = _a.location, element = _a.element; element.style.minHeight = _this.locationToMinHeight[location]; }); return slots; }; ClsDynamicAdsInjector.prototype._shouldTargetAllElgibile = function (density) { return density === this._densityMax; }; ClsDynamicAdsInjector.prototype._injectDensitySlots = function (dynamicAds, target) { var e_2, _a; var _this = this; if (target === void 0) { target = document; } try { this._calculateMainContentHeightAndAllElements(dynamicAds); } catch (e) { logger$1.warn(‘ClsDynamicAdsInjector’, ‘injectDensitySlots’, e); return []; } this._densityDevice = this._device === ‘desktop’ ? DensityDevice.Desktop : DensityDevice.Mobile; var slots = []; var _b = this._getDensitySettings(), targetDensity = _b.adDensity, onePerViewport = _b.onePerViewport; var targetAll = this._shouldTargetAllElgibile(targetDensity); var targetDensityUnits = this._getTargetDensityUnits(targetDensity); var combinedMax = this._getCombinedMax(dynamicAds); var numberOfUnits = Math.min.apply(Math, __spread$1([this._totalAvailableElements, targetDensityUnits], (combinedMax > 0 ? [combinedMax] : []))); this._pubLog = { onePerViewport: onePerViewport, targetDensity: targetDensity, targetDensityUnits: targetDensityUnits, combinedMax: combinedMax }; if (!numberOfUnits) { logger$1.warn(‘ClsDynamicAdsInjector’, ‘injectDensitySlots’, ‘No Content Units To Inject’, __assign(__assign({}, this._pubLog), { mainContentDiv: this._mainContentDiv, mainContentHeight: this._mainContentHeight, totalAvailableElements: this._totalAvailableElements })); return []; } var contentInsertedThisPage = 0; var insertNext = 0; var _loop_2 = function (dynamicAd) { var elements = this_2.getElements(dynamicAd.elementSelector, target); var insertEvery = this_2._getInsertEvery(numberOfUnits, onePerViewport); this_2._logDensityInfo(elements, dynamicAd.elementSelector, insertEvery); var dynamicInsertion = function (element) { var _a; var slot = null; var adElement = null; (_a = _this._attemptInsertion({ dynamicAd: dynamicAd, element: element, insertNext: insertNext, onePerViewport: onePerViewport, contentInsertedThisPage: contentInsertedThisPage, target: target, insertEvery: insertEvery, targetAll: targetAll, }), insertNext = _a.insertNext, slot = _a.slot, adElement = _a.adElement); if (slot && adElement) { slots.push(slot); ++contentInsertedThisPage; adElement.style.minHeight = _this.locationToMinHeight[dynamicAd.location]; } }; if (dynamicAd.skip > 0) { logger$1.info(‘ClsDynamicAdsInjector’, ‘_injectDensitySlots’, ‘Skipping %d element(s)’, dynamicAd.skip); } for (var t = dynamicAd.skip; t = this_2._mainContentHeight && this_2._totalAvailableElements > 1) { continue; } else if (contentInsertedThisPage < combinedMax && contentInsertedThisPage = Number of Units to Inject, breaking’); break; } } }; var this_2 = this; try { for (var dynamicAds_2 = __values$1(dynamicAds), dynamicAds_2_1 = dynamicAds_2.next(); !dynamicAds_2_1.done; dynamicAds_2_1 = dynamicAds_2.next()) { var dynamicAd = dynamicAds_2_1.value; _loop_2(dynamicAd); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (dynamicAds_2_1 && !dynamicAds_2_1.done && (_a = dynamicAds_2.return)) _a.call(dynamicAds_2); } finally { if (e_2) throw e_2.error; } } logger$1.info(‘ClsDynamicAdsInjector’, ‘_injectDensitySlots’, ‘Ad Density: contentInsertedThisPage’, contentInsertedThisPage); return slots; }; ClsDynamicAdsInjector.prototype._getInsertEvery = function (numberOfUnits, onePerViewport) { var trimContentFraction = 0.43; var insert = (this._mainContentHeight * trimContentFraction) / numberOfUnits; return onePerViewport && window.innerHeight > insert ? window.innerHeight : insert; }; ClsDynamicAdsInjector.prototype._getDensitySettings = function () { var densitySettings = this._clsOptions.siteAds.adDensityLayout; var overrides = this._determineOverrides(densitySettings.pageOverrides); return overrides.length ? overrides[0] : densitySettings[this._densityDevice]; }; ClsDynamicAdsInjector.prototype._determineOverrides = function (pageOverrides) { var _this = this; return pageOverrides .filter(function (pageOverride) { var selector = allowablePageSelector(pageOverride.pageSelector); return pageOverride.pageSelector === ” || (selector.elements && selector.elements.length); }) .map(function (pageOverride) { return pageOverride[_this._densityDevice]; }); }; ClsDynamicAdsInjector.prototype._getTargetDensityUnits = function (targetDensity) { return Math.floor((targetDensity * this._mainContentHeight) / (1 – targetDensity) / this._minDivHeight) – this._recipeCount; }; ClsDynamicAdsInjector.prototype._getCombinedMax = function (dynamicAds) { return defaultTo(dynamicAds .filter(function (dynamicAd) { var el; try { el = document.querySelector(dynamicAd.elementSelector); } catch (err) { logger$1.info(‘ClsDynamicAdsInjector’, ‘_getCombinedMax’, ‘Invalid Query Selector: ‘, dynamicAd.elementSelector); } return el; }) .map(function (dynamicAd) { return dynamicAd.max + (dynamicAd.lazyMaxDefaulted ? 0 : dynamicAd.lazyMax); }) .sort(function (a, b) { return b – a; })[0], 0); }; ClsDynamicAdsInjector.prototype._logDensityInfo = function (elements, elementSelector, insertEvery) { var _a = this._pubLog, onePerViewport = _a.onePerViewport, targetDensity = _a.targetDensity, targetDensityUnits = _a.targetDensityUnits, combinedMax = _a.combinedMax; logger$1.info(‘ClsDynamicAdsInjector’, ‘_logDensityInfo’, ‘Ad Density: Top Level Report’, “nOnePerViewport: ” + onePerViewport, “nTarget Density: ” + targetDensity, “nMain Content Height ” + this._mainContentHeight + “px”, “nRecipe Units: ” + this._recipeCount, “nAvailable Elements based on Selectors: ” + elements.length, “nNumber of Units to Hit Density: ” + targetDensityUnits, “nNumber of pixels between each ad (relevant for onePerViewport setting): ” + insertEvery + “px”, “nCombined max calculated from Admin Dash: ” + combinedMax, ‘nElement Selector: ‘, elementSelector, ‘nActual elements we are working with: ‘, elements); if (this._totalAvailableElements = Math.max(dynamicAd.min, dynamicAd.max) }); (_b = this._addContentAd(element, dynamicAd, newDynamicAd, target, insertEvery), slot = _b.insertedSlot, insertNext = _b.insertNext, adElement = _b.adElement); } return { insertNext: insertNext, slot: slot, adElement: adElement }; }; ClsDynamicAdsInjector.prototype._isElementSpacedCorrectly = function (element, insertNext, onePerViewport, dynamicAd, targetAll, insertEvery) { var shouldInsertAtTop = dynamicAd.position === ‘beforebegin’ || dynamicAd.position === ‘afterbegin’; var isFarEnoughFromPreviousInjection = targetAll || this._isElementFarEnough(onePerViewport, element, insertNext, shouldInsertAtTop, insertEvery); var isNotInSameRowAsNextElement = this._isElementNotInRow(element, shouldInsertAtTop); var isElementSpacedCorrectly = isFarEnoughFromPreviousInjection && isNotInSameRowAsNextElement; if (isElementSpacedCorrectly) { this._lastElement = element; this._lastAdPosition = dynamicAd.position === ‘beforebegin’ || dynamicAd.position === ‘afterbegin’ ? ‘top’ : ‘bottom’; } logger$1.info(‘ClsDynamicAdsInjector’, ‘_isElementSpacedCorrectly’, ‘Ad Density: _isElementSpacedCorrectly’, element, isElementSpacedCorrectly); return isElementSpacedCorrectly; }; ClsDynamicAdsInjector.prototype._getMinimumSpacingByLastInjection = function (insertEvery) { return this._lastAdPosition && this._lastAdPosition === ‘bottom’ && insertEvery insertNext && (lastOffset === 0 || elementEdge – lastOffset >= insertEvery + spacing); if (!onePerViewport && !isFarEnough) { logger$1.info(‘ClsDynamicAdsInjector’, ‘_isElementFarEnough’, “Ad Density: The onePerViewport setting is false, and the element edge at ” + elementEdge + “px is less than our next minimum insertion point located at ” + insertNext + “.”, element); } return isFarEnough; }; ClsDynamicAdsInjector.prototype._isElementNotInRow = function (element, shouldInsertAtTop) { var prevSibling = element.previousElementSibling; var nextSibling = element.nextElementSibling; var sibling = shouldInsertAtTop ? (!prevSibling && nextSibling) || (prevSibling && element.tagName !== prevSibling.tagName) ? nextSibling : prevSibling : nextSibling; return sibling && element.getBoundingClientRect().height === 0 ? true : sibling ? element.getBoundingClientRect().top !== sibling.getBoundingClientRect().top : true; }; ClsDynamicAdsInjector.prototype._calculateMainContentHeightAndAllElements = function (dynamicAds) { var _a = this._setMainContentAndElements(dynamicAds), mainContentDiv = _a.mainContentDiv, firstContentDiv = _a.firstContentDiv; this._mainContentDiv = mainContentDiv; this._firstContentDiv = firstContentDiv; var commentElem = this._mainContentDiv.querySelector(‘div #comments, section .comments’); this._mainContentHeight = commentElem ? this._mainContentDiv.offsetHeight – commentElem.offsetHeight : this._mainContentDiv.offsetHeight; }; ClsDynamicAdsInjector.prototype._setMainContentAndElements = function (dynamicAds) { var potentialMainContentElements = this._getPotentialElements(dynamicAds); if (potentialMainContentElements.length === 0) { throw Error(‘No Main Content Elements Found’); } var mainContentDiv = Array.from(potentialMainContentElements).reduce(function (previous, current) { return (current.offsetHeight > previous.offsetHeight ? current : previous); }) || document.body; var firstContentDiv = Array.from(potentialMainContentElements).reduce(function (previous, current) { return elementOffset(current).top < elementOffset(previous).top ? current : previous; }); return { mainContentDiv: mainContentDiv, firstContentDiv: firstContentDiv }; }; ClsDynamicAdsInjector.prototype._getPotentialElements = function (dynamicAds) { var _this = this; var article = this._attemptArticleLookup(); var potentialMainContentElements = article ? [article] : []; dynamicAds.forEach(function (dynamicAd) { return _this._getSelectors(dynamicAd.elementSelector).forEach(function (selector) { var els = document.querySelectorAll(selector); for (var k = 0; k previous.offsetHeight ? current : previous); }); var oneAndAHalfViewports = 1.5; if (content && content.offsetHeight > window.innerHeight * oneAndAHalfViewports) { logger$1.info(‘ClsDynamicAdsInjector’, ‘_attemptArticleLookup’, ‘mainContent’, content.offsetHeight, content); return content; } return null; }; ClsDynamicAdsInjector.prototype._getSelectors = function (elementSelector) { return elementSelector.indexOf(‘,’) > -1 ? elementSelector.split(‘,’) : [elementSelector]; }; ClsDynamicAdsInjector.prototype._addContentAd = function (element, dynamicAd, newDynamicAd, target, insertEvery) { if (target === void 0) { target = document; } var insertedSlot = null; var locationClassName = “adthrive-” + dynamicAd.location.replace(‘_’, ‘-‘).toLowerCase(); var locationSequenceClassName = locationClassName + “-” + dynamicAd.sequence; var adElement = this.addAd(element, this.getDynamicElementId(newDynamicAd), newDynamicAd.position, __spread$1([ locationClassName, locationSequenceClassName ], dynamicAd.classNames)); var insertNext = this._getNextInsertPosition(newDynamicAd.position, adElement, insertEvery); if (adElement) { var sizes = filterAdUnitSizes(newDynamicAd, adElement); if (sizes.length) { var name_2 = newDynamicAd.location + “_” + newDynamicAd.sequence; insertedSlot = { clsDynamicAd: dynamicAd, dynamicAd: newDynamicAd, element: adElement, sizes: sizes, name: name_2, infinite: target !== document, }; ++this._totalContentInserted; } else { logger$1.info(‘ClsDynamicAdsInjector’, ‘_addContentAd’, ‘Skipped ad unit….. It does not fit in the element.’); } } return { insertedSlot: insertedSlot, insertNext: insertNext, adElement: adElement }; }; ClsDynamicAdsInjector.prototype._getNextInsertPosition = function (position, element, insertEvery) { var rect = element.getBoundingClientRect(); var pageHeight = window.pageYOffset; var pos = (position === ‘beforebegin’ || position === ‘afterbegin’ ? rect.top : rect.bottom) + pageHeight; return pos + insertEvery + this._minDivHeight; }; ClsDynamicAdsInjector.prototype.getDynamicElementId = function (dynamicAd) { var gamPrefix = ‘AdThrive’; return gamPrefix + “_” + dynamicAd.location + “_” + dynamicAd.sequence + “_” + this._device; }; ClsDynamicAdsInjector.prototype.getElements = function (selector, target) { if (target === void 0) { target = document; } return target.querySelectorAll(selector); }; ClsDynamicAdsInjector.prototype.addAd = function (element, id, position, classNames) { if (classNames === void 0) { classNames = []; } if (!document.getElementById(id)) { var tag = “]]>”; element.insertAdjacentHTML(position, tag); } return document.getElementById(id); }; ClsDynamicAdsInjector.prototype._repeatDynamicAds = function (dynamicAd) { var repeatedDynamicAds = []; var maxLazySequence = dynamicAd.lazy ? defaultTo(this.locationMaxLazySequence.get(dynamicAd.location), 0) : 0; var initialMax = Math.max(dynamicAd.min, dynamicAd.max); var lazyMax = maxLazySequence === 0 && dynamicAd.lazy ? initialMax + dynamicAd.lazyMax : Math.min(Math.max(maxLazySequence – dynamicAd.sequence + 1, 0), initialMax + dynamicAd.lazyMax); var max = Math.max(initialMax, lazyMax); for (var dynamicSequence = 0; dynamicSequence = initialMax; repeatedDynamicAds.push(__assign(__assign({}, dynamicAd), { sequence: sequence, lazy: lazy })); } return repeatedDynamicAds; }; ClsDynamicAdsInjector.prototype._locationEnabled = function (dynamicAdUnit) { var clsEnabledLocation = this._clsOptions.enabledLocations.indexOf(dynamicAdUnit.location) !== -1; var allLocationsDisabled = (this._clsOptions.disableAds && this._clsOptions.disableAds.all) || document.body.classList.contains(‘adthrive-disable-all’); var contentEnabled = !document.body.classList.contains(‘adthrive-disable-content’) && !this._clsOptions.disableAds.reasons.has(‘content_plugin’); return clsEnabledLocation && !allLocationsDisabled && contentEnabled; }; return ClsDynamicAdsInjector; }()); var VideoAdUnit; (function (VideoAdUnit) { VideoAdUnit[“Video_Collapse_Autoplay_SoundOff”] = “Video_Collapse_Autoplay_SoundOff”; VideoAdUnit[“Video_Individual_Autoplay_SOff”] = “Video_Individual_Autoplay_SOff”; VideoAdUnit[“Video_Coll_SOff_Smartphone”] = “Video_Coll_SOff_Smartphone”; VideoAdUnit[“Video_In_Post_ClicktoPlay_SoundOn”] = “Video_In-Post_ClicktoPlay_SoundOn”; })(VideoAdUnit || (VideoAdUnit = {})); var PinterestReplacedPlayer; (function (PinterestReplacedPlayer) { PinterestReplacedPlayer[“StickySekindo”] = “stickySekindo”; PinterestReplacedPlayer[“StaticSekindo”] = “staticSekindo”; PinterestReplacedPlayer[“None”] = “none”; })(PinterestReplacedPlayer || (PinterestReplacedPlayer = {})); var SekindoHoldoutExperiment = (function (_super) { __extends$1(SekindoHoldoutExperiment, _super); function SekindoHoldoutExperiment() { var _this = _super.call(this) || this; _this.key = ‘sekho’; _this._result = false; _this._choices = [{ choice: true }, { choice: false }]; _this._result = _this.run(); _this.setExperimentKey(); logger$1.info(‘ClsSekindoHoldoutExperiment’, ‘result’, _this._result); return _this; } Object.defineProperty(SekindoHoldoutExperiment.prototype, “result”, { get: function () { return this._result; }, enumerable: false, configurable: true }); SekindoHoldoutExperiment.prototype.run = function () { return new BernoulliTrial(0.05).get(); }; return SekindoHoldoutExperiment; }(PluginExperiment)); var Component = (function () { function Component() { } Object.defineProperty(Component.prototype, “enabled”, { get: function () { return true; }, enumerable: false, configurable: true }); return Component; }()); var VideoBase = (function (_super) { __extends$1(VideoBase, _super); function VideoBase(_videoConfig, sekindoHoldoutExperimentResult, _component) { var _this = _super.call(this) || this; _this._videoConfig = _videoConfig; _this._component = _component; _this._stickyRelatedOnPage = false; _this._contextualMediaIds = []; var players = _this._videoConfig.players || []; _this._device = isDesktop() ? ‘desktop’ : ‘mobile’; _this._potentialPlayerMap = _this._setPotentialPlayerMap(sekindoHoldoutExperimentResult); var stationaryRelated = players.filter(function (player) { return player.type === “stationaryRelated” && player.enabled; }); _this._potentialPlayerMap.stationaryRelated = stationaryRelated; return _this; } VideoBase.prototype._setPotentialPlayerMap = function (sekindoHoldoutExperimentResult) { var _this = this; var players = this._videoConfig.players; var defaultMap = { stickyRelated: [], stickyPlaylist: [], sekindo: [], stationaryRelated: [], }; return players && players.length ? players .filter(function (player) { var _a; return ((_a = player.devices) === null || _a === void 0 ? void 0 : _a.indexOf(_this._device)) > -1; }) .reduce(function (accumulator, player) { if (!accumulator[player.type]) { logger.event(_this._component, ‘constructor’, ‘Unknown Video Player Type detected’, player.type); accumulator[player.type] = []; } if (player.enabled) { if (!sekindoHoldoutExperimentResult || player.type !== “sekindo” ) { accumulator[player.type].push(player); } } return accumulator; }, defaultMap) : defaultMap; }; VideoBase.prototype._checkPlayerSelectorOnPage = function (playerType) { var _this = this; var players = this._potentialPlayerMap[playerType].map(function (player) { return { player: player, playerElement: _this._getPlacementElement(player), }; }); if (!players.length) { return { player: null, playerElement: null }; } return players[0]; }; VideoBase.prototype._getOverrideElement = function (player, playerElement, publisherPageElement) { if (player && playerElement) { var div = document.createElement(‘div’); playerElement.insertAdjacentElement(player.position, div); publisherPageElement = div; logger.info(this._component, ‘_initializeRelatedPlayers’, ‘Changing injection element’, publisherPageElement); } else { var _a = this._checkPlayerSelectorOnPage(“stickyPlaylist” ), stickyPlaylistPlayer = _a.player, stickyPlaylistElement = _a.playerElement; if (stickyPlaylistPlayer && stickyPlaylistElement) { var div = document.createElement(‘div’); stickyPlaylistElement.insertAdjacentElement(stickyPlaylistPlayer.position, div); publisherPageElement = div; logger.info(this._component, ‘_initializeRelatedPlayers’, ‘Changing injection element’, publisherPageElement); } } return publisherPageElement; }; VideoBase.prototype._shouldOverrideElement = function (element) { var overrideEmbed = element.getAttribute(‘override-embed’); if (overrideEmbed === ‘true’ || overrideEmbed === ‘false’) { return overrideEmbed === ‘true’; } return this._videoConfig.contextualSettings ? this._videoConfig.contextualSettings.overrideEmbedLocation : false; }; VideoBase.prototype._getPlacementElement = function (settings) { var pageSelectorEl = allowablePageSelector(settings.pageSelector); var elementSelectorEl = validCssSelector(settings.elementSelector); if (!pageSelectorEl.valid) { logger.error(‘VideoUtils’, ‘getPlacementElement’, new Error(settings.pageSelector + ” is not a valid selector”)); return null; } if (settings.pageSelector && !pageSelectorEl.elements.length) { logger.error(‘VideoUtils’, ‘getPlacementElement’, new Error(“PSNF: ” + settings.pageSelector + ” does not exist on the page”)); return null; } if (!elementSelectorEl.valid) { logger.error(‘VideoUtils’, ‘getPlacementElement’, new Error(settings.elementSelector + ” is not a valid selector”)); return null; } if (elementSelectorEl.elements.length > settings.skip) { return elementSelectorEl.elements[settings.skip]; } else { logger.error(‘VideoUtils’, ‘getPlacementElement’, new Error(“ESNF: ” + settings.elementSelector + ” does not exist on the page”)); return null; } }; VideoBase.prototype._getEmbeddedPlayerType = function (element) { var embeddedPlayerType = element.getAttribute(‘data-player-type’); if (!embeddedPlayerType || embeddedPlayerType === ‘default’) { embeddedPlayerType = this._videoConfig.contextualSettings ? this._videoConfig.contextualSettings.defaultPlayerType : ‘static’; } if (this._stickyRelatedOnPage) { embeddedPlayerType = ‘static’; } return embeddedPlayerType; }; VideoBase.prototype._getUnusedMediaId = function (publisherPageElement) { var mediaId = publisherPageElement.getAttribute(‘data-video-id’); if (mediaId && this._contextualMediaIds.indexOf(mediaId) === -1) { this._contextualMediaIds.push(mediaId); return mediaId; } else { logger.info(this._component, ‘_getUnusedMediaId’, ‘No Unique MediaId’); return false; } }; VideoBase.prototype._createRelatedPlayer = function (mediaId, embeddedPlayerType, publisherPageElement) { if (embeddedPlayerType === ‘collapse’) { this._createCollapsePlayer(mediaId, publisherPageElement); } else if (embeddedPlayerType === ‘static’) { this._createStaticPlayer(mediaId, publisherPageElement); } }; VideoBase.prototype._createCollapsePlayer = function (mediaId, publisherPageElement) { var _a = this._checkPlayerSelectorOnPage(“stickyRelated” ), stickyRelatedPlayer = _a.player, stickyRelatedElement = _a.playerElement; var player = stickyRelatedPlayer ? stickyRelatedPlayer : this._potentialPlayerMap[“stationaryRelated” ][0]; if (player && player.playerId) { var shouldOverrideElement = this._shouldOverrideElement(publisherPageElement); if (shouldOverrideElement) { publisherPageElement = this._getOverrideElement(stickyRelatedPlayer, stickyRelatedElement, publisherPageElement); } publisherPageElement = document.querySelector(“#cls-video-container-” + mediaId + ” > div”) || publisherPageElement; this._createStickyRelatedPlayer(__assign(__assign({}, player), { mediaId: mediaId }), publisherPageElement); } else { logger.error(this._component, ‘_createCollapsePlayer’, ‘No video player found’); } }; VideoBase.prototype._createStaticPlayer = function (mediaId, publisherPageElement) { if (this._potentialPlayerMap[“stationaryRelated” ].length && this._potentialPlayerMap[“stationaryRelated” ][0].playerId) { var player = this._potentialPlayerMap[“stationaryRelated” ][0]; this._createStationaryRelatedPlayer(__assign(__assign({}, player), { mediaId: mediaId }), publisherPageElement); } else { logger.error(this._component, ‘_createStaticPlayer’, ‘No video player found’); } }; VideoBase.prototype._shouldRunAutoplayPlayers = function () { if (this._isVideoAllowedOnPage()) { if (this._potentialPlayerMap[“stickyRelated” ].length || this._potentialPlayerMap[“stickyPlaylist” ].length || this._potentialPlayerMap[“sekindo” ].length) { return true; } } return false; }; VideoBase.prototype._determineAutoplayPlayers = function () { var componentName = this._component; var isVideoManagerComponent = componentName === ‘VideoManagerComponent’; var config = this._config; if (this._stickyRelatedOnPage) { logger.event(componentName, ‘stickyRelatedOnPage’, (isVideoManagerComponent && { device: config && config.context.device, isDesktop: this._device, }) || {}); return; } var _a = this._checkPlayerSelectorOnPage(“stickyPlaylist” ), stickyPlaylistPlayer = _a.player, stickyPlaylistElement = _a.playerElement; var _b = this._checkPlayerSelectorOnPage(“sekindo” ), sekindoPlayer = _b.player, sekindoElement = _b.playerElement; if (stickyPlaylistPlayer && stickyPlaylistPlayer.playerId && stickyPlaylistPlayer.playlistId && stickyPlaylistElement) { this._createPlaylistPlayer(stickyPlaylistPlayer, stickyPlaylistElement); } else if (sekindoPlayer && sekindoPlayer.playlistId && sekindoElement) { this._createSekindoPlayer(sekindoPlayer, sekindoElement); } else { logger.event(componentName, ‘noStickyPlaylistOrSekindo’, (isVideoManagerComponent && { vendor: ‘none’, device: config && config.context.device, isDesktop: this._device, }) || {}); } }; VideoBase.prototype._initializeRelatedPlayers = function (publisherPageElements) { for (var t = 0; t Adding Stationary Related Player Container”); this._wrapJWPlayerWithCLS(element, player.mediaId); this._playersAddedFromPlugin.push(player.mediaId); } }; ClsVideoInsertion.prototype._createStickyRelatedPlayer = function (player, element) { this._device === ‘mobile’ ? [400, 225] : [640, 360]; VideoAdUnit.Video_Individual_Autoplay_SOff; this._stickyRelatedOnPage = true; this._videoConfig.mobileStickyPlayerOnPage = this._device === ‘mobile’; if (element && player.position && player.mediaId) { logger$1.info(‘ClsVideoInsertion’, ‘_createStickyRelatedPlayer’, “Video > Adding Sticky Related OnPage Player Container”); var playerContainer = document.createElement(‘div’); element.insertAdjacentElement(player.position, playerContainer); var title = document.createElement(‘h3′); title.style.margin = ’10px 0’; var titleHeight = this._getTitleHeight(title); this._wrapJWPlayerWithCLS(playerContainer, player.mediaId, this._WRAPPER_BAR_HEIGHT + titleHeight); this._playersAddedFromPlugin.push(player.mediaId); } }; ClsVideoInsertion.prototype._createSekindoPlayer = function (player, element) { var playlistId = player.playlistId; __assign(__assign({}, player), { classNames: [] }); var playerSize = this._device === ‘mobile’ ? { width: 340, height: 260 } : { width: 320, height: 250 }; logger$1.info(‘ClsVideoInsertion’, ‘_createSekindoPlayer’, “Video > Adding Sekindo Player Container”); var clsWrapper = this._createSekindoCLSWrapper(playerSize.height, playlistId); element.insertAdjacentElement(player.position, clsWrapper); this._playersAddedFromPlugin.push(playlistId); }; ClsVideoInsertion.prototype._createPlaylistPlayer = function (player, element) { var playlistId = player.playlistId; this._videoConfig.mobileStickyPlayerOnPage = true; var playerContainer = document.createElement(‘div’); element.insertAdjacentElement(player.position, playerContainer); logger$1.info(‘ClsVideoInsertion’, ‘_createPlaylistPlayer’, “Video > Adding Playlist Player Container”); this._wrapJWPlayerWithCLS(playerContainer, playlistId, this._WRAPPER_BAR_HEIGHT); this._playersAddedFromPlugin.push(“playlist-” + playlistId); }; ClsVideoInsertion.prototype._isVideoAllowedOnPage = function () { var disableAds = this._clsOptions.disableAds; if (disableAds && disableAds.video) { logger$1.info(‘ClsVideoInsertionMigrated’, ‘isVideoAllowedOnPage’, ‘Video > Non in post players are disabled on page’); var disableAdsReason = ”; if (disableAds.reasons.has(‘video_tag’)) { disableAdsReason = ‘video tag’; } else if (disableAds.reasons.has(‘video_plugin’)) { disableAdsReason = ‘video plugin’; } else if (disableAds.reasons.has(‘video_page’)) { disableAdsReason = ‘command queue’; } var loggedClassName = disableAdsReason ? ‘ClsVideoInsertionMigrated’ : ‘ClsVideoInsertion’; logger$1.error(loggedClassName, ‘isVideoAllowedOnPage’, new Error(“DBP: Disabled by publisher via ” + (disableAdsReason || ‘other’))); return false; } if (this._clsOptions.videoDisabledFromPlugin) { return false; } return true; }; return ClsVideoInsertion; }(VideoBase)); (function () { var clsOptions = new ClsOptions(); if (!clsOptions || !clsOptions.enabled) { return; } new ClsDynamicAdsInjector(clsOptions, new TargetDensityExperiment()).start(); new ClsVideoInsertion(new Video(clsOptions), clsOptions).init(); })(); })();

View Original Source Here






The Best Way to Celebrate the Buckeyes is with Buckeye
10 Minutes Recipe| Quick & Easy Breakfast Recipe| New Snacks
Breakfast Quesadilla – Quick Breakfast Recipes
Buckle Up, Sports Fans! Here’s Where to Eat and Drink
Lunch Ideas
They said BEST Lunch Ever, so I made them ALL!
Back to School Lunchbox
Monday to friday simple & healthy school lunch + recipe
What to Serve With Chicken Piccata ( delicious side dishes)
How to Host a Stress-Free Dinner Party
throwing myself a £5 dinner party
Beth’s Mixed Grill Dinner Party!
Grilled Chicken Panini with Zucchini, Tomato, and Mozzarella
What I eat in a Day to stay fit, healthy
Turkey Meatloaf with Zucchini
5 Dinners for $20/ Budget Meals/Frugal Healthy Meals
Grilling recipes
Chicken Grilling Tips for Summer! How to cook chicken on
Easy Tips to Become a BBQ Master || Grill Hacks
Fish Grilling Tips & Cedar Planked Salmon Recipe
Sorbet|| healthy dessert to loose weight|| 2 ingredients sorbet recipe||
Ras Malai Recipe || Easy and Fast Dessert || Lubna’s
Rainbow Dessert Recipes For Your Family! Easy Chocolate Cake Tutorials
4 Incredible Strawberry Dessert Recipes For Valentine’s Day
Nelson Brother’s Bourbon
Valentine’s Day Dessert Drinks • Tasty Recipes
Podcast: Beverage Week 2022 Recap
4 easy homemade coffee recipes for lockdown
%d bloggers like this: