PageSourceSearch

https://statics.atresmedia.com/atresplayer/assets/scripts/freewheel/freewheel-adManager-7.0.0.js

js atresmedia.com collected 2026-10-01 10:16:40 UTC 373,620 bytes, 717 lines download raw bytes

1var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(h,l,p){h!=Array.prototype&&h!=Object.prototype&&(h[l]=p.value)};$jscomp.getGlobal=function(h){return"undefined"!=typeof window&&window===h?h:"undefined"!=typeof global&&null!=global?global:h};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
2$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var h=0;return function(l){return $jscomp.SYMBOL_PREFIX+(l||"")+h++}}();
3$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var h=$jscomp.global.Symbol.iterator;h||(h=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[h]&&$jscomp.defineProperty(Array.prototype,h,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(h){var l=0;return $jscomp.iteratorPrototype(function(){return l<h.length?{done:!1,value:h[l++]}:{done:!0}})};
4$jscomp.iteratorPrototype=function(h){$jscomp.initSymbolIterator();h={next:h};h[$jscomp.global.Symbol.iterator]=function(){return this};return h};$jscomp.makeIterator=function(h){$jscomp.initSymbolIterator();var l=h[Symbol.iterator];return l?l.call(h):$jscomp.arrayIterator(h)};$jscomp.arrayFromIterator=function(h){for(var l,p=[];!(l=h.next()).done;)p.push(l.value);return p};$jscomp.arrayFromIterable=function(h){return h instanceof Array?h:$jscomp.arrayFromIterator($jscomp.makeIterator(h))};
5$jscomp.iteratorFromArray=function(h,l){$jscomp.initSymbolIterator();h instanceof String&&(h+="");var p=0,a={next:function(){if(p<h.length){var b=p++;return{value:l(b,h[b]),done:!1}}a.next=function(){return{done:!0,value:void 0}};return a.next()}};a[Symbol.iterator]=function(){return a};return a};
6$jscomp.polyfill=function(h,l,p,a){if(l){p=$jscomp.global;h=h.split(".");for(a=0;a<h.length-1;a++){var b=h[a];b in p||(p[b]={});p=p[b]}h=h[h.length-1];a=p[h];l=l(a);l!=a&&null!=l&&$jscomp.defineProperty(p,h,{configurable:!0,writable:!0,value:l})}};$jscomp.polyfill("Array.prototype.keys",function(h){return h?h:function(){return $jscomp.iteratorFromArray(this,function(h){return h})}},"es6","es3");
7$jscomp.polyfill("Object.is",function(h){return h?h:function(h,p){return h===p?0!==h||1/h===1/p:h!==h&&p!==p}},"es6","es3");$jscomp.polyfill("Array.prototype.includes",function(h){return h?h:function(h,p){var a=this;a instanceof String&&(a=String(a));var b=a.length;for(p=p||0;p<b;p++)if(a[p]==h||Object.is(a[p],h))return!0;return!1}},"es7","es3");
8$jscomp.checkStringArgs=function(h,l,p){if(null==h)throw new TypeError("The 'this' value for String.prototype."+p+" must not be null or undefined");if(l instanceof RegExp)throw new TypeError("First argument to String.prototype."+p+" must not be a regular expression");return h+""};$jscomp.polyfill("String.prototype.includes",function(h){return h?h:function(h,p){return-1!==$jscomp.checkStringArgs(this,h,"includes").indexOf(h,p||0)}},"es6","es3");$jscomp.FORCE_POLYFILL_PROMISE=!1;
9$jscomp.polyfill("Promise",function(h){function l(){this.batch_=null}function p(a){return a instanceof b?a:new b(function(b,c){b(a)})}if(h&&!$jscomp.FORCE_POLYFILL_PROMISE)return h;l.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};l.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var a=$jscomp.global.setTimeout;l.prototype.asyncExecuteFunction=function(b){a(b,
100)};l.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var c=a[b];delete a[b];try{c()}catch(k){this.asyncThrow_(k)}}}this.batch_=null};l.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var b=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(f){b.reject(f)}};b.prototype.createResolveAndReject_=
11function(){function a(a){return function(d){c||(c=!0,a.call(b,d))}}var b=this,c=!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};
11b.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof b)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var c=null!=a;break a;case "function":c=!0;break a;default:c=!1}c?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};b.prototype.resolveToNonPromiseObj_=function(a){var b=
12void 0;try{b=a.then}catch(f){this.reject_(f);return}"function"==typeof b?this.settleSameAsThenable_(b,a):this.fulfill_(a)};b.prototype.reject_=function(a){this.settle_(2,a)};b.prototype.fulfill_=function(a){this.settle_(1,a)};b.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};b.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=
13this.onSettledCallbacks_,b=0;b<a.length;++b)a[b].call(),a[b]=null;this.onSettledCallbacks_=null}};var c=new l;b.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};b.prototype.settleSameAsThenable_=function(a,b){var c=this.createResolveAndReject_();try{a.call(b,c.resolve,c.reject)}catch(k){c.reject(k)}};b.prototype.then=function(a,c){function d(a,b){return"function"==typeof a?function(b){try{e(a(b))}catch(t){g(t)}}:b}var e,g,m=new b(function(a,
14b){e=a;g=b});this.callWhenSettled_(d(a,e),d(c,g));return m};b.prototype.catch=function(a){return this.then(void 0,a)};b.prototype.callWhenSettled_=function(a,b){function d(){switch(e.state_){case 1:a(e.result_);break;case 2:b(e.result_);break;default:throw Error("Unexpected state: "+e.state_);}}var e=this;null==this.onSettledCallbacks_?c.asyncExecute(d):this.onSettledCallbacks_.push(function(){c.asyncExecute(d)})};b.resolve=p;b.reject=function(a){return new b(function(b,c){c(a)})};b.race=function(a){return new b(function(b,
15c){for(var d=$jscomp.makeIterator(a),e=d.next();!e.done;e=d.next())p(e.value).callWhenSettled_(b,c)})};b.all=function(a){var c=$jscomp.makeIterator(a),d=c.next();return d.done?p([]):new b(function(a,b){function e(b){return function(c){f[b]=c;g--;0==g&&a(f)}}var f=[],g=0;do f.push(void 0),g++,p(d.value).callWhenSettled_(e(f.length-1),b),d=c.next();while(!d.done)})};return b},"es6","es3");$jscomp.owns=function(h,l){return Object.prototype.hasOwnProperty.call(h,l)};
16$jscomp.polyfill("Object.values",function(h){return h?h:function(h){var p=[],a;for(a in h)$jscomp.owns(h,a)&&p.push(h[a]);return p}},"es8","es3");$jscomp.polyfill("String.prototype.startsWith",function(h){return h?h:function(h,p){var a=$jscomp.checkStringArgs(this,h,"startsWith");h+="";var b=a.length,c=h.length;p=Math.max(0,Math.min(p|0,a.length));for(var d=0;d<c&&p<b;)if(a[p++]!=h[d++])return!1;return d>=c}},"es6","es3");
17$jscomp.polyfill("Object.assign",function(h){return h?h:function(h,p){for(var a=1;a<arguments.length;a++){var b=arguments[a];if(b)for(var c in b)$jscomp.owns(b,c)&&(h[c]=b[c])}return h}},"es6","es3");
18(function(){var h="SDK_"+"7.0.0-f9057ece-202401111918".replace(/[^\w]/g,"_"),l="undefined"!=typeof window?window:"undefined"!=typeof GLOBAL?GLOBAL:this;l.tv=l.tv||{};l.tv.freewheel=l.tv.freewheel||{};l.tv.freewheel[h]=function(h){var a={version:"js-7.0.0-f9057ece-202401111918"};"undefined"!==typeof window&&(window._fw_admanager=window._fw_admanager||{},window._fw_admanager.version=a.version);a.LOG_LEVEL_QUIET=0;a.LOG_LEVEL_INFO=1;a.LOG_LEVEL_DEBUG=2;a.setLogLevel=function(b){a.warn=a.log=a.debug=
19function(){};if("undefined"!==typeof console){try{window.localStorage&&window.localStorage.getItem("fwLogLevel")&&-1<window.localStorage.getItem("fwLogLevel")&&(b=window.localStorage.getItem("fwLogLevel"))}catch(c){console.warn(">FW Common.setLogLevel "+c.name+": "+c.message)}b>a.LOG_LEVEL_QUIET&&(a.log=function(){console.log(">FW "+(new Date).toISOString().substr(14,9)+" "+Array.prototype.slice.call(arguments).join(" "))},a.warn=function(){console.warn(">FW "+(new Date).toISOString().substr(14,9)+
20" "+Array.prototype.slice.call(arguments).join(" "))},b>a.LOG_LEVEL_INFO&&(a.debug=function(){console.log(">FW "+(new Date).toISOString().substr(14,9)+" "+Array.prototype.slice.call(arguments).join(" "))}))}};a.setLogLevel(a.LOG_LEVEL_INFO);a.log("FreeWheel Integration Runtime",a.version);a.proxyUrl=null;a.creativesProxyUrl=null;a.proxyAuthenticationParameter=null;a.setProxy=function(b){a.debug("setProxy: "+b);a.Util.isValidProxyUrl(b)&&(a.proxyUrl="/"!==b.charAt(b.length-1)?b+"/":b)};a.setCreativesProxy=
21function(b){a.debug("setCreativesProxy: "+b);a.Util.isValidProxyUrl(b)&&(a.creativesProxyUrl="/"!==b.charAt(b.length-1)?b+"/":b)};a.setProxyAuthenticationParameter=function(b,c){a.proxyAuthenticationParameter=2<=arguments.length&&b?{key:b,value:c||""}:null};a.checkUserAgent=function(b){a.PLATFORM_IS_WINDOWSPHONE=-1<b.search("windows phone");a.PLATFORM_IS_IPAD=-1<b.search("ipad");a.PLATFORM_IS_IPHONE_IPOD=-1<b.search("iphone")||-1<b.search("ipod");a.PLATFORM_IS_CHROMECAST=-1<b.search("crkey");var c=
22function(a){return(a=b.match(a))&&0<a.length?(a=a[0].match(/\d+/g),1*a[0]+.1*(1<a.length?a[1]:0)):0};a.PLATFORM_IE_MOBILE_VERSION=c(/iemobile\/\d+\.\d+/);a.PLATFORM_IOS_VERSION=c(/os \d+_\d+/);a.PLATFORM_ANDROID_VERSION=function(){if(-1<b.indexOf("transformer"))return 3.2;var a=c(/android \d+\.\d+/);return 0!==a?a:c(/android \d+/)}();a.PLATFORM_IS_SAFARI=0<a.PLATFORM_IOS_VERSION&&-1<b.search("applewebkit")||0===a.PLATFORM_ANDROID_VERSION&&0>b.search("chrome")&&-1<b.search("safari");a.PLATFORM_IS_CHROME=
230>b.search("edge")&&-1<b.search("chrome");a.PLATFORM_IS_FIREFOX=-1<b.search("firefox");a.PLATFORM_IS_MOBILE=0<a.PLATFORM_IOS_VERSION||0<a.PLATFORM_ANDROID_VERSION;a.PLATFORM_BROWSER_VERSION=function(a){var b="",c;-1!==(c=a.indexOf("opr/"))?b=a.substring(c+4):-1!==(c=a.indexOf("opera"))?(b=a.substring(c+6),-1!==(c=a.indexOf("version"))&&(b=a.substring(c+8))):-1!==(c=a.indexOf("rv:"))?b=a.substring(c+3):-1!==(c=a.indexOf("msie"))?b=a.substring(c+5):-1!==(c=a.indexOf("edge"))?b=a.substring(c+5):-1!==
24(c=a.indexOf("chrome"))?b=a.substring(c+7):-1!==(c=a.indexOf("safari"))?(b=a.substring(c+7),-1!==(c=a.indexOf("version"))&&(b=a.substring(c+8))):-1!==(c=a.indexOf("firefox"))?b=a.substring(c+8):a.lastIndexOf(" ")+1<(c=a.lastIndexOf("/"))&&(b=a.substring(c+1));var d;-1!==(d=b.indexOf(";"))&&(b=b.substring(0,d));-1!==(d=b.indexOf(" "))&&(b=b.substring(0,d));return(a=parseInt(""+b,10))?a:0}(b);a.PLATFORM_ID=a.PLATFORM_IS_MOBILE?0<a.PLATFORM_ANDROID_VERSION?"Android"+a.PLATFORM_ANDROID_VERSION:a.PLATFORM_IS_IPAD?
25"iPad"+a.PLATFORM_IOS_VERSION:a.PLATFORM_IS_IPHONE_IPOD?"iPhone"+a.PLATFORM_IOS_VERSION:"UnknownMobile":"Desktop";a.log("Device:",a.PLATFORM_ID,"PLATFORM_IS_SAFARI:",a.PLATFORM_IS_SAFARI,"PLATFORM_IS_CHROME:",a.PLATFORM_IS_CHROME)};a.checkUserAgent(navigator.userAgent.toLowerCase());a.PLATFORM_EVENT_CLICK=a.PLATFORM_IS_MOBILE?"touchend":"click";a.MOBILE_EVENT_DRAG="touchmove";a.PLATFORM_SEND_REQUEST_BY_FORM=!1;a.PLATFORM_SEND_REQUEST_BY_JS=!1;a.PLATFORM_AUTO_SEEK_AFTER_MIDROLL=a.PLATFORM_IS_IPAD;
26a.PLATFORM_NOT_SUPPORT_OVERLAY_AD=a.PLATFORM_IS_IPHONE_IPOD||a.PLATFORM_IS_WINDOWSPHONE;a.PLATFORM_NOT_SUPPORT_MIDROLL_AD=9<=a.PLATFORM_IE_MOBILE_VERSION;a.PLATFORM_NOT_SUPPORT_CLICK_FOR_VIDEO=a.PLATFORM_IS_IPHONE_IPOD&&10>a.PLATFORM_IOS_VERSION||a.PLATFORM_IS_WINDOWSPHONE||a.PLATFORM_IS_CHROMECAST;a.PLATFORM_NOT_FIRE_CLICK_WHEN_AD_VIDEO_PAUSED=3.1<=a.PLATFORM_ANDROID_VERSION||10<=a.PLATFORM_IOS_VERSION;a.PLATFORM_VIDEO_DOESNOT_SUPPORT_TIMEUPDATE=9<=a.PLATFORM_IE_MOBILE_VERSION;a.PLATFORM_PLAY_DUMMY_VIDEO_FOR_PREROLL=
270<a.PLATFORM_IOS_VERSION&&4.2>a.PLATFORM_IOS_VERSION&&4<=a.PLATFORM_IOS_VERSION;a.PLATFORM_SUPPORT_VIDEO_START_DETECT_TIMEOUT=0===a.PLATFORM_IOS_VERSION||4<=a.PLATFORM_IOS_VERSION&&4.2>a.PLATFORM_IOS_VERSION;a.PLATFORM_BLOCKS_AUTOPLAY=a.PLATFORM_IS_MOBILE||a.PLATFORM_IS_SAFARI||a.PLATFORM_IS_CHROME&&(0<a.PLATFORM_ANDROID_VERSION||64<=a.PLATFORM_BROWSER_VERSION)||a.PLATFORM_IS_FIREFOX&&66<=a.PLATFORM_BROWSER_VERSION;a.PLATFORM_NOT_SUPPORT_DASH=0<a.PLATFORM_IOS_VERSION;a.PLATFORM_HLSJS_MIN_VERSION=
28"0.11.0";a.PLATFORM_DASHJS_SUPPORTED_VERSION="3.0.3";a.CONTEXT_REQUEST_TIMEOUT=5;a.RENDERER_STATE_INIT=1;a.RENDERER_STATE_STARTING=2;a.RENDERER_STATE_STARTED=3;a.RENDERER_STATE_COMPLETING=4;a.RENDERER_STATE_COMPLETED=5;a.RENDERER_STATE_FAILED=6;a.TRANSLATOR_STATE_INIT=a.RENDERER_STATE_INIT;a.TRANSLATOR_STATE_STARTING=a.RENDERER_STATE_STARTING;a.TRANSLATOR_STATE_STARTED=a.RENDERER_STATE_STARTED;a.TRANSLATOR_STATE_COMPLETING=a.RENDERER_STATE_COMPLETING;a.TRANSLATOR_STATE_COMPLETED=a.RENDERER_STATE_COMPLETED;
29a.TRANSLATOR_STATE_FAILED=a.RENDERER_STATE_FAILED;a.EVENT_AD="adEvent";a.EVENT_AD_BUFFERING_START="adBufferingStart";a.EVENT_AD_BUFFERING_END="adBufferingEnd";a.EVENT_SLOT_IMPRESSION="slotImpression";a.EVENT_SLOT_END="slotEnd";a.EVENT_AD_INITIATED="adInitiated";a.EVENT_AD_PREINIT="preInit";a.EVENT_AD_IMPRESSION="defaultImpression";a.EVENT_AD_IMPRESSION_END="adEnd";a.EVENT_AD_QUARTILE="quartile";a.EVENT_AD_FIRST_QUARTILE="firstQuartile";a.EVENT_AD_MIDPOINT="midPoint";a.EVENT_AD_THIRD_QUARTILE="thirdQuartile";
30a.EVENT_AD_SKIPPED="adSkipped";a.EVENT_AD_PROGRESS="progress";a.EVENT_AD_COMPLETE="complete";a.EVENT_AD_CLICK="defaultClick";a.EVENT_AD_MUTE="_mute";a.EVENT_AD_UNMUTE="_un-mute";a.EVENT_AD_COLLAPSE="_collapse";a.EVENT_AD_EXPAND="_expand";a.EVENT_AD_PAUSE="_pause";a.EVENT_AD_RESUME="_resume";a.EVENT_AD_REWIND="_rewind";a.EVENT_AD_ACCEPT_INVITATION="_accept-invitation";a.EVENT_AD_CLOSE="_close";a.EVENT_AD_MINIMIZE="_minimize";a.EVENT_ERROR="_e_unknown";a.EVENT_RESELLER_NO_AD="resellerNoAd";a.EVENT_AD_MEASUREMENT=
31"concreteEvent";a.EVENT_EXTENSION_LOADED="extensionLoaded";a.EVENT_AD_VOLUME_CHANGE="adVolumeChange";a.EVENT_AD_AUTO_PLAY_BLOCKED="videoAutoPlayBlocked";a.EVENT_AD_SKIPPABLE_STATE_CHANGED="skippableStateChanged";a.EVENT_VIDEO_DISPLAY_BASE_CHANGED="videoDisplayBaseChanged";a.INFO_KEY_CUSTOM_ID="customId";a.INFO_KEY_MODULE_TYPE="moduleType";a.INFO_KEY_AD_SKIPPABLE_STATE="skippableState";a.MODULE_TYPE_EXTENSION="extension";a.MODULE_TYPE_RENDERER="renderer";a.MODULE_TYPE_TRANSLATOR="translator";a.INFO_KEY_START_TIME_POSITION=
32"startTimePosition";a.INFO_KEY_ERROR_CODE="errorCode";a.INFO_KEY_ERROR_INFO="errorInfo";a.INFO_KEY_ERROR_MODULE="errorModule";a.INFO_KEY_VAST_ERROR_CODE="vastErrorCode";a.ERROR_IO="_e_io";a.ERROR_TIMEOUT="_e_timeout";a.ERROR_NULL_ASSET="_e_null-asset";a.ERROR_ADINSTANCE_UNAVAILABLE="_e_adinst-unavail";a.ERROR_UNKNOWN="_e_unknown";a.ERROR_MISSING_PARAMETER="_e_missing-param";a.ERROR_NO_AD_AVAILABLE="_e_no-ad";a.ERROR_PARSE="_e_parse";a.ERROR_INVALID_VALUE="_e_invalid-value";a.ERROR_INVALID_SLOT="_e_invalid-slot";
33a.ERROR_NO_RENDERER="_e_no-renderer";a.ERROR_DEVICE_LIMIT="_e_device-limit";a.ERROR_3P_COMPONENT="_e_3p-comp";a.ERROR_UNSUPPORTED_3P_FEATURE="_e_unsupp-3p-feature";a.ERROR_SECURITY="_e_security";a.ERROR_UNMATCHED_SLOT_SIZE="_e_slot-size-unmatch";a.ERROR_DASHJS="_e_dashjs";a.ERROR_HLSJS="_e_hlsjs";a.ERROR_CUSTOM_PLAYER="_e_custom_player";a.INFO_KEY_URL="url";a.INFO_KEY_SHOW_BROWSER="showBrowser";a.INFO_KEY_CUSTOM_EVENT_NAME="customEventName";a.INFO_KEY_NEED_EMPTY_CT="needEmptyCT";a.INFO_KEY_CONCRETE_EVENT_ID=
34"concreteEventId";a.EVENT_TYPE_CLICK_TRACKING="CLICKTRACKING";a.EVENT_TYPE_IMPRESSION="IMPRESSION";a.EVENT_TYPE_CLICK="CLICK";a.EVENT_TYPE_STANDARD="STANDARD";
34a.EVENT_TYPE_GENERIC="GENERIC";a.EVENT_TYPE_ERROR="ERROR";a.EVENT_VIDEO_VIEW="videoView";a.SHORT_EVENT_TYPE_IMPRESSION="i";a.SHORT_EVENT_TYPE_CLICK="c";a.SHORT_EVENT_TYPE_STANDARD="s";a.SHORT_EVENT_TYPE_ERROR="e";a.INIT_VALUE_ZERO="0";a.INIT_VALUE_ONE="1";a.INIT_VALUE_TWO="2";a.INFO_KEY_PARAMETERS="parameters";a.URL_PARAMETER_KEY_ET="et";a.URL_PARAMETER_KEY_CN=
35"cn";a.URL_PARAMETER_KEY_INIT="init";a.URL_PARAMETER_KEY_CT="ct";a.URL_PARAMETER_KEY_METR="metr";a.URL_PARAMETER_KEY_CR="cr";a.URL_PARAMETER_KEY_KEY_VALUE="kv";a.URL_PARAMETER_KEY_ERROR_INFO="additional";a.URL_PARAMETER_KEY_ERROR_MODULE="renderer";a.URL_PARAMETER_KEY_CREATIVE_RENDITION_ID="reid";a.URL_PARAMETER_KEY_CONCRETE_EVENT_ID="creid";a.URL_PARAMETER_START_TIME_POSITION="stpos";a.URL_PARAMETER_KEY_AUTO_PLAY_BLOCKED="f";a.URL_PARAMETER_KEY_AUTO_PLAY_BLOCKED_VALUE="16777216";a.CAPABILITY_SLOT_TEMPLATE=
36"sltp";a.CAPABILITY_DISPLAY_REFRESH="rfnt";a.CAPABILITY_MULTIPLE_CREATIVE_RENDITIONS="emcr";a.CAPABILITY_RECORD_VIDEO_VIEW="exvt";a.CAPABILITY_CHECK_COMPANION="cmpn";a.CAPABILITY_CHECK_TARGETING="targ";a.CAPABILITY_RESET_EXCLUSIVITY="rste";a.CAPABILITY_FALLBACK_UNKNOWN_ASSET="unka";a.CAPABILITY_FALLBACK_UNKNOWN_SITE_SECTION="unks";a.CAPABILITY_FALLBACK_ADS="fbad";a.CAPABILITY_SLOT_CALLBACK="slcb";a.CAPABILITY_NULL_CREATIVE="nucr";a.CAPABILITY_AUTO_EVENT_TRACKING="aeti";a.CAPABILITY_RENDERER_MANIFEST=
37"rema";a.CAPABILITY_REQUIRE_VIDEO_CALLBACK="vicb";a.CAPABILITY_SKIP_AD_SELECTION="skas";a.CAPABILITY_REQUIRE_ADVANCED_CALLBACK="amcb";a.CAPABILITY_REQUIRE_QUARTILE_CALLBACK="qtcb";a.CAPABILITY_REQUIRE_COMPLETE_CALLBACK="cpcb";a.SLOT_TYPE_TEMPORAL="temporal";a.SLOT_TYPE_VIDEOPLAYER_NONTEMPORAL="videoPlayerNonTemporal";a.SLOT_TYPE_SITESECTION_NONTEMPORAL="siteSectionNonTemporal";a.TIME_POSITION_CLASS_PREROLL="PREROLL";a.TIME_POSITION_CLASS_MIDROLL="MIDROLL";a.TIME_POSITION_CLASS_POSTROLL="POSTROLL";
38a.TIME_POSITION_CLASS_OVERLAY="OVERLAY";a.TIME_POSITION_CLASS_DISPLAY="DISPLAY";a.TIME_POSITION_CLASS_PAUSE_MIDROLL="PAUSE_MIDROLL";a.EVENT_REQUEST_INITIATED="onRequestInitiated";a.EVENT_REQUEST_COMPLETE="onRequestComplete";a.EVENT_SLOT_STARTED="onSlotStarted";a.EVENT_SLOT_ENDED="onSlotEnded";a.EVENT_CONTENT_VIDEO_PAUSED="contentVideoPaused";a.EVENT_CONTENT_VIDEO_RESUMED="contentVideoResumed";a.EVENT_CONTENT_VIDEO_PAUSE_REQUEST="contentVideoPauseRequest";a.EVENT_CONTENT_VIDEO_RESUME_REQUEST="contentVideoResumeRequest";
39a.EVENT_USER_ACTION_NOTIFIED="userActionNotified";a.EVENT_USER_ACTION_PAUSE_BUTTON_CLICKED="pauseButtonClicked";a.EVENT_USER_ACTION_RESUME_BUTTON_CLICKED="resumeButtonClicked";a.CAPABILITY_STATUS_OFF=0;a.CAPABILITY_STATUS_ON=1;a.PARAMETER_LEVEL_PROFILE=0;a.PARAMETER_LEVEL_GLOBAL=1;a.PARAMETER_LEVEL_OVERRIDE=5;a.PARAMETER_ENABLE_COUNTING_REPLAY_CALLBACK="enableCountingReplayCallback";a.PARAMETER_ENABLE_FORM_TRANSPORT="sdk.enableFormTransport";a.PARAMETER_ENABLE_JS_TRANSPORT="sdk.enableJSTransport";
40a.PARAMETER_DESIRED_BITRATE="desiredBitrate";a.PARAMETER_PAGE_SLOT_CONTENT_TYPE="sdk.pageSlotContentType";a.PARAMETER_EXTENSION_AD_CONTROL_CLICK_ELEMENT="extension.ad.control.clickElement";a.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED="extension.contentVideo.enabled";a.PARAMETER_EXTENSION_CONTENT_VIDEO_RESPOND_PAUSE_RESUME="extension.contentVideo.respondPauseResume";a.PARAMETER_EXTENSION_CONTENT_VIDEO_AUTO_SEEK_BACK="extension.contentVideo.autoSeekBack";a.PARAMETER_EXTENSION_CONTENT_VIDEO_AUTO_SOURCE_RESTORE=
41"extension.contentVideo.autoSourceRestore";a.PARAMETER_EXTENSION_PAUSE_AD_ENABLE="extension.pausead.enable";a.PARAMETER_EXTENSION_OMSDK_ENABLED="extension.omsdk.enabled";a.PARAMETER_EXTENSION_VIDEO_STATE_ENABLED="extension.videoState.enabled";a.PARAMETER_EXTENSION_SKIPPABLE_AD_ENABLED="extension.skippableAd.enabled";a.PARAMETER_EXTENSION_SKIPPABLE_AD_BUTTON_TEXT="extension.skippableAd.buttonText";a.PARAMETER_EXTENSION_SKIPPABLE_AD_BUTTON_CLASS="extension.skippableAd.buttonClass";a.PARAMETER_EXTENSION_SKIPPABLE_AD_CONTROL_CLICK_ELEMENT=
42"extension.skippableAd.control.clickElement";a.PARAMETER_RENDERER_VIDEO_START_DETECT_TIMEOUT="renderer.video.startDetectTimeout";a.PARAMETER_RENDERER_VIDEO_PROGRESS_DETECT_TIMEOUT="renderer.video.progressDetectTimeout";a.PARAMETER_RENDERER_VIDEO_ANDROID_DELAY="renderer.video.android.delay";a.PARAMETER_RENDERER_VIDEO_DISPLAY_CONTROLS_WHEN_PAUSE="renderer.video.displayControlsWhenPause";a.PARAMETER_RENDERER_VIDEO_CLICK_DETECTION="renderer.video.clickDetection";a.PARAMETER_RENDERER_VIDEO_PLAY_AFTER_STALLED=
43"renderer.video.playAfterStalled";a.PARAMETER_EXTENSION_SURVEY_ENABLED="extension.survey.enabled";a.PARAMETER_AUTO_PAUSE_AD_ONVISIBILITYCHANGE="autoPauseAdOnVisibilityChange";a.PARAMETER_DISABLE_CORS_ENFORCEMENT="disableCORSEnforcement";a.PARAMETER_ENABLE_ACCESS_CONTROL_ALLOW_CREDENTIALS="enableAccessControlAllowCredentials";
43a.PARAMETER_RENDERER_DISPLAY_COAD_SCRIPT_NAME="renderer.html.coadScriptName";a.PARAMETER_RENDERER_HTML_SHOULD_BACKGROUND_TRANSPARENT="renderer.html.isBackgroundTransparent";a.PARAMETER_RENDERER_HTML_SHOULD_END_AFTER_DURATION=
44"renderer.html.shouldEndAfterDuration";a.PARAMETER_RENDERER_HTML_AD_LOAD_TIMEOUT="renderer.html.adLoadTimeout";a.PARAMETER_RENDERER_HTML_RENDER_IMAGE_WITHOUT_IFRAME="renderer.html.renderImageWithoutIFrame";a.PARAMETER_RENDERER_HTML_PLACEMENT_TYPE="renderer.html.placementType";a.PARAMETER_RENDERER_HTML_BOOTSTRAP="renderer.html.bootstrap";a.PARAMETER_RENDERER_HTML_PRIMARY_ANCHOR="renderer.html.primaryAnchor";a.PARAMETER_RENDERER_HTML_MARGIN_WIDTH="renderer.html.marginWidth";a.PARAMETER_RENDERER_HTML_MARGIN_HEIGHT=
45"renderer.html.marginHeight";a.PARAMETER_VPAID_CREATIVE_TIMEOUT_DELAY="renderer.vpaid.creativeTimeoutDelay";a.PARAMETER_VAST_TIMEOUT_IN_MILLISECONDS="translator.vast.timeoutInMilliseconds";a.PARAMETER_VAST_MAX_WRAPPER_COUNT="translator.vast.maxWrapperCount";a.VAST_DEFAULT_MAX_WRAPPER_COUNT=5;a.PARAMETER_RENDERER_HTML_PLACEMENT_TYPE_INTERSTITIAL="interstitial";a.PARAMETER_RENDERER_HTML_BASEUNIT_INTERSTITIAL="app-interstitial";a.PARAMETER_CONSENT_RETRIEVAL_TIMEOUT="consent_retrieval_timeout";a.PARAMETER_USE_GDPR_TCFAPI=
46"useGDPR_TCFAPI";a.PARAMETER_USE_CCPA_USPAPI="useCCPA_USPAPI";a.PARAMETER_USE_GPP="useGPP";a.CMP_GPP_VERSION=null;a.GDPR_TCFAPI_VERSION=2;a.CCPA_USPAPI_VERSION=1;a.ID_TYPE_FW=1;a.ID_TYPE_CUSTOM=2;a.ID_TYPE_GROUP=3;a.VIDEO_STATE_PLAYING=1;a.VIDEO_STATE_PAUSED=2;a.VIDEO_STATE_STOPPED=3;a.VIDEO_STATE_COMPLETED=4;a.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED=1;a.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED=2;a.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE=3;a.VIDEO_ASSET_AUTO_PLAY_TYPE_CLICK_TO_PLAY=4;a.VIDEO_ASSET_DURATION_TYPE_EXACT=
47"exact";a.VIDEO_ASSET_DURATION_TYPE_VARIABLE="variable";a.ADUNIT_PREROLL="preroll";a.ADUNIT_MIDROLL="midroll";a.ADUNIT_POSTROLL="postroll";a.ADUNIT_OVERLAY="overlay";a.ADUNIT_STREAM_PREROLL="stream_preroll";a.ADUNIT_STREAM_POSTROLL="stream_postroll";a.ADUNIT_PAUSE_MIDROLL="pause_midroll";a.SLOT_LOCATION_PLAYER="player";a.SLOT_LOCATION_EXTERNAL="external";a.SLOT_OPTION_INITIAL_AD_STAND_ALONE=0;a.SLOT_OPTION_INITIAL_AD_KEEP_ORIGINAL=1;a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_ONLY=2;a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_OR_STAND_ALONE=
483;a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_THEN_STAND_ALONE=4;a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_OR_NO_STAND_ALONE=5;a.SLOT_OPTION_INITIAL_AD_NO_STAND_ALONE=6;a.SLOT_OPTION_INITIAL_AD_NO_STAND_ALONE_IF_TEMPORAL=7;a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_OR_NO_STAND_ALONE_IF_TEMPORAL=8;a.REQUEST_MODE_ON_DEMAND="on-demand";a.REQUEST_MODE_LIVE="live";a.MINIMUM_VAST_VERSION_SUPPORTED=2;a.MAXIMUM_VAST_VERSION_SUPPORTED=4;a.ERROR_VAST_XML_PARSING="100";a.ERROR_VAST_SCHEMA_VALIDATION="101";a.ERROR_VAST_VERSION_NOT_SUPPORTED=
49"102";a.ERROR_VAST_TRACKING_ERROR="200";a.ERROR_VAST_LINEARITY_NOT_MATCH="201";a.ERROR_VAST_NO_AD="303";a.ERROR_VAST_WRAPPER_LIMIT_REACH="302";a.ERROR_VAST_URI_TIMEOUT="301";a.ERROR_VAST_GENERAL_LINEAR_ERROR="400";a.ERROR_VAST_NON_LINEAR_GENERAL_ERROR="500";a.ERROR_VAST_COMPANION_GENERAL_ERROR="600";a.ERROR_VAST_GENERAL_VPAID_ERROR="901";a.AD_VIDEO_PAUSED_BY_RENDERER=1;a.AD_VIDEO_PAUSED_BY_TAB_SWITCH=2;a.AD_VIDEO_UNPAUSED=3;a.AD_VIDEO_HLS_PAUSED_BY_RENDERER_AFTER_TAB_SWITCH=4;a.OMSDK_LIBRARY_VERSION=
50"1.4.7";a.OMSDK_PARTNER_NAME="Freewheeltv";a.OMSDK_SERVICE_SCRIPT_URL="https://mssl.fwmrm.net/libs/omsdk/"+a.OMSDK_LIBRARY_VERSION+"/omweb-v1.js";a.OMSDK_SESSION_SCRIPT_URL="https://mssl.fwmrm.net/libs/omsdk/"+a.OMSDK_LIBRARY_VERSION+"/omid-session-client-v1.js";a.OMSDK_ACCESS_MODE="full";a.OMSDK_CREATIVE_TYPE_VIDEO="video";a.OMSDK_IMPRESSION_TYPE_BEGIN_TO_RENDER="beginToRender";a.AD_VERIFICATION_EVENT_NOT_EXECUTED="verificationNotExecuted";a.VERIFICATION_RESOURCE_REJECTED="1";a.VERIFICATION_NOT_SUPPORTED=
51"2";a.VERIFICATION_RESOURCE_LOAD_ERROR="3";a.IAB_API_FRAMEWORKS_VPAID_2=2;a.IAB_API_FRAMEWORKS_MRAID_1=3;a.IAB_API_FRAMEWORKS_OMID_1=7;a.PARAMETER_SIMID_FULL_SCREEN_ALLOWED="renderer.simid.fullScreenAllowed";
51a.PARAMETER_SIMID_CREATIVE_TIMEOUT_DELAY="renderer.simid.creativeTimeoutDelay";a.SimidProtocolMessage={CREATE_SESSION:"createSession",RESOLVE:"resolve",REJECT:"reject"};a.SimidMediaMessage={DURATION_CHANGE:"Media:durationchange",ENDED:"Media:ended",ERROR:"Media:error",PAUSE:"Media:pause",PLAY:"Media:play",
52PLAYING:"Media:playing",SEEKED:"Media:seeked",SEEKING:"Media:seeking",STALLED:"Media:stalled",TIME_UPDATE:"Media:timeupdate",VOLUME_CHANGE:"Media:volumechange"};a.SimidPlayerMessage={RESIZE:"Player:resize",INIT:"Player:init",LOG:"Player:log",START_CREATIVE:"Player:startCreative",AD_SKIPPED:"Player:adSkipped",AD_STOPPED:"Player:adStopped",FATAL_ERROR:"Player:fatalError"};a.SimidCreativeMessage={REQUEST_PAUSE:"Creative:requestPause",REQUEST_PLAY:"Creative:requestPlay",FATAL_ERROR:"Creative:fatalError",
53GET_MEDIA_STATE:"Creative:getMediaState",LOG:"Creative:log",REQUEST_FULL_SCREEN:"Creative:requestFullScreen",REQUEST_EXIT_FULL_SCREEN:"Creative:requestExitFullScreen",REQUEST_SKIP:"Creative:requestSkip",REQUEST_STOP:"Creative:requestStop",REQUEST_RESIZE:"Creative:requestResize",REQUEST_VOLUME:"Creative:requestVolume",REQUEST_TRACKING:"Creative:reportTracking",REQUEST_CHANGE_AD_DURATION:"Creative:requestChangeAdDuration"};a.SimidStopCode={UNSPECIFIED:0,USER_INITIATED:1,MEDIA_PLAYBACK_COMPLETE:2,PLAYER_INITATED:3,
54CREATIVE_INITIATED:4,NON_LINEAR_DURATION_COMPLETE:5};a.SimidPlayerErrorCode={UNSPECIFIED:1200,WRONG_VERSION:1201,UNSUPPORTED_TIME:1202,UNSUPPORTED_FUNCTIONALITY_REQUEST:1203,UNSUPPORTED_ACTIONS:1204,POSTMESSAGE_CHANNEL_OVERLOADED:1205,VIDEO_COULD_NOT_LOAD:1206,VIDEO_TIME_OUT:1207,RESPONSE_TIMEOUT:1208,MEDIA_NOT_SUPPORTED:1209,SPEC_NOT_FOLLOWED_ON_INIT:1210,SPEC_NOT_FOLLOWED_ON_MESSAGES:1211,SESSION_NOT_CREATED:1223};a.SimidCreativeErrorCode={UNSPECIFIED:1100,CANNOT_LOAD_RESOURCE:1101,PLAYBACK_AREA_UNUSABLE:1102,
55INCORRECT_VERSION:1103,TECHNICAL_ERROR:1104,EXPAND_NOT_POSSIBLE:1105,PAUSE_NOT_HONORED:1106,PLAYMODE_NOT_ADEQUATE:1107,CREATIVE_INTERNAL_ERROR:1108,DEVICE_NOT_SUPPORTED:1109,MESSAGES_NOT_FOLLOWING_SPEC:1110,PLAYER_RESPONSE_TIMEOUT:1111};a.SimidEventsThatRequireResponse=[a.SimidCreativeMessage.GET_MEDIA_STATE,a.SimidCreativeMessage.REQUEST_VIDEO_LOCATION,a.SimidCreativeMessage.READY,a.SimidCreativeMessage.CLICK_THRU,a.SimidCreativeMessage.REQUEST_SKIP,a.SimidCreativeMessage.REQUEST_STOP,a.SimidCreativeMessage.REQUEST_PAUSE,
56a.SimidCreativeMessage.REQUEST_PLAY,a.SimidCreativeMessage.REQUEST_FULL_SCREEN,a.SimidCreativeMessage.REQUEST_VOLUME,a.SimidCreativeMessage.REQUEST_RESIZE,a.SimidCreativeMessage.REQUEST_CHANGE_AD_DURATION,a.SimidCreativeMessage.REPORT_TRACKING,a.SimidPlayerMessage.INIT,a.SimidPlayerMessage.START_CREATIVE,a.SimidPlayerMessage.AD_SKIPPED,a.SimidPlayerMessage.AD_STOPPED,a.SimidPlayerMessage.FATAL_ERROR,a.SimidProtocolMessage.CREATE_SESSION];a.Util={setContext:function(b){a.Util._context=b},getParameterAccessControlAllowCredentials:function(){if(!a.Util._context)return!1;
57var b=a.Util._context.getParameter(a.PARAMETER_ENABLE_ACCESS_CONTROL_ALLOW_CREDENTIALS);return!0===a.Util.str2bool(b)},canPlayVideoType:function(b){"video/3gp"===b&&(b="video/3gpp");if("video/3gpp"===b&&!a.PLATFORM_IS_SAFARI||a.PLATFORM_IS_SAFARI&&("video/ogg"===b||"video/webm"===b))return!1;if(1<a.PLATFORM_ANDROID_VERSION&&"video/m4v"===b)return!0;var c=document.createElement("video");return c.canPlayType?"undefined"!==typeof Hls&&Hls.isSupported()&&this.isMimeTypeHls(b)?!0:!(!c.canPlayType(b)&&
58!c.canPlayType(b.replace("/","/x-"))):!1},isMimeTypeHls:function(a){a=a.toLowerCase();return"application/x-mpegurl"===a||"application/vnd.apple.mpegurl"===a},str2bool:function(b){if(!b)return!1;b=a.Util.trim(b).toLowerCase();return"true"===b||"yes"===b||"on"===b||"1"===b},trim:function(a){return"string"!==typeof a?a.toString():a.replace(/^\s+|\s+$/g,"")},isBlank:function(b){return!b||""===a.Util.trim(b)},encodeToHex:function(a){for(var b="",d=0;d<a.length;d++){for(var e=a.charCodeAt(d).toString(16).toUpperCase();4>
59e.length;)e="0"+e;b+="\\u"+e.toUpperCase()}return b},forEachOnArray:function(a,c,d){var b;if(null==a)throw new TypeError(" array is null or not defined");a=Object(a);var f=a.length>>>0;if("[object Function]"!=={}.toString.call(c))throw new TypeError(c+" is not a function");d&&(b=d);for(d=0;d<f;){if(d in a){var k=a[d];c.call(b,k,d,a)}d++}},mixin:function(a,c){for(var b in c)"undefined"!==typeof c[b]&&(a[b]=c[b]);return a},copy:function(b){return a.Util.mixin({},b)},bind:function(a,c){var b=c,e=Array.prototype.slice.call(arguments);
60e.shift();b=e.shift();return function(){return b.apply(a,e.concat(Array.prototype.slice.call(arguments)))}},getObject:function(a,c,d){if(!a)return null;a=a.split(".");c=c||window;for(var b=0,f;c&&(f=a[b]);b++)c=f in c?c[f]:d?c[f]={}:void 0;return c},transformToProxy:function(b,c){if(null==b||null==c)return b;c=c.replace("$","$$");b=b.replace(/https?:\/\//,c);a.proxyAuthenticationParameter&&(b=a.Util.setParameterInURL(b,a.proxyAuthenticationParameter.key,a.proxyAuthenticationParameter.value));return b},
61transformUrlToProxy:function(b){return this.transformToProxy(b,a.proxyUrl)},transformCreativeUrlToProxy:function(b){return this.transformToProxy(b,a.creativesProxyUrl)},pingURLWithImage:function(b){(new Image(1,1)).src=a.Util.transformUrlToProxy(b)},pingURLWithForm:function(b,c,d){d=d?"_fw_request":"_fw_cb";null==c&&(c=Math.random());var e=document.createElement("iframe");
61e.name=d+"_iframe_"+c;e.id=d+"_iframe_"+c;e.style.position="absolute";e.style.left="-10000px";e.style.width="1px";e.style.visibility=
62"hidden";var f=document.createElement("form");f.action=a.Util.transformUrlToProxy(b);f.id=d+"_form_"+c;f.target=e.id;f.method="post";f.style.position="absolute";f.style.left="-10000px";f.style.width="1px";f.style.visibility="hidden";document.body&&(document.body.appendChild(e),document.body.appendChild(f),f.submit(),document.body.removeChild(f))},pingURLWithScript:function(b){var c=document.getElementsByTagName("head")[0],d=document.createElement("script");d.src=a.Util.transformUrlToProxy(b);d.onload=
63d.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||c.removeChild(d)};c.appendChild(d)},pingURLWithXMLHTTPRequest:function(b){var c=new XMLHttpRequest,d=a.Util.transformUrlToProxy(b);c.onload=function(){200===c.status?a.debug("Sent pingback: "+d+". Status: "+c.status):a.warn("Pingback not sent: "+d+". Status: "+c.status)};c.onerror=function(b){a.warn("An error ocurred while trying to send pingback:"+d+". Error: "+JSON.stringify(b))};c.ontimeout=
64function(){a.warn("Timeout ocurred while trying to send pingback:"+d)};c.timeout=1E3*a.CONTEXT_REQUEST_TIMEOUT;c.open("GET",d,!0);c.withCredentials=a.Util.getParameterAccessControlAllowCredentials();c.send()},extractAdResponseJSONFromXMLHttpRequest:function(b,c){String.prototype.rsplit=function(a,b){var c=this.split(a);return b?[c.slice(0,-b).join(a)].concat(c.slice(-b)):c};try{var d=c.split(".requestComplete(");return d&&0!=d.length?-1>=d[0].indexOf("tv.freewheel.SDK._instanceQueue['Context_"+b+
65"']")?(a.warn("An error occured while trying to parse the ad response. The callback function is not set correctly."),null):JSON.parse(d[1].rsplit(");",1)[0]):(a.warn("An error occured while trying to parse the ad response."),null)}catch(e){return a.warn("An error occured while trying to parse the ad response: "+e),null}},sendAdRequestWithXMLHTTPRequest:function(b){var c=new XMLHttpRequest,d=a.Util.transformUrlToProxy(b);c.onload=function(){if(200===c.status){a.debug("Sent request: "+d+". Status: "+
66c.status);var b=a.Util.extractAdResponseJSONFromXMLHttpRequest(a.Util._context._instanceId,c.responseText);a.Util._context.requestComplete(b)}else a.warn("Request not sent: "+d+". Status: "+c.status)};c.onerror=function(b){a.warn("An error ocurred while trying to send ad request: "+d+". Error: "+JSON.stringify(b));a.Util._context.requestComplete(null)};c.ontimeout=function(){a.warn("Timeout ocurred while trying to send the ad request: "+d)};c.timeout=1E3*a.CONTEXT_REQUEST_TIMEOUT;c.open("GET",d,!0);
67c.withCredentials=a.Util.getParameterAccessControlAllowCredentials();c.send()},pingURL:function(b){a.debug("send callback: "+b);b&&(a.PLATFORM_SEND_REQUEST_BY_FORM?a.Util.pingURLWithForm(b,null,!1):a.PLATFORM_SEND_REQUEST_BY_JS?a.Util.pingURLWithXMLHTTPRequest(b):a.Util.pingURLWithImage(b))},pingURLs:function(b){for(var c=0;c<b.length;c++)a.Util.pingURL(b[c])},setParameterInURL:function(a,c,d){if(!a||!c||null==d)return null;var b=!1;a=a.split("?");d=encodeURIComponent(d);if(a[1]){var f=a[1].split("&");
68for(var k=0;k<f.length;++k){var g=f[k].split("=");if(g[0]===c){f[k]=g[0]+"="+d;b=!0;break}}g=f.join("&");b||(g=c+"="+d+"&"+g)}else g=c+"="+d;return g=a[0]+"?"+g},getParameterInURL:function(b,c){if(!b||!c)return null;b=b.split("?");if(b[1]){b=b[1].split("&");for(var d=0;d<b.length;++d){var e=b[d].split("=");if(e[0]===c&&!a.Util.isBlank(e[1]))return decodeURIComponent(e[1])}}return null},isParameterInURL:function(a,c){if(!a||!c)return!1;a=a.split("?");if(a[1]){a=a[1].split("&");for(var b=0;b<a.length;++b)if(a[b].split("=")[0]===
69c)return!0}return!1},xmlToJson:function(b){var c={};if(!b)return null;if(1===b.nodeType){if(0<b.attributes.length){c["@attributes"]={};for(var d=0;d<b.attributes.length;d++){var e=b.attributes.item(d);c["@attributes"][e.nodeName]=e.nodeValue}}}else 3===b.nodeType?c=b.nodeValue:4===b.nodeType&&(c=b.nodeValue);if(b.hasChildNodes()){for(d=0;d<b.childNodes.length;d++){e=b.childNodes.item(d);var f=e.nodeName;if("undefined"===typeof c[f])c[f]=a.Util.xmlToJson(e);else{if("undefined"===typeof c[f].length||
70"string"===typeof c[f]){var k=c[f];c[f]=[];c[f].push(k)}c[f].push(a.Util.xmlToJson(e))}}"undefined"!==typeof c["#cdata-section"]?(c.value=c["#cdata-section"],c.value.constructor===Array&&(c.value=c.value.join(""))):c["#text"]&&(c.value=c["#text"])}return c},lazyJavaScriptLoad:function(a,c){var b=document.getElementsByTagName("head")[0]||document.documentElement,e=document.createElement("script");e.type="text/javascript";e.src=a;c&&(e.attachEvent&&!window.opera?e.onreadystatechange=function(){if("loaded"===
71e.readyState||"complete"===e.readyState)b.removeChild(e),e.onreadystatechange=null,c()}:e.addEventListener("load",function(){b.removeChild(e);c()},!1));b.insertBefore(e,b.firstChild)},getViewport:function(){var a=0,c=0;"undefined"!==typeof window.innerWidth?(a=window.innerWidth,c=window.innerHeight):"undefined"!==typeof document.documentElement&&"undefined"!==typeof document.documentElement.clientWidth&&
710!==document.documentElement.clientWidth?(a=document.documentElement.clientWidth,c=document.documentElement.clientHeight):
72document.getElementsByTagName("body")&&document.getElementsByTagName("body")[0]&&(a=document.getElementsByTagName("body")[0].clientWidth,c=document.getElementsByTagName("body")[0].clientHeight);return{width:a,height:c,offsetX:window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,offsetY:window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop}},getAbsoluteUrl:function(b,c){b=a.Util.trim(b);c=a.Util.trim(c);if(-1!==c.indexOf("://"))return c;var d=
73b.substring(0,b.indexOf("://"));if(0===c.indexOf("//"))return d+":"+c;d=b.indexOf("/",b.indexOf("://")+5);var e=b;-1!==d&&(e=b.substring(0,d));if(0===c.indexOf("/"))return e+c;d=b.lastIndexOf("#");e=b;-1!==d&&(e=b.substring(0,d));if(0===c.indexOf("#"))return e+c;e=b.indexOf("?");d=b;-1!==e&&(d=b.substring(0,e));if(0===c.indexOf("?"))return d+c;e=-1===e?b.lastIndexOf("/"):d.lastIndexOf("/");d=-1!==e?b.substring(0,e+1):d+"/";return d+c},secondsToHms:function(a){a=isNaN(Number(a))?0:Number(a);var b=
74Math.floor(a%3600/60),d=Math.round(a%3600%60);return("0"+Math.floor(a/3600)).slice(-2)+":"+("0"+b).slice(-2)+":"+("0"+d).slice(-2)},getFixedDigitRandomNumber:function(a){a=isNaN(Number(a))?0:Number(a);return Math.floor(9*Math.random()*Math.pow(10,a-1)+Math.pow(10,a-1))},getDateStringInISOFormat:function(a){return a instanceof Date&&!isNaN(a.valueOf())?a.toISOString():null},getTopMostWindow:function(){for(var a=window;a!=top;)if(a.parent.location.href.length)a=a.parent;else throw"Cannot access top most window";
75return a},getContentURL:function(){var b=null;try{b=a.Util.getTopMostWindow().location.href}catch(c){b=document.referrer,a.debug("Could not retrieve url from top most window. Using document referrer. Error: "+c)}return b},getFrameAncestor:function(b){for(var c=window,d;!d;){try{c.frames[b]&&(d=c)}catch(e){a.warn("Error while trying to access window with "+b)}if(c===window.top)break;c=c.parent}return d},isValidProxyUrl:function(a){return a&&"string"===typeof a},compareVersion:function(a,c){if(a===
76c)return 0;a=a.split(".");c=c.split(".");for(var b=Math.min(a.length,c.length),e=0;e<b;e++){if(parseInt(a[e])>parseInt(c[e]))return 1;if(parseInt(a[e])<parseInt(c[e]))return-1}return a.length>c.length?1:a.length<c.length?-1:0},validateJSON:function(a,c,d){var b=Object.keys(c).filter(function(b){var d=c[b];if(d.isOptional&&!a.hasOwnProperty(b))return!1;if(d.validationFunction)return!d.validationFunction(a[b]);for(var e=0;e<d.allowedTypes.length;e++)if(typeof a[b]===d.allowedTypes[e])return!1;return!0}).map(function(b){return b in
77a?b+" is invalid.":b+" is missing."});if(0<b.length)return b=this.arrayToString(b),Error("The "+d+" failed validation:"+b)},arrayToString:function(a){return a.reduce(function(a,b){return a+" "+b},"")},validateCustomPlayer:function(a){if(!a)return Error("customPlayer is null");if(a=this.validateJSON(a,{open:{allowedTypes:["function"]},getDuration:{allowedTypes:["function"]},getPlayheadTime:{allowedTypes:["function"]},playPause:{allowedTypes:["function"]}},"customPlayer"))return Error(a.message.replace("invalid",
78"not a function"))},getBooleanParameter:function(a,c){a=this._context.getParameter(a);null==a&&(a=c);return this.str2bool(a)},offsetStringToSecond:function(b,c){if("string"!==typeof b||this.isBlank(b))return-1;var d=/(\d+)(.(\d+))%|(\d+)%/.exec(b);if(d)return b=d[0].substr(0,d[0].length-1),0<c?c*Number(b)/100|0:-1;if(c=/(\d+):(\d+):(\d+)(.(\d+))?/.exec(b))return 3600*c[1]+60*c[2]+1*c[3];a.warn('offset is malformatted with value "',b,' ", the expected format is either HH:MM:SS(:mmm) or percentage%.');
79return-1},offsetStringToPercentage:function(a){return"string"!==typeof a||this.isBlank(a)?-1:(a=/(\d+)(.(\d+))%|(\d+)%/.exec(a))?a[0].substr(0,a[0].length-1):-1},fireVolumeEvents:function(b,c,d){c!==b&&d.processEvent({name:a.EVENT_AD_VOLUME_CHANGE});0===b&&0!==c?d.processEvent({name:a.EVENT_AD_UNMUTE}):0!==b&&0===c&&d.processEvent({name:a.EVENT_AD_MUTE})}};a.MediaState=function(){};a.MediaState.prototype={};a.MediaState.prototype.constructor=a.MediaState;a.Util.mixin(a.MediaState.prototype,{play:function(b){a.debug(this._name+
80" play("+b+")")},pause:function(b){a.debug(this._name+" pause("+b+")")},complete:function(b){a.debug(this._name+" complete("+b+")")}});a.MediaInitState=function(){this._name="MediaInitState"};a.MediaInitState.prototype=new a.MediaState;a.MediaInitState.prototype.constructor=a.MediaInitState;a.Util.mixin(a.MediaInitState.prototype,{play:function(b){a.debug(this._name+" play("+b+")");b.setMediaState(a.MediaPlayingState.instance);if("function"===typeof b.onStartPlaying)b.onStartPlaying()}});a.MediaInitState.instance=
81new a.MediaInitState;a.MediaPlayingState=function(){this._name="MediaPlayingState"};a.MediaPlayingState.prototype=new a.MediaState;a.MediaPlayingState.prototype.constructor=a.MediaPlayingState;a.Util.mixin(a.MediaPlayingState.prototype,{pause:function(b){a.debug(this._name+" pause("+b+")");b.setMediaState(a.MediaPausedState.instance);if("function"===typeof b.onPausePlaying)b.onPausePlaying()},complete:function(b){a.debug(this._name+" complete("+b+")");b.setMediaState(a.MediaEndState.instance);if("function"===
82typeof b.onCompletePlaying)b.onCompletePlaying()}});a.MediaPlayingState.instance=new a.MediaPlayingState;a.MediaPausedState=function(){this._name="MediaPausedState"};a.MediaPausedState.prototype=new a.MediaState;a.MediaPausedState.prototype.constructor=a.MediaPausedState;a.Util.mixin(a.MediaPausedState.prototype,{play:function(b){a.debug(this._name+" play("+b+")");b.setMediaState(a.MediaPlayingState.instance);if("function"===typeof b.onResumePlaying)b.onResumePlaying()},complete:function(b){a.debug(this._name+
83" complete("+b+")");b.setMediaState(a.MediaEndState.instance);if("function"===typeof b.onCompletePlaying)b.onCompletePlaying()}});a.MediaPausedState.instance=new a.MediaPausedState;a.MediaReplayingState=function(){this._name="MediaReplayingState"};a.MediaReplayingState.prototype=new a.MediaState;a.MediaReplayingState.prototype.constructor=a.MediaReplayingState;a.Util.mixin(a.MediaReplayingState.prototype,{pause:function(b){a.debug(this._name+" pause("+b+")");b.setMediaState(a.MediaReplayPausedState.instance);
84if("function"===typeof b.onPausePlaying)b.onPausePlaying()},complete:function(b){a.debug(this._name+" complete("+b+")");b.setMediaState(a.MediaEndState.instance);if("function"===typeof b.onCompleteReplaying)b.onCompleteReplaying()}});a.MediaReplayingState.instance=new a.MediaReplayingState;a.MediaReplayPausedState=function(){this._name="MediaReplayPausedState"};a.MediaReplayPausedState.prototype=new a.MediaState;a.MediaReplayPausedState.prototype.constructor=a.MediaReplayPausedState;a.Util.mixin(a.MediaReplayPausedState.prototype,
85{play:function(b){a.debug(this._name+" play("+b+")");b.setMediaState(a.MediaReplayingState.instance);if("function"===typeof b.onResumePlaying)b.onResumePlaying()},complete:function(b){a.debug(this._name+" complete("+b+")");b.setMediaState(a.MediaEndState.instance);if("function"===typeof b.onCompleteReplaying)b.onCompleteReplaying()}});a.MediaReplayPausedState.instance=new a.MediaReplayPausedState;a.MediaEndState=function(){this._name="MediaEndState"};a.MediaEndState.prototype=new a.MediaState;a.MediaEndState.prototype.constructor=
86a.MediaEndState;a.Util.mixin(a.MediaEndState.prototype,{play:function(b){a.debug(this._name+" play("+b+")");b.setMediaState(a.MediaReplayingState.instance);if("function"===typeof b.onStartReplaying)b.onStartReplaying()}});a.MediaEndState.instance=new a.MediaEndState;a.RendererState=function(){};a.RendererState.prototype={};a.RendererState.prototype.constructor=a.RendererState;a.Util.mixin(a.RendererState.prototype,{start:function(b){a.debug(this._name+" start() rendererController = "+b)},notifyStarted:function(b){a.debug(this._name+
87" notifyStarted() rendererController = "+b)},stop:function(b){a.debug(this._name+" stop() rendererController = "+b)},complete:function(b){a.debug(this._name+" complete() rendererController = "+b)},notifyCompleted:function(b){a.debug(this._name+" notifyCompleted() rendererController = "+b)},fail:function(b){a.debug(this._name+" fail() rendererController = "+b);b.setRendererState(a.RendererFailedState.instance);b.getAdInstance().complete()}});a.RendererInitState=function(){this._name="RendererInitState"};
88a.RendererInitState.prototype=new a.RendererState;a.RendererInitState.prototype.constructor=a.RendererInitState;a.RendererInitState.instance=new a.RendererInitState;a.Util.mixin(a.RendererInitState.prototype,{start:function(b){a.debug(this._name+" start()");b.setRendererState(a.RendererStartingState.instance);b.getRenderer().start(b)},stop:function(b){a.debug(this._name+" stop()");b.setRendererState(a.RendererCompletingState.instance);b.getRendererState().notifyCompleted(b)}});a.RendererStartingState=
89function(){this._name="RendererStartingState"};a.RendererStartingState.prototype=new a.RendererState;a.RendererStartingState.prototype.constructor=a.RendererStartingState;a.RendererStartingState.instance=new a.RendererStartingState;a.Util.mixin(a.RendererStartingState.prototype,{notifyStarted:function(b){a.debug(this._name+" notifyStarted()");b.setRendererState(a.RendererStartedState.instance);b.getAdInstance().play()},stop:function(b){a.debug(this._name+" stop()");"function"===typeof b.getRenderer().stop&&
90(b.setRendererState(a.RendererCompletingState.instance),b.getRenderer().stop())}});a.RendererStartedState=function(){this._name="RendererStartedState"};a.RendererStartedState.prototype=new a.RendererState;a.RendererStartedState.prototype.constructor=a.RendererStartedState;a.RendererStartedState.instance=new a.RendererStartedState;a.Util.mixin(a.RendererStartedState.prototype,{complete:function(b){a.debug(this._name+" complete()");b.setRendererState(a.RendererCompletingState.instance)},stop:function(b){a.debug(this._name+
91" stop()");"function"===typeof b.getRenderer().stop&&(b.setRendererState(a.RendererCompletingState.instance),!1===b.getRenderer().stop()&&b.getAdInstance().fakeComplete())}});a.RendererCompletingState=function(){this._name="RendererCompletingState"};a.RendererCompletingState.prototype=new a.RendererState;a.RendererCompletingState.prototype.constructor=a.RendererCompletingState;a.RendererCompletingState.instance=new a.RendererCompletingState;a.Util.mixin(a.RendererCompletingState.prototype,{notifyCompleted:function(b){a.debug(this._name+
92" notifyCompleted()");b.setRendererState(a.RendererCompletedState.instance);b.getAdInstance().complete()}});a.RendererCompletedState=function(){this._name="RendererCompletedState"};a.RendererCompletedState.prototype=new a.RendererState;a.RendererCompletedState.prototype.constructor=a.RendererCompletedState;a.RendererCompletedState.instance=new a.RendererCompletedState;a.RendererFailedState=function(){this._name="RendererFailedState"};a.RendererFailedState.prototype=new a.RendererState;a.RendererFailedState.prototype.constructor=
93a.RendererFailedState;a.RendererFailedState.instance=new a.RendererFailedState;a.HTMLRenderer=function(){this._rendererController=null;this._onVisibilityChange=this._onVisibilityChange.bind(this)};a.HTMLRenderer.prototype={start:function(b){this._rendererController=b;this._rendererController.getAdInstance().getSlot().getBase()?document.visibilityState&&"visible"!==document.visibilityState?(a.debug("Document was not visible when ad started."),document.addEventListener("visibilitychange",this._onVisibilityChange,
94!1)):(a.debug("Document was visible when ad started."),this._setupParameters()&&(this._render(),this._rendererController.handleStateTransition(a.RENDERER_STATE_STARTED))):this._onRendererFailed(a.ERROR_INVALID_SLOT,"slot base is empty")},_onVisibilityChange:function(){"visible"===document.visibilityState&&(a.debug("Document is now visible, and ad already tried to start when the document was not visible."),this._setupParameters()&&(this._render(),this._rendererController.handleStateTransition(a.RENDERER_STATE_STARTED)),
95document.removeEventListener("visibilitychange",this._onVisibilityChange,!1))},pause:function(){this.log("pause");this.shouldEndAfterDuration&&this.timer&&this.timer.pause()},resume:function(){this.log("resume");this.shouldEndAfterDuration&&this.timer&&this.timer.start()},stop:function(){this.log("stop isMRAIDAd:"+this.isMRAIDAd+" tpc:"+this._tpc+" interstitial:"+this.shouldKeepInterstitial);return this._stop()},_stop:function(){this.log("_stop isMRAIDAd:"+this.isMRAIDAd+" tpc:"+this._tpc+" interstitial:"+
96this.shouldKeepInterstitial);if(this.isMRAIDAd||this._tpc!==a.TIME_POSITION_CLASS_DISPLAY||this.shouldKeepInterstitial)this._cleanup(),this._rendererController.handleStateTransition(a.RENDERER_STATE_COMPLETED);else return!1},resize:function(){var b=this._rendererController.getAdInstance(),c=b.getSlot().getBase();b.getSlot().getTimePositionClass()===a.TIME_POSITION_CLASS_OVERLAY?!this.isMRAIDAd||this.isMRAIDAd&&this.mraid.state===this.mraid.STATEDEFAULT?(b="_fw_ad_container_html_"+b.getSlot().getCustomId()+
97"_",b=document.getElementById(b),b.style.width=c.style.width||"100%",b.style.height=c.style.height||"100%",this._layoutOverlayAd(this.defaultAdElement)):this.log("Cannot resize an MRAID ad that is not in the default state"):this.log("Cannot resize a non-overlay ad")},_cleanup:function(){this.log("_cleanup");document.removeEventListener("visibilitychange",this._onVisibilityChange,!1);this.timer&&(this.timer.stop(),this.timer=null);this.adLoadTimeoutTimer&&(this.adLoadTimeoutTimer.stop(),this.adLoadTimeoutTimer=
98null);window.removeEventListener?(document.removeEventListener("touchmove",this.touchMoveDisabler,!1),window.removeEventListener("message",this.messageHandlerFunc,!1),window.removeEventListener("resize",this.viewportChangeFunc,!1),window.removeEventListener("scroll",this.viewportChangeFunc,!1)):window.detachEvent&&(window.detachEvent("onmessage",this.messageHandlerFunc),window.detachEvent("onresize",this.viewportChangeFunc),window.detachEvent("onscroll",this.viewportChangeFunc));if(this.isMRAIDAd&&
99(this.mraid.inExpandedState()&&(this.log("stopping with expanded state, invoke close()"),this._mraidClose()),this.mraid.inDefaultState())){this.log("stopping with default state, invoke close()");this._mraidClose();return}if(this.expandedAdElement){var a=this.expandedAdElement.parentNode;this.expandedAdElement._fw_closeButton&&a.removeChild(this.expandedAdElement._fw_closeButton);a.removeChild(this.expandedAdElement);this.expandedAdElement===this.defaultAdElement&&(this.defaultAdElementContainer===
100this.defaultAdElement&&(this.defaultAdElementContainer=null),this.defaultAdElement=null);this.expandedAdElement=null}this.expandedLightbox&&(a=this.expandedLightbox.parentNode,a.removeChild(this.expandedLightbox),this.expandedLightbox=null);if(this.defaultAdElement){a=this.defaultAdElement.parentNode;var c=this.defaultAdElement;c.style.display="none";a!==this._rendererController.getAdInstance().getSlot().getBase()&&window.setTimeout(function(){for(var b=a&&a.childNodes||[],e=0;e<b.length;e++){var f=
101b[e];f===c&&a.removeChild(f)}},200);this.defaultAdElementContainer===this.defaultAdElement&&(this.defaultAdElementContainer=null);this.defaultAdElement=null}this.defaultAdElementContainer&&(a=this.defaultAdElementContainer.parentNode,a.removeChild(this.defaultAdElementContainer),this.defaultAdElementContainer=null);(this.shouldPauseContentWhenStart||this.isInterstitialNow&&!this.isMRAIDAd)&&this._rendererController.requestContentStateChange(!1)},_setupParameters:function(){var b=this._rendererController.getAdInstance(),
102c=b.getSlot().getTimePositionClass();this._tpc=c;var d=b.getActiveCreativeRendition();b=d.getBaseUnit();d=d.getCreativeApi();var e;if(a.PLATFORM_NOT_SUPPORT_OVERLAY_AD&&c===a.TIME_POSITION_CLASS_OVERLAY)return this._onRendererFailed(a.ERROR_DEVICE_LIMIT,"Overlay not supported on this device."),!1;if(a.PLATFORM_NOT_SUPPORT_MIDROLL_AD&&(c===a.TIME_POSITION_CLASS_MIDROLL||c===a.TIME_POSITION_CLASS_PAUSE_MIDROLL))return this._onRendererFailed(a.ERROR_DEVICE_LIMIT,"Midroll, pause_midroll not supported on this device."),
103!1;if(a.PLATFORM_IS_IPHONE_IPOD)switch(c){case a.TIME_POSITION_CLASS_MIDROLL:case a.TIME_POSITION_CLASS_PAUSE_MIDROLL:case a.TIME_POSITION_CLASS_OVERLAY:return this._onRendererFailed(a.ERROR_DEV
103ICE_LIMIT,"Midroll, pause_midroll and overlay ads are not supported on iPod, iPhone."),!1;case a.TIME_POSITION_CLASS_PREROLL:case a.TIME_POSITION_CLASS_POSTROLL:this._rendererController.setCapability(a.EVENT_AD_CLICK,a.CAPABILITY_STATUS_OFF)}this.adLoadTimeout=5;if(e=this._rendererController.getParameter(a.PARAMETER_RENDERER_HTML_AD_LOAD_TIMEOUT))this.adLoadTimeout=
1040<Number(e)?Number(e):this.adLoadTimeout;this.shouldKeepInterstitial=!1;(e=this._rendererController.getParameter(a.PARAMETER_RENDERER_HTML_PLACEMENT_TYPE))?this.shouldKeepInterstitial=e===a.PARAMETER_RENDERER_HTML_PLACEMENT_TYPE_INTERSTITIAL:"string"===typeof b&&(this.shouldKeepInterstitial=b.toLowerCase()===a.PARAMETER_RENDERER_HTML_BASEUNIT_INTERSTITIAL);this.isInterstitialNow=this.shouldKeepInterstitial;this.shouldPauseContentWhenStart=!1;this.shouldPauseContentWhenExpandOrClick=!this.shouldKeepInterstitial&&
105(c===a.TIME_POSITION_CLASS_DISPLAY||c===a.TIME_POSITION_CLASS_OVERLAY);this.shouldBackgroundTransparent=!1;e=this._rendererController.getParameter(a.PARAMETER_RENDERER_HTML_SHOULD_BACKGROUND_TRANSPARENT);"undefined"!==typeof e&&null!=e&&(this.shouldBackgroundTransparent=a.Util.str2bool(e));this.shouldEndAfterDuration=c!==a.TIME_POSITION_CLASS_DISPLAY||this.shouldKeepInterstitial;e=this._rendererController.getParameter(a.PARAMETER_RENDERER_HTML_SHOULD_END_AFTER_DURATION);"undefined"!==typeof e&&null!=
106e&&(this.shouldEndAfterDuration=a.Util.str2bool(e));this.coadScriptName=this._rendererController.getParameter(a.PARAMETER_RENDERER_DISPLAY_COAD_SCRIPT_NAME);this.coadScriptName||(this.coadScriptName=this._rendererController.getParameter("coad_script_name"));this.primaryAnchor=this._rendererController.getParameter(a.PARAMETER_RENDERER_HTML_PRIMARY_ANCHOR)||"bc";this.marginWidth=this._rendererController.getParameter(a.PARAMETER_RENDERER_HTML_MARGIN_WIDTH)||0;this.marginHeight=this._rendererController.getParameter(a.PARAMETER_RENDERER_HTML_MARGIN_HEIGHT)||
1070;this.bootstrap=this._rendererController.getParameter(a.PARAMETER_RENDERER_HTML_BOOTSTRAP);this.shouldRenderImagesWithoutIFrame=this._rendererController.getParameter(a.PARAMETER_RENDERER_HTML_RENDER_IMAGE_WITHOUT_IFRAME);b=a.Util.getViewport();this.defaultExpandWidth=b.width;this.defaultExpandHeight=b.height;this.isMRAIDAd="MRAID-1.0"===d;this.mraid=new function(b){this.STATELOADING="loading";this.STATEDEFAULT="default";this.STATEEXPANDED="expanded";this.STATEHIDDEN="hidden";this._renderer=b;this._state=
108this.STATELOADING;this._useCustomClose=!1;this.viewable=this.expandIsModal=!0;this._baseUrlExpanded=this._baseUrlDefault="";b=Object.defineProperty||function(a,b,c){c.get&&a.__defineGetter__(b,c.get);c.set&&a.__defineSetter__(b,c.set)};b(this,"baseUrl",{get:function(){return this.inExpandedState()?this._baseUrlExpanded||this._baseUrlDefault:this._baseUrlDefault},set:function(a){this.inExpandedState()?this._baseUrlExpanded=a:(this._baseUrlDefault=a,this._baseUrlExpanded="")}});b(this,"useCustomClose",
109{get:function(){return this._useCustomClose},set:function(a){this._useCustomClose===!a&&(this._useCustomClose=!!a,this.pushData())}});b(this,"placementType",{get:function(){return this._renderer.shouldKeepInterstitial?"interstitial":"inline"}});b(this,"expandWidth",{get:function(){return this._renderer.requestedExpandWidth&&this._renderer.requestedExpandWidth<this._renderer.defaultExpandWidth?this._renderer.requestedExpandWidth:this._renderer.defaultExpandWidth}});b(this,"expandHeight",{get:function(){return this._renderer.requestedExpandHeight&&
110this._renderer.requestedExpandHeight<this._renderer.defaultExpandHeight?this._renderer.requestedExpandHeight:this._renderer.defaultExpandHeight}});b(this,"state",{get:function(){return this._state},set:function(b){this.log("mraid.state change "+this.state+" => "+b);this.state!==b&&(this._renderer.shouldPauseContentWhenExpandOrClick&&(b===this.STATEEXPANDED?this._renderer._rendererController.requestContentStateChange(!0):this.inExpandedState()&&this._renderer._rendererController.requestContentStateChange(!1)),
111b===this.STATEEXPANDED?(this._renderer.expandedAdElement?this._renderer._rendererController.processEvent({name:a.EVENT_AD_ACCEPT_INVITATION}):(this._renderer.expandedAdElement=this._renderer.defaultAdElement,this._renderer._rendererController.processEvent({name:a.EVENT_AD_EXPAND})),this._renderer.presentInterstitial(),this._renderer.shouldEndAfterDuration&&this._renderer.timer.pause()):b===this.STATEDEFAULT&&(this._renderer.shouldKeepInterstitial?(this._renderer.expandedAdElement=this._renderer.defaultAdElement,
112this._renderer.presentInterstitial()):(this.inExpandedState()&&(this._renderer.expandedAdElement!==this._renderer.defaultAdElement?this._renderer._rendererController.processEvent({name:a.EVENT_AD_CLOSE}):this._renderer._rendererController.processEvent({name:a.EVENT_AD_COLLAPSE})),this._renderer.expandedAdElement=null,this._renderer.presentInline()),this._renderer.shouldEndAfterDuration&&this._renderer.timer&&this._renderer.timer.start()),this._state=b,this.pushData(),b===this.STATEHIDDEN&&this._renderer.stop())}});
113this.inLoadingState=function(){return this.state===this.STATELOADING};this.inDefaultState=function(){return this.state===this.STATEDEFAULT};this.inExpandedState=function(){return this.state===this.STATEEXPANDED};this.inHiddenState=function(){return this.state===this.STATEHIDDEN};this.pushData=function(){var a='mraid._Update("'+this.state+'", '+this.viewable+', "'+this.placementType+'", '+this.expandWidth+", "+this.expandHeight+", "+this.useCustomClose+", "+this.expandIsModal+")";this.log("mraid.pushData: going to invoke on iframe with "+
114a);this._renderer.defaultAdElement?(this._renderer.defaultAdElement.contentWindow.postMessage("fwsdk-bounce:"+a,"*"),this._renderer.expandedAdElement&&this._renderer.expandedAdElement!==this._renderer.defaultAdElement&&this._renderer.expandedAdElement.contentWindow.postMessage("fwsdk-bounce:"+a,"*")):this.warn("_mraidPushData: no iframe suitable to send "+a)};this.log=function(a){this._renderer.log(a)};this.warn=function(a){this._renderer.warn(a)}}(this);this.onLoadFunc=a.Util.bind(this,function(){this.adLoadTimeoutTimer&&
115(this.adLoadTimeoutTimer.stop(),this.adLoadTimeoutTimer=null);this.timer&&this.shouldEndAfterDuration&&this.timer.start()});this.touchMoveDisabler=function(a){a.preventDefault()};this.log("setting parameters, adLoadTimeout: "+this.adLoadTimeout+", isMRAIDAd: "+this.isMRAIDAd+", shouldKeepInterstitial: "+this.shouldKeepInterstitial+", shouldEndAfterDuration: "+this.shouldEndAfterDuration+", shouldPauseContentWhenStart: "+this.shouldPauseContentWhenStart+", shouldPauseContentWhenExpandOrClick: "+this.shouldPauseContentWhenExpandOrClick+
116", shouldBackgroundTransparent: "+this.shouldBackgroundTransparent+", defaultExpandWidth: "+this.defaultExpandWidth+", defaultExpandHeight: "+this.defaultExpandHeight+", coadScriptName: "+this.coadScriptName+", primaryAnchor: "+this.primaryAnchor+", marginWidth: "+this.marginWidth+", marginHeight: "+this.marginHeight+", bootstrap: "+this.bootstrap,"shouldRenderImagesWithoutIFrame: "+this.shouldRenderImagesWithoutIFrame);if(!this.shouldKeepInterstitial)!this.isMRAIDAd||a.PLATFORM_IS_IPHONE_IPOD&&c!==
117a.TIME_POSITION_CLASS_DISPLAY||(this._rendererController.setCapability(a.EVENT_AD_ACCEPT_INVITATION,a.CAPABILITY_STATUS_ON),this._rendererController.setCapability(a.EVENT_AD_CLOSE,a.CAPABILITY_STATUS_ON),this._rendererController.setCapability(a.EVENT_AD_COLLAPSE,a.CAPABILITY_STATUS_ON),this._rendererController.setCapability(a.EVENT_AD_EXPAND,a.CAPABILITY_STATUS_ON));else if(c===a.TIME_POSITION_CLASS_OVERLAY)return this._onRendererFailed(a.ERROR_INVALID_SLOT,"Interstitial ad is not supported in overlay slot."),
118!1;return!0},_render:function(){this.log("_render");var b=this._rendererController.getAdInstance(),c=b.getSlot(),d=c.getTimePositionClass(),e=c.getBase(),f=b.getActiveCreativeRendition(),k=f.getDuration(),g=f.getPrimaryCreativeRenditionAsset(),m=g.getProxiedUrl(),h=g.getContent(),P=f.getContentType();d===a.TIME_POSITION_CLASS_DISPLAY&&(e.innerHTML="");this.timer=new a.Timer(k,a.Util.bind(this,this._stop));if(this.coadScriptName&&"function"===typeof window[this.coadScriptName])this.defaultAdElement=
119window[this.coadScriptName](h,m,f.getHeight(),f.getWidth(),g.getMimeType(),c.getCustomId()),this.timer&&this.shouldEndAfterDuration&&this.timer.start();else if(f=document.createElement("span"),f.id="_fw_ad_container_html_"+c.getCustomId()+"_","relative"===window.getComputedStyle(e).position?f.style.position="absolute":f.style.position="relative",f.style.display="inline-block",f.style.margin="0px",f.style.padding="0px",f.style.width=e.style.width||"100%",f.style.height=e.style.height||"100%",f.style.top=
120f.style.left="0px",e.appendChild(f),this.defaultAdElementContainer=f,m||h){if("text/html_lit_nowrapper"===P||"text/html_lit_js_wc_nw"===P){if(this.isMRAIDAd||this.isInterstitialNow){this._onRendererFailed(a.ERROR_INVALID_VALUE,"");this._stop();return}if(!h){this._onRendererFailed(a.ERROR_NULL_ASSET,"Empty content");this._stop();return}this.defaultAdElement=f;this.defaultAdElement.innerHTML=h;m=this.defaultAdElement.getElementsByTagName("script");var H=document.getElementsByTagName("head")[0];for(c=
1210;c<m.length;++c)if(m[c].src){var t=document.createElement("script");t.src=m[c].src;m[c].charset&&(t.charset=m[c].charset);m[c].innerHTML&&(t.innerHTML=m[c].innerHTML);t.onload=t.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||H.removeChild(t)};H.appendChild(t)}else t=m[c].innerHTML,eval(t);this.presentInline();this.onLoadFunc();return}if(this.shouldRenderImagesWithoutIFrame&&P.includes("image/")){this.defaultAdElement=f;c=b.getEventCallback(a.EVENT_AD_CLICK,
122a.EVENT_TYPE_CLICK)._url?b.getEventCallback(a.EVENT_AD_CLICK,a.EVENT_TYPE_CLICK)._url:null;m=a.HTMLAdGenerator.generateImageHTML(m,c);this.defaultAdElement.innerHTML=m;return}b=document.createElement("iframe");b.id="_fw_ad_container_iframe_"+c.getCustomId()+"_"+Math.random();b.attachEvent?b.attachEvent("onload",this.onLoadFunc):b.onload=this.onLoadFunc;this.defaultAdElement=b;this.defaultAdElementContainer.appendChild(b);this._fillAdNode(b,m,h);this.isMRAIDAd&&(this.adLoadTimeoutTimer=new a.Timer(this.adLoadTimeout,
123a.Util.bind(this,function(){this._onRendererFailed(a.ERROR_TIMEOUT,"Loading MRAID Ad timed out");d!==a.TIME_POSITION_CLASS_DISPLAY?this.isMRAIDAd&&!this.mraid.inLoadingState()?this._mraidClose():this._stop():this._stop()})),this.adLoadTimeoutTimer.start())}else{this._onRendererFailed(a.ERROR_NULL_ASSET,"Empty URL and empty content");this._stop();return}this.defaultAdElement||(m=e.getElementsByTagName("iframe"))&&0<m.length&&(this.defaultAdElement=m[m.length-1]);this.defaultAdElement?(this.defaultAdElement.frameBorder=
124"0",this.shouldBackgroundTransparent&&(this.defaultAdElement.allowTransparency="true",this.defaultAdElement.style["background-color"]="rgba(255,255,255,0)"),this.isInterstitialNow?(this.expandedAdElement=this.defaultAdElement,this.presentInterstitial()):this.presentInline(),this.messageHandlerFunc=a.Util.bind(this,this._onWindowMessageReceived),this.viewportChangeFunc=a.Util.bind(this,function(){this.viewportChangeFuncTimer&&window.clearTimeout(this.viewportChangeFuncTimer);this.viewportChangeFuncTimer=
125window.setTimeout(a.Util.bind(this,this._onViewportResizeScroll),200)}),window.addEventListener?(window.addEventListener("message",this.messageHandlerFunc,!1),window.addEventListener("resize",this.viewportChangeFunc,!1),window.addEventListener("scroll",this.viewportChangeFunc,!1)):window.attachEvent&&(window.attachEvent("onmessage",this.messageHandlerFunc),window.attachEvent("onresize",this.viewportChangeFunc),window.attachEvent("onscroll",this.viewportChangeFunc))):this.isMRAIDAd&&(this._onRendererFailed(a.ERROR_UNKNOWN,
126"Failed to find iframe in slotBase for MRAID ad"),this._stop())},_layoutOverlayAd:function(a){this.log("_layoutOverlayAd");var b=this._rendererController.getAdInstance(),d=b.getSlot(),e=d.getVideoDisplaySize().width;d=d.getVideoDisplaySize().height;var f=b.getActiveCreativeRendition();b=f.getWidth()||240;f=f.getHeight()||50;a.style.width=Math.min(b,e)+"px";a.style.height=Math.min(f,d)+"px";a.style.left=a.style.top=a.style.right=a.style.bottom="";switch(this.primaryAnchor){case "tl":case "lt":a.style.top=
127this.marginHeight+"px";a.style.left=this.marginWidth+"px";break;case "tr":case "rt":a.style.top=this.marginHeight+"px";a.style.right=this.marginWidth+"px";break;case "bl":case "lb":a.style.bottom=this.marginHeight+"px";a.style.left=this.marginWidth+"px";break;case "br":case "rb":a.style.bottom=this.marginHeight+"px";a.style.right=this.marginWidth+"px";break;case "tc":case "ct":a.style.top=this.marginHeight+"px";a.style.left=.5*Math.max(0,e-b)+"px";break;case "lm":case "ml":a.style.left=this.marginWidth+
128"px";a.style.top=.5*Math.max(0,d-f)+"px";break;case "rm":case "mr":a.style.right=this.marginWidth+"px";a.style.top=.5*Math.max(0,d-f)+"px";break;case "mc":case "cm":case "c":case "m":a.style.left=.5*Math.max(0,e-b)+"px";a.style.top=.5*Math.max(0,d-f)+"px";break;default:case "bc":case "cb":a.style.bottom=this.marginHeight+"px",a.style.left=.5*Math.max(0,e-b)+"px"}},_fillAdNode:function(b,c,d){this.log("_fillAdNode, url:"+c+", content:"+(d?"<omited>":"<empty>"));if(c)b.src=c;else if(d)b=b.contentWindow?
129b.contentWindow.document:b.contentDocument.document?b.contentDocument.document:b.contentDocument,b.open(),b.write(d),b.close();else return this._onRendererFailed(a.ERROR_NULL_ASSET,"Empty URL and content"),!1;return!0},presentInline:function(){this.log("presentInline");this.isInterstitialNow=!1;var b=this.defaultAdElement;if(b){var c=this._rendererController.getAdInstance(),d=c.getSlot(),e=d.getTimePositionClass(),f=d.getWidth(),k=d.getHeight(),g=d.getVideoDisplaySize().width;d=d.getVideoDisplaySize().height;
130var m=c.getActiveCreativeRendition();c=m.getWidth();m=m.getHeight();b.scrolling="no";b.style.overflow="hidden";switch(e){case a.TIME_POSITION_CLASS_DISPLAY:b.style.position="";b.style.background=this.shouldBackgroundTransparent?"transparent":"";b.style.left="0px";b.style.top="0px";b.style.width=(c?c:f)+"px";b.style.height=(m?m:k)+"px";break;case a.TIME_POSITION_CLASS_OVERLAY:b.style.position="absolute";b.style.background=this.shouldBackgroundTransparent?"transparent":"white";this._layoutOverlayAd(b);
131break;default:b.style.position="absolute",b.style.background=this.shouldBackgroundTransparent?"transparent":"white",b.style.left="0px",b.style.top="0px",b.style.width=g+"px",b.style.height=d+"px"}}},presentInterstitial:function(){this.log("presentInterstitial, defaultExpandWidth: "+this.defaultExpandWidth+", defaultExpandHeight: "+this.defaultExpandHeight+", this.mraid.expandWidth: "+this.mraid.expandWidth+", this.mraid.expandHeight: "+this.mraid.expandHeight+", (Math.max(0, this.defaultExpandWidth - this.mraid.expandWidth) / 2) = "+
132Math.max(0,this.defaultExpandWidth-this.mraid.expandWidth)/2+", (Math.max(0, this.defaultExpandHeight - this.mraid.expandHeight) / 2) = "+Math.max(0,this.defaultExpandHeight-this.mraid.expandHeight)/2);if(this.expandedAdElement){this.isInterstitialNow=!0;document.addEventListener&&(document.removeEventListener("touchmove",this.touchMoveDisabler,!1),document.addEventListener("touchmove",this.touchMoveDisabler,!1));var b=this.expandedAdElement.parentNode;this.expandedLightbox||(this.expandedLightbox=
133document.createElement("div"),this.expandedLightbox.style.background="black",this.expandedLightbox.style.opacity=.8,this.expandedLightbox.style.position="fixed",this.expandedLightbox.style.top="0px",this.expandedLightbox.style.left="0px",this.expandedLightbox.style.zIndex=this.expandedLightbox.style["z-index"]=9999,b.appendChild(this.expandedLightbox));this.expandedLightbox.style.width=this.defaultExpandWidth+"px";this.expandedLightbox.style.height=this.defaultExpandHeight+"px";this.expandedAdElement.frameBorder=
134"0";this.expandedAdElement.scrolling="no";this.expandedAdElement.style.position="fixed";this.expandedAdElement.style.overflow="hidden";this.expandedAdElement.style.top=this.expandedAdElement.top=Math.max(0,this.defaultExpandHeight-this.mraid.expandHeight)/2+"px";this.expandedAdElement.style.left=this.expandedAdElement.left=Math.max(0,this.defaultExpandWidth-this.mraid.expandWidth)/2+"px";this.expandedAdElement.style.width=this.expandedAdElement.width=this.mraid.expandWidth+"px";this.expandedAdElement.style.height=
135this.expandedAdElement.height=this.mraid.expandHeight+"px";this.expandedAdElement.style.zIndex=this.expandedAdElement.style["z-index"]=1E4;this.log("presentInterstitial, expanded ad element size: (top, left, width, height) = ("+this.expandedAdElement.top+", "+this.expandedAdElement.left+", "+this.expandedAdElement.width+", "+this.expandedAdElement.height+")");if(this.isMRAIDAd){var c=this.expandedAdElement._fw_closeButton;c||(c=document.createElement("div"),c.addEventListener?c.addEventListener("click",
136a.Util.bind(this,function(){this._mraidClose()})):c.attachEvent&&c.attachEvent("onclick",a.Util.bind(this,function(){this._mraidClose()})),c.style.position="fixed",c.style.margin="0px",c.style.padding="0px",c.style.width="25px",c.style.height="25px",c.style.zIndex=c.style["z-index"]=10001,b.appendChild(c),this.expandedAdElement._fw_closeButton=c);c.style.top=this.expandedAdElement.style.top;c.style.left=Math.max(0,this.defaultExpandWidth-this.mraid.expandWidth)/2+this.mraid.expandWidth-25+"px";c.innerHTML=
137this.mraid.useCustomClose?0<a.PLATFORM_ANDROID_VERSION?"   ":"":'<img style="width:25px; height:25px; border:0" src="data:image/svg+xml;
137base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwIiB5PSIwIiB3aWR0aD0iNDAwcHgiIGhlaWdodD0iNDAwcHgiIHZpZXdCb3g9IjAgMCA0MDAgNDAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0MDAgNDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48Y2lyY2xlIGZpbGw9IiM2NjY2NjYiIGN4PSIyMDAuMTM5IiBjeT0iMTk5Ljg2IiByPSIxOTcuODYiLz48cGF0aCBmaWxsPSIjRjBGMEYwIiBzdHJva2U9IiNGMEYwRjAiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgZD0iTTExNC44NjUsMzAzLjY0NGMtNi4yMjYsNi4yMjctMTUuMzYzLDcuMTg2LTIwLjQwNywyLjE0NGwtMC41MjItMC41MjJjLTUuMDQzLTUuMDQzLTQuMDgzLTE0LjE4LDIuMTQ0LTIwLjQwN0wyODQuODYsOTYuMDc4YzYuMjI2LTYuMjI3LDE1LjM2Mi03LjE4NiwyMC40MDUtMi4xNDRsMC41MjIsMC41MjFjNS4wNDMsNS4wNDIsNC4wODMsMTQuMTc5LTIuMTQ0LDIwLjQwOEwxMTQuODY1LDMwMy42NDR6Ii8+PHBhdGggZmlsbD0iI0YwRjBGMCIgc3Ryb2tlPSIjRjBGMEYwIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik0zMDcuODE5LDI4OC42NjZjNS4xNTMsNS4xNTgsNS4wNDgsMTMuNjI0LTAuMjQxLDE4LjkxMWwwLDBjLTUuMjg4LDUuMjg5LTEzLjc1Miw1LjM5My0xOC45MDksMC4yNEw5MS45MDYsMTExLjA1NWMtNS4xNTYtNS4xNTYtNS4wNDgtMTMuNjIzLDAuMjQtMTguOTFsMCwwYzUuMjktNS4yODksMTMuNzU1LTUuMzk2LDE4LjkxMS0wLjI0MUwzMDcuODE5LDI4OC42NjZ6Ii8+PC9zdmc+">'}this.isMRAIDAd||
138this._rendererController.requestContentStateChange(!0)}},_onWindowMessageReceived:function(b){if(this.defaultAdElement&&(b.source===this.defaultAdElement.contentWindow||this.expandedAdElement&&b.source===this.expandedAdElement.contentWindow)){this.log("_onWindowMessageReceived, event.data:"+b.data+", event.origin:"+b.origin);var c=b.data.toString().split(":");if(c&&2<=c.length&&"fwsdk-invoke"===c[0]){var d=c[1];if((c=c.slice(2))&&0<c.length){for(var e=0;e<c.length;e++)c[e]=decodeURIComponent(c[e]);
1391===c.length&&(c=c[0])}else c=null;if("iframe_ready"===d){if(this.onLoadFunc&&b.source===this.defaultAdElement.contentWindow&&this.defaultAdElement!==this.expandedAdElement)this.onLoadFunc();c&&(c=a.Util.trim(c))&&this.isMRAIDAd&&(this.mraid.baseUrl=c);this.bootstrap&&b.source.postMessage("fwsdk-bounce:"+this.bootstrap,b.origin);b.source.postMessage('fwsdk-bounce:mraid._messagingModel = "postMessage"',b.origin);this.isMRAIDAd&&(b.source===this.defaultAdElement.contentWindow&&this.shouldPauseContentWhenStart&&
140this._rendererController.requestContentStateChange(!0),this.mraid.inLoadingState()?this.mraid.state=this.mraid.STATEDEFAULT:this.expandedAdElement&&b.source===this.expandedAdElement.contentWindow&&this.mraid.pushData())}else this.isMRAIDAd?this._mraidMethods(d,c):"close"===d&&this._stop()}}},_mraidMethods:function(b,c){if(b&&this.isMRAIDAd)switch(this.log("_mraidMethods("+b+", "+c+")"),b){case "open":"string"===typeof c?this._mraidOpen(c):2<=c.length&&this._mraidOpen(c[0],a.Util.str2bool(c[1]));break;
141case "close":this._mraidClose();break;case "expand":this._mraidExpand(c);break;case "useCustomClose":c&&0<c.length?this.mraid.useCustomClose=a.Util.str2bool(c):this.warn("Invalid parameter to useCustomClose");break;case "setExpandProperties":if(!c)break;this.requestedExpandWidth=Number(c[0]);this.requestedExpandHeight=Number(c[1]);if(!this.requestedExpandWidth||!this.requestedExpandHeight||this.requestedExpandWidth===this.defaultExpandWidth&&this.requestedExpandHeight===this.defaultExpandHeight)this.requestedExpandHeight=
142this.requestedExpandWidth=0;this.mraid.useCustomClose=a.Util.str2bool(c[2]);this.requestedExpandWidth===this.mraid.expandWidth&&this.requestedExpandHeight===this.mraid.expandHeight||this.mraid.pushData();break;case "log":this.log("MRAID log:"+c);break;default:this.warn("Unknown MRAID function call: "+b+" with param:"+c)}},_mraidOpen:function(b,c){this.log("_mraidOpen("+b+"), baseUrl: "+this.mraid.baseUrl+", absolute Url: "+(b=a.Util.getAbsoluteUrl(this.mraid.baseUrl,b)));b&&"string"===typeof b&&0<
143b.length?((c||"undefined"===typeof c)&&window.open(b),this._rendererController.processEvent({name:a.EVENT_AD_CLICK,info:{showBrowser:!1}})):this.warn("_mraidOpen: url required for open")}
143,_mraidClose:function(){this.log("_mraidClose, current state: "+this.mraid.state);if(this.mraid.inExpandedState()){window.removeEventListener&&document.removeEventListener("touchmove",this.touchMoveDisabler,!1);var a=this.expandedAdElement,c=this.expandedAdElement._fw_closeButton;this.expandedAdElement._fw_closeButton=
144null;var d=this.expandedAdElement.parentNode;this.mraid.state=this.mraid.STATEDEFAULT;this.expandedLightbox&&(d.removeChild(this.expandedLightbox),this.expandedLightbox=null);a!==this.defaultAdElement&&(a.style.display="hidden",window.setTimeout(function(){d.removeChild(a)},50));d.removeChild(c)}else this.mraid.inDefaultState()?this.mraid.state=this.mraid.STATEHIDDEN:this.warn("_mraidClose: close() is only valid when in expanded/default state")},_mraidExpand:function(b){this.log("_mraidExpand, current state: "+
145this.mraid.state);if(this.mraid.inDefaultState())if(this.shouldKeepInterstitial)this.warn("_mraidExpand: expand() is only valid for inline ad");else{if(b){var c=document.createElement("iframe"),d=a.Util.getAbsoluteUrl(this.mraid.baseUrl,b);this.shouldBackgroundTransparent&&(c.allowTransparency="true",c.style["background-color"]="rgba(255,255,255,0)");(this.defaultAdElementContainer||this.defaultAdElement.parentNode).appendChild(c);this.expandedAdElement=c;this.log("_mraidExpand("+b+"), baseUrl:"+
146this.mraid.baseUrl+", absolute Url"+d);this._fillAdNode(c,d,null)}this.mraid.state=this.mraid.STATEEXPANDED;this.isInterstitialNow=!0;this._onViewportResizeScroll()}else this.warn("_mraidExpand: expand() is only valid when in default state")},_onViewportResizeScroll:function(){var b=a.Util.getViewport();this.defaultExpandWidth=b.width;this.defaultExpandHeight=b.height;this.isInterstitialNow&&this.presentInterstitial()},log:function(b){var c=this._rendererController.getAdInstance().getSlot();a.log("HTMLRenderer["+
147c+"]\t"+b)},warn:function(b){var c=this._rendererController.getAdInstance().getSlot();a.warn("HTMLRenderer["+c+"]\t"+b)},info:function(){return{moduleType:a.MODULE_TYPE_RENDERER}},getPlayheadTime:function(){return this.timer?this.timer.getPlayheadTime():-1},getDuration:function(){return this.timer?this.timer.getDuration():-1},_onRendererFailed:function(b,c,d){var e={};e[a.INFO_KEY_ERROR_MODULE]="HTMLRenderer";e[a.INFO_KEY_ERROR_CODE]=b;this._rendererController.getAdInstance().getSlot().getTimePositionClass()===
148a.TIME_POSITION_CLASS_OVERLAY?d||(d=a.ERROR_VAST_NON_LINEAR_GENERAL_ERROR):this._rendererController.getAdInstance().getSlot().getTimePositionClass()!==a.TIME_POSITION_CLASS_DISPLAY||d||(d=a.ERROR_VAST_COMPANION_GENERAL_ERROR);d&&(e[a.INFO_KEY_VAST_ERROR_CODE]=d);c&&(e[a.INFO_KEY_ERROR_INFO]=c);this._rendererController.handleStateTransition(a.RENDERER_STATE_FAILED,e)}};a.HTMLRenderer.prototype.constructor=a.HTMLRenderer;a.GPPConsentManager_v1_0=function(b){a.debug("GPPConsentManager.constructor");
149this._consentManager=b;this._isListening=this._isExecuted=!1;this._gpp=this._listenerId=null;this._gppEventListener=this._gppEventListener.bind(this);this._findGppFunction()};a.GPPConsentManager_v1_0.prototype._addEventListener=function(b,c){a.debug("GPPConsentManager._addEventListener");this._isListening=!0;try{this._listenerId=b("addEventListener",c).listenerId}catch(d){this._isExecuted=!0,a.warn("GPPConsentManager._addEventListener failed with err: "+d.name+": "+d.message)}};a.GPPConsentManager_v1_0.prototype._removeEventListener=
150function(b){a.debug("GPPConsentManager._removeEventListenerForGPPData");this._isListening=!1;try{b("removeEventListener",null,this._listenerId)}catch(c){a.warn("GPPConsentManager._removeEventListenerForGPPData failed with err: "+c.name+": "+c.message)}this._listenerId=null};a.GPPConsentManager_v1_0.prototype._findGppFunction=function(){a.debug("GPPConsentManager._findGppFunction");try{this._gpp=a.Util.getTopMostWindow().__gpp,this._checkIfConsentIsExecuted()}catch(b){a.warn("__gpp function on top window is inaccessible due to the following error: "+
151b)}};a.GPPConsentManager_v1_0.prototype._checkIfConsentIsExecuted=function(){a.debug("GPPConsentManager._checkIfConsentIsExecuted");if(this._gpp){var b=this._gpp("getGPPData");b&&"loaded"==b.pingData.cmpStatus&&"visible"!=b.pingData.cmpDisplayStatus?(this._isExecuted=!0,a.debug("__gpp function found and consent executed")):this._addEventListener(this._gpp,this._gppEventListener)}else a.warn("__gpp function not found"),this._isExecuted=!0};a.GPPConsentManager_v1_0.prototype._gppEventListener=function(b){a.debug("GPPConsentManager_gppEventListener");
152"loaded"==b.pingData.cmpStatus&&"visible"!=b.pingData.cmpDisplayStatus&&(this._isExecuted=!0,this._isListening&&this._removeEventListener(this._gpp))};a.GPPConsentManager_v1_0.prototype.isExecuted=function(){return this._isExecuted};a.GPPConsentManager_v1_0.prototype.getGPPValues=function(){var b="",c="";if(!this._gpp)return a.warn("window.__gpp is missing."),{gppString:b,sectionId:c};try{var d=this._gpp("getGPPData");a.debug("GPPConsentManager.getGPPData")}catch(e){a.warn("GPPConsentManager.getGPPValues failed with err:  "+
153e.name+": "+e.message)}if(!d)return a.warn("GPPData is missing."),{gppString:b,sectionId:c};null!=d.gppString?("string"!=typeof d.gppString&&a.warn("GPPData's gppString value is not a string."),b=d.gppString.toString()):a.warn("GPPData's gppString value is missing.");null!=d.applicableSections?!Array.isArray(d.applicableSections)||2<d.applicableSections.length?(a.warn("GPPData's sectionId value is not an array of up to 2 numbers."),c=d.applicableSections.toString()):c=d.applicableSections.join():
154a.warn("GPPData's sectionId value is missing.");return{gppString:b,sectionId:c}};a.GPPConsentManager_v1_0.prototype.dispose=function(){this._isListening&&this._removeEventListener();this._consentManager=null};a.TCFConsentManager=function(a){this._consentManager=a;this._fwGDPRConsent=this._fwGDPR=null;this._isExecuted=!1;this._tcfapiImpl=this._listenerId=null;this._tcfapiCallback=this._tcfapiCallback.bind(this);this._fetchGDPRData()};a.TCFConsentManager.prototype._fetchGDPRData=function(){a.debug("TCFConsentManager.fetchGDPRData");
155try{this._tcfapiImpl=a.Util.getTopMostWindow().__tcfapi,this._getGdprConsentData()}catch(b){a.warn("__tcfapi function on top window is inaccessible due to the following error: "+b),this._retrieveGDPRWithPostMessage()}};a.TCFConsentManager.prototype._getGdprConsentData=function(){a.debug("TCFConsentManager.getGdprConsentData");"function"==typeof this._tcfapiImpl?this._addEventListenerForTCData():(this._isExecuted=!0,a.warn("TCFAPI function cannot be found. _fw_gdpr: "+this._fwGDPR+", _fw_gdpr_consent: "+
156this._fwGDPRConsent))};a.TCFConsentManager.prototype._retrieveGDPRWithPostMessage=function(){a.debug("TCFConsentManager.retrieveGDPRWithPostMessage");this._consentManager.setupConsentPostMessage("__tcfapi");this._tcfapiImpl=window.__tcfapi;this._getGdprConsentData()};a.TCFConsentManager.prototype._tcfapiCallback=function(b,c){c?this._onTCFSuccess(b):(this._isExecuted=!0,a.warn("TCFAPI call failed."))};a.TCFConsentManager.prototype._onTCFSuccess=function(b){a.debug("TCFConsentManager._onTCFSuccess with event status ",
157b.eventStatus);this._getTCStringFromTCData(b);b.listenerId&&(this._listenerId=b.listenerId);"tcloaded"==b.eventStatus||"useractioncomplete"==b.eventStatus?this._isExecuted=!0:"cmpuishown"!==b.eventStatus&&(this._fwGDPRConsent=this._fwGDPR="",this._isExecuted=!0,a.warn("VendorConsentData's event status is missing or not valid."))};a.TCFConsentManager.prototype._getTCStringFromTCData=function(b){var c=b.gdprApplies;null!==c?void 0==c?this._fwGDPR="":"boolean"==typeof c?this._fwGDPR=c?1:0:(this._fwGDPR=
158c.toString(),a.warn("VendorConsentData's gdprApplies value is not a string.")):a.warn("VendorConsentData's gdprApplies value is missing.");b=b.tcString;null!=b?"string"==typeof b?this._fwGDPRConsent=b:(this._fwGDPRConsent=b.toString(),a.warn("VendorConsentData's consentData value is malformed.")):a.warn("VendorConsentData's consentData value is missing.")};a.TCFConsentManager.prototype._addEventListenerForTCData=function(){a.debug("TCFConsentManager._addEventListenerForTCData");try{this._tcfapiImpl("addEventListener",
159a.GDPR_TCFAPI_VERSION,this._tcfapiCallback)}catch(b){this._isExecuted=!0,a.warn("TCFConsentManager._addEventListenerForTCData failed with err: "+b.name+": "+b.message)}};a.TCFConsentManager.prototype._removeEventListenerForTCData=function(){a.debug("TCFConsentManager._removeEventListenerForTCData");if(this._listenerId){try{this._tcfapiImpl("removeEventListener",a.GDPR_TCFAPI_VERSION,function(b){b?a.log("TCFAPI removeEventListener succeeded"):a.warn("TCFAPI remove listener failed.")},this._listenerId)}catch(b){a.warn("TCFConsentManager._removeEventListenerForTCData failed with err: "+
160b.name+": "+b.message)}this._listenerId=null}};a.TCFConsentManager.prototype.isExecuted=function(){return this._isExecuted};a.TCFConsentManager.prototype.getGDPRValues=function(){return{string:(this._fwGDPR||"").toString(),consentParam:this._fwGDPRConsent||""}};a.TCFConsentManager.prototype.dispose=function(){this._removeEventListenerForTCData();this._consentManager=null};a.PauseAdExtension=function(){this._context=null;this.linearSlotToPauseSlotsMap={};this.currentPlayingPauseSlotCustomId=this.toBePlayedPauseSlotCustomId=
161null;this.needDispatchContentResumeEvent=!1};a.PauseAdExtension.prototype={init:function(b){a.debug("PauseAdExtension.init(context)");this._context=b;this._onRequestComplete=a.Util.bind(this,function(b){a.debug("PauseAdExtension._onRequestComplete");if(a.Util.getBooleanParameter(a.PARAMETER_EXTENSION_PAUSE_AD_ENABLE,!0))if(b.
161success){b=this._context.getTemporalSlots();for(var c=b.filter(function(a){return a.isPauseSlot()}),e=0;e<b.length;e++){var f=b[e];if(f.getTimePositionClass()===a.TIME_POSITION_CLASS_PREROLL||
162f.getTimePositionClass()===a.TIME_POSITION_CLASS_MIDROLL){for(var k=[],g=0;g<c.length;g++){var m=c[g];m.getTimePosition()===f.getTimePosition()&&k.push(m.getCustomId())}0<k.length&&(this.linearSlotToPauseSlotsMap[f.getCustomId()]=k)}}for(e=0;e<c.length;e++)if(f=c[e],0===f.getTimePosition()){this.toBePlayedPauseSlotCustomId=f.getCustomId();break}a.debug("PauseAdExtension: toBePlayedPauseSlotCustomId:"+this.toBePlayedPauseSlotCustomId);this._context.addEventListener(a.EVENT_SLOT_STARTED,this._onSlotStarted);
163this._context.addEventListener(a.EVENT_SLOT_ENDED,this._onSlotEnded);this._context.addEventListener(a.EVENT_AD,this._onAdEvent)}else a.debug("PauseAdExtension: request complete failed");else a.debug("PauseAdExtension: return since PauseAdExtension is disabled")});this._onSlotStarted=a.Util.bind(this,function(b){a.debug("PauseAdExtension._onSlotStarted");b=b.slot;var c=this.linearSlotToPauseSlotsMap[b.getCustomId()];c?(a.debug("PauseAdExtension: setting pause slot to follow after preroll or midroll"),
164this.toBePlayedPauseSlotCustomId=c[Math.floor(Math.random()*Math.floor(Math.pow(2,32)+1))%c.length]):b.getTimePositionClass()===a.TIME_POSITION_CLASS_PAUSE_MIDROLL&&(this.currentPlayingPauseSlotCustomId=b.getCustomId())});this._onSlotEnded=a.Util.bind(this,function(b){a.debug("PauseAdExtension._onSlotEnded");this.needDispatchContentResumeEvent&&this.currentPlayingPauseSlotCustomId===b.slot.getCustomId()&&(this.needDispatchContentResumeEvent=!1,this.currentPlayingPauseSlotCustomId=null,a.debug("PauseAdExtension: _requestContentVideoToResumeBySlot",
165b.slot.getCustomId()),this._context._requestContentVideoToResumeBySlot(b.slot))});this._onUserActionNotified=a.Util.bind(this,function(b){a.debug("PauseAdExtension._onUserActionNotified");b=b.action;if(b===a.EVENT_USER_ACTION_PAUSE_BUTTON_CLICKED){if(a.debug("PauseAdExtension: pauseButtonClicked"),b=this._context.getSlotByCustomId(this.toBePlayedPauseSlotCustomId))a.debug("PauseAdExtension: slot.play: "+this.toBePlayedPauseSlotCustomId),b.play()}else if(b===a.EVENT_USER_ACTION_RESUME_BUTTON_CLICKED)if(a.debug("PauseAdExtension: resumeButtonClicked"),
166this.currentPlayingPauseSlotCustomId){if(b=this._context.getSlotByCustomId(this.currentPlayingPauseSlotCustomId))a.debug("PauseAdExtension: slot.stop: "+this.currentPlayingPauseSlotCustomId),b.stop(),this.needDispatchContentResumeEvent=!1,this.currentPlayingPauseSlotCustomId=null}else a.debug("PauseAdExtension: Current playing pause slot id was empty. No slot to stop.");else a.debug("PauseAdExtension: No valid user action was provided.")});this._onAdEvent=a.Util.bind(this,function(b){b.subType&&b.subType===
167a.EVENT_AD_IMPRESSION?(a.debug("PauseAdExtension._onAdEvent impression fired"),this.currentPlayingPauseSlotCustomId===b.slot.getCustomId()&&(this.needDispatchContentResumeEvent=!0)):b.subType&&b.subType===tv.freewheel.SDK.EVENT_ERROR&&(a.debug("PauseAdExtension._onAdEvent error fired"),this.currentPlayingPauseSlotCustomId===b.slot.getCustomId()&&(this.needDispatchContentResumeEvent=!1))});this._context.addEventListener(a.EVENT_REQUEST_COMPLETE,this._onRequestComplete);this._context.addEventListener(a.EVENT_USER_ACTION_NOTIFIED,
168this._onUserActionNotified)},dispose:function(){a.debug("PauseAdExtension.dispose()");this._context&&(this._context.removeEventListener(a.EVENT_REQUEST_COMPLETE,this._onRequestComplete),this._context.removeEventListener(a.EVENT_USER_ACTION_NOTIFIED,this._onUserActionNotified),this._context.removeEventListener(a.EVENT_AD,this._onAdEvent),this._context.removeEventListener(a.EVENT_SLOT_STARTED,this._onSlotStarted),this._context.removeEventListener(a.EVENT_SLOT_ENDED,this._onSlotEnded),this._context=
169null)}};a.PauseAdExtension.prototype.constructor=a.PauseAdExtension;a.CustomPlayerRenderer=function(){this._adListener=this._customPlayer=this._rendererController=null;this._quartileSent=0;this._isPaused=this._isStarted=!1;this._timeoutTracker=null;this._lastPlayheadTime=0;this._timeUpdatePollingIntervalInMs=250;this._volume=1};a.CustomPlayerRenderer.prototype={pause:function(){this._isPaused=!0;this._rendererController&&this._rendererController.processEvent({name:a.EVENT_AD_PAUSE});this._customPlayer&&
170this._customPlayer.playPause(!0)},resume:function(){this._isPaused=!1;this._rendererController&&this._rendererController.processEvent({name:a.EVENT_AD_RESUME});this._customPlayer&&this._customPlayer.playPause(!1)},start:function(b){this._rendererController=b;if(this._customPlayer=this._rendererController.getCustomPlayer()){b=this._rendererController.getAdInstance();var c=b.getSlot();a.log("CustomPlayerRenderer.start",c.getTimePositionClass(),b);var d=c.getVideoDisplaySize().width,e=c.getVideoDisplaySize().height;
171c=b.getRenderableCreativeRenditions();if((e=(d=(new a.RenditionSelector(this._rendererController.getParameter(a.PARAMETER_DESIRED_BITRATE)||1E3,this._rendererController.getParameter("arWeight")||1,this._rendererController.getParameter("pxWeight")||1,.2)).getCustomPlayerBestFitRendition(c,d,e))?d.getPrimaryCreativeRenditionAsset():null)&&c.length)if(c=e.getProxiedUrl()){b.setActiveCreativeRendition(d);a.log("CustomPlayerRenderer.start selected rendition is:",c);this._rendererController.setCapability(a.EVENT_AD_QUARTILE,
172a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_MUTE,a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_PAUSE,a.CAPABILITY_STATUS_ON);b=this._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_CLICK_DETECTION);if(null===b||"undefined"===typeof b)b="false";!1===a.Util.str2bool(b)?this._rendererController.setCapability(a.EVENT_AD_CLICK,a.CAPABILITY_STATUS_OFF):this._rendererController.setCapability(a.EVENT_AD_CLICK,a.CAPABILITY_STATUS_ON);this._volume=
173this._rendererController.getContext().getAdVolume();this._adListener=new a.AdListener(this);b=this._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_START_DETECT_TIMEOUT)||5E3;this._progressTimeoutInMs=this._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_PROGRESS_DETECT_TIMEOUT)||8E3;this._onTimeout=a.Util.bind(this,function(a){this._adListener.onError(a)});this._timeoutTracker=setTimeout(this._onTimeout,b,b+" ms custom player timeout before playing");this._quartileTimerId=setInterval(a.Util.bind(this,
174this._pollForAdVideoTimeUpdate),this._timeUpdatePollingIntervalInMs);a.log("CustomPlayerRenderer will play video ad: "+c);this._customPlayer.open(d,this._adListener)}else this._onRendererFailed(a.ERROR_NULL_ASSET);else this._onRendererFailed(a.ERROR_DEVICE_LIMIT,"no compatible asset")}else this._onRendererFailed(a.ERROR_UNKNOWN,"custom player was null")},_pollForAdVideoTimeUpdate:function(){var b=this._customPlayer.getPlayheadTime(),c=this._customPlayer.getDuration();"number"===typeof b&&"number"===
175typeof c&&(0>=b||0>=c?a.debug("CustomPlayerRenderer._pollForAdVideoTimeUpdate currentTime or duration is less than or 0"):(this._isStarted||(this._isStarted=!0,this._rendererController.getAdInstance().adjustOffsetAndProgressWithRendererDuration(c),this._rendererController.handleStateTransition(a.RENDERER_STATE_STARTED)),this._rendererController&&(this._rendererController.checkProgress(b),this._rendererController.checkForSkippableStateChange()),b>this._lastPlayheadTime&&(this._clearTimeoutTracker(),
176this._lastPlayheadTime=b,this._isPaused||(this._timeoutTracker=setTimeout(this._onTimeout,this._progressTimeoutInMs,this._progressTimeoutInMs+" ms custom player timeout when playing"))),this._sendQuartiles(b/c)))},_sendQuartiles:function(b){a.debug("CustomPlayerRenderer._sendQuartiles");.25<=b&&1>this._quartileSent&&(this._quartileSent=1,this._rendererController.processEvent({name:a.EVENT_AD_FIRST_QUARTILE}));.5<=b&&2>this._quartileSent&&(this._quartileSent=2,this._rendererController.processEvent({name:a.EVENT_AD_MIDPOINT}));
177.75<=b&&3>this._quartileSent&&(this._quartileSent=3,this._rendererController.processEvent({name:a.EVENT_AD_THIRD_QUARTILE}));.99<=b&&4>this._quartileSent&&(this._rendererController.checkProgress(this._customPlayer.getDuration()),this._quartileSent=4,this._rendererController.processEvent({name:a.EVENT_AD_COMPLETE}))},_sendMissingQuartiles:function(){a.debug("CustomPlayerRenderer._sendMissingQuartiles");this._sendQuartiles(1)},_onEnded:function(b){a.debug("CustomPlayerRenderer._onEnded");this._pollForAdVideoTimeUpdate();
178if(b){var c=a.ERROR_CUSTOM_PLAYER;b.includes("timeout")&&(c=a.ERROR_TIMEOUT);this._onRendererFailed(c,b)}else this._sendMissingQuartiles(),this._rendererController.handleStateTransition(a.RENDERER_STATE_COMPLETED);this._dispose()},_dispose:function(){a.debug("CustomPlayerRenderer._dispose");this._clearTimeoutTracker();this._clearQuartileTimer();this._customPlayer=null;
178this._rendererController=this._adListener=this._adListener._customPlayerRenderer=null},stop:function(){a.debug("CustomPlayerRenderer.stop");
179this._customPlayer&&this._customPlayer.playPause(!0);this._rendererController.handleStateTransition(a.RENDERER_STATE_COMPLETED);this._dispose()},info:function(){return{moduleType:a.MODULE_TYPE_RENDERER}},getPlayheadTime:function(){return this._customPlayer?this._customPlayer.getPlayheadTime():-1},getDuration:function(){return this._customPlayer?this._customPlayer.getDuration():-1},setVolume:function(b){a.warn("CustomPlayerRenderer.setVolume("+b+")");a.Util.fireVolumeEvents(this._volume,b,this._rendererController);
180this._volume=b},_getClickThroughUrls:function(){var b=this._rendererController.getAdInstance().getEventCallback(a.EVENT_AD_CLICK,a.EVENT_TYPE_CLICK);return[].concat(b._url,b._trackingUrls)},_clearTimeoutTracker:function(){this._timeoutTracker&&(clearTimeout(this._timeoutTracker),this._timeoutTracker=null)},_clearQuartileTimer:function(){this._quartileTimerId&&(clearInterval(this._quartileTimerId),this._quartileTimerId=null)},_onRendererFailed:function(b,c){var d={};d[a.INFO_KEY_ERROR_MODULE]="CustomPlayerRenderer";
181d[a.INFO_KEY_ERROR_CODE]=b;c&&(d[a.INFO_KEY_ERROR_INFO]=c);this._rendererController.handleStateTransition(a.RENDERER_STATE_FAILED,d)}};a.CustomPlayerRenderer.prototype.constructor=a.CustomPlayerRenderer;a.AdListener=function(a){this._customPlayerRenderer=a};a.AdListener.prototype={onEnded:function(){a.debug("AdListener.onEnded");this._customPlayerRenderer._onEnded()},onError:function(b){a.warn("AdListener.onError:",b);this._customPlayerRenderer._onEnded(b)},getClickThroughUrls:function(){return this._customPlayerRenderer._getClickThroughUrls()}};
182a.AdListener.prototype.constructor=a.AdListener;a.GPPConsentManagerWrapper=function(b){this._consentManager=b;this._isVersionSet=!1;this._gppConsentManagerWrapped=this._gpp=null;this._gppConsentManagerMap={"1.0":a.GPPConsentManager_v1_0,"1.1":a.GPPConsentManager_v1_1};this._setGPPVersion=this._setGPPVersion.bind(this);this._setGPPConsentManager()};a.GPPConsentManagerWrapper.prototype._setGPPConsentManager=function(){a.debug("GPPConsentManagerVersionControl._setGPPConsentManager");this._setGPP();this._pingForGPPVersion();
183if(this._gpp)if(a.CMP_GPP_VERSION){a.debug("GPPConsentManagerVersionControl: GPP version "+a.CMP_GPP_VERSION+" selected.");var b=this._gppConsentManagerMap[a.CMP_GPP_VERSION]}else a.warn("GPPConsentManagerVersionControl: Query for GPP version failed. Defaulting to GPP v1.1"),b=this._gppConsentManagerMap["1.1"];else a.warn("GPPConsentManagerVersionControl: __gpp function not found in local frame. Defaulting to GPP v1.1"),b=this._gppConsentManagerMap["1.1"];this._gppConsentManagerWrapped=new b(this._consentManager)};
184a.GPPConsentManagerWrapper.prototype._setGPP=function(){a.debug("GPPConsentManagerVersionControl._setGPP");try{this._gpp=a.Util.getTopMostWindow().__gpp}catch(b){a.warn("__gpp function on top window is inaccessible due to the following error: "+b)}};a.GPPConsentManagerWrapper.prototype._setGPPVersion=function(b,c){a.debug("GPPConsentManagerVersionControl._setGPPVersion");!1===c?a.warn("CMP failed to process GPP ping."):this._isVersionSet||(a.CMP_GPP_VERSION="number"===typeof b.gppVersion?b.gppVersion.toFixed(1):
185b.gppVersion,this._isVersionSet=!0)};a.GPPConsentManagerWrapper.prototype._pingForGPPVersion=function(){if(this._gpp){var b=this._gpp("ping",this._setGPPVersion);b?this._setGPPVersion(b,!0):this._isVersionSet||this._setGPPVersion(null,!1)}else a.debug("GPPConsentManagerVersionControl._pingForGPPVersion: __gpp function not found.")};a.GPPConsentManagerWrapper.prototype.isExecuted=function(){return this._gppConsentManagerWrapped?this._gppConsentManagerWrapped.isExecuted():!1};a.GPPConsentManagerWrapper.prototype.getGPPValues=
186function(){return this._gppConsentManagerWrapped?this._gppConsentManagerWrapped.getGPPValues():{gppString:"",sectionId:""}};a.GPPConsentManagerWrapper.prototype.dispose=function(){this._gppConsentManagerWrapped&&this._gppConsentManagerWrapped.dispose();this._consentManager=null};a.Timer=function(a,c){this._lastTickDate=new Date;this._duration=a||-1;this._playheadTime=-1;this._callback=c;this._state=-1};a.Timer.prototype={};a.Timer.prototype.constructor=a.Timer;a.Util.mixin(a.Timer.prototype,{tick:function(){var a=
187new Date,c=Math.round((a.getTime()-this._lastTickDate.getTime())/1E3);this._lastTickDate=a;return c},start:function(){if(0!==this._state){if(2===this._state||-1===this._playheadTime)this._playheadTime=0;this._state=0;this._timeStamp=new Date;this._timeouter&&(window.clearTimeout(this._timeouter),this._timeouter=null);var a=this,c=1E3*(this._duration-this._playheadTime);0>c||(this._timeouter=window.setTimeout(function(){a.stop();a._playheadTime=a._duration;a._callback&&a._callback()},c))}},pause:function(){0===
188this._state&&(this._state=1,this._timeouter&&(window.clearTimeout(this._timeouter),this._timeouter=null),this._playheadTime=(new Date-this._timeStamp)/1E3+this._playheadTime)},stop:function(){this._state=2;this._timeouter&&(window.clearTimeout(this._timeouter),this._timeouter=null);this._playheadTime=(new Date-this._timeStamp)/1E3+this._playheadTime},getPlayheadTime:function(){return 0===this._state?(new Date-this._timeStamp)/1E3+this._playheadTime:this._playheadTime},getCTValue:function(){return(new Date-
189this._timeStamp)/1E3},getDuration:function(){return this._duration}});a.RendererController=function(b,c){var d=null,e=null,f={},k=a.RendererInitState.instance,g={},m=[],A=0,P=!1,H=!1,t=[];return{getAdInstance:function(){return c},getContext:function(){return b},getRendererState:function(){return k},processEvent:function(b){var d=b.name;if(d===a.RENDERER_STATE_STARTED||d===a.RENDERER_STATE_COMPLETING||d===a.RENDERER_STATE_COMPLETED||d===a.RENDERER_STATE_FAILED)this.handleStateTransition(d,b.info);
190else{var e=this._inferEventType(d);if(e&&(e===a.EVENT_TYPE_CLICK&&b.info&&b.info[a.INFO_KEY_CUSTOM_EVENT_NAME]&&
190(d=b.info[a.INFO_KEY_CUSTOM_EVENT_NAME]),d!==a.EVENT_AD_MEASUREMENT||b.info[a.INFO_KEY_CONCRETE_EVENT_ID])){var f=d===a.EVENT_AD_INITIATED||d===a.EVENT_AD_PREINIT||d===a.EVENT_AD_BUFFERING_START||d===a.EVENT_AD_BUFFERING_END||d===a.EVENT_AD_VOLUME_CHANGE||d===a.EVENT_AD_SKIPPABLE_STATE_CHANGED||b.info&&b.info.hasOwnProperty("apiOnly")&&b.info.apiOnly;c.processEvent(d,e,b.info,f)}}},checkProgress:function(a){for(;0<
191t.length&&t[0]<a;)c.processProgressEvent(t.shift())},checkForSkippableStateChange:function(){!H&&c&&c.getAdSkippableState()&&(H=!0,this.processEvent({name:a.EVENT_AD_SKIPPABLE_STATE_CHANGED}))},handleStateTransition:function(b,d){switch(b){case a.RENDERER_STATE_STARTED:t=Object.keys(c._progressEventCallbackUrlsDict||[]).sort(function(a,b){return a-b});d&&d[a.INFO_KEY_START_TIME_POSITION]&&c.setStartTimePosition(d[a.INFO_KEY_START_TIME_POSITION]);k.notifyStarted(this);break;case a.RENDERER_STATE_COMPLETING:k.complete(this);
192break;case a.RENDERER_STATE_COMPLETED:k.complete(this);k.notifyCompleted(this);break;case a.RENDERER_STATE_FAILED:c.getSlot()._clearScheduledAdInstance();d||(d={});a.warn("FAIL",", FW ErrorModule:",d[a.INFO_KEY_ERROR_MODULE],", FW ErrorCode:",d[a.INFO_KEY_ERROR_CODE],", FW ErrorInfo:",d[a.INFO_KEY_ERROR_INFO],", VAST ErrorCode:",d[a.INFO_KEY_VAST_ERROR_CODE]);(b=c.processEvent(a.EVENT_ERROR,a.EVENT_TYPE_ERROR,d))||a.debug("No EVENT_ERROR callback found");if(d)switch(d[a.INFO_KEY_ERROR_CODE]){case a.ERROR_NO_AD_AVAILABLE:case a.ERROR_PARSE:(b=
193c.processEvent(a.EVENT_RESELLER_NO_AD,a.EVENT_TYPE_IMPRESSION))||a.debug("No EVENT_RESELLER_NO_AD callback found.")}k.fail(this);break;default:a.debug("Unknown event received",b)}},setCapability:function(a,b){c.setMetr(a,b)},getVersion:function(){return b._adManager.getVersion()},getParameter:function(a){if(!a)return null;if(b._overrideLevelParameterDictionary.hasOwnProperty(a))return b._overrideLevelParameterDictionary[a];if(c.getActiveCreativeRendition()&&"undefined"!==typeof c.getActiveCreativeRendition().getParameter(a))return c.getActiveCreativeRendition().getParameter(a);
194var d=c._creative;return d&&"undefined"!==typeof d.getParameter(a)?d.getParameter(a):"undefined"!==typeof c.getSlot().getParameter(a)?c.getSlot().getParameter(a):b._adResponse._profileParameters.hasOwnProperty(a)?b._adResponse._profileParameters[a]:b._globalLevelParameterDictionary.hasOwnProperty(a)?b._globalLevelParameterDictionary[a]:f&&f.hasOwnProperty(a)?f[a]:null},getCompanionSlots:function(){for(var a=[],b=c._companionAdInstances,d=0;d<b.length;d++)b[d].isPlaceholder()&&a.push(b[d].getSlot());
195return a},createNullDrivingAdInstance:function(){var a=c.getSlot().scheduleAdInstance();a.addCreativeRendition().setContentType("null/null");return a},scheduleAdInstances:function(a){var b,d=[],e=null;a=a||[];if(0===a.length)return d;for(b=0;b<a.length;b++)a[b].getCustomId()===c.getSlot().getCustomId()&&(e=c.getSlot().scheduleAdInstance());if(!e)if(this.isTranslator())e=this.createNullDrivingAdInstance();else if(this.isRenderer())e=c;else return d;for(var f=0;f<a.length;f++){if(a[f].getCustomId()===
196c.getSlot().getCustomId())e!==c&&d.push(e);else for(var k=0,v=e._companionAdInstances;k<v.length;k++)if(b=v[k],a[f]===b.getSlot()){if(this.isTranslator())d.push(b);else if(this.isRenderer()&&b.isPlaceholder()){var h=b.cloneForTranslation();e===c&&(g[h]=b);v[k]=h;d.push(h);m.push(h)}break}d.length<=f&&d.push(null)}return d},commitAdInstance:function(){if(this.isRenderer()&&c.isStarted()){for(var b=0;b<m.length;b++){var d=m[b];d&&d.getSlot().playCompanionAds(d)}m=[]}else a.warn("Skipping RendererController.commitAdInstance when called with driving ad not started or completed.")},
197isRenderer:function(){return d&&a.MODULE_TYPE_RENDERER===d.info()[a.INFO_KEY_MODULE_TYPE]},isTranslator:function(){return d&&a.MODULE_TYPE_TRANSLATOR===d.info()[a.INFO_KEY_MODULE_TYPE]},playable:function(){return k===a.RendererInitState.instance},reset:function(){k=a.RendererInitState.instance},play:function(){for(var a=c.getRenderableCreativeRenditions()||[],b=null,d=0;d<a.length;d++){var e=a[d];if(b=this._matchRendererClassName(e)){c.setActiveCreativeRendition(e);break}}0===A&&this._actualPlay(b)},
198_actualPlay:function(b){(e=a.Util.getObject(b)||a.Util.getObject(h+"."+b))&&(d=new e);d?(P||this.isTranslator()||(P=!0,this.processEvent({name:a.EVENT_AD_PREINIT}),a.debug("Fired preInit for: "+b)),k.start(this)):this.handleStateTransition(a.RENDERER_STATE_FAILED,{errorCode:a.ERROR_NO_RENDERER,errorInfo:"Renderer class <"+b+"> not found"})},dispatchEvent:function(a,c){b.dispatchEvent(a,c)},requestContentStateChange:function(a){a?b._requestContentVideoToPauseBySlot(c.getSlot()):b._requestContentVideoToResumeBySlot(c.getSlot())},
199getRenderer:function(){return d},setRenderer:function(a){d=a},setRendererState:function(a){k=a},getContentVideoElement:function(){return b.getContentVideoElement()},getCustomPlayer:function(){return b.getCustomPlayer()},_restorePlaceholdersForHybrid:function(){if(g&&this.isRenderer()){for(var a=[],b=0;b<c._companionAdInstances.length;b++){var d=c._companionAdInstances[b],e=g[d];e?a.push(e):a.push(d)}c._companionAdInstances=a}0<m.length&&this.isRenderer()&&(m=[])},rendererMatch:function(b){return e?
200e===a.Util.getObject(this._matchRendererClassName(b)):!0},_matchRendererClassName:function(d){function e(b,c,d){a.debug("matching "+b+" within "+c);if(!c)return!0;c=c.split(",");c[c.length-1]||c.pop();if(d){b=b.toLowerCase();for(d=0;d<c.length;d++)if(b===c[d].toLowerCase())return!0;a.debug("not match");return!1}(c=0<=c.indexOf(b))||a.debug("not match");return c}var g=d.getPrimaryCreativeRenditionAsset().getContentType(),k=d.getContentType(),m=d.getWrapperType(),v=d.getCreativeApi(),P=d.getBaseUnit(),
201t=c.getSoAdUnit(),H=c.getSlot(),p=H.getType();H=H.getTimePositionClass();a.debug("match renderer for creativeRendition:"+d.getId());a.debug("slot type:"+p);if(a.Util.isBlank(k)&&a.Util.isBlank(m))return a.warn("renderer not match due to both contentType and wrapperType are empty"),null;var l=b._rendererManifest["*"];l||(l=b._rendererManifest[m]);l||(l=b._rendererManifest[k]);if(!l){p=b._overriddenAdRenderers.concat(b._adResponse._adRenderers);for(var E=0;E<p.length;E++){var u=p[E],F=!u.contentType;
202F||(m?F=e(m,u.contentType,!0):(g&&(F=e(g,u.contentType,!0)),F||(F=e(k,u.contentType,!0))));if(F)if((F=!u.creativeApi)||(F=e(v,u.creativeApi)),F)if(u.baseUnit&&!e(P,u.baseUnit))a.debug("can't match renderer "+u.url+" due to baseUnit not match for creativeRendition:"+d.getId());else if(u.soAdUnit&&!e(t,u.soAdUnit))a.debug("can't match renderer "+u.url+" due to soAdUnit not match for creativeRendition:"+d.getId());else if(u.slotType&&!e(H.toUpperCase(),u.slotType.toUpperCase()))a.debug("can't match renderer "+
203u.url+" due to slotType not match for creativeRendition:"+d.getId());else if("class://DashRenderer"===u.url&&void 0===window.tv.freewheel.Dashjs)a.debug("can't match renderer "+u.url+" due to missing tv.freewheel.Dash.js for creativeRendition:"+d.getId());else if("class://VideoRenderer"===u.url&&null==this.getContentVideoElement())a.warn("VideoRenderer could not find reference to the video element, should call context.registerVideoDisplayBase() or context.setContentVideoElement()");else if("class://CustomPlayerRenderer"===
204u.url&&null==this.getCustomPlayer())a.warn("CustomPlayerRenderer could not find reference to the custom player, should call context.regusterCustomPlayer()");else if("class://VPAIDRenderer"===u.url&&null==this.getContentVideoElement())a.warn("VPAIDRenderer could not find reference to the video element, should call context.registerVideoDisplayBase() or context.setContentVideoElement()");else if("class://DashRenderer"===u.url&&null==this.getContentVideoElement())a.warn("DashRenderer could not find reference to the video element, should call context.registerVideoDisplayBase() or context.setContentVideoElement()");
205else{if(a.debug("renderer "+u.url+" matched for creativeRendition:"+d.getId()),u.url){l=u.url;d=l.indexOf("?");-1!==d&&(l=l.substring(0,d));d=l.lastIndexOf("/");-1!==d&&(l=l.substring(d+1));d=l.lastIndexOf(".js");-1!==d&&(l=l.substring(0,d));var z={};if(u.parameter)for(d=[].concat(u.parameter),g=0;g<d.length;g++)if(d[g].hasOwnProperty("name"))z[d[g].name]=d[g].value;else for(var w in d[g])d[g].hasOwnProperty(w)&&(z[w]=d[g][w]);a.Util.getObject(h+"."+l)&&(l=h+"."+l);if(a.Util.getObject(l))f=z,A=0;
206else{if(0<A)break;var x=this;w=1*this.getContext().getParameter("moduleLoadTimeout")||6E4;A=window.setTimeout(function(){A=-1;x.handleStateTransition(a.RENDERER_STATE_FAILED,{errorCode:a.ERROR_NO_RENDERER,errorInfo:"Load renderer timeout, URL:"+u.url})},w);a.Util.lazyJavaScriptLoad(u.url,function(){a.log("async load renderer successful, URL:"+u.url);-1===A?a.debug("renderer loaded after timeout. WILL NOT PLAY."):(window.clearTimeout(A),A=0,f=z,x._actualPlay(l))})}break}}else a.debug("can't match renderer "+
207u.url+" due to creative api not match for creativeRendition:"+d.getId());else a.debug("can't match renderer "+u.url+" due to contentType not match for creativeRendition:"+d.getId())}}return l?l:a.Util.isBlank(m)?"null/null"===k?h+".NullRenderer":null:null},_inferEventType:function(b){return b===a.EVENT_ERROR?a.EVENT_TYPE_ERROR:b===a.EVENT_AD_CLICK?a.EVENT_TYPE_CLICK:b===a.EVENT_AD_IMPRESSION||b===a.EVENT_AD_FIRST_QUARTILE||b===a.EVENT_AD_MIDPOINT||b===a.EVENT_AD_THIRD_QUARTILE||b===a.EVENT_AD_COMPLETE||
208b===a.EVENT_RESELLER_NO_AD?a.EVENT_TYPE_IMPRESSION:b===a.EVENT_AD_PAUSE||b===a.EVENT_AD_RESUME||b===a.EVENT_AD_REWIND||b===a.EVENT_AD_MUTE||b===a.EVENT_AD_UNMUTE||b===a.EVENT_AD_COLLAPSE||b===a.EVENT_AD_EXPAND||b===a.EVENT_AD_MINIMIZE||b===a.EVENT_AD_CLOSE||b===a.EVENT_AD_ACCEPT_INVITATION||b===a.EVENT_AD_SKIPPED?a.EVENT_TYPE_STANDARD:b===a.EVENT_AD_MEASUREMENT||b===a.EVENT_AD_VOLUME_CHANGE||b===a.EVENT_AD_BUFFERING_START||b===a.EVENT_AD_BUFFERING_END||b===a.EVENT_AD_INITIATED||b===a.EVENT_AD_PREINIT||
209b===a.EVENT_AD_AUTO_PLAY_BLOCKED||b===a.EVENT_AD_SKIPPABLE_STATE_CHANGED?a.EVENT_TYPE_GENERIC:null},pause:function(){a.log("RendererController.pause");d&&"function"===typeof d.pause?d.pause():a.log("Renderer.pause() is not implemented.")},resume:function(){a.log("RendererController.resume");d&&"function"===typeof d.resume?d.resume():a.log("Renderer.resume() is not implemented.")},stop:function(){a.log("RendererController.stop");0<A&&(A=-1);k.stop(this)}}};a.VideoStateExtension=function(){};a.VideoStateExtension.prototype=
210{_enabled:function(){if(null==this._context)return!1;var b=this._context.getParameter(a.PARAMETER_EXTENSION_VIDEO_STATE_ENABLED);null==b&&(b="false");return!0===a.Util.str2bool(b)},init:function(b){this._context=b;this._enabled()?this._context.setVideoState(a.VIDEO_STATE_PLAYING):a.log("VideoStateExtension is disabled.")},dispose:function(){this._context=null}};a.VideoStateExtension.prototype.constructor=a.VideoStateExtension;a.AdResponse=function(a){this._context=a};a.AdResponse.prototype={};a.AdResponse.prototype.constructor=
211a.AdResponse;a.Util.mixin(a.AdResponse.prototype,{parse:function(b,c){this._data=b;this._temporalSlots=[];this._videoPlayerNonTemporalSlots=[];this._siteSectionNonTemporalSlots=[];this._profileParameters={};this._ads=[];this._siteSectionCustomId=a.Util.getObject("siteSection.customId",b)||"";this._adRenderers=[];var d;var e=a.Util.getObject("parameters",b)||[];for(d=0;d<e.length;++d){var f=e[d];this._profileParameters[f.name]=f.value}this._adRenderers=a.Util.getObject("rendererManifest.adRenderers.adRenderer",
212b)||[];for(d=0;d<this._adRenderers.length;d++)"undefined"!==typeof this._adRenderers[d].adUnit&&(this._adRenderers[d].baseUnit=this._adRenderers[d].adUnit,delete this._adRenderers[d].adUnit);e=a.Util.getObject("ads.ads",b)||[];for(d=0;d<e.length;
212++d)f=new a.Ad(this._context),f.parse(e[d]),this._ads.push(f);e=a.Util.getObject("siteSection.videoPlayer.videoAsset.adSlots",b)||[];for(d=0;d<e.length;++d)f=new a.Slot(this._context),f.setType(a.SLOT_TYPE_TEMPORAL),f.setBase(c),f.parse(e[d]),this._temporalSlots.push(f);
213e=a.Util.getObject("siteSection.videoPlayer.adSlots",b)||[];for(d=0;d<e.length;++d)f=new a.Slot(this._context),f.setType(a.SLOT_TYPE_VIDEOPLAYER_NONTEMPORAL),f.setTimePositionClass(a.TIME_POSITION_CLASS_DISPLAY),f.parse(e[d]),this._initSlotData(f),this._videoPlayerNonTemporalSlots.push(f);e=a.Util.getObject("siteSection.adSlots",b)||[];for(d=0;d<e.length;++d)f=new a.Slot(this._context),f.setType(a.SLOT_TYPE_SITESECTION_NONTEMPORAL),f.setTimePositionClass(a.TIME_POSITION_CLASS_DISPLAY),f.parse(e[d]),
214this._initSlotData(f),this._siteSectionNonTemporalSlots.push(f);b=a.Util.getObject("siteSection.videoPlayer.videoAsset",b)||{};this._context._videoAsset.parse(b)},getCreative:function(a,c){return(a=this.getAd(a))?a.getCreative(c):null},getAd:function(a){for(var b=0;b<this._ads.length;b++){var d=this._ads[b];if(d.getId()===a)return d}return null},getTemporalSlots:function(){return this._temporalSlots},getSiteSectionNonTemporalSlots:function(){return this._siteSectionNonTemporalSlots},getVideoPlayerNonTemporalSlots:function(){return this._videoPlayerNonTemporalSlots},
215getSiteSectionCustomId:function(){return this._siteSectionCustomId},getSlotByCustomId:function(b){for(var c=0;c<this._temporalSlots.length;++c)if(this._temporalSlots[c].getCustomId()===b)return this._temporalSlots[c];for(c=0;c<this._videoPlayerNonTemporalSlots.length;++c)if(this._videoPlayerNonTemporalSlots[c].getCustomId()===b)return this._videoPlayerNonTemporalSlots[c];for(c=0;c<this._siteSectionNonTemporalSlots.length;++c)if(this._siteSectionNonTemporalSlots[c].getCustomId()===b)return this._siteSectionNonTemporalSlots[c];
216a.warn("getSlotByCustomId(): not found",b);return null},_initSlotData:function(b){for(var c=!1,d=0;d<this._context._adRequest._slotScanner._knownSlots.length;d++){var e=this._context._adRequest._slotScanner._knownSlots[d];if(b.getCustomId()===e.id&&e.element){b.setWidth(e.width);b.setHeight(e.height);b.setBase(e.element);b.setAcceptCompanion(e.acceptCompanion);b.setInitialAdOption(e.initialAdOption);c=!0;break}}c||a.warn("Failed to init slot "+b.getCustomId());return c}});a.Slot=function(b){var c=
217"",d=null,e=null,f=null,k=null,g=[],m=[],h={},l=null,H=a.MediaInitState.instance,p=0,v=null,n,r,L,y,M,N,O,Q=0,R=0,K=[],E=null,u=0,F=!1,z=!1,w=!0,x=[],B,I,J=!1;return{getAutoPlayBlocked:function(){return J},setAutoPlayBlocked:function(a){J=a},getSlotProfile:function(){return e},setSlotProfile:function(a){e=a},setMediaState:function(a){H=a},setParameter:function(a,b){null==b?delete h[a]:h[a]=b},getParameter:function(a){if(a&&h.hasOwnProperty(a))return h[a]},getAdCount:function(){return g.length},setCustomId:function(a){c=
218a},getCustomId:function(){return c},setAdUnit:function(a){N=a},getAdUnit:function(){return N},setType:function(a){d=a},getType:function(){return d},setTimePosition:function(a){r=a},getTimePosition:function(){return r},getEndTimePosition:function(){return L},setTimePositionClass:function(a){v=a&&a.toUpperCase()},getTimePositionClass:function(){return v},setWidth:function(a){y=a},getWidth:function(){return v!==a.TIME_POSITION_CLASS_DISPLAY?y?y:b.getVideoDisplaySize().width:y},setHeight:function(a){M=
2191*a},getHeight:function(){return v!==a.TIME_POSITION_CLASS_DISPLAY?M?M:b.getVideoDisplaySize().height:M},setBase:function(a){n=a},getBase:function(){return n},setCuepointSequence:function(a){O=1*a?1*a:0},getCuepointSequence:function(){return O},getVideoDisplaySize:function(){return b.getVideoDisplaySize()},setMaxDuration:function(a){Q=1*a?1*a:0},getMaxDuration:function(){return Q},setMinDuration:function(a){R=1*a?1*a:0},getMinDuration:function(){return R},setAcceptContentType:function(a){if(a&&a.trim()){a=
220a.split(",");for(var b=0;b<a.length;b++)K.push(a[b].trim())}},setSignalId:function(a){a&&a.trim()&&(E=a)},getSignalId:function(){return E},setMaxAds:function(a){u=1*a?1*a:0},getMaxAds:function(){return u},getAcceptContentType:function(){return K.join(",")},parse:function(d){if(d){c=d.customId;r=1*d.timePosition;v=d.timePositionClass&&d.timePositionClass.toUpperCase()||v;var e=1*d.endTimePosition||-1;L=e>=r?e:-1;N=d.adUnit;0<=d.maxDuration&&(Q=d.maxDuration);E=d.signalId;if(void 0===E||null===E)E=
221d.outSignalId;for(var f=0,k=d.eventCallbacks||[];f<k.length;f++){e=k[f];var h=a.EventCallback.newEventCallback(b,e.name,e.type);h&&(h._slot=this,h.parse(e),m.push(h))}f=0;for(k=d.selectedAds||[];f<k.length;f++)e=k[f],d=[],h=new a.AdInstance(b),d.push(h),h._slot=this,h._slotCustomId=c,h._parentAdInstancesGroup=d,h.parse(e),g.push(d)}},getCurrentAdInstance:function(){return f},isPauseSlot:function(){return v===a.TIME_POSITION_CLASS_PAUSE_MIDROLL},play:function(c){if(J)a.log("Resuming previously blocked video ad now."),
222J=!1,b.getContentVideoElement()&&b.getContentVideoElement().play();else{for(var d=this.getAdInstances(),e=0;e<d.length;e++)d[e]._isSkipped=!1;v!==a.TIME_POSITION_CLASS_DISPLAY||w?(a.log("Slot.play",v),F=!1,v===a.TIME_POSITION_CLASS_DISPLAY&&1<g.length&&g.splice(0,g.length-1),this._play(c)):(a.log("Slot is invisible. Push the play operation to the queue."),x.push({operation:this.play,argument:c}))}},stop:function(){a.log("Slot.stop",v);v===a.TIME_POSITION_CLASS_DISPLAY&&(x=[]);H===a.MediaInitState.instance||
223H===a.MediaEndState.instance?a.log("Slot.stop, not start or already end, ignore"):(F=!0,f?f.stop():a.warn("Slot.stop, no _currentAdInstance, ignore"))},pause:function(){a.log("Slot.pause");v!==a.TIME_POSITION_CLASS_DISPLAY?f&&f.pause():a.log("Not a temporal slot. Ignore.")},resume:function(){a.log("Slot.resume");v!==a.TIME_POSITION_CLASS_DISPLAY?f&&f.resume():a.log("Not a temporal slot. Ignore.")},skipCurrentAd:function(){a.log("Slot.skipCurrentAd ",f);f?f.skip():a.log("Slot.skipCurrentAd, no _currentAdInstance, ignore")},
224setVisible:function(b){if(v!==a.TIME_POSITION_CLASS_DISPLAY)a.log("Slot.setVisible is only for display ads.");else if(a.log("Slot.setVisible",b),w!==b&&(w=b))for(;0<x.length;)b=x.pop(),b.operation&&b.operation.call(this,b.argument)},_play:function(a){l=l||a;H.play(this)},onStartPlaying:function(){this._onStartPlaying()},onStartReplaying:function(){this._onStartPlaying()},onCompletePlaying:function(){this._onCompletePlaying()},onCompleteReplaying:function(){this._onCompletePlaying()},playNextAdInstance:function(){a.log("Slot.playNextAdInstance ",
225v);this._playNextAdInstance()||H.complete(this)},scheduleAdInstance:function(){return k=f.cloneForTranslation()},_clearScheduledAdInstance:function(){k=null},_onStartPlaying:function(){v===a.TIME_POSITION_CLASS_MIDROLL&&0<g.length&&b._requestContentVideoToPauseBySlot(this);var c=a.EventCallback.getEventCallback(m,a.EVENT_SLOT_IMPRESSION,a.EVENT_TYPE_IMPRESSION);c&&c.process();this.dispatchSlotEvent(a.EVENT_SLOT_STARTED);this.playNextAdInstance()},dispatchSlotEvent:function(a){z||b.dispatchEvent(a,
226{slot:this})},_onCompletePlaying:function(){l&&l();l=null;x=[];var c=a.EventCallback.getEventCallback(m,a.EVENT_SLOT_END,a.EVENT_TYPE_IMPRESSION);c&&c.process();f=null;this.dispatchSlotEvent(a.EVENT_SLOT_ENDED);v===a.TIME_POSITION_CLASS_MIDROLL&&0<g.length&&b._requestContentVideoToResumeBySlot(this)},_playNextAdInstance:function(){if(F||H!==a.MediaPlayingState.instance&&H!==a.MediaReplayingState.instance)return!1;this._commitScheduledAdInstance();f=this._nextPlayableAdInstance();if(!f)return!1;f.reset();
227f._isInitiatedSent||(f.getRendererController().processEvent({name:a.EVENT_AD_INITIATED}),f._isInitiatedSent=!0);f.getRendererController().play();return!0},_commitScheduledAdInstance:function(){if(k){var a=f._parentAdInstancesGroup.indexOf(f);0<=a&&(k._parentAdInstancesGroup=f._parentAdInstancesGroup,f._parentAdInstancesGroup.splice(a,1,k),k=null)}},_nextPlayableAdInstance:function(){if(f){var b=f._parentAdInstancesGroup,c=b.indexOf(f);var d=g.indexOf(b);0<=d&&0<=c&&(f._isImpressionSent||f._isSkipped||
228c===b.length-1)&&d++}else d=0;if(0>d||d>=g.length)return null;var e;if(H===a.MediaPlayingState.instance)for(b=g[d],e=0;e<b.length;e++){if(c=b[e],c.getRendererController().playable())return c}else if(H===a.MediaReplayingState.instance)for(;d<g.length;d++){b=g[d];for(e=0;e<b.length;e++)if(c=b[e],c._isImpressionSent)return c;for(e=0;e<b.length;e++)if(c=b[e],c.getRendererController().getRendererState()!==a.RendererFailedState.instance&&!c._translated)return c}return null},toString:function(){return"[Slot "+
229c+"]"},getAdInstances:function(){for(var a=[],b=0;b<g.length;++b)for(var c=g[b],d=0;d<c.length;++d){var e=c[d];if(e.isPlayable()){a.push(e);break}}return a},getPlayheadTime:function(){for(var a=0,b=this.getAdInstances(),c=0;c<b.length;++c)if(b[c]===f){b=f.getPlayheadTime();
229-1<b&&(a+=b);break}else{var d=b[c].getDuration();-1<d&&(a+=d)}p&&a>p&&(a=p);return a},getTotalDuration:function(){if(d!==a.SLOT_TYPE_TEMPORAL)return-1;for(var b=0,c=this.getAdInstances(),e=0;e<c.length;++e){var f=c[e].getDuration();
230-1<f&&(b+=f)}return p=b},playCompanionAds:function(b){a.log("Slot.playCompanionAds");var c=[];b._parentAdInstancesGroup=c;c.push(b);g.push(c);z=!0;f&&this.stop();this.play()},getState:function(){return H},setAcceptCompanion:function(a){B=a},getAcceptCompanion:function(){return B},setInitialAdOption:function(a){I=a},getInitialAdOption:function(){return I}}};a.GPPConsentManager_v1_1=function(b){a.debug("GPPConsentManager.constructor");this._consentManager=b;this._sectionId=this._gppString="";this._isListening=
231this._isExecuted=!1;this._gpp=this._listenerId=null;this._gppEventListener=this._gppEventListener.bind(this);this._findGppFunction()};a.GPPConsentManager_v1_1.prototype._addEventListener=function(){a.debug("GPPConsentManager._addEventListener");this._isListening=!0;try{this._gpp("addEventListener",this._gppEventListener)}catch(b){this._isExecuted=!0,a.warn("GPPConsentManager._addEventListener failed with err: "+b.name+": "+b.message)}};a.GPPConsentManager_v1_1.prototype._removeEventListener=function(){a.debug("GPPConsentManager._removeEventListenerForGPPData");
232this._isListening=!1;try{this._gpp("removeEventListener",null,this._listenerId)}catch(b){a.warn("GPPConsentManager._removeEventListenerForGPPData failed with err: "+b.name+": "+b.message)}this._listenerId=null};a.GPPConsentManager_v1_1.prototype._findGppFunction=function(){a.debug("GPPConsentManager._findGppFunction");try{this._gpp=a.Util.getTopMostWindow().__gpp,this._checkIfConsentIsExecuted()}catch(b){a.warn("__gpp function on top window is inaccessible due to the following error: "+b),this._retrieveGPPWithPostMessage()}};
233a.GPPConsentManager_v1_1.prototype._retrieveGPPWithPostMessage=function(){a.debug("GPPConsentManager._retrieveGDPRWithPostMessage");this._consentManager.setupConsentPostMessage("__gpp");this._gpp=window.__gpp;this._checkIfConsentIsExecuted()};a.GPPConsentManager_v1_1.prototype._checkIfConsentIsExecuted=function(){a.debug("GPPConsentManager._checkIfConsentIsExecuted");this._gpp?this._isExecuted?a.debug("__gpp function found and consent executed"):this._isListening?a.debug("__gpp function found, consent being processed"):
234this._addEventListener():(a.warn("__gpp function not found"),this._isExecuted=!0)};a.GPPConsentManager_v1_1.prototype._gppEventListener=function(b,c){a.debug("GPPConsentManager._gppEventListener: event:"+b.eventName+", success:"+c);if(!1===c)this._isExecuted=!0,a.warn("CMP failed to process GPP call.");else switch(b.eventName){case "listenerRegistered":this._listenerId=b.listenerId;break;case "signalStatus":"ready"===b.data&&(this._isExecuted=!0,this._getGPPValuesFromGPPData(b.pingData))}};a.GPPConsentManager_v1_1.prototype._getGPPValuesFromGPPData=
235function(b){b?(null!=b.gppString?("string"!=typeof b.gppString&&a.warn("GPPData's gppString value is not a string."),this._gppString=b.gppString.toString()):a.warn("GPPData's gppString value is missing."),null!=b.applicableSections?!Array.isArray(b.applicableSections)||2<b.applicableSections.length?(a.warn("GPPData's sectionId value is not an array of up to 2 numbers."),this._sectionId=b.applicableSections.toString()):this._sectionId=b.applicableSections.join():a.warn("GPPData's sectionId value is missing.")):
236a.warn("GPPData is missing.")};a.GPPConsentManager_v1_1.prototype.isExecuted=function(){return this._isExecuted};a.GPPConsentManager_v1_1.prototype.getGPPValues=function(){return{gppString:this._gppString,sectionId:this._sectionId}};a.GPPConsentManager_v1_1.prototype.dispose=function(){this._isListening&&this._removeEventListener();this._consentManager=null};a.SurveyExtension=function(){this._surveyPingedIds=[]};a.SurveyExtension.prototype={init:function(b){this._context=b;a.log("SurveyExtension.init("+
237Array.prototype.slice.call(arguments).join(",")+")");this._onAdStarted=a.Util.bind(this,function(b){this._parameters=this._getParameters();if(this._parameters.enabled){a.log("SurveyExtension.onAdStarted()");var c=b.adInstance;if(-1<this._surveyPingedIds.indexOf(c.getAdId()))a.log("won't pingback survey since it has been pinged back");else{var e=c._creative.getParameter("_fw_survey_url");
237if(e)try{a.log("append"+e+" to head");var f=document.getElementsByTagName("head")[0],k=document.createElement("script");
238k.setAttribute("type","text/javascript");k.setAttribute("src",e);f.appendChild(k);this._surveyPingedIds.push(c.getAdId())}catch(g){a.warn("Append survey to head",b.type,g)}}}});this._context.addEventListener(a.EVENT_AD_IMPRESSION,this._onAdStarted)},dispose:function(){a.log("SurveyExtension.dispose()");this._context.removeEventListener(a.EVENT_AD_IMPRESSION,this._onAdStarted);this._parameters=this._onAdStarted=null},_getParameters:function(){var b={};b.enabled="false"!==this._context.getParameter(a.PARAMETER_EXTENSION_SURVEY_ENABLED);
239a.log(b);return b}};a.SurveyExtension.prototype.constructor=a.SurveyExtension;a.ExtensionManager=function(b){this._extensions={};this._context=b;this._surveyExtension=new a.SurveyExtension;this._surveyExtension.init(b);this._videoStateExtension=new a.VideoStateExtension;this._videoStateExtension.init(b);this._displayRefreshExtension=new a.DisplayRefreshExtension;this._displayRefreshExtension.init(b);this._contentVideoExtension=new a.ContentVideoExtension;this._contentVideoExtension.init(b);this._pauseAdExtension=
240new a.PauseAdExtension;this._pauseAdExtension.init(b);this._omsdkExtension=new a.OMSDKExtension;this._omsdkExtension.init(b);this._skippableAdExtension=new a.SkippableAdExtension;this._skippableAdExtension.init(b)};a.ExtensionManager.prototype={_scriptLoaded:function(b){if(null==this._extensions[b])this._loadFail(b,"Extension supposed to be loaded but not found");else{var c=a.Util.getObject(b);"function"!==typeof c?this._loadFail(b,"Script loaded but extension class not found"):(c=new c,"function"===
241typeof c.init&&"function"===typeof c.dispose?(a.log("Extension loaded: "+b),c.init(this._context),this._context.dispatchEvent(a.EVENT_EXTENSION_LOADED,{success:!0,moduleName:b})):this._loadFail(b,"Extension loaded but is not supported"))}},_getExtensionNameFromUrl:function(a){for(var b=/(?!.*\.{2})(?:[\\/\?=#])([a-z][\w\.]+)(?:\.js(#|\?|$))/gi,d,e;null!=(d=b.exec(a));)e=d;return e?e[1]:null},_loadFail:function(b,c){a.log("Extension failed to load. "+b+" : "+c);this._context.dispatchEvent(a.EVENT_EXTENSION_LOADED,
242{success:!1,errorVal:c,moduleName:b})},load:function(b){if(b){var c=this._getExtensionNameFromUrl(b);if(null==c)this._loadFail(c,"Extension name not exists in the Url. Url: "+b);else if(this._extensions[c]===b)a.log("Extension is already loaded"),this._loadFail(c,"Extension is already loaded");else{var d=1*this._context.getParameter("moduleLoadTimeout")||6E4,e=!1,f=this,k=window.setTimeout(function(){e=!0;f._loadFail(c,"Timeout occured while loading extension. Url: "+b)},d);a.Util.lazyJavaScriptLoad(b,
243function(){a.log("async load extension successful, URL:"+b);window.clearTimeout(k);e?a.debug("Extension loaded after timeout, do nothing."):(f._extensions[c]=b,f._scriptLoaded(c))})}}else this._loadFail(c,"Url cannot be empty")},dispose:function(){this._extensions=null;this._surveyExtension.dispose();this._surveyExtension=null;this._displayRefreshExtension.dispose();this._displayRefreshExtension=null;this._pauseAdExtension.dispose();this._pauseAdExtension=null;this._omsdkExtension.dispose();this._omsdkExtension=
244null;this._videoStateExtension.dispose();this._videoStateExtension=null;this._contentVideoExtension.dispose();this._contentVideoExtension=null;this._skippableAdExtension.dispose();this._context=this._skippableAdExtension=null}};a.ExtensionManager.prototype.constructor=a.ExtensionManager;a.EventCallback=function(a){this._url=this._name=this._type=null;this._showBrowser=!1;this._trackingUrls=[];this._adInstance=this._slot=null;this._context=a};a.EventCallback.prototype={};a.EventCallback.prototype.constructor=
245a.EventCallback;a.EventCallback.getEventCallback=function(b,c,d){for(var e,f=0;f<b.length;f++)if(e=b[f],e._name===c&&e._type===d)return e;for(f=0;f<b.length;f++)if(e=b[f],e._type===a.EVENT_TYPE_GENERIC){if(c=a.EventCallback.newEventCallback(e._context,c,d))c._url=e._url,c._slot=e._slot,c._adInstance=e._adInstance,b.push(c);return c}return null};a.EventCallback.newEventCallback=function(b,c,d){if(d===a.EVENT_TYPE_GENERIC)b=new a.EventCallback(b);else if(d===a.EVENT_TYPE_ERROR)b=new a.ErrorEventCallback(b);
246else if(d===a.EVENT_TYPE_CLICK)b=new a.AdClickEventCallback(b);else if(d===a.EVENT_TYPE_STANDARD)b=new a.AdStandardEventCallback(b);
246else if(c===a.EVENT_SLOT_IMPRESSION||c===a.EVENT_SLOT_END)b=new a.SlotImpressionEventCallback(b);else if(c===a.EVENT_AD_IMPRESSION||c===a.EVENT_AD_IMPRESSION_END)b=new a.AdImpressionEventCallback(b);else if(c===a.EVENT_VIDEO_VIEW)b=new a.VideoViewEventCallback(b);else if(c===a.EVENT_RESELLER_NO_AD)b=new a.ResellerNoAdEventCallback(b);else if(c===a.EVENT_AD_FIRST_QUARTILE||
247c===a.EVENT_AD_MIDPOINT||c===a.EVENT_AD_THIRD_QUARTILE||c===a.EVENT_AD_COMPLETE)b=new a.AdQuartileEventCallback(b);else if(c===a.EVENT_AD_PROGRESS)b=new a.AdProgressEventCallback(b);else return null;b._name=c;b._type=d;return b};a.EventCallback.getShortType=function(b){var c="";switch(b){case a.EVENT_TYPE_IMPRESSION:c=a.SHORT_EVENT_TYPE_IMPRESSION;break;case a.EVENT_TYPE_CLICK:c=a.SHORT_EVENT_TYPE_CLICK;break;case a.EVENT_TYPE_STANDARD:c=a.SHORT_EVENT_TYPE_STANDARD;break;case a.EVENT_TYPE_ERROR:c=
248a.SHORT_EVENT_TYPE_ERROR}return c};a.Util.mixin(a.EventCallback.prototype,{parse:function(a){if(a){this._usage=a.use;this._type=a.type;this._name=a.name;this._url=a.url;this._showBrowser=a.showBrowser;this._trackingUrls=[];var b=0;for(a=a.trackingUrls||[];b<a.length;b++)this._trackingUrls.push(a[b].value)}},copy:function(){var a=new this.constructor(this._context);a._type=this._type;a._name=this._name;a._url=this._url;a._showBrowser=this._showBrowser;a._trackingUrls=this._trackingUrls.slice();a._slot=
249this._slot;a._adInstance=this._adInstance;return a},getUrl:function(b){var c=this._replaceMacrosInUrl(this._url,b);this._name===a.EVENT_AD_MEASUREMENT?(c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_ET,a.SHORT_EVENT_TYPE_IMPRESSION),c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_CONCRETE_EVENT_ID,b[a.INFO_KEY_CONCRETE_EVENT_ID])):c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_ET,a.EventCallback.getShortType(this._type));c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_CN,this._name);this._adInstance&&
2500<this._adInstance._creativeRenditionId&&(c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_CREATIVE_RENDITION_ID,this._adInstance._creativeRenditionId));return c},getTrackingUrls:function(b){var c=this._trackingUrls;if(this._adInstance){var d=this._type;d===a.EVENT_TYPE_CLICK&&(d=a.EVENT_TYPE_CLICK_TRACKING);c=c.concat(this._adInstance.getExternalEventCallbackUrls(this._name,d))}d=[];for(var e=0;e<c.length;e++){var f=a.Util.trim(this._replaceMacrosInUrl(c[e],b));a.Util.isBlank(f)||d.push(f)}return d},
251process:function(b){b=b||{};this._processTrackingUrls(b);a.Util.pingURL(this.getUrl(b))},_processTrackingUrls:function(b){this._shouldSkipSendingTrackingAndExternalUrls()||a.Util.pingURLs(this.getTrackingUrls(b))},_shouldSkipSendingTrackingAndExternalUrls:function(){return!1},_needEmptyCT:function(b){var c=!1;b&&!0===b[a.INFO_KEY_NEED_EMPTY_CT]&&(c=!0);return c},_getAdPlayheadTime:function(){var a=-1;this._adInstance&&(a=this._adInstance.getPlayheadTime());return a},_getCreativeAssetLocation:function(){var a=
252null;this._adInstance&&this._adInstance.getActiveCreativeRendition()&&this._adInstance.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset()&&(a=this._adInstance.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getProxiedUrl());return a},_getParameter:function(a){return this._adInstance?this._adInstance._rendererController.getParameter(a):this._slot?this._slot.getParameter(a):this._context.getParameter(a)},_replaceVASTMacro:function(b,c,d){a.log("replace VAST Macro: url=",
253b+", macro="+c+", value="+d);b&&c&&(d=encodeURIComponent(d?d:""),b=b.replace("["+c+"]",d),b=b.replace("%5B"+c+"%5D",d));return b},_replaceMacrosInUrl:function(b,c){if(a.Util.isBlank(b))return b;c&&c[a.INFO_KEY_VAST_ERROR_CODE]&&(b=this._replaceVASTMacro(b,"ERRORCODE",c[a.INFO_KEY_VAST_ERROR_CODE]));this._getCreativeAssetLocation()&&(b=this._replaceVASTMacro(b,"ASSETURI",this._getCreativeAssetLocation()));var d=this._context._getContentPlayheadTime();if(this._adInstance){c=null!=d&&0<=Number(d)?a.Util.secondsToHms(d):
254"";b=this._replaceVASTMacro(b,"CONTENTPLAYHEAD",c);b=this._replaceVASTMacro(b,"CACHEBUSTING",a.Util.getFixedDigitRandomNumber(8));b=this._replaceVASTMacro(b,"TIMESTAMP",a.Util.getDateStringInISOFormat(new Date));b=this._replaceVASTMacro(b,"PAGEURL",a.Util.getContentURL());b=this._replaceVASTMacro(b,"OMIDPARTNER",a.OMSDK_PARTNER_NAME+"/"+this._context._adManager.getOMSDKPartnerVersion());c=[];if(this._context._overriddenAdRenderers&&null!=this._context._overriddenAdRenderers){var e=[];this._context._adResponse&&
255this._context._adResponse._adRenderers&&(e=this._context._overriddenAdRenderers.concat(this._context._adResponse._adRenderers));for(var f=0;f<e.length;f++){var k=e[f].creativeApi||"";k.includes("VPAID")?c.push(a.IAB_API_FRAMEWORKS_VPAID_2):k.includes("MRAID")&&c.push(a.IAB_API_FRAMEWORKS_MRAID_1)}}this._context.getParameter(a.PARAMETER_EXTENSION_OMSDK_ENABLED)&&c.push(a.IAB_API_FRAMEWORKS_OMID_1);c=c.sort().filter(function(a,b,c){return!b||a!=c[b-1]});b=this._replaceVASTMacro(b,"APIFRAMEWORKS",c.toString())}b=
256b.replace(/#(ce?)\{([^\}]+)\}/g,a.Util.bind(this,function(b,c,e){a.log("matchedSubString"+b);b="ce"===c;c=null;switch(e){case "ad.playheadTime":e=this._getAdPlayheadTime();c=0<=e?Math.round(e)+"":"";break;case "content.playheadTime":c=0<=d?Math.round(d)+"":"";break;case "creative.assetLocation":c=this._getCreativeAssetLocation();break;default:0===e.indexOf("parameter.")&&(c=this._getParameter(e.substr(10)))}a.Util.isBlank(c)&&(c="");return b?encodeURIComponent(c):c}));c="";try{c=a.Util.getParameterInURL(b,
257a.URL_PARAMETER_KEY_CR)}catch(g){return a.warn(g),b}a.Util.isBlank(c)||(b=a.Util.setParameterInURL(b,a.URL_PARAMETER_KEY_CR,this._replaceMacrosInUrl(c)));return b}});a.AdClickEventCallback=function(b){a.EventCallback.call(this,b)};a.AdClickEventCallback.prototype=new a.EventCallback;a.AdClickEventCallback.prototype.constructor=a.AdClickEventCallback;a.Util.mixin(a.AdClickEventCallback.prototype,{getUrl:function(b){var c=a.EventCallback.prototype.getUrl.call(this,b);b[a.INFO_KEY_URL]&&(a.Util.isParameterInURL(c,
258a.URL_PARAMETER_KEY_CR)||(c=c+"&"+a.URL_PARAMETER_KEY_CR+"="),c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_CR,b[a.INFO_KEY_URL]));return c},process:function(b){b=b||{};var c=this.getUrl(b),d=!0===this._showBrowser;d=b.hasOwnProperty(a.INFO_KEY_SHOW_BROWSER)?!0===b[a.INFO_KEY_SHOW_BROWSER]:d;b[a.INFO_KEY_URL]&&(d=!0);d&&!a.Util.isBlank(c)?(window.open(c),this._processTrackingUrls(b)):a.EventCallback.prototype.process.call(this,b)}});a.AdImpressionEventCallback=function(b){a.EventCallback.call(this,
259b)};a.AdImpressionEventCallback.prototype=new a.EventCallback;a.AdImpressionEventCallback.prototype.constructor=a.AdImpressionEventCallback;a.Util.mixin(a.AdImpressionEventCallback.prototype,{_shouldSkipSendingTrackingAndExternalUrls:function(){return this._getInitValue()!==a.INIT_VALUE_ONE},_getInitValue:function(){return this._adInstance.getSlot().isPauseSlot(
259)||!this._processed?a.INIT_VALUE_ONE:a.INIT_VALUE_TWO},_getStartTimePosition:function(){return this._adInstance.getStartTimePosition()},_getAutoPlayBlocked:function(){return this._adInstance.getSlot().getAutoPlayBlocked()},
260getUrl:function(b){var c=a.EventCallback.prototype.getUrl.call(this,b);c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_METR,this._adInstance._metr);if(this._name!==a.EVENT_AD_IMPRESSION)c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_CT,this._needEmptyCT(b)?"":this._adInstance._timer.tick());else if(-1<this._getStartTimePosition()&&(c=a.Util.setParameterInURL(c,a.URL_PARAMETER_START_TIME_POSITION,this._getStartTimePosition())),this._getAutoPlayBlocked()){b="";try{b=a.Util.getParameterInURL(c,a.URL_PARAMETER_KEY_AUTO_PLAY_BLOCKED)}catch(d){return a.warn(d),
261c}c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_AUTO_PLAY_BLOCKED,b|a.URL_PARAMETER_KEY_AUTO_PLAY_BLOCKED_VALUE)}return c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_INIT,this._getInitValue())},process:function(b){a.MODULE_TYPE_TRANSLATOR!==this._adInstance.getRendererController().getRenderer().info()[a.INFO_KEY_MODULE_TYPE]&&(a.EventCallback.prototype.process.call(this,b),this._processed=!0)}});a.AdQuartileEventCallback=function(b){a.EventCallback.call(this,b)};a.AdQuartileEventCallback.prototype=
262new a.EventCallback;a.AdQuartileEventCallback.prototype.constructor=a.AdQuartileEventCallback;a.Util.mixin(a.AdQuartileEventCallback.prototype,{_getInitValue:function(){return this._adInstance.getSlot().isPauseSlot(
262)||!this._processed?a.INIT_VALUE_ONE:a.INIT_VALUE_TWO},getUrl:function(b){var c=a.EventCallback.prototype.getUrl.call(this,b);c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_METR,this._adInstance._metr);c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_CT,this._needEmptyCT(b)?"":this._adInstance._timer.tick());
263null!=this._adInstance._context.getParameter(a.PARAMETER_ENABLE_COUNTING_REPLAY_CALLBACK)&&"true"==this._adInstance._context.getParameter(a.PARAMETER_ENABLE_COUNTING_REPLAY_CALLBACK)&&(c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_INIT,this._getInitValue()));return c},process:function(b){var c=null!=this._adInstance._context.getParameter(a.PARAMETER_ENABLE_COUNTING_REPLAY_CALLBACK)?"true"==this._adInstance._context.getParameter(a.PARAMETER_ENABLE_COUNTING_REPLAY_CALLBACK):!1;if(!this._processed||
264c)a.EventCallback.prototype.process.call(this,b),this._processed=!0}});a.AdStandardEventCallback=function(b){a.EventCallback.call(this,b)};a.AdStandardEventCallback.prototype=new a.EventCallback;a.AdStandardEventCallback.prototype.constructor=a.AdStandardEventCallback;a.AdProgressEventCallback=function(b){a.EventCallback.call(this,b)};a.AdProgressEventCallback.prototype=new a.EventCallback;a.AdProgressEventCallback.prototype.constructor=a.AdProgressEventCallback;a.Util.mixin(a.AdProgressEventCallback.prototype,
265{getTrackingUrls:function(){for(var b=[],c=0;c<this._trackingUrls.length;c++)a.Util.isBlank(this._trackingUrls[c])||b.push(this._trackingUrls[c]);return b},process:function(b){this._shouldSkipSendingTrackingAndExternalUrls()||a.Util.pingURLs(this.getTrackingUrls())}});a.ErrorEventCallback=function(b){a.EventCallback.call(this,b)};a.ErrorEventCallback.prototype=new a.EventCallback;a.ErrorEventCallback.prototype.constructor=a.ErrorEventCallback;a.Util.mixin(a.ErrorEventCallback.prototype,{getUrl:function(b){var c=
266a.EventCallback.prototype.getUrl.call(this,b),d=b[a.INFO_KEY_ERROR_CODE];d||(d=a.ERROR_UNKNOWN);var e=b[a.INFO_KEY_ERROR_INFO];e||(e="");(b=b[a.INFO_KEY_ERROR_MODULE])||(b="");c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_CN,d);return c=a.Util.setParameterInURL(c,a.URL_PARAMETER_KEY_KEY_VALUE,encodeURIComponent(a.URL_PARAMETER_KEY_ERROR_MODULE)+"="+encodeURIComponent(b)+"&"+encodeURIComponent(a.URL_PARAMETER_KEY_ERROR_INFO)+"="+a.PLATFORM_ID+"/"+encodeURIComponent(e))}});a.ResellerNoAdEventCallback=
267function(b){a.EventCallback.call(this,b)};a.ResellerNoAdEventCallback.prototype=new a.EventCallback;a.ResellerNoAdEventCallback.prototype.constructor=a.ResellerNoAdEventCallback;a.Util.mixin(a.ResellerNoAdEventCallback.prototype,{});a.SlotImpressionEventCallback=function(b){a.EventCallback.call(this,b)};a.SlotImpressionEventCallback.prototype=new a.EventCallback;a.SlotImpressionEventCallback.prototype.constructor=a.SlotImpressionEventCallback;a.Util.mixin(a.SlotImpressionEventCallback.prototype,{_shouldSkipSendingTrackingAndExternalUrls:function(){return this._getInitValue()!==
268a.INIT_VALUE_ONE}
268,_getInitValue:function(){return this._slot.isPauseSlot()||!this._processed?a.INIT_VALUE_ONE:a.INIT_VALUE_TWO},getUrl:function(b){b=a.EventCallback.prototype.getUrl.call(this,b);return b=a.Util.setParameterInURL(b,a.URL_PARAMETER_KEY_INIT,this._getInitValue())},process:function(b){a.EventCallback.prototype.process.call(this,b);this._processed=!0}});a.VideoViewEventCallback=function(b){a.EventCallback.call(this,b)};a.VideoViewEventCallback.prototype=new a.EventCallback;a.VideoViewEventCallback.prototype.constructor=
269a.VideoViewEventCallback;a.Util.mixin(a.VideoViewEventCallback.prototype,{_getInitValue:function(){return this._processed?a.INIT_VALUE_ZERO:a.INIT_VALUE_ONE},_getCTValue:function(){return this._context._videoAsset?this._context._videoAsset.getPlayheadTime():0},getUrl:function(b){b=a.EventCallback.prototype.getUrl.call(this,b);b=a.Util.setParameterInURL(b,a.URL_PARAMETER_KEY_INIT,this._getInitValue());return b=a.Util.setParameterInURL(b,a.URL_PARAMETER_KEY_CT,this._getCTValue())},_shouldSkipSendingTrackingAndExternalUrls:function(){return this._processed},
270process:function(b){a.EventCallback.prototype.process.call(this,b);this._processed=!0}});a.VideoRenderer=function(a){this._adVideo=null;this._duration=this._playheadTime=-1;this._dragging=this._stopInvoked=this._isEnded=!1;this._volume=1;this._rendererController=null;this._isBuffering=!1;this._autoPauseAdOnVisibilityChange=!0;this._hls=null;this._adVideoPauseState="";this._isSimid=void 0===a?!1:a};a.VideoRenderer.prototype={pause:function(){this._rendererController&&this._rendererController.processEvent({name:a.EVENT_AD_PAUSE});
271this._adVideo&&!this._adVideo.paused&&this._adVideo.pause();this._adVideoPauseState=this._hls&&this._adVideoPauseState===a.AD_VIDEO_PAUSED_BY_TAB_SWITCH?a.AD_VIDEO_HLS_PAUSED_BY_RENDERER_AFTER_TAB_SWITCH:a.AD_VIDEO_PAUSED_BY_RENDERER},resume:function(){this._rendererController&&this._rendererController.processEvent({name:a.EVENT_AD_RESUME});this._adVideo&&this._adVideo.paused&&this._adVideo.play();this._adVideoPauseState=a.AD_VIDEO_UNPAUSED},start:function(b){this._rendererController=b;var c=this._rendererController.getAdInstance(),
272d=c.getSlot(),e=this,f=!1,k=!1;this._autoPauseAdOnVisibilityChange=this._rendererController.getParameter(a.PARAMETER_AUTO_PAUSE_AD_ONVISIBILITYCHANGE);if(a.PLATFORM_NOT_SUPPORT_MIDROLL_AD&&d.getTimePositionClass()===a.TIME_POSITION_CLASS_MIDROLL)this._onRendererFailed(a.ERROR_DEVICE_LIMIT,"midroll");else{a.log("VideoRenderer.start",d.getTimePositionClass(),c);var g=this._rendererController.getContentVideoElement();a.debug("VideoRenderer","use content video element");g.controls=!1;this._adVideo=g;
273var m=null,h=null,l=null,p=null,t=d.getVideoDisplaySize().width,v=d.getVideoDisplaySize().height;b=c.getRenderableCreativeRenditions();var n=(t=(new a.RenditionSelector(this._rendererController.getParameter(a.PARAMETER_DESIRED_BITRATE)||1E3,this._rendererController.getParameter("arWeight")||1,this._rendererController.getParameter("pxWeight")||1,.2)).getBestFitRendition(b,t,v))?t.getPrimaryCreativeRenditionAsset():null;if(n&&b.length)if(b=n.getProxiedUrl()){c.setActiveCreativeRendition(t);a.log("VideoRenderer.start selected rendition is:",
274b);b=n.getMimeType();var r=a.Util.isMimeTypeHls(b);this._rendererController.setCapability(a.EVENT_AD_QUARTILE,a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_MUTE,a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_PAUSE,a.CAPABILITY_STATUS_ON);var L=!a.PLATFORM_NOT_SUPPORT_CLICK_FOR_VIDEO;L||this._rendererController.setCapability(a.EVENT_AD_CLICK,a.CAPABILITY_STATUS_OFF);var y=a.PLATFORM_EVENT_CLICK,M=a.MOBILE_EVENT_DRAG;this._volume=this._rendererController.getContext().getAdVolume();
275this._adVideo.volume=this._volume;this._adVideo.muted=0===this._volume;var N=function(b){a.debug("VideoRenderer.checkTimeUpdate timeout");S(b)},O=function(){h&&(clearTimeout(h),h=null)},Q=a.Util.bind(this,function(b){a.debug("onAdVideoBufferEmpty(): Ad video event "+b.type);b=this._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_PLAY_AFTER_STALLED);null!==b&&"undefined"!==typeof b&&!1!==a.Util.str2bool(b)&&(a.debug("play the ad immediately after the stalled event"),g&&g._fw_videoAdPlaying&&
276g.play())}),R=function(b){e._isBuffering||(e._isBuffering=!0,e._rendererController.processEvent({name:a.EVENT_AD_BUFFERING_START}),a.debug("onAdVideoBufferingStarted(): Ad video event "+b.type))},K=function(b){e._isBuffering&&(e._isBuffering=!1,e._rendererController.processEvent({name:a.EVENT_AD_BUFFERING_END}),a.debug("onAdVideoBufferingEnded(): Ad video event "+b.type))};b=this._rendererController.getParameter(a.PARAMETER_EXTENSION_AD_CONTROL_CLICK_ELEMENT);var E=null;b&&(E=document.getElementById(b));
277E||(E=g);var u=a.Util.bind(this,function(b){if(g.paused&&a.PLATFORM_NOT_FIRE_CLICK_WHEN_AD_VIDEO_PAUSED)g.play();else{var c=this._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_CLICK_DETECTION);null==c&&(c="true");!1!==a.Util.str2bool(c)&&(k?(a.debug("Ad video event "+b.type),this._dragging?this._dragging=!1:this._rendererController.processEvent({name:a.EVENT_AD_CLICK})):a.debug("Ad not started, ignore click."))}}),F=a.Util.bind(this,function(b){a.debug("Ad video event "+b.type);this._dragging=
278!0}),z,w=function(b){a.debug("Ad video event "+b.type+" ended: "+g.ended+" playing:"+g._fw_videoAdPlaying);if(g.ended&&.2>Math.abs(g.duration-g.currentTime)||!g._fw_videoAdPlaying)z=setTimeout(function(){a.warn("Force ad video end bc ad paused with ended = true");b.type="ended";J(b)},200);else{var c=e._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_DISPLAY_CONTROLS_WHEN_PAUSE);null==c&&(c="true");!1===a.Util.str2bool(c)?a.debug("Pause controls disabled"):g.controls=!0;O()}},x=function(b){a.debug("Ad video event "+
279b.type);g.controls=!1},B=0,I=function(b){a.debug("Ad video event "+b.type);0>=g.currentTime?a.debug("VideoRenderer.onAdVideoTimeUpdate currentTime is less than or 0"):(O(),g.paused||(b=e._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_PROGRESS_DETECT_TIMEOUT)||8E3,h=setTimeout(N,b,b+"ms timeout when playing")),k||(k=!0,e._playheadTime=g.currentTime,0>e._playheadTime&&(e._playheadTime=0),m&&(clearTimeout(m),m=null),e._quartileTimerId=setInterval(function(){var b=g.currentTime,c=g.duration;
2800<b&&(e._playheadTime=b);"number"!==typeof b||"number"!==typeof c||l||(e._rendererController&&(e._rendererController.checkProgress(b),e._rendererController.checkForSkippableStateChange()),b>=.25*c&&1>
280B&&(e._rendererController.processEvent({name:a.EVENT_AD_FIRST_QUARTILE}),B=1),b>=.5*c&&2>B&&(e._rendererController.processEvent({name:a.EVENT_AD_MIDPOINT}),B=2),b>=.75*c&&3>B&&(clearInterval(e._quartileTimerId),e._quartileTimerId=null,e._rendererController.processEvent({name:a.EVENT_AD_THIRD_QUARTILE}),
281B=3))},1E3),0<g.duration&&(e._duration=g.duration,c.adjustOffsetAndProgressWithRendererDuration(e._duration)),e._rendererController.handleStateTransition(a.RENDERER_STATE_STARTED),e._rendererController.checkForSkippableStateChange()))};this.dispose=a.Util.bind(this,function(){J()});var J=function(b){e.playAdAfterStartDelay&&(clearTimeout(e.playAdAfterStartDelay),e.playAdAfterStartDelay=null);var c=l;b&&b.type&&(a.debug("Ad video event "+b.type),"error"===b.type&&(a.warn(b.target.src),a.warn(b.target.currentSrc),
282K(b)));O();m&&(clearTimeout(m),m=null);L&&(E.removeEventListener(y,u,!1),E.removeEventListener(M,F,!1));z&&(clearTimeout(z),z=null);T&&e._autoPauseAdOnVisibilityChange&&(document.removeEventListener("visibilitychange",T,!1),T=null);g.removeEventListener("ended",J,!1);g.removeEventListener("error",J,!0);g.removeEventListener("pause",w,!1);g.removeEventListener("playing",x,!1);g.removeEventListener("timeupdate",I,!1);g.removeEventListener("stalled",Q,!1);g.removeEventListener("waiting",R,!1);g.removeEventListener("canplay",
283K,!1);g.paused||(a.debug("try pausing video before complete"),g.pause());b&&"error"===b.type&&(c="video error",(b=g.error||b.target.error)&&(c="error:"+b+",code:"+b.code));c||(e._isEnded=!0);a.log("VideoRenderer.complete");f?e._rendererController.checkProgress(g.duration):(f=!0,delete g._fw_videoAdPlaying,e._adVideo=null,e._quartileTimerId&&(clearInterval(e._quartileTimerId),e._quartileTimerId=null),c?e._onRendererFailed(p,c):(e._stopInvoked||(g.currentTime>=.25*g.duration&&1>
283B&&(e._rendererController.processEvent({name:a.EVENT_AD_FIRST_QUARTILE}),
284B=1),g.currentTime>=.5*g.duration&&2>B&&(e._rendererController.processEvent({name:a.EVENT_AD_MIDPOINT}),B=2),g.currentTime>=.75*g.duration&&3>B&&(e._rendererController.processEvent({name:a.EVENT_AD_THIRD_QUARTILE}),B=3),g.currentTime>=g.duration-.5&&4>B&&(e._rendererController.checkProgress(g.duration),e._rendererController.processEvent({name:a.EVENT_AD_COMPLETE}),B=4)),e._stopInvoked=!1,e._isSimid||e._rendererController.handleStateTransition(a.RENDERER_STATE_COMPLETED)));e._rendererController=null;
285e._hls&&e._hls.destroy()};var S=function(b){l=b;p=a.ERROR_TIMEOUT;a.warn(l);J()},T=function(b){a.log("onVisibilityChange:"+(document.hidden?"invisible":"visible"));document.hidden?e._adVideoPauseState!==a.AD_VIDEO_PAUSED_BY_RENDERER&&(g&&!g.paused&&g.pause(),e._adVideoPauseState=a.AD_VIDEO_PAUSED_BY_TAB_SWITCH,e._rendererController&&e._rendererController.processEvent({name:a.EVENT_AD_PAUSE}),m&&(clearTimeout(m),m=null)):e._adVideoPauseState===a.AD_VIDEO_PAUSED_BY_TAB_SWITCH?(e.resume(),k||!g._fw_fromVideoPool&&
286!a.PLATFORM_SUPPORT_VIDEO_START_DETECT_TIMEOUT||(b=e._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_START_DETECT_TIMEOUT)||5E3,m=setTimeout(S,b,b+"ms timeout before playing"))):e._adVideoPauseState===a.AD_VIDEO_HLS_PAUSED_BY_RENDERER_AFTER_TAB_SWITCH&&e._rendererController&&!g.paused&&(console.log("VideoRenderer _onVisibilityChange: ad already resumed, fire resume event"),e._rendererController.processEvent({name:a.EVENT_AD_RESUME}))};g._fw_videoAdPlaying=!0;var U=!1,G=function(){if(!U){U=
287!0;L&&(E.addEventListener(y,u,!1),E.addEventListener(M,F,!1));g.addEventListener("ended",J,!1);g.addEventListener("error",J,!0);g.addEventListener("pause",w,!1);g.addEventListener("playing",x,!1);g.addEventListener("timeupdate",I,!1);g.addEventListener("stalled",Q,!1);g.addEventListener("waiting",R,!1);g.addEventListener("canplay",K,!1);if(r)if("undefined"!==typeof Hls){if(Hls.isSupported()){var b=Hls.version;b=b.replace("-beta","");0<=a.Util.compareVersion(b,a.PLATFORM_HLSJS_MIN_VERSION)?(a.log("VideoRenderer loading hls rendition using hls.js version",
288b),e._hls=new window.Hls,e._hls.on(Hls.Events.ERROR,function(b,c){if(c.fatal)switch(c.type){case Hls.ErrorTypes.NETWORK_ERROR:a.debug("VideoRenderer has encountered fatal hls network error and attempting to recover");e._hls.startLoad();break;case Hls.ErrorTypes.MEDIA_ERROR:a.debug("VideoRenderer has encountered fatal hls media error and attempting to recover");e._hls.recoverMediaError();break;default:e._hls.destroy(),a.debug("VideoRenderer has encountered unrecoverable fatal hls error. Details: "+
289c.details),e._onRendererFailed(a.ERROR_HLSJS,c.details)}else a.debug("VideoRenderer has encountered non-fatal hls network error. Automatic recovery attempt by hls.js.")}),e._hls.attachMedia(g),e._hls.on(Hls.Events.MEDIA_ATTACHED,function(){e._hls.loadSource(n.getProxiedUrl());e._hls.on(Hls.Events.MANIFEST_PARSED,function(b,c){a.debug("VideoRenderer hls manifest successfully parsed, found "+c.levels.length+" quality level")})})):0>a.Util.compareVersion(b,a.PLATFORM_HLSJS_MIN_VERSION)?a.warn("Found hls.js ver
289sion is too old and incompatible. Please upgrade to v0.11.0 or higher. Current version:",
290b):a.warn("Unable to find successful hls support.")}}else g.src=n.getProxiedUrl(),a.debug("VideoRenderer loading hls rendition on Safari "+g.src),g.load();else g.src=n.getProxiedUrl(),a.debug("VideoRenderer loading video ad "+g.src),g.load();if(g._fw_fromVideoPool||a.PLATFORM_SUPPORT_VIDEO_START_DETECT_TIMEOUT)b=e._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_START_DETECT_TIMEOUT)||5E3,m=setTimeout(S,b,b+"ms timeout before playing");a.PLATFORM_VIDEO_DOESNOT_SUPPORT_TIMEUPDATE&&e._rendererController.handleStateTransition(a.RENDERER_STATE_STARTED);
291b=100;0<a.PLATFORM_ANDROID_VERSION&&(b=e._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_ANDROID_DELAY)||100);e.playAdAfterStartDelay=setTimeout(function(){e.playAdAfterStartDelay=null;var b=g.play();b&&a.PLATFORM_BLOCKS_AUTOPLAY&&b.catch(function(b){if(b&&"AbortError"===b.name||"NotAllowedError"===b.name)a.warn("Blocked by browser, need player to display a start button. Details: %o",b),m&&(clearTimeout(m),m=null),d.setAutoPlayBlocked(!0),e._rendererController.processEvent({name:a.EVENT_AD_AUTO_PLAY_BLOCKED,
292info:{apiOnly:!0}})});document.hidden&&g&&e._autoPauseAdOnVisibilityChange&&(a.log("VideoRenderer pause ad when tab is invisible."),g&&!g.paused&&(g.pause(),e._adVideoPauseState=a.AD_VIDEO_PAUSED_BY_TAB_SWITCH,e._rendererController&&e._rendererController.processEvent({name:a.EVENT_AD_PAUSE})),m&&(clearTimeout(m),m=null));e._autoPauseAdOnVisibilityChange&&document.addEventListener("visibilitychange",T,!1)},b)}};a.VideoRenderer._fw_playedDummyVideo||d.getTimePositionClass()!==a.TIME_POSITION_CLASS_PREROLL||
293!a.PLATFORM_PLAY_DUMMY_VIDEO_FOR_PREROLL||/\.webm$/.test(n.getProxiedUrl())?G():(a.VideoRenderer._fw_playedDummyVideo=!0,a.debug("play dummy video for iOS 3.2-4.1"),g.src="http://127.0.0.1:1/404.mp4",g.load(),g.play(),g._fw_videoAdPlaying=!0,g.addEventListener("error",function(){event.target.removeEventListener("error",g,!0);G()},!0),setTimeout(G,5E3))}else this._onRendererFailed(a.ERROR_NULL_ASSET);else this._onRendererFailed(a.ERROR_DEVICE_LIMIT,"no compatible asset")}},stop:function(){a.debug("VideoRenderer stop");
294this._stopInvoked=!0;this._adVideo&&(this._adVideo._fw_videoAdPlaying=!1,this._adVideo.pause(),this.dispose());this._rendererController=null},info:function(){return{moduleType:a.MODULE_TYPE_RENDERER}},getPlayheadTime:function(){if(this._isEnded&&0<this._duration)return this._duration;if(this._adVideo){var a=this._adVideo.currentTime;if(0<a)return a}return this._playheadTime},getDuration:function(){return this._duration},setVolume:function(b){a.debug("VideoRenderer setVolume("+b+")");this._adVideo?
295(this._adVideo.volume=b,this._adVideo.muted=0===b,a.Util.fireVolumeEvents(this._volume,b,this._rendererController),this._volume=b):a.debug("VideoRenderer ad video is null, ignore.")},_onRendererFailed:function(b,c,d){var e={};e[a.INFO_KEY_ERROR_MODULE]="VideoRenderer";e[a.INFO_KEY_ERROR_CODE]=b;d||(d=a.ERROR_VAST_GENERAL_LINEAR_ERROR);e[a.INFO_KEY_VAST_ERROR_CODE]=d;c&&(e[a.INFO_KEY_ERROR_INFO]=c);this._rendererController.handleStateTransition(a.RENDERER_STATE_FAILED,e)}};a.VideoRenderer.prototype.constructor=
296a.VideoRenderer;a.AdRequest=function(b){this._context=b;this._capabilities=new a.Capabilities;this._keyValues=[];this._playerProfile="";this._compatibleDimensions=null;this._temporalSlots=[];this._siteSectionId=this._siteSectionCustomId="";this._siteSectionNetworkId=0;this._siteSectionFallbackId="";this._siteSectionViewRandom=0;this._requestMode=this._visitorIpV4Address=this._visitorCustomId="";this._subsessionToken=this._requestDuration=0;this._candidateAdIds=[];this._slotScanner=new a.PageSlotScanner(b);
297this._urlParams={};this._urlKeyValues=[];this._customInfo=""};a.AdRequest.prototype={setCapability:function(a,c){this._capabilities.setCapability(a,c)},addKeyValue:function(b,c){"string"!==typeof b||"string"!==typeof c||0===b.length?a.warn("AdRequest.addKeyValue:","key and value required"):(b=encodeURIComponent(b)+"="+encodeURIComponent(c),0>this._keyValues.indexOf(b)&&this._keyValues.push(b))},removeKey:function(b){if("string"!==typeof b||0===b.length)a.warn("AdRequest.removeKey:","key required");
298else{b=encodeURIComponent(b);for(var c=this._keyValues,d=c.length-1;0<=d;--d)c[d].split("=")[0]===b&&this._keyValues.splice(d,1)}},setProfile:function(b){"string"!==typeof b?a.warn("AdRequest.setProfile:","player profile required"):this._playerProfile=b},setVideoDisplayCompatibleSizes:function(b){if(b&&b.length){for(var c=[],d={},e=0;e<b.length;++e)if(a.debug("dimension is:",b[e].width,"X",b[e].height),0<b[e].width&&0<b[e].height){var f=b[e].width+","+b[e].height;null==d[f]&&(d[f]="",c.push(f))}0<
299c.length&&(this._compatibleDimensions=c.join("|"))}else a.warn("AdRequest.setVideoDisplayCompatibleSizes:","compatible dimensions required")},setSiteSection:function(b,c,d,e,f){if(b){switch(e){case a.ID_TYPE_FW:this._siteSectionId=b;break;case a.ID_TYPE_GROUP:this._siteSectionId="g"+b;break;default:this._siteSectionCustomId=b}0<1*c&&(this._siteSectionNetworkId=1*c);0<1*d&&(this._siteSectionViewRandom=1*d);"number"===typeof f&&0<f?this._siteSectionFallbackId=""+f:"string"===typeof f&&(this._siteSectionFallbackId=
300f.trim())}else a.warn("AdRequest.setSiteSection: id required")},setVisitor:function(b,c){"string"!==typeof b?a.warn("AdRequest.setVisitor:","customId required"):(this._visitorCustomId=b,"string"===typeof c&&""!==c&&(this._visitorIpV4Address=c))},setRequestMode:function(b){b!==a.REQUEST_MODE_ON_DEMAND&&b!==a.REQUEST_MODE_LIVE?a.warn("AdRequest.setRequestMode:","unknown mode: "+b):(this._requestMode=b,this._requestMode===a.REQUEST_MODE_LIVE&&0===this._subsessionToken&&this.setSubsessionToken(1E4*Math.random()+
3011))},setRequestDuration:function(b){"number"!==typeof b?a.warn("AdRequest.setRequestDuration:","request duration required"):(0>b&&(a.warn("AdRequest.setRequestDuration:","requestDuration is negative, reset it to 0"),b=0),this._requestDuration=b)},addCandidateAd:function(b){"number"!==typeof b?a.warn("AdRequest.addCandidateAd:","candidate ad ID required"):0>
301b?a.warn("AdRequest.addCandidateAd","invalid ad ID, ignore"):this._candidateAdIds.push(b)},addTemporalSlot:function(b,c,d,e,f,k,g,m,h,l){if(a.Util.isBlank(b)||
302a.Util.isBlank(c)||0>d)a.warn("AdRequest.addTemporalSlot:","invalid parameters");else{for(var A=0;A<this._temporalSlots.length;A++)if(this._temporalSlots[A].getCustomId()===b){a.warn("AdRequest.addTemporalSlot:","slot with custom Id: "+b+" is already added, ignoring the duplicate addition");return}A=new a.Slot(this._context);A.setCustomId(b);A.setAdUnit(c);A.setTimePosition(d);A.setSlotProfile(e);A.setCuepointSequence(1*f);A.setMaxDuration(k);A.setMinDuration(g);A.setAcceptContentType(m);A.setSignalId(h);
303A.setMaxAds(l);this._temporalSlots.push(A)}},setSubsessionToken:function(a){this._subsessionToken=a},scanPageSlots:function(){this._slotScanner.scanPageSlots()},generateTypeBRequestUrl:function(){var b=this._context._adManager._serverURL.split("?"),c=b[0],d=[/fwmrm\.net$/,/fwmrm\.net\/$/,/fwmrm\.net\/ad$/,/fwmrm\.net\/ad\/$/,/fwmrm\.net\/ad\/g$/,/fwmrm\.net\/ad\/g\/$/,/fwmrm\.net\/ad\/g\/1$/];if(0===c.indexOf("http://")||0===c.indexOf("https://"))for(var e=0;e<d.length;++e)if(c.match(d[e])){c=c.slice(0,
304c.indexOf("fwmrm.net")+9)+"/ad/g/1";break}this.parseQueryStr(b.slice(1).join("?"));b=this.generateGlobalParametersQueryStr()+";"+this.generateKeyValuesStr()+";";this._capabilities.getCapability(a.CAPABILITY_SKIP_AD_SELECTION)&&1===this._capabilities.getCapability(a.CAPABILITY_SKIP_AD_SELECTION)||(b+=this.generateSlotsTypeBStr());a.Util.isBlank(this._customInfo)||(b+=";"+this._customInfo);return c+"?"+b},generateVideoViewRequestUrlWithDummyContextInstanceId:function(b){this._context.setCapability(a.CAPABILITY_REQUIRE_VIDEO_CALLBACK,
305a.CAPABILITY_STATUS_ON);this._context.setCapability(a.CAPABILITY_SKIP_AD_SELECTION,a.CAPABILITY_STATUS_ON);var c=this.generateTypeBRequestUrl();c=a.Util.setParameterInURL(c,"cbfn","tv.freewheel.SDK._instanceQueue['Context_"+b+"']._videoAsset.requestComplete");a.debug("generateVideoViewRequestUrlWithDummyContextInstanceId():"+c);this._context.setCapability(a.CAPABILITY_REQUIRE_VIDEO_CALLBACK,a.CAPABILITY_STATUS_UNSET);this._context.setCapability(a.CAPABILITY_SKIP_AD_SELECTION,a.CAPABILITY_STATUS_UNSET);
306return c},parseQueryStr:function(b){var c=b;a.debug("AdRequest.parseQueryStr("+Array.prototype.slice.call(arguments).join(",")+")");this._urlParams={};this._urlKeyValues=[];this._customInfo="";if(c){";"===c.charAt(c.length-1)&&(c=c.substring(0,c.length-1));c=c.split(";");var d;if(c[0]){var e=c[0].split("&");for(d=0;d<e.length;++d){var f=e[d].split("=");2===f.length&&(this._urlParams[f[0]]=f[1])}}if(c[1])for(e=c[1].split("&"),d=0;d<e.length;++d)this._urlKeyValues.push(e[d]);c[2]&&(this._customInfo=
307c.slice(2).join(";"))}},generateGlobalParametersQueryStr:function(){a.debug("AdRequest.generateGlobalParametersQueryStr");var b=this._context.getParameter("wrapperVersion");b=[["prof",this._playerProfile,"string"],["nw",this._context._adManager._networkId,"number"],["caid",this._context._videoAsset._customId,"string"],["asid",this._context._videoAsset._id,"string"],["vdur",this._context._videoAsset._duration,"number"],["asnw",this._context._videoAsset._networkId,"number"],["asml",this._context._videoAsset._location,
308"string"],["vprn",this._context._videoAsset._viewRandom,"number"],["afid",this._context._videoAsset._fallbackId,"string"],["vdty",this._context._videoAsset._durationType,"string"],["vtpo",this._context._videoAsset._currentTpos,"number"],["csid",this._siteSectionCustomId,"string"],["ssid",this._siteSectionId,"string"],["ssnw",this._siteSectionNetworkId,"number"],["pvrn",this._siteSectionViewRandom,"number"],["sfid",this._siteSectionFallbackId,"string"],["vcid",this._visitorCustomId,"string"],["mode",
309this._requestMode,"string"],["vrdu",this._requestDuration,"number"],["ssto",this._subsessionToken,"number"],["cd",this._compatibleDimensions||this.detectScreenDimension(),"string"],["vclr",a.version+(b?","+b:""),"string"],["resp",a.PLATFORM_SEND_REQUEST_BY_FORM?"json2":"json","string"],["orig",window.location.protocol+"//"+window.location.host,"string"],["cbfn","tv.freewheel.SDK._instanceQueue['Context_"+this._context._instanceId+"'].requestComplete","string"],["vip",this._visitorIpV4Address,"string"],
310["cana",this._candidateAdIds.join(","),"string"],["aist",this._context._airingStartTime,"number"],["bksq",this._context._breakSequence,"number"]];for(var c=0;c<b.length;c++){var d=b[c];
310switch(d[2]){case "string":a.Util.isBlank(d[1])||(this._urlParams[d[0]]=encodeURIComponent(d[1]));break;case "number":0<d[1]&&(this._urlParams[d[0]]=d[1])}}b="";for(var e in this._urlParams)this._urlParams.hasOwnProperty(e)&&(b+=e+"="+this._urlParams[e]+"&");b=b.substring(0,b.length-1);0<this._slotScanner._candidateAds.length&&
311(null==this._capabilities._capabilities[a.CAPABILITY_CHECK_COMPANION]&&this._capabilities.setCapability(a.CAPABILITY_CHECK_COMPANION,a.CAPABILITY_STATUS_ON),null==this._capabilities._capabilities[a.CAPABILITY_CHECK_TARGETING]&&this._capabilities.setCapability(a.CAPABILITY_CHECK_TARGETING,a.CAPABILITY_STATUS_OFF));this._context._videoAsset._eventCallback||this._context._videoAsset._requestedVideoViewUrl||!this._context._videoAsset._id&&!this._context._videoAsset._customId||this._context.setCapability(a.CAPABILITY_REQUIRE_VIDEO_CALLBACK,
312a.CAPABILITY_STATUS_ON);this._capabilities._capabilities[a.CAPABILITY_DISPLAY_REFRESH]&&this._context.setCapability(a.CAPABILITY_REQUIRE_VIDEO_CALLBACK,a.CAPABILITY_STATUS_OFF);b=this._capabilities.parseCapabilities(b);this._context.setCapability(a.CAPABILITY_REQUIRE_VIDEO_CALLBACK,a.CAPABILITY_STATUS_UNSET);switch(this._context._videoAsset._autoPlayType){case a.VIDEO_ASSET_AUTO_PLAY_TYPE_CLICK_TO_PLAY:e="+cltp";break;case a.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED:e="+play+uapl";break;case a.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE:e=
313"-play";break;default:e="+play-uapl"}return b=b.replace(/flag=/,"flag="+encodeURIComponent(e))},generateKeyValuesStr:function(){a.debug("AdRequest.generateKeyValuesStr");this.addBrowserParams();this.addOmidValues();for(var b=this._keyValues.concat(["_fw_dpr="+(void 0===window.devicePixelRatio?"1":window.devicePixelRatio.toFixed(2).toString())]),c=0;c<this._urlKeyValues.length;c++){var d=this._urlKeyValues[c];0>b.indexOf(d)&&b.push(d)}(c=this._context._adManager._location)&&b.push("ltlg="+encodeURIComponent(Math.round(1E4*
314c.coords.latitude)/1E4+","+Math.round(1E4*c.coords.longitude)/1E4));return b.join("&")},generateSlotsTypeBStr:function(){a.debug("AdRequest.generateSlotsTypeBStr");for(var b="",c=[],d=0;d<this._temporalSlots.length;d++){var e=this._temporalSlots[d];e=[["slid",e.getCustomId(),"string"],["slau",e.getAdUnit(),"string"],["ptgt","a","string"],["tpos",e.getTimePosition(),"number"],["cpsq",e.getCuepointSequence(),"number"],["envp",e.getSlotProfile(),"string"],["maxd",e.getMaxDuration(),"number"],["mind",
315e.getMinDuration(),"number"],["prct",e.getAcceptContentType(),"string"],["sgid",e.getSignalId(),"string"],["maxa",e.getMaxAds(),"number"]];for(var f=[],k=0;k<e.length;k++){var g=e[k];switch(g[2]){case "string":a.Util.isBlank(g[1])||f.push(g[0]+"="+encodeURIComponent(g[1]));break;case "number":-1<["cpsq","maxd","mind","maxa"].indexOf(g[0])?0<g[1]&&f.push(g[0]+"="+g[1]):0<=g[1]&&f.push(g[0]+"="+g[1])}}c.push(f.join("&"))}0<c.length&&(b=c.join(";")+";");return b+=this._slotScanner.slotsToTypeBStr()},
316detectScreenDimension:function(){a.debug("AdRequest.detectScreenDimension:",screen.width+","+screen.height);return screen.width+","+screen.height},useTCFAPI:function(b){var c=b.string;b=b.consentParam;a.debug("AdRequest.useTCFAPI");this.removeKey("_fw_gdpr");this.removeKey("_fw_gdpr_consent");this.addKeyValue("_fw_gdpr",c);this.addKeyValue("_fw_gdpr_consent",b)},useUSPAPI:function(b){""!=b&&(a.debug("AdRequest.useUSPAPI"),this.removeKey("_fw_us_privacy"),this.addKeyValue("_fw_us_privacy",b))},useGPP:function(b){var c=
317b.gppString;b=b.sectionId;a.debug("AdRequest.useGPP");this.removeKey("gpp");this.removeKey("gpp_sid");this.addKeyValue("gpp",c);this.addKeyValue("gpp_sid",b)},addBrowserParams:function(){this.addKeyValue("_fw_br_lg",(navigator.languages?navigator.languages.length:0).toString());this.addKeyValue("_fw_br_prm",this._context._adManager._permissionsCheck.toString());this.addKeyValue("_fw_br_wd",this._checkPresence(navigator.webdriver));this.addKeyValue("_fw_br_ch",this._checkPresence(window.chrome));this.addKeyValue("_fw_br_nt",
318this._checkPresence(window.netscape));this.addKeyValue("_fw_br_sf",this._checkSafari())},addOmidValues:function(){this.removeKey("_fw_omidpn");this.removeKey("_fw_omidpv");this.addKeyValue("_fw_omidpn",a.OMSDK_PARTNER_NAME);this.addKeyValue("_fw_omidpv",this._context._adManager.getOMSDKPartnerVersion())},_checkPresence:function(a){return(a?1:0).toString()},_checkSafari:function(){return a.PLATFORM_IS_SAFARI?"1":"0"}};a.AdInstance=function(b){this._context=b;this._creativeRenditionId=this._creativeId=
319this._soAdUnit=this._adId=this._slot=null;this._universalAdIdRegistry=this._universalAdId=this._action=this._marketUnifiedAdId=this._openExchangeId=this._dealId=this._replicaId="";this._primaryCreativeRendition=this._creative=null;this._creativeRenditions=[];this._noLoad=!1;this._companionAdInstances=[];this._eventCallbacks=[];this._externalEventCallbackUrlsDictionary={};this._rendererController=new a.RendererController(b,this);this._timer=new a.Timer;this._metr=0;this._state=a.MediaInitState.instance;
320this._isStartSuccessfully=this._translated=this._isImpressionSent=this._isInitiatedSent=!1;this._lastDurationFromRenderer=-1;this._slotCustomId=this._parentAdInstancesGroup=null;this._isSkipped=!1;this._wrapperCount=0;this._startTimePosition=-1;this._adVerifications=[];this._skipOffset=-1;this._progressEventCallbackUrlsDict={};this._progressPercentageEventCallbackUrlsDict={};this._skipOffsetPercentage=-1};a.AdInstance.prototype={};a.AdInstance.prototype.constructor=a.AdInstance;a.METR_MASK_QUARTILE=
3210;a.METR_MASK_MIDPOINT=1;a.METR_MASK_COMPLETE=2;a.METR_MASK_VOLUME=3;a.METR_MASK_SIZE=4;a.METR_MASK_CONTROL=5;a.METR_MASK_REWIND=6;a.METR_MASK_ACCEPT_INVITATION=7;a.METR_MASK_CLOSE=8;a.METR_MASK_MINIMIZE=9;a.METR_MASK_CLICK=10;a.AdInstance._metrDictionary={};a.AdInstance._metrDictionary[a.EVENT_AD_FIRST_QUARTILE]=a.AdInstance._metrDictionary[a.EVENT_AD_THIRD_QUARTILE]=a.AdInstance._metrDictionary[a.EVENT_AD_QUARTILE]=1<<a.METR_MASK_QUARTILE|1<<a.METR_MASK_MIDPOINT|1<<a.METR_MASK_COMPLETE;a.AdInstance._metrDictionary[a.EVENT_AD_MIDPOINT]=
3221<<a.METR_MASK_MIDPOINT|1<<a.METR_MASK_COMPLETE;a.AdInstance._metrDictionary[a.EVENT_AD_COMPLETE]=1<<a.METR_MASK_COMPLETE;a.AdInstance._metrDictionary[a.EVENT_AD_MUTE]=1<<a.METR_MASK_VOLUME;a.AdInstance._metrDictionary[a.EVENT_AD_UNMUTE]=1<<a.METR_MASK_VOLUME;a.AdInstance._metrDictionary[a.EVENT_AD_COLLAPSE]=1<<a.METR_MASK_SIZE;a.AdInstance._metrDictionary[a.EVENT_AD_EXPAND]=1<<a.METR_MASK_SIZE;a.AdInstance._metrDictionary[a.EVENT_AD_PAUSE]=1<<a.METR_MASK_CONTROL;a.AdInstance._metrDictionary[a.EVENT_AD_RESUME]=
3231<<a.METR_MASK_CONTROL;a.AdInstance._metrDictionary[a.EVENT_AD_REWIND]=1<<a.METR_MASK_REWIND;a.AdInstance._metrDictionary[a.EVENT_AD_ACCEPT_INVITATION]=1<<a.METR_MASK_ACCEPT_INVITATION;a.AdInstance._metrDictionary[a.EVENT_AD_CLOSE]=1<<a.METR_MASK_CLOSE;a.AdInstance._metrDictionary[a.EVENT_AD_MINIMIZE]=1<<a.METR_MASK_MINIMIZE;a.AdInstance._metrDictionary[a.EVENT_AD_CLICK]=1<<a.METR_MASK_CLICK;a.Util.mixin(a.AdInstance.prototype,{getAdId:function(){return this._adId},getUniversalAdId:function(){if(""!=
324this._universalAdId)return{idRegistry:this._universalAdIdRegistry,idValue:this._universalAdId};var a=this.getActiveCreativeRendition();return a?a.getUniversalAdId():null},getSoAdUnit:function(){return this._soAdUnit},getParameter:function(a){var b=[];this._context.getParameter(a)&&b.push(this._context.getParameter(a));this._primaryCreativeRendition.getParameter(a)&&b.push(this._primaryCreativeRendition.getParameter(a));this._creative.getParameter(a)&&b.push(this._creative.getParameter(a));this._slot.getParameter(a)&&
325b.push(this._slot.getParameter(a));return b},addProgressEventCallbackUrls:function(a,c){this._progressEventCallbackUrlsDict.hasOwnProperty(a)?(c=this._progressEventCallbackUrlsDict[a].concat(c),this._progressEventCallbackUrlsDict[a]=c):this._progressEventCallbackUrlsDict[a]=c||[]},addPercentageProgressEventCallbackUrls:function(a,c){this._progressPercentageEventCallbackUrlsDict.hasOwnProperty(a)?(c=this._progressPercentageEventCallbackUrlsDict[a].concat(c),this._progressPercentageEventCallbackUrlsDict[a]=
326c):this._progressPercentageEventCallbackUrlsDict[a]=c||[]},adjustOffsetAndProgressWithRendererDuration:function(b){-1!==this._skipOffsetPercentage&&(this._skipOffset=a.Util.offsetStringToSecond(this._skipOffsetPercentage+"%",b));if(0!==Object.keys(this._progressPercentageEventCallbackUrlsDict).length){this._progressEventCallbackUrlsDict={};for(var c in this._progressPercentageEventCallbackUrlsDict){var d=a.Util.offsetStringToSecond(c+"%",b);this._progressEventCallbackUrlsDict[d]=this._progressEventCallbackUrlsDict[d]?
327this._progressEventCallbackUrlsDict[d].concat(this._progressPercentageEventCallbackUrlsDict[c]):[].concat($jscomp.arrayFromIterable(this._progressPercentageEventCallbackUrlsDict[c]))}}},getAdSkippableState:function(){return"VPAID"===this.getActiveCreativeRendition().getCreativeApi()?this._rendererController.getRenderer().getAdSkippableState():-1===this.getSkipOffset()?!1:this.getPlayheadTime()>=this.getSkipOffset()},getEventCallbackUrls:function(b,c){var d=[],e=c===a.EVENT_TYPE_CLICK,f=c===a.EVENT_TYPE_CLICK_TRACKING;
328b=a.EventCallback.getEventCallback(this._eventCallbacks,b,f?a.EVENT_TYPE_CLICK:c);if(!b)return d;c={};c[a.INFO_KEY_NEED_EMPTY_CT]=!0;e?b._showBrowser&&d.push(b.getUrl(c)):f?b._showBrowser||d.push(b.getUrl(c)):d.push(b.getUrl(c));e||(d=d.concat(b.getTrackingUrls()));return d},addEventCallbackUrls:function(a,c,d){d&&this._isValidEventNameAndType(a,c)&&(this._externalEventCallbackUrlsDictionary[c+"-"+a]=this.getExternalEventCallbackUrls(a,c).concat(d))},setClickThroughUrl:function(b,c){c&&this._isValidEventNameAndType(b,
329a.EVENT_TYPE_CLICK)&&(b=this.getEventCallback(b,a.EVENT_TYPE_CLICK))&&(a.Util.isParameterInURL(b._url,a.URL_PARAMETER_KEY_CR)||(b._url=b._url+"&"+a.URL_PARAMETER_KEY_CR+"="),b._url=a.Util.setParameterInURL(b._url,a.URL_PARAMETER_KEY_CR,c),b._showBrowser=!0)},addAdVerificationsFromVast:function(a){for(var b=0;b<a.length;b++)this._adVerifications.push(a[b])},addCreativeRendition:function(){var b=new a.CreativeRendition;b.parse({creativeRenditionId:this._creativeRenditionId,adReplicaId:this._replicaId,
330preference:0});b.setBaseUnit(this._creative.getBaseUnit());b.setDuration(this._creative.getDuration());this._creativeRenditions.push(b);this.isPlaceholder()&&(this._noLoad=!1);return b},getRendererController:function(){return this._rendererController},getSlot:function(){this._slot||(this._slot=this._context._adResponse.getSlotByCustomId(this._slotCustomId));return this._slot},getCompanionSlots:function(){for(var a=[],c=0;c<this._companionAdInstances.length;c++)a.push(this._companionAdInstances[c]._slot);
331return a},getActiveCreativeRendition:function(){return this._primaryCreativeRendition},setActiveCreativeRendition:function(b){b?(-1===this._creativeRenditions.indexOf(b)&&this._creativeRenditions.push(b),this._primaryCreativeRendition=b,this._creativeRenditionId=b.getId()):a.warn("AdInstance.setActiveCreativeRendition","rendition is null")},getAllCreativeRenditions:function(){var a=this._creativeRenditions.slice();a.sort(function(a,b){return b.getPreference()-a.getPreference()});var c=a.indexOf(this._primaryCreativeRendition);
332-1<c&&(a.splice(c,1),a.unshift(this._primaryCreativeRendition));return a},getRenderableCreativeRenditions:function(){var a=this._creativeRenditions.slice().sort(function(a,b){return b.getPreference()-a.getPreference()}).filter(function(a){return this._rendererController.rendererMatch(a)},this),c=a.indexOf(this._primaryCreativeRendition);-1<c&&(a.splice(c,1),a.unshift(this._primaryCreativeRendition));return a},getPlayheadTime:function(){var b=-1;if(this._rendererController.getRenderer()&&"function"===
333typeof this._rendererController.getRenderer().getPlayheadTime)try{b=this._rendererController.getRenderer().getPlayheadTime()}catch(c){a.warn("AdInstance.getPlayheadTime "+c.name+": "+c.message)}return b},getDuration:function(){var a=-1;this._rendererController.getRenderer()&&"function"===typeof this._rendererController.getRenderer().getDuration&&(this._lastDurationFromRenderer=a=this._rendererController.getRenderer().getDuration());-1===a&&(a=-1<this._lastDurationFromRenderer?this._lastDurationFromRenderer:
334this.getActiveCreativeRendition().getDuration());return a},parse:function(b){if(b){this._adId=b.adId||null;this._creativeId=b.creativeId||null;this._creativeRenditionId=b.creativeRenditionId||null;this._replicaId=b.hasOwnProperty("replicaId")?b.replicaId:"";this._dealId=b.hasOwnProperty("dealId")?b.dealId:"";this._openExchangeId=b.hasOwnProperty("openExchangeId")?b.openExchangeId:"";this._marketUnifiedAdId=b.hasOwnProperty("marketUnifiedAdId")?b.marketUnifiedAdId:"";this._action=b.hasOwnProperty("action")?
335b.action:"";this._universalAdId=b.hasOwnProperty("universalAdId")?b.universalAdId:"";this._universalAdIdRegistry=b.hasOwnProperty("universalAdIdRegistry")?b.universalAdIdRegistry:"";this._noLoad=this._context._adResponse.getAd(this._adId).getNoLoad();this._soAdUnit=this._context._adResponse.getAd(this._adId).getSoAdUnit();this._creative=this._context._adResponse.getCreative(this._adId,this._creativeId);this._creativeRenditions=this._creative.getEligibleCreativeRenditionsForAdInstance(this);var c,
336d;var e=0;for(c=b.eventCallbacks||[];e<c.length;e++){var f=c[e];if(d=a.EventCallback.newEventCallback(this._context,f.name,f.type))d._adInstance=this,d.parse(f),this._eventCallbacks.push(d)}e=0;for(c=b.companionAds||[];e<c.length;++e)(f=c[e])&&f.adSlotCustomId&&(d=new a.AdInstance(this._context),d._slotCustomId=f.adSlotCustomId,d.parse(f),this._companionAdInstances.push(d));e=0;for(c=b.fallbackAds||[];e<c.length;++e)f=c[e],d=new a.AdInstance(this._context),this._parentAdInstancesGroup.push(d),d._slot=
337this._slot,d._parentAdInstancesGroup=this._parentAdInstancesGroup,d.parse(f);e=0;for(c=b.extensions||[];e<c.length;++e)if((f=c[e])&&"adVerifications"==f.type)for(b=0,f=f.adVerifications||[];b<f.length;++b)d=new a.AdVerification,d.parseFromJSON(f[b]),this._adVerifications.push(d);0<this._creativeRenditions.length&&(this._primaryCreativeRendition=this._creativeRenditions[0])}},play:function(){a.log("AdInstance.play "+this._slotCustomId);this._timer.tick();this.processEvent(a.EVENT_AD_IMPRESSION,a.EVENT_TYPE_IMPRESSION);
338this._isStartSuccessfully||(a.MODULE_TYPE_RENDERER===this._rendererController.getRenderer().info()[a.INFO_KEY_MODULE_TYPE]&&this._context.dispatchEvent(a.EVENT_AD_IMPRESSION,{adInstance:this,slotCustomId:this._slotCustomId}),this._isStartSuccessfully=!0);this._state.play(this);if(this._rendererController.getRenderer().info()[a.INFO_KEY_MODULE_TYPE]===a.MODULE_TYPE_RENDERER)for(var b=0;b<this._companionAdInstances.length;b++)this._companionAdInstances[b].isPlaceholder()||this._companionAdInstances[b].getSlot().playCompanionAds(this._companionAdInstances[b])},
339pause:function(){a.log("AdInstance.pause "+this._slotCustomId);this._isStartSuccessfully?this._rendererController&&this._rendererController.pause():a.log("Ad hasn't started yet. Ignore.")},resume:function(){a.log("AdInstance.resume"+this._slotCustomId);this._isStartSuccessfully?this._rendererController&&this._rendererController.resume():a.log("Ad hasn't started yet. Ignore.")},skip:function(){a.log("AdInstance.skip");"VPAID"!==this.getActiveCreativeRendition().getCreativeApi()?(this._processSkipEvent(),
340this.stop()):this._rendererController.getRenderer().attemptSkip()},_processSkipEvent:function(){this._isSkipped=!0;this.processEvent(a.EVENT_AD_SKIPPED,a.EVENT_TYPE_STANDARD)},stop:function(){a.log("AdInstance.stop");this._rendererController.stop()},fakeComplete:function(){this._slot.getTimePositionClass()===a.TIME_POSITION_CLASS_DISPLAY&&(this._isStartSuccessfully=!1,this._slot.playNextAdInstance())},complete:function(){this._isStartSuccessfully&&(this.processEvent(a.EVENT_AD_IMPRESSION_END,a.EVENT_TYPE_IMPRESSION),
341a.MODULE_TYPE_RENDERER===this._rendererController.getRenderer().info()[a.INFO_KEY_MODULE_TYPE]&&this._context.dispatchEvent(a.EVENT_AD_IMPRESSION_END,{adInstance:this}));this._state.complete(this);this._rendererController._restorePlaceholdersForHybrid();this._rendererController.setRenderer(null);this._isStartSuccessfully=!1;this._slot.playNextAdInstance()},isStarted:function(){return this._isStartSuccessfully},onStartPlaying:function(){a.MODULE_TYPE_RENDERER===this._rendererController.get
341Renderer().info()[a.INFO_KEY_MODULE_TYPE]?
342this._isImpressionSent=!0:this._translated=!0},onCompletePlaying:function(){},onStartReplaying:function(){},onCompleteReplaying:function(){},getEventCallback:function(b,c){return a.EventCallback.getEventCallback(this._eventCallbacks,b,c)},processEvent:function(b,c,d,e){var f=!0;c=this.getEventCallback(b,c);b===a.EVENT_AD_IMPRESSION&&this._isStartSuccessfully&&(c=this.getEventCallback(a.EVENT_ERROR,a.EVENT_TYPE_ERROR),d={errorInfo:"Trying to send defaultImpression multiple times"},f=!1);c?e||c.process(d):
343f=!1;b===a.EVENT_AD_CLICK&&this._context.dispatchEvent(a.EVENT_AD_CLICK,{adInstance:this});if(b!==a.EVENT_AD_IMPRESSION&&b!==a.EVENT_AD_IMPRESSION_END||a.MODULE_TYPE_RENDERER===this._rendererController.getRenderer().info()[a.INFO_KEY_MODULE_TYPE])e={subType:b,adInstance:this,slot:this._slot},b===a.EVENT_AD_SKIPPABLE_STATE_CHANGED&&(e[a.INFO_KEY_AD_SKIPPABLE_STATE]=this.getAdSkippableState()),b===a.EVENT_ERROR&&(e[a.INFO_KEY_ERROR_CODE]=d[a.INFO_KEY_ERROR_CODE],e[a.INFO_KEY_ERROR_INFO]=d[a.INFO_KEY_ERROR_INFO],
344e[a.INFO_KEY_ERROR_MODULE]=d[a.INFO_KEY_ERROR_MODULE]),b===a.EVENT_AD_MEASUREMENT&&(e[a.INFO_KEY_CONCRETE_EVENT_ID]=d[a.INFO_KEY_CONCRETE_EVENT_ID]),this._context.dispatchEvent(a.EVENT_AD,e);return f},processProgressEvent:function(b){var c=a.EventCallback.newEventCallback(this._rendererController.getContext(),a.EVENT_AD_PROGRESS);c._trackingUrls=this._progressEventCallbackUrlsDict[b];this._context.dispatchEvent(a.EVENT_AD,{subType:a.EVENT_AD_PROGRESS,adInstance:this,slot:this._slot,offset:b});c.process()},
345setVolume:function(b){a.debug("AdInstance.setVolume("+b+")");this.isStarted()&&"function"===typeof this._rendererController.getRenderer().setVolume&&this._rendererController.getRenderer().setVolume(b)},setMetr:function(b,c){var d=a.AdInstance._metrDictionary[b],e=c;d&&(b===a.EVENT_AD_CLICK&&(e=!c),this._metr=e===a.CAPABILITY_STATUS_ON||!0===e?this._metr|d:this._metr&~d)},getExternalEventCallbackUrls:function(a,c){return(this._externalEventCallbackUrlsDictionary[c+"-"+a]||[]).slice()},reset:function(){this._rendererController.reset();
346for(var b=0;b<this._companionAdInstances.length;b++){var c=this._companionAdInstances[b];c._state!==a.MediaPlayingState.instance&&c._state!==a.MediaReplayingState.instance||c.stop();c._rendererController.reset()}},cloneForTranslation:function(){var b=new a.AdInstance(this._context);b._adId=this._adId;b._creativeId=this._creativeId;b._creative=this._creative.cloneForTranslation();b._creativeRenditionId=this._creativeRenditionId;b._isInitiatedSent=this._isInitiatedSent;b._noLoad=this._noLoad;b._slot=
347this.getSlot();b._soAdUnit=this.getSoAdUnit();b._replicaId=this._replicaId;b._dealId=this._dealId;b._openExchangeId=this._openExchangeId;b._marketUnifiedAdId=this._marketUnifiedAdId;b._action=this._action;b._universalAdId=this._universalAdId;b._universalAdIdRegistry=this._universalAdIdRegistry;b._wrapperCount=this._wrapperCount;b._adVerifications=this._adVerifications;b._skipOffset=this._skipOffset;b._skipOffsetPercentage=this._skipOffsetPercentage;for(var c=0;c<this._eventCallbacks.length;c++){var d=
348this._eventCallbacks[c].copy();d._adInstance=b;b._eventCallbacks.push(d)}b._externalEventCallbackUrlsDictionary=a.Util.copy(this._externalEventCallbackUrlsDictionary);b._progressEventCallbackUrlsDict=a.Util.copy(this._progressEventCallbackUrlsDict);b._progressPercentageEventCallbackUrlsDict=a.Util.copy(this._progressPercentageEventCallbackUrlsDict);for(c=0;c<this._companionAdInstances.length;c++)this._companionAdInstances[c].isPlaceholder()?b._companionAdInstances.push(this._companionAdInstances[c].cloneForTranslation()):
349b._companionAdInstances.push(this._companionAdInstances[c]);return b},isPlaceholder:function(){return this._noLoad},setMediaState:function(a){this._state=a},_isValidEventNameAndType:function(b,c){return a.Util.isBlank(b)||a.Util.isBlank(c)?!1:c===a.EVENT_TYPE_CLICK||c===a.EVENT_TYPE_CLICK_TRACKING||c===a.EVENT_TYPE_IMPRESSION&&(b===a.EVENT_AD_IMPRESSION||b===a.EVENT_AD_FIRST_QUARTILE||b===a.EVENT_AD_MIDPOINT||b===a.EVENT_AD_THIRD_QUARTILE||b===a.EVENT_AD_COMPLETE)||c===a.EVENT_TYPE_STANDARD&&(b===
350a.EVENT_AD_PAUSE||b===a.EVENT_AD_RESUME||b===a.EVENT_AD_REWIND||b===a.EVENT_AD_MUTE||b===a.EVENT_AD_UNMUTE||b===a.EVENT_AD_COLLAPSE||b===a.EVENT_AD_EXPAND||b===a.EVENT_AD_MINIMIZE||b===a.EVENT_AD_CLOSE||b===a.EVENT_AD_ACCEPT_INVITATION||b===a.EVENT_AD_SKIPPED||b===a.EVENT_AD_PROGRESS)||c===a.EVENT_TYPE_ERROR&&b===a.EVENT_ERROR},isPlayable:function(){var b=!(this._rendererController.getRendererState()===a.RendererFailedState.instance&&!this._isImpressionSent);if(!b)return a.debug("AdInstance.isPlayable returning false isImpressionSent:",
351this._isImpressionSent),b;(b=b&&!this._translated)||a.debug("AdInstance.isPlayable returning false translated:",this._translated);return b},toString:function(){return"[AdInstance "+this._adId+"]"},getCompanionAdInstances:function(){for(var a=[],c=0;c<this._companionAdInstances.length;++c)this._companionAdInstances[c].isPlaceholder()||a.push(this._companionAdInstances[c]);return a},isRequiredToShow:function(){return this._context._adResponse.getAd(this._adId).isRequiredToShow()},incrementWrapperCount:function(){this._wrapperCount++},
352getWrapperCount:function(){return this._wrapperCount},getDealId:function(){return this._dealId},getOpenExchangeId:function(){return this._openExchangeId},getMarketUnifiedAdId:function(){return this._marketUnifiedAdId},getAction:function(){return this._action},setStartTimePosition:function(b){!isNaN(b)&&-1<b&&b<this.getDuration()?this._startTimePosition=Math.round(b):a.warn("AdInstance.setStartTimePosition","invali
352d start time position")},getStartTimePosition:function(){return this._startTimePosition},
353getSkipOffset:function(){return this._skipOffset},_setSkipOffset:function(b){this._skipOffset=a.Util.offsetStringToSecond(b,this.getDuration())},_setSkipOffsetPercentage:function(b){this._skipOffsetPercentage=a.Util.offsetStringToPercentage(b)}});a.EventDispatcher=function(){this._listeners={}};a.EventDispatcher.prototype={addEventListener:function(a,c){"undefined"===typeof this._listeners[a]&&(this._listeners[a]=[]);this._listeners[a].push(c)},dispatchEvent:function(b){"string"===typeof b&&(b={type:b});
354b.target||(b.target=this);if(b.type&&this._listeners[b.type]instanceof Array)for(var c=this._listeners[b.type],d=0,e=c.length;d<e;d++)try{c[d]&&c[d].call(this,b)}catch(f){a.warn("EventDispatcher.dispatchEvent",b.type,f)}},removeEventListener:function(a,c){if(this._listeners[a]instanceof Array){var b=this._listeners[a];if(null==c)this._listeners[a]=[];else{a=0;for(var e=b.length;a<e;a++)if(b[a]===c){b.splice(a,1);break}}}}};a.EventDispatcher.prototype.constructor=a.EventDispatcher;a.ConsentManager=
355function(){this._consentCallbacks={};this._removeEventListenerMap={};this._addEventListenerMap={};this._tcfConsentManager=new a.TCFConsentManager(this);this._uspConsentManager=new a.USPConsentManager(this);this._gppConsentManager=new a.GPPConsentManagerWrapper(this)};a.ConsentManager.prototype._setupProxyConsentFunction=function(b,c){var d=this,e=b+"Call";window[b]=function(f){for(var k=[],g=0;g<arguments.length;++g)k[g-0]=arguments[g];g=k[0];var m=k[1],h=k[2],l=k[3];"__gpp"===b&&(h=k[1],l=k[2],m=
356k[3]);a.debug("ConsentManager._sendPostMessage: "+b+" postMessage arguments. command: "+g+", version: "+m+", callback: "+h+", parameter: "+l);try{var p=new Uint32Array(1);crypto.getRandomValues(p);var t=""+p[0]}catch(v){t=""+Math.random()}k={};k=(k[e]={command:g,parameter:l,version:m,callId:t},k);d._consentCallbacks[t]=h;"removeEventListener"===g&&(d._removeEventListenerMap[t]=l);c.postMessage(k,"*")}};a.ConsentManager.prototype._setupReceivePostMessageListener=function(b){var c=this,d=b+"Return";
357window.addEventListener("message",function(e){e=e.data;var f=c._consentCallbacks;try{var k="string"===typeof e?JSON.parse(e):e;if(k[d]){var g=k[d];if(f[g.callId]&&(f[g.callId](g.returnValue,g.success),g.returnValue.listenerId?c._addEventListenerMap[g.returnValue.listenerId]||(c._addEventListenerMap[g.returnValue.listenerId]=g.callId):delete f[g.callId],c._removeEventListenerMap[g.callId]&&!1!==g.success)){var m=c._removeEventListenerMap[g.callId];delete f[c._addEventListenerMap[m]];delete c._addEventListenerMap[m];
358delete c._removeEventListenerMap[g.callId];a.debug("ConsentManager._recievePostMessage: deleted listener callId")}}}catch(A){a.warn(b+" postMessage listener error: "+A)}},!1)};a.ConsentManager.prototype.setupConsentPostMessage=function(b){a.debug("ConsentManager.setupConsentPostMessage");var c=b+"Locator",d=a.Util.getFrameAncestor(c);d?(this._setupProxyConsentFunction(b,d),this._setupReceivePostMessageListener(b)):a.warn("ConsentManager.setupConsentPostMessage: "+c+" not found")};a.ConsentManager.prototype.isTCFAPIExecuted=
359function(){return this._tcfConsentManager.isExecuted()};a.ConsentManager.prototype.getGDPRValues=function(){return this._tcfConsentManager.getGDPRValues()};a.ConsentManager.prototype.isUSPAPIExecuted=function(){return this._uspConsentManager.isExecuted()};a.ConsentManager.prototype.isGPPExecuted=function(){return this._gppConsentManager.isExecuted()};a.ConsentManager.prototype.getUSPString=function(){return this._uspConsentManager.getUSPString()};a.ConsentManager.prototype.getGPPValues=function(){return this._gppConsentManager.getGPPValues()};
360a.ConsentManager.prototype.dispose=function(){this._tcfConsentManager.dispose();this._uspConsentManager.dispose();this._gppConsentManager.dispose();this._gppConsentManager=this._uspConsentManager=this._tcfConsentManager=null};a.DashRenderer=function(){this._fwDashPlayer=null;this._duration=this._playheadTime=-1;this._dragging=this._stopInvoked=this._isEnded=!1;this._volume=1;this._rendererController=null;this._isBuffering=!1;this._autoPauseAdOnVisibilityChange=!0;this._dashjs=window.tv.freewheel.Dashjs;
361this._adVideoPauseState=""};a.DashRenderer.prototype={pause:function(){this._rendererController&&this._rendererController.processEvent({name:a.EVENT_AD_PAUSE});this._fwDashPlayer&&!this._fwDashPlayer.isPaused()&&this._fwDashPlayer.pause();this._adVideoPauseState=a.AD_VIDEO_PAUSED_BY_RENDERER},resume:function(){this._rendererController&&this._rendererController.processEvent({name:a.EVENT_AD_RESUME});this._fwDashPlayer&&this._fwDashPlayer.isPaused()&&this._fwDashPlayer.play();this._adVideoPauseState=
362a.AD_VIDEO_UNPAUSED},start:function(b){this._rendererController=b;var c=this._rendererController.getAdInstance(),d=c.getSlot(),e=this,f=!1,k=!1;this._autoPauseAdOnVisibilityChange=this._rendererController.getParameter(a.PARAMETER_AUTO_PAUSE_AD_ONVISIBILITYCHANGE);if(a.PLATFORM_NOT_SUPPORT_MIDROLL_AD&&d.getTimePositionClass()===a.TIME_POSITION_CLASS_MIDROLL)this._onRendererFailed(a.ERROR_DEVICE_LIMIT,"midroll");else if(a.PLATFORM_NOT_SUPPORT_DASH)this._onRendererFailed(a.ERROR_DEVICE_LIMIT,"MPEG-DASH playback not supported on this platform");
363else{a.log("DashRenderer.start",d.getTimePositionClass(),c);var g=this._rendererController.getContentVideoElement(),m=d.getVideoDisplaySize().width,h=d.getVideoDisplaySize().height,l=c.getRenderableCreativeRenditions();b=(b=this._rendererController.getParameter(a.PARAMETER_DESIRED_BITRATE))&&0<Number(b)?Number(b):null;if((m=(h=(new a.RenditionSelector(b||1E3,this._rendererController.getParameter("arWeight")||1,this._rendererController.getParameter("pxWeight")||1,.2)).getBestDashRendition(l,m,h))?
364h.getPrimaryCreativeRenditionAsset():null)&&l.length)if(m.getProxiedUrl()){c.setActiveCreativeRendition(h);a.log("DashRenderer.start selected rendition is:",m.getUrl());this._rendererController.setCapability(a.EVENT_AD_QUARTILE,a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_MUTE,a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_PAUSE,a.CAPABILITY_STATUS_ON);var p=!a.PLATFORM_NOT_SUPPORT_CLICK_FOR_VIDEO;p||this._rendererController.setCapability(a.EVENT_AD_CLICK,
365a.CAPABILITY_STATUS_OFF);var t=a.PLATFORM_EVENT_CLICK,v=a.MOBILE_EVENT_DRAG;a.debug("DashRenderer","use content video element");g.controls=!1;var n=this._dashjs.MediaPlayer().create();n.initialize();l=n.getVersion();a.debug("dash.js -v "+n.getVersion()+" loaded");if(0!==a.Util.compareVersion(l,a.PLATFORM_DASHJS_SUPPORTED_VERSION))this._onRendererFailed(a.ERROR_DEVICE_LIMIT,"Unsupported tv.freewheel.Dash.js ver
365sion");else{n.setAutoPlay(!1);n.attachView(g);b&&n.updateSettings({streaming:{abr:{initialBitrate:{video:b}}}});
366n.attachSource(m.getUrl());n.preload();this._fwDashPlayer=n;var r=null,L=null,y=null;this._volume=this._rendererController.getContext().getAdVolume();n.setVolume(this._volume);n.setMute(0===this._volume);var M=function(b){a.debug("DashRenderer.checkTimeUpdate timeout");J(b)},N=function(){L&&(clearTimeout(L),L=null)},O=a.Util.bind(this,function(b){a.debug("onAdVideoPlaybackStalled(): Ad video event "+b.type);b=this._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_PLAY_AFTER_STALLED);null!==
367b&&"undefined"!==typeof b&&!1!==a.Util.str2bool(b)&&(a.debug("play the ad immediately after the stalled event"),n&&n._fw_videoAdPlaying&&n.play())}),Q=function(b){e._isBuffering||(e._isBuffering=!0,e._rendererController.processEvent({name:a.EVENT_AD_BUFFERING_START}),a.debug("onAdVideoBufferingStarted(): Ad video event "+b.type))},R=function(b){e._isBuffering&&(e._isBuffering=!1,e._rendererController.processEvent({name:a.EVENT_AD_BUFFERING_END}),a.debug("onAdVideoBufferingEnded(): Ad video event "+
368b.type))};b=this._rendererController.getParameter(a.PARAMETER_EXTENSION_AD_CONTROL_CLICK_ELEMENT);var K=null;b&&(K=document.getElementById(b));K||(K=g);var E=a.Util.bind(this,function(b){if(n.isPaused()&&a.PLATFORM_NOT_FIRE_CLICK_WHEN_AD_VIDEO_PAUSED)n.play();else{var c=this._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_CLICK_DETECTION);null==c&&(c="true");!1!==a.Util.str2bool(c)&&(k?(a.debug("Ad video event "+b.type),this._dragging?this._dragging=!1:this._rendererController.processEvent({name:a.EVENT_AD_CLICK})):
369a.debug("Ad not started, ignore click."))}}),u=a.Util.bind(this,function(b){a.debug("Ad video event "+b.type);this._dragging=!0}),F,z=function(b){a.debug("Ad video event "+b.type+" ended: "+g.ended+" playing: "+n._fw_videoAdPlaying);b=e._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_DISPLAY_CONTROLS_WHEN_PAUSE);null==b&&(b="true");!1===a.Util.str2bool(b)?a.debug("Pause controls disabled"):g.controls=!0;N()},w=function(b){a.debug("Ad video event "+b.type);g.controls=!1;e._videoPausedByRenderer=
370!1},x=0,B=function(b){a.debug("Ad video event "+b.type);0>=n.time()?a.debug("DashRenderer.onAdVideoTimeUpdate currentTime is less than or 0"):(N(),n.isPaused()||(b=e._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_PROGRESS_DETECT_TIMEOUT)||8E3,L=setTimeout(M,b,b+"ms timeout when playing")),k||(k=!0,e._playheadTime=n.time(),0>e._playheadTime&&(e._playheadTime=0),r&&(clearTimeout(r),r=null),e._quartileTimerId=setInterval(function(){var b=n.time(),c=n.duration();0<b&&(e._playheadTime=b);
371"number"!==typeof b||"number"!==typeof c||y||(e._rendererController&&(e._rendererController.checkProgress(b),e._rendererController.checkForSkippableStateChange()),b>=.25*c&&1>x&&(e._rendererController.processEvent({name:a.EVENT_AD_FIRST_QUARTILE}),x=1),b>=.5*c&&2>x&&(e._rendererController.processEvent({name:a.EVENT_AD_MIDPOINT}),x=2),b>=.75*c&&3>x&&(e._rendererController.processEvent({name:a.EVENT_AD_THIRD_QUARTILE}),x=3),b>=c-.5&&4>x&&(clearInterval(e._quartileTimerId),e._quartileTimerId=null,e._rendererController.processEvent({name:a.EVENT_AD_COMPLETE}),
372x=4))},500),0<n.duration()&&(e._duration=n.duration(),c.adjustOffsetAndProgressWithRendererDuration(e._duration)),e._rendererController.handleStateTransition(a.RENDERER_STATE_STARTED),e._rendererController.checkForSkippableStateChange()))};this.dispose=a.Util.bind(this,function(){I()});var I=function(b){e.playAdAfterStartDelay&&(clearTimeout(e.playAdAfterStartDelay),e.playAdAfterStartDelay=null);var c=y;b&&b.type&&(a.debug("DashRenderer onAdVideoEnded. Ad video event: "+b.type),"error"===b.type&&
373b.target&&(a.warn(b.target.src),a.warn(b.target.currentSrc),R(b)));N();r&&(clearTimeout(r),r=null);p&&(K.removeEventListener(t,E,!1),K.removeEventListener(v,u,!1));F&&(clearTimeout(F),F=null);S&&e._autoPauseAdOnVisibilityChange&&(document.removeEventListener("visibilitychange",S,!1),S=null);var d=e._dashjs.MediaPlayer.events;n.off(d.PLAYBACK_ENDED,I,e);n.off(d.PLAYBACK_ERROR,I,e);n.off(d.ERROR,I,e);n.off(d.PLAYBACK_PAUSED,z,e);n.off(d.PLAYBACK_PLAYING,w,e);n.off(d.PLAYBACK_TIME_UPDATED,B,e);n.off(d.PLAYBACK_STALLED,
374O,e);n.off(d.BUFFER_EMPTY,Q,e);n.off(d.BUFFER_LOADED,R,e);n.off(d.PLAYBACK_NOT_ALLOWED,T,e);n.isPaused()||(a.debug("try pausing video before complete"),n.pause());b&&"error"===b.type&&b.target?(c="video error",(b=g.error||b.target.error)&&(c="error:"+b+",code:"+b.code)):b&&"error"===b.type&&b.error?c="dashjs error, dashjs-error-message: "+b.error.message+", dashjs-error-code: "+b.error.code:b&&"playbackError"===b.type&&b.error&&(c="dashjs playbackError");c||(e._isEnded=!0);a.log("DashRenderer.complete");
375if(f)e._rendererController.checkProgress(n.duration());else{f=!0;delete n._fw_videoAdPlaying;b=n.time();d=n.duration();e._fwDashPlayer=null;try{n.reset()}catch(D){a.warn("Error resetting fw dashjs player: ",D)}n=null;e._quartileTimerId&&(clearInterval(e._quartileTimerId),e._quartileTimerId=null);c?(b=null,c.includes("timeout")?b=a.ERROR_TIMEOUT:c.includes("dashjs")&&(b=a.ERROR_DASHJS),e._onRendererFailed(b,c)):(e._stopInvoked||(b>=.25*d&&1>x&&(e._rendererController.processEvent({name:a.EVENT_AD_FIRST_QUARTILE}),
376x=1),b>=.5*d&&2>x&&(e._rendererController.processEvent({name:a.EVENT_AD_MIDPOINT}),x=2),b>=.75*d&&3>x&&(e._rendererController.processEvent({name:a.EVENT_AD_THIRD_QUARTILE}),x=3),b>=d-.5&&4>x&&(e._rendererController.checkProgress(d),e._rendererController.processEvent({name:a.EVENT_AD_COMPLETE}),x=4)),e._stopInvoked=!1,e._rendererController.handleStateTransition(a.RENDERER_STATE_COMPLETED))}e._rendererController=null};var J=function(b){y=b;a.warn(y);I()},S=function(b){a.log("onVisibilityChange:"+(document.hidden?
377"invisible":"visible"));document.hidden?e._adVideoPauseState!==a.AD_VIDEO_PAUSED_BY_RENDERER&&(n&&!n.isPaused()&&n.pause(),e._adVideoPauseState=a.AD_VIDEO_PAUSED_BY_TAB_SWITCH,e._rendererController&&e._rendererController.processEvent({name:a.EVENT_AD_PAUSE}),r&&(clearTimeout(r),r=null)):e._adVideoPauseState===a.AD_VIDEO_PAUSED_BY_TAB_SWITCH&&(e.resume(),k||!n._fw_fromVideoPool&&!a.PLATFORM_SUPPORT_VIDEO_START_DETECT_TIMEOUT||(b=e._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_START_DETECT_TIMEOUT)||
3785E3,r=setTimeout(J,b,b+"ms timeout before playing")))},T=function(){a.warn("Blocked by browser, need player to display a start button");e._fwDashPlayer.off(e._dashjs.MediaPlayer.events.PLAYBACK_NOT_ALLOWED,T,e);r&&(clearTimeout(r),r=null);d.setAutoPlayBlocked(!0);e._rendererController.processEvent({name:a.EVENT_AD_AUTO_PLAY_BLOCKED,info:{apiOnly:!0}})};n._fw_videoAdPlaying=!0;var U=!1;(function(){if(!U){U=!0;p&&(K.addEventListener(t,E,!1),K.addEventListener(v,u,!1));var b=e._dashjs.MediaPlayer.events;
379n.on(b.PLAYBACK_ENDED,I,e);n.on(b.PLAYBACK_ERROR,I,e);n.on(b.ERROR,I,e);n.on(b.PLAYBACK_PAUSED,z,e);n.on(b.PLAYBACK_PLAYING,w,e);n.on(b.PLAYBACK_TIME_UPDATED,B,e);n.on(b.PLAYBACK_STALLED,O,e);n.on(b.BUFFER_EMPTY,Q,e);n.on(b.BUFFER_LOADED,R,e);n.on(b.PLAYBACK_NOT_ALLOWED,T,e);a.log("DashRenderer, play video ad "+n.getSource());if(n._fw_fromVideoPool||a.PLATFORM_SUPPORT_VIDEO_START_DETECT_TIMEOUT)b=e._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_START_DETECT_TIMEOUT)||5E3,r=setTimeout(J,
380b,b+"ms timeout before playing");a.PLATFORM_VIDEO_DOESNOT_SUPPORT_TIMEUPDATE&&e._rendererController.handleStateTransition(a.RENDERER_STATE_STARTED);b=100;0<a.PLATFORM_ANDROID_VERSION&&(b=e._rendererController.getParameter(a.PARAMETER_RENDERER_VIDEO_ANDROID_DELAY)||100);e.playAdAfterStartDelay=setTimeout(function(){e.playAdAfterStartDelay=null;document.hidden&&e._autoPauseAdOnVisibilityChange?(a.log("DashRenderer pause ad when tab is invisible."),e._adVideoPauseState=a.AD_VIDEO_PAUSED_BY_TAB_SWITCH,
381n&&n.pause(),e._rendererController&&e._rendererController.processEvent({name:a.EVENT_AD_PAUSE}),r&&(clearTimeout(r),r=null)):n.play();e._autoPauseAdOnVisibilityChange&&document.addEventListener("visibilitychange",S,!1)},b)}})()}}else this._onRendererFailed(a.ERROR_NULL_ASSET);else this._onRendererFailed(a.ERROR_DEVICE_LIMIT,"no compatible asset")}},stop:function(){a.debug("DashRenderer stop");this._stopInvoked=!0;this._fwDashPlayer&&(this._fwDashPlayer._fw_videoAdPlaying=!1,this._fwDashPlayer.pause(),
382this.dispose());this._rendererController=null},info:function(){return{moduleType:a.MODULE_TYPE_RENDERER}},getPlayheadTime:function(){if(this._isEnded&&0<this._duration)return this._duration;if(this._fwDashPlayer){var a=this._fwDashPlayer.time();if(0<a)return a}return this._playheadTime},getDuration:function(){return this._duration},setVolume:function(b){a.debug("DashRenderer setVolume("+b+")");this._fwDashPlayer?(this._fwDashPlayer.setVolume(b),this._fwDashPlayer.setMute(0===b),a.Util.fireVolumeEvents(this._volume,
383b,this._rendererController),this._volume=b):a.debug("DashRenderer dash player is null, ignore.")},_onRendererFailed:function(b,c,d){var e={};e[a.INFO_KEY_ERROR_MODULE]="DashRenderer";e[a.INFO_KEY_ERROR_CODE]=b;d||(d=a.ERROR_VAST_GENERAL_LINEAR_ERROR);e[a.INFO_KEY_VAST_ERROR_CODE]=d;c&&(e[a.INFO_KEY_ERROR_INFO]=c);this._rendererController.handleStateTransition(a.RENDERER_STATE_FAILED,e)}};a.DashRenderer.prototype.constructor=a.DashRenderer;a.HTMLAdGenerator={log:function(b){a.log("HTMLAdGenerator\t"+
384b)},getExtension:function(a){return a?(a=a.match(/^[^?]+\/[^?.]*(\.\w+)+/))?a[a.length-1].slice(1):"":""},generateAd:function(b,c,d,e,f,k,g){a.HTMLAdGenerator.log("generatorAd("+[].slice.call(arguments,0).join(",")+")");var m=k,h=!1;null==m&&(h=!0,m=a.HTMLAdGenerator.getExtension(b).toLowerCase());switch(m){case "jpeg":case "jpg":case "gif":case "png":case "image/jpeg":case "image/jpg":case "image/gif":case "image/png":case "image/bmp":m=
384a.HTMLAdGenerator.generateImageHTML(b,c);break;case "swf":case "application/x-shockwave-flash":m=
385a.HTMLAdGenerator.generateFlashHTML(b,c,d,e,f);break;case "script":case "js":case "text/javascript":case "text/js_ref":case "application/x-javascript":m=a.HTMLAdGenerator.generateScriptHTML(b,d,e,f);break;case "iframe":case "html":case "htm":case "text/html":case "text/html_doc_ref":case "text/html_lit_nowrapper":case "text/html_doc_lit_mobile":m=a.HTMLAdGenerator.generateIFrameHTML(b,c,d,e,f);break;default:m=h?a.HTMLAdGenerator.generateIFrameHTML(b,c,d,e,f):a.HTMLAdGenerator.generateAd(b,c,d,e,f,
386null,g)}return"text/html_doc_lit_mobile"===g?a.HTMLAdGenerator.htmlLitToHTMLDocLitMobile(m):m},generateImageHTML:function(b,c){a.HTMLAdGenerator.log("generateImageHTML");return c?'<a rel="noopener noreferrer" href="'+c+'" target="_blank"><img src="'+b+'" border="0" /></a>':'<img src="'+b+'" border="0" />'},generateFlashHTML:function(b,c,d,e,f){a.HTMLAdGenerator.log("generateFlashHTML");var k=b;c&&0<c.length&&(k+=-1===b.indexOf("?")?"?":"&",k+="clickTag="+encodeURIComponent(c));b='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"WIDTH="'+
387e+'" HEIGHT="'+f+'" id="'+d+'_external_ad">'+('<PARAM NAME=movie VALUE="'+k+'"/>')+'<PARAM NAME=quality VALUE=high/><PARAM NAME=bgcolor VALUE=#FFFFFF/><PARAM NAME="allowScriptAccess" VALUE="always"/><PARAM NAME="loop" VALUE="true"/>';b+='<EMBED src="'+k+'" ';return b+('quality=high bgcolor=#FFFFFF WIDTH="'+e+'" HEIGHT="'+f+'"NAME="'+d+'_external_video" ALIGN="" TYPE="application/x-shockwave-flash"PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>')},generateIFrameHTML:function(b,
388c,d,e,f){a.HTMLAdGenerator.log("generateIFrameHTML");return'<iframe height="'+f+'" width="'+e+'" frameborder="0" scrolling="no" allowtransparency="true" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0" src="'+b+'"></iframe>'},docLitToHTMLLit:function(b,c,d,e){a.HTMLAdGenerator.log("docLitToHTMLLit");return'<iframe id="_fw_frame_'+c+'" width="'+d+'" height="'+e+'" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe><script language="javascript" type="text/javascript" id="_fw_container_js_'+
389c+"\">if(!fw_targets) {var fw_targets = [];}var _fw_wr;var fw_scope = document;var fw_content = '"+a.Util.encodeToHex(b)+"';var trgtFrm = fw_scope.getElementById(\"_fw_frame_"+c+'");trgtFrm = (trgtFrm.contentWindow) ? trgtFrm.contentWindow : (trgtFrm.contentDocument.document) ? trgtFrm.contentDocument.document : trgtFrm.contentDocument;fw_targets["'+c+'"] = trgtFrm;if(navigator.userAgent.match(/\\bMSIE\\b/) || navigator.userAgent.match(/\\bOpera\\b/)){trgtFrm.document.open();trgtFrm.document.write(fw_content);setTimeout(function(){fw_close(fw_targets["'+
390c+'"])}, 7500);} else if (navigator.userAgent.match(/\\bFirefox\\b/)) {if(true && fw_content.length < 2000){var ec = escape(fw_content);var fw_iframe_url = "http://m2.feiwei.tv/g/lib/template/echo.html?s="+ec;fw_scope.getElementById("_fw_frame_'+c+'").src = fw_iframe_url;} else {trgtFrm.document.open();trgtFrm.document.write(fw_content);trgtFrm.document.close();}} else {trgtFrm.document.open();trgtFrm.document.write(fw_content);trgtFrm.document.close();}function fw_close(theFrame){theFrame.document.close();}\x3c/script>'},
391htmlLitToDocLit:function(b){a.HTMLAdGenerator.log("htmlLitToDocLit");return'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Advertisement</title></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">'+b+"</body></html>"},wrapUnsafeHTML:function(b,c,d,e){return a.HTMLAdGenerator.htmlLitToHTMLDocLitMobile(a.HTMLAdGenerator.docLitToHTMLLit(a.HTMLAdGenerator.htmlLitToDocLit(b),c,d,e))},wrapJSCode:function(b,
392c,d,e){return a.HTMLAdGenerator.wrapUnsafeHTML('<script language="javascript" type="text/javascript">'+b+"\x3c/script>",c,d,e)},generateScriptHTML:function(b,c,d,e){a.HTMLAdGenerator.log("generateScriptHTML");return a.HTMLAdGenerator.wrapUnsafeHTML('<script language="javascript" type="text/javascript" src="'+b+'">\x3c/script>',c,d,e)},htmlLitToHTMLDocLitMobile:function(b){a.HTMLAdGenerator.log("htmlLitToHTMLDocLitMobile");return'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta name = "viewport" content = "initial-scale = 1.0, target-densitydpi = device-dpi" /><title>Advertisement</title><script type="text/javascript">window._fw_page_url = "";\x3c/script></head><body style="margin:0px;background-color:transparent;">'+
393b+"</body></html>"}};a.SIMIDRenderer=function(){var a=this;this._simidCreativeUrl=this._simidIframe=this._rendererController=this._videoRenderer=this._context=null;this._simidVariableDurationAllowed=!1;this._ad=this._slotBase=this._videoElement=null;this._listeners={};this._sessionId="";this._nextMessageId=1;this._target=window;this._resolutionListeners={};this._onAdEvent=this._onAdEvent.bind(this);this._onSessionCreated=this._onSessionCreated.bind(this);this._onRequestPlay=this._onRequestPlay.bind(this);
394this._onRequestPause=this._onRequestPause.bind(this);this._onRequestStop=this._onRequestStop.bind(this);this._onRequestSkip=this._onRequestSkip.bind(this);this._onRequestVolume=this._onRequestVolume.bind(this);this._onRequestFullScreen=this._onRequestFullScreen.bind(this);this._onRequestExitFullScreen=this._onRequestExitFullScreen.bind(this);this._onGetMediaState=this._onGetMediaState.bind(this);
394this._onCreativeFatalError=this._onCreativeFatalError.bind(this);this._onReceiveCreativeLog=this._onReceiveCreativeLog.bind(this);
395this._onAdVideoTimeUpdate=this._onAdVideoTimeUpdate.bind(this);this._onAdVideoStalled=this._onAdVideoStalled.bind(this);this._onAdVideoDurationChange=this._onAdVideoDurationChange.bind(this);this._onFullScreenChange=this._onFullScreenChange.bind(this);this._onRequestChangeAdDuration=this._onRequestChangeAdDuration.bind(this);this._receiveMessage=this._receiveMessage.bind(this);this._resolveStartCreativePromise=this._startCreativePromise=this._resolveInitializationPromise=this._initializationPromise=
396null;this._fullScreenAllowed=!0;this._isFullScreen=!1;this._timeoutListeners={};this._creativeTimeoutDelayInMs=5E3;this._creativeRespondingPlayerAdStoppedDelayInMs=250;this._creativeMessageCount=0;this._isSessionCreated=!1;this._requestedDuration=this._maxDuration=null;this._isMuted=this._isEnded=this._isPaused=!1;this._resolveSessionCreatedPromise=this._stopTimeout=null;this._sessionCreatedPromise=new Promise(function(b,d){a._resolveSessionCreatedPromise=b});this._rejectInitializationPromise=null;
397this._initializationPromise=new Promise(function(b,d){a._resolveInitializationPromise=b;a._rejectInitializationPromise=d});this._startCreativePromise=new Promise(function(b,d){a._resolveStartCreativePromise=b})};a.SIMIDRenderer.prototype.start=function(b){window.addEventListener("message",this._receiveMessage,!1);this._context=b.getContext();this._videoRenderer=new a.VideoRenderer(!0);this._rendererController=b;this._ad=b.getAdInstance();b.handleStateTransition(tv.freewheel.SDK.RENDERER_STATE_STARTED);
398a.log("SIMIDRenderer started.");this._videoRenderer.start(b);this._fullScreenAllowed="true"===(this._rendererController.getParameter(a.PARAMETER_SIMID_FULL_SCREEN_ALLOWED)||"true");a.debug("SIMIDRenderer _fullScreenAllowed set to "+this._fullScreenAllowed);this._creativeTimeoutDelayInMs=this._rendererController.getParameter(a.PARAMETER_SIMID_CREATIVE_TIMEOUT_DELAY)||5E3;a.debug("SIMIDRenderer _creativeTimeoutDelayInMs set to "+this._creativeTimeoutDelayInMs);this._initiateSimidAd()};a.SIMIDRenderer.prototype._initiateSimidAd=
399function(){a.debug("SIMIDRenderer_onAdInitiated");if(null!=this._rendererController.getContentVideoElement()){this._addListener(a.SimidProtocolMessage.CREATE_SESSION,this._onSessionCreated);this._addListener(a.SimidCreativeMessage.REQUEST_PLAY,this._onRequestPlay);this._addListener(a.SimidCreativeMessage.REQUEST_PAUSE,this._onRequestPause);this._addListener(a.SimidCreativeMessage.REQUEST_STOP,this._onRequestStop);this._addListener(a.SimidCreativeMessage.REQUEST_SKIP,this._onRequestSkip);this._addListener(a.SimidCreativeMessage.REQUEST_FULL_SCREEN,
400this._onRequestFullScreen);this._addListener(a.SimidCreativeMessage.REQUEST_EXIT_FULL_SCREEN,this._onRequestExitFullScreen);this._addListener(a.SimidCreativeMessage.REQUEST_VOLUME,this._onRequestVolume);this._addListener(a.SimidCreativeMessage.LOG,this._onReceiveCreativeLog);this._addListener(a.SimidCreativeMessage.GET_MEDIA_STATE,this._onGetMediaState);this._addListener(a.SimidCreativeMessage.REQUEST_CHANGE_AD_DURATION,this._onRequestChangeAdDuration);this._addListener(a.SimidCreativeMessage.FATAL_ERROR,
401this._onCreativeFatalError);this._context.addEventListener(a.EVENT_AD,this._onAdEvent);var b=this._ad.getActiveCreativeRendition();this._simidCreativeUrl=b.getSimidCreativeUrl();this._slotBase=this._ad.getSlot().getBase();this._simidVariableDurationAllowed=b.getSimidVariableDurationAllowed();this._simidVariableDurationAllowed||(a.debug("simidRenderer no variableDuration attribute found"),this._simidVariableDurationAllowed=!1);a.debug("simidRenderer variable duration= "+this._simidVariableDurationAllowed);
402this._maxDuration=this._ad.getSlot().getMaxDuration();this._simidCreativeUrl?this._initializeSIMIDCreative():a.debug("SIMIDRenderer: The SIMID media could not be loaded.")}};a.SIMIDRenderer.prototype._initializeSIMIDCreative=function(){var b=this;a.debug("SIMIDRenderer._initWithScripts");this._simidIframe=this._createSIMIDIframe();this._videoElement=this._rendererController.getContentVideoElement();this._videoElement.addEventListener("timeupdate",this._onAdVideoTimeUpdate,!1);this._videoElement.addEventListener("stalled",
403this._onAdVideoStalled,!1);this._videoElement.addEventListener("durationchange",this._onAdVideoDurationChange,!1);window.document.addEventListener("fullscreenchange",this._onFullScreenChange,!1);var c=this._getFullDimensions(),d=this._getFullDimensions(),e=this._ad.getAdSkippableState(),f={videoDimensions:c,creativeDimensions:d,fullscreen:this._isFullScreen,fullscreenAllowed:this._fullScreenAllowed,variableDurationAllowed:this._simidVariableDurationAllowed,skippableState:e?"playerHandles":"adHandles",
404version:"1.1",siteUrl:document.location.host,useragent:a.checkUserAgent(navigator.userAgent.toLowerCase()),muted:this._isMuted,volume:this._context.getAdVolume()};(c=this._rendererController.getAdInstance().getActiveCreativeRendition().getParameter("creativeData"))||(c="");var k={adParameters:c,clickThroughUrl:this._ad.getEventCallbackUrls(a.EVENT_AD_CLICK,a.EVENT_TYPE_CLICK)};this._sessionCreatedPromise.then(function(){b._sendMessage(a.SimidPlayerMessage.INIT,{environmentData:f,creativeData:k}).then(function(a){b._resolveInitializationPromise(a)}).catch(function(a){b._rejectInitializationPromise(a)});
405b._initializationPromise.then(function(){b._startSIMIDCreativePlayback()})})};a.SIMIDRenderer.prototype._getFullDimensions=function(){var a=this._ad.getSlot().getVideoDisplaySize();this._isFullScreen=a.width>=screen.width&&a.height>=screen.height?!0:!1;return{x:a.x,y:a.y,width:a.width,height:a.height}};a.SIMIDRenderer.prototype._onSessionCreated=function(){this._resolveSessionCreatedPromise();this._isSessionCreated=!0};a.SIMIDRenderer.prototype._startSIMIDCreativePlayback=function(){var b=this;this._sendMessage(a.SimidPlayerMessage.START_CREATIVE).then(function(a){b._resolveStartCreativePromise(a)});
406this._startCreativePromise.then(function(){b._simidIframe.style.display="block"})};a.SIMIDRenderer.prototype._createSIMIDIframe=function(){this._videoElement=this._rendererController.getContentVideoElement();var a=document.createElement("iframe");a.style.border="none";a.style.display="none";a.id="_fw_simid_iframe";this._slotBase.appendChild(a);a.style.position="absolute";a.style.top=a.style.left="0px";a.style.width=this._slotBase.style.width||"100%";a.style.height=this._slotBase.style.height||"100%";
407a.src=this._simidCreativeUrl;this._setMessageTarget(a.contentWindow);return a};a.SIMIDRenderer.prototype._setMessageTarget=function(a){this._target=a};a.SIMIDRenderer.prototype._sendMessage=function(b,c){var d=this,e=this._nextMessageId++,f={sessionId:this._sessionId,messageId:e,type:b==a.SimidProtocolMessage.CREATE_SESSION?b:"SIMID:"+b,timestamp:Date.now(),args:c};return a.SimidEventsThatRequireResponse.includes(b)?new Promise(function(a,b){d._addResolveRejectListener(e,a,b);d._target.postMessage(JSON.stringify(f),
408d._simidCreativeUrl);d._startTimeoutTimer(f)}):new Promise(function(a,b){d._target.postMessage(JSON.stringify(f),d._simidCreativeUrl);a()})};a.SIMIDRenderer.prototype._addListener=function(a,c){this._listeners[a]?this._listeners[a].push(c):this._listeners[a]=[c]};a.SIMIDRenderer.prototype._addResolveRejectListener=function(a,c,d){this._resolutionListeners[a]=function(a){var b=a.type;a=a.args.value;"resolve"==b?c(a):"reject"==b&&d(a)}};a.SIMIDRenderer.prototype._receiveMessage=function(b){if(b&&b.data)try{var c=
409JSON.parse(b.data);if(c)if(5E3===this._creativeMessageCount){var d={errorCode:a.SimidPlayerErrorCode.POSTMESSAGE_CHANNEL_OVERLOADED,message:"The creative is overloading the postmessage channel."};a.debug("SIMIDRenderer: "+d.message);this._reject(c,d);this._stopAdOverload()}else this._handlePostMessage(c)}catch(e){a.warn("SIMID Renderer: An error occured while trying to parse the event data: "+e.message)}};a.SIMIDRenderer.prototype._handlePostMessage=function(b){this._creativeMessageCount++;a.debug("SIMID Renderer: Creative postMessage count"+
410this._creativeMessageCount);var c=b.sessionId,d=b.type;a.debug("SIMID Renderer: Creative message:"+d);c=this._sessionId==c;(""==this._sessionId&&d==a.SimidProtocolMessage.CREATE_SESSION||c)&&null!=d?Object.values(a.SimidProtocolMessage).includes(d)?this._handleProtocolMessage(b):d.startsWith("SIMID:")&&(d=d.substr(6),(d=this._listeners[d])&&d.forEach(function(a){return a(b)})):this._sendMessage(a.SimidPlayerErrorCode.SPEC_NOT_FOLLOWED_ON_MESSAGES,{errorCode:a.SimidPlayerErrorCode.SPEC_NOT_FOLLOWED_ON_MESSAGES,
411message:"The creative is not following the spec in the way it sends messages."})};a.SIMIDRenderer.prototype._handleProtocolMessage=function(b){var c=b.type;switch(c){case a.SimidProtocolMessage.CREATE_SESSION:this._sessionId=b.sessionId;this._resolve(b);(c=this._listeners[c])&&c.forEach(function(a){return a(b)});break;case a.SimidProtocolMessage.RESOLVE:case a.SimidProtocolMessage.REJECT:c=b.args;var d=c.messageId,e=this._resolutionListeners[d];c&&this._handleCreativeError(c);e&&(e(b),delete this._resolutionListeners[d],
412this._clearTimeoutTimer(b))}};a.SIMIDRenderer.prototype._resolve=function(b,c){var d=this._nextMessageId++;b={messageId:b.messageId,value:c};d={sessionId:this._sessionId,messageId:d,type:a.SimidProtocolMessage.RESOLVE,timestamp:Date.now(),args:b};this._target==window&&(this._target=window.parent);a.debug(d);this._target.postMessage(JSON.stringify(d),this._simidCreativeUrl)};a.SIMIDRenderer.prototype._reject=function(b,c){var d=this._nextMessageId++;b={messageId:b.messageId,value:c};d={sessionId:this._sessionId,
413messageId:d,type:a.SimidProtocolMessage.REJECT,timestamp:Date.now(),args:b};this._target.postMessage(JSON.stringify(d),this._simidCreativeUrl)};a.SIMIDRenderer.prototype.pause=function(){this._isPaused=!0;this._videoRenderer.pause();this._sendMessage(a.SimidMediaMessage.PAUSE)};a.SIMIDRenderer.prototype.resume=function(){this._isPaused=!1;this._videoRenderer.resume();this._sendMessage(a.SimidMediaMessage.PLAY)};a.SIMIDRenderer.prototype.stop=function(){this._stop(a.SimidStopCode.PLAYER_INITATED)};
414a.SIMIDRenderer.prototype._stop=function(a){var b=this;this._stopAd(a);this._simidIframe&&(this._stopTimeout=setTimeout(function(){b._adComplete()},this._creativeRespondingPlayerAdStoppedDelayInMs))};a.SIMIDRenderer.prototype.info=function(){return{moduleType:a.MODULE_TYPE_RENDERER}};a.SIMIDRenderer.prototype.getPlayheadTime=function(){return this._videoRenderer.getPlayheadTime()};a.SIMIDRenderer.prototype.getDuration=function(){return this._videoRenderer.getDuration()};a.SIMIDRenderer.prototype.setVolume=
415function(b){this._videoRenderer.setVolume(b);this._isMuted=0===b?!0:!1;a.debug("SIMIDRenderer setVolume: "+b);this._sendMessage(a.SimidMediaMessage.VOLUME_CHANGE,{volume:b,muted:0===b})};a.SIMIDRenderer.prototype._onRequestPause=function(b){if(this._ad)if(this._isPaused){var c={errorCode:a.SimidCreativeErrorCode.PAUSE_NOT_HONORED,message:"Request for pause not honored since the video is already paused."};this._reject(b,c);a.debug("SIMIDRenderer: "+c.message)}else this.pause(),this._resolve(b);else console.log(this._ad)};
416a.SIMIDRenderer.prototype._onRequestPlay=function(b){if(this._ad)if(this._isPaused)this.resume(),this._resolve(b);else{var c={errorCode:a.SimidPlayerErrorCode.VIDEO_COULD_NOT_LOAD,message:"Request for play not honored as video is already playing."};this._reject(b,c);a.debug("SIMIDRenderer: "+c.message)}else console.log(this._ad)};a.SIMIDRenderer.prototype._onRequestStop=function(b){this._resolve(b);this._stopAd(a.SimidStopCode.CREATIVE_INITIATED)};a.SIMIDRenderer.prototype._onRequestSkip=function(a){this._resolve(a);
417this._ad.getSlot().skipCurrentAd()};a.SIMIDRenderer.prototype._onRequestFullScreen=function(b){if(this._fullScreenAllowed)if(this._isFullScreen)this._reject(b,{errorCode:a.SimidPlayerErrorCode.UNSUPPORTED_FUNCTIONALITY_REQUEST,message:"Media is already in full screen."});else{if("function"===typeof this._slotBase.requestFullscreen)this._slotBase.requestFullscreen();else if("function"===typeof this._slotBase.webkitRequestFullscreen)this._slotBase.webkitRequestFullscreen();else{this._reject(b,{errorCode:a.SimidPlayerErrorCode.UNSUPPORTED_FUNCTIONALITY_REQUEST,
418message:"The environment does not support fullscreen."});return}this._isFullScreen=!0;this._resolve(b)}else this._reject(b,{errorCode:a.SimidPlayerErrorCode.UNSUPPORTED_FUNCTIONALITY_REQUEST,message:"Fullscreen functionality is not allowed."})};a.SIMIDRenderer.prototype._onFullScreenChange=function(){this._isFullScreen=document.fullscreenElement;
418this._context.setVideoDisplaySize(0,0,window.screen.availWidth,window.screen.availHeight,"relative");this._videoElement.style.width="100%";this._videoElement.style.height=
419"100%"};a.SIMIDRenderer.prototype._onRequestExitFullScreen=function(b){if(this._fullScreenAllowed)if(this._isFullScreen){if("function"===typeof document.exitFullscreen)document.exitFullscreen();else if("function"===typeof document.webkitExitFullscreen)document.webkitExitFullscreen();else{this._reject(b,{errorCode:a.SimidPlayerErrorCode.UNSUPPORTED_FUNCTIONALITY_REQUEST,message:"The environment does not support fullscreen."});return}this._isFullScreen=!1;this._resolve(b)}else this._reject(b,{errorCode:a.SimidPlayerErrorCode.UNSUPPORTED_FUNCTIONALITY_REQUEST,
420message:"Media is not currently in full screen mode."});else this._reject(b,{errorCode:a.SimidPlayerErrorCode.UNSUPPORTED_FUNCTIONALITY_REQUEST,message:"Fullscreen functionality is not allowed."})};a.SIMIDRenderer.prototype._onRequestVolume=function(b){this._resolve(b);var c=b.args.volume;b=b.args.muted;a.debug("SIMIDRenderer onRequestVolume "+c+"is Muted: "+b);b?this.setVolume(0):this.setVolume(c)};a.SIMIDRenderer.prototype._onGetMediaState=function(b){var c=this.getPlayheadTime(),d=this.getDuration(),
421e=this._isEnded,f=this._isMuted,k=this._isPaused,g=this._context.getAdVolume(),m=this._isFullScreen;this._resolve(b,{currentTime:c,duration:d,ended:e,muted:f,paused:k,volume:g,fullscreen:m});a.debug("SIMIDRenderer onGetMediaState currentTime: "+c+", duration: "+d+", isEnded: "+e+", isMuted: "+f+", isPaused: "+k+", vol: "+g+", isFullScreen: "+m)};a.SIMIDRenderer.prototype._onCreativeFatalError=function(){this._failWithError(a.ERROR_3P_COMPONENT,"SIMID Creative reported a fatal error.");this._stopAd(a.SimidStopCode.CREATIVE_INITIATED)};
422a.SIMIDRenderer.prototype._onRequestChangeAdDuration=function(b){var c=b.args.duration;this._simidVariableDurationAllowed?c>this._maxDuration?this._reject(b,{errorCode:a.SimidPlayerErrorCode.UNSUPPORTED_TIME,message:"The creative is requesting more time than the player is willing to support."}):-2!=c&&0>c?this._reject(b,{errorCode:a.SimidPlayerErrorCode.UNSUPPORTED_TIME,message:"A negative duration is not valid."}):(this._requestedDuration=c,this._compareAdAndRequestedDurations(),this._resolve(b)):
423this._reject(b,{errorCode:a.SimidPlayerErrorCode.UNSUPPORTED_TIME,message:"Variable duration allowed is set to false."})};a.SIMIDRenderer.prototype._onReceiveCreativeLog=function(b){a.debug("Received message from creative: "+b.args.message)};a.SIMIDRenderer.prototype._compareAdAndRequestedDurations=function(){0!=this._requestedDuration&&-2!=this._requestedDuration&&this.getPlayheadTime()>=this._requestedDuration&&(this._videoRenderer.stop(),this._stopAd(a.SimidStopCode.CREATIVE_INITIATED))};a.SIMIDRenderer.prototype._onAdVideoTimeUpdate=
424function(){if(this._simidIframe){var b=this._videoRenderer.getPlayheadTime();a.debug("SIMIDRenderer: TIMEUPDATE "+b);this._sendMessage(a.SimidMediaMessage.TIME_UPDATE,{currentTime:b})}};a.SIMIDRenderer.prototype._onAdVideoStalled=function(){a.debug("SIMIDRenderer: STALLED");this._sendMessage(a.SimidMediaMessage.STALLED)};a.SIMIDRenderer.prototype._onAdVideoDurationChange=function(){a.debug("SIMIDRenderer: DURATION CHANGE");this._sendMessage(a.SimidMediaMessage.DURATION_CHANGE)};a.SIMIDRenderer.prototype._onAdEvent=
425function(b){var c=this;a.debug("SIMIDRenderer._onAdEvent:",b.subType);if(b&&b.subType)switch(b.subType){case a.EVENT_AD_IMPRESSION:a.debug("SIMIDRenderer: AD_IMPRESSION");this._sendMessage(a.SimidMediaMessage.PLAY);this._sendMessage(a.SimidMediaMessage.PLAYING);break;case a.EVENT_AD_SKIPPED:a.debug("SIMIDRenderer: AD_SKIPPED");this._sendMessage(a.SimidPlayerMessage.AD_SKIPPED);break;case a.EVENT_AD_COMPLETE:a.debug("SIMIDRenderer: AD_COMPLETE: ");this._sendMessage(a.SimidMediaMessage.ENDED);this._isSessionCreated||
426this._sendMessage(a.SimidPlayerErrorCode.SESSION_NOT_CREATED,{errorCode:a.SimidPlayerErrorCode.SESSION_NOT_CREATED,message:"Session was not created by the creative."});null==this._requestedDuration?this._stop(a.SimidStopCode.MEDIA_PLAYBACK_COMPLETE):-2!=this._requestedDuration&&(b=this._videoRenderer.getDuration(),setTimeout(function(){c._stopAd(a.SimidStopCode.CREATIVE_INITIATED)},1E3*(this._requestedDuration-b)));break;case a.ERROR_TIMEOUT:this._sendMessage(a.SimidPlayerMessage.FATAL_ERROR,{errorCode:a.SimidPlayerErrorCode.VIDEO_TIME_OUT,
427message:"The ad media has timed out."});this._stopAd(a.SimidStopCode.PLAYER_INITATED);break;case a.ERROR_DEVICE_LIMIT:this._sendMessage(a.SimidPlayerMessage.FATAL_ERROR,{errorCode:a.SimidPlayerErrorCode.MEDIA_NOT_SUPPORTED,message:"The SIMID media from the VAST response is not supported on this device."});this._stopAd(a.SimidStopCode.PLAYER_INITATED);break;case a.ERROR_NO_AD_AVAILABLE:this._sendMessage(a.SimidPlayerMessage.FATAL_ERROR,{errorCode:a.SimidPlayerErrorCode.VIDEO_COULD_NOT_LOAD,message:"The ad media file could not be loaded."});
428this._stopAd(a.SimidStopCode.PLAYER_INITATED);break;case a.ERROR_UNKNOWN:this._sendMessage(a.SimidPlayerMessage.FATAL_ERROR,{errorCode:a.SimidPlayerErrorCode.UNSPECIFIED,message:"Unspecified error."}),5E3>this._creativeMessageCount&&this._stopAd(a.SimidStopCode.PLAYER_INITATED)}};a.SIMIDRenderer.prototype._adVideoError=function(b){b={error:b.errorCode,message:b.errorInfo};a.debug("SIMIDRenderer: Media Error, error code: "+b.error+", "+b.message+" ");this._sendMessage(SimidMediaMessage.ERROR,b)};a.SIMIDRenderer.prototype._startTimeoutTimer=
429function(b){var c=this,d=b.type,e=b.messageId;a.debug("SIMID Renderer timeout STARTED for "+d+" msg ID "+e);this._timeoutListeners[e]=setTimeout(function(){var b={errorCode:a.SimidPlayerErrorCode.RESPONSE_TIMEOUT,message:"The creative timeout for sending resolve or reject message for "+d+" msg ID "+e};c._sendMessage(a.SimidPlayerErrorCode.RESPONSE_TIMEOUT,b);a.debug("SIMIDRenderer Error: "+b.message)},this._creativeTimeoutDelayInMs)};a.SIMIDRenderer.prototype._clearTimeoutTimer=function(b){var c=
430b.args.messageId;a.debug("SIMID Renderer timeout CLEARED for "+b.type+" for original msg ID "+c);clearTimeout(this._timeoutListeners[c]);delete this._timeoutListeners[c]};a.SIMIDRenderer.prototype._handleCreativeError=function(b){switch(b.value.errorCode){case a.SimidCreativeErrorCode.UNSPECIFIED:a.debug("SIMIDRenderer CREATIVE ERROR: UNSPECIFIED");break;case a.SimidCreativeErrorCode.CANNOT_LOAD_RESOURCE:a.debug("SIMIDRenderer CREATIVE ERROR: Resources could not be loaded.");break;case a.SimidCreativeErrorCode.PLAYBACK_AREA_UNUSABLE:a.debug("SIMIDRenderer CREATIVE ERROR: Playback area not usable by creative.");
431break;case a.SimidCreativeErrorCode.INCORRECT_VERSION:a.debug("SIMIDRenderer CREATIVE ERROR: Wrong SIMID version.");this._sendMessage(a.SimidPlayerErrorCode.WRONG_VERSION,{errorCode:a.SimidPlayerErrorCode.WRONG_VERSION,message:"The player could not support the creatives version."});break;case a.SimidCreativeErrorCode.TECHNICAL_ERROR:a.debug("SIMIDRenderer CREATIVE ERROR: Creative not playable for a technical reason on this site.");break;case a.SimidCreativeErrorCode.EXPAND_NOT_POSSIBLE:a.debug("SIMIDRenderer CREATIVE ERROR: Request for expand not honored.");
432break;case a.SimidCreativeErrorCode.PAUSE_NOT_HONORED:a.debug("SIMIDRenderer CREATIVE ERROR: Request for pause not honored.");break;case a.SimidCreativeErrorCode.PLAYMODE_NOT_ADEQUATE:a.debug("SIMIDRenderer CREATIVE ERROR: Play mode not adequate for creative.");break;case a.SimidCreativeErrorCode.CREATIVE_INTERNAL_ERROR:a.debug("SIMIDRenderer CREATIVE ERROR: Ad internal error.");break;case a.SimidCreativeErrorCode.DEVICE_NOT_SUPPORTED:a.debug("SIMIDRenderer CREATIVE ERROR: Device not supported.");
433break;case a.SimidCreativeErrorCode.MESSAGES_NOT_FOLLOWING_SPEC:a.debug("SIMIDRenderer CREATIVE ERROR: The player is not following the spec in the way it sends messages.");break;case a.SimidCreativeErrorCode.PLAYER_RESPONSE_TIMEOUT:a.debug("SIMIDRenderer CREATIVE ERROR: The player is not responding adequately to messages.")}};a.SIMIDRenderer.prototype._sendLog=function(b){this._sendMessage(a.SimidPlayerMessage.LOG,{message:b})};a.SIMIDRenderer.prototype._stopAd=function(b){var c=this;b=void 0===b?
434a.SimidStopCode.PLAYER_INITATED:b;this._simidIframe?(this._simidIframe.style.display="none",b={code:b},this._isEnded=!0,this._sendMessage(a.SimidPlayerMessage.AD_STOPPED,b).then(function(){c._destroySimidIframe();c._adComplete()})):this._adComplete()};a.SIMIDRenderer.prototype._adComplete=function(){this._stopTimeout&&(clearTimeout(this._stopTimeout),this._stopTimeout=null);null!=this._rendererController&&(this._rendererController.handleStateTransition(a.RENDERER_STATE_COMPLETED),this._videoRenderer.stop(),
435this.dispose())};a.SIMIDRenderer.prototype._stopAdOverload=function(){this._simidIframe&&(this._simidIframe.style.display="none",this._sendMessage(a.SimidPlayerMessage.AD_STOPPED,{code:a.SimidStopCode.CREATIVE_INITIATED}),this._destroySimidIframe(),this._rendererController.handleStateTransition(a.RENDERER_STATE_FAILED),this.dispose())};a.SIMIDRenderer.prototype._failWithError=function(b,c){var d={};d[a.INFO_KEY_ERROR_MODULE]="SIMIDRenderer";d[a.INFO_KEY_ERROR_CODE]=b;c&&(d[a.INFO_KEY_ERROR_INFO]=
436c);this._rendererController.handleStateTransition(a.RENDERER_STATE_FAILED,d)};a.SIMIDRenderer.prototype.dispose=function(){a.debug("SimidRenderer.dispose()");window.removeEventListener("message",this._receiveMessage);window.document.removeEventListener("fullscreenchange",this._onFullScreenChange);this._context.removeEventListener(a.EVENT_AD,this._onAdEvent);this._videoElement.removeEventListener("timeupdate",this._onAdVideoTimeUpdate);this._videoElement.removeEventListener("stalled",this._onAdVideoStalled);
437this._videoElement.removeEventListener("durationchange",this._onAdVideoDurationChange);this._resolveInitializationPromise=this._initializationPromise=this._ad=this._slotBase=this._simidCreativeUrl=this._simidIframe=this._videoRenderer=this._rendererController=this._videoElement=this._context=null;this._listeners={};this._timeoutListeners={};this._creativeMessageCount=0;this._isSessionCreated=!1;this._requestedDuration=this._maxDuration=null;this._creativeTimeoutDelayInMs=5E3;this._isMuted=this._isEnded=
438this._isPaused=this._isFullScreen=this._fullScreenAllowed=!1};a.SIMIDRenderer.prototype._destroySimidIframe=function(){this._simidIframe&&(this._simidIframe.remove(),this._simidIframe=null,this._listeners={},this._sessionId="",this._nextMessageId=1,this._resolutionListeners={})};a.AdVerification=function(){this.vendorKey="";this.javaScriptResources=[];this.executableResources=[];this.verificationParameters="";this.trackingEvents={}};a.AdVerification.prototype={parseFromVAST:function(a){this.javaScriptResources=
439this._parseJavaScriptResources(a);this.executableResources=this._parseExecutableResources(a);a["@attributes"]&&a["@attributes"].vendor&&(this.vendorKey=a["@attributes"].vendor);a.VerificationParameters&&a.VerificationParameters.value&&(this.verificationParameters=a.VerificationParameters.value);if(a.TrackingEvents&&a.TrackingEvents.Tracking)if(a=a.TrackingEvents.Tracking,a.length)for(var b=0;b<a.length;b++)this._pushTrackingEventsFromVAST(a[b]);else this._pushTrackingEventsFromVAST(a)},parseFromJSON:function(b){if(b.javaScriptResource)if(Array.isArray(b.javaScriptResource))for(i=
4400,arr=b.javaScriptResource||[];i<arr.length;i++)this.javaScriptResources.push(this._parseJavaScriptResourcesNodeFromJSON(arr[i]));else a.debug("AdVerification node is expecting an array but got: "+b.javaScriptResource);b.vendor&&(this.vendorKey=b.vendor);b.verificationParameters&&(this.verificationParameters=b.verificationParameters);if(b.trackingEvents)for(i=0,arr=b.trackingEvents||[];i<arr.length;i++)this._pushTrackingEventsFromJSON(arr[i])},dispatchAdVerificationNotExecutedWithReason:function(b){for(var c=
441this.trackingEvents[a.AD_VERIFICATION_EVENT_NOT_EXECUTED],d=0;d<c.length;d++){var e=c[d].replace("[REASON]",b);a.Util.pingURL(e)}},_pushTrackingEventsFromVAST:function(a){var b=a["@attributes"].event;this.trackingEvents[b]?this.trackingEvents[b].push(a.value):this.trackingEvents[b]=[a.value]},_pushTrackingEventsFromJSON:function(a){var b=a.event;this.trackingEvents[b]?this.trackingEvents[b].push(a.url):this.trackingEvents[b]=[a.url]},_parseJavaScriptResources:function(a){return this._parseResources(a.JavaScriptResource,
442this._parseJavaScriptResourceNode.bind(this))},_parseExecutableResources:function(a){return this._parseResources(a.ExecutableResource,this._parseExecutableResourceNode.bind(this))},_parseResources:function(a,c){var b=[];if(a)if(a.length)for(var e=0;e<a.length;e++){var f=c(a[e]);b.push(f)}else f=c(a),b.push(f);return b},_parseJavaScriptResourceNode:function(a){return{url:this._parseUrl(a),apiFramework:this._parseApiFramework(a),browserOptional:this._parseBrowserOptional(a)}},_parseJavaScriptResourcesNodeFromJSON:function(a){var b=
443"";"boolean"===typeof a.browserOptional&&(b=a.browserOptional?"true":"false");return{url:a.url||"",apiFramework:a.apiFramework||"",browserOptional:b}},_parseExecutableResourceNode:function(a){return{url:this._parseUrl(a),apiFramework:this._parseApiFramework(a),type:this._parseType(a)}},_parseUrl:function(b){try{return new URL(b.value),b.value}catch(c){return a.debug('AdVerification._parseUrl Error parsing "'+b.value+'". Error message:',c.message),""}},_parseApiFramework:function(a){return this._parseFromAttributes(a,
444"apiFramework")},_parseBrowserOptional:function(a){return this._parseFromAttributes(a,"browserOptional")},_parseType:function(a){return this._parseFromAttributes(a,"type")},_parseFromAttributes:function(a,c){return(a=a["@attributes"])&&void 0!=a[c]?a[c]:""}};a.RenditionSelector=function(a,c,d,e){this._targetByterate=a;this._arWeight=c;this._pxWeight=d;this._conversionFactor=e};a.RenditionSelector.prototype={getBestFitRendition:function(b,c,d){var e=this;b.reverse();b=b.filter(function(b){return b&&
445b.getPrimaryCreativeRenditionAsset()&&(b.getPrimaryCreativeRenditionAsset().getProxiedUrl()||b.getPrimaryCreativeRenditionAsset().getContent())&&a.Util.canPlayVideoType(b.getPrimaryCreativeRenditionAsset().getMimeType())});var f=b.filter(function(b){return b&&a.Util.isMimeTypeHls(b.getPrimaryCreativeRenditionAsset().getMimeType())});if(0<f.length)return f.sort(function(a,b){return e.compareVisualMetrics(a,b,c,d)}).pop();b.sort(function(a,b){return a.getBitrate()-b.getBitrate()});return b.length?this._getBitRateFilteredRenditions(b,
446c,d,e):null},getCustomPlayerBestFitRendition:function(a,c,d){a.reverse();a=a.filter(function(a){return a&&a.getPrimaryCreativeRenditionAsset()&&(a.getPrimaryCreativeRenditionAsset().getProxiedUrl()||a.getPrimaryCreativeRenditionAsset().getContent())}).sort(function(a,b){return a.getBitrate()-b.getBitrate()});return a.length?this._getBitRateFilteredRenditions(a,c,d,this):null},_getBitRateFilteredRenditions:function(a,c,d,e){var b=Number.MAX_VALUE,k=a.filter(function(a){a=a.getBitrate();b=a<b?a:b;return a<=
447e._targetByterate});k.length||(k=a.filter(function(a){return a.getBitrate()<=b}));return k.sort(function(a,b){return e.compareVisualMetrics(a,b,c,d)}).pop()},getBestDashRendition:function(a,c,d){var b=this;a.reverse();return a.sort(function(a,e){return b.compareVisualMetrics(a,e,c,d)})[a.length-1]},compareVisualMetrics:function(a,c,d,e){var b=this.calculateVisualRatios(a.getWidth(),a.getHeight(),d,e);e=this.calculateVisualRatios(c.getWidth(),c.getHeight(),d,e);return!b&&e?-1:b&&!e?1:b&&e&&(d=this._conversionFactor*
448this._arWeight*Math.log(e.arRatio),e=this._pxWeight*Math.log(e.pixelation),b=this.findDistance(this._conversionFactor*this._arWeight*Math.log(b.arRatio),this._pxWeight*Math.log(b.pixelation),0,0),d=this.findDistance(d,e,0,0),d!==b)?d-b:a.getPreference()-c.getPreference()},calculateVisualRatios:function(a,c,d,e){if(0<a&&0<c&&0<d&&0<e){var b=a/c,k=d/e;b>k?e=d/b:d=e*b;return{arRatio:b/k,pixelation:a*c/(d*e)}}return null},findDistance:function(a,c,d,e){return isNaN(a)||isNaN(d)||isNaN(c)||isNaN(e)?NaN:
449Math.sqrt(Math.pow(d-a,2)+Math.pow(e-c,2))}};a.RenditionSelector.prototype.constructor=a.RenditionSelector;a.SkippableAdExtension=function(){this._skipButton=this._currentPlayingAd=this._context=null;this._onAdInitiated=this._onAdInitiated.bind(this);this._adEventListener=this._adEventListener.bind(this);this._onRequestComplete=this._onRequestComplete.bind(this);this._pollForAdProgress=this._pollForAdProgress.bind(this);this._onVideoDisplayBaseChanged=this._onVideoDisplayBaseChanged.bind(this);this._onClick=
450this._onClick.bind(this);this._defaultSkipButtonId="_fw_skipAdButton"};a.SkippableAdExtension.prototype={init:function(b){a.debug("SkippableAdExtension.init(context)");this._context=b;this._context.addEventListener(a.EVENT_REQUEST_COMPLETE,this._onRequestComplete)},_onRequestComplete:function(b){a.Util.getBooleanParameter(a.PARAMETER_EXTENSION_SKIPPABLE_AD_ENABLED,!1)?b.success?this._prepareExtension():a.debug("SkippableAdExtension: request complete failed."):a.debug("SkippableAdExtension: return since SkippableAdExtension is disabled")},
451_prepareExtension:function(){this._context.addEventListener(a.EVENT_VIDEO_DISPLAY_BASE_CHANGED,this._onVideoDisplayBaseChanged);this._context.addEventListener(a.EVENT_AD,this._onAdInitiated);var b=this._context.getParameter(a.PARAMETER_EXTENSION_SKIPPABLE_AD_CONTROL_CLICK_ELEMENT),c=null;b&&(c=document.getElementById(b));c?a.debug("SkippableAdExtension using custom button"):(a.debug("SkippableAdExtension creating button"),c=document.createElement("button"),c.id=this._defaultSkipButtonId,(b=this._context.getParameter(a.PARAMETER_EXTENSION_SKIPPABLE_AD_BUTTON_CLASS))?
452(a.debug("SkippableAdExtension using custom class to style button"),c.className=b):(c.style.bottom="2%",c.style.right="1%",c.style.width="80px",c.style.position="absolute",c.style.backgroundColor="#01020185",c.style.border="none",c.style.color="white",c.style.padding="8px",c.style.textAlign="center",c.style.textDecoration="none",c.style.display="inline-block",c.style.fontSize="16px",c.style.zIndex=9999),this._context._temporalSlotBase.appendChild(c));c.style.visibility="hidden";c.disabled=!0;this._skipButton=
453c},_onAdInitiated:function(b){b.subType===a.EVENT_AD_PREINIT&&b.adInstance&&(b=b.adInstance,-1<b.getSkipOffset()&&(a.debug("SkippableAdExtension._onAdInitiated"),this._context.addEventListener(a.EVENT_AD,this._adEventListener),this._currentPlayingAd=b,0<b.getSkipOffset()&&(this._skipButton.innerHTML=b.getSkipOffset(),this._adProgressPoller
453=setInterval(this._pollForAdProgress,1E3))))},_onVideoDisplayBaseChanged:function(){a.debug("SkippableAdExtension._onVideoDisplayBaseChanged");if(this._skipButton){this._skipButton.parentElement.removeChild(this._skipButton);
454var b=this._context._temporalSlotBase;b&&b.appendChild(this._skipButton)}},_pollForAdProgress:function(){a.debug("SkippableAdExtension._pollForAdProgress");var b=this._currentPlayingAd.getPlayheadTime(),c=this._currentPlayingAd.getSkipOffset();b=Math.round(c-b);0<b&&(this._skipButton.innerHTML=b)},_adEventListener:function(b){b&&b.subType&&(b.subType==a.EVENT_AD_IMPRESSION?this._onAdImpression():b.subType==a.EVENT_AD_SKIPPABLE_STATE_CHANGED?this._onAdSkippableStateChanged():(b.subType==a.EVENT_AD_IMPRESSION_END||
455b.subType==a.EVENT_ERROR)&&this._onAdEnded())},_onAdImpression:function(){a.debug("SkippableAdExtension._onAdImpression");this._skipButton.style.visibility="visible"},_onAdSkippableStateChanged:function(){a.debug("SkippableAdExtension._onAdSkippableStateChanged");if(this._currentPlayingAd.getAdSkippableState()){clearInterval(this._adProgressPoller);this._adProgressPoller=null;var b=this._context.getParameter(a.PARAMETER_EXTENSION_SKIPPABLE_AD_BUTTON_TEXT);b||(b="Skip Ad");this._skipButton.innerHTML=
456b;this._skipButton.addEventListener("click",this._onClick);this._skipButton.disabled=!1}},_onClick:function(){a.debug("SkippableAdExtension._onClick");this._currentPlayingAd.getAdSkippableState()&&this._currentPlayingAd.skip()},_onAdEnded:function(){a.debug("SkippableAdExtension._onAdEnded");null!=this._adProgressPoller&&(clearInterval(this._adProgressPoller),this._adProgressPoller=null);this._skipButton.disabled=!0;this._skipButton.style.visibility="hidden";this._skipButton.removeEventListener("click",
457this._onClick);this._context.removeEventListener(a.EVENT_AD,this._adEventListener);this._currentPlayingAd=null},dispose:function(){a.debug("SkippableAdExtension.dispose()");if(this._context){this._context.removeEventListener(a.EVENT_AD,this._onAdInitiated);this._context.removeEventListener(a.EVENT_REQUEST_COMPLETE,this._onRequestComplete);this._context.removeEventListener(a.EVENT_VIDEO_DISPLAY_BASE_CHANGED,this._onVideoDisplayBaseChanged);if(document.getElementById(this._defaultSkipButtonId)){var b=
458this._context._temporalSlotBase;b&&b.removeChild(this._skipButton)}this._context=null}this._skipButton=null}};a.SkippableAdExtension.prototype.constructor=a.SkippableAdExtension;a.PageSlotScanner=function(a){this.OPTION_INIT=1;this.OPTION_FCAI=2;this.OPTION_NIIC=4;this.OPTION_NOSA=8;this.OPTION_NSIT=16;this._knownSlots=[];this._slots={};this._candidateAds=[];this._slotOptionFound=!1;this._context=a};a.PageSlotScanner.prototype={isSlotDuplicate:function(a){for(var b=0;b<this._knownSlots.length;++b)if(this._knownSlots[b].id===
459a)return!0;return!1},findPageSlotByScope:function(b){var c=b.document;if(c){var d=/(^|\s)_fwph(\s|$)/,e=c.getElementsByTagName("span");b._fw_admanager||(b._fw_admanager={});b._fw_admanager.pageScanState=!0;for(b=0;b<e.length;++b){var f;var k=e[b];if(d.test(k.className)&&(k=k.getAttribute("id"),(f=c.getElementById("_fw_input_"+k))&&!this.isSlotDuplicate(k)&&(f=f.getAttribute("value")))){";"!==f.charAt(f.length-1)&&(f+=";");f=f.split(";");var g=f[f.length-2],m=!1;-1!==g.search("lo=i")&&(m=!0);var h=
460!1;-1!==g.search("prct=")&&(h=!0);0>g.search("flag=")&&(g+="&flag=");0>g.search("ptgt=")&&(g="ptgt=s&"+g);f=[];var l=g.split("&"),p,t;g=!0;for(var v=a.SLOT_OPTION_INITIAL_AD_STAND_ALONE,n=0;n<l.length;++n){var r=l[n].split("=");if(2===r.length){r[1]=decodeURIComponent(r[1]);if("ssct"===r[0])if(h)continue;else h=!0,r[0]="prct";"flag"===r[0]?(-1===r[1].search(/[-\+]cmpn/)&&(r[1]+="+cmpn"),"+"!==r[1].charAt(0)&&"-"!==r[1].charAt(0)&&(r[1]="+"+r[1]),m&&-1===r[1].search("-init")&&(r[1]+="-init"),-1!==
461r[1].search("-nrpl")&&(r[1]=r[1].replace("-nrpl","+cmpn")),-1!==r[1].search("-cmpn")&&(g=!1),v=this._getInitialOption(r[1]),this._slotOptionFound||(v=m?a.SLOT_OPTION_INITIAL_AD_KEEP_ORIGINAL:a.SLOT_OPTION_INITIAL_AD_STAND_ALONE)):"w"===r[0]?p=Number(r[1]):"h"===r[0]?t
461=Number(r[1]):"cana"===r[0]&&this._addCandidateAds(r[1]);r=encodeURIComponent(r[0])+"="+encodeURIComponent(r[1]);f.push(r)}}h||""==this._context.getParameter(a.PARAMETER_PAGE_SLOT_CONTENT_TYPE)||(m=this._context.getParameter(a.PARAMETER_PAGE_SLOT_CONTENT_TYPE)||
462"text/html_doc_lit_mobile,text/html_doc_ref",f.push("prct="+encodeURIComponent(m)));(m=c.getElementById("_fw_container_"+k))?(this._slots[k]=f.join("&")+";",this._knownSlots.push({id:k,width:p,height:t,element:m,acceptCompanion:g,initialAdOption:v})):a.warn("Failed to find container for slot "+k)}}}},scanPageSlots:function(){for(var b=0;b<window.frames.length;++b)try{a.debug("scanPageSlots in frame",b),this.findPageSlotByScope(window.frames[b])}catch(c){a.debug("PageSlotScanner: scanPageSlots exception "+
463c)}try{window.parent&&window.parent!==window&&(a.debug("scanPageSlots in parent frame"),this.findPageSlotByScope(window.parent))}catch(c){a.debug("PageSlotScanner: scanPageSlots exception "+c)}try{a.debug("scanPageSlots in current window"),this.findPageSlotByScope(window)}catch(c){a.debug("PageSlotScanner: scanPageSlots exception "+c)}},slotsToTypeBStr:function(){var a="",c;for(c in this._slots)if(this._slots.hasOwnProperty(c)){var d=this._slots[c];-1===d.search("slid=")&&(d="slid="+encodeURIComponent(c)+
464"&"+d);a+=d;";"!==a.charAt(a.length-1)&&(a+=";")}a&&(a=a.substring(0,a.length-1));return a},_addCandidateAds:function(a){a=a.split(",");for(var b=0;b<a.length;b++){var d=parseInt(a[b],10);0<d&&this._candidateAds.push(d)}},_parseFlags:function(a){var b=[],d=[],e="",f=!0;a+="+";for(var k=0;k<a.length;++k){var g=a.charAt(k);switch(g){case "+":case "-":""!==e&&((f?b:d).push(e),e="");f="+"===g;break;default:e+=g}}return[b,d]},_getInitialOption:function(b){var c=!0,d=!1,e=0;b=this._parseFlags(b);for(var f=
465a.SLOT_OPTION_INITIAL_AD_STAND_ALONE,k=0;k<b.length;++k)for(var g=0;g<b[k].length;++g)switch(b[k][g].toString().toLowerCase()){case "cmpn":c=0===k;break;case "nrpl":c=0!==k;break;case "init":e=0===k?e&~this.OPTION_INIT:e|this.OPTION_INIT;d=!0;break;case "fcai":e=0===k?e|this.OPTION_FCAI:e&~this.OPTION_FCAI;d=!0;break;case "niic":e=0===k?e|this.OPTION_NIIC:e&~this.OPTION_NIIC;d=!0;break;case "nosa":e=0===k?e|this.OPTION_NOSA:e&~this.OPTION_NOSA;d=!0;break;case "nsit":e=0===k?e|this.OPTION_NSIT:e&~this.OPTION_NSIT,
466d=!0}a.debug("PageSlotScanner: _getInitialOption: acceptCompanion = "+c);switch(e){case 0:d&&(f=a.SLOT_OPTION_INITIAL_AD_STAND_ALONE);break;case 1:f=a.SLOT_OPTION_INITIAL_AD_KEEP_ORIGINAL;break;case 3:f=a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_ONLY;break;case 2:f=a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_OR_STAND_ALONE;break;case 6:f=a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_THEN_STAND_ALONE;break;case 8:f=a.SLOT_OPTION_INITIAL_AD_NO_STAND_ALONE;break;case 10:f=a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_OR_NO_STAND_ALONE;
467break;case 16:f=a.SLOT_OPTION_INITIAL_AD_NO_STAND_ALONE_IF_TEMPORAL;break;case 18:f=a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_OR_NO_STAND_ALONE_IF_TEMPORAL;break;default:f=a.SLOT_OPTION_INITIAL_AD_STAND_ALONE}this._slotOptionFound=d;return f}};a.PageSlotScanner.prototype.constructor=a.PageSlotScanner;a.DisplayRefreshExtension=function(){this.REFRESH_TYPE_NONE="refresh_none";this.REFRESH_TYPE_AD="refresh_ad";this.REFRESH_TYPE_TIME="refresh_time";this.REPLACE_TYPE_NONE="replace_none";this.REPLACE_TYPE_BLANK=
468"replace_blank";this.REPLACE_TYPE_AD="replace_ad";this._subContext=null;this._displaySlots=[];this._companionSlots=[];this._keyValues=[];this._globalParameters=[];this._overrideParameters=[];this._refreshType=this.REFRESH_TYPE_NONE;this._replaceType=this.REPLACE_TYPE_NONE;this._refreshInterval=0;this._refreshTimer=null;this._firstTemporalAd=!0;this._REQUEST_TIME_OUT=5};a.DisplayRefreshExtension.prototype={init:function(b){this._context=b;a.debug("DisplayRefreshExtension.init(context)");this._onRendererEvent=
469a.Util.bind(this,function(b){a.debug("DisplayRefreshExtension._onRendererEvent()");b.subType===a.EVENT_AD_IMPRESSION&&this._onAdStarted(b)});this._onSlotEnded=a.Util.bind(this,function(b){var c=b.slot.getTimePositionClass();b=b.slot;a.debug("DisplayRefreshExtension._onSlotEnded()",b,c);if(null!=b&&c!==a.TIME_POSITION_CLASS_DISPLAY&&0!==b.getAdInstances().length)if(this._refreshType===this.REFRESH_TYPE_AD)this._resetSubContext(),this._refreshSlots(this._displaySlots);else if(this._refreshType===this.REFRESH_TYPE_TIME){this._resetSubContext();
470this._refreshSlots(this._displaySlots);var e=this;this._refreshTimer=setInterval(function(){a.debug("DisplayRefreshExtension._onTimeout()");e._resetSubContext();e._refreshSlots(e._displaySlots)},1E3*this._refreshInterval)}});this._onRequestComplete=a.Util.bind(this,function(b){a.debug("DisplayRefreshExtension._onRequestComplete()");if(b.success){switch(this._context.getParameter("refreshType")){case "ad":this._refreshType=this.REFRESH_TYPE_AD;break;case "time":this._refreshInterval=this._context.getParameter("refreshInterval");
471this._refreshType=0<this._refreshInterval?this.REFRESH_TYPE_TIME:this.REFRESH_TYPE_NONE;break;default:this._refreshType=this.REFRESH_TYPE_NONE}switch(this._context.getParameter("replaceMissingCompanion")){case "blank":this._replaceType=this.REPLACE_TYPE_BLANK;break;case "ad":this._replaceType=this.REPLACE_TYPE_AD;break;default:this._replaceType=this.REPLACE_TYPE_NONE}if(this._refreshType!==this.REFRESH_TYPE_NONE||this._replaceType!==this.REPLACE_TYPE_NONE){if(this._displaySlots=this._context.getSlotsByTimePositionClass(a.TIME_POSITION_CLASS_DISPLAY),
472this._companionSlots=this._displaySlots.filter(function(a){return a.getAcceptCompanion()}),this._keyValues=this._context._adRequest._keyValues,this._globalParameters=this._context._globalLevelParameterDictionary,this._overrideParameters=this._context._overrideLevelParameterDictionary,this._firstTemporalAd=!0,this._context.addEventListener(a.EVENT_AD,this._onRendererEvent),this._context.addEventListener(a.EVENT_SLOT_ENDED,this._onSlotEnded),this._refreshType===this.REFRESH_TYPE_TIME){var c=this;this._refreshTimer=
473setInterval(function(){a.debug("DisplayRefreshExtension._onTimeout()");c._resetSubContext();c._refreshSlots(c._displaySlots)},1E3*this._refreshInterval)}}else this._refreshTimer&&clearInterval(this._refreshTimer)}else a.debug("DisplayRefreshExtension: request complete failed")});this._context.addEventListener(a.EVENT_REQUEST_COMPLETE,this._onRequestComplete)},_resetSubContext:function(){a.debug("DisplayRefreshExtension._resetSubContext()");this._subContext=this._context._adManager.cloneContext(this._context);
474this._subContext._extensionManager._displayRefreshExtension.dispose();this._subContext._extensionManager._videoStateExtension.dispose();this._subContext.setCapability(a.CAPABILITY_SLOT_TEMPLATE,a.CAPABILITY_STATUS_OFF);this._subContext.setCapability(a.CAPABILITY_DISPLAY_REFRESH,a.CAPABILITY_STATUS_ON);this._playRefreshedSlots=a.Util.bind(this,function(b){a.debug("DisplayRefreshExtension._playRefreshedSlots()");if(b.success){b=this._subContext.getSlotsByTimePositionClass(a.TIME_POSITION_CLASS_DISPLAY);
475for(var c=0;c<b.length;c++)b[c].play()}else a.debug("DisplayRefreshExtension._playRefreshedSlots(): subContext refresh request error:",b)});this._subContext.addEventListener(a.EVENT_REQUEST_COMPLETE,this._playRefreshedSlots);for(var b=this._subContext._adRequest._keyValues,c=0;c<this._keyValues.length;c++)0>b.indexOf(this._keyValues[c])&&b.push(this._keyValues[c]);for(var d in this._globalParameters)this._globalParameters.hasOwnProperty(d)&&this._subContext.setParameter(d,this._globalParameters[d],
476a.PARAMETER_LEVEL_GLOBAL);for(d in this._overrideParameters)this._overrideParameters.hasOwnProperty(d)&&this._subContext.setParameter(d,this._overrideParameters[d],a.PARAMETER_LEVEL_OVERRIDE)},_onAdStarted:function(b){a.debug("DisplayRefreshExtension._onAdStarted()");var c=b.adInstance.getSlot();a.debug("DisplayRefreshExtension._onAdStarted(): slot: ",c," | timePositionClass:",c.getTimePositionClass());if(null!=c&&c.getTimePositionClass()!==a.TIME_POSITION_CLASS_DISPLAY&&(this._resetSubContext(),
477this._refreshTimer&&clearInterval(this._refreshTimer),this._replaceType!==this.REPLACE_TYPE_NONE)){b=b.adInstance;c=c.getAdInstances();for(var d=0;d<c.length;d++)b.getAdId()===c[d].getAdId()&&this._checkMissingCompanionForAd(b)}},_checkMissingCompanionForAd:function(b){a.debug("DisplayRefreshExtension._checkMissingCompanionForAd()",b);var c=this._companionSlots.slice();b=b.getCompanionAdInstances();var d;for(d=0;d<b.length;d++){var e=c.indexOf(b[d].getSlot());-1<e&&c.splice(e,1)}this._firstTemporalAd&&
478(this._firstTemporalAd=!1,c=c.filter(function(b){if(b.getInitialAdOption()!==a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_ONLY&&b.getInitialAdOption()!==a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_OR_STAND_ALONE&&b.getInitialAdOption()!==a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_THEN_STAND_ALONE&&b.getInitialAdOption()!==a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_OR_NO_STAND_ALONE&&b.getInitialAdOption()!==a.SLOT_OPTION_INITIAL_AD_FIRST_COMPANION_OR_NO_STAND_ALONE_IF_TEMPORAL)return a.debug("DisplayRefreshExtension._checkMissingCompanionForAd(): firstCompanionAsInitial false in slot ",
479b.getCustomId()),!0;for(var c=b.getAdInstances(),d=0;d<c.length;d++)if(!c[d].isPlaceholder())return a.debug("DisplayRefreshExtension._checkMissingCompanionForAd(): first companion found in slot ",b.getCustomId()),!1;a.debug("DisplayRefreshExtension._checkMissingCompanionForAd(): firstCompanionAsInitial true, no ad in slot ",b.getCustomId());return!0}));if(this._replaceType===this.REPLACE_TYPE_BLANK)for(d=0;d<c.length;d++)c[d].stop(),this._subContext._replacePageSlot(c[d].getCustomId(),"");else this._replaceType===
480this.REPLACE_TYPE_AD&&this._refreshSlots(c)},_refreshSlots:function(b){a.debug("DisplayRefreshExtension._refreshSlots()",b);if(null!=b&&0!==b.length){for(var c=0;c<b.length;c++)b[c].stop(),this._subContext._refreshSlots.push(b[c].getCustomId());this._subContext._isRefreshRequest=!0;this._subContext.submitRequest(this._REQUEST_TIME_OUT)}},dispose:function(){a.debug("DisplayRefreshExtension.dispose()");this._context&&(this._context.removeEventListener(a.EVENT_REQUEST_COMPLETE,this._onRequestComplete),
481this._context.removeEventListener(a.EVENT_SLOT_ENDED,this._onSlotEnded),this._context.removeEventListener(a.EVENT_AD,this._onRendererEvent),this._context=null);this._subContext&&(this._subContext.removeEventListener(a.EVENT_REQUEST_COMPLETE,this._playRefreshedSlots),this._subContext=null);this._displaySlots=[];this._companionSlots=[];this._keyValues=[];this._globalParameters=[];this._overrideParameters=[];this._refreshType=this.REFRESH_TYPE_NONE;this._replaceType=this.REPLACE_TYPE_NONE;this._refreshInterval=
4820;this._refreshTimer&&clearInterval(this._refreshTimer);this._refreshTimer=null;this._firstTemporalAd=!0}};a.DisplayRefreshExtension.prototype.constructor=a.DisplayRefreshExtension;a.Ad=function(){this._id=null;this._creatives=[];this._noLoad=!1;this._soAdUnit=null;this._isRequiredToShow=!1};a.Ad.prototype={isRequiredToShow:function(){return this._isRequiredToShow},parse:function(b){if(b){this._id=b.adId||null;this._noLoad=b.noLoad;this._soAdUnit=b.adUnit;b.hasOwnProperty("required")&&(this._isRequiredToShow=
483b.required);var c=0;for(b=b.creatives||[];c<b.length;c++){var d=b[c],e=new a.Creative;e.parse(d);this._creatives.push(e)}}},getSoAdUnit:function(){return this._soAdUnit},getId:function(){return this._id},getNoLoad:function(){return this._noLoad},getCreative:function(a){for(var b=0;b<this._creatives.length;b++)if(this._creatives[b].getId()===a)return this._creatives[b];return null},addCreativeRendition:function(){var b=new a.Creative;this._creatives.push(b);return b}};a.Ad.prototype.constructor=a.Ad;
484a.Creative=function(){this._duration=this._baseUnit=this._id=null;this._parameters={};this._creativeRenditions=[]};a.Creative.prototype={getId:function(){return this._id},getBaseUnit:function(){return this._baseUnit},getDuration:function(){return this._duration},getParameter:function(a){return this._parameters[a]},setParameter:function(a,c){null==c?delete this._parameters[a]:this._parameters[a]=c},parse:function(b){if(b){this._id=b.creativeId||null;this._baseUnit=b.baseUnit||null;this._duration=1*
485b.duration;if(b.parameters)if(b.parameters.constructor===Array)for(var c=0,d=b.parameters||[];c<d.length;c++){var e=d[c];this._parameters[e.name]=e.value}else"object"===typeof b.parameters&&(this._parameters=a.Util.copy(b.parameters));c=0;for(d=b.creativeRenditions||[];c<d.length;c++){e=d[c];b=new a.CreativeRendition;b.parse(e);b.setDuration(this._duration);b.setBaseUnit(this._baseUnit);for(var f in this._parameters)this._parameters.hasOwnProperty(f)&&b.setParameter(f,this._parameters[f]);this._creativeRenditions.push(b)}}},
486getAllCreativeRenditions:function(){return this._creativeRenditions},addCreativeRendition:function(a){this._creativeRenditions.push(a)},getEligibleCreativeRenditionsForAdInstance:function(a){var b=[],d=[],e;for(e=0;e<this._creativeRenditions.length;e++){var f=this._creativeRenditions[e];f.getId()===a._creativeRenditionId&&f.getReplicaId()===a._replicaId&&b.push(f);""===f.getReplicaId()&&d.push(f)}return 0===b.length?d:b},cloneForTranslation:function(){var b=new a.Creative;b.parse({creativeId:this._id,
487baseUnit:this._baseUnit,duration:this._duration,parameters:a.Util.copy(this._parameters)});return b}};a.Creative.prototype.constructor=a.Creative;a.CreativeRendition=function(){this._id=null;this._creativeApi="None";this._baseUnit=null;this._replicaId="";this._bitrate=this._height=this._width=this._preference=this._originalVastWrapperUrl=this._wrapperUrl=this._wrapperType=this._contentType=null;this._parameters={};this._primaryCreativeRenditionAsset=null;this._otherCreativeRenditionAssets=[];this._simidVariableDurationAllowed=
488this._simidCreativeUrl=this._universalAdId=this._duration=null};a.CreativeRendition.prototype={getId:function(){return this._id},getCreativeApi:function(){return this._creativeApi},setCreativeApi:function(a){this._creativeApi=a||"None"},getReplicaId:function(){return this._replicaId},getContentType:function(){return this._contentType?this._contentType:this._primaryCreativeRenditionAsset&&this._primaryCreativeRenditionAsset.getContentType()?this._primaryCreativeRenditionAsset.getContentType():null},
489setContentType:function(a){this._contentType=a},getWrapperType:function(){return this._wrapperType},setWrapperType:function(a){this._wrapperType=a},getWrapperUrl:function(){return this._wrapperUrl},setWrapperUrl:function(a){this._wrapperUrl=a},getOriginalVastWrapperUrl:function(){return this._originalVastWrapperUrl},setOriginalVastWrapperUrl:function(a){this._originalVastWrapperUrl=a},getBaseUnit:function(){return this._baseUnit},setBaseUnit:function(a){this._baseUnit=a},getPreference:function(){return this._preference},
490setPreference:function(a){this._preference=a},getWidth:function(){return this._width}
490,setWidth:function(a){this._width=a},getHeight:function(){return this._height},setHeight:function(a){this._height=a},getDuration:function(){return this._duration},setDuration:function(a){this._duration=a},getParameter:function(a){return this._parameters[a]},setParameter:function(a,c){null==c?delete this._parameters[a]:this._parameters[a]=c},getUniversalAdId:function(){return this._universalAdId},setUniversalAdId:function(a){this._universalAdId=
491a},getSimidCreativeUrl:function(){return this._simidCreativeUrl},setSimidCreativeUrl:function(a){this._simidCreativeUrl=a},getSimidVariableDurationAllowed:function(){return this._simidVariableDurationAllowed},setSimidVariableDurationAllowed:function(a){this._simidVariableDurationAllowed="true"===a},getPrimaryCreativeRenditionAsset:function(){return this._primaryCreativeRenditionAsset},getOtherCreativeRenditionAssets:function(){return this._otherCreativeRenditionAssets.slice()},addCreativeRenditionAsset:function(b,
492c){var d=new a.CreativeRenditionAsset;d.setName(b);c?this._primaryCreativeRenditionAsset=d:this._otherCreativeRenditionAssets.push(d);return d},getBitrate:function(){var a=this._duration,c=this._primaryCreativeRenditionAsset._bytes;return c&&a&&!isNaN(c)&&!isNaN(a)&&0<c&&0<a?8*c/1E3/a:0<this._bitrate?this._bitrate:-1},parse:function(b){if(b){this._id=b.creativeRenditionId||null;this._creativeApi=b.creativeApi||"None";this._replicaId=b.hasOwnProperty("adReplicaId")?b.adReplicaId:"";this._contentType=
493b.contentType||null;this._wrapperType=b.wrapperType||null;this._wrapperUrl=b.wrapperUrl||null;this._preference=1*b.preference;this._width=1*b.width;this._height=1*b.height;this._bitrate=b.hasOwnProperty("bitrate")?1*b.bitrate:null;for(var c,d=0,e=b.parameters||[];d<e.length;d++)c=e[d],this._parameters[c.name]=c.value;this._primaryCreativeRenditionAsset=new a.CreativeRenditionAsset;this._primaryCreativeRenditionAsset.parse(b.asset);d=0;for(e=b.otherAssets||[];d<e.length;d++)c=e[d],b=new a.CreativeRenditionAsset,
494b.parse(c),this._otherCreativeRenditionAssets.push(b)}}};a.CreativeRendition.prototype.constructor=a.CreativeRendition;a.CreativeRenditionAsset=function(){this._bytes=this._mimeType=this._contentType=this._content=this._proxiedUrl=this._url=this._name=this._id=null};a.CreativeRenditionAsset.prototype={getName:function(){return this._name},setName:function(a){this._name=a},getUrl:function(){return this._url},getProxiedUrl:function(){return this._proxiedUrl},setUrl:function(b){this._url=b;this._proxiedUrl=
495a.Util.transformCreativeUrlToProxy(this._url)},getContent:function(){return this._content},setContent:function(a){this._content=a},getContentType:function(){return this._contentType},setContentType:function(a){this._contentType=a},getMimeType:function(){return this._mimeType},setMimeType:function(a){this._mimeType=a},getBytes:function(){return this._bytes},setBytes:function(a){this._bytes=a},parse:function(b){b&&(this._id=b.id||null,this._name=b.name||null,this._url=b.url||null,this._proxiedUrl=a.Util.transformCreativeUrlToProxy(this._url),
496this._content=b.content||null,this._contentType=b.contentType||null,this._mimeType=b.mimeType||null,this._bytes=1*b.bytes)}};a.CreativeRenditionAsset.prototype.constructor=a.CreativeRenditionAsset;a.AdManager=function(b){var c=this;this._context=this.newContext();this._context.addEventListener(a.EVENT_REQUEST_COMPLETE,function(a){c.onRequestComplete(a)});this._networkId=this._serverURL="";this._location=null;if(b){var d=a.Util.validateJSON(b,{adNetworkID:{allowedTypes:["number","string"]},adProfileID:{allowedTypes:["string"]},
497adServerUrl:{allowedTypes:["string"]},adSiteSectionID:{allowedTypes:["string"]},adAssetNetworkID:{allowedTypes:["number","string"],isOptional:!0},adOptOut:{allowedTypes:["number","boolean"],isOptional:!0},appBundleID:{allowedTypes:["string"],isOptional:!0},appName:{allowedTypes:["string"],isOptional:!0},appVersion:{allowedTypes:["string"],isOptional:!0},authenticationEntity:{allowedTypes:["string"],isOptional:!0},coppa:{allowedTypes:["string"],isOptional:!0},deviceAdAttributes:{allowedTypes:["string"],
498isOptional:!0},distributorAppID:{allowedTypes:["string"],isOptional:!0},ifa:{allowedTypes:["string"],isOptional:!0},ifaValue:{allowedTypes:["string"],isOptional:!0},privacyData:{allowedTypes:["string"],isOptional:!0}},"adConfig");if(d)throw b="Unable to initialize AdManager instance. "+d.message,a.warn(b),Error(b);this._adConfig=Object.assign({},b);"boolean"===typeof b.adOptOut&&(this._adConfig.adOptOut=Number(b.adOptOut));"string"===typeof b.adNetworkID&&(this._adConfig.adNetworkID=Number(b.adNetworkID));
499"string"===typeof b.adAssetNetworkID&&(this._adConfig.adAssetNetworkID=Number(b.adAssetNetworkID));this.setNetwork(b.adNetworkID);b=b.adServerUrl;b.startsWith("https://")||b.startsWith("http://")||(b="https://"+b);this.setServer(b)}this._consentManager=new a.ConsentManager;this._permissionsCheck=0;this._permissionsCheckExecuted=!1;this._checkPermissions()};a.AdManager.prototype={getVersion:function(){if(a.version){var b=a.version.match(/^js-(\d)\.(\d)\.(\d).(\d)/)||a.version.match(/^js-(\d)\.(\d)\.(\d)/)||
500a.version.match(/^js-(\d)\.(\d)/);if(null!=b&&0<b.length){for(var c=0,d=0;d<b.length-1;d++)c+=b[b.length-d-1]<<(d<<3);return c}if(0===a.version.indexOf("js-master"))return 4294967295}return 0},getOMSDKLibraryVersion:function(){return a.OMSDK_LIBRARY_VERSION},getOMSDKPartnerVersion:function(){var b=a.version.match(/^js-(\d+(?:\.\d+)+)/);return b&&0<b.length?b[1]:"0.0.0"},setNetwork:function(b){a.debug("AdManager.setNetwork("+Array.prototype.slice.call(arguments).join(",")+")");if(0<1*b){this._networkId=
5011*b;for(var c in a._instanceQueue)if(a._instanceQueue.hasOwnProperty(c)){var d=a._instanceQueue[c];d&&d._videoAsset&&d._videoAsset._videoPlayPending&&d._videoAsset.play()}}else a.warn("AdManager.setNetwork","valid networkId required")},setServer:function(b){a.debug("AdManager.setServer("+Array.prototype.slice.call(arguments).join(",")+")");if(b&&"string"===typeof b){this._serverURL=b;
501for(var c in a._instanceQueue)if(a._instanceQueue.hasOwnProperty(c)){var d=a._instanceQueue[c];d&&d._videoAsset&&d._videoAsset._videoPlayPending&&
502d._videoAsset.play()}}else a.warn("AdManager.setServer","server url required")},setLocation:function(b){a.debug("AdManager.setLocation("+Array.prototype.slice.call(arguments).join(",")+")");this._location=b},newContext:function(b,c){a.debug("AdManager.newContext("+Array.prototype.slice.call(arguments).join(",")+")");var d=this._validateVideoConfig(b,c);if(0<d.length)throw d="Unable to initialize Context instance."+d,a.warn(d),Error(d);return new a.Context(this,b,c)},_validateVideoConfig:function(b,
503c){var d=[];b&&!this._adConfig?d.push("A videoConfig object should only be used to initialize Context when AdManager was initialized with an adConfig object."):!b&&this._adConfig?d.push("A videoConfig object is required to initialize Context when AdManager was initialized with an adConfig object."):b&&(((b=a.Util.validateJSON(b,{mode:{validationFunction:function(a){return a&&("live"===a.toLowerCase()||"on-demand"===a.toLowerCase())}},duration:{allowedTypes:["number"]},customID:{allowedTypes:["string"]},
504language:{allowedTypes:["string"],isOptional:!0},genre:{allowedTypes:["string"],isOptional:!0},brand:{allowedTypes:["string"],isOptional:!0},rating:{allowedTypes:["string"],isOptional:!0},provider:{allowedTypes:["string"],isOptional:!0},title:{allowedTypes:["string"],isOptional:!0},series:{allowedTypes:["string"],isOptional:!0},autoPlay:{allowedTypes:["boolean"],isOptional:!0},idType:{isOptional:!0,validationFunction:function(b){return b===a.ID_TYPE_CUSTOM||b===a.ID_TYPE_FW||b===a.ID_TYPE_GROUP}},
505durationType:{isOptional:!0,validationFunction:function(b){return b&&(b.toLowerCase()===a.VIDEO_ASSET_DURATION_TYPE_EXACT||b.toLowerCase()===a.VIDEO_ASSET_DURATION_TYPE_VARIABLE)}},fallbackId:{allowedTypes:["number","string"],isOptional:!0},location:{allowedTypes:["string"],isOptional:!0}},"videoConfig"))&&d.push(b.message),c)?"string"!==typeof c&&"object"!==typeof c?d.push("The player argument is the incorrect type. It should either be a string or an object."):"object"===typeof c&&(b=a.Util.validateCustomPlayer(c))&&
506d.push(b.message):d.push("No player argument was passed. The player argument is required when using a videoConfig object."));return a.Util.arrayToString(d)},newContextWithContext:function(b){a.debug("AdManager.newContextWithContext("+Array.prototype.slice.call(arguments).join(",")+")");var c=this.cloneContext(b);c._temporalSlotBase=b._temporalSlotBase;b.getContentVideoElement()&&(c.setContentVideoElement(b.getContentVideoElement()),delete c._temporalSlotBase["_fw_contentVideo_"+b._instanceId]);c._videoDisplaySize=
507b._videoDisplaySize;c._overriddenAdRenderers=b._overriddenAdRenderers;c._currentContentPlayheadTime=b._currentContentPlayheadTime;c.startSubsession(b._adRequest._subsessionToken);c.setRequestMode(b._adRequest._requestMode);c._adRequest._compatibleDimensions=b._adRequest._compatibleDimensions;c._adRequest._keyValues=b._adRequest._keyValues;c._videoAsset._state=b._videoAsset._state;c._videoAsset._callbackTimer=b._videoAsset._callbackTimer;c._videoAsset._videoPlayPending=b._videoPlayPending;c._videoAsset._requestedVideoViewUrl=
508b._videoAsset._requestedVideoViewUrl;c._videoAsset._delay=b._videoAsset._delay;c._videoAsset._durationType=b._videoAsset._durationType;b._customPlayer&&(c._customPlayer=b._customPlayer);var d=b._extensionManager.extensions,e;for(e in d)d.hasOwnProperty(e)&&c.loadExtension(d[e]);return this._context=c},_checkPermissions:function(){navigator.permissions&&"undefined"!=typeof Notification&&Notification.permission?navigator.permissions.query({name:"notifications"}).then(function(a){this._permissionsCheckExecuted=
509!0;this._permissionsCheck="denied"===Notification.permission&&"prompt"===a.state?0:1}.bind(this)):this._permissionsCheckExecuted=!0},dispose:function(){a.debug("AdManager.dispose()");this._context.dispose();this._consentManager.dispose();this._consentManager=null},cloneContext:function(b){var c=new a.Context(this),d=b._adRequest._capabilities._capabilities,e;
509for(e in d)d.hasOwnProperty(e)&&c.setCapability(e,d[e]);c.setProfile(b._adRequest._playerProfile);c.setSiteSection(b._ss_id,b._ss_networkId,
510b._ss_pageViewRandom,b._ss_idType,b._ss_fallbackId);c.setVideoAsset(b._va_id,b._va_duration,b._va_networkId,b._va_location,b._va_autoPlayType,b._va_viewRandom,b._va_idType,b._va_fallbackId,b._va_durationType);c.setVisitor(b._adRequest._visitorCustomId,b._adRequest._visitorIpV4Address);return c},_isTCFAPIExecuted:function(){return this._consentManager.isTCFAPIExecuted()},_isUSPAPIExecuted:function(){return this._consentManager.isUSPAPIExecuted()},_isGPPExecuted:function(){return this._consentManager.isGPPExecuted()},
511_getConsentValues:function(){return{gdpr:this._consentManager.getGDPRValues(),uspString:this._consentManager.getUSPString(),gpp:this._consentManager.getGPPValues()}}};a.AdManager.prototype.constructor=a.AdManager;a._instanceCounter=0;a._instanceQueue={};a.Context=function(b,c,d){this._adManager=b;this._eventDispatcher=new a.EventDispatcher;this._adRequest=new a.AdRequest(this);this._adResponse=null;this._videoAsset=new a.VideoAsset(this);this._customPlayer=this._temporalSlotBase=null;this._videoDisplaySize=
512{};this._globalLevelParameterDictionary={};this._overrideLevelParameterDictionary={};this._globalLevelParameterDictionary[a.PARAMETER_AUTO_PAUSE_AD_ONVISIBILITYCHANGE]=!0;this._globalLevelParameterDictionary[a.PARAMETER_DISABLE_CORS_ENFORCEMENT]=!0;this._globalLevelParameterDictionary[a.PARAMETER_USE_GDPR_TCFAPI]=!0;this._globalLevelParameterDictionary[a.PARAMETER_USE_CCPA_USPAPI]=!0;this._globalLevelParameterDictionary[a.PARAMETER_USE_GPP]=!0;this._globalLevelParameterDictionary[a.PARAMETER_CONSENT_RETRIEVAL_TIMEOUT]=
513500;this._globalLevelParameterDictionary[a.PARAMETER_ENABLE_ACCESS_CONTROL_ALLOW_CREDENTIALS]=!1;a.Util.setContext(this);this._rendererManifest={};this._overriddenAdRenderers=[];this._extensionManager=new a.ExtensionManager(this);this._totalSetDisplaySizeCount=this._autoSetDisplaySizeCount=this._requestState=0;this._instanceId=a._instanceCounter;a._instanceQueue["Context_"+a._instanceCounter]=this;a._instanceCounter++;this._contentVideoAttached=!1;this._currentContentPlayheadTime=0;this._ss_id="";
514this._ss_networkId=this._ss_pageViewRandom=0;this._ss_idType=a.ID_TYPE_CUSTOM;this._va_location=this._va_networkId=this._va_duration=this._va_id=this._ss_fallbackId="";this._va_autoPlayType=a.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED;this._va_fallbackId="";this._va_viewRandom=0;this._va_idType=a.ID_TYPE_CUSTOM;this._va_durationType=a.VIDEO_ASSET_DURATION_TYPE_EXACT;this._isRefreshRequest=!1;this._refreshSlots=[];this._adVolume=1;this._onVolumeChange=this.__onVolumeChange.bind(this);this._breakSequence=
515this._airingStartTime=0;if(c){b=b._adConfig;this.setProfile(b.adProfileID);var e=b.adNetworkID;b.adAssetNetworkID&&(e=b.adAssetNetworkID);var f=null;!1===c.autoPlay?f=a.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE:!0===c.autoPlay&&(f=a.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED);var k=this._va_idType;null!=c.idType&&(k=c.idType);var g=this._va_durationType;null!=c.durationType&&(g=c.durationType.toLowerCase());var m=a.Util.getFixedDigitRandomNumber(8);this.setVideoAsset(c.customID,c.duration,e,c.location,f,m,k,c.fallbackId,
516g);e=a.Util.getFixedDigitRandomNumber(8);this.setSiteSection(b.adSiteSectionID,b.adNetworkID,e);this.setRequestMode(c.mode.toLowerCase());"object"===typeof d?this._registerCustomPlayer(d):this.registerVideoDisplayBase(d);this.addKeyValue("_fw_content_id",c.customID);null!=c.language&&this.addKeyValue("_fw_content_language",c.language);null!=c.genre&&this.addKeyValue("_fw_content_genre",c.genre);null!=c.brand&&this.addKeyValue("_fw_content_programmer_brand",c.brand);null!=c.rating&&this.addKeyValue("_fw_content_rating",
517c.rating);null!=c.provider&&this.addKeyValue("_fw_content_provider",c.provider);null!=c.title&&this.addKeyValue("_fw_content_title",c.title);null!=c.series&&this.addKeyValue("_fw_content_series",c.series);null!=b.appBundleID&&this.addKeyValue("_fw_app_bundle",b.appBundleID);null!=b.appName&&this.addKeyValue("_fw_app_name",b.appName);null!=b.appVersion&&this.addKeyValue("_fw_app_version",b.appVersion);null!=b.authenticationEntity&&this.addKeyValue("_fw_ae",b.authenticationEntity);null!=b.coppa&&this.addKeyValue("_fw_coppa",
518b.coppa);null!=b.deviceAdAttributes&&this.addKeyValue("_fw_ad_attributes",b.deviceAdAttributes);null!=b.distributorAppID&&this.addKeyValue("_fw_app_platform",b.distributorAppID);null!=b.ifa&&this.addKeyValue("_fw_ifa",b.ifa);null!=b.ifaValue&&this.addKeyValue("_fw_ifa_value",b.ifaValue);null!=b.adOptOut&&this.addKeyValue("_fw_opt_out",b.adOptOut.toString());if(null!=b.privacyData)try{var h=atob(b.privacyData);a.debug("Context.constructor: Decoded adConfig.privacyData value:",h);this.addKeyValue("_fw_opt_out_data",
519h)}catch(P){a.warn("Context.constructor: An error occurred while decoding adConfig.privacyData:",P)}}};a.Context.prototype={setAiringStartTimeAndBreakSequence:function(b,c){a.debug("Context.setAiringStartTimeAndBreakSequence airingStartTime="+b+" breakSequence="+c);0<b&&0<c?(this._airingStartTime=b,this._breakSequence=c):a.warn("airingStartTime and breakSequence not set because one or both are invalid.")},getAdVolume:function(){return this._adVolume},setAdVolume:function(b){a.debug("Context.setAdVolume",
520b);if(this.getContentVideoElement())if("number"!==typeof b||0>b||1<b)a.debug("Invalid volume: "+b);else if((a.PLATFORM_IS_IPHONE_IPOD||a.PLATFORM_IS_IPAD)&&0<b&&1>b)a.debug("iOS doesn't allow volume values other than 0 and 1, ignore.");
520else if(b===this._adVolume)a.debug("Volume did not change, ignore.");else{this._adVolume=b;b=this.getTemporalSlots();for(var c=0;c<b.length;++c){var d=b[c];if(d.getType()===a.SLOT_TYPE_TEMPORAL&&d.getState()!==a.MediaInitState.instance&&d.getState()!==a.MediaEndState.instance&&
521(d=d.getCurrentAdInstance())){d.setVolume(this._adVolume);break}}}else a.debug("No video element set, ignore.")},__onVolumeChange:function(b){a.debug("Context._onVolumeChange(): event = "+b.type);a.debug("Context._onVolumeChange(): video element is muted: "+this.getContentVideoElement().muted);0!==this._adVolume||this.getContentVideoElement().muted?this.setAdVolume(this.getContentVideoElement().muted?0:this.getContentVideoElement().volume):this.setAdVolume(this.getContentVideoElement().volume)},addRenderer:function(a,
522c,d,e,f,k,g){this._overriddenAdRenderers.push({url:a,baseUnit:c,contentType:d,creativeApi:k,slotType:e,soAdUnit:f,parameter:g})},setCapability:function(b,c){a.debug("Context.setCapability",b,c);this._adRequest.setCapability(b,c)},addKeyValue:function(b,c){a.debug("Context.addKeyValue",b,c);this._adRequest.addKeyValue(b,c)},setParameter:function(b,c,d){a.debug("Context.setParameter",b,c,d);if(d===a.PARAMETER_LEVEL_GLOBAL)d=this._globalLevelParameterDictionary;else if(d===a.PARAMETER_LEVEL_OVERRIDE)d=
523this._overrideLevelParameterDictionary;else return;null==c?delete d[b]:d[b]=c},getParameter:function(a){return a?this._overrideLevelParameterDictionary.hasOwnProperty(a)?this._overrideLevelParameterDictionary[a]:this._adResponse&&this._adResponse._profileParameters.hasOwnProperty(a)?this._adResponse._profileParameters[a]:this._globalLevelParameterDictionary.hasOwnProperty(a)?this._globalLevelParameterDictionary[a]:null:null},setVideoState:function(b){a.debug("Context.setVideoState",b);this._videoAsset&&
524this._videoAsset.setVideoState(b)},registerVideoDisplayBase:function(b){a.debug("Context.registerVideoDisplayBase",b);if(b&&"string"===typeof b){if(this._temporalSlotBase&&this._temporalSlotBase.id===b){a.debug("Context.registerVideoDisplayBase","register the same display base, will only change size");var c=this._temporalSlotBase.getElementsByTagName("video")}else{this._temporalSlotBase&&this.getContentVideoElement().removeEventListener("volumechange",this._onVolumeChange);this._temporalSlotBase=
525document.getElementById(b);if(!this._temporalSlotBase){a.warn("Context.registerVideoDisplayBase","could not get element",b);return}c=this._temporalSlotBase.getElementsByTagName("video");if(0===c.length){a.warn("Context.registerVideoDisplayBase","could not get video element from",b);this._temporalSlotBase=null;return}this._temporalSlotBase["_fw_contentVideo_"+this._instanceId]=c[0];this.getContentVideoElement().addEventListener("volumechange",this._onVolumeChange);this._adVolume=c[0].muted?0:c[0].volume}this._setVideoDisplaySizeByContentVideo(c[0]);
526this.dispatchEvent(a.EVENT_VIDEO_DISPLAY_BASE_CHANGED)}else a.warn("Context.registerVideoDisplayBase","id required")},setContentVideoElement:function(b){a.debug("Context.setContentVideoElement()");if(b&&b.parentNode){var c=this._temporalSlotBase;this._temporalSlotBase=b.parentNode;this._temporalSlotBase["_fw_contentVideo_"+this._instanceId]===b?a.debug("Context.setContentVideoElement","set the same video in same div, will only change size"):(c&&c["_fw_contentVideo_"+this._instanceId]&&c["_fw_contentVideo_"+
527this._instanceId].removeEventListener("volumechange",this._onVolumeChange),this._temporalSlotBase["_fw_contentVideo_"+this._instanceId]=b,this.getContentVideoElement().addEventListener("volumechange",this._onVolumeChange),this._adVolume=this.getContentVideoElement().muted?0:this.getContentVideoElement().volume);this._setVideoDisplaySizeByContentVideo(b)}else a.warn("Context.setContentVideoElement","contentVideo and contentVideo.parentNode is required")},registerCustomPlayer:function(b){a.debug("Context.registerCustomPlayer");
528var c=a.Util.validateCustomPlayer(b);c?a.warn("Context.registerCustomPlayer: "+c.message):this._registerCustomPlayer(b)},_registerCustomPlayer:function(a){this._customPlayer=a;this._videoDisplaySize={left:0,top:0,width:0,height:0,position:0}},getContentVideoElement:function(){return this._temporalSlotBase?this._temporalSlotBase["_fw_contentVideo_"+this._instanceId]:(a.warn("Context.getContentVideoElement: SlotBase is null"),null)},getCustomPlayer:function(){return this._customPlayer?this._customPlayer:
529(a.warn("Context.getCustomPlayer: customPlayer was null"),null)},setVideoDisplaySize:function(b,c,d,e,f){a.debug("Context.setVideoDisplaySize("+Array.prototype.slice.call(arguments).join(",")+")");this._totalSetDisplaySizeCount++;this._videoDisplaySize={left:b,top:c,width:d,height:e,position:f};for(var k=this.getTemporalSlots(),g=0;g<k.length;++g){var h=k[g];h.setWidth(d);h.setHeight(e);if(h.getState()===a.MediaPlayingState.instance||h.getState()===a.MediaReplayingState.instance){if(k=h.getCurrentAdInstance())(k=
530k.getRendererController().getRenderer())&&k.resize?k.resize():a.debug("renderer do not support resize");break}}},getVideoDisplaySize:function(){function a(a){a=parseInt(a,10);isNaN(a)&&(a=0);return a}this._videoDisplaySize.left=a(this._videoDisplaySize.left);this._videoDisplaySize.top=a(this._videoDisplaySize.top);
530this._videoDisplaySize.width=a(this._videoDisplaySize.width);this._videoDisplaySize.height=a(this._videoDisplaySize.height);return this._videoDisplaySize},setVideoDisplayCompatibleSizes:function(b){a.debug("Context.setVideoDisplayCompatibleSizes",
531b);this._adRequest.setVideoDisplayCompatibleSizes(b)},resize:function(b,c){a.debug("Context.resize("+Array.prototype.slice.call(arguments).join(",")+")");if(!this._temporalSlotBase)return a.warn("SlotBase is null"),null;this.setVideoDisplaySize(this._videoDisplaySize.left,this._videoDisplaySize.top,b,c,this._videoDisplaySize.position)},setProfile:function(b){a.debug("Context.setProfile",b);this._adRequest.setProfile(b)},setVideoAsset:function(b,c,d,e,f,k,g,h,l){a.debug("Context.setVideoAsset("+Array.prototype.slice.call(arguments).join(",")+
532")");this._videoAsset.setVideoAsset(b,c,d,e,f,k,g,h,l);this._va_id=b;this._va_duration=c;this._va_networkId=d;this._va_location=e;this._va_autoPlayType=f;this._va_viewRandom=k;this._va_idType=g;this._va_fallbackId=h;this._va_durationType=l},setVideoAssetCurrentTimePosition:function(b){a.debug("Context.setVideoAssetCurrentTimePosition("+b+")");this._videoAsset.setVideoAssetCurrentTimePosition(b)},setSiteSection:function(b,c,d,e,f){a.debug("Context.setSiteSection("+Array.prototype.slice.call(arguments).join(",")+
533")");this._adRequest.setSiteSection(b,c,d,e,f);this._ss_id=b;this._ss_networkId=c;this._ss_pageViewRandom=d;this._ss_idType=e;this._ss_fallbackId=f},setVisitor:function(b,c){a.debug("Context.setVisitor("+Array.prototype.slice.call(arguments).join(",")+")");this._adRequest.setVisitor(b,c)},startSubsession:function(b){a.debug("Context.startSubsession("+b+")");this._adRequest.setSubsessionToken(b)},setRequestMode:function(b){a.debug("Context.setRequestMode("+b+")");this._adRequest.setRequestMode(b)},
534setRequestDuration:function(b){a.debug("Context.setRequestDuration("+b+")");this._adRequest.setRequestDuration(b)},addCandidateAd:function(b){a.debug("Context.addCandidateAd("+b+")");this._adRequest.addCandidateAd(b)},addTemporalSlot:function(b,c,d,e,f,k,g,h,l,p){a.debug("Context.addTemporalSlot("+Array.prototype.slice.call(arguments).join(",")+")");this._adRequest.addTemporalSlot(b,c,d,e,f,k,g,h,l,p)},getTemporalSlots:function(){return this._adResponse?this._adResponse._temporalSlots.slice():[]},
535getSlotByCustomId:function(a){return this._adResponse?this._adResponse.getSlotByCustomId(a):null},getSlotsByTimePositionClass:function(a){var b=[],d;if(this._adResponse){for(d=0;d<this._adResponse._temporalSlots.length;d++)this._adResponse._temporalSlots[d].getTimePositionClass()===a&&b.push(this._adResponse._temporalSlots[d]);for(d=0;d<this._adResponse._siteSectionNonTemporalSlots.length;d++)this._adResponse._siteSectionNonTemporalSlots[d].getTimePositionClass()===a&&b.push(this._adResponse._siteSectionNonTemporalSlots[d]);
536for(d=0;d<this._adResponse._videoPlayerNonTemporalSlots.length;d++)this._adResponse._videoPlayerNonTemporalSlots[d].getTimePositionClass()===a&&b.push(this._adResponse._videoPlayerNonTemporalSlots[d])}return b},_isRequestReady:function(){var b=this.getParameter(a.PARAMETER_USE_GDPR_TCFAPI)&&!this._adManager._isTCFAPIExecuted(),c=this.getParameter(a.PARAMETER_USE_CCPA_USPAPI)&&!this._adManager._isUSPAPIExecuted(),d=this.getParameter(a.PARAMETER_USE_GPP)&&!this._adManager._isGPPExecuted();return!b&&
537!c&&!d&&this._adManager._permissionsCheckExecuted},submitRequest:function(b){a.debug("Context.submitRequest",b);var c=0;if(this._isRequestReady()||this._isRefreshRequest)this._submitValidatedRequest(b);else var d=this.getParameter(a.PARAMETER_CONSENT_RETRIEVAL_TIMEOUT),e=setInterval(function(){c+=100;if(this._isRequestReady()||c>=d)clearInterval(e),this._submitValidatedRequest(b)}.bind(this),100)},_submitValidatedRequest:function(b){this.dispatchEvent(a.EVENT_REQUEST_INITIATED,{});if(this._requestState)a.warn("Context.submitRequest: request already submitted");
538else if(a.Util.isBlank(this._adManager._serverURL))a.warn("Context.submitRequest: serverURL is not set");else{this._requestState=1;this._addConsentValuesToAdRequest();this._adRequest.scanPageSlots();if(this._isRefreshRequest){var c={},d=[],e,f;for(e=0;e<this._refreshSlots.length;e++){var k=this._refreshSlots[e];if(void 0!==this._adRequest._slotScanner._slots[k]){c[k]=this._adRequest._slotScanner._slots[k];var g=c[k].split("&");for(f=0;f<g.length;f++)-1!==g[f].search("flag")&&(g[f]="flag=-cmpn");c[k]=
539g.join("&")}for(f=0;f<this._adRequest._slotScanner._knownSlots.length;f++)this._adRequest._slotScanner._knownSlots[f].id===k&&(g=this._adRequest._slotScanner._knownSlots[f],g.acceptCompanion=!1,g.initialAdOption=a.SLOT_OPTION_INITIAL_AD_STAND_ALONE,d.push(g))}this._adRequest._slotScanner._slots=c;this._adRequest._slotScanner._knownSlots=d}this.getParameter(a.PARAMETER_ENABLE_FORM_TRANSPORT)?(a.debug("Context.submitRequest: enabling Safari transport mechanism globally"),a.PLATFORM_SEND_REQUEST_BY_FORM=
540!0,a.PLATFORM_SEND_REQUEST_BY_JS=!1,this.setParameter(a.PARAMETER_ENABLE_JS_TRANSPORT,!1,a.PARAMETER_LEVEL_GLOBAL)):this.getParameter(a.PARAMETER_ENABLE_JS_TRANSPORT)?(a.debug("Context.submitRequest: enabling JS transport mechanism globally"),a.PLATFORM_SEND_REQUEST_BY_JS=!0,a.PLATFORM_SEND_REQUEST_BY_FORM&&a.warn("PARAMETER_ENABLE_FORM_TRANSPORT was enabled while attempting to use PARAMETER_ENABLE_JS_TRANSPORT. This will prevent PARAMETER_ENABLE_JS_TRANSPORT from working properly. Please disable PARAMETER_ENABLE_FORM_TRANSPORT before attempting to use PARAMETER_ENABLE_JS_TRANSPORT."),
541this.setParameter(a.PARAMETER_ENABLE_FORM_TRANSPORT,!1,a.PARAMETER_LEVEL_GLOBAL)):a.PLATFORM_SEND_REQUEST_BY_JS=!1;c=this._adManager._serverURL;".js"!==c.substring(c.length-3,c.length)&&(c=this._adRequest.generateTypeBRequestUrl());d=function(){1===this._requestState&&(a.warn("Context.submitRequest: request timeout"),this.requestComplete(null))}.bind(this);b&&"number"===typeof b&&0<b&&(a.CONTEXT_REQUEST_TIMEOUT=b);setTimeout(d,1E3*a.CONTEXT_REQUEST_TIMEOUT);a.log("Context.submitRequest: sending request to",
542c,"timeout",a.CONTEXT_REQUEST_TIMEOUT);a.PLATFORM_SEND_REQUEST_BY_FORM?(a.debug("Context.submitRequest:","use json2"),a.Util.pingURLWithForm(c,this._instanceId,!0),this._onMessagePosted=function(a){"object"===typeof a.data&&a.data.hasOwnProperty("cbfn")&&-1<a.data.cbfn.indexOf("['Context_"+this._instanceId+"']")&&this.requestComplete(a.data.response)}.bind(this),window.addEventListener("message",this._onMessagePosted,!1)):a.PLATFORM_SEND_REQUEST_BY_JS?a.Util.sendAdRequestWithXMLHTTPRequest
542(c):a.Util.pingURLWithScript(c)}},
543_addConsentValuesToAdRequest:function(){var b=this._adManager._getConsentValues();this.getParameter(a.PARAMETER_USE_GDPR_TCFAPI)&&this._adRequest.useTCFAPI(b.gdpr);this.getParameter(a.PARAMETER_USE_CCPA_USPAPI)&&this._adRequest.useUSPAPI(b.uspString);this.getParameter(a.PARAMETER_USE_GPP)&&this._adRequest.useGPP(b.gpp)},requestComplete:function(b){if(1!==this._requestState)a.warn("ad request complete after timeout"),this.dispatchEvent(a.EVENT_REQUEST_COMPLETE,{success:!1});else{this._requestState=
5442;a.debug("Context.requestComplete");if(a.PLATFORM_SEND_REQUEST_BY_FORM){window.removeEventListener("message",this._onMessagePosted,!1);var c=document.getElementById("_fw_request_iframe_"+this._instanceId);document.body.removeChild(c)}if(null!=b){a._instanceQueue["Context_"+this._instanceId]=null;this._adResponse=new a.AdResponse(this);this._adResponse.parse(b,this._temporalSlotBase);a.log("Ad request succeeded");if(this._adResponse._profileParameters.autoloadExtensions){c=this._adResponse._profileParameters.autoloadExtensions.split(",");
545for(var d=0;d<c.length;d++){var e=c[d].trim();a.log("Loading extension: "+e);this.loadExtension(e)}}this.dispatchEvent(a.EVENT_REQUEST_COMPLETE,{success:!0,response:b});c=this._adResponse.getSiteSectionNonTemporalSlots();for(b=0;b<c.length;++b)a.log("Auto play site section nonTemporal slots"),c[b].play();c=this._adResponse.getVideoPlayerNonTemporalSlots();for(b=0;b<c.length;++b)a.log("Auto play video player nonTemporal slots"),c[b].play()}else a.warn("Ad request failed"),this.dispatchEvent(a.EVENT_REQUEST_COMPLETE,
546{success:!1})}},addEventListener:function(b,c){a.debug("Context.addEventListener",b);this._eventDispatcher.addEventListener(b,c)},removeEventListener:function(b,c){a.debug("Context.removeEventListener",b);this._eventDispatcher.removeEventListener(b,c)},dispatchEvent:function(b,c){a.log("Context.dispatchEvent type: "+b+", payload: "+c);if(b===a.EVENT_SLOT_STARTED){var d=c.slot.getTimePositionClass();if(d===a.TIME_POSITION_CLASS_PREROLL||d===a.TIME_POSITION_CLASS_MIDROLL||d===a.TIME_POSITION_CLASS_POSTROLL||
547d===a.TIME_POSITION_CLASS_PAUSE_MIDROLL)this._contentVideoAttached=!0,this._markCurrentContentPlayheadTime()}else b===a.EVENT_SLOT_ENDED&&(d=c.slot.getTimePositionClass(),d===a.TIME_POSITION_CLASS_PREROLL||d===a.TIME_POSITION_CLASS_MIDROLL||d===a.TIME_POSITION_CLASS_POSTROLL||d===a.TIME_POSITION_CLASS_PAUSE_MIDROLL)&&(this._contentVideoAttached=!1);c=c||{};c.type=b;c.target=this;this._eventDispatcher.dispatchEvent(c)},dispose:function(){a.debug("Context.dispose");this.setVideoState(a.VIDEO_STATE_STOPPED);
548this._videoAsset=null;if(this._adResponse){if(this._temporalSlotBase||this._customPlayer)for(var b=0,c=this._adResponse._temporalSlots||[];b<c.length;++b){var d=c[b];d.getCurrentAdInstance()&&d.stop();if(d._onContentVideoTimeUpdate&&this._temporalSlotBase){var e=this._temporalSlotBase["_fw_contentVideo_"+this._instanceId];e&&e.removeEventListener("timeupdate",d._onContentVideoTimeUpdate,!1);d._onContentVideoTimeUpdate=null}}this._customPlayer&&(this._customPlayer=null);this._temporalSlotBase&&(this.getContentVideoElement().removeEventListener("volumechange",
549this._onVolumeChange),this._temporalSlotBase["_fw_contentVideo_"+this._instanceId]=null);this._isRefreshRequest=!1;this._refreshSlots=[];this._extensionManager.dispose();this._extensionManager=null}},loadExtension:function(a){this._extensionManager.load(a,this)},_markCurrentContentPlayheadTime:function(){if(this._customPlayer)this._currentContentPlayheadTime=this._customPlayer.getPlayheadTime()||0;else if(this._temporalSlotBase){var a=this._temporalSlotBase["_fw_contentVideo_"+this._instanceId].currentTime;
5500<a&&(this._currentContentPlayheadTime=a)}},_getContentPlayheadTime:function(){var a=-1;this._customPlayer?a=this._currentContentPlayheadTime:!this._contentVideoAttached&&this._temporalSlotBase&&this._temporalSlotBase["_fw_contentVideo_"+this._instanceId]&&(a=this._temporalSlotBase["_fw_contentVideo_"+this._instanceId].currentTime);return 0<a?a:this._currentContentPlayheadTime},_requestContentVideoToPauseBySlot:function(a){this._videoAsset.requestPauseBySlot(a)},_requestContentVideoToResumeBySlot:function(a){this._videoAsset.requestResumeBySlot(a)},
551_setVideoDisplaySizeByContentVideo:function(a){if(this._autoSetDisplaySizeCount===this._totalSetDisplaySizeCount){var b=a.style.left,d=a.style.top,e=a.offsetWidth?a.offsetWidth:a.style.pixelWidth,f=a.offsetHeight?a.offsetHeight:a.style.pixelHeight;a=a.style.position;this._autoSetDisplaySizeCount++;this.setVideoDisplaySize(b,d,e,f,a)}},_replacePageSlot:function(b,c){a.debug("fw replace %s",b);var d;try{var e=document.getElementById(b)?document:parent.document.getElementById(b)?parent.document:null;
552var f=document.getElementById(b)?"window":parent.document.getElementById(b)?"parent":null}catch(A){f=e=null}if(!e)for(var k=0;k<window.frames.length;k++)try{window.frames[k].document.getElementById(b)&&(e=window.frames[k].document,f="window.frames["+k+"]")}catch(A){a.debug(A)}f&&(d=f+".document");a.debug("fw replacing slot %s in frame %s",b,d);if(!e)throw"Slot element not found: "+b;k=e.getElementById("_fw_container_"+b);k.innerHTML=c;c=k.getElementsByTagName("script");var g=e.getElementsByTagName("head")[0];
553for(k=0;k<c.length;++k)if(a.PLATFORM_IS_FIREFOX||c[k].src){var h=e.createElement("script");c[k].charset&&(h.charset=c[k].charset);c[k].src&&(h.src=c[k].src);c[k].innerHTML&&(h.innerHTML=c[k].innerHTML);h.onload=h.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||g.removeChild(h)};a.debug("fw append script for %s",b);g.appendChild(h)}else h=c[k].innerHTML,h=h.replace(/var fw_scope = document;/,"var fw_scope="+d+";"),h=h.replace(/var fw_scope_window = window;/,
554"var fw_scope_window="+f+";"),a.debug("fw eval in %s for %s, %s",d,b,h),eval(h);a.debug("fw finish replace %s",b)}};a.Context.prototype.constructor=a.Context;a.Capabilities=function(){this._capabilities={};this.init()};a.Capabilities.prototype={init:function(){for(var b=[a.CAPABILITY_SLOT_TEMPLATE,a.CAPABILITY_MULTIPLE_CREATIVE_RENDITIONS,a.CAPABILITY_FALLBACK_UNKNOWN_ASSET,a.CAPABILITY_FALLBACK_UNKNOWN_SITE_SECTION,a.CAPABILITY_FALLBACK_ADS,a.CAPABILITY_SLOT_CALLBACK,a.CAPABILITY_NULL_CREATIVE,a.CAPABILITY_AUTO_EVENT_TRACKING,
555a.CAPABILITY_RENDERER_MANIFEST],c=0;c<b.length;c++)this._capabilities[b[c]]=a.CAPABILITY_STATUS_ON},setCapability:function(a,c){this._capabilities[a]=c},getCapability:function(a){return this._capabilities[a]},parseCapabilities:function(b){var c="",d;for(d in this._capabilities)if(this._capabilities.hasOwnProperty(d)){switch(this._capabilities[d]){case a.CAPABILITY_STATUS_ON:c+="+"+d;break;case a.CAPABILITY_STATUS_OFF:c+="-"+d}b=b.replace(new RegExp("(%2B|-|\\+)"+d,"g"),"")}c=encodeURIComponent(c);
556return b=-1<b.indexOf("flag=")?b.replace(/flag=/,"flag="+c):b+("&flag="+c)}};a.OMSDKExtension=function(){this._adSession=this._mediaEvents=this._adEvents=this._ad=this._videoElement=this._sessionClient=this._context=null;this._cachedEvents=[];this._serviceScript=null;this._serviceScriptLoaded=!1;this._sessionScript=null;this._pendingSessionStartRequest=this._sessionScriptLoaded=!1;this._onAdInitiated=this._onAdInitiated.bind(this);this._adEventListener=this._adEventListener.bind(this);this._videoDidLoad=
557this._videoDidLoad.bind(this);this._onRequestComplete=this._onRequestComplete.bind(this)};a.OMSDKExtension.prototype={init:function(b){a.debug("OMSDKExtension.init(context)");this._context=b;this._context.addEventListener(a.EVENT_REQUEST_COMPLETE,this._onRequestComplete)},_getVideoElement:function(){this._videoElement=this._context.getContentVideoElement();return null==this._videoElement?(a.debug("OMSDKExtension: Error: Cannot use OMSDK because no video element was found"),null):this._videoElement},
558_onRequestComplete:function(b){a.Util.getBooleanParameter(a.PARAMETER_EXTENSION_OMSDK_ENABLED,!1)?b.success?null!=this._getVideoElement()&&this._initWithScripts():a.debug("OMSDKExtension: request complete failed."):a.debug("OMSDKExtension: return since OMSDKExtension is disabled")},_initWithScripts:function(){a.debug("OMSDKExtension._initWithScripts");this._addServiceScript();this._addSessionScript();this._context.addEventListener(a.EVENT_AD,this._onAdInitiated)},_addServiceScript:function(){this._serviceScript=
559this._addScript(a.OMSDK_SERVICE_SCRIPT_URL,"_fw_omsdk_service_script_",function(){a.debug("OMSDKExtension: on OMSDK service script load");this._serviceScriptLoaded=!0;
559this._checkIfAdSessionShouldStart()})},_addSessionScript:function(){this._sessionScript=this._addScript(a.OMSDK_SESSION_SCRIPT_URL,"_fw_omsdk_session_script_",function(){a.debug("OMSDKExtension: on session script load");window.OmidSessionClient&&window.OmidSessionClient.default?(a.debug("OMSDKExtension: setting session client."),this._sessionClient=
560window.OmidSessionClient.default,this._sessionScriptLoaded=!0,this._checkIfAdSessionShouldStart()):(a.debug("OMSDKExtension: Error: Cannot use OMSDK because session client was null."),this.dispose())})},_addScript:function(b,c,d){a.debug("OMSDKExtension._addScript");var e=document.createElement("script");e.type="text/javascript";e.src=b;return this._addElement(e,c,d)},_addElement:function(b,c,d){b.id=c+this._context._instanceId;b.onload=d.bind(this);b.onerror=function(){a.debug("OMSDKExtension: Error adding element: ",
561b);this.dispose()}.bind(this);return document.body.appendChild(b)},_checkIfAdSessionShouldStart:function(){a.debug("OMSDKExtension: _checkIfAdSessionShouldStart");this._serviceScriptLoaded&&this._sessionScriptLoaded&&this._pendingSessionStartRequest&&this._prepareAdSession()},_onAdInitiated:function(b){if(b.subType===a.EVENT_AD_PREINIT&&b.adInstance&&(a.debug("OMSDKExtension_onAdInitiated"),null!=this._getVideoElement())){b=b.adInstance;var c=b.getActiveCreativeRendition();c=b._rendererController._matchRendererClassName(c);
562this._isRendererSupported(c)?this._isTimePositionClassSupported(b)?null==b._adVerifications||0==b._adVerifications.length?a.debug("OMSDKExtension: No AdVerifications found."):(this._videoElement.addEventListener("loadeddata",this._videoDidLoad),this._context.addEventListener(a.EVENT_AD,this._adEventListener),this._ad=b,this._prepareAdSession()):a.debug("OMSDKExtension: The selected ad's slot time position class is not supported by OMSDK Web Video: "+timePositionClass):a.debug("OMSDKExtension: The selected renderer does not support OMSDK Web Video: "+
563c)}},_isRendererSupported:function(b){a.debug("OMSDKExtension._isRendererSupported:",b);switch(b){case h+".VideoRenderer":case h+".DashRenderer":case h+".CustomPlayerRenderer":return!0;default:return!1}},_isTimePositionClassSupported:function(b){b=b.getSlot().getTimePositionClass();a.debug("OMSDKExtension._isTimePositionClassSupported: "+b);switch(b){case a.TIME_POSITION_CLASS_PREROLL:return!0;case a.TIME_POSITION_CLASS_MIDROLL:return!0;case a.TIME_POSITION_CLASS_POSTROLL:return!0;default:return!1}},
564_prepareAdSession:function(){a.debug("OMSDKExtension._prepareAdSession");if(this._serviceScriptLoaded&&this._sessionScriptLoaded){var b=this._getVerificationResourcesFromAdVerifications();0<b.length?(b=this._createOMSDKContext(b),this._createAdSession(b)):(a.debug("OMSDKExtension: No VerificationScriptResources were created."),this._cleanupAfterAdSession())}else a.debug("OMSDKExtension scripts are not loaded, cannot start ad session at this time."),this._pendingSessionStartRequest=!0},_getVerificationResourcesFromAdVerifications:function(){var b=
565this._ad._adVerifications;a.debug("OMSDKExtension._getVerificationResourcesFromAdVerifications",JSON.stringify(b));for(var c=[],d=0;d<b.length;d++){for(var e=0,f=b[d],k=f.javaScriptResources.concat(f.executableResources),g=0;g<k.length;g++)try{var h=k[g],l=new this._sessionClient.VerificationScriptResource(h.url,f.vendorKey,f.verificationParameters,a.OMSDK_ACCESS_MODE);c.push(l);e++}catch(P){a.debug("OMSDKExtension: An error occured while trying to create a verification script resource: "+P+(" verification script url: "+
566(null!=h.url)?h.url:"No verification script url provided"))}0===e&&(a.debug("OMSDKExtension: Failed to create a verification script resource"),f.dispatchAdVerificationNotExecutedWithReason(a.VERIFICATION_RESOURCE_LOAD_ERROR))}return c},_createOMSDKContext:function(b){a.debug("OMSDKExtension._createOMSDKContext");var c=this._context._adManager.getOMSDKPartnerVersion();c=new this._sessionClient.Partner(a.OMSDK_PARTNER_NAME,c);var d=a.Util.getContentURL();b=new this._sessionClient.Context(c,b,d);b.setVideoElement(this._videoElement);
567b.setServiceWindow(window.top);return b},_createAdSession:function(b){a.debug("OMSDKExtension._createAdSession");try{var c=new this._sessionClient.AdSession(b);c.isSupported()?this._startAdSession(c):(a.debug("OMSDKExtension: Error: Cannot use OMSDK because adSession 
567was not supported."),this._cleanupAfterAdSession())}catch(d){a.debug("OMSDKExtension: Error: "+d),this._cleanupAfterAdSession()}},_startAdSession:function(b){b.setCreativeType(a.OMSDK_CREATIVE_TYPE_VIDEO);b.setImpressionType(a.OMSDK_IMPRESSION_TYPE_BEGIN_TO_RENDER);
568this._mediaEvents=new this._sessionClient.MediaEvents(b);this._adEvents=new this._sessionClient.AdEvents(b);this._adSession=b;this._adSession.start();for(a.debug("OMSDKExtension: adSession.start() called");0<this._cachedEvents.length;)a.debug("Firing cached event:",this._cachedEvents[0].subType),this._onAdEvent(this._cachedEvents.shift())},_videoDidLoad:function(){a.debug("OMSDKExtension._videoDidLoad");this._videoElement.removeEventListener("loadeddata",this._videoDidLoad);this._adEventListener({subType:"loaded"})},
569_adEventListener:function(b){a.debug("OMSDKExtension._adEventListener",b.subType);this._adSession?this._onAdEvent(b):this._cachedEvents.push(b)},_onAdEvent:function(b){a.debug("OMSDKExtension._onAdEvent:",b.subType);if(b&&b.subType)switch(b.subType){case "loaded":this._onVideoLoaded();break;case a.EVENT_AD_IMPRESSION:try{this._adEvents.impressionOccurred(),this._mediaEvents.start(this._ad.getDuration(),this._getVolume())}catch(c){a.debug("OMSDKExtension: Error: "+c)}break;case a.EVENT_AD_FIRST_QUARTILE:this._mediaEvents.firstQuartile();
570break;case a.EVENT_AD_MIDPOINT:this._mediaEvents.midpoint();break;case a.EVENT_AD_THIRD_QUARTILE:this._mediaEvents.thirdQuartile();break;case a.EVENT_AD_COMPLETE:this._mediaEvents.complete();break;case a.EVENT_AD_IMPRESSION_END:this._endAdSession();break;case a.EVENT_AD_PAUSE:this._mediaEvents.pause();break;case a.EVENT_AD_RESUME:this._mediaEvents.resume();break;case a.EVENT_AD_BUFFERING_START:this._mediaEvents.bufferStart();break;case a.EVENT_AD_BUFFERING_END:this._mediaEvents.bufferFinish();break;
571case a.EVENT_AD_VOLUME_CHANGE:this._mediaEvents.volumeChange(this._getVolume());break;case a.EVENT_AD_CLICK:this._mediaEvents.adUserInteraction("click");break;case a.EVENT_AD_SKIPPED:this._mediaEvents.skipped();break;case a.EVENT_ERROR:this._adSession.error("media",b.errorInfo||"An error occured during ad playback."),this._endAdSession()}},_getVolume:function(){return this._videoElement.muted?0:this._videoElement.volume},_onVideoLoaded:function(){a.debug("OMSDKExtension._onVideoLoaded");var b=this._ad.getSlot().getTimePositionClass().toLowerCase(),
572c=this._ad.getSkipOffset(),d=-1<c;d||(c=0);b=new this._sessionClient.VastProperties(d,c,this._context._va_autoPlayType!=a.VIDEO_ASSET_AUTO_PLAY_TYPE_CLICK_TO_PLAY&&this._context._va_autoPlayType!=a.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,b);this._adEvents.loaded(b)},_endAdSession:function(){a.debug("OMSDKExtension._endAdSession()");this._adSession.finish();this._cleanupAfterAdSession()},_cleanupAfterAdSession:function(){a.debug("OMSDKExtension._cleanupAfterAdSession()");this._cachedEvents=[];this._adSession=
573this._ad=this._adEvents=this._mediaEvents=null;this._videoElement&&this._videoElement.removeEventListener("loadeddata",this._videoDidLoad);this._context&&this._context.removeEventListener(a.EVENT_AD,this._adEventListener)},dispose:function(){a.debug("OMSDKExtension.dispose()");this._cleanupAfterAdSession();this._context&&(this._context.removeEventListener(a.EVENT_REQUEST_COMPLETE,this._onRequestComplete),this._context.removeEventListener(a.EVENT_AD,this._onAdInitiated));this._context=this._videoElement=
574this._sessionClient=null;this._serviceScript&&(this._serviceScript.onload=null,this._serviceScript.onerror=null);this._sessionScript&&(this._sessionScript.onload=null,this._sessionScript.onerror=null);this._sessionScriptLoaded=this._serviceScriptLoaded=!1;setTimeout(function(){this._serviceScript&&(this._serviceScript.remove(),this._serviceScript=null);this._sessionScript&&(this._sessionScript.remove(),this._sessionScript=null)}.bind(this),3E3)}};a.OMSDKExtension.prototype.constructor=a.OMSDKExtension;
575a.USPConsentManager=function(a){this._consentManager=a;this._fwUSPString=null;this._isExecuted=!1;this._getUSPDataCallback=this._getUSPDataCallback.bind(this);this._fetchCCPAData()};a.USPConsentManager.prototype._fetchCCPAData=function(){a.debug("ConsentManager.fetchCCPAData");try{var b=a.Util.getTopMostWindow().__uspapi;this._getUSPData(b)}catch(c){a.warn("__uspapi function on top window is inaccessible due to the following error: "+c),this._retrieveCCPAWithPostMessage()}};a.USPConsentManager.prototype._getUSPData=
576function(b){a.debug("ConsentManager.getUSPData");if("function"==typeof b)try{b("getUSPData",a.CCPA_USPAPI_VERSION,this._getUSPDataCallback)}catch(c){this._isExecuted=!0,a.warn("ConsentManager.getUSPData "+c.name+": "+c.message)}else this._isExecuted=!0,a.warn("USPAPI function cannot be found. _fw_us_privacy: "+this._fwUSPString)};a.USPConsentManager.prototype._retrieveCCPAWithPostMessage=function(){a.debug("ConsentManager.retrieveCCPAWithPostMessage");this._consentManager.setupConsentPostMessage("__uspapi");
577this._getUSPData(window.__uspapi)};a.USPConsentManager.prototype._getUSPDataCallback=function(b,c){c?(b=b.uspString,null!=b?"string"==typeof b?this._fwUSPString=b:(this._fwUSPString=b.toString(),a.warn("USPData's uspString value is not a string.")):a.warn("USPData's uspString value is missing.")):a.warn("Cannot retrieve CCPA params from USPAPI.");this._isExecuted=!0};a.USPConsentManager.prototype.isExecuted=function(){return this._isExecuted};a.USPConsentManager.prototype.getUSPString=function(){return this._fwUSPString||
578""};a.USPConsentManager.prototype.dispose=function(){this._consentManager=null};a.VideoAsset=function(b){this._defaultTimeouts=[5,10,15,30,60,120,180,300];this._context=b;this._internalState=a.MediaInitState.instance;this._eventCallback=this._state="";this._callbackTimer=null;this._requestedVideoViewUrl=this._videoPlayPending=!1;this._dummyInstanceId="";this._delay=0;this._location=this._networkId=this._duration=this._customId=this._id="";this._autoPlayType=null;this._fallbackId="";this._viewRandom=
5790;this._durationType=null;this._currentTpos=0};a.VideoAsset.prototype={setVideoAsset:function(b,c,d,e,f,k,g,h,l){if(b){switch(g){case a.ID_TYPE_FW:g=this._id!==b;this._id=b;break;case a.ID_TYPE_GROUP:g=this._id!=="g"+b;this._id="g"+b;break;default:g=this._customId!==b,this._customId=b}g&&(this._eventCallback="");"number"===typeof c&&(this._duration=Math.round(10*c)/10);0<1*d&&(this._networkId=1*d);"string"===typeof e&&(this._location=e);"number"===typeof f&&(this._autoPlayType=f);0<1*k&&(this._viewRandom=
5801*k);"number"===typeof h&&0<h?this._fallbackId=""+h:"string"===typeof h&&(this._fallbackId=h.trim());if(l===a.VIDEO_ASSET_DURATION_TYPE_EXACT||l===a.VIDEO_ASSET_DURATION_TYPE_VARIABLE)this._durationType=l;this._videoPlayPending&&this.play()}else a.warn("AdRequest.setVideoAsset","id is required.")},setVideoAssetCurrentTimePosition:function(b){!b||0>b?a.warn("AdRequest.setVideoAssetCurrentTimePosition","valid timePosition is required"):this._currentTpos=b},setVideoState:function(b){b===a.VIDEO_STATE_PLAYING?
581(this._state===a.VIDEO_STATE_PAUSED&&this._context.dispatchEvent(a.EVENT_CONTENT_VIDEO_RESUMED),this.play()):b===a.VIDEO_STATE_PAUSED||b===a.VIDEO_STATE_STOPPED?(this.pause(),b===a.VIDEO_STATE_PAUSED&&this._state===a.VIDEO_STATE_PLAYING&&this._context.dispatchEvent(a.EVENT_CONTENT_VIDEO_PAUSED)):b===a.VIDEO_STATE_COMPLETED&&this.complete();this._state=b},callback:function(b){this._eventCallback?this._eventCallback.process():b=!0;b||((b=this._defaultTimeouts.shift())||(b=300),this._callbackTimer=new a.Timer(b,
582a.Util.bind(this,this.callback)),this._callbackTimer.start())},getPlayheadTime:function(){var a=this._delay;this._delay=0;a+=this._callbackTimer?this._callbackTimer.getCTValue():0;return Math.floor(a)},play:function(){this._context._adManager._serverURL&&this._context._adManager._networkId&&(this._id||this._customId)?this._eventCallback?(this._videoPlayPending=!1,this._internalState.play(this)):this._requestedVideoViewUrl||(this._requestedVideoViewUrl=!0,this.requestForVideoViewCallback(),this._callbackTimer||
583(this._callbackTimer=new a.Timer,this._callbackTimer.tick())):(a.warn("Server URL or Network ID or Video Asset id/customId is not set, delay video asset state change until these are provided."),this._videoPlayPending=!0,this._callbackTimer||(this._callbackTimer=new a.Timer,this._callbackTimer.tick()))},pause:function(){this._internalState.pause(this)},complete:function(){this._internalState.complete(this)},onStartPlaying:function(){this.callback()},onStartReplaying:function(){this.callback()},onPausePlaying:function(){this.callback(!0);
584this._callbackTimer.pause()},onResumePlaying:function(){this._callbackTimer.start()},onCompletePlaying:function(){this.callback(!0);this._callbackTimer.stop();this._callbackTimer=null;this._eventCallback="";this._requestedVideoViewUrl=!1},onCompleteReplaying:function(){this.onCompletePlaying()},setMediaState:function(a){this._internalState=a},requestPauseBySlot:function(b){a.debug("requestPauseBySlot");this._internalState===a.MediaPlayingState.instance||this._internalState===a.MediaReplayingState.instance?
585this._context.dispatchEvent(a.EVENT_CONTENT_VIDEO_PAUSE_REQUEST,{slot:b}):a.debug("Not sending content pause request because content video state is",JSON.stringify(this._internalState))},requestResumeBySlot:function(b){a.debug("requestResumeBySlot");this._internalState===a.MediaPausedState.instance||this._internalState===a.MediaReplayPausedState.instance?this._context.dispatchEvent(a.EVENT_CONTENT_VIDEO_RESUME_REQUEST,{slot:b}):a.debug("Not sending content resume request because content video state is ",
586JSON.stringify(this._internalState))},requestForVideoViewCallback:function(){var b=new a.Context(this._context._adManager);b._videoAsset=this;this._dummyInstanceId=b._instanceId;b=this._context._adRequest.generateVideoViewRequestUrlWithDummyContextInstanceId(b._instanceId);var c=this;a.PLATFORM_SEND_REQUEST_BY_FORM?(a.debug("Context.submitRequest:","use json2"),a.Util.pingURLWithForm(b,this._dummyInstanceId,!0),c._onMessagePosted=function(a){"object"===typeof a.data&&a.data.hasOwnProperty("cbfn")&&
587-1<a.data.cbfn.indexOf("['Context_"+this._dummyInstanceId+"']")&&c.requestComplete(a.data.response)},window.addEventListener("message",c._onMessagePosted,!1)):a.PLATFORM_SEND_REQUEST_BY_JS?a.Util.pingURLWithXMLHTTPRequest
587(b):a.Util.pingURLWithScript(b)},requestComplete:function(b){this._delay=this._callbackTimer.tick();this._callbackTimer=null;if(a.PLATFORM_SEND_REQUEST_BY_FORM){window.removeEventListener("message",this._onMessagePosted,!1);var c=document.getElementById("_fw_request_iframe_"+this._dummyInstanceId);
588document.body.removeChild(c)}null!=b?(a._instanceQueue["Context_"+this._dummyInstanceId]=null,this.parse(a.Util.getObject("siteSection.videoPlayer.videoAsset",b)||{}),this.play()):a.warn("Failed to get video view callback url.")},parse:function(b){if(b){this._customId=b.customId;this._networkId=parseInt(b.networkId);for(var c=0,d=b.eventCallbacks||[];c<d.length;c++){b=d[c];var e=a.EventCallback.newEventCallback(this._context,b.name,b.type);if(e&&b.name===a.EVENT_VIDEO_VIEW){e.parse(b);this._eventCallback=
589e;a.debug("Parsed video view url: "+this._eventCallback._url);break}}}}};a.NullRenderer=function(){this._rendererController=null};a.NullRenderer.prototype={start:function(b){this._rendererController=b;this._rendererController.setCapability(a.EVENT_AD_CLICK,a.CAPABILITY_STATUS_OFF);this._rendererController.handleStateTransition(a.RENDERER_STATE_STARTED);this._rendererController.handleStateTransition(a.RENDERER_STATE_COMPLETED)},info:function(){return{moduleType:a.MODULE_TYPE_RENDERER}},getPlayheadTime:function(){return-1},
590getDuration:function(){return-1}};a.NullRenderer.prototype.constructor=a.NullRenderer;a.VPAIDWrapper=function(){this._creative=null;this._timeoutInMs=0;this._eventHandlers={};this._timeoutTimer=null;this._timeoutOperation="";this.timeoutReached=!1;this._visibilityChangeListener=null;this._creativePausedByTabSwitch=!1;this._autoPauseAdOnVisibilityChange=!0;this._loadIntervalTimer=null;this._isCORSEnforcementDisabled=!0};a.VPAIDWrapper.prototype={_isCreativeFunctionInvokable:function(a){return this._creative?
591(a=this._creative[a])&&"function"===typeof a:!1},checkVPAIDInterface:function(a){for(var b={passed:!0,missingInterfaces:""},d=a.length-1;0<=d;d--)this._isCreativeFunctionInvokable(a[d])||(b.passed=!1,b.missingInterfaces+=a[d]+" ");return b},loadCreativeAsset:function(b){a.log("loadCreativeAsset("+b+")");var c=document.getElementById("vpaidFrame"),d=document.createElement("iframe");d.id="vpaidFrame";null==c?document.body.appendChild(d):document.body.replaceChild(d,c);d.width=0;d.height=0;d.style.display=
592"none";d.contentWindow.document.open();if(this._isCORSEnforcementDisabled){a.log("CORS Enforcement Disabled");
592setTimeout(function(){d.contentWindow.document.write('<script type="text/javascript" src="'+b+'"> \x3c/script>');d.contentWindow.document.close()},0);this._timeoutOperation="loadCreativeAsset";this._waitForTimeout();var e=this;this._loadIntervalTimer=setInterval(function(){var b=document.getElementById("vpaidFrame").contentWindow.getVPAIDAd;b&&"function"===typeof b&&(clearInterval(e._loadIntervalTimer),
593b=b(),"undefined"===typeof b?a.debug("getVPAIDAd() returns undefined value"):null==b?a.debug("getVPAIDAd() returns null"):(e._creative=b,e._eventHandlers.CreativeAssetLoaded()))},200)}else{d.contentWindow.document.close();this._timeoutOperation="loadCreativeAsset";e=this;var f=new XMLHttpRequest;f.open("GET",b);f.timeout=e._timeoutInMs;f.onreadystatechange=function(){if(4==f.readyState)if(200===f.status)try{d.contentWindow.eval(f.responseText);var c=d.contentWindow.getVPAIDAd;if(c&&"function"===typeof c){var g=
594c();if("undefined"===typeof g)throw"getVPAIDAd() returns undefined value";if(null==g)throw"getVPAIDAd() returns null";e._creative=g;e._eventHandlers.CreativeAssetLoaded()}else throw"getVPAIDAd() funtion does not exist";}catch(m){a.warn(m),e._eventHandlers.loaderror(a.ERROR_3P_COMPONENT,"Creative is not VPAID: "+m)}else 400<=f.status&&e._eventHandlers.loaderror(a.ERROR_IO,"creativeUrl="+b+"; status code="+f.status+"; status text="+f.statusText)};f.ontimeout=function(){e._eventHandlers.timeout.call()};
595f.onerror=function(){0===f.status?(a.warn("CORS error"),e._eventHandlers.loaderror(a.ERROR_SECURITY,"creativeUrl="+b+";cors error")):(a.warn("exception:"+f.statusText),e._eventHandlers.loaderror(a.ERROR_IO,"creativeUrl="+b+";exception="+f.statusText))};f.send()}},setCallbacksForCreative:function(a,c){for(var b in a)a.hasOwnProperty(b)&&this._creative.subscribe(a[b],b,c)},removeCallbacksForCreative:function(a){for(var b in a)a.hasOwnProperty(b)&&this._creative.unsubscribe(a[b],b)},handshakeVersion:function(b){a.log("VPAID Creative: handshakeVersion("+
596b+")");return this._creative.handshakeVersion(b)},initAd:function(b,c,d,e,f,k){a.log("VPAID Creative: initAd()");this._timeoutOperation="initAd";this._waitForTimeout();this._creative.initAd(b,c,d,e,f,k)},startAd:function(){a.log("VPAID Creative: startAd()");this._timeoutOperation="startAd";this._waitForTimeout();this._creative.startAd();document.hidden&&this._autoPauseAdOnVisibilityChange&&(a.log("VPAIDRenderer pause ad when tab is invisible"),this._creative.pauseAd(),this._creativePausedByTabSwitch=
597!0)},stopAd:function(){a.log("VPAID Creative: stopAd()");"loadCreativeAsset"===this._timeoutOperation?(clearInterval(this._loadIntervalTimer),this._timeoutOperation="loadCreativeAsset and stopAd"):"startAd"===this._timeoutOperation?(clearTimeout(this._timeoutTimer),this._timeoutOperation="startAd and stopAd"):this._timeoutOperation+="stopAd";this._creative&&(this._waitForTimeout(),this._creative.stopAd())},isCreativeSkippable:function(){return this._isCreativeFunctionInvokable("skipAd")&&this._isCreativeFunctionInvokable("getAdSkippableState")},
598getAdSkippableState:function(){return this._isCreativeFunctionInvokable("getAdSkippableState")&&this._creative.getAdSkippableState()},skipAd:function(){a.log("VPAID Creative: skipAd()");this._creative.skipAd()},canPauseAd:function(){return this._isCreativeFunctionInvokable("pauseAd")},canResumeAd:function(){return this._isCreativeFunctionInvokable("resumeAd")},canResizeAd:function(){return this._isCreativeFunctionInvokable("resizeAd")},pauseAd:function(){this.canPauseAd()&&(a.log("VPAID Creative: pauseAd()"),
599this._creative.pauseAd())},resumeAd:function(){this.canResumeAd()&&(a.log("VPAID Creative: resumeAd()"),this._creative.resumeAd())},resizeAd:function(b,c,d){this.canResizeAd()?(a.log("VPAID Creative: resizeAd()"),this._creative.resizeAd(b,c,d)):a.log("The creative is not able to resize")},getAdVolume:function(){return this._isCreativeFunctionInvokable("getAdVolume")?this._creative.getAdVolume():-1},setAdVolume:function(a){this._isCreativeFunctionInvokable("setAdVolume")&&this._creative.setAdVolume(a)},
600getAdExpanded:function(){return this._isCreativeFunctionInvokable("getAdExpanded")?this._creative.getAdExpanded():!1},getAdRemainingTime:function(){return this._isCreativeFunctionInvokable("getAdRemainingTime")?this._creative.getAdRemainingTime():-1},getAdDuration:function(){return this._isCreativeFunctionInvokable("getAdDuration")?this._creative.getAdDuration():-1},getAdLinear:function(){return this._creative.getAdLinear()},getAdCompanions:function(){return this._isCreativeFunctionInvokable("getAdCompanions")?
601this._creative.getAdCompanions():""},setTimeoutValueInMs:function(a){this._timeoutInMs=a},cancelTimeoutEvent:function(){a.log("cancelTimeoutEvent");var b="startAd and stopAd"!==this._timeoutOperation;clearTimeout(this._timeoutTimer);if(!b){this._timeoutOperation="startAd";var c=this;setTimeout(function(){c._eventHandlers&&c._eventHandlers.timeout&&c._eventHandlers.timeout.call()},500)}},addEventListener:function(a,c){this._eventHandlers[a]=c},removeEventListener:function(a){this._eventHandlers[a]=
602null},_waitForTimeout:function(){a.log("Wait for "+this._timeoutOperation+" for "+this._timeoutInMs+"ms");if(this._eventHandlers.timeout){var b=this;this._timeoutTimer=setTimeout(function(){b.timeoutReached||(b.timeoutReached=!0);"startAd"===b._timeoutOperation?b.stopAd():("loadCreativeAsset"===b._timeoutOperation&&clearInterval(b._loadIntervalTimer),b._eventHandlers&&b._eventHandlers.timeout&&b._eventHandlers.timeout.call())},this._timeoutInMs)}},getTimeoutOperation:function(){return this._timeoutOperation}};
603a.VPAIDWrapper.prototype.constructor=a.VPAIDWrapper;a.VPAIDRenderer=function(){this._rendererController=null;this._isCORSEnforcementDisabled=!0;this.vpaidCreative=null;this.vpaidVolume=this.vpaidDuration=-1;this.creativeEventCallbacks={};this.isMuted=!1;this.adPlaybackState="";this.creativeTimeoutDelayInMs=1E4;this.vpaidDesiredBitrate=268;this.vpaidViewmode="normal";this.playheadTime=0;
603this.videoBase=document.createElement("div");this.videoParent=null;this.SUPPORTED_CREATIVE_VPAID_VERSION_MIN=this.PLAYER_VPAID_VERSION=
6042};a.VPAIDRenderer.prototype={};a.VPAIDRenderer.prototype.constructor=a.VPAIDRenderer;a.VPAIDRenderer.VastCompanion=function(a,c,d,e){this._width=a;this._height=c;this._apiFramework=d;this._xmlNode=e};a.VPAIDRenderer.VastCompanion.prototype={getWidth:function(){return this._width},getHeight:function(){return this._height},_isValidResource:function(a,c){return"StaticResource"===a&&c["@attributes"].creativeType||"IFrameResource"===a&&c.value||"HTMLResource"===a&&c.value},hasValidRendtions:function(){for(var a in this._xmlNode)if(this._xmlNode.hasOwnProperty(a)&&
605("StaticResource"===a||"IFrameResource"===a||"HTMLResource"===a))for(var c=[].concat(this._xmlNode[a]),d=c.length-1;0<=d;d--)if(this._isValidResource(a,c[d]))return!0;return!1},translateToAdInstance:function(b){this._xmlNode.CompanionClickThrough&&b.setClickThroughUrl(a.EVENT_AD_CLICK,this._xmlNode.CompanionClickThrough.value);var c;if(this._xmlNode.TrackingEvents){var d=this._xmlNode.TrackingEvents;if(d.Tracking){d=[].concat(d.Tracking);var e=[];for(c=d.length-1;0<=c;c--)"creativeView"===d[c]["@attributes"].event&&
606e.push(d[c].value);0<e.length&&b.addEventCallbackUrls(a.EVENT_AD_IMPRESSION,a.EVENT_TYPE_IMPRESSION,e)}}for(var f in this._xmlNode)if(this._xmlNode.hasOwnProperty(f)&&("StaticResource"===f||"IFrameResource"===f||"HTMLResource"===f))for(d=[].concat(this._xmlNode[f]),c=d.length-1;0<=c;c--)if(this._isValidResource(f,d[c])){e=d[c];var k=b.addCreativeRendition();k.setWidth(this._width);k.setHeight(this._height);k.setCreativeApi("None");var g=k.addCreativeRenditionAsset("VPAIDAsset"+c,!0);g.setContentType("text/html_doc_lit_mobile");
607g.setMimeType("text/html");var h=b.getEventCallbackUrls(a.EVENT_AD_CLICK,a.EVENT_TYPE_CLICK)[0],l=f;if("HTMLResource"===l)g.setContent(a.HTMLAdGenerator.wrapUnsafeHTML(e.value,b.getSlot().getCustomId(),this._width,this._height));else{var p;"IFrameResource"===l?p="iframe":"StaticResource"===l&&(p=this._xmlNode.creativeType);g.setContent(a.HTMLAdGenerator.generateAd(e.value,h,b.getSlot().getCustomId(),this._width,this._height,p,g.getContentType()))}a.debug("rendtion width: "+k.getWidth()+" height:"+
608k.getHeight()+" asset content:"+g.getContent())}}};a.VPAIDRenderer.VastCompanion.prototype.constructor=a.VPAIDRenderer.VastCompanion;a.VPAIDRenderer.VastAdSelect=function(){};a.VPAIDRenderer.VastAdSelect.prototype={_getDeadSpaceRatio:function(b,c){var d=b.getWidth();b=b.getHeight();var e=c.getWidth();c=c.getHeight();var f=1;d<=e&&b<=c&&(f=1-d*b/(e*c));a.debug("computing dead space ratio ("+f+") for slot "+e+"x"+c+" and ad "+d+"x"+b);return f},matchAdsWithSlots:function(b,c){a.log("VPAIDRenderer: Matching ads with slots");
609var d;for(d=0;d<c.length;++d)c[d].matched=!1;var e=[],f=[];for(d=0;d<b.length;d++)for(var k=0;k<c.length;k++)f.push({ratio:this._getDeadSpaceRatio(b[d],c[k]),adIndex:d,slotIndex:k});f.sort(function(a,b){return a.ratio-b.ratio});for(d=0;d<f.length&&1!==f[d].ratio;d++){k=f[d];var g=b[k.adIndex],h=c[k.slotIndex];g.matched||h.matched||(a.log("Winning ratio:"+k.ratio+" Winning ad:"+g.getWidth()+"x"+g.getHeight()+" for slot:"+h.getWidth()+"x"+h.getHeight()),e.push({ad:g,slot:h}),g.matched=!0,h.matched=
610!0)}return e}};a.VPAIDRenderer.VastAdSelect.prototype.constructor=a.VPAIDRenderer.VastAdSelect;a.Util.mixin(a.VPAIDRenderer.prototype,{_initParams:function(){var b=this._rendererController.getParameter(a.PARAMETER_VPAID_CREATIVE_TIMEOUT_DELAY);this._isCORSEnforcementDisabled=this._rendererController.getParameter(a.PARAMETER_DISABLE_CORS_ENFORCEMENT);b&&0<Number(b)&&(this.creativeTimeoutDelayInMs=Number(b));a.log("initParams(), creative timeout delay in miliseconds:"+this.creativeTimeoutDelayInMs);
611b=parseFloat(this._rendererController.getParameter(a.PARAMETER_DESIRED_BITRATE));this.vpaidDesiredBitrate=0<b?b:this.vpaidDesiredBitrate;a.log("initParams(), desired bitrate: "+this.vpaidDesiredBitrate)},_failWithError:function(b,c,d){var e={};e[a.INFO_KEY_ERROR_MODULE]="VPAIDRenderer";e[a.INFO_KEY_ERROR_CODE]=b;d||(d=a.ERROR_VAST_GENERAL_VPAID_ERROR);e[a.INFO_KEY_VAST_ERROR_CODE]=d;c&&(e[a.INFO_KEY_ERROR_INFO]=c);this._rendererController.handleStateTransition(a.RENDERER_STATE_FAILED,e);this.dispose()},
612onCreativeLoadError:function(b,c){a.log("VPAIDRenderer: onCreativeLoadError()");this.vpaidCreative.cancelTimeoutEvent();this._failWithError(b,c)},onCreativeTimeout:function(){a.log("VPAIDRenderer: onCreativeTimeout()");var b=this.vpaidCreative.getTimeoutOperation();this._failWithError(a.ERROR_TIMEOUT,"loadCreativeAsset"!==b?"Creative function "+b+" timeout":"load creative asset timeout")},setVolume:function(b){a.log("VPAIDRenderer: setVolume("+b+")");this.vpaidCreative&&this.vpaidCreative.setAdVolume(b)},
613onAdVolumeChange:function(){a.log("VPAIDRenderer: onAdVolumeChange()");var b=this.vpaidCreative.getAdVolume();0>b||1<b?a.log("Invalid ad volume value"):(this.isMuted&&2<100*b?(this.isMuted=!1,this._rendererController.processEvent({name:a.EVENT_AD_UNMUTE}
613)):!this.isMuted&&2>100*b&&(this.isMuted=!0,this._rendererController.processEvent({name:a.EVENT_AD_MUTE})),this._rendererController.processEvent({name:a.EVENT_AD_VOLUME_CHANGE}))},onAdExpandedChange:function(){a.log("VPAIDRenderer: onAdExpandedChange()");
614this.vpaidCreative.getAdExpanded()?this._rendererController.processEvent({name:a.EVENT_AD_EXPAND}):this._rendererController.processEvent({name:a.EVENT_AD_COLLAPSE})},onAdDurationChange:function(){a.log("VPAIDRenderer: onAdDurationChange(): duration changed to "+this.vpaidCreative.getAdDuration())},onAdClickThru:function(b,c,d){a.log("VPAIDRenderer: onAdClickThru() with url:"+b+" id:"+c+" playerHandles:"+d);c={name:a.EVENT_AD_CLICK,info:{}};c.info[a.INFO_KEY_SHOW_BROWSER]=!0===d;!0===d?b?(a.log("onAdClickThru(): open window with overrided url"),
615c.info[a.INFO_KEY_URL]=b):a.log("onAdClickThru(): open window with url booked in MRM UI or VAST clickthru url"):a.log("onAdClickThru(): send click tracking");this._rendererController.processEvent(c)},onCreativeAssetLoaded:function(){a.log("VPAIDRenderer: onCreativeAssetLoaded()");this.vpaidCreative.cancelTimeoutEvent();var b=this,c=function(){var c=b.vpaidCreative.handshakeVersion(b.PLAYER_VPAID_VERSION.toFixed(1));return c?parseFloat(c)<b.SUPPORTED_CREATIVE_VPAID_VERSION_MIN?(b._failWithError(a.ERROR_INVALID_VALUE,
616"Only support creatives with VPAID version >= "+b.SUPPORTED_CREATIVE_VPAID_VERSION_MIN.toFixed(1)),!1):!0:(b._failWithError(a.ERROR_3P_COMPONENT,"Cannot get VPAID version from the creative"),!1)};if(function(){var c=b.vpaidCreative.checkVPAIDInterface("handshakeVersion initAd startAd stopAd subscribe unsubscribe getAdLinear".split(" "));c.passed||b._failWithError(a.ERROR_3P_COMPONENT,"Missing interfaces in the VPAID creative: "+c.missingInterfaces);return c.passed}()&&c()){b.creativeEventCallbacks=
617{AdStarted:b.onAdStarted,AdStopped:b.onAdStopped,AdSkipped:b.onAdSkipped,AdLoaded:b.onAdLoaded,AdLinearChange:b.onAdLinearChange,AdSizeChange:b.onAdSizeChange,AdExpandedChange:b.onAdExpandedChange,AdDurationChange:b.onAdDurationChange,AdVolumeChange:b.onAdVolumeChange,AdImpression:b.onAdImpression,AdClickThru:b.onAdClickThru,AdSkippableStateChange:b.onAdSkippableStateChange,AdVideoFirstQuartile:b.onAdVideoFirstQuartile,AdVideoMidpoint:b.onAdVideoMidpoint,AdVideoThirdQuartile:b.onAdVideoThirdQuartile,
618AdVideoComplete:b.onAdVideoComplete,AdUserAcceptInvitation:b.onAdUserAcceptInvitation,AdUserMinimize:b.onAdUserMinimize,AdUserClose:b.onAdUserClose,AdPaused:b.onAdPaused,AdPlaying:b.onAdResumed,AdError:b.onAdError,AdLog:b.onAdLog};b.vpaidCreative.setCallbacksForCreative(b.creativeEventCallbacks,b);this._rendererController.setCapability(a.EVENT_AD_QUARTILE,a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_MUTE,a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_EXPAND,
619a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_PAUSE,a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_CLOSE,a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_MINIMIZE,a.CAPABILITY_STATUS_ON);this._rendererController.setCapability(a.EVENT_AD_ACCEPT_INVITATION,a.CAPABILITY_STATUS_ON);(c=this.rendition?this.rendition.getParameter("creativeData"):null)||(c=this.rendition?this.rendition.getParameter("VPAID_creativeData"):null);
620c&&(c=a.Util.trim(c));c={AdParameters:c};var d=this._rendererController.getAdInstance().getSlot();this.videoBase.style.width="0px";this.videoBase.style.height="0px";this.videoBase.style.zIndex="100000";this.videoBase.style.position="absolute";this.videoBase.style.left=this._rendererController.getContentVideoElement().style.left;this.videoBase.style.top=this._rendererController.getContentVideoElement().style.top;this.videoBase.className="fw_vpaid_slot";this.videoParent=d.getBase();var e=this._rendererController.getContentVideoElement();
621if("nodeType"in e&&0<e.nodeType)try{this.videoParent.insertBefore(this.videoBase,this._rendererController.getContentVideoElement())}catch(k){this.videoParent.insertBefore(this.videoBase,this.videoParent.firstChild)}else this.videoParent.insertBefore(this.videoBase,this.videoParent.firstChild);e={slot:this.videoBase,videoSlot:this._rendererController.getContentVideoElement(),videoSlotCanAutoPlay:!0};var f=d.getWidth();d=d.getHeight();f&&d||!this.rendition||(f=this.rendition.getWidth(),d=this.rendition.getHeight());
622this.vpaidViewmode=f>=screen.width&&d>=screen.height?"fullscreen":"normal";a.log("VPAIDRenderer ad init videoMode: "+this.vpaidViewmode);this.vpaidCreative.initAd(f,d,this.vpaidViewmode,this.vpaidDesiredBitrate,c,e)}},onAdLoaded:function(){a.log("VPAIDRenderer: onAdLoaded()");this.vpaidCreative.cancelTimeoutEvent();a.log("Ad duration:"+this.getDuration());var b=this,c=function(c,d){var e=d;a.debug(e.length+" companion slots to fill.");if(0!==e.length&&0!==c.length){var f=(new a.VPAIDRenderer.VastAdSelect).matchAdsWithSlots(c,
623e);if(0!==f.length){c=[];e=[];for(d=f.length-1;0<=d;d--)c.push(f[d].ad),e.push(f[d].slot);e=b._rendererController.scheduleAdInstances(e);for(d=e.length-1;0<=d;d--)c[d].translateToAdInstance(e[d])}}},d=function(b){if(!b)return a.log("The adCompanions property is empty."),null;a.log("parsing adCompanions: "+b);if(window.DOMParser)var c=(new DOMParser).parseFromString(b,"text/xml");else c=new ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.loadXML(b);b=a.Util.xmlToJson(c);if(!b||!b.CompanionAds||!b.CompanionAds.Companion)return a.log("No companion ads found in parsed xml"),
624[];b=[].concat(b.CompanionAds.Companion);c=[];for(var d=b.length-1;0<=d;d--){var e=b[d];if(e["@attributes"]){var h=e["@attributes"].width,l=e["@attributes"].height;if(!h||!l||0>h||0>l)a.log("Missing width/height for companion.");else{var p=e["@attributes"].apiFramework||"";a.debug("Companion "+h+"x"+l+" api:"+p);e=new a.VPAIDRenderer.VastCompanion(h,l,p,e);e.hasValidRendtions()&&c.push(e)}}}return c}(b.vpaidCreative.getAdCompanions());d&&0<d.length?c(d,this._rendererController.getCompanionSlots()):
625a.log("VPAIDAdRenderer: No companions from VPAID creative.");c=this._rendererController.getAdInstance()._context.getAdVolume();!this.isMuted&&2>100*c&&(this.isMuted=!0);this.setVolume(c);this.vpaidCreative.startAd()},onVisibilityChange:function(){a.log("onVisibilityChange:"+(document.hidden?"invisible":"visible"));a.log("Current playback state:"+this.adPlaybackState);document.hidden&&"playing"===this.adPlaybackState?(a.log("Pause the VPAID creative"),this.vpaidCreative.pauseAd(),this.vpaidCreative._creativePausedByTabSwitch=
626!0):!document.hidden&&"paused"===this.adPlaybackState&&this.vpaidCreative._creativePausedByTabSwitch&&(a.log("Resume the VPAID creative"),this.vpaidCreative.resumeAd(),this.vpaidCreative._creativePausedByTabSwitch=!1)},onAdStarted:function(){a.log("VPAIDRenderer: onAdStarted()");this.vpaidCreative.timeoutReached?a.log("VPAID ad has already failed due to timeout. The AdStarted event will not be handled."):(this.vpaidCreative.cancelTimeoutEvent(),this.vpaidCreative._autoPauseAdOnVisibilityChange&&(this._visibilityChangeListener=
627this.onVisibilityChange.bind(this),document.addEventListener("visibilitychange",this._visibilityChangeListener,!1)))},onAdStopped:function(){a.log("VPAIDRenderer: onAdStopped()");this.vpaidCreative?(this.vpaidCreative.cancelTimeoutEvent(),this.timePositionClass===a.TIME_POSITION_CLASS_OVERLAY&&this.vpaidCreative.getAdLinear()&&this._rendererController.requestContentStateChange(!1),this.vpaidCreative&&!this.vpaidCreative.timeoutReached&&(this.adPlaybackState?(this._rendererController.handleStateTransition(a.RENDERER_STATE_COMPLETED),
628this.dispose()):(a.warn("Expecting AdStarted and AdImpression events but got AdStopped event instead. Fail."),this._failWithError(a.ERROR_3P_COMPONENT,"Expecting AdStarted and AdImpression events from the VPAID creative but got AdStopped event instead")))):a.log("The VPAID creative has been disposed. Return.")},onAdImpression:function(){a.log("VPAIDRenderer: onAdImpression()");if(this.vpaidCreative.timeoutReached)a.log("VPAID ad has already failed due to timeout. The AdImpression event will not be handled.");
629else{var b=this.vpaidCreative.getAdVolume();this.isMuted=0<b&&2>=100*b;this.adPlaybackState="playing";this._rendererController.handleStateTransition(a.RENDERER_STATE_STARTED)}},onAdLinearChange:function(){a.log("VPAIDRenderer: onAdLinearChange()");var b=this.vpaidCreative.getAdLinear();b?a.log("onAdLinearChange(): non-linear click to linear -> request content video to pause"):a.log("onAdLinearChange(): linear back to non-linear -> request content video to resume");this._rendererController.requestContentStateChange(b)},
630onAdSizeChange:function(){a.log("VPAIDRenderer: onAdSizeChange()")},onAdPaused:function(){a.log("VPAIDRenderer: onAdPaused()");"playing"===this.adPlaybackState&&this._rendererController.processEvent({name:a.EVENT_AD_PAUSE});this.adPlaybackState="paused"},onAdResumed:function(){a.log("VPAIDRenderer: onAdResumed()");"paused"===this.adPlaybackState&&this._rendererController.processEvent({name:a.EVENT_AD_RESUME});this.adPlaybackState="playing"},attemptSkip:function(){a.log("VPAIDRenderer: attemptSkip()");
631this.vpaidCreative.isCreativeSkippable()?this.vpaidCreative.getAdSkippableState()?this.vpaidCreative.skipAd():(a.log("VPAIDRenderer: creative adSkippableState is false, adding SkippableStateChange listener"),this._isAttemptSkipCalled=!0):(a.log("VPAIDRenderer: creative does not have skip functionality, calling rendererController.stop()"),this._rendererController.getAdInstance()._processSkipEvent(),this._rendererController.stop(),this.adPlaybackState||this._rendererController.handleStateTransition(a.RENDERER_STATE_COMPLETED))},
632onAdSkippableStateChange:function(){a.log("VPAIDRenderer: onAdSkippableStateChange()");this._rendererController.processEvent({name:a.EVENT_AD_SKIPPABLE_STATE_CHANGED});this.vpaidCreative.getAdSkippableState()&&this._isAttemptSkipCalled?(this._isAttemptSkipCalled=!1,this.vpaidCreative.skipAd()):a.log("VPAIDRenderer: creative adSkippableState is false, unable to skip")},onAdSkipped:function(){a.log("VPAIDRenderer: onAdSkipped()");this._rendererController.getAdInstance()._processSkipEvent();this.dispose();
633this._rendererController.handleStateTransition(a.RENDERER_STATE_COMPLETED)},onAdVideoFirstQuartile:function(){a.log("VPAIDRenderer: onAdVideoFirstQuartile()");this._rendererController.processEvent({name:a.EVENT_AD_FIRST_QUARTILE})},onAdVideoMidpoint:function(){a.log("VPAIDRenderer: onAdVideoMidpoint()");this._rendererController.processEvent({name:a.EVENT_AD_MIDPOINT})},onAdVideoThirdQuartile:function(){a.log("VPAIDRenderer: onAdVideoThirdQuartile()");this._rendererController.processEvent({name:a.EVENT_AD_THIRD_QUARTILE})},
634onAdVideoComplete:function(){a.log("VPAIDRenderer: onAdVideoComplete");this._rendererController.processEvent({name:a.EVENT_AD_COMPLETE})},onAdUserAcceptInvitation:function(){a.log("VPAIDRenderer: onAdUserAcceptInvitation()");this._rendererController.processEvent({name:a.EVENT_AD_ACCEPT_INVITATION})},onAdUserClose:function(){a.log("VPAIDRenderer: onAdUserClose()");this._rendererController.processEvent({name:a.EVENT_AD_CLOSE})},onAdUserMinimize:function(){a.log("VPAIDRenderer: onAdUserMinimize()");
635this._rendererController.processEvent({name:a.EVENT_AD_MINIMIZE})},onAdLog:function(b){a.log("VPAIDRenderer: onAdLog: "+b)},onAdError:function(b){a.log("VPAIDRenderer: onAdError(): "+b);this._failWithError(a.ERROR_3P_COMPONENT,"AdError event:"+b)},start:function(b){a.log("VPAIDRenderer start()");this._rendererController=b;this._isAttemptSkipCalled=!1;this.timePositionClass=this._rendererController.getAdInstance().getSlot().getTimePositionClass();this.rendition=this._rendererController.getAdInstance().getActiveCreativeRendition();
636this._initParams();if(b=(b=this.rendition?this.rendition.getPrimaryCreativeRenditionAsset():null)?b.getProxiedUrl():null){this.vpaidCreative=new a.VPAIDWrapper;this.vpaidCreative._autoPauseAdOnVisibilityChange=this._rendererController.getParameter(a.PARAMETER_AUTO_PAUSE_AD_ONVISIBILITYCHANGE);this.vpaidCreative._isCORSEnforcementDisabled=this._isCORSEnforcementDisabled;this.vpaidCreative.setTimeoutValueInMs(this.creativeTimeoutDelayInMs);this.vpaidCreative.addEventListener("loaderror",this.onCreativeLoadError.bind(this));
637this.vpaidCreative.addEventListener("timeout",this.onCreativeTimeout.bind(this));this.vpaidCreative.addEventListener("CreativeAssetLoaded",this.onCreativeAssetLoaded.bind(this));try{this.vpaidCreative.loadCreativeAsset(b)}catch(c){a.warn(c),this._isCORSEnforcementDisabled?(this._failWithError(a.ERROR_UNKNOWN,"Error when loading creative"+c),this.cancelTimeoutEvent()):that._eventHandlers.loaderror(a.ERROR_UNKNOWN,"Error when loading creative: "+c)}}else this._failWithError(a.ERROR_NULL_ASSET,"Creative asset url cannot be null")},
638stop:function(){a.log("VPAIDRenderer stop()");this.vpaidCreative.stopAd();this.vpaidCreative&&"loadCreativeAsset and stopAd"==this.vpaidCreative.getTimeoutOperation()&&this.dispose()},info:function(){return{moduleType:a.MODULE_TYPE_RENDERER}},getPlayheadTime:function(){var a=this.vpaidCreative.getAdDuration(),c=this.vpaidCreative.getAdRemainingTime();0<=a&&0<=c&&(this.playheadTime=a-c);0>this.playheadTime&&(this.playheadTime=-1);return this.playheadTime},getDuration:function(){var a=this.vpaidCreative.getAdDuration();
639return 0<=a?a:-1},pause:function(){a.log("VPAIDRenderer pause()");this._rendererController.processEvent({name:a.EVENT_AD_PAUSE});this.vpaidCreative.canPauseAd()?"playing"===this.adPlaybackState&&(this.adPlaybackState="pausing",this.vpaidCreative.pauseAd()):a.log("The creative is not able to pause")},resume:function(){a.log("VPAIDRenderer resume()");this._rendererController.processEvent({name:a.EVENT_AD_RESUME});this.vpaidCreative.canResumeAd()?"paused"===this.adPlaybackState&&(this.adPlaybackState=
640"resuming",this.vpaidCreative.resumeAd()):a.log("The creative is not able to resume")},dispose:function(){a.log("VPAIDRenderer dispose()");this.vpaidCreative&&(this.videoParent&&(this.videoParent.removeChild(this.videoBase),this.videoParent=null),this._visibilityChangeListener&&this.vpaidCreative._autoPauseAdOnVisibilityChange&&(a.log("remove visibilitychange listener"),document.removeEventListener("visibilitychange",this._visibilityChangeListener,!1)),this.vpaidCreative.removeCallbacksForCreative(this.creativeEventCallbacks),
641this.vpaidCreative.removeEventListener("CreativeAssetLoaded"),this.vpaidCreative.removeEventListener("timeout"),this.vpaidCreative.removeEventListener("loaderror"),this.vpaidCreative=null)},resize:function(){a.log("VPAIDAdRenderer resize()");var b=this._rendererController.getAdInstance().getSlot(),c=b.getWidth();b=b.getHeight();a.log("VPAIDRenderer new size width:"+c+" height:"+b);this.vpaidViewmode=c>=screen.width&&b>=screen.height?"fullscreen":"normal";a.log("VPAIDRenderer videoMode: "+this.vpaidViewmode);
642this.vpaidCreative.resizeAd(c,b,this.vpaidViewmode)},getAdSkippableState:function(){return this.vpaidCreative.getAdSkippableState()}});a.VastTranslator=function(){this._rendererController=this._request=null};a.VastTranslator.prototype={start:function(b){function c(b){a.log("VastTranslator\t"+b)}function d(b){a.warn("VastTranslator\t"+b)}function e(a,b){if(a)if(a.length&&"string"!==typeof a)for(var c=0;c<a.length;c++)b(a[c].value);else a.value&&b(a.value)}function f(a,b){e(b,function(b){b&&a.push(b)})}
643function k(b){if(!b)return!1;for(var c=0;c<u.length;c++)if(a.Util.trim(u[c]).toLowerCase()===a.Util.trim(b).toLowerCase())return!0;return!1}function g(b){if(!b)return null;"string"!==typeof b&&(b=b.toString());b=a.Util.trim(b);return-1<b.indexOf("://")?b:null}function h(b,c){if(b&&b.length)for(var d=0;d<b.length;d++)h(b[d],c);else if(b.AdVerifications&&b.AdVerifications.Verification)if(b=b.AdVerifications.Verification,b.length)for(d=0;d<b.length;d++){var e=new a.AdVerification;e.parseFromVAST(b[d]);
644c.adVerifications.push(e)}else e=new a.AdVerification,e.parseFromVAST(b),c.adVerifications.push(e)}function l(){this.apiFramework=this.type=this.url=null;this.variableDuration=!1}
644function p(a){this.code=this.url=null;this.height=this.width=NaN;this.resourceType=this.creativeType=null;this.bitrate=NaN;this.creativeApi=null;this.ad=a;this.clickThrough=null;this.clickTrackings=[];this.customClicks=[];this.creativeData=null}function H(){this.creativeView=[];this.start=[];this.firstQuartile=[];this.midpoint=
645[];this.thirdQuartile=[];this.complete=[];this.mute=[];this.unmute=[];this.pause=[];this.rewind=[];this.resume=[];this.replay=[];this.fullscreen=[];this.expand=[];this.collapse=[];this.acceptInvitation=[];this.stop=[];this.skip=[];this.progress={};this.percentageProgress={}}function t(a){this._impressions=[];this.clickThrough=null;this.clickTrackings=[];this.customClicks=[];this.creativeData=null;this.sequence=-1;this.universalAdId=null;this.vastRenditions=[];this.duration=NaN;this.adp=a;this.isDrivingAd=
646!1;this.interactiveCreativeFiles=[];this.simidUrl=null;this.simidVariableDurationAllowed=!1;this.simidCreativeApi=this.simidContentType=null}function v(a){t.call(this,a)}function n(a){t.call(this,a)}function r(a){t.call(this,a)}function L(){}function y(a,b,d,e){if(a&&e&&0<e.length){c("augmentCallbacks("+b+", "+d+", "+e+")");for(var f=a.getEventCallbackUrls(b,d),q=0;q<f.length;q++)-1<e.indexOf(f[q])&&(c("augmentCallbacks() url = "+f[q]),e.unshift(f[q]));a.addEventCallbackUrls(b,d,e)}else c("augmentCallbacks("+
647b+", "+d+", "+e+"), empty callbacks")}function M(b,d){c("initErrorTrackings()");b&&d&&y(b,a.EVENT_ERROR,a.EVENT_TYPE_ERROR,d.errorTrackings)}function N(b,d){c("initTrackingEvents()");if(d&&b){y(b,a.EVENT_AD_IMPRESSION,a.EVENT_TYPE_IMPRESSION,d.creativeView);y(b,a.EVENT_AD_IMPRESSION,a.EVENT_TYPE_IMPRESSION,d.start);y(b,a.EVENT_AD_FIRST_QUARTILE,a.EVENT_TYPE_IMPRESSION,d.firstQuartile);y(b,a.EVENT_AD_MIDPOINT,a.EVENT_TYPE_IMPRESSION,d.midpoint);y(b,a.EVENT_AD_THIRD_QUARTILE,a.EVENT_TYPE_IMPRESSION,
648d.thirdQuartile);y(b,a.EVENT_AD_COMPLETE,a.EVENT_TYPE_IMPRESSION,d.complete);y(b,a.EVENT_AD_MUTE,a.EVENT_TYPE_STANDARD,d.mute);y(b,a.EVENT_AD_UNMUTE,a.EVENT_TYPE_STANDARD,d.unmute);y(b,a.EVENT_AD_PAUSE,a.EVENT_TYPE_STANDARD,d.pause);y(b,a.EVENT_AD_RESUME,a.EVENT_TYPE_STANDARD,d.resume);y(b,a.EVENT_AD_REWIND,a.EVENT_TYPE_STANDARD,d.rewind);y(b,a.EVENT_AD_EXPAND,a.EVENT_TYPE_STANDARD,d.fullscreen);y(b,a.EVENT_AD_COLLAPSE,a.EVENT_TYPE_STANDARD,d.collapse);y(b,a.EVENT_AD_EXPAND,a.EVENT_TYPE_STANDARD,
649d.expand);y(b,a.EVENT_AD_CLOSE,a.EVENT_TYPE_STANDARD,d.stop);y(b,a.EVENT_AD_ACCEPT_INVITATION,a.EVENT_TYPE_STANDARD,d.acceptInvitation);y(b,a.EVENT_AD_SKIPPED,a.EVENT_TYPE_STANDARD,d.skip);for(var e=Object.keys(d.progress),f=0;f<e.length;f++){var q=e[f];b.addProgressEventCallbackUrls(q,d.progress[q])}e=Object.keys(d.percentageProgress);for(f=0;f<e.length;f++)q=e[f],b.addPercentageProgressEventCallbackUrls(q,d.percentageProgress[q])}}
649function O(b,d,e,f,g){c("initClickAndImpressionEvents");if(b){d&&
650b.setClickThroughUrl(a.EVENT_AD_CLICK,d);e&&0<e.length&&y(b,a.EVENT_AD_CLICK,a.EVENT_TYPE_CLICK_TRACKING,e);if(f&&0<f.length)for(d=0;d<f.length;d++)f[d].url&&y(b,f[d].id,a.EVENT_TYPE_CLICK_TRACKING,[f[d].url]);g&&y(b,a.EVENT_AD_IMPRESSION,a.EVENT_TYPE_IMPRESSION,g)}}function Q(a,b){c("initTemporalAdInstance");a||d("initTemporalAdInstance: Invalid adInstance");if(b.selectedDrivingAd){b.surveyUrl&&a._creative.setParameter("_fw_survey_url",b.surveyUrl);var e=b.selectedDrivingAd,f=b.selectedDrivingRenditions;
651c("vastRenditions:"+f);for(var g=4===B,q=0;q<f.length;q++){var h=a.addCreativeRendition();var C=h.addCreativeRenditionAsset("VAST_CRA",!0);var l=f[q];a:{var m=l.creativeType;switch(m){case "video/mp4":m="video/mp4-h264";break a;case "video/3gp":m="video/3gpp"}}c("initTemporalAdInstance() set rendition/asset [vastRd.creativeApi,vastAd.duration,vastRd.width,vastRd.height,vastRd.url,assetContentType,vastRd.creativeType] =  "+[l.creativeApi,e.duration,l.width,l.height,l.url,m,l.creativeType]);h.setCreativeApi(l.creativeApi);
652isNaN(e.duration)||h.setDuration(e.duration);l.width&&!isNaN(l.width)&&h.setWidth(l.width);l.height&&!isNaN(l.height)&&h.setHeight(l.height);e.universalAdId&&h.setUniversalAdId(e.universalAdId);for(var p=$jscomp.makeIterator(e.interactiveCreativeFiles),n=p.next();!n.done;n=p.next())(n=n.value)&&"text/html"===n.type.toLowerCase()&&"simid"===n.apiFramework.toLowerCase()&&(h.setSimidCreativeUrl(n.url),h.setCreativeApi(n.apiFramework),h.setContentType(n.type),h.setSimidVariableDurationAllowed(n.variableDuration));
653l.url&&C.setUrl(l.url);l.code&&C.setContent(l.code);C.setMimeType(l.creativeType);"static"===l.resourceType&&"text/html"===l.creativeType?C.setContentType("text/html_doc_ref"):"application/x-javascript"===l.creativeType||"application/javascript"===l.creativeType?C.setContentType("text/js_ref"):"iframe"===l.resourceType?C.setContentType("text/html_doc_ref"):"text/html"===l.creativeType||"text/html_doc_ref"===l.creativeType?C.setContentType("text/html_doc_ref"):"text/html_doc_lit_mobile"===l.creativeType?
654C.setContentType("text/html_doc_lit_mobile"):g||k(m)?(C.setContentType("text/html_doc_lit_mobile"),C.setUrl(null),C.setContent(R(a,x.getCustomId(),e,l,"text/html_doc_lit_mobile"))):C.setContentType(m);e.creativeData&&0!==e.creativeData.length&&(c("initTemporalAdInstance(), set asset parameter creativeData:"+e.creativeData),h.setParameter("creativeData",e.creativeData));g||k(m)||(l=l.bitrate,!isNaN(l)&&0<l&&C.setBytes(1E3*l*e.duration/8));m=J;C=S;l=!1;if(h.getContentType()&&m)if(p=h.getContentType().toLowerCase(),
655n=m.toLowerCase(),p===n)l=!0;else if(0===p.indexOf("video/mp4")&&0===n.indexOf("video/mp4")||"application/javascript"===n&&"text/js_ref"===p)h.setContentType(m),l=!0;m=!1;h.getCreativeApi()&&C&&(p=h.getCreativeApi().toLowerCase(),n=C.toLowerCase(),p===n?m=!0:0===p.indexOf("mraid")&&0===n.indexOf("mraid")&&(m=!0,h.setCreativeApi(C)));l&&m?h.setPreference(10):m?h.setPreference(6):l?h.setPreference(5):h.setPreference(0);c("adjustMatchedRendition "+h.getId()+", contentType "+h.getContentType()+", creativeAPI "+
656h.getCreativeApi()+", preference "+h.getPreference())}N(a,e.trackingEvents);M(a,b);O(a,g?f[0].clickThrough:e.clickThrough,e.clickTrackings,e.customClicks,e.impressions);a.addAdVerificationsFromVast(b.adVerifications)}else h=a.addCreativeRendition(),h.setContentType("null/null"),C=h.addCreativeRenditionAsset("VAST_CRA",!0),C.setContentType("null/null")}function R(b,d,e,f,g){c("getCoadHTML, ad id = "+b.getAdId());return f.url&&0<f.url.length?((e=f.clickThrough)&&0<e.length&&b.setClickThroughUrl(a.EVENT_AD_CLICK,
657e),b=b.getEventCallbackUrls(a.EVENT_AD_CLICK,a.EVENT_TYPE_CLICK)[0],a.HTMLAdGenerator.generateAd(f.url,b,d,f.width,f.height,f.creativeType,g)):f.code&&0<f.code.length?"script"===f.resourceType||"text/javascript"===f.resourceType||"text/js_ref"===f.resourceType||"application/x-javascript"===f.resourceType?a.HTMLAdGenerator.wrapJSCode(f.code,d,f.width,f.height):a.HTMLAdGenerator.wrapUnsafeHTML(f.code,d,f.width,f.height):null}function K(b,d,e,f){c("initPageAdInstance ad:"+d.getAdId());var g=e.vastRenditions[0];
658if(g.url||g.code){var q=d.addCreativeRendition(),h=q.addCreativeRenditionAsset("VAST_CRA",!0);q.setCreativeApi(g.creativeApi);q.setWidth(g.width);q.setHeight(g.height);"static"===g.resourceType&&"text/html"===g.creativeType||"iframe"===g.resourceType?(h.setContentType("text/html_doc_ref"),h.setUrl(g.url)):"HTML"===g.resourceType?(h.setContentType("text/html_doc_lit_mobile"),h.setContent(a.HTMLAdGenerator.wrapUnsafeHTML(g.code,b.getCustomId(),g.width,g.height))):(h.setContentType("text/html_doc_lit_mobile"),
659h.setContent(R(d,b.getCustomId(),e,g,"text/html_doc_lit_mobile")));h.setMimeType("text/html")}else c("initPageAdInstance will add a tracking only companion ad");N(d,e.trackingEvents);M(d,f);O(d,g.clickThrough,g.clickTrackings,g.customClicks,e.impressions)}function E(b){if(200<=b.status&&400>b.status)if(b.responseXML){var d=(new L).parseAdData(b.responseXML);if(d){c("scheduleVastAds");if(d&&0!==d.length)if(b=d[0].selectedPackage,d=d[0].redirectPackage,!b&&!d)if(c("scheduleVastAds(), no ads from vast response!!!"),
660F)if(4!==B)w.onTranslatorFailed(a.ERROR_NO_AD_AVAILABLE,"Expecting linear ad but returned non-linear ad",a.ERROR_VAST_LINEARITY_NOT_MATCH);else w.onTranslatorFailed(a.ERROR_NO_AD_AVAILABLE,"Expecting non-linear ad but returned linear ad",a.ERROR_VAST_LINEARITY_NOT_MATCH);else w.onTranslatorFailed(a.ERROR_NO_AD_AVAILABLE,"wrapperUrl="+G);else if(!b&&d){c("scheduleVastAds(), no ads scheduled, redirect to downstream Secondary Ad Server");c("scheduleRedirect");b=[];var e=[];b.push(x);e.push({});for(var f=
661I,g=d.selectedCompanionAds,h=0;h<f.length;h++){var q=f[h];g&&g[q.getCustomId()]&&(b.push(q),e.push(g[q.getCustomId()]))}(f=w._rendererController.scheduleAdInstances(b))&&0<f.length&&(g=f[0],h=g.addCreativeRendition(),h.setWrapperUrl(a.Util.transformUrlToProxy(d.tagUrl)),h.setOriginalVastWrapperUrl(z.getActiveCreativeRendition().getOriginalVastWrapperUrl()),h.setWrapperType(T),h.setContentType(J),h.setCreativeApi(S),N(g,d.getTrackingEventsOfWrapper()),M(g,d),O(g,d.getClickThroughOfWrapper(),d.getClickTrackingsOfWrapper(),
662d.getCustomClicksOfWrapper(),d.getImpressionOfWrapper()),g.addAdVerificationsFromVast(d.adVerifications));c("scheduleRedirect, schedule companion for redirect ad "+d);for(h=1;h<f.length;h++)if(g=f[h])q=e[h],q instanceof r&&K(b[h],g,q,d)}else{if(b){c("scheduleVastAds(), ads returned from vast response, going to schedule them");b.selectedDrivingAd?(c("scheduleVastAds(), ads returned from vast response, going to schedule them with driving ad"),b.selectedDrivingAd.isDrivingAd=!0):c("scheduleVastAds(), ads returned from vast response, going to schedule them without driving ad");
663c("scheduleAdPackage()");d=[];e=[];d.push(x);b.selectedDrivingAd&&e.push(b.selectedDrivingAd);f=I;g=b.selectedCompanionAds;for(h=0;h<f.length;h++)q=f[h],g&&g[q.getCustomId()]&&(d.push(q),e.push(g[q.getCustomId()]));g=w._rendererController.scheduleAdInstances(d);if(0<g.length){c("scheduleAdPackage, scheduled "+g.length+" ads"+b.selectedDrivingAd?"":", 1 of it is nullAd for pure companion ad schedule");b.selectedDrivingAd||c("Driving ad is not selected, will create a dummy null ad.");b.selectedDrivingAd||
664(d.shift(),Q(g.shift(),b));for(h=0;h<g.length;h++)if(q=g[h]){var k=e[h];k instanceof r?K(d[h],q,k,b):Q(q,b)}!b.selectedDrivingAd&&0<f.length&&0<b.companionAds.length&&0===e.length&&(c("found empty companion slots and companion ads in package, but none of them matches slot size"),w.onTranslatorFailed(a.ERROR_UNMATCHED_SLOT_SIZE))}else c("scheduleAdPackage, no ad scheduled.")}}else c("no ads for scheduleVastAds");w._request=null;w._rendererController.handleStateTransition(a.TRANSLATOR_STATE_STARTED);
665w._rendererController.handleStateTransition(a.TRANSLATOR_STATE_COMPLETED)}}else w.onTranslatorFailed(a.ERROR_PARSE,"wrapperUrl="+G,a.ERROR_VAST_XML_PARSING);else if(0!=b.status)w.onTranslatorFailed(a.ERROR_IO,"wrapperUrl="+G)}this._rendererController=b;var u="image/gif image/jpeg image/png text/html text/javascript text/html_doc_ref text/html_doc_lit_mobile application/x-javascript application/javascript".split(" "),F=!1,z=this._rendererController.getAdInstance(),w=this,x=z.getSlot(),B=function(){if(!x)return 1;
666switch(x.getTimePositionClass()){case a.TIME_POSITION_CLASS_PREROLL:case a.TIME_POSITION_CLASS_MIDROLL:case a.TIME_POSITION_CLASS_POSTROLL:return 2;case a.TIME_POSITION_CLASS_OVERLAY:return 4;case a.TIME_POSITION_CLASS_DISPLAY:return x&&!x.getBase()?8:1;default:return 1}}(),I=this._rendererController.getCompanionSlots().filter(function(b){if(!b)return!1;switch(b.getTimePositionClass()){case a.TIME_POSITION_CLASS_PREROLL:case a.TIME_POSITION_CLASS_MIDROLL:case a.TIME_POSITION_CLASS_PAUSE_MIDROLL:case a.TIME_POSITION_CLASS_POSTROLL:return!1;
667default:return!0}});c("Checking CompanionSlots, length = "+I.length+", this._rendererController.getCompanionSlots().length = "+this._rendererController.getCompanionSlots().length+", AdInstance.getCompanionSlots.length = "+z.getCompanionSlots().length);var J=z.getActiveCreativeRendition().getContentType(),S=z.getActiveCreativeRendition().getCreativeApi()||"None";this.log("ExpectedDrivingContentType:"+J+", ExpectedDrivingAPI:"+S);var T=z.getActiveCreativeRendition().getWrapperType();l.prototype={init:function(a,
668b,c,d){this.url=a;this.type=b;this.apiFramework=c;this.variableDuration=d}};l.prototype.constructor=l;p.prototype={init:function(a,b,c,d,e,f,g,h){this.log("init("+[].slice.call(arguments,0).join(",")+")");this.url=a;this.width=1*b;this.height=1*c;this.creativeType=d;this.resourceType=e;this.bitrate=f;var q;if((q=g)&&0!==q.length)switch(q.toLowerCase()){case "flashvar":case "flashvars":q="clickTag";break;
668case "vpaid":q="VPAID";break;case "mraid":q="MRAID-1.0";break;case "simid":q="SIMID"}else q="None";
669this.creativeApi=q;this.code=h||null},log:function(b){a.log("VastTranslator.VastRendition\t"+b)},toString:function(){var a=[],b;for(b in this)this.hasOwnProperty(b)&&"function"!==typeof this[b]&&"ad"!==b&&a.push(b+":"+this[b]);return a.join(",")}};p.prototype.constructor=p;t.prototype={parse:function(b){this.log("parse()");b["@attributes"]&&b["@attributes"].hasOwnProperty("skipoffset")&&(z._setSkipOffset(b["@attributes"].skipoffset),z._setSkipOffsetPercentage(b["@attributes"].skipoffset));if(b.Duration)if(b.Duration.value){var c=
670/(\d+):(\d+):(\d+)/.exec(b.Duration.value);c?this.duration=3600*c[1]+60*c[2]+1*c[3]:this.warn("Failed to parse duration value for creative "+b)}else this.warn("No duration value set for creative "+b);b.VideoClicks&&(b.VideoClicks=[].concat(b.VideoClicks),a.Util.forEachOnArray(b.VideoClicks,function(a){a.ClickThrough&&a.ClickThrough.value&&(this.clickThrough=g(a.ClickThrough.value));var b;if(a.ClickTracking){a.ClickTracking=[].concat(a.ClickTracking);for(var c=0;c<a.ClickTracking.length;c++)(b=g(a.ClickTracking[c].value))&&
671this.clickTrackings.push(b)}if(a.CustomClick)for(a.CustomClick=[].concat(a.CustomClick),c=0;c<a.CustomClick.length;c++){var d=null;a.CustomClick[c]["@attributes"]&&(d=a.CustomClick[c]["@attributes"].id);(b=g(a.CustomClick[c].value))&&this.customClicks.push({id:d,url:b})}},this));b.MediaFiles&&b.MediaFiles.MediaFile&&(b.MediaFiles.MediaFile=[].concat(b.MediaFiles.MediaFile),a.Util.forEachOnArray(b.MediaFiles.MediaFile,function(a){var b=g(a.value),
671c=NaN,d=NaN,e=null,f="None",h=NaN;a["@attributes"]&&
672(c=a["@attributes"].width||NaN,d=a["@attributes"].height||NaN,e=a["@attributes"].type,f=a["@attributes"].apiFramework||"None",h=a["@attributes"].bitrate||NaN);b&&-1!==b.indexOf(":")?(a=new p(this),a.init(b,c,d,e,"",h,f,null),a.clickThrough=this.clickThrough,this.vastRenditions.push(a),(isNaN(c)||isNaN(d))&&this.log("continue with missing [width,height]"+[c,d])):this.warn("will ignore this mediaFile because some required field is missing [url,width,height]:"+[b,c,d])},this));b.MediaFiles&&b.MediaFiles.InteractiveCreativeFile&&
673(b.MediaFiles.InteractiveCreativeFile=[].concat(b.MediaFiles.InteractiveCreativeFile),a.Util.forEachOnArray(b.MediaFiles.InteractiveCreativeFile,function(a){var b=g(a.value);if(a["@attributes"]){var c=a["@attributes"].type;var d=a["@attributes"].apiFramework;a=a["@attributes"].variableDuration;var e=new l;e.init(b,c,d,a);this.interactiveCreativeFiles.push(e)}},this));b.TrackingEvents&&this.parseTrackingEvents(b.TrackingEvents,this.setTrackingEvents());b.AdParameters&&(this.log("parse() got AdParameters:"+
674b.AdParameters.value),this.creativeData=b.AdParameters.value);b.Companion&&(b.Companion=[].concat(b.Companion),a.Util.forEachOnArray(b.Companion,function(b){var c=null,d=null,e="",f="",h=null,q=null,l=!1;b.CompanionClickThrough&&(f=g(b.CompanionClickThrough.value));b.StaticResource&&(c=g(b.StaticResource.value),b.StaticResource["@attributes"]&&(d=b.StaticResource["@attributes"].creativeType),e="static");b.IFrameResource&&(c=g(b.IFrameResource.value))&&(d="text/html_doc_ref",e="iframe");b.HTMLResource&&
675(h=b.HTMLResource["#cdata-section"]||"",h=a.Util.trim(h))&&(d="text/html_doc_lit_mobile",e="HTML");b.TrackingEvents&&(q=b.TrackingEvents);var m=new r(this.adp);m.sequence=this.sequence;m.clickThrough=f;q&&m.parseTrackingEvents(q,m.setTrackingEvents());if(b["@attributes"]){q=b["@attributes"].width||NaN;var C=b["@attributes"].height||NaN;b=b["@attributes"].apiFramework||"None";if((c&&-1!==c.indexOf(":")||h)&&!isNaN(q)&&!isNaN(C)&&k(d)||this.adp.isWrapper){var W=new p(m);W.init(c,q,C,d,e,NaN,b,h);W.clickThrough=
676f;m.vastRenditions.push(W)}else l=!0,this.warn("will ignore this rendition because some required fields is missing or incompatible [creativeType,url,code,width,height]:"+[d,c,h,q,C])}else this.adp.isWrapper||(l=!0,this.warn("for InLine ad package, No attributes found for the Companion ads:"+b));l?this.adp.isWrapper&&this.adp.companionAds.push(m):this.adp.companionAds.push(m)},this));b.NonLinear&&(b.NonLinear=[].concat(b.NonLinear),a.Util.forEachOnArray(b.NonLinear,function(b){var c=null,d=null,e=
677"",f="",h="",q=null,l=!1;b.AdParameters&&(h=b.AdParameters.value);b.NonLinearClickThrough&&(f=g(b.NonLinearClickThrough.value));b.StaticResource&&(c=g(b.StaticResource.value),b.StaticResource["@attributes"]&&(d=b.StaticResource["@attributes"].creativeType),e="static");b.IFrameResource&&(c=g(b.IFrameResource.value),d="text/html_doc_ref",e="iframe");b.HTMLResource&&(q=b.HTMLResource["#cdata-section"]||"",q=a.Util.trim(q),d="text/html_doc_lit_mobile",e="HTML");var m=new n(this.adp);m.sequence=this.sequence;
678m.clickThrough=f;m._trackingEvents=this._trackingEvents;h&&(m.creativeData=h);if(b["@attributes"]){h=b["@attributes"].width||NaN;var C=b["@attributes"].height||NaN;b=b["@attributes"].apiFramework||"None";if(!c&&!q||isNaN(h)||isNaN(C)||!k(d))l=!0,this.warn("will ignore this rendition because some required fields is missing or incompatible:[creativeType,url,code,width,height]:"+[d,c,q,h,C]);else{var W=new p(m);W.init(c,h,C,d,e,NaN,b,q);W.clickThrough=f;m.vastRenditions.push(W)}}else this.adp.isWrapper||
679(l=!0,this.warn("for InLine ad package, No attributes found for the NonLinear ads:"+b));this.adp.nonLinearAds.push(m);l?this.adp.isWrapper&&this.adp.nonLinearAds.push(m):this.adp.nonLinearAds.push(m)},this))},parseLinears:function(a){2!==B?(this.log("TargetAdType != TARGET_LINEAR, skipping parse"),F=!0):this.parse(a)},parseNonLinears:function(a){4!==B?(this.log("TargetAdType != TARGET_NONLINEAR, skipping parse"),F=!0):this.parse(a)},parseCompanionAds:function(a){this.parse(a)},setTrackingEvents:function(){this._trackingEvents||
680(this._trackingEvents=new H);return this._trackingEvents},parseTrackingEvents:function(b,c){this.log("parseTrackingEvents");b.Tracking&&(b.Tracking=[].concat(b.Tracking),a.Util.forEachOnArray(b.Tracking,function(b){var d=b["@attributes"].event,e=g(b.value);if(e)switch(d){case "creativeView":case "start":case "firstQuartile":case "midpoint":case "thirdQuartile":case "complete":case "mute":case "unmute":case "pause":case "resume":case "rewind":case "replay":case "fullscreen":case "expand":case "collapse":case "acceptInvitation":case "stop":case "skip":c[d].push(e);
681break;case "progress":d=a.Util.offsetStringToSecond(b["@attributes"].offset,this.duration);-1!=d&&(c.progress[d]||(c.progress[d]=[]),c.progress[d].push(e));b=a.Util.offsetStringToPercentage(b["@attributes"].offset);-1!=b&&(c.percentageProgress[b]||(c.percentageProgress[b]=[]),c.percentageProgress[b].push(e));break;case "close":c.stop.push(e)}},this),a.debug("********** events:",c))},toString:function(){return this.constructor.name+", renditions:"+this.vastRenditions},log:function(b){a.log("VastTranslator."+
682this.constructor.name+"\t"+b)},warn:function(b){a.warn("VastTranslator."+this.constructor.name+"\t"+b)}};b=Object.defineProperty||function(a,b,c){c.get&&a.__defineGetter__(b,c.get);c.set&&a.__defineSetter__(b,c.set)};b(t.prototype,"trackingEvents",{get:function(){this.log("get trackingEvents()");return this._trackingEvents?this._trackingEvents:this.isDrivingAd?this.adp.trackingEvents:null}});b(t.prototype,"impressions",{set:function(a){this._impressions=a},get:function(){return this.isDrivingAd?this._impressions.concat(this.adp.impressions):
683this._impressions}});t.prototype.constructor=t;v.prototype=new t;v.prototype.constructor=v;n.prototype=new t;n.prototype.constructor=n;r.prototype=new t;r.prototype.getPrimaryRendition=function(){return this.vastRenditions[0]||null};b(r.prototype,"impressions",{get:function(){return 8===B?this._impressions.concat(this.adp.impressions):this._impressions}});r.prototype.constructor=r;var U=function(){this.impressions=[];this.errorTrackings=[];this.linearAds=[];this.nonLinearAds=[];this.companionAds=
684[];this.extensions=[];this.tagUrl="";this.isWrapper=!1;this.surveyUrl=null;this.selectedDrivingRenditions=[];this.selectedDrivingAd=null;this.selectedCompanionAds={};this.adVerifications=[]};U.prototype={parse:function(a){this.log("parse("+a+")");if(a)if(this.isWrapper||a.Creatives&&a.Creatives.Creative){a.Creatives=a.Creatives||[];f(this.impressions,a.Impression);f(this.extensions,a.Extensions);f(this.errorTrackings,a.Error);this.isWrapper&&a.VASTAdTagURI&&(this.tagUrl=a.VASTAdTagURI.value||"");
685a.Survey&&a.Survey.value&&0<a.Survey.value.length&&(this.surveyUrl=a.Survey.value);a.Creatives.Creative=a.Creatives.Creative?[].concat(a.Creatives.Creative):[];for(var b=0;b<a.Creatives.Creative.length;b++){var c=a.Creatives.Creative[b],d=-1;c["@attributes"]&&(d=c["@attributes"].sequence||-1,d*=1);if(c.Linear){var e=new v(this);e.sequence=d;e.parseLinears(c.Linear);this.linearAds.push(e)}else c.NonLinearAds?(e=new n(this),e.sequence=d,e.parseNonLinears(c.NonLinearAds)):c.CompanionAds&&(e=new r(this),
686e.sequence=d,e.parseCompanionAds(c.CompanionAds));e&&c.UniversalAdId?(e.universalAdId={idRegistry:c.UniversalAdId["@attributes"].idRegistry,idValue:c.UniversalAdId["@attributes"].idValue},this.log("Universal Ad ID with idRegistry "+e.universalAdId.idRegistry+" and idValue "+e.universalAdId.idValue)):this.log("No Universal Ad ID is present in the VAST response.")}a.Extensions&&a.Extensions.Extension&&h(a.Extensions.Extension,this);a.AdVerifications&&h(a,this)}else this.warn("parse(): no creative found!");
687else this.warn("parse(): empty adpackage")},testAndUpdatePackageForTemporalSlot:function(a){this.log("testAndUpdatePackageForTemporalSlot("+a+")");a=a?this.linearAds:this.nonLinearAds;
687if(1>a.length)return!1;this.log("testAndUpdatePackageForTemporalSlot(), ads.length = "+a.length+"");var b=!1;if(!b)for(var c=0;c<a.length;c++){var d=this.findRenditionGroupByContentType(a[c]);if(0<d.length){this.log("testAndUpdatePackageForTemporalSlot() : found driving ad and renditions group: "+d);this.selectedDrivingRenditions=
688d;this.selectedDrivingAd=a[c];b=!0;break}}return b},testAndUpdatePackageForPageSlots:function(a){var b=!1,c=this.companionAds,d=I.slice(0);this.log("testAndUpdatePackageForPageSlots("+a+"), ads are "+c.join(",")+", slots are "+d.join(","));if(a){if(a=this.matchAdsToSlots(c,d),0<a.length)for(b=!0,c=0;c<a.length;c++){d=a[c];var e=d.ad;this.selectedCompanionAds[d.slot.getCustomId()]=e}}else a=this.matchAdsToSlots(c,[x]),1===a.length?(b=!0,this.selectedDrivingAd=a[0].ad):this.selectedDrivingAd=null;return b},
689renditionFitsInSlot:function(a,b){return a?a.width<=b.getWidth()&&a.height<=b.getHeight():!1},calcDeadSpaceRatio:function(a,b){a=a.getPrimaryRendition();if(!a)return 0;this.log("ad w,h  slot w,h"+[a.width,a.height,b.getWidth(),b.getHeight()]);return this.renditionFitsInSlot(a,b)?1-a.width*a.height/b.getWidth()*b.getHeight():1},matchAdsToSlots:function(a,b){this.log("matchAdsToSlots(ads="+a.join(",")+", slots="+b.join(",")+")");for(var c=[],d=null,e=null,f=1,g=0;g<a.length;g++)for(var h=a[g],k=0;k<
690b.length;k++){var l=b[k],q=this.calcDeadSpaceRatio(h,l);q<f&&(d=h,e=l,f=q)}null!=d&&(c.push({ad:d,slot:e}),a.splice(a.indexOf(d),1),b.splice(b.indexOf(e),1),c=c.concat(this.matchAdsToSlots(a,b)));this.log("matchAdsToSlots: winningAd:"+d+" winningSlot:"+e+" ratio:"+f);return c},getAllRenditions:function(a){return a.vastRenditions},findRenditionGroupByContentType:function(b){this.log("findRenditionGroupByContentType:"+b);var c=[];if(b instanceof v&&isNaN(b.duration))return this.warn("findRenditionGroupByContentType(), duration of linear ad is NaN, will not used for scheduling"),
691c;for(var d=this.getAllRenditions(b),e=0;e<d.length;e++){var f=d[e];if(b instanceof v){if(null==f.creativeType||""===a.Util.trim(f.creativeType)){this.warn("findRenditionGroupByContentType, the contentType "+f.creativeType+" not supported for linearAd");continue}}else if(!k(f.creativeType)){this.warn("findRenditionGroupByContentType, the contentType "+f.creativeType+" not supported for non-linearAd");continue}c.push(f)}return c},formalizeString:function(b){return b?a.Util.trim(b).toLowerCase():""},
692getAdsByTargetType:function(){this.log("getAdsByTargetType");var a=[];switch(B){case 8:a=this.companionAds;break;case 2:a=this.linearAds;break;case 4:a=this.nonLinearAds}for(var b=0;b<a.length;b++)a[b].isDrivingAd=!0;return a},getImpressionOfWrapper:function(){this.log("getImpressionOfWrapper");for(var a=this.getAdsByTargetType(),b=null,c=0;c<a.length;c++){var d=a[c];if(d&&d._impressions&&0<d._impressions.length){b=d._impressions;break}}b||(b=this.impressions);return b},getTrackingEventsOfWrapper:function(){this.log("getTrackingEventsOfWrapper");
693for(var a=this.getAdsByTargetType(),b=null,c=0;c<a.length;c++){var d=a[c];if(d&&d._trackingEvents){b=d._trackingEvents;break}}return b},getClickThroughOfWrapper:function(){this.log("getClickThroughOfWrapper");for(var a=this.getAdsByTargetType(),b=null,c=0;c<a.length;c++){var d=a[c];if(d){d.clickThrough&&(b=d.clickThrough);d=d.vastRenditions;for(var e=0;e<d.length;e++){var f=d[e];if(f.clickThrough){b=f.clickThrough;break}}if(b)break}}return b},getClickTrackingsOfWrapper:function(){this.log("getClickTrackingsOfWrapper");
694for(var a=this.getAdsByTargetType(),b=null,c=0;c<a.length;c++){var d=a[c];if(d){d.clickTrackings&&0<d.clickTrackings.length&&(b=d.clickTrackings);d=d.vastRenditions;for(var e=0;e<d.length;e++){var f=d[e];if(f.clickTrackings&&0<f.clickTrackings.length){b=f.clickTrackings;break}}if(b)break}}return b},getCustomClicksOfWrapper:function(){this.log("getCustomClicksOfWrapper");for(var a=this.getAdsByTargetType(),b=null,c=0;c<a.length;c++){var d=a[c];if(d){d.customClicks&&0<d.customClicks.length&&(b=d.customClicks);
695d=d.vastRenditions;for(var e=0;e<d.length;e++){var f=d[e];if(f.customClicks&&0<f.customClicks.length){b=f.customClicks;break}}if(b)break}}return b},testWrapperForRedirect:function(){this.log("testAndUpdateWrapperForRedirect()");return this.tagUrl&&0<this.tagUrl.length},log:function(b){a.log("VastTranslator.VastAdPackage\t"+b)},warn:function(b){a.warn("VastTranslator.VastAdPackage\t"+b)}};U.prototype.constructor=U;L.prototype={getVastVersion:function(a){this.log("getVastVersion("+a+")");return a&&
6960!==a.indexOf(".")?0<a.indexOf(".")?parseInt(a.substring(0,a.indexOf("."))):parseInt(a):-1},parseAdData:function(b){this.log("parseAdData()");var c={},d;c.selectedPackage=null;c.redirectPackage=null;var e=a.Util.xmlToJson(b);if(e)if(e.VAST&&e.VAST["@attributes"])if(this.getVastVersion(e.VAST["@attributes"].version)<a.MINIMUM_VAST_VERSION_SUPPORTED||this.getVastVersion(e.VAST["@attributes"].version)>a.MAXIMUM_VAST_VERSION_SUPPORTED)w.onTranslatorFailed(a.ERROR_PARSE,"wrapperUrl="+G,a.ERROR_VAST_VERSION_NOT_SUPPORTED);
697else{if(e.VAST.Ad){e.VAST.Ad=[].concat(e.VAST.Ad);var f=[];b=[];for(d=0;d<e.VAST.Ad.length;d++){var g=new U;g.isWrapper=!!e.VAST.Ad[d].Wrapper;g.isWrapper?(g.parse(e.VAST.Ad[d].Wrapper),b.push(g)):(g.parse(e.VAST.Ad[d].InLine),f.push(g))}e=!1;if(0===f.length&&0===b.length)return this.log("parseAdData(): no ads from vast response!!!"),[c];this.log("parseAdData(): "+f.length+"inline ads, "+b.length+" wrapper ads.");g=null;for(d=0;d<f.length;d++)if(this.selectUsableAdsForDrivingSlot(f[d])){this.log("parseAdData(): package for driving slot is found!!!");
698g=f[d];break}d=0<I.length&&z.getSlot().getTimePositionClass()!==a.TIME_POSITION_CLASS_DISPLAY;if(g)d&&this.selectUsableAdsCompanionSlots(g)&&this.log("parseAdData(): companion ads are found for companion slots, with driving slot"),c.selectedPackage=g;else if(d){d=!1;for(var h=0;h<f.length;h++)g=f[h],this.selectUsableAdsCompanionSlots(g)&&(this.log("parseAdData(): companion ads are found for companion slots,without driving slot"),c.selectedPackage=g,d=!0);d||(this.log("parseAdData(): companion ads are not found for companion slots,without driving slot"),
699e=!0)}else this.log("parseAdData(): no usable ads found in vast response!!!"),e=!0;if(e&&0<b.length)for(f=0;f<b.length;f++)if(this.testWrapperForRedirect(b[f])){c.redirectPackage=b[f];0==z.getWrapperCount()&&z.getActiveCreativeRendition().setOriginalVastWrapperUrl(G);z.incrementWrapperCount();this.selectUsableAdsCompanionSlots(b[f])&&this.log("parseAdData(): companion ads are found for wrapper ad");break}return[c]}e.VAST.Error&&y(z,a.EVENT_ERROR,a.EVENT_TYPE_ERROR,e.VAST.Error.value);w.onTranslatorFailed(a.ERROR_NO_AD_AVAILABLE,
700"wrapperUrl="+G,a.ERROR_VAST_NO_AD)}else w.onTranslatorFailed(a.ERROR_PARSE,"wrapperUrl="+G,a.ERROR_VAST_SCHEMA_VALIDATION);else w.onTranslatorFailed(a.ERROR_PARSE,"wrapperUrl="+G,a.ERROR_VAST_XML_PARSING)},selectUsableAdsForDrivingSlot:function(a){this.log("selectUsableAdsForDrivingSlot()");switch(B){case 2:a=this.testAndUpdatePackageForTemporalSlot(a,!0);break;case 4:a=this.testAndUpdatePackageForTemporalSlot(a,!1);break;case 8:a=this.testAndUpdatePackageForPageSlots(a,!1);break;default:a=!1}return a},
701selectUsableAdsCompanionSlots:function(a){this.log("selectUsableAdsCompanionSlots(pk)");return this.testAndUpdatePackageForPageSlots(a,!0)},testAndUpdatePackageForTemporalSlot:function(a,b){this.log("testAndUpdatePackageForTemporalSlot(pk,isLinear), isLinear = "+b);return a.testAndUpdatePackageForTemporalSlot(b)},testAndUpdatePackageForPageSlots:function(a,b){this.log("testAndUpdatePackageForPageSlots(pk,isCompanion) isCompanion = "+b);return a.testAndUpdatePackageForPageSlots(b)},testWrapperForRedirect:function(a){this.log("testWrapperForRedirect(pk)");
702return a.testWrapperForRedirect()},log:function(b){a.log("VastTranslator.VastParser\t"+b)},warn:function(b){a.warn("VastTranslator.VastParser\t"+b)}};var G=z.getActiveCreativeRendition().getWrapperUrl();b=z.getActiveCreativeRendition().getWrapperType();c("AdInstance.getActiveCreativeRendition().getWrapperUrl()="+G+", getWrapperType()="+b);if(0!==b.indexOf("external/vast-"))w.onTranslatorFailed(a.ERROR_NO_RENDERER,"wrapperType="+b+";wrapperUrl="+G,a.ERROR_VAST_TRACKING_ERROR);else if(G&&0!==G.length){var V=
703a.VAST_DEFAULT_MAX_WRAPPER_COUNT;(b=this._rendererController.getParameter(a.PARAMETER_VAST_MAX_WRAPPER_COUNT))&&0<Number(b)&&(V=Number(b));b=z.getWrapperCount();if(b>=V)V=z.getActiveCreativeRendition().getOriginalVastWrapperUrl(),w.onTranslatorFailed(a.ERROR_IO,"maximum wrapper limit is reached: "+b+" wrapperUrl="+V,a.ERROR_VAST_WRAPPER_LIMIT_REACH);else{V=this._rendererController.getParameter("translator.vast.asyncLoad");V=!0===a.Util.str2bool(V);c("will load vast xml, asyncAjax:"+V);var X=this._rendererController.getParameter("translator.vast.loadWithCookie");
704X=!0===a.Util.str2bool(X);var D=null,Y=5E3;(b=this._rendererController.getParameter(a.PARAMETER_VAST_TIMEOUT_IN_MILLISECONDS))&&0<Number(b)&&(Y=Number(b));try{window.XDomainRequest?(D=new XDomainRequest,V=!0):(D=new XMLHttpRequest,D.withCredentials=X),w._request=D,V?(D.open("GET",G),window.XDomainRequest?D.onload=function(){var a=new ActiveXObject("Microsoft.XMLDOM");a.async=!1;a.loadXML(D.responseText);D.responseXML=a;D.status=200;E(D)}:(D.timeout=Y,D.onreadystatechange=function(){4===D.readyState&&
705E(D)}),D.ontimeout=function(){w.onTranslatorFailed(a.ERROR_TIMEOUT,"wrapperUrl="+G+" timed out.",a.ERROR_VAST_URI_TIMEOUT)},D.onerror=function(){window.XDomainRequest&&(D.status=0);0===D.status?(d("CORS error"),w.onTranslatorFailed(a.ERROR_SECURITY,"wrapperUrl="+G)):(d("exception:"+D.statusText),w.onTranslatorFailed(a.ERROR_UNKNOWN,"wrapperUrl="+G+";exception="+D.statusText))},D.send()):(D.open("GET",G,!1),D.send(),E(D))}catch(q){b=!1;if(!window.XMLHttpRequestException)q.code===DOMException.NETWORK_E
705RR&&
706(d("CORS in IE10"),b=!0);else if(q instanceof XMLHttpRequestException)switch(q.code){case XMLHttpRequestException.NETWORK_ERR:b=!0}b?(d("CORS error:"+q),w.onTranslatorFailed(a.ERROR_SECURITY,"wrapperUrl="+G)):(d("exception:"+q),w.onTranslatorFailed(a.ERROR_UNKNOWN,"wrapperUrl="+G+";exception="+q))}}}else w.onTranslatorFailed(a.ERROR_NULL_ASSET,"wrapperUrl="+G,a.ERROR_VAST_TRACKING_ERROR)},info:function(){return{moduleType:a.MODULE_TYPE_TRANSLATOR}},log:function(b){a.log("VastTranslator\t"+b)},warn:function(b){a.warn("VastTranslator\t"+
707b)},getPlayheadTime:function(){return-1},getDuration:function(){return-1},stop:function(){a.debug("VastTranslator stop");this._request&&(this._request.abort(),a.log("VastTranslator Stop: request aborted"));this._request=null;this._rendererController&&this._rendererController.handleStateTransition(a.TRANSLATOR_STATE_COMPLETED)},onTranslatorFailed:function(b,c,d){this._request&&(this._request=null);var e={};e[a.INFO_KEY_ERROR_MODULE]="VastTranslator";e[a.INFO_KEY_ERROR_CODE]=b;e[a.INFO_KEY_VAST_ERROR_CODE]=
708d;c&&(e[a.INFO_KEY_ERROR_INFO]=c);this._rendererController.handleStateTransition(a.TRANSLATOR_STATE_FAILED,e)}};a.VastTranslator.prototype.constructor=a.VastTranslator;a.ContentVideoExtension=function(){this.autoSourceRestore=this.respondPauseResume=!0;this._originalTime=0;this._contentVideoControls=this._contentVideoSrc=null};a.ContentVideoExtension.prototype={_isEnabled:function(){var b=this._context.getParameter(a.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED);return(null==b||!0===a.Util.str2bool(b))&&
709null!=this._context.getContentVideoElement()},init:function(b){a.debug("ContentVideoExtension.init(context)");this._context=b;this._fixContentVideoCurrentTime=a.Util.bind(this,function(b){a.log("_fixContentVideoCurrentTime: event = "+b.type);if(!(0>=this._context.getContentVideoElement().currentTime||0>=this._context.getContentVideoElement().seekable.length)&&(this._context.getContentVideoElement().removeEventListener("timeupdate",this._fixContentVideoCurrentTime,!1),0<this._context.getContentVideoElement().currentTime&&
7101>this._context.getContentVideoElement().currentTime&&1<this._originalTime)){a.log("ContentVideoExtension: seeking to original time",this._originalTime);try{this._context.getContentVideoElement().currentTime=this._originalTime}catch(d){a.warn("ContentVideoExtension: seek error")}}});this._pause=a.Util.bind(this,function(b){a.log("_pause: event = "+b.type);this._isEnabled()?this._respondPauseResume()&&(a.debug("ContentVideoExtension: EVENT_CONTENT_VIDEO_PAUSE_REQUEST pausing content video",this._context.getContentVideoElement().src),
711this._originalTime=this._context.getContentVideoElement().currentTime,this._context.getContentVideoElement().pause()):a.debug("ContentVideoExtension: extension is not enabled, do nothing.")});this._resume=a.Util.bind(this,function(b){a.log("_resume: event = "+b.type);this._isEnabled()?this._respondPauseResume()&&(a.debug("ContentVideoExtension: EVENT_CONTENT_VIDEO_RESUME_REQUEST resume content video",this._context.getContentVideoElement().src),!this._context._videoAsset||null!=this._context._videoAsset._state&&
712this._context._videoAsset._state!==a.VIDEO_STATE_COMPLETED?(a.log("ContentVideoExtension: resume content video"),this._context.getContentVideoElement().play(),a.PLATFORM_AUTO_SEEK_AFTER_MIDROLL&&!0===a.Util.getBooleanParameter(a.PARAMETER_EXTENSION_CONTENT_VIDEO_AUTO_SEEK_BACK,!0)&&this._context.getContentVideoElement().addEventListener("timeupdate",this._fixContentVideoCurrentTime,!1)):a.warn("ContentVideoExtension: video state is uninitialized or completed, skip resume.")):a.debug("ContentVideoExtension: extension is not enabled, do nothing.")});
713this._onAttach=a.Util.bind(this,function(b){if(!this._isEnabled())a.debug("ContentVideoExtension: extension is not enabled, do nothing.");else if(this._autoSourceRestore())switch(b.slot.getTimePositionClass()){case a.TIME_POSITION_CLASS_PREROLL:case a.TIME_POSITION_CLASS_POSTROLL:a.debug("ContentVideoExtension: store current content video src",this._context.getContentVideoElement().src),this._contentVideoSrc=this._context.getContentVideoElement().src,this._contentVideoControls=this._context.getContentVideoElement().controls,
714this._context.getContentVideoElement().paused||this._context.getContentVideoElement().pause()}});this._onDetach=a.Util.bind(this,function(b){if(!this._isEnabled())a.debug("ContentVideoExtension: extension is not enabled, do nothing.");else if(this._autoSourceRestore())switch(b=b.slot.getTimePositionClass(),b){case a.TIME_POSITION_CLASS_PREROLL:case a.TIME_POSITION_CLASS_POSTROLL:a.debug("ContentVideoExtension: restore content video src to",this._contentVideoSrc),this._context.getContentVideoElement().src!==
715this._contentVideoSrc&&(this._context.getContentVideoElement().src=this._contentVideoSrc),this._context.getContentVideoElement().controls=this._contentVideoControls,b===a.TIME_POSITION_CLASS_PREROLL&&this._context.getContentVideoElement().load()}});a.debug("ContentVideoExtension: enabling content video pause resume request handling.");this._context.addEventListener(a.EVENT_CONTENT_VIDEO_PAUSE_REQUEST,this._pause);this._context.addEventListener(a.EVENT_CONTENT_VIDEO_RESUME_REQUEST,this._resume);a.debug("ContentVideoExtension: enabling content video source management.");
716this._context.addEventListener(a.EVENT_SLOT_STARTED,this._onAttach);this._context.addEventListener(a.EVENT_SLOT_ENDED,this._onDetach)},_respondPauseResume:function(){return a.Util.getBooleanParameter(a.PARAMETER_EXTENSION_CONTENT_VIDEO_RESPOND_PAUSE_RESUME,!0)},_autoSourceRestore:function(){return a.Util.getBooleanParameter(a.PARAMETER_EXTENSION_CONTENT_VIDEO_AUTO_SOURCE_RESTORE,!0)},dispose:function(){a.debug("ContentVideoExtension.dispose()");this._context&&(this._context.removeEventListener(a.EVENT_CONTENT_VIDEO_PAUSE_REQUEST,
717this._pause),this._context.removeEventListener(a.EVENT_CONTENT_VIDEO_RESUME_REQUEST,this._resume),this._context.removeEventListener(a.EVENT_SLOT_STARTED,this._onAttach),this._context.removeEventListener(a.EVENT_SLOT_ENDED,this._onDetach),this._context=null)}};a.ContentVideoExtension.prototype.constructor=a.ContentVideoExtension;return a};l.tv.freewheel.SDK||(l.tv.freewheel.SDK=l.tv.freewheel[h]("tv.freewheel.SDK"));return l})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.