/*! * artplayer-plugin-vast.js v1.1.0 * Github: https://github.com/zhw2590582/ArtPlayer * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ !function(e,t,i,n,r){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof s[n]&&s[n],a=o.i||{},u=o.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,i){if(!u[t]){if(!e[t]){if(r[t])return r[t];var a="function"==typeof s[n]&&s[n];if(!i&&a)return a(t,!0);if(o)return o(t,!0);if(d&&"string"==typeof t)return d(t);var h=Error("Cannot find module '"+t+"'");throw h.code="MODULE_NOT_FOUND",h}f.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},f.cache={};var c=u[t]=new l.Module(t);e[t][0].call(c.exports,f,c,c.exports,s)}return u[t].exports;function f(e){var t=f.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],s=l(n);"*"===t?Object.keys(s).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return s[e]}})}):"*"===r?Object.defineProperty(i,t,{enumerable:!0,value:s}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===r?s.__esModule?s.default:s:s[r]}})}),i}return l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=d,this.exports={}},l.modules=e,l.cache=u,l.parent=o,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=a,l.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(l,"root",{get:function(){return s[n]}}),s[n]=l;for(var h=0;htypeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({cVeZd:[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:u}=i;await (0,s.loadImaSdk)();let d=window.google.ima,l=new d.AdsRenderingSettings;l.restoreCustomPlaybackStateOnAdBreakComplete=!0,l.enablePreloading=!0;let h=new(0,s.PlayerOptions),c=!1,f=null,p=null;function v(){let e;return f?f:((e=r("div")).id=`art-vast-${Date.now()}`,o(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),p=e,u.appendChild(p),(f=new(0,s.Player)(d,a,p,l,h)).addEventListener("AdContentPauseRequested",()=>{c=!0,p.style.display="block"}),f.addEventListener("AdContentResumeRequested",()=>{c=!1,p.style.display="none"}),f.addEventListener("AdStarted",()=>{c=!0,p.style.display="block"}),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,t={}){if(c)return;f||v();let i=new d.AdsRequest;for(let n in i.adTagUrl=e,t)i[n]=t[n];f.playAds(i)},playRes:function(e,t={}){if(c)return;f||v();let i=new d.AdsRequest;for(let n in i.adsResponse=e,t)i[n]=t[n];f.playAds(i)},init:v,ima:d,adsRenderingSettings:l,playerOptions:h,get imaPlayer(){return f},get container(){return p}}),{name:"artplayerPluginVast",destroy:function(){f?.destroy&&f.destroy(),p?.parentNode&&p.parentNode.removeChild(p),p=null,f=null}}}}"u">typeof window&&(window.artplayerPluginVast=o)},{"@glomex/vast-ima-player":"1iE81","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"1iE81":[function(e,t,i,n){var r,s,o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i),o.export(i,"Player",()=>ed),o.export(i,"PlayerError",()=>L),o.export(i,"PlayerEvent",()=>M),o.export(i,"PlayerOptions",()=>j),o.export(i,"loadImaSdk",()=>d);var a=null,u=function(){a=null},d=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(u).catch(u),a)};function l(e,t){for(var i=0;ie.length)&&(t=e.length);for(var i=0,n=Array(t);i-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,q)[q]=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,Y)[Y]=!1,O(this,X)[X]=!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,H)[H]&&(O(this,H)[H].removeEventListener(O(this,B)[B].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),O(this,H)[H].removeEventListener(O(this,B)[B].AdErrorEvent.Type.AD_ERROR,this.l,!1),O(this,H)[H].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,H)[H])||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,H)[H])||i.destroy(),O(this,Y)[Y]=!1,O(this,J)[J]=!1,O(this,X)[X]=!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=.5&&(this.dispatchEvent(new T(M.MEDIA_IMPRESSION)),O(this,Y)[Y]=!0)}if("play"!==e.type||O(this,X)[X]||O(this,$)[$]||(this.dispatchEvent(new T(M.MEDIA_START)),O(this,X)[X]=!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,H)[H].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,q)[q]=r,this.R()}O(this,$)[$]&&"volumechange"!==e.type||this.dispatchEvent(new T(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,Z)[Z]=n;break;case i.Type.AD_BREAK_READY:this.C(),O(this,en)[en]?(O(this,en)[en]({ad:O(this,Z)[Z],adBreakTime:e.getAdData().adBreakTime,start:function(){t.M(),O(t,en)[en]=void 0},startWithoutReset:function(){t.M()}}),O(this,Z)[Z]=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 u=e.getAdData();O(this,en)[en]?O(this,en)[en]({start:function(){t.I(),O(t,en)[en]=void 0},startWithoutReset:function(){t.I()}}):u.adError&&!O(this,K)[K]&&this.I();break;case i.Type.VOLUME_CHANGED:var d=O(this,F)[F].getVolume();d>0&&(O(this,ea)[ea]=d)}},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),M[e]){var n=["LOG","AD_PROGRESS"].indexOf(e)>-1;i.dispatchEvent(new T(M[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,q)[q],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 L(e.message))}},i.M=function(){if(O(this,X)[X]||(this.dispatchEvent(new T(M.MEDIA_START)),O(this,X)[X]=!0),O(this,F)[F])try{O(this,F)[F].start()}catch(e){this.j(new L(e.message))}else this.I()},i.T=function(){var e=this;setTimeout(function(){O(e,Y)[Y]=!1,O(e,X)[X]=!1,O(e,J)[J]=!1,e.dispatchEvent(new T(M.MEDIA_STOP))},1)},i.v=function(e){for(var t,i=function(e){var t="u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e){if(e){if("string"==typeof e)return A(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?A(e,void 0):void 0}}(e))){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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,q)[q]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(O(this,G)[G]=n.contentBoxSize.inlineSize,O(this,q)[q]=n.contentBoxSize.blockSize):(O(this,G)[G]=n.contentRect.width,O(this,q)[q]=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,q)[q]?this.resizeAd(O(this,G)[G],O(this,q)[q]):(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,q)[q])}},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 T("pause"))):(this.p().then(function(){}).catch(function(){e.dispatchEvent(new T("pause"))}),this.dispatchEvent(new T("play")),this.dispatchEvent(new T(M.MEDIA_RESUMED))),O(this,eo)[eo]=!1)},i.B=function(e){var t=e.getError(),i=new L(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 T(M.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()},h(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":"loqXi"}],loqXi:[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})}},{}]},["cVeZd"],"cVeZd","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("cVeZd");export{e as default};