bitmovin-player 8.281.0 → 8.282.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bitmovinplayer-serviceworker.js +2 -2
- package/bitmovinplayer-serviceworker.prod.js +2 -2
- package/bitmovinplayer-ui.js +1 -1
- package/bitmovinplayer.js +2 -2
- package/bitmovinplayer.prod.js +2 -2
- package/modules/bitmovinplayer-abr.js +2 -2
- package/modules/bitmovinplayer-abr.prod.js +2 -2
- package/modules/bitmovinplayer-advertising-bitmovin.js +2 -2
- package/modules/bitmovinplayer-advertising-bitmovin.prod.js +2 -2
- package/modules/bitmovinplayer-advertising-core.js +2 -2
- package/modules/bitmovinplayer-advertising-core.prod.js +2 -2
- package/modules/bitmovinplayer-advertising-ima.js +2 -2
- package/modules/bitmovinplayer-advertising-ima.prod.js +2 -2
- package/modules/bitmovinplayer-advertising-omsdk.js +2 -2
- package/modules/bitmovinplayer-advertising-omsdk.prod.js +2 -2
- package/modules/bitmovinplayer-analytics.js +1 -1
- package/modules/bitmovinplayer-analytics.prod.js +1 -1
- package/modules/bitmovinplayer-container-mp4.js +2 -2
- package/modules/bitmovinplayer-container-mp4.prod.js +2 -2
- package/modules/bitmovinplayer-container-ts.js +2 -2
- package/modules/bitmovinplayer-container-ts.prod.js +2 -2
- package/modules/bitmovinplayer-container-webm.js +2 -2
- package/modules/bitmovinplayer-container-webm.prod.js +2 -2
- package/modules/bitmovinplayer-core.js +2 -2
- package/modules/bitmovinplayer-core.prod.js +2 -2
- package/modules/bitmovinplayer-crypto.js +2 -2
- package/modules/bitmovinplayer-crypto.prod.js +2 -2
- package/modules/bitmovinplayer-dash.js +2 -2
- package/modules/bitmovinplayer-dash.prod.js +2 -2
- package/modules/bitmovinplayer-drm.js +2 -2
- package/modules/bitmovinplayer-drm.prod.js +2 -2
- package/modules/bitmovinplayer-engine-bitmovin.js +2 -2
- package/modules/bitmovinplayer-engine-bitmovin.prod.js +2 -2
- package/modules/bitmovinplayer-engine-native.js +2 -2
- package/modules/bitmovinplayer-engine-native.prod.js +2 -2
- package/modules/bitmovinplayer-engine-webrtc.js +2 -2
- package/modules/bitmovinplayer-engine-webrtc.prod.js +2 -2
- package/modules/bitmovinplayer-envivio.js +1 -1
- package/modules/bitmovinplayer-envivio.prod.js +1 -1
- package/modules/bitmovinplayer-hls.js +2 -2
- package/modules/bitmovinplayer-hls.prod.js +2 -2
- package/modules/bitmovinplayer-lowlatency.js +2 -2
- package/modules/bitmovinplayer-lowlatency.prod.js +2 -2
- package/modules/bitmovinplayer-mserenderer.js +2 -2
- package/modules/bitmovinplayer-mserenderer.prod.js +2 -2
- package/modules/bitmovinplayer-patch.js +1 -1
- package/modules/bitmovinplayer-patch.prod.js +1 -1
- package/modules/bitmovinplayer-playstation4.js +2 -2
- package/modules/bitmovinplayer-playstation4.prod.js +2 -2
- package/modules/bitmovinplayer-playstation5.js +2 -2
- package/modules/bitmovinplayer-playstation5.prod.js +2 -2
- package/modules/bitmovinplayer-polyfill.js +1 -1
- package/modules/bitmovinplayer-polyfill.prod.js +1 -1
- package/modules/bitmovinplayer-reactnative.js +1 -1
- package/modules/bitmovinplayer-reactnative.prod.js +1 -1
- package/modules/bitmovinplayer-remotecontrol.js +2 -2
- package/modules/bitmovinplayer-remotecontrol.prod.js +2 -2
- package/modules/bitmovinplayer-serviceworker-client.js +2 -2
- package/modules/bitmovinplayer-serviceworker-client.prod.js +2 -2
- package/modules/bitmovinplayer-serviceworker.js +2 -2
- package/modules/bitmovinplayer-serviceworker.prod.js +2 -2
- package/modules/bitmovinplayer-sgai.js +2 -2
- package/modules/bitmovinplayer-sgai.prod.js +2 -2
- package/modules/bitmovinplayer-smooth.js +2 -2
- package/modules/bitmovinplayer-smooth.prod.js +2 -2
- package/modules/bitmovinplayer-style.js +2 -2
- package/modules/bitmovinplayer-style.prod.js +2 -2
- package/modules/bitmovinplayer-subtitles-cea608.js +2 -2
- package/modules/bitmovinplayer-subtitles-cea608.prod.js +2 -2
- package/modules/bitmovinplayer-subtitles-native.js +2 -2
- package/modules/bitmovinplayer-subtitles-native.prod.js +2 -2
- package/modules/bitmovinplayer-subtitles-ttml.js +2 -2
- package/modules/bitmovinplayer-subtitles-ttml.prod.js +2 -2
- package/modules/bitmovinplayer-subtitles-vtt.js +2 -2
- package/modules/bitmovinplayer-subtitles-vtt.prod.js +2 -2
- package/modules/bitmovinplayer-subtitles.js +2 -2
- package/modules/bitmovinplayer-subtitles.prod.js +2 -2
- package/modules/bitmovinplayer-thumbnail-imp.js +2 -2
- package/modules/bitmovinplayer-thumbnail-imp.prod.js +2 -2
- package/modules/bitmovinplayer-thumbnail.js +2 -2
- package/modules/bitmovinplayer-thumbnail.prod.js +2 -2
- package/modules/bitmovinplayer-tizen.js +2 -2
- package/modules/bitmovinplayer-tizen.prod.js +2 -2
- package/modules/bitmovinplayer-ui.js +2 -2
- package/modules/bitmovinplayer-ui.prod.js +2 -2
- package/modules/bitmovinplayer-vidaa.js +2 -2
- package/modules/bitmovinplayer-vidaa.prod.js +2 -2
- package/modules/bitmovinplayer-vr.js +2 -2
- package/modules/bitmovinplayer-vr.prod.js +2 -2
- package/modules/bitmovinplayer-webos.js +2 -2
- package/modules/bitmovinplayer-webos.prod.js +2 -2
- package/modules/bitmovinplayer-wpe.js +2 -2
- package/modules/bitmovinplayer-wpe.prod.js +2 -2
- package/modules/bitmovinplayer-xml.js +1 -1
- package/modules/bitmovinplayer-xml.prod.js +1 -1
- package/package.json +1 -1
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* This software includes open-source components. See THIRD_PARTY_NOTICES
|
|
10
10
|
* in the distribution for details.
|
|
11
11
|
*
|
|
12
|
-
* Bitmovin Player Version 8.
|
|
12
|
+
* Bitmovin Player Version 8.282.0
|
|
13
13
|
*
|
|
14
14
|
****************************************************************************/
|
|
15
15
|
|
|
16
16
|
(function() {
|
|
17
|
-
"use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["advertising-core"]=t():(e.bitmovin=e.bitmovin||{},e.bitmovin.player=e.bitmovin.player||{},e.bitmovin.player["advertising-core"]=t())}(self,function(){return(self.webpackChunkbitmovin_player=self.webpackChunkbitmovin_player||[]).push([[561],{28610:function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.VmapTrackingEventType=void 0,function(e){e.BreakStart="breakstart",e.BreakEnd="breakend",e.Error="error"}(r||(t.VmapTrackingEventType=r={}))},76713:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.PAUSE_AD_POSITION=t.DEFAULT_AD_BREAK_POSITION=void 0,t.isPauseAdBreak=function(e){return(null==e?void 0:e.position)===t.PAUSE_AD_POSITION},t.DEFAULT_AD_BREAK_POSITION="pre",t.PAUSE_AD_POSITION="pause"},45392:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AdManifestHelper=void 0,t.xmlToString=function(e){return(new XMLSerializer).serializeToString(e.documentElement)},t.toDataUri=function(e){return"data:text/xml,"+encodeURIComponent(e)},t.pingVmapTrackingUrls=function(e,t){void 0===e&&(e=[]),e.filter(function(e){return e.type===t}).forEach(function(e){return(0,i.pingUrl)(e.url)})};var n=r(70850),i=r(95217),o=r(88457),a=r(60326),s=r(47091),l=function(){function e(e,t,r,n){this.loader=e,this.videoLoadTimeout=t,this.withCredentials=r,this.disableStorage=n}return e.prototype.downloadVastManifest=function(e){var t,r=this;return null!==(t=this.TK)&&void 0!==t||(this.TK=new DOMParser),this.loader.load(e,void 0,void 0,void 0,void 0,this.withCredentials).catch(function(){return Promise.reject({code:o.AdvertisingModuleErrorCode.COULD_NOT_LOAD_AD_MANIFEST})}).then(function(e){var t;if(!e.body)return Promise.reject({code:s.VastErrorCode.XML_PARSING_ERROR});var n=r.TK.parseFromString(e.body,"text/xml"),i=null===(t=n.childNodes[0].childNodes[0])||void 0===t?void 0:t.nodeName.includes("Error"),a=void 0===i||i,l=n.childNodes[0].nodeName.includes("error");if(n.childNodes[0].nodeName.includes("VMAP"))return Promise.reject({code:o.AdvertisingModuleErrorCode.AD_TAG_TYPE_NOT_MATCHING});if(a)return Promise.reject({code:s.VastErrorCode.NO_ADS_VAST_RESPONSE});if(l)return Promise.reject({code:s.VastErrorCode.XML_PARSING_ERROR});var u={downloadTime:e.elapsedTime,timeToFirstByte:e.timeToFirstByte};return Promise.resolve({manifest:n,downloadTiming:u})})},e.prototype.downloadVmapManifest=function(e){return this.loader.load(e,void 0,void 0,void 0,void 0,this.withCredentials)},e.prototype.parseAdVerifications=function(e){var t;return null!==(t=this.UK)&&void 0!==t||(this.UK=new a.VastClientWrapper(this.videoLoadTimeout,this.withCredentials,this.disableStorage)),this.UK.parseManifest(e,!1).then(function(e){if(e.ads.length<1)return Promise.resolve([]);var t=e.ads.map(function(e){return{id:e.id||"adVerification-"+n.Util.generateUniqueId(),verifications:e.verifications}});return Promise.resolve(t)}).catch(function(e){return Promise.resolve([])})},e}();t.AdManifestHelper=l},63524:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AdPlaybackFactory=void 0;var n=r(60937),i=r(52448),o=function(){function e(){}return e.create=function(e,t){var r=!1,o=function(){r=!1},a=function(e){var t="The current ad playback has to be finished by calling ".concat(e,".done(), before a new one can be requested.");return Promise.reject(t)};return new(function(){function s(){}return s.prototype.requestPlayer=function(){return r?a("AdPlayerAPI"):(r=!0,Promise.resolve(i.AdPlayerFactory.createAdPlayer(e,o)))},s.prototype.requestReporter=function(){return r?a("AdPlaybackReportingAPI"):(r=!0,Promise.resolve(new n.AdPlaybackReporter(e,o)))},s.prototype.done=function(e){return void 0===e&&(e=!0),t(e)},s}())},e}();t.AdPlaybackFactory=o},60937:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AdPlaybackReporter=void 0;var n=r(9768),i=r(3714),o=r(19483),a=function(){return function(e,t){var r=this,a=new o.ArrayMap;this.videoElement=e.getVideoElement();var s=!1,l=function(){if(s)throw"AdPlaybackReporter is no longer usable. Request a new one."},u=this.videoElement.addEventListener;this.videoElement.addEventListener=function(e,t,n){a.add(e,t),u.apply(r.videoElement,[e,t,n])},this.started=function(t){if(l(),r.Adb)throw"Ad playback is already in progress. A new one can not be started.";r.Adb=t,r.Bdb=!1,e.hasCurrentSourcePlayedOnce()||e.fireEvent(i.PlayerEvent.Playing,{time:e.getCurrentTime(),issuer:n.ADVERTISING_ISSUER_NAME}),e.fireEvent(i.PlayerEvent.AdStarted,{ad:t})},this.paused=function(t){l(),e.fireEvent(i.PlayerEvent.Paused,{time:t,issuer:n.ADVERTISING_ISSUER_NAME})},this.resumed=function(t){l(),e.fireEvent(i.PlayerEvent.Play,{time:t,issuer:n.ADVERTISING_ISSUER_NAME}),e.fireEvent(i.PlayerEvent.Playing,{time:t,issuer:n.ADVERTISING_ISSUER_NAME})},this.timeupdate=function(t){l(),e.fireEvent(i.PlayerEvent.TimeChanged,{time:t,issuer:n.ADVERTISING_ISSUER_NAME})},this.skipped=function(){r.Bdb||(l(),e.fireEvent(i.PlayerEvent.AdSkipped,{ad:r.Adb}),r.Bdb=!0,r.Adb=null)},this.done=function(){return l(),a.forAll(function(e,t){r.videoElement.removeEventListener(e,t),r.videoElement.addEventListener=u}),!r.Bdb&&r.Adb&&e.fireEvent(i.PlayerEvent.AdFinished,{ad:r.Adb}),r.Adb=null,t(),s=!0,Promise.resolve()}}}();t.AdPlaybackReporter=a},43255:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.AdPlayerDelegate=void 0;var i=r(40306),o=r(80813),a=r(9768),s=r(3714),l=r(51289),u=r(90408),c=r(20213),d=r(18192),p=r(94685),f=r(41138),h=r(63524),v=r(44202),A=r(65185),g=r(47091),E=function(){function e(t){this.logger=t.context.logger;var r,p=t.internalPlayer,f=new v.AdPlayerStateStore(t.context,p),E=Promise.resolve(),y=!1,R=!1,P=!1,_={width:0,height:0},S=[],N=function(e){e.code===c.WarningCode.PLAYBACK_COULD_NOT_BE_STARTED&&(R=!0)};p.onInternal(s.PlayerEvent.PlayerResized,function(e){var t=m(e.width),r=m(e.height);_={width:t,height:r}});var b=function(){R=!1};this.getVideoElement=function(){return p.getVideoElement()},this.getVolume=function(){return p.isMuted()?0:p.getVolume()},this.isContentPaused=function(){return p.isContentPaused()},this.isContentSeeking=function(){return p.isContentSeeking()},this.parsePosition=function(t){var r;return r=f.hasStoredState()?f.getStoredState().contentDuration:p.getDuration(),e.parsePosition(t,r)},this.selectMediaFile=function(e){var r=e.every(function(e){return e.bitrate||e.minBitrate&&e.maxBitrate}),n=p.getDownloadedVideoData(),i=p.getDownloadedAudioData(),a=Boolean(i&&n&&n.bitrate>0),s=t.context.serviceManager.get(o.ServiceName.AdaptationService);return r&&(s||a)?U(e,[n,i],s):function(e,t,r){return r&&r.width>0?(0,A.findMediaFileByResolution)(r.width,r.height,e):(0,A.findMediaFileByResolution)(t.width,t.height,e)}(e,_,n)};var U=function(e,t,r){var n=t[0],i=t[1];return r?r.selectQualityBasedOnBitrateMeasurement(e):(0,A.findMediaFileByBitrate)(n.bitrate+i.bitrate,e)};this.metadataLoaded=function(e,t){var r={adBreak:null,downloadTiming:t};e.hasOwnProperty("scheduleTime")&&(r.adBreak=e),r.adConfig=e,p.fireEvent(s.PlayerEvent.AdManifestLoaded,r)};var k=function(){S.forEach(function(e){return p.fireEvent(s.PlayerEvent.Error,{type:s.PlayerEvent.Error,code:e.code,name:e.name,message:e.message,data:e.data,troubleShootLink:(0,l.generateTroubleshootUrl)(e.code)})})},I=function(e){if(!f.hasStoredState())return Promise.resolve();var n=f.getStoredState().contentDuration,l=Promise.resolve();return y=!e,e&&(l=E=function(){return S.length?function(){return p.removeExternalEventFilter(O),f.clear(),p.off(s.PlayerEvent.Warning,N),p.off(s.PlayerEvent.Playing,b),p.unload().then(k)}():(p.fireEvent(s.PlayerEvent.RestoringContent),p.addExternalEventFilter(D),f.restore(a.ADVERTISING_RESTORE_ISSUER_NAME).then(function(e){if(p.removeExternalEventFilter(O),S.length)throw new Error("Background errors occurred during ad break");if(R)R=!1;else{if(e)return p.play(a.ADVERTISING_ISSUER_NAME).catch(function(e){P=!0,t.context.logger.debug("Unable to start playback after restoring the content after an ad break:",e)});var r=t.context.serviceManager.get(o.ServiceName.PlayerStateService);null==r||r.transitionToStoppedState()}}).catch(function(){S.length?k():p.fireEvent(s.PlayerEvent.Error,{code:i.ErrorCode.UNKNOWN})}).finally(function(){f.clear(),p.removeExternalEventFilter(D),p.off(s.PlayerEvent.Warning,N),p.off(s.PlayerEvent.Playing,b)}))}().then(function(){t.restoreContentDeferred&&t.restoreContentDeferred.resolve()})),l.then(function(){var i=r?{adBreak:r}:void 0;p.fireEvent(s.PlayerEvent.AdBreakFinished,i),r=null,e&&(0,u.maybeFireDurationChangedEvent)(n,p.getDuration(),t.context.eventHandler),p.hasCurrentSourcePlayedOnce()||P||p.fireEvent(s.PlayerEvent.Playing,{time:p.getCurrentTime(),issuer:a.ADVERTISING_ISSUER_NAME}),P=!1})},C=[s.PlayerEvent.Error,s.PlayerEvent.SourceLoaded,s.PlayerEvent.SourceUnloaded,s.PlayerEvent.PlaybackFinished,s.PlayerEvent.Ready],O=function(e,r){var n=function(){var e=t.context.store.getState();return(null==e?void 0:e.sources)&&Object.keys(e.sources).find(function(t){var r;return e.sources&&e.sources[t]&&(null===(r=e.sources[t].playback)||void 0===r?void 0:r.kind)===d.PlaybackKind.Background})}();return T(e,r)&&n&&r.sourceIdentifier===n&&S.push(r),!C.includes(e)},L=[s.PlayerEvent.Play,s.PlayerEvent.Playing,s.PlayerEvent.Seek,s.PlayerEvent.Seeked,s.PlayerEvent.TimeShift,s.PlayerEvent.TimeShifted],D=function(e){return!L.includes(e)};this.requestAdPlayback=function(e){return r?Promise.reject("Ad break already in progress"):(r=e,E.then(function(){var t=y?Promise.resolve():M(e),r={adBreak:n(n({},JSON.parse(JSON.stringify(e))),{scheduleTime:e.scheduleTime})};return p.fireEvent(s.PlayerEvent.AdBreakStarted,r),p.onInternal(s.PlayerEvent.Warning,N),p.onInternal(s.PlayerEvent.Playing,b),t.then(function(){return p.unload(a.ADVERTISING_ISSUER_NAME)}).then(function(){return h.AdPlaybackFactory.create(p,I)})}))},this.updateAdRestoreState=function(e){r&&f.setAdRestoreState(e)};var M=function(r){var n=t.context,i=n.sourceContext.sourceIdentifier,s=n.adRestorationOptimizationService,l=n.serviceManager.get(o.ServiceName.ManifestService,i),u=s&&n.settings.OPTIMIZE_AD_RESTORATION,c=e.getAdBreakDuration(r),d=r.replaceContentDuration;return f.capture(a.ADVERTISING_ISSUER_NAME),f.setAdRestoreState({adBreakDuration:c,replaceContentDuration:d}),p.addExternalEventFilter(O),u&&l&&!l.isLive()?s.optimizeRestorationAfterUpcomingAdBreak():Promise.resolve()};this.overlayAdStarted=function(e){p.fireEvent(s.PlayerEvent.OverlayAdStarted,{ad:e})},this.nonLinearAdStarted=function(e,t){p.fireEvent(s.PlayerEvent.NonLinearAdStarted,{ad:e,position:t})},this.nonLinearAdFinished=function(e,t){p.fireEvent(s.PlayerEvent.NonLinearAdFinished,{ad:e,position:t})},this.nonLinearAdSkipped=function(e,t){p.fireEvent(s.PlayerEvent.NonLinearAdSkipped,{ad:e,position:t})},this.adClicked=function(e){p.fireEvent(s.PlayerEvent.AdClicked,{clickThroughUrl:e})},this.adInteraction=function(e,t){p.fireEvent(s.PlayerEvent.AdInteraction,{interactionType:e,id:t})},this.onQuartile=function(e){p.fireEvent(s.PlayerEvent.AdQuartile,{quartile:e})},this.onError=function(e,t,r){var n={code:e||g.VastErrorCode.UNDEFINED_ERROR};t&&(n.message=t),r&&(n.adConfig=r),p.fireEvent(s.PlayerEvent.AdError,{code:i.ErrorCode.MODULE_ADVERTISING_ERROR,data:n,name:i.ErrorCode[i.ErrorCode.MODULE_ADVERTISING_ERROR],message:t,troubleShootLink:(0,l.generateTroubleshootUrl)(i.ErrorCode.MODULE_ADVERTISING_ERROR)})},this.onWarning=function(e,t,r){p.fireEvent(s.PlayerEvent.Warning,new c.PlayerWarning(e,t,r))},this.reset=function(){var t=p.getVideoElement();y=!1,R=!1,f.clear(),p.removeExternalEventFilter(O),p.removeExternalEventFilter(D),r&&t instanceof HTMLVideoElement&&e.clearVideoElement(t),r=null}}return e.getAdBreakDuration=function(e){var t,r,n=e.totalPlannedDuration;return null!=n?n:null!==(r=null===(t=e.ads)||void 0===t?void 0:t.reduce(function(e,t){var r;return e+(t.isLinear&&null!==(r=t.duration)&&void 0!==r?r:0)},0))&&void 0!==r?r:0},e.parsePosition=function(e,t){var r=Number(e);return!isNaN(r)&&r<=0&&(e="pre"),e.includes("pre")||"0%"===e?0:e.includes("post")?1/0:this.parseNumericalPosition(e,t)},e.parseNumericalPosition=function(e,t){var r;if(/%/.test(e)){if(!t)return NaN;e=e.replace(/%/gi,""),r=parseFloat(e)/100*t}else if(e.indexOf(":")>-1){var n=e.split(":");r=3600*parseFloat(n[0])+60*parseFloat(n[1])+parseFloat(n[2])}else r=parseFloat(e);return r>=0?r:NaN},e.clearVideoElement=function(e){f.VideoElementUtil.removeSource(e),e.load()},e}();t.AdPlayerDelegate=E;var y=/(\d+)/;function m(e){return Number(e.match(y)?e.match(y)[0]:0)}var T=function(e,t){return e===s.PlayerEvent.Error&&(0,p.isObject)(t)}},52448:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AdPlayerFactory=t.DEFAULT_AD_PLAYBACK_RATE=void 0,t.createSourceConfig=d;var n=r(40306),i=r(9768),o=r(3714),a=r(19483),s=r(85434),l=r(6365),u=r(7581);t.DEFAULT_AD_PLAYBACK_RATE=1;var c=function(){function e(){}return e.createAdPlayer=function(e,r){var s,l=new a.ArrayMap,c=!1,p=!1,f=[o.PlayerEvent.Play,o.PlayerEvent.Playing],h=function(){if(p)throw"AdPlayer is no longer usable. Request a new one."};return new(function(){function a(){this.adPlaybackStartEventFilter=function(t){return!e.hasCurrentSourcePlayedOnce()||!f.includes(t)}}return a.prototype.done=function(t){void 0===t&&(t=!1),h();var n=Promise.resolve();return c?n=e.unload(i.ADVERTISING_ISSUER_NAME):t||e.hasEnded()?function(e,t){e.fireEvent(o.PlayerEvent.AdFinished,{ad:t})}(e,s):function(e,t){e.fireEvent(o.PlayerEvent.AdSkipped,{ad:t})}(e,s),s=null,l.forAll(function(t,r){e.off(t,r)}),r(),p=!0,c=!1,n},a.prototype.on=function(t,r){h(),l.add(t,r),e.onInternal(t,r)},a.prototype.pause=function(){h(),e.pause(i.ADVERTISING_ISSUER_NAME)},a.prototype.play=function(){return h(),e.play(i.ADVERTISING_ISSUER_NAME)},a.prototype.load=function(r,a){var l=this;return h(),s=r,e.addExternalEventFilter(this.adPlaybackStartEventFilter),c=!0,e.load(d(r),void 0,null!=a?a:{seeking:!0},i.ADVERTISING_ISSUER_NAME).then(function(){return e.setPlaybackSpeed(t.DEFAULT_AD_PLAYBACK_RATE)}).then(function(){return e.play(i.ADVERTISING_ISSUER_NAME).catch(function(){})}).then(function(){c&&e.fireEvent(o.PlayerEvent.AdStarted,{ad:r})}).catch(function(t){if(t&&t.code===n.ErrorCode.MODULE_MISSING)throw{code:u.AdvertisingModuleErrorCode.REQUIRED_PLAYER_MODULE_MISSING,message:t.data.name};throw e.getLogger().debug("Failed to load Ad due to error: ".concat(null==t?void 0:t.message),t),t}).finally(function(){e.removeExternalEventFilter(l.adPlaybackStartEventFilter),c=!1})},Object.defineProperty(a.prototype,"duration",{get:function(){return h(),e.getDuration(i.ADVERTISING_ISSUER_NAME)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"currentTime",{get:function(){return h(),e.getCurrentTime(i.ADVERTISING_ISSUER_NAME)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"volume",{get:function(){return h(),e.getVolume()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"muted",{get:function(){return h(),e.isMuted()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"paused",{get:function(){h();var t=e.isContentPaused(),r=e.isContentPlaying();return!1===t&&!1===r||t},enumerable:!1,configurable:!0}),a}())},e}();function d(e){return e.data.delivery===l.MediaFileDeliveryType.Streaming?s.MimeTypeHelper.isDash(e.data.mimeType)?{dash:e.mediaFileUrl}:{hls:e.mediaFileUrl}:{progressive:e.mediaFileUrl}}t.AdPlayerFactory=c},44202:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof r?e:new r(function(t){t(e)})}(e.value).then(a,s)}l((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdPlayerStateStore=void 0;var a=r(80813),s=r(3714),l=r(44468),u=r(29488),c=r(46922),d=r(81524),p=r(18192),f=r(15487),h=r(88844),v=r(93531),A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.mX=null,t}return n(t,e),t.prototype.setAdRestoreState=function(e){this.hasStoredState()&&(this.mX=e,this.pX())},t.prototype.nX=function(){var e,t,r=null!==(t=null===(e=this.storedState)||void 0===e?void 0:e.sourceIdentifier)&&void 0!==t?t:this.context.sourceContext.sourceIdentifier;return this.context.serviceManager.get(a.ServiceName.SourceStoreService,r)},t.prototype.oX=function(){if(!this.storedState)return NaN;if(!this.mX)return this.storedState.playbackPosition;var e={adBreakDuration:this.mX.adBreakDuration,isLive:this.storedState.isLive,replaceContentDuration:this.mX.replaceContentDuration,playbackPosition:this.storedState.playbackPosition,resumeLiveContentAtPreviousPosition:this.context.settings.RESUME_LIVE_CONTENT_AT_PREVIOUS_POSITION_AFTER_AD_BREAK};return this.storedState.useTimeshiftForRestore?(0,v.calculateTimeshiftRestorationPosition)(e):(0,v.calculatePlaybackRestorationPosition)(e)},t.prototype.pX=function(){var e;if(this.storedState){var t=this.oX();this.context.logger.debug("Saving content restore position: ".concat(t)),null===(e=this.nX())||void 0===e||e.dispatch((0,c.setBackgroundPlaybackState)({kind:p.PlaybackKind.Background,position:t}))}},t.prototype.qX=function(e){var t,r,n,i,o=this,a=this.storedState;if(!a)return Promise.reject(new Error("no stored state to restore playback position"));if(a.isStartup)return Promise.resolve(!0);var u=null===(r=null===(t=this.nX())||void 0===t?void 0:t.getState())||void 0===r?void 0:r.playback;if(!u)return Promise.reject(new Error("no playback state available to restore playback position"));var c=(0,d.getPlaybackPosition)(u);if(a.useTimeshiftForRestore)return this.internalPlayer.timeShift(c,e),Promise.resolve(!0);if(this.internalPlayer.getPlayerType()===l.PlayerType.Native&&(0,f.isSafari)()&&c<.5)return Promise.resolve(!0);var p=(null===(n=this.context.renderer)||void 0===n?void 0:n.getDuration())||(null===(i=this.context.videoElement)||void 0===i?void 0:i.duration)||a.contentDuration||c;return c>=p?Promise.resolve(!1):new Promise(function(t,r){var n,i=function(){(0,h.clearTimeoutIfDefined)(n),o.internalPlayer.off(s.PlayerEvent.Seeked,a),o.internalPlayer.off(s.PlayerEvent.Error,u)},a=function(){i(),t(!0)},u=function(){i(),r(new Error("Error during playback restoration"))};o.internalPlayer.onInternal(s.PlayerEvent.Seeked,a),o.internalPlayer.onInternal(s.PlayerEvent.Error,u),o.internalPlayer.getPlayerType()===l.PlayerType.Native&&((0,f.isWebOS)()||(0,f.isPlayStation4)())&&(n=window.setTimeout(a,5e3)),o.internalPlayer.seek(c,e)||a()})},t.prototype.restore=function(e){return i(this,void 0,void 0,function(){var t,r,n;return o(this,function(i){switch(i.label){case 0:if(!(t=this.storedState))throw new Error("no stored state to restore");if(!t.source)throw new Error("stored state has no source to restore");return[4,this.loadSource(e)];case 1:return i.sent(),this.restoreBaseState(t),[4,this.qX(e)];case 2:return r=i.sent(),this.restoreSubtitles(t.subtitles),null===(n=this.nX())||void 0===n||n.dispatch((0,c.setMainContentPlaybackState)({kind:p.PlaybackKind.MainContent})),this.clear(),[2,r]}})})},t.prototype.clear=function(){e.prototype.clear.call(this),this.mX=null},t}(u.PlayerStateStore);t.AdPlayerStateStore=A},42163:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.AdPreloadingService=t.AdPlaybackPhase=t.AdPreloadState=void 0;var i,o,a=r(80813),s=r(9768),l=r(3714),u=r(69251),c=r(15971),d=r(23068),p=r(52448);!function(e){e.None="none",e.Pending="pending",e.Done="done",e.Failed="failed"}(i||(t.AdPreloadState=i={})),function(e){e.Upcoming="upcoming",e.Playing="playing",e.Retired="retired"}(o||(t.AdPlaybackPhase=o={}));var f=function(){function e(e){var t=this;this.context=e,this.wz=[],this.yz=!1,this.Az=function(e){var r,n,i;if(!t.yz){var a=t.wz.find(function(t){return t.id===String(e.ad.id)});if((null==a?void 0:a.phase)===o.Upcoming&&a.sourceIdentifier===(null===(r=t.context.sourceContext)||void 0===r?void 0:r.sourceIdentifier)){t.Dz(a.id);var s=(0,c.getSourceStore)(t.context);(null===(i=null===(n=null==s?void 0:s.getState())||void 0===n?void 0:n.buffer)||void 0===i?void 0:i.isLoadingRangeFinished)?t.Bz():(t.Cz(),t.zz=null==s?void 0:s.subscribe(t.Bz,function(e,t){var r,n;return Boolean((null===(r=null==e?void 0:e.buffer)||void 0===r?void 0:r.isLoadingRangeFinished)&&!(null===(n=null==t?void 0:t.buffer)||void 0===n?void 0:n.isLoadingRangeFinished))}))}}},this.Bz=function(){var e,r=t.Gz(o.Playing);!t.yz&&r&&r.sourceIdentifier===(null===(e=t.context.sourceContext)||void 0===e?void 0:e.sourceIdentifier)&&(t.Ez(r.id),t.Cz())},e.eventHandler.on(l.PlayerEvent.AdStarted,this.Az,!0)}return e.prototype.Cz=function(){var e;null===(e=this.zz)||void 0===e||e.call(this),this.zz=void 0},e.prototype.hasTrackedAds=function(){return this.wz.length>0},e.prototype.preloadAds=function(e){return!!this.trackAds(e)&&(this.Hz(),!0)},e.prototype.trackAds=function(e){var t=this,r=function(e){return e.map(function(e){return{id:String(e.id),sourceConfig:(0,p.createSourceConfig)(e)}}).filter(function(e){return(0,d.isDefined)(e.sourceConfig.hls)||(0,d.isDefined)(e.sourceConfig.dash)})}(e);return!this.yz&&0!==r.length&&(this.hasTrackedAds()?(this.context.logger.debug("[AdPreloading] Hand-over ignored while ads are tracked; cancel() first"),!1):(this.context.logger.debug("[AdPreloading] Tracking ".concat(r.length," ads for preloading: ").concat(r.map(function(e){return e.id}))),this.wz=this.wz.concat(r.map(function(e){return n(n({},e),{sourceIdentifier:(0,u.deriveSourceIdentifier)(e.sourceConfig,t.context.internalPlayerID),preload:i.None,phase:o.Upcoming})})),!0))},e.prototype.Dz=function(e){if(!this.yz){var t=this.wz.find(function(t){return t.id===e&&t.phase!==o.Retired});if(t){this.Fz(t);var r=this.wz.filter(function(e){return e.phase===o.Upcoming}).length;this.context.logger.debug("[AdPreloading] Ad ".concat(e," started playback (").concat(r," ads upcoming)"))}else this.context.logger.debug("[AdPreloading] Ad ".concat(e," started playback but is not tracked"))}},e.prototype.Ez=function(e){var t;this.yz||(null===(t=this.Gz(o.Playing))||void 0===t?void 0:t.id)!==e||(this.Kz(function(e){return e.phase===o.Retired}),this.Hz())},e.prototype.cancel=function(){this.yz||(this.wz.length>0&&this.context.logger.debug("[AdPreloading] Dropping ".concat(this.wz.length," tracked ads")),this.Kz(function(){return!0}),this.Cz())},e.prototype.dispose=function(){this.yz||(this.cancel(),this.context.eventHandler.off(l.PlayerEvent.AdStarted,this.Az),this.yz=!0)},e.prototype.Fz=function(e){if(e.phase!==o.Playing){this.Kz(function(e){return e.phase===o.Retired});for(var t=0,r=this.wz;t<r.length;t++){var n=r[t];if(n===e){n.phase=o.Playing;break}n.phase=o.Retired}this.xz===e&&(this.xz=void 0)}},e.prototype.Gz=function(e){return this.wz.find(function(t){return t.phase===e})},e.prototype.Hz=function(){var e=this.wz.find(function(e){return e.phase===o.Upcoming&&e.preload===i.None});!this.xz&&e&&(e.preload=i.Pending,this.xz=e,this.context.logger.debug("[AdPreloading] Preloading ad ".concat(e.id)),this.Iz(e))},e.prototype.Iz=function(e){var t,r=this,n=null===(t=this.context.serviceManager)||void 0===t?void 0:t.get(a.ServiceName.PreloadingService);n?n.preloadSource(e.sourceConfig,s.ADVERTISING_ISSUER_NAME).then(function(){r.xz===e&&(r.xz=void 0),e.preload=i.Done,!r.yz&&r.wz.includes(e)&&r.context.logger.debug("[AdPreloading] Source preparation completed for ad ".concat(e.id))}).catch(function(t){var n;r.context.logger.debug("[AdPreloading] Failed to preload ad ".concat(e.id,": ").concat(null!==(n=null==t?void 0:t.message)&&void 0!==n?n:t)),r.Jz(e)}):this.Jz(e)},e.prototype.Jz=function(e){e.preload=i.Failed,this.xz===e&&(this.xz=void 0),this.wz.includes(e)&&e.phase===o.Upcoming&&(this.Lz(e),this.yz||this.Hz())},e.prototype.Kz=function(e){var t=this.wz.filter(e);this.wz=this.wz.filter(function(t){return!e(t)}),this.xz&&t.includes(this.xz)&&(this.xz=void 0);for(var r={},n=0,i=t;n<i.length;n++){var o=i[n];r[o.sourceIdentifier]||(r[o.sourceIdentifier]=!0,this.Lz(o))}},e.prototype.Lz=function(e){var t,r;this.wz.some(function(t){return t!==e&&t.sourceIdentifier===e.sourceIdentifier&&function(e){return e.phase!==o.Upcoming||e.preload===i.Pending||e.preload===i.Done}(t)})||(this.context.logger.debug(e.preload===i.Pending?"[AdPreloading] Cancelling the in-flight preload of ad ".concat(e.id):"[AdPreloading] Releasing the preload artifacts of ad ".concat(e.id)),null===(r=null===(t=this.context.serviceManager)||void 0===t?void 0:t.get(a.ServiceName.PreloadingService))||void 0===r||r.cancelPreload(e.sourceIdentifier))},e}();t.AdPreloadingService=f},95217:function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.AdTrackingEvent=void 0,t.pingUrl=function(e){(new Image).src=e},function(e){e.FirstQuartile="firstQuartile",e.Midpoint="midpoint",e.ThirdQuartile="thirdQuartile"}(r||(t.AdTrackingEvent=r={}))},90176:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AdvertisingController=t.adTagPlaceholderDefaults=void 0,t.applyModuleSpecificConfig=T,t.createPlayerAdvertisingApi=R;var n=r(4224),i=r(9768),o=r(3714),a=r(4129),s=r(29669),l=r(44468),u=r(87827),c=r(93204),d=r(94685),p=r(34841),f=r(88844),h=r(70850),v=r(88052),A=r(62756),g=r(45392),E=r(50205),y={videoLoadTimeout:r(6365).DEFAULT_VIDEO_LOAD_TIMEOUT,strategy:E.defaultAdvertisingStrategy};t.adTagPlaceholderDefaults={playbackTime:["[CONTENTPLAYHEAD]"],height:["[HEIGHT]"],width:["[WIDTH]"],domain:["[DOMAIN]"],page:["[SITE]"],referrer:["[REFERRER]"],random:["[random]","[CACHEBUSTING]"],timestamp:["[TIMESTAMP]"]};var m=function(){function e(e,t){var r=this;this.context=t,this.uA=function(e){r.kA.isCastingToCAF()||r.qA.onTimeChanged(e.time)},this.vA=function(e){return r.qA.onSeek(e.position,e.seekTarget)},this.wA=function(){var e,t;return null===(t=(e=r.qA).onSeeked)||void 0===t?void 0:t.call(e)},this.xA=function(){var e,t;return null===(t=(e=r.qA).onPlay)||void 0===t?void 0:t.call(e)},this.yA=function(e){return r.tA=e.position},this.zA=function(){r.vA({position:r.tA,seekTarget:r.kA.getCurrentTime(i.ADVERTISING_ISSUER_NAME)}),r.wA()},this.AA=function(e){r.pA&&e.code===n.WarningCode.PLAYBACK_COULD_NOT_BE_STARTED&&(r.pA=!1)},this.onVolumeChanged=function(e){return r.qA.onVolumeChanged(e)},this.BA=function(){r.mA.length>0&&r.DA(r.mA.splice(0,r.mA.length)),r.kA.off(o.PlayerEvent.SourceLoaded,r.BA)},this.onPlayerResize=function(e,t){r.qA.onResize(e,t,r.kA.getViewMode()===l.ViewMode.Fullscreen)};var a=e.getConfig(!0);this.lA=a.advertising||{},this.kA=e,this.mA=[],this.nA=null,this.oA=!0,this.pA=!1;var s=function(e,t){var r,n,i={},o={};return h.Util.deepCopy(o,e),delete o.adBreaks,h.Util.deepCopyMulti(i,y,o),i.hasOwnProperty("withCredentials")||(i.withCredentials=!0),i.hasOwnProperty("disableStorageApi")||(i.disableStorageApi=null!==(n=null===(r=t.storage)||void 0===r?void 0:r.disableStorageApi)&&void 0!==n&&n),i}(this.lA,a);T(a,s,t.logger),this.createAdvertisingModule(s),this.lA.adBreaks&&this.lA.adBreaks.length>0&&this.lA.adBreaks.splice(0).forEach(function(e){return r.scheduleAd(e).catch(function(e){return r.context.logger.warn("Failed to schedule ad break",e)})}),this.kA.on(o.PlayerEvent.TimeChanged,this.uA),this.kA.on(o.PlayerEvent.Seek,this.vA),this.kA.on(o.PlayerEvent.Seeked,this.wA),this.kA.onInternal(o.PlayerEvent.Play,this.xA),this.kA.on(o.PlayerEvent.Warning,this.AA),this.kA.on(o.PlayerEvent.TimeShift,this.yA),this.kA.on(o.PlayerEvent.TimeShifted,this.zA),this.playerAdvertisingApi=R(this,this.qA)}return e.prototype.createAdvertisingModule=function(e){var t,r,n=new g.AdManifestHelper(new a.DefaultContentLoader(this.context,{requestType:s.HttpRequestType.MANIFEST_ADS}),e.videoLoadTimeout,null===(t=e.withCredentials)||void 0===t||t,null!==(r=e.disableStorageApi)&&void 0!==r&&r);this.sA={internalPlayer:this.kA,context:this.context,restoreContentDeferred:null};var i=v.ModuleManager.get(A.ModuleName.AdvertisingCore),o=v.ModuleManager.get(A.ModuleName.Advertising),l=new i.AdPlayerDelegate(this.sA);this.qA=new o(l,e,n),this.rA=l},e.prototype.updatePlayerContext=function(e){this.context=e,this.sA.context=e},e.prototype.initializeAdModule=function(){this.qA.initialize()},e.prototype.onContentPaused=function(e){var t,r;(0,i.isUserInitiatedPause)(e)&&!this.kA.isCasting()&&this.kA.getViewMode()!==l.ViewMode.PictureInPicture&&(null===(r=(t=this.qA).onContentPaused)||void 0===r||r.call(t))},e.prototype.scheduleAd=function(e){return P(e)&&(e.discardAfterPlayback=!1!==e.discardAfterPlayback,this.CA(e)&&!this.FA())?(this.mA.push(e),this.nA||(this.nA=new p.Deferred,this.kA.on(o.PlayerEvent.SourceLoaded,this.BA)),this.nA.promise):this.EA(e)},e.prototype.CA=function(e){return e.position.includes("%")&&"0%"!==e.position},e.prototype.DA=function(e){var t=this,r=e.map(function(e){return t.EA(e)});this.nA&&Promise.all(r).then(function(e){var r=[].concat.apply([],e);t.nA.resolve(r),t.nA=null}).catch(function(e){return t.context.logger.warn("Failed to schedule delayed ad breaks",e)})},e.prototype.EA=function(e){return P(e)&&this.kA.isLive()&&this.CA(e)?Promise.reject("percentage based ad break positions can not be used for live streams"):this.qA.schedule(e)},e.prototype.playPreRollAds=function(){var e,t,r=this,n=Promise.resolve();return this.pA=!0,this.oA&&(null===(t=null===(e=this.context)||void 0===e?void 0:e.videoElement)||void 0===t?void 0:t.prime)&&(n=this.context.videoElement.prime()),Promise.resolve(this.qA.beforeContent()).catch(function(e){(0,d.isContextAvailable)(r.context)&&r.context.logger.debug("Failed to trigger preroll ad playback: ",e)}).then(function(){return n}).catch(function(e){(0,d.isContextAvailable)(r.context)&&r.context.logger.debug("Failed to prime video element: ",e)})},e.prototype.playPostRollAds=function(){var e=this,t=!1,r=function(){t=!0,e.kA.off(o.PlayerEvent.AdBreakStarted,r)};return this.kA.on(o.PlayerEvent.AdBreakStarted,r),this.sA.restoreContentDeferred=new p.Deferred,Promise.resolve(this.qA.afterContent()).then(function(){return new Promise(function(r,n){if(t){var i,o=function(){e.sA.restoreContentDeferred.promise.then(r).catch(n),a(),(0,f.clearTimeoutIfDefined)(i)},a=(0,c.subscribe)(e.context.store)(function(e){return(0,u.getIsStopped)((0,u.getPlayerState)(e))},o,function(e){return e});i=window.setTimeout(o,1e3)}else r()})}).then(function(){return e.sA.restoreContentDeferred=null}).catch(function(t){e.sA.restoreContentDeferred=null,e.context.logger.debug("Failed to restore content after ad playback",t)})},e.prototype.hasAlreadyRequestedPreRollAds=function(){return this.pA},e.prototype.play=function(){return this.qA.resume(),Promise.resolve()},e.prototype.pause=function(){this.qA.pause()},e.prototype.getCurrentTime=function(){var e,t=null===(e=this.qA)||void 0===e?void 0:e.currentTime();return isNaN(t)?0:null!=t?t:0},e.prototype.getDuration=function(){return this.qA.duration()},e.prototype.isLinearAdActive=function(){return this.qA.isLinearAdActive()},e.prototype.isPlaying=function(){return this.qA.isLinearAdActive(!0)},e.prototype.isPaused=function(){return this.isLinearAdActive()&&!this.isPlaying()},e.prototype.FA=function(){return this.kA.getDuration()>0},e.prototype.reset=function(){return this.mA=[],this.pA=!1,this.rA.reset(),this.qA.reset()},e.prototype.dispose=function(){this.kA.off(o.PlayerEvent.TimeChanged,this.uA),this.kA.off(o.PlayerEvent.Seek,this.vA),this.kA.off(o.PlayerEvent.Seeked,this.wA),this.kA.off(o.PlayerEvent.Play,this.xA),this.kA.off(o.PlayerEvent.Warning,this.AA),this.kA.off(o.PlayerEvent.TimeShift,this.yA),this.kA.off(o.PlayerEvent.TimeShifted,this.zA),this.kA=null,this.lA=null,this.qA.dispose(),this.qA=null,this.rA=null},e}();function T(e,t,r){if(Boolean(v.ModuleManager.get(A.ModuleName.Advertising).bitmovinMarker))return r.debug("Using Bitmovin Advertising Module"),void function(e,t){var r=t;e.playback&&Array.isArray(e.playback.preferredTech)?r.preferredTechnology=e.playback.preferredTech:r.preferredTechnology=[]}(e,t);Boolean(v.ModuleManager.get(A.ModuleName.Advertising).imaMarker)&&(r.debug("Using IMA Advertising Module"),function(e,t){var r=t;r.sdkUrl||(r.sdkUrl=e.location.google_ima)}(e,t))}function R(e,t){return new(function(){function r(){}return r.prototype.schedule=function(t){return e.scheduleAd(t)},r.prototype.skip=function(){return t.skip()},r.prototype.list=function(){return t.list()},r.prototype.getActiveAdBreak=function(){return t.getActiveAdBreak()},r.prototype.getActiveAd=function(){return t.getActiveAd()},r.prototype.discardAdBreak=function(e){t.discardAdBreak(e)},r.prototype.isLinearAdActive=function(){return t.isLinearAdActive()},r.prototype.getModuleInfo=function(){return t.getModuleInfo()},r}())}function P(e){return Boolean(e.position)}t.AdvertisingController=m},28412:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AdvertisingModule=void 0;var r=function(){return function(e,t,r){this.player=e,this.config=t,this.adManifestHelper=r}}();t.AdvertisingModule=r},88457:function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.AdvertisingModuleErrorCode=void 0,function(e){e[e.AD_TAG_TYPE_NOT_MATCHING=110]="AD_TAG_TYPE_NOT_MATCHING",e[e.COULD_NOT_LOAD_AD_MANIFEST=404]="COULD_NOT_LOAD_AD_MANIFEST",e[e.REQUIRED_PLAYER_MODULE_MISSING=2e3]="REQUIRED_PLAYER_MODULE_MISSING"}(r||(t.AdvertisingModuleErrorCode=r={}))},50205:function(e,t,r){var n=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.defaultAdvertisingStrategy=void 0,t.shouldLoadAdBreak=function(e,r,n){var o;return null!==(o=(0,i.safeUserCallback)(function(){var t;return null===(t=null==e?void 0:e.shouldLoadAdBreak)||void 0===t?void 0:t.call(e,r)},n))&&void 0!==o?o:t.defaultAdvertisingStrategy.shouldLoadAdBreak()},t.shouldPlayAdBreak=function(e,r,n){var o;return null!==(o=(0,i.safeUserCallback)(function(){var t;return null===(t=null==e?void 0:e.shouldPlayAdBreak)||void 0===t?void 0:t.call(e,r)},n))&&void 0!==o?o:t.defaultAdvertisingStrategy.shouldPlayAdBreak()},t.shouldPlaySkippedAdBreaks=function(e,r,o,a,s){var l=(0,i.safeUserCallback)(function(){var t;return null===(t=null==e?void 0:e.shouldPlaySkippedAdBreaks)||void 0===t?void 0:t.call(e,n([],r,!0),o,a)},s);return null!=l?l:t.defaultAdvertisingStrategy.shouldPlaySkippedAdBreaks(r)};var i=r(70850);t.defaultAdvertisingStrategy={shouldLoadAdBreak:function(){return!0},shouldPlayAdBreak:function(){return!0},shouldPlaySkippedAdBreaks:function(e){var t=Math.max.apply(Math,e.map(function(e){return e.scheduleTime})),r=e.find(function(e){return e.scheduleTime===t});return r?[r]:[]}}},23912:function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.AdTagType=void 0,function(e){e.VAST="vast",e.VMAP="vmap",e.VPAID="vpaid"}(r||(t.AdTagType=r={}))},93531:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.calculatePlaybackRestorationPosition=function(e){var t=e.adBreakDuration,r=e.isLive,n=e.playbackPosition,i=e.replaceContentDuration,o=e.resumeLiveContentAtPreviousPosition;return n+(null!=i?i:!r||o?0:t)},t.calculateTimeshiftRestorationPosition=function(e){var t=e.adBreakDuration,r=e.playbackPosition,i=e.replaceContentDuration,o=e.resumeLiveContentAtPreviousPosition?t:0,a=(0,n.isDefined)(i)?t-i:o;return Math.min(r-a,0)};var n=r(23068)},6365:function(e,t){var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.VastApiFramework=t.MediaFileDeliveryType=t.DEFAULT_OVERLAY_AD_BOTTOM_POSITION=t.DEFAULT_VIDEO_LOAD_TIMEOUT=t.NON_SKIPPABLE_IDENTIFIER=t.DEFAULT_PRELOAD_OFFSET=t.DEFAULT_PAUSE_AD_ACTIVATION_DELAY=void 0,t.DEFAULT_PAUSE_AD_ACTIVATION_DELAY=1,t.DEFAULT_PRELOAD_OFFSET=0,t.NON_SKIPPABLE_IDENTIFIER=-1,t.DEFAULT_VIDEO_LOAD_TIMEOUT=8e3,t.DEFAULT_OVERLAY_AD_BOTTOM_POSITION="4.5em",function(e){e.Progressive="progressive",e.Streaming="streaming"}(r||(t.MediaFileDeliveryType=r={})),function(e){e.Vpaid="vpaid"}(n||(t.VastApiFramework=n={}))},65185:function(e,t){function r(e){return e.bitrate||(e.maxBitrate+e.minBitrate)/2}Object.defineProperty(t,"__esModule",{value:!0}),t.findMediaFileByResolution=function(e,t,r){return r.reduce(function(r,n){var i=Math.abs(e-r.width)+Math.abs(t-r.height);return Math.abs(e-n.width)+Math.abs(t-n.height)<i?n:r})},t.findMediaFileByBitrate=function(e,t){return t.reduce(function(t,n){var i=r(t),o=r(n),a=Math.abs(i-e);return Math.abs(o-e)<a?n:t})}},7581:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.VastErrorCode=t.AdvertisingModuleErrorCode=t.AdTagType=t.AdvertisingCoreModuleDefinition=void 0;var n=r(62756),i=r(43255),o=r(42163),a=r(90176),s=r(88457);Object.defineProperty(t,"AdvertisingModuleErrorCode",{enumerable:!0,get:function(){return s.AdvertisingModuleErrorCode}});var l=r(23912);Object.defineProperty(t,"AdTagType",{enumerable:!0,get:function(){return l.AdTagType}});var u=r(47091);Object.defineProperty(t,"VastErrorCode",{enumerable:!0,get:function(){return u.VastErrorCode}}),t.AdvertisingCoreModuleDefinition={name:n.ModuleName.AdvertisingCore,module:function(){return{AdvertisingController:a.AdvertisingController,AdPlayerDelegate:i.AdPlayerDelegate,AdPreloadingService:o.AdPreloadingService}},dependencies:[n.ModuleName.XML],exports:{AdTagType:l.AdTagType,AdvertisingModuleErrorCode:s.AdvertisingModuleErrorCode,VastErrorCode:u.VastErrorCode}},t.default=t.AdvertisingCoreModuleDefinition},60326:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.VastClientWrapper=void 0;var n=r(6036),i=r(6365),o=r(47091),a=function(){function e(e,t,r){this.VK=new n.VASTClient({allowUsingBrowserStorageApi:!r}),this.VK.vastParser.initParsingStatus(),this.gL=e||i.DEFAULT_VIDEO_LOAD_TIMEOUT,this.hL=t}return e.prototype.parseManifest=function(e,t){var r=this,n=[],i=function(e){n.push({code:e.ERRORCODE})};return this.VK.vastParser.addListener("VAST-error",i),this.VK.vastParser.parseVAST(e,{timeout:this.gL,withCredentials:this.hL,replaceUnavailableAdPodAds:!t}).catch(function(e){return r.VK.vastParser.removeListener("VAST-error",i),Promise.reject({code:e&&e.ERRORCODE||o.VastErrorCode.UNDEFINED_ERROR})}).then(function(e){var t;return r.VK.vastParser.removeListener("VAST-error",i),(null===(t=e.ads)||void 0===t?void 0:t.length)>0?e:n.length>0?Promise.reject(n[0]):Promise.reject({code:o.VastErrorCode.UNDEFINED_ERROR})})},e}();t.VastClientWrapper=a},47091:function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.VastErrorCode=void 0,function(e){e[e.XML_PARSING_ERROR=100]="XML_PARSING_ERROR",e[e.VAST_SCHEMA_VALIDATION_ERROR=101]="VAST_SCHEMA_VALIDATION_ERROR",e[e.VERSION_NOT_SUPPORTED=102]="VERSION_NOT_SUPPORTED",e[e.TRAFFICKING_ERROR=200]="TRAFFICKING_ERROR",e[e.EXPECTING_DIFFERENT_LINEARITY=201]="EXPECTING_DIFFERENT_LINEARITY",e[e.EXPECTING_DIFFERENT_DURATION=202]="EXPECTING_DIFFERENT_DURATION",e[e.EXPECTING_DIFFERENT_SIZE=203]="EXPECTING_DIFFERENT_SIZE",e[e.GENERAL_WRAPPER_ERROR=300]="GENERAL_WRAPPER_ERROR",e[e.WRAPPER_VAST_URI_TIMEOUT=301]="WRAPPER_VAST_URI_TIMEOUT",e[e.WRAPPER_LIMIT_REACHED=302]="WRAPPER_LIMIT_REACHED",e[e.NO_ADS_VAST_RESPONSE=303]="NO_ADS_VAST_RESPONSE",e[e.INLINE_AD_DISPLAY_TIMEOUT=304]="INLINE_AD_DISPLAY_TIMEOUT",e[e.GENERAL_LINEAR_ERROR=400]="GENERAL_LINEAR_ERROR",e[e.FILE_NOT_FOUND=401]="FILE_NOT_FOUND",e[e.MEDIAFILE_URI_TIMEOUT=402]="MEDIAFILE_URI_TIMEOUT",e[e.NO_SUPPORTED_MEDIAFILE=403]="NO_SUPPORTED_MEDIAFILE",e[e.PROBLEM_DISPLAYING_MEDIAFILE=405]="PROBLEM_DISPLAYING_MEDIAFILE",e[e.GENERAL_NONLINEARADS_ERROR=500]="GENERAL_NONLINEARADS_ERROR",e[e.NONLINEAR_AD_INVALID_DIMENSIONS=501]="NONLINEAR_AD_INVALID_DIMENSIONS",e[e.UNABLE_TO_FETCH_NONLINEAR_RESOURCE=502]="UNABLE_TO_FETCH_NONLINEAR_RESOURCE",e[e.NO_SUPPORTED_NONLINEAR_RESOURCE_TYPE=503]="NO_SUPPORTED_NONLINEAR_RESOURCE_TYPE",e[e.GENERAL_COMPANIONADS_ERROR=600]="GENERAL_COMPANIONADS_ERROR",e[e.COMPANION_AD_INVALID_DIMENSIONS=601]="COMPANION_AD_INVALID_DIMENSIONS",e[e.UNABLE_TO_DISPLAY_REQUIRED_COMPANION=602]="UNABLE_TO_DISPLAY_REQUIRED_COMPANION",e[e.UNABLE_TO_FETCH_COMPANION_RESOURCE=603]="UNABLE_TO_FETCH_COMPANION_RESOURCE",e[e.NO_SUPPORTED_COMPANION_RESOURCE_TYPE=604]="NO_SUPPORTED_COMPANION_RESOURCE_TYPE",e[e.UNDEFINED_ERROR=900]="UNDEFINED_ERROR",e[e.GENERAL_VPAID_ERROR=901]="GENERAL_VPAID_ERROR"}(r||(t.VastErrorCode=r={}))},5838:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.VmapExtractor=void 0;var n=r(70850),i=r(88052),o=r(62756),a=r(45392),s=r(88457),l=r(23912),u=r(6365),c=r(47091),d=function(){function e(){}return e.xml2js=function(e){return(0,i.ModuleManager.get(o.ModuleName.XML).parseXML)(e,{decodeEntities:!1,useArrayRepresentationForChildren:!0})},e.js2xml=function(e){return(0,i.ModuleManager.get(o.ModuleName.XML).parseJSONtoXML)(e)},e.extractAdBreakConfigs=function(t,r){return e.getParsedManifest(t.tag.url,r).then(function(r){if(r.manifest.VMAP){var n=e.parseVmapAdBreaks(r.manifest,t);return Promise.resolve({adBreakConfigs:n,downloadTiming:r.downloadTiming})}return Promise.reject({code:s.AdvertisingModuleErrorCode.AD_TAG_TYPE_NOT_MATCHING})})},e.getParsedManifest=function(t,r){return r.downloadVmapManifest(t).catch(function(){return Promise.reject({code:s.AdvertisingModuleErrorCode.COULD_NOT_LOAD_AD_MANIFEST})}).then(function(t){if(!t.body)return Promise.reject({code:c.VastErrorCode.XML_PARSING_ERROR});try{var r=e.xml2js(t.body),n=r.success?r.parsed:{},i={downloadTime:t.elapsedTime,timeToFirstByte:t.timeToFirstByte};return Promise.resolve({manifest:n,downloadTiming:i})}catch(e){return Promise.reject({code:c.VastErrorCode.XML_PARSING_ERROR})}})},e.parseVmapAdBreaks=function(t,r){return e.extractAdBreaks(t).map(function(e){var t,i={id:e.id||n.Util.generateUniqueId(),tag:{url:e.tag,type:l.AdTagType.VAST},position:e.offset,preloadOffset:null!==(t=r.preloadOffset)&&void 0!==t?t:u.DEFAULT_PRELOAD_OFFSET};r.hasOwnProperty("replaceContentDuration")&&(i.replaceContentDuration=r.replaceContentDuration),r.passthroughMode&&(i.passthroughMode=r.passthroughMode);var o={publicAdBreakConfig:i};return e.trackingEvents&&Object.keys(e.trackingEvents).length>0&&(o.trackingEvents=e.trackingEvents),o})||[]},e.extractAdBreaks=function(t){return t.VMAP?t.VMAP.AdBreak.map(function(t){var r=t._breakId,n=t._timeOffset;switch(n){case"start":n="pre";break;case"end":n="post"}var i=e.getAdBreakUri(t),o=[];return t.TrackingEvents&&t.TrackingEvents[0]&&t.TrackingEvents[0].Tracking&&t.TrackingEvents[0].Tracking.forEach(function(e){var t=e._event.toLocaleLowerCase();o.push({type:t,url:e.toString()})}),{id:r,offset:n,tag:i,trackingEvents:o}}):[]},e.getAdBreakUri=function(t){var r,n,i,o=null===(r=t.AdSource)||void 0===r?void 0:r[0],s=null===(n=null==o?void 0:o.AdTagURI)||void 0===n?void 0:n[0],l=null===(i=null==o?void 0:o.VASTAdData)||void 0===i?void 0:i[0];return(null==s?void 0:s.toString)?s.toString():l?(0,a.toDataUri)(e.js2xml(l)):""},e}();t.VmapExtractor=d},63207:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Ad=void 0;var r=function(){return function(){this.id=null,this.wrapperAdIds=[],this.sequence=null,this.system=null,this.title=null,this.description=null,this.advertiser=null,this.pricing=null,this.survey=null,this.errorURLTemplates=[],this.impressionURLTemplates=[],this.creatives=[],this.extensions=[],this.verifications=[]}}();t.Ad=r},19637:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AdExtension=void 0;var r=function(){function e(){this.name=null,this.value=null,this.attributes={},this.children=[]}return e.prototype.isEmpty=function(){return null===this.value&&0===Object.keys(this.attributes).length&&0===this.children.length},e}();t.AdExtension=r},31472:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.CompanionAd=void 0;var r=function(){return function(){this.id=null,this.width=0,this.height=0,this.type=null,this.staticResource=null,this.htmlResource=null,this.iframeResource=null,this.altText=null,this.companionClickThroughURLTemplate=null,this.companionClickTrackingURLTemplates=[],this.trackingEvents={}}}();t.CompanionAd=r},36828:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Creative=void 0;var r=function(){return function(e){void 0===e&&(e={}),this.id=e.id||null,this.adId=e.adId||null,this.universalAdId=e.universalAdId||null,this.sequence=e.sequence||null,this.apiFramework=e.apiFramework||null,this.trackingEvents={}}}();t.Creative=r},81214:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.CreativeCompanion=void 0;var i=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.type="companion",r.variations=[],r}return n(t,e),t}(r(36828).Creative);t.CreativeCompanion=i},77615:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.CreativeLinear=void 0;var i=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.type="linear",r.duration=0,r.skipDelay=null,r.mediaFiles=[],r.videoClickThroughURLTemplate=null,r.videoClickTrackingURLTemplates=[],r.videoCustomClickURLTemplates=[],r.adParameters=null,r.icons=[],r}return n(t,e),t}(r(36828).Creative);t.CreativeLinear=i},35475:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.CreativeNonLinear=void 0;var i=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.type="nonlinear",r.variations=[],r}return n(t,e),t}(r(36828).Creative);t.CreativeNonLinear=i},50199:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Icon=void 0;var r=function(){return function(){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}}();t.Icon=r},36629:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MediaFile=void 0;var r=function(){return function(){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}}();t.MediaFile=r},57219:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.NonLinearAd=void 0;var r=function(){return function(){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}}();t.NonLinearAd=r},71119:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parseAd=function(e){var t=e.childNodes;for(var r in t){var n=t[r];if(-1!==["Wrapper","InLine"].indexOf(n.nodeName)){if(l.parserUtils.copyNodeAttribute("id",e,n),l.parserUtils.copyNodeAttribute("sequence",e,n),"Wrapper"===n.nodeName)return c(n);if("InLine"===n.nodeName)return u(n)}}},t.parseExtensions=d;var n=r(63207),i=r(19637),o=r(93088),a=r(2035),s=r(64815),l=r(75065);function u(e){var t=e.childNodes,r=new n.Ad;for(var i in r.id=e.getAttribute("id")||null,r.sequence=e.getAttribute("sequence")||null,t){var u=t[i];switch(u.nodeName){case"Error":r.errorURLTemplates.push(l.parserUtils.parseNodeText(u));break;case"Impression":r.impressionURLTemplates.push(l.parserUtils.parseNodeText(u));break;case"Creatives":l.parserUtils.childrenByName(u,"Creative").forEach(function(e){var t={id:e.getAttribute("id")||null,adId:h(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"UniversalAdId":t.universalAdId=v(i);break;case"Linear":var l=(0,a.parseCreativeLinear)(i,t);l&&r.creatives.push(l);break;case"NonLinearAds":var u=(0,s.parseCreativeNonLinear)(i,t);u&&r.creatives.push(u);break;case"CompanionAds":var c=(0,o.parseCreativeCompanion)(i,t);c&&r.creatives.push(c)}}});break;case"Extensions":r.extensions=d(l.parserUtils.childrenByName(u,"Extension"),r);break;case"AdSystem":r.system={value:l.parserUtils.parseNodeText(u),version:u.getAttribute("version")||null};break;case"AdTitle":r.title=l.parserUtils.parseNodeText(u);break;case"Description":r.description=l.parserUtils.parseNodeText(u);break;case"Advertiser":r.advertiser={name:l.parserUtils.parseNodeText(u),id:u.getAttribute("id")||null};break;case"Pricing":r.pricing={value:l.parserUtils.parseNodeText(u),model:u.getAttribute("model")||null,currency:u.getAttribute("currency")||null};break;case"Survey":r.survey={uri:l.parserUtils.parseNodeText(u),type:u.getAttribute("type")||null};break;case"AdVerifications":f(r.verifications,l.parserUtils.childrenByName(u,"Verification"))}}return r}function c(e){var t=u(e),r=l.parserUtils.childByName(e,"VASTAdTagURI");if(r?t.nextWrapperURL=l.parserUtils.parseNodeText(r):(r=l.parserUtils.childByName(e,"VASTAdTagURL"))&&(t.nextWrapperURL=l.parserUtils.parseNodeText(l.parserUtils.childByName(r,"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 r=function(r){var n=e.trackingEvents[r];t.trackingEvents[e.type][r]||(t.trackingEvents[e.type][r]=[]),n.forEach(function(n){t.trackingEvents[e.type][r].push(n)})};for(var n in e.trackingEvents)r(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 d(e,t){var r=[];return e.forEach(function(e){var n=p(e,t);n&&r.push(n)}),r}function p(e,t){if("#comment"===e.nodeName)return null;var r=new i.AdExtension,n=e.attributes,o=e.childNodes;if(r.name=e.nodeName,e.attributes)for(var a in n)if(n.hasOwnProperty(a)){var s=n[a];s.nodeName&&s.nodeValue&&(r.attributes[s.nodeName]=s.nodeValue)}for(var u in o)if(o.hasOwnProperty(u)){if("AdVerifications"===o[u].nodeName){f(t.verifications,l.parserUtils.childrenByName(o[u],"Verification"));continue}var c=p(o[u],t);c&&r.children.push(c)}if(0===r.children.length||1===r.children.length&&["#cdata-section","#text"].indexOf(r.children[0].name)>=0){var d=l.parserUtils.parseNodeText(e);""!==d&&(r.value=d),r.children=[]}return r.isEmpty()?null:r}function f(e,t){var r=["Verification","JavaScriptResource","ExecutableResource","TrackingEvents","Tracking","VerificationParameters"],n=function(e){var t={},i=l.parserUtils.parseNodeText(e);return Object.keys(e.attributes).forEach(function(r){var n=e.attributes[r].nodeName,i=e.attributes[r].nodeValue;n&&i&&(t[n]=i)}),"#comment"!==e.nodeName&&""!==i&&(e.children&&e.children.length>0?e.childNodes.forEach(function(e){r.includes(e.nodeName)&&(t[e.nodeName]||(t[e.nodeName]=[]),t[e.nodeName].push(n(e)))}):t.content=i),t};t.forEach(function(t){var r=n(t);e.push(r)})}function h(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}function v(e){return{idRegistry:e.getAttribute("idRegistry")||"unknown",value:l.parserUtils.parseNodeText(e)||"unknown"}}},93088:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parseCreativeCompanion=function(e,t){var r=new i.CreativeCompanion(t);return o.parserUtils.childrenByName(e,"Companion").forEach(function(e){var t=new n.CompanionAd;t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.companionClickTrackingURLTemplates=[],o.parserUtils.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=o.parserUtils.parseNodeText(e)}),o.parserUtils.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=o.parserUtils.parseNodeText(e)}),o.parserUtils.childrenByName(e,"StaticResource").forEach(function(r){t.type=r.getAttribute("creativeType")||0,o.parserUtils.childrenByName(e,"AltText").forEach(function(e){t.altText=o.parserUtils.parseNodeText(e)}),t.staticResource=o.parserUtils.parseNodeText(r)}),o.parserUtils.childrenByName(e,"TrackingEvents").forEach(function(e){o.parserUtils.childrenByName(e,"Tracking").forEach(function(e){var r=e.getAttribute("event"),n=o.parserUtils.parseNodeText(e);r&&n&&(null==t.trackingEvents[r]&&(t.trackingEvents[r]=[]),t.trackingEvents[r].push(n))})}),o.parserUtils.childrenByName(e,"CompanionClickTracking").forEach(function(e){t.companionClickTrackingURLTemplates.push(o.parserUtils.parseNodeText(e))}),t.companionClickThroughURLTemplate=o.parserUtils.parseNodeText(o.parserUtils.childByName(e,"CompanionClickThrough")),t.companionClickTrackingURLTemplate=o.parserUtils.parseNodeText(o.parserUtils.childByName(e,"CompanionClickTracking")),r.variations.push(t)}),r};var n=r(31472),i=r(81214),o=r(75065)},2035:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parseCreativeLinear=function(e,t){var r,s=new n.CreativeLinear(t);s.duration=a.parserUtils.parseDuration(a.parserUtils.parseNodeText(a.parserUtils.childByName(e,"Duration")));var l=e.getAttribute("skipoffset");if(null==l)s.skipDelay=null;else if("%"===l.charAt(l.length-1)&&-1!==s.duration){var u=parseInt(l,10);s.skipDelay=s.duration*(u/100)}else s.skipDelay=a.parserUtils.parseDuration(l);var c=a.parserUtils.childByName(e,"VideoClicks");c&&(s.videoClickThroughURLTemplate=a.parserUtils.parseNodeText(a.parserUtils.childByName(c,"ClickThrough")),a.parserUtils.childrenByName(c,"ClickTracking").forEach(function(e){s.videoClickTrackingURLTemplates.push(a.parserUtils.parseNodeText(e))}),a.parserUtils.childrenByName(c,"CustomClick").forEach(function(e){s.videoCustomClickURLTemplates.push(a.parserUtils.parseNodeText(e))}));var d=a.parserUtils.childByName(e,"AdParameters");d&&(s.adParameters=a.parserUtils.parseNodeText(d)),a.parserUtils.childrenByName(e,"TrackingEvents").forEach(function(e){a.parserUtils.childrenByName(e,"Tracking").forEach(function(e){var t=e.getAttribute("event"),n=a.parserUtils.parseNodeText(e);if(t&&n){if("progress"===t){if(!(r=e.getAttribute("offset")))return;t="%"===r.charAt(r.length-1)?"progress-".concat(r):"progress-".concat(Math.round(a.parserUtils.parseDuration(r)))}null==s.trackingEvents[t]&&(s.trackingEvents[t]=[]),s.trackingEvents[t].push(n)}})}),a.parserUtils.childrenByName(e,"MediaFiles").forEach(function(e){a.parserUtils.childrenByName(e,"MediaFile").forEach(function(e){var t=new o.MediaFile;t.id=e.getAttribute("id"),t.fileURL=a.parserUtils.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 r=e.getAttribute("scalable");r&&"string"==typeof r&&("true"===(r=r.toLowerCase())?t.scalable=!0:"false"===r&&(t.scalable=!1));var n=e.getAttribute("maintainAspectRatio");n&&"string"==typeof n&&("true"===(n=n.toLowerCase())?t.maintainAspectRatio=!0:"false"===n&&(t.maintainAspectRatio=!1)),s.mediaFiles.push(t)})});var p=a.parserUtils.childByName(e,"Icons");return p&&a.parserUtils.childrenByName(p,"Icon").forEach(function(e){var t=new i.Icon;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=a.parserUtils.parseDuration(e.getAttribute("offset")),t.duration=a.parserUtils.parseDuration(e.getAttribute("duration")),a.parserUtils.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=a.parserUtils.parseNodeText(e)}),a.parserUtils.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=a.parserUtils.parseNodeText(e)}),a.parserUtils.childrenByName(e,"StaticResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=a.parserUtils.parseNodeText(e)});var r=a.parserUtils.childByName(e,"IconClicks");r&&(t.iconClickThroughURLTemplate=a.parserUtils.parseNodeText(a.parserUtils.childByName(r,"IconClickThrough")),a.parserUtils.childrenByName(r,"IconClickTracking").forEach(function(e){t.iconClickTrackingURLTemplates.push(a.parserUtils.parseNodeText(e))})),t.iconViewTrackingURLTemplate=a.parserUtils.parseNodeText(a.parserUtils.childByName(e,"IconViewTracking")),s.icons.push(t)}),s};var n=r(77615),i=r(50199),o=r(36629),a=r(75065)},64815:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parseCreativeNonLinear=function(e,t){var r=new n.CreativeNonLinear(t);return o.parserUtils.childrenByName(e,"TrackingEvents").forEach(function(e){var t,n;o.parserUtils.childrenByName(e,"Tracking").forEach(function(e){t=e.getAttribute("event"),n=o.parserUtils.parseNodeText(e),t&&n&&(null==r.trackingEvents[t]&&(r.trackingEvents[t]=[]),r.trackingEvents[t].push(n))})}),o.parserUtils.childrenByName(e,"NonLinear").forEach(function(e){var t=new i.NonLinearAd;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=o.parserUtils.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=o.parserUtils.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=o.parserUtils.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),o.parserUtils.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=o.parserUtils.parseNodeText(e)}),o.parserUtils.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=o.parserUtils.parseNodeText(e)}),o.parserUtils.childrenByName(e,"StaticResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=o.parserUtils.parseNodeText(e)});var n=o.parserUtils.childByName(e,"AdParameters");n&&(t.adParameters=o.parserUtils.parseNodeText(n)),t.nonlinearClickThroughURLTemplate=o.parserUtils.parseNodeText(o.parserUtils.childByName(e,"NonLinearClickThrough")),o.parserUtils.childrenByName(e,"NonLinearClickTracking").forEach(function(e){t.nonlinearClickTrackingURLTemplates.push(o.parserUtils.parseNodeText(e))}),r.variations.push(t)}),r};var n=r(35475),i=r(57219),o=r(75065)},75065:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parserUtils=void 0;var n=r(11417);t.parserUtils={childByName:function(e,t){var r=e.childNodes;for(var n in r){var i=r[n];if(i.nodeName===t)return i}},childrenByName:function(e,t){var r=[],n=e.childNodes;for(var i in n){var o=n[i];o.nodeName===t&&r.push(o)}return r},resolveVastAdTagURI:function(e,t){if(!t)return e;if(0===e.indexOf("//")){var r=location.protocol;return"".concat(r).concat(e)}if(-1===e.indexOf("://")){var n=t.slice(0,t.lastIndexOf("/"));return"".concat(n,"/").concat(e)}return 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,r){var n=t.getAttribute(e);n&&r.setAttribute(e,n)},parseDuration:function(e){if(null==e)return-1;if(n.util.isNumeric(e))return parseInt(e);var t=e.split(":");if(3!==t.length)return-1;var r=t[2].split("."),i=parseInt(r[0]);2===r.length&&(i+=parseFloat("0.".concat(r[1])));var o=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(o)||isNaN(i)||o>3600||i>60?-1:a+o+i},splitVAST:function(e){var t=[],r=null;return e.forEach(function(n,i){if(n.sequence&&(n.sequence=parseInt(n.sequence,10)),n.sequence>1){var o=e[i-1];if(o&&o.sequence===n.sequence-1)return void(r&&r.push(n));delete n.sequence}r=[n],t.push(r)}),t},mergeWrapperAdData:function(e,t){if(e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),e.verifications=t.verifications.concat(e.verifications),e.wrapperAdIds.push(t.id),e.creatives.forEach(function(e){if(t.trackingEvents&&t.trackingEvents[e.type])for(var r in t.trackingEvents[e.type]){var n=t.trackingEvents[e.type][r];e.trackingEvents[r]||(e.trackingEvents[r]=[]),e.trackingEvents[r]=e.trackingEvents[r].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)}),e.fallbackAdSequence&&e.sequence!==e.fallbackAdSequence){if(!t.sequence&&!t.fallbackAdSequence)return;e.sequence=null,e.fallbackAdSequence=t.fallbackAdSequence||t.sequence}else if(t.fallbackAdSequence)e.sequence=null,e.fallbackAdSequence=t.fallbackAdSequence||t.sequence;else{if(!t.sequence&&!t.fallbackAdSequence)return;e.sequence=t.sequence}}}},29902:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.VASTParser=void 0;var o=r(71119),a=r(37007),s=r(75065),l=r(27294),u=r(11417),c=r(71076),d={ERRORCODE:900,extensions:[]},p=function(e){function t(){var t=e.call(this)||this;return t.remainingAds=[],t.parentURLs=[],t.errorURLTemplates=[],t.rootErrorURLTemplates=[],t.maxWrapperDepth=null,t.URLTemplateFilters=[],t.fetchingOptions={},t.currentAdSequence=null,t}return n(t,e),t.prototype.addURLTemplateFilter=function(e){"function"==typeof e&&this.URLTemplateFilters.push(e)},t.prototype.removeURLTemplateFilter=function(){this.URLTemplateFilters.pop()},t.prototype.countURLTemplateFilters=function(){return this.URLTemplateFilters.length},t.prototype.clearURLTemplateFilters=function(){this.URLTemplateFilters=[]},t.prototype.trackVastError=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];this.emit("VAST-error",Object.assign.apply(Object,i([d,t],r,!1))),u.util.track(e,t)},t.prototype.getErrorURLTemplates=function(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)},t.prototype.fetchVAST=function(e,t,r){var n=this;return new Promise(function(i,o){n.URLTemplateFilters.forEach(function(t){e=t(e)}),n.parentURLs.push(e),n.emit("VAST-resolving",{url:e,wrapperDepth:t,originalUrl:r}),n.urlHandler.get(e,n.fetchingOptions,function(t,r){n.emit("VAST-resolved",{url:e,error:t}),t?o(t):i(r)})})},t.prototype.initParsingStatus=function(e){void 0===e&&(e={}),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||l.urlHandler},t.prototype.getRemainingAds=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 r=e?u.util.flatten(this.remainingAds):this.remainingAds.shift();return this.errorURLTemplates=[],this.parentURLs=[],this.resolveAds(r,{wrapperDepth:0,originalUrl:this.rootURL}).then(function(e){return t.buildVASTResponse(e)})},t.prototype.getAndParseVAST=function(e,t){var r=this;return void 0===t&&(t={}),this.initParsingStatus(t),this.rootURL=e,this.fetchVAST(e).then(function(n){return t.originalUrl=e,t.isRootVAST=!0,r.parse(n,t).then(function(e){return r.buildVASTResponse(e,t)})})},t.prototype.parseVAST=function(e,t){var r=this;return void 0===t&&(t={}),this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(function(e){return r.buildVASTResponse(e,t)})},t.prototype.getPodAds=function(e){return e.filter(function(e){return null!=e.sequence})},t.prototype.getStandaloneAds=function(e){return e.filter(function(e){return null==e.sequence})},t.prototype.hasMediaFiles=function(e){return!(!e||null!=e.errorCode)&&(Array.isArray(e.creatives)?e.creatives:[]).some(function(e){return e.mediaFiles&&e.mediaFiles.length>0})},t.prototype.replaceUnavailableAdPodAds=function(e){var t=this,r=this.getPodAds(e),n=this.getStandaloneAds(e).filter(this.hasMediaFiles);return 0===r.length||0===n.length?e:(r=r.map(function(e){return t.hasMediaFiles(e)?e:n.shift()}).filter(Boolean),n.forEach(function(e){return e.isFallback=!0}),r.concat(n))},t.prototype.markFallbackAds=function(e){return this.getPodAds(e).length>0&&this.getStandaloneAds(e).forEach(function(e){return e.isFallback=!0}),e},t.prototype.buildVASTResponse=function(e,t){void 0===t&&(t={});var r=new c.VASTResponse;return r.errorURLTemplates=this.getErrorURLTemplates(),e.forEach(function(e){return e.isFallback=!1}),r.ads=t.replaceUnavailableAdPodAds?this.replaceUnavailableAdPodAds(e):this.markFallbackAds(e),this.completeWrapperResolving(r),r},t.prototype.parse=function(e,t){var r=this,n=t.resolveAll,i=void 0===n||n,a=t.wrapperSequence,l=void 0===a?null:a,u=t.originalUrl,c=void 0===u?null:u,d=t.wrapperDepth,p=void 0===d?0:d,f=t.isRootVAST,h=void 0!==f&&f,v=t.parentAdSequence,A=void 0===v?null:v;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName)return Promise.reject(new Error("Invalid VAST XMLDocument"));var g=[],E=e.documentElement.childNodes;for(var y in E){var m=E[y];if("Error"===m.nodeName){var T=s.parserUtils.parseNodeText(m);h?this.rootErrorURLTemplates.push(T):this.errorURLTemplates.push(T)}if("Ad"===m.nodeName){var R=(0,o.parseAd)(m);R?g.push(R):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}var P=g.length,_=g[P-1];return 1===P&&null!=l&&_&&!_.sequence&&(_.sequence=l),g.forEach(function(e){return r.handleFallbackAdSequence(e,A)}),!1===i&&(this.remainingAds=s.parserUtils.splitVAST(g),g=this.remainingAds.shift()),this.resolveAds(g,{wrapperDepth:p,originalUrl:c})},t.prototype.handleFallbackAdSequence=function(e,t){null==e.sequence?e.fallbackAdSequence=t||this.currentAdSequence:this.currentAdSequence=e.sequence},t.prototype.resolveAds=function(e,t){var r=this;void 0===e&&(e=[]);var n=t.wrapperDepth,i=t.originalUrl,o=[];return e.forEach(function(e){var t=r.resolveWrappers(e,n,i);o.push(t)}),Promise.all(o).then(function(e){var t=u.util.flatten(e);if(!t&&r.remainingAds.length>0){var o=r.remainingAds.shift();return r.resolveAds(o,{wrapperDepth:n,originalUrl:i})}return t})},t.prototype.resolveWrappers=function(e,t,r){var n=this;return new Promise(function(i){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=s.parserUtils.resolveVastAdTagURI(e.nextWrapperURL,r);var o=e.sequence;r=e.nextWrapperURL,n.fetchVAST(e.nextWrapperURL,t,r).then(function(a){return n.parse(a,{originalUrl:r,wrapperSequence:o,wrapperDepth:t,parentAdSequence:e.sequence||e.fallbackAdSequence}).then(function(t){if(delete e.nextWrapperURL,0===t.length)return e.creatives=[],i(e);t.forEach(function(t){t&&s.parserUtils.mergeWrapperAdData(t,e)}),i(t)})}).catch(function(t){e.errorCode=301,e.errorMessage=t.message,i(e)})})},t.prototype.completeWrapperResolving=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 r=e.ads[t];(r.errorCode||0===r.creatives.length)&&(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),e.ads.splice(t,1))}},t}(a.EventEmitter);t.VASTParser=p},27294:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.urlHandler=void 0;var n=r(82664),i=r(13769),o=r(2860);t.urlHandler={get:function(e,t,r){return r||("function"==typeof t&&(r=t),t={}),"undefined"==typeof window||null===window?i.nodeURLHandler.get(e,t,r):o.XHRURLHandler.supported()?o.XHRURLHandler.get(e,t,r):n.flashURLHandler.supported()?n.flashURLHandler.get(e,t,r):r(new Error("Current context is not supported by any of the default URLHandlers. Please provide a custom URLHandler"))}}},82664:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.flashURLHandler=void 0,t.flashURLHandler={get:function(e,t,r){var n="function"==typeof window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLDOM"):void 0;if(!n)return r(new Error("FlashURLHandler: Microsoft.XMLDOM format not supported"));n.async=!1;var i=i();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),r(null,n)}},supported:function(){return!!function(){var e;return window.XDomainRequest&&(e=new XDomainRequest),e}()}}},13769:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.nodeURLHandler=void 0,t.nodeURLHandler={get:function(e,t,r){r(new Error("Please bundle the library for node to use the node urlHandler"))}}},2860:function(e,t){function r(){try{var e=new window.XMLHttpRequest;return"withCredentials"in e?e:null}catch(e){return console.log("Error in XHRURLHandler support check:",e),null}}Object.defineProperty(t,"__esModule",{value:!0}),t.XHRURLHandler=void 0,t.XHRURLHandler={get:function(e,t,n){if("https:"===window.location.protocol&&0===e.indexOf("http://"))return n(new Error("XHRURLHandler: Cannot go from HTTPS to HTTP."));try{var i=r();i.open("GET",e),i.timeout=t.timeout||0,i.withCredentials=t.withCredentials||!1,i.overrideMimeType&&i.overrideMimeType("text/xml"),i.onreadystatechange=function(){4===i.readyState&&(200===i.status?n(null,i.responseXML):n(new Error("XHRURLHandler: ".concat(i.statusText))))},i.send()}catch(e){n(new Error("XHRURLHandler: Unexpected error"))}},supported:function(){return!!r()}}},1100:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Storage=void 0;var r=null,n={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}},i=function(){function e(e){this.storage=this.initStorage(e)}return e.prototype.initStorage=function(e){if(r&&("undefined"==typeof window||null===window||Object.getPrototypeOf(r)!==window.Storage.prototype||e))return r;try{r="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){r=null}return r&&e&&!this.isStorageDisabled(r)||(r=n).clear(),r},e.prototype.isStorageDisabled=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},e.prototype.getItem=function(e){return this.storage.getItem(e)},e.prototype.setItem=function(e,t){return this.storage.setItem(e,t)},e.prototype.removeItem=function(e){return this.storage.removeItem(e)},e.prototype.clear=function(){return this.storage.clear()},e}();t.Storage=i},11417:function(e,t){function r(e,t){void 0===t&&(t={});var r=[];t.ASSETURI&&(t.ASSETURI=n(t.ASSETURI)),t.CONTENTPLAYHEAD&&(t.CONTENTPLAYHEAD=n(t.CONTENTPLAYHEAD)),t.ERRORCODE&&!/^[0-9]{3}$/.test(t.ERRORCODE)&&(t.ERRORCODE=900),t.CACHEBUSTING=i(Math.round(1e8*Math.random()).toString()),t.TIMESTAMP=n((new Date).toISOString()),t.RANDOM=t.random=t.CACHEBUSTING;for(var o=0,a=e;o<a.length;o++){var s=a[o];if("string"==typeof s){for(var l in t){var u=t[l],c="[".concat(l,"]"),d="%%".concat(l,"%%");s=(s=s.replace(c,u)).replace(d,u)}r.push(s)}}return r}function n(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%".concat(e.charCodeAt(0).toString(16))})}function i(e){return e.length<8?o(0,8-e.length,!1).map(function(e){return"0"}).join("")+e:e}function o(e,t,r){for(var n=[],i=e<t,o=r?i?t+1:t-1:t,a=e;i?a<o:a>o;i?a++:a--)n.push(a);return n}Object.defineProperty(t,"__esModule",{value:!0}),t.util=void 0,t.util={track:function(e,t){r(e,t).forEach(function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:r,encodeURIComponentRFC3986:n,leftpad:i,range:o,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce(function(t,r){return t.concat(Array.isArray(r)?e(r):r)},[])}}},6036:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.VASTClient=void 0;var n=r(1100),i=r(29902),o=function(){function e(e){e=e||{},this.cappingFreeLunch=e.cappingFreeLunch||0,this.cappingMinimumTimeInterval=e.cappingMinimumTimeInterval||0,this.defaultOptions={withCredentials:!1,timeout:0},this.vastParser=new i.VASTParser;var t=null==e.allowUsingBrowserStorageApi||e.allowUsingBrowserStorageApi;this.storage=e.customStorage||new n.Storage(t),void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}return e.prototype.getParser=function(){return this.vastParser},Object.defineProperty(e.prototype,"lastSuccessfulAd",{get:function(){return this.storage.getItem("vast-client-last-successful-ad")},set:function(e){this.storage.setItem("vast-client-last-successful-ad",e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalCalls",{get:function(){return this.storage.getItem("vast-client-total-calls")},set:function(e){this.storage.setItem("vast-client-total-calls",e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalCallsTimeout",{get:function(){return this.storage.getItem("vast-client-total-calls-timeout")},set:function(e){this.storage.setItem("vast-client-total-calls-timeout",e)},enumerable:!1,configurable:!0}),e.prototype.hasRemainingAds=function(){return this.vastParser.remainingAds.length>0},e.prototype.getNextAds=function(e){return this.vastParser.getRemainingAds(e)},e.prototype.get=function(e,t){var r=this;void 0===t&&(t={});var n=Date.now();return(t=Object.assign(this.defaultOptions,t)).hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<n?(this.totalCalls=1,this.totalCallsTimeout=n+36e5):this.totalCalls++,new Promise(function(i,o){if(r.cappingFreeLunch>=r.totalCalls)return o(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(r.totalCalls,"/").concat(r.cappingFreeLunch)));var a=n-r.lastSuccessfulAd;if(a<0)r.lastSuccessfulAd=0;else if(a<r.cappingMinimumTimeInterval)return o(new Error("VAST call canceled – (".concat(r.cappingMinimumTimeInterval,")ms minimum interval reached")));r.vastParser.getAndParseVAST(e,t).then(function(e){return i(e)}).catch(function(e){return o(e)})})},e}();t.VASTClient=o},71076:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.VASTResponse=void 0;var r=function(){return function(){this.ads=[],this.errorURLTemplates=[]}}();t.VASTResponse=r}},function(e){return function(){return e(7581)}()}])});
|
|
17
|
+
"use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["advertising-core"]=t():(e.bitmovin=e.bitmovin||{},e.bitmovin.player=e.bitmovin.player||{},e.bitmovin.player["advertising-core"]=t())}(self,function(){return(self.webpackChunkbitmovin_player=self.webpackChunkbitmovin_player||[]).push([[561],{28610:function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.VmapTrackingEventType=void 0,function(e){e.BreakStart="breakstart",e.BreakEnd="breakend",e.Error="error"}(r||(t.VmapTrackingEventType=r={}))},76713:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.PAUSE_AD_POSITION=t.DEFAULT_AD_BREAK_POSITION=void 0,t.isPauseAdBreak=function(e){return(null==e?void 0:e.position)===t.PAUSE_AD_POSITION},t.DEFAULT_AD_BREAK_POSITION="pre",t.PAUSE_AD_POSITION="pause"},45392:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AdManifestHelper=void 0,t.xmlToString=function(e){return(new XMLSerializer).serializeToString(e.documentElement)},t.toDataUri=function(e){return"data:text/xml,"+encodeURIComponent(e)},t.pingVmapTrackingUrls=function(e,t){void 0===e&&(e=[]),e.filter(function(e){return e.type===t}).forEach(function(e){return(0,i.pingUrl)(e.url)})};var n=r(70850),i=r(95217),o=r(88457),a=r(60326),s=r(47091),l=function(){function e(e,t,r,n){this.loader=e,this.videoLoadTimeout=t,this.withCredentials=r,this.disableStorage=n}return e.prototype.downloadVastManifest=function(e){var t,r=this;return null!==(t=this.FM)&&void 0!==t||(this.FM=new DOMParser),this.loader.load(e,void 0,void 0,void 0,void 0,this.withCredentials).catch(function(){return Promise.reject({code:o.AdvertisingModuleErrorCode.COULD_NOT_LOAD_AD_MANIFEST})}).then(function(e){var t;if(!e.body)return Promise.reject({code:s.VastErrorCode.XML_PARSING_ERROR});var n=r.FM.parseFromString(e.body,"text/xml"),i=null===(t=n.childNodes[0].childNodes[0])||void 0===t?void 0:t.nodeName.includes("Error"),a=void 0===i||i,l=n.childNodes[0].nodeName.includes("error");if(n.childNodes[0].nodeName.includes("VMAP"))return Promise.reject({code:o.AdvertisingModuleErrorCode.AD_TAG_TYPE_NOT_MATCHING});if(a)return Promise.reject({code:s.VastErrorCode.NO_ADS_VAST_RESPONSE});if(l)return Promise.reject({code:s.VastErrorCode.XML_PARSING_ERROR});var u={downloadTime:e.elapsedTime,timeToFirstByte:e.timeToFirstByte};return Promise.resolve({manifest:n,downloadTiming:u})})},e.prototype.downloadVmapManifest=function(e){return this.loader.load(e,void 0,void 0,void 0,void 0,this.withCredentials)},e.prototype.parseAdVerifications=function(e){var t;return null!==(t=this.GM)&&void 0!==t||(this.GM=new a.VastClientWrapper(this.videoLoadTimeout,this.withCredentials,this.disableStorage)),this.GM.parseManifest(e,!1).then(function(e){if(e.ads.length<1)return Promise.resolve([]);var t=e.ads.map(function(e){return{id:e.id||"adVerification-"+n.Util.generateUniqueId(),verifications:e.verifications}});return Promise.resolve(t)}).catch(function(e){return Promise.resolve([])})},e}();t.AdManifestHelper=l},63524:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AdPlaybackFactory=void 0;var n=r(60937),i=r(52448),o=function(){function e(){}return e.create=function(e,t){var r=!1,o=function(){r=!1},a=function(e){var t="The current ad playback has to be finished by calling ".concat(e,".done(), before a new one can be requested.");return Promise.reject(t)};return new(function(){function s(){}return s.prototype.requestPlayer=function(){return r?a("AdPlayerAPI"):(r=!0,Promise.resolve(i.AdPlayerFactory.createAdPlayer(e,o)))},s.prototype.requestReporter=function(){return r?a("AdPlaybackReportingAPI"):(r=!0,Promise.resolve(new n.AdPlaybackReporter(e,o)))},s.prototype.done=function(e){return void 0===e&&(e=!0),t(e)},s}())},e}();t.AdPlaybackFactory=o},60937:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AdPlaybackReporter=void 0;var n=r(9768),i=r(3714),o=r(19483),a=function(){return function(e,t){var r=this,a=new o.ArrayMap;this.videoElement=e.getVideoElement();var s=!1,l=function(){if(s)throw"AdPlaybackReporter is no longer usable. Request a new one."},u=this.videoElement.addEventListener;this.videoElement.addEventListener=function(e,t,n){a.add(e,t),u.apply(r.videoElement,[e,t,n])},this.started=function(t){if(l(),r.c5)throw"Ad playback is already in progress. A new one can not be started.";r.c5=t,r.d5=!1,e.hasCurrentSourcePlayedOnce()||e.fireEvent(i.PlayerEvent.Playing,{time:e.getCurrentTime(),issuer:n.ADVERTISING_ISSUER_NAME}),e.fireEvent(i.PlayerEvent.AdStarted,{ad:t})},this.paused=function(t){l(),e.fireEvent(i.PlayerEvent.Paused,{time:t,issuer:n.ADVERTISING_ISSUER_NAME})},this.resumed=function(t){l(),e.fireEvent(i.PlayerEvent.Play,{time:t,issuer:n.ADVERTISING_ISSUER_NAME}),e.fireEvent(i.PlayerEvent.Playing,{time:t,issuer:n.ADVERTISING_ISSUER_NAME})},this.timeupdate=function(t){l(),e.fireEvent(i.PlayerEvent.TimeChanged,{time:t,issuer:n.ADVERTISING_ISSUER_NAME})},this.skipped=function(){r.d5||(l(),e.fireEvent(i.PlayerEvent.AdSkipped,{ad:r.c5}),r.d5=!0,r.c5=null)},this.done=function(){return l(),a.forAll(function(e,t){r.videoElement.removeEventListener(e,t),r.videoElement.addEventListener=u}),!r.d5&&r.c5&&e.fireEvent(i.PlayerEvent.AdFinished,{ad:r.c5}),r.c5=null,t(),s=!0,Promise.resolve()}}}();t.AdPlaybackReporter=a},43255:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.AdPlayerDelegate=void 0;var i=r(40306),o=r(80813),a=r(9768),s=r(3714),l=r(51289),u=r(90408),c=r(20213),d=r(18192),p=r(94685),f=r(41138),h=r(63524),v=r(44202),g=r(65185),A=r(47091),E=function(){function e(t){this.logger=t.context.logger;var r,p=t.internalPlayer,f=new v.AdPlayerStateStore(t.context,p),E=Promise.resolve(),y=!1,P=!1,R=!1,_={width:0,height:0},S=[],N=function(e){e.code===c.WarningCode.PLAYBACK_COULD_NOT_BE_STARTED&&(P=!0)};p.onInternal(s.PlayerEvent.PlayerResized,function(e){var t=m(e.width),r=m(e.height);_={width:t,height:r}});var U=function(){P=!1};this.getVideoElement=function(){return p.getVideoElement()},this.getVolume=function(){return p.isMuted()?0:p.getVolume()},this.isContentPaused=function(){return p.isContentPaused()},this.isContentSeeking=function(){return p.isContentSeeking()},this.parsePosition=function(t){var r;return r=f.hasStoredState()?f.getStoredState().contentDuration:p.getDuration(),e.parsePosition(t,r)},this.selectMediaFile=function(e){var r=e.every(function(e){return e.bitrate||e.minBitrate&&e.maxBitrate}),n=p.getDownloadedVideoData(),i=p.getDownloadedAudioData(),a=Boolean(i&&n&&n.bitrate>0),s=t.context.serviceManager.get(o.ServiceName.AdaptationService);return r&&(s||a)?b(e,[n,i],s):function(e,t,r){return r&&r.width>0?(0,g.findMediaFileByResolution)(r.width,r.height,e):(0,g.findMediaFileByResolution)(t.width,t.height,e)}(e,_,n)};var b=function(e,t,r){var n=t[0],i=t[1];return r?r.selectQualityBasedOnBitrateMeasurement(e):(0,g.findMediaFileByBitrate)(n.bitrate+i.bitrate,e)};this.metadataLoaded=function(e,t){var r={adBreak:null,downloadTiming:t};e.hasOwnProperty("scheduleTime")&&(r.adBreak=e),r.adConfig=e,p.fireEvent(s.PlayerEvent.AdManifestLoaded,r)};var I=function(){S.forEach(function(e){return p.fireEvent(s.PlayerEvent.Error,{type:s.PlayerEvent.Error,code:e.code,name:e.name,message:e.message,data:e.data,troubleShootLink:(0,l.generateTroubleshootUrl)(e.code)})})},k=function(e){if(!f.hasStoredState())return Promise.resolve();var n=f.getStoredState().contentDuration,l=Promise.resolve();return y=!e,e&&(l=E=function(){return S.length?function(){return p.removeExternalEventFilter(C),f.clear(),p.off(s.PlayerEvent.Warning,N),p.off(s.PlayerEvent.Playing,U),p.unload().then(I)}():(p.fireEvent(s.PlayerEvent.RestoringContent),p.addExternalEventFilter(M),f.restore(a.ADVERTISING_RESTORE_ISSUER_NAME).then(function(e){if(p.removeExternalEventFilter(C),S.length)throw new Error("Background errors occurred during ad break");if(P)P=!1;else{if(e)return p.play(a.ADVERTISING_ISSUER_NAME).catch(function(e){R=!0,t.context.logger.debug("Unable to start playback after restoring the content after an ad break:",e)});var r=t.context.serviceManager.get(o.ServiceName.PlayerStateService);null==r||r.transitionToStoppedState()}}).catch(function(){S.length?I():p.fireEvent(s.PlayerEvent.Error,{code:i.ErrorCode.UNKNOWN})}).finally(function(){f.clear(),p.removeExternalEventFilter(M),p.off(s.PlayerEvent.Warning,N),p.off(s.PlayerEvent.Playing,U)}))}().then(function(){t.restoreContentDeferred&&t.restoreContentDeferred.resolve()})),l.then(function(){var i=r?{adBreak:r}:void 0;p.fireEvent(s.PlayerEvent.AdBreakFinished,i),r=null,e&&(0,u.maybeFireDurationChangedEvent)(n,p.getDuration(),t.context.eventHandler),p.hasCurrentSourcePlayedOnce()||R||p.fireEvent(s.PlayerEvent.Playing,{time:p.getCurrentTime(),issuer:a.ADVERTISING_ISSUER_NAME}),R=!1})},O=[s.PlayerEvent.Error,s.PlayerEvent.SourceLoaded,s.PlayerEvent.SourceUnloaded,s.PlayerEvent.PlaybackFinished,s.PlayerEvent.Ready],C=function(e,r){var n=function(){var e=t.context.store.getState();return(null==e?void 0:e.sources)&&Object.keys(e.sources).find(function(t){var r;return e.sources&&e.sources[t]&&(null===(r=e.sources[t].playback)||void 0===r?void 0:r.kind)===d.PlaybackKind.Background})}();return T(e,r)&&n&&r.sourceIdentifier===n&&S.push(r),!O.includes(e)},L=[s.PlayerEvent.Play,s.PlayerEvent.Playing,s.PlayerEvent.Seek,s.PlayerEvent.Seeked,s.PlayerEvent.TimeShift,s.PlayerEvent.TimeShifted],M=function(e){return!L.includes(e)};this.requestAdPlayback=function(e){return r?Promise.reject("Ad break already in progress"):(r=e,E.then(function(){var t=y?Promise.resolve():D(e),r={adBreak:n(n({},JSON.parse(JSON.stringify(e))),{scheduleTime:e.scheduleTime})};return p.fireEvent(s.PlayerEvent.AdBreakStarted,r),p.onInternal(s.PlayerEvent.Warning,N),p.onInternal(s.PlayerEvent.Playing,U),t.then(function(){return p.unload(a.ADVERTISING_ISSUER_NAME)}).then(function(){return h.AdPlaybackFactory.create(p,k)})}))},this.updateAdRestoreState=function(e){r&&f.setAdRestoreState(e)};var D=function(r){var n=t.context,i=n.sourceContext.sourceIdentifier,s=n.adRestorationOptimizationService,l=n.serviceManager.get(o.ServiceName.ManifestService,i),u=s&&n.settings.OPTIMIZE_AD_RESTORATION,c=e.getAdBreakDuration(r),d=r.replaceContentDuration;return f.capture(a.ADVERTISING_ISSUER_NAME),f.setAdRestoreState({adBreakDuration:c,replaceContentDuration:d}),p.addExternalEventFilter(C),u&&l&&!l.isLive()?s.optimizeRestorationAfterUpcomingAdBreak():Promise.resolve()};this.overlayAdStarted=function(e){p.fireEvent(s.PlayerEvent.OverlayAdStarted,{ad:e})},this.nonLinearAdStarted=function(e,t){p.fireEvent(s.PlayerEvent.NonLinearAdStarted,{ad:e,position:t})},this.nonLinearAdFinished=function(e,t){p.fireEvent(s.PlayerEvent.NonLinearAdFinished,{ad:e,position:t})},this.nonLinearAdSkipped=function(e,t){p.fireEvent(s.PlayerEvent.NonLinearAdSkipped,{ad:e,position:t})},this.adClicked=function(e){p.fireEvent(s.PlayerEvent.AdClicked,{clickThroughUrl:e})},this.adInteraction=function(e,t){p.fireEvent(s.PlayerEvent.AdInteraction,{interactionType:e,id:t})},this.onQuartile=function(e){p.fireEvent(s.PlayerEvent.AdQuartile,{quartile:e})},this.onError=function(e,t,r){var n={code:e||A.VastErrorCode.UNDEFINED_ERROR};t&&(n.message=t),r&&(n.adConfig=r),p.fireEvent(s.PlayerEvent.AdError,{code:i.ErrorCode.MODULE_ADVERTISING_ERROR,data:n,name:i.ErrorCode[i.ErrorCode.MODULE_ADVERTISING_ERROR],message:t,troubleShootLink:(0,l.generateTroubleshootUrl)(i.ErrorCode.MODULE_ADVERTISING_ERROR)})},this.onWarning=function(e,t,r){p.fireEvent(s.PlayerEvent.Warning,new c.PlayerWarning(e,t,r))},this.reset=function(){var t=p.getVideoElement();y=!1,P=!1,f.clear(),p.removeExternalEventFilter(C),p.removeExternalEventFilter(M),r&&t instanceof HTMLVideoElement&&e.clearVideoElement(t),r=null}}return e.getAdBreakDuration=function(e){var t,r,n=e.totalPlannedDuration;return null!=n?n:null!==(r=null===(t=e.ads)||void 0===t?void 0:t.reduce(function(e,t){var r;return e+(t.isLinear&&null!==(r=t.duration)&&void 0!==r?r:0)},0))&&void 0!==r?r:0},e.parsePosition=function(e,t){var r=Number(e);return!isNaN(r)&&r<=0&&(e="pre"),e.includes("pre")||"0%"===e?0:e.includes("post")?1/0:this.parseNumericalPosition(e,t)},e.parseNumericalPosition=function(e,t){var r;if(/%/.test(e)){if(!t)return NaN;e=e.replace(/%/gi,""),r=parseFloat(e)/100*t}else if(e.indexOf(":")>-1){var n=e.split(":");r=3600*parseFloat(n[0])+60*parseFloat(n[1])+parseFloat(n[2])}else r=parseFloat(e);return r>=0?r:NaN},e.clearVideoElement=function(e){f.VideoElementUtil.removeSource(e),e.load()},e}();t.AdPlayerDelegate=E;var y=/(\d+)/;function m(e){return Number(e.match(y)?e.match(y)[0]:0)}var T=function(e,t){return e===s.PlayerEvent.Error&&(0,p.isObject)(t)}},52448:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AdPlayerFactory=t.DEFAULT_AD_PLAYBACK_RATE=void 0,t.createSourceConfig=d;var n=r(40306),i=r(9768),o=r(3714),a=r(19483),s=r(85434),l=r(6365),u=r(7581);t.DEFAULT_AD_PLAYBACK_RATE=1;var c=function(){function e(){}return e.createAdPlayer=function(e,r){var s,l=new a.ArrayMap,c=!1,p=!1,f=[o.PlayerEvent.Play,o.PlayerEvent.Playing],h=function(){if(p)throw"AdPlayer is no longer usable. Request a new one."};return new(function(){function a(){this.adPlaybackStartEventFilter=function(t){return!e.hasCurrentSourcePlayedOnce()||!f.includes(t)}}return a.prototype.done=function(t){void 0===t&&(t=!1),h();var n=Promise.resolve();return c?n=e.unload(i.ADVERTISING_ISSUER_NAME):t||e.hasEnded()?function(e,t){e.fireEvent(o.PlayerEvent.AdFinished,{ad:t})}(e,s):function(e,t){e.fireEvent(o.PlayerEvent.AdSkipped,{ad:t})}(e,s),s=null,l.forAll(function(t,r){e.off(t,r)}),r(),p=!0,c=!1,n},a.prototype.on=function(t,r){h(),l.add(t,r),e.onInternal(t,r)},a.prototype.pause=function(){h(),e.pause(i.ADVERTISING_ISSUER_NAME)},a.prototype.play=function(){return h(),e.play(i.ADVERTISING_ISSUER_NAME)},a.prototype.load=function(r,a){var l=this;return h(),s=r,e.addExternalEventFilter(this.adPlaybackStartEventFilter),c=!0,e.load(d(r),void 0,null!=a?a:{seeking:!0},i.ADVERTISING_ISSUER_NAME).then(function(){return e.setPlaybackSpeed(t.DEFAULT_AD_PLAYBACK_RATE)}).then(function(){return e.play(i.ADVERTISING_ISSUER_NAME).catch(function(){})}).then(function(){c&&e.fireEvent(o.PlayerEvent.AdStarted,{ad:r})}).catch(function(t){if(t&&t.code===n.ErrorCode.MODULE_MISSING)throw{code:u.AdvertisingModuleErrorCode.REQUIRED_PLAYER_MODULE_MISSING,message:t.data.name};throw e.getLogger().debug("Failed to load Ad due to error: ".concat(null==t?void 0:t.message),t),t}).finally(function(){e.removeExternalEventFilter(l.adPlaybackStartEventFilter),c=!1})},Object.defineProperty(a.prototype,"duration",{get:function(){return h(),e.getDuration(i.ADVERTISING_ISSUER_NAME)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"currentTime",{get:function(){return h(),e.getCurrentTime(i.ADVERTISING_ISSUER_NAME)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"volume",{get:function(){return h(),e.getVolume()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"muted",{get:function(){return h(),e.isMuted()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"paused",{get:function(){h();var t=e.isContentPaused(),r=e.isContentPlaying();return!1===t&&!1===r||t},enumerable:!1,configurable:!0}),a}())},e}();function d(e){return e.data.delivery===l.MediaFileDeliveryType.Streaming?s.MimeTypeHelper.isDash(e.data.mimeType)?{dash:e.mediaFileUrl}:{hls:e.mediaFileUrl}:{progressive:e.mediaFileUrl}}t.AdPlayerFactory=c},44202:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof r?e:new r(function(t){t(e)})}(e.value).then(a,s)}l((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdPlayerStateStore=void 0;var a=r(80813),s=r(3714),l=r(44468),u=r(29488),c=r(46922),d=r(81524),p=r(18192),f=r(15487),h=r(88844),v=r(93531),g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.TK=null,t}return n(t,e),t.prototype.setAdRestoreState=function(e){this.hasStoredState()&&(this.TK=e,this.gL())},t.prototype.UK=function(){var e,t,r=null!==(t=null===(e=this.storedState)||void 0===e?void 0:e.sourceIdentifier)&&void 0!==t?t:this.context.sourceContext.sourceIdentifier;return this.context.serviceManager.get(a.ServiceName.SourceStoreService,r)},t.prototype.VK=function(){if(!this.storedState)return NaN;if(!this.TK)return this.storedState.playbackPosition;var e={adBreakDuration:this.TK.adBreakDuration,isLive:this.storedState.isLive,replaceContentDuration:this.TK.replaceContentDuration,playbackPosition:this.storedState.playbackPosition,resumeLiveContentAtPreviousPosition:this.context.settings.RESUME_LIVE_CONTENT_AT_PREVIOUS_POSITION_AFTER_AD_BREAK};return this.storedState.useTimeshiftForRestore?(0,v.calculateTimeshiftRestorationPosition)(e):(0,v.calculatePlaybackRestorationPosition)(e)},t.prototype.gL=function(){var e;if(this.storedState){var t=this.VK();this.context.logger.debug("Saving content restore position: ".concat(t)),null===(e=this.UK())||void 0===e||e.dispatch((0,c.setBackgroundPlaybackState)({kind:p.PlaybackKind.Background,position:t}))}},t.prototype.hL=function(e){var t,r,n,i,o=this,a=this.storedState;if(!a)return Promise.reject(new Error("no stored state to restore playback position"));if(a.isStartup)return Promise.resolve(!0);var u=null===(r=null===(t=this.UK())||void 0===t?void 0:t.getState())||void 0===r?void 0:r.playback;if(!u)return Promise.reject(new Error("no playback state available to restore playback position"));var c=(0,d.getPlaybackPosition)(u);if(a.useTimeshiftForRestore)return this.internalPlayer.timeShift(c,e),Promise.resolve(!0);if(this.internalPlayer.getPlayerType()===l.PlayerType.Native&&(0,f.isSafari)()&&c<.5)return Promise.resolve(!0);var p=(null===(n=this.context.renderer)||void 0===n?void 0:n.getDuration())||(null===(i=this.context.videoElement)||void 0===i?void 0:i.duration)||a.contentDuration||c;return c>=p?Promise.resolve(!1):new Promise(function(t,r){var n,i=function(){(0,h.clearTimeoutIfDefined)(n),o.internalPlayer.off(s.PlayerEvent.Seeked,a),o.internalPlayer.off(s.PlayerEvent.Error,u)},a=function(){i(),t(!0)},u=function(){i(),r(new Error("Error during playback restoration"))};o.internalPlayer.onInternal(s.PlayerEvent.Seeked,a),o.internalPlayer.onInternal(s.PlayerEvent.Error,u),o.internalPlayer.getPlayerType()===l.PlayerType.Native&&((0,f.isWebOS)()||(0,f.isPlayStation4)())&&(n=window.setTimeout(a,5e3)),o.internalPlayer.seek(c,e)||a()})},t.prototype.restore=function(e){return i(this,void 0,void 0,function(){var t,r,n;return o(this,function(i){switch(i.label){case 0:if(!(t=this.storedState))throw new Error("no stored state to restore");if(!t.source)throw new Error("stored state has no source to restore");return[4,this.loadSource(e)];case 1:return i.sent(),this.restoreBaseState(t),[4,this.hL(e)];case 2:return r=i.sent(),this.restoreSubtitles(t.subtitles),null===(n=this.UK())||void 0===n||n.dispatch((0,c.setMainContentPlaybackState)({kind:p.PlaybackKind.MainContent})),this.clear(),[2,r]}})})},t.prototype.clear=function(){e.prototype.clear.call(this),this.TK=null},t}(u.PlayerStateStore);t.AdPlayerStateStore=g},42163:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.AdPreloadingService=t.AdPlaybackPhase=t.AdPreloadState=void 0;var i,o,a=r(80813),s=r(9768),l=r(3714),u=r(69251),c=r(15971),d=r(23068),p=r(52448);!function(e){e.None="none",e.Pending="pending",e.Done="done",e.Failed="failed"}(i||(t.AdPreloadState=i={})),function(e){e.Upcoming="upcoming",e.Playing="playing",e.Retired="retired"}(o||(t.AdPlaybackPhase=o={}));var f=function(){function e(e){var t=this;this.context=e,this.Of=[],this.Qf=!1,this.Sf=function(e){var r,n,i;if(!t.Qf){var a=t.Of.find(function(t){return t.id===String(e.ad.id)});if((null==a?void 0:a.phase)===o.Upcoming&&a.sourceIdentifier===(null===(r=t.context.sourceContext)||void 0===r?void 0:r.sourceIdentifier)){t.Vf(a.id);var s=(0,c.getSourceStore)(t.context);(null===(i=null===(n=null==s?void 0:s.getState())||void 0===n?void 0:n.buffer)||void 0===i?void 0:i.isLoadingRangeFinished)?t.Tf():(t.Uf(),t.Rf=null==s?void 0:s.subscribe(t.Tf,function(e,t){var r,n;return Boolean((null===(r=null==e?void 0:e.buffer)||void 0===r?void 0:r.isLoadingRangeFinished)&&!(null===(n=null==t?void 0:t.buffer)||void 0===n?void 0:n.isLoadingRangeFinished))}))}}},this.Tf=function(){var e,r=t.ig(o.Playing);!t.Qf&&r&&r.sourceIdentifier===(null===(e=t.context.sourceContext)||void 0===e?void 0:e.sourceIdentifier)&&(t.Wf(r.id),t.Uf())},e.eventHandler.on(l.PlayerEvent.AdStarted,this.Sf,!0)}return e.prototype.Uf=function(){var e;null===(e=this.Rf)||void 0===e||e.call(this),this.Rf=void 0},e.prototype.hasTrackedAds=function(){return this.Of.length>0},e.prototype.preloadAdBreaks=function(e){return!!this.trackAdBreaks(e)&&(this.jg(),!0)},e.prototype.trackAdBreaks=function(e){var t=this,r=function(e){return e.map(function(e){return{id:String(e.id),sourceConfig:(0,p.createSourceConfig)(e)}}).filter(function(e){return(0,d.isDefined)(e.sourceConfig.hls)||(0,d.isDefined)(e.sourceConfig.dash)})}(e.reduce(function(e,t){return e.concat(t.ads)},[]));return!this.Qf&&0!==r.length&&(this.hasTrackedAds()?(this.context.logger.debug("[AdPreloading] Hand-over ignored while ads are tracked; cancel() first"),!1):(this.context.logger.debug("[AdPreloading] Tracking ".concat(r.length," ads for preloading: ").concat(r.map(function(e){return e.id}))),this.Of=this.Of.concat(r.map(function(e){return n(n({},e),{sourceIdentifier:(0,u.deriveSourceIdentifier)(e.sourceConfig,t.context.internalPlayerID),preload:i.None,phase:o.Upcoming})})),!0))},e.prototype.Vf=function(e){if(!this.Qf){var t=this.Of.find(function(t){return t.id===e&&t.phase!==o.Retired});if(t){this.Xf(t);var r=this.Of.filter(function(e){return e.phase===o.Upcoming}).length;this.context.logger.debug("[AdPreloading] Ad ".concat(e," started playback (").concat(r," ads upcoming)"))}else this.context.logger.debug("[AdPreloading] Ad ".concat(e," started playback but is not tracked"))}},e.prototype.Wf=function(e){var t;this.Qf||(null===(t=this.ig(o.Playing))||void 0===t?void 0:t.id)!==e||(this.mg(function(e){return e.phase===o.Retired}),this.jg())},e.prototype.cancel=function(){this.Qf||(this.Of.length>0&&this.context.logger.debug("[AdPreloading] Dropping ".concat(this.Of.length," tracked ads")),this.mg(function(){return!0}),this.Uf())},e.prototype.dispose=function(){this.Qf||(this.cancel(),this.context.eventHandler.off(l.PlayerEvent.AdStarted,this.Sf),this.Qf=!0)},e.prototype.Xf=function(e){if(e.phase!==o.Playing){this.mg(function(e){return e.phase===o.Retired});for(var t=0,r=this.Of;t<r.length;t++){var n=r[t];if(n===e){n.phase=o.Playing;break}n.phase=o.Retired}this.Pf===e&&(this.Pf=void 0)}},e.prototype.ig=function(e){return this.Of.find(function(t){return t.phase===e})},e.prototype.jg=function(){var e=this.Of.find(function(e){return e.phase===o.Upcoming&&e.preload===i.None});!this.Pf&&e&&(e.preload=i.Pending,this.Pf=e,this.context.logger.debug("[AdPreloading] Preloading ad ".concat(e.id)),this.kg(e))},e.prototype.kg=function(e){var t,r=this,n=null===(t=this.context.serviceManager)||void 0===t?void 0:t.get(a.ServiceName.PreloadingService);n?n.preloadSource(e.sourceConfig,s.ADVERTISING_ISSUER_NAME).then(function(){r.Pf===e&&(r.Pf=void 0),e.preload=i.Done,!r.Qf&&r.Of.includes(e)&&r.context.logger.debug("[AdPreloading] Source preparation completed for ad ".concat(e.id))}).catch(function(t){var n;r.context.logger.debug("[AdPreloading] Failed to preload ad ".concat(e.id,": ").concat(null!==(n=null==t?void 0:t.message)&&void 0!==n?n:t)),r.lg(e)}):this.lg(e)},e.prototype.lg=function(e){e.preload=i.Failed,this.Pf===e&&(this.Pf=void 0),this.Of.includes(e)&&e.phase===o.Upcoming&&(this.ng(e),this.Qf||this.jg())},e.prototype.mg=function(e){var t=this.Of.filter(e);this.Of=this.Of.filter(function(t){return!e(t)}),this.Pf&&t.includes(this.Pf)&&(this.Pf=void 0);for(var r={},n=0,i=t;n<i.length;n++){var o=i[n];r[o.sourceIdentifier]||(r[o.sourceIdentifier]=!0,this.ng(o))}},e.prototype.ng=function(e){var t,r;this.Of.some(function(t){return t!==e&&t.sourceIdentifier===e.sourceIdentifier&&function(e){return e.phase!==o.Upcoming||e.preload===i.Pending||e.preload===i.Done}(t)})||(this.context.logger.debug(e.preload===i.Pending?"[AdPreloading] Cancelling the in-flight preload of ad ".concat(e.id):"[AdPreloading] Releasing the preload artifacts of ad ".concat(e.id)),null===(r=null===(t=this.context.serviceManager)||void 0===t?void 0:t.get(a.ServiceName.PreloadingService))||void 0===r||r.cancelPreload(e.sourceIdentifier))},e}();t.AdPreloadingService=f},95217:function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.AdTrackingEvent=void 0,t.pingUrl=function(e){(new Image).src=e},function(e){e.FirstQuartile="firstQuartile",e.Midpoint="midpoint",e.ThirdQuartile="thirdQuartile"}(r||(t.AdTrackingEvent=r={}))},90176:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AdvertisingController=t.adTagPlaceholderDefaults=void 0,t.applyModuleSpecificConfig=T,t.createPlayerAdvertisingApi=P;var n=r(4224),i=r(9768),o=r(3714),a=r(4129),s=r(29669),l=r(44468),u=r(87827),c=r(93204),d=r(94685),p=r(34841),f=r(88844),h=r(70850),v=r(88052),g=r(62756),A=r(45392),E=r(50205),y={videoLoadTimeout:r(6365).DEFAULT_VIDEO_LOAD_TIMEOUT,strategy:E.defaultAdvertisingStrategy};t.adTagPlaceholderDefaults={playbackTime:["[CONTENTPLAYHEAD]"],height:["[HEIGHT]"],width:["[WIDTH]"],domain:["[DOMAIN]"],page:["[SITE]"],referrer:["[REFERRER]"],random:["[random]","[CACHEBUSTING]"],timestamp:["[TIMESTAMP]"]};var m=function(){function e(e,t){var r=this;this.context=t,this.yg=function(e){r.og.isCastingToCAF()||r.ug.onTimeChanged(e.time)},this.zg=function(e){return r.ug.onSeek(e.position,e.seekTarget)},this.Ag=function(){var e,t;return null===(t=(e=r.ug).onSeeked)||void 0===t?void 0:t.call(e)},this.Bg=function(){var e,t;return null===(t=(e=r.ug).onPlay)||void 0===t?void 0:t.call(e)},this.Cg=function(e){return r.xg=e.position},this.Dg=function(){r.zg({position:r.xg,seekTarget:r.og.getCurrentTime(i.ADVERTISING_ISSUER_NAME)}),r.Ag()},this.Eg=function(e){r.tg&&e.code===n.WarningCode.PLAYBACK_COULD_NOT_BE_STARTED&&(r.tg=!1)},this.onVolumeChanged=function(e){return r.ug.onVolumeChanged(e)},this.Fg=function(){r.qg.length>0&&r.Hg(r.qg.splice(0,r.qg.length)),r.og.off(o.PlayerEvent.SourceLoaded,r.Fg)},this.onPlayerResize=function(e,t){r.ug.onResize(e,t,r.og.getViewMode()===l.ViewMode.Fullscreen)};var a=e.getConfig(!0);this.pg=a.advertising||{},this.og=e,this.qg=[],this.rg=null,this.sg=!0,this.tg=!1;var s=function(e,t){var r,n,i={},o={};return h.Util.deepCopy(o,e),delete o.adBreaks,h.Util.deepCopyMulti(i,y,o),i.hasOwnProperty("withCredentials")||(i.withCredentials=!0),i.hasOwnProperty("disableStorageApi")||(i.disableStorageApi=null!==(n=null===(r=t.storage)||void 0===r?void 0:r.disableStorageApi)&&void 0!==n&&n),i}(this.pg,a);T(a,s,t.logger),this.createAdvertisingModule(s),this.pg.adBreaks&&this.pg.adBreaks.length>0&&this.pg.adBreaks.splice(0).forEach(function(e){return r.scheduleAd(e).catch(function(e){return r.context.logger.warn("Failed to schedule ad break",e)})}),this.og.on(o.PlayerEvent.TimeChanged,this.yg),this.og.on(o.PlayerEvent.Seek,this.zg),this.og.on(o.PlayerEvent.Seeked,this.Ag),this.og.onInternal(o.PlayerEvent.Play,this.Bg),this.og.on(o.PlayerEvent.Warning,this.Eg),this.og.on(o.PlayerEvent.TimeShift,this.Cg),this.og.on(o.PlayerEvent.TimeShifted,this.Dg),this.playerAdvertisingApi=P(this,this.ug)}return e.prototype.createAdvertisingModule=function(e){var t,r,n=new A.AdManifestHelper(new a.DefaultContentLoader(this.context,{requestType:s.HttpRequestType.MANIFEST_ADS}),e.videoLoadTimeout,null===(t=e.withCredentials)||void 0===t||t,null!==(r=e.disableStorageApi)&&void 0!==r&&r);this.wg={internalPlayer:this.og,context:this.context,restoreContentDeferred:null};var i=v.ModuleManager.get(g.ModuleName.AdvertisingCore),o=v.ModuleManager.get(g.ModuleName.Advertising),l=new i.AdPlayerDelegate(this.wg);this.ug=new o(l,e,n),this.vg=l},e.prototype.updatePlayerContext=function(e){this.context=e,this.wg.context=e},e.prototype.initializeAdModule=function(){this.ug.initialize()},e.prototype.onContentPaused=function(e){var t,r;(0,i.isUserInitiatedPause)(e)&&!this.og.isCasting()&&this.og.getViewMode()!==l.ViewMode.PictureInPicture&&(null===(r=(t=this.ug).onContentPaused)||void 0===r||r.call(t))},e.prototype.scheduleAd=function(e){return R(e)&&(e.discardAfterPlayback=!1!==e.discardAfterPlayback,this.Gg(e)&&!this.Jg())?(this.qg.push(e),this.rg||(this.rg=new p.Deferred,this.og.on(o.PlayerEvent.SourceLoaded,this.Fg)),this.rg.promise):this.Ig(e)},e.prototype.Gg=function(e){return e.position.includes("%")&&"0%"!==e.position},e.prototype.Hg=function(e){var t=this,r=e.map(function(e){return t.Ig(e)});this.rg&&Promise.all(r).then(function(e){var r=[].concat.apply([],e);t.rg.resolve(r),t.rg=null}).catch(function(e){return t.context.logger.warn("Failed to schedule delayed ad breaks",e)})},e.prototype.Ig=function(e){return R(e)&&this.og.isLive()&&this.Gg(e)?Promise.reject("percentage based ad break positions can not be used for live streams"):this.ug.schedule(e)},e.prototype.playPreRollAds=function(){var e,t,r=this,n=Promise.resolve();return this.tg=!0,this.sg&&(null===(t=null===(e=this.context)||void 0===e?void 0:e.videoElement)||void 0===t?void 0:t.prime)&&(n=this.context.videoElement.prime()),Promise.resolve(this.ug.beforeContent()).catch(function(e){(0,d.isContextAvailable)(r.context)&&r.context.logger.debug("Failed to trigger preroll ad playback: ",e)}).then(function(){return n}).catch(function(e){(0,d.isContextAvailable)(r.context)&&r.context.logger.debug("Failed to prime video element: ",e)})},e.prototype.playPostRollAds=function(){var e=this,t=!1,r=function(){t=!0,e.og.off(o.PlayerEvent.AdBreakStarted,r)};return this.og.on(o.PlayerEvent.AdBreakStarted,r),this.wg.restoreContentDeferred=new p.Deferred,Promise.resolve(this.ug.afterContent()).then(function(){return new Promise(function(r,n){if(t){var i,o=function(){e.wg.restoreContentDeferred.promise.then(r).catch(n),a(),(0,f.clearTimeoutIfDefined)(i)},a=(0,c.subscribe)(e.context.store)(function(e){return(0,u.getIsStopped)((0,u.getPlayerState)(e))},o,function(e){return e});i=window.setTimeout(o,1e3)}else r()})}).then(function(){return e.wg.restoreContentDeferred=null}).catch(function(t){e.wg.restoreContentDeferred=null,e.context.logger.debug("Failed to restore content after ad playback",t)})},e.prototype.hasAlreadyRequestedPreRollAds=function(){return this.tg},e.prototype.play=function(){return this.ug.resume(),Promise.resolve()},e.prototype.pause=function(){this.ug.pause()},e.prototype.getCurrentTime=function(){var e,t=null===(e=this.ug)||void 0===e?void 0:e.currentTime();return isNaN(t)?0:null!=t?t:0},e.prototype.getDuration=function(){return this.ug.duration()},e.prototype.isLinearAdActive=function(){return this.ug.isLinearAdActive()},e.prototype.isPlaying=function(){return this.ug.isLinearAdActive(!0)},e.prototype.isPaused=function(){return this.isLinearAdActive()&&!this.isPlaying()},e.prototype.Jg=function(){return this.og.getDuration()>0},e.prototype.reset=function(){return this.qg=[],this.tg=!1,this.vg.reset(),this.ug.reset()},e.prototype.dispose=function(){this.og.off(o.PlayerEvent.TimeChanged,this.yg),this.og.off(o.PlayerEvent.Seek,this.zg),this.og.off(o.PlayerEvent.Seeked,this.Ag),this.og.off(o.PlayerEvent.Play,this.Bg),this.og.off(o.PlayerEvent.Warning,this.Eg),this.og.off(o.PlayerEvent.TimeShift,this.Cg),this.og.off(o.PlayerEvent.TimeShifted,this.Dg),this.og=null,this.pg=null,this.ug.dispose(),this.ug=null,this.vg=null},e}();function T(e,t,r){if(Boolean(v.ModuleManager.get(g.ModuleName.Advertising).bitmovinMarker))return r.debug("Using Bitmovin Advertising Module"),void function(e,t){var r=t;e.playback&&Array.isArray(e.playback.preferredTech)?r.preferredTechnology=e.playback.preferredTech:r.preferredTechnology=[]}(e,t);Boolean(v.ModuleManager.get(g.ModuleName.Advertising).imaMarker)&&(r.debug("Using IMA Advertising Module"),function(e,t){var r=t;r.sdkUrl||(r.sdkUrl=e.location.google_ima)}(e,t))}function P(e,t){return new(function(){function r(){}return r.prototype.schedule=function(t){return e.scheduleAd(t)},r.prototype.skip=function(){return t.skip()},r.prototype.list=function(){return t.list()},r.prototype.getActiveAdBreak=function(){return t.getActiveAdBreak()},r.prototype.getActiveAd=function(){return t.getActiveAd()},r.prototype.discardAdBreak=function(e){t.discardAdBreak(e)},r.prototype.isLinearAdActive=function(){return t.isLinearAdActive()},r.prototype.getModuleInfo=function(){return t.getModuleInfo()},r}())}function R(e){return Boolean(e.position)}t.AdvertisingController=m},28412:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AdvertisingModule=void 0;var r=function(){return function(e,t,r){this.player=e,this.config=t,this.adManifestHelper=r}}();t.AdvertisingModule=r},88457:function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.AdvertisingModuleErrorCode=void 0,function(e){e[e.AD_TAG_TYPE_NOT_MATCHING=110]="AD_TAG_TYPE_NOT_MATCHING",e[e.COULD_NOT_LOAD_AD_MANIFEST=404]="COULD_NOT_LOAD_AD_MANIFEST",e[e.REQUIRED_PLAYER_MODULE_MISSING=2e3]="REQUIRED_PLAYER_MODULE_MISSING"}(r||(t.AdvertisingModuleErrorCode=r={}))},50205:function(e,t,r){var n=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.defaultAdvertisingStrategy=void 0,t.shouldLoadAdBreak=function(e,r,n){var o;return null!==(o=(0,i.safeUserCallback)(function(){var t;return null===(t=null==e?void 0:e.shouldLoadAdBreak)||void 0===t?void 0:t.call(e,r)},n))&&void 0!==o?o:t.defaultAdvertisingStrategy.shouldLoadAdBreak()},t.shouldPlayAdBreak=function(e,r,n){var o;return null!==(o=(0,i.safeUserCallback)(function(){var t;return null===(t=null==e?void 0:e.shouldPlayAdBreak)||void 0===t?void 0:t.call(e,r)},n))&&void 0!==o?o:t.defaultAdvertisingStrategy.shouldPlayAdBreak()},t.shouldPlaySkippedAdBreaks=function(e,r,o,a,s){var l=(0,i.safeUserCallback)(function(){var t;return null===(t=null==e?void 0:e.shouldPlaySkippedAdBreaks)||void 0===t?void 0:t.call(e,n([],r,!0),o,a)},s);return null!=l?l:t.defaultAdvertisingStrategy.shouldPlaySkippedAdBreaks(r)};var i=r(70850);t.defaultAdvertisingStrategy={shouldLoadAdBreak:function(){return!0},shouldPlayAdBreak:function(){return!0},shouldPlaySkippedAdBreaks:function(e){var t=Math.max.apply(Math,e.map(function(e){return e.scheduleTime})),r=e.find(function(e){return e.scheduleTime===t});return r?[r]:[]}}},23912:function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.AdTagType=void 0,function(e){e.VAST="vast",e.VMAP="vmap",e.VPAID="vpaid"}(r||(t.AdTagType=r={}))},93531:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.calculatePlaybackRestorationPosition=function(e){var t=e.adBreakDuration,r=e.isLive,n=e.playbackPosition,i=e.replaceContentDuration,o=e.resumeLiveContentAtPreviousPosition;return n+(null!=i?i:!r||o?0:t)},t.calculateTimeshiftRestorationPosition=function(e){var t=e.adBreakDuration,r=e.playbackPosition,i=e.replaceContentDuration,o=e.resumeLiveContentAtPreviousPosition?t:0,a=(0,n.isDefined)(i)?t-i:o;return Math.min(r-a,0)};var n=r(23068)},6365:function(e,t){var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.VastApiFramework=t.MediaFileDeliveryType=t.DEFAULT_OVERLAY_AD_BOTTOM_POSITION=t.DEFAULT_VIDEO_LOAD_TIMEOUT=t.NON_SKIPPABLE_IDENTIFIER=t.DEFAULT_PRELOAD_OFFSET=t.DEFAULT_PAUSE_AD_ACTIVATION_DELAY=void 0,t.DEFAULT_PAUSE_AD_ACTIVATION_DELAY=1,t.DEFAULT_PRELOAD_OFFSET=0,t.NON_SKIPPABLE_IDENTIFIER=-1,t.DEFAULT_VIDEO_LOAD_TIMEOUT=8e3,t.DEFAULT_OVERLAY_AD_BOTTOM_POSITION="4.5em",function(e){e.Progressive="progressive",e.Streaming="streaming"}(r||(t.MediaFileDeliveryType=r={})),function(e){e.Vpaid="vpaid"}(n||(t.VastApiFramework=n={}))},65185:function(e,t){function r(e){return e.bitrate||(e.maxBitrate+e.minBitrate)/2}Object.defineProperty(t,"__esModule",{value:!0}),t.findMediaFileByResolution=function(e,t,r){return r.reduce(function(r,n){var i=Math.abs(e-r.width)+Math.abs(t-r.height);return Math.abs(e-n.width)+Math.abs(t-n.height)<i?n:r})},t.findMediaFileByBitrate=function(e,t){return t.reduce(function(t,n){var i=r(t),o=r(n),a=Math.abs(i-e);return Math.abs(o-e)<a?n:t})}},7581:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.VastErrorCode=t.AdvertisingModuleErrorCode=t.AdTagType=t.AdvertisingCoreModuleDefinition=void 0;var n=r(62756),i=r(43255),o=r(42163),a=r(90176),s=r(88457);Object.defineProperty(t,"AdvertisingModuleErrorCode",{enumerable:!0,get:function(){return s.AdvertisingModuleErrorCode}});var l=r(23912);Object.defineProperty(t,"AdTagType",{enumerable:!0,get:function(){return l.AdTagType}});var u=r(47091);Object.defineProperty(t,"VastErrorCode",{enumerable:!0,get:function(){return u.VastErrorCode}}),t.AdvertisingCoreModuleDefinition={name:n.ModuleName.AdvertisingCore,module:function(){return{AdvertisingController:a.AdvertisingController,AdPlayerDelegate:i.AdPlayerDelegate,AdPreloadingService:o.AdPreloadingService}},dependencies:[n.ModuleName.XML],exports:{AdTagType:l.AdTagType,AdvertisingModuleErrorCode:s.AdvertisingModuleErrorCode,VastErrorCode:u.VastErrorCode}},t.default=t.AdvertisingCoreModuleDefinition},60326:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.VastClientWrapper=void 0;var n=r(6036),i=r(6365),o=r(47091),a=function(){function e(e,t,r){this.IM=new n.VASTClient({allowUsingBrowserStorageApi:!r}),this.IM.vastParser.initParsingStatus(),this.JM=e||i.DEFAULT_VIDEO_LOAD_TIMEOUT,this.KM=t}return e.prototype.parseManifest=function(e,t){var r=this,n=[],i=function(e){n.push({code:e.ERRORCODE})};return this.IM.vastParser.addListener("VAST-error",i),this.IM.vastParser.parseVAST(e,{timeout:this.JM,withCredentials:this.KM,replaceUnavailableAdPodAds:!t}).catch(function(e){return r.IM.vastParser.removeListener("VAST-error",i),Promise.reject({code:e&&e.ERRORCODE||o.VastErrorCode.UNDEFINED_ERROR})}).then(function(e){var t;return r.IM.vastParser.removeListener("VAST-error",i),(null===(t=e.ads)||void 0===t?void 0:t.length)>0?e:n.length>0?Promise.reject(n[0]):Promise.reject({code:o.VastErrorCode.UNDEFINED_ERROR})})},e}();t.VastClientWrapper=a},47091:function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.VastErrorCode=void 0,function(e){e[e.XML_PARSING_ERROR=100]="XML_PARSING_ERROR",e[e.VAST_SCHEMA_VALIDATION_ERROR=101]="VAST_SCHEMA_VALIDATION_ERROR",e[e.VERSION_NOT_SUPPORTED=102]="VERSION_NOT_SUPPORTED",e[e.TRAFFICKING_ERROR=200]="TRAFFICKING_ERROR",e[e.EXPECTING_DIFFERENT_LINEARITY=201]="EXPECTING_DIFFERENT_LINEARITY",e[e.EXPECTING_DIFFERENT_DURATION=202]="EXPECTING_DIFFERENT_DURATION",e[e.EXPECTING_DIFFERENT_SIZE=203]="EXPECTING_DIFFERENT_SIZE",e[e.GENERAL_WRAPPER_ERROR=300]="GENERAL_WRAPPER_ERROR",e[e.WRAPPER_VAST_URI_TIMEOUT=301]="WRAPPER_VAST_URI_TIMEOUT",e[e.WRAPPER_LIMIT_REACHED=302]="WRAPPER_LIMIT_REACHED",e[e.NO_ADS_VAST_RESPONSE=303]="NO_ADS_VAST_RESPONSE",e[e.INLINE_AD_DISPLAY_TIMEOUT=304]="INLINE_AD_DISPLAY_TIMEOUT",e[e.GENERAL_LINEAR_ERROR=400]="GENERAL_LINEAR_ERROR",e[e.FILE_NOT_FOUND=401]="FILE_NOT_FOUND",e[e.MEDIAFILE_URI_TIMEOUT=402]="MEDIAFILE_URI_TIMEOUT",e[e.NO_SUPPORTED_MEDIAFILE=403]="NO_SUPPORTED_MEDIAFILE",e[e.PROBLEM_DISPLAYING_MEDIAFILE=405]="PROBLEM_DISPLAYING_MEDIAFILE",e[e.GENERAL_NONLINEARADS_ERROR=500]="GENERAL_NONLINEARADS_ERROR",e[e.NONLINEAR_AD_INVALID_DIMENSIONS=501]="NONLINEAR_AD_INVALID_DIMENSIONS",e[e.UNABLE_TO_FETCH_NONLINEAR_RESOURCE=502]="UNABLE_TO_FETCH_NONLINEAR_RESOURCE",e[e.NO_SUPPORTED_NONLINEAR_RESOURCE_TYPE=503]="NO_SUPPORTED_NONLINEAR_RESOURCE_TYPE",e[e.GENERAL_COMPANIONADS_ERROR=600]="GENERAL_COMPANIONADS_ERROR",e[e.COMPANION_AD_INVALID_DIMENSIONS=601]="COMPANION_AD_INVALID_DIMENSIONS",e[e.UNABLE_TO_DISPLAY_REQUIRED_COMPANION=602]="UNABLE_TO_DISPLAY_REQUIRED_COMPANION",e[e.UNABLE_TO_FETCH_COMPANION_RESOURCE=603]="UNABLE_TO_FETCH_COMPANION_RESOURCE",e[e.NO_SUPPORTED_COMPANION_RESOURCE_TYPE=604]="NO_SUPPORTED_COMPANION_RESOURCE_TYPE",e[e.UNDEFINED_ERROR=900]="UNDEFINED_ERROR",e[e.GENERAL_VPAID_ERROR=901]="GENERAL_VPAID_ERROR"}(r||(t.VastErrorCode=r={}))},5838:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.VmapExtractor=void 0;var n=r(70850),i=r(88052),o=r(62756),a=r(45392),s=r(88457),l=r(23912),u=r(6365),c=r(47091),d=function(){function e(){}return e.xml2js=function(e){return(0,i.ModuleManager.get(o.ModuleName.XML).parseXML)(e,{decodeEntities:!1,useArrayRepresentationForChildren:!0})},e.js2xml=function(e){return(0,i.ModuleManager.get(o.ModuleName.XML).parseJSONtoXML)(e)},e.extractAdBreakConfigs=function(t,r){return e.getParsedManifest(t.tag.url,r).then(function(r){if(r.manifest.VMAP){var n=e.parseVmapAdBreaks(r.manifest,t);return Promise.resolve({adBreakConfigs:n,downloadTiming:r.downloadTiming})}return Promise.reject({code:s.AdvertisingModuleErrorCode.AD_TAG_TYPE_NOT_MATCHING})})},e.getParsedManifest=function(t,r){return r.downloadVmapManifest(t).catch(function(){return Promise.reject({code:s.AdvertisingModuleErrorCode.COULD_NOT_LOAD_AD_MANIFEST})}).then(function(t){if(!t.body)return Promise.reject({code:c.VastErrorCode.XML_PARSING_ERROR});try{var r=e.xml2js(t.body),n=r.success?r.parsed:{},i={downloadTime:t.elapsedTime,timeToFirstByte:t.timeToFirstByte};return Promise.resolve({manifest:n,downloadTiming:i})}catch(e){return Promise.reject({code:c.VastErrorCode.XML_PARSING_ERROR})}})},e.parseVmapAdBreaks=function(t,r){return e.extractAdBreaks(t).map(function(e){var t,i={id:e.id||n.Util.generateUniqueId(),tag:{url:e.tag,type:l.AdTagType.VAST},position:e.offset,preloadOffset:null!==(t=r.preloadOffset)&&void 0!==t?t:u.DEFAULT_PRELOAD_OFFSET};r.hasOwnProperty("replaceContentDuration")&&(i.replaceContentDuration=r.replaceContentDuration),r.passthroughMode&&(i.passthroughMode=r.passthroughMode);var o={publicAdBreakConfig:i};return e.trackingEvents&&Object.keys(e.trackingEvents).length>0&&(o.trackingEvents=e.trackingEvents),o})||[]},e.extractAdBreaks=function(t){return t.VMAP?t.VMAP.AdBreak.map(function(t){var r=t._breakId,n=t._timeOffset;switch(n){case"start":n="pre";break;case"end":n="post"}var i=e.getAdBreakUri(t),o=[];return t.TrackingEvents&&t.TrackingEvents[0]&&t.TrackingEvents[0].Tracking&&t.TrackingEvents[0].Tracking.forEach(function(e){var t=e._event.toLocaleLowerCase();o.push({type:t,url:e.toString()})}),{id:r,offset:n,tag:i,trackingEvents:o}}):[]},e.getAdBreakUri=function(t){var r,n,i,o=null===(r=t.AdSource)||void 0===r?void 0:r[0],s=null===(n=null==o?void 0:o.AdTagURI)||void 0===n?void 0:n[0],l=null===(i=null==o?void 0:o.VASTAdData)||void 0===i?void 0:i[0];return(null==s?void 0:s.toString)?s.toString():l?(0,a.toDataUri)(e.js2xml(l)):""},e}();t.VmapExtractor=d},63207:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Ad=void 0;var r=function(){return function(){this.id=null,this.wrapperAdIds=[],this.sequence=null,this.system=null,this.title=null,this.description=null,this.advertiser=null,this.pricing=null,this.survey=null,this.errorURLTemplates=[],this.impressionURLTemplates=[],this.creatives=[],this.extensions=[],this.verifications=[]}}();t.Ad=r},19637:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AdExtension=void 0;var r=function(){function e(){this.name=null,this.value=null,this.attributes={},this.children=[]}return e.prototype.isEmpty=function(){return null===this.value&&0===Object.keys(this.attributes).length&&0===this.children.length},e}();t.AdExtension=r},31472:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.CompanionAd=void 0;var r=function(){return function(){this.id=null,this.width=0,this.height=0,this.type=null,this.staticResource=null,this.htmlResource=null,this.iframeResource=null,this.altText=null,this.companionClickThroughURLTemplate=null,this.companionClickTrackingURLTemplates=[],this.trackingEvents={}}}();t.CompanionAd=r},36828:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Creative=void 0;var r=function(){return function(e){void 0===e&&(e={}),this.id=e.id||null,this.adId=e.adId||null,this.universalAdId=e.universalAdId||null,this.sequence=e.sequence||null,this.apiFramework=e.apiFramework||null,this.trackingEvents={}}}();t.Creative=r},81214:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.CreativeCompanion=void 0;var i=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.type="companion",r.variations=[],r}return n(t,e),t}(r(36828).Creative);t.CreativeCompanion=i},77615:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.CreativeLinear=void 0;var i=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.type="linear",r.duration=0,r.skipDelay=null,r.mediaFiles=[],r.videoClickThroughURLTemplate=null,r.videoClickTrackingURLTemplates=[],r.videoCustomClickURLTemplates=[],r.adParameters=null,r.icons=[],r}return n(t,e),t}(r(36828).Creative);t.CreativeLinear=i},35475:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.CreativeNonLinear=void 0;var i=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.type="nonlinear",r.variations=[],r}return n(t,e),t}(r(36828).Creative);t.CreativeNonLinear=i},50199:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Icon=void 0;var r=function(){return function(){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}}();t.Icon=r},36629:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MediaFile=void 0;var r=function(){return function(){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}}();t.MediaFile=r},57219:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.NonLinearAd=void 0;var r=function(){return function(){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}}();t.NonLinearAd=r},71119:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parseAd=function(e){var t=e.childNodes;for(var r in t){var n=t[r];if(-1!==["Wrapper","InLine"].indexOf(n.nodeName)){if(l.parserUtils.copyNodeAttribute("id",e,n),l.parserUtils.copyNodeAttribute("sequence",e,n),"Wrapper"===n.nodeName)return c(n);if("InLine"===n.nodeName)return u(n)}}},t.parseExtensions=d;var n=r(63207),i=r(19637),o=r(93088),a=r(2035),s=r(64815),l=r(75065);function u(e){var t=e.childNodes,r=new n.Ad;for(var i in r.id=e.getAttribute("id")||null,r.sequence=e.getAttribute("sequence")||null,t){var u=t[i];switch(u.nodeName){case"Error":r.errorURLTemplates.push(l.parserUtils.parseNodeText(u));break;case"Impression":r.impressionURLTemplates.push(l.parserUtils.parseNodeText(u));break;case"Creatives":l.parserUtils.childrenByName(u,"Creative").forEach(function(e){var t={id:e.getAttribute("id")||null,adId:h(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"UniversalAdId":t.universalAdId=v(i);break;case"Linear":var l=(0,a.parseCreativeLinear)(i,t);l&&r.creatives.push(l);break;case"NonLinearAds":var u=(0,s.parseCreativeNonLinear)(i,t);u&&r.creatives.push(u);break;case"CompanionAds":var c=(0,o.parseCreativeCompanion)(i,t);c&&r.creatives.push(c)}}});break;case"Extensions":r.extensions=d(l.parserUtils.childrenByName(u,"Extension"),r);break;case"AdSystem":r.system={value:l.parserUtils.parseNodeText(u),version:u.getAttribute("version")||null};break;case"AdTitle":r.title=l.parserUtils.parseNodeText(u);break;case"Description":r.description=l.parserUtils.parseNodeText(u);break;case"Advertiser":r.advertiser={name:l.parserUtils.parseNodeText(u),id:u.getAttribute("id")||null};break;case"Pricing":r.pricing={value:l.parserUtils.parseNodeText(u),model:u.getAttribute("model")||null,currency:u.getAttribute("currency")||null};break;case"Survey":r.survey={uri:l.parserUtils.parseNodeText(u),type:u.getAttribute("type")||null};break;case"AdVerifications":f(r.verifications,l.parserUtils.childrenByName(u,"Verification"))}}return r}function c(e){var t=u(e),r=l.parserUtils.childByName(e,"VASTAdTagURI");if(r?t.nextWrapperURL=l.parserUtils.parseNodeText(r):(r=l.parserUtils.childByName(e,"VASTAdTagURL"))&&(t.nextWrapperURL=l.parserUtils.parseNodeText(l.parserUtils.childByName(r,"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 r=function(r){var n=e.trackingEvents[r];t.trackingEvents[e.type][r]||(t.trackingEvents[e.type][r]=[]),n.forEach(function(n){t.trackingEvents[e.type][r].push(n)})};for(var n in e.trackingEvents)r(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 d(e,t){var r=[];return e.forEach(function(e){var n=p(e,t);n&&r.push(n)}),r}function p(e,t){if("#comment"===e.nodeName)return null;var r=new i.AdExtension,n=e.attributes,o=e.childNodes;if(r.name=e.nodeName,e.attributes)for(var a in n)if(n.hasOwnProperty(a)){var s=n[a];s.nodeName&&s.nodeValue&&(r.attributes[s.nodeName]=s.nodeValue)}for(var u in o)if(o.hasOwnProperty(u)){if("AdVerifications"===o[u].nodeName){f(t.verifications,l.parserUtils.childrenByName(o[u],"Verification"));continue}var c=p(o[u],t);c&&r.children.push(c)}if(0===r.children.length||1===r.children.length&&["#cdata-section","#text"].indexOf(r.children[0].name)>=0){var d=l.parserUtils.parseNodeText(e);""!==d&&(r.value=d),r.children=[]}return r.isEmpty()?null:r}function f(e,t){var r=["Verification","JavaScriptResource","ExecutableResource","TrackingEvents","Tracking","VerificationParameters"],n=function(e){var t={},i=l.parserUtils.parseNodeText(e);return Object.keys(e.attributes).forEach(function(r){var n=e.attributes[r].nodeName,i=e.attributes[r].nodeValue;n&&i&&(t[n]=i)}),"#comment"!==e.nodeName&&""!==i&&(e.children&&e.children.length>0?e.childNodes.forEach(function(e){r.includes(e.nodeName)&&(t[e.nodeName]||(t[e.nodeName]=[]),t[e.nodeName].push(n(e)))}):t.content=i),t};t.forEach(function(t){var r=n(t);e.push(r)})}function h(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}function v(e){return{idRegistry:e.getAttribute("idRegistry")||"unknown",value:l.parserUtils.parseNodeText(e)||"unknown"}}},93088:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parseCreativeCompanion=function(e,t){var r=new i.CreativeCompanion(t);return o.parserUtils.childrenByName(e,"Companion").forEach(function(e){var t=new n.CompanionAd;t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.companionClickTrackingURLTemplates=[],o.parserUtils.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=o.parserUtils.parseNodeText(e)}),o.parserUtils.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=o.parserUtils.parseNodeText(e)}),o.parserUtils.childrenByName(e,"StaticResource").forEach(function(r){t.type=r.getAttribute("creativeType")||0,o.parserUtils.childrenByName(e,"AltText").forEach(function(e){t.altText=o.parserUtils.parseNodeText(e)}),t.staticResource=o.parserUtils.parseNodeText(r)}),o.parserUtils.childrenByName(e,"TrackingEvents").forEach(function(e){o.parserUtils.childrenByName(e,"Tracking").forEach(function(e){var r=e.getAttribute("event"),n=o.parserUtils.parseNodeText(e);r&&n&&(null==t.trackingEvents[r]&&(t.trackingEvents[r]=[]),t.trackingEvents[r].push(n))})}),o.parserUtils.childrenByName(e,"CompanionClickTracking").forEach(function(e){t.companionClickTrackingURLTemplates.push(o.parserUtils.parseNodeText(e))}),t.companionClickThroughURLTemplate=o.parserUtils.parseNodeText(o.parserUtils.childByName(e,"CompanionClickThrough")),t.companionClickTrackingURLTemplate=o.parserUtils.parseNodeText(o.parserUtils.childByName(e,"CompanionClickTracking")),r.variations.push(t)}),r};var n=r(31472),i=r(81214),o=r(75065)},2035:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parseCreativeLinear=function(e,t){var r,s=new n.CreativeLinear(t);s.duration=a.parserUtils.parseDuration(a.parserUtils.parseNodeText(a.parserUtils.childByName(e,"Duration")));var l=e.getAttribute("skipoffset");if(null==l)s.skipDelay=null;else if("%"===l.charAt(l.length-1)&&-1!==s.duration){var u=parseInt(l,10);s.skipDelay=s.duration*(u/100)}else s.skipDelay=a.parserUtils.parseDuration(l);var c=a.parserUtils.childByName(e,"VideoClicks");c&&(s.videoClickThroughURLTemplate=a.parserUtils.parseNodeText(a.parserUtils.childByName(c,"ClickThrough")),a.parserUtils.childrenByName(c,"ClickTracking").forEach(function(e){s.videoClickTrackingURLTemplates.push(a.parserUtils.parseNodeText(e))}),a.parserUtils.childrenByName(c,"CustomClick").forEach(function(e){s.videoCustomClickURLTemplates.push(a.parserUtils.parseNodeText(e))}));var d=a.parserUtils.childByName(e,"AdParameters");d&&(s.adParameters=a.parserUtils.parseNodeText(d)),a.parserUtils.childrenByName(e,"TrackingEvents").forEach(function(e){a.parserUtils.childrenByName(e,"Tracking").forEach(function(e){var t=e.getAttribute("event"),n=a.parserUtils.parseNodeText(e);if(t&&n){if("progress"===t){if(!(r=e.getAttribute("offset")))return;t="%"===r.charAt(r.length-1)?"progress-".concat(r):"progress-".concat(Math.round(a.parserUtils.parseDuration(r)))}null==s.trackingEvents[t]&&(s.trackingEvents[t]=[]),s.trackingEvents[t].push(n)}})}),a.parserUtils.childrenByName(e,"MediaFiles").forEach(function(e){a.parserUtils.childrenByName(e,"MediaFile").forEach(function(e){var t=new o.MediaFile;t.id=e.getAttribute("id"),t.fileURL=a.parserUtils.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 r=e.getAttribute("scalable");r&&"string"==typeof r&&("true"===(r=r.toLowerCase())?t.scalable=!0:"false"===r&&(t.scalable=!1));var n=e.getAttribute("maintainAspectRatio");n&&"string"==typeof n&&("true"===(n=n.toLowerCase())?t.maintainAspectRatio=!0:"false"===n&&(t.maintainAspectRatio=!1)),s.mediaFiles.push(t)})});var p=a.parserUtils.childByName(e,"Icons");return p&&a.parserUtils.childrenByName(p,"Icon").forEach(function(e){var t=new i.Icon;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=a.parserUtils.parseDuration(e.getAttribute("offset")),t.duration=a.parserUtils.parseDuration(e.getAttribute("duration")),a.parserUtils.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=a.parserUtils.parseNodeText(e)}),a.parserUtils.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=a.parserUtils.parseNodeText(e)}),a.parserUtils.childrenByName(e,"StaticResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=a.parserUtils.parseNodeText(e)});var r=a.parserUtils.childByName(e,"IconClicks");r&&(t.iconClickThroughURLTemplate=a.parserUtils.parseNodeText(a.parserUtils.childByName(r,"IconClickThrough")),a.parserUtils.childrenByName(r,"IconClickTracking").forEach(function(e){t.iconClickTrackingURLTemplates.push(a.parserUtils.parseNodeText(e))})),t.iconViewTrackingURLTemplate=a.parserUtils.parseNodeText(a.parserUtils.childByName(e,"IconViewTracking")),s.icons.push(t)}),s};var n=r(77615),i=r(50199),o=r(36629),a=r(75065)},64815:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parseCreativeNonLinear=function(e,t){var r=new n.CreativeNonLinear(t);return o.parserUtils.childrenByName(e,"TrackingEvents").forEach(function(e){var t,n;o.parserUtils.childrenByName(e,"Tracking").forEach(function(e){t=e.getAttribute("event"),n=o.parserUtils.parseNodeText(e),t&&n&&(null==r.trackingEvents[t]&&(r.trackingEvents[t]=[]),r.trackingEvents[t].push(n))})}),o.parserUtils.childrenByName(e,"NonLinear").forEach(function(e){var t=new i.NonLinearAd;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=o.parserUtils.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=o.parserUtils.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=o.parserUtils.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),o.parserUtils.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=o.parserUtils.parseNodeText(e)}),o.parserUtils.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=o.parserUtils.parseNodeText(e)}),o.parserUtils.childrenByName(e,"StaticResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=o.parserUtils.parseNodeText(e)});var n=o.parserUtils.childByName(e,"AdParameters");n&&(t.adParameters=o.parserUtils.parseNodeText(n)),t.nonlinearClickThroughURLTemplate=o.parserUtils.parseNodeText(o.parserUtils.childByName(e,"NonLinearClickThrough")),o.parserUtils.childrenByName(e,"NonLinearClickTracking").forEach(function(e){t.nonlinearClickTrackingURLTemplates.push(o.parserUtils.parseNodeText(e))}),r.variations.push(t)}),r};var n=r(35475),i=r(57219),o=r(75065)},75065:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parserUtils=void 0;var n=r(11417);t.parserUtils={childByName:function(e,t){var r=e.childNodes;for(var n in r){var i=r[n];if(i.nodeName===t)return i}},childrenByName:function(e,t){var r=[],n=e.childNodes;for(var i in n){var o=n[i];o.nodeName===t&&r.push(o)}return r},resolveVastAdTagURI:function(e,t){if(!t)return e;if(0===e.indexOf("//")){var r=location.protocol;return"".concat(r).concat(e)}if(-1===e.indexOf("://")){var n=t.slice(0,t.lastIndexOf("/"));return"".concat(n,"/").concat(e)}return 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,r){var n=t.getAttribute(e);n&&r.setAttribute(e,n)},parseDuration:function(e){if(null==e)return-1;if(n.util.isNumeric(e))return parseInt(e);var t=e.split(":");if(3!==t.length)return-1;var r=t[2].split("."),i=parseInt(r[0]);2===r.length&&(i+=parseFloat("0.".concat(r[1])));var o=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(o)||isNaN(i)||o>3600||i>60?-1:a+o+i},splitVAST:function(e){var t=[],r=null;return e.forEach(function(n,i){if(n.sequence&&(n.sequence=parseInt(n.sequence,10)),n.sequence>1){var o=e[i-1];if(o&&o.sequence===n.sequence-1)return void(r&&r.push(n));delete n.sequence}r=[n],t.push(r)}),t},mergeWrapperAdData:function(e,t){if(e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),e.verifications=t.verifications.concat(e.verifications),e.wrapperAdIds.push(t.id),e.creatives.forEach(function(e){if(t.trackingEvents&&t.trackingEvents[e.type])for(var r in t.trackingEvents[e.type]){var n=t.trackingEvents[e.type][r];e.trackingEvents[r]||(e.trackingEvents[r]=[]),e.trackingEvents[r]=e.trackingEvents[r].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)}),e.fallbackAdSequence&&e.sequence!==e.fallbackAdSequence){if(!t.sequence&&!t.fallbackAdSequence)return;e.sequence=null,e.fallbackAdSequence=t.fallbackAdSequence||t.sequence}else if(t.fallbackAdSequence)e.sequence=null,e.fallbackAdSequence=t.fallbackAdSequence||t.sequence;else{if(!t.sequence&&!t.fallbackAdSequence)return;e.sequence=t.sequence}}}},29902:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.VASTParser=void 0;var o=r(71119),a=r(37007),s=r(75065),l=r(27294),u=r(11417),c=r(71076),d={ERRORCODE:900,extensions:[]},p=function(e){function t(){var t=e.call(this)||this;return t.remainingAds=[],t.parentURLs=[],t.errorURLTemplates=[],t.rootErrorURLTemplates=[],t.maxWrapperDepth=null,t.URLTemplateFilters=[],t.fetchingOptions={},t.currentAdSequence=null,t}return n(t,e),t.prototype.addURLTemplateFilter=function(e){"function"==typeof e&&this.URLTemplateFilters.push(e)},t.prototype.removeURLTemplateFilter=function(){this.URLTemplateFilters.pop()},t.prototype.countURLTemplateFilters=function(){return this.URLTemplateFilters.length},t.prototype.clearURLTemplateFilters=function(){this.URLTemplateFilters=[]},t.prototype.trackVastError=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];this.emit("VAST-error",Object.assign.apply(Object,i([d,t],r,!1))),u.util.track(e,t)},t.prototype.getErrorURLTemplates=function(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)},t.prototype.fetchVAST=function(e,t,r){var n=this;return new Promise(function(i,o){n.URLTemplateFilters.forEach(function(t){e=t(e)}),n.parentURLs.push(e),n.emit("VAST-resolving",{url:e,wrapperDepth:t,originalUrl:r}),n.urlHandler.get(e,n.fetchingOptions,function(t,r){n.emit("VAST-resolved",{url:e,error:t}),t?o(t):i(r)})})},t.prototype.initParsingStatus=function(e){void 0===e&&(e={}),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||l.urlHandler},t.prototype.getRemainingAds=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 r=e?u.util.flatten(this.remainingAds):this.remainingAds.shift();return this.errorURLTemplates=[],this.parentURLs=[],this.resolveAds(r,{wrapperDepth:0,originalUrl:this.rootURL}).then(function(e){return t.buildVASTResponse(e)})},t.prototype.getAndParseVAST=function(e,t){var r=this;return void 0===t&&(t={}),this.initParsingStatus(t),this.rootURL=e,this.fetchVAST(e).then(function(n){return t.originalUrl=e,t.isRootVAST=!0,r.parse(n,t).then(function(e){return r.buildVASTResponse(e,t)})})},t.prototype.parseVAST=function(e,t){var r=this;return void 0===t&&(t={}),this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(function(e){return r.buildVASTResponse(e,t)})},t.prototype.getPodAds=function(e){return e.filter(function(e){return null!=e.sequence})},t.prototype.getStandaloneAds=function(e){return e.filter(function(e){return null==e.sequence})},t.prototype.hasMediaFiles=function(e){return!(!e||null!=e.errorCode)&&(Array.isArray(e.creatives)?e.creatives:[]).some(function(e){return e.mediaFiles&&e.mediaFiles.length>0})},t.prototype.replaceUnavailableAdPodAds=function(e){var t=this,r=this.getPodAds(e),n=this.getStandaloneAds(e).filter(this.hasMediaFiles);return 0===r.length||0===n.length?e:(r=r.map(function(e){return t.hasMediaFiles(e)?e:n.shift()}).filter(Boolean),n.forEach(function(e){return e.isFallback=!0}),r.concat(n))},t.prototype.markFallbackAds=function(e){return this.getPodAds(e).length>0&&this.getStandaloneAds(e).forEach(function(e){return e.isFallback=!0}),e},t.prototype.buildVASTResponse=function(e,t){void 0===t&&(t={});var r=new c.VASTResponse;return r.errorURLTemplates=this.getErrorURLTemplates(),e.forEach(function(e){return e.isFallback=!1}),r.ads=t.replaceUnavailableAdPodAds?this.replaceUnavailableAdPodAds(e):this.markFallbackAds(e),this.completeWrapperResolving(r),r},t.prototype.parse=function(e,t){var r=this,n=t.resolveAll,i=void 0===n||n,a=t.wrapperSequence,l=void 0===a?null:a,u=t.originalUrl,c=void 0===u?null:u,d=t.wrapperDepth,p=void 0===d?0:d,f=t.isRootVAST,h=void 0!==f&&f,v=t.parentAdSequence,g=void 0===v?null:v;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName)return Promise.reject(new Error("Invalid VAST XMLDocument"));var A=[],E=e.documentElement.childNodes;for(var y in E){var m=E[y];if("Error"===m.nodeName){var T=s.parserUtils.parseNodeText(m);h?this.rootErrorURLTemplates.push(T):this.errorURLTemplates.push(T)}if("Ad"===m.nodeName){var P=(0,o.parseAd)(m);P?A.push(P):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}var R=A.length,_=A[R-1];return 1===R&&null!=l&&_&&!_.sequence&&(_.sequence=l),A.forEach(function(e){return r.handleFallbackAdSequence(e,g)}),!1===i&&(this.remainingAds=s.parserUtils.splitVAST(A),A=this.remainingAds.shift()),this.resolveAds(A,{wrapperDepth:p,originalUrl:c})},t.prototype.handleFallbackAdSequence=function(e,t){null==e.sequence?e.fallbackAdSequence=t||this.currentAdSequence:this.currentAdSequence=e.sequence},t.prototype.resolveAds=function(e,t){var r=this;void 0===e&&(e=[]);var n=t.wrapperDepth,i=t.originalUrl,o=[];return e.forEach(function(e){var t=r.resolveWrappers(e,n,i);o.push(t)}),Promise.all(o).then(function(e){var t=u.util.flatten(e);if(!t&&r.remainingAds.length>0){var o=r.remainingAds.shift();return r.resolveAds(o,{wrapperDepth:n,originalUrl:i})}return t})},t.prototype.resolveWrappers=function(e,t,r){var n=this;return new Promise(function(i){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=s.parserUtils.resolveVastAdTagURI(e.nextWrapperURL,r);var o=e.sequence;r=e.nextWrapperURL,n.fetchVAST(e.nextWrapperURL,t,r).then(function(a){return n.parse(a,{originalUrl:r,wrapperSequence:o,wrapperDepth:t,parentAdSequence:e.sequence||e.fallbackAdSequence}).then(function(t){if(delete e.nextWrapperURL,0===t.length)return e.creatives=[],i(e);t.forEach(function(t){t&&s.parserUtils.mergeWrapperAdData(t,e)}),i(t)})}).catch(function(t){e.errorCode=301,e.errorMessage=t.message,i(e)})})},t.prototype.completeWrapperResolving=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 r=e.ads[t];(r.errorCode||0===r.creatives.length)&&(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),e.ads.splice(t,1))}},t}(a.EventEmitter);t.VASTParser=p},27294:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.urlHandler=void 0;var n=r(82664),i=r(13769),o=r(2860);t.urlHandler={get:function(e,t,r){return r||("function"==typeof t&&(r=t),t={}),"undefined"==typeof window||null===window?i.nodeURLHandler.get(e,t,r):o.XHRURLHandler.supported()?o.XHRURLHandler.get(e,t,r):n.flashURLHandler.supported()?n.flashURLHandler.get(e,t,r):r(new Error("Current context is not supported by any of the default URLHandlers. Please provide a custom URLHandler"))}}},82664:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.flashURLHandler=void 0,t.flashURLHandler={get:function(e,t,r){var n="function"==typeof window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLDOM"):void 0;if(!n)return r(new Error("FlashURLHandler: Microsoft.XMLDOM format not supported"));n.async=!1;var i=i();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),r(null,n)}},supported:function(){return!!function(){var e;return window.XDomainRequest&&(e=new XDomainRequest),e}()}}},13769:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.nodeURLHandler=void 0,t.nodeURLHandler={get:function(e,t,r){r(new Error("Please bundle the library for node to use the node urlHandler"))}}},2860:function(e,t){function r(){try{var e=new window.XMLHttpRequest;return"withCredentials"in e?e:null}catch(e){return console.log("Error in XHRURLHandler support check:",e),null}}Object.defineProperty(t,"__esModule",{value:!0}),t.XHRURLHandler=void 0,t.XHRURLHandler={get:function(e,t,n){if("https:"===window.location.protocol&&0===e.indexOf("http://"))return n(new Error("XHRURLHandler: Cannot go from HTTPS to HTTP."));try{var i=r();i.open("GET",e),i.timeout=t.timeout||0,i.withCredentials=t.withCredentials||!1,i.overrideMimeType&&i.overrideMimeType("text/xml"),i.onreadystatechange=function(){4===i.readyState&&(200===i.status?n(null,i.responseXML):n(new Error("XHRURLHandler: ".concat(i.statusText))))},i.send()}catch(e){n(new Error("XHRURLHandler: Unexpected error"))}},supported:function(){return!!r()}}},1100:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Storage=void 0;var r=null,n={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}},i=function(){function e(e){this.storage=this.initStorage(e)}return e.prototype.initStorage=function(e){if(r&&("undefined"==typeof window||null===window||Object.getPrototypeOf(r)!==window.Storage.prototype||e))return r;try{r="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){r=null}return r&&e&&!this.isStorageDisabled(r)||(r=n).clear(),r},e.prototype.isStorageDisabled=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},e.prototype.getItem=function(e){return this.storage.getItem(e)},e.prototype.setItem=function(e,t){return this.storage.setItem(e,t)},e.prototype.removeItem=function(e){return this.storage.removeItem(e)},e.prototype.clear=function(){return this.storage.clear()},e}();t.Storage=i},11417:function(e,t){function r(e,t){void 0===t&&(t={});var r=[];t.ASSETURI&&(t.ASSETURI=n(t.ASSETURI)),t.CONTENTPLAYHEAD&&(t.CONTENTPLAYHEAD=n(t.CONTENTPLAYHEAD)),t.ERRORCODE&&!/^[0-9]{3}$/.test(t.ERRORCODE)&&(t.ERRORCODE=900),t.CACHEBUSTING=i(Math.round(1e8*Math.random()).toString()),t.TIMESTAMP=n((new Date).toISOString()),t.RANDOM=t.random=t.CACHEBUSTING;for(var o=0,a=e;o<a.length;o++){var s=a[o];if("string"==typeof s){for(var l in t){var u=t[l],c="[".concat(l,"]"),d="%%".concat(l,"%%");s=(s=s.replace(c,u)).replace(d,u)}r.push(s)}}return r}function n(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%".concat(e.charCodeAt(0).toString(16))})}function i(e){return e.length<8?o(0,8-e.length,!1).map(function(e){return"0"}).join("")+e:e}function o(e,t,r){for(var n=[],i=e<t,o=r?i?t+1:t-1:t,a=e;i?a<o:a>o;i?a++:a--)n.push(a);return n}Object.defineProperty(t,"__esModule",{value:!0}),t.util=void 0,t.util={track:function(e,t){r(e,t).forEach(function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:r,encodeURIComponentRFC3986:n,leftpad:i,range:o,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce(function(t,r){return t.concat(Array.isArray(r)?e(r):r)},[])}}},6036:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.VASTClient=void 0;var n=r(1100),i=r(29902),o=function(){function e(e){e=e||{},this.cappingFreeLunch=e.cappingFreeLunch||0,this.cappingMinimumTimeInterval=e.cappingMinimumTimeInterval||0,this.defaultOptions={withCredentials:!1,timeout:0},this.vastParser=new i.VASTParser;var t=null==e.allowUsingBrowserStorageApi||e.allowUsingBrowserStorageApi;this.storage=e.customStorage||new n.Storage(t),void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}return e.prototype.getParser=function(){return this.vastParser},Object.defineProperty(e.prototype,"lastSuccessfulAd",{get:function(){return this.storage.getItem("vast-client-last-successful-ad")},set:function(e){this.storage.setItem("vast-client-last-successful-ad",e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalCalls",{get:function(){return this.storage.getItem("vast-client-total-calls")},set:function(e){this.storage.setItem("vast-client-total-calls",e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalCallsTimeout",{get:function(){return this.storage.getItem("vast-client-total-calls-timeout")},set:function(e){this.storage.setItem("vast-client-total-calls-timeout",e)},enumerable:!1,configurable:!0}),e.prototype.hasRemainingAds=function(){return this.vastParser.remainingAds.length>0},e.prototype.getNextAds=function(e){return this.vastParser.getRemainingAds(e)},e.prototype.get=function(e,t){var r=this;void 0===t&&(t={});var n=Date.now();return(t=Object.assign(this.defaultOptions,t)).hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<n?(this.totalCalls=1,this.totalCallsTimeout=n+36e5):this.totalCalls++,new Promise(function(i,o){if(r.cappingFreeLunch>=r.totalCalls)return o(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(r.totalCalls,"/").concat(r.cappingFreeLunch)));var a=n-r.lastSuccessfulAd;if(a<0)r.lastSuccessfulAd=0;else if(a<r.cappingMinimumTimeInterval)return o(new Error("VAST call canceled – (".concat(r.cappingMinimumTimeInterval,")ms minimum interval reached")));r.vastParser.getAndParseVAST(e,t).then(function(e){return i(e)}).catch(function(e){return o(e)})})},e}();t.VASTClient=o},71076:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.VASTResponse=void 0;var r=function(){return function(){this.ads=[],this.errorURLTemplates=[]}}();t.VASTResponse=r}},function(e){return function(){return e(7581)}()}])});
|
|
18
18
|
})();
|