":">",'"':""","'":"'","/":"/"};return t.replace(/[&<>"'/]/gi,(function(t){return e[t]}))}var De=function(){function t(t,e){this._adAdapter=t,this._viewabilityDetector=e,this._isDesktopOrTablet=(0,z.nI)()||(0,z.Em)(),this.configureStyle(),this.setWrapperContent(),e.onViewabilityChange(this.onViewabilityChange.bind(this))}return Object.defineProperty(t.prototype,"element",{get:function(){return this._ctaWrapper},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_ctaConfig",{get:function(){return this._adAdapter.ctaConfig},enumerable:!1,configurable:!0}),t.prototype.configureStyle=function(){var t,e,n,r,i,o,a,s,u,c,p,l,d,f,h="";(null===(t=this._ctaConfig)||void 0===t?void 0:t.top)&&(h+="top:".concat(this._ctaConfig.top,"px;bottom:auto;")),(null===(e=this._ctaConfig)||void 0===e?void 0:e.right)&&(h+="right:".concat(this._ctaConfig.right,"px;left:auto;")),(null===(n=this._ctaConfig)||void 0===n?void 0:n.bottom)&&(h+="bottom:".concat(this._ctaConfig.bottom,"px;top:auto;")),(null===(r=this._ctaConfig)||void 0===r?void 0:r.left)&&(h+="left:".concat(this._ctaConfig.left,"px;right:auto;")),(null===(i=this._ctaConfig)||void 0===i?void 0:i.padding)&&(h+="padding:".concat(this._ctaConfig.padding,";")),(null===(o=this._ctaConfig)||void 0===o?void 0:o.bgColor)&&(h+="background-color:".concat(this._ctaConfig.bgColor,";")),(null===(a=this._ctaConfig)||void 0===a?void 0:a.borderRadius)&&(h+="border-radius:".concat(this._ctaConfig.borderRadius,";")),(null===(s=this._ctaConfig)||void 0===s?void 0:s.textColor)&&(h+="color:".concat(this._ctaConfig.textColor,";"));var _="";(null===(c=null===(u=this._ctaConfig)||void 0===u?void 0:u.button)||void 0===c?void 0:c.bgColor)&&(_+="background-color:".concat(this._ctaConfig.button.bgColor,";")),(null===(l=null===(p=this._ctaConfig)||void 0===p?void 0:p.button)||void 0===l?void 0:l.textColor)&&(_+="color:".concat(this._ctaConfig.button.textColor,";"));var v="",y="";(null===(f=null===(d=this._ctaConfig)||void 0===d?void 0:d.advertiser)||void 0===f?void 0:f.textColor)&&(v+="color:".concat(this._ctaConfig.advertiser.textColor,";"),y+="background-color:".concat(this._ctaConfig.advertiser.textColor,";")),this._styles={wrapper:h,button:_,advertiser:v,dot:y}},t.prototype.setWrapperContent=function(){var t,e=this._styles;this._ctaWrapper=i("div",[{key:"class",value:"cta-wrapper align-".concat((null===(t=this._ctaConfig)||void 0===t?void 0:t.right)?"right":"left"," cta-").concat(this._isDesktopOrTablet?"desktop":"mobile")},{key:"style",value:e.wrapper}]);var n=xe(this._adAdapter.headline),r=n;r.length>50&&(r=r.slice(0,50)+"...");var o=xe(this._adAdapter.source),a=xe(this._adAdapter.callToAction);this._ctaWrapper.innerHTML=this._getCtaMarkup(o,r,a,n)},t.prototype._getCtaMarkup=function(t,e,n,r){var i=this._styles,o='\n \n '.concat(t?"Ad: ".concat(t,""):"","\n
").concat(e,'
\n \n \n "),a='\n \n
').concat(e,'
\n \n \n ");return this._isDesktopOrTablet?a:o},t.prototype.onViewabilityChange=function(t){t>=50?this._ctaWrapper.classList.add("show"):this._ctaWrapper.classList.remove("show")},t}(),Le=function(){function t(t,e){var n,r;this._icon=t,this._demoMode=e,this._isShow=!1,this._position={left:void 0,right:void 0,top:void 0,bottom:void 0};var i=(0,M.Os)(null!==(n=this._icon.duration)&&void 0!==n?n:"0")/1e3;this._offsetInSec=(0,M.Os)(null!==(r=this._icon.offset)&&void 0!==r?r:"0")/1e3,this._offsetHideSec=this._offsetInSec+i,this._setPosition()}return t.prototype.updateTimer=function(t){!1===this._isShow&&t>this._offsetInSec&&tthis._offsetHideSec&&(this._isShow=!1,this.remove())},t.prototype.show=function(){var t=this;he(this._icon.iconViewTracking).forEach((function(e){return ae(e.content,t._demoMode)})),this._draw()},t.prototype.remove=function(){this._img&&document.body.removeChild(this._img),this._img=void 0},t.prototype._draw=function(){var t,e=this;this._img=new Image(this.width,this.height),this._img.src=(null===(t=this._icon.staticResource)||void 0===t?void 0:t.content)||"",this._img.title=this.program,this._img.className="icon-btn",void 0!==this.position.left&&(this._img.style.left=this.position.left+"px"),void 0!==this.position.right&&(this._img.style.right=this.position.right+"px"),void 0!==this.position.top&&(this._img.style.top=this.position.top+"px"),void 0!==this.position.bottom&&(this._img.style.bottom=this.position.bottom+"px");var n=this._icon.iconClicks;if(n){var r=he(n.iconClickTracking);this._img.addEventListener("click",(function(){r.forEach((function(t){return ae(t.content,e._demoMode)})),(0,at.tG)(n.iconClickThrough.content),e.remove()}))}document.body.appendChild(this._img)},Object.defineProperty(t.prototype,"program",{get:function(){return this._icon.program},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._icon.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._icon.height},enumerable:!1,configurable:!0}),t.prototype._setPosition=function(){switch(this._icon.xPosition){case"left":this._position.left=0;break;case"right":this._position.right=0;break;default:"number"==typeof this._icon.xPosition&&(this._position.left=this._icon.xPosition)}switch(this._icon.yPosition){case"top":this._position.top=0;break;case"bottom":this._position.bottom=0;break;default:"number"==typeof this._icon.yPosition&&(this._position.top=this._icon.yPosition)}},t}(),ke=function(){function t(){}return t.prototype.init=function(t,e,n){var r=t.icons;if(r&&0!==r.length){var i=e/2;r=this._cleanDuplication(r);var o=(r=this._cleanEmptyResource(r)).map((function(t){return new Le(t,n)}));this._sortPosition(o,i),this._icons=o}},t.prototype.updateTimer=function(t){var e;null===(e=this._icons)||void 0===e||e.forEach((function(e){return e.updateTimer(t)}))},t.prototype._cleanDuplication=function(t){return t.reverse().filter((function(t,e,n){return e===n.findIndex((function(e){return e.program===t.program}))}))},t.prototype._cleanEmptyResource=function(t){return t.filter((function(t){var e;return!!(null===(e=t.staticResource)||void 0===e?void 0:e.content)}))},t.prototype._sortPosition=function(t,e){var n=t.filter((function(t){return void 0!==t.position.left&&void 0!==t.position.top})),r=t.filter((function(t){return void 0!==t.position.left&&void 0!==t.position.bottom})),i=t.filter((function(t){return void 0!==t.position.right&&void 0!==t.position.top})),o=t.filter((function(t){return void 0!==t.position.right&&void 0!==t.position.bottom}));n.sort((function(t,e){return t.position.left-e.position.left})),r.sort((function(t,e){return t.position.left-e.position.left})),i.sort((function(t,e){return t.position.right-e.position.right})),o.sort((function(t,e){return t.position.right-e.position.right})),this._sorting(n,"left","top",e),this._sorting(i,"right","top",e),this._sorting(o,"right","bottom",e),this._sorting(r,"left","bottom",e)},t.prototype._sorting=function(t,e,n,r){for(var i=1;ir&&(a[e]=0,a[n]=this._getMaxY(t,i,n)+a[n])}},t.prototype._getMaxY=function(t,e,n){for(var r=0,i=0;it[i].height?r:t[i].height+t[i].position[n];return r},t}(),Me=function(){function t(t,e){this._renderer=t,this._iconsRender=e}return t.prototype.onProgress=function(){this._iconsRender.updateTimer(this._renderer.currentTime)},t}(),Ve=function(){function t(t){this._renderer=t}return t.prototype.onComplete=function(){this._renderer.unload()},t}(),Ne=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},je=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0){var r=We.create(n,"martini-network-requests",i._name,i._targetName),a=We.stringify(r);o.postMessage(a,i._targetUrl)}}),1e3)}},t.prototype.dispatch=function(t,e,n){return qe(this,void 0,void 0,(function(){var r,i,o,a;return Ke(this,(function(s){switch(s.label){case 0:return[4,this._initFuture.getPromise()];case 1:return s.sent(),r=We.create(e,t,this._name,this._targetName,n),i=We.stringify(r),(o=(0,at.Ww)(this._targetElement))&&(this._isSameOrigin?(a=o["martini-message-handler-".concat(this._targetName)])?a({data:i}):console.error("Could not locate martini message handler on target:",o):o.postMessage(i,this._targetUrl)),[2,r]}}))}))},t.prototype.setListener=function(t,e){var n;this._listeners[t]=null!==(n=this._listeners[t])&&void 0!==n?n:[],this._listeners[t]=e},t.prototype.dispatchAndPromisify=function(t,e){return qe(this,void 0,void 0,(function(){var n;return Ke(this,(function(r){switch(r.label){case 0:return[4,this.dispatch(t,e)];case 1:return n=r.sent(),[4,this._promiseManager.create(n,t)];case 2:return[2,r.sent()]}}))}))},t.prototype.addAsyncReply=function(t,e){var n=this,r=function(r){return qe(n,void 0,void 0,(function(){var n;return Ke(this,(function(i){switch(i.label){case 0:return[4,e(r)];case 1:return n=i.sent(),this.dispatch(t,n,r.id),[2,n]}}))}))};return this.setListener(t,r),r},t.prototype.destroy=function(){for(var t in this._listeners)delete this._listeners[t];delete this._targetUrl,delete this._targetElement,this._isSameOrigin?delete window["martini-message-handler-".concat(this._name)]:window.removeEventListener("message",this._handleMessageReceived),this._demoMode&&this._performanceInterval&&clearInterval(this._performanceInterval)},t.prototype._listen=function(){window.addEventListener("message",this._handleMessageReceived)},t.prototype._handleMessageReceived=function(t){var e=We.resolve(t.data,this._name);if(e){e.receivedAt=Date.now();var n=this._listeners[e.type];n&&n(e)}},t}(),Xe=function(){function t(t,e,n){this._playerGuid=t,this._runnerIndex=e,this._adViewSent=!1,this._startedSent=!1,this._messenger=new ze(n),(0,at.Jf)(this.sendUnhandledException.bind(this),"executor")}return Object.defineProperty(t.prototype,"_name",{get:function(){return"executor-".concat(this._playerGuid,"-").concat(this._runnerIndex)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_targetName",{get:function(){return"plugin-".concat(this._name)},enumerable:!1,configurable:!0}),t.prototype.init=function(t,e){this._messenger.init(t,e,this._name,this._targetName)},t.prototype.destroy=function(){var t=this;setTimeout((function(){return t._messenger.destroy()}),0)},t.prototype.sendUnhandledException=function(t){this._messenger.dispatch("UNHANDLED_EXCEPTION",t)},t.prototype.onPlaying=function(t){this._messenger.setListener("PLAY",t)},t.prototype.sendPlaying=function(t,e){this._messenger.dispatch("PLAY",t,e)},t.prototype.sendSetSize=function(t,e,n){var r={item1:t,item2:e,item3:n};this._messenger.dispatch("SET_SIZE",r)},t.prototype.sendPausedEvent=function(t){this._messenger.dispatch("PAUSE_SUCCESS",t)},t.prototype.sendPlayComplete=function(t,e,n){var r={item1:t,item2:e,item3:n};this._messenger.dispatch("PLAY_COMPLETE",r)},t.prototype.onPause=function(t){this._messenger.setListener("PAUSE_REQUEST",t)},t.prototype.sendCcLoadedEvent=function(t){this._messenger.dispatch("CLOSED_CAPTIONS_LOADED",t)},t.prototype.onCurrentTimeRequest=function(t){this._messenger.addAsyncReply("CURRENT_TIME",t)},t.prototype.onStop=function(t){this._messenger.setListener("stop",t)},t.prototype.onMute=function(t){this._messenger.setListener("mute",t)},t.prototype.onResume=function(t){this._messenger.setListener("resume",t)},t.prototype.sendStateChanged=function(t){this._messenger.dispatch("AD_STATE",t)},t.prototype.onSetVolume=function(t){this._messenger.setListener("SET_VOLUME",t)},t.prototype.onSetCcLanguage=function(t){this._messenger.setListener("SET_CLOSED_CAPTIONS_LANGUAGE",t)},t.prototype.onSetCcStyle=function(t){this._messenger.setListener("SET_CLOSED_CAPTIONS_STYLE",t)},t.prototype.onShowCaptions=function(t){this._messenger.setListener("SHOW_CAPTIONS",t)},t.prototype.onSetFullscreen=function(t){this._messenger.setListener("SET_FULLSCREEN",t)},t.prototype.sendMediaLoaded=function(t){this._messenger.dispatch("MEDIA_LOADED",t)},t.prototype.sendAdClick=function(t){this._messenger.dispatch("CLICK",t)},t.prototype.sendResume=function(t,e,n){this._messenger.dispatch("resume",{item1:t,item2:e,item3:n})},t.prototype.sendQuartileProgress=function(t,e){this._messenger.dispatch("QUARTILE",{item1:t,item2:e})},t.prototype.sendViewSuccess=function(t){this._adViewSent||(this._messenger.dispatch("VIEW_SUCCESS",t),this._adViewSent=!0)},t.prototype.sendStarted=function(t,e,n){this._startedSent||(this._messenger.dispatch("STARTED",{item1:t,item2:e,item3:n}),this._startedSent=!0)},t.prototype.sendHeavyAdIntervention=function(t){this._messenger.dispatch("AD_INTERVENTION",t)},t.prototype.sendPlaybackStopped=function(t,e){this._messenger.dispatch("stop",t,e)},t}();try{var Ze=JSON.parse(window.name),Je=!!Ze[t.AD_BLOCKER_DETECTED],$e=Ze[t.PLAYBACK_TIMEOUT],tn=!!Ze[t.DEMO_MODE];new Fe(new Xe(Ze[t.PLAYER_GUID],""+Ze[t.RUNNER_INDEX],tn),$e,Je,tn)}catch(t){console.error("There is no window.name in the executor iframe")}}(),__webpack_exports__}()}));
//# sourceMappingURL=executor.html.js.map