diff --git a/index.js b/index.js index f5a9ce8..16d9736 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("react")},function(e,t,n){n(3),e.exports=n(5)},function(e,t,n){(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n=function(e){"use strict";var n,r=Object.prototype,i=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),a=new T(r||[]);return o._invoke=function(e,t,n){var r=l;return function(i,o){if(r===h)throw new Error("Generator is already running");if(r===d){if("throw"===i)throw o;return R()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=x(a,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var s=f(e,t,n);if("normal"===s.type){if(r=n.done?d:p,s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r=d,n.method="throw",n.arg=s.arg)}}}(e,n,a),o}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l="suspendedStart",p="suspendedYield",h="executing",d="completed",y={};function v(){}function m(){}function g(){}var b={};b[a]=function(){return this};var w=Object.getPrototypeOf,O=w&&w(w(q([])));O&&O!==r&&i.call(O,a)&&(b=O);var S=g.prototype=v.prototype=Object.create(b);function E(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function k(e){var n;this._invoke=function(r,o){function a(){return new Promise(function(n,a){!function n(r,o,a,u){var s=f(e[r],e,o);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"===t(l)&&i.call(l,"__await")?Promise.resolve(l.__await).then(function(e){n("next",e,a,u)},function(e){n("throw",e,a,u)}):Promise.resolve(l).then(function(e){c.value=e,a(c)},function(e){return n("throw",e,a,u)})}u(s.arg)}(r,o,n,a)})}return n=n?n.then(a,a):a()}}function x(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,x(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=f(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function q(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(s&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:q(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}},e}("object"===t(e)?e.exports:{});try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}}).call(this,n(4)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.r(t);var r=n(1),i=n.n(r),o=function(e){return e.reduce(function(e,t){return e.concat(t.prebid.map(function(e){return{code:t.id,mediaTypes:e.mediaTypes,bids:e.bids}}))},[])};function a(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:[];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.config=t,this.slots={},this.plugins=n,this.gptSizeMappings={},this.customEventCallbacks={},this.customEventHandlers={},this.queue=[],t&&this[x]()}var t,n,r;return t=e,n=[{key:"setup",value:function(){var t=c(regeneratorRuntime.mark(function t(){var n,r,i,o,a,u,s,c,f,l,p=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.slots,r=this.queue,this[b](),t.next=4,Promise.all([e[k](this[y].bind(this)),e[E](this[m].bind(this))]);case 4:if(0!==r.length){t.next=6;break}return t.abrupt("return");case 6:for(i=!0,o=!1,a=void 0,t.prev=9,u=function(){var e=c.value,t=e.id,n=e.customEventHandlers;Object.keys(n).forEach(function(e){return p.customEventCallbacks[e]||(p.customEventCallbacks[e]={}),p.customEventCallbacks[e][t]=n[e]})},s=r[Symbol.iterator]();!(i=(c=s.next()).done);i=!0)u();t.next=18;break;case 14:t.prev=14,t.t0=t.catch(9),o=!0,a=t.t0;case 18:t.prev=18,t.prev=19,i||null==s.return||s.return();case 21:if(t.prev=21,!o){t.next=24;break}throw a;case 24:return t.finish(21);case 25:return t.finish(18);case 26:f=r.map(function(e){return e.id}),l=r.map(function(e){var t=e.id;return n[t]}),e[k](function(){return window.pbjs.requestBids({adUnitCodes:f,bidsBackHandler:function(){window.pbjs.setTargetingForGPTAsync(f),e[E](function(){return window.googletag.pubads().refresh(l)})}})});case 29:case"end":return t.stop()}},t,this,[[9,14,18,26],[19,,21,25]])}));return function(){return t.apply(this,arguments)}}()},{key:"teardown",value:function(){var t=c(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this[O](),t.next=3,Promise.all([e[k](this[v].bind(this)),e[E](this[g].bind(this))]);case 3:this.slots={},this.gptSizeMappings={},this.queue={};case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"activate",value:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.slots;0!==Object.values(i).length?(Object.keys(r).forEach(function(e){return n.customEventCallbacks[e]||(n.customEventCallbacks[e]={}),n.customEventCallbacks[e][t]=r[e]}),e[k](function(){return window.pbjs.requestBids({adUnitCodes:[t],bidsBackHandler:function(){window.pbjs.setTargetingForGPTAsync([t]),e[E](function(){return window.googletag.pubads().refresh([i[t]])})}})})):this.queue.push({id:t,customEventHandlers:r})}},{key:"isConfigReady",value:function(){return Boolean(this.config)}},{key:"setConfig",value:function(e){this.config=e,this[x]()}},{key:b,value:function(){var e=this;this.config.customEvents&&Object.keys(this.config.customEvents).forEach(function(t){return e[w](t,e.config.customEvents[t])})}},{key:w,value:function(e,t){var n=t.eventMessagePrefix,r=t.divIdPrefix,i=this.customEventCallbacks;this.customEventHandlers[e]=function(t){var o=t.data;if("string"==typeof o&&o.startsWith("".concat(n))){var a="".concat(r||"").concat(o.substr(n.length)),u=i[e];if(u){var s=u[a];s&&s()}}},window.addEventListener("message",this.customEventHandlers[e])}},{key:O,value:function(){var e=this;this.config.customEvents&&Object.keys(this.config.customEvents).forEach(function(t){return window.removeEventListener("message",e.customEventHandlers[t])})}},{key:l,value:function(){if(this.config.sizeMappings)for(var e=0,t=Object.entries(this.config.sizeMappings);e0&&l.setCollapseEmptyDiv.apply(l,a(i));for(var d=0,y=Object.entries(s);d=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(s&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:q(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}},e}("object"===t(e)?e.exports:{});try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}}).call(this,n(4)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.r(t);var r=n(1),i=n.n(r),o=function(e){return e.reduce(function(e,t){return e.concat(t.prebid.map(function(e){return{code:t.id,mediaTypes:e.mediaTypes,bids:e.bids}}))},[])};function a(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:[];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.config=t,this.slots={},this.plugins=n,this.gptSizeMappings={},this.customEventCallbacks={},this.customEventHandlers={},this.queue=[],t&&this[j]()}var t,n,r;return t=e,n=[{key:"setup",value:function(){var t=c(regeneratorRuntime.mark(function t(){var n,r,i,o,a,u,s,c,f,l,p=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.slots,r=this.queue,this[b](),t.next=4,Promise.all([e[k](this[y].bind(this)),e[E](this[g].bind(this))]);case 4:if(0!==r.length){t.next=6;break}return t.abrupt("return");case 6:for(i=!0,o=!1,a=void 0,t.prev=9,u=function(){var e=c.value,t=e.id,n=e.customEventHandlers;Object.keys(n).forEach(function(e){return p.customEventCallbacks[e]||(p.customEventCallbacks[e]={}),p.customEventCallbacks[e][t]=n[e]})},s=r[Symbol.iterator]();!(i=(c=s.next()).done);i=!0)u();t.next=18;break;case 14:t.prev=14,t.t0=t.catch(9),o=!0,a=t.t0;case 18:t.prev=18,t.prev=19,i||null==s.return||s.return();case 21:if(t.prev=21,!o){t.next=24;break}throw a;case 24:return t.finish(21);case 25:return t.finish(18);case 26:f=r.map(function(e){return e.id}),l=r.map(function(e){var t=e.id;return n[t]}),e[k](function(){return window.pbjs.requestBids({adUnitCodes:f,bidsBackHandler:function(){window.pbjs.setTargetingForGPTAsync(f),e[E](function(){return window.googletag.pubads().refresh(l)})}})});case 29:case"end":return t.stop()}},t,this,[[9,14,18,26],[19,,21,25]])}));return function(){return t.apply(this,arguments)}}()},{key:"teardown",value:function(){var t=c(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this[O](),t.next=3,Promise.all([e[k](this[v].bind(this)),e[E](this[m].bind(this))]);case 3:this.slots={},this.gptSizeMappings={},this.queue={};case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"activate",value:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.slots;0!==Object.values(i).length?(Object.keys(r).forEach(function(e){return n.customEventCallbacks[e]||(n.customEventCallbacks[e]={}),n.customEventCallbacks[e][t]=r[e]}),e[k](function(){return window.pbjs.requestBids({adUnitCodes:[t],bidsBackHandler:function(){window.pbjs.setTargetingForGPTAsync([t]),e[E](function(){return window.googletag.pubads().refresh([i[t]])})}})})):this.queue.push({id:t,customEventHandlers:r})}},{key:"isConfigReady",value:function(){return Boolean(this.config)}},{key:"setConfig",value:function(e){this.config=e,this[j]()}},{key:b,value:function(){var e=this;this.config.customEvents&&Object.keys(this.config.customEvents).forEach(function(t){return e[w](t,e.config.customEvents[t])})}},{key:w,value:function(e,t){var n=t.eventMessagePrefix,r=t.divIdPrefix,i=this.customEventCallbacks;this.customEventHandlers[e]=function(t){var o=t.data;if("string"==typeof o&&o.startsWith("".concat(n))){var a="".concat(r||"").concat(o.substr(n.length)),u=i[e];if(u){var s=u[a];s&&s()}}},window.addEventListener("message",this.customEventHandlers[e])}},{key:O,value:function(){var e=this;this.config.customEvents&&Object.keys(this.config.customEvents).forEach(function(t){return window.removeEventListener("message",e.customEventHandlers[t])})}},{key:l,value:function(){if(this.config.sizeMappings)for(var e=0,t=Object.entries(this.config.sizeMappings);e0&&l.setCollapseEmptyDiv.apply(l,a(i));for(var d=0,y=Object.entries(s);d