ssl.p.jwpcdn.com
Open in
urlscan Pro
2a04:4e42:600::626
Public Scan
URL:
https://ssl.p.jwpcdn.com/player/v/8.34.5/googima.js
Submission: On July 26 via api from IT — Scanned from IT
Submission: On July 26 via api from IT — Scanned from IT
Form analysis
0 forms found in the DOMText Content
!function(){"use strict";const e="vast",t="googima",s="freewheel",i="playing",a="viewable",n="external",r=n,o="time",l="adBreakIgnored",d="__jwpseg__",h="instream",u="article",c={[[h]]:1,[["banner"]]:2,[[u]]:3,[["feed"]]:4,[["floating"]]:5,[["interstitial"]]:5,[["slider"]]:5},p="adError",g="adItem",m="adStarted",y="adSkipped",f="jw-flag-ads-vpaid",A="jw-flag-ads-vpaid-controls",v="-1",P="vmap",w="TYPE_API",b="TYPE_SCHEDULE",k="jw-flag-ads-googleima",E=(e,t)=>({begin:e._offSet,text:t,cueType:"ads",adId:e.adBreakId});class _{constructor(e,t,s,i){this.client=i,this.player=e,this.pluginConfig=t,this.div=s,this.utils=this.player.utils,this.playerConfig=this.player.getConfig(),this.playlistItemManager=null,this.playerKey=this.playerConfig.key,this.casting=!1,this.player.pauseAd=this.pauseAd.bind(this),this.player.skipAd=this.skipAd.bind(this),this.player.skipAdBreak=this.skipAdBreak.bind(this),this.destroyAdsManager=this.destroyAdsManager.bind(this),this.handleDependencyError=this.handleDependencyError.bind(this),this.sendCues=this.sendCues.bind(this)}lateInitAfterReady(){this.onReady();const e=this.player.getPlaylistItem();e&&this.onPlaylistItemCallback({item:e,index:this.player.getPlaylistIndex()})}onReady(){throw new Error("Not implemented.")}onPlaylistItemCallback(){throw new Error("Not implemented.")}destroyAdsManager(){this.playlistItemManager&&(this.playlistItemManager.destroy(),this.playlistItemManager=null)}handleDependencyError(e,t){this.destroyAdsManager(),this.player.off(null,null,this),this.client===s&&(this.player.playAd=this.utils.noop),this.player.trigger(p,{id:v,client:this.client,message:e,code:900,adErrorCode:t,tag:""})}pauseAd(e,t=null){this.playlistItemManager&&(e?this.playlistItemManager.pause(t||{}):this.playlistItemManager.resume(t||{}))}skipAd(){var e;null!=this&&null!=(e=this.playlistItemManager)&&e.skipAd&&this.playlistItemManager.skipAd()}skipAdBreak(){var e;null!=this&&null!=(e=this.playlistItemManager)&&e.skipAdBreak&&this.playlistItemManager.skipAdBreak()}sendCues(e,t){const s=e.getMidRolls(),i=[];e.preRoll&&i.push(E(e.preRoll,t)),s.length&&s.forEach((e=>{"nonlinear"!==e._type&&i.push(E(e,t))})),e.postRoll&&i.push(E(e.postRoll,t)),this.player.addCues(i)}resetCues(){const e=this.player.getCues().filter((e=>"ads"!==e.cueType));this.player.setCues(e)}}const M=function(e,t,s,i){if(0!==i.indexOf(e))return!1;const a=parseFloat(i.slice(e.length));return!(a<t||a>s)&&a},C=M.bind(null,"800000",10,90),I=M.bind(null,"900000",10,90),R=M.bind(null,"JWIAB",1,999),S=M.bind(null,"120321",10,90),j=M.bind(null,"120241",10,90),L=M.bind(null,"15010",1,698),T=["15020012","15020023","15020034"];var x=function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),t)};const B=/^[^:/?#]+:?\/\/[^/?#]+/,D=function(e,t){if(!e)return;if(!t)return e;let s,i="",a="";Object.keys(t).forEach((e=>{const s=t[e];i=`${i}${a}${e}=${s}`,a="&"}));const n=(e=>{if(e)return new URL(e,window.location)})(e),r=n.pathname;return n.searchParams.has("cust_params")?n.searchParams.set("cust_params",`${i}&${n.searchParams.getAll("cust_params")}`):n.searchParams.set("cust_params",i),s=n.toString(),0===e.indexOf("./")?s=`.${s.substring(s.indexOf(r))}`:0===e.indexOf("../")?s=`..${s.substring(s.indexOf(r))}`:0!==e.indexOf(`${n.protocol}`)||e.includes("://")?0===e.indexOf("//")?s=s.replace(n.protocol,""):0!==e.indexOf("//")&&0===e.indexOf("/")?s=s.substring(s.indexOf(r)):0!==e.indexOf("/")&&0===e.indexOf(n.pathname.substring(1))&&(s=s.substring(s.indexOf(r)+1)):s=s.replace("://",":"),s},O=e=>e?new URL(e).hostname:"",U=(e,t=document.location.search)=>{if(e)return new URLSearchParams(t).getAll(e)},q="hb_jwvb",V="hb_jwcr",N={[[q]]:"VIEWABILITY",[[V]]:"COMPLETION_RATE",[["hb_jwiab"]]:"IAB_CONTEXTUAL",[["hb_jwbs"]]:"BRAND_SAFETY"},H=[q,V],$=/^(https?:\/\/).*.(?:ampproject.org|bing-amp.com)\/(?:.\/)*(.*)\/amp.*$/,z=function(){if(!((e,t)=>{if(e)return new URLSearchParams(e).has(t)})(document.location.search,"isAMP"))return;const e=U("consentValue").join(),t=U("consentGdpr").join();return e||t?{gdprApplies:t,consentData:e}:void 0},Q=Date.now||function(){return(new Date).getTime()},W=e=>{const t=(e=>{let t=window;for(;t;){try{if(t.frames[e])break}catch(e){}t=t===window.top?null:t.parent}return t})(`${e}Locator`);return null!==t&&function(s,i,a,n){const r=Q(),o=t=>{let s=t?t.data:{};if("string"==typeof s)try{s=JSON.parse(s)}catch(e){s={}}const i=`${e}Return`;s[i]&&s[i].callId===r&&(removeEventListener("message",o),a(s[i].returnValue,s[i].success))};window.addEventListener("message",o,!1);const l={[[`${e}Call`]]:{command:s,callId:r,parameter:n,[[void 0!==n?"version":"parameter"]]:i}};t.postMessage(JSON.stringify(l),"*")}};let X=null,G={gdprApplies:!0,consentData:""};const J=function(e=1e3){return null===X&&(X=new Promise((e=>{const t=window.__tcfapi||W("__tcfapi");if(t)return t("getTCData",2,((t,s)=>{e(!1!==s?{gdprApplies:t.gdprApplies,consentData:t.tcString,addtlConsent:t.addtlConsent}:null)}));const s=window.__cmp||W("__cmp");if(s)return s("getConsentData",null,((t,s)=>{e(!1!==s?{gdprApplies:t.gdprApplies||t.isUserInEu,consentData:t.consentData}:null)}));const i=z();return e(i||{gdprApplies:!1,consentData:""})})).then((e=>(e&&(G=e),G)))),Promise.race([X,new Promise((t=>{setTimeout(t,e,G)}))])},F=function(e){const t=e.advertising;if(null!=t&&t.placement){const e=t.placement.toLowerCase();if(c[e])return c[e]}return c[null!=t&&t.outstream?u:h]},K=function(){const e=(t=document.referrer)&&null!==t.match(B)?function(e){const t=e.match($);return t&&t.length>1?`${t[1]}${t[2]}`:e}(document.referrer):"";var t;if(window.top!==window.self){try{return{url:window.top.location.href,domain:window.top.document.domain,referrer:e}}catch(e){}return{url:e,domain:O(e),referrer:""}}return{url:document.location.href,domain:document.domain,referrer:e}},Y=function(e,t,s=!0){if("start"===e||"0%"===e||s&&!e&&0!==e)return"pre";if("end"===e||"100%"===e)return"post";if("string"==typeof e&&("pre"===e||"post"===e||e.indexOf("%")>=0))return e;const i=t.seconds(e);return"number"==typeof i&&!isNaN(i)&&i},Z=function(e,t){const s=Y(e,t);return"pre"===s?0:"post"===s?-1:s},ee=function(e,t){const s=e.getPlugin("inference"),i=t.jwpseg_client_side,a=t.jwpseg||[];let n;if(!i||!i.length||!s)return a;try{n=s.predict(i,t)}catch(e){return t.jwpseg||[]}return[...Object.keys(n).filter((e=>n[e])),...a.filter((e=>-1===i.indexOf(e)))]},te=function(e){const t=[],s=[],i=[],a=[];let n=Boolean(e.some((e=>/^1/.test(String(e)))));for(let a of e){"string"!=typeof a&&(a=String(a));const e=C(a);if(e){t.push(e);continue}const r=S(a);if(r){t.push(r);continue}const o=I(a);if(o){s.push(o);continue}const l=j(a);if(l){s.push(l);continue}const d=R(a);if(d){i.push(d);continue}const h=L(a);h?i.push(h):T.includes(String(a))?n=!1:"JWBRSAFE"!==a||(n=!0)}if(n&&a.push(1),t.length||s.length||i.length||a.length){const e={hb_jwvb:t,hb_jwcr:s,hb_jwiab:i,hb_jwbs:a};return Object.keys(e).forEach((t=>{e[t]=[...new Set(e[t])]})),e}return null},se=function(e,t){t&&"object"==typeof t&&Object.keys(t).forEach((s=>{const i=t[s];if(!i||"object"!=typeof i)return;const a=function(e,t,s){if(s&&t&&t.length)return s.sendIsIncluded?`HAS_${N[e]||"SEGMENT"}`:s.sendMax&&H.includes(e)?t.reduce(((e,t)=>Math.max(e,t)),-1/0):void 0}(s,e[s],i);void 0!==a&&(e[s]=[a])}))},ie=function(e){const{player:t,item:s,tag:i,targetingConfig:a,enablePPS:n=!1}=e,r=ee(t,s);if(!r.length)return i;const o=te(r);if(!o)return i;se(o,a);const l=function(e){if(!e)return;const t=[];for(const s in e)x(e,s)&&e[s].length&&t.push(`${s}=${e[s]}`);return t.join("&")}(o),d=new URL(i),h=d.searchParams,u=h.getAll("cust_params").filter((e=>e)).join("&");let c;return!h.get("ppsj")&&n&&(c=(e=>{var t;if(null==e||null==(t=e.hb_jwiab)||!t.length)return null;const s={PublisherProvidedTaxonomySignals:[{taxonomy:"IAB_CONTENT_2_2",values:e.hb_jwiab.map(String)}]};return window.btoa(JSON.stringify(s))})(o)),u&&u.length>0?h.set("cust_params",`${u}&${l}`):h.set("cust_params",l),c&&h.set("ppsj",c),d.toString()},ae=e=>{if("true"===e)return!0;if("false"===e)return!1;const t=parseFloat(e);return isNaN(t)?e:t},ne=(e,t=!1)=>{const s=t?0===e.getPosition()&&"idle"===e.getState():0===e.getPosition();return e.isBeforePlay()||s?"pre":e.isBeforeComplete()||e.getPosition()===e.getDuration()?"post":"mid"};var re=function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),t)};const oe=/^((https?:)?\/\/)?(secure)?pubads\.g\.doubleclick\.net\/gampad\/ads\?[\S]*$/,le=function(e,t,s){return e.replace(t,s)},de=function(e,t){const s=Math.pow(10,t);return Math.round(e*s)/s},he=function(i,a,n,r,o,l={}){var h,u,c,p,g,m,y;if(!i)return i;const f=function(e,t){const s=e.getConfig(),i=e.getPlaylistItem()===t,a={playerHeight:e.getHeight()||s.height||"",playerWidth:e.getWidth()||s.width||"",itemDuration:i&&de(e.getDuration(),3)||"",integerDuration:i&&de(t.duration,0)||"",item:t,jwpseg:ee(e,t),placement:F(s),userAgent:navigator.userAgent},n=s.advertising?s.advertising.ampMacros:{};return Object.assign(a,n)}(a,n),A=K();let v=null;null!=n&&n.jwpseg&&(v=te(n.jwpseg));const P={viewability:(null==(h=v)||null==(u=h.hb_jwvb)?void 0:u.map((e=>encodeURIComponent(e))).join(","))||"",completion:(null==(c=v)||null==(p=c.hb_jwcr)?void 0:p.map((e=>encodeURIComponent(e))).join(","))||"",brandSafety:1===(null==(g=v)?void 0:g.hb_jwbs[0])?encodeURIComponent("Yes"):encodeURIComponent("No"),contextual:(null==(m=v)||null==(y=m.hb_jwiab)?void 0:y.map((e=>encodeURIComponent(e))).join(","))||""};-1!==i.indexOf(d)&&(l.jwpseg=f.jwpseg),i=le(i,"__random-number__",Math.random()*Math.pow(10,18)),i=le(i,"__timestamp__",(new Date).getTime()),i=le(i,"__page-url__",encodeURIComponent(f.pageUrl||A.url)),i=le(i,"__referrer__",encodeURIComponent(f.referrer||A.referrer)),i=le(i,"__player-height__",f.playerHeight),i=le(i,"__player-width__",f.playerWidth),i=le(i,"__item-duration__",f.itemDuration),i=le(i,"__integer-duration__",f.integerDuration),i=le(i,d,f.jwpseg),i=le(i,"__domain__",encodeURIComponent(f.domain||A.domain)),i=le(i,"__placement__",f.placement),i=le(i,"__device-ua__",encodeURIComponent(f.userAgent)),i=le(i,"__jw-viewability__",P.viewability),i=le(i,"__jw-completion__",P.completion),i=le(i,"__jw-brand-safety__",P.brandSafety),i=le(i,"__jw-contextual__",P.contextual),i=o.companion?le(i,"__companion-div__",o.companion.id):le(i,"__companion-div__","");const w=Object.keys(f).filter((e=>-1!==e.indexOf("item"))),b=w.map((e=>{const t=e.match(/item([\w]+?)(List)?$/);let s;return t&&(s=t[1].toLowerCase()),s}));let k=null;const E=/__item-([\w-]+?)(-list)?__/g,_=i;for(;null!==(k=E.exec(_));){const e=k[0],t=k[1],s=w[b.indexOf(t)];let a="";if(re(n,t)&&"string"==typeof n[t]||s){a=s?f[s]:n[t];const e=!1===o.truncateMacros?4096:1e3;a.length>e&&(a=a.substring(0,e));const i=k[2]?",":null;a=a.split(i).map(encodeURIComponent)}i=le(i,e,a)}if(r===s)return i;if(r===e){const e=a.getConfig().autostart?1:0,t=a.getMute()?1:0;i=function(e,t,s){return oe.test(e)&&(e=`${e}&vpa=${t}&vpmute=${s}`),e}(i,e,t)}if(r===t&&n.title&&-1===i.indexOf("vid_t=")){const e=n.title.substring(0,100).replace(/[^\x00-\x7F]/g,"");i+=`${function(e){return-1!==e.indexOf("?")?"&":"?"}(i)}vid_t=${encodeURIComponent(e)}`}return-1!==i.indexOf("__gdpr__")||-1!==i.indexOf("__gdpr_consent__")||-1!==i.indexOf("__addtl_consent__")?J().then((({gdprApplies:e,consentData:t,addtlConsent:s})=>(i=le(i,"__gdpr__",e?1:0),i=le(i,"__addtl_consent__",s||""),le(i,"__gdpr_consent__",t||"")))).catch((()=>i)):Promise.resolve(i)},ue=function(){},ce=function(e,t,s){let i=[];return e&&(i=e.getElementsByTagName(t),s&&i&&0===i.length&&(i=e.getElementsByTagName(`${s}:${t}`))),i},pe=function(e,t){return e?e.getAttribute(t):null},ge=function(e,t,s){e.push({message:t,code:1002,adErrorCode:70001,id:s})},me=function(){const e=new Error("No AdBreaks in VMAP");throw e.adErrorCode=60005,e},ye=function(e){if(e){const t=e.textContent||e.text;if(t)return t.trim()}return""},fe=function(e,t,s,i){let a=[];return e||t?(a=t.getElementsByTagNameNS?t.getElementsByTagNameNS(e,s):t.getElementsByTagName(`${i}:${s}`),a):a},Ae=function(e,t){if(e){const s=e.getElementsByTagName(t);if(s)return s[0]}return null};let ve=function(e){(e.indexOf("[REGULATIONS]")>=0||e.indexOf("[GDPRCONSENT]")>=0)&&(J().catch(ue),ve=ue)};const Pe=function(e,t){let s=pe(t,"event");if("progress"===s){s=`${s}_${pe(t,"offset")}`}!function(e,t,s){e[t]||(e[t]=[]),s&&(e[t].push(s),ve(s))}(e,s,ye(t))},we=function(e,t){if(!e)return null;const s=e.getElementsByTagName("Ad");if(!s.length)return null;const i={_offSet:t};if(1===s.length)i._adQueue=[s[0].textContent.trim()];else{i._pod=[];for(let e=0;e<s.length;e++)i._pod.push(s[e].textContent.trim())}return i},be=function(e,t,s){if(ce(e,"VMAP",P).length)return function(e,t,s){const i=[],a=ce(e,"VMAP",P);pe(a[0],"version")||ge(i,"VMAP Schema Error: version missing from VMAP tag",v);const n=ce(e,"AdBreak",P);n.length||me();const r=e.lookupNamespaceURI(P),o={};for(let e=0;e<n.length;e++){const t={},s={},a=n[e],d=pe(a,"timeOffset")||0,h=pe(a,"breakId"),u=pe(a,"breakType"),c=ce(a,"AdSource",P)[0],p=pe(c,"id"),g=ce(a,"AdTagURI",P)[0],m=ce(a,"VASTData",P)[0]||ce(a,"VASTAdData",P)[0],y=pe(g,"templateType"),f=ye(g),A=fe(r,a,"Tracking",P);if(u||ge(i,"VMAP Schema Error: missing breakType on AdBreak",h),m||y||ge(i,"VMAP Schema Error: missing templateType on AdBreak",h),d||ge(i,"VMAP Schema Error: missing timeOffset on AdBreak",h),t._type=u,t._vmap={id:p,breakid:h,timeoffset:d},m)t._adXML=(l=Ae(m,"VAST")).ownerDocument instanceof Document?l.outerHTML||(new XMLSerializer).serializeToString(l):null;else{if("vast2"!==y&&"vast3"!==y&&"vast4"!==y)continue;t._adQueue=[f],t._waterfallIndex=0}const v=[];if(A)for(let e=0;e<A.length;e++){Pe(s,A[e]);const t=pe(A[e],"event");v.push(t)}(v.indexOf("breakStart")<0||v.indexOf("breakEnd")<0||v.indexOf("error")<0)&&ge(i,"Tracking events are missing breakStart, breakEnd, or error for AdBreak",h),t._trackers=s,t._type=u;const w="number"==typeof d||"string"==typeof d;w&&!o[d]?(o[d]=t,o[d]._pod=t._adQueue?[...t._adQueue]:[]):w&&o[d]&&t._adQueue&&o[d]._pod.push(...t._adQueue)}var l;return Object.keys(o).forEach((e=>{const i=o[e];switch(i._pod&&i._pod.length<=1&&delete i._pod,e){case"start":i._offSet="pre",t.setPreRoll(i);break;case"100%":case"end":i._offSet="post",t.setPostRoll(i);break;default:if(/^#/.test(e))break;/^\d\d?(?:\.\d+)?%$/.test(e)?i._offSet=e:i._offSet=s.seconds(e),t.addMidRoll(i)}})),t.preRoll||t.midRolls.length||t.postRoll||me(),t.sort(null,!0),i}(e,t,s);if(ce(e,"Playlist",P).length)return function(e,t,s){const i=ce(e,"Playlist",P)[0],a=i.getElementsByTagName("Preroll")[0],n=i.getElementsByTagName("Postroll")[0],r=we(a,"pre"),o=we(n,"post");r&&t.setPreRoll(r),o&&t.setPostRoll(o);const l=i.getElementsByTagName("Midroll");for(let e=0;e<l.length;e++){const i=l[e],a=s.seconds(i.getAttribute("timeOffset")),n=we(i,a);t.addMidRoll(n)}return[]}(e,t,s);throw new Error("No VMAP tag in response")},ke=function(e){e.onload=e.onreadystatechange=e.onerror=null,"abort"in e&&e.abort()},Ee=function(e,t,s){if(null===e)return;let i;return Object.keys(e).forEach((t=>{const s=e[t];i=i||{},i[t]="_adQueue"===t||"_pod"===t?s.slice():s})),i?(i.requestTimeout=t,i.creativeTimeout=s,i._errors=[],i._waterfallIndex=0,i._adPodIndex=0,i):void 0},_e=function(e,t){return"%"===e.toString().slice(-1)?t*parseFloat(e.slice(0,-1))/100:parseFloat(e)};class Me{constructor(e,t){this.adRules=e,this.utils=t,this.preRoll=null,this.vmap=null,this.postRoll=null,this.midRolls=[],this.playedMidRolls=[],this.duration=0,this._vmapPromise=null,this._vmapXHR=null}load(e,s,i,a){if(this._vmapPromise)return this._vmapPromise;null!==this._vmapXHR&&(ke(this._vmapXHR),this._vmapXHR=null);const n=he(this.getVMAP(),e,s,i,a);return i===t?(this._vmapPromise=n.then((e=>{this.setPreRoll({_adQueue:[e]})})),this._vmapPromise):(this._vmapPromise=n.then((t=>new Promise(((s,i)=>{this._vmapXHR=e.utils.ajax({url:t,withCredentials:a.withCredentials,retryWithoutCredentials:!0,requireValidXML:!0,timeout:this.requestTimeout},s,((e,t,s,a)=>i(a)))})).then((s=>{this._vmapXHR=null,e.trigger("adLoadedXML",{client:i,tag:t,xml:s.responseXML});return be(s.responseXML,this,e.utils).map((e=>Object.assign(e,{vmap:t})))})).catch((s=>{this._vmapXHR=null;const i={id:v,vmap:t};if(s.message)Object.assign(i,{message:`VMAP Schema Error: ${s.message}`,code:1002,adErrorCode:s.adErrorCode||11002});else{const t={1:{code:1007,message:"Timeout"},602:{code:1e3,message:"Invalid XML"},default:{code:1008,message:e.getConfig().localization.errors[s.key]}},a=t[s.code]||t.default;e.utils.log(a.message),Object.assign(i,{message:"Error Loading VMAP Schedule",code:a.code,adErrorCode:a.code+1e4})}throw i})))),this._vmapPromise)}canWaterfall(e){return e._adQueue&&e._waterfallIndex+1<e._adQueue.length}getPreRoll(e){return e&&"none"===this.adRules.startOnSeek?null:Ee(this.preRoll,this.requestTimeout,this.creativeTimeout)}getPostRoll(e){const t=Ee(this.postRoll,this.requestTimeout,this.creativeTimeout);return this.adRules.timeBetweenAdsAllowsAdPlayback(t,e)?t:null}getMidRollAtIndex(e){const t=this.midRolls[e];return Ee(t,this.requestTimeout,this.creativeTimeout)}getLastMidRollIndexBetweenTime(e,t,s){if(e>t)return null;this.sort(s);let i=this.midRolls.length;for(;i--;){const a=this.midRolls[i],n=_e(this.midRolls[i]._offSet,s);if(e>=n)return null;if(t>=n){const e=Ee(a,this.requestTimeout,this.creativeTimeout);if(!this.adRules.timeBetweenAdsAllowsAdPlayback(e))return null;if(!this.adRules.timeBetweenAds){if(this.playedMidRolls.indexOf(i)>=0)return null;this.playedMidRolls.push(i)}return i}}return null}peek(e,t,s){if(this.midRolls.length>this.playedMidRolls.length){this.sort(s);let i=0;for(;this.midRolls[i];){const a=this.midRolls[i],n=_e(a._offSet,s);if(n>=e&&-1===this.playedMidRolls.indexOf(i)){const s=Q()+1e3*(n-e);return n<=t&&this.adRules.timeBetweenAdsAllowsAdPlayback(null,s)?i:null}i+=1}}const i=Q()+1e3*(s-e);return this.postRoll&&t>=s&&this.adRules.timeBetweenAdsAllowsAdPlayback(null,i)?-1:null}getNextMidrollIndex(e,t,s){if(this.adRules.timeBetweenAds||this.adRules.startOnSeek)return this.getLastMidRollIndexBetweenTime(e,t,s);if(this.midRolls.length>this.playedMidRolls.length){const e=this.getClosestIndex(t,s);if(e>=0&&this.playedMidRolls.indexOf(e)<0)return this.playedMidRolls.push(e),e}return null}getMidRolls(){return this.midRolls.map((e=>Ee(e,this.requestTimeout,this.creativeTimeout)))}reset(){null!==this._vmapXHR&&(ke(this._vmapXHR),this._vmapXHR=null),this.playedMidRolls=[],this.duration=0}setPreRoll(e){e&&this.resetBreakId(e),this.preRoll=e}addMidRoll(e){this.resetBreakId(e),this.midRolls.push(e),this.duration=0}setPostRoll(e){e&&this.resetBreakId(e),this.postRoll=e}sort(e,t){(!e||e<1)&&(e=1),(this.duration!==e||t)&&(this.duration=e,this.midRolls.forEach((t=>{t._offsetSeconds=_e(t._offSet,e)})),this.midRolls.sort(((e,t)=>e._offsetSeconds-t._offsetSeconds)),function(e,t){for(let s=0;s<e.length;s++){const i=e[s];t?i._vmap.item=s+1:(i._adbreak={item:s+1,breakid:i._breakId},i._pod?i._adbreak.pod=i._pod:i._adbreak.tags=i._adQueue)}}(this.getAllAds(),t))}getAllAds(){const e=this.preRoll?[this.preRoll]:[],t=this.postRoll?[this.postRoll]:[];return e.concat(this.midRolls,t)}setVMAP(e){this.vmap=e}isVMAP(){return Boolean(this.vmap)}getVMAP(){return this.vmap}getClosestIndex(e,t){this.sort(t);let s=this.midRolls.length;for(;s--;)if(e>=_e(this.midRolls[s]._offSet,t))return s;return-1}clearAds(){this.preRoll=null,this.midRolls.length=0,this.postRoll=null}resetBreakId(e){e.adBreakId=this.utils.genId(12)}resetAllBreakIds(){this.getAllAds().forEach((e=>{this.resetBreakId(e)}))}destroy(){this.reset(),this.adRules.destroy()}}const Ce=function(e){return Array.isArray(e)?e.slice(0):[e]},Ie=function(e,t){return 0===e?1/0:e||t};class Re{constructor(e){this.utils=e}getSchedule(e,t){const s=new Me(t,this.utils);if(s.requestTimeout=Ie(e.requestTimeout,5e3),s.creativeTimeout=Ie(e.creativeTimeout,5e3),e.tag)s.setPreRoll({_offSet:"pre",_adQueue:Ce(e.tag),_waterfallIndex:0});else if("string"==typeof e.vastxml)s.setPreRoll({_offSet:"pre",_adXML:e.vastxml});else{if("string"==typeof e.schedule)return s.setVMAP(e.schedule),s;if("string"==typeof e.adschedule)return s.setVMAP(e.adschedule),s;!function(e,t,s){const i=t.schedule||t.adschedule;if(!i)return;const a={};Object.keys(i).forEach((e=>{const t=i[e];t.ad&&(Object.assign(t,t.ad),delete t.ad);const n=Y(t.offset,s),r=Ie(t.requestTimeout,5e3),o=Ie(t.creativeTimeout,5e3);let l=a[n];if(l){if("nonlinear"===t.type)return;"nonlinear"===l._type&&(l=null)}const d=a[n]=l||{_offSet:n,_type:t.type,_breakId:e,adBreakId:s.genId(12),requestTimeout:r,creativeTimeout:o};!1===n&&s.log("Error: ad offset format not supported",n);const h=t.skipoffset;if(void 0!==h&&void 0===d.skipoffset&&(d.skipoffset=h),"string"==typeof t.adm)d.adm=t.adm;else if(t.pod){const e=d._pod||[];d._pod=e.concat(t.pod)}else if(t.tag){const e=D(t.tag,t.custParams);d._adQueue&&(d._pod=[d._adQueue[0]],delete d._adQueue),d._pod?d._pod.push(Ce(e)[0]):d._adQueue=Ce(e)}else"string"==typeof t.vastxml?d._adXML=t.vastxml:s.log("Error: no ad tag provided")})),Object.keys(a).forEach((s=>{const i=a[s];switch(i.skipoffset=void 0!==i.skipoffset?i.skipoffset:t.skipoffset,s){case"pre":e.setPreRoll(i);break;case"post":e.setPostRoll(i);break;default:e.addMidRoll(i)}}))}(s,e,this.utils)}return s.sort(),s}getOptParams(e,t){const s={cuetext:t.cuetext,dynamicMessage:t.admessage,loadingAd:t.loadingAd,podMessage:t.podmessage,skipoffset:e.skipoffset,skipmessage:t.skipmessage,skiptext:t.skiptext,omidAccessMode:e.omidAccessMode||"full",omidSupport:e.omidSupport||"auto",allowedOmidVendors:e.allowedOmidVendors||[],vpaidcontrols:e.vpaidcontrols||!1,conditionaladoptout:e.conditionaladoptout||!1,requestFilter:e.requestFilter,trackingFilter:e.trackingFilter,withCredentials:void 0===e.withCredentials||e.withCredentials,extensions:"[object Object]"===Object.prototype.toString.call(e.extensions)?e.extensions:{}},i=e.companiondiv;return i&&(s.companion={id:i.id,height:i.height,width:i.width}),s}getAdRules(e){const t=e.rules||{},s=parseInt(t.frequency,10);return{startOn:t.startOn||1,frequency:isNaN(s)?1:s,timeBetweenAds:t.timeBetweenAds||0,startOnSeek:t.startOnSeek||null,deferAds:t.deferAds||null}}}const Se=function(e,t=null,s={}){const i={client:e.client},{bidding:a,item:n,player:r}=e;if(e.isDestroyed()||Object.assign(i,{placement:F(r.getConfig()),viewable:r.getViewable()}),s.jwpseg&&(i.jwpseg=s.jwpseg),t){const{adBreakId:n,adPlayId:r}=e.getAdIds(t,s);if(Object.assign(i,{adBreakId:n,adPlayId:r,offset:t._offSet}),a){const e=a.getBid(r);e&&Object.assign(i,e.getEventObject())}}return i.item=n,i},je=function(e,t,s,i){return{client:i,message:e,adErrorCode:t,id:v,placement:F(s),tag:""}};class Le{constructor(e,t){this.player=e,this.options=t,this.client=t.client,this.ignoreStartOnSeek=!1,this.reset(),t.timeBetweenAds&&e.on({adBreakStart:this.handleAdBreakStart,adSkipped:this.handleAdSkipped,adComplete:this.handleAdComplete,adBreakEnd:this.handleAdBreakEnd,destroyPlugin:this.destroy},this)}get timeBetweenAds(){return this.options.timeBetweenAds}get startOnSeek(){return this.ignoreStartOnSeek?null:this.options.startOnSeek}shouldDeferAds(){return this.options.deferAds&&!this.player.getConfig().activeTab}clearStartOnSeek(){this.ignoreStartOnSeek=!0}sendAdBreakIgnored(e,t){e&&this.player.trigger(l,function(e,t){let s={};return e&&(s={id:e._breakId,tag:e._adQueue&&e._adQueue.length>0?e._adQueue[0]:e._adXML,offset:e._offSet}),Object.assign(s,{timeSinceLastAd:t,type:l})}(e,t,this.client))}rulesAllowAdPlayback(e){const t=this.options,s=0===t.frequency&&1===e,i=e>=t.startOn&&(e-t.startOn)%t.frequency==0;return s||i}handleAdBreakStart(){this.adSkipped=!1,this.adComplete=!1}handleAdComplete(){this.adComplete=!0}handleAdSkipped(){this.adSkipped=!0}handleAdBreakEnd(){!this.adSkipped&&this.adComplete&&(this.recentCompletedAdTime=Q(),this.player.trigger("previousAdCompleteTime",{time:this.recentCompletedAdTime}))}timeBetweenAdsAllowsAdPlayback(e,t=Q()){if(this.options.timeBetweenAds){const s=(t-this.recentCompletedAdTime)/1e3;if(s<this.options.timeBetweenAds)return this.sendAdBreakIgnored(e,s),!1}return!0}reset(){this.ignoreStartOnSeek=!1,this.recentCompletedAdTime=0}destroy(){this.player.off(null,null,this)}}const Te=()=>{};class xe{constructor(e,t,s){this.player=e,this.pluginConfig=t,this.adClient=s;const i=this.configParser=new Re(e.utils),a=this.adRules=new Le(e,i.getAdRules(t),s);this.emptySchedule=new Me(a,e.utils)}getAdRules(){return this.adRules}resetDefaultSchedule(e){const t=void 0===this.pluginConfig.withCredentials||this.pluginConfig.withCredentials,s=this.defaultSchedule=this.configParser.getSchedule(this.pluginConfig,this.adRules);s.isVMAP()&&s.load(this.player,e,this.adClient,{withCredentials:t}).catch(Te)}getSchedule(e,t){var s;return t>0&&!this.adRules.rulesAllowAdPlayback(t)?this.emptySchedule:null!=e&&e.adschedule&&!0!==(null==(s=this.pluginConfig)?void 0:s.ignorePlaylistSchedules)?this.configParser.getSchedule(e,this.adRules):(this.resetDefaultSchedule(e),this.defaultSchedule)}getOptParams(e,t){return this.configParser.getOptParams(e,t)}reset(){this.adRules.reset()}destroy(){this.emptySchedule&&this.emptySchedule.destroy(),this.defaultSchedule&&this.defaultSchedule.destroy()}}var Be=function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),t)};class De{constructor(e,t,s){this.config=e,this.setOptions(s),this.setLocalizationOptions(t)}setLocalizationOptions(e){for(const t in e)t&&"string"==typeof t&&(this[t]=e[t])}setOptions(e,t=!1){for(const s in e)if(Be(e,s)){let i=t?this.config[s]||this.config[s.toLowerCase()]:this.config[s];const a=e[s],n=typeof a;if(void 0!==i){if("boolean"!==n&&"number"!==n||(i=ae(i)),typeof i!==n)throw new Error(`invalid parameter: ${s} should be a ${n}`);this[s]=i}else this[s]=a}}}const Oe={adPosition:"",autoplayadsmuted:!1,companiondiv:null,companionResourceType:"",customUi:null,debug:!1,omidSupport:"disabled",omidAccessModeRules:{},enablePreloading:!1,loadVideoTimeout:15e3,locale:"",maxRedirects:-1,ppid:"",preloadAds:!1,requestTimeout:1e4,truncateMacros:!0,vastLoadTimeout:1e4,vpaidcontrols:!1,vpaidmode:"insecure"};class Ue extends De{constructor(e,t,s){var i;const a=null==t||null==(i=t.localization)?void 0:i.advertising,{admessage:n,cuetext:r,podmessage:o,loadingAd:l,skipmessage:d,skiptext:h}=a;super(e,{admessage:n,cuetext:r,podmessage:o,loadingAd:l,skipmessage:d,skiptext:h},Oe),this.utils=s,this.bidsResponse={}}}class qe{constructor(e,t,s){s.addClass(e,"jw-plugin-googima");const i=document.createElement("div");i.id=`${t}_ad`,i.className="jw-ads-view",this.visible=!1,this.utils=s,this.div=e,this.adDiv=i,e.appendChild(i)}resizeNonLinear(e){this.resize(!1,e)}resizeLinear(){this.resize(!0)}resize(e,t){const s=this.utils;s.toggleClass(this.div,"jw-ad-non-linear",!e),s.toggleClass(this.div,"jw-ad-linear",e),s.style(this.div,{height:t?`${t}px`:""})}getAdDiv(){return this.adDiv}adSetup(){this.visible=!0,this.utils.addClass(this.div,"jw-ad-instream"),this.resize(!0)}adTakeDown(){this.visible=!1,this.utils.removeClass(this.div,"jw-ad-instream"),this.resize(!0)}}const Ve={};let Ne=null;function He(e){var t,s,i;return!Ne&&null!=(t=window)&&null!=(s=t.google)&&null!=(i=s.ima)&&i.AdDisplayContainer&&(Ne=Promise.resolve()),Ne||(Ne=function(e,t){if(Ve[t])return Ve[t];"file:"===document.location.protocol&&0===t.indexOf("//")&&(t=`https:${t}`);const s=new(0,e.scriptloader)(t);return Ve[t]=s.load(),Ve[t]}(e,"//imasdk.googleapis.com/js/sdkloader/ima3.js"),Ne)}class $e{constructor(e,t,s){e.extend(this,t),this.vol=0,this.imaProxy=null,this.view=s}setProxy(e){this.imaProxy=e,"boolean"==typeof this.muted&&this.mute(this.muted)}attachMedia(){}detachMedia(){}mute(e){this.muted=e,this.imaProxy&&(e?this.imaProxy.setVolume(0):this.vol>=0&&this.imaProxy.setVolume(this.vol)),this.muteAllAdContainerVideo(e)}muteAllAdContainerVideo(e){const t=this.view.getAdDiv().getElementsByTagName("video");for(let s=0;s<t.length;s++)t[s].muted=e}volume(e){this.vol=e/100,this.imaProxy&&this.imaProxy.setVolume(this.vol)}}const ze=function(){};class Qe{constructor(e,t,s,i,a){Object.assign(this,e.Events),this.client="shared",this.player=e,this.item=s,this.config=i,this.casting=a;const n=e.utils,r=new Re(n);this.adRules=new Le(e,r.getAdRules(i)),"string"==typeof t?(this.schedule=new Me(this.adRules,n),this.schedule.setPreRoll({tag:t})):(this.schedule=t,t.resetAllBreakIds()),this.vmapPromise=null,this.lastTimeEvent=null,this.prerollPromise=null,this.midrollPromise={},this.postrollPromise=null,this.next=null,this.nextPlaylistItemPromise=null,this.relatedNextUp=null,this.bidding=e.getPlugin("bidding"),this.bids=[],this.bidsPromises=[],this.bidsPromise=null,this._events=[]}attachListeners(){this.player.on({all:this.onAll,beforePlay:this.checkPreroll,relatedReady:this.relatedReady,cast:this.onCast,destroyBidding:this.destroyBids},this)}onAll(e,t){this.isDestroyed()||(e===o?this.checkMidrolls(t):"beforeComplete"===e?this.checkPostrolls(t):"meta"===e&&this.schedule.sort(this.player.getDuration()),"complete"===e&&(this.player.videoHasCompleted=!0))}relatedReady(){if(this.config.preloadAds){const e=this.player.getPlugin("related");e&&e.on("nextUp",(e=>{e&&"discovery"===e.mode&&(this.relatedNextUp=e)}))}}onCast(e){this.casting=Boolean(e.active)}init(e,t){if(this.config.clearAdsOnComplete&&this.player.videoHasCompleted&&this.schedule.clearAds(),e=e||null,this.schedule.isVMAP()&&(t.requestTimeout=this.schedule.requestTimeout,t.creativeTimeout=this.schedule.creativeTimeout,this.vmapPromise=this.schedule.load(this.player,this.item,this.client,t)),this.bidsPromise=this.vmapPromise||Promise.resolve(),this.bidsPromise=null!==e?this.bidsPromise.then((()=>{if(this.isDestroyed())return;if(this.bidding)return this.createBidsPromise(e,t);const s=function(e,t,s){const i=Se(e,t,s);return Object.assign(i,{message:"Ad Error: bidding plugin unavailable",code:900,adErrorCode:60008}),i}(this,null,t);this.player.trigger(p,s)})).catch(ze):this.bidsPromise.catch(ze),this.config.preloadAds)if(1===t.playlistItemEventCount){const e=this.player.getConfig().autostart;!1===e||"viewable"===e&&0===this.player.getViewable()?this.loadPreroll(t).catch((e=>this.isDestroyed()?null:this.enqueueAdEvent(p,e,{preload:!0}))):this.player.once("autostartNotAllowed",(()=>{this.loadPreroll(t).catch((e=>this.isDestroyed()?null:this.enqueueAdEvent(p,e,{preload:!0})))}))}else t.preloadPreroll&&this.loadPreroll(t).catch((e=>this.isDestroyed()?null:this.enqueueAdEvent(p,e,{preload:!0})));return this.bidsPromise}createBidsPromise(t,s){const i=this.player;let a=parseInt(t.bidOnBreaks,10);return a=a>0?a:1/0,this.bids=this.schedule.getAllAds().slice(0,a).map((a=>{const{adPlayId:n}=this.getAdIds(a),r=i.getConfig(),{skipoffset:o}=this.config,l=null!=o&&o>=0,d=ee(i,this.item),h={id:n,offset:t.offset,jwpseg:d,placement:F(r),tag:a._adQueue?a._adQueue[0]:a._currentTag,adClient:this.client};this.client===e&&(h.skipoffset=l?o:-1);const u=this.bidding.createNewBid(h,{getURLParts:K});this.player.trigger("adBidRequest",Se(this,a,Object.assign({jwpseg:d},s))),u.init();const c=u.start().then((({result:t})=>{if(this.isDestroyed())return;let i=Promise.resolve();var n;t&&!t.error&&(a.jwpseg=d,t.adm?(a._adXML=t.adm,null!=a&&null!=(n=a._adQueue)&&n.length&&a._adQueue.unshift(t.adm)):t.tag&&(i=he(t.tag,this.player,this.item,this.client,{},a).then((t=>{this.client===e?(a._adQueue=a._adQueue||[],a._adQueue.unshift(t)):a._adQueue=[t]}))));return this.player.trigger("adBidResponse",Se(this,a,s)),i}));return this.bidsPromises.push(c),u})),Promise.all(this.bidsPromises)}checkPreroll(e){if(this.bidTimeoutStarted||(this.bidTimeoutStarted=!0,this.bids.forEach((e=>e.timeout()))),this.casting||this.preRollPlayed||this.adRules.shouldDeferAds())return;this.preRollPlayed=!0;const t=(null==e?void 0:e.startTime)||this.player.getPosition();this.lastTimeEvent=t||this.lastTimeEvent;const s=this.schedule.getPreRoll(t);if(!s&&!this.vmapPromise)return;(null!==this.vmapPromise||s&&"nonlinear"!==s._type)&&this.startBlocking(),this.bidsPromise.then((()=>{if(this.isDestroyed())return;const e=this.schedule.getPreRoll(t);e&&"nonlinear"!==e._type&&this.triggerAdBreakEvents(e,"pre")})),t?"none"===this.adRules.startOnSeek&&(this.prerollPromise=null):this.adRules.clearStartOnSeek();const i=null!=e&&e.playReason?e.playReason:n;this.playPreroll({adBlock:this.adBlockErrorDetected,startTime:t,reason:i})}checkMidrolls(e){if(this.casting||0===e.duration||this.adRules.shouldDeferAds())return;const t=this.schedule.getNextMidrollIndex(this.lastTimeEvent,e.position,e.duration);if(this.lastTimeEvent=e.position,null!==t){if(this.isAdLoading)return;const e=this.schedule.getMidRollAtIndex(t);"nonlinear"!==e._type&&(this.startBlocking(),this.triggerAdBreakEvents(e,"mid")),this.playMidrollAtIndex(t,{adBlock:this.adBlockErrorDetected})}else if(!this.preRollPlayed&&this.schedule.getClosestIndex(e.position,e.duration)<0)this.checkPreroll(e);else if(this.config.preloadAds){const t=e.position+5,s=this.schedule.peek(e.position,t,e.duration);if(null!==s&&s>=0)this.loadMidrollAtIndex(s,{adBlock:this.adBlockErrorDetected,preload:!0}).catch(ze);else if(-1===s){const t=Q()+1e3*(e.duration-e.position);this.loadPostroll({adBlock:this.adBlockErrorDetected,preload:!0,startTime:t}).catch(ze)}else if(null===this.next&&null===this.nextPlaylistItemPromise&&t>e.duration){const e=this.player.getPlaylistIndex()+1,t=this.player.getPlaylistItem(e);if(this.nextPlaylistRelated=Boolean(this.relatedNextUp),t||this.relatedNextUp){const t=this.relatedNextUp?-1:e;this.nextPlaylistItemPromise=Promise.resolve(this.player.getPlaylistItemPromise(t)).then((()=>{this.isDestroyed()||(this.trigger("preloadNext",{item:this.player.getPlaylistItem(e)||this.relatedNextUp,index:t}),this.relatedNextUp=null,this.nextPlaylistItemPromise=null)})).catch(ze)}}}}checkPostrolls(e){if(this.casting||this.adRules.shouldDeferAds()||this.isDestroyed())return;const t=this.schedule.getPostRoll();t&&("nonlinear"!==t._type&&(this.startBlocking(),this.triggerAdBreakEvents(t,"post")),this.playPostroll(e))}getAdIds(e,{tagIndex:t,podIndex:s}={}){let i=e.adRequestIds&&void 0!==t?e.adRequestIds[t]:null;if(!i){const t=`p${s||e._adPodIndex||0}w${e._waterfallIndex||0}`;"p0w0"===t?i=e.adBreakId:(e.adPlayIds=e.adPlayIds||{},i=e.adPlayIds[t]=e.adPlayIds[t]||this.player.utils.genId(12))}return{adBreakId:e.adBreakId,adPlayId:i}}loadPreroll(e={}){return this.prerollPromise||(this.prerollPromise=this.bidsPromise.then((()=>{if(this.isDestroyed())return;const t=this.schedule.getPreRoll(e.startTime);return t?(t._position="pre",t._preload=!0,this.loadAd(t,e)):void 0}))),this.prerollPromise}loadMidrollAtIndex(e,t){return this.midrollPromise[e]||(this.midrollPromise[e]=this.bidsPromise.then((()=>{if(this.isDestroyed())return;const s=this.schedule.getMidRollAtIndex(e);return s?(s._position="mid",s._preload=!0,this.loadAd(s,t)):void 0}))),this.midrollPromise[e]}loadPostroll(e={}){return this.postrollPromise||(this.postrollPromise=this.bidsPromise.then((()=>{if(this.isDestroyed())return;const t=this.schedule.getPostRoll(e.startTime);return t?(t._position="post",t._preload=!0,this.loadAd(t,e)):void 0}))),this.postrollPromise}playPreroll(e){this.prerollPromise?this.playPreloadedPromise(this.prerollPromise,e):this.bidsPromise.then((()=>{if(this.isDestroyed())return;const t=this.schedule.getPreRoll(e.startTime);t?(t._position="pre",this.startAdBreak(t,e)):this.stopBlocking()}))}playMidrollAtIndex(e){this.midrollPromise[e]?this.playPreloadedPromise(this.midrollPromise[e]):this.bidsPromise.then((()=>{const t=this.schedule.getMidRollAtIndex(e);t&&(t._position="mid",this.startAdBreak(t))}))}playPostroll(e){this.postrollPromise?this.playPreloadedPromise(this.postrollPromise):this.bidsPromise.then((()=>{const t=this.schedule.getPostRoll();t&&(t._position="post",this.startAdBreak(t,e))}))}isDestroyed(){return null===this.player}destroy(){this.destroyBids(),this.player.off(null,null,this),this.player=null}destroyBids(){this.bids.forEach((e=>e.stop())),this.bidsPromises=[],this.bids=[]}enqueueAdEvent(e,t,s){this._events.push({type:e,event:t}),s.preload||this.dequeueAdEvents()}async waitForAdPlay(e){this.isAdLoading=!0;let t=!1;try{await e,t=!0}catch(e){}return this.isAdLoading=!1,t}dequeueAdEvents(){}triggerAdBreakEvents(){}startBlocking(){}stopBlocking(){}loadAd(){}playPreloadedPromise(){}startAdBreak(){}}const We=(e,t,...s)=>{if(null!=e&&e[t]&&"function"==typeof e[t])try{return e[t](...s)}catch(e){return null}return null},Xe=(e,s,i,a={})=>{s=s||null;const n={client:t};if(!e)return n;const{bidding:r,config:o,player:l}=e;Object.assign(n,{placement:F(l.getConfig()),viewable:l.getViewable()}),a.jwpseg&&(n.jwpseg=a.jwpseg),o.preloadAds&&(n.preloadAds=a.preload||(null==i?void 0:i._preload)||!1);const d=We(s,"getAdPodInfo");if(d){const e=We(d,"getTotalAds");if(e>1){const t=We(d,"getAdPosition");Object.assign(n,{sequence:t,podcount:e}),a.podIndex="number"==typeof t?t-1:0}if(void 0===n.adposition){const e=We(d,"getTimeOffset");n.adposition=0===e?"pre":-1===e?"post":"mid"}}if(i){const{adBreakId:t,adPlayId:s}=e.getAdIds(i,a);if(Object.assign(n,{tag:i._adQueue&&i._adQueue.length>0?i._adQueue[0]:i._adXML||i.adm,adBreakId:t,adPlayId:s,id:t,adposition:i._position}),i.jwpseg&&(n.jwpseg=i.jwpseg),r){const e=r.getBid(s);e&&Object.assign(n,e.getEventObject())}}const h=e.adsLoaderManager||a.loader;if(s){if(h){const e=n.mediationLayerAdServer;if("dfp"===e||"jwpdfp"===e){-1!==(We(s,"getWrapperAdSystem")||[]).concat(We(s,"getAdSystem")||[]).indexOf("SpotXJW")&&n.bidders.forEach((e=>{e.winner="SpotX"===e.name}))}const t=h.userRequestContext;Object.assign(n,{tag:n.tag||h.getTag(s),ima:{ad:s,userRequestContext:t}})}Object.assign(n,{adtitle:s.getTitle(),adsystem:s.getAdSystem(),creativetype:s.getContentType(),duration:s.getDuration(),linear:s.isLinear()?"linear":"nonlinear",description:s.getDescription(),creativeAdId:s.getCreativeAdId(),adId:s.getAdId(),universalAdId:s.getUniversalAdIds().map((e=>({universalAdIdRegistry:e.g,universalAdIdValue:e.h}))),advertiser:s.getAdvertiserName(),dealId:s.getDealId()});const e=s.getMediaUrl();e&&(n.mediaFile={file:e})}return void 0!==a.offset&&Object.assign(n,{adposition:n.adposition||a.offset,offset:a.offset}),n},Ge=(e,t,s,i,a)=>{const n=Xe(e,s,i,a),r=t.getVastErrorCode?t.getVastErrorCode():t.code;let o=t.getErrorCode?t.getErrorCode():t.adErrorCode;return o=o<1e4?o+2e4:o||60900,Object.assign(n,{message:`Ad Error: ${t.getMessage?t.getMessage():t.message}`,code:r>=100&&r<=1008?r:900,adErrorCode:o}),e&&(20402===o?n.timeout=e.options.loadVideoTimeout:21009===o?n.timeout=e.options.vastLoadTimeout:60004===o&&(n.timeout=e.options.requestTimeout)),void 0!==t.placement&&(n.placement=t.placement),void 0!==t.id&&(n.id=t.id),t.getInnerError&&(n.sourceError=t.getInnerError()),void 0!==t.tag&&(n.tag=t.tag),n},Je=()=>null;class Fe{constructor(e,t){const{player:s,options:i,instreamProvider:a,view:n,adsLoaderManager:r,video:o,item:l,client:d}=e;if(s.utils.extend(this,s.Events),this.playlistItemManager=e,this.player=s,this.options=i,this.instreamProvider=a,this.view=n,this.adsLoaderManager=r,this.video=o,this.item=l,this.client=d,this.reason=t,this.env=s.getEnvironment(),this.utils=s.utils,this._qoe=new s.utils.Timer,i.customUi){const e=i.customUi;this.mainContainer=s.getContainer(),this.customUiDiv=document.getElementById(e.customUiDivId),this.adClickButton=document.getElementById(e.adClickButtonId),this.customCountDownDiv=document.getElementById(e.customCountDownId),this.customSkipButton=document.getElementById(e.customSkipButtonId),this.timeTillSkip=Number.POSITIVE_INFINITY}this.initAdsManagerPromise=null,this.blockingInstreamPlayer=null,this.currentAd=null,this.progressIntervalId=-1,this.viewablePlayedTime=0,this.lastPosition=null,this.adViewableImpressionHandler=Je,this.paused=!1,this.playbackProxy={currentTime:this.player.getPosition(),duration:this.player.getDuration()},s.on("time",this.time,this),this.debugConsoleLog=Je,i.debug&&(this.debugConsoleLog=function(...e){console.log(e)})}time(e){this.playbackProxy.currentTime=e.position,e.duration>=e.position?this.playbackProxy.duration=e.duration:this.playbackProxy.duration=1/0}init(e,t,s){this.requestType=e,this.requestOptions=t,this.scheduledAd=s,this.offset=s._offset;const i=this.adsLoaderManager;return this.initAdsManagerPromise=this.initAdsManagerPromise||He(this.utils).then((()=>this.destroyed()?null:(this.debugConsoleLog("[JW DEBUG] Open adsLoaderManager"),i.open(e,t,this.video)))).then((e=>{if(this.destroyed())return null;const s=i.getAdsManager(e,this.playbackProxy,this.options);if(this.instreamProvider.setProxy(s),i.bindEvents({AD_ERROR:this.adError.bind(this),LOADED:this.adLoaded.bind(this),CONTENT_PAUSE_REQUESTED:this.pauseRequested.bind(this),CONTENT_RESUME_REQUESTED:this.resumeRequested.bind(this),LOG:this.adLog.bind(this),STARTED:this.adStarted.bind(this),IMPRESSION:this.adImpression.bind(this),LINEAR_CHANGED:this.resize.bind(this),CLICK:this.adClick.bind(this),PAUSED:this.adPaused.bind(this),RESUMED:this.adResumed.bind(this),SKIPPED:this.adSkipped.bind(this),USER_CLOSE:this.adUserClose.bind(this),ALL_ADS_COMPLETED:this.allAdsCompleted.bind(this)},this),t.preloadAds)clearTimeout(this.timeoutAdStart);else{const{width:e,height:t}=this.player.getSafeRegion(!1),s=this.getViewMode();this.debugConsoleLog("[JW DEBUG] adsManager init with",e,t,s),i.init(e,t,s)}const a=s.getCuePoints();if(a.length){const e=a.filter((e=>e>0)).map((e=>({begin:e,text:this.options.cuetext,cueType:"ads"})));this.player.addCues(e)}return s})).catch((e=>{if(clearTimeout(this.timeoutAdStart),this.asyncError&&!s._preload&&this.asyncError(e),null!=e&&e.getError){const t=e.getError();throw this.getAdErrorEventObject(t,e)}throw e})),this.initAdsManagerPromise}getViewMode(){const e=google.ima.ViewMode;return this.player.getFullscreen()?e.FULLSCREEN:e.NORMAL}beforeComplete(){const e=this.adsLoaderManager.adsManager;e&&e.getCuePoints().indexOf(-1)>-1&&this.playlistItemManager.startBlocking(),this.adsLoaderManager.unbindEvents(["CONTENT_RESUME_REQUESTED"]),this.debugConsoleLog("[JW DEBUG] Call contentComplete on IMA SDK"),this.adsLoaderManager.contentComplete()}requestAds(){var e,t;if(this.destroyed())return;this.debugConsoleLog("[JW DEBUG] Request ads to IMA SDK");let s=Promise.resolve();if(null!=this&&null!=(e=this.scheduledAd)&&null!=(t=e._adQueue)&&t.length){const e=this.scheduledAd._adQueue.map(((e,t)=>he(e,this.player,this.item,this.client,this.options,this.scheduledAd).then((e=>{e=ie({player:this.player,item:this.item,tag:e,targetingConfig:this.options.config.targeting,enablePPS:Boolean(this.options.config.enablePPS)}),this.scheduledAd._adQueue[t]=e}))));s=Promise.all(e)}return s.then((()=>{this.startRequestTimeout(),this.trigger("adRequest",Xe(this.playlistItemManager,null,this.scheduledAd)),this.adsLoaderManager.requestAds(this.requestType,this.requestOptions,this.options,this.scheduledAd)}))}muteInstreamProvider(){const e=this.video.muted||this.player.getMute();this.debugConsoleLog("[JW DEBUG] Setting mute on instreamProvider",e),this.instreamProvider.mute(e)}pauseRequested(e){const t=this.playlistItemManager.schedule.isVMAP();t&&this.playlistItemManager.startBlocking();const s=null==e?void 0:e.getAd();if(t){const e=We(s,"getAdPodInfo"),t=We(e,"getTimeOffset");if(t){const e=-1===t?"post":"mid";this.scheduledAd._position=e,this.playlistItemManager.triggerAdBreakEvents(this.scheduledAd,e)}}const i=Xe(this.playlistItemManager,s,this.scheduledAd);this.trigger(g,i)}resumeRequested(){var e;this.debugConsoleLog("[JW DEBUG] ResumeRequest from IMA SDK"),null!=this&&null!=(e=this.currentAd)&&e.isLinear()&&this.finishAd(),this.blockingInstreamPlayer&&this.view.adTakeDown(),this.trigger("stopBlocking"),this.blockingInstreamPlayer=null}finishAd(){this.currentAd&&(this.hideCustomUi(),clearInterval(this.progressIntervalId),this.viewablePlayedTime=0,this.currentAd=null)}discardAdBreak(e){!e&&this.adsLoaderManager&&(e=this.adsLoaderManager.adsManager),!this.destroyed()&&e&&(this.currentAd&&this.trigger(y,Xe(this.playlistItemManager,this.currentAd,this.scheduledAd)),0===e.getCuePoints().length?this.destroy():(e.discardAdBreak(),e.stop()))}asyncDiscardAdBreak(){this.initAdsManagerPromise&&this.initAdsManagerPromise.then((e=>this.discardAdBreak(e))).catch(Je)}pause({reason:e}){if(this.destroyed())return;const t=this.adsLoaderManager.adsManager;t&&(this.viewablePlayedTime=0,this.debugConsoleLog("[JW DEBUG] JW Player pause ad"),this.reason=e||n,t.pause())}resume({reason:e}){if(this.destroyed())return;const t=this.adsLoaderManager.adsManager;t&&(this.debugConsoleLog("[JW DEBUG] JW Player resume ad"),this.reason=e||n,t.resume())}startRequestTimeout(){clearTimeout(this.timeoutAdStart),this.timeoutAdStart=setTimeout((()=>{this.debugConsoleLog("[JW DEBUG] Ad request timeout"),this.destroyed()||(this.asyncError=null,this.handleAdError({message:`Ad Request timeout after ${this.options.requestTimeout} milliseconds`,getErrorCode:()=>60004}),this.asyncDiscardAdBreak())}),this.options.requestTimeout)}startAdsLoader(e){if(this.destroyed()||!this.initAdsManagerPromise)return Promise.reject();this.player.off("beforePlay",null,this),e&&(this.blockingInstreamPlayer=e,e.setText(this.options.loadingAd)),this.muteInstreamProvider(),this._qoe.tick("adBeforePlay"),this.startRequestTimeout(),this.initAdsManagerPromise.then((()=>{if(this.destroyed())return;const e=this.adsLoaderManager;if(!e.initialized){const{width:t,height:s}=this.player.getSafeRegion(!1),i=this.getViewMode();this.debugConsoleLog("[JW DEBUG] adsManager init with",t,s,i),e.init(t,s,i)}this.debugConsoleLog("[JW DEBUG] Start adsManager"),e.start()})).catch(Je)}resize(){const e=this.currentAd,t=this.adsLoaderManager.adsManager;if(!t)return;const s=e&&!e.isLinear(),i=this.player.getSafeRegion(s);if(s){let s=e.getHeight();s=this.player.getFullscreen()?i.height/2:Math.max(100,s+10),this.debugConsoleLog("[JW DEBUG] Resize adsManager",i.width,s,this.getViewMode()),t.resize(i.width,s,this.getViewMode()),this.view.resizeNonLinear(s)}else this.debugConsoleLog("[JW DEBUG] Resize adsManager",i.width,i.height,this.getViewMode()),t.resize(i.width,i.height,this.getViewMode()),this.view.resizeLinear()}setState(e,t,s){if(!e.isLinear())return;const a=Xe(this.playlistItemManager,e,this.scheduledAd);if(a.newstate=t,s&&(a.oldstate=s),null!==this.reason){a[t===i?"playReason":"pauseReason"]=this.reason,this.reason=null}this.instreamProvider.trigger("state",a)}customMainClickHandler(){this.adsLoaderManager.adsManager.resume()}customSkipHandler(e){if(e.stopPropagation(),this.timeTillSkip<=0){this.adsLoaderManager.adsManager.skip()}}customClickHandler(e){e.stopPropagation(),this.adsLoaderManager.adsManager.clicked()}addCustomEventHandlers(){this.mainClick=this.customMainClickHandler.bind(this),this.customSkip=this.customSkipHandler.bind(this),this.customClick=this.customClickHandler.bind(this),this.mainContainer.addEventListener("click",this.mainClick),this.adClickButton&&this.adClickButton.addEventListener("click",this.customClick),this.customSkipButton&&this.customSkipButton.addEventListener("click",this.customSkip)}removeCustomEventHandlers(){this.mainContainer.removeEventListener("click",this.mainClick),this.adClickButton&&this.adClickButton.removeEventListener("click",this.customClick),this.customSkipButton&&this.customSkipButton.removeEventListener("click",this.customSkip)}showCustomUi(){this.customUiDiv&&(this.customUiDiv.style.display="block",this.addCustomEventHandlers())}hideCustomUi(){this.customUiDiv&&(this.customUiDiv.style.display="none",this.removeCustomEventHandlers())}adLoaded(e){clearTimeout(this.timeoutAdStart);const t=e.getAd();if(this.playlistItemManager.schedule.isVMAP()){const e=We(t,"getAdPodInfo"),s=We(e,"getTimeOffset");s&&(this.scheduledAd._position=-1===s?"post":"mid")}const s=Xe(this.playlistItemManager,t,this.scheduledAd);this.trigger("adLoaded",s)}adStarted(e){this.player.getPip()&&this.player.requestPip(this.view.getAdDiv().querySelector("video"));const t=e.getAd();this.currentAd=t,this.paused=!1,t.isUiDisabled()&&this.showCustomUi();const s=Xe(this.playlistItemManager,t,this.scheduledAd);this.trigger(m,s)}adImpression(e){this.view.adSetup();const t=e.getAd(),s=t.isLinear(),a=s&&(t.getContentType().indexOf("image")>=0||-1===t.getDuration()),n=this.isVpaidAd(t),r=s&&n&&this.options.vpaidcontrols;this.currentAd=t,this.blockingInstreamPlayer&&this.blockingInstreamPlayer.setSkipOffset(t.getSkipTimeOffset()),this.adsLoaderManager.bindEvents({COMPLETE:this.adComplete.bind(this)}),n&&this.env.OS.mobile&&this.options.autoplayadsmuted&&this.adsLoaderManager.bindEvents({VOLUME_CHANGED:()=>{this.adsLoaderManager.unbindEvents(["VOLUME_CHANGED"]),this.player.setMute(0===this.adsLoaderManager.adsManager.getVolume())}}),s||this.trigger("stopBlocking",{isNonlinear:!0}),this.utils.toggleClass(this.player.getContainer(),f,s&&(a||n)),this.utils.toggleClass(this.player.getContainer(),A,r),this.resize(),this.muteInstreamProvider(),clearTimeout(this.timeoutAdStart);const o=this.adsLoaderManager.adsManager;this.progressInterval(t,o);const l=Xe(this.playlistItemManager,t,this.scheduledAd),d=void 0===l.podcount||1===l.sequence;"pre"===l.adposition&&d&&(this._qoe.tick("adImpression"),l.timeLoading=this._qoe.between("adBeforePlay","adImpression")),s&&!d&&this.trigger(g,l),this.trigger("adImpression",l,t),this.setupViewableListener(),this.setState(t,i,"buffering")}progressInterval(e,t){if(clearInterval(this.progressIntervalId),!t)return;const s=e.getAdId(),i=e.isSkippable()&&this.customSkipButton;let a=-1;const n=this.options.admessage||"",r=this.options.podmessage||"",l=this.options.skipmessage||"",d=this.options.skiptext||"",h=new RegExp("__AD_POD_CURRENT__","g"),u=new RegExp("__AD_POD_LENGTH__","g");this.progressIntervalId=setInterval((()=>{if(!this.currentAd||this.currentAd.getAdId()!==s)return void clearInterval(this.progressIntervalId);const c=t.getRemainingTime();if(isNaN(c)||c<=0)return;if(a===c)return;a=c;const p=this.currentAd.getDuration(),g=p-c,m=Math.round(p-g);if(i){const t=this.timeTillSkip=Math.ceil(e.getSkipTimeOffset()-g);t>0?(this.customSkipButton.innerText=l.replace(/(\b)xx(s?\b)/g,`$1${t}$2`),this.customSkipButton.style.cursor="default"):(this.customSkipButton.innerText=d,this.customSkipButton.style.cursor="pointer")}if(this.blockingInstreamPlayer){let e=n.replace(/(\b)xx(s?\b)/g,`$1${m}$2`);const t=We(this.currentAd,"getAdPodInfo");if(t){const s=We(t,"getTotalAds");if(s>1){const i=We(t,"getAdPosition");e=`${r.replace(h,i).replace(u,s)} ${e}`}}this.blockingInstreamPlayer.setText(e),this.customCountDownDiv&&(this.customCountDownDiv.innerText=e),this.instreamProvider.trigger(o,{duration:p,position:g})}if(p>0){const t=Xe(this.playlistItemManager,e,this.scheduledAd);t.position=g,t.duration=p,this.adViewableImpressionHandler(t),this.trigger("adTime",t)}}),250)}setupViewableListener(){this.player.off(a,this.viewableHandler,this),this.player.on(a,this.viewableHandler,this),this.viewableHandler({viewable:this.player.getViewable()})}adViewableHandler(e){const{position:t}=e;null===this.lastPosition&&(this.lastPosition=t);let s=t-this.lastPosition;if(this.lastPosition=t,s=Math.min(Math.max(0,s),4),this.viewablePlayedTime+=s,this.viewablePlayedTime>=2){this.player.off(a,this.viewableHandler,this),this.adViewableImpressionHandler=Je;const e=Xe(this.playlistItemManager,this.currentAd,this.scheduledAd);this.trigger("adViewableImpression",e)}}viewableHandler(e){e.viewable?(this.viewablePlayedTime=0,this.lastPosition=null,this.adViewableImpressionHandler=this.adViewableHandler):this.adViewableImpressionHandler=Je}adComplete(e){const t=e.getAd();this.finishAd();const s=Xe(this.playlistItemManager,t,this.scheduledAd);this.trigger("adComplete",s),this.adsLoaderManager.unbindEvents(["VOLUME_CHANGED"])}adClick(e){const t=this.adsLoaderManager.adsManager,s=e.getAd();this.reason="clickthrough",this.isVpaidAd(s)||(this.debugConsoleLog("[JW DEBUG] Ad paused due to ad click"),t.pause());const i=Xe(this.playlistItemManager,s,this.scheduledAd);this.trigger("adClick",i)}adPaused(e){if(!this.paused){this.paused=!0;const t=e.getAd();null===this.reason&&this.isVpaidAd(t)&&(this.reason=r),this.setState(t,"paused")}}adResumed(e){if(this.paused){this.paused=!1;const t=e.getAd();null===this.reason&&this.isVpaidAd(t)&&(this.reason=r),this.setState(t,i)}}adSkipped(e){const t=e.getAd();this.debugConsoleLog("[JW DEBUG] AdSkipped"),this.adsLoaderManager.unbindEvents(["COMPLETE","VOLUME_CHANGED"]),this.finishAd();const s=Xe(this.playlistItemManager,t,this.scheduledAd);this.trigger(y,s)}adUserClose(e){var t;this.debugConsoleLog("[JW DEBUG] AdUserClose"),null!=this&&null!=(t=this.currentAd)&&t.isLinear()&&-1===this.currentAd.getDuration()?this.adSkipped(e):(this.adsLoaderManager.unbindEvents(["COMPLETE","VOLUME_CHANGED"]),this.finishAd())}allAdsCompleted(){this.stopAdsManager(),this.trigger("allAdsComplete",{})}stopAdsManager(){this.initAdsManagerPromise.then((e=>{this.destroyed()||(this.debugConsoleLog("[JW DEBUG] Stop IMA SDK adsManager"),e.stop(),e.destroy(),this.initAdsManagerPromise=null)})).catch(Je)}adLog(e){this.debugConsoleLog("[JW DEBUG]",e.type,e);const t=We(e,"getAdData"),s=null==t?void 0:t.adError;if(s&&402===s.getVastErrorCode())this.handleAdError(s,e);else if(s){const t=We(e,"getAd");this.trigger(p,Ge(this.playlistItemManager,s,t,this.scheduledAd,{jwpseg:this.adsLoaderManager.getJwpSeg(t)}))}}adError(e){const t=e.getError();this.handleAdError(t,e)}asyncError(e){var t;if(!this.destroyed())if(clearTimeout(this.timeoutAdStart),this.timeoutAdStart=setTimeout((()=>this.destroy()),0),null!=e&&e.getError){const t=e.getError();this.handleAdError(t,e,!0)}else null!=e&&null!=(t=e.target)&&t.src?console.error(`Failed to load ${e.target.src}`):console.error(e)}getAdErrorEventObject(e,t){const s=We(t,"getUserRequestContext"),i=s?s.offset:void 0;return Ge(this.playlistItemManager,e,null,this.scheduledAd,{offset:i})}handleAdError(e,t,s){this.options.debug&&console.error(e);const i=this.getAdErrorEventObject(e,t);this.player&&0===this.player.getPosition()&&(this._qoe.tick("adError"),i.timeLoading=this._qoe.between("adBeforePlay","adError")),this.trigger(p,i),this.destroyed()||(900===e.getErrorCode()||s?(clearTimeout(this.timeoutAdStart),this.timeoutAdStart=setTimeout((()=>this.destroy()),0)):this.destroy())}isVpaidAd(e){const t=e.getContentType();return"application/javascript"===t||"application/x-shockwave-flash"===t}destroy(){this.debugConsoleLog("[JW DEBUG] JW Player destroy AdsPlayer"),this.trigger("stopBlocking",{isDestroyed:!0}),this.off(),this.destroyed()||(this.player.off(null,null,this),clearTimeout(this.timeoutAdStart),clearInterval(this.progressIntervalId),this.currentAd=null,this.options=null,this.adsLoaderManager.reset(null,!0),this.view.adTakeDown(),this.video=null,this.initAdsManagerPromise=null,this.instreamProvider.off(),this.instreamProvider.setProxy(null),this.instreamProvider=null,this.view=null,this.player=null)}destroyed(){return!this.player}}let Ke=null;class Ye extends Qe{constructor(e,s,i,a,n,r,o,l,d,h){super(e,s,i,a,h),e.utils.extend(this,e.Events),this.client=t,this.config=a,this.options=n,this.player=e,this.utils=e.utils,this.adsLoaderManager=l,this.view=o,this.qoe=new e.utils.Timer,this.instreamProvider=r,this.vmapPromise=Promise.resolve(),this.fullscreenIcon=e.getContainer().querySelector(".jw-icon-fullscreen"),this.video=d,this.hasPreroll=!0,this.reason=null}checkPreroll(e){this.adsLoaderManager.initializeDisplay({restrict:!0}),this.reason=null!=e&&e.playReason?e.playReason:n,super.checkPreroll(e)}checkPostrolls(e){this.schedule.isVMAP()&&this.adsPlayer?this.adsPlayer.beforeComplete():super.checkPostrolls(e)}createAdsPlayer(e){this.adsPlayer&&!this.adsPlayer.destroyed()||(this.adsPlayer=new Fe(this,this.reason),this.adsPlayer.on("all",((t,s)=>"allAdsComplete"===t?(this.adsPlayer.destroy(),void(this.adsPlayer=null)):"stopBlocking"===t?(this.stopBlocking(null==s?void 0:s.isNonlinear),void(!e&&s&&s.isDestroyed&&(this.adsPlayer=null))):void("adError"!==t?(this.dequeueAdEvents(),this.trigger(t,s)):this.enqueueAdEvent(t,s,{preload:e})))))}initAdsPlayer(e,t,s){return e===w&&(this.reason=n),this.createAdsPlayer(s._preload),this.player.on("resize",(()=>this.adsPlayer.resize()),this.adsPlayer).on("fullscreen",(()=>this.adsPlayer.resize()),this.adsPlayer),this.adsPlayer.init(e,t,s).then((e=>{this.trigger("adsManager",{adsManager:e,videoElement:this.video})}))}adLoadRequest(e,t){const s=this.utils.extend({},this.config);s.ad=e,this.offset=e.offset||this.offset,s.adPosition=ne(this.player);const i=new Ue(s,this.player.getConfig(),this.utils),a=t?b:w,n=this.initAdsPlayer(a,i,e);return He(this.utils).then((()=>(this.adsPlayer.requestAds(),n)))}pause(e){this.adsPlayer&&this.adsPlayer.pause(e||{})}resume(e){this.adsPlayer&&this.adsPlayer.resume(e||{})}skipAd(){this.adsLoaderManager&&this.adsLoaderManager.skipAd()}skipAdBreak(){this.adsPlayer&&this.adsPlayer.asyncDiscardAdBreak()}dequeueAdEvents(){this._events.forEach((({type:e,event:t})=>{this.trigger(e,t)})),this._events.splice(0)}triggerAdBreakEvents(e,t){var s;e._position=e._position||t,this.blockingInstreamPlayer.once("destroyed",(()=>{this.dequeueAdEvents(),this.trigger("adBreakEnd",Xe(this,null,e))}));const i=Xe(this,null,e);this.trigger("adBreakStart",i),this.dequeueAdEvents(),null!=this&&null!=(s=this.adsPlayer)&&s.destroyed()&&this.stopBlocking()}async startBlocking(){if(!this.blockingInstreamPlayer&&!this.destroyed()){if(this.blockingInstreamPlayer=this.player.createInstream().init(),this.blockingInstreamPlayer.applyProviderListeners(this.instreamProvider),this.qoe.tick("adLoading"),this.blockingInstreamPlayer.adPlayPromise){if(!await this.waitForAdPlay(this.blockingInstreamPlayer.adPlayPromise))return}!function(e){if(Ke=e.getEnvironment(),!Ke.OS.iOS||Ke.Browser.version.major<10)return;const t=e.getContainer();t.requestFullscreen||t.webkitRequestFullscreen||e.getFullscreen()&&e.setFullscreen(!1)}(this.player),this.utils.addClass(this.player.getContainer(),k),this.adsPlayer&&!this.adsPlayer.destroyed()&&(this.adsPlayer.blockingInstreamPlayer=this.blockingInstreamPlayer),this.view.adSetup()}}stopBlocking(e){if(!this.destroyed()){var t;if(this.player.off("viewable",null,this),this.utils.removeClass(this.player.getContainer(),[f,A,k]),this.blockingInstreamPlayer)this.instreamProvider.off(),this.blockingInstreamPlayer.destroy(),this.blockingInstreamPlayer=null,null==(t=this.player)||t.trigger("adRequestedContentResume");e||this.view.adTakeDown()}}loadAd(e,t){if(e)return this.adsPlayer&&this.adsPlayer.scheduledAd!==e&&this.adsPlayer.destroy(),e._preload=!0,this.adLoadRequest(e,t)}playPreloadedPromise(e){e.then((()=>this.adsPlayer.startAdsLoader(this.blockingInstreamPlayer))).catch((()=>{this.stopBlocking()}))}startAdBreak(e,t){e&&(((e,t)=>{var s;let i;if(null!=e&&null!=(s=e._adQueue)&&s[0]){try{i=new URL(e._adQueue[0],window.location).protocol}catch(e){}"https:"!==i&&"https:"===window.location.protocol&&t.trigger(p,{message:"VPAID insecure request was blocked.",code:901,adErrorCode:50005})}})(e,this.player),this.adsPlayer&&this.adsPlayer.scheduledAd!==e&&this.adsPlayer.destroy(),this.startBlocking(),this.dequeueAdEvents(),this.adLoadRequest(e,t).then((()=>{this.adsPlayer.startAdsLoader(this.blockingInstreamPlayer)})).catch((()=>{this.stopBlocking()})))}destroy(){this.stopBlocking();const e=this.adsLoaderManager;e&&(e.reset(),this.adsLoaderManager=null),this.adsPlayer&&this.adsPlayer.destroy(),this.adsPlayer=null,super.destroy()}destroyed(){return null===this.adsLoaderManager}}class Ze{constructor(e,t){this.adsLoader=null,this.adDisplayContainer=null,this.displayInitialized=!1,this.initialized=!1,this.started=!1,this.adsRequest=null,this.userRequestContext=null,this.adsManager=null,this.adsLoaderEvents={},this.adsManagerEvents={},this.container=t,this.schedule=null,this.breakMap={},this.player=e,this.environment=e.getEnvironment()}getVpaidMode(e){const t=google.ima.ImaSdkSettings.VpaidMode;return"disabled"===e||"none"===e?t.DISABLED:"enabled"===e?t.ENABLED:t.INSECURE}initializeDisplay(e){this.adDisplayContainer&&!this.displayInitialized&&(this.adDisplayContainer.initialize(),null!=e&&e.restrict&&(this.displayInitialized=!0))}contentComplete(){this.adsLoader&&this.adsLoader.contentComplete()}reset(e,t){if(t){this.adsRequest=null,this.userRequestContext=null;const e=this.adsManager;e&&(e.destroy(),this.adsManager=null),this.adsManagerEvents={},Object.keys(this.adsLoaderEvents).forEach((e=>{this.adsLoader.removeEventListener(e,this.adsLoaderEvents[e])})),this.adsLoaderEvents={}}else this.contentComplete();e&&(this.schedule=null,this.breakMap={}),this.initialized=this.started=!1}prepare(e,t){const s=google.ima.settings;s.setDisableCustomPlaybackForIOS10Plus(!0);const i=t.locale||this.player.getConfig().language;s.setLocale(i);const a=t.ppid;return a&&s.setPpid(a),"enabled"===t.omidSupport&&s.setFeatureFlags({enableOmidBeta:!0}),t.maxRedirects>=0&&s.setNumRedirects(t.maxRedirects),null===this.adsLoader&&(this.adDisplayContainer=new google.ima.AdDisplayContainer(this.container,e),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer)),this.adsLoader}open(e,t,s){const i=this.prepare(s,t);return new Promise(((e,t)=>{i.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,t,!1),i.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e,!1),this.adsLoaderEvents[google.ima.AdErrorEvent.Type.AD_ERROR]=t,this.adsLoaderEvents[google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED]=e}))}requestAds(e,t,s,i){if(null!==this.adsRequest)return;if(!i)return;const a=this.player,n=this.adsRequest=new google.ima.AdsRequest,r=this.userRequestContext={requestType:e,vpaidMode:t.vpaidmode,playerVersion:a.version.split("+")[0],adPosition:t.adPosition};n.setAdWillAutoPlay(!1!==a.getConfig().autostart),n.setAdWillPlayMuted(a.getMute());const o=a.getSafeRegion(!1);n.linearAdSlotWidth=o.width,n.linearAdSlotHeight=o.height;const l=a.getSafeRegion(!0);n.nonLinearAdSlotWidth=l.width,n.nonLinearAdSlotHeight=l.height,n.forceNonLinearFullSlot=s.forceNonLinearFullSlot,n.vastLoadTimeout=s.vastLoadTimeout,"enabled"===t.omidSupport&&(n.omidAccessModeRules=t.omidAccessModeRules);const d=this.adsLoader.getSettings(),h=this.getVpaidMode(r.vpaidMode);if(d.setPlayerType("jwplayer"),d.setPlayerVersion(r.playerVersion),d.setVpaidMode(h),i._pod)n.adsResponse=r.adsResponse=((e,t)=>{const s=document.implementation.createDocument("http://www.iab.net/videosuite/vmap","vmap:VMAP",null),i=s.documentElement;return i.setAttribute("version","1.0"),e.forEach((e=>{const a=s.createElement("vmap:AdTagURI");a.appendChild(s.createCDATASection(e));const n=i.appendChild(s.createElement("vmap:AdBreak")),r=`${t}`.replace("pre","start").replace("post","end");n.setAttribute("timeOffset",r);const o=n.appendChild(s.createElement("vmap:AdSource"));o.setAttribute("allowMultipleAds","true"),o.setAttribute("followRedirects","true"),o.appendChild(a)})),i.outerHTML||(new XMLSerializer).serializeToString(i)})(i._pod,i._offSet);else if(i.adm||i._adXML)n.adsResponse=r.adsResponse=i.adm||i._adXML;else if(i.tag||i._adQueue&&1===i._adQueue.length){const e=i.tag||i._adQueue[0];n.adTagUrl=r.adTagUrl=e.trim()}else{var u;const e=null!=i&&null!=(u=i._adQueue)&&u.length?(e=>{const t=document.implementation.createDocument("http://www.w3.org/2001/XMLSchema-instance","VAST",null),s=t.documentElement;return s.setAttribute("version","2.0"),e.forEach(((e,i)=>{const a=t.createElement("Ad");a.setAttribute("id",i);const n=t.createElement("Wrapper"),r=t.createElement("Extensions"),o=t.createElement("Extension");o.setAttribute("type","waterfall"),o.setAttribute("fallback_index",i);const l=t.createElement("VASTAdTagURI");l.appendChild(t.createCDATASection(e)),a.appendChild(n),n.appendChild(l),n.appendChild(r),r.appendChild(o),s.appendChild(a)})),s.outerHTML||(new XMLSerializer).serializeToString(s)})(i._adQueue):i.xml;n.adsResponse=r.adsResponse=e}this.adsLoader.requestAds(n,r)}getAdsManager(e,t,s){const i=new google.ima.AdsRenderingSettings;i.enablePreloading=s.enablePreloading||s.preloadAds,i.loadVideoTimeout=s.loadVideoTimeout,i.uiElements=null,i.useStyledNonLinearAds=!0,this.environment.OS.android&&this.environment.Browser.chrome&&this.environment.Browser.version.major>=84&&(i.mimeTypes=["video/mp4","video/webm","audio/mp4","audio/webm"]);const a=this.player.getConfig().bandwidthEstimate;if(i.bitrate=a?a/1e3:-1,s.customUi){s.customUi.disableUi&&(i.disableUi=!0)}return this.adsManager=e.getAdsManager(t,i),this.userRequestContext=e.getUserRequestContext(),this.adsManager}init(e,t,s){null!==this.adsManager&&!1===this.initialized&&(this.adsManager.init(e,t,s),this.initialized=!0)}start(){null!==this.adsManager&&!1===this.started&&(this.initializeDisplay({restrict:!0}),this.adsManager.start(),this.started=!0)}bindEvents(e){const t=google.ima.AdEvent.Type,s=google.ima.AdErrorEvent.Type;Object.keys(e).forEach((i=>{const a=t[i]||s[i],n=this.adsManagerEvents[a];n&&this.adsManager.removeEventListener(a,n),this.adsManager.addEventListener(a,e[i],!1),this.adsManagerEvents[a]=e[i]}))}unbindEvents(e){const t=google.ima.AdEvent.Type,s=google.ima.AdErrorEvent.Type;e.forEach((e=>{const i=t[e]||s[e],a=this.adsManagerEvents[i];a&&(this.adsManager.removeEventListener(i,a),delete this.adsManagerEvents[i])}))}getTag(e){if("string"==typeof this.schedule)return this.schedule;const t=We(e,"getAdPodInfo");if(t){const e=this.breakMap[We(t,"getTimeOffset")]||{};if(e.tag)return e.tag}return this.userRequestContext?this.userRequestContext.adTagUrl||this.userRequestContext.adsResponse||"":(console.error("invalid request context",this.userRequestContext),"")}getJwpSeg(e){const t=We(e,"getAdPodInfo");if(t){var s,i;const e=We(t,"getTimeOffset");return null==this||null==(s=this.breakMap)||null==(i=s[e])?void 0:i.jwpseg}return null}_getTimeoffsetFromPosition(){const e=this.player.getPosition();let t,s=1/0;return Object.keys(this.breakMap).forEach((i=>{const a=e-i;a>=0&&a<s&&(t=i,s=a)})),s===1/0?-1:t}skipAd(){this.adsManager&&this.adsManager.skip()}getBid(e){const t=Z(e,this.player.utils);return this.breakMap[t]?this.breakMap[t].bid:null}setBid(e,t){const s=Z(e,this.player.utils);this.breakMap[s]=this.breakMap[s]||{},this.breakMap[s].bid=t}}const et={},tt={},st={},it=(e,t)=>{const s=et[t];return s||(et[t]=new Promise(((s,i)=>{const a=new e.key(t);if("unlimited"===a.edition())return i();const n=["//","entitlements.jwplayer.com","/",a.token(),".json"];"file:"===window.location.protocol&&n.unshift("https:"),e.ajax(n.join(""),(function(e){const t=null==e?void 0:e.response;t?s(t):i()}),(function(){i()}),{timeout:1e4,responseType:"json"})})))},at=(e,t)=>{const s=tt[t];return s||(tt[t]=it(e,t).catch((()=>({}))).then((e=>{if(!1===e.canUseVPB)throw new Error("Not entitled for Player Bidding")})))},nt=(e,t,s)=>{const i=st[t];return i||(st[t]=it(e,t).catch((()=>({}))).then((e=>{let t,i;if(!0===s.outstream?(t=!1!==e.canPlayOutstreamAds,i="Outstream Ad Limit Reached"):(t=!1!==e.canPlayAds,i="Ad Limit Reached"),!1===t)throw new Error(i);return{message:"Can Play Ads"}})))},rt=function(){};var ot="8.10.0";!function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");t.setAttribute("media","screen"),t.innerHTML=e,document.head.appendChild(t)}}(".jw-plugin-googima{overflow:hidden;width:100%;height:100%;display:block;visibility:hidden;pointer-events:none;opacity:0}.jw-plugin-googima.jw-ad-instream{visibility:visible;display:block;pointer-events:all;opacity:1}.jw-plugin-googima.jw-ad-instream .jw-ads-view>:not(div),.jw-plugin-googima.jw-ad-instream .jw-ads-view>div:not(:empty){width:100%;height:100%}.jw-plugin-googima.jw-ad-linear{top:0;left:0;bottom:0}.jw-plugin-googima.jw-ad-non-linear{top:auto}.jw-plugin-googima .jw-ads-view{position:absolute;width:100%;height:100%}.jwplayer.jw-flag-ads-googleima.jw-flag-touch .jw-controlbar{font-size:1em}.jwplayer.jw-flag-ads-googleima.jw-flag-touch .jw-display-icon-display,.jwplayer.jw-flag-ads-googleima.jw-flag-touch .jw-display-icon-display .jw-icon-display{pointer-events:none}.jwplayer.jw-flag-ads-googleima .jw-controlbar{background:0 0!important;pointer-events:none}.jwplayer.jw-flag-ads-googleima .jw-controlbar .jw-horizontal-volume-container{pointer-events:auto}.jwplayer.jw-flag-ads-googleima .jw-controlbar .jw-icon{pointer-events:all}.jwplayer.jw-flag-ads-googleima .jw-controlbar .jw-icon-fullscreen:not(.jw-fullscreen-ima){display:none}.jwplayer.jw-flag-ads-googleima .jw-controlbar .jw-fullscreen-ima{display:flex}.jwplayer.jw-flag-ads-googleima .jw-controls-backdrop{display:none}.jwplayer.jw-flag-ads-googleima.jw-ie .jw-slider-volume,.jwplayer.jw-flag-ads-googleima.jw-ie .jw-svg-icon{background:rgba(0,0,0,.25);border-radius:3px}.jwplayer.jw-flag-ads-googleima.jw-ie .jw-slider-volume{margin:0 10px}@supports (filter:drop-shadow(0 0 3px #000)){.jwplayer.jw-flag-ads-googleima.jw-ie .jw-slider-volume,.jwplayer.jw-flag-ads-googleima.jw-ie .jw-svg-icon{background:0 0;border-radius:0}.jwplayer.jw-flag-ads-googleima.jw-ie .jw-slider-volume{margin:0}}.jwplayer.jw-flag-ads-googleima .jw-controlbar .jw-svg-icon{fill:#fff;filter:drop-shadow(0 0 3px #000)}.jwplayer.jw-flag-ads-googleima .jw-controlbar .jw-text{text-shadow:0 0 3px #000}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player.jw-flag-ads.jw-state-playing.jw-flag-touch:not(.jw-flag-ads-vpaid) .jw-controls .jw-controlbar{pointer-events:none}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-controlbar{flex-flow:column-reverse nowrap;height:100%;max-height:none}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-button-container{align-items:flex-end;flex-wrap:wrap;margin-bottom:7px}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-controlbar .jw-icon{height:30px}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-text{align-self:flex-start;margin:16px 0 0 16px;order:-1;width:100%}"),function(e,t,s){try{(window.jwplayerPluginJsonp||window.jwplayer().registerPlugin)(e,t,s)}catch(e){}}(t,"8.1",class extends _{constructor(e,s,i,a){super(e,s,i,t),this.player.utils.extend(this,this.player.Events),this.configScheduleParser=new xe(this.player,this.pluginConfig,t),this.options=new Ue(this.pluginConfig||{},this.player.getConfig(),this.player.utils),this.adRules=this.configScheduleParser.getAdRules(),this.videoElement=null,this.playlistItemEventCount=0,this.nextPlaylistItemManager=null,this.nextPlaylistRelated=!1,this.bidsBlock=this.pluginConfig.bids,a&&a.sdkPromise&&a.checkEntitlements?(a.checkEntitlements(),a.sdkPromise()):(!function(e,t,s,i){const a=t.key,n=e.utils,r=nt(n,a,s);let o;r.catch(rt),s.bids&&(o=at(n,a),o.catch(rt)),e.on("ready",(()=>{o&&o.catch((s=>{e.trigger("destroyBidding"),e.trigger(p,je(s.message,60009,t,i))})),r.catch((s=>{e.trigger("destroyPlugin",s),e.trigger(p,je(s.message,60002,t,i))}))}))}(this.player,this.playerConfig,this.pluginConfig,t),He(this.player.utils).catch(this.player.utils.noop)),this.view=new qe(this.div,this.player.id,this.player.utils),this.instreamProvider=new $e(this.player.utils,this.player.Events,this.view),this.adsLoader=new Ze(this.player,this.view.getAdDiv()),this.version=ot,this.player.loadAdTag=this.loadAdTag.bind(this),this.player.loadAdXml=this.loadAdXml.bind(this),this.player.playAd=this.loadAdTag.bind(this),this.player.on("ready",this.onReady,this),this.player.on("playlistItem",this.onPlaylistItemCallback,this),this.player.on("playlistComplete",this.onPlaylistCompleteCallback,this),this.player.on("cast",this.onCastCallback,this),this.player.on("mute",this.onMuteCallback,this),this.player.on("destroyPlugin",this.onDestroyPlugin,this),this.player.on("destroyBidding",this.onDestroyBidding,this),this.player.isReady()&&this.lateInitAfterReady()}adsDebugMode(){this.options.debug=!0,this.playlistItemManager&&(this.playlistItemManager.debugConsoleLog=function(...e){console.log(e)})}getCompanions(e,t,s,i){try{return e.getCompanionAds(t,s,i)}catch(e){return[]}}addCompanionsToDOM(e){if(!e||!e.length)return;const t=document.getElementById(this.options.companiondiv.id);if(!t)return;const s=e[0];s&&("function"==typeof s.getContent?t.innerHTML=s.getContent():t.innerHTML=s.resource||s.content)}convertCompanions(e){const t=[];for(let s=0;s<e.length;s++){const i=e[s];t.push({width:i.getWidth(),height:i.getHeight(),type:"html",resource:i.getContent()})}return t}manageCompanionAd(e){const t=e.currentAd;let s=new google.ima.CompanionAdSelectionSettings;s.sizeCriteria=google.ima.CompanionAdSelectionSettings.SizeCriteria.IGNORE;const i=this.options.companiondiv||{width:300,height:250},a=this.convertCompanions(this.getCompanions(t,i.width,i.height,s));let n=a.length;if(n){const s=Xe(this.playlistItemManager,t,e.scheduledAd);s.companions=a,this.player.trigger("adCompanions",s)}if(this.options.companiondiv){s=new google.ima.CompanionAdSelectionSettings,this.options.companionResourceType&&(s.resourceType=google.ima.CompanionAdSelectionSettings.ResourceType[this.options.companionResourceType]);const e=this.getCompanions(t,this.options.companiondiv.width,this.options.companiondiv.height,s);n=Math.max(n,e.length),this.addCompanionsToDOM(e)}return n>0}resetSchedule(e){var t;null!=this&&null!=(t=this.playlistItemManager)&&t.adsPlayer&&this.playlistItemManager.adsPlayer.destroy(),this.reset(e),this.adsLoader.contentComplete(),function(e){const t=e.getCues();if(Array.isArray(t)&&t.length){const s=t.filter((e=>"ads"!==e.cueType));e.setCues(s)}}(this.player)}createPlaylistItemManager(e,t,s,i){const a=e.item||{},n=this.configScheduleParser.getSchedule(a,s.playlistItemEventCount),r=new(null!=i&&i.PlaylistItemManager?i.PlaylistItemManager:Ye)(this.player,n,a,this.pluginConfig,this.options,this.instreamProvider,this.view,this.adsLoader,this.videoElement,this.casting);return r.on("all",((e,t)=>{if("preloadNext"!==e)this.player.trigger(e,t);else{const e=Object.assign({},s,{preloadPreroll:!0,playlistItemEventCount:this.playlistItemEventCount+1});r.next=this.createPlaylistItemManager(t,b,e)}})),r.init(this.bidsBlock,s),r.on(m,(()=>this.manageCompanionAd(r.adsPlayer))),r}handlePlaylistItem(e,t,s,i){null!=i&&i.sdkPromise?i.sdkPromise():He(this.player.utils).then((()=>{this.adsLoader.prepare(this.videoElement,s)}));const a=e.item||this.player.getPlaylistItem(e.index);this.resetSchedule(!0);const n=this.configScheduleParser.getSchedule(a,this.playlistItemEventCount);!(t===b&&!this.adRules.rulesAllowAdPlayback(this.playlistItemEventCount))&&n&&(n.getAllAds().length||n.isVMAP())&&(this.nextPlaylistItemManager&&a!==this.nextPlaylistItemManager.item&&!1===this.nextPlaylistRelated&&(this.nextPlaylistItemManager.off(null,null,this),this.nextPlaylistItemManager.destroy(),this.nextPlaylistItemManager=null),this.adsLoader.reset(!0),this.playlistItemManager=this.nextPlaylistItemManager||this.createPlaylistItemManager(e,t,s),this.playlistItemManager.attachListeners(),this.nextPlaylistItemManager=null,this.nextPlaylistRelated=!1)}loadAdTag(e,t){let s;s=this.player._.isArray(e)?e.slice(0):[e],this.buildAndLoadAdObj({_adQueue:s},t)}loadAdXml(e,t){this.buildAndLoadAdObj({_adXML:e},t)}buildAndLoadAdObj(e,t){const s={_position:ne(this.player),adBreakId:this.player.utils.genId(12)},i=Object.assign(s,e);this.loadAdObj(i,t)}loadAdObj(e,t){const s=this.player.utils.extend({},this.pluginConfig),i=new(null!=t&&t.Options?t.Options:Ue)(s,this.player.getConfig(),this.player.utils),a=this.playlistItemManager?this.playlistItemManager.blockingInstreamPlayer:null;a&&(a.noResume=!0),this.reset(),this.playlistItemManager=this.createPlaylistItemManager({item:this.player.getPlaylistItem()},w,i),this.playlistItemManager&&!this.playlistItemManager.destroyed()&&(this.playlistItemManager.startAdBreak(e),this.playlistItemManager.triggerAdBreakEvents(e))}handleDependencyError(e,t){this.destroy(),this.player.trigger(p,Ge(null,{message:e,adErrorCode:t,id:v,placement:F(this.playerConfig),tag:""}))}onReady(e){if(this.videoElement||(this.videoElement=this.player.createInstream().getMediaElement()),null!=e&&e.sdkPromise?e.sdkPromise():He(this.player.utils).catch((e=>{e.message.match(/Failed to load/)&&this.handleDependencyError("Ad playback blocked by an ad blocker",2e4)})),"idle"!==this.player.getState())return;const t=document.body;this.primeAdDisplay=()=>{t.removeEventListener("mouseup",this.primeAdDisplay),t.removeEventListener("touchend",this.primeAdDisplay),this.adsLoader.initializeDisplay(),this.primeAdDisplay=null},t.addEventListener("mouseup",this.primeAdDisplay,!1),t.addEventListener("touchend",this.primeAdDisplay,!1)}onPlaylistItemCallback(e){this.playlistItemEventCount++;const t=Object.assign({playlistItemEventCount:this.playlistItemEventCount},this.options);this.handlePlaylistItem(e,b,t),this.playlistItemManager&&!this.playlistItemManager.schedule.isVMAP()&&this.sendCues(this.playlistItemManager.schedule,this.options.cuetext)}onPlaylistCompleteCallback(){this.resetSchedule(!0)}onCastCallback(e){this.casting=Boolean(e.active),e.active&&this.resetSchedule()}onMuteCallback(e){this.instreamProvider.mute(e)}onDestroyPlugin(){this.reset()}onDestroyBidding(){this.bidsBlock=null}reset(e){this.playlistItemManager&&(e&&(this.nextPlaylistItemManager=this.playlistItemManager.next,this.nextPlaylistRelated=this.playlistItemManager.nextPlaylistRelated),this.playlistItemManager.off(null,null,this),this.playlistItemManager.destroy(),this.playlistItemManager=null),this.primeAdDisplay&&(document.body.removeEventListener("mouseup",this.primeAdDisplay),document.body.removeEventListener("touchend",this.primeAdDisplay)),this.configScheduleParser.reset()}destroy(){var e;this.reset(),null!=this&&null!=(e=this.adsLoader)&&e.adDisplayContainer&&this.adsLoader.adDisplayContainer.destroy(),this.resetCues(),this.player.off(null,null,this),this.player.playAd=this.player.utils.noop,this.player.loadAdTag=this.player.utils.noop,this.player.loadAdXml=this.player.utils.noop,this.player.pauseAd=this.player.utils.noop}})}();