mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
- Created a new documentation file for the danmuku plugin with code examples. - Added a comprehensive guide for language settings, including default languages, importing languages, adding new languages, and modifying existing languages. - Updated the i18n documentation to reflect changes in language handling and provide code snippets for implementation.
8 lines
25 KiB
JavaScript
8 lines
25 KiB
JavaScript
|
|
/*!
|
|
* artplayer-plugin-vast.js v1.0.2
|
|
* Github: https://github.com/zhw2590582/ArtPlayer
|
|
* (c) 2017-2025 Harvey Zack
|
|
* Released under the MIT License.
|
|
*/
|
|
!function(e,t,i,n,r,s,o,a){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof d[n]&&d[n],h=u.i||{},l=u.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,i){if(!l[t]){if(!e[t]){if(r[t])return r[t];var s="function"==typeof d[n]&&d[n];if(!i&&s)return s(t,!0);if(u)return u(t,!0);if(c&&"string"==typeof t)return c(t);var o=Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}h.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},h.cache={};var a=l[t]=new f.Module(t);e[t][0].call(a.exports,h,a,a.exports,d)}return l[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=l,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=h,f.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(f,"root",{get:function(){return d[n]}}),d[n]=f;for(var p=0;p<t.length;p++)f(t[p]);if(i){var v=f(i);"object"==typeof exports&&"undefined"!=typeof module?module.exports=v:"function"==typeof define&&define.amd&&define(function(){return v})}}({dwHLV:[function(e,t,i,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"default",()=>o);var s=e("@glomex/vast-ima-player");function o(e){return async t=>{let{template:i,constructor:n}=t,{createElement:r,setStyles:o}=n.utils,{$video:a,$player:d}=i;await (0,s.loadImaSdk)();let u=window.google.ima,h=new u.AdsRenderingSettings;h.restoreCustomPlaybackStateOnAdBreakComplete=!0,h.enablePreloading=!0;let l=new(0,s.PlayerOptions),c=!1,f=null,p=null;function v(){return f||(p=function(){let e=r("div");return e.id=`art-vast-${Date.now()}`,o(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),e}(),d.appendChild(p),(f=new(0,s.Player)(u,a,p,h,l)).addEventListener("AdStarted",()=>{c=!0,p.style.display="block"}),f.addEventListener("AdComplete",()=>{c=!1,p.style.display="none"}),f.addEventListener("AdError",e=>{console.error("VAST Ad Error:",e.detail),c=!1,p.style.display="none"})),f}return"function"==typeof e&&await e({art:t,playUrl:function(e){if(c)return;f||v();let t=new u.AdsRequest;t.adTagUrl=e,f.playAds(t)},playRes:function(e){if(c)return;f||v();let t=new u.AdsRequest;t.adsResponse=e,f.playAds(t)},ima:u,imaPlayer:f,get container(){return p}}),{name:"artplayerPluginVast",destroy:function(){f?.destroy&&f.destroy(),p?.parentNode&&p.parentNode.removeChild(p),p=null,f=null}}}}"undefined"!=typeof window&&(window.artplayerPluginVast=o)},{"@glomex/vast-ima-player":"edhqb","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],edhqb:[function(e,t,i,n){var r,s,o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i),o.export(i,"Player",()=>eu),o.export(i,"PlayerError",()=>j),o.export(i,"PlayerEvent",()=>L),o.export(i,"PlayerOptions",()=>M),o.export(i,"loadImaSdk",()=>u);var a=null,d=function(){a=null},u=function(){var e=window;return e.google&&e.google.ima?Promise.resolve(e.google.ima):a||((a=new Promise(function(e,t){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=e,i.onerror=t,document.body.appendChild(i)}).then(function(){return e.google.ima})).then(d).catch(d),a)};function h(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,i){return t&&h(e.prototype,t),i&&h(e,i),e}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,v(e,t)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t,i){return(y=!function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}()?function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&v(r,i.prototype),r}:Reflect.construct).apply(null,arguments)}function E(e){var t="function"==typeof Map?new Map:void 0;return(E=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return y(e,arguments,p(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),v(i,e)})(e)}function m(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}var b=0;function g(e){return"__private_"+b+++"_"+e}function O(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var w={};w.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(e){return t[e]=new t("").constructor[e],t;function t(e,t){t||(t={});var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail),i}}("prototype");var P,T,R=w.CustomEvent,S=g("mediaElement"),D=g("currentTime"),_=g("enabled"),C=function(){function e(e){Object.defineProperty(this,S,{writable:!0,value:void 0}),Object.defineProperty(this,D,{writable:!0,value:void 0}),Object.defineProperty(this,_,{writable:!0,value:void 0}),this.seeking=void 0,O(this,S)[S]=e,O(this,D)[D]=0,O(this,_)[_]=!1,this.seeking=!1,this.t=this.t.bind(this),this.i=this.i.bind(this),this.h=this.h.bind(this),this.enable()}var t=e.prototype;return t.i=function(){this.seeking=!0},t.h=function(){this.seeking=!1},t.t=function(){var e,t;this.seeking||null!=(e=O(this,S)[S])&&e.paused||(O(this,D)[D]=null==(t=O(this,S)[S])?void 0:t.currentTime)},t.enable=function(){var e,t,i;O(this,_)[_]||(null==(e=O(this,S)[S])||e.addEventListener("seeking",this.i),null==(t=O(this,S)[S])||t.addEventListener("seeked",this.h),null==(i=O(this,S)[S])||i.addEventListener("timeupdate",this.t),O(this,_)[_]=!0)},t.disable=function(){var e,t,i;O(this,_)[_]&&(null==(e=O(this,S)[S])||e.removeEventListener("seeking",this.i),null==(t=O(this,S)[S])||t.removeEventListener("seeked",this.h),null==(i=O(this,S)[S])||i.removeEventListener("timeupdate",this.t),O(this,_)[_]=!1)},t.play=function(){var e=this;return new Promise(function(t){var i;t(null==(i=O(e,S)[S])?void 0:i.play())})},t.pause=function(){var e;null==(e=O(this,S)[S])||e.pause()},t.reset=function(){O(this,D)[D]=0,O(this,_)[_]=!1,this.seeking=!1,this.enable()},t.destroy=function(){O(this,D)[D]=0,O(this,_)[_]=!1,this.seeking=!1,this.disable(),O(this,S)[S]=void 0},l(e,[{key:"enabled",get:function(){return O(this,_)[_]}},{key:"currentTime",get:function(){return O(this,D)[D]}},{key:"duration",get:function(){var e;return null==(e=O(this,S)[S])?void 0:e.duration}},{key:"muted",get:function(){var e;return null==(e=O(this,S)[S])?void 0:e.muted}},{key:"volume",get:function(){var e;return null==(e=O(this,S)[S])?void 0:e.volume}}]),e}(),k=function(){function e(){this.delegate=document.createDocumentFragment()}var t=e.prototype;return t.addEventListener=function(){this.delegate.addEventListener.apply(this.delegate,[].slice.call(arguments))},t.dispatchEvent=function(){return this.delegate.dispatchEvent.apply(this.delegate,[].slice.call(arguments))},t.removeEventListener=function(){return this.delegate.removeEventListener.apply(this.delegate,[].slice.call(arguments))},e}(),I=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"];(r=P||(P={})).MEDIA_START="MediaStart",r.MEDIA_IMPRESSION="MediaImpression",r.MEDIA_STOP="MediaStop",r.MEDIA_CUE_POINTS_CHANGE="MediaCuePointsChange",r.MEDIA_RESUMED="MediaResumed",(s=T||(T={})).AD_ERROR="AdError",s.AD_BUFFERING="AdBuffering",s.LOADED="AdLoaded",s.IMPRESSION="AdImpression",s.STARTED="AdStarted",s.FIRST_QUARTILE="AdFirstQuartile",s.MIDPOINT="AdMidpoint",s.THIRD_QUARTILE="AdThirdQuartile",s.AD_PROGRESS="AdProgress",s.COMPLETE="AdComplete",s.CLICK="AdClick",s.PAUSED="AdPaused",s.RESUMED="AdResumed",s.SKIPPED="AdSkipped",s.SKIPPABLE_STATE_CHANGED="AdSkippableStateChanged",s.VOLUME_CHANGED="AdVolumeChanged",s.VOLUME_MUTED="AdMuted",s.AD_METADATA="AdMetadata",s.AD_BREAK_READY="AdBreakReady",s.CONTENT_PAUSE_REQUESTED="AdContentPauseRequested",s.CONTENT_RESUME_REQUESTED="AdContentResumeRequested",s.ALL_ADS_COMPLETED="AdAllAdsCompleted",s.DURATION_CHANGE="AdDurationChange",s.INTERACTION="AdInteraction",s.LINEAR_CHANGED="AdLinearChanged",s.LOG="AdLog",s.USER_CLOSE="AdUserClose",s.AD_CAN_PLAY="AdCanPlay",s.EXPANDED_CHANGED="AdExpandedChanged",s.VIEWABLE_IMPRESSION="AdViewableImpression";var L=c({},T,P),M=function(){this.disableCustomPlaybackForIOS10Plus=!1,this.autoResize=!0,this.clickTrackingElement=void 0},j=function(e){function t(){var t;return(t=e.call.apply(e,[this].concat([].slice.call(arguments)))||this).errorCode=void 0,t.innerError=void 0,t.type=void 0,t.vastErrorCode=void 0,t}return f(t,e),t}(E(Error));j.ERROR_CODE_ADS_MANAGER_LOADED_TIMEOUT=9e3,j.ERROR_CODE_REQUEST_ADS_TIMEOUT=9001;var N=g("mediaElement"),x=g("adElement"),U=g("customPlayhead"),z=g("adsRenderingSettings"),B=g("ima"),V=g("adDisplayContainer"),F=g("adsManager"),G=g("width"),H=g("height"),q=g("adsLoader"),W=g("playerOptions"),Q=g("resizeObserver"),K=g("currentAd"),Y=g("loadedAd"),$=g("mediaStartTriggered"),X=g("mediaImpressionTriggered"),Z=g("mediaInActivation"),J=g("customPlaybackTimeAdjustedOnEnded"),ee=g("cuePoints"),et=g("adCurrentTime"),ei=g("adDuration"),en=g("startAdCallback"),er=g("adsManagerLoadedTimeout"),es=g("requestAdsTimeout"),eo=g("wasExternallyPaused"),ea=g("lastNonZeroAdVolume"),ed=g("activatePromise"),eu=function(e){function t(t,i,n,r,s){void 0===r&&(r=new t.AdsRenderingSettings),void 0===s&&(s=new M),Object.defineProperty(m(o=e.call(this)||this),N,{writable:!0,value:void 0}),Object.defineProperty(m(o),x,{writable:!0,value:void 0}),Object.defineProperty(m(o),U,{writable:!0,value:void 0}),Object.defineProperty(m(o),z,{writable:!0,value:void 0}),Object.defineProperty(m(o),B,{writable:!0,value:void 0}),Object.defineProperty(m(o),V,{writable:!0,value:void 0}),Object.defineProperty(m(o),F,{writable:!0,value:void 0}),Object.defineProperty(m(o),G,{writable:!0,value:void 0}),Object.defineProperty(m(o),H,{writable:!0,value:void 0}),Object.defineProperty(m(o),q,{writable:!0,value:void 0}),Object.defineProperty(m(o),W,{writable:!0,value:void 0}),Object.defineProperty(m(o),Q,{writable:!0,value:void 0}),Object.defineProperty(m(o),K,{writable:!0,value:void 0}),Object.defineProperty(m(o),Y,{writable:!0,value:void 0}),Object.defineProperty(m(o),$,{writable:!0,value:!1}),Object.defineProperty(m(o),X,{writable:!0,value:!1}),Object.defineProperty(m(o),Z,{writable:!0,value:!1}),Object.defineProperty(m(o),J,{writable:!0,value:!1}),Object.defineProperty(m(o),ee,{writable:!0,value:[]}),Object.defineProperty(m(o),et,{writable:!0,value:void 0}),Object.defineProperty(m(o),ei,{writable:!0,value:void 0}),Object.defineProperty(m(o),en,{writable:!0,value:void 0}),Object.defineProperty(m(o),er,{writable:!0,value:void 0}),Object.defineProperty(m(o),es,{writable:!0,value:void 0}),Object.defineProperty(m(o),eo,{writable:!0,value:!1}),Object.defineProperty(m(o),ea,{writable:!0,value:1}),Object.defineProperty(m(o),ed,{writable:!0,value:Promise.resolve()}),O(m(o),N)[N]=i,O(m(o),x)[x]=n,O(m(o),B)[B]=t,O(m(o),W)[W]=s,O(m(o),z)[z]=r,O(m(o),z)[z].restoreCustomPlaybackStateOnAdBreakComplete=!0,s.disableCustomPlaybackForIOS10Plus&&!O(m(o),N)[N].hasAttribute("playsinline")&&O(m(o),N)[N].setAttribute("playsinline",""),O(m(o),B)[B].settings.setDisableCustomPlaybackForIOS10Plus(s.disableCustomPlaybackForIOS10Plus),O(m(o),U)[U]=new C(O(m(o),N)[N]),o.o=o.o.bind(m(o)),I.forEach(function(e){O(m(o),N)[N].addEventListener(e,o.o)}),o.u=o.u.bind(m(o)),o.l=o.l.bind(m(o));var o,a=O(m(o),N)[N],d=a.offsetHeight,u=a.offsetWidth;return O(m(o),G)[G]=u,O(m(o),H)[H]=d,s.autoResize&&window.ResizeObserver&&(O(m(o),Q)[Q]=new window.ResizeObserver(function(e){return o.v(e)}),O(m(o),Q)[Q].observe(O(m(o),N)[N])),o}f(t,e);var i=t.prototype;return i.activate=function(){var e=this;if(!O(this,$)[$]&&!O(this,Z)[Z]&&(O(this,Z)[Z]=!0,O(this,N)[N].paused)){var t=function(){return O(e,N)[N].pause(),new Promise(function(t){setTimeout(function(){O(e,Z)[Z]=!1,t()},1)})};O(this,ed)[ed]=new Promise(function(t){return t(O(e,N)[N].play())}).then(t).catch(t)}},i.playAds=function(e){this.m(e)},i.loadAds=function(e,t){this.m(e,!1,t)},i.p=function(){var e=this;return O(this,ed)[ed].then(function(){return new Promise(function(t){return t(O(e,N)[N].play())})})},i.m=function(e,t,i){var n=this;void 0===t&&(t=!0),this.reset(),this.O(),O(this,B)[B].settings.setAutoPlayAdBreaks(t),O(this,N)[N].ended&&(O(this,U)[U].reset(),O(this,N)[N].currentTime=0),O(this,en)[en]=i,e.linearAdSlotWidth=O(this,G)[G],e.linearAdSlotHeight=O(this,H)[H],e.nonLinearAdSlotWidth=O(this,G)[G],e.nonLinearAdSlotHeight=O(this,H)[H],null==e.contentDuration&&(e.contentDuration=-3),O(this,er)[er]=window.setTimeout(function(){var e=new j("No adsManagerLoadedEvent within 5000ms.");e.errorCode=j.ERROR_CODE_ADS_MANAGER_LOADED_TIMEOUT,n.j(e)},5e3),O(this,es)[es]=window.setTimeout(function(){var e=new j("No response for ads-request within 10000ms.");e.errorCode=j.ERROR_CODE_REQUEST_ADS_TIMEOUT,n.j(e)},1e4),O(this,q)[q].requestAds(e)},i.O=function(){O(this,V)[V]=new(O(this,B))[B].AdDisplayContainer(O(this,x)[x],O(this,W)[W].disableCustomPlaybackForIOS10Plus?void 0:O(this,N)[N],O(this,W)[W].clickTrackingElement),O(this,q)[q]=new(O(this,B))[B].AdsLoader(O(this,V)[V]),O(this,q)[q].addEventListener(O(this,B)[B].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),O(this,q)[q].addEventListener(O(this,B)[B].AdErrorEvent.Type.AD_ERROR,this.l,!1)},i.skipAd=function(){O(this,F)[F]&&O(this,F)[F].skip()},i.discardAdBreak=function(){O(this,F)[F]&&O(this,F)[F].discardAdBreak()},i.play=function(){var e=this;O(this,eo)[eo]=!1,!O(this,U)[U].enabled&&O(this,F)[F]?O(this,F)[F].resume():O(this,er)[er]||this.p().then(function(){}).catch(function(){e.dispatchEvent(new R("pause"))})},i.pause=function(){O(this,eo)[eo]=!0,!O(this,U)[U].enabled&&O(this,F)[F]?O(this,F)[F].pause():O(this,N)[N].pause()},i.g=function(e){O(this,ee)[ee]=[].concat(e),this.dispatchEvent(new R(L.MEDIA_CUE_POINTS_CHANGE,{detail:{cuePoints:[].concat(O(this,ee)[ee])}}))},i.A=function(e){var t=this.cuePoints.indexOf(e);t>-1&&(O(this,ee)[ee].splice(t,1),this.g(O(this,ee)[ee]))},i.resizeAd=function(e,t){O(this,G)[G]=e,O(this,H)[H]=t,O(this,F)[F]&&O(this,F)[F].resize(e,t,this.k()),O(this,x)[x].style.width=e+"px",O(this,x)[x].style.height=t+"px"},i.reset=function(e){void 0===e&&(e=!1),e&&(O(this,X)[X]=!1,O(this,$)[$]=!1,O(this,J)[J]=!1),this.C(),O(this,ee)[ee]=[],O(this,eo)[eo]=!1,O(this,en)[en]=void 0,O(this,F)[F]&&O(this,F)[F].destroy(),O(this,F)[F]=void 0,O(this,B)[B].settings.setAutoPlayAdBreaks(!0),e&&this.P(),O(this,x)[x].style.display="none"},i.P=function(){O(this,q)[q]&&(O(this,q)[q].removeEventListener(O(this,B)[B].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),O(this,q)[q].removeEventListener(O(this,B)[B].AdErrorEvent.Type.AD_ERROR,this.l,!1),O(this,q)[q].destroy()),O(this,V)[V]&&O(this,V)[V].destroy()},i.destroy=function(){var e,t,i,n,r=this;this.reset(!0),O(this,U)[U].destroy(),I.forEach(function(e){O(r,N)[N].removeEventListener(e,r.o)}),null==(e=O(this,q)[q])||e.removeEventListener(O(this,B)[B].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(t=O(this,V)[V])||t.destroy(),null==(i=O(this,q)[q])||i.destroy(),O(this,X)[X]=!1,O(this,J)[J]=!1,O(this,$)[$]=!1,null==(n=O(this,Q)[Q])||n.disconnect()},i.isCustomPlaybackUsed=function(){return!1===O(this,B)[B].settings.getDisableCustomPlaybackForIOS10Plus()&&!O(this,x)[x].querySelector("video")},i.C=function(){window.clearTimeout(O(this,er)[er]),window.clearTimeout(O(this,es)[es]),O(this,er)[er]=void 0,O(this,es)[es]=void 0,O(this,K)[K]=void 0,O(this,et)[et]=void 0,O(this,ei)[ei]=void 0,O(this,x)[x].style.display="none",O(this,x)[x].classList.remove("nonlinear"),O(this,F)[F]&&this.R()},i.o=function(e){var t=this;if(O(this,U)[U].enabled||"volumechange"===e.type){if("timeupdate"===e.type){if(O(this,F)[F]){var i=O(this,F)[F].getCuePoints().filter(function(e){return e>=0&&e<O(t,U)[U].currentTime}).pop();this.A(i)}!O(this,X)[X]&&O(this,$)[$]&&O(this,N)[N].currentTime>=.5&&(this.dispatchEvent(new R(L.MEDIA_IMPRESSION)),O(this,X)[X]=!0)}if("play"!==e.type||O(this,$)[$]||O(this,Z)[Z]||(this.dispatchEvent(new R(L.MEDIA_START)),O(this,$)[$]=!0),"ended"===e.type&&(this.isCustomPlaybackUsed()&&O(this,N)[N].currentTime===O(this,N)[N].duration&&O(this,ee)[ee].indexOf(-1)>-1&&(O(this,N)[N].currentTime=O(this,N)[N].duration-1e-5,O(this,J)[J]=!0),O(this,q)[q].contentComplete(),O(this,F)[F]||this.T()),!window.ResizeObserver&&O(this,W)[W].autoResize&&"loadedmetadata"===e.type){var n=O(this,N)[N],r=n.offsetHeight,s=n.offsetWidth;O(this,G)[G]=s,O(this,H)[H]=r,this.R()}O(this,Z)[Z]&&"volumechange"!==e.type||this.dispatchEvent(new R(e.type))}},i.S=function(e){var t=this,i=O(this,B)[B].AdEvent;switch(e.type){case i.Type.LOADED:var n=e.getAd();O(this,en)[en]&&0===O(this,ee)[ee].length?O(this,en)[en]({ad:n,start:function(){t.M(),O(t,en)[en]=void 0},startWithoutReset:function(){t.M()}}):O(this,Y)[Y]=n;break;case i.Type.AD_BREAK_READY:this.C(),O(this,en)[en]?(O(this,en)[en]({ad:O(this,Y)[Y],adBreakTime:e.getAdData().adBreakTime,start:function(){t.M(),O(t,en)[en]=void 0},startWithoutReset:function(){t.M()}}),O(this,Y)[Y]=void 0):this.M();break;case i.Type.STARTED:var r=O(this,K)[K]=e.getAd();r.getAdPodInfo().getAdPosition()>1&&O(this,F)[F].setVolume(O(this,F)[F].getVolume()),O(this,x)[x].classList.remove("nonlinear"),this.R(),r.isLinear()?(O(this,U)[U].disable(),O(this,ei)[ei]=r.getDuration(),O(this,et)[et]=0):(O(this,x)[x].classList.add("nonlinear"),this.I()),O(this,x)[x].style.display="",O(this,eo)[eo]&&(O(this,eo)[eo]=!1,O(this,F)[F].pause());break;case i.Type.ALL_ADS_COMPLETED:if(O(this,J)[J])return;this.isCustomPlaybackUsed()&&O(this,K)[K]&&-1!==O(this,K)[K].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),O(this,K)[K]=e.getAd(),O(this,x)[x].style.display="",O(this,N)[N].pause(),this.R(),O(this,K)[K]&&this.A(O(this,K)[K].getAdPodInfo().getTimeOffset()),O(this,F)[F].setVolume(O(this,N)[N].muted?0:O(this,N)[N].volume),O(this,U)[U].disable(),O(this,ei)[ei]=O(this,K)[K].getDuration(),O(this,et)[et]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var s=!!O(this,K)[K];if(s){var o=O(this,F)[F].getVolume();O(this,N)[N].muted=0===o,O(this,N)[N].volume=O(this,ea)[ea]}O(this,J)[J]&&(O(this,N)[N].currentTime=O(this,N)[N].duration+1,O(this,J)[J]=!1),O(this,N)[N].ended?(this.reset(),this.T()):this.C(),s&&(O(this,eo)[eo]=!1,this.I());break;case i.Type.AD_METADATA:this.g(O(this,F)[F].getCuePoints()),-1===O(this,ee)[ee].indexOf(0)&&(O(this,en)[en]?O(this,en)[en]({start:function(){t.I(),O(t,en)[en]=void 0},startWithoutReset:function(){t.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=e.getAdData();O(this,et)[et]=a.currentTime,O(this,ei)[ei]=a.duration;break;case i.Type.LOG:var d=e.getAdData();O(this,en)[en]?O(this,en)[en]({start:function(){t.I(),O(t,en)[en]=void 0},startWithoutReset:function(){t.I()}}):d.adError&&!O(this,K)[K]&&this.I();break;case i.Type.VOLUME_CHANGED:var u=O(this,F)[F].getVolume();u>0&&(O(this,ea)[ea]=u)}},i.l=function(e){this.j(this.B(e))},i.u=function(e){var t,i=this,n=O(this,B)[B],r=n.AdEvent,s=n.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(O(this,er)[er]);var o=O(this,F)[F]=e.getAdsManager(O(this,U)[U],O(this,z)[z]);Object.keys(r.Type).forEach(function(e){o.addEventListener(r.Type[e],function(t){if(i.S(t),L[e]){var n=["LOG","AD_PROGRESS"].indexOf(e)>-1;i.dispatchEvent(new R(L[e],{detail:{ad:t.getAd()||O(i,K)[K],adData:n?t.getAdData():{}}}))}})}),o.addEventListener(s,function(e){return i.j(i.B(e))});try{o.init(O(this,G)[G],O(this,H)[H],this.k()),o.setVolume(O(this,N)[N].muted?0:O(this,N)[N].volume),null==(t=O(this,V)[V])||t.initialize(),O(this,en)[en]||this.M()}catch(e){this.j(new j(e.message))}},i.M=function(){if(O(this,$)[$]||(this.dispatchEvent(new R(L.MEDIA_START)),O(this,$)[$]=!0),O(this,F)[F])try{O(this,F)[F].start()}catch(e){this.j(new j(e.message))}else this.I()},i.T=function(){var e=this;setTimeout(function(){O(e,X)[X]=!1,O(e,$)[$]=!1,O(e,J)[J]=!1,e.dispatchEvent(new R(L.MEDIA_STOP))},1)},i.v=function(e){for(var t,i=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return A(e,void 0);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?A(e,void 0):void 0}}(e))){i&&(e=i);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(t=i()).done;){var n=t.value;n.contentBoxSize&&1===n.contentBoxSize.length?(O(this,G)[G]=n.contentBoxSize[0].inlineSize,O(this,H)[H]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(O(this,G)[G]=n.contentBoxSize.inlineSize,O(this,H)[H]=n.contentBoxSize.blockSize):(O(this,G)[G]=n.contentRect.width,O(this,H)[H]=n.contentRect.height)}this.R()},i.R=function(){if(O(this,W)[W].autoResize&&O(this,F)[F]){var e=O(this,K)[K],t=this.k();e&&!e.isLinear()?e&&(e.getWidth()>O(this,G)[G]||e.getHeight()>O(this,H)[H]?this.resizeAd(O(this,G)[G],O(this,H)[H]):(O(this,F)[F].resize(e.getWidth(),e.getHeight()+20,t),O(this,x)[x].style.width=e.getWidth()+"px",O(this,x)[x].style.height=e.getHeight()+20+"px")):this.resizeAd(O(this,G)[G],O(this,H)[H])}},i.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||O(this,N)[N].webkitDisplayingFullscreen?O(this,B)[B].ViewMode.FULLSCREEN:O(this,B)[B].ViewMode.NORMAL},i.I=function(){var e=this;O(this,x)[x].style.display="none",O(this,N)[N].ended||(O(this,U)[U].enable(),O(this,eo)[eo]?(O(this,N)[N].pause(),this.dispatchEvent(new R("pause"))):(this.p().then(function(){}).catch(function(){e.dispatchEvent(new R("pause"))}),this.dispatchEvent(new R("play")),this.dispatchEvent(new R(L.MEDIA_RESUMED))),O(this,eo)[eo]=!1)},i.B=function(e){var t=e.getError(),i=new j(t.getMessage());return i.type=t.getType(),i.errorCode=t.getErrorCode(),i.vastErrorCode=t.getVastErrorCode&&t.getVastErrorCode(),i.innerError=t.getInnerError(),i},i.j=function(e){var t=this;this.dispatchEvent(new R(L.AD_ERROR,{detail:{error:e}})),this.C(),O(this,en)[en]?O(this,en)[en]({start:function(){t.I(),O(t,en)[en]=void 0},startWithoutReset:function(){t.I()}}):this.I()},l(t,[{key:"volume",get:function(){return!O(this,U)[U].enabled&&O(this,F)[F]?O(this,F)[F].getVolume():O(this,N)[N].volume},set:function(e){!O(this,U)[U].enabled&&O(this,F)[F]&&O(this,F)[F].setVolume(e),O(this,N)[N].volume=e}},{key:"muted",get:function(){return!O(this,U)[U].enabled&&O(this,F)[F]?0===O(this,F)[F].getVolume():O(this,N)[N].muted},set:function(e){!O(this,U)[U].enabled&&O(this,F)[F]&&O(this,F)[F].setVolume(e?0:O(this,ea)[ea]),O(this,N)[N].muted=e}},{key:"currentTime",get:function(){return void 0!==O(this,et)[et]?O(this,et)[et]:O(this,N)[N].currentTime},set:function(e){O(this,U)[U].enabled&&(O(this,N)[N].currentTime=e)}},{key:"duration",get:function(){return void 0!==O(this,ei)[ei]?O(this,ei)[ei]:O(this,N)[N].duration}},{key:"cuePoints",get:function(){return[].concat(O(this,ee)[ee])}}]),t}(k)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,t,i,n){i.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},i.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.exportAll=function(e,t){return Object.keys(e).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})}),t},i.export=function(e,t,i){Object.defineProperty(e,t,{enumerable:!0,get:i})}},{}]},["dwHLV"],"dwHLV","parcelRequire4dc0",{}); |