@flowplayer/player 3.24.0-rc.4 → 3.25.0-rc

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 (49) hide show
  1. package/core.js +1 -1
  2. package/default.js +1 -1
  3. package/embed.js +2 -2
  4. package/index.d.ts +0 -2
  5. package/package.json +1 -1
  6. package/plugins/ads.d.ts +0 -2
  7. package/plugins/ads.js +1 -1
  8. package/plugins/airplay.d.ts +0 -2
  9. package/plugins/analytics.d.ts +0 -2
  10. package/plugins/analytics.js +1 -1
  11. package/plugins/asel.d.ts +0 -2
  12. package/plugins/audio.d.ts +0 -2
  13. package/plugins/chapters.d.ts +0 -2
  14. package/plugins/chromecast.d.ts +0 -2
  15. package/plugins/comscore.d.ts +0 -2
  16. package/plugins/consent.d.ts +0 -2
  17. package/plugins/context-menu.d.ts +0 -2
  18. package/plugins/cuepoints.d.ts +0 -2
  19. package/plugins/dash.d.ts +0 -2
  20. package/plugins/drm.d.ts +0 -2
  21. package/plugins/endscreen.d.ts +0 -2
  22. package/plugins/fas.d.ts +0 -2
  23. package/plugins/float-on-scroll.d.ts +0 -2
  24. package/plugins/ga4.d.ts +0 -2
  25. package/plugins/gemius.d.ts +1 -3
  26. package/plugins/google-analytics.d.ts +0 -2
  27. package/plugins/hls.d.ts +0 -2
  28. package/plugins/id3.d.ts +0 -2
  29. package/plugins/iframe.d.ts +1 -3
  30. package/plugins/keyboard.d.ts +0 -2
  31. package/plugins/media-session.d.ts +0 -2
  32. package/plugins/message.d.ts +0 -2
  33. package/plugins/ovp.d.ts +0 -2
  34. package/plugins/playlist.d.ts +18 -19
  35. package/plugins/playlist.js +1 -1
  36. package/plugins/preview.d.ts +0 -2
  37. package/plugins/qsel.d.ts +0 -2
  38. package/plugins/qul.d.ts +0 -2
  39. package/plugins/rts.d.ts +0 -2
  40. package/plugins/share.d.ts +0 -2
  41. package/plugins/speed.d.ts +0 -2
  42. package/plugins/ssai.d.ts +0 -2
  43. package/plugins/ssai.js +1 -1
  44. package/plugins/subtitles.d.ts +0 -2
  45. package/plugins/thumbnails.d.ts +0 -2
  46. package/plugins/tizen.d.ts +0 -2
  47. package/plugins/vtsel.d.ts +0 -2
  48. package/plugins/webos.d.ts +0 -2
  49. package/util/loader.d.ts +0 -2
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=t.flowplayer||{},t.flowplayer.playlist=e())}(this,(function(){"use strict";var t=Object.freeze({__proto__:null,PLAYLIST_NEXT:"playlist:next",PLAYLIST_PREVIOUS:"playlist:previous",PLAYLIST_SELECTION:"playlist:selection",PLAYLIST_LOOP:"playlist:loop",PLAYLIST_ENDED:"playlist:ended",PLAYLIST_READY:"playlist:ready",PLAYLIST_ADD:"playlist:add",PLAYLIST_REMOVE:"playlist:remove",INTERSTITIAL_END:"interstitial/end",INTERSTITIAL_CANCEL:"interstitial/cancel",INTERSTITIAL_NEXT_ITEM:"interstitial/next_item"});const e={translation_key:"core.skip-next",name:"fp-skip-next"},n={translation_key:"core.skip-prev",name:"fp-skip-prev"};class Pipe{static of(t){return new Pipe(t)}static maybe(t,e,...n){return null==t?t:e.apply(t,[t,...n])}constructor(t){this.data=t}tap(t,...e){return t.apply(this,[this.data,...e]),new Pipe(this.data)}fmap(t,...e){const n=t.apply(this,[this.data,...e]);return new Pipe(n)}unwrap(){return this.data}}function i(t,e){if(!e)throw new Error(t)}function s(t){return"invalid playlist configuration\ndetails: "+t+"\n\tmust match Object of shape:\n"+["\t\t{ controls?: Selector|HTMLElement","player: Selector|HTMLElement","playlist: PlaylistId|Array(MediaId|PlayerConfig)","shuffle?: Boolean|false","loop?: Boolean|false","advance?: Boolean|true","delay?: Milliseconds|5000"].join("\n\t\t, ")+"\n\t\t}"}function l(t,e){Pipe.of(t).fmap(s).fmap(i,e)}function o(t){return void 0!==t}function a(t){return"string"==typeof t}function r(t){return"object"==typeof t}function c(t){return t instanceof HTMLElement}function p(t){var e;l("Config must be an Object",o(t)&&r(t)),l("property `playlist` is required",o(t.playlist)),l("property `playlist` was not a String(MediaId)",a(t.playlist)||(e=t.playlist,l("playlist property was not of type PlaylistId|Array(MediaId|PlayConfig)",Array.isArray(e)),l("playlist property cannot be an empty Array",e.length>0),!e.forEach((function(t,e){l("item at playlist["+e+"] was not valid",a(t)||r(t))})))),"loop shuffle".split(" ").forEach((function(e){o(t[e])&&l(e+" must be a boolean value if present","boolean"==typeof t[e])})),o(t.delay)&&l("property `delay` must be a Number (Milliseconds)","number"==typeof t.delay)}function u(t){try{p(t)}catch(t){return!1}return!0}class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}class FlowplayerIcon extends FlowplayerComponent{constructor(t,e){super(t),this.classList.add("fp-icon",e.name),e.title&&this.setAttribute("title",e.title),e.title&&this.setAttribute("aria-label",e.title),e.translation_key&&this.setAttribute("aria-label",t.i18n(e.translation_key)),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}const d=["title","delay","description","poster","src"];class UpNext extends FlowplayerComponent{static get observedAttributes(){return d}constructor(t){super(t),this.classList.add("up-next"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent("interstitial/end"))}),this.addEventListener("animationcancel",()=>{this.classList.add("cancelled"),this.dispatchEvent(new CustomEvent("interstitial/cancel"))}),this.addEventListener("interstitial/next_item",this._setUpNext.bind(this))}getTitle(){return this.getAttribute("title")||""}getDescription(){return this.getAttribute("description")||""}getPoster(){return this.getAttribute("poster")||""}getDelay(){return this.getAttribute("delay")||""}connectedCallback(){this.isConnected&&this._render()}attributeChangedCallback(){this._render()}_render(){var t,e;this.innerHTML="",this.classList.remove("cancelled");const n=document.createDocumentFragment(),i=document.createElement("div");i.classList.add("pane","left");const s=document.createElement("div");s.classList.add("pane","right"),n.append(i,s);const l=document.createElement("div");l.classList.add("poster"),l.style.backgroundImage="url("+this.getPoster()+")",i.append(l),l.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("interstitial/end")));const o=document.createElement("span");o.classList.add("fp-icon","fp-play"),l.append(o);const a=document.createElement("span");a.classList.add("title"),a.textContent=this.getTitle();const r=document.createElement("span");r.classList.add("description"),r.textContent=this.getDescription();const c=document.createElement("span");c.classList.add("countdown"),this.getDelay()&&(c.style.setProperty("--up-next-delay",this.getDelay()+"s"),c.classList.add("go"));const p=document.createElement("span");p.classList.add("cancel"),p.textContent=null!==(e=null===(t=this.player)||void 0===t?void 0:t.i18n("playlist.cancel"))&&void 0!==e?e:"cancel",p.addEventListener("click",()=>c.classList.remove("go")),s.append(a,r,p,c),this.append(n)}_setUpNext(t){var e,n,i;const s=t.detail.next,l=this.player.opt("playlist.delay",void 0)||10;this.setAttribute("title",null!==(e=s.title)&&void 0!==e?e:""),this.setAttribute("description",null!==(n=s.description)&&void 0!==n?n:""),this.setAttribute("poster",null!==(i=s.poster)&&void 0!==i?i:""),this.setAttribute("delay",l+"")}}const y=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const i=window.customElements.get(e);if(!i)throw new Error(`no default flowplayer component with the name ${e} exists`);const s=window.customElements.get(n);return"function"!=typeof s?i:s})(t._customElements,e))(t),m=(t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)};function f(t,e,n){const i=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;i.length;){if(null==t)return n;const e=i.shift();if("string"!=typeof e)return n;t=t[e]}return null==t?n:t}function v(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}class FlowplayerPlaylistControls extends FlowplayerComponent{constructor(t){super(t),this.playlistWrapper=document.createElement("ol"),this.className="fp-playlist-controls is-empty use-play-1",this.header=this.controlsHeader(t),this.append(this.header,this.playlistWrapper),t.on("playlist:ready",e=>{const n=e.detail.queue;n&&(this.list(n,t),this.classList.toggle("is-empty",!n.members.length))}),t.on("playlist:next",()=>{var e;(null===(e=t.playlist)||void 0===e?void 0:e.queue)&&Array.from(this.querySelectorAll("li")).forEach((e,n)=>{var i;const s=n===(null===(i=t.playlist)||void 0===i?void 0:i.queue.idx);e.classList.toggle("is-current",s),e.setAttribute("aria-current",""+s)})}),t.on("playlist:add",e=>{var n;const i=null===(n=t.playlist)||void 0===n?void 0:n.queue;if(!e.data||!i)return;e.data.members.forEach(e=>{const n=this.videoRow(e,t);n&&this.playlistWrapper.append(n)})}),t.on("playlist:remove",t=>{if(!t.data)return;const e=Array.from(this.querySelectorAll("li"))[t.data.index];e&&this.playlistWrapper.removeChild(e)})}list(t,e){this.playlistWrapper.innerHTML="",t.members.forEach(t=>{const n=this.videoRow(t,e);n&&this.playlistWrapper.append(n)})}videoRow(t,e){const n=document.createElement("li");return n.onclick=this.videoRow_onclick.bind(this,n,e),n.setAttribute("tabindex","0"),n.append(this.item(e,t)),n}item(t,e){const n=document.createElement("div");n.className="fp-playlist-controls-item";const i=this.itemHeader(t,e),s=this.itemContent(e);return n.append(i,s),n}itemContent(t){var e,n;const i=document.createElement("div");i.className="fp-playlist-controls-item-content";const s=document.createElement("div");s.className="fp-playlist-controls-item-title",s.textContent=t.title||(null===(e=t.metadata)||void 0===e?void 0:e.title)||"";const l=document.createElement("div");return l.className="fp-playlist-controls-item-desc",l.textContent=t.description||(null===(n=t.metadata)||void 0===n?void 0:n.description)||"",i.append(s,l),i}itemHeader(t,e){var n,i;const s=document.createElement("div");s.className="fp-playlist-controls-item-header";const l=document.createElement("img");l.alt=e.title||(null===(n=e.metadata)||void 0===n?void 0:n.title)||"",l.className="fp-playlist-controls-image",l.src=e.poster||"";const o=document.createElement("div");o.className="fp-playlist-controls-playing";const a=new(window.customElements.get("flowplayer-play-icon"))(t);a.ariaHidden="true",a.tabIndex=-1;const r=document.createElement("span");r.textContent=t.i18n("playlist.now_playing","Now playing"),o.append(a,r),s.append(l,o);const c=e.duration||(null===(i=e.metadata)||void 0===i?void 0:i.duration);if(void 0!==c){const t=document.createElement("span");t.className="fp-playlist-controls-duration",t.textContent=isFinite(c)?function(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const n=Math.floor(t/3600);let i=Math.floor(t/60);return t-=60*i,n>=1?(i-=60*n,e+n+":"+v(i)+":"+v(t)):e+v(i)+":"+v(t)}(c):"",s.append(t)}return s}controlsHeader(t){const e=document.createElement("div");e.className="fp-playlist-controls-header";const n=document.createElement("h3");n.id="title",n.className="fp-playlist-title",n.textContent="Playlist";const i=document.createElement("input");i.type="checkbox",i.className="fp-playlist-toggle-input",i.id="toggle";const s=document.createElement("label");s.className="fp-playlist-toggle-label",s.tabIndex=0,s.setAttribute("role","button"),s.setAttribute("for","toggle");const l=document.createElement("span");l.className="fp-playlist-toggle-title",l.textContent=t.i18n("playlist.autoplay","Autoplay");const o=document.createElement("div");return o.className="fp-playlist-toggle",o.append(l,i,s),s.addEventListener("click",e=>{e.preventDefault();const n=!i.checked;i.checked=n;const l=t.opts;l.playlist||(l.playlist={}),Object.assign(l.playlist,{advance:n}),s.ariaPressed=n+"",s.ariaLabel=n?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay")}),t.on("playlist:ready",()=>{var e,l,o;const a=t.opts,r=null===(e=null==a?void 0:a.playlist)||void 0===e?void 0:e.advance;i.checked=!1!==r,s.ariaPressed=""+(!1!==r),s.ariaLabel=!1!==r?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay"),n.textContent=null!==(o=null===(l=null==a?void 0:a.metadata)||void 0===l?void 0:l.playlist_title)&&void 0!==o?o:"Playlist"}),e.append(n,o),e}videoRow_onclick(t,e){var n;if(t.classList.contains("is-current"))return;const i=Array.from(this.querySelectorAll("li")).indexOf(t);-1!==i&&(null===(n=e.playlist)||void 0===n||n.play(i))}}var h;function x(t,e){var n,i;const s=e.sort||g,l=null!==(n=e.mode)&&void 0!==n?n:h.FIFO;return t=s(t.slice(0),l),{mode:l,sort:s,members:t,last_idx:t.length-1,plays:null!==(i=e.plays)&&void 0!==i?i:0,idx:-1}}function b(t){return t.idx==t.last_idx}function E(t){const e=t.idx+1;return e>t.last_idx?0:e}function w(t,e,n){return t.idx=e&&"number"==typeof n&&n>=0&&n<=t.last_idx?n:t.idx+1,t.members[t.idx]}function g(t,e){return(e&h.SHUFFLE)==h.SHUFFLE?t.sort((function(){return Math.random()-Math.random()})):t.slice(0)}function L(t){return x(t.members,{mode:t.mode,plays:t.plays+1,sort:t.sort})}!function(t){t[t.SHUFFLE=1]="SHUFFLE",t[t.FIFO=2]="FIFO",t[t.LOOP=4]="LOOP"}(h||(h={})),function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}}();const _=["touchstart","touchmove"];function A(t,e,n){const i=function(t,e){const n=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(n,"data",{get:()=>e}),n}(e,n);return t.dispatchEvent(i),t}function P(t,e,n,i){Array.isArray(e)?e.forEach(e=>I(t,e,n,i)):I(t,e,n,i)}function I(t,e,n,i){if(s=e,!~_.indexOf(s))return t.addEventListener(e,n,i),t;var s;const l=Object.assign(i||{},{passive:!0});return t.addEventListener(e,n,l),t}function q(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}function O(t,e,n){return t.setAttribute(e,n),t}function N(t,e,n){return e.split(" ").forEach(e=>t.classList.toggle(e,n)),t}function T(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}function k(t,e,n){const i=e.idx+e.plays<0;if(!i&&n.delay)return function(t,e){var n;const i=null===(n=t.playlist)||void 0===n?void 0:n.queue,s=q(t,"flowplayer-playlist-interstitial");if(!s||!i||!e.delay)return;t.root.classList.add("is-interstitial");const l=i.members[E(i)];A(s,"interstitial/next_item",{next:l})}(t,n);C(t,w(e,i,n.start_index),i)}function C(t,e,n){n||(t.preload=e.preload="auto",!t.opts.autoplay&&t.setOpts({autoplay:1})),t.emit("playlist/advance"),"object"==typeof e&&t.setOpts(e),function(t,e){var n;const i=null===(n=t.playlist)||void 0===n?void 0:n.queue;if(!i)return;const s=i.idx,l=i.members[s],o=t.currentSrc;if(l.src&&t.setSrc(l.src),t.emit("playlist:next",{next_index:s}),t.opts.autoplay||e)return;const a=e=>{("canplay"===e.type&&o!==t.currentSrc||"playlist:next"===e.type)&&(t.removeEventListener("canplay",a),t.removeEventListener("playlist:next",a),"canplay"===e.type&&t.togglePlay(!0))};t.on(["canplay","playlist:next"],a)}(t,n)}function S(e,n){return{queue:n,events:t,play:function(t){t<0||t>=n.members.length||(this.queue.idx=t,C(e,n.members[t]))},next:function(){this.queue.idx!==this.queue.last_idx&&this.play(this.queue.idx+1)},prev:function(){this.queue.idx&&this.play(this.queue.idx-1)},remove:function(t){const n=this.queue;return n.members[t]?n.idx===t?console.warn("operation failed: you cannot remove current playlist item"):(n.members.splice(t,1),n.last_idx=n.members.length-1,t<n.idx&&--n.idx,void e.emit("playlist:remove",{index:t})):console.warn("there is no playlist item at this index")},push:function(...t){const n=e.root;if(0==this.queue.idx&&n.classList.contains("is-interstitial"))return console.warn("new items cannot be added when playlist has ended.");const i=this.queue.members;i.push(...t),this.queue.last_idx=i.length-1,e.emit("playlist:add",{members:t})},clear:function(){this.queue.members=[],this.queue.plays--,function(t,e){t.playlist&&(e=t.playlist.queue=L(e),t.emit("playlist:ready",{queue:e,should_play:!1}))}(e,this.queue)}}}function F(t){const e=y(t,"flowplayer-skip-previous-icon");O(e,"role","button"),P(e,"click",(function(){t.playlist&&t.playlist.prev()}));const n=y(t,"flowplayer-skip-next-icon");O(n,"role","button"),P(n,"click",(function(){t.playlist&&t.playlist.next()}));const i=T("fp-playlist-prev-preview"),s=T("fp-playlist-next-preview"),l=q(t,"flowplayer-control-buttons");return l&&(l.prepend(e),l.append(n),l.append(i),l.append(s)),t.on("reap",(function(){t.skip_controls=void 0})),t.on(["playlist:next","playlist:add","playlist:remove"],(function(e){const n=f(e,"data.queue",f(t,"playlist.queue"));if(!n||!l||!t.skip_controls)return;N(l,"is-prev-button-disabled",!n.idx),N(l,"is-next-button-disabled",n.idx===n.last_idx);const o=n.idx<n.last_idx?function(t){if(!b(t)||0!=(t.mode&h.LOOP))return t.members[E(t)]}(n):null,a=n.idx>0?function(t){if(0!==t.idx||0!=(t.mode&h.LOOP))return t.members[function(t){const e=t.idx-1;return e<0?t.last_idx:e}(t)]}(n):null;s.style.backgroundImage=["url(",o?o.poster:null,")"].join(""),i.style.backgroundImage=["url(",a?a.poster:null,")"].join("")})),{prevButton:e,nextButton:n,prevPreview:i,nextPreview:s}}function M(t,e){if(!e)return;!1!==e.skip_controls&&(t.skip_controls=F(t));const n=function(t){let e=null;if(n=t.controls,!a(n)&&!c(n))return;var n;c(t.controls)?e=t.controls:a(t.controls)&&(e=document.querySelector(t.controls));return i("Could not find controls by Selector["+t.controls+"]",c(e)),e}(e);if(!n)return;const s=y(t,"flowplayer-playlist-controls");n.append(s)}function j(t,e,n){if(Array.isArray(e))return n(function(t,e){let n=e.shuffle?h.SHUFFLE:h.FIFO;return e.loop&&(n|=h.LOOP),x(t,{mode:n,sort:e.sort})}(e,t));throw new Error("config.playlist must be an Array")}function H(t){var e;t.on("playlist:ready",(function(e){var n,i;const s=t.opt("playlist",{}),l=null===(n=e.detail)||void 0===n?void 0:n.queue,o=null===(i=e.detail)||void 0===i?void 0:i.should_play;l&&s&&(t.playlist=S(t,l),o&&k(t,l,s))})),t.on("ended",(e=e=>{if(e.prevented_from_ads)return;const n=t.opt("playlist");return t.playlist&&n?b(t.playlist.queue)?function(t,e){if(t.emit("playlist:ended"),!e.loop)return;if(!t.playlist)return;const n=t.playlist.queue=L(t.playlist.queue);if(t.emit("playlist:loop"),!e.shuffle)return k(t,n,e);t.emit("playlist:ready",{queue:n,should_play:!0})}(t,n):void(!1!==n.advance&&k(t,t.playlist.queue,n)):void 0},t=>{setTimeout((function(){if(!t.defaultPrevented)return e(t)}),0)})),t.on(["playing","waiting","seeking","src"],(function(){if(!t.root.classList.contains("is-interstitial"))return;const e=q(t,"flowplayer-playlist-interstitial");e&&A(e,"interstitial/cancel")}))}var D;const R=((D=class Playlist{constructor(t){m(t,"flowplayer-playlist-controls",FlowplayerPlaylistControls),m(t,"flowplayer-playlist-interstitial",class extends UpNext{constructor(t){super(t),this.classList.add("fp-interstitial")}}),m(t,"flowplayer-skip-next-icon",class extends FlowplayerIcon{constructor(t){super(t,e)}}),m(t,"flowplayer-skip-previous-icon",class extends FlowplayerIcon{constructor(t){super(t,n)}})}init(t,e,n){const i=t.playlist||{};i.delay="number"==typeof i.delay?i.delay:5,n.setOpts(Object.assign(Object.assign({},t),{playlist:i})),M(n,t.playlist),function(t){var e;const n=y(t,"flowplayer-playlist-interstitial");n.addEventListener("interstitial/cancel",()=>t.root.classList.remove("is-interstitial")),n.addEventListener("interstitial/end",()=>{var e;t.root.classList.remove("is-interstitial");const n=null===(e=t.playlist)||void 0===e?void 0:e.queue;n&&C(t,w(n,!1))}),null===(e=q(t,"flowplayer-ui"))||void 0===e||e.prepend(n)}(n),H(n)}onload(t,e,n,i){j(t.playlist||{},i.items,(function(t){n.setState("is-playlist",!0),n.emit("playlist:ready",{queue:t,should_play:0===n.currentSrc.length})}))}wants(t,e,n){return"flowplayer/playlist"==e.type&&!!e.items&&u(Object.assign(Object.assign({},n),{playlist:e.items}))}}).pluginName="playlist",D.events=t,D);return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;return"function"==typeof n?(n(e),e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e),e)}(window,R)}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=t.flowplayer||{},t.flowplayer.playlist=e())}(this,(function(){"use strict";var t=Object.freeze({__proto__:null,PLAYLIST_NEXT:"playlist:next",PLAYLIST_ENDED:"playlist:ended",PLAYLIST_READY:"playlist:ready",PLAYLIST_PREVIOUS:"playlist:previous",PLAYLIST_SELECTION:"playlist:selection",PLAYLIST_LOOP:"playlist:loop",PLAYLIST_ADD:"playlist:add",PLAYLIST_REMOVE:"playlist:remove",INTERSTITIAL_END:"interstitial/end",INTERSTITIAL_CANCEL:"interstitial/cancel",INTERSTITIAL_NEXT_ITEM:"interstitial/next_item"});const e={translation_key:"core.skip-next",name:"fp-skip-next"},n={translation_key:"core.skip-prev",name:"fp-skip-prev"};class Pipe{static of(t){return new Pipe(t)}static maybe(t,e,...n){return null==t?t:e.apply(t,[t,...n])}constructor(t){this.data=t}tap(t,...e){return t.apply(this,[this.data,...e]),new Pipe(this.data)}fmap(t,...e){const n=t.apply(this,[this.data,...e]);return new Pipe(n)}unwrap(){return this.data}}function i(t,e){if(!e)throw new Error(t)}function s(t){return"invalid playlist configuration\ndetails: "+t+"\n\tmust match Object of shape:\n"+["\t\t{ controls?: Selector|HTMLElement","player: Selector|HTMLElement","playlist: PlaylistId|Array(MediaId|PlayerConfig)","shuffle?: Boolean|false","loop?: Boolean|false","advance?: Boolean|true","delay?: Milliseconds|5000"].join("\n\t\t, ")+"\n\t\t}"}function l(t,e){Pipe.of(t).fmap(s).fmap(i,e)}function o(t){return void 0!==t}function a(t){return"string"==typeof t}function r(t){return"object"==typeof t}function c(t){return t instanceof HTMLElement}function p(t){var e;l("Config must be an Object",o(t)&&r(t)),l("property `playlist` is required",o(t.playlist)),l("property `playlist` was not a String(MediaId)",a(t.playlist)||(e=t.playlist,l("playlist property was not of type PlaylistId|Array(MediaId|PlayConfig)",Array.isArray(e)),l("playlist property cannot be an empty Array",e.length>0),!e.forEach((function(t,e){l("item at playlist["+e+"] was not valid",a(t)||r(t))})))),"loop shuffle".split(" ").forEach((function(e){o(t[e])&&l(e+" must be a boolean value if present","boolean"==typeof t[e])})),o(t.delay)&&l("property `delay` must be a Number (Milliseconds)","number"==typeof t.delay)}function u(t){try{p(t)}catch(t){return!1}return!0}class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}class FlowplayerIcon extends FlowplayerComponent{constructor(t,e){super(t),this.classList.add("fp-icon",e.name),e.title&&this.setAttribute("title",e.title),e.title&&this.setAttribute("aria-label",e.title),e.translation_key&&this.setAttribute("aria-label",t.i18n(e.translation_key)),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}const d=["title","delay","description","poster","src"];class UpNext extends FlowplayerComponent{static get observedAttributes(){return d}constructor(t){super(t),this.classList.add("up-next"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent("interstitial/end"))}),this.addEventListener("animationcancel",()=>{this.classList.add("cancelled"),this.dispatchEvent(new CustomEvent("interstitial/cancel"))}),this.addEventListener("interstitial/next_item",this._setUpNext.bind(this))}getTitle(){return this.getAttribute("title")||""}getDescription(){return this.getAttribute("description")||""}getPoster(){return this.getAttribute("poster")||""}getDelay(){return this.getAttribute("delay")||""}connectedCallback(){this.isConnected&&this._render()}attributeChangedCallback(){this._render()}_render(){var t,e;this.innerHTML="",this.classList.remove("cancelled");const n=document.createDocumentFragment(),i=document.createElement("div");i.classList.add("pane","left");const s=document.createElement("div");s.classList.add("pane","right"),n.append(i,s);const l=document.createElement("div");l.classList.add("poster"),l.style.backgroundImage="url("+this.getPoster()+")",i.append(l),l.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("interstitial/end")));const o=document.createElement("span");o.classList.add("fp-icon","fp-play"),l.append(o);const a=document.createElement("span");a.classList.add("title"),a.textContent=this.getTitle();const r=document.createElement("span");r.classList.add("description"),r.textContent=this.getDescription();const c=document.createElement("span");c.classList.add("countdown"),this.getDelay()&&(c.style.setProperty("--up-next-delay",this.getDelay()+"s"),c.classList.add("go"));const p=document.createElement("span");p.classList.add("cancel"),p.textContent=null!==(e=null===(t=this.player)||void 0===t?void 0:t.i18n("playlist.cancel"))&&void 0!==e?e:"cancel",p.addEventListener("click",()=>c.classList.remove("go")),s.append(a,r,p,c),this.append(n)}_setUpNext(t){var e,n,i;const s=t.detail.next,l=this.player.opt("playlist.delay",void 0)||10;this.setAttribute("title",null!==(e=s.title)&&void 0!==e?e:""),this.setAttribute("description",null!==(n=s.description)&&void 0!==n?n:""),this.setAttribute("poster",null!==(i=s.poster)&&void 0!==i?i:""),this.setAttribute("delay",l+"")}}const y=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const i=window.customElements.get(e);if(!i)throw new Error(`no default flowplayer component with the name ${e} exists`);const s=window.customElements.get(n);return"function"!=typeof s?i:s})(t._customElements,e))(t),m=(t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)};function f(t,e,n){const i=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;i.length;){if(null==t)return n;const e=i.shift();if("string"!=typeof e)return n;t=t[e]}return null==t?n:t}function v(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}class FlowplayerPlaylistControls extends FlowplayerComponent{constructor(t){super(t),this.playlistWrapper=document.createElement("ol"),this.className="fp-playlist-controls is-empty use-play-1",this.header=this.controlsHeader(t),this.append(this.header,this.playlistWrapper),t.on("playlist:ready",e=>{const n=e.detail.queue;n&&(this.list(n,t),this.classList.toggle("is-empty",!n.members.length))}),t.on("playlist:next",()=>{var e;(null===(e=t.playlist)||void 0===e?void 0:e.queue)&&Array.from(this.querySelectorAll("li")).forEach((e,n)=>{var i;const s=n===(null===(i=t.playlist)||void 0===i?void 0:i.queue.idx);e.classList.toggle("is-current",s),e.setAttribute("aria-current",""+s)})}),t.on("playlist:add",e=>{var n;const i=null===(n=t.playlist)||void 0===n?void 0:n.queue;if(!e.data||!i)return;e.data.members.forEach(e=>{const n=this.videoRow(e,t);n&&this.playlistWrapper.append(n)})}),t.on("playlist:remove",t=>{if(!t.data)return;const e=Array.from(this.querySelectorAll("li"))[t.data.index];e&&this.playlistWrapper.removeChild(e)})}list(t,e){this.playlistWrapper.innerHTML="",t.members.forEach(t=>{const n=this.videoRow(t,e);n&&this.playlistWrapper.append(n)})}videoRow(t,e){const n=document.createElement("li");return n.onclick=this.videoRow_onclick.bind(this,n,e),n.setAttribute("tabindex","0"),n.append(this.item(e,t)),n}item(t,e){const n=document.createElement("div");n.className="fp-playlist-controls-item";const i=this.itemHeader(t,e),s=this.itemContent(e);return n.append(i,s),n}itemContent(t){var e,n;const i=document.createElement("div");i.className="fp-playlist-controls-item-content";const s=document.createElement("div");s.className="fp-playlist-controls-item-title",s.textContent=t.title||(null===(e=t.metadata)||void 0===e?void 0:e.title)||"";const l=document.createElement("div");return l.className="fp-playlist-controls-item-desc",l.textContent=t.description||(null===(n=t.metadata)||void 0===n?void 0:n.description)||"",i.append(s,l),i}itemHeader(t,e){var n,i;const s=document.createElement("div");s.className="fp-playlist-controls-item-header";const l=document.createElement("img");l.alt=e.title||(null===(n=e.metadata)||void 0===n?void 0:n.title)||"",l.className="fp-playlist-controls-image",l.src=e.poster||"";const o=document.createElement("div");o.className="fp-playlist-controls-playing";const a=new(window.customElements.get("flowplayer-play-icon"))(t);a.ariaHidden="true",a.tabIndex=-1;const r=document.createElement("span");r.textContent=t.i18n("playlist.now_playing","Now playing"),o.append(a,r),s.append(l,o);const c=e.duration||(null===(i=e.metadata)||void 0===i?void 0:i.duration);if(void 0!==c){const t=document.createElement("span");t.className="fp-playlist-controls-duration",t.textContent=isFinite(c)?function(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const n=Math.floor(t/3600);let i=Math.floor(t/60);return t-=60*i,n>=1?(i-=60*n,e+n+":"+v(i)+":"+v(t)):e+v(i)+":"+v(t)}(c):"",s.append(t)}return s}controlsHeader(t){const e=document.createElement("div");e.className="fp-playlist-controls-header";const n=document.createElement("h3");n.id="title",n.className="fp-playlist-title",n.textContent="Playlist";const i=document.createElement("input");i.type="checkbox",i.className="fp-playlist-toggle-input",i.id="toggle";const s=document.createElement("label");s.className="fp-playlist-toggle-label",s.tabIndex=0,s.setAttribute("role","button"),s.setAttribute("for","toggle");const l=document.createElement("span");l.className="fp-playlist-toggle-title",l.textContent=t.i18n("playlist.autoplay","Autoplay");const o=document.createElement("div");return o.className="fp-playlist-toggle",o.append(l,i,s),s.addEventListener("click",e=>{e.preventDefault();const n=!i.checked;i.checked=n;const l=t.opts;l.playlist||(l.playlist={}),Object.assign(l.playlist,{advance:n}),s.ariaPressed=n+"",s.ariaLabel=n?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay")}),t.on("playlist:ready",()=>{var e,l,o;const a=t.opts,r=null===(e=null==a?void 0:a.playlist)||void 0===e?void 0:e.advance;i.checked=!1!==r,s.ariaPressed=""+(!1!==r),s.ariaLabel=!1!==r?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay"),n.textContent=null!==(o=null===(l=null==a?void 0:a.metadata)||void 0===l?void 0:l.playlist_title)&&void 0!==o?o:"Playlist"}),e.append(n,o),e}videoRow_onclick(t,e){var n;if(t.classList.contains("is-current"))return;const i=Array.from(this.querySelectorAll("li")).indexOf(t);-1!==i&&(null===(n=e.playlist)||void 0===n||n.play(i))}}var h;function x(t,e){var n,i;const s=e.sort||g,l=null!==(n=e.mode)&&void 0!==n?n:h.FIFO;return t=s(t.slice(0),l),{mode:l,sort:s,members:t,last_idx:t.length-1,plays:null!==(i=e.plays)&&void 0!==i?i:0,idx:-1}}function b(t){return t.idx==t.last_idx}function E(t){const e=t.idx+1;return e>t.last_idx?0:e}function w(t,e,n){return t.idx=e&&"number"==typeof n&&n>=0&&n<=t.last_idx?n:t.idx+1,t.members[t.idx]}function g(t,e){return(e&h.SHUFFLE)==h.SHUFFLE?t.sort((function(){return Math.random()-Math.random()})):t.slice(0)}function L(t){return x(t.members,{mode:t.mode,plays:t.plays+1,sort:t.sort})}!function(t){t[t.SHUFFLE=1]="SHUFFLE",t[t.FIFO=2]="FIFO",t[t.LOOP=4]="LOOP"}(h||(h={})),function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}}();const _=["touchstart","touchmove"];function A(t,e,n){const i=function(t,e){const n=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(n,"data",{get:()=>e}),n}(e,n);return t.dispatchEvent(i),t}function P(t,e,n,i){Array.isArray(e)?e.forEach(e=>I(t,e,n,i)):I(t,e,n,i)}function I(t,e,n,i){if(s=e,!~_.indexOf(s))return t.addEventListener(e,n,i),t;var s;const l=Object.assign(i||{},{passive:!0});return t.addEventListener(e,n,l),t}function q(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}function O(t,e,n){return t.setAttribute(e,n),t}function N(t,e,n){return e.split(" ").forEach(e=>t.classList.toggle(e,n)),t}function T(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}function k(t,e,n){const i=e.idx+e.plays<0;if(!i&&n.delay)return function(t,e){var n;const i=null===(n=t.playlist)||void 0===n?void 0:n.queue,s=q(t,"flowplayer-playlist-interstitial");if(!s||!i||!e.delay)return;t.root.classList.add("is-interstitial");const l=i.members[E(i)];A(s,"interstitial/next_item",{next:l})}(t,n);C(t,w(e,i,n.start_index),i)}function C(t,e,n){n||(t.preload=e.preload="auto",!t.opts.autoplay&&t.setOpts({autoplay:1})),t.emit("playlist/advance"),"object"==typeof e&&t.setOpts(e),function(t,e){var n;const i=null===(n=t.playlist)||void 0===n?void 0:n.queue;if(!i)return;const s=i.idx,l=i.members[s],o=t.currentSrc;if(l.src&&t.setSrc(l.src),t.emit("playlist:next",{next_index:s}),t.opts.autoplay||e)return;const a=e=>{("canplay"===e.type&&o!==t.currentSrc||"playlist:next"===e.type)&&(t.removeEventListener("canplay",a),t.removeEventListener("playlist:next",a),"canplay"===e.type&&t.togglePlay(!0))};t.on(["canplay","playlist:next"],a)}(t,n)}function S(e,n){return{queue:n,events:t,play:function(t){t<0||t>=n.members.length||(this.queue.idx=t,C(e,n.members[t]))},next:function(){this.queue.idx!==this.queue.last_idx&&this.play(this.queue.idx+1)},prev:function(){this.queue.idx&&this.play(this.queue.idx-1)},remove:function(t){const n=this.queue;return n.members[t]?n.idx===t?console.warn("operation failed: you cannot remove current playlist item"):(n.members.splice(t,1),n.last_idx=n.members.length-1,t<n.idx&&--n.idx,void e.emit("playlist:remove",{index:t})):console.warn("there is no playlist item at this index")},push:function(...t){const n=e.root;if(0==this.queue.idx&&n.classList.contains("is-interstitial"))return console.warn("new items cannot be added when playlist has ended.");const i=this.queue.members;i.push(...t),this.queue.last_idx=i.length-1,e.emit("playlist:add",{members:t})},clear:function(){this.queue.members=[],this.queue.plays--,function(t,e){t.playlist&&(e=t.playlist.queue=L(e),t.emit("playlist:ready",{queue:e,should_play:!1}))}(e,this.queue)}}}function F(t){const e=y(t,"flowplayer-skip-previous-icon");O(e,"role","button"),P(e,"click",(function(){t.playlist&&t.playlist.prev()}));const n=y(t,"flowplayer-skip-next-icon");O(n,"role","button"),P(n,"click",(function(){t.playlist&&t.playlist.next()}));const i=T("fp-playlist-prev-preview"),s=T("fp-playlist-next-preview"),l=q(t,"flowplayer-control-buttons");return l&&(l.prepend(e),l.append(n),l.append(i),l.append(s)),t.on("reap",(function(){t.skip_controls=void 0})),t.on(["playlist:next","playlist:add","playlist:remove"],(function(e){const n=f(e,"data.queue",f(t,"playlist.queue"));if(!n||!l||!t.skip_controls)return;N(l,"is-prev-button-disabled",!n.idx),N(l,"is-next-button-disabled",n.idx===n.last_idx);const o=n.idx<n.last_idx?function(t){if(!b(t)||0!=(t.mode&h.LOOP))return t.members[E(t)]}(n):null,a=n.idx>0?function(t){if(0!==t.idx||0!=(t.mode&h.LOOP))return t.members[function(t){const e=t.idx-1;return e<0?t.last_idx:e}(t)]}(n):null;s.style.backgroundImage=["url(",o?o.poster:null,")"].join(""),i.style.backgroundImage=["url(",a?a.poster:null,")"].join("")})),{prevButton:e,nextButton:n,prevPreview:i,nextPreview:s}}function M(t,e){if(!e)return;!1!==e.skip_controls&&(t.skip_controls=F(t));const n=function(t){let e=null;if(n=t.controls,!a(n)&&!c(n))return;var n;c(t.controls)?e=t.controls:a(t.controls)&&(e=document.querySelector(t.controls));return i("Could not find controls by Selector["+t.controls+"]",c(e)),e}(e);if(!n)return;const s=y(t,"flowplayer-playlist-controls");n.append(s)}function j(t,e,n){if(Array.isArray(e))return n(function(t,e){let n=e.shuffle?h.SHUFFLE:h.FIFO;return e.loop&&(n|=h.LOOP),x(t,{mode:n,sort:e.sort})}(e,t));throw new Error("config.playlist must be an Array")}function H(t){var e;t.on("playlist:ready",(function(e){var n,i;const s=t.opt("playlist",{}),l=null===(n=e.detail)||void 0===n?void 0:n.queue,o=null===(i=e.detail)||void 0===i?void 0:i.should_play;l&&s&&(t.playlist=S(t,l),o&&k(t,l,s))})),t.on("ended",(e=e=>{if(e.prevented_from_ads)return;const n=t.opt("playlist");return t.playlist&&n?b(t.playlist.queue)?function(t,e){if(t.emit("playlist:ended"),!e.loop)return;if(!t.playlist)return;const n=t.playlist.queue=L(t.playlist.queue);if(t.emit("playlist:loop"),!e.shuffle)return k(t,n,e);t.emit("playlist:ready",{queue:n,should_play:!0})}(t,n):void(!1!==n.advance&&k(t,t.playlist.queue,n)):void 0},t=>{setTimeout((function(){if(!t.defaultPrevented)return e(t)}),0)})),t.on(["playing","waiting","seeking","src"],(function(){if(!t.root.classList.contains("is-interstitial"))return;const e=q(t,"flowplayer-playlist-interstitial");e&&A(e,"interstitial/cancel")}))}var D;const R=((D=class Playlist{constructor(t){m(t,"flowplayer-playlist-controls",FlowplayerPlaylistControls),m(t,"flowplayer-playlist-interstitial",class extends UpNext{constructor(t){super(t),this.classList.add("fp-interstitial")}}),m(t,"flowplayer-skip-next-icon",class extends FlowplayerIcon{constructor(t){super(t,e)}}),m(t,"flowplayer-skip-previous-icon",class extends FlowplayerIcon{constructor(t){super(t,n)}})}init(t,e,n){const i=t.playlist||{};i.delay="number"==typeof i.delay?i.delay:5,n.setOpts(Object.assign(Object.assign({},t),{playlist:i})),M(n,t.playlist),function(t){var e;const n=y(t,"flowplayer-playlist-interstitial");n.addEventListener("interstitial/cancel",()=>t.root.classList.remove("is-interstitial")),n.addEventListener("interstitial/end",()=>{var e;t.root.classList.remove("is-interstitial");const n=null===(e=t.playlist)||void 0===e?void 0:e.queue;n&&C(t,w(n,!1))}),null===(e=q(t,"flowplayer-ui"))||void 0===e||e.prepend(n)}(n),H(n)}onload(t,e,n,i){j(t.playlist||{},i.items,(function(t){n.setState("is-playlist",!0),n.emit("playlist:ready",{queue:t,should_play:0===n.currentSrc.length})}))}wants(t,e,n){return"flowplayer/playlist"==e.type&&!!e.items&&u(Object.assign(Object.assign({},n),{playlist:e.items}))}}).pluginName="playlist",D.events=t,D);return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;return"function"==typeof n?(n(e),e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e),e)}(window,R)}));
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type { Level } from 'hls.js';
package/plugins/qsel.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type { Level } from 'hls.js';
package/plugins/qul.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type { Level } from 'hls.js';
package/plugins/rts.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { ConnectionStats } from '@millicast/sdk';
5
3
  import type { DiagnosticsResponse } from '@millicast/sdk';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type { Level } from 'hls.js';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type { Level } from 'hls.js';
