@viewlift/player-backup 2.0.316-backup → 2.0.318-backup

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/cjs/{autoNextVideo-aca868b2.js → autoNextVideo-6704601a.js} +1 -1
  2. package/cjs/bundle.css +1085 -979
  3. package/cjs/{features-ba230d44.js → features-ef61de84.js} +1 -1
  4. package/cjs/{generic-b119e225.js → generic-754b73b9.js} +1 -1
  5. package/cjs/{index-c1289347.js → index-58a5e66f.js} +1 -1
  6. package/cjs/{index-90eaa87b.js → index-759a1ed5.js} +1 -1
  7. package/cjs/{index-069a9358.js → index-94a82c6b.js} +1 -1
  8. package/cjs/index-c82f1ab8.js +1 -0
  9. package/cjs/index.js +1 -1
  10. package/cjs/{multicamv2-afc38215.js → multicamv2-a5ccde69.js} +1 -1
  11. package/cjs/{multicamv2-1de3d2cf.js → multicamv2-c0ea0f16.js} +1 -1
  12. package/cjs/{nextEpisodeButton-ba5016fe.js → nextEpisodeButton-94a6e1c3.js} +1 -1
  13. package/cjs/{playlist-4c8be9da.js → playlist-869072fe.js} +1 -1
  14. package/cjs/{series-b93644c2.js → series-45f423d1.js} +1 -1
  15. package/cjs/{series-v2-93b2300c.js → series-v2-85099d28.js} +1 -1
  16. package/cjs/{series-v2-706cd019.js → series-v2-fa48542f.js} +1 -1
  17. package/cjs/{skin-e69b9634.js → skin-0ba3b5ee.js} +1 -1
  18. package/cjs/{skin-e0837286.js → skin-0f4c3f0c.js} +1 -1
  19. package/cjs/{skin-9fd7e847.js → skin-10eb465d.js} +1 -1
  20. package/cjs/{skin-ebca6c8b.js → skin-13f1ddc0.js} +1 -1
  21. package/cjs/{skin-dcc335ff.js → skin-211ae95b.js} +1 -1
  22. package/cjs/{skin-32b69fad.js → skin-a015e59f.js} +1 -1
  23. package/cjs/{skin-6dfcf154.js → skin-ba4cd74f.js} +1 -1
  24. package/cjs/{skin-20ef2a38.js → skin-c6e91e59.js} +1 -1
  25. package/cjs/{skin-bf860a27.js → skin-e5bc212a.js} +1 -1
  26. package/cjs/{skin-35b032cc.js → skin-f7c8304f.js} +1 -1
  27. package/cjs/videoSelector-3c8fb5e9.js +1 -0
  28. package/cjs/{videoSelector-cf477c8e.js → videoSelector-e8c72f5d.js} +1 -1
  29. package/cjs/{videojs-dash5.es-fd74bd77.js → videojs-dash5.es-e6b0205f.js} +1 -1
  30. package/esm/{autoNextVideo-91c70a62.js → autoNextVideo-d5b82444.js} +1 -1
  31. package/esm/bundle.css +1085 -979
  32. package/esm/components/video-selector/videoSelector.d.ts +1 -0
  33. package/esm/{features-ee38c5bb.js → features-99081d09.js} +1 -1
  34. package/esm/{generic-d8ac6622.js → generic-f765c6f0.js} +1 -1
  35. package/esm/index-32db0990.js +1 -0
  36. package/esm/{index-22ed302f.js → index-894852f9.js} +1 -1
  37. package/esm/{index-554f98ba.js → index-97684837.js} +1 -1
  38. package/esm/{index-080bf7b9.js → index-aba78d94.js} +1 -1
  39. package/esm/index.js +1 -1
  40. package/esm/{multicamv2-52fd51a9.js → multicamv2-455bd82e.js} +1 -1
  41. package/esm/{multicamv2-f174146d.js → multicamv2-723a367d.js} +1 -1
  42. package/esm/{nextEpisodeButton-a6d2c73b.js → nextEpisodeButton-6ceba54e.js} +1 -1
  43. package/esm/{playlist-a412afc9.js → playlist-16d651a2.js} +1 -1
  44. package/esm/{series-becfa7b8.js → series-99ed8498.js} +1 -1
  45. package/esm/{series-v2-1736cc8f.js → series-v2-d9d8653b.js} +1 -1
  46. package/esm/{series-v2-5442a8d9.js → series-v2-ec6c014a.js} +1 -1
  47. package/esm/{skin-8a5bf136.js → skin-0c5cb109.js} +1 -1
  48. package/esm/{skin-076873a1.js → skin-513a9b7d.js} +1 -1
  49. package/esm/{skin-e0e20103.js → skin-5b9c3675.js} +1 -1
  50. package/esm/{skin-1c90159f.js → skin-66c6b120.js} +1 -1
  51. package/esm/{skin-500c2418.js → skin-953812ed.js} +1 -1
  52. package/esm/{skin-4f4fee6c.js → skin-b471f198.js} +1 -1
  53. package/esm/{skin-b8d4c095.js → skin-c182cabd.js} +1 -1
  54. package/esm/{skin-3be46735.js → skin-e63ece28.js} +1 -1
  55. package/esm/{skin-c212b8d7.js → skin-f3c11ee9.js} +1 -1
  56. package/esm/{skin-56f6d601.js → skin-ffe5b1ec.js} +1 -1
  57. package/esm/{videoSelector-c77c3f9e.js → videoSelector-ba26c654.js} +1 -1
  58. package/esm/{videoSelector-45e68ccd.js → videoSelector-fc8de3a6.js} +1 -1
  59. package/esm/{videojs-dash5.es-ea7b0efc.js → videojs-dash5.es-43f0858c.js} +1 -1
  60. package/package.json +1 -1
  61. package/cjs/index-9c7a1bcb.js +0 -1
  62. package/cjs/videoSelector-0747ad7d.js +0 -1
  63. package/esm/index-54e8aa9b.js +0 -1
