/*! For license information please see ovenplayer.provider.DashProvider~ovenplayer.provider.HlsProvider~ovenplayer.provider.Html5~ovenplaye~2ec193ac-0.9.0.js.LICENSE */ (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{306:function(e,t,A){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pickCurrentSource=t.errorTrigger=t.separateLive=t.extractVideoElement=void 0;var n=A(1),i=function(e){return e&&e.__esModule?e:{default:e}}(A(7));t.extractVideoElement=function(e){return i.default.isElement(e)?e:e.getVideoElement?e.getVideoElement():e.media?e.media:null},t.separateLive=function(e){return!(!e||!e.isDynamic)&&e.isDynamic()},t.errorTrigger=function(e,t){t&&(t.setState(n.STATE_ERROR),t.pause(),t.trigger(n.ERROR,e))},t.pickCurrentSource=function(e,t,A){var n=Math.max(0,t);if(e)for(var i=0;i0&&y.creatives[0].mediaFiles&&y.creatives[0].mediaFiles.length>0&&y.creatives[0].mediaFiles[0].fileURL&&(r=y.creatives[0].mediaFiles[0].fileURL,OvenPlayerConsole.log("VAST : media url : ",r)),d.src=r,d.volume=e.volume,d.muted=e.muted}).catch(function(e){E(e)}),s())})):setTimeout(v,100)}()})},s.pause=function(){d.pause()},s.videoEndedCallback=function(e){e(),l.isVideoEnded=!0},s.destroy=function(){u&&(u.destroy(),u=null),T=null,f=null,c.remove()},s}},337:function(e,t,A){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TEMP_VIDEO_URL="data:video/mp4;base64, AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0w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AAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"},384:function(e,t,A){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=A(1);t.default=function(e,t,A,i){var r={},a={},o=null,s=google.ima.AdEvent.Type.AD_BUFFERING,l=google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,u=google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,c=google.ima.AdErrorEvent.Type.AD_ERROR,d=google.ima.AdEvent.Type.ALL_ADS_COMPLETED,h=google.ima.AdEvent.Type.CLICK,p=google.ima.AdEvent.Type.SKIPPED,g=google.ima.AdEvent.Type.COMPLETE,v=google.ima.AdEvent.Type.FIRST_QUARTILE,m=google.ima.AdEvent.Type.LOADED,f=google.ima.AdEvent.Type.MIDPOINT,T=google.ima.AdEvent.Type.PAUSED,y=google.ima.AdEvent.Type.RESUMED,E=google.ima.AdEvent.Type.STARTED,k=google.ima.AdEvent.Type.USER_CLOSE,C=google.ima.AdEvent.Type.THIRD_QUARTILE,R=!1,L=null;return OvenPlayerConsole.log("IMA : Listener Created"),a[l]=function(e){OvenPlayerConsole.log("IMA LISTENER : ",e.type),A.started&&(A.active=!0,t.pause())},a[u]=function(e){OvenPlayerConsole.log("IMA LISTENER : ",e.type),A.active=!1,!A.started||0!==t.getPosition()&&A.isVideoEnded||t.play()},a[c]=function(e){R=!0,i(e)},a[d]=function(e){OvenPlayerConsole.log("IMA LISTENER : ",e.type),R=!0,A.isVideoEnded&&t.setState(n.STATE_COMPLETE)},a[h]=function(e){OvenPlayerConsole.log(e.type),t.trigger(n.PLAYER_CLICKED,{type:n.PLAYER_AD_CLICK})},a[v]=function(e){OvenPlayerConsole.log(e.type)},a[s]=function(e){OvenPlayerConsole.log("AD_BUFFERING",e.type)},a[m]=function(A){OvenPlayerConsole.log(A.type);var i=e.getRemainingTime(),r=A.getAd();t.trigger(n.STATE_AD_LOADED,{remaining:i,isLinear:r.isLinear()})},a[f]=function(e){OvenPlayerConsole.log(e.type)},a[T]=function(e){OvenPlayerConsole.log(e.type),t.setState(n.STATE_AD_PAUSED)},a[y]=function(e){OvenPlayerConsole.log(e.type),t.setState(n.STATE_AD_PLAYING)},a[E]=function(i){OvenPlayerConsole.log(i.type);var r=i.getAd();L=r;var a={isLinear:r.isLinear(),duration:r.getDuration(),skipTimeOffset:r.getSkipTimeOffset()};t.trigger(n.AD_CHANGED,a),r.isLinear()?(t.setState(n.STATE_AD_PLAYING),A.started=!0,o=setInterval(function(){var A=e.getRemainingTime(),i=r.getDuration();t.trigger(n.AD_TIME,{duration:i,skipTimeOffset:r.getSkipTimeOffset(),remaining:A,position:i-A,skippable:e.getAdSkippableState()})},300)):t.play()},a[g]=function(e){OvenPlayerConsole.log(e.type),e.getAd().isLinear()&&clearInterval(o),t.trigger(n.STATE_AD_COMPLETE)},a[p]=function(e){OvenPlayerConsole.log(e.type),e.getAd().isLinear()&&clearInterval(o),t.trigger(n.STATE_AD_COMPLETE)},a[k]=function(e){OvenPlayerConsole.log(e.type),e.getAd().isLinear()&&clearInterval(o),t.trigger(n.STATE_AD_COMPLETE)},a[C]=function(e){OvenPlayerConsole.log(e.type)},Object.keys(a).forEach(function(t){e.removeEventListener(t,a[t]),e.addEventListener(t,a[t])}),r.setAdCompleteCallback=function(e){},r.isAllAdComplete=function(){return R},r.isLinearAd=function(){return!L||L.isLinear()},r.destroy=function(){OvenPlayerConsole.log("IMAEventListener : destroy()"),Object.keys(a).forEach(function(t){e.removeEventListener(t,a[t])})},r}},385:function(e,t,A){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),this.id=t.id||null,this.adId=t.adId||null,this.sequence=t.sequence||null,this.apiFramework=t.apiFramework||null,this.trackingEvents={}},h=function(e){function t(){var e,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o(this,t),(e=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,A))).type="companion",e.variations=[],e}return a(t,d),t}();function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},A=[];for(var n in t.ASSETURI&&(t.ASSETURI=g(t.ASSETURI)),t.CONTENTPLAYHEAD&&(t.CONTENTPLAYHEAD=g(t.CONTENTPLAYHEAD)),t.ERRORCODE&&!/^[0-9]{3}$/.test(t.ERRORCODE)&&(t.ERRORCODE=900),t.CACHEBUSTING=v(Math.round(1e8*Math.random()).toString()),t.TIMESTAMP=g((new Date).toISOString()),t.RANDOM=t.random=t.CACHEBUSTING,e){var i=e[n];if("string"==typeof i){for(var r in t){var a=t[r],o="["+r+"]",s="%%"+r+"%%";i=(i=i.replace(o,a)).replace(s,a)}A.push(i)}}return A}function g(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16)})}function v(e){return e.length<8?m(0,8-e.length,!1).map(function(e){return"0"}).join("")+e:e}function m(e,t,A){for(var n=[],i=er;i?a++:a--)n.push(a);return n}var f={track:function(e,t){p(e,t).forEach(function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:p,encodeURIComponentRFC3986:g,leftpad:v,range:m,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce(function(t,A){return t.concat(Array.isArray(A)?e(A):A)},[])}};var T={childByName:function(e,t){var A=e.childNodes;for(var n in A){var i=A[n];if(i.nodeName===t)return i}},childrenByName:function(e,t){var A=[],n=e.childNodes;for(var i in n){var r=n[i];r.nodeName===t&&A.push(r)}return A},resolveVastAdTagURI:function(e,t){return t?0===e.indexOf("//")?""+location.protocol+e:-1===e.indexOf("://")?t.slice(0,t.lastIndexOf("/"))+"/"+e:e:e},parseBoolean:function(e){return-1!==["true","TRUE","1"].indexOf(e)},parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,A){var n=t.getAttribute(e);n&&A.setAttribute(e,n)},parseDuration:function(e){if(null==e)return-1;if(f.isNumeric(e))return parseInt(e);var t=e.split(":");if(3!==t.length)return-1;var A=t[2].split("."),n=parseInt(A[0]);2===A.length&&(n+=parseFloat("0."+A[1]));var i=parseInt(60*t[1]),r=parseInt(60*t[0]*60);return isNaN(r)||isNaN(i)||isNaN(n)||i>3600||n>60?-1:r+i+n},splitVAST:function(e){var t=[],A=null;return e.forEach(function(n,i){if(n.sequence&&(n.sequence=parseInt(n.sequence,10)),n.sequence>1){var r=e[i-1];if(r&&r.sequence===n.sequence-1)return void(A&&A.push(n));delete n.sequence}A=[n],t.push(A)}),t},mergeWrapperAdData:function(e,t){e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),e.creatives.forEach(function(e){if(t.trackingEvents&&t.trackingEvents[e.type])for(var A in t.trackingEvents[e.type]){var n=t.trackingEvents[e.type][A];e.trackingEvents[A]||(e.trackingEvents[A]=[]),e.trackingEvents[A]=e.trackingEvents[A].concat(n)}}),t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length&&e.creatives.forEach(function(e){"linear"===e.type&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates))}),t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length&&e.creatives.forEach(function(e){"linear"===e.type&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates))}),t.videoClickThroughURLTemplate&&e.creatives.forEach(function(e){"linear"===e.type&&null==e.videoClickThroughURLTemplate&&(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)})}};function y(e,t){var A=new h(t);return T.childrenByName(e,"Companion").forEach(function(e){var t=new c;t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.companionClickTrackingURLTemplates=[],T.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=T.parseNodeText(e)}),T.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=T.parseNodeText(e)}),T.childrenByName(e,"StaticResource").forEach(function(A){t.type=A.getAttribute("creativeType")||0,T.childrenByName(e,"AltText").forEach(function(e){t.altText=T.parseNodeText(e)}),t.staticResource=T.parseNodeText(A)}),T.childrenByName(e,"TrackingEvents").forEach(function(e){T.childrenByName(e,"Tracking").forEach(function(e){var A=e.getAttribute("event"),n=T.parseNodeText(e);A&&n&&(null==t.trackingEvents[A]&&(t.trackingEvents[A]=[]),t.trackingEvents[A].push(n))})}),T.childrenByName(e,"CompanionClickTracking").forEach(function(e){t.companionClickTrackingURLTemplates.push(T.parseNodeText(e))}),t.companionClickThroughURLTemplate=T.parseNodeText(T.childByName(e,"CompanionClickThrough")),t.companionClickTrackingURLTemplate=T.parseNodeText(T.childByName(e,"CompanionClickTracking")),A.variations.push(t)}),A}var E=function(e){function t(){var e,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o(this,t),(e=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,A))).type="linear",e.duration=0,e.skipDelay=null,e.mediaFiles=[],e.videoClickThroughURLTemplate=null,e.videoClickTrackingURLTemplates=[],e.videoCustomClickURLTemplates=[],e.adParameters=null,e.icons=[],e}return a(t,d),t}(),k=function e(){o(this,e),this.program=null,this.height=0,this.width=0,this.xPosition=0,this.yPosition=0,this.apiFramework=null,this.offset=null,this.duration=0,this.type=null,this.staticResource=null,this.htmlResource=null,this.iframeResource=null,this.iconClickThroughURLTemplate=null,this.iconClickTrackingURLTemplates=[],this.iconViewTrackingURLTemplate=null},C=function e(){o(this,e),this.id=null,this.fileURL=null,this.deliveryType="progressive",this.mimeType=null,this.codec=null,this.bitrate=0,this.minBitrate=0,this.maxBitrate=0,this.width=0,this.height=0,this.apiFramework=null,this.scalable=null,this.maintainAspectRatio=null};function R(e,t){var A=void 0,n=new E(t);n.duration=T.parseDuration(T.parseNodeText(T.childByName(e,"Duration")));var i=e.getAttribute("skipoffset");if(null==i)n.skipDelay=null;else if("%"===i.charAt(i.length-1)&&-1!==n.duration){var r=parseInt(i,10);n.skipDelay=n.duration*(r/100)}else n.skipDelay=T.parseDuration(i);var a=T.childByName(e,"VideoClicks");a&&(n.videoClickThroughURLTemplate=T.parseNodeText(T.childByName(a,"ClickThrough")),T.childrenByName(a,"ClickTracking").forEach(function(e){n.videoClickTrackingURLTemplates.push(T.parseNodeText(e))}),T.childrenByName(a,"CustomClick").forEach(function(e){n.videoCustomClickURLTemplates.push(T.parseNodeText(e))}));var o=T.childByName(e,"AdParameters");o&&(n.adParameters=T.parseNodeText(o)),T.childrenByName(e,"TrackingEvents").forEach(function(e){T.childrenByName(e,"Tracking").forEach(function(e){var t=e.getAttribute("event"),i=T.parseNodeText(e);if(t&&i){if("progress"===t){if(!(A=e.getAttribute("offset")))return;t="%"===A.charAt(A.length-1)?"progress-"+A:"progress-"+Math.round(T.parseDuration(A))}null==n.trackingEvents[t]&&(n.trackingEvents[t]=[]),n.trackingEvents[t].push(i)}})}),T.childrenByName(e,"MediaFiles").forEach(function(e){T.childrenByName(e,"MediaFile").forEach(function(e){var t=new C;t.id=e.getAttribute("id"),t.fileURL=T.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.apiFramework=e.getAttribute("apiFramework"),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);var A=e.getAttribute("scalable");A&&"string"==typeof A&&("true"===(A=A.toLowerCase())?t.scalable=!0:"false"===A&&(t.scalable=!1));var i=e.getAttribute("maintainAspectRatio");i&&"string"==typeof i&&("true"===(i=i.toLowerCase())?t.maintainAspectRatio=!0:"false"===i&&(t.maintainAspectRatio=!1)),n.mediaFiles.push(t)})});var s=T.childByName(e,"Icons");return s&&T.childrenByName(s,"Icon").forEach(function(e){var t=new k;t.program=e.getAttribute("program"),t.height=parseInt(e.getAttribute("height")||0),t.width=parseInt(e.getAttribute("width")||0),t.xPosition=function(e){return-1!==["left","right"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("xPosition")),t.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),t.apiFramework=e.getAttribute("apiFramework"),t.offset=T.parseDuration(e.getAttribute("offset")),t.duration=T.parseDuration(e.getAttribute("duration")),T.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=T.parseNodeText(e)}),T.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=T.parseNodeText(e)}),T.childrenByName(e,"StaticResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=T.parseNodeText(e)});var A=T.childByName(e,"IconClicks");A&&(t.iconClickThroughURLTemplate=T.parseNodeText(T.childByName(A,"IconClickThrough")),T.childrenByName(A,"IconClickTracking").forEach(function(e){t.iconClickTrackingURLTemplates.push(T.parseNodeText(e))})),t.iconViewTrackingURLTemplate=T.parseNodeText(T.childByName(e,"IconViewTracking")),n.icons.push(t)}),n}var L=function(e){function t(){var e,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o(this,t),(e=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,A))).type="nonlinear",e.variations=[],e}return a(t,d),t}(),w=function e(){o(this,e),this.id=null,this.width=0,this.height=0,this.expandedWidth=0,this.expandedHeight=0,this.scalable=!0,this.maintainAspectRatio=!0,this.minSuggestedDuration=0,this.apiFramework="static",this.type=null,this.staticResource=null,this.htmlResource=null,this.iframeResource=null,this.nonlinearClickThroughURLTemplate=null,this.nonlinearClickTrackingURLTemplates=[],this.adParameters=null};function b(e,t){var A=new L(t);return T.childrenByName(e,"TrackingEvents").forEach(function(e){var t=void 0,n=void 0;T.childrenByName(e,"Tracking").forEach(function(e){t=e.getAttribute("event"),n=T.parseNodeText(e),t&&n&&(null==A.trackingEvents[t]&&(A.trackingEvents[t]=[]),A.trackingEvents[t].push(n))})}),T.childrenByName(e,"NonLinear").forEach(function(e){var t=new w;t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.expandedWidth=e.getAttribute("expandedWidth"),t.expandedHeight=e.getAttribute("expandedHeight"),t.scalable=T.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=T.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=T.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),T.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=T.parseNodeText(e)}),T.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=T.parseNodeText(e)}),T.childrenByName(e,"StaticResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=T.parseNodeText(e)});var n=T.childByName(e,"AdParameters");n&&(t.adParameters=T.parseNodeText(n)),t.nonlinearClickThroughURLTemplate=T.parseNodeText(T.childByName(e,"NonLinearClickThrough")),T.childrenByName(e,"NonLinearClickTracking").forEach(function(e){t.nonlinearClickTrackingURLTemplates.push(T.parseNodeText(e))}),A.variations.push(t)}),A}function I(e){var t=e.childNodes;for(var A in t){var n=t[A];if(-1!==["Wrapper","InLine"].indexOf(n.nodeName)){if(T.copyNodeAttribute("id",e,n),T.copyNodeAttribute("sequence",e,n),"Wrapper"===n.nodeName)return U(n);if("InLine"===n.nodeName)return N(n)}}}function N(e){var t=e.childNodes,A=new s;for(var n in A.id=e.getAttribute("id")||null,A.sequence=e.getAttribute("sequence")||null,t){var i=t[n];switch(i.nodeName){case"Error":A.errorURLTemplates.push(T.parseNodeText(i));break;case"Impression":A.impressionURLTemplates.push(T.parseNodeText(i));break;case"Creatives":T.childrenByName(i,"Creative").forEach(function(e){var t={id:e.getAttribute("id")||null,adId:O(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null};for(var n in e.childNodes){var i=e.childNodes[n];switch(i.nodeName){case"Linear":var r=R(i,t);r&&A.creatives.push(r);break;case"NonLinearAds":var a=b(i,t);a&&A.creatives.push(a);break;case"CompanionAds":var o=y(i,t);o&&A.creatives.push(o)}}});break;case"Extensions":S(A.extensions,T.childrenByName(i,"Extension"));break;case"AdSystem":A.system={value:T.parseNodeText(i),version:i.getAttribute("version")||null};break;case"AdTitle":A.title=T.parseNodeText(i);break;case"Description":A.description=T.parseNodeText(i);break;case"Advertiser":A.advertiser=T.parseNodeText(i);break;case"Pricing":A.pricing={value:T.parseNodeText(i),model:i.getAttribute("model")||null,currency:i.getAttribute("currency")||null};break;case"Survey":A.survey=T.parseNodeText(i)}}return A}function U(e){var t=N(e),A=T.childByName(e,"VASTAdTagURI");if(A?t.nextWrapperURL=T.parseNodeText(A):(A=T.childByName(e,"VASTAdTagURL"))&&(t.nextWrapperURL=T.parseNodeText(T.childByName(A,"URL"))),t.creatives.forEach(function(e){if(-1!==["linear","nonlinear"].indexOf(e.type)){if(e.trackingEvents){t.trackingEvents||(t.trackingEvents={}),t.trackingEvents[e.type]||(t.trackingEvents[e.type]={});var A=function(A){var n=e.trackingEvents[A];t.trackingEvents[e.type][A]||(t.trackingEvents[e.type][A]=[]),n.forEach(function(n){t.trackingEvents[e.type][A].push(n)})};for(var n in e.trackingEvents)A(n)}e.videoClickTrackingURLTemplates&&(t.videoClickTrackingURLTemplates||(t.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach(function(e){t.videoClickTrackingURLTemplates.push(e)})),e.videoClickThroughURLTemplate&&(t.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(t.videoCustomClickURLTemplates||(t.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach(function(e){t.videoCustomClickURLTemplates.push(e)}))}}),t.nextWrapperURL)return t}function S(e,t){t.forEach(function(t){var A=new l,n=t.attributes,i=t.childNodes;if(t.attributes)for(var r in n){var a=n[r];a.nodeName&&a.nodeValue&&(A.attributes[a.nodeName]=a.nodeValue)}for(var o in i){var s=i[o],c=T.parseNodeText(s);if("#comment"!==s.nodeName&&""!==c){var d=new u;if(d.name=s.nodeName,d.value=c,s.attributes){var h=s.attributes;for(var p in h){var g=h[p];d.attributes[g.nodeName]=g.nodeValue}}A.children.push(d)}}e.push(A)})}function O(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}function B(){}function P(){P.init.call(this)}function D(e){return void 0===e._maxListeners?P.defaultMaxListeners:e._maxListeners}function M(e,t,A,n){var i,r,a;if("function"!=typeof A)throw new TypeError('"listener" argument must be a function');if((r=e._events)?(r.newListener&&(e.emit("newListener",t,A.listener?A.listener:A),r=e._events),a=r[t]):(r=e._events=new B,e._eventsCount=0),a){if("function"==typeof a?a=r[t]=n?[A,a]:[a,A]:n?a.unshift(A):a.push(A),!a.warned&&(i=D(e))&&i>0&&a.length>i){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=a.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(o)}}else a=r[t]=A,++e._eventsCount;return e}function _(e,t,A){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,A.apply(e,arguments))}return i.listener=A,i}function x(e){var t=this._events;if(t){var A=t[e];if("function"==typeof A)return 1;if(A)return A.length}return 0}function Q(e,t){for(var A=new Array(t);t--;)A[t]=e[t];return A}B.prototype=Object.create(null),P.EventEmitter=P,P.usingDomains=!1,P.prototype.domain=void 0,P.prototype._events=void 0,P.prototype._maxListeners=void 0,P.defaultMaxListeners=10,P.init=function(){this.domain=null,P.usingDomains&&(!(void 0).active||this instanceof(void 0).Domain||(this.domain=(void 0).active)),this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new B,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},P.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},P.prototype.getMaxListeners=function(){return D(this)},P.prototype.emit=function(e){var t,A,n,i,r,a,o,s="error"===e;if(a=this._events)s=s&&null==a.error;else if(!s)return!1;if(o=this.domain,s){if(t=arguments[1],!o){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=o,t.domainThrown=!1,o.emit("error",t),!1}if(!(A=a[e]))return!1;var u="function"==typeof A;switch(n=arguments.length){case 1:!function(e,t,A){if(t)e.call(A);else for(var n=e.length,i=Q(e,n),r=0;r0;)if(A[r]===t||A[r].listener&&A[r].listener===t){a=A[r].listener,i=r;break}if(i<0)return this;if(1===A.length){if(A[0]=void 0,0==--this._eventsCount)return this._events=new B,this;delete n[e]}else!function(e,t){for(var A=t,n=A+1,i=e.length;n0?Reflect.ownKeys(this._events):[]};var V={get:function(e,t,A){var n="function"==typeof window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLDOM"):void 0;if(!n)return A(new Error("FlashURLHandler: Microsoft.XMLDOM format not supported"));n.async=!1,request.open("GET",e),request.timeout=t.timeout||0,request.withCredentials=t.withCredentials||!1,request.send(),request.onprogress=function(){},request.onload=function(){n.loadXML(request.responseText),A(null,n)}},supported:function(){return!!function(){var e=void 0;return window.XDomainRequest&&(e=new XDomainRequest),e}()}};var X={get:function(e,t,A){A(new Error("Please bundle the library for node to use the node urlHandler"))}};function Z(){try{var e=new window.XMLHttpRequest;return"withCredentials"in e?e:null}catch(e){return console.log("Error in XHRURLHandler support check:",e),null}}var F={get:function(e,t,A){if("https:"===window.location.protocol&&0===e.indexOf("http://"))return A(new Error("XHRURLHandler: Cannot go from HTTPS to HTTP."));try{var n=Z();n.open("GET",e),n.timeout=t.timeout||0,n.withCredentials=t.withCredentials||!1,n.overrideMimeType&&n.overrideMimeType("text/xml"),n.onreadystatechange=function(){4===n.readyState&&(200===n.status?A(null,n.responseXML):A(new Error("XHRURLHandler: "+n.statusText)))},n.send()}catch(e){A(new Error("XHRURLHandler: Unexpected error"))}},supported:function(){return!!Z()}};var G={get:function(e,t,A){return A||("function"==typeof t&&(A=t),t={}),"undefined"==typeof window||null===window?X.get(e,t,A):F.supported()?F.get(e,t,A):V.supported()?V.get(e,t,A):A(new Error("Current context is not supported by any of the default URLHandlers. Please provide a custom URLHandler"))}},H={ERRORCODE:900,extensions:[]},W=function(e){function t(){var e;return o(this,t),(e=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))).remainingAds=[],e.parentURLs=[],e.errorURLTemplates=[],e.rootErrorURLTemplates=[],e.maxWrapperDepth=null,e.URLTemplateFilters=[],e.fetchingOptions={},e}return a(t,P),i(t,[{key:"addURLTemplateFilter",value:function(e){"function"==typeof e&&this.URLTemplateFilters.push(e)}},{key:"removeURLTemplateFilter",value:function(){this.URLTemplateFilters.pop()}},{key:"countURLTemplateFilters",value:function(){return this.URLTemplateFilters.length}},{key:"clearURLTemplateFilters",value:function(){this.URLTemplateFilters=[]}},{key:"trackVastError",value:function(e,t){for(var A=arguments.length,i=Array(A>2?A-2:0),r=2;r0&&void 0!==arguments[0]?arguments[0]:{};this.rootURL="",this.remainingAds=[],this.parentURLs=[],this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.maxWrapperDepth=e.wrapperLimit||10,this.fetchingOptions={timeout:e.timeout,withCredentials:e.withCredentials},this.urlHandler=e.urlhandler||G}},{key:"getRemainingAds",value:function(e){var t=this;if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));var A=e?f.flatten(this.remainingAds):this.remainingAds.shift();return this.errorURLTemplates=[],this.parentURLs=[],this.resolveAds(A,{wrapperDepth:0,originalUrl:this.rootURL}).then(function(e){return t.buildVASTResponse(e)})}},{key:"getAndParseVAST",value:function(e){var t=this,A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(A),this.rootURL=e,this.fetchVAST(e).then(function(n){return A.originalUrl=e,A.isRootVAST=!0,t.parse(n,A).then(function(e){return t.buildVASTResponse(e)})})}},{key:"parseVAST",value:function(e){var t=this,A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(A),A.isRootVAST=!0,this.parse(e,A).then(function(e){return t.buildVASTResponse(e)})}},{key:"buildVASTResponse",value:function(e){var t=new function e(){o(this,e),this.ads=[],this.errorURLTemplates=[]};return t.ads=e,t.errorURLTemplates=this.getErrorURLTemplates(),this.completeWrapperResolving(t),t}},{key:"parse",value:function(e,t){var A=t.resolveAll,n=void 0===A||A,i=t.wrapperSequence,r=void 0===i?null:i,a=t.originalUrl,o=void 0===a?null:a,s=t.wrapperDepth,l=void 0===s?0:s,u=t.isRootVAST,c=void 0!==u&&u;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName)return Promise.reject(new Error("Invalid VAST XMLDocument"));var d=[],h=e.documentElement.childNodes;for(var p in h){var g=h[p];if("Error"===g.nodeName){var v=T.parseNodeText(g);c?this.rootErrorURLTemplates.push(v):this.errorURLTemplates.push(v)}if("Ad"===g.nodeName){var m=I(g);m?d.push(m):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}var f=d.length,y=d[f-1];return 1===f&&void 0!==r&&null!==r&&y&&!y.sequence&&(y.sequence=r),!1===n&&(this.remainingAds=T.splitVAST(d),d=this.remainingAds.shift()),this.resolveAds(d,{wrapperDepth:l,originalUrl:o})}},{key:"resolveAds",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],A=arguments[1],n=A.wrapperDepth,i=A.originalUrl,r=[];return t.forEach(function(t){var A=e.resolveWrappers(t,n,i);r.push(A)}),Promise.all(r).then(function(t){var A=f.flatten(t);if(!A&&e.remainingAds.length>0){var r=e.remainingAds.shift();return e.resolveAds(r,{wrapperDepth:n,originalUrl:i})}return A})}},{key:"resolveWrappers",value:function(e,t,A){var n=this;return new Promise(function(i,r){if(t++,!e.nextWrapperURL)return delete e.nextWrapperURL,i(e);if(t>=n.maxWrapperDepth||-1!==n.parentURLs.indexOf(e.nextWrapperURL))return e.errorCode=302,delete e.nextWrapperURL,i(e);e.nextWrapperURL=T.resolveVastAdTagURI(e.nextWrapperURL,A);var a=e.sequence;A=e.nextWrapperURL,n.fetchVAST(e.nextWrapperURL,t,A).then(function(r){return n.parse(r,{originalUrl:A,wrapperSequence:a,wrapperDepth:t}).then(function(t){if(delete e.nextWrapperURL,0===t.length)return e.creatives=[],i(e);t.forEach(function(t){t&&T.mergeWrapperAdData(t,e)}),i(t)})}).catch(function(t){e.errorCode=301,e.errorMessage=t.message,i(e)})})}},{key:"completeWrapperResolving",value:function(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(var t=e.ads.length-1;t>=0;t--){var A=e.ads[t];(A.errorCode||0===A.creatives.length)&&(this.trackVastError(A.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:A.errorCode||303},{ERRORMESSAGE:A.errorMessage||""},{extensions:A.extensions},{system:A.system}),e.ads.splice(t,1))}}}]),t}(),j=null,J={data:{},length:0,getItem:function(e){return this.data[e]},setItem:function(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem:function(e){delete data[e],this.length=Object.keys(this.data).length},clear:function(){this.data={},this.length=0}},Y=function(){function e(){o(this,e),this.storage=this.initStorage()}return i(e,[{key:"initStorage",value:function(){if(j)return j;try{j="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){j=null}return j&&!this.isStorageDisabled(j)||(j=J).clear(),j}},{key:"isStorageDisabled",value:function(e){var t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch(e){return!0}return e.removeItem(t),!1}},{key:"getItem",value:function(e){return this.storage.getItem(e)}},{key:"setItem",value:function(e,t){return this.storage.setItem(e,t)}},{key:"removeItem",value:function(e){return this.storage.removeItem(e)}},{key:"clear",value:function(){return this.storage.clear()}}]),e}(),q=function(){function e(t,A,n){o(this,e),this.cappingFreeLunch=t||0,this.cappingMinimumTimeInterval=A||0,this.defaultOptions={withCredentials:!1,timeout:0},this.vastParser=new W,this.storage=n||new Y,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}return i(e,[{key:"getParser",value:function(){return this.vastParser}},{key:"hasRemainingAds",value:function(){return this.vastParser.remainingAds.length>0}},{key:"getNextAds",value:function(e){return this.vastParser.getRemainingAds(e)}},{key:"get",value:function(e){var t=this,A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Date.now();return(A=n(this.defaultOptions,A)).hasOwnProperty("resolveAll")||(A.resolveAll=!1),this.totalCallsTimeout=t.totalCalls)return r(new Error("VAST call canceled – FreeLunch capping not reached yet "+t.totalCalls+"/"+t.cappingFreeLunch));var a=i-t.lastSuccessfulAd;if(a<0)t.lastSuccessfulAd=0;else if(a3&&void 0!==arguments[3]?arguments[3]:null;for(var s in o(this,t),(i=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))).ad=A,i.creative=n,i.variation=a,i.muted=!1,i.impressed=!1,i.skippable=!1,i.trackingEvents={},i._alreadyTriggeredQuartiles={},i.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"],i.creative.trackingEvents){var l=i.creative.trackingEvents[s];i.trackingEvents[s]=l.slice(0)}return i.creative instanceof E?i._initLinearTracking():i._initVariationTracking(),e&&i.on("start",function(){e.lastSuccessfulAd=Date.now()}),i}return a(t,P),i(t,[{key:"_initLinearTracking",value:function(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}},{key:"_initVariationTracking",value:function(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(var e in this.variation.trackingEvents){var t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}this.variation instanceof w?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):this.variation instanceof c&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}},{key:"setDuration",value:function(e){this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}}},{key:"setProgress",value:function(e){var t=this,A=this.skipDelay||-1;if(-1===A||this.skippable||(A>e?this.emit("skip-countdown",A-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){var n=[];if(e>0){var i=Math.round(e/this.assetDuration*100);for(var r in n.push("start"),n.push("progress-"+i+"%"),n.push("progress-"+Math.round(e)),this.quartiles)this.isQuartileReached(r,this.quartiles[r],e)&&(n.push(r),this._alreadyTriggeredQuartiles[r]=!0)}n.forEach(function(e){t.track(e,!0)}),e0&&void 0!==arguments[0]?arguments[0]:null;this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates);var t=this.clickThroughURLTemplate||e;if(t){var A=this.linear?{CONTENTPLAYHEAD:this.progressFormatted()}:{},n=f.resolveURLTemplates([t],A)[0];this.emit("clickthrough",n)}}},{key:"track",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close");var A=this.trackingEvents[e],n=this.emitAlwaysEvents.indexOf(e)>-1;A?(this.emit(e,""),this.trackURLs(A)):n&&this.emit(e,""),t&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}},{key:"trackURLs",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(t.ASSETURI=this.creative.mediaFiles[0].fileURL),t.CONTENTPLAYHEAD=this.progressFormatted()),f.track(e,t)}},{key:"progressFormatted",value:function(){var e=parseInt(this.progress),t=e/3600;t.length<2&&(t="0"+t);var A=e/60%60;A.length<2&&(A="0"+A);var n=e%60;return n.length<2&&(n="0"+A),t+":"+A+":"+n+"."+parseInt(100*(this.progress-e))}}]),t}();t.VASTClient=q,t.VASTParser=W,t.VASTTracker=z},386:function(e,t,A){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=A(1),i=function(e){return e&&e.__esModule?e:{default:e}}(A(6));t.default=function(e,t,A,r,a,o,s){var l={},u={},c=(0,i.default)(o),d=(0,i.default)(a),h=(0,i.default)(e);A.on(n.CONTENT_VOLUME,function(t){t.mute?e.muted=!0:(e.muted=!1,e.volume=t.volume/100)},u);var p=function(){r.active=!1,d.hide(),!r.started||0!==A.getPosition()&&r.isVideoEnded||(h.hide(),A.play()),A.trigger(n.STATE_AD_COMPLETE)},g=function(A){c.hasClass("videoAdUiAction")&&(t.skip(),e.pause(),p())};return o.addEventListener("click",g,!1),l.error=function(){OvenPlayerConsole.log("VAST : listener : error.",e.error),console.log("VAST : listener : error.",e.error);var A={},n=e.error&&e.error.code||0;2===n?(A.code=402,A.message="Timeout of MediaFile URI."):3===n?(A.code=405,A.message="Problem displaying MediaFile. Video player found a MediaFile with supported type but couldn’t display it. MediaFile may include: unsupported codecs, different MIME type than MediaFile@type, unsupported delivery method, etc."):4===n?(A.code=403,A.message="Couldn’t find MediaFile that is supported by this video player, based on the attributes of the MediaFile element."):(A.code=400,A.message="General Linear error. Video player is unable to display the Linear Ad."),t.errorWithCode(A.code),s("405")},l.canplay=function(){},l.ended=function(){t.complete(),p()},l.click=function(e){t.click()},l.play=function(){t.setPaused(!1)},l.pause=function(){t.setPaused(!0)},l.timeupdate=function(i){t.setProgress(i.target.currentTime),A.trigger(n.AD_TIME,{duration:e.duration,position:e.currentTime})},l.volumechange=function(e){OvenPlayerConsole.log("VAST : listener : Ad Video Volumechange."),t.setMuted(e.target.muted)},l.loadedmetadata=function(){OvenPlayerConsole.log("VAST : listener : Ad CONTENT LOADED ."),n.STATE_PLAYING===A.getState()&&A.pause(),t.trackImpression(),A.trigger(n.STATE_AD_LOADED,{remaining:e.duration,isLinear:!0}),e.play()},t.on("skip",function(){OvenPlayerConsole.log("VAST : listener : skipped")}),t.on("mute",function(){OvenPlayerConsole.log("VAST : listener : muted")}),t.on("unmute",function(){OvenPlayerConsole.log("VAST : listener : unmuted")}),t.on("resume",function(){OvenPlayerConsole.log("VAST : listener : vastTracker resumed."),r.started&&A.setState(n.STATE_AD_PLAYING)}),t.on("pause",function(){OvenPlayerConsole.log("VAST : listener : vastTracker paused."),A.setState(n.STATE_AD_PAUSED)}),t.on("clickthrough",function(e){OvenPlayerConsole.log("VAST : listener : clickthrough :",e),window.open(e,"_blank")}),t.on("skip-countdown",function(e){0===e?("ko"===r.lang?c.html("광고 건너뛰기"):c.html("Ad Skip"),c.addClass("videoAdUiAction")):"ko"===r.lang?c.html(parseInt(e)+1+"초 후에 이 광고를 건너뛸 수 있습니다."):c.html("You can skip this ad in "+(parseInt(e)+1))}),t.on("rewind",function(){OvenPlayerConsole.log("VAST : listener : rewind")}),t.on("start",function(){OvenPlayerConsole.log("VAST : listener : started"),r.started=!0,r.active=!0,h.show(),d.show(),A.trigger(n.AD_CHANGED,{isLinear:!0}),A.setState(n.STATE_AD_PLAYING)}),t.on("firstQuartile",function(){OvenPlayerConsole.log("VAST : listener : firstQuartile")}),t.on("midpoint",function(){OvenPlayerConsole.log("VAST : listener : midpoint")}),t.on("thirdQuartile",function(){OvenPlayerConsole.log("VAST : listener : thirdQuartile")}),t.on("creativeView",function(){OvenPlayerConsole.log("VAST : listener : creativeView")}),Object.keys(l).forEach(function(t){e.removeEventListener(t,l[t]),e.addEventListener(t,l[t])}),u.destroy=function(){OvenPlayerConsole.log("EventListener : destroy()"),o.removeEventListener("click",g,!1),Object.keys(l).forEach(function(t){e.removeEventListener(t,l[t])})},u}}}]);