Healthy

Dreamy Refried Bean Chicken Enchiladas




[]

Enchiladas are known in my family to be the ultimate comfort food. I grew up all my life eating them in a variety of different ways: red sauce, green chile, a tomatillo salsa version, avocado and even sour cream. In my opinion, all enchiladas are worthy of eating.

The first time I made these refried bean chicken enchiladas, one of my besties and fellow food bloggers, Sarah, and I devoured them after a long day of photography and recipes. Our minds were teetering on the verge of delusional and delirious, but our bellies were happier than ever.

Back when Tony was playing baseball I would make him turkey meatballs, healthy chicken parm, pepper jack and chicken pasta, and of course, these beautiful enchiladas when he’d come home from traveling. Because he was an athlete I made sure that my recipes were both satisfying, filling and tasty. Fast-forward. many years and I’m still whipping up nourishing, delicious eats for him and our two kiddos!

These chicken enchiladas are seriously the perfect comfort food to feed the whole family or a group of friends. They’re freezer-friendly, too, so whip up a batch and enjoy any time.

chicken enchiladas in a pan topped with avocado

Ingredients in these healthy chicken enchiladas

These delicious chicken enchiladas are easy to customize and are the perfect way to use up leftover chicken. Here’s everything you’ll need to make them:

  • Homemade enchilada sauce: this is the most exciting part of the recipe. Making your own enchilada sauce is easier than you can imagine. Just tomato sauce, tomato paste, garlic, onion, chicken broth (or vegetarian broth), apple cider vinegar, and a few spices. You are going to be making it again and again! And best yet, you can make it while you’re cooking your chicken (if need be) so you get two things done at once.
  • Chicken: you’ll add cooked, shredded chicken straight to the enchiladas, so this is the perfect way to use up any leftovers! Get all of our tips for cooking perfect chicken here, and shredding it here. You can also use a rotisserie chicken if you’d like.
  • Refried beans: I love, love, love using refried beans in my enchilada recipes because of the added nutrition, fiber and protein. Plus it makes the enchiladas literally melt in your mouth. Black bean refried beans are a favorite.
  • Cheese: I didn’t go crazy with the amount of cheese in this recipe. Frankly, it isn’t necessary thanks to the wonderful creamy beans and flavorful enchilada sauce.
  • Tortillas: I love to use soft corn tortillas, but feel free to use any tortillas you’d like!
  • To garnish: add some avocado, fresh cilantro and diced onion on top for the perfect bite every time.

unrolled chicken enchilada on a board

Simple ingredient swaps

Because these chicken enchiladas use plenty of simple ingredients, they’re also easy to customize!

  • Go vegetarian: feel free to leave out the chicken and add a can of black beans or even some roasted veggies. You’ll want to check and make sure your refried beans are also vegetarian.
  • Add veggies: I recommend adding the following: zucchini, bell pepper, corn, onion, cooked sweet potato or butternut squash. I would refrain from adding more than 1 cup of veggies so that you avoid overstuffing the enchiladas.
  • Make them dairy free: use your favorite dairy free/vegan shredded cheese.
  • Keep them gluten free: be sure to use gluten free corn tortillas, or a different gluten free tortilla (see a note on tortillas below).
  • Choose your sauce: for ease, you can also use a 28 ounce can of your favorite enchilada sauce instead of making it yourself.

unbaked healthy chicken enchiladas in a pan

Choose the right tortillas

As I mentioned, I like to use corn tortillas for the flavor and easy rolling capability. If you want to use a different type of tortillas, keep these notes in mind:

  • For flour tortillas: you may need to use 8-10 instead of 12 and will need to slightly increase filling, cheese & sauce in each tortilla.
  • For grain free tortillas: be careful with these as they may be harder to roll depending on the brand and what they are made of.

easy chicken enchiladas in a pan topped with avocado

Tips for assembling perfect chicken enchiladas

Homemade enchiladas can seem a bit intimidating with the filling, rolling, etc. But they’re SO easy and delicious with a few simple tips:

  • Warm your tortillas. You can do this in the microwave for about 20 seconds so they are easier to roll. You can splash a little water on them before microwaving to make them more pliable.
  • Don’t overfill. Fill them with just about 1/4 cup of the refried bean & chicken mixture so that they stay together and don’t burst at the seams.
  • Lay them correctly. Remember to place them seam-side down so that the filling stays inside, and arrange them tightly next to each other in your pan to help them stay together.