@@ -1 +1 @@
1
- "use strict";var e=require("video.js"),t=require("./generic-b119e225.js"),r=require("./renditions-2d73c43d.js"),o=require("./skin-5a0cbc97.js"),l=require("./localisation-443f3f19.js");exports.addBigMuteButton=(t,r)=>{Promise.resolve().then(function(){return require("./index-3ff024d5.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("MuteButton",n),s.addChild("MuteButton",{playerId:t,...r})})},exports.addCaptionButton=(t,r)=>{Promise.resolve().then(function(){return require("./caption-settings-d2b4b7e3.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("captionSelector",n),document?.getElementById(t)?.getElementsByClassName("caption-selection vjs-control vjs-button")?.[0]?.remove(),s&&s.getChild("controlBar").addChild("captionSelector",{playerId:t,options:r},s.controlBar.children().length-3)})},exports.addDBClickFullScreen=e=>{const t=o.getPlayer(e).el();let r=0;const l=o.getPlayer(e);l.addChild("fullscreenToggle");const n=()=>{let e=t?.getElementsByClassName("vjs-fullscreen-control")?.[0];e&&e.click()};l.el().addEventListener("dblclick",n),window._multiplayer_dbClickHandler=n;l.el().addEventListener("touchend",()=>{const e=(new Date).getTime(),o=e-r;if(o<300&&o>0){let e=t?.getElementsByClassName("vjs-fullscreen-control")?.[0];e&&e.click()}r=e}),window._multiplayer_dbTapHandler=n},exports.addMulticamSelector=(t,r)=>{Promise.resolve().then(function(){return require("./multicamv2-afc38215.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("streamSelector",n),s.getChild("controlBar").addChild("streamSelector",{playerId:t,streams:r},s.controlBar.children().length-4)})},exports.addMulticamSelector_DEFAULTV2_TEMP=(t,r)=>{Promise.resolve().then(function(){return require("./multicamv2-1de3d2cf.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("streamSelector",n),s.getChild("controlBar").addChild("streamSelector",{playerId:t,streams:r},s.controlBar.children().length-4)})},exports.addNextEpisodeButton=(t,r,l)=>{Promise.resolve().then(function(){return require("./nextEpisodeButton-ba5016fe.js")}).then(n=>{let s=n.default,i=o.getPlayer(l);e.registerComponent("nextEpisodeButtonModule",s),i.getChild("controlBar").addChild("nextEpisodeButtonModule",{playerId:l,sres:t,res:r},i.controlBar.children().length-5)})},exports.addOutputtingOverlay=(t,r)=>{let l=o.getPlayer(t).el(),n=e.dom.createEl("div",{className:"output-overlay",innerHTML:`<iframe frameBorder="0" src=${r}></iframe>`});l.append(n)},exports.addPlaylistSelector=(t,r)=>{Promise.resolve().then(function(){return require("./playlist-4c8be9da.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("playlistSelector",n),s.getChild("controlBar").addChild("playlistSelector",{playerId:t,playlist:r},s.controlBar.children().length-3)})},exports.addResolutionModule=(t,l,n)=>{Promise.resolve().then(function(){return require("./resolution-68945558.js")}).then(s=>{let i=s.default;document.getElementById(t).getElementsByClassName("container")[0]&&document.getElementById(t).getElementsByClassName("container")[0].remove();let d=o.getPlayer(t),a=r.getRenditions(t);a?.length>0&&(e.registerComponent("resolutionModule",i),d.getChild("controlBar").addChild("resolutionModule",{playerId:t,skin:l,icon:n,renditions:a},d.controlBar.children().length-4))})},exports.addRewindButton=(r,l,n)=>{var s=e.getComponent("Button");e.registerComponent("MyButton",class extends s{constructor(e,t){super(e,t);var r=this.el_;r.classList.add("vjs-rewind-button");const l=o.parseSvgString(n);r.append(l)}handleClick(){t.rewind(r,10)}}),e(r).getChild("controlBar").addChild("myButton",{},1)},exports.addSeriesModule=(t,r,l)=>{Promise.resolve().then(function(){return require("./series-b93644c2.js")}).then(n=>{let s=n.seriesModule,i=o.getPlayer(t);e.registerComponent("seriesModule",s),i.getChild("controlBar").addChild("seriesModule",{playerId:t,seriesData:r},i.controlBar.children().length-4);let d=document.querySelectorAll(".season-title-sdk");for(let e=0;e<d.length;e++)d[e].addEventListener("click",()=>{r[e]&&n.handleSeasonChange(r[e],e,i,l)})})},exports.addSeriesSelectorV2=(t,r)=>{Promise.resolve().then(function(){return require("./series-v2-93b2300c.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("seriesV2",n),s.getChild("controlBar").addChild("seriesV2",{playerId:t,...r},s.controlBar.children().length-3)})},exports.addSeriesSelectorV2_DEFAULTV2_TEMP=(t,r)=>{Promise.resolve().then(function(){return require("./series-v2-706cd019.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("seriesV2",n),s.getChild("controlBar").addChild("seriesV2",{playerId:t,...r},s.controlBar.children().length-3)})},exports.addSettingsButtonV2=(t,r)=>{Promise.resolve().then(function(){return require("./settings-icon-3b19759d.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("settingsSelector",n),document?.getElementById(t)?.getElementsByClassName("settings-selection vjs-control vjs-button")?.[0]?.remove(),s&&s.getChild("controlBar").addChild("settingsSelector",{playerId:t,options:r},s.controlBar.children().length-3)})},exports.addSkipButton=(r,l,n)=>{var s=e.getComponent("Button");e.registerComponent("MyButton",class extends s{constructor(e,t){super(e,t);var r=this.el_;r.classList.add("vjs-skip-button");const l=o.parseSvgString(n);r.append(l)}handleClick(){t.skip(r,10)}}),e(r).getChild("controlBar").addChild("myButton",{},1)},exports.addSlowMotion=t=>{var r=e.getComponent("Button");e.registerComponent("MyButton",class extends r{constructor(e,t){super(e,t);var r=this.el_;r.classList.add("vjs-slowmo-button"),r.textContent=l.getLocalisation("slowMoText")||"Slow Mo"}handleClick(){1==o.playbackRate()?(o.playbackRate(.5),this.el().style.background="darkgray"):(o.playbackRate(1),this.el().style.background="none")}});var o=e(t);o.getChild("controlBar").addChild("myButton",{},2)},exports.addVideoSelector=(t,r)=>{Promise.resolve().then(function(){return require("./videoSelector-0747ad7d.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("videoSelector",n),s.getChild("controlBar").addChild("videoSelector",{playerId:t,related:r},s.controlBar.children().length-3)})},exports.addVideoSelector_DEFAULTV2_TEMP=(t,r)=>{Promise.resolve().then(function(){return require("./videoSelector-cf477c8e.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("videoSelector",n),s.getChild("controlBar").addChild("videoSelector",{playerId:t,related:r},s.controlBar.children().length-3)})};
1
+ "use strict";var e=require("video.js"),t=require("./generic-754b73b9.js"),r=require("./renditions-2d73c43d.js"),o=require("./skin-5a0cbc97.js"),l=require("./localisation-443f3f19.js");exports.addBigMuteButton=(t,r)=>{Promise.resolve().then(function(){return require("./index-3ff024d5.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("MuteButton",n),s.addChild("MuteButton",{playerId:t,...r})})},exports.addCaptionButton=(t,r)=>{Promise.resolve().then(function(){return require("./caption-settings-d2b4b7e3.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("captionSelector",n),document?.getElementById(t)?.getElementsByClassName("caption-selection vjs-control vjs-button")?.[0]?.remove(),s&&s.getChild("controlBar").addChild("captionSelector",{playerId:t,options:r},s.controlBar.children().length-3)})},exports.addDBClickFullScreen=e=>{const t=o.getPlayer(e).el();let r=0;const l=o.getPlayer(e);l.addChild("fullscreenToggle");const n=()=>{let e=t?.getElementsByClassName("vjs-fullscreen-control")?.[0];e&&e.click()};l.el().addEventListener("dblclick",n),window._multiplayer_dbClickHandler=n;l.el().addEventListener("touchend",()=>{const e=(new Date).getTime(),o=e-r;if(o<300&&o>0){let e=t?.getElementsByClassName("vjs-fullscreen-control")?.[0];e&&e.click()}r=e}),window._multiplayer_dbTapHandler=n},exports.addMulticamSelector=(t,r)=>{Promise.resolve().then(function(){return require("./multicamv2-a5ccde69.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("streamSelector",n),s.getChild("controlBar").addChild("streamSelector",{playerId:t,streams:r},s.controlBar.children().length-4)})},exports.addMulticamSelector_DEFAULTV2_TEMP=(t,r)=>{Promise.resolve().then(function(){return require("./multicamv2-c0ea0f16.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("streamSelector",n),s.getChild("controlBar").addChild("streamSelector",{playerId:t,streams:r},s.controlBar.children().length-4)})},exports.addNextEpisodeButton=(t,r,l)=>{Promise.resolve().then(function(){return require("./nextEpisodeButton-94a6e1c3.js")}).then(n=>{let s=n.default,i=o.getPlayer(l);e.registerComponent("nextEpisodeButtonModule",s),i.getChild("controlBar").addChild("nextEpisodeButtonModule",{playerId:l,sres:t,res:r},i.controlBar.children().length-5)})},exports.addOutputtingOverlay=(t,r)=>{let l=o.getPlayer(t).el(),n=e.dom.createEl("div",{className:"output-overlay",innerHTML:`<iframe frameBorder="0" src=${r}></iframe>`});l.append(n)},exports.addPlaylistSelector=(t,r)=>{Promise.resolve().then(function(){return require("./playlist-869072fe.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("playlistSelector",n),s.getChild("controlBar").addChild("playlistSelector",{playerId:t,playlist:r},s.controlBar.children().length-3)})},exports.addResolutionModule=(t,l,n)=>{Promise.resolve().then(function(){return require("./resolution-68945558.js")}).then(s=>{let i=s.default;document.getElementById(t).getElementsByClassName("container")[0]&&document.getElementById(t).getElementsByClassName("container")[0].remove();let d=o.getPlayer(t),a=r.getRenditions(t);a?.length>0&&(e.registerComponent("resolutionModule",i),d.getChild("controlBar").addChild("resolutionModule",{playerId:t,skin:l,icon:n,renditions:a},d.controlBar.children().length-4))})},exports.addRewindButton=(r,l,n)=>{var s=e.getComponent("Button");e.registerComponent("MyButton",class extends s{constructor(e,t){super(e,t);var r=this.el_;r.classList.add("vjs-rewind-button");const l=o.parseSvgString(n);r.append(l)}handleClick(){t.rewind(r,10)}}),e(r).getChild("controlBar").addChild("myButton",{},1)},exports.addSeriesModule=(t,r,l)=>{Promise.resolve().then(function(){return require("./series-45f423d1.js")}).then(n=>{let s=n.seriesModule,i=o.getPlayer(t);e.registerComponent("seriesModule",s),i.getChild("controlBar").addChild("seriesModule",{playerId:t,seriesData:r},i.controlBar.children().length-4);let d=document.querySelectorAll(".season-title-sdk");for(let e=0;e<d.length;e++)d[e].addEventListener("click",()=>{r[e]&&n.handleSeasonChange(r[e],e,i,l)})})},exports.addSeriesSelectorV2=(t,r)=>{Promise.resolve().then(function(){return require("./series-v2-85099d28.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("seriesV2",n),s.getChild("controlBar").addChild("seriesV2",{playerId:t,...r},s.controlBar.children().length-3)})},exports.addSeriesSelectorV2_DEFAULTV2_TEMP=(t,r)=>{Promise.resolve().then(function(){return require("./series-v2-fa48542f.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("seriesV2",n),s.getChild("controlBar").addChild("seriesV2",{playerId:t,...r},s.controlBar.children().length-3)})},exports.addSettingsButtonV2=(t,r)=>{Promise.resolve().then(function(){return require("./settings-icon-3b19759d.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("settingsSelector",n),document?.getElementById(t)?.getElementsByClassName("settings-selection vjs-control vjs-button")?.[0]?.remove(),s&&s.getChild("controlBar").addChild("settingsSelector",{playerId:t,options:r},s.controlBar.children().length-3)})},exports.addSkipButton=(r,l,n)=>{var s=e.getComponent("Button");e.registerComponent("MyButton",class extends s{constructor(e,t){super(e,t);var r=this.el_;r.classList.add("vjs-skip-button");const l=o.parseSvgString(n);r.append(l)}handleClick(){t.skip(r,10)}}),e(r).getChild("controlBar").addChild("myButton",{},1)},exports.addSlowMotion=t=>{var r=e.getComponent("Button");e.registerComponent("MyButton",class extends r{constructor(e,t){super(e,t);var r=this.el_;r.classList.add("vjs-slowmo-button"),r.textContent=l.getLocalisation("slowMoText")||"Slow Mo"}handleClick(){1==o.playbackRate()?(o.playbackRate(.5),this.el().style.background="darkgray"):(o.playbackRate(1),this.el().style.background="none")}});var o=e(t);o.getChild("controlBar").addChild("myButton",{},2)},exports.addVideoSelector=(t,r)=>{Promise.resolve().then(function(){return require("./videoSelector-3c8fb5e9.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("videoSelector",n),s.getChild("controlBar").addChild("videoSelector",{playerId:t,related:r},s.controlBar.children().length-3)})},exports.addVideoSelector_DEFAULTV2_TEMP=(t,r)=>{Promise.resolve().then(function(){return require("./videoSelector-e8c72f5d.js")}).then(l=>{let n=l.default,s=o.getPlayer(t);e.registerComponent("videoSelector",n),s.getChild("controlBar").addChild("videoSelector",{playerId:t,related:r},s.controlBar.children().length-3)})};
@@ -1 +1 @@
1
- "use strict";var e=require("video.js"),t=require("axios"),n=require("./skin-5a0cbc97.js"),i=require("./browser-dc29be24.js"),r=require("md5"),s=require("js-cookie"),o=require("./captions-1ec67937.js"),a=require("@viewlift/comscore/index.js");function d(){window?.dataLayer?.push(arguments)}function l(e,t){d("event",e,t)}var c={name:"@viewlift/player",version:"2.1.49",main:"dist/bundle.cjs.js",types:"dist/@viewlift/player/esm/index.d.ts",amdName:"_playerCore",scripts:{prepublishOnly:"release-assistant"},dependencies:{"@silvermine/videojs-airplay":"^1.3.0","@silvermine/videojs-chromecast":"^1.4.1","@viewlift/sse":"^0.0.3","broadcast-channel":"^7.3.0","@viewlift/comscore":"^1.0.19",axios:"^1.2.3",md5:"^2.3.0",ima:"npm:videojs-ima@2.2.0","js-cookie":"^3.0.5","jwt-decode":"^4.0.0","video.js":"8.22.0","videojs-contrib-ads":"7.5.2","videojs-contrib-eme":"5.5.1","videojs-mux":"^4.21.7","videojs-contrib-quality-menu":"^1.0.3"},overrides:{"min-document":"^2.19.1"}},u="https://prod-api.viewlift.com",m="/entitlement/video/status",p="/v2/user/history",h="/v2/user/info",f="/v2/user/history/series",g="/v3/entitlement/linearchannel",T="/analytics/player-beacon";const _=(()=>{let e={};return{setConfig:t=>{e={...e,...t}},getConfig:()=>e}})(),v=e=>!!e&&"drm"===(e=>{if(5===Number(e?.code))return"drm";const t=`${e?.code??""} ${(e=>e?.response?.data?.errorMessage||e?.response?.data?.message||e?.response?.statusText||e?.message||"unknown_error")(e)}`.toLowerCase();return/(drm|license|widevine|playready|fairplay|eme|key|hdcp)/.test(t)?"drm":/(network|manifest|segment|playlist|http|xhr|fetch|timeout)/.test(t)?"network":/(decode|mediaerror|mediasource|appendbuffer|sourcebuffer)/.test(t)?"decode":"player"})(e),w=new Set(["license","key","server_certificate"]),I="asset_not_found",E="geo_blocking_issue",y="entitlement_mismatch",S="DRM/License Failures",b=new Set(["contentgeorestricted","contentgeorestrictedbyhba","content_not_available_for_country"]),A=[/geo[\s_-]?block/i,/geo[\s_-]?restrict/i,/geographic/i,/not available in your/i,/outside.*(?:region|country|territory)/i,/\bcountry\b/i,/\bterritory\b/i],k=[/entitlement/i,/not entitled/i,/subscription/i,/not subscribed/i,/access denied/i,/\bunauthorized\b/i,/\bforbidden\b/i,/\bpremium\b/i,/upgrade required/i,/tv[\s_-]?provider/i,/\bprovider\b/i],L=[/not found/i,/no content/i,/does not exist/i,/\bmissing\b/i,/not available currently/i,/not available/i],C=(e,t,n,i)=>{const r=Number(e),s=String(t||"");return v(i)?S:b.has((e=>String(e||"").toLowerCase().replace(/[\s-]/g,"_"))(n))||A.some(e=>e.test(s))?E:k.some(e=>e.test(s))?y:L.some(e=>e.test(s))||404===r?I:451===r?E:y},F=(e,t,n,i={})=>{console.log("emitApiErrorEvent",{apiName:e,error:t,errorCategory:n,meta:i});const r=(()=>{const e=_.getConfig()||{};return e?.apiErrorCb||e?.onApiError||e?.customData?.apiErrorCb||e?.customData?.onApiError||e?.customData?.callbacks?.onApiError||null})();if("function"!=typeof r)return;console.log("emitApiErrorEvent",t);const s=t?.response?.status||t?.status||0,o=(e=>e?.response?.data?.errorMessage||e?.response?.data?.message||e?.response?.statusText||e?.message||"unknown_error")(t),a=(e=>e?.response?.data?.errorCode||e?.response?.data?.error_code||e?.response?.data?.code||e?.errorCode||null)(t),d=C(s,o,a,t),l={errorcode:s||a,errormessage:o,errorcategory:n||d,...i};e&&(l.apiPath=e);try{r(d,l)}catch(e){console.warn("[VLPlayer] apiError callback failed:",e)}};let D=c;window.vl_player_version=D.version;const P=()=>window?.customData?.overrideEntitlementBaseUrl?window?.customData?.overrideEntitlementBaseUrl+"/video/status":x.get()+`${m}`,R=function(e,n,i=!1){if(window?.customData?.overrideEntitlementResponse)return new Promise((e,t)=>e({data:window?.customData?.overrideEntitlementResponse}));{let r=P();return t({url:P(),params:{id:e,deviceType:"web_browser",contentConsumption:"web",ssaiDisable:i,...window?.customData?.entitlement},method:"GET",headers:{Authorization:n,"Sdk-Version":D.version,"x-player-name":"videojs",adbTempToken:window?.customData?.adbTempToken},withCredentials:!0}).catch(t=>{throw F(r,t,"content",{videoId:e}),t})}},M=function(e,n,i=!1){if(window?.customData?.overrideEntitlementResponse)return new Promise((e,t)=>e({data:window?.customData?.overrideEntitlementResponse}));let r=x.get()+g;return t({url:r,params:{id:e?.id,deviceType:"web_browser",contentConsumption:"web",ssaiDisable:i,...e?.channelId&&{channelId:e?.channelId},...e?.programId&&{programId:e?.programId},...e?.programTitle&&{programTitle:e?.programTitle},...e?.programSubType&&{programSubType:e?.programSubType},...window?.customData?.entitlement},method:"GET",headers:{Authorization:n,hdcp:"HDCP-1.4",sl:"SW_SECURE_CRYPTO",adbTempToken:window?.customData?.adbTempToken}}).catch(t=>{throw F(r,t,"content",{videoId:e?.id,channelId:e?.channelId,programId:e?.programId}),t})},N=(e,n)=>{let i=window.contentType,r=x.get()+`${h}/${i}/${e}`;return t({method:"GET",url:r,headers:{Authorization:n,"x-api-key":window?.watchHistory?.xApiKey},timeout:15e3}).catch(t=>{throw F(r,t,"content",{videoId:e,contentType:i}),t})},W=e=>{let n=e.videoId,i=x.get()+`${f}/${n}`;return t({method:"GET",url:i,headers:{Authorization:e.token},timeout:15e3}).catch(t=>{throw F(i,t,"content",{seriesId:n,videoId:e?.videoId}),t})},x=(()=>{let e=u;return{set(t){t&&(e=t)},get:()=>e}})(),V=e=>{let t=JSON.parse(atob(e?.split(".")[1])),n=t?.exp;if(new Date(1e3*n).getTime()<(new Date).getTime())return!0};let U=null;function B(){return{set(e){e&&(U=e)},get:()=>U}}let O=null;const j=async()=>{let e=sessionStorage.getItem("vlp_token");return e&&V(e)?(O||(O=(async()=>{let e=B().get(),n=x.get();try{return await t({method:"GET",url:`${n}/identity/refresh/${e}`})}catch(e){throw console.error("Error fetching refresh token",e),e}})().then(t=>{const n=t?.data?.authorizationToken,i=t?.data?.refreshToken;return n&&sessionStorage.setItem("vlp_token",n),i&&B().set(i),n||e}).catch(t=>(console.error("Error fetching refresh token",t),e)).finally(()=>{O=null})),O):e},H=e=>{if(e&&"string"==typeof e)return JSON.parse(atob(e.split(".")[1]))};let $,q,G,z,Q;const Y=(()=>{let e=new Map;return{set(t){let n=t?.video?.id||t||null;e.set(n,(e.get(n)||0)+1)},get:t=>e.get(t),clear(){e.clear()}}})(),K=e=>{q=e},X=()=>q,J=()=>$,Z=e=>{G=e},ee=e=>{if(z){let t=z.get(e);Z(t+1)}},te=(()=>{let e=0;return{set(t){t>=0&&(e=t)},get:()=>e}})();let ne=0,ie=null,re=null,se=!1,oe=!1;const ae=()=>{const e=X();return"linearchannel"==(e?.contentType||"video")?e?.linearchannel?.channels?.find(t=>t?.id===e?.channelId)?.content?.id:e?.video?.gist?.id||e?.video?.id||e?.id};function de(){const e=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function le(){return ie||window.sessionStorage.getItem("uid")}async function ce(){let e=await j();if(e){let t=JSON.parse(atob(e.split(".")[1]));return t?.anonymousId?"guest-user":t?.userId}return"guest-user"}window.initialise=function(e){window.sid=de(),window.environment="production",window.platform="WEBSITE",window.failedToStartTimer=null,window.droppedStreamTimer=null,window.firstFrameFired=!1,window.isAdPlaying=!1,window._pingTimes=[],window._pingTimeUpdateHandler=null,streamFailures(e),buffering(e),ads(e),ping(e),ue(e),me(e)};const ue=function(e){e.on("play",function(){"pause"!==re||e.scrubbing()||(re="play",l("RESUME",{pfm:window.platform,uid:le(),vid:ae(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:"RESUME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}))}),e.on("playing",function(){window.firstFrameFired&&!e.scrubbing()&&(re="play")}),e.on("pause",function(){setTimeout(()=>{!se&&window.firstFrameFired&&"play"===re&&(re="pause",l("PAUSE",{pfm:window.platform,uid:le(),vid:ae(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:"PAUSE",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}))},50)})},me=function(e){if(!e)return;let t=0,n=0,i=0,r=0;function s(){t=n,n=Math.floor(e.currentTime()),t<n&&(r=t,t=n)}function o(){if(oe)return void(oe=!1);i=Math.floor(e.currentTime());const t=Math.floor(i-r);if(0!==t&&window.firstFrameFired){const n=t>0?"SEEK_FORWARD":"SEEK_BACKWARD";l(n,{pfm:window.platform,uid:le(),vid:ae(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:n,videoPosition:Math.floor(e.currentTime()),isAdEvent:!1})}r=Math.floor(e.currentTime()),setTimeout(()=>{se=!1},50),e.on("timeupdate",s)}e.on("timeupdate",s),e.on("seeking",function(){if(se)return;se=!0,e.off("timeupdate",s),e.one("seeked",o)}),e.on("seeked",o)};window.cleanupTimers=function(){clearInterval(window.bufferingTimer),clearTimeout(window.failedToStartTimer),clearTimeout(window.droppedStreamTimer),window.failedToStartTimer=null,window.droppedStreamTimer=null},window.fireStreamFailure=function(e){const t=n.getPlayer(),i=t?.el_?Math.floor(t.currentTime()):0;window.cleanupTimers(),l(e,{pfm:window.platform,uid:le(),vid:ae(),videoPosition:i,...window?.customData?.beacon?.params}),fireEvent({eventName:e,videoPosition:i,isAdEvent:!1})},window.streamFailures=function(e){e.on("error",function(){const e=window.firstFrameFired?"DROPPED_STREAM":"FAILED_TO_START";window.fireStreamFailure(e)})},window.firstFrame=function(e,t,n){e.one("play",tryCatch(function(){window.ttFirstFrameStartTime_In_MS=performance.now(),re="play",window.failedToStartTimer=setTimeout(function(){window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")},3e4),l("PLAY",{pfm:window.platform,uid:le(),vid:ae(),videoPosition:Math.floor(e.currentTime()),...window?.customData?.beacon?.params}),fireEvent({eventName:"PLAY",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}),t&&t("started_video_playback",{"Video ID":ae(),watchTime:Math.floor(e.currentTime()),...n})}))},window.buffering=function(e){e.on("waiting",tryCatch(function(){window.firstFrameFired&&(e.currentTime(),clearInterval(window.bufferingTimer),window.bufferingTimer=setInterval(function(){e?.el_?.className?.includes("vjs-waiting")&&!e.paused()?window.totalBufferTime=window.handleBufferTimer?window.handleBufferTimer(window.totalBufferTime,e):null:(clearInterval(window.bufferingTimer),clearTimeout(window.droppedStreamTimer),window.droppedStreamTimer=null)},100),window.firstFrameFired&&(clearTimeout(window.droppedStreamTimer),window.droppedStreamTimer=setTimeout(function(){e?.el_?.className?.includes("vjs-waiting")&&!e.paused()&&window.fireStreamFailure("DROPPED_STREAM")},45e3)))}))},window.handleBufferTimer=function(e,t){if(!t.el_)return void(window.ttFirstFrameStartTime_In_MS=null);let n=e+.1;return+n.toFixed(2)%5==0&&t?.el_?.className?.includes("vjs-waiting")&&ne<4&&(ne++,l("BUFFERING",{pfm:window.platform,uid:le(),vid:ae(),videoPosition:t.el_&&Math.floor(t.currentTime()),...window?.customData?.beacon?.params}),fireEvent({eventName:"BUFFERING",videoPosition:t.el_&&Math.floor(t.currentTime()),isAdEvent:!1})),n},window.endFirstFrame=function(e){const t=tryCatch(function(){if(!window.ttFirstFrameStartTime_In_MS||window.firstFrameFired)return;if(window.isAdPlaying)return void console.log("'playing' event ignored during ad playback.");clearInterval(window.bufferingTimer),clearTimeout(window.failedToStartTimer),window.failedToStartTimer=null,window.firstFrameFired=!0;const n=(performance.now()-window.ttFirstFrameStartTime_In_MS)/1e3;window.ttFirstFrameStartTime_In_MS=null,window.totalBufferTime=n||0,l("FIRST_FRAME",{eventName:"FIRST_FRAME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,ttFirstFrame:parseFloat(n?.toFixed(2)),bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:le(),vid:ae(),...window?.customData?.beacon?.params}),fireEvent({eventName:"FIRST_FRAME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,ttFirstFrame:parseFloat(n?.toFixed(2)),bufferHealth:window.getRemainingBufferTime(e)}),e.off("timeupdate",t)});e.on("timeupdate",t)},window.ads=function(e){e.on("adsready",function(){e.ima.addEventListener(window.google.ima.AdEvent.Type.STARTED,function(){window.isAdPlaying=!0,!window.firstFrameFired&&window.failedToStartTimer&&clearTimeout(window.failedToStartTimer),l("AD_REQUEST",{eventName:"AD_REQUEST",videoPosition:Math.floor(e.currentTime()),isAdEvent:!0,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:le(),vid:ae(),resHeight:e.videoHeight(),resWidth:e.videoWidth(),...window?.customData?.beacon?.params}),fireEvent({eventName:"AD_REQUEST",videoPosition:Math.ceil(e.currentTime()),isAdEvent:!0,resHeight:e.videoHeight(),resWidth:e.videoWidth(),adPosition:1}),l("AD_IMPRESSION",{eventName:"AD_IMPRESSION",videoPosition:Math.floor(e.currentTime()),isAdEvent:!0,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:le(),resHeight:e.videoHeight(),resWidth:e.videoWidth(),vid:ae(),...window?.customData?.beacon?.params}),fireEvent({eventName:"AD_IMPRESSION",videoPosition:Math.ceil(e.currentTime()),resHeight:e.videoHeight(),resWidth:e.videoWidth(),isAdEvent:!0,adPosition:1})}),e.ima.addEventListener(window.google.ima.AdEvent.Type.SKIPPED,function(){window.isAdPlaying=!1,window.firstFrameFired||(window.failedToStartTimer=setTimeout(()=>{window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")},3e4))}),e.ima.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,function(){window.isAdPlaying=!1,window.firstFrameFired||(window.failedToStartTimer=setTimeout(()=>{window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")},3e4))})})};const pe=function(e,t,n){fireEvent({eventName:"PING",videoPosition:t,isAdEvent:!1,duration:n,resHeight:e.videoHeight(),resWidth:e.videoWidth(),bufferHealth:window.getRemainingBufferTime(e),bitrate:e.tech_?.vhs&&window.getBitrate(e)})};window.fireExitPing=function(e){if(window.isAdPlaying)return;const t=e?.el_?Math.floor(e.currentTime()):0;t<=0||pe(e,t,t)},window.ping=function(e){window._pingTimeUpdateHandler&&(e.off("timeupdate",window._pingTimeUpdateHandler),window._pingTimeUpdateHandler=null),e.on("dispose",tryCatch(function(){console.log('Player DISPOSED >> "dispose" event fired >>> firing exit PING'),window.fireExitPing(e)})),window._pingTimes||(window._pingTimes=[]),window._pingTimeUpdateHandler=function(){var t=Math.floor(e.currentTime());t>=30&&t%30==0&&!window._pingTimes.includes(t)&&(ne=0,window._pingTimes.push(t),pe(e,t,30))},e.on("timeupdate",window._pingTimeUpdateHandler)},window.getBitrate=function(e){return Math.round(e.tech_.vhs.selectPlaylist().attributes.BANDWIDTH/1e3)},window.getRemainingBufferTime=function(e){return tryCatch(function(){let t=e.currentTime(),n=e.duration(),i=e.buffered();for(let e=0;e<i.length;e++){let s=i.start(e),o=i.end(e);if(he(t,s,o)){var r=Math.round(n-o);if(isFinite(r))return r}}})()};const he=function(e,t,n){return e>=t&&e<=n},fe=()=>{const e=X(),t=e?.contentType||"video",n=e?.[t]?.network;return n||null};window.fireEvent=async function(e){if(i.isBotUserAgent())return;const n=await j(),r=H(n),s=r?.site,o=r?.siteId;var a,d=[{aid:s,cid:o,pfm:window.platform,...window?.customData?.beacon?.params,uid:le(),vid:ae(),url:e.url||document.location.href,ref:e.ref||document.referrer,pa:e.eventName,vpos:e.videoPosition??null,environment:window.environment,dp1:e.dp1||"",dp2:e.dp2||"",dp3:e.dp3||"",dp4:e.dp4||"",dp5:e.dp5||"",apos:!0===e.isAdEvent?e.videoPosition:null,apod:!0===e.isAdEvent?(a=e.adPosition,a?String(a):""):"",profid:await ce(),player:e.playerType||"native",media_type:e.mediaType||"VIDEO",stream_id:window.sid,embedurl:"",ttfirstframe:e.ttFirstFrame??null,bitrate:e.bitrate??null,connectionspeed:null,resolutionheight:e.resHeight??null,resolutionwidth:e.resWidth??null,bufferhealth:e.bufferHealth??null,networkname:fe()??null,brandname:s??null,...e?.duration&&{duration:e.duration},...window?.customData?.beacon?.params}];t({url:window?.customData?.beacon?.url||x.get()+T,method:"post",headers:{Authorization:n},contentType:"application/x-www-form-urlencoded",dataType:"text",data:d}).catch(function(e){console.error(e)})},window.tryCatch=function(e){return function(){try{return e.apply(window,arguments)}catch(e){return console.error(e),null}}};window.watchLive=function(e){if(!e)return;const t=e?.controlBar?.getChild("SeekToLive");if(!t)return;const n=t.handleClick;t.handleClick=function(t){return e.liveTracker?.atLiveEdge?.()||(!function(e){l("WATCH_LIVE",{eventName:"WATCH_LIVE",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:le(),resHeight:e.videoHeight(),resWidth:e.videoWidth(),vid:ae(),...window?.customData?.beacon?.params}),fireEvent({eventName:"WATCH_LIVE",videoPosition:Math.ceil(e.currentTime()),resHeight:e.videoHeight(),resWidth:e.videoWidth(),isAdEvent:!1})}(e),oe=!0),n.call(this,t)}};const ge=()=>{const e=te.get();return e>=0?e+1:1},Te=()=>{const e=J(),t=X(),n=t?.video?.id,i=te.get(),r=e?.[i]?.episodes?.findIndex(e=>e?.id===n);return r>=0?r+1:1},_e=r,ve=(e,t)=>e&&t?`${e}x${t}`:e>1024?"L":e>768?"M":"S",we=e=>{const t=Ie(e,"video.tags",[]),n=Ie(e,"video.gist.primaryCategory.title","VIEWLIFT_CONTENT_GENRE");return t.length>0?t.map(e=>e.title).join(","):n},Ie=(e,t,n)=>{for(var i=0,r=(t=t.split(".")).length;i<r;i++)e=e?.[t[i]];return e||n},Ee=(e=!0)=>{const t=localStorage.getItem("deviceId")||"VIEWLIFT_DEVICE_ID";return e?t:t.includes("browser-")?t.replace("browser-",""):t},ye=(e="",t,i)=>{if(window?.customData?.disableMacros)return e;const r=i?.siteName||i?.site||"";let o=i?.contentType||"video",a=i?.[o]?.metadata||i?.[o]?.gist?.metadata,d=n.getPlayer(t);if(!e.includes("VIEWLIFT_"))return e;let l=window.getComputedStyle(document.getElementById(t),null),c=Math.trunc(l.getPropertyValue("height").slice(0,-2)),u=Math.trunc(l.getPropertyValue("width").slice(0,-2));const m="linearchannel"===o?i?.linearchannel?.channels?.find(e=>e?.id===i?.channelId)?.content?.id:Ie(i,"video.gist.id",""),p="linearchannel"===o?i?.linearchannel?.channels?.find(e=>e?.id===i?.channelId)?.title:Ie(i,"video.gist.title","VIEWLIFT_ENCODED_VIDEO_TITLE");let h=null,f=null;"function"==typeof window.__gpp&&window?.__gpp("ping",e=>{h=e?.gppString,f=e?.sectionList[0]});const g=s.get("us_privacy")||s.get("usprivacy"),T=void 0!==g?g:"1YNN",_=JSON.parse(localStorage.getItem("selectedMvpdProvider")||"{}")?.fwIdentifier??null,v={...Se(a),VIEWLIFT_WIDTH:u,VIEWLIFT_HEIGHT:c,VIEWLIFT_SIZE:ve(u,c),VIEWLIFT_DOMAIN:window.location.hostname,VIEWLIFT_URL:window.location.href,VIEWLIFT_ENCODED_URL:encodeURIComponent(window.location.href),VIEWLIFT_DOUBLE_ENCODED_URL:encodeURIComponent(encodeURIComponent(window.location.href)),VIEWLIFT_CACHEBUSTER:"3708662946268",VIEWLIFT_TIMESTAMP:Date.now().toString().substring(0,10),VIEWLIFT_TIMESTAMP_MS:Date.now().toString(),VIEWLIFT_IP:window?.ip||"VIEWLIFT_IP",VIEWLIFT_USER_AGENT:encodeURIComponent(encodeURIComponent(navigator.userAgent)),VIEWLIFT_DNT:"1"===navigator.doNotTrack?"1":"0",VIEWLIFT_DESCRIPTION:Ie(i,"video.gist.description","VIEWLIFT_DESCRIPTION"),VIEWLIFT_DURATION:Ie(i,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_MIN_DURATION:0,VIEWLIFT_MAX_DURATION:Ie(i,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_AUTOPLAY:d?.options_?.autoplay||1,VIEWLIFT_MUTE:d?.options_?.autoplay||0,VIEWLIFT_DEVICE_ID:"spinco"==r||"usanetwork"==r||"golfchannel"==r?"":Ee(!1),VIEWLIFT_DID:"spinco"==r||"usanetwork"==r||"golfchannel"==r?"":Ee(),VIEWLIFT_DEVICETYPE:"WEB_BROWSER",VIEWLIFT_IDTYPE:"dpid",VIEWLIFT_KEYWORDS:we(i),VIEWLIFT_MEDIA_ID:m,VIEWLIFT_ENCODED_VIDEO_TITLE:encodeURI(Ie(i,"video.gist.title","VIEWLIFT_ENCODED_VIDEO_TITLE")),VIEWLIFT_VIDEO_ID:m,VIEWLIFT_VIDEO_URL:encodeURI(window.location.origin+Ie(i,"video.gist.permalink","")),VIEWLIFT_CONSENT:s.get("cc")||"VIEWLIFT_CONSENT",VIEWLIFT_COPPA:Ie(window?.app_data?.site?.settings,"compliance.coppa")?1:0,VIEWLIFT_GDPR_CONSENT:"",VIEWLIFT_ROKU_AD_ID:"",VIEWLIFT_ROKU_AD_KEYS:"",VIEWLIFT_RDID:"",VIEWLIFT_GDPR:"spinco"==r||"usanetwork"==r||"golfchannel"==r?"":Ie(window?.app_data?.site?.settings,"compliance.gdpr")?1:0,VIEWLIFT_US_PRIVACY:T,VIEWLIFT_TVE_PROVIDER:_?_e(_):"",VIEWLIFT_CONTENT_DURATION_MS:1e3*Ie(i,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_CONTENT_DURATION:Ie(i,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_CONTENT_ID:m,VIEWLIFT_CONTENT_TITLE:p,VIEWLIFT_CONTENT_SERIES_TITLE:Ie(i,"video.series.gist.title","VIEWLIFT_CONTENT_SERIES_TITLE"),VIEWLIFT_CONTENT_GENRE:Ie(i,"video.gist.primaryCategory.title","VIEWLIFT_CONTENT_GENRE"),VIEWLIFT_USER:sessionStorage.getItem("uid")||"VIEWLIFT_USER",VIEWLIFT_EPISODE_NUMBER:Te(),VIEWLIFT_SEASON_NUMBER:ge(),VIEWLIFT_CONTENT_TAGS:we(i),VIEWLIFT_GPP_SID:f||"VIEWLIFT_GPP_SID",VIEWLIFT_GPP:h||"VIEWLIFT_GPP",VIEWLIFT_APP_ID:"",VIEWLIFT_APP_STORE_URL:"",VIEWLIFT_LAT:"",VIEWLIFT_APP_BUNDLE:"",VIEWLIFT_ATT_CONSENT:"",...window?.customData?.macros};for(let t in v){const n=new RegExp(t,"g");e=e.replace(n,v[t])}return e},Se=e=>{let t={},n=new Map;e?.length>0&&e?.map(e=>{n.set(e.name,e.value)});let r=window?.customData?.subscription?.SVOD||!1,s=window?.customData?.subscription?.TVE||!1;return r||s?(i.isMobile()?r?t={...t,VIEWLIFT_CSID:n.get("csid.mweb.dtc")||"",VIEWLIFT_CSID_CSAI:n.get("csid.mweb.dtc.csai")||""}:s&&(t={...t,VIEWLIFT_CSID:n.get("csid.mweb.tve")||"",VIEWLIFT_CSID_CSAI:n.get("csid.mweb.tve.csai")||""}):r?t={...t,VIEWLIFT_CSID:n.get("csid.web.dtc")||"",VIEWLIFT_CSID_CSAI:n.get("csid.web.dtc.csai")||""}:s&&(t={...t,VIEWLIFT_CSID:n.get("csid.web.tve")||"",VIEWLIFT_CSID_CSAI:n.get("csid.web.tve.csai")||""}),r?t={...t,VIEWLIFT_SFID:n.get("sfid.dtc")||n.get("sfid.web.dtc")||"",VIEWLIFT_SFID_CSAI:n.get(i.isMobile()?"sfid.mweb.dtc.csai":"sfid.web.dtc.csai")||""}:s&&(t={...t,VIEWLIFT_SFID:n.get("sfid.tve")||n.get("sfid.web.tve")||"",VIEWLIFT_SFID_CSAI:n.get(i.isMobile()?"sfid.mweb.tve.csai":"sfid.web.tve.csai")||""}),t=i.isMobile()?{...t,VIEWLIFT_PROF:n.get("prof.mweb")||"",VIEWLIFT_PROF_CSAI:n.get("prof.mweb.csai")||""}:{...t,VIEWLIFT_PROF:n.get("prof.web")||"",VIEWLIFT_PROF_CSAI:n.get("prof.web.csai")||""}):(t={...t,VIEWLIFT_SFID:n.get("sfid.dtc")||n.get("sfid.web.dtc")||"",VIEWLIFT_SFID_CSAI:n.get(i.isMobile()?"sfid.mweb.dtc.csai":"sfid.web.dtc.csai")||""},t=i.isMobile()?{...t,VIEWLIFT_CSID:n.get("csid.mweb.dtc")||"",VIEWLIFT_PROF:n.get("prof.mweb")||"",VIEWLIFT_CSID_CSAI:n.get("csid.mweb.dtc.csai")||"",VIEWLIFT_PROF_CSAI:n.get("prof.mweb.csai")||""}:{...t,VIEWLIFT_CSID:n.get("csid.web.dtc")||"",VIEWLIFT_PROF:n.get("prof.web")||"",VIEWLIFT_CSID_CSAI:n.get("csid.web.dtc.csai")||"",VIEWLIFT_PROF_CSAI:n.get("prof.web.csai")||""}),t={...t,VIEWLIFT_AFID:n.get("afid"),VIEWLIFT_NIELSEN_APP_ID:Ie(window?.app_data?.appcmsMain?.analytics,"nielsen.id")||n.get("VIEWLIFT_NIELSEN_APP_ID")||"",VIEWLIFT_CHANNEL:n.get("VIEWLIFT_CHANNEL")||"",VIEWLIFT_GRACE_NOTE_ID:n.get("VIEWLIFT_GRACE_NOTE_ID")||"",VIEWLIFT_EXTERNAL_AD_ID:n.get("VIEWLIFT_EXTERNAL_AD_ID")||""},t},be=(e,t)=>{let n=e?.contentType||"video",r=e?.[n]?.drmEnabled,s=e?.[n]?.streamingInfo?.videoAssets,o=e?.[n]?.streamingInfo?.audioAssets,a=e?.[n]?.streamingInfo?.videoAssets?.hls||!1,d=e?.[n]?.streamingInfo?.videoAssets?.dash||!1;if(e?.directPlaybackUrl)return{src:e?.directPlaybackUrl,type:null};if(e?.audioAssetSource&&o?.hls){return ke(o)}if(r){let n=Le(s,t);return n.src=ye(n.src,t,e),n}if("Safari"!==i.detectBrowser()&&d){return Ae(s)}if(a){let n=ke(s);return n.src=ye(n.src,t,e),n}if(s?.mpeg){let n=(e=>{let t=e?.mpeg;return{src:t[t.length-1].url,type:"video/mp4"}})(s);return n.src=ye(n.src,t,e),n}return null},Ae=e=>{let t=e?.dash;return t?{src:t,type:"application/dash+xml"}:null},ke=e=>{let t=e?.hls;return t?{src:t,type:"application/x-mpegURL"}:null},Le=(t,r)=>{const s=t?.drmProvider||null,o=t.fairPlayCmaf||t.fairPlay,a=t.widevine,d=t.playReady;let l=i.detectBrowser();if(n.getPlayer(r),"Safari"===l){let t=function(t){let n=t.url;return{src:n,type:"application/x-mpegURL",__vlLicenseUrl:t?.licenseUrl||"",keySystems:{"com.apple.fps.1_0":{getCertificate:(n,i)=>{let r={uri:t.certificateUrl,method:"GET",responseType:"arraybuffer"};e.xhr(r,(e,t,n)=>{console.log(e),e&&i(e),i(null,new Uint8Array(n))})},getContentId:(e,t)=>{if(t){const e=t.indexOf("\0")+1;return t.slice(e)}},getLicense:(n,i,r,s)=>{let o={uri:t.licenseUrl,method:"POST",responseType:"arraybuffer",body:r,headers:{"Content-type":"application/octet-stream","X-AxDRM-Message":t&&t.licenseToken}};e.xhr(o,(e,t,n)=>{console.log(e),e&&s(e),s(null,n)})}}}}}(o);return Ce(r),t}{let e={src:a.url,type:"application/dash+xml"};return"caliente"==window?.siteName?(Ce(r),e.keySystems={"com.widevine.alpha":{url:a.licenseUrl,licenseHeaders:{"X-AxDRM-Message":a.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"},"com.microsoft.playready":{url:d?.licenseUrl,licenseHeaders:{"X-AxDRM-Message":d?.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}):"custom"==s?(e.keySystemOptions=[],e.keySystemOptions.push({name:"com.widevine.alpha",options:{serverURL:a.licenseUrl,httpRequestHeaders:{"Content-Type":"application/octet-stream"},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}),e.keySystemOptions.push({name:"com.microsoft.playready",options:{serverURL:d?.licenseUrl,httpRequestHeaders:{"Content-Type":"application/octet-stream"},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}})):(e.keySystemOptions=[],e.keySystemOptions.push({name:"com.widevine.alpha",options:{serverURL:a.licenseUrl,httpRequestHeaders:{"X-AxDRM-Message":a.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}),e.keySystemOptions.push({name:"com.microsoft.playready",options:{serverURL:d?.licenseUrl,httpRequestHeaders:{"X-AxDRM-Message":d?.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}})),e}};const Ce=e=>{const t=n.getPlayer(e);if("function"==typeof t.eme)try{t.eme(),"Safari"==i.detectBrowser()&&t.eme.initLegacyFairplay()}catch(e){console.log("EME ERROR :",e)}},Fe=(e,t)=>{if(Promise.resolve().then(function(){return require("./error-26d5a3c3.js")}).then(e=>{let t=document.createElement("style");t.id="errorblock",t.append(`${e.default}`),document.head.appendChild(t)}),document.getElementsByClassName("error-container")[0]){let e=document.getElementsByClassName("error-message")[0];e&&(e.innerHTML=`${t}`)}else{let n=document.getElementById(e);if(n){let e=document.createElement("div");e.className="error-container";let i=document.createElement("div");i.className="error-message",i.innerHTML=`${t}`,e.appendChild(i),n.append(e)}}},De=()=>{document.getElementsByClassName("error-container")[0]&&document.getElementsByClassName("error-container")[0].remove()};let Pe=!1;const Re=(e,t,i)=>{let r=ye(t,e,i),s=n.getPlayer(e);if(t&&window.google){if("function"!=typeof s.ima&&"object"!=typeof s.ima)return;s.ima.initializeAdDisplayContainer&&s.ima.initializeAdDisplayContainer(),function(e,t){let i=n.getPlayer(e);if(null===i.el_)return;Pe=!0;var r={id:e,adTagUrl:`${t}`,adLabel:"Your video will resume after this sponsor message"};i.ima.initializeAdDisplayContainer&&i.ima.initializeAdDisplayContainer(),Pe&&null!==i.el_&&("function"==typeof i.ima?i.ima(r):setTimeout(()=>{i.ima.setContentWithAdTag(null,t,!0),i.ima.requestAds()},1e3));var s=document.getElementById(`${e}`);(navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&s.hasAttribute("controls")&&s.removeAttribute("controls");var o="click",a=!1;(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(a=!0,o="touchend"),i.one(o,function(){a&&i.ima.initializeAdDisplayContainer()});let d=window?.customData?.ads?.adEventHandler||null;i.one("ads-ad-started",function(){d&&d({status:"STARTED",msg:"Advertisement Started"})}),i.one("ads-manager",function(e){var t=e.adsManager;t.addEventListener(google.ima.AdEvent.Type.COMPLETE,()=>{d&&d({status:"ENDED",msg:"Advertisement Ended"})}),t.addEventListener(google.ima.AdEvent.Type.LOADED,e=>{d&&d({status:"LOADED",msg:"Advertisement Loaded",data:e})})}),i.on("adserror",function(e){d&&d({status:"ERROR",msg:"Advertisement Error"})})}(e,r)}};const Me=(()=>{let e=!0;return{enable(){e=!0},disable(){e=!1},get enabled(){return e}}})(),Ne="ssai-breakStart",We="ssai-adImpression",xe="ssai-firstQuartile",Ve="ssai-midpoint",Ue="ssai-thirdQuartile",Be="ssai-complete",Oe="ssai-breakEnd",je={breakStart:Ne,impression:We,firstQuartile:xe,midpoint:Ve,thirdQuartile:Ue,complete:Be,breakEnd:Oe};function He(e,t={}){const i=n.getPlayer(e);if(!i)return console.error("[SSAI] Player instance not found"),{};const{eventType:r}=t,s=je[r];s&&i.trigger(s,t)}const $e=(()=>{let e={};return{get:()=>e,set(t){e=t}}})();function qe(e,t){const i=e?.playerId,r=n.getPlayer(i);if(!e?.comscore?.enable)return;let s=X();const o=s?.video?.metadata||[];let d=o?.length&&o.filter(e=>"advertisingGenre"===e.name);if(d?.length){let e=d.map(e=>e.value);d=e?.join(",")}a.destroyComscoreTag();let l=window?.lcProgrammeDetails,c=Array.isArray(l?.category)?l?.category?.join(","):l?.category||null,u={...s?.video,...s?.linearchannel,siteName:e?.comscore?.applicationName||e?.comscore?.metadata?.siteName||s?.site||null,programId:l?.videotmsid||null,programTitle:l?.lcProgrammeName||null,episodeId:l?.videotmsid||null,seasonNumber:s?.video?.series?.seasonNumber||l?.seriesDetails?.season||null,episodeNumber:s?.video?.series?.episodeNumber||l?.seriesDetails?.episode||null,episodeTitle:l?.lcSubTitle||null,isCompleteEpisode:!(!s?.video?.series&&!l?.seriesDetails?.episode),genre:d||c,comscoreConfig:{implementationId:e?.comscore?.implementationId||null,projectId:e?.comscore?.projectId||null}};const m=e?.comscore?.metadata?.contentType;if(u.contentType=u?.streamingInfo?.isLiveStream?"Live":m||"LongFormOnDemand",!u?.network){let e=u?.metadata||[];const t=e?.find(e=>"network"===e.name)?.value;u.network=t||null}var p;u?.network&&u?.genre&&(u.customGenre=`${u.network}_${u?.programTitle||(p=u,p?.series?p?.series?.title:p?.gist?.title)}_${u.genre}`),l?.airDate&&(u.publishDate=l.airDate),u?.runtime&&"function"==typeof r.duration&&(u.runtime=1e3*Math.ceil(r.duration()));const h=a.formulateComscorePayload(u,r);console.log("comscoreOptions player data",h),a.createComscoreStreamingTag({playerName:"Video.js",...h}),a.setComscorePlayerInstance(r)}const Ge=(()=>{let e="";return{set(t){t&&(e=t)},get:()=>e}})();async function ze(e,t){n.getPlayer(e);const i=be(t,e),r=i.src;let s=r.replace("/dash/","/session/").replace("/master/","/session/");s=ye(s,e,t);const[o,a]=function(e){const t={};if(!e.split("?")[1])return[{},{}];const n=new URL(e,window.location.origin),i=n?.searchParams||[];for(const[e,n]of i)t[decodeURIComponent(e)]=decodeURIComponent(n||"");const r={},s={};for(const[e,n]of Object.entries(t))if(e.startsWith("ads.")){r[e.replace(/^ads\./,"")]=n}else s[e]=n;return[r,s]}(s),d=(l=a,Object.fromEntries(Object?.entries(l)?.map(([e,t])=>[e?.replace(/^aws\./,""),String(t)]))||{}||{});var l;s=new URL(s.split("?")[0]),Object.keys(a).length>0&&Object.entries(a).forEach(([e,t])=>{s.searchParams.set(e,t)});try{const e=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adsParams:{...o},...d})}),t=await e.json(),n="https://"+new URL(s).hostname,r=t.trackingUrl,a=t.manifestUrl,l=n+r,c=n+a;return Ge.set(l),console.log("%c TRACKING URL","background: #bdf369; color: #000",l),i.src=c,i}catch(e){return i}}const Qe=new Map;async function Ye(e,t){Qe.clear(),window.isAdPlaying=!1;const i=Ge.get(),r=n.getPlayer(e);r.one("loadeddata",()=>{i&&h(i)});const s=new Map,o=new Map;let a=-1;const d=document?.getElementsByClassName("tvProviderImage")?.[0]||null,l=r?.controlBar?.getChild("videoSelector")||null,c=r?.controlBar?.getChild("seriesV2")||null,u=r?.el()?.getElementsByClassName("vjs-button vjs-rewind-button")?.[0]||null,m=r?.el()?.getElementsByClassName("vjs-button vjs-skip-button")?.[0]||null,p=(e=[],t=[])=>{if(0==e?.length)return[...t];let n=[];const i=t?.find(e=>"breakEnd"===e?.eventType),r=i?.beaconUrls?.find(e=>e.includes("videoView"))||null,s=e?.length>1?e?.[e?.length-1]:e?.[0],o=s?.trackingEvents?.filter(e=>["breakEnd"].includes(e?.eventType));if(!(o?.some(e=>e?.beaconUrls?.some(e=>e.includes("videoView")))||!1)&&r){let e=o?.map(e=>({...e,eventType:"videoView",beaconUrls:[r]}));e?.[0]&&n.push(e?.[0])}return n},h=async i=>{const r=await fetch(i),h=(await r.json()).avails,g=[];let T=null;const _=n.getPlayer(e),w=_.controlBar.progressControl,I=w.seekBar.el();if(document?.querySelectorAll(".vjs-seekbar-marker").forEach(e=>e?.remove()),h.map((e,t)=>{0==t&&Array.isArray(e?.ads),g.push({ads:e?.ads,durationInSeconds:e?.durationInSeconds,startTimeInSeconds:e?.startTimeInSeconds,markerPositionInSeconds:Math.floor(e?.startTimeInSeconds),podSlotImpressionBeacon:p(e?.ads,e?.adBreakTrackingEvents)})}),t&&function(e){if(null==e)return;let t=null;for(const n of g){const{startTimeInSeconds:i,ads:r}=n;Array.isArray(r)&&r?.length>0&&(i>e||s.has(i)||(null===t||i>t.startTimeInSeconds)&&(t=n))}t?(console.log("Resume: seeking back to recent ad break:",t.startTimeInSeconds,"then resuming to",e),T={position:e,podStart:t.startTimeInSeconds,podEndTime:t.startTimeInSeconds+t.durationInSeconds,entered:!1},setTimeout(()=>{_.currentTime(t.startTimeInSeconds+.4)},100)):(T=null,_.currentTime(e),S(e))}(t),g?.length){console.log("%c SSAI AD PODS ","background: #bdf369; color: #000",g),window.adsQueueList=g;const e=window?.customData?.ads?.onAdBreaksLoaded||null;"function"==typeof e&&e(g)}console.log(g,"data"),g.forEach(({markerPositionInSeconds:e,ads:t})=>{const n=_.duration();if(e>n)return;if(Array.isArray(t)&&0==t?.length)return;const i=e/n*100,r=document.createElement("div");r.className="vjs-seekbar-marker",r.style.left=`${i}%`,r.style.position="absolute",r.style.top="0",r.style.bottom="0",r.style.width="2px",r.style.backgroundColor="#fecc09",r.style.left=`${i}%`,r.style.pointerEvents="none",I.appendChild(r)}),_._timeUpdateHandler&&_.off("timeupdate",_._timeUpdateHandler),_._timeUpdateHandler=n.throttle(function(){const e=_.currentTime();if(e!==a){a=e;let t=!1;for(let n=0;n<g.length;n++){const i=g[n],{startTimeInSeconds:r,durationInSeconds:a,ads:p}=i,h=r+a;if(e>=r-1.2&&e<=h+1.2){e>=r&&e<=h&&Array.isArray(p)&&p?.length>0&&(t=!0),e>h&&s.set(r,!0),Me.disable(),d&&d.classList.add("vjs-hidden"),u&&(u.style.pointerEvents="none",u.classList.add("vjs-hidden")),m&&(m.style.pointerEvents="none",m.classList.add("vjs-hidden")),l&&(l.el().style.pointerEvents="none",l.el().classList.add("vjs-hidden")),c&&(c.el().style.pointerEvents="none",c.el().classList.add("vjs-hidden")),w.el().classList.add("hide-progress-bar");const o=e-r;let g=0,T=0;for(let e=0;e<p.length;e++){const t=p?.[e]?.durationInSeconds;if(o<g+t){T=e;break}g+=t}p[T];const _=Math.max(0,a-o),I=Math.round(_);k.style.display="block",F.textContent=`${T+1} of ${p.length} • ${f(I)}`;const E=[];p?.forEach(e=>{const t=e.trackingEvents.filter(e=>["breakStart","breakEnd","firstQuartile","secondQuartile","thirdQuartile","fourthQuartile","midpoint","impression","complete"].includes(e.eventType));E.push(...t)}),i?.podSlotImpressionBeacon?.length>0&&E.push(...i?.podSlotImpressionBeacon),v(e,i,E,T,n);break}o.delete(r)}if(window.isAdPlaying=t,T&&!_.seeking()&&(e>=T.podStart&&e<=T.podEndTime&&(T.entered=!0),T.entered&&e>=T.podEndTime)){const e=T.position;T=null,setTimeout(()=>{_.currentTime(e),S(e)},300)}t||(k.style.display="none",w.el().classList.remove("hide-progress-bar"),l&&(l.el().style.pointerEvents="auto",l.el().classList.remove("vjs-hidden")),c&&(c.el().style.pointerEvents="auto",c.el().classList.remove("vjs-hidden")),d&&d.classList.remove("vjs-hidden"),u&&(u.style.pointerEvents="auto",u.classList.remove("vjs-hidden")),m&&(m.style.pointerEvents="auto",m.classList.remove("vjs-hidden")),Me.enable())}},1e3),_.on("timeupdate",_._timeUpdateHandler),document?.addEventListener("keydown",t=>{if(Me.enabled&&"ArrowRight"==t.key){const n=_.currentTime();jt(e,10),y(n,n+10),t.stopPropagation()}});let E=-1;function y(e,t=_.currentTime()){if(null==e||e<0||t<=e)return;let n=null;for(const i of g){const{startTimeInSeconds:r,ads:o}=i;Array.isArray(o)&&o?.length>0&&(s.has(r)||r>e&&r<=t&&(null===n||r>n.startTimeInSeconds)&&(n=i))}null!==n&&(s.set(n.startTimeInSeconds,!0),o.set(n.startTimeInSeconds,!0),T={position:t,podStart:n.startTimeInSeconds,podEndTime:n.startTimeInSeconds+n.durationInSeconds,entered:!1},console.log("Seeking back to ad pod:",n.startTimeInSeconds,"then resuming to",t),setTimeout(()=>{_.currentTime(n.startTimeInSeconds+.4)},100))}function S(e=_.currentTime()){const t=e;let n=null;for(const e of g){const{startTimeInSeconds:i,durationInSeconds:r,ads:o}=e,a=Math.floor(i+r);t>=i&&t<=a&&(n=a,s.set(i,!0))}null!==n&&(console.log("Seeking to end of the ad pod:",n),setTimeout(()=>{_.currentTime(n+2.2)},100))}function b(e){}function A(e){document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",A),0===e.button&&y(E)}w.el().addEventListener("pointerdown",e=>{0===e.button&&(E=_.currentTime(),document.addEventListener("pointermove",b),document.addEventListener("pointerup",A))}),document?.querySelectorAll(".ssai-ad-container")?.forEach(e=>e?.remove());const k=document.createElement("div");k.className="ssai-ad-container";const L=document.createElement("div");L.className="sponsored-adbox";const C=document.createElement("div");C.className="sponsored-text",C.textContent="Sponsored Ad",L.append(C);const F=document.createElement("div");F.className="ad-counter";document.createElement("div").className="ad-timer",k.append(L),k.append(F),_.el().appendChild(k)};function f(e){return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}const g=new Map;let T=-1;function _(e,t,n,i){console.warn("%c SSAI BEACON ","background: #e25822; color: #fff",e,`Fired:${Math.round(i.currentTime())}`,"AD_POD:",t),console.log("%c SSAI BEACON ","background: #e25822; color: #fff",e,`Fired:${Math.round(i.currentTime())}`,"AD_POD:",t),n?.forEach(e=>{fetch(e,{mode:"no-cors"}).catch(t=>{console.warn("Beacon failed:",e,t)})})}function v(t,i,r,s,o,a){const d=n.getPlayer(e);if(d.seeking())return;const{startTimeInSeconds:l,durationInSeconds:c}=i;t<T&&g.clear(),T=t;let u=i?.ads?.[s]?.adId||l;Math.floor(d.currentTime());for(const n of r){const{eventType:r,beaconUrls:a,startTimeInSeconds:l,startTime:c,durationInSeconds:m}=n,p=l||0,h=a;let f=window?.customData?.ads?.adEventHandler||null,T=`${p}_${r}`,v=Qe.get(`pod-${o}`)||[];if(console.warn(t,p,"map:",r,"condition1:",t>=p,"map:",Qe),t>=p&&!v.includes(T)){v.push(T),Qe.set(`pod-${o}`,v);try{_(r,i,h,d)}catch(e){console.error("Error when calling triggerAdBeacon:",e,r,i)}if("function"==typeof f)try{const t={eventType:r,startTimeInSeconds:l,startTime:c,durationInSeconds:m,ad:i?.ads?.[s],adIndex:s};f({adsData:t}),He(e,t)}catch(e){console.error("Error when calling ads callback:",e)}let t=$e.get();if(t&&0!==Object.keys(t).length){const{formulateComscoreAdPayload:e,startComscoreAdTracking:n,finishComscoreAdTracking:o,endComscoreAdTracking:a}=t,d=`${p}_${u}_${r}`;if(!g.has(d))if(g.set(d,!0),"impression"===r){let t=Ge.get();n(e({...i?.ads?.[s],trackingUrl:t}))}else"complete"===r?o():"breakEnd"===r&&a()}}}}}let Ke={};const Xe=window?.location?.search?.includes("debug=true")||!1;let Je=null;async function Ze(e){const t=Ge.get(),i=n.getPlayer(e);function r(){Je&&clearInterval(Je)}i.one("loadeddata",()=>{r(),Je=setInterval(()=>{t&&!i.paused()&&g(t)},2e3)}),i.on("dispose",()=>{r()});const s=new Map,o=new Map;let a=-1,d=null;const l=document?.getElementsByClassName("tvProviderImage")?.[0]||null,c=i?.controlBar?.getChild("videoSelector")||null,u=i?.controlBar?.getChild("seriesV2")||null,m=i?.el()?.getElementsByClassName("vjs-button vjs-rewind-button")?.[0]||null,p=i?.el()?.getElementsByClassName("vjs-button vjs-skip-button")?.[0]||null;let h=!1;const f=(e=[],t=[])=>{if(0==e?.length)return[...t];let n=[];const i=t?.find(e=>"breakEnd"===e?.eventType),r=i?.beaconUrls?.find(e=>e.includes("videoView"))||null,s=e?.length>1?e?.[e?.length-1]:e?.[0],o=s?.trackingEvents?.filter(e=>["breakEnd"].includes(e?.eventType));if(!(o?.some(e=>e?.beaconUrls?.some(e=>e.includes("videoView")))||!1)&&r){let e=o?.map(e=>({...e,eventType:"videoView",beaconUrls:[r]}));e?.[0]&&n.push(e?.[0])}return n},g=async t=>{const i=new URL(t);d&&i.searchParams.append("nextToken",d);const r=await fetch(i.toString(),{method:"GET"}),g=await r.json(),T=g.avails,_=g.nextToken||null;d=_;const v=[],I=n.getPlayer(e),E=I?.controlBar?.progressControl,y=E?.seekBar?.el();document?.querySelectorAll(".vjs-seekbar-marker").forEach(e=>e?.remove()),T.map((e,t)=>{v.push({ads:e?.ads,durationInSeconds:e?.durationInSeconds,startTimeInSeconds:e?.startTimeInSeconds,markerPositionInSeconds:Math.floor(e?.startTimeInSeconds),podSlotImpressionBeacon:f(e?.ads,e?.adBreakTrackingEvents)})}),Xe&&console.log("%c SSAI AD PODS ","background: #bdf369; color: #000",v),v?.length&&(window.adsQueueList=v),v.forEach(({markerPositionInSeconds:e,ads:t})=>{const n=I.duration();if(e>n)return;if(Array.isArray(t)&&0==t?.length)return;const i=e/n*100,r=document.createElement("div");r.className="vjs-seekbar-marker",r.style.left=`${i}%`,r.style.position="absolute",r.style.top="0",r.style.bottom="0",r.style.width="2px",r.style.backgroundColor="#fecc09",r.style.left=`${i}%`,r.style.pointerEvents="none",y.appendChild(r)}),I._timeUpdateHandler&&I.off("timeupdate",I?._timeUpdateHandler),I._timeUpdateHandler=n.throttle(function(){if(!$t(e))return;const t=I?.currentTime();if(t!==a){a=t;for(let e=0;e<v.length;e++){const n=v[e],{startTimeInSeconds:i,durationInSeconds:r,ads:a}=n,d=i+r;if(t>=i-1.2&&t<=d+1.2){h=!!(t>=i&&t<=d&&Array.isArray(a)&&a?.length>0),t>d&&s.set(i,!0),Me.disable(),l&&l.classList.add("vjs-hidden"),m&&(m.style.pointerEvents="none",m.classList.add("vjs-hidden")),p&&(p.style.pointerEvents="none",p.classList.add("vjs-hidden")),c&&(c.el().style.pointerEvents="none",c.el().classList.add("vjs-hidden")),u&&(u.el().style.pointerEvents="none",u.el().classList.add("vjs-hidden")),E.el().classList.add("hide-progress-bar");const e=t-i;let r=0,o=0;for(let t=0;t<a.length;t++){const n=a?.[t]?.durationInSeconds;if(e<r+n){o=t;break}r+=n}setTimeout(()=>{Ke.totalAds=a?.length,Ke.currentAdIndex=o},1e3);const f=[];a?.forEach(e=>{const t=e.trackingEvents.filter(e=>["breakStart","breakEnd","firstQuartile","secondQuartile","thirdQuartile","fourthQuartile","midpoint","impression","complete"].includes(e.eventType));f.push(...t)}),n?.podSlotImpressionBeacon?.length>0&&f.push(...n?.podSlotImpressionBeacon),w(t,n,f,o);break}o.delete(i)}h||(Ke={},E.el().classList.remove("hide-progress-bar"),c&&(c.el().style.pointerEvents="auto",c.el().classList.remove("vjs-hidden")),u&&(u.el().style.pointerEvents="auto",u.el().classList.remove("vjs-hidden")),l&&l.classList.remove("vjs-hidden"),m&&(m.style.pointerEvents="auto",m.classList.remove("vjs-hidden")),p&&(p.style.pointerEvents="auto",p.classList.remove("vjs-hidden")),Me.enable())}},1e3),I.on("timeupdate",I._timeUpdateHandler)},T=new Map,_=2.5;function v(e,t,n,i){"breakEnd"===e&&Ke?.currentAdIndex+1!=Ke?.totalAds&&t?.ads?.length>0||(Xe&&console.warn("%c SSAI BEACON ","background: #e25822; color: #fff",e,`Fired:${Math.round(i.currentTime())}`,"AD_POD:",t),n?.forEach(e=>{fetch(e,{mode:"no-cors"}).catch(t=>{console.warn("Beacon failed:",e,t)})}))}function w(t,i,r,s,o){const a=n.getPlayer(e);if(a.seeking())return;const{startTimeInSeconds:d,durationInSeconds:l}=i;let c=i?.ads?.[s]?.adId||d;Math.floor(a.currentTime());for(const n of r){const{eventType:r,beaconUrls:o,startTimeInSeconds:l,startTime:u,durationInSeconds:m,eventId:p}=n,h=l||d,f=o;let g=window?.customData?.ads?.adEventHandler||null,w=`${c}_${r}`,I=`pod-${d}`;T.has(I)||T.set(I,new Set);let E=T.get(I);if(Xe&&console.warn(t,h,"map:",r,"condition1:",t>=h,"map:",T),t>=h&&t<=h+_&&!E.has(w)){E.add(w);try{v(r,i,f,a)}catch(e){console.error("Error when calling triggerAdBeacon:",e,r,i)}if("function"==typeof g)try{const t={eventType:r,startTimeInSeconds:l,startTime:u,durationInSeconds:m,ad:i?.ads?.[s],adIndex:s};g({adsData:t}),He(e,t)}catch(e){console.error("Error when calling ads callback:",e)}let t=$e.get();if(t&&0!==Object.keys(t).length){const{formulateComscoreAdPayload:e,startComscoreAdTracking:n,finishComscoreAdTracking:o,endComscoreAdTracking:a}=t;if("impression"===r){let t=Ge.get();n(e({...i?.ads?.[s],trackingUrl:t}))}else"complete"===r?o():"breakEnd"===r&&a()}}}}}const et=/(?:(\d{1,}):)?(\d{2}):(\d{2})((\.(\d{1,3})))?/g;function tt(e){return JSON.stringify((e||[]).map(e=>({availId:e.availId,startTimeInSeconds:e.startTimeInSeconds,durationInSeconds:e.durationInSeconds,ads:(e.ads||[]).map(e=>({adId:e.adId,startTimeInSeconds:e.startTimeInSeconds,durationInSeconds:e.durationInSeconds}))})))}class nt{constructor(e,t,n,i){this.video_=i,this.ad_=e,this.skipOffset_=function(e){if(!e)return null;const t=new RegExp(et.source,"g");t.lastIndex=0;const n=t.exec(e);if(!n)return null;const i=Number(n[1])||0,r=Number(n[2]),s=Number(n[3]),o=Number(n[6])||0;return r>59||s>59?null:o/1e3+s+60*r+3600*i}(e?.skipOffset),this.adPosition_=t,this.totalAds_=n,this.isSkipped_=!1}isClientRendering(){return!1}getDuration(){return this.ad_?.durationInSeconds??0}getRemainingTime(){return(this.ad_?.startTimeInSeconds??0)+(this.ad_?.durationInSeconds??0)-(this.video_?.currentTime??0)}isSkippable(){return"number"==typeof this.skipOffset_}getTimeUntilSkippable(){if("number"!=typeof this.skipOffset_)return this.getRemainingTime();const e=this.getRemainingTime()+this.skipOffset_-this.getDuration();return Math.max(e,0)}canSkipNow(){return 0===this.getTimeUntilSkippable()}skip(){this.isSkipped_=!0,this.video_&&(this.video_.currentTime+=this.getRemainingTime())}isLinear(){return!0}getSequenceLength(){return this.totalAds_||1}getPositionInSequence(){return this.adPosition_||1}getTitle(){return this.ad_?.adTitle||""}getVastAdId(){return this.ad_?.vastAdId||""}getAdId(){return this.ad_?.adId||""}getCreativeAdId(){return this.ad_?.creativeId||""}getTimeOffset(){return this.ad_?.startTimeInSeconds??0}release(){this.ad_=null,this.adPosition_=null,this.totalAds_=null}isSkipped(){return this.isSkipped_}}const it="impression",rt="start",st="mute",ot="unmute",at="resume",dt="pause",lt="firstQuartile",ct="midpoint",ut="thirdQuartile",mt="complete",pt="skip",ht="breakStart",ft="breakEnd",gt="skipStateChanged",Tt="ad_impression",_t="ad_started",vt="ad_muted",wt="ad_volume_changed",It="ad_resumed",Et="ad_paused",yt="ad_first_quartile",St="ad_midpoint",bt="ad_third_quartile",At="ad_complete",kt="ad_stopped",Lt="ad_skipped",Ct="ad_skip_state_changed",Ft="ad_break_started",Dt="ad_break_ended",Pt="ads_loaded",Rt="ad_cuepoints_changed",Mt="[Transmit]";function Nt(e){if(null==e)return{avails:[],nextToken:null,dashAvailabilityStartTime:null};let t=e.dashAvailabilityStartTime??null,n=e.nextToken??null,i=[];if(Array.isArray(e.avails))i=e.avails;else if(Array.isArray(e)){const r=e[0];r&&Array.isArray(r.avails)?(i=r.avails,t=t??r.dashAvailabilityStartTime??null,n=n??r.nextToken??null):i=e}else Array.isArray(e?.data?.avails)?(i=e.data.avails,n=n??e.data.nextToken??null,t=t??e.data.dashAvailabilityStartTime??null):Array.isArray(e?.data)&&(i=e.data);return{avails:i,nextToken:n,dashAvailabilityStartTime:t}}class Wt{constructor(e,t,n,i={}){this.video_=e,this.player_=t,this.onEvent_="function"==typeof n?n:()=>{},this.dashManifestUrl_=i.dashManifestUrl||null,this.config_=null,this.trackingUrl_="",this.firstTrackingRequest_=!0,this.nextToken_=null,this.dashAvailabilityStartTime_=0,this.dashAvailabilityStartTimeResolved_=!1,this.pollIntervalMs_=2e3,this.pollId_=null,this.adBreaks_=[],this.ad_=null,this.transmitAd_=null,this.transmitAdBreak_=null,this.eventsSent_=new Set,this.firedBeacons_=new Set,this.adBreakListenersAttached_=!1,this.globalListeners_=[],this.adListeners_=[],this.videoTimeupdate_=null,this.lastMutedForAd_=null,this.onDispose_=()=>this.release(),this.apiTimelineAbsolute_=!1}configure(e){this.config_=e}addTrackingUrl(e){this.trackingUrl_=e||"",this.onEvent_({type:Pt,loadTime:0})}getCuePoints(){const e=new Map;for(const t of this.adBreaks_)for(const n of t.ads||[]){const t=n.startTimeInSeconds,i=t+n.durationInSeconds;if(!isFinite(t)||!isFinite(i)||i<=t)continue;const r=`${t.toFixed(1)}|${i.toFixed(1)}`;e.has(r)||e.set(r,{start:t,end:i})}return Array.from(e.values()).sort((e,t)=>e.start-t.start)}onManifestUpdated(){this.trackingUrl_&&(this.requestTrackingInfo_(this.firstTrackingRequest_),this.firstTrackingRequest_=!1,this.ensurePolling_())}stop(){this.onEnded_(),this.detachAllListeners_(),this.eventsSent_.clear(),this.firedBeacons_.clear(),this.trackingUrl_="",this.firstTrackingRequest_=!0,this.nextToken_=null,this.dashAvailabilityStartTime_=0,this.dashAvailabilityStartTimeResolved_=!1,this.apiTimelineAbsolute_=!1,this.adBreaks_=[],this.adBreakListenersAttached_=!1,this.pollId_&&(clearInterval(this.pollId_),this.pollId_=null)}release(){this.stop()}ensurePolling_(){this.pollId_||(this.pollId_=setInterval(()=>{this.trackingUrl_&&(this.player_?.paused?.()||this.requestTrackingInfo_(!1))},this.pollIntervalMs_))}async requestTrackingInfo_(e){try{const t=new Map;let n=0,i=null;for(;n<10;){const e=new URL(this.trackingUrl_);this.nextToken_&&e.searchParams.set("nextToken",this.nextToken_);const r=await fetch(e.toString(),{method:"GET"}),s=await r.json();n++;const o=Nt(s);o.dashAvailabilityStartTime&&!i&&(i=o.dashAvailabilityStartTime);for(const e of o.avails){const n=e?.availId||`${e?.startTimeInSeconds}`;t.set(n,e)}const a=o.nextToken||null;if(!a||a===this.nextToken_){this.nextToken_=a;break}this.nextToken_=a}const r=Array.from(t.values());this.updateApiTimelineAbsoluteFlag_(r);const s=r?.[0]?.startTimeInSeconds||0;if(this.apiTimelineAbsolute_?(this.dashAvailabilityStartTimeResolved_=!0,this.dashAvailabilityStartTime_=0):await this.resolveDashAvailabilityStartTime_(i,s),r.length){const e=this.normalizeAvails_(r);if(tt(this.adBreaks_)!==tt(e)){this.adBreaks_=e;const t=this.getCuePoints();this.onEvent_({type:Rt,cuepoints:t})}}else this.adBreaks_.length&&(this.onEvent_({type:Rt,cuepoints:[]}),this.onEnded_(),this.adBreaks_=[]);e&&this.setupAdBreakListeners_()}catch(e){console.warn(Mt,"tracking info fetch failed",e)}}updateApiTimelineAbsoluteFlag_(e){this.apiTimelineAbsolute_=!1;const t=1e6;for(const n of e||[]){if((n?.startTimeInSeconds??0)>t)return void(this.apiTimelineAbsolute_=!0);for(const e of n?.ads||[])if((e?.startTimeInSeconds??0)>t)return void(this.apiTimelineAbsolute_=!0)}}normalizeAvails_(e){const t=this.apiTimelineAbsolute_?0:this.dashAvailabilityStartTime_||0;return e.map(e=>{const n=this.resolveAbsoluteStart_(e,t,null);return{...e,startTimeInSeconds:n,ads:(e.ads||[]).map(i=>({...i,startTimeInSeconds:this.resolveAbsoluteStart_(i,t,e,n)}))}})}resolveAbsoluteStart_(e,t,n,i){const r=e?.adProgramDateTime;if(r){const e=new Date(r).getTime()/1e3;if(isFinite(e)&&e>0)return e}if(n?.adProgramDateTime&&"number"==typeof i){return i+((e.startTimeInSeconds||0)-(n.startTimeInSeconds||0))}return(e.startTimeInSeconds||0)+t}async resolveDashAvailabilityStartTime_(e,t){if(!this.dashAvailabilityStartTimeResolved_){if(e){const t=new Date(e).getTime()/1e3;if(isFinite(t)&&t>0)return this.dashAvailabilityStartTime_=t,void(this.dashAvailabilityStartTimeResolved_=!0)}if(t>0){const e=await this.fetchDashAvailabilityStartTimeFromMpd_();e>0&&(this.dashAvailabilityStartTime_=e,this.dashAvailabilityStartTimeResolved_=!0)}}}async fetchDashAvailabilityStartTimeFromMpd_(){try{const e=this.dashManifestUrl_||this.getCurrentSourceUrl_();if(!e||!e.includes(".mpd"))return 0;const t=await fetch(e),n=await t.text(),i=(new DOMParser).parseFromString(n,"application/xml"),r=i.querySelector("MPD")?.getAttribute("availabilityStartTime");return r?new Date(r).getTime()/1e3:0}catch(e){return console.warn(Mt,"MPD availabilityStartTime parse failed",e),0}}getCurrentSourceUrl_(){try{const e=this.player_?.currentSrc?.()||this.player_?.src?.();return"string"==typeof e?e:e?.src||""}catch(e){return""}}setupAdBreakListeners_(){if(this.adBreakListenersAttached_)return;this.adBreakListenersAttached_=!0,this.onTimeupdate_();this.attachGlobalListener_("timeupdate",()=>this.onTimeupdate_()),this.attachGlobalListener_("dispose",this.onDispose_),this.video_&&(this.videoTimeupdate_=()=>this.onTimeupdate_(),this.video_.addEventListener("timeupdate",this.videoTimeupdate_))}isHlsSource_(){const e=this.getCurrentSourceUrl_().toLowerCase(),t=(this.player_?.currentType?.()||"").toLowerCase();return e.includes(".m3u8")||"application/x-mpegurl"===t||"application/vnd.apple.mpegurl"===t}isDashSource_(){const e=this.getCurrentSourceUrl_().toLowerCase();return"application/dash+xml"===(this.player_?.currentType?.()||"").toLowerCase()||e.includes(".mpd")}getDashMediaPlayerTimelineSeconds_(){try{const e=this.player_?.dash?.mediaPlayer;if(!e||"function"!=typeof e.time)return null;const t=e.time();return"number"==typeof t&&isFinite(t)&&t>1e6?t:null}catch(e){return null}}getCurrentTime_(){const e=this.video_?.currentTime??0,t=i.detectBrowser();if(this.isHlsSource_()){let t=e;const n=this.player_?.seekable?.();return n&&n.length>0&&(t=n.end(n.length-1)),Date.now()/1e3-(t-e)}if(this.isDashSource_()){const t=this.getDashMediaPlayerTimelineSeconds_();if(null!=t)return t;const n=this.player_?.seekable?.(),i="function"==typeof this.player_?.currentTime?this.player_.currentTime():e;if(n&&n.length>0){const e=n.start(0);if(e>1e6&&e+i>1e6)return e+i}if(this.apiTimelineAbsolute_&&(this.dashAvailabilityStartTime_||0)>1e9)return(this.dashAvailabilityStartTime_||0)+i}return"Safari"===t?e:"function"==typeof this.player_?.currentTime?this.player_.currentTime():e}onTimeupdate_(){if(!this.ad_&&!this.adBreaks_.length)return;const e=this.getCurrentTime_();if(this.ad_){this.sendInProgressEvents_(e,this.transmitAd_);const t=this.ad_.getDuration(),n=(this.transmitAd_?.startTimeInSeconds??0)+t,i=n-e;this.ad_.canSkipNow()&&i>0&&t>0&&this.sendTrackingEvent_(gt),t>0&&e>=n&&this.onEnded_()}this.ad_||this.checkLinearAds_(e)}sendInProgressEvents_(e,t){if(!t)return;const n=t.startTimeInSeconds+.25*t.durationInSeconds,i=t.startTimeInSeconds+.5*t.durationInSeconds,r=t.startTimeInSeconds+.75*t.durationInSeconds;e>=n&&!this.eventsSent_.has(lt)&&(this.eventsSent_.add(lt),this.sendTrackingEvent_(lt)),e>=i&&!this.eventsSent_.has(ct)&&(this.eventsSent_.add(ct),this.sendTrackingEvent_(ct)),e>=r&&!this.eventsSent_.has(ut)&&(this.eventsSent_.add(ut),this.sendTrackingEvent_(ut))}flushPendingQuartiles_(){for(const e of[lt,ct,ut])this.eventsSent_.has(e)||(this.eventsSent_.add(e),this.sendTrackingEvent_(e))}checkLinearAds_(e){for(const t of this.adBreaks_){if(this.ad_)break;const n=t.ads||[];for(let i=0;i<n.length;i++){const r=n[i],s=r.startTimeInSeconds,o=s+r.durationInSeconds;if(s<=e&&o>e){this.onEnded_(),this.transmitAdBreak_=t,this.transmitAd_=r,this.ad_=new nt(r,i+1,n.length,this.video_),0===i&&this.sendTrackingEvent_(ht),this.setupCurrentAdListeners_();break}}}}onEnded_(){this.ad_&&this.transmitAd_&&(this.ad_.isSkipped()||this.flushPendingQuartiles_(),this.removeCurrentAdListeners_(this.ad_.isSkipped()),this.ad_.getPositionInSequence()===this.ad_.getSequenceLength()&&this.sendTrackingEvent_(ft),this.ad_=null,this.transmitAd_=null,this.transmitAdBreak_=null)}setupCurrentAdListeners_(){let e=!1;this.player_?.paused?.()?e=!0:(this.sendTrackingEvent_(it),this.sendTrackingEvent_(rt)),this.lastMutedForAd_=this.player_?.muted?.()??!1,this.attachAdListener_("volumechange",()=>{const e=this.player_?.muted?.()??!1;e!==this.lastMutedForAd_&&(this.lastMutedForAd_=e,e?this.sendTrackingEvent_(st):this.sendTrackingEvent_(ot))}),this.attachAdListener_("play",()=>{e?(this.sendTrackingEvent_(it),this.sendTrackingEvent_(rt),e=!1):this.sendTrackingEvent_(at)}),this.attachAdListener_("pause",()=>{this.sendTrackingEvent_(dt)})}removeCurrentAdListeners_(e=!1){this.sendTrackingEvent_(e?pt:mt),this.detachAdListeners_(),this.eventsSent_.clear()}attachGlobalListener_(e,t){this.player_&&(this.player_.on(e,t),this.globalListeners_.push({event:e,handler:t}))}attachAdListener_(e,t){this.player_&&(this.player_.on(e,t),this.adListeners_.push({event:e,handler:t}))}detachAdListeners_(){for(const{event:e,handler:t}of this.adListeners_)this.player_?.off?.(e,t);this.adListeners_=[]}detachAllListeners_(){this.detachAdListeners_();for(const{event:e,handler:t}of this.globalListeners_)this.player_?.off?.(e,t);this.globalListeners_=[],this.video_&&this.videoTimeupdate_&&(this.video_.removeEventListener("timeupdate",this.videoTimeupdate_),this.videoTimeupdate_=null)}startComscoreForCurrentAd_(){try{const e=$e.get();if(!e||0===Object.keys(e).length)return;const{formulateComscoreAdPayload:t,startComscoreAdTracking:n}=e,i=Ge.get();n(t({...this.transmitAd_,trackingUrl:i}))}catch(e){console.warn(Mt,"comscore start failed",e)}}sendTrackingEvent_(e){if(!this.transmitAd_||!this.transmitAdBreak_)return void console.warn(Mt,"sendTrackingEvent_ skipped — no active ad",{eventType:e});let t=(this.transmitAd_.trackingEvents||[]).find(t=>t.eventType===e);if(t||(t=(this.transmitAdBreak_.adBreakTrackingEvents||[]).find(t=>t.eventType===e)),t&&!this.config_?.disableTrackingEvents){const n=this.transmitAd_?.adId||this.transmitAdBreak_?.availId||"unknown";for(const i of t.beaconUrls||[]){if(!i)continue;const t=`${n}|${e}|${i}`;this.firedBeacons_.has(t)||(this.firedBeacons_.add(t),fetch(i,{mode:"no-cors"}).catch(e=>{console.warn(Mt,"beacon failed",i,e)}))}}const n=$e.get(),i=n&&Object.keys(n).length?n:null;switch(e){case it:this.onEvent_({type:Tt}),this.startComscoreForCurrentAd_();break;case rt:this.onEvent_({type:_t,ad:this.ad_});break;case st:this.onEvent_({type:vt});break;case ot:this.onEvent_({type:wt});break;case at:this.onEvent_({type:It});break;case dt:this.onEvent_({type:Et});break;case lt:this.onEvent_({type:yt});break;case ct:this.onEvent_({type:St});break;case ut:this.onEvent_({type:bt});break;case mt:this.onEvent_({type:At}),this.onEvent_({type:kt}),i?.finishComscoreAdTracking&&i.finishComscoreAdTracking();break;case pt:this.onEvent_({type:Lt}),this.onEvent_({type:kt});break;case ht:this.onEvent_({type:Ft});break;case ft:this.onEvent_({type:Dt}),i?.endComscoreAdTracking&&i.endComscoreAdTracking();break;case gt:this.onEvent_({type:Ct})}}}const xt={dash:"tracking/initialize/dash",hls:"tracking/initialize/hls"};async function Vt(e,t,n){const i=function(e){if(!e?.src)return null;const t=(e.type||"").toLowerCase(),n=String(e.src).toLowerCase();return"application/dash+xml"===t||n.includes(".mpd")?"dash":"application/x-mpegurl"===t||"application/vnd.apple.mpegurl"===t||n.includes(".m3u8")?"hls":null}(e);if(!i)return e;const r=ye(e.src,n,t).replace(i,xt[i]);console.log("[Transmit] session init →",r);try{const t=await fetch(r,{method:"GET",redirect:"follow"}),n=await t.json();console.log("[Transmit] session response",n);const s="dash"===i?n?.dashUrl:n?.hlsUrl,o=n?.trackingUrl;if(!s||!o)return e;const{hostname:a}=new URL(r),d=`https://${a}${s}`,l=`https://${a}${o}`;return Ge.set(l),console.log("[Transmit] session ready",{manifestUrl:d,trackingUrl:l}),{...e,src:d}}catch(t){return console.warn("[Transmit] session init failed",t),e}}let Ut=null;function Bt(e,t){if(Ut)return console.log("[Transmit] initializeTransmit skipped — manager already initialised"),Ut;const i=Ge.get();if(!i)return console.warn("[Transmit] initializeTransmit skipped — no tracking URL"),null;const r=n.getPlayer(e);if(!r)return console.warn("[Transmit] initializeTransmit skipped — no player"),null;const s=r.el()?.querySelector("video")||null,o=function(e){try{const t="function"==typeof e?.currentSrc&&e.currentSrc()||"function"==typeof e?.src&&e.src()||"";if("application/dash+xml"===("function"==typeof e?.currentType&&e.currentType()||"")||String(t).includes(".mpd"))return t}catch(e){}return null}(r);return Ut=new Wt(s,r,e=>{console.log("[Transmit] ad event",e);const n=t?.customData?.ads?.adEventHandler;if("function"==typeof n)try{n(e)}catch(e){console.warn("[Transmit] adEventHandler threw",e)}},{dashManifestUrl:o}),Ut.configure({disableTrackingEvents:!1}),Ut.addTrackingUrl(i),Ut.onManifestUpdated(),Ut}function Ot(){Ut&&(Ut.release(),Ut=null)}const jt=(t,n)=>{let i=e(t),r=i.currentTime()+n;i.currentTime(r)},Ht=(t,n)=>{let i=e(t),r=i.currentTime(),s=r<=n?0:r-n;i.currentTime(s)},$t=t=>!!e.getPlayer(`${t}`),qt=()=>{document.getElementById("carousel_homepage")&&document.getElementById("carousel_homepage").remove(),document.getElementById("dvr_skin")&&document.getElementById("dvr_skin").remove(),document.getElementById("nondvr_skin")&&document.getElementById("nondvr_skin").remove(),document.getElementById("multicam")&&document.getElementById("multicam").remove(),document.getElementById("errorblock")&&document.getElementById("errorblock").remove(),document.getElementById("def_skin")&&document.getElementById("def_skin").remove(),document.getElementById("video-selection")&&document.getElementById("video-selection").remove(),document.getElementById("multicam-v2")&&document.getElementById("multicam-v2").remove(),document.getElementById("default_v2")&&document.getElementById("default_v2").remove(),document.getElementById("video-captions")&&document.getElementById("video-captions").remove(),document.getElementById("playlist-selection")&&document.getElementById("playlist-selection").remove(),document.getElementById("multiplayer_css")&&document.getElementById("multiplayer_css").remove(),document.getElementById("chromett")&&document.getElementById("chromett").remove()},Gt=(e,t)=>{console.log("load video in core",t);let i=n.getPlayer(e);i&&i.src(t)},zt=(e,t,n,i)=>{let r=e?.response?.data?.errorCode,s=e?.response?.data?.errorMessage||e?.message;$t(t)&&Fe(t,window?.customErrors&&window?.customErrors[r]||`${s}`),n&&n({status:!1,response:e,msg:`${s}`,...i&&{videoId:i}})};exports.authenticateLC=async(e,t,r=!1)=>{let s=await j();const o=n.getPlayer(e);return new Promise((n,a)=>{M(t,s).then(async s=>{Ot();let a=s?.data;i.isBotUserAgent()||(window.sid=de()),a.contentType="linearchannel",a.channelId=t?.channelId;const d=window.customData?.ads||window?.app_data?.appcmsMain?.adsConfig||{},l=!!a?.linearchannel?.isSSAIEnabled,c=l&&"MEDIA_TAILOR"==d?.vodAdSticherProvider,u=l&&"TRANSMIT"==d?.liveAdSticherProvider&&!!d?.liveAdClientSideTracking;let m=be(a,e);c?(m=await ze(e,a),r=!0):u&&(m=await Vt(m,a,e),r=!0),K(a),m&&r?(Gt(e,m),u?Bt(e,{customData:window.customData||{ads:d}}):c&&Ze(e),o.on("loadstart",()=>{n({status:!0,msg:"Feed authenticated and loaded",response:a})})):($e.get()&&0!==Object.keys($e.get()).length&&qe({playerId:e,comscore:{enable:!0}}),n({status:!0,msg:"Feed authenticated",response:a}))}).catch(e=>{a({status:!1,msg:"Cannot load feed",response:e})})})},exports.baseUrlManager=x,exports.classifyRequestKind=(e,t)=>{const n=String(t||"").toLowerCase();if(n.includes("license"))return"license";if(n.includes("certificate"))return"server_certificate";if(n.includes("manifest"))return"manifest";if(n.includes("key"))return"key";if(n.includes("segment")||n.includes("media"))return"segment";const i=String(e||"").split("?")[0].toLowerCase();return i.endsWith(".mpd")||i.endsWith(".m3u8")||i.endsWith(".ism/manifest")?"manifest":/\.(m4s|mp4|m4a|m4v|ts|aac|webm|cmf[av]|mp4a)$/.test(i)?"segment":/license|widevine|playready|fairplay|drm/.test(i)?"license":/cert|certificate/.test(i)?"server_certificate":/\.key($|\?)/.test(i)||/\/key\//.test(i)?"key":"other"},exports.clearError=De,exports.comscoreInstanceManager=$e,exports.createIdxMapping=e=>{z=new Map,e.map((e,t)=>{z.set(e.id,t)})},exports.createSeriesWatchMap=(e,t)=>{let n=new Map;W({videoId:e,token:t}).then(({data:e})=>{e.map(e=>{n.set(e.videoId,{t:e.watchedTime,p:e.watchedPercentage})}),Q=n}).catch(e=>console.log(e))},exports.disableControls=e=>{let t=document.getElementById(e),n=t.getElementsByClassName("vjs-control-bar")[0];n&&(n.style.visibility="hidden");let i=t.getElementsByClassName("vjs-big-play-button")[0];i&&(i.style.display="none");let r=t.getElementsByClassName("vjs-fullscreen-control")[0];r&&(r.style.display="none")},exports.dispose=e=>{Ot();const t=n.getPlayer(e),{destroyComscoreTag:i}=$e.get()||{};if(qt(),i&&i(),n.clearEventListeners(),window.onresize=null,t)t.dispose();else{let t=document.getElementById(e);t&&t.remove()}},exports.emitApiErrorEvent=F,exports.extractStatusCode=(e,t)=>{const n=[e?.statusCode,e?.status,e?.code,t?.statusCode,t?.status,t?.code];for(const e of n){const t=Number(e);if(Number.isFinite(t)&&t>0)return t}return null},exports.getCurrentSeries=J,exports.getCurrentVideo=X,exports.getDecodedToken=H,exports.getEntitlementData=function(e,n,i,r){return t({url:i,params:{id:e,deviceType:"web_browser",contentConsumption:"web",latitude:r?.latitude,longitude:r?.longitude},method:"GET",headers:{Authorization:n,adbTempToken:window?.customData?.adbTempToken},withCredentials:!0}).catch(t=>{throw F(i,t,"content",{videoId:e,url:i}),t})},exports.getEpisodeNumber=Te,exports.getLinearChannelDetails=M,exports.getSGAIEnabledSource=ze,exports.getSeasonNumber=ge,exports.getSeriesDetails=function(e,n){const i=H(n),r=i?.site||null;if(window?.customData?.seriesData)return new Promise((e,t)=>e({data:window?.customData?.seriesData}));{let i=x.get()+`/v3/content/series/${e}`;return t({url:i,params:{site:r},method:"GET",headers:{Authorization:n}}).catch(t=>{throw F(i,t,"content",{videoId:e}),t})}},exports.getSeriesWatchHistory=W,exports.getSeriesWatchMap=()=>Q,exports.getSource=be,exports.getSsaiEvents=function(e){const t=n.getPlayer(e);if(!t)return console.error("[SSAI] Player instance not found"),{};const i=(e,n)=>{const i=(e,t)=>n(t);return t.on(e,i),()=>t.off(e,i)};return{adBreakStart:e=>i(Ne,e),adImpression:e=>i(We,e),adFirstQuartile:e=>i(xe,e),adMidpoint:e=>i(Ve,e),adThirdQuartile:e=>i(Ue,e),adComplete:e=>i(Be,e),adBreakEnd:e=>i(Oe,e)}},exports.getToken=j,exports.getTransmitEnabledSource=Vt,exports.getUpdatedClusterSource=({src:e,type:t},n)=>{if(!e||"string"!=typeof e||!e.includes(".com"))return{src:e,type:t};n=n.replace(/\/$/,"");const i=e.split(".com")[1]||"";return{src:i?`${n}${i}`:e,type:t}},exports.getUserId=le,exports.getVideoDetails=R,exports.getVideoIdx=()=>G,exports.getVideoInfo=N,exports.handleError=Fe,exports.initialiseAdvertisement=Re,exports.initialiseComscoreStreamingTracking=qe,exports.initialiseKeyboardEvents=function(e,t){let i=n.getPlayer(e);const r=i?.controlBar?.playToggle?.el_;let s=document.getElementsByTagName("video")[0];document?.addEventListener("keydown",n=>{if(!Me.enabled)return;if(n.metaKey||n.ctrlKey)return;if("input"==n.target.localName||"textarea"==n.target.localName)return;const o=n.key,a=!0===t.liveVideo||!0===t.liveui;switch([" ","m","M","f","F","ArrowLeft","ArrowRight"].includes(o)&&(n.preventDefault(),s?.focus()),o){case" ":r?.click();break;case"m":case"M":i.muted(!i.muted());break;case"f":case"F":document.querySelector(".vjs-fullscreen-control")?.click();break;case"ArrowLeft":a&&!1===t.liveui||Ht(e,10);break;case"ArrowRight":if("MEDIA_TAILOR"==window?.app_data?.appcmsMain?.adsConfig?.vodAdSticherProvider&&window?.app_data?.appcmsMain?.adsConfig?.vodAdClientSideTracking)return;a||jt(e,10)}},!0)},exports.initializeTransmit=Bt,exports.initiateErrorHandling=zt,exports.inititateBeacon=function(e,t){if("localhost"===location.hostname||"127.0.0.1"===location.hostname)return;if(i.isBotUserAgent())return;const r=_.getConfig();if(r?.disableBeacon)return;t?.userId&&(ie=t.userId);const s=n.getPlayer(e);window.initialise(s,t?.analyticsCb),window.firstFrame(s,t?.analyticsCb,t?.analyticsEventParams),window.endFirstFrame(s),window.watchLive(s)},exports.isDrmError=v,exports.isDrmRequestKind=e=>w.has(e),exports.isHttpOk=e=>null==e||e>=200&&e<400,exports.isPaused=t=>e(t).paused(),exports.isPlayerInitialised=$t,exports.isTokenExpired=V,exports.load=async(e,t,i)=>{let r=await j();console.log("load video");(J()||null)&&ee(t);let s=0,a=0,d=null;return window?.watchHistory&&window?.watchHistory?.enable&&N(t,r).then(e=>{window?.watchHistory?.cb&&!window?.watchHistory?.isExternal&&window?.watchHistory?.cb(e?.data),s=e?.data?.watchedTime||null,a=e?.data?.watchedPercentage||null,a<95&&(d=e?.data?.watchedTime||null)}).catch(()=>{}),new Promise((i,l)=>{R(t,r).then(async t=>{let r=t?.data;const c=r?.contentType||"video",u=window.customData?.ads||window?.app_data?.appcmsMain?.adsConfig||{},m=!!r?.[c]?.isSSAIEnabled,p=m&&"MEDIA_TAILOR"==u?.vodAdSticherProvider,h=m&&"TRANSMIT"==u?.liveAdSticherProvider&&!!u?.liveAdClientSideTracking;let f=!!r?.[c]?.streamingInfo?.isLiveStream||"linearchannel"===c;K(t.data);let g=r?.ads?.preRoll?.adTags?.web?.active&&r?.ads?.preRoll?.adTags?.web?.url;g&&Re(e,g,r);let T=be(r,e);if(p?T=await ze(e,r):h&&f&&(Ot(),T=await Vt(T,r,e)),T){let t,c=n.getPlayer(e);if(!c)return console.error(`[VL][player-core] player not found for id=${e}`,{player:c}),l({status:!1,msg:"Player not found",response:{}});if(Gt(e,T),h&&f?Bt(e,{customData:window.customData||{ads:u}}):p&&Ye(e,d),c.on("loadstart",()=>{f&&i({status:!0,msg:"Video Loaded",response:r})}),c.on("loadeddata",()=>{De(),i({status:!0,msg:"Video Loaded",response:r})}),c.one("play",()=>{!s||p||h&&f||a<95&&setTimeout(()=>{c.currentTime(s)},0)}),c.one("error",()=>{l({status:!1,msg:c?.error()?.message||"Some error occured"})}),r?.video?.contentDetails?.closedCaptions?.length>0||r?.video?.closedCaptions?.length>0){t=(r?.video?.contentDetails?.closedCaptions||r?.video?.closedCaptions).filter(e=>"VTT"===e.format),o.addCaptions(e,t)}else o.removeCaptions(e)}else Fe(e,"Incompatible Source, only hls,mp4,drm content is allowed"),l("Incompatible Source, only hls,mp4,drm content is allowed")}).catch(n=>{zt(n,e,l,t)})})},exports.loadVideo=Gt,exports.loadVideoInstantly=(e,t,i)=>{let r=n.getPlayer(e);return r.src(t),new Promise((e,t)=>{let n=0;r.one("loadedmetadata",()=>{clearTimeout(n),e({status:!0,msg:"video loaded"})}),r.one("loadstart",e=>{n=setTimeout(()=>{t("FAILED: Took too long to load")},i)})})},exports.pause=t=>{e(t).pause()},exports.play=t=>{e(t).play()},exports.playerConfigManager=_,exports.refreshTokenManager=B,exports.rewind=Ht,exports.runGtag=function(e){window.dataLayer=window.dataLayer||[],d("js",new Date),d("config",e)},exports.saveWatchHistory=async function(e){let n=await j();return t({url:x.get()+`${p}`,method:"POST",headers:{Authorization:n},data:{...e},params:{...e?.profileId&&{profileId:e?.profileId}}}).catch(t=>{throw F("saveWatchHistory",t,"content",{videoId:e?.videoId,profileId:e?.profileId}),t})},exports.seasonIdxManager=te,exports.setCurrentSeries=e=>{$=e},exports.setCurrentVideo=K,exports.setUserId=e=>{e&&"undefined"!=typeof window&&window.sessionStorage&&window.sessionStorage.setItem("uid",e)},exports.setVideoIdx=Z,exports.setVideoIdxById=ee,exports.setupAdvertisementMarkers=Ye,exports.setupAdvertisementMarkersForLinear=Ze,exports.skip=jt,exports.token_authentication_enabled=e=>{let t=!0;const n=e?.videoSourceUrl,i=e?.asat;return n&&!i&&(t=!1),t},exports.trackMap=Qe,exports.trackingUrlManager=Ge,exports.videoReplayTracker=Y;
1
+ "use strict";var e=require("video.js"),t=require("axios"),n=require("./skin-5a0cbc97.js"),i=require("./browser-dc29be24.js"),r=require("md5"),s=require("js-cookie"),o=require("./captions-1ec67937.js"),a=require("@viewlift/comscore/index.js");function d(){window?.dataLayer?.push(arguments)}function l(e,t){d("event",e,t)}var c={name:"@viewlift/player",version:"2.1.54",main:"dist/bundle.cjs.js",types:"dist/@viewlift/player/esm/index.d.ts",amdName:"_playerCore",scripts:{prepublishOnly:"release-assistant"},dependencies:{"@silvermine/videojs-airplay":"^1.3.0","@silvermine/videojs-chromecast":"^1.4.1","@viewlift/sse":"^0.0.3","broadcast-channel":"^7.3.0","@viewlift/comscore":"^1.0.19",axios:"^1.2.3",md5:"^2.3.0",ima:"npm:videojs-ima@2.2.0","js-cookie":"^3.0.5","jwt-decode":"^4.0.0","video.js":"8.22.0","videojs-contrib-ads":"7.5.2","videojs-contrib-eme":"5.5.1","videojs-mux":"^4.21.7","videojs-contrib-quality-menu":"^1.0.3"},overrides:{"min-document":"^2.19.1"}},u="https://prod-api.viewlift.com",m="/entitlement/video/status",p="/v2/user/history",h="/v2/user/info",f="/v2/user/history/series",g="/v3/entitlement/linearchannel",T="/analytics/player-beacon";const _=(()=>{let e={};return{setConfig:t=>{e={...e,...t}},getConfig:()=>e}})(),v=e=>!!e&&"drm"===(e=>{if(5===Number(e?.code))return"drm";const t=`${e?.code??""} ${(e=>e?.response?.data?.errorMessage||e?.response?.data?.message||e?.response?.statusText||e?.message||"unknown_error")(e)}`.toLowerCase();return/(drm|license|widevine|playready|fairplay|eme|key|hdcp)/.test(t)?"drm":/(network|manifest|segment|playlist|http|xhr|fetch|timeout)/.test(t)?"network":/(decode|mediaerror|mediasource|appendbuffer|sourcebuffer)/.test(t)?"decode":"player"})(e),w=new Set(["license","key","server_certificate"]),I="asset_not_found",E="geo_blocking_issue",y="entitlement_mismatch",S="DRM/License Failures",b=new Set(["contentgeorestricted","contentgeorestrictedbyhba","content_not_available_for_country"]),A=[/geo[\s_-]?block/i,/geo[\s_-]?restrict/i,/geographic/i,/not available in your/i,/outside.*(?:region|country|territory)/i,/\bcountry\b/i,/\bterritory\b/i],k=[/entitlement/i,/not entitled/i,/subscription/i,/not subscribed/i,/access denied/i,/\bunauthorized\b/i,/\bforbidden\b/i,/\bpremium\b/i,/upgrade required/i,/tv[\s_-]?provider/i,/\bprovider\b/i],L=[/not found/i,/no content/i,/does not exist/i,/\bmissing\b/i,/not available currently/i,/not available/i],C=(e,t,n,i)=>{const r=Number(e),s=String(t||"");return v(i)?S:b.has((e=>String(e||"").toLowerCase().replace(/[\s-]/g,"_"))(n))||A.some(e=>e.test(s))?E:k.some(e=>e.test(s))?y:L.some(e=>e.test(s))||404===r?I:451===r?E:y},F=(e,t,n,i={})=>{console.log("emitApiErrorEvent",{apiName:e,error:t,errorCategory:n,meta:i});const r=(()=>{const e=_.getConfig()||{};return e?.apiErrorCb||e?.onApiError||e?.customData?.apiErrorCb||e?.customData?.onApiError||e?.customData?.callbacks?.onApiError||null})();if("function"!=typeof r)return;console.log("emitApiErrorEvent",t);const s=t?.response?.status||t?.status||0,o=(e=>e?.response?.data?.errorMessage||e?.response?.data?.message||e?.response?.statusText||e?.message||"unknown_error")(t),a=(e=>e?.response?.data?.errorCode||e?.response?.data?.error_code||e?.response?.data?.code||e?.errorCode||null)(t),d=C(s,o,a,t),l={errorcode:s||a,errormessage:o,errorcategory:n||d,...i};e&&(l.apiPath=e);try{r(d,l)}catch(e){console.warn("[VLPlayer] apiError callback failed:",e)}};let D=c;window.vl_player_version=D.version;const P=()=>window?.customData?.overrideEntitlementBaseUrl?window?.customData?.overrideEntitlementBaseUrl+"/video/status":x.get()+`${m}`,R=function(e,n,i=!1){if(window?.customData?.overrideEntitlementResponse)return new Promise((e,t)=>e({data:window?.customData?.overrideEntitlementResponse}));{let r=P();return t({url:P(),params:{id:e,deviceType:"web_browser",contentConsumption:"web",ssaiDisable:i,...window?.customData?.entitlement},method:"GET",headers:{Authorization:n,"Sdk-Version":D.version,"x-player-name":"videojs",adbTempToken:window?.customData?.adbTempToken},withCredentials:!0}).catch(t=>{throw F(r,t,"content",{videoId:e}),t})}},M=function(e,n,i=!1){if(window?.customData?.overrideEntitlementResponse)return new Promise((e,t)=>e({data:window?.customData?.overrideEntitlementResponse}));let r=x.get()+g;return t({url:r,params:{id:e?.id,deviceType:"web_browser",contentConsumption:"web",ssaiDisable:i,...e?.channelId&&{channelId:e?.channelId},...e?.programId&&{programId:e?.programId},...e?.programTitle&&{programTitle:e?.programTitle},...e?.programSubType&&{programSubType:e?.programSubType},...window?.customData?.entitlement},method:"GET",headers:{Authorization:n,hdcp:"HDCP-1.4",sl:"SW_SECURE_CRYPTO",adbTempToken:window?.customData?.adbTempToken}}).catch(t=>{throw F(r,t,"content",{videoId:e?.id,channelId:e?.channelId,programId:e?.programId}),t})},N=(e,n)=>{let i=window.contentType,r=x.get()+`${h}/${i}/${e}`;return t({method:"GET",url:r,headers:{Authorization:n,"x-api-key":window?.watchHistory?.xApiKey},timeout:15e3}).catch(t=>{throw F(r,t,"content",{videoId:e,contentType:i}),t})},W=e=>{let n=e.videoId,i=x.get()+`${f}/${n}`;return t({method:"GET",url:i,headers:{Authorization:e.token},timeout:15e3}).catch(t=>{throw F(i,t,"content",{seriesId:n,videoId:e?.videoId}),t})},x=(()=>{let e=u;return{set(t){t&&(e=t)},get:()=>e}})(),V=e=>{let t=JSON.parse(atob(e?.split(".")[1])),n=t?.exp;if(new Date(1e3*n).getTime()<(new Date).getTime())return!0};let U=null;function B(){return{set(e){e&&(U=e)},get:()=>U}}let O=null;const j=async()=>{let e=sessionStorage.getItem("vlp_token");return e&&V(e)?(O||(O=(async()=>{let e=B().get(),n=x.get();try{return await t({method:"GET",url:`${n}/identity/refresh/${e}`})}catch(e){throw console.error("Error fetching refresh token",e),e}})().then(t=>{const n=t?.data?.authorizationToken,i=t?.data?.refreshToken;return n&&sessionStorage.setItem("vlp_token",n),i&&B().set(i),n||e}).catch(t=>(console.error("Error fetching refresh token",t),e)).finally(()=>{O=null})),O):e},H=e=>{if(e&&"string"==typeof e)return JSON.parse(atob(e.split(".")[1]))};let $,q,G,z,Q;const Y=(()=>{let e=new Map;return{set(t){let n=t?.video?.id||t||null;e.set(n,(e.get(n)||0)+1)},get:t=>e.get(t),clear(){e.clear()}}})(),K=e=>{q=e},X=()=>q,J=()=>$,Z=e=>{G=e},ee=e=>{if(z){let t=z.get(e);Z(t+1)}},te=(()=>{let e=0;return{set(t){t>=0&&(e=t)},get:()=>e}})();let ne=0,ie=null,re=null,se=!1,oe=!1;const ae=()=>{const e=X();return"linearchannel"==(e?.contentType||"video")?e?.linearchannel?.channels?.find(t=>t?.id===e?.channelId)?.content?.id:e?.video?.gist?.id||e?.video?.id||e?.id};function de(){const e=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function le(){return ie||window.sessionStorage.getItem("uid")}async function ce(){let e=await j();if(e){let t=JSON.parse(atob(e.split(".")[1]));return t?.anonymousId?"guest-user":t?.userId}return"guest-user"}window.initialise=function(e){window.sid=de(),window.environment="production",window.platform="WEBSITE",window.failedToStartTimer=null,window.droppedStreamTimer=null,window.firstFrameFired=!1,window.isAdPlaying=!1,window._pingTimes=[],window._pingTimeUpdateHandler=null,streamFailures(e),buffering(e),ads(e),ping(e),ue(e),me(e)};const ue=function(e){e.on("play",function(){"pause"!==re||e.scrubbing()||(re="play",l("RESUME",{pfm:window.platform,uid:le(),vid:ae(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:"RESUME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}))}),e.on("playing",function(){window.firstFrameFired&&!e.scrubbing()&&(re="play")}),e.on("pause",function(){setTimeout(()=>{!se&&window.firstFrameFired&&"play"===re&&(re="pause",l("PAUSE",{pfm:window.platform,uid:le(),vid:ae(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:"PAUSE",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}))},50)})},me=function(e){if(!e)return;let t=0,n=0,i=0,r=0;function s(){t=n,n=Math.floor(e.currentTime()),t<n&&(r=t,t=n)}function o(){if(oe)return void(oe=!1);i=Math.floor(e.currentTime());const t=Math.floor(i-r);if(0!==t&&window.firstFrameFired){const n=t>0?"SEEK_FORWARD":"SEEK_BACKWARD";l(n,{pfm:window.platform,uid:le(),vid:ae(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:n,videoPosition:Math.floor(e.currentTime()),isAdEvent:!1})}r=Math.floor(e.currentTime()),setTimeout(()=>{se=!1},50),e.on("timeupdate",s)}e.on("timeupdate",s),e.on("seeking",function(){if(se)return;se=!0,e.off("timeupdate",s),e.one("seeked",o)}),e.on("seeked",o)};window.cleanupTimers=function(){clearInterval(window.bufferingTimer),clearTimeout(window.failedToStartTimer),clearTimeout(window.droppedStreamTimer),window.failedToStartTimer=null,window.droppedStreamTimer=null},window.fireStreamFailure=function(e){const t=n.getPlayer(),i=t?.el_?Math.floor(t.currentTime()):0;window.cleanupTimers(),l(e,{pfm:window.platform,uid:le(),vid:ae(),videoPosition:i,...window?.customData?.beacon?.params}),fireEvent({eventName:e,videoPosition:i,isAdEvent:!1})},window.streamFailures=function(e){e.on("error",function(){const e=window.firstFrameFired?"DROPPED_STREAM":"FAILED_TO_START";window.fireStreamFailure(e)})},window.firstFrame=function(e,t,n){e.one("play",tryCatch(function(){window.ttFirstFrameStartTime_In_MS=performance.now(),re="play",window.failedToStartTimer=setTimeout(function(){window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")},3e4),l("PLAY",{pfm:window.platform,uid:le(),vid:ae(),videoPosition:Math.floor(e.currentTime()),...window?.customData?.beacon?.params}),fireEvent({eventName:"PLAY",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}),t&&t("started_video_playback",{"Video ID":ae(),watchTime:Math.floor(e.currentTime()),...n})}))},window.buffering=function(e){e.on("waiting",tryCatch(function(){window.firstFrameFired&&(e.currentTime(),clearInterval(window.bufferingTimer),window.bufferingTimer=setInterval(function(){e?.el_?.className?.includes("vjs-waiting")&&!e.paused()?window.totalBufferTime=window.handleBufferTimer?window.handleBufferTimer(window.totalBufferTime,e):null:(clearInterval(window.bufferingTimer),clearTimeout(window.droppedStreamTimer),window.droppedStreamTimer=null)},100),window.firstFrameFired&&(clearTimeout(window.droppedStreamTimer),window.droppedStreamTimer=setTimeout(function(){e?.el_?.className?.includes("vjs-waiting")&&!e.paused()&&window.fireStreamFailure("DROPPED_STREAM")},45e3)))}))},window.handleBufferTimer=function(e,t){if(!t.el_)return void(window.ttFirstFrameStartTime_In_MS=null);let n=e+.1;return+n.toFixed(2)%5==0&&t?.el_?.className?.includes("vjs-waiting")&&ne<4&&(ne++,l("BUFFERING",{pfm:window.platform,uid:le(),vid:ae(),videoPosition:t.el_&&Math.floor(t.currentTime()),...window?.customData?.beacon?.params}),fireEvent({eventName:"BUFFERING",videoPosition:t.el_&&Math.floor(t.currentTime()),isAdEvent:!1})),n},window.endFirstFrame=function(e){const t=tryCatch(function(){if(!window.ttFirstFrameStartTime_In_MS||window.firstFrameFired)return;if(window.isAdPlaying)return void console.log("'playing' event ignored during ad playback.");clearInterval(window.bufferingTimer),clearTimeout(window.failedToStartTimer),window.failedToStartTimer=null,window.firstFrameFired=!0;const n=(performance.now()-window.ttFirstFrameStartTime_In_MS)/1e3;window.ttFirstFrameStartTime_In_MS=null,window.totalBufferTime=n||0,l("FIRST_FRAME",{eventName:"FIRST_FRAME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,ttFirstFrame:parseFloat(n?.toFixed(2)),bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:le(),vid:ae(),...window?.customData?.beacon?.params}),fireEvent({eventName:"FIRST_FRAME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,ttFirstFrame:parseFloat(n?.toFixed(2)),bufferHealth:window.getRemainingBufferTime(e)}),e.off("timeupdate",t)});e.on("timeupdate",t)},window.ads=function(e){e.on("adsready",function(){e.ima.addEventListener(window.google.ima.AdEvent.Type.STARTED,function(){window.isAdPlaying=!0,!window.firstFrameFired&&window.failedToStartTimer&&clearTimeout(window.failedToStartTimer),l("AD_REQUEST",{eventName:"AD_REQUEST",videoPosition:Math.floor(e.currentTime()),isAdEvent:!0,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:le(),vid:ae(),resHeight:e.videoHeight(),resWidth:e.videoWidth(),...window?.customData?.beacon?.params}),fireEvent({eventName:"AD_REQUEST",videoPosition:Math.ceil(e.currentTime()),isAdEvent:!0,resHeight:e.videoHeight(),resWidth:e.videoWidth(),adPosition:1}),l("AD_IMPRESSION",{eventName:"AD_IMPRESSION",videoPosition:Math.floor(e.currentTime()),isAdEvent:!0,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:le(),resHeight:e.videoHeight(),resWidth:e.videoWidth(),vid:ae(),...window?.customData?.beacon?.params}),fireEvent({eventName:"AD_IMPRESSION",videoPosition:Math.ceil(e.currentTime()),resHeight:e.videoHeight(),resWidth:e.videoWidth(),isAdEvent:!0,adPosition:1})}),e.ima.addEventListener(window.google.ima.AdEvent.Type.SKIPPED,function(){window.isAdPlaying=!1,window.firstFrameFired||(window.failedToStartTimer=setTimeout(()=>{window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")},3e4))}),e.ima.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,function(){window.isAdPlaying=!1,window.firstFrameFired||(window.failedToStartTimer=setTimeout(()=>{window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")},3e4))})})};const pe=function(e,t,n){fireEvent({eventName:"PING",videoPosition:t,isAdEvent:!1,duration:n,resHeight:e.videoHeight(),resWidth:e.videoWidth(),bufferHealth:window.getRemainingBufferTime(e),bitrate:e.tech_?.vhs&&window.getBitrate(e)})};window.fireExitPing=function(e){if(window.isAdPlaying)return;const t=e?.el_?Math.floor(e.currentTime()):0;t<=0||pe(e,t,t)},window.ping=function(e){window._pingTimeUpdateHandler&&(e.off("timeupdate",window._pingTimeUpdateHandler),window._pingTimeUpdateHandler=null),e.on("dispose",tryCatch(function(){console.log('Player DISPOSED >> "dispose" event fired >>> firing exit PING'),window.fireExitPing(e)})),window._pingTimes||(window._pingTimes=[]),window._pingTimeUpdateHandler=function(){var t=Math.floor(e.currentTime());t>=30&&t%30==0&&!window._pingTimes.includes(t)&&(ne=0,window._pingTimes.push(t),pe(e,t,30))},e.on("timeupdate",window._pingTimeUpdateHandler)},window.getBitrate=function(e){return Math.round(e.tech_.vhs.selectPlaylist().attributes.BANDWIDTH/1e3)},window.getRemainingBufferTime=function(e){return tryCatch(function(){let t=e.currentTime(),n=e.duration(),i=e.buffered();for(let e=0;e<i.length;e++){let s=i.start(e),o=i.end(e);if(he(t,s,o)){var r=Math.round(n-o);if(isFinite(r))return r}}})()};const he=function(e,t,n){return e>=t&&e<=n},fe=()=>{const e=X(),t=e?.contentType||"video",n=e?.[t]?.network;return n||null};window.fireEvent=async function(e){if(i.isBotUserAgent())return;const n=await j(),r=H(n),s=r?.site,o=r?.siteId;var a,d=[{aid:s,cid:o,pfm:window.platform,...window?.customData?.beacon?.params,uid:le(),vid:ae(),url:e.url||document.location.href,ref:e.ref||document.referrer,pa:e.eventName,vpos:e.videoPosition??null,environment:window.environment,dp1:e.dp1||"",dp2:e.dp2||"",dp3:e.dp3||"",dp4:e.dp4||"",dp5:e.dp5||"",apos:!0===e.isAdEvent?e.videoPosition:null,apod:!0===e.isAdEvent?(a=e.adPosition,a?String(a):""):"",profid:await ce(),player:e.playerType||"native",media_type:e.mediaType||"VIDEO",stream_id:window.sid,embedurl:"",ttfirstframe:e.ttFirstFrame??null,bitrate:e.bitrate??null,connectionspeed:null,resolutionheight:e.resHeight??null,resolutionwidth:e.resWidth??null,bufferhealth:e.bufferHealth??null,networkname:fe()??null,brandname:s??null,...e?.duration&&{duration:e.duration},...window?.customData?.beacon?.params}];t({url:window?.customData?.beacon?.url||x.get()+T,method:"post",headers:{Authorization:n},contentType:"application/x-www-form-urlencoded",dataType:"text",data:d}).catch(function(e){console.error(e)})},window.tryCatch=function(e){return function(){try{return e.apply(window,arguments)}catch(e){return console.error(e),null}}};window.watchLive=function(e){if(!e)return;const t=e?.controlBar?.getChild("SeekToLive");if(!t)return;const n=t.handleClick;t.handleClick=function(t){return e.liveTracker?.atLiveEdge?.()||(!function(e){l("WATCH_LIVE",{eventName:"WATCH_LIVE",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:le(),resHeight:e.videoHeight(),resWidth:e.videoWidth(),vid:ae(),...window?.customData?.beacon?.params}),fireEvent({eventName:"WATCH_LIVE",videoPosition:Math.ceil(e.currentTime()),resHeight:e.videoHeight(),resWidth:e.videoWidth(),isAdEvent:!1})}(e),oe=!0),n.call(this,t)}};const ge=()=>{const e=te.get();return e>=0?e+1:1},Te=()=>{const e=J(),t=X(),n=t?.video?.id,i=te.get(),r=e?.[i]?.episodes?.findIndex(e=>e?.id===n);return r>=0?r+1:1},_e=r,ve=(e,t)=>e&&t?`${e}x${t}`:e>1024?"L":e>768?"M":"S",we=e=>{const t=Ie(e,"video.tags",[]),n=Ie(e,"video.gist.primaryCategory.title","VIEWLIFT_CONTENT_GENRE");return t.length>0?t.map(e=>e.title).join(","):n},Ie=(e,t,n)=>{for(var i=0,r=(t=t.split(".")).length;i<r;i++)e=e?.[t[i]];return e||n},Ee=(e=!0)=>{const t=localStorage.getItem("deviceId")||"VIEWLIFT_DEVICE_ID";return e?t:t.includes("browser-")?t.replace("browser-",""):t},ye=(e="",t,i)=>{if(window?.customData?.disableMacros)return e;const r=i?.siteName||i?.site||"";let o=i?.contentType||"video",a=i?.[o]?.metadata||i?.[o]?.gist?.metadata,d=n.getPlayer(t);if(!e.includes("VIEWLIFT_"))return e;let l=window.getComputedStyle(document.getElementById(t),null),c=Math.trunc(l.getPropertyValue("height").slice(0,-2)),u=Math.trunc(l.getPropertyValue("width").slice(0,-2));const m="linearchannel"===o?i?.linearchannel?.channels?.find(e=>e?.id===i?.channelId)?.content?.id:Ie(i,"video.gist.id",""),p="linearchannel"===o?i?.linearchannel?.channels?.find(e=>e?.id===i?.channelId)?.title:Ie(i,"video.gist.title","VIEWLIFT_ENCODED_VIDEO_TITLE");let h=null,f=null;"function"==typeof window.__gpp&&window?.__gpp("ping",e=>{h=e?.gppString,f=e?.sectionList[0]});const g=s.get("us_privacy")||s.get("usprivacy"),T=void 0!==g?g:"1YNN",_=JSON.parse(localStorage.getItem("selectedMvpdProvider")||"{}")?.fwIdentifier??null,v={...Se(a),VIEWLIFT_WIDTH:u,VIEWLIFT_HEIGHT:c,VIEWLIFT_SIZE:ve(u,c),VIEWLIFT_DOMAIN:window.location.hostname,VIEWLIFT_URL:window.location.href,VIEWLIFT_ENCODED_URL:encodeURIComponent(window.location.href),VIEWLIFT_DOUBLE_ENCODED_URL:encodeURIComponent(encodeURIComponent(window.location.href)),VIEWLIFT_CACHEBUSTER:"3708662946268",VIEWLIFT_TIMESTAMP:Date.now().toString().substring(0,10),VIEWLIFT_TIMESTAMP_MS:Date.now().toString(),VIEWLIFT_IP:window?.ip||"VIEWLIFT_IP",VIEWLIFT_USER_AGENT:encodeURIComponent(encodeURIComponent(navigator.userAgent)),VIEWLIFT_DNT:"1"===navigator.doNotTrack?"1":"0",VIEWLIFT_DESCRIPTION:Ie(i,"video.gist.description","VIEWLIFT_DESCRIPTION"),VIEWLIFT_DURATION:Ie(i,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_MIN_DURATION:0,VIEWLIFT_MAX_DURATION:Ie(i,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_AUTOPLAY:d?.options_?.autoplay||1,VIEWLIFT_MUTE:d?.options_?.autoplay||0,VIEWLIFT_DEVICE_ID:"spinco"==r||"usanetwork"==r||"golfchannel"==r?"":Ee(!1),VIEWLIFT_DID:"spinco"==r||"usanetwork"==r||"golfchannel"==r?"":Ee(),VIEWLIFT_DEVICETYPE:"WEB_BROWSER",VIEWLIFT_IDTYPE:"dpid",VIEWLIFT_KEYWORDS:we(i),VIEWLIFT_MEDIA_ID:m,VIEWLIFT_ENCODED_VIDEO_TITLE:encodeURI(Ie(i,"video.gist.title","VIEWLIFT_ENCODED_VIDEO_TITLE")),VIEWLIFT_VIDEO_ID:m,VIEWLIFT_VIDEO_URL:encodeURI(window.location.origin+Ie(i,"video.gist.permalink","")),VIEWLIFT_CONSENT:s.get("cc")||"VIEWLIFT_CONSENT",VIEWLIFT_COPPA:Ie(window?.app_data?.site?.settings,"compliance.coppa")?1:0,VIEWLIFT_GDPR_CONSENT:"",VIEWLIFT_ROKU_AD_ID:"",VIEWLIFT_ROKU_AD_KEYS:"",VIEWLIFT_RDID:"",VIEWLIFT_GDPR:"spinco"==r||"usanetwork"==r||"golfchannel"==r?"":Ie(window?.app_data?.site?.settings,"compliance.gdpr")?1:0,VIEWLIFT_US_PRIVACY:T,VIEWLIFT_TVE_PROVIDER:_?_e(_):"",VIEWLIFT_CONTENT_DURATION_MS:1e3*Ie(i,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_CONTENT_DURATION:Ie(i,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_CONTENT_ID:m,VIEWLIFT_CONTENT_TITLE:p,VIEWLIFT_CONTENT_SERIES_TITLE:Ie(i,"video.series.gist.title","VIEWLIFT_CONTENT_SERIES_TITLE"),VIEWLIFT_CONTENT_GENRE:Ie(i,"video.gist.primaryCategory.title","VIEWLIFT_CONTENT_GENRE"),VIEWLIFT_USER:sessionStorage.getItem("uid")||"VIEWLIFT_USER",VIEWLIFT_EPISODE_NUMBER:Te(),VIEWLIFT_SEASON_NUMBER:ge(),VIEWLIFT_CONTENT_TAGS:we(i),VIEWLIFT_GPP_SID:f||"VIEWLIFT_GPP_SID",VIEWLIFT_GPP:h||"VIEWLIFT_GPP",VIEWLIFT_APP_ID:"",VIEWLIFT_APP_STORE_URL:"",VIEWLIFT_LAT:"",VIEWLIFT_APP_BUNDLE:"",VIEWLIFT_ATT_CONSENT:"",...window?.customData?.macros};for(let t in v){const n=new RegExp(t,"g");e=e.replace(n,v[t])}return e},Se=e=>{let t={},n=new Map;e?.length>0&&e?.map(e=>{n.set(e.name,e.value)});let r=window?.customData?.subscription?.SVOD||!1,s=window?.customData?.subscription?.TVE||!1;return r||s?(i.isMobile()?r?t={...t,VIEWLIFT_CSID:n.get("csid.mweb.dtc")||"",VIEWLIFT_CSID_CSAI:n.get("csid.mweb.dtc.csai")||""}:s&&(t={...t,VIEWLIFT_CSID:n.get("csid.mweb.tve")||"",VIEWLIFT_CSID_CSAI:n.get("csid.mweb.tve.csai")||""}):r?t={...t,VIEWLIFT_CSID:n.get("csid.web.dtc")||"",VIEWLIFT_CSID_CSAI:n.get("csid.web.dtc.csai")||""}:s&&(t={...t,VIEWLIFT_CSID:n.get("csid.web.tve")||"",VIEWLIFT_CSID_CSAI:n.get("csid.web.tve.csai")||""}),r?t={...t,VIEWLIFT_SFID:n.get("sfid.dtc")||n.get("sfid.web.dtc")||"",VIEWLIFT_SFID_CSAI:n.get(i.isMobile()?"sfid.mweb.dtc.csai":"sfid.web.dtc.csai")||""}:s&&(t={...t,VIEWLIFT_SFID:n.get("sfid.tve")||n.get("sfid.web.tve")||"",VIEWLIFT_SFID_CSAI:n.get(i.isMobile()?"sfid.mweb.tve.csai":"sfid.web.tve.csai")||""}),t=i.isMobile()?{...t,VIEWLIFT_PROF:n.get("prof.mweb")||"",VIEWLIFT_PROF_CSAI:n.get("prof.mweb.csai")||""}:{...t,VIEWLIFT_PROF:n.get("prof.web")||"",VIEWLIFT_PROF_CSAI:n.get("prof.web.csai")||""}):(t={...t,VIEWLIFT_SFID:n.get("sfid.dtc")||n.get("sfid.web.dtc")||"",VIEWLIFT_SFID_CSAI:n.get(i.isMobile()?"sfid.mweb.dtc.csai":"sfid.web.dtc.csai")||""},t=i.isMobile()?{...t,VIEWLIFT_CSID:n.get("csid.mweb.dtc")||"",VIEWLIFT_PROF:n.get("prof.mweb")||"",VIEWLIFT_CSID_CSAI:n.get("csid.mweb.dtc.csai")||"",VIEWLIFT_PROF_CSAI:n.get("prof.mweb.csai")||""}:{...t,VIEWLIFT_CSID:n.get("csid.web.dtc")||"",VIEWLIFT_PROF:n.get("prof.web")||"",VIEWLIFT_CSID_CSAI:n.get("csid.web.dtc.csai")||"",VIEWLIFT_PROF_CSAI:n.get("prof.web.csai")||""}),t={...t,VIEWLIFT_AFID:n.get("afid"),VIEWLIFT_NIELSEN_APP_ID:Ie(window?.app_data?.appcmsMain?.analytics,"nielsen.id")||n.get("VIEWLIFT_NIELSEN_APP_ID")||"",VIEWLIFT_CHANNEL:n.get("VIEWLIFT_CHANNEL")||"",VIEWLIFT_GRACE_NOTE_ID:n.get("VIEWLIFT_GRACE_NOTE_ID")||"",VIEWLIFT_EXTERNAL_AD_ID:n.get("VIEWLIFT_EXTERNAL_AD_ID")||""},t},be=(e,t)=>{let n=e?.contentType||"video",r=e?.[n]?.drmEnabled,s=e?.[n]?.streamingInfo?.videoAssets,o=e?.[n]?.streamingInfo?.audioAssets,a=e?.[n]?.streamingInfo?.videoAssets?.hls||!1,d=e?.[n]?.streamingInfo?.videoAssets?.dash||!1;if(e?.directPlaybackUrl)return{src:e?.directPlaybackUrl,type:null};if(e?.audioAssetSource&&o?.hls){return ke(o)}if(r){let n=Le(s,t);return n.src=ye(n.src,t,e),n}if("Safari"!==i.detectBrowser()&&d){return Ae(s)}if(a){let n=ke(s);return n.src=ye(n.src,t,e),n}if(s?.mpeg){let n=(e=>{let t=e?.mpeg;return{src:t[t.length-1].url,type:"video/mp4"}})(s);return n.src=ye(n.src,t,e),n}return null},Ae=e=>{let t=e?.dash;return t?{src:t,type:"application/dash+xml"}:null},ke=e=>{let t=e?.hls;return t?{src:t,type:"application/x-mpegURL"}:null},Le=(t,r)=>{const s=t?.drmProvider||null,o=t.fairPlayCmaf||t.fairPlay,a=t.widevine,d=t.playReady;let l=i.detectBrowser();if(n.getPlayer(r),"Safari"===l){let t=function(t){let n=t.url;return{src:n,type:"application/x-mpegURL",__vlLicenseUrl:t?.licenseUrl||"",keySystems:{"com.apple.fps.1_0":{getCertificate:(n,i)=>{let r={uri:t.certificateUrl,method:"GET",responseType:"arraybuffer"};e.xhr(r,(e,t,n)=>{console.log(e),e&&i(e),i(null,new Uint8Array(n))})},getContentId:(e,t)=>{if(t){const e=t.indexOf("\0")+1;return t.slice(e)}},getLicense:(n,i,r,s)=>{let o={uri:t.licenseUrl,method:"POST",responseType:"arraybuffer",body:r,headers:{"Content-type":"application/octet-stream","X-AxDRM-Message":t&&t.licenseToken}};e.xhr(o,(e,t,n)=>{console.log(e),e&&s(e),s(null,n)})}}}}}(o);return Ce(r),t}{let e={src:a.url,type:"application/dash+xml"};return"caliente"==window?.siteName?(Ce(r),e.keySystems={"com.widevine.alpha":{url:a.licenseUrl,licenseHeaders:{"X-AxDRM-Message":a.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"},"com.microsoft.playready":{url:d?.licenseUrl,licenseHeaders:{"X-AxDRM-Message":d?.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}):"custom"==s?(e.keySystemOptions=[],e.keySystemOptions.push({name:"com.widevine.alpha",options:{serverURL:a.licenseUrl,httpRequestHeaders:{"Content-Type":"application/octet-stream"},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}),e.keySystemOptions.push({name:"com.microsoft.playready",options:{serverURL:d?.licenseUrl,httpRequestHeaders:{"Content-Type":"application/octet-stream"},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}})):(e.keySystemOptions=[],e.keySystemOptions.push({name:"com.widevine.alpha",options:{serverURL:a.licenseUrl,httpRequestHeaders:{"X-AxDRM-Message":a.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}),e.keySystemOptions.push({name:"com.microsoft.playready",options:{serverURL:d?.licenseUrl,httpRequestHeaders:{"X-AxDRM-Message":d?.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}})),e}};const Ce=e=>{const t=n.getPlayer(e);if("function"==typeof t.eme)try{t.eme(),"Safari"==i.detectBrowser()&&t.eme.initLegacyFairplay()}catch(e){console.log("EME ERROR :",e)}},Fe=(e,t)=>{if(Promise.resolve().then(function(){return require("./error-26d5a3c3.js")}).then(e=>{let t=document.createElement("style");t.id="errorblock",t.append(`${e.default}`),document.head.appendChild(t)}),document.getElementsByClassName("error-container")[0]){let e=document.getElementsByClassName("error-message")[0];e&&(e.innerHTML=`${t}`)}else{let n=document.getElementById(e);if(n){let e=document.createElement("div");e.className="error-container";let i=document.createElement("div");i.className="error-message",i.innerHTML=`${t}`,e.appendChild(i),n.append(e)}}},De=()=>{document.getElementsByClassName("error-container")[0]&&document.getElementsByClassName("error-container")[0].remove()};let Pe=!1;const Re=(e,t,i)=>{let r=ye(t,e,i),s=n.getPlayer(e);if(t&&window.google){if("function"!=typeof s.ima&&"object"!=typeof s.ima)return;s.ima.initializeAdDisplayContainer&&s.ima.initializeAdDisplayContainer(),function(e,t){let i=n.getPlayer(e);if(null===i.el_)return;Pe=!0;var r={id:e,adTagUrl:`${t}`,adLabel:"Your video will resume after this sponsor message"};i.ima.initializeAdDisplayContainer&&i.ima.initializeAdDisplayContainer(),Pe&&null!==i.el_&&("function"==typeof i.ima?i.ima(r):setTimeout(()=>{i.ima.setContentWithAdTag(null,t,!0),i.ima.requestAds()},1e3));var s=document.getElementById(`${e}`);(navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&s.hasAttribute("controls")&&s.removeAttribute("controls");var o="click",a=!1;(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(a=!0,o="touchend"),i.one(o,function(){a&&i.ima.initializeAdDisplayContainer()});let d=window?.customData?.ads?.adEventHandler||null;i.one("ads-ad-started",function(){d&&d({status:"STARTED",msg:"Advertisement Started"})}),i.one("ads-manager",function(e){var t=e.adsManager;t.addEventListener(google.ima.AdEvent.Type.COMPLETE,()=>{d&&d({status:"ENDED",msg:"Advertisement Ended"})}),t.addEventListener(google.ima.AdEvent.Type.LOADED,e=>{d&&d({status:"LOADED",msg:"Advertisement Loaded",data:e})})}),i.on("adserror",function(e){d&&d({status:"ERROR",msg:"Advertisement Error"})})}(e,r)}};const Me=(()=>{let e=!0;return{enable(){e=!0},disable(){e=!1},get enabled(){return e}}})(),Ne="ssai-breakStart",We="ssai-adImpression",xe="ssai-firstQuartile",Ve="ssai-midpoint",Ue="ssai-thirdQuartile",Be="ssai-complete",Oe="ssai-breakEnd",je={breakStart:Ne,impression:We,firstQuartile:xe,midpoint:Ve,thirdQuartile:Ue,complete:Be,breakEnd:Oe};function He(e,t={}){const i=n.getPlayer(e);if(!i)return console.error("[SSAI] Player instance not found"),{};const{eventType:r}=t,s=je[r];s&&i.trigger(s,t)}const $e=(()=>{let e={};return{get:()=>e,set(t){e=t}}})();function qe(e,t){const i=e?.playerId,r=n.getPlayer(i);if(!e?.comscore?.enable)return;let s=X();const o=s?.video?.metadata||[];let d=o?.length&&o.filter(e=>"advertisingGenre"===e.name);if(d?.length){let e=d.map(e=>e.value);d=e?.join(",")}a.destroyComscoreTag();let l=window?.lcProgrammeDetails,c=Array.isArray(l?.category)?l?.category?.join(","):l?.category||null,u={...s?.video,...s?.linearchannel,siteName:e?.comscore?.applicationName||e?.comscore?.metadata?.siteName||s?.site||null,programId:l?.videotmsid||null,programTitle:l?.lcProgrammeName||null,episodeId:l?.videotmsid||null,seasonNumber:s?.video?.series?.seasonNumber||l?.seriesDetails?.season||null,episodeNumber:s?.video?.series?.episodeNumber||l?.seriesDetails?.episode||null,episodeTitle:l?.lcSubTitle||null,isCompleteEpisode:!(!s?.video?.series&&!l?.seriesDetails?.episode),genre:d||c,comscoreConfig:{implementationId:e?.comscore?.implementationId||null,projectId:e?.comscore?.projectId||null}};const m=e?.comscore?.metadata?.contentType;if(u.contentType=u?.streamingInfo?.isLiveStream?"Live":m||"LongFormOnDemand",!u?.network){let e=u?.metadata||[];const t=e?.find(e=>"network"===e.name)?.value;u.network=t||null}var p;u?.network&&u?.genre&&(u.customGenre=`${u.network}_${u?.programTitle||(p=u,p?.series?p?.series?.title:p?.gist?.title)}_${u.genre}`),l?.airDate&&(u.publishDate=l.airDate),u?.runtime&&"function"==typeof r.duration&&(u.runtime=1e3*Math.ceil(r.duration()));const h=a.formulateComscorePayload(u,r);console.log("comscoreOptions player data",h),a.createComscoreStreamingTag({playerName:"Video.js",...h}),a.setComscorePlayerInstance(r)}const Ge=(()=>{let e="";return{set(t){t&&(e=t)},get:()=>e}})();async function ze(e,t){n.getPlayer(e);const i=be(t,e),r=i.src;let s=r.replace("/dash/","/session/").replace("/master/","/session/");s=ye(s,e,t);const[o,a]=function(e){const t={};if(!e.split("?")[1])return[{},{}];const n=new URL(e,window.location.origin),i=n?.searchParams||[];for(const[e,n]of i)t[decodeURIComponent(e)]=decodeURIComponent(n||"");const r={},s={};for(const[e,n]of Object.entries(t))if(e.startsWith("ads.")){r[e.replace(/^ads\./,"")]=n}else s[e]=n;return[r,s]}(s),d=(l=a,Object.fromEntries(Object?.entries(l)?.map(([e,t])=>[e?.replace(/^aws\./,""),String(t)]))||{}||{});var l;s=new URL(s.split("?")[0]),Object.keys(a).length>0&&Object.entries(a).forEach(([e,t])=>{s.searchParams.set(e,t)});try{const e=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adsParams:{...o},...d})}),t=await e.json(),n="https://"+new URL(s).hostname,r=t.trackingUrl,a=t.manifestUrl,l=n+r,c=n+a;return Ge.set(l),console.log("%c TRACKING URL","background: #bdf369; color: #000",l),i.src=c,i}catch(e){return i}}const Qe=new Map;async function Ye(e,t){Qe.clear(),window.isAdPlaying=!1;const i=Ge.get(),r=n.getPlayer(e);r.one("loadeddata",()=>{i&&h(i)});const s=new Map,o=new Map;let a=-1;const d=document?.getElementsByClassName("tvProviderImage")?.[0]||null,l=r?.controlBar?.getChild("videoSelector")||null,c=r?.controlBar?.getChild("seriesV2")||null,u=r?.el()?.getElementsByClassName("vjs-button vjs-rewind-button")?.[0]||null,m=r?.el()?.getElementsByClassName("vjs-button vjs-skip-button")?.[0]||null,p=(e=[],t=[])=>{if(0==e?.length)return[...t];let n=[];const i=t?.find(e=>"breakEnd"===e?.eventType),r=i?.beaconUrls?.find(e=>e.includes("videoView"))||null,s=e?.length>1?e?.[e?.length-1]:e?.[0],o=s?.trackingEvents?.filter(e=>["breakEnd"].includes(e?.eventType));if(!(o?.some(e=>e?.beaconUrls?.some(e=>e.includes("videoView")))||!1)&&r){let e=o?.map(e=>({...e,eventType:"videoView",beaconUrls:[r]}));e?.[0]&&n.push(e?.[0])}return n},h=async i=>{const r=await fetch(i),h=(await r.json()).avails,g=[];let T=null;const _=n.getPlayer(e),w=_.controlBar.progressControl,I=w.seekBar.el();if(document?.querySelectorAll(".vjs-seekbar-marker").forEach(e=>e?.remove()),h.map((e,t)=>{0==t&&Array.isArray(e?.ads),g.push({ads:e?.ads,durationInSeconds:e?.durationInSeconds,startTimeInSeconds:e?.startTimeInSeconds,markerPositionInSeconds:Math.floor(e?.startTimeInSeconds),podSlotImpressionBeacon:p(e?.ads,e?.adBreakTrackingEvents)})}),t&&function(e){if(null==e)return;let t=null;for(const n of g){const{startTimeInSeconds:i,ads:r}=n;Array.isArray(r)&&r?.length>0&&(i>e||s.has(i)||(null===t||i>t.startTimeInSeconds)&&(t=n))}t?(console.log("Resume: seeking back to recent ad break:",t.startTimeInSeconds,"then resuming to",e),T={position:e,podStart:t.startTimeInSeconds,podEndTime:t.startTimeInSeconds+t.durationInSeconds,entered:!1},setTimeout(()=>{_.currentTime(t.startTimeInSeconds+.4)},100)):(T=null,_.currentTime(e),S(e))}(t),g?.length){console.log("%c SSAI AD PODS ","background: #bdf369; color: #000",g),window.adsQueueList=g;const e=window?.customData?.ads?.onAdBreaksLoaded||null;"function"==typeof e&&e(g)}console.log(g,"data"),g.forEach(({markerPositionInSeconds:e,ads:t})=>{const n=_.duration();if(e>n)return;if(Array.isArray(t)&&0==t?.length)return;const i=e/n*100,r=document.createElement("div");r.className="vjs-seekbar-marker",r.style.left=`${i}%`,r.style.position="absolute",r.style.top="0",r.style.bottom="0",r.style.width="2px",r.style.backgroundColor="#fecc09",r.style.left=`${i}%`,r.style.pointerEvents="none",I.appendChild(r)}),_._timeUpdateHandler&&_.off("timeupdate",_._timeUpdateHandler),_._timeUpdateHandler=n.throttle(function(){const e=_.currentTime();if(e!==a){a=e;let t=!1;for(let n=0;n<g.length;n++){const i=g[n],{startTimeInSeconds:r,durationInSeconds:a,ads:p}=i,h=r+a;if(e>=r-1.2&&e<=h+1.2){e>=r&&e<=h&&Array.isArray(p)&&p?.length>0&&(t=!0),e>h&&s.set(r,!0),Me.disable(),d&&d.classList.add("vjs-hidden"),u&&(u.style.pointerEvents="none",u.classList.add("vjs-hidden")),m&&(m.style.pointerEvents="none",m.classList.add("vjs-hidden")),l&&(l.el().style.pointerEvents="none",l.el().classList.add("vjs-hidden")),c&&(c.el().style.pointerEvents="none",c.el().classList.add("vjs-hidden")),w.el().classList.add("hide-progress-bar");const o=e-r;let g=0,T=0;for(let e=0;e<p.length;e++){const t=p?.[e]?.durationInSeconds;if(o<g+t){T=e;break}g+=t}p[T];const _=Math.max(0,a-o),I=Math.round(_);k.style.display="block",F.textContent=`${T+1} of ${p.length} • ${f(I)}`;const E=[];p?.forEach(e=>{const t=e.trackingEvents.filter(e=>["breakStart","breakEnd","firstQuartile","secondQuartile","thirdQuartile","fourthQuartile","midpoint","impression","complete"].includes(e.eventType));E.push(...t)}),i?.podSlotImpressionBeacon?.length>0&&E.push(...i?.podSlotImpressionBeacon),v(e,i,E,T,n);break}o.delete(r)}if(window.isAdPlaying=t,T&&!_.seeking()&&(e>=T.podStart&&e<=T.podEndTime&&(T.entered=!0),T.entered&&e>=T.podEndTime)){const e=T.position;T=null,setTimeout(()=>{_.currentTime(e),S(e)},300)}t||(k.style.display="none",w.el().classList.remove("hide-progress-bar"),l&&(l.el().style.pointerEvents="auto",l.el().classList.remove("vjs-hidden")),c&&(c.el().style.pointerEvents="auto",c.el().classList.remove("vjs-hidden")),d&&d.classList.remove("vjs-hidden"),u&&(u.style.pointerEvents="auto",u.classList.remove("vjs-hidden")),m&&(m.style.pointerEvents="auto",m.classList.remove("vjs-hidden")),Me.enable())}},1e3),_.on("timeupdate",_._timeUpdateHandler),document?.addEventListener("keydown",t=>{if(Me.enabled&&"ArrowRight"==t.key){const n=_.currentTime();jt(e,10),y(n,n+10),t.stopPropagation()}});let E=-1;function y(e,t=_.currentTime()){if(null==e||e<0||t<=e)return;let n=null;for(const i of g){const{startTimeInSeconds:r,ads:o}=i;Array.isArray(o)&&o?.length>0&&(s.has(r)||r>e&&r<=t&&(null===n||r>n.startTimeInSeconds)&&(n=i))}null!==n&&(s.set(n.startTimeInSeconds,!0),o.set(n.startTimeInSeconds,!0),T={position:t,podStart:n.startTimeInSeconds,podEndTime:n.startTimeInSeconds+n.durationInSeconds,entered:!1},console.log("Seeking back to ad pod:",n.startTimeInSeconds,"then resuming to",t),setTimeout(()=>{_.currentTime(n.startTimeInSeconds+.4)},100))}function S(e=_.currentTime()){const t=e;let n=null;for(const e of g){const{startTimeInSeconds:i,durationInSeconds:r,ads:o}=e,a=Math.floor(i+r);t>=i&&t<=a&&(n=a,s.set(i,!0))}null!==n&&(console.log("Seeking to end of the ad pod:",n),setTimeout(()=>{_.currentTime(n+2.2)},100))}function b(e){}function A(e){document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",A),0===e.button&&y(E)}w.el().addEventListener("pointerdown",e=>{0===e.button&&(E=_.currentTime(),document.addEventListener("pointermove",b),document.addEventListener("pointerup",A))}),document?.querySelectorAll(".ssai-ad-container")?.forEach(e=>e?.remove());const k=document.createElement("div");k.className="ssai-ad-container";const L=document.createElement("div");L.className="sponsored-adbox";const C=document.createElement("div");C.className="sponsored-text",C.textContent="Sponsored Ad",L.append(C);const F=document.createElement("div");F.className="ad-counter";document.createElement("div").className="ad-timer",k.append(L),k.append(F),_.el().appendChild(k)};function f(e){return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}const g=new Map;let T=-1;function _(e,t,n,i){console.warn("%c SSAI BEACON ","background: #e25822; color: #fff",e,`Fired:${Math.round(i.currentTime())}`,"AD_POD:",t),console.log("%c SSAI BEACON ","background: #e25822; color: #fff",e,`Fired:${Math.round(i.currentTime())}`,"AD_POD:",t),n?.forEach(e=>{fetch(e,{mode:"no-cors"}).catch(t=>{console.warn("Beacon failed:",e,t)})})}function v(t,i,r,s,o,a){const d=n.getPlayer(e);if(d.seeking())return;const{startTimeInSeconds:l,durationInSeconds:c}=i;t<T&&g.clear(),T=t;let u=i?.ads?.[s]?.adId||l;Math.floor(d.currentTime());for(const n of r){const{eventType:r,beaconUrls:a,startTimeInSeconds:l,startTime:c,durationInSeconds:m}=n,p=l||0,h=a;let f=window?.customData?.ads?.adEventHandler||null,T=`${p}_${r}`,v=Qe.get(`pod-${o}`)||[];if(console.warn(t,p,"map:",r,"condition1:",t>=p,"map:",Qe),t>=p&&!v.includes(T)){v.push(T),Qe.set(`pod-${o}`,v);try{_(r,i,h,d)}catch(e){console.error("Error when calling triggerAdBeacon:",e,r,i)}if("function"==typeof f)try{const t={eventType:r,startTimeInSeconds:l,startTime:c,durationInSeconds:m,ad:i?.ads?.[s],adIndex:s};f({adsData:t}),He(e,t)}catch(e){console.error("Error when calling ads callback:",e)}let t=$e.get();if(t&&0!==Object.keys(t).length){const{formulateComscoreAdPayload:e,startComscoreAdTracking:n,finishComscoreAdTracking:o,endComscoreAdTracking:a}=t,d=`${p}_${u}_${r}`;if(!g.has(d))if(g.set(d,!0),"impression"===r){let t=Ge.get();n(e({...i?.ads?.[s],trackingUrl:t}))}else"complete"===r?o():"breakEnd"===r&&a()}}}}}let Ke={};const Xe=window?.location?.search?.includes("debug=true")||!1;let Je=null;async function Ze(e){const t=Ge.get(),i=n.getPlayer(e);function r(){Je&&clearInterval(Je)}i.one("loadeddata",()=>{r(),Je=setInterval(()=>{t&&!i.paused()&&g(t)},2e3)}),i.on("dispose",()=>{r()});const s=new Map,o=new Map;let a=-1,d=null;const l=document?.getElementsByClassName("tvProviderImage")?.[0]||null,c=i?.controlBar?.getChild("videoSelector")||null,u=i?.controlBar?.getChild("seriesV2")||null,m=i?.el()?.getElementsByClassName("vjs-button vjs-rewind-button")?.[0]||null,p=i?.el()?.getElementsByClassName("vjs-button vjs-skip-button")?.[0]||null;let h=!1;const f=(e=[],t=[])=>{if(0==e?.length)return[...t];let n=[];const i=t?.find(e=>"breakEnd"===e?.eventType),r=i?.beaconUrls?.find(e=>e.includes("videoView"))||null,s=e?.length>1?e?.[e?.length-1]:e?.[0],o=s?.trackingEvents?.filter(e=>["breakEnd"].includes(e?.eventType));if(!(o?.some(e=>e?.beaconUrls?.some(e=>e.includes("videoView")))||!1)&&r){let e=o?.map(e=>({...e,eventType:"videoView",beaconUrls:[r]}));e?.[0]&&n.push(e?.[0])}return n},g=async t=>{const i=new URL(t);d&&i.searchParams.append("nextToken",d);const r=await fetch(i.toString(),{method:"GET"}),g=await r.json(),T=g.avails,_=g.nextToken||null;d=_;const v=[],I=n.getPlayer(e),E=I?.controlBar?.progressControl,y=E?.seekBar?.el();document?.querySelectorAll(".vjs-seekbar-marker").forEach(e=>e?.remove()),T.map((e,t)=>{v.push({ads:e?.ads,durationInSeconds:e?.durationInSeconds,startTimeInSeconds:e?.startTimeInSeconds,markerPositionInSeconds:Math.floor(e?.startTimeInSeconds),podSlotImpressionBeacon:f(e?.ads,e?.adBreakTrackingEvents)})}),Xe&&console.log("%c SSAI AD PODS ","background: #bdf369; color: #000",v),v?.length&&(window.adsQueueList=v),v.forEach(({markerPositionInSeconds:e,ads:t})=>{const n=I.duration();if(e>n)return;if(Array.isArray(t)&&0==t?.length)return;const i=e/n*100,r=document.createElement("div");r.className="vjs-seekbar-marker",r.style.left=`${i}%`,r.style.position="absolute",r.style.top="0",r.style.bottom="0",r.style.width="2px",r.style.backgroundColor="#fecc09",r.style.left=`${i}%`,r.style.pointerEvents="none",y.appendChild(r)}),I._timeUpdateHandler&&I.off("timeupdate",I?._timeUpdateHandler),I._timeUpdateHandler=n.throttle(function(){if(!$t(e))return;const t=I?.currentTime();if(t!==a){a=t;for(let e=0;e<v.length;e++){const n=v[e],{startTimeInSeconds:i,durationInSeconds:r,ads:a}=n,d=i+r;if(t>=i-1.2&&t<=d+1.2){h=!!(t>=i&&t<=d&&Array.isArray(a)&&a?.length>0),t>d&&s.set(i,!0),Me.disable(),l&&l.classList.add("vjs-hidden"),m&&(m.style.pointerEvents="none",m.classList.add("vjs-hidden")),p&&(p.style.pointerEvents="none",p.classList.add("vjs-hidden")),c&&(c.el().style.pointerEvents="none",c.el().classList.add("vjs-hidden")),u&&(u.el().style.pointerEvents="none",u.el().classList.add("vjs-hidden")),E.el().classList.add("hide-progress-bar");const e=t-i;let r=0,o=0;for(let t=0;t<a.length;t++){const n=a?.[t]?.durationInSeconds;if(e<r+n){o=t;break}r+=n}setTimeout(()=>{Ke.totalAds=a?.length,Ke.currentAdIndex=o},1e3);const f=[];a?.forEach(e=>{const t=e.trackingEvents.filter(e=>["breakStart","breakEnd","firstQuartile","secondQuartile","thirdQuartile","fourthQuartile","midpoint","impression","complete"].includes(e.eventType));f.push(...t)}),n?.podSlotImpressionBeacon?.length>0&&f.push(...n?.podSlotImpressionBeacon),w(t,n,f,o);break}o.delete(i)}h||(Ke={},E.el().classList.remove("hide-progress-bar"),c&&(c.el().style.pointerEvents="auto",c.el().classList.remove("vjs-hidden")),u&&(u.el().style.pointerEvents="auto",u.el().classList.remove("vjs-hidden")),l&&l.classList.remove("vjs-hidden"),m&&(m.style.pointerEvents="auto",m.classList.remove("vjs-hidden")),p&&(p.style.pointerEvents="auto",p.classList.remove("vjs-hidden")),Me.enable())}},1e3),I.on("timeupdate",I._timeUpdateHandler)},T=new Map,_=2.5;function v(e,t,n,i){"breakEnd"===e&&Ke?.currentAdIndex+1!=Ke?.totalAds&&t?.ads?.length>0||(Xe&&console.warn("%c SSAI BEACON ","background: #e25822; color: #fff",e,`Fired:${Math.round(i.currentTime())}`,"AD_POD:",t),n?.forEach(e=>{fetch(e,{mode:"no-cors"}).catch(t=>{console.warn("Beacon failed:",e,t)})}))}function w(t,i,r,s,o){const a=n.getPlayer(e);if(a.seeking())return;const{startTimeInSeconds:d,durationInSeconds:l}=i;let c=i?.ads?.[s]?.adId||d;Math.floor(a.currentTime());for(const n of r){const{eventType:r,beaconUrls:o,startTimeInSeconds:l,startTime:u,durationInSeconds:m,eventId:p}=n,h=l||d,f=o;let g=window?.customData?.ads?.adEventHandler||null,w=`${c}_${r}`,I=`pod-${d}`;T.has(I)||T.set(I,new Set);let E=T.get(I);if(Xe&&console.warn(t,h,"map:",r,"condition1:",t>=h,"map:",T),t>=h&&t<=h+_&&!E.has(w)){E.add(w);try{v(r,i,f,a)}catch(e){console.error("Error when calling triggerAdBeacon:",e,r,i)}if("function"==typeof g)try{const t={eventType:r,startTimeInSeconds:l,startTime:u,durationInSeconds:m,ad:i?.ads?.[s],adIndex:s};g({adsData:t}),He(e,t)}catch(e){console.error("Error when calling ads callback:",e)}let t=$e.get();if(t&&0!==Object.keys(t).length){const{formulateComscoreAdPayload:e,startComscoreAdTracking:n,finishComscoreAdTracking:o,endComscoreAdTracking:a}=t;if("impression"===r){let t=Ge.get();n(e({...i?.ads?.[s],trackingUrl:t}))}else"complete"===r?o():"breakEnd"===r&&a()}}}}}const et=/(?:(\d{1,}):)?(\d{2}):(\d{2})((\.(\d{1,3})))?/g;function tt(e){return JSON.stringify((e||[]).map(e=>({availId:e.availId,startTimeInSeconds:e.startTimeInSeconds,durationInSeconds:e.durationInSeconds,ads:(e.ads||[]).map(e=>({adId:e.adId,startTimeInSeconds:e.startTimeInSeconds,durationInSeconds:e.durationInSeconds}))})))}class nt{constructor(e,t,n,i){this.video_=i,this.ad_=e,this.skipOffset_=function(e){if(!e)return null;const t=new RegExp(et.source,"g");t.lastIndex=0;const n=t.exec(e);if(!n)return null;const i=Number(n[1])||0,r=Number(n[2]),s=Number(n[3]),o=Number(n[6])||0;return r>59||s>59?null:o/1e3+s+60*r+3600*i}(e?.skipOffset),this.adPosition_=t,this.totalAds_=n,this.isSkipped_=!1}isClientRendering(){return!1}getDuration(){return this.ad_?.durationInSeconds??0}getRemainingTime(){return(this.ad_?.startTimeInSeconds??0)+(this.ad_?.durationInSeconds??0)-(this.video_?.currentTime??0)}isSkippable(){return"number"==typeof this.skipOffset_}getTimeUntilSkippable(){if("number"!=typeof this.skipOffset_)return this.getRemainingTime();const e=this.getRemainingTime()+this.skipOffset_-this.getDuration();return Math.max(e,0)}canSkipNow(){return 0===this.getTimeUntilSkippable()}skip(){this.isSkipped_=!0,this.video_&&(this.video_.currentTime+=this.getRemainingTime())}isLinear(){return!0}getSequenceLength(){return this.totalAds_||1}getPositionInSequence(){return this.adPosition_||1}getTitle(){return this.ad_?.adTitle||""}getVastAdId(){return this.ad_?.vastAdId||""}getAdId(){return this.ad_?.adId||""}getCreativeAdId(){return this.ad_?.creativeId||""}getTimeOffset(){return this.ad_?.startTimeInSeconds??0}release(){this.ad_=null,this.adPosition_=null,this.totalAds_=null}isSkipped(){return this.isSkipped_}}const it="impression",rt="start",st="mute",ot="unmute",at="resume",dt="pause",lt="firstQuartile",ct="midpoint",ut="thirdQuartile",mt="complete",pt="skip",ht="breakStart",ft="breakEnd",gt="skipStateChanged",Tt="ad_impression",_t="ad_started",vt="ad_muted",wt="ad_volume_changed",It="ad_resumed",Et="ad_paused",yt="ad_first_quartile",St="ad_midpoint",bt="ad_third_quartile",At="ad_complete",kt="ad_stopped",Lt="ad_skipped",Ct="ad_skip_state_changed",Ft="ad_break_started",Dt="ad_break_ended",Pt="ads_loaded",Rt="ad_cuepoints_changed",Mt="[Transmit]";function Nt(e){if(null==e)return{avails:[],nextToken:null,dashAvailabilityStartTime:null};let t=e.dashAvailabilityStartTime??null,n=e.nextToken??null,i=[];if(Array.isArray(e.avails))i=e.avails;else if(Array.isArray(e)){const r=e[0];r&&Array.isArray(r.avails)?(i=r.avails,t=t??r.dashAvailabilityStartTime??null,n=n??r.nextToken??null):i=e}else Array.isArray(e?.data?.avails)?(i=e.data.avails,n=n??e.data.nextToken??null,t=t??e.data.dashAvailabilityStartTime??null):Array.isArray(e?.data)&&(i=e.data);return{avails:i,nextToken:n,dashAvailabilityStartTime:t}}class Wt{constructor(e,t,n,i={}){this.video_=e,this.player_=t,this.onEvent_="function"==typeof n?n:()=>{},this.dashManifestUrl_=i.dashManifestUrl||null,this.config_=null,this.trackingUrl_="",this.firstTrackingRequest_=!0,this.nextToken_=null,this.dashAvailabilityStartTime_=0,this.dashAvailabilityStartTimeResolved_=!1,this.pollIntervalMs_=2e3,this.pollId_=null,this.adBreaks_=[],this.ad_=null,this.transmitAd_=null,this.transmitAdBreak_=null,this.eventsSent_=new Set,this.firedBeacons_=new Set,this.adBreakListenersAttached_=!1,this.globalListeners_=[],this.adListeners_=[],this.videoTimeupdate_=null,this.lastMutedForAd_=null,this.onDispose_=()=>this.release(),this.apiTimelineAbsolute_=!1}configure(e){this.config_=e}addTrackingUrl(e){this.trackingUrl_=e||"",this.onEvent_({type:Pt,loadTime:0})}getCuePoints(){const e=new Map;for(const t of this.adBreaks_)for(const n of t.ads||[]){const t=n.startTimeInSeconds,i=t+n.durationInSeconds;if(!isFinite(t)||!isFinite(i)||i<=t)continue;const r=`${t.toFixed(1)}|${i.toFixed(1)}`;e.has(r)||e.set(r,{start:t,end:i})}return Array.from(e.values()).sort((e,t)=>e.start-t.start)}onManifestUpdated(){this.trackingUrl_&&(this.requestTrackingInfo_(this.firstTrackingRequest_),this.firstTrackingRequest_=!1,this.ensurePolling_())}stop(){this.onEnded_(),this.detachAllListeners_(),this.eventsSent_.clear(),this.firedBeacons_.clear(),this.trackingUrl_="",this.firstTrackingRequest_=!0,this.nextToken_=null,this.dashAvailabilityStartTime_=0,this.dashAvailabilityStartTimeResolved_=!1,this.apiTimelineAbsolute_=!1,this.adBreaks_=[],this.adBreakListenersAttached_=!1,this.pollId_&&(clearInterval(this.pollId_),this.pollId_=null)}release(){this.stop()}ensurePolling_(){this.pollId_||(this.pollId_=setInterval(()=>{this.trackingUrl_&&(this.player_?.paused?.()||this.requestTrackingInfo_(!1))},this.pollIntervalMs_))}async requestTrackingInfo_(e){try{const t=new Map;let n=0,i=null;for(;n<10;){const e=new URL(this.trackingUrl_);this.nextToken_&&e.searchParams.set("nextToken",this.nextToken_);const r=await fetch(e.toString(),{method:"GET"}),s=await r.json();n++;const o=Nt(s);o.dashAvailabilityStartTime&&!i&&(i=o.dashAvailabilityStartTime);for(const e of o.avails){const n=e?.availId||`${e?.startTimeInSeconds}`;t.set(n,e)}const a=o.nextToken||null;if(!a||a===this.nextToken_){this.nextToken_=a;break}this.nextToken_=a}const r=Array.from(t.values());this.updateApiTimelineAbsoluteFlag_(r);const s=r?.[0]?.startTimeInSeconds||0;if(this.apiTimelineAbsolute_?(this.dashAvailabilityStartTimeResolved_=!0,this.dashAvailabilityStartTime_=0):await this.resolveDashAvailabilityStartTime_(i,s),r.length){const e=this.normalizeAvails_(r);if(tt(this.adBreaks_)!==tt(e)){this.adBreaks_=e;const t=this.getCuePoints();this.onEvent_({type:Rt,cuepoints:t})}}else this.adBreaks_.length&&(this.onEvent_({type:Rt,cuepoints:[]}),this.onEnded_(),this.adBreaks_=[]);e&&this.setupAdBreakListeners_()}catch(e){console.warn(Mt,"tracking info fetch failed",e)}}updateApiTimelineAbsoluteFlag_(e){this.apiTimelineAbsolute_=!1;const t=1e6;for(const n of e||[]){if((n?.startTimeInSeconds??0)>t)return void(this.apiTimelineAbsolute_=!0);for(const e of n?.ads||[])if((e?.startTimeInSeconds??0)>t)return void(this.apiTimelineAbsolute_=!0)}}normalizeAvails_(e){const t=this.apiTimelineAbsolute_?0:this.dashAvailabilityStartTime_||0;return e.map(e=>{const n=this.resolveAbsoluteStart_(e,t,null);return{...e,startTimeInSeconds:n,ads:(e.ads||[]).map(i=>({...i,startTimeInSeconds:this.resolveAbsoluteStart_(i,t,e,n)}))}})}resolveAbsoluteStart_(e,t,n,i){const r=e?.adProgramDateTime;if(r){const e=new Date(r).getTime()/1e3;if(isFinite(e)&&e>0)return e}if(n?.adProgramDateTime&&"number"==typeof i){return i+((e.startTimeInSeconds||0)-(n.startTimeInSeconds||0))}return(e.startTimeInSeconds||0)+t}async resolveDashAvailabilityStartTime_(e,t){if(!this.dashAvailabilityStartTimeResolved_){if(e){const t=new Date(e).getTime()/1e3;if(isFinite(t)&&t>0)return this.dashAvailabilityStartTime_=t,void(this.dashAvailabilityStartTimeResolved_=!0)}if(t>0){const e=await this.fetchDashAvailabilityStartTimeFromMpd_();e>0&&(this.dashAvailabilityStartTime_=e,this.dashAvailabilityStartTimeResolved_=!0)}}}async fetchDashAvailabilityStartTimeFromMpd_(){try{const e=this.dashManifestUrl_||this.getCurrentSourceUrl_();if(!e||!e.includes(".mpd"))return 0;const t=await fetch(e),n=await t.text(),i=(new DOMParser).parseFromString(n,"application/xml"),r=i.querySelector("MPD")?.getAttribute("availabilityStartTime");return r?new Date(r).getTime()/1e3:0}catch(e){return console.warn(Mt,"MPD availabilityStartTime parse failed",e),0}}getCurrentSourceUrl_(){try{const e=this.player_?.currentSrc?.()||this.player_?.src?.();return"string"==typeof e?e:e?.src||""}catch(e){return""}}setupAdBreakListeners_(){if(this.adBreakListenersAttached_)return;this.adBreakListenersAttached_=!0,this.onTimeupdate_();this.attachGlobalListener_("timeupdate",()=>this.onTimeupdate_()),this.attachGlobalListener_("dispose",this.onDispose_),this.video_&&(this.videoTimeupdate_=()=>this.onTimeupdate_(),this.video_.addEventListener("timeupdate",this.videoTimeupdate_))}isHlsSource_(){const e=this.getCurrentSourceUrl_().toLowerCase(),t=(this.player_?.currentType?.()||"").toLowerCase();return e.includes(".m3u8")||"application/x-mpegurl"===t||"application/vnd.apple.mpegurl"===t}isDashSource_(){const e=this.getCurrentSourceUrl_().toLowerCase();return"application/dash+xml"===(this.player_?.currentType?.()||"").toLowerCase()||e.includes(".mpd")}getDashMediaPlayerTimelineSeconds_(){try{const e=this.player_?.dash?.mediaPlayer;if(!e||"function"!=typeof e.time)return null;const t=e.time();return"number"==typeof t&&isFinite(t)&&t>1e6?t:null}catch(e){return null}}getCurrentTime_(){const e=this.video_?.currentTime??0,t=i.detectBrowser();if(this.isHlsSource_()){let t=e;const n=this.player_?.seekable?.();return n&&n.length>0&&(t=n.end(n.length-1)),Date.now()/1e3-(t-e)}if(this.isDashSource_()){const t=this.getDashMediaPlayerTimelineSeconds_();if(null!=t)return t;const n=this.player_?.seekable?.(),i="function"==typeof this.player_?.currentTime?this.player_.currentTime():e;if(n&&n.length>0){const e=n.start(0);if(e>1e6&&e+i>1e6)return e+i}if(this.apiTimelineAbsolute_&&(this.dashAvailabilityStartTime_||0)>1e9)return(this.dashAvailabilityStartTime_||0)+i}return"Safari"===t?e:"function"==typeof this.player_?.currentTime?this.player_.currentTime():e}onTimeupdate_(){if(!this.ad_&&!this.adBreaks_.length)return;const e=this.getCurrentTime_();if(this.ad_){this.sendInProgressEvents_(e,this.transmitAd_);const t=this.ad_.getDuration(),n=(this.transmitAd_?.startTimeInSeconds??0)+t,i=n-e;this.ad_.canSkipNow()&&i>0&&t>0&&this.sendTrackingEvent_(gt),t>0&&e>=n&&this.onEnded_()}this.ad_||this.checkLinearAds_(e)}sendInProgressEvents_(e,t){if(!t)return;const n=t.startTimeInSeconds+.25*t.durationInSeconds,i=t.startTimeInSeconds+.5*t.durationInSeconds,r=t.startTimeInSeconds+.75*t.durationInSeconds;e>=n&&!this.eventsSent_.has(lt)&&(this.eventsSent_.add(lt),this.sendTrackingEvent_(lt)),e>=i&&!this.eventsSent_.has(ct)&&(this.eventsSent_.add(ct),this.sendTrackingEvent_(ct)),e>=r&&!this.eventsSent_.has(ut)&&(this.eventsSent_.add(ut),this.sendTrackingEvent_(ut))}flushPendingQuartiles_(){for(const e of[lt,ct,ut])this.eventsSent_.has(e)||(this.eventsSent_.add(e),this.sendTrackingEvent_(e))}checkLinearAds_(e){for(const t of this.adBreaks_){if(this.ad_)break;const n=t.ads||[];for(let i=0;i<n.length;i++){const r=n[i],s=r.startTimeInSeconds,o=s+r.durationInSeconds;if(s<=e&&o>e){this.onEnded_(),this.transmitAdBreak_=t,this.transmitAd_=r,this.ad_=new nt(r,i+1,n.length,this.video_),0===i&&this.sendTrackingEvent_(ht),this.setupCurrentAdListeners_();break}}}}onEnded_(){this.ad_&&this.transmitAd_&&(this.ad_.isSkipped()||this.flushPendingQuartiles_(),this.removeCurrentAdListeners_(this.ad_.isSkipped()),this.ad_.getPositionInSequence()===this.ad_.getSequenceLength()&&this.sendTrackingEvent_(ft),this.ad_=null,this.transmitAd_=null,this.transmitAdBreak_=null)}setupCurrentAdListeners_(){let e=!1;this.player_?.paused?.()?e=!0:(this.sendTrackingEvent_(it),this.sendTrackingEvent_(rt)),this.lastMutedForAd_=this.player_?.muted?.()??!1,this.attachAdListener_("volumechange",()=>{const e=this.player_?.muted?.()??!1;e!==this.lastMutedForAd_&&(this.lastMutedForAd_=e,e?this.sendTrackingEvent_(st):this.sendTrackingEvent_(ot))}),this.attachAdListener_("play",()=>{e?(this.sendTrackingEvent_(it),this.sendTrackingEvent_(rt),e=!1):this.sendTrackingEvent_(at)}),this.attachAdListener_("pause",()=>{this.sendTrackingEvent_(dt)})}removeCurrentAdListeners_(e=!1){this.sendTrackingEvent_(e?pt:mt),this.detachAdListeners_(),this.eventsSent_.clear()}attachGlobalListener_(e,t){this.player_&&(this.player_.on(e,t),this.globalListeners_.push({event:e,handler:t}))}attachAdListener_(e,t){this.player_&&(this.player_.on(e,t),this.adListeners_.push({event:e,handler:t}))}detachAdListeners_(){for(const{event:e,handler:t}of this.adListeners_)this.player_?.off?.(e,t);this.adListeners_=[]}detachAllListeners_(){this.detachAdListeners_();for(const{event:e,handler:t}of this.globalListeners_)this.player_?.off?.(e,t);this.globalListeners_=[],this.video_&&this.videoTimeupdate_&&(this.video_.removeEventListener("timeupdate",this.videoTimeupdate_),this.videoTimeupdate_=null)}startComscoreForCurrentAd_(){try{const e=$e.get();if(!e||0===Object.keys(e).length)return;const{formulateComscoreAdPayload:t,startComscoreAdTracking:n}=e,i=Ge.get();n(t({...this.transmitAd_,trackingUrl:i}))}catch(e){console.warn(Mt,"comscore start failed",e)}}sendTrackingEvent_(e){if(!this.transmitAd_||!this.transmitAdBreak_)return void console.warn(Mt,"sendTrackingEvent_ skipped — no active ad",{eventType:e});let t=(this.transmitAd_.trackingEvents||[]).find(t=>t.eventType===e);if(t||(t=(this.transmitAdBreak_.adBreakTrackingEvents||[]).find(t=>t.eventType===e)),t&&!this.config_?.disableTrackingEvents){const n=this.transmitAd_?.adId||this.transmitAdBreak_?.availId||"unknown";for(const i of t.beaconUrls||[]){if(!i)continue;const t=`${n}|${e}|${i}`;this.firedBeacons_.has(t)||(this.firedBeacons_.add(t),fetch(i,{mode:"no-cors"}).catch(e=>{console.warn(Mt,"beacon failed",i,e)}))}}const n=$e.get(),i=n&&Object.keys(n).length?n:null;switch(e){case it:this.onEvent_({type:Tt}),this.startComscoreForCurrentAd_();break;case rt:this.onEvent_({type:_t,ad:this.ad_});break;case st:this.onEvent_({type:vt});break;case ot:this.onEvent_({type:wt});break;case at:this.onEvent_({type:It});break;case dt:this.onEvent_({type:Et});break;case lt:this.onEvent_({type:yt});break;case ct:this.onEvent_({type:St});break;case ut:this.onEvent_({type:bt});break;case mt:this.onEvent_({type:At}),this.onEvent_({type:kt}),i?.finishComscoreAdTracking&&i.finishComscoreAdTracking();break;case pt:this.onEvent_({type:Lt}),this.onEvent_({type:kt});break;case ht:this.onEvent_({type:Ft});break;case ft:this.onEvent_({type:Dt}),i?.endComscoreAdTracking&&i.endComscoreAdTracking();break;case gt:this.onEvent_({type:Ct})}}}const xt={dash:"tracking/initialize/dash",hls:"tracking/initialize/hls"};async function Vt(e,t,n){const i=function(e){if(!e?.src)return null;const t=(e.type||"").toLowerCase(),n=String(e.src).toLowerCase();return"application/dash+xml"===t||n.includes(".mpd")?"dash":"application/x-mpegurl"===t||"application/vnd.apple.mpegurl"===t||n.includes(".m3u8")?"hls":null}(e);if(!i)return e;const r=ye(e.src,n,t).replace(i,xt[i]);console.log("[Transmit] session init →",r);try{const t=await fetch(r,{method:"GET",redirect:"follow"}),n=await t.json();console.log("[Transmit] session response",n);const s="dash"===i?n?.dashUrl:n?.hlsUrl,o=n?.trackingUrl;if(!s||!o)return e;const{hostname:a}=new URL(r),d=`https://${a}${s}`,l=`https://${a}${o}`;return Ge.set(l),console.log("[Transmit] session ready",{manifestUrl:d,trackingUrl:l}),{...e,src:d}}catch(t){return console.warn("[Transmit] session init failed",t),e}}let Ut=null;function Bt(e,t){if(Ut)return console.log("[Transmit] initializeTransmit skipped — manager already initialised"),Ut;const i=Ge.get();if(!i)return console.warn("[Transmit] initializeTransmit skipped — no tracking URL"),null;const r=n.getPlayer(e);if(!r)return console.warn("[Transmit] initializeTransmit skipped — no player"),null;const s=r.el()?.querySelector("video")||null,o=function(e){try{const t="function"==typeof e?.currentSrc&&e.currentSrc()||"function"==typeof e?.src&&e.src()||"";if("application/dash+xml"===("function"==typeof e?.currentType&&e.currentType()||"")||String(t).includes(".mpd"))return t}catch(e){}return null}(r);return Ut=new Wt(s,r,e=>{console.log("[Transmit] ad event",e);const n=t?.customData?.ads?.adEventHandler;if("function"==typeof n)try{n(e)}catch(e){console.warn("[Transmit] adEventHandler threw",e)}},{dashManifestUrl:o}),Ut.configure({disableTrackingEvents:!1}),Ut.addTrackingUrl(i),Ut.onManifestUpdated(),Ut}function Ot(){Ut&&(Ut.release(),Ut=null)}const jt=(t,n)=>{let i=e(t),r=i.currentTime()+n;i.currentTime(r)},Ht=(t,n)=>{let i=e(t),r=i.currentTime(),s=r<=n?0:r-n;i.currentTime(s)},$t=t=>!!e.getPlayer(`${t}`),qt=()=>{document.getElementById("carousel_homepage")&&document.getElementById("carousel_homepage").remove(),document.getElementById("dvr_skin")&&document.getElementById("dvr_skin").remove(),document.getElementById("nondvr_skin")&&document.getElementById("nondvr_skin").remove(),document.getElementById("multicam")&&document.getElementById("multicam").remove(),document.getElementById("errorblock")&&document.getElementById("errorblock").remove(),document.getElementById("def_skin")&&document.getElementById("def_skin").remove(),document.getElementById("video-selection")&&document.getElementById("video-selection").remove(),document.getElementById("multicam-v2")&&document.getElementById("multicam-v2").remove(),document.getElementById("default_v2")&&document.getElementById("default_v2").remove(),document.getElementById("video-captions")&&document.getElementById("video-captions").remove(),document.getElementById("playlist-selection")&&document.getElementById("playlist-selection").remove(),document.getElementById("multiplayer_css")&&document.getElementById("multiplayer_css").remove(),document.getElementById("chromett")&&document.getElementById("chromett").remove()},Gt=(e,t)=>{console.log("load video in core",t);let i=n.getPlayer(e);i&&i.src(t)},zt=(e,t,n,i)=>{let r=e?.response?.data?.errorCode,s=e?.response?.data?.errorMessage||e?.message;$t(t)&&Fe(t,window?.customErrors&&window?.customErrors[r]||`${s}`),n&&n({status:!1,response:e,msg:`${s}`,...i&&{videoId:i}})};exports.authenticateLC=async(e,t,r=!1)=>{let s=await j();const o=n.getPlayer(e);return new Promise((n,a)=>{M(t,s).then(async s=>{Ot();let a=s?.data;i.isBotUserAgent()||(window.sid=de()),a.contentType="linearchannel",a.channelId=t?.channelId;const d=window.customData?.ads||window?.app_data?.appcmsMain?.adsConfig||{},l=!!a?.linearchannel?.isSSAIEnabled,c=l&&"MEDIA_TAILOR"==d?.vodAdSticherProvider,u=l&&"TRANSMIT"==d?.liveAdSticherProvider&&!!d?.liveAdClientSideTracking;let m=be(a,e);c?(m=await ze(e,a),r=!0):u&&(m=await Vt(m,a,e),r=!0),K(a),m&&r?(Gt(e,m),u?Bt(e,{customData:window.customData||{ads:d}}):c&&Ze(e),o.on("loadstart",()=>{n({status:!0,msg:"Feed authenticated and loaded",response:a})})):($e.get()&&0!==Object.keys($e.get()).length&&qe({playerId:e,comscore:{enable:!0}}),n({status:!0,msg:"Feed authenticated",response:a}))}).catch(e=>{a({status:!1,msg:"Cannot load feed",response:e})})})},exports.baseUrlManager=x,exports.classifyRequestKind=(e,t)=>{const n=String(t||"").toLowerCase();if(n.includes("license"))return"license";if(n.includes("certificate"))return"server_certificate";if(n.includes("manifest"))return"manifest";if(n.includes("key"))return"key";if(n.includes("segment")||n.includes("media"))return"segment";const i=String(e||"").split("?")[0].toLowerCase();return i.endsWith(".mpd")||i.endsWith(".m3u8")||i.endsWith(".ism/manifest")?"manifest":/\.(m4s|mp4|m4a|m4v|ts|aac|webm|cmf[av]|mp4a)$/.test(i)?"segment":/license|widevine|playready|fairplay|drm/.test(i)?"license":/cert|certificate/.test(i)?"server_certificate":/\.key($|\?)/.test(i)||/\/key\//.test(i)?"key":"other"},exports.clearError=De,exports.comscoreInstanceManager=$e,exports.createIdxMapping=e=>{z=new Map,e.map((e,t)=>{z.set(e.id,t)})},exports.createSeriesWatchMap=(e,t)=>{let n=new Map;W({videoId:e,token:t}).then(({data:e})=>{e.map(e=>{n.set(e.videoId,{t:e.watchedTime,p:e.watchedPercentage})}),Q=n}).catch(e=>console.log(e))},exports.disableControls=e=>{let t=document.getElementById(e),n=t.getElementsByClassName("vjs-control-bar")[0];n&&(n.style.visibility="hidden");let i=t.getElementsByClassName("vjs-big-play-button")[0];i&&(i.style.display="none");let r=t.getElementsByClassName("vjs-fullscreen-control")[0];r&&(r.style.display="none")},exports.dispose=e=>{Ot();const t=n.getPlayer(e),{destroyComscoreTag:i}=$e.get()||{};if(qt(),i&&i(),n.clearEventListeners(),window.onresize=null,t)t.dispose();else{let t=document.getElementById(e);t&&t.remove()}},exports.emitApiErrorEvent=F,exports.extractStatusCode=(e,t)=>{const n=[e?.statusCode,e?.status,e?.code,t?.statusCode,t?.status,t?.code];for(const e of n){const t=Number(e);if(Number.isFinite(t)&&t>0)return t}return null},exports.getCurrentSeries=J,exports.getCurrentVideo=X,exports.getDecodedToken=H,exports.getEntitlementData=function(e,n,i,r){return t({url:i,params:{id:e,deviceType:"web_browser",contentConsumption:"web",latitude:r?.latitude,longitude:r?.longitude},method:"GET",headers:{Authorization:n,adbTempToken:window?.customData?.adbTempToken},withCredentials:!0}).catch(t=>{throw F(i,t,"content",{videoId:e,url:i}),t})},exports.getEpisodeNumber=Te,exports.getLinearChannelDetails=M,exports.getSGAIEnabledSource=ze,exports.getSeasonNumber=ge,exports.getSeriesDetails=function(e,n){const i=H(n),r=i?.site||null;if(window?.customData?.seriesData)return new Promise((e,t)=>e({data:window?.customData?.seriesData}));{let i=x.get()+`/v3/content/series/${e}`;return t({url:i,params:{site:r},method:"GET",headers:{Authorization:n}}).catch(t=>{throw F(i,t,"content",{videoId:e}),t})}},exports.getSeriesWatchHistory=W,exports.getSeriesWatchMap=()=>Q,exports.getSource=be,exports.getSsaiEvents=function(e){const t=n.getPlayer(e);if(!t)return console.error("[SSAI] Player instance not found"),{};const i=(e,n)=>{const i=(e,t)=>n(t);return t.on(e,i),()=>t.off(e,i)};return{adBreakStart:e=>i(Ne,e),adImpression:e=>i(We,e),adFirstQuartile:e=>i(xe,e),adMidpoint:e=>i(Ve,e),adThirdQuartile:e=>i(Ue,e),adComplete:e=>i(Be,e),adBreakEnd:e=>i(Oe,e)}},exports.getToken=j,exports.getTransmitEnabledSource=Vt,exports.getUpdatedClusterSource=({src:e,type:t},n)=>{if(!e||"string"!=typeof e||!e.includes(".com"))return{src:e,type:t};n=n.replace(/\/$/,"");const i=e.split(".com")[1]||"";return{src:i?`${n}${i}`:e,type:t}},exports.getUserId=le,exports.getVideoDetails=R,exports.getVideoIdx=()=>G,exports.getVideoInfo=N,exports.handleError=Fe,exports.initialiseAdvertisement=Re,exports.initialiseComscoreStreamingTracking=qe,exports.initialiseKeyboardEvents=function(e,t){let i=n.getPlayer(e);const r=i?.controlBar?.playToggle?.el_;let s=document.getElementsByTagName("video")[0];document?.addEventListener("keydown",n=>{if(!Me.enabled)return;if(n.metaKey||n.ctrlKey)return;if("input"==n.target.localName||"textarea"==n.target.localName)return;const o=n.key,a=!0===t.liveVideo||!0===t.liveui;switch([" ","m","M","f","F","ArrowLeft","ArrowRight"].includes(o)&&(n.preventDefault(),s?.focus()),o){case" ":r?.click();break;case"m":case"M":i.muted(!i.muted());break;case"f":case"F":document.querySelector(".vjs-fullscreen-control")?.click();break;case"ArrowLeft":a&&!1===t.liveui||Ht(e,10);break;case"ArrowRight":if("MEDIA_TAILOR"==window?.app_data?.appcmsMain?.adsConfig?.vodAdSticherProvider&&window?.app_data?.appcmsMain?.adsConfig?.vodAdClientSideTracking)return;a||jt(e,10)}},!0)},exports.initializeTransmit=Bt,exports.initiateErrorHandling=zt,exports.inititateBeacon=function(e,t){if("localhost"===location.hostname||"127.0.0.1"===location.hostname)return;if(i.isBotUserAgent())return;const r=_.getConfig();if(r?.disableBeacon)return;t?.userId&&(ie=t.userId);const s=n.getPlayer(e);window.initialise(s,t?.analyticsCb),window.firstFrame(s,t?.analyticsCb,t?.analyticsEventParams),window.endFirstFrame(s),window.watchLive(s)},exports.isDrmError=v,exports.isDrmRequestKind=e=>w.has(e),exports.isHttpOk=e=>null==e||e>=200&&e<400,exports.isPaused=t=>e(t).paused(),exports.isPlayerInitialised=$t,exports.isTokenExpired=V,exports.load=async(e,t,i)=>{let r=await j();console.log("load video");(J()||null)&&ee(t);let s=0,a=0,d=null;return window?.watchHistory&&window?.watchHistory?.enable&&N(t,r).then(e=>{window?.watchHistory?.cb&&!window?.watchHistory?.isExternal&&window?.watchHistory?.cb(e?.data),s=e?.data?.watchedTime||null,a=e?.data?.watchedPercentage||null,a<95&&(d=e?.data?.watchedTime||null)}).catch(()=>{}),new Promise((i,l)=>{R(t,r).then(async t=>{let r=t?.data;const c=r?.contentType||"video",u=window.customData?.ads||window?.app_data?.appcmsMain?.adsConfig||{},m=!!r?.[c]?.isSSAIEnabled,p=m&&"MEDIA_TAILOR"==u?.vodAdSticherProvider,h=m&&"TRANSMIT"==u?.liveAdSticherProvider&&!!u?.liveAdClientSideTracking;let f=!!r?.[c]?.streamingInfo?.isLiveStream||"linearchannel"===c;K(t.data);let g=r?.ads?.preRoll?.adTags?.web?.active&&r?.ads?.preRoll?.adTags?.web?.url;g&&Re(e,g,r);let T=be(r,e);if(p?T=await ze(e,r):h&&f&&(Ot(),T=await Vt(T,r,e)),T){let t,c=n.getPlayer(e);if(!c)return console.error(`[VL][player-core] player not found for id=${e}`,{player:c}),l({status:!1,msg:"Player not found",response:{}});if(Gt(e,T),h&&f?Bt(e,{customData:window.customData||{ads:u}}):p&&Ye(e,d),c.on("loadstart",()=>{f&&i({status:!0,msg:"Video Loaded",response:r})}),c.on("loadeddata",()=>{De(),i({status:!0,msg:"Video Loaded",response:r})}),c.one("play",()=>{!s||p||h&&f||a<95&&setTimeout(()=>{c.currentTime(s)},0)}),c.one("error",()=>{l({status:!1,msg:c?.error()?.message||"Some error occured"})}),r?.video?.contentDetails?.closedCaptions?.length>0||r?.video?.closedCaptions?.length>0){t=(r?.video?.contentDetails?.closedCaptions||r?.video?.closedCaptions).filter(e=>"VTT"===e.format),o.addCaptions(e,t)}else o.removeCaptions(e)}else Fe(e,"Incompatible Source, only hls,mp4,drm content is allowed"),l("Incompatible Source, only hls,mp4,drm content is allowed")}).catch(n=>{zt(n,e,l,t)})})},exports.loadVideo=Gt,exports.loadVideoInstantly=(e,t,i)=>{let r=n.getPlayer(e);return r.src(t),new Promise((e,t)=>{let n=0;r.one("loadedmetadata",()=>{clearTimeout(n),e({status:!0,msg:"video loaded"})}),r.one("loadstart",e=>{n=setTimeout(()=>{t("FAILED: Took too long to load")},i)})})},exports.pause=t=>{e(t).pause()},exports.play=t=>{e(t).play()},exports.playerConfigManager=_,exports.refreshTokenManager=B,exports.rewind=Ht,exports.runGtag=function(e){window.dataLayer=window.dataLayer||[],d("js",new Date),d("config",e)},exports.saveWatchHistory=async function(e){let n=await j();return t({url:x.get()+`${p}`,method:"POST",headers:{Authorization:n},data:{...e},params:{...e?.profileId&&{profileId:e?.profileId}}}).catch(t=>{throw F("saveWatchHistory",t,"content",{videoId:e?.videoId,profileId:e?.profileId}),t})},exports.seasonIdxManager=te,exports.setCurrentSeries=e=>{$=e},exports.setCurrentVideo=K,exports.setUserId=e=>{e&&"undefined"!=typeof window&&window.sessionStorage&&window.sessionStorage.setItem("uid",e)},exports.setVideoIdx=Z,exports.setVideoIdxById=ee,exports.setupAdvertisementMarkers=Ye,exports.setupAdvertisementMarkersForLinear=Ze,exports.skip=jt,exports.token_authentication_enabled=e=>{let t=!0;const n=e?.videoSourceUrl,i=e?.asat;return n&&!i&&(t=!1),t},exports.trackMap=Qe,exports.trackingUrlManager=Ge,exports.videoReplayTracker=Y;
@@ -1 +1 @@
1
- "use strict";var e=require("./skin-5a0cbc97.js"),t=require("./generic-b119e225.js"),n=require("./autoNextVideo-aca868b2.js"),l=require("./relatedVideosManager-ba607f01.js"),r=require("video.js");let a=[],i=!1,o=null,s=!1,d=null,c=null,u=null,m=null,p=null;const f=()=>{null!=o&&(clearInterval(o),o=null),s=!1},g="next-ep-preview-player-thumb",h=(e,t)=>{if(!e)return;var n;n=t,n?.gist?.imageGist?.r16x9||n?.img||window;let l=e.getElementsByClassName(g)[0];l||(l=document.createElement("div"),l.className=g,l.setAttribute("aria-hidden","true"),e.appendChild(l))},x=(e,t)=>{if(!e)return;const n=e.getElementsByClassName(g)[0];n&&(n.style.visibility=t?"visible":"hidden")},v=()=>{let e=document.createElement("div");e.className="next-heading-wrapper";let t=document.createElement("div");t.className="next-ep-header";let n=document.createElement("span");n.className="next-ep-header-text",n.textContent="Next up in";let l=document.createElement("span");return l.className="next-ep-duration",l.textContent="10",t.append(n,l),e.append(t),e},y=(t,n,l,r)=>{let a=t?.isClip?t?.seriesTitle:t?.title,o=t?.gist?.description||t?.description||"",s=document.createElement("div");s.className="next-ep-content";let d=document.createElement("div");d.className="next-ep-thumb-wrap";let c=document.createElement("img");c.className="next-ep-img",c.alt="",c.src=t?.gist?.imageGist?.r16x9||t?.img||window?.customData?.fallbackImage;let u=(e=>{if(null==e||Number.isNaN(Number(e)))return"";const t=Math.floor(Number(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`})(t?.runtime),m=document.createElement("div");m.className="next-ep-thumb-runtime",m.textContent=u,u||m.classList.add("next-ep-thumb-runtime--empty"),d.appendChild(c),d.appendChild(m);let p=document.createElement("div");p.className="next-ep-meta";let g=document.createElement("div");g.className="next-ep-title",g.textContent=`${a||""}`;let h=document.createElement("div");h.className="next-ep-desc",h.textContent=o||"",String(o||"").trim()||h.classList.add("next-ep-desc--empty");let x=document.createElement("div");x.className="next-ep-meta-row";let v=document.createElement("span");v.className="next-ep-badge";let y=(e=>{const t=e?.isClip;if(t)return"CLIP"})(t);v.textContent=y,y||v.classList.add("next-ep-badge--empty");let C=document.createElement("span");C.className="next-ep-episode",C.textContent=(e=>{if(!e||"string"!=typeof e)return"";const t=e.match(/^S(\d+)\s*E(\d+)$/i)||e.match(/^S(\d+)E(\d+)$/i);return t?`S${t[1]} E${Number(t[2])}`:e})(t?.episodeDisplayAttribute)||"";let w=document.createElement("div");w.className="next-ep-meta-row-left",w.appendChild(v),w.appendChild(C);let N=document.createElement("img");N.className="next-ep-network-logo",N.alt="";let A=(e=>{if(!e)return;const t=window?.app_data?.appcmsMain?.networks;if(!e||!t)return;const n=t?.find(t=>{if(t.identifier==e)return t});return n?.badgeImage})(t?.network);A?N.src=A:N.classList.add("next-ep-network-logo--empty"),x.appendChild(w),p.appendChild(g),p.appendChild(h),p.appendChild(x);let b=document.createElement("div");return b.className="next-ep-meta-with-logo",b.appendChild(p),b.appendChild(N),s.appendChild(d),s.appendChild(b),s.onclick=e.debounce(()=>{f(),n?.remove(),i=!0,E(l)},400),s},C=(n,r)=>{if(i=!1,m=n,p=r,u&&(u(),u=null),r?.series?.enable){a=[];const e=t.getCurrentSeries();e?.map(e=>a.push(...e.episodes))}else{const e=l.relatedVideosManager.get();a=e?.content||[],u=l.relatedVideosManager.subscribe(()=>{u&&(u(),u=null),m&&p&&C(m,p)})}let g=e.getPlayer(n);if(!g)return;(e=>{e&&c&&(e.off("timeupdate",c),c=null)})(e.getPlayer(d)),f(),d=n,c=()=>{if(i)return;let e=g.duration(),l=g.currentTime(),r=Number.isFinite(e)&&e>0?e-l:1/0,d=document.getElementsByClassName("next-ep-preview")?.[0];const c=document.getElementById(n),u=t.getVideoIdx()<=a?.length-1;if(r>1){if(null!=o||s){f();let e=d?.querySelector(".next-ep-header .next-ep-duration");e&&(e.textContent="10")}return d&&(d.style.visibility="hidden"),void x(c,!1)}u?(d&&(d.style.visibility="visible"),x(c,!0),s||null!=o||(g.pause(n),s=!0,(e=>{if(null!=o)return;const n=document.getElementsByClassName("next-ep-preview")?.[0],l=n?.querySelector(".next-ep-header .next-ep-duration");if(!l)return;let r=10;l.textContent="10",o=setInterval(()=>{r--,l.textContent=String(r),0===r&&(clearInterval(o),o=null,s=!1,a.filter((e,n)=>n==t.getVideoIdx()),E(e))},1e3)})(n))):x(c,!1)},g.on("timeupdate",c);let w=a.filter((e,n)=>n==t.getVideoIdx());if(w?.length>0)if(document.getElementsByClassName("next-ep-preview")?.[0]){let e=document.getElementsByClassName("next-ep-preview")?.[0];e.style.visibility="hidden",e.querySelector(".next-ep-preview-inner")?.remove(),Array.from(e.children).forEach(e=>{e.classList.contains("next-ep-content")&&e.remove()});let t=e.querySelector(".next-heading-wrapper");if(t){let e=t.querySelector(".next-ep-header"),n=e?.querySelector(".next-ep-duration");if(!n&&e){e.textContent="";let t=document.createElement("span");t.className="next-ep-header-text",t.textContent="Next up in",n=document.createElement("span"),n.className="next-ep-duration",n.textContent="10",e.append(t,n)}else n&&(n.textContent="10")}else t=v(),e.insertBefore(t,e.firstChild);e.appendChild(y(w[0],e,n));const l=document.getElementById(n);h(l,w[0]),x(l,!1)}else{let e=document.createElement("div");e.className="next-ep-preview",e.style.visibility="hidden";let t=document.getElementById(n);t.append(e);let l=v();e.append(l);let r=y(w[0],e,n);e.append(r),h(t,w[0]),x(t,!1)}},E=(l,r)=>{let i=e.getPlayer(l);if(!i)return;let o=i.duration();if(!Number.isFinite(o)||o<=0)return;i.pause(l);let s=t.getVideoIdx();n.switchToNext(s,l,a)};var w,N,A,b;w={0:{src:"data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==",alt:"loading"}},N=function(){var e,t,n,l,r;for(n in t=(e=Array.prototype.slice.call(arguments)).shift()||{},e)for(r in l=e[n])l.hasOwnProperty(r)&&("object"==typeof l[r]?t[r]=N(t[r],l[r]):t[r]=l[r]);return t},A=function(e,t){return function(n){return window.getComputedStyle?window.getComputedStyle(e,t)[n]:e.currentStyle[n]}},b=function(e){return"HTML"!==e.nodeName&&"static"===A(e)("position")?b(e.offsetParent):e},r.registerPlugin("thumbnails",function(e){var t,n,l,r,a,i,o,s;function d(){document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",d),s()}n=N({},w,e),r=this,function(){var e,t,n;-1!==navigator.userAgent.toLowerCase().indexOf("android")&&(t=function(){e.addClass("fake-active")},n=function(){e.removeClass("fake-active")},(e=r.controlBar.progressControl).on("touchstart",t),e.on("touchend",n),e.on("touchcancel",n))}(),(t=document.createElement("div")).className="vjs-thumbnail-holder",l=document.createElement("img"),t.appendChild(l),l.src=n[0].src,l.className="vjs-thumbnail",N(l.style,n[0].style),l.style.left||l.style.right||(l.onload=function(){l.style.left=-l.naturalWidth/2+"px"}),i=r.duration(),r.on("durationchange",function(e){i=r.duration()}),r.on("loadedmetadata",function(e){i=r.duration()}),(a=r.controlBar.progressControl).el().appendChild(t),o=function(e){var r,o,s,d,c,u,m,p,f,g;for(o in s=0,f=(window.pageXOffset?{x:window.pageXOffset,y:window.pageYOffset}:{x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}).x,m=((g=b(a.el()).getBoundingClientRect()).width||g.right)+f,u=e.pageX,e.changedTouches&&(u=e.changedTouches[0].pageX),d=u||e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,d-=b(a.el()).getBoundingClientRect().left+f,r=Math.floor((d-a.el().offsetLeft)/a.width()*i),n)r>o&&(s=Math.max(s,o));(c=n[s]).src&&l.src!=c.src&&(l.src=c.src),c.style&&l.style!=c.style&&N(l.style,c.style),d+(p=function(e,t){var n;return t?parseFloat(t):"auto"!==(n=A(e)("clip"))&&"inherit"!==n&&4===(n=n.split(/(?:\(|\))/)[1].split(/(?:,| )/)).length?parseFloat(n[1])-parseFloat(n[3]):0}(l,c.width||n[0].width)/2)>m?d-=d+p-m:d<p&&(d=p),t.style.left=d+"px"},a.on("mousemove",o),a.on("touchmove",o),a.on("pointerdown",function(e){document.addEventListener("pointermove",o),document.addEventListener("pointerup",d)}),s=function(e){t.style.left="-1000px"},a.on("mouseout",s),a.on("touchcancel",s),a.on("touchend",s),r.on("userinactive",s)}),exports.addNextEpPreview=C,exports.addTVProviderImage=function(t,n){let l=e.getPlayer(t),r=n?.tvProviderLogoUrl;if(!r)return;let a=document.createElement("div");a.className="tvProviderImage";let i=document.createElement("img");i.src=`${r}`,i.alt="Provider Image",a.append(i),l.el().appendChild(a),l.on("useractive",()=>{a.classList.remove("vjs-fade")}),l.on("userinactive",()=>{l.paused()||a.classList.add("vjs-fade")}),l.on("fullscreenchange",()=>{l.isFullscreen_?a.style.top="3.2rem":a.style.top="1rem"})};
1
+ "use strict";var e=require("./skin-5a0cbc97.js"),t=require("./generic-754b73b9.js"),n=require("./autoNextVideo-6704601a.js"),l=require("./relatedVideosManager-ba607f01.js"),r=require("video.js");let a=[],i=!1,o=null,s=!1,d=null,c=null,u=null,m=null,p=null;const f=()=>{null!=o&&(clearInterval(o),o=null),s=!1},g="next-ep-preview-player-thumb",h=(e,t)=>{if(!e)return;var n;n=t,n?.gist?.imageGist?.r16x9||n?.img||window;let l=e.getElementsByClassName(g)[0];l||(l=document.createElement("div"),l.className=g,l.setAttribute("aria-hidden","true"),e.appendChild(l))},x=(e,t)=>{if(!e)return;const n=e.getElementsByClassName(g)[0];n&&(n.style.visibility=t?"visible":"hidden")},v=()=>{let e=document.createElement("div");e.className="next-heading-wrapper";let t=document.createElement("div");t.className="next-ep-header";let n=document.createElement("span");n.className="next-ep-header-text",n.textContent="Next up in";let l=document.createElement("span");return l.className="next-ep-duration",l.textContent="10",t.append(n,l),e.append(t),e},y=(t,n,l,r)=>{let a=t?.isClip?t?.seriesTitle:t?.title,o=t?.gist?.description||t?.description||"",s=document.createElement("div");s.className="next-ep-content";let d=document.createElement("div");d.className="next-ep-thumb-wrap";let c=document.createElement("img");c.className="next-ep-img",c.alt="",c.src=t?.gist?.imageGist?.r16x9||t?.img||window?.customData?.fallbackImage;let u=(e=>{if(null==e||Number.isNaN(Number(e)))return"";const t=Math.floor(Number(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`})(t?.runtime),m=document.createElement("div");m.className="next-ep-thumb-runtime",m.textContent=u,u||m.classList.add("next-ep-thumb-runtime--empty"),d.appendChild(c),d.appendChild(m);let p=document.createElement("div");p.className="next-ep-meta";let g=document.createElement("div");g.className="next-ep-title",g.textContent=`${a||""}`;let h=document.createElement("div");h.className="next-ep-desc",h.textContent=o||"",String(o||"").trim()||h.classList.add("next-ep-desc--empty");let x=document.createElement("div");x.className="next-ep-meta-row";let v=document.createElement("span");v.className="next-ep-badge";let y=(e=>{const t=e?.isClip;if(t)return"CLIP"})(t);v.textContent=y,y||v.classList.add("next-ep-badge--empty");let C=document.createElement("span");C.className="next-ep-episode",C.textContent=(e=>{if(!e||"string"!=typeof e)return"";const t=e.match(/^S(\d+)\s*E(\d+)$/i)||e.match(/^S(\d+)E(\d+)$/i);return t?`S${t[1]} E${Number(t[2])}`:e})(t?.episodeDisplayAttribute)||"";let w=document.createElement("div");w.className="next-ep-meta-row-left",w.appendChild(v),w.appendChild(C);let N=document.createElement("img");N.className="next-ep-network-logo",N.alt="";let A=(e=>{if(!e)return;const t=window?.app_data?.appcmsMain?.networks;if(!e||!t)return;const n=t?.find(t=>{if(t.identifier==e)return t});return n?.badgeImage})(t?.network);A?N.src=A:N.classList.add("next-ep-network-logo--empty"),x.appendChild(w),p.appendChild(g),p.appendChild(h),p.appendChild(x);let b=document.createElement("div");return b.className="next-ep-meta-with-logo",b.appendChild(p),b.appendChild(N),s.appendChild(d),s.appendChild(b),s.onclick=e.debounce(()=>{f(),n?.remove(),i=!0,E(l)},400),s},C=(n,r)=>{if(i=!1,m=n,p=r,u&&(u(),u=null),r?.series?.enable){a=[];const e=t.getCurrentSeries();e?.map(e=>a.push(...e.episodes))}else{const e=l.relatedVideosManager.get();a=e?.content||[],u=l.relatedVideosManager.subscribe(()=>{u&&(u(),u=null),m&&p&&C(m,p)})}let g=e.getPlayer(n);if(!g)return;(e=>{e&&c&&(e.off("timeupdate",c),c=null)})(e.getPlayer(d)),f(),d=n,c=()=>{if(i)return;let e=g.duration(),l=g.currentTime(),r=Number.isFinite(e)&&e>0?e-l:1/0,d=document.getElementsByClassName("next-ep-preview")?.[0];const c=document.getElementById(n),u=t.getVideoIdx()<=a?.length-1;if(r>1){if(null!=o||s){f();let e=d?.querySelector(".next-ep-header .next-ep-duration");e&&(e.textContent="10")}return d&&(d.style.visibility="hidden"),void x(c,!1)}u?(d&&(d.style.visibility="visible"),x(c,!0),s||null!=o||(g.pause(n),s=!0,(e=>{if(null!=o)return;const n=document.getElementsByClassName("next-ep-preview")?.[0],l=n?.querySelector(".next-ep-header .next-ep-duration");if(!l)return;let r=10;l.textContent="10",o=setInterval(()=>{r--,l.textContent=String(r),0===r&&(clearInterval(o),o=null,s=!1,a.filter((e,n)=>n==t.getVideoIdx()),E(e))},1e3)})(n))):x(c,!1)},g.on("timeupdate",c);let w=a.filter((e,n)=>n==t.getVideoIdx());if(w?.length>0)if(document.getElementsByClassName("next-ep-preview")?.[0]){let e=document.getElementsByClassName("next-ep-preview")?.[0];e.style.visibility="hidden",e.querySelector(".next-ep-preview-inner")?.remove(),Array.from(e.children).forEach(e=>{e.classList.contains("next-ep-content")&&e.remove()});let t=e.querySelector(".next-heading-wrapper");if(t){let e=t.querySelector(".next-ep-header"),n=e?.querySelector(".next-ep-duration");if(!n&&e){e.textContent="";let t=document.createElement("span");t.className="next-ep-header-text",t.textContent="Next up in",n=document.createElement("span"),n.className="next-ep-duration",n.textContent="10",e.append(t,n)}else n&&(n.textContent="10")}else t=v(),e.insertBefore(t,e.firstChild);e.appendChild(y(w[0],e,n));const l=document.getElementById(n);h(l,w[0]),x(l,!1)}else{let e=document.createElement("div");e.className="next-ep-preview",e.style.visibility="hidden";let t=document.getElementById(n);t.append(e);let l=v();e.append(l);let r=y(w[0],e,n);e.append(r),h(t,w[0]),x(t,!1)}},E=(l,r)=>{let i=e.getPlayer(l);if(!i)return;let o=i.duration();if(!Number.isFinite(o)||o<=0)return;i.pause(l);let s=t.getVideoIdx();n.switchToNext(s,l,a)};var w,N,A,b;w={0:{src:"data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==",alt:"loading"}},N=function(){var e,t,n,l,r;for(n in t=(e=Array.prototype.slice.call(arguments)).shift()||{},e)for(r in l=e[n])l.hasOwnProperty(r)&&("object"==typeof l[r]?t[r]=N(t[r],l[r]):t[r]=l[r]);return t},A=function(e,t){return function(n){return window.getComputedStyle?window.getComputedStyle(e,t)[n]:e.currentStyle[n]}},b=function(e){return"HTML"!==e.nodeName&&"static"===A(e)("position")?b(e.offsetParent):e},r.registerPlugin("thumbnails",function(e){var t,n,l,r,a,i,o,s;function d(){document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",d),s()}n=N({},w,e),r=this,function(){var e,t,n;-1!==navigator.userAgent.toLowerCase().indexOf("android")&&(t=function(){e.addClass("fake-active")},n=function(){e.removeClass("fake-active")},(e=r.controlBar.progressControl).on("touchstart",t),e.on("touchend",n),e.on("touchcancel",n))}(),(t=document.createElement("div")).className="vjs-thumbnail-holder",l=document.createElement("img"),t.appendChild(l),l.src=n[0].src,l.className="vjs-thumbnail",N(l.style,n[0].style),l.style.left||l.style.right||(l.onload=function(){l.style.left=-l.naturalWidth/2+"px"}),i=r.duration(),r.on("durationchange",function(e){i=r.duration()}),r.on("loadedmetadata",function(e){i=r.duration()}),(a=r.controlBar.progressControl).el().appendChild(t),o=function(e){var r,o,s,d,c,u,m,p,f,g;for(o in s=0,f=(window.pageXOffset?{x:window.pageXOffset,y:window.pageYOffset}:{x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}).x,m=((g=b(a.el()).getBoundingClientRect()).width||g.right)+f,u=e.pageX,e.changedTouches&&(u=e.changedTouches[0].pageX),d=u||e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,d-=b(a.el()).getBoundingClientRect().left+f,r=Math.floor((d-a.el().offsetLeft)/a.width()*i),n)r>o&&(s=Math.max(s,o));(c=n[s]).src&&l.src!=c.src&&(l.src=c.src),c.style&&l.style!=c.style&&N(l.style,c.style),d+(p=function(e,t){var n;return t?parseFloat(t):"auto"!==(n=A(e)("clip"))&&"inherit"!==n&&4===(n=n.split(/(?:\(|\))/)[1].split(/(?:,| )/)).length?parseFloat(n[1])-parseFloat(n[3]):0}(l,c.width||n[0].width)/2)>m?d-=d+p-m:d<p&&(d=p),t.style.left=d+"px"},a.on("mousemove",o),a.on("touchmove",o),a.on("pointerdown",function(e){document.addEventListener("pointermove",o),document.addEventListener("pointerup",d)}),s=function(e){t.style.left="-1000px"},a.on("mouseout",s),a.on("touchcancel",s),a.on("touchend",s),r.on("userinactive",s)}),exports.addNextEpPreview=C,exports.addTVProviderImage=function(t,n){let l=e.getPlayer(t),r=n?.tvProviderLogoUrl;if(!r)return;let a=document.createElement("div");a.className="tvProviderImage";let i=document.createElement("img");i.src=`${r}`,i.alt="Provider Image",a.append(i),l.el().appendChild(a),l.on("useractive",()=>{a.classList.remove("vjs-fade")}),l.on("userinactive",()=>{l.paused()||a.classList.add("vjs-fade")}),l.on("fullscreenchange",()=>{l.isFullscreen_?a.style.top="3.2rem":a.style.top="1rem"})};
@@ -1 +1 @@
1
- "use strict";var e=require("./generic-b119e225.js"),t=require("./skin-5a0cbc97.js"),n=require("./localisation-443f3f19.js");let a=!1;let o=null;const s=(e,t)=>{(new Date).getMonth(),new Date(t).getMonth(),(new Date).getFullYear(),new Date(t).getFullYear();const n=Math.floor(e/6048e5);let a=((e,t)=>{var n;return n=12*(t.getFullYear()-e.getFullYear()),n-=e.getMonth(),(n+=t.getMonth())<=0?0:n})(new Date,new Date(t));const o=a>0&&n>4?a:0;let s=((e,t)=>{let n=new Date(t).getFullYear()-new Date(e).getFullYear(),a=new Date(t).getMonth()-new Date(e).getMonth();return new Date(t).getDay()-new Date(e).getDay()<0&&(a-=1),a<0&&(n-=1),n})(new Date,new Date(t));return[s>0&&o>0?s:0,o,n,Math.floor(e/864e5),Math.floor(e%864e5/36e5),Math.floor(e%36e5/6e4),Math.floor(e%6e4/1e3)]},r=([e,t,n,a,o,s,r,l])=>{let i;i=e>=1?` ${e} Year`:t>=1?` ${t} month`:n>=1?` ${n} week`:a>=1?` ${a} day`:o<24&&o>=12?` ${o} hour`:o>0?`${o} hours ${s} minutes ${r} seconds`:s>0?`${s} minutes ${r} seconds`:`${r} seconds`,l.textContent=`${i}`},l=(()=>{let e={scheduleStartTimeMs:0,scheduleEndTimeMs:0};return{get:()=>e,set(t){e={scheduleStartTimeMs:t?.startDateTime,scheduleEndTimeMs:t?.endDateTime}}}})();function i(e,t,a,o){if(!e)return;const r=()=>{let e=l.get()?.scheduleStartTimeMs,r=l.get()?.scheduleEndTimeMs,c=Date.now();if(c-r>0){let e=document.getElementsByClassName("error-message")[0];return e&&(e.textContent=n.getLocalisation("eventEnded")||"Game has ended",o.textContent=""),clearInterval(i),void a?.()}const d=e-c;if(d/1e3<=0)return clearInterval(i),t?.([0,0,0,0,0,0,0,o]),void a?.();const u=s(d,e);t?.([...u,o])};r();const i=setInterval(r,1e3);return i}exports.getVideoDuration=e=>{let n=t.getPlayer(e);return n?n.duration():`Cannot find player with id: '${e}'`},exports.handleCountdownTimer=(e,t,a)=>{const o=t?.response?.data?.errorCode,s=t?.response?.data?.errorMessage||t?.message||null;l.set({startDateTime:t?.response?.data?.scheduleStartDate,endDateTime:t?.response?.data?.scheduleEndDate}),function(e,t,a,o){let s=Date.now();const c=l.get()?.scheduleStartTimeMs,d=l.get()?.scheduleEndTimeMs;let u=function(e,t,a,o){let s;e<0?s=n.getLocalisation("eventNotStarted")||o||"Game starts in":(t>0||"VIDEO_NOT_EXISTS"==a)&&(s=n.getLocalisation("eventEnded")||o||"Game has ended");return s||o}(s-c,s-d,t,a);if(document.getElementsByClassName("error-container")[0]){let e=document.getElementsByClassName("error-message")[0];e&&(e.textContent=`${u}`);let t=document.getElementsByClassName("error-timer-message")[0];t&&i(Math.abs(c),r,o,t)}else{let t=document.getElementById(e).parentElement;if(t){let e=document.createElement("div");e.className="error-container";let n=document.createElement("div");n.className="error-message";let a=document.createElement("div");a.className="error-timer-message",n.textContent=`${u}`,e.appendChild(n),e.appendChild(a),t.append(e),i(Math.abs(c),r,o,a)}}}(e,o,s,a)},exports.handlePlayerMessage=function(a,{scheduleEndDate:s,scheduleStartDate:r}){l.set({startDateTime:r,endDateTime:s}),o&&clearInterval(o),o=setInterval(()=>{const s=Date.now(),r=l.get()?.scheduleEndTimeMs;if(console.log("scheduleEndTimeMs",r),r&&s>r){console.log("Game ended");const s=t.getPlayer(a);if(e.isPlayerInitialised(a)&&s){s.dispose(),console.log("Player disposed");const e=document.getElementsByClassName("vl-container")?.[0],t=document.createElement("video");t.id=a,t.className="video-js",t.style.width="100%",t.style.height="100%",e&&e.appendChild(t)}const r=n.getLocalisation("eventEnded")||"Game has ended";let l=document.getElementsByClassName("error-container")?.[0];if(l){const e=l.querySelector(".error-message");e&&(e.textContent=r)}else{const e=document.getElementById(a),t=e?.parentElement;if(t){l=document.createElement("div"),l.className="error-container";const e=document.createElement("div");e.className="error-message",e.textContent=r,l.appendChild(e),t.append(l)}}clearInterval(o)}},1e3)},exports.onReplay=(n,o)=>{const s=t.getPlayer(n);s?(s.on("ended",()=>a=!0),s.on("timeupdate",()=>{if(!s.paused()&&a){const t=e.getCurrentVideo()?.video?.id;e.videoReplayTracker.get(t)?(e.videoReplayTracker.clear(),e.trackMap.clear(),o(),e.videoReplayTracker.set(t)):(e.videoReplayTracker.clear(),e.videoReplayTracker.set(t)),a=!1}})):o(`Cannot find player with id: '${n}'`)},exports.onTimeUpdate=(e,n)=>{let a=t.getPlayer(e);a?a.on("timeupdate",()=>n(a.currentTime())):n(`Cannot find player with id: '${e}'`)},exports.onVideoEnded=(e,n)=>{let a=t.getPlayer(e);a?a.on("ended",()=>n(!0)):n(`Cannot find player with id: '${e}'`)},exports.playerEvents=function(){const e=(e,n)=>{const a=t.getPlayer(e);if(!a)throw`Cannot find player with id: '${e}'`;if("function"!=typeof n)throw"Callback function (cb) is missing or not a function";return a};return{onPlay:(t,n)=>{e(t,n).on("play",()=>n())},onPause:(t,n)=>{e(t,n).on("pause",()=>n())},onMute:(t,n)=>{const a=e(t,n);a.on("volumechange",()=>{a.muted()?n({muted:!0}):n({muted:!1})})},onPictureInPictureChange:(t,n)=>{const a=e(t,n);a.on("enterpictureinpicture",()=>{n({pip:!0})}),a.on("leavepictureinpicture",()=>{n({pip:!1})})},onFullScreenChange:(t,n)=>{const a=e(t,n);a.on("fullscreenchange",e=>{a.isFullscreen_?n({isFullscreen:!0}):n({isFullscreen:!1})})},onSetVolume:(t,n)=>{const a=e(t,n);a.on("volumechange",()=>{const e=100*a.volume().toFixed(2);a.muted()?n({vol:0}):n({vol:e})})},onSeeked:(t,n)=>{const a=e(t,n);a.on("seeked",()=>{n({seeked:a.currentTime()})})},onSubtitleEnable:(t,n)=>{const a=e(t,n);a.textTracks().on("change",function(e){console.log(a.textTracks());const t=a.textTracks().tracks_.filter(e=>("subtitles"===e.kind||"captions"===e.kind)&&"showing"===e.mode);t.length>0&&n({enabled:t[0]})})},onDisableSubtitles:(t,n)=>{const a=e(t,n);a.textTracks().on("change",function(e){console.log(a.textTracks());const t=a?.textTracks()?.tracks_?.every(e=>"showing"!=e.mode);t&&n({captions_disabled:!0})})},onSubtitleCueChange:(t,n)=>{const a=e(t,n);a.on("loadeddata",()=>{const e=a.textTracks();let t;"object"==typeof a.dash&&null!=a.dash&&a.dash.mediaPlayer.on(window?.dashjs?.MediaPlayer?.events?.CAPTION_RENDERED,e=>{n(e)});for(let n=0;n<e.length;n++){const a=e[n];"metadata"===a.kind&&(a.mode="hidden",t=a)}t&&t.addEventListener("cuechange",()=>{const e=t.activeCues;if(e&&e.length>0)for(let t=0;t<e.length;t++){const a=e[t];n(a)}else console.log("no active cue at this moment")})})},onError:(t,n)=>{const a=e(t,n);a.on("error",()=>{n({error:a?.error()?.code,msg:a?.error()?.message})})}}},exports.scheduleTimerInstanceManager=l,exports.seekToTimeStamp=(e,n,a)=>{let o=t.getPlayer(e);o?n>=0&&n<=o.duration()?(a({status:!0,msg:`Successfully seeked to timestamp : ${n}`}),o.currentTime(n)):a({status:!1,msg:"Out of bounds, please provide a valid timestamp"}):a(`Cannot find player with id: '${e}'`)},exports.setPlaybackSpeed=(e,n)=>{let a=t.getPlayer(e);if(!a)return`Cannot find player with id: '${e}'`;try{return a.playbackRate(n),`Playback speed set to ${n}x`}catch(e){return`Error: ${e}`}};
1
+ "use strict";var e=require("./generic-754b73b9.js"),t=require("./skin-5a0cbc97.js"),n=require("./localisation-443f3f19.js");let a=!1;let o=null;const s=(e,t)=>{(new Date).getMonth(),new Date(t).getMonth(),(new Date).getFullYear(),new Date(t).getFullYear();const n=Math.floor(e/6048e5);let a=((e,t)=>{var n;return n=12*(t.getFullYear()-e.getFullYear()),n-=e.getMonth(),(n+=t.getMonth())<=0?0:n})(new Date,new Date(t));const o=a>0&&n>4?a:0;let s=((e,t)=>{let n=new Date(t).getFullYear()-new Date(e).getFullYear(),a=new Date(t).getMonth()-new Date(e).getMonth();return new Date(t).getDay()-new Date(e).getDay()<0&&(a-=1),a<0&&(n-=1),n})(new Date,new Date(t));return[s>0&&o>0?s:0,o,n,Math.floor(e/864e5),Math.floor(e%864e5/36e5),Math.floor(e%36e5/6e4),Math.floor(e%6e4/1e3)]},r=([e,t,n,a,o,s,r,l])=>{let i;i=e>=1?` ${e} Year`:t>=1?` ${t} month`:n>=1?` ${n} week`:a>=1?` ${a} day`:o<24&&o>=12?` ${o} hour`:o>0?`${o} hours ${s} minutes ${r} seconds`:s>0?`${s} minutes ${r} seconds`:`${r} seconds`,l.textContent=`${i}`},l=(()=>{let e={scheduleStartTimeMs:0,scheduleEndTimeMs:0};return{get:()=>e,set(t){e={scheduleStartTimeMs:t?.startDateTime,scheduleEndTimeMs:t?.endDateTime}}}})();function i(e,t,a,o){if(!e)return;const r=()=>{let e=l.get()?.scheduleStartTimeMs,r=l.get()?.scheduleEndTimeMs,c=Date.now();if(c-r>0){let e=document.getElementsByClassName("error-message")[0];return e&&(e.textContent=n.getLocalisation("eventEnded")||"Game has ended",o.textContent=""),clearInterval(i),void a?.()}const d=e-c;if(d/1e3<=0)return clearInterval(i),t?.([0,0,0,0,0,0,0,o]),void a?.();const u=s(d,e);t?.([...u,o])};r();const i=setInterval(r,1e3);return i}exports.getVideoDuration=e=>{let n=t.getPlayer(e);return n?n.duration():`Cannot find player with id: '${e}'`},exports.handleCountdownTimer=(e,t,a)=>{const o=t?.response?.data?.errorCode,s=t?.response?.data?.errorMessage||t?.message||null;l.set({startDateTime:t?.response?.data?.scheduleStartDate,endDateTime:t?.response?.data?.scheduleEndDate}),function(e,t,a,o){let s=Date.now();const c=l.get()?.scheduleStartTimeMs,d=l.get()?.scheduleEndTimeMs;let u=function(e,t,a,o){let s;e<0?s=n.getLocalisation("eventNotStarted")||o||"Game starts in":(t>0||"VIDEO_NOT_EXISTS"==a)&&(s=n.getLocalisation("eventEnded")||o||"Game has ended");return s||o}(s-c,s-d,t,a);if(document.getElementsByClassName("error-container")[0]){let e=document.getElementsByClassName("error-message")[0];e&&(e.textContent=`${u}`);let t=document.getElementsByClassName("error-timer-message")[0];t&&i(Math.abs(c),r,o,t)}else{let t=document.getElementById(e).parentElement;if(t){let e=document.createElement("div");e.className="error-container";let n=document.createElement("div");n.className="error-message";let a=document.createElement("div");a.className="error-timer-message",n.textContent=`${u}`,e.appendChild(n),e.appendChild(a),t.append(e),i(Math.abs(c),r,o,a)}}}(e,o,s,a)},exports.handlePlayerMessage=function(a,{scheduleEndDate:s,scheduleStartDate:r}){l.set({startDateTime:r,endDateTime:s}),o&&clearInterval(o),o=setInterval(()=>{const s=Date.now(),r=l.get()?.scheduleEndTimeMs;if(console.log("scheduleEndTimeMs",r),r&&s>r){console.log("Game ended");const s=t.getPlayer(a);if(e.isPlayerInitialised(a)&&s){s.dispose(),console.log("Player disposed");const e=document.getElementsByClassName("vl-container")?.[0],t=document.createElement("video");t.id=a,t.className="video-js",t.style.width="100%",t.style.height="100%",e&&e.appendChild(t)}const r=n.getLocalisation("eventEnded")||"Game has ended";let l=document.getElementsByClassName("error-container")?.[0];if(l){const e=l.querySelector(".error-message");e&&(e.textContent=r)}else{const e=document.getElementById(a),t=e?.parentElement;if(t){l=document.createElement("div"),l.className="error-container";const e=document.createElement("div");e.className="error-message",e.textContent=r,l.appendChild(e),t.append(l)}}clearInterval(o)}},1e3)},exports.onReplay=(n,o)=>{const s=t.getPlayer(n);s?(s.on("ended",()=>a=!0),s.on("timeupdate",()=>{if(!s.paused()&&a){const t=e.getCurrentVideo()?.video?.id;e.videoReplayTracker.get(t)?(e.videoReplayTracker.clear(),e.trackMap.clear(),o(),e.videoReplayTracker.set(t)):(e.videoReplayTracker.clear(),e.videoReplayTracker.set(t)),a=!1}})):o(`Cannot find player with id: '${n}'`)},exports.onTimeUpdate=(e,n)=>{let a=t.getPlayer(e);a?a.on("timeupdate",()=>n(a.currentTime())):n(`Cannot find player with id: '${e}'`)},exports.onVideoEnded=(e,n)=>{let a=t.getPlayer(e);a?a.on("ended",()=>n(!0)):n(`Cannot find player with id: '${e}'`)},exports.playerEvents=function(){const e=(e,n)=>{const a=t.getPlayer(e);if(!a)throw`Cannot find player with id: '${e}'`;if("function"!=typeof n)throw"Callback function (cb) is missing or not a function";return a};return{onPlay:(t,n)=>{e(t,n).on("play",()=>n())},onPause:(t,n)=>{e(t,n).on("pause",()=>n())},onMute:(t,n)=>{const a=e(t,n);a.on("volumechange",()=>{a.muted()?n({muted:!0}):n({muted:!1})})},onPictureInPictureChange:(t,n)=>{const a=e(t,n);a.on("enterpictureinpicture",()=>{n({pip:!0})}),a.on("leavepictureinpicture",()=>{n({pip:!1})})},onFullScreenChange:(t,n)=>{const a=e(t,n);a.on("fullscreenchange",e=>{a.isFullscreen_?n({isFullscreen:!0}):n({isFullscreen:!1})})},onSetVolume:(t,n)=>{const a=e(t,n);a.on("volumechange",()=>{const e=100*a.volume().toFixed(2);a.muted()?n({vol:0}):n({vol:e})})},onSeeked:(t,n)=>{const a=e(t,n);a.on("seeked",()=>{n({seeked:a.currentTime()})})},onSubtitleEnable:(t,n)=>{const a=e(t,n);a.textTracks().on("change",function(e){console.log(a.textTracks());const t=a.textTracks().tracks_.filter(e=>("subtitles"===e.kind||"captions"===e.kind)&&"showing"===e.mode);t.length>0&&n({enabled:t[0]})})},onDisableSubtitles:(t,n)=>{const a=e(t,n);a.textTracks().on("change",function(e){console.log(a.textTracks());const t=a?.textTracks()?.tracks_?.every(e=>"showing"!=e.mode);t&&n({captions_disabled:!0})})},onSubtitleCueChange:(t,n)=>{const a=e(t,n);a.on("loadeddata",()=>{const e=a.textTracks();let t;"object"==typeof a.dash&&null!=a.dash&&a.dash.mediaPlayer.on(window?.dashjs?.MediaPlayer?.events?.CAPTION_RENDERED,e=>{n(e)});for(let n=0;n<e.length;n++){const a=e[n];"metadata"===a.kind&&(a.mode="hidden",t=a)}t&&t.addEventListener("cuechange",()=>{const e=t.activeCues;if(e&&e.length>0)for(let t=0;t<e.length;t++){const a=e[t];n(a)}else console.log("no active cue at this moment")})})},onError:(t,n)=>{const a=e(t,n);a.on("error",()=>{n({error:a?.error()?.code,msg:a?.error()?.message})})}}},exports.scheduleTimerInstanceManager=l,exports.seekToTimeStamp=(e,n,a)=>{let o=t.getPlayer(e);o?n>=0&&n<=o.duration()?(a({status:!0,msg:`Successfully seeked to timestamp : ${n}`}),o.currentTime(n)):a({status:!1,msg:"Out of bounds, please provide a valid timestamp"}):a(`Cannot find player with id: '${e}'`)},exports.setPlaybackSpeed=(e,n)=>{let a=t.getPlayer(e);if(!a)return`Cannot find player with id: '${e}'`;try{return a.playbackRate(n),`Playback speed set to ${n}x`}catch(e){return`Error: ${e}`}};
@@ -1 +1 @@
1
- "use strict";require("./index-c1289347.js");var t=require("./skin-5a0cbc97.js"),e=require("./generic-b119e225.js");let r="my-player";function n(e,n,i){const a=document.querySelector(".vjs-progress-holder.vjs-slider.vjs-slider-horizontal"),o=t.getPlayer(r);if(!a||!o)return;const s=a.getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=function(t,e){if(!e||0===e.length)return null;let r=0,n=e.length-1;for(;r<=n;){const i=Math.floor((r+n)/2),a=e[i];if(a===t)return a;a<t?r=i+1:n=i-1}const i=e[r]??1/0,a=e[n]??-1/0;return Math.abs(i-t)<Math.abs(a-t)?i:a}(Math.round(l*o.duration()),i),c=n[u];c&&!c.loading&&(c.loading=!0,async function(t){if(t._tiles)return t._tiles;try{const e=await fetch(t.uri,{mode:"cors"}),r=await e.blob(),n=await createImageBitmap(r),[i,a]=t.layout.split("x").map(Number),o=n.width/a,s=n.height/i,l=[];for(let e=0;e<i;e++)for(let r=0;r<a;r++){const i=document.createElement("canvas");i.width=o,i.height=s,i.getContext("2d").drawImage(n,r*o,e*s,o,s,0,0,o,s);const a=i.toDataURL("image/png");l.push({uri:a,duration:t.duration}),t._tiles=l}return l}catch(e){const[r,n]=t.layout.split("x").map(Number);let i=[];for(let e=0;e<r*n;e++)i.push({uri:window?.app_data?.appcmsMain?.images?.placeholderCover,duration:t.duration});return i}}(c).then(t=>{const e=t[c.tileIndex],r=document.querySelector(".vjs-thumbnail-holder img");r&&e.uri&&(r.src=e.uri),c.loading=!1,c.src=e.uri}))}async function i(e){let r={};e.forEach((t,e)=>{const[n,i]=t.layout.split("x").map(Number),a=n*i,o=t.duration;for(let n=0;n<a;n++){const i=Math.round((e*a+n)*o);r[i]={...t,duration:t.duration,tileIndex:n,loading:!1,style:{left:"-60px",height:"85px",width:"130px",left:"-60px",border:"1px solid transparent",borderRadius:"4px"}}}});const i=Object.keys(r).map(Number).sort((t,e)=>t-e),a=document.querySelector(".vjs-progress-holder.vjs-slider.vjs-slider-horizontal");a?.addEventListener("mousemove",t.throttle(t=>n(t,r,i),500));const o=document.querySelector(".vjs-progress-control.vjs-control");return o?.addEventListener("pointerdown",function(e){document.addEventListener("pointermove",t.throttle(t=>n(t,r,i),500))}),r}function a(t){return t.replace(/AdSegmentFilter\/markers=\(.+?\)\//,"")}function o(t){const e=t.match(/Thumbnail_\$Number%0\d+d\$\.\w+/);return e?e[0]:null}function s(t,e){const r=t.match(/%0(\d+)d/);if(!r)return t;const n=parseInt(r[1],10),i=String(e).padStart(n,"0");return t.replace(/\$Number%0\d+d\$/,i)}exports.initiateTrickplay=async function(n){const l=t.getPlayer(n);let{src:u}=l.currentSource();if(u=u?.includes("blob")?l?.getSource?.():u,u?.includes("m3u8")){let t=await async function(t,e){r=e;try{const e=await fetch(t);return function(t){const e=t.split("\n"),r=[];return e.forEach(t=>{if((t=t.trim()).startsWith("#EXT-X-IMAGE-STREAM-INF")){const e=t.split(","),n={resolution:null,uri:null};e.forEach(t=>{t.includes("RESOLUTION")&&(n.resolution=t.split("=")[1]),t.includes("URI")&&(n.uri=t.split("=")[1].replace(/"/g,""))}),r.push(n)}}),r}(await e.text())}catch(t){console.error("Error fetching the M3U8 manifest:",t)}}(u,n);if(t?.length>0){const{uri:e}=t?.[0]||null,r=u.substring(0,u.lastIndexOf("/"))+"/";let n=await(async(t,e)=>{const r=await fetch(t+e),n=(await r.text()).split("\n").map(t=>t.trim()),i=[];let a=null;for(let e=0;e<n?.length;e++){const r=n[e];if(r.startsWith("#EXT-X-TILES"))a={resolution:null,duration:null,uri:null,layout:null},(r.split(":")[1]||"").split(",").forEach(t=>{const[e,r]=t.split("=");e&&r&&(a[e.trim().toLowerCase()]=r.trim())});else{if(r.startsWith("#EXTINF"))continue;(r.includes("jpg")||r.includes("png")||r.includes("jpeg"))&&(a.uri=r.includes("http")?r:t+r,i.push(a),a=null)}}return i})(r,e),a=await i(n);l.thumbnails(a)}}else if(u?.includes("mpd")){let c=await async function(n,i){r=i;const l=t.getPlayer(i),u=n.split("/"),c=u.findIndex(t=>"dash"===t.toLowerCase()),d=a(-1!==c?u.slice(0,c+1).join("/"):new URL(n).origin);try{const t=await fetch(n),r=await t.text(),i=(new DOMParser).parseFromString(r,"application/xml"),a=l?.duration()||e.getCurrentVideo()?.video?.runtime,u=i?.querySelector("MPD > BaseURL")?.textContent||d+"/",c=i.getElementsByTagName("AdaptationSet");for(let t=0;t<c.length;t++){const e=c[t];if("image"===e.getAttribute("contentType")&&"image/png"===e.getAttribute("mimeType")||"image/jpeg"===e.getAttribute("mimeType")){const r=e.getElementsByTagName("SegmentTemplate")[0],n=r.getElementsByTagName("SegmentTimeline")?.[0];if(r&&n){const i=n.getElementsByTagName("S"),o=parseInt(i[0]?.getAttribute("t")),s=parseInt(i[0]?.getAttribute("d")),l=e.getElementsByTagName("Representation")[0],u=l.getElementsByTagName("EssentialProperty")[0].getAttribute("value"),[c,g]=u?.split("x");if(r){r.getAttribute("media");const e=r.getAttribute("timescale"),n=(e?s/e:s)/(c*g),i=l.getAttribute("id"),m=Math.round(a/n),p=Math.ceil(m/(c*g)),h=r.getAttribute("media");if(parseInt(r.getAttribute("startNumber")),isNaN(parseInt(p)))return;let f=[];for(t=0;t<p;t++){const e=h,r="/"==e[0]?new URL(d).origin:d+"/";f.push({duration:n,layout:u,uri:r+e.replace("$Time$",o+t*s).replace("$RepresentationID$",i)})}return f}}else{const n=e.getElementsByTagName("Representation")[0],i=n.getElementsByTagName("EssentialProperty")[0].getAttribute("value"),[l,c]=i?.split("x");if(r){r.getAttribute("media");const e=r.getAttribute("duration"),d=r.getAttribute("timescale"),g=(d?e/d:e)/(l*c),m=n.getAttribute("id"),p=Math.round(a/g),h=Math.ceil(p/(l*c)),f=r.getAttribute("media"),y=parseInt(r.getAttribute("startNumber"))||0;if(isNaN(parseInt(h)))return;let b=[];const w=o(f);for(t=0;t<h;t++){const e=w?s(w,t+y):f;b.push({duration:g,layout:i,uri:u+e.replace("$Number$",t+y).replace("$RepresentationID$",m)})}return b}}}}return console.log("No trickplay segment found."),null}catch(t){console.error("Error fetching or parsing MPD:",t)}}(u,n);if(c?.length>0){let t=await i(c);l.thumbnails(t)}}};
1
+ "use strict";require("./index-58a5e66f.js");var t=require("./skin-5a0cbc97.js"),e=require("./generic-754b73b9.js");let r="my-player";function n(e,n,i){const a=document.querySelector(".vjs-progress-holder.vjs-slider.vjs-slider-horizontal"),o=t.getPlayer(r);if(!a||!o)return;const s=a.getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=function(t,e){if(!e||0===e.length)return null;let r=0,n=e.length-1;for(;r<=n;){const i=Math.floor((r+n)/2),a=e[i];if(a===t)return a;a<t?r=i+1:n=i-1}const i=e[r]??1/0,a=e[n]??-1/0;return Math.abs(i-t)<Math.abs(a-t)?i:a}(Math.round(l*o.duration()),i),c=n[u];c&&!c.loading&&(c.loading=!0,async function(t){if(t._tiles)return t._tiles;try{const e=await fetch(t.uri,{mode:"cors"}),r=await e.blob(),n=await createImageBitmap(r),[i,a]=t.layout.split("x").map(Number),o=n.width/a,s=n.height/i,l=[];for(let e=0;e<i;e++)for(let r=0;r<a;r++){const i=document.createElement("canvas");i.width=o,i.height=s,i.getContext("2d").drawImage(n,r*o,e*s,o,s,0,0,o,s);const a=i.toDataURL("image/png");l.push({uri:a,duration:t.duration}),t._tiles=l}return l}catch(e){const[r,n]=t.layout.split("x").map(Number);let i=[];for(let e=0;e<r*n;e++)i.push({uri:window?.app_data?.appcmsMain?.images?.placeholderCover,duration:t.duration});return i}}(c).then(t=>{const e=t[c.tileIndex],r=document.querySelector(".vjs-thumbnail-holder img");r&&e.uri&&(r.src=e.uri),c.loading=!1,c.src=e.uri}))}async function i(e){let r={};e.forEach((t,e)=>{const[n,i]=t.layout.split("x").map(Number),a=n*i,o=t.duration;for(let n=0;n<a;n++){const i=Math.round((e*a+n)*o);r[i]={...t,duration:t.duration,tileIndex:n,loading:!1,style:{left:"-60px",height:"85px",width:"130px",left:"-60px",border:"1px solid transparent",borderRadius:"4px"}}}});const i=Object.keys(r).map(Number).sort((t,e)=>t-e),a=document.querySelector(".vjs-progress-holder.vjs-slider.vjs-slider-horizontal");a?.addEventListener("mousemove",t.throttle(t=>n(t,r,i),500));const o=document.querySelector(".vjs-progress-control.vjs-control");return o?.addEventListener("pointerdown",function(e){document.addEventListener("pointermove",t.throttle(t=>n(t,r,i),500))}),r}function a(t){return t.replace(/AdSegmentFilter\/markers=\(.+?\)\//,"")}function o(t){const e=t.match(/Thumbnail_\$Number%0\d+d\$\.\w+/);return e?e[0]:null}function s(t,e){const r=t.match(/%0(\d+)d/);if(!r)return t;const n=parseInt(r[1],10),i=String(e).padStart(n,"0");return t.replace(/\$Number%0\d+d\$/,i)}exports.initiateTrickplay=async function(n){const l=t.getPlayer(n);let{src:u}=l.currentSource();if(u=u?.includes("blob")?l?.getSource?.():u,u?.includes("m3u8")){let t=await async function(t,e){r=e;try{const e=await fetch(t);return function(t){const e=t.split("\n"),r=[];return e.forEach(t=>{if((t=t.trim()).startsWith("#EXT-X-IMAGE-STREAM-INF")){const e=t.split(","),n={resolution:null,uri:null};e.forEach(t=>{t.includes("RESOLUTION")&&(n.resolution=t.split("=")[1]),t.includes("URI")&&(n.uri=t.split("=")[1].replace(/"/g,""))}),r.push(n)}}),r}(await e.text())}catch(t){console.error("Error fetching the M3U8 manifest:",t)}}(u,n);if(t?.length>0){const{uri:e}=t?.[0]||null,r=u.substring(0,u.lastIndexOf("/"))+"/";let n=await(async(t,e)=>{const r=await fetch(t+e),n=(await r.text()).split("\n").map(t=>t.trim()),i=[];let a=null;for(let e=0;e<n?.length;e++){const r=n[e];if(r.startsWith("#EXT-X-TILES"))a={resolution:null,duration:null,uri:null,layout:null},(r.split(":")[1]||"").split(",").forEach(t=>{const[e,r]=t.split("=");e&&r&&(a[e.trim().toLowerCase()]=r.trim())});else{if(r.startsWith("#EXTINF"))continue;(r.includes("jpg")||r.includes("png")||r.includes("jpeg"))&&(a.uri=r.includes("http")?r:t+r,i.push(a),a=null)}}return i})(r,e),a=await i(n);l.thumbnails(a)}}else if(u?.includes("mpd")){let c=await async function(n,i){r=i;const l=t.getPlayer(i),u=n.split("/"),c=u.findIndex(t=>"dash"===t.toLowerCase()),d=a(-1!==c?u.slice(0,c+1).join("/"):new URL(n).origin);try{const t=await fetch(n),r=await t.text(),i=(new DOMParser).parseFromString(r,"application/xml"),a=l?.duration()||e.getCurrentVideo()?.video?.runtime,u=i?.querySelector("MPD > BaseURL")?.textContent||d+"/",c=i.getElementsByTagName("AdaptationSet");for(let t=0;t<c.length;t++){const e=c[t];if("image"===e.getAttribute("contentType")&&"image/png"===e.getAttribute("mimeType")||"image/jpeg"===e.getAttribute("mimeType")){const r=e.getElementsByTagName("SegmentTemplate")[0],n=r.getElementsByTagName("SegmentTimeline")?.[0];if(r&&n){const i=n.getElementsByTagName("S"),o=parseInt(i[0]?.getAttribute("t")),s=parseInt(i[0]?.getAttribute("d")),l=e.getElementsByTagName("Representation")[0],u=l.getElementsByTagName("EssentialProperty")[0].getAttribute("value"),[c,g]=u?.split("x");if(r){r.getAttribute("media");const e=r.getAttribute("timescale"),n=(e?s/e:s)/(c*g),i=l.getAttribute("id"),m=Math.round(a/n),p=Math.ceil(m/(c*g)),h=r.getAttribute("media");if(parseInt(r.getAttribute("startNumber")),isNaN(parseInt(p)))return;let f=[];for(t=0;t<p;t++){const e=h,r="/"==e[0]?new URL(d).origin:d+"/";f.push({duration:n,layout:u,uri:r+e.replace("$Time$",o+t*s).replace("$RepresentationID$",i)})}return f}}else{const n=e.getElementsByTagName("Representation")[0],i=n.getElementsByTagName("EssentialProperty")[0].getAttribute("value"),[l,c]=i?.split("x");if(r){r.getAttribute("media");const e=r.getAttribute("duration"),d=r.getAttribute("timescale"),g=(d?e/d:e)/(l*c),m=n.getAttribute("id"),p=Math.round(a/g),h=Math.ceil(p/(l*c)),f=r.getAttribute("media"),y=parseInt(r.getAttribute("startNumber"))||0;if(isNaN(parseInt(h)))return;let b=[];const w=o(f);for(t=0;t<h;t++){const e=w?s(w,t+y):f;b.push({duration:g,layout:i,uri:u+e.replace("$Number$",t+y).replace("$RepresentationID$",m)})}return b}}}}return console.log("No trickplay segment found."),null}catch(t){console.error("Error fetching or parsing MPD:",t)}}(u,n);if(c?.length>0){let t=await i(c);l.thumbnails(t)}}};