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EAAGS,MAAML,EAASG,EACnB,GAAE1E,KAEHqE,EAAOG,EACPL,EAAGS,MAAML,EAASG,GAErB,CACF,C,uBC/BDG,EAAOC,QAAUC,M,GCCbC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBzH,IAAjB0H,EACH,OAAOA,EAAaL,QAGrB,IAAID,EAASG,EAAyBE,GAAY,CAGjDJ,QAAS,CAAC,GAOX,OAHAM,EAAoBF,GAAUL,EAAQA,EAAOC,QAASG,GAG/CJ,EAAOC,OACf,CCrBAG,EAAoBI,EAAKP,IACH,oBAAXjI,QAA0BA,OAAOyI,aAC1CxH,OAAOC,eAAe+G,EAASjI,OAAOyI,YAAa,CAAEnI,MAAO,WAE7DW,OAAOC,eAAe+G,EAAS,aAAc,CAAE3H,OAAO,GAAO,ECA9DoG,EAAQ,IACRA,EAAQ,I","sources":["webpack://essence_site/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://essence_site/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://essence_site/./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://essence_site/./node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://essence_site/./wp/wp-content/themes/pubstack/assets/js/ads/admanager-freestar.js","webpack://essence_site/./wp/wp-content/themes/pubstack/assets/js/ads/common.js","webpack://essence_site/./wp/wp-content/themes/pubstack/assets/js/utils/throttle.js","webpack://essence_site/external var \"jQuery\"","webpack://essence_site/webpack/bootstrap","webpack://essence_site/webpack/runtime/make namespace object","webpack://essence_site/./wp/wp-content/themes/pubstack/assets/head-freestar.js"],"sourcesContent":["export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","/**\n * Javascript for Essence Ads\n *\n **/\n\n/**\n * Prepares and sends data from ad tags to Freestar for ad rendering.\n */\n// Object from Ajax\nconst viewPortHeight = Math.max(\n document.documentElement.clientHeight,\n window.innerHeight || 0\n);\n\nconst isMobileDevice = window.matchMedia(\n \"only screen and (max-width: 760px)\"\n).matches;\n\nlet viewPortMultiplier = isMobileDevice ? 0.9 : 0.5;\n// Google Optimize Test override\nif (typeof window.viewPortMultiplier !== \"undefined\") {\n viewPortMultiplier = window.viewPortMultiplier;\n}\n\nconst rootMargin = Math.floor(viewPortMultiplier * viewPortHeight);\n\n// Observer to detect ads within 3 viewport view\nconst ads_observer = new IntersectionObserver(\n (entries, observer) => {\n let els = [];\n\n entries.forEach((entry) => {\n if (entry.intersectionRatio > 0) {\n const el = $(entry.target);\n el.addClass(\"freestar-pushed\");\n els.push(el);\n observer.unobserve(entry.target);\n }\n });\n\n pushToFreestar(els);\n },\n {\n rootMargin: `0px 0px ${rootMargin}px 0px`,\n threshold: 0,\n }\n);\n\nlet count = 0;\nlet positions = \".ad-position\";\n\nconst pushToFreestar = (els) => {\n let els_to_push = [];\n\n els.forEach(function (el) {\n // Tell Freestar which element to use.\n let slot_id = el.attr(\"id\");\n if (\n !isMobileDevice &&\n typeof slot_id === \"string\" &&\n slot_id.includes(\"_mobile_\")\n ) {\n return;\n }\n\n // Tell Freestar which type of ad to send.\n let placement = el.attr(\"data-placement-name\");\n\n let article_key_values = {};\n article_key_values.pos = slot_id;\n\n if (dfp_ad_object[0].test !== null) {\n article_key_values.test = dfp_ad_object[0].test;\n }\n\n // Only send the tile value if the current ad is not outofpage 1x1.\n if (!el.hasClass(\"dfp-ads-outofpage\")) {\n count++;\n article_key_values.tile = count;\n }\n\n if (slot_id.includes(\"leaderboard\")) {\n article_key_values.inDapIF = true;\n }\n\n // Bring the page targeting & article_key_values values into article_targeting together\n // so that overwriting values within objects does not occur.\n let article_targeting = Object.assign(\n article_key_values,\n page_targeting(el)\n );\n\n els_to_push.push({\n placementName: placement,\n slotId: slot_id,\n targeting: article_targeting,\n });\n });\n\n freestar.queue.push(function () {\n freestar.newAdSlots(els_to_push);\n });\n};\n\nconst page_targeting = (el) => {\n const krux_data =\n typeof Krux !== \"undefined\" ? { ksg: Krux.segments, kuid: Krux.user } : {};\n\n try {\n // Use the targeting data of the article the ad belongs to\n // And use the first article for the out-of-page and leaderboard ads\n const page_targeting = el.closest(\"article\").length\n ? el.closest(\"article\").prev().data(\"page_targeting\")\n : $(\".pubstack-post-header\").first().data(\"page_targeting\");\n return { ...page_targeting, ...krux_data };\n } catch (e) {\n return krux_data;\n }\n};\n\nfunction freestarAdsRequest() {\n this.initTimer = 0;\n this.init = function () {\n $(window).on(\"ad:request\", this, this.freestarInit);\n $(window).on(\"ad:scroll_update\", this, this.freestarPush);\n this.freestarInit();\n };\n\n this.freestarInit = () => {\n if (typeof freestar !== \"undefined\") {\n clearTimeout(this.initTimer);\n // Load DV Authentic Direct signals first\n PQ.loadSignals([\"abs\"], () => {\n freestarInitAction(); // Proceed with initializing Freestar\n });\n } else {\n this.initTimer = setTimeout(() => {\n this.freestarInit();\n }, 500);\n }\n };\n\n const freestarInitAction = () => {\n freestar.config.targeting = [{ essence_adhesion: page_targeting() }];\n freestar.initCallback = function () {\n $(positions)\n .not(\".observed\")\n .slice(0, 100)\n .each((index, el) => {\n $(el).addClass(\"observed\");\n ads_observer.observe(el);\n });\n };\n };\n\n this.freestarPush = function () {\n $(positions)\n .not(\".observed\")\n .slice(0, 100)\n .each((index, el) => {\n $(el).addClass(\"observed\");\n ads_observer.observe(el);\n });\n };\n}\n\nvar freestartAdsRequestInstance = new freestarAdsRequest();\nfreestartAdsRequestInstance.init();\n","require(\"../utils/throttle\");\n\ngoogletag.cmd.push(function () {\n googletag.pubads().addEventListener(\"slotRenderEnded\", function (event) {\n const slotId = event.slot.getSlotElementId();\n\n // If the slot is leaderboard:\n if (slotId.includes(\"leaderboard\")) {\n const leaderboard = $(\".ad-position.leaderboard\");\n\n // Stick Leadboard ads for 2 seconds after being loaded.\n $(window).on(\n \"scroll\",\n essThrottle(function () {\n if (!$(window).scrollTop()) {\n return; // return if page is not scrolled\n }\n setTimeout(function () {\n leaderboard.addClass(\"fade\");\n setTimeout(() => {\n leaderboard.removeClass(\"sticky fade\");\n }, 500);\n }, 2000);\n })\n );\n }\n });\n});\n","/**\n * Throttle a function so that it fires once every { threshold }\n * @param {Function} fn\n * @param {Integer} threshold\n * @param {FunctionContext} scope\n */\n\nwindow.essThrottle = (fn, threshold, scope) => {\n if (!threshold) {\n threshold = 250;\n }\n\n var last, deferTimer;\n\n return function () {\n var context = scope || this;\n var now = +new Date();\n var args = arguments;\n\n if (last && now < last + threshold) {\n // hold on to it\n clearTimeout(deferTimer);\n deferTimer = setTimeout(function () {\n last = now;\n fn.apply(context, args);\n }, threshold);\n } else {\n last = now;\n fn.apply(context, args);\n }\n };\n};\n","module.exports = jQuery;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * All frontend scripts that are related to Freestar ads should be included here.\n *\n * This is the file that Webpack is compiling into main-head-freestar.[hash].js\n */\nrequire(\"./js/ads/admanager-freestar\");\nrequire(\"./js/ads/common\");\n"],"names":["_typeof","obj","Symbol","iterator","constructor","prototype","_defineProperty","key","value","arg","input","hint","prim","toPrimitive","undefined","res","call","TypeError","String","Object","defineProperty","enumerable","configurable","writable","viewPortHeight","Math","max","document","documentElement","clientHeight","window","innerHeight","isMobileDevice","matchMedia","matches","viewPortMultiplier","rootMargin","floor","ads_observer","IntersectionObserver","entries","observer","els","forEach","entry","intersectionRatio","el","$","target","addClass","push","unobserve","pushToFreestar","threshold","count","positions","els_to_push","slot_id","attr","includes","placement","article_key_values","pos","dfp_ad_object","test","hasClass","tile","inDapIF","article_targeting","assign","page_targeting","placementName","slotId","targeting","freestar","queue","newAdSlots","krux_data","Krux","ksg","segments","kuid","user","closest","length","prev","data","first","e","this","initTimer","init","on","freestarInit","freestarPush","clearTimeout","PQ","loadSignals","freestarInitAction","setTimeout","config","essence_adhesion","initCallback","not","slice","each","index","observe","require","googletag","cmd","pubads","addEventListener","event","slot","getSlotElementId","leaderboard","essThrottle","scrollTop","removeClass","fn","scope","last","deferTimer","context","now","Date","args","arguments","apply","module","exports","jQuery","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","r","toStringTag"],"sourceRoot":""}