refried bean chicken enchiladas in a pan

Can I make them ahead of time?

Absolutely! I’ve included instructions for how to freeze chicken enchiladas below, but you can also assemble the enchiladas one day ahead of time and store them covered in the refrigerator. Bake them for about 10-15 minutes longer once you’re ready to cook them, and then serve!

chicken enchiladas topped with avocado on a plate

How to make the best chicken enchiladas

  1. Make your sauce. In a medium pot sauté your onion and garlic, stir in the spices, then add the tomato sauce, paste, and broth. Bring it all to a boil then reduce the heat and let it simmer for 15-20 minutes to thicken up. Once it’s ready stir in the apple cider vinegar and add salt & pepper to taste.
  2. Prep your pan. Grease a 9×13 inch pan with a little oil, then spread 3/4 cup of the enchilada sauce on the bottom of the pan.
  3. Assemble enchiladas. Warm your corn tortillas, then add refried beans, shredded chicken, cheese and enchilada sauce to each one. Roll them up and place them seam-side down in the pan. Repeat for all of the tortillas.
  4. Top & bake. Pour the rest of the enchilada sauce over the tortillas, sprinkle with the remaining cheese, and bake.
  5. Garnish & serve. Top the enchiladas with fresh avocado, cilantro & onion if you’d like, and add my famous spicy cilantro jalapeño yogurt sauce to take them to the next level!

healthy chicken enchiladas on a plate next to diced onion and cilantro

Two ways to freeze chicken enchiladas

These easy chicken enchiladas can be frozen two different ways for the perfect meal prep dinner! They’re the perfect meal to prepare for new parents or anyone that could use a home cooked meal. Here’s how to freeze them:

  1. Bake first, then freeze. You can either bake them first, then cool to room temperature, divide them in freezer safe containers and then freeze. Or you can bake them, bring them to room temp, and then freeze the entire pan. Just make sure you double wrap the pan so the enchiladas do not dry out. This is assuming you are freezing the entire pan. Once ready to reheat, thaw it out. Then bake, covered at 350 degrees F for 30-45 minutes or until heated through.
  2. Freeze before baking: To freeze before baking, simply assemble the enchiladas as written in the instructions, then double wrap with plastic wrap and foil and freeze for up to 3 months. Once ready to bake, thaw out then bake according to instructions.

chicken enchiladas topped with cilantro on a plate

More tacos & enchiladas

Get all of our taco & enchilada recipes here!

I hope you love these dreamy refried bean chicken enchiladas! If you make them be sure to leave a comment and a rating so I know how you liked them. Enjoy, xo!

Dreamy Refried Bean Chicken Enchiladas with Homemade Enchilada Sauce

healthy chicken enchiladas on a plate

