var LoggingClientManager=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},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=7)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:window.event;return n(e)};if(e.addEventListener)e.addEventListener(t,i,!0);else if(t="on"+t,e.attachEvent)e.attachEvent(t,i);else{var r=e[t];e[t]=function(){i.apply(this,arguments),"function"==typeof r&&r.apply(this,arguments)}}}}]),e}();t.default=s},function(e,t,n){"use strict";n.r(t);var i=function(){function e(e,t){for(var n=0;n0?n-e:t>0?Math.min(t,n):0,Math.min(i,t-e)}var s=function(){function e(t,n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),this.window=n||window,this.elem=t}return i(e,[{key:"getPercentInView",value:function(){var e=this.getTopWindow();if(e){if(this.window===e)return r(this.elem,e);if(this.window.frameElement)return r(this.window.frameElement,e)}else if(this.window.$sf)try{return(this.window.$sf.ext.inViewPercentage()||0)/100}catch(e){}return-1}},{key:"getTopWindow",value:function(){return function(e){if(!e)throw new Error("window argument required");if("boolean"==typeof e.dacxIsCrossOrigin)return e.dacxIsCrossOrigin;try{if(!e.top.document)throw new Error("cross-domain exception");e.dacxIsCrossOrigin=!1}catch(t){e.dacxIsCrossOrigin=!0}return e.dacxIsCrossOrigin}(this.window)?null:this.window.top}},{key:"onViewThreshold",value:function(e,t,n,i){var r=this,o=null;return function(a){var s=null;return function a(){(function(){if(r.getPercentInView()>=e&&r.getPercentInView()<=t){var a=(new Date).getTime();if(null===o)o=a;else if(a-o>n)return i(),!0}else o=null})()||(s=setTimeout(a,100))}(),{clear:function(){s&&clearTimeout(s)}}}()}},{key:"onView",value:function(e,t,n){return this.onViewThreshold(e,1,t,n)}},{key:"onHide",value:function(e,t,n){return this.onViewThreshold(0,e,t,n)}},{key:"getVerticalPositionOnPage",value:function(){var e=-1,t=this.getTopWindow();if(t)if(this.window===t){var n=this.elem.getBoundingClientRect().top,i=o(t),r=this.elem.getBoundingClientRect().height;e=Math.max(Math.min(n/(i-r),1),0)}else this.window.frameElement&&(n=this.window.frameElement.getBoundingClientRect().top,i=o(t),r=this.window.frameElement.getBoundingClientRect().height,e=Math.max(Math.min(n/(i-r),1),0));else if(this.window.$sf)try{e=Math.max(Math.min($sf.ext.geom().self.t/($sf.ext.geom().win.h-$sf.ext.geom().self.h),1),0)}catch(e){}return e}}]),e}();t.default=s},function(e,t,n){"use strict";n.r(t);var i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}(e,["sampleRate","batchTimeout"]);n="number"==typeof n?n:50,this.enabled="number"!=typeof t||Math.random()1&&void 0!==arguments[1]?arguments[1]:{},n=this.bufferedMetrics[e],r=i({},t,{template_name:this.templateName});Array.isArray(n)?n.push(r):this.bufferedMetrics[e]=[r],this.logBatchedMetrics()}},{key:"prepareBatchedMetrics",value:function(){var e=this;return Object.keys(this.bufferedMetrics).map(function(t){return{event_type:t,render_id:e.renderId,dimensions:e.bufferedMetrics[t]}})}},{key:"logBatchedMetrics",value:function(){this.debouncedLogBatchMetrics()}},{key:"logMetric",value:function(e,t){var n=i({},t,{template_name:this.templateName});if(this.isDebug)console.log("[DEBUG] Logging metric for "+t.subtype+" with dimensions:"),console.log(t);else{var r={render_id:this.renderId,event_type:e,dimensions:n||{}};this.postMetrics(r)}}},{key:"doLogging",value:function(e,t,n){(n?this.batchMetric:this.logMetric).call(this,e,t)}},{key:"doLogImpression",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.doLogging("impression",i({subtype:"impression",value:1},e),t)}},{key:"logImpression",value:function(e){this.doLogImpression(e)}},{key:"logBatchedImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.doLogImpression(e,!0)}},{key:"doLogEvent",value:function(e,t){var n=e.eventName,r=e.eventType,o=e.componentType,a=e.componentName,s=e.eventValue,u=void 0===s?1:s,c=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.doLogging(r,i({component_type:o,component_name:a,subtype:n,value:u},t),c)}},{key:"logEvent",value:function(e){this.doLogEvent(e)}},{key:"logBatchedEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.doLogEvent(e,t,!0)}},{key:"doLogPerformanceEvent",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.doLogging("performance",i({subtype:e,value:t||1,userAgent:navigator&&navigator.userAgent},n),r)}},{key:"logPerformanceEvent",value:function(e,t,n){this.doLogPerformanceEvent(e,t,n)}},{key:"logBatchedPerformanceEvent",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.doLogPerformanceEvent(e,t,n,!0)}}]),e}();t.default=a},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;nl;if(t.currentDate){var o=Math.random()>f,a=new Date(t.currentDate),u=a.getUTCHours(),c=a.getUTCMinutes(),d=4===u||5===u&&c<30;this.suppressViewabilityEventLogging=t.isPDACreative||o&&d}this.visualCompleteness=new s.default(t.requiredElementsForVisualCompleteness,i),this.requiredElementsForVisualCompleteness=t.requiredElementsForVisualCompleteness,this.preDefinedUrlsForVisualCompleteness=t.preDefinedUrlsForVisualCompleteness,t.isPDACreative||this.cemLogger.logImpression(),this.performanceEventManager=n,i||this.trackLoadLatency(),this.trackVisualCompletenessLatency(),this.attachGlobals(),this.addErrorListener()}return i(e,[{key:"attachGlobals",value:function(){this.window.document.ad={aid:this.aid,cid:this.cid},this.window.CemLogger=this.cemLogger,this.window.Viewability=o.default,this.window.VisualCompleteness=this.visualCompleteness}},{key:"trackVisualCompletenessLatency",value:function(){var e=this;this.visualCompleteness.startTimer(this.performanceEventManager.timers[u.VISUAL_COMPLETENESS_LATENCY]),this.requiredElementsForVisualCompleteness.forEach(function(t){if(e.preDefinedUrlsForVisualCompleteness[t]){var n=new Image;n.onload=function(){e.visualCompleteness.endTimer(t)},n.src=e.preDefinedUrlsForVisualCompleteness[t]}})}},{key:"trackLoadLatency",value:function(){var e=this;this.performanceEventManager.addListener(this.window,"load",function(){var t=new Date-e.performanceEventManager.timers[u.CREATIVE_LOAD_LATENCY];e.cemLogger.logPerformanceEvent(a.CEM_LOGGER_METRICS.EVENT_NAMES.CREATIVE_LOAD_LATENCY,t)})}},{key:"addErrorListener",value:function(){var e=this,t=function(t){e.cemLogger.logPerformanceEvent(a.CEM_LOGGER_METRICS.EVENT_NAMES.UNCAUGHT_ERROR,t)};this.performanceEventManager.onNewError=t;for(var n in this.performanceEventManager.events[u.UNCAUGHT_ERROR])t(n)}},{key:"addViewabilityListener",value:function(e){var t=this,n=new o.default(e,this.window);this.suppressViewabilityEventLogging||(n.getPercentInView()<=-1?this.cemLogger.logEvent({eventName:a.CEM_LOGGER_METRICS.EVENT_NAMES.VIEWABILITY_FAILURE,eventType:a.CEM_LOGGER_METRICS.EVENT_TYPES.VIEWABILITY,componentType:a.CEM_LOGGER_METRICS.COMPONENT_TYPES.CREATIVE,componentName:a.CEM_LOGGER_METRICS.COMPONENT_TYPES.CREATIVE}):n.onView(.5,1e3,function(){t.cemLogger.logEvent({eventName:a.CEM_LOGGER_METRICS.EVENT_NAMES.IN_VIEW,eventType:a.CEM_LOGGER_METRICS.EVENT_TYPES.VIEWABILITY,componentType:a.CEM_LOGGER_METRICS.COMPONENT_TYPES.CREATIVE,componentName:a.CEM_LOGGER_METRICS.COMPONENT_TYPES.CREATIVE})}))}}]),e}();t.default=d},function(e,t,n){e.exports=n(6)}]);