package/plugins/ssai.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { FragParsingMetadataData } from 'hls.js';
5
3
  import type { Get } from 'type-fest';
package/plugins/ssai.js CHANGED
@@ -4,4 +4,4 @@
4
4
  * https://github.com/lancedikson/bowser
5
5
  * MIT License | (c) Dustin Diaz 2012-2015
6
6
  * MIT License | (c) Denis Demchenko 2015-2019
7
- */const S=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return u}static get ENGINE_MAP(){return g}static get OS_MAP(){return m}static get PLATFORMS_MAP(){return p}}.parse(window.navigator.userAgent),{platform:w,os:_,browser:M}=S,A=e=>e&&e.toLowerCase();var T={rnd:Math.random().toString(36).substr(2,32),os:A(_.name+(_.versionName?" "+_.versionName:"")),device:A(w.type),browser:A(M.name),browser_version:(M&&M.version?M.version:"unknown").split(".").shift(),plugin_version:"3.24.0-rc.4"};const E="https://fp-eu-w1-aai.flowplayer.com/in",k="POST",U=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],R=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],P=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],O=d("ads/analytics"),C=RequestQueue.of(),F=(...e)=>Object.assign({},...e);class Analytics{static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,F(e.metadata,t,{player_version:"3.24.0-rc.4"})),e}constructor(e,t={}){this.emitter=e,this.metadata=F(T,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),O(this),this.wireup()}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,r=F(this.metadata,{event_type:e},s),i=Analytics.pluck_valid_keys(this,r),a=Analytics.ensure_required_keys(this,i);if(O(`Event[${e}]`,{payload:i,observation:s}),a.length)return O(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${a}`,i);RequestQueue.rpush(C,[E,k,i])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}var B;function I(e,t){var s;switch(t){case B.Preroll:return 0;case B.Postroll:return-1;default:return null===(s=e.ssai)||void 0===s?void 0:s.provider.getContentCurrentTime(e)}}function q(e,t,s){var r,i,a,n;const o=null===(r=t.ssai)||void 0===r?void 0:r.provider.getAdType(),d=null===(n=null===(a=null===(i=t.ssai)||void 0===i?void 0:i.provider)||void 0===a?void 0:a.src)||void 0===n?void 0:n.analyticsId,c={ad_break_time:I(t,o),ad_muted:t.muted,event_type:e,is_ssai:!0};o&&Object.assign(c,{ad_type:o}),d&&Object.assign(c,{ad_tag_id:d}),s&&"duration"in s&&Object.assign(c,{ad_remaining_seconds:s.duration-s.currentTime,ad_duration_seconds:s.duration}),t.emit("health:record",{event:"ads/"+e,detail:c}),t.emit(e,Object.assign(c,s))}function D(e,t){var s;e.setState("ssai-ad-active",!0);const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress={currentTime:0,duration:t},L(e,r))}function N(e,t){var s;const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress=t,L(e,r))}function x(e){if(!e.ssai)return;const t=e.ssai.state;e.setState("ssai-ad-active",!1),delete t.adProgress,void 0!==t.rate&&(e.playbackRate=t.rate,delete t.rate),"number"==typeof t.snapbackTime&&(r(e,t.snapbackTime),delete t.snapbackTime)}function L(e,t){const s=e.playbackRate;1!==s&&(t.rate=s,e.playbackRate=1)}!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(B||(B={}));const j=navigator.languages||[navigator.language];const Q="flowplayer-ssai-ui";function V(e,t){const s=new google.ima.dai.api.UiSettings,r=e.opt("lang")||function(){try{return j.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().find(e=>!e.includes("-"))||"en";s.setLocale(r);const i=new google.ima.dai.api.StreamManager(e,function(e,t){const s=e._customElements.get(t);return s&&e.root.querySelector(s)||void 0}(e,Q),s);return i.addEventListener([google.ima.dai.api.StreamEvent.Type.LOADED,google.ima.dai.api.StreamEvent.Type.ERROR,google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED,google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED,google.ima.dai.api.StreamEvent.Type.AD_PROGRESS,google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED,google.ima.dai.api.StreamEvent.Type.RESUMED,google.ima.dai.api.StreamEvent.Type.PAUSED,google.ima.dai.api.StreamEvent.Type.STARTED,google.ima.dai.api.StreamEvent.Type.COMPLETE,google.ima.dai.api.StreamEvent.Type.SKIPPED,google.ima.dai.api.StreamEvent.Type.CLICK],s=>{!function(e,t,s,r){var i;if((null===(i=e.ssai)||void 0===i?void 0:i.provider)!==r)return;switch(s.type){case google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED:return async function(e,t,s,r){var i,a;const n=r.getStreamData().streamId;if(!n||!t.isPod)return;if(!t.isVod){const s=null===(i=t.src)||void 0===i?void 0:i.streamUrl;return s?(t.daiStream=t.buildPodStreamURL(s,n),e.setSrc(t.daiStream)):console.error("streamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#create_a_simple_video_player_2")}const o=null===(a=t.src)||void 0===a?void 0:a.requestStreamUrl;if(!o)return console.error("requestStreamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#vod-pod-serving_1");try{t.daiStream=await o(s,n),s.loadStreamMetadata(),e.setSrc(t.daiStream)}catch(s){G(e,t)}}(e,r,t,s);case google.ima.dai.api.StreamEvent.Type.RESUMED:return q("ad-resumed",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.PAUSED:return q("ad-paused",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.COMPLETE:return q("ad-completed",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.SKIPPED:return q("ad-skipped",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.LOADED:return function(e,t,s){const r=s.getStreamData().url;if(!r||t.isPod&&!t.isVod)return;t.daiStream=r,e.setSrc(r)}(e,r,s);case google.ima.dai.api.StreamEvent.Type.STARTED:return r.currentAd=s.getAd(),q("ad-started",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED:return D(e),q("ad-break-started",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED:return q(n,e,z(e,s,r)),x(e),r.currentAd=void 0;case google.ima.dai.api.StreamEvent.Type.ERROR:return G(e,r,s);case google.ima.dai.api.StreamEvent.Type.AD_PROGRESS:{const t=z(e,s,r);return N(e,t),q("ad-progress",e,t)}case google.ima.dai.api.StreamEvent.Type.CLICK:(function(e,t){if(!e.paused)e.togglePlay(!1)})(e)}}(e,i,s,t)},!1),e.on("ssai:hls:metadata",s=>{var r,a;(null===(r=e.ssai)||void 0===r?void 0:r.provider)===t&&(null===(a=s.detail)||void 0===a||a.samples.forEach(e=>i.processMetadata("ID3",e.data,e.pts)))}),e.on("ssai:dash:metadata",s=>{var r;const a=s.detail;if(!a||(null===(r=e.ssai)||void 0===r?void 0:r.provider)!==t)return;const n=a.event.messageData,o=a.event.calculatedPresentationTime;i.processMetadata("urn:google:dai:2018",n,o)}),i}function z(e,t,s){const r=s.currentAd,i=Object.assign({},t.getStreamData().adProgressData);return r&&Object.assign(i,{vast_ad_id:r.getAdId()}),(null==r?void 0:r.getAdPodInfo())&&Object.assign(i,{position:r.getAdPodInfo().getAdPosition(),totals:r.getAdPodInfo().getTotalAds()}),i}function G(e,t,s){var r,i;if(null===(r=t.src)||void 0===r?void 0:r.backupStream)return e.setSrc(t.src.backupStream);e.emit("error",{message:(null===(i=null==s?void 0:s.getStreamData())||void 0===i?void 0:i.errorMessage)||"error loading stream"})}var W;!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(W||(W={}));const H=d("ads/ima/sdk");var K;async function Y(e,t){var s;const r=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(t?null==r?void 0:r.dai:r)return void H(":noop");const i=t?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":e._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(e){return new Promise((t,s)=>{let r=document.querySelector(`script[src='${e}']`);if(r)return $(r,t,s);r=document.createElement("script"),r.setAttribute("state",K.LOADING),$(r,t,s),r.src=e,document.head.appendChild(r)})}(i),void H(":loaded")}catch(e){H(":error "+e.message,e)}}function $(e,t,s){const r=e.getAttribute("state");if(r&&[K.ERROR,K.LOADED].includes(r))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",K.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",K.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(K||(K={}));class Dai{constructor(e){this.make_analytics(e)}async onload(e,t){var s,r;return await Y(e,!0),(null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai)?((null==this?void 0:this.streamManager)||(this.streamManager=V(e,this)),this.src=t,this.isPod=!!t.customAssetKey||!!t.requestStreamUrl,this.isVod=!!t.contentSourceId||!!t.videoId||!!t.requestStreamUrl,this.isPod?this.requestPodStream(t):void this.requestStream(t)):(console.warn("google.ima.dai unavailable"),void(t.backupStream&&e.setSrc(t.backupStream)))}onNewSrc(e,t){var s;t.src!==this.daiStream&&(this.daiStream=void 0,e.ssai=void 0,null===(s=this.streamManager)||void 0===s||s.reset())}make_analytics(e){const t=Analytics.of(e,{required_keys:R,events:U,optional_keys:P});e.on("config",()=>{var s;return Analytics.mergeMetadata(t,null===(s=e.opts)||void 0===s?void 0:s.metadata)})}onId3(e){var t;const s={},r=e.value;s[r.key]=r.data,null===(t=this.streamManager)||void 0===t||t.onTimedMetadata(s)}getAdType(){if(this.currentAd)switch(this.currentAd.getAdPodInfo().getPodIndex()){case 0:return W.Preroll;case-1:return W.Postroll;case-2:return;default:return W.Midroll}}getContentCurrentTime(e){const t=e.currentTime;return this.streamManager?this.streamManager.contentTimeForStreamTime(t):t}setContentCurrentTime(e,t){}getContentDuration(e){const t=e.duration;return this.streamManager?this.streamManager.contentTimeForStreamTime(t):t}getPreviousActiveAdStart(e,t){var s;const r=null===(s=null==this?void 0:this.streamManager)||void 0===s?void 0:s.previousCuePointForStreamTime(t);if(r&&!r.played)return r.start}requestStream(e){var t;const s=this.isVod?new google.ima.dai.api.VODStreamRequest:new google.ima.dai.api.LiveStreamRequest;null===(t=this.streamManager)||void 0===t||t.requestStream(Object.assign(s,e))}requestPodStream(e){var t;const s=this.isVod?new google.ima.dai.api.PodVodStreamRequest:new google.ima.dai.api.PodStreamRequest;null===(t=this.streamManager)||void 0===t||t.requestStream(Object.assign(s,e))}buildPodStreamURL(e,t){return e.replace("[[STREAMID]]",t)}}Dai.Type="google/dai";const Z=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends Z.AnalyticEventObserver{constructor(e){super(),this.video=e}onAdvertBreakStart(e){const t=e.getDuration();if(!e.isActive()&&t){const e=s(this.video);r(this.video,e+t/1e3)}D(this.video,e.getStart()),q("ad-break-started",this.video)}onAdvertBreakEnd(){x(this.video),q(n,this.video)}onAdvertStart(e){}onAdvertEnd(){}onTrackingEvent(e){}}function X(e,t){YospaceAdManagement.SessionVOD.create(e,t.ssai.properties,e=>{const r=e.getPayload();if(r.getSessionResult()===YospaceAdManagement.SessionResult.INITIALISED){t.ssai.session=r;const e=new EventObserver(t);r.addAnalyticObserver(e),t.setSrc({src:r.getPlaybackUrl()}),setInterval(()=>{const e=1e3*s(t);r.onPlayheadUpdate(e),function(e,t,s){const r=e.getCurrentAdBreak();if(!r)return;const i={currentTime:s-r.getStart(),duration:r.getDuration()};N(t,i),q("ad-progress",t,i)}(r,t,e)},250)}else console.warn("YoSpace Failed to initialise session. ResultCode = "+r.getResultCode())})}class Yospace{static exists(){return!!window.YospaceAdManagement}constructor(e){!function(e){Object.defineProperty(e,"currentTime",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.currentTime:e.ssai.provider.getContentCurrentTime(e)}return s(e)},set:function(t){var s;if(e.ssai){if(e.ssai.state.adProgress)return;return null===(s=e.ssai.provider)||void 0===s?void 0:s.setContentCurrentTime(e,t)}return r(e,t)}}),Object.defineProperty(e,"duration",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.duration:e.ssai.provider.getContentDuration(e)}return a(e)},set:function(){}})}(e)}onload(e,t){Object.assign(e.ssai,function(){const e=new YospaceAdManagement.SessionProperties;return e.setUserAgent(navigator.userAgent),{properties:e}}()),t&&t.src&&X(t.src,e)}getContentCurrentTime(e){const t=s(e),r=e.ssai.session;return r?r.getContentPositionForPlayhead(1e3*t)/1e3:t}setContentCurrentTime(e,t){const s=e.ssai.session;if(!s)return r(e,t);return r(e,s.getPlayheadForContentPosition(1e3*t)/1e3)}getContentDuration(e){const t=e.ssai.session,s=a(e);return t?t.getContentPositionForPlayhead(t.getDuration())/1e3:s}getAdType(){}getPreviousActiveAdStart(e,t){const s=e.ssai.session;if(!s)return;const r=s.getAdBreaks();let i;const a=1e3*t;return r.forEach(e=>{void 0===i&&e.getStart()<a&&e.isActive()&&(i=e)}),void 0!==i?i.getStart()/1e3:void 0}}function J(e){var t;if((null===(t=this.player.ssai)||void 0===t?void 0:t.provider)===this)switch(e.type){case"playing":case"pause":return function(e){if(!e.player.hasState("ssai-ad-active"))return;return q(e.player.paused?"ad-paused":"ad-resumed",e.player)}(this);case"progress":return function(e){const t=e.player,s=t.hls;if(!s)return;if(t.hasState("ssai-ad-active"))return s.config.maxBufferLength=1;const r=t.currentTime;let i,a=0;for(;a<t.buffered.length;a++)if(t.buffered.start(a)-1<=r&&t.buffered.end(a)>=r){i=t.buffered.end(a);break}if(void 0===i)return;const n=e.getAdCues().find(e=>!e.played&&e.endTime>i&&e.startTime<=i);return s.config.maxBufferLength=n?1:30}(this);case"timeupdate":return function(e){if(!e.activeCue||!e.player.hasState("ssai-ad-active"))return;const t=e.player.currentTime;if(t<=e.activeCue.endTime)return e.ad={duration:e.activeCue.endTime-e.activeCue.startTime,currentTime:t-e.activeCue.startTime},q("ad-progress",e.player,Object.assign(Object.assign({},e.ad),e.podInfo));if(e.podInfo.totals!==e.podInfo.position)return;q("ad-completed",e.player),q(n,e.player),x(e.player),e.activeCue.played=!0,e.activeCue=void 0}(this)}}Yospace.Type="yospace";class MediaTailor{constructor(e){this.ad={duration:0,currentTime:0},this.podInfo={totals:0,position:0},this.player=e,e.on(["timeupdate","progress","playing","pause"],J.bind(this))}onload(e,t){this.stream=t.stream,e.setSrc(t.stream)}onNewSrc(e,t){t.src!==this.stream&&(this.activeCue=void 0,e.ssai=void 0)}getPreviousActiveAdStart(e,t){const s=this.getAdCues(),r=s.slice().reverse().find(e=>e.endTime<t);if(!r||r.played)return;const i=s[s.indexOf(r)+1];return!i||t<i.startTime&&(t+.1<=i.startTime||i.played||e.paused)?this.findAdBreakStartCue(r).startTime:void 0}onId3(e){var t;if(e.played||e==this.activeCue)return;if("X-AD-CREATIVE-SIGNALING"!==(null===(t=e.value)||void 0===t?void 0:t.key))return;if(this.activeCue)return q("ad-completed",this.player),this.activeCue.played=!0,this.activeCue=e,++this.podInfo.position,q("ad-started",this.player,Object.assign(Object.assign({},this.ad),this.podInfo));const s=this.findAdBreakStartCue(e);if(s!==e)return this.player.currentTime=s.startTime;Math.abs(e.startTime-this.player.currentTime)>1&&(this.player.currentTime=e.startTime),this.activeCue=e,D(this.player),this.setPodInfo(e),q("ad-break-started",this.player),q("ad-started",this.player,Object.assign(Object.assign({},this.ad),this.podInfo))}setPodInfo(e){const t=this.getAdCues().filter(t=>t.startTime>=e.startTime);let s=1;for(;s<=t.length-1&&!(t[s].startTime-t[s-1].endTime>1);)s++;return this.podInfo={totals:s,position:1},this.player.hasState("is-live")?this.ad_type=B.Midroll:e.startTime<=1?this.ad_type=B.Preroll:Math.abs(t[s-1].endTime-this.player.duration)<=1?this.ad_type=B.Postroll:this.ad_type=B.Midroll}findAdBreakStartCue(e){const t=this.getAdCues().filter(t=>t.startTime<=e.startTime).reverse();let s=e,r=1;for(;r<t.length&&!(t[r-1].startTime-t[r].endTime>.1);)s=t[r],r++;return s}getAdCues(){var e;const t=(null===(e=Array.from(this.player.textTracks).find(e=>"metadata"===e.kind))||void 0===e?void 0:e.cues)||[];return Array.from(t).slice().filter(e=>{var t;return"X-AD-CREATIVE-SIGNALING"===(null===(t=e.value)||void 0===t?void 0:t.key)})}getContentCurrentTime(e){if(!this.activeCue)return 0;let t=this.findAdBreakStartCue(this.activeCue).startTime;return this.getAdCues().filter(e=>e.endTime<t).forEach(e=>{t-=e.endTime-e.startTime}),t}getAdType(){return this.ad_type}getContentDuration(e){return 0}setContentCurrentTime(e,t){}}MediaTailor.Type="mediaTailor";const ee=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?r:i})(e._customElements,t))(e),te=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class SSAIAdUi extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-ui",this.append(...this.player.createComponents("flowplayer-ssai-indicator","flowplayer-ssai-timeline","flowplayer-ssai-controls"))}}class SSAITimeline extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-timeline";const t=document.createElement("div");t.className="fp-ssai-progress",this.append(t),this.player.on(n,()=>{t.classList.remove("go"),"--ssai-percent-complete --ssai-percent-previous".split(" ").forEach(e=>this.style.setProperty(e,"0"))}),this.player.on("ad-progress",e=>{var s,r;const i=null===(s=e.detail)||void 0===s?void 0:s.currentTime,a=null===(r=e.detail)||void 0===r?void 0:r.duration;if(void 0===a||void 0===i)return;const n=i/a*100,o=t.style.getPropertyValue("--ssai-percent-complete");t.classList.remove("go"),t.style.setProperty("--ssai-percent-previous",o),t.style.setProperty("--ssai-percent-complete",n.toFixed(3)),t.classList.add("go")})}}function se(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}class SSAIControls extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-controls",this.createLeftZone(),this.createRightZone()}createRightZone(){const e=document.createElement("div");e.className="fp-ssai-right-zone",e.append(...this.player.createComponents("flowplayer-volume-control"),...this.fsIcons()),this.append(e)}createLeftZone(){const e=document.createElement("div");e.className="fp-ssai-left-zone",e.append(...this.player.createComponents("flowplayer-control-buttons"),this.remainingTimeComponent()),this.append(e)}fsIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(e=>(e.onclick=()=>this.player.toggleFullScreen(),e))}remainingTimeComponent(){const e=document.createElement("div");return e.className="fp-ssai-remaining",this.player.on("ad-progress",t=>{var s;const r=null===(s=t.detail)||void 0===s?void 0:s.remaining;void 0!==r&&(e.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let r=Math.floor(e/60);return e-=60*r,s>=1?(r-=60*s,t+s+":"+se(r)+":"+se(e)):t+se(r)+":"+se(e)}(r))}),e}}class SSAIAdIndicator extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-indicator",this.player.on("ad-started",e=>{var t,s;const r=null===(t=e.detail)||void 0===t?void 0:t.totals,i=null===(s=e.detail)||void 0===s?void 0:s.position;void 0!==r&&void 0!==i&&(this.textContent=`${this.player.i18n("ads.indicator","ADS")} ${i} / ${r}`)})}}var re,ie=Object.freeze({__proto__:null,ID3:"ID3"});const ae=((re=class ID3{init(e,t,s){s.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label||"com.apple.streaming"==e.inBandMetadataTrackDispatchType?function(e,t){t.mode="hidden",t.addEventListener("cuechange",async()=>{Array.from(t.activeCues||[]).forEach(async t=>{(function(e){return"object"==typeof e.value&&"string"==typeof e.value.key&&!!e.value.data})(t)&&e.emit("ID3",{cue:t})})})}(s,e):void 0})}}).pluginName="id3",re.events=ie,re),ne=e(window,ae);var oe;const de=((oe=class Ssai{constructor(e,t){this.umd=e,this.providers=[],this.player=t,te(e,Q,SSAIAdUi),te(e,"flowplayer-ssai-timeline",SSAITimeline),te(e,"flowplayer-ssai-controls",SSAIControls),te(e,"flowplayer-ssai-indicator",SSAIAdIndicator)}init(e,t,i){const a=ee(i,Q);if(t.append(a),i.on(ne.events.ID3,({detail:e})=>{var t,s,r;const a=null==e?void 0:e.cue;a&&(null===(r=null===(t=i.ssai)||void 0===t?void 0:(s=t.provider).onId3)||void 0===r||r.call(s,a))}),i.on("seeked",()=>function(e){if(e.opt("live"))return;if(!e.ssai)return;const{provider:t,state:i}=e.ssai;if(i.snapback)return i.snapback=!1;const a=s(e),n=t.getPreviousActiveAdStart(e,a);void 0!==n&&(i.snapback=!0,i.snapbackTime=a,r(e,n))}(i)),i.on("src",e=>{var t,s,r;i.setState("ssai-ad-active",!1),null===(r=null===(s=null===(t=i.ssai)||void 0===t?void 0:t.provider)||void 0===s?void 0:s.onNewSrc)||void 0===r||r.call(s,i,e.detail)}),this.umd.extensions.find(e=>e.pluginName===ne.pluginName))return;new ne(this.umd,i).init(e,t,i)}onload(e,t,s,r){var i,a;null===(a=null===(i=s.ssai)||void 0===i?void 0:i.provider)||void 0===a||a.onload(s,r)}wants(e,t,s){return!!this.findProvider(t)}findProvider(e){let t=void 0;switch(e.type){case MediaTailor.Type:t=this.providers.find(e=>e instanceof MediaTailor)||new MediaTailor(this.player);break;case Dai.Type:t=this.providers.find(e=>e instanceof Dai)||new Dai(this.player);break;case Yospace.Type:Yospace.exists()&&(t=this.providers.find(e=>e instanceof Yospace)||new Yospace(this.player))}return t&&(this.player.ssai={provider:t,state:{snapback:!1}},this.providers.includes(t)||this.providers.push(t)),t}}).pluginName="ssai",oe.events=o,oe);return e(window,de)}));
7
+ */const S=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return u}static get ENGINE_MAP(){return g}static get OS_MAP(){return m}static get PLATFORMS_MAP(){return p}}.parse(window.navigator.userAgent),{platform:w,os:_,browser:M}=S,A=e=>e&&e.toLowerCase();var T={rnd:Math.random().toString(36).substr(2,32),os:A(_.name+(_.versionName?" "+_.versionName:"")),device:A(w.type),browser:A(M.name),browser_version:(M&&M.version?M.version:"unknown").split(".").shift(),plugin_version:"3.25.0-rc"};const E="https://fp-eu-w1-aai.flowplayer.com/in",k="POST",U=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],R=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],P=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],O=d("ads/analytics"),C=RequestQueue.of(),F=(...e)=>Object.assign({},...e);class Analytics{static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,F(e.metadata,t,{player_version:"3.25.0-rc"})),e}constructor(e,t={}){this.emitter=e,this.metadata=F(T,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),O(this),this.wireup()}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,r=F(this.metadata,{event_type:e},s),i=Analytics.pluck_valid_keys(this,r),a=Analytics.ensure_required_keys(this,i);if(O(`Event[${e}]`,{payload:i,observation:s}),a.length)return O(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${a}`,i);RequestQueue.rpush(C,[E,k,i])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}var B;function I(e,t){var s;switch(t){case B.Preroll:return 0;case B.Postroll:return-1;default:return null===(s=e.ssai)||void 0===s?void 0:s.provider.getContentCurrentTime(e)}}function q(e,t,s){var r,i,a,n;const o=null===(r=t.ssai)||void 0===r?void 0:r.provider.getAdType(),d=null===(n=null===(a=null===(i=t.ssai)||void 0===i?void 0:i.provider)||void 0===a?void 0:a.src)||void 0===n?void 0:n.analyticsId,c={ad_break_time:I(t,o),ad_muted:t.muted,event_type:e,is_ssai:!0};o&&Object.assign(c,{ad_type:o}),d&&Object.assign(c,{ad_tag_id:d}),s&&"duration"in s&&Object.assign(c,{ad_remaining_seconds:s.duration-s.currentTime,ad_duration_seconds:s.duration}),t.emit("health:record",{event:"ads/"+e,detail:c}),t.emit(e,Object.assign(c,s))}function D(e,t){var s;e.setState("ssai-ad-active",!0);const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress={currentTime:0,duration:t},L(e,r))}function N(e,t){var s;const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress=t,L(e,r))}function x(e){if(!e.ssai)return;const t=e.ssai.state;e.setState("ssai-ad-active",!1),delete t.adProgress,void 0!==t.rate&&(e.playbackRate=t.rate,delete t.rate),"number"==typeof t.snapbackTime&&(r(e,t.snapbackTime),delete t.snapbackTime)}function L(e,t){const s=e.playbackRate;1!==s&&(t.rate=s,e.playbackRate=1)}!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(B||(B={}));const j=navigator.languages||[navigator.language];const Q="flowplayer-ssai-ui";function V(e,t){const s=new google.ima.dai.api.UiSettings,r=e.opt("lang")||function(){try{return j.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().find(e=>!e.includes("-"))||"en";s.setLocale(r);const i=new google.ima.dai.api.StreamManager(e,function(e,t){const s=e._customElements.get(t);return s&&e.root.querySelector(s)||void 0}(e,Q),s);return i.addEventListener([google.ima.dai.api.StreamEvent.Type.LOADED,google.ima.dai.api.StreamEvent.Type.ERROR,google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED,google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED,google.ima.dai.api.StreamEvent.Type.AD_PROGRESS,google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED,google.ima.dai.api.StreamEvent.Type.RESUMED,google.ima.dai.api.StreamEvent.Type.PAUSED,google.ima.dai.api.StreamEvent.Type.STARTED,google.ima.dai.api.StreamEvent.Type.COMPLETE,google.ima.dai.api.StreamEvent.Type.SKIPPED,google.ima.dai.api.StreamEvent.Type.CLICK],s=>{!function(e,t,s,r){var i;if((null===(i=e.ssai)||void 0===i?void 0:i.provider)!==r)return;switch(s.type){case google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED:return async function(e,t,s,r){var i,a;const n=r.getStreamData().streamId;if(!n||!t.isPod)return;if(!t.isVod){const s=null===(i=t.src)||void 0===i?void 0:i.streamUrl;return s?(t.daiStream=t.buildPodStreamURL(s,n),e.setSrc(t.daiStream)):console.error("streamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#create_a_simple_video_player_2")}const o=null===(a=t.src)||void 0===a?void 0:a.requestStreamUrl;if(!o)return console.error("requestStreamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#vod-pod-serving_1");try{t.daiStream=await o(s,n),s.loadStreamMetadata(),e.setSrc(t.daiStream)}catch(s){G(e,t)}}(e,r,t,s);case google.ima.dai.api.StreamEvent.Type.RESUMED:return q("ad-resumed",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.PAUSED:return q("ad-paused",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.COMPLETE:return q("ad-completed",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.SKIPPED:return q("ad-skipped",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.LOADED:return function(e,t,s){const r=s.getStreamData().url;if(!r||t.isPod&&!t.isVod)return;t.daiStream=r,e.setSrc(r)}(e,r,s);case google.ima.dai.api.StreamEvent.Type.STARTED:return r.currentAd=s.getAd(),q("ad-started",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED:return D(e),q("ad-break-started",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED:return q(n,e,z(e,s,r)),x(e),r.currentAd=void 0;case google.ima.dai.api.StreamEvent.Type.ERROR:return G(e,r,s);case google.ima.dai.api.StreamEvent.Type.AD_PROGRESS:{const t=z(e,s,r);return N(e,t),q("ad-progress",e,t)}case google.ima.dai.api.StreamEvent.Type.CLICK:(function(e,t){if(!e.paused)e.togglePlay(!1)})(e)}}(e,i,s,t)},!1),e.on("ssai:hls:metadata",s=>{var r,a;(null===(r=e.ssai)||void 0===r?void 0:r.provider)===t&&(null===(a=s.detail)||void 0===a||a.samples.forEach(e=>i.processMetadata("ID3",e.data,e.pts)))}),e.on("ssai:dash:metadata",s=>{var r;const a=s.detail;if(!a||(null===(r=e.ssai)||void 0===r?void 0:r.provider)!==t)return;const n=a.event.messageData,o=a.event.calculatedPresentationTime;i.processMetadata("urn:google:dai:2018",n,o)}),i}function z(e,t,s){const r=s.currentAd,i=Object.assign({},t.getStreamData().adProgressData);return r&&Object.assign(i,{vast_ad_id:r.getAdId()}),(null==r?void 0:r.getAdPodInfo())&&Object.assign(i,{position:r.getAdPodInfo().getAdPosition(),totals:r.getAdPodInfo().getTotalAds()}),i}function G(e,t,s){var r,i;if(null===(r=t.src)||void 0===r?void 0:r.backupStream)return e.setSrc(t.src.backupStream);e.emit("error",{message:(null===(i=null==s?void 0:s.getStreamData())||void 0===i?void 0:i.errorMessage)||"error loading stream"})}var W;!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(W||(W={}));const H=d("ads/ima/sdk");var K;async function Y(e,t){var s;const r=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(t?null==r?void 0:r.dai:r)return void H(":noop");const i=t?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":e._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(e){return new Promise((t,s)=>{let r=document.querySelector(`script[src='${e}']`);if(r)return $(r,t,s);r=document.createElement("script"),r.setAttribute("state",K.LOADING),$(r,t,s),r.src=e,document.head.appendChild(r)})}(i),void H(":loaded")}catch(e){H(":error "+e.message,e)}}function $(e,t,s){const r=e.getAttribute("state");if(r&&[K.ERROR,K.LOADED].includes(r))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",K.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",K.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(K||(K={}));class Dai{constructor(e){this.make_analytics(e)}async onload(e,t){var s,r;return await Y(e,!0),(null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai)?((null==this?void 0:this.streamManager)||(this.streamManager=V(e,this)),this.src=t,this.isPod=!!t.customAssetKey||!!t.requestStreamUrl,this.isVod=!!t.contentSourceId||!!t.videoId||!!t.requestStreamUrl,this.isPod?this.requestPodStream(t):void this.requestStream(t)):(console.warn("google.ima.dai unavailable"),void(t.backupStream&&e.setSrc(t.backupStream)))}onNewSrc(e,t){var s;t.src!==this.daiStream&&(this.daiStream=void 0,e.ssai=void 0,null===(s=this.streamManager)||void 0===s||s.reset())}make_analytics(e){const t=Analytics.of(e,{required_keys:R,events:U,optional_keys:P});e.on("config",()=>{var s;return Analytics.mergeMetadata(t,null===(s=e.opts)||void 0===s?void 0:s.metadata)})}onId3(e){var t;const s={},r=e.value;s[r.key]=r.data,null===(t=this.streamManager)||void 0===t||t.onTimedMetadata(s)}getAdType(){if(this.currentAd)switch(this.currentAd.getAdPodInfo().getPodIndex()){case 0:return W.Preroll;case-1:return W.Postroll;case-2:return;default:return W.Midroll}}getContentCurrentTime(e){const t=e.currentTime;return this.streamManager?this.streamManager.contentTimeForStreamTime(t):t}setContentCurrentTime(e,t){}getContentDuration(e){const t=e.duration;return this.streamManager?this.streamManager.contentTimeForStreamTime(t):t}getPreviousActiveAdStart(e,t){var s;const r=null===(s=null==this?void 0:this.streamManager)||void 0===s?void 0:s.previousCuePointForStreamTime(t);if(r&&!r.played)return r.start}requestStream(e){var t;const s=this.isVod?new google.ima.dai.api.VODStreamRequest:new google.ima.dai.api.LiveStreamRequest;null===(t=this.streamManager)||void 0===t||t.requestStream(Object.assign(s,e))}requestPodStream(e){var t;const s=this.isVod?new google.ima.dai.api.PodVodStreamRequest:new google.ima.dai.api.PodStreamRequest;null===(t=this.streamManager)||void 0===t||t.requestStream(Object.assign(s,e))}buildPodStreamURL(e,t){return e.replace("[[STREAMID]]",t)}}Dai.Type="google/dai";const Z=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends Z.AnalyticEventObserver{constructor(e){super(),this.video=e}onAdvertBreakStart(e){const t=e.getDuration();if(!e.isActive()&&t){const e=s(this.video);r(this.video,e+t/1e3)}D(this.video,e.getStart()),q("ad-break-started",this.video)}onAdvertBreakEnd(){x(this.video),q(n,this.video)}onAdvertStart(e){}onAdvertEnd(){}onTrackingEvent(e){}}function X(e,t){YospaceAdManagement.SessionVOD.create(e,t.ssai.properties,e=>{const r=e.getPayload();if(r.getSessionResult()===YospaceAdManagement.SessionResult.INITIALISED){t.ssai.session=r;const e=new EventObserver(t);r.addAnalyticObserver(e),t.setSrc({src:r.getPlaybackUrl()}),setInterval(()=>{const e=1e3*s(t);r.onPlayheadUpdate(e),function(e,t,s){const r=e.getCurrentAdBreak();if(!r)return;const i={currentTime:s-r.getStart(),duration:r.getDuration()};N(t,i),q("ad-progress",t,i)}(r,t,e)},250)}else console.warn("YoSpace Failed to initialise session. ResultCode = "+r.getResultCode())})}class Yospace{static exists(){return!!window.YospaceAdManagement}constructor(e){!function(e){Object.defineProperty(e,"currentTime",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.currentTime:e.ssai.provider.getContentCurrentTime(e)}return s(e)},set:function(t){var s;if(e.ssai){if(e.ssai.state.adProgress)return;return null===(s=e.ssai.provider)||void 0===s?void 0:s.setContentCurrentTime(e,t)}return r(e,t)}}),Object.defineProperty(e,"duration",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.duration:e.ssai.provider.getContentDuration(e)}return a(e)},set:function(){}})}(e)}onload(e,t){Object.assign(e.ssai,function(){const e=new YospaceAdManagement.SessionProperties;return e.setUserAgent(navigator.userAgent),{properties:e}}()),t&&t.src&&X(t.src,e)}getContentCurrentTime(e){const t=s(e),r=e.ssai.session;return r?r.getContentPositionForPlayhead(1e3*t)/1e3:t}setContentCurrentTime(e,t){const s=e.ssai.session;if(!s)return r(e,t);return r(e,s.getPlayheadForContentPosition(1e3*t)/1e3)}getContentDuration(e){const t=e.ssai.session,s=a(e);return t?t.getContentPositionForPlayhead(t.getDuration())/1e3:s}getAdType(){}getPreviousActiveAdStart(e,t){const s=e.ssai.session;if(!s)return;const r=s.getAdBreaks();let i;const a=1e3*t;return r.forEach(e=>{void 0===i&&e.getStart()<a&&e.isActive()&&(i=e)}),void 0!==i?i.getStart()/1e3:void 0}}function J(e){var t;if((null===(t=this.player.ssai)||void 0===t?void 0:t.provider)===this)switch(e.type){case"playing":case"pause":return function(e){if(!e.player.hasState("ssai-ad-active"))return;return q(e.player.paused?"ad-paused":"ad-resumed",e.player)}(this);case"progress":return function(e){const t=e.player,s=t.hls;if(!s)return;if(t.hasState("ssai-ad-active"))return s.config.maxBufferLength=1;const r=t.currentTime;let i,a=0;for(;a<t.buffered.length;a++)if(t.buffered.start(a)-1<=r&&t.buffered.end(a)>=r){i=t.buffered.end(a);break}if(void 0===i)return;const n=e.getAdCues().find(e=>!e.played&&e.endTime>i&&e.startTime<=i);return s.config.maxBufferLength=n?1:30}(this);case"timeupdate":return function(e){if(!e.activeCue||!e.player.hasState("ssai-ad-active"))return;const t=e.player.currentTime;if(t<=e.activeCue.endTime)return e.ad={duration:e.activeCue.endTime-e.activeCue.startTime,currentTime:t-e.activeCue.startTime},q("ad-progress",e.player,Object.assign(Object.assign({},e.ad),e.podInfo));if(e.podInfo.totals!==e.podInfo.position)return;q("ad-completed",e.player),q(n,e.player),x(e.player),e.activeCue.played=!0,e.activeCue=void 0}(this)}}Yospace.Type="yospace";class MediaTailor{constructor(e){this.ad={duration:0,currentTime:0},this.podInfo={totals:0,position:0},this.player=e,e.on(["timeupdate","progress","playing","pause"],J.bind(this))}onload(e,t){this.stream=t.stream,e.setSrc(t.stream)}onNewSrc(e,t){t.src!==this.stream&&(this.activeCue=void 0,e.ssai=void 0)}getPreviousActiveAdStart(e,t){const s=this.getAdCues(),r=s.slice().reverse().find(e=>e.endTime<t);if(!r||r.played)return;const i=s[s.indexOf(r)+1];return!i||t<i.startTime&&(t+.1<=i.startTime||i.played||e.paused)?this.findAdBreakStartCue(r).startTime:void 0}onId3(e){var t;if(e.played||e==this.activeCue)return;if("X-AD-CREATIVE-SIGNALING"!==(null===(t=e.value)||void 0===t?void 0:t.key))return;if(this.activeCue)return q("ad-completed",this.player),this.activeCue.played=!0,this.activeCue=e,++this.podInfo.position,q("ad-started",this.player,Object.assign(Object.assign({},this.ad),this.podInfo));const s=this.findAdBreakStartCue(e);if(s!==e)return this.player.currentTime=s.startTime;Math.abs(e.startTime-this.player.currentTime)>1&&(this.player.currentTime=e.startTime),this.activeCue=e,D(this.player),this.setPodInfo(e),q("ad-break-started",this.player),q("ad-started",this.player,Object.assign(Object.assign({},this.ad),this.podInfo))}setPodInfo(e){const t=this.getAdCues().filter(t=>t.startTime>=e.startTime);let s=1;for(;s<=t.length-1&&!(t[s].startTime-t[s-1].endTime>1);)s++;return this.podInfo={totals:s,position:1},this.player.hasState("is-live")?this.ad_type=B.Midroll:e.startTime<=1?this.ad_type=B.Preroll:Math.abs(t[s-1].endTime-this.player.duration)<=1?this.ad_type=B.Postroll:this.ad_type=B.Midroll}findAdBreakStartCue(e){const t=this.getAdCues().filter(t=>t.startTime<=e.startTime).reverse();let s=e,r=1;for(;r<t.length&&!(t[r-1].startTime-t[r].endTime>.1);)s=t[r],r++;return s}getAdCues(){var e;const t=(null===(e=Array.from(this.player.textTracks).find(e=>"metadata"===e.kind))||void 0===e?void 0:e.cues)||[];return Array.from(t).slice().filter(e=>{var t;return"X-AD-CREATIVE-SIGNALING"===(null===(t=e.value)||void 0===t?void 0:t.key)})}getContentCurrentTime(e){if(!this.activeCue)return 0;let t=this.findAdBreakStartCue(this.activeCue).startTime;return this.getAdCues().filter(e=>e.endTime<t).forEach(e=>{t-=e.endTime-e.startTime}),t}getAdType(){return this.ad_type}getContentDuration(e){return 0}setContentCurrentTime(e,t){}}MediaTailor.Type="mediaTailor";const ee=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?r:i})(e._customElements,t))(e),te=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class SSAIAdUi extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-ui",this.append(...this.player.createComponents("flowplayer-ssai-indicator","flowplayer-ssai-timeline","flowplayer-ssai-controls"))}}class SSAITimeline extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-timeline";const t=document.createElement("div");t.className="fp-ssai-progress",this.append(t),this.player.on(n,()=>{t.classList.remove("go"),"--ssai-percent-complete --ssai-percent-previous".split(" ").forEach(e=>this.style.setProperty(e,"0"))}),this.player.on("ad-progress",e=>{var s,r;const i=null===(s=e.detail)||void 0===s?void 0:s.currentTime,a=null===(r=e.detail)||void 0===r?void 0:r.duration;if(void 0===a||void 0===i)return;const n=i/a*100,o=t.style.getPropertyValue("--ssai-percent-complete");t.classList.remove("go"),t.style.setProperty("--ssai-percent-previous",o),t.style.setProperty("--ssai-percent-complete",n.toFixed(3)),t.classList.add("go")})}}function se(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}class SSAIControls extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-controls",this.createLeftZone(),this.createRightZone()}createRightZone(){const e=document.createElement("div");e.className="fp-ssai-right-zone",e.append(...this.player.createComponents("flowplayer-volume-control"),...this.fsIcons()),this.append(e)}createLeftZone(){const e=document.createElement("div");e.className="fp-ssai-left-zone",e.append(...this.player.createComponents("flowplayer-control-buttons"),this.remainingTimeComponent()),this.append(e)}fsIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(e=>(e.onclick=()=>this.player.toggleFullScreen(),e))}remainingTimeComponent(){const e=document.createElement("div");return e.className="fp-ssai-remaining",this.player.on("ad-progress",t=>{var s;const r=null===(s=t.detail)||void 0===s?void 0:s.remaining;void 0!==r&&(e.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let r=Math.floor(e/60);return e-=60*r,s>=1?(r-=60*s,t+s+":"+se(r)+":"+se(e)):t+se(r)+":"+se(e)}(r))}),e}}class SSAIAdIndicator extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-indicator",this.player.on("ad-started",e=>{var t,s;const r=null===(t=e.detail)||void 0===t?void 0:t.totals,i=null===(s=e.detail)||void 0===s?void 0:s.position;void 0!==r&&void 0!==i&&(this.textContent=`${this.player.i18n("ads.indicator","ADS")} ${i} / ${r}`)})}}var re,ie=Object.freeze({__proto__:null,ID3:"ID3"});const ae=((re=class ID3{init(e,t,s){s.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label||"com.apple.streaming"==e.inBandMetadataTrackDispatchType?function(e,t){t.mode="hidden",t.addEventListener("cuechange",async()=>{Array.from(t.activeCues||[]).forEach(async t=>{(function(e){return"object"==typeof e.value&&"string"==typeof e.value.key&&!!e.value.data})(t)&&e.emit("ID3",{cue:t})})})}(s,e):void 0})}}).pluginName="id3",re.events=ie,re),ne=e(window,ae);var oe;const de=((oe=class Ssai{constructor(e,t){this.umd=e,this.providers=[],this.player=t,te(e,Q,SSAIAdUi),te(e,"flowplayer-ssai-timeline",SSAITimeline),te(e,"flowplayer-ssai-controls",SSAIControls),te(e,"flowplayer-ssai-indicator",SSAIAdIndicator)}init(e,t,i){const a=ee(i,Q);if(t.append(a),i.on(ne.events.ID3,({detail:e})=>{var t,s,r;const a=null==e?void 0:e.cue;a&&(null===(r=null===(t=i.ssai)||void 0===t?void 0:(s=t.provider).onId3)||void 0===r||r.call(s,a))}),i.on("seeked",()=>function(e){if(e.opt("live"))return;if(!e.ssai)return;const{provider:t,state:i}=e.ssai;if(i.snapback)return i.snapback=!1;const a=s(e),n=t.getPreviousActiveAdStart(e,a);void 0!==n&&(i.snapback=!0,i.snapbackTime=a,r(e,n))}(i)),i.on("src",e=>{var t,s,r;i.setState("ssai-ad-active",!1),null===(r=null===(s=null===(t=i.ssai)||void 0===t?void 0:t.provider)||void 0===s?void 0:s.onNewSrc)||void 0===r||r.call(s,i,e.detail)}),this.umd.extensions.find(e=>e.pluginName===ne.pluginName))return;new ne(this.umd,i).init(e,t,i)}onload(e,t,s,r){var i,a;null===(a=null===(i=s.ssai)||void 0===i?void 0:i.provider)||void 0===a||a.onload(s,r)}wants(e,t,s){return!!this.findProvider(t)}findProvider(e){let t=void 0;switch(e.type){case MediaTailor.Type:t=this.providers.find(e=>e instanceof MediaTailor)||new MediaTailor(this.player);break;case Dai.Type:t=this.providers.find(e=>e instanceof Dai)||new Dai(this.player);break;case Yospace.Type:Yospace.exists()&&(t=this.providers.find(e=>e instanceof Yospace)||new Yospace(this.player))}return t&&(this.player.ssai={provider:t,state:{snapback:!1}},this.providers.includes(t)||this.providers.push(t)),t}}).pluginName="ssai",oe.events=o,oe);return e(window,de)}));
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type hlsjs from 'hls.js';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type { Level } from 'hls.js';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type { Level } from 'hls.js';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type { Level } from 'hls.js';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type { Level } from 'hls.js';
package/util/loader.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import type { BitrateInfo } from 'dashjs';
4
2
  import type { Get } from 'type-fest';
5
3
  import type { Level } from 'hls.js';