Amazing chicken enchiladas with creamy refried beans, protein-packed chicken, and a homemade enchilada sauce. This delicious, easy chicken enchilada recipe is freezer-friendly and a crowd-pleasing dinner staple!

  • For the enchilada sauce:
  • 1 tablespoon olive oil
  • 1 small white onion, very finely minced or grated
  • 4 cloves garlic, minced
  • 2-3 tablespoons chili powder
  • 1 teaspoon cumin
  • 1 teaspoon dried oregano
  • 1/4 teaspoon cayenne pepper
  • 1 (15 ounce) can tomato sauce
  • 1 cup chicken broth
  • 2 tablespoons tomato paste
  • 1 teaspoon apple cider vinegar
  • Salt, to taste
  • For the enchiladas:
  • 2 1/2 cups cooked shredded chicken (breast or thighs work great!)
  • 1 (15 ounce) can refried beans (I like to use refried black beans for best flavor)
  • 1 1/4 cup shredded colby jack or Mexican cheese, divided
  • 1/2 cup shredded pepper jack cheese
  • 10 soft corn tortillas
  • To garnish:
  • 1 avocado, sliced or diced
  • 1/4 cup fresh chopped cilantro
  • 1/4 cup chopped red onion or diced green onion
  1. Prepare the enchilada sauce by heating oil in a medium pot over medium high heat. Add in garlic and onions and sauté for 5 minutes or until onions become translucent. Add in chili powder, cumin, oregano and cayenne pepper and stir for 30 seconds to allow the spices to cook a bit. Stir in tomato sauce, broth, tomato paste then bring to a boil. Reduce heat to a medium low and simmer for about 15-20 minutes. Lastly stir in apple cider vinegar, then add salt and pepper to taste. **NOTE: if you don’t want to use homemade enchilada sauce, feel free to use 1 (28 ounce) can of red enchilada sauce.

  2. Preheat oven to 350 degrees F. Grease a 9×13 inch pan with a little olive oil or avocado oil.

  3. Begin by spreading ¾ cup of enchilada sauce on the bottom of a 9×13 inch baking pan.

  4. Next, warm up your tortillas so they are easier to roll and to avoid them breaking: I like to microwave mine for 15 seconds on a plate then cover them with a warm towel so they stay warm. Please note it is important to use soft corn tortillas, these are the ones that do not easily break!

  5. Assemble enchiladas: place 2 tablespoons of refried beans in a corn tortilla, then top with a few tablespoons of shredded chicken, 1 heaping tablespoon of colby jack cheese and 1 tablespoon of enchilada sauce. Roll tortillas up and place seam side down in pan. Repeat with remaining tortillas.

  6. Next pour remaining enchilada sauce over the top of the tortillas and sprinkle with remaining 1/2 cup of shredded colby jack and 1/2 cup of shredded pepper jack cheese. Bake for 25-30 minutes. Remove from oven and allow to cool for 5 minutes before serving.

  7. Garnish with avocado, cilantro, red or green onion, if desired. Makes 5 servings, 2 enchiladas each. I also love serving this with my spicy cilantro jalapeno yogurt sauce and it makes the recipe extra pretty, too! Just a little drizzle on top really take it to the next level, but it’s up to you.

If you don’t want to make your own enchilada sauce, feel free to use 1 (28 ounce) can of red enchilada sauce.

See the full post for easy ways to customize your enchiladas, plus two ways to freeze them for later!

Nutrition

Servings: 5 servings

Serving size: 2 enchiladas

Calories: 400kcal

Fat: 10g

Carbohydrates: 45.6g

Fiber: 10.8g

Sugar: 6.1g

Protein: 31.2g

This post was originally published on September 23rd, 2015, and republished on February 20th, 2022.

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.

3 && r && Object.defineProperty(target, key, r), r; } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator[“throw”](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), “throw”: verb(1), “return”: verb(2) }, typeof Symbol === “function” && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError(“Generator is already executing.”); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y[“return”] : op[0] ? y[“throw”] || ((t = y[“return”]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.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






5 Restaurants to Try This Month: June 2022
6 south indian dosa recipes for morning breakfast
13 Donuts to Celebrate National Donut Day
Best Breakfast Recipe, Simple and Quick Meals, Nashta, Vegetable Pancake
5 of the BEST COLD LUNCH BOX IDEAS
High protein lunch recipe for babies&toddlers/5 minute weight gaining lunch
SQUID GAME Lunch Box DOSIRAK l 4 Korean Side dishes,
Lunch Recipe Combo -1/Healthy Lunch Recipes in Tamil
Top 10 Mexican Christmas Dishes
Korean rolled omelette (Gyeran-mari: 계란말이)
4 Dinner Recipes, घर में खाना कभी ऐसे बनाके देखे,
3 FOIL PACKET RECIPES for Your Next Camping Dinner *these
Mango Coconut Chia Pudding
Simple Delicious Alkaline Recipes!
Chocolate Peanut Butter Banana Smoothie (tastes like a frosty!)
Whole-wheat Biscotti recipe | Healthy Baking Recipes
Beginners Guide to Grilling Chicken Thighs
How to BBQ Pizza
How to Grill Fish Fillets
Grilled Cheese with Kimchi (김치 그릴치즈)
Coconut custard recipe || Quick and easy dessert recipe ||
15 Christmas Desserts
Low Carb Crustless Cheesecake
10 Easy Dessert Recipes to Make at Home
Elements: Sake
Boris Johnson ‘poured drinks’ at Downing Street party, more trouble
D’Mongo’s Speakeasy Is a Legendary Detroit Bar
5 Simple Drinks for Glowing Skin & Body
%d bloggers like this: