@flowplayer/player 3.43.1-rc → 3.43.1

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.
package/plugins/id3.js CHANGED
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.id3=n())}(this,function(){"use strict";var e,n=Object.freeze({__proto__:null,ID3:"ID3"});const t=((e=class ID3{init(e,n,t){t.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label||"com.apple.streaming"==e.inBandMetadataTrackDispatchType?function(e,n){n.mode="hidden",n.addEventListener("cuechange",async()=>{Array.from(n.activeCues||[]).forEach(async n=>{(function(e){return"object"==typeof e.value&&"string"==typeof e.value.key&&!!e.value.data})(n)&&e.emit("ID3",{cue:n})})})}(t,e):void 0})}}).pluginName="id3",e.events=n,e);return function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;if(null===document.currentScript)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;return"function"==typeof t?(t(n),n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n),n)}(window,t)});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.id3=t())}(this,function(){"use strict";var e=Object.freeze({__proto__:null,ID3:"ID3"});const t=1,n=.001;const a=new WeakMap;function o(e,o,i="used"){var r;const d=`${o}:${i}`,s=null!==(r=a.get(e))&&void 0!==r?r:new Set;if(s.has(d))return;s.add(d),a.set(e,s);const f=()=>function(e,{feature_name:n,behavior:a,sample_rate:o}){n&&(o||(o=t),e.emit("flowplayer:feature",{feature_name:n,behavior:a,sample_rate:o}))}(e,{feature_name:o,behavior:i,sample_rate:n});e.opt("metadata.media_id")?f():e.once("health:ready",f)}var i;const r=((i=class ID3{init(e,t,n){n.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label||"com.apple.streaming"==e.inBandMetadataTrackDispatchType?(o(n,"id3"),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})})})}(n,e)):void 0})}}).pluginName="id3",i.events=e,i);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,r)});
package/plugins/iframe.js CHANGED
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.iframe=n())}(this,function(){"use strict";var e;const n=((e=class Iframe{constructor(n,t){e.ATTACHED||(t.setState("is-iframe",!0),e.ATTACHED=!0,window.addEventListener("message",function(t){if(!e.is_flowplayer_message(t.data))return;const i=n.instances||[],o=i[0];if(!o)return;i.length>1&&console.warn("Multiple player instances in iframe. Messaging supported with first instance only.");switch(e.message_body(t.data)){case"pause":return o.togglePlay(!1);case"play":return o.togglePlay(!0)}}))}init(e,n,t){t.on("fullscreenenter",function(){document.fullscreenEnabled||"function"==typeof t.webkitEnterFullscreen&&(t.webkitEnterFullscreen(),t.once("webkitendfullscreen",function(){t.emit("fullscreenexit")}),t.on("ended",function(){t.webkitExitFullscreen()}))})}}).pluginName="iframe",e.FLOWPLAYER_RPC_PROTOCOL="flowplayer://",e.ATTACHED=!1,e.is_flowplayer_message=function(n){return"string"==typeof n&&n.startsWith(e.FLOWPLAYER_RPC_PROTOCOL)},e.message_body=function(n){return n.slice(e.FLOWPLAYER_RPC_PROTOCOL.length)},e);(function(){try{return window.self!==window.top}catch(e){return!0}})()&&function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;if(null===document.currentScript)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;"function"==typeof t?t(n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n))}(window,n);return n});
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.iframe=n())}(this,function(){"use strict";const e=1,n=.001;const t=new WeakMap;function r(r,o,i="used"){var s;const a=`${o}:${i}`,l=null!==(s=t.get(r))&&void 0!==s?s:new Set;if(l.has(a))return;l.add(a),t.set(r,l);const f=()=>function(n,{feature_name:t,behavior:r,sample_rate:o}){t&&(o||(o=e),n.emit("flowplayer:feature",{feature_name:t,behavior:r,sample_rate:o}))}(r,{feature_name:o,behavior:i,sample_rate:n});r.opt("metadata.media_id")?f():r.once("health:ready",f)}var o;const i=((o=class Iframe{constructor(e,n){o.ATTACHED||(n.setState("is-iframe",!0),o.ATTACHED=!0,window.addEventListener("message",function(n){if(!o.is_flowplayer_message(n.data))return;const t=e.instances||[],r=t[0];if(!r)return;t.length>1&&console.warn("Multiple player instances in iframe. Messaging supported with first instance only.");switch(o.message_body(n.data)){case"pause":return r.togglePlay(!1);case"play":return r.togglePlay(!0)}}))}init(e,n,t){r(t,"iframe"),t.on("fullscreenenter",function(){document.fullscreenEnabled||"function"==typeof t.webkitEnterFullscreen&&(t.webkitEnterFullscreen(),t.once("webkitendfullscreen",function(){t.emit("fullscreenexit")}),t.on("ended",function(){t.webkitExitFullscreen()}))})}}).pluginName="iframe",o.FLOWPLAYER_RPC_PROTOCOL="flowplayer://",o.ATTACHED=!1,o.is_flowplayer_message=function(e){return"string"==typeof e&&e.startsWith(o.FLOWPLAYER_RPC_PROTOCOL)},o.message_body=function(e){return e.slice(o.FLOWPLAYER_RPC_PROTOCOL.length)},o);(function(){try{return window.self!==window.top}catch(e){return!0}})()&&function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;if(null===document.currentScript)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;"function"==typeof t?t(n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n))}(window,i);return i});
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.keyboard=t())}(this,function(){"use strict";function e(e,t,n){const o=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;o.length;){if(null==e)return n;const t=o.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}var t={TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",SPACE:" ",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",F:"f",H:"h",J:"j",K:"k",L:"l",M:"m"};const n="mousemove",o="fp-menu-container",r="details[open]."+o;function i(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector(r);n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}document.addEventListener("click",function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(i(),this.active_menu=void 0)});const a="is-kb-active";let s;function u(e){e.setState(a,!0),clearTimeout(s),s=setTimeout(function(){e.setState(a,!1)},2500)}function c(e,t){e.enqueueSeek(t)&&u(e)}const l="flowplayer-timeline-bar",f="flowplayer-volume-bar",d="flowplayer-wait",p="flowplayer-playlist-controls";const m="flowplayer-ad-ui";const R=1,y=.001;function v(e,{feature_name:t,behavior:n,sample_rate:o}){t&&(o||(o=R),e.emit("flowplayer:feature",{feature_name:t,behavior:n,sample_rate:o}))}const A=e=>{const t=e.closest(`.${o}`);return t?((e,t)=>{var n,o;const r=`${((null===(n=t.parentElement)||void 0===n?void 0:n.localName)||"")+">"+e.localName}>${t.open?"open":"closed"}`;return e instanceof HTMLSpanElement?r+">"+(e.textContent||""):e instanceof HTMLLIElement?r+">"+((null===(o=e.querySelector("span"))||void 0===o?void 0:o.textContent)||""):r})(e,t):e.closest(l)?l:e.closest(f)?f:e.closest(d)?d:e.closest(m)?m+">"+e.localName:e.localName};function E(e,t,n){const o=function(e){return" "===e?"space":e}(t),r={};n&&(r.focused_element=A(n));const i=((e,t,n={})=>{const o=t.join(","),r=Object.entries(n).map(([e,t])=>`${e}=${t}`).join(",");return r?`${e}:${o}:${r}`:`${e}:${o}`})("key",[o],r);v(e,{feature_name:"keyboard",behavior:i,sample_rate:y})}var h;const O=[t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT,t.ARROW_DOWN],S=[t.SPACE,t.F,t.ESCAPE,t.M,t.ARROW_UP,t.ARROW_DOWN,t.ARROW_RIGHT,t.ARROW_LEFT,t.H,t.J,t.K,t.L];function _(e,t){e.volume=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.volume+t,1,0),u(e)}function b(e){e.preventDefault(),e.stopPropagation()}function W(o){const r=o.key,a=T(),s=document.activeElement;if(!s)return;if(r===t.TAB)return function(){var e,t,o;const r=document.activeElement;if(!r)return;const i=null===(e=r.closest(".flowplayer"))||void 0===e?void 0:e.querySelector(".fp-engine");if(g().forEach(e=>{e.root.hasFocus=i===e,e.setState("is-accessibility",i===e)}),!i)return;if(i.root.dispatchEvent(new Event(n)),!function(e){var t,n;return!(!e.hasState("ad-paused")&&!e.hasState("ad-playing")||!(null===(n=null===(t=null==e?void 0:e.ads)||void 0===t?void 0:t.adapter)||void 0===n?void 0:n.isLinearAd()))}(i)||P(r,m))return;const a=i.root.querySelector(m);if(!a)return;if(i.hasState("ad-playing"))return null===(t=a.querySelector(".fp-small-pause"))||void 0===t?void 0:t.focus();if(i.hasState("ad-paused"))return null===(o=a.querySelector(".fp-small-play"))||void 0===o?void 0:o.focus()}();if((r===t.SPACE||r===t.ENTER)&&s.hasAttribute("tabindex")&&(P(s,".flowplayer")||P(s,p)))return a&&E(a,r,s),null==s||s.dispatchEvent(new CustomEvent("click",{cancelable:!0,bubbles:!0})),b(o);if((r===t.ARROW_DOWN||r===t.ARROW_UP||r===t.ESCAPE)&&(P(s,".fp-menu-container")||P(s,p))){if(r===t.ARROW_DOWN&&s.nextSibling)return a&&E(a,r,s),s.nextSibling.focus();if(r===t.ARROW_UP&&s.previousSibling)return a&&E(a,r,s),s.previousSibling.focus();if(r===t.ESCAPE){a&&E(a,r,s);const e=new CustomEvent("keyboard:close:menus",{cancelable:!0});if(null==a||a.dispatchEvent(e),e.defaultPrevented)return;return i()}}if(!a)return;let u=e(a,"opts.keyboard.seek_step",5);if(u<1&&(u=Math.round(u*a.duration)),~O.indexOf(r)&&s.hasAttribute("aria-valuenow")){const e=~[t.ARROW_UP,t.ARROW_RIGHT].indexOf(r);if(s.matches(".fp-volume"))return E(a,r,s),_(a,e?.15:-.15),b(o);if(s.matches(".fp-timeline"))return E(a,r,s),c(a,e?u:-1*u),b(o)}if(!1===function(e,t){return!(t.altKey||t.shiftKey||t.metaKey||t.ctrlKey)&&!!(e&&e.hasState("is-in-viewport")&&e.started)&&!!e.root&&void 0}(a,o))return;const l=!a.hasState("no-timeline");switch(~S.indexOf(r)&&o.preventDefault(),r){case t.SPACE:return E(a,r,s),a.togglePlay();case t.F:return E(a,r,s),a.toggleFullScreen();case t.ESCAPE:return a.hasState("is-fullscreen")?(E(a,r,s),a.toggleFullScreen(!1)):void 0;case t.M:return E(a,r,s),a.toggleMute();case t.ARROW_UP:case t.K:return E(a,r,s),_(a,.15);case t.ARROW_DOWN:case t.J:return E(a,r,s),_(a,-.15);case t.ARROW_RIGHT:case t.L:return E(a,r,s),l&&c(a,u);case t.ARROW_LEFT:case t.H:return E(a,r,s),l&&c(a,-1*u)}}function w(e){setTimeout(function(){e.defaultPrevented||W(e)},0)}function T(){return g().find(e=>function(e){let t=document.activeElement;for(;t;){if(t===e)return!0;t=t.parentElement}return!1}(e.root))||g().find(e=>document.activeElement===document.body&&e.root.hasFocus)}function g(){return Array.from(document.querySelectorAll(".fp-engine"))}function P(e,t){return!!function(e,t){return e.closest(t)}(e,t)}document.addEventListener("keydown",function(e){if(e.key===t.TAB)return w(e);const n=T();if(n)return function(e,n){const o=document.activeElement;if(e.key===t.F&&n.root.classList.contains("no-fullscreen"))return;if([t.SPACE,t.ARROW_DOWN,t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT].includes(e.key)||o&&P(o,".fp-menu-container")&&e.key===t.ENTER)return e.preventDefault(),W(e);w(e)}(e,n);const o=document.activeElement;[t.SPACE,t.ENTER,t.ARROW_DOWN,t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT].includes(e.key)&&o&&P(o,p)&&(e.preventDefault(),W(e))}),document.addEventListener("mousedown",function(e){const t=e.composedPath();g().forEach(e=>{e.setState("is-accessibility",!1),e.root.hasFocus=t.includes(e.root)})});const k=((h=class Keyboard{init(e,t,o){o.once("health:ready",()=>{v(o,{feature_name:"keyboard",behavior:"loaded",sample_rate:y})}),o.once("beforeplay",()=>{o===T()&&o.hasState("is-accessibility")&&o.once("playing",()=>{if(o!==T()||!o.hasState("is-accessibility"))return;const e=o.root.querySelector(".fp-small-pause");e&&(o.root.dispatchEvent(new Event(n)),e.focus())})})}}).pluginName="keyboard",h);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,k)});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.keyboard=t())}(this,function(){"use strict";function e(e,t,n){const o=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;o.length;){if(null==e)return n;const t=o.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}var t={TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",SPACE:" ",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",F:"f",H:"h",J:"j",K:"k",L:"l",M:"m"};const n="mousemove",o="fp-menu-container",r="details[open]."+o;function i(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector(r);n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}document.addEventListener("click",function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(i(),this.active_menu=void 0)});const a="is-kb-active";let s;function u(e){e.setState(a,!0),clearTimeout(s),s=setTimeout(function(){e.setState(a,!1)},2500)}function c(e,t){e.enqueueSeek(t)&&u(e)}const l="flowplayer-timeline-bar",f="flowplayer-volume-bar",d="flowplayer-wait",p="flowplayer-playlist-controls";const m="flowplayer-ad-ui";const R=1,y=.001;function v(e,{feature_name:t,behavior:n,sample_rate:o}){t&&(o||(o=R),e.emit("flowplayer:feature",{feature_name:t,behavior:n,sample_rate:o}))}const A=e=>{const t=e.closest(`.${o}`);return t?((e,t)=>{var n,o;const r=`${((null===(n=t.parentElement)||void 0===n?void 0:n.localName)||"")+">"+e.localName}>${t.open?"open":"closed"}`;return e instanceof HTMLSpanElement?r+">"+(e.textContent||""):e instanceof HTMLLIElement?r+">"+((null===(o=e.querySelector("span"))||void 0===o?void 0:o.textContent)||""):r})(e,t):e.closest(l)?l:e.closest(f)?f:e.closest(d)?d:e.closest(m)?m+">"+e.localName:e.localName},E=new WeakMap;function h(e,t,n){!function(e,t,n="used"){var o;const r=`${t}:${n}`,i=null!==(o=E.get(e))&&void 0!==o?o:new Set;if(i.has(r))return;i.add(r),E.set(e,i);const a=()=>v(e,{feature_name:t,behavior:n,sample_rate:y});e.opt("metadata.media_id")?a():e.once("health:ready",a)}(e,"keyboard");const o=function(e){return" "===e?"space":e}(t),r={};n&&(r.focused_element=A(n));const i=((e,t,n={})=>{const o=t.join(","),r=Object.entries(n).map(([e,t])=>`${e}=${t}`).join(",");return r?`${e}:${o}:${r}`:`${e}:${o}`})("key",[o],r);v(e,{feature_name:"keyboard",behavior:i,sample_rate:y})}var S;const _=[t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT,t.ARROW_DOWN],O=[t.SPACE,t.F,t.ESCAPE,t.M,t.ARROW_UP,t.ARROW_DOWN,t.ARROW_RIGHT,t.ARROW_LEFT,t.H,t.J,t.K,t.L];function b(e,t){e.volume=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.volume+t,1,0),u(e)}function W(e){e.preventDefault(),e.stopPropagation()}function w(o){const r=o.key,a=T(),s=document.activeElement;if(!s)return;if(r===t.TAB)return function(){var e,t,o;const r=document.activeElement;if(!r)return;const i=null===(e=r.closest(".flowplayer"))||void 0===e?void 0:e.querySelector(".fp-engine");if(P().forEach(e=>{e.root.hasFocus=i===e,e.setState("is-accessibility",i===e)}),!i)return;if(i.root.dispatchEvent(new Event(n)),!function(e){var t,n;return!(!e.hasState("ad-paused")&&!e.hasState("ad-playing")||!(null===(n=null===(t=null==e?void 0:e.ads)||void 0===t?void 0:t.adapter)||void 0===n?void 0:n.isLinearAd()))}(i)||k(r,m))return;const a=i.root.querySelector(m);if(!a)return;if(i.hasState("ad-playing"))return null===(t=a.querySelector(".fp-small-pause"))||void 0===t?void 0:t.focus();if(i.hasState("ad-paused"))return null===(o=a.querySelector(".fp-small-play"))||void 0===o?void 0:o.focus()}();if((r===t.SPACE||r===t.ENTER)&&s.hasAttribute("tabindex")&&(k(s,".flowplayer")||k(s,p)))return a&&h(a,r,s),null==s||s.dispatchEvent(new CustomEvent("click",{cancelable:!0,bubbles:!0})),W(o);if((r===t.ARROW_DOWN||r===t.ARROW_UP||r===t.ESCAPE)&&(k(s,".fp-menu-container")||k(s,p))){if(r===t.ARROW_DOWN&&s.nextSibling)return a&&h(a,r,s),s.nextSibling.focus();if(r===t.ARROW_UP&&s.previousSibling)return a&&h(a,r,s),s.previousSibling.focus();if(r===t.ESCAPE){a&&h(a,r,s);const e=new CustomEvent("keyboard:close:menus",{cancelable:!0});if(null==a||a.dispatchEvent(e),e.defaultPrevented)return;return i()}}if(!a)return;let u=e(a,"opts.keyboard.seek_step",5);if(u<1&&(u=Math.round(u*a.duration)),~_.indexOf(r)&&s.hasAttribute("aria-valuenow")){const e=~[t.ARROW_UP,t.ARROW_RIGHT].indexOf(r);if(s.matches(".fp-volume"))return h(a,r,s),b(a,e?.15:-.15),W(o);if(s.matches(".fp-timeline"))return h(a,r,s),c(a,e?u:-1*u),W(o)}if(!1===function(e,t){return!(t.altKey||t.shiftKey||t.metaKey||t.ctrlKey)&&!!(e&&e.hasState("is-in-viewport")&&e.started)&&!!e.root&&void 0}(a,o))return;const l=!a.hasState("no-timeline");switch(~O.indexOf(r)&&o.preventDefault(),r){case t.SPACE:return h(a,r,s),a.togglePlay();case t.F:return h(a,r,s),a.toggleFullScreen();case t.ESCAPE:return a.hasState("is-fullscreen")?(h(a,r,s),a.toggleFullScreen(!1)):void 0;case t.M:return h(a,r,s),a.toggleMute();case t.ARROW_UP:case t.K:return h(a,r,s),b(a,.15);case t.ARROW_DOWN:case t.J:return h(a,r,s),b(a,-.15);case t.ARROW_RIGHT:case t.L:return h(a,r,s),l&&c(a,u);case t.ARROW_LEFT:case t.H:return h(a,r,s),l&&c(a,-1*u)}}function g(e){setTimeout(function(){e.defaultPrevented||w(e)},0)}function T(){return P().find(e=>function(e){let t=document.activeElement;for(;t;){if(t===e)return!0;t=t.parentElement}return!1}(e.root))||P().find(e=>document.activeElement===document.body&&e.root.hasFocus)}function P(){return Array.from(document.querySelectorAll(".fp-engine"))}function k(e,t){return!!function(e,t){return e.closest(t)}(e,t)}document.addEventListener("keydown",function(e){if(e.key===t.TAB)return g(e);const n=T();if(n)return function(e,n){const o=document.activeElement;if(e.key===t.F&&n.root.classList.contains("no-fullscreen"))return;if([t.SPACE,t.ARROW_DOWN,t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT].includes(e.key)||o&&k(o,".fp-menu-container")&&e.key===t.ENTER)return e.preventDefault(),w(e);g(e)}(e,n);const o=document.activeElement;[t.SPACE,t.ENTER,t.ARROW_DOWN,t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT].includes(e.key)&&o&&k(o,p)&&(e.preventDefault(),w(e))}),document.addEventListener("mousedown",function(e){const t=e.composedPath();P().forEach(e=>{e.setState("is-accessibility",!1),e.root.hasFocus=t.includes(e.root)})});const x=((S=class Keyboard{init(e,t,o){o.once("beforeplay",()=>{o===T()&&o.hasState("is-accessibility")&&o.once("playing",()=>{if(o!==T()||!o.hasState("is-accessibility"))return;const e=o.root.querySelector(".fp-small-pause");e&&(o.root.dispatchEvent(new Event(n)),e.focus())})})}}).pluginName="keyboard",S);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,x)});
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.media_session=t())}(this,function(){"use strict";const e="is-kb-active";let t;function n(n,i){n.enqueueSeek(i)&&function(n){n.setState(e,!0),clearTimeout(t),t=setTimeout(function(){n.setState(e,!1)},2500)}(n)}const i="seekbackward",o="seekforward",a="seekto",s="pause",l="playing",r="seeked",c="playlist:next",u="is-playing",d="no-timeline";var f;let p;function y(e){e.data&&m(e.data)}function m(e){var t,n,i;const o=null!==(t=e.media_session)&&void 0!==t?t:{};if(null!==(n=o.title)&&void 0!==n||(o.title=e.title),null==o.artwork){const t=null!==(i=e.poster)&&void 0!==i?i:"";o.artwork=[{src:t,sizes:"512x512"},{src:t,sizes:"256x256"}]}navigator.mediaSession.metadata=new MediaMetadata(o)}function k(){const e=navigator.mediaSession;if(null==e.setPositionState)return;const t=p;t&&(e.setPositionState({duration:Math.round(t.duration||0),playbackRate:t.hasState(u)?t.playbackRate:.001,position:Math.round(t.currentTime)}),e.playbackState=t.hasState(u)?"playing":"paused")}function g(e){const t=p,s=navigator.mediaSession;if(t){if(s.setActionHandler("play",function(){t.togglePlay()}),s.setActionHandler("pause",function(){t.togglePlay()}),"playlist"in t){const e=t.playlist;s.setActionHandler("nexttrack",function(){e&&e.next()}),s.setActionHandler("previoustrack",function(){e&&e.prev()})}!function(e,t){var s,l;const r=null===(s=t.seekable)||void 0===s||s;if(!r||e.hasState(d))return;const c=navigator.mediaSession,u=null!==(l=t.seek_step)&&void 0!==l?l:5;e.disabled||c.setActionHandler(o,function(){n(e,u)});c.setActionHandler(i,function(){n(e,-u)});try{c.setActionHandler(a,function(t){"number"==typeof t.seekTime&&(t.seekTime>e.currentTime&&e.disabled?k():t&&t.seekTime<e.duration&&(e.currentTime=t.seekTime))})}catch(e){}}(t,e)}}const v=((f=class MediaSession{init(e,t,n){null!=navigator.mediaSession&&n.on(["loadstart",l,"fullscreenenter"],function(){let t=p;n!==t&&(t&&(["ratechange",r,l,s].forEach(e=>{t&&t.off(e,k)}),t.off(c,y),t=void 0),p=n,m(e),g(e),k(),n.on(["ratechange",r,l,s],k),n.on(c,y))})}}).pluginName="media-session",f);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,v)});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.media_session=t())}(this,function(){"use strict";const e="is-kb-active";let t;function n(n,a){n.enqueueSeek(a)&&function(n){n.setState(e,!0),clearTimeout(t),t=setTimeout(function(){n.setState(e,!1)},2500)}(n)}const a="seekbackward",i="seekforward",o="seekto",s="pause",r="playing",l="seeked",u="playlist:next",c="is-playing",d="no-timeline",f=1,p=.001;const m=new WeakMap;function y(e,t,n="used"){var a;const i=`${t}:${n}`,o=null!==(a=m.get(e))&&void 0!==a?a:new Set;if(o.has(i))return;o.add(i),m.set(e,o);const s=()=>function(e,{feature_name:t,behavior:n,sample_rate:a}){t&&(a||(a=f),e.emit("flowplayer:feature",{feature_name:t,behavior:n,sample_rate:a}))}(e,{feature_name:t,behavior:n,sample_rate:p});e.opt("metadata.media_id")?s():e.once("health:ready",s)}var v;let k;function h(e){e.data&&g(e.data)}function g(e){var t,n,a;const i=null!==(t=e.media_session)&&void 0!==t?t:{};if(null!==(n=i.title)&&void 0!==n||(i.title=e.title),null==i.artwork){const t=null!==(a=e.poster)&&void 0!==a?a:"";i.artwork=[{src:t,sizes:"512x512"},{src:t,sizes:"256x256"}]}navigator.mediaSession.metadata=new MediaMetadata(i)}function S(){const e=navigator.mediaSession;if(null==e.setPositionState)return;const t=k;t&&(e.setPositionState({duration:Math.round(t.duration||0),playbackRate:t.hasState(c)?t.playbackRate:.001,position:Math.round(t.currentTime)}),e.playbackState=t.hasState(c)?"playing":"paused")}function b(e){const t=k,s=navigator.mediaSession;if(t){if(s.setActionHandler("play",function(){t.togglePlay()}),s.setActionHandler("pause",function(){t.togglePlay()}),"playlist"in t){const e=t.playlist;s.setActionHandler("nexttrack",function(){e&&e.next()}),s.setActionHandler("previoustrack",function(){e&&e.prev()})}!function(e,t){var s,r;const l=null===(s=t.seekable)||void 0===s||s;if(!l||e.hasState(d))return;const u=navigator.mediaSession,c=null!==(r=t.seek_step)&&void 0!==r?r:5;e.disabled||u.setActionHandler(i,function(){n(e,c)});u.setActionHandler(a,function(){n(e,-c)});try{u.setActionHandler(o,function(t){"number"==typeof t.seekTime&&(t.seekTime>e.currentTime&&e.disabled?S():t&&t.seekTime<e.duration&&(e.currentTime=t.seekTime))})}catch(e){}}(t,e)}}const w=((v=class MediaSession{init(e,t,n){null!=navigator.mediaSession&&n.on(["loadstart",r,"fullscreenenter"],function(){let t=k;n!==t&&(t&&(["ratechange",l,r,s].forEach(e=>{t&&t.off(e,S)}),t.off(u,h),t=void 0),k=n,g(e),b(e),y(n,"media-session"),S(),n.on(["ratechange",l,r,s],S),n.on(u,h))})}}).pluginName="media-session",v);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,w)});
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.message=t())}(this,function(){"use strict";const e="message:show",t="message:dismiss";var n,s=Object.freeze({__proto__:null,SHOW_MESSAGE:e,DISMISS_MESSAGE:t});const o=/<trans(.*)trans>/,i=((n=class Message{init(s,i,a){let f="";a.on(e,function(e){var n,s,l;const r=null===(n=e.data)||void 0===n?void 0:n.sticky,u=null===(s=e.data)||void 0===s?void 0:s.timeout;let d=(null===(l=e.data)||void 0===l?void 0:l.message)||"";if(d==f)return;if(f=d||"",o.test(d)){const e=(o.exec(d)||["",""])[1].trim();d=a.i18n(e,e)}const c=document.createElement("div");c.classList.add("fp-message");const p=document.createElement("p");p.innerText=d,c.append(p),i.append(c),setTimeout(function(){c.classList.add("fp-shown")},100),r||setTimeout(function(){a.emit(t,c)},u)}),a.on(t,function(e){f="";const t=e.data;t&&(t.classList.remove("fp-shown"),setTimeout(function(){t.remove()},1e3))}),a.message={events:n.events}}}).pluginName="message",n.events=s,n);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,i)});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.message=t())}(this,function(){"use strict";const e="message:show",t="message:dismiss";var n=Object.freeze({__proto__:null,SHOW_MESSAGE:e,DISMISS_MESSAGE:t});const s=1,o=.001;const a=new WeakMap;function i(e,t,n="used"){var i;const r=`${t}:${n}`,f=null!==(i=a.get(e))&&void 0!==i?i:new Set;if(f.has(r))return;f.add(r),a.set(e,f);const l=()=>function(e,{feature_name:t,behavior:n,sample_rate:o}){t&&(o||(o=s),e.emit("flowplayer:feature",{feature_name:t,behavior:n,sample_rate:o}))}(e,{feature_name:t,behavior:n,sample_rate:o});e.opt("metadata.media_id")?l():e.once("health:ready",l)}var r;const f=/<trans(.*)trans>/,l=((r=class Message{init(n,s,o){let a="";o.on(e,function(e){var n,r,l;const u=null===(n=e.data)||void 0===n?void 0:n.sticky,d=null===(r=e.data)||void 0===r?void 0:r.timeout;let c=(null===(l=e.data)||void 0===l?void 0:l.message)||"";if(c==a)return;if(a=c||"",i(o,"message"),f.test(c)){const e=(f.exec(c)||["",""])[1].trim();c=o.i18n(e,e)}const m=document.createElement("div");m.classList.add("fp-message");const p=document.createElement("p");p.innerText=c,m.append(p),s.append(m),setTimeout(function(){m.classList.add("fp-shown")},100),u||setTimeout(function(){o.emit(t,m)},d)}),o.on(t,function(e){a="";const t=e.data;t&&(t.classList.remove("fp-shown"),setTimeout(function(){t.remove()},1e3))}),o.message={events:r.events}}}).pluginName="message",r.events=n,r);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,l)});
@@ -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";const t="is-interstitial",e="playlist:next",n="playlist:ended",s="playlist:ready",i="playlist:loop",l="playlist:add",o="playlist:remove",a="interstitial/end",r="interstitial/cancel",c="interstitial/next_item";var u=Object.freeze({__proto__:null,PLAYLIST_NEXT:e,PLAYLIST_ENDED:n,PLAYLIST_READY:s,PLAYLIST_PREVIOUS:"playlist:previous",PLAYLIST_SELECTION:"playlist:selection",PLAYLIST_LOOP:i,PLAYLIST_ADD:l,PLAYLIST_REMOVE:o,INTERSTITIAL_END:a,INTERSTITIAL_CANCEL:r,INTERSTITIAL_NEXT_ITEM:c});const p={translation_key:"core.skip-next",name:"fp-skip-next"},d={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 y(t,e){if(!e)throw new Error(t)}function m(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 f(t,e){Pipe.of(t).fmap(m).fmap(y,e)}function h(t){return void 0!==t}function v(t){return"string"==typeof t}function b(t){return"object"==typeof t}function E(t){return t instanceof HTMLElement}function x(t){var e;f("Config must be an Object",h(t)&&b(t)),f("property `playlist` is required",h(t.playlist)),f("property `playlist` was not a String(MediaId)",v(t.playlist)||(e=t.playlist,f("playlist property was not of type PlaylistId|Array(MediaId|PlayConfig)",Array.isArray(e)),f("playlist property cannot be an empty Array",e.length>0),!e.forEach(function(t,e){f("item at playlist["+e+"] was not valid",v(t)||b(t))}))),"loop shuffle".split(" ").forEach(function(e){h(t[e])&&f(e+" must be a boolean value if present","boolean"==typeof t[e])}),h(t.delay)&&f("property `delay` must be a Number (Milliseconds)","number"==typeof t.delay)}function g(t){try{x(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 w=["title","delay","description","poster","src"];class UpNext extends FlowplayerComponent{static get observedAttributes(){return w}constructor(t){super(t),this.classList.add("up-next"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent(a))}),this.addEventListener("animationcancel",()=>{this.classList.add("cancelled"),this.dispatchEvent(new CustomEvent(r))}),this.addEventListener(c,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(),s=document.createElement("div");s.classList.add("pane","left");const i=document.createElement("div");i.classList.add("pane","right"),n.append(s,i);const l=document.createElement("div");l.classList.add("poster"),l.style.backgroundImage="url("+this.getPoster()+")",s.append(l),l.addEventListener("click",()=>this.dispatchEvent(new CustomEvent(a)));const o=document.createElement("span");o.classList.add("fp-icon","fp-play"),l.append(o);const r=document.createElement("span");r.classList.add("title"),r.textContent=this.getTitle();const c=document.createElement("span");c.classList.add("description"),c.textContent=this.getDescription();const u=document.createElement("span");u.classList.add("countdown"),this.getDelay()&&(u.style.setProperty("--up-next-delay",this.getDelay()+"s"),u.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",()=>u.classList.remove("go")),i.append(r,c,p,u),this.append(n)}_setUpNext(t){var e,n,s;const i=t.detail.next,l=this.player.opt("playlist.delay",void 0)||10;this.setAttribute("title",null!==(e=i.title)&&void 0!==e?e:""),this.setAttribute("description",null!==(n=i.description)&&void 0!==n?n:""),this.setAttribute("poster",null!==(s=i.poster)&&void 0!==s?s:""),this.setAttribute("delay",l+"")}}const L=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const s=window.customElements.get(e);if(!s)throw new Error(`no default flowplayer component with the name ${e} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(t._customElements,e))(t),_=(t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)};function A(t,e,n){const s=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;s.length;){if(null==t)return n;const e=s.shift();if("string"!=typeof e)return n;t=t[e]}return null==t?n:t}function P(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}const I="flowplayer-playlist-interstitial",q="flowplayer-skip-next-icon",O="flowplayer-skip-previous-icon",N="flowplayer-playlist-controls";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(s,e=>{const n=e.detail.queue;n&&(this.list(n,t),this.classList.toggle("is-empty",!n.members.length))}),t.on(e,()=>{var e;(null===(e=t.playlist)||void 0===e?void 0:e.queue)&&Array.from(this.querySelectorAll("li")).forEach((e,n)=>{var s;const i=n===(null===(s=t.playlist)||void 0===s?void 0:s.queue.idx);e.classList.toggle("is-current",i),e.setAttribute("aria-current",""+i)})}),t.on(l,e=>{var n;const s=null===(n=t.playlist)||void 0===n?void 0:n.queue;if(!e.data||!s)return;e.data.members.forEach(e=>{const n=this.videoRow(e,t);n&&this.playlistWrapper.append(n)})}),t.on(o,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 s=this.itemHeader(t,e),i=this.itemContent(e);return n.append(s,i),n}itemContent(t){var e,n;const s=document.createElement("div");s.className="fp-playlist-controls-item-content";const i=document.createElement("div");i.className="fp-playlist-controls-item-title",i.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)||"",s.append(i,l),s}itemHeader(t,e){var n,s;const i=document.createElement("div");i.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),i.append(l,o);const c=e.duration||(null===(s=e.metadata)||void 0===s?void 0:s.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 s=Math.floor(t/60);return t-=60*s,n>=1?(s-=60*n,e+n+":"+P(s)+":"+P(t)):e+P(s)+":"+P(t)}(c):"",i.append(t)}return i}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 l=document.createElement("label");l.className="fp-playlist-toggle-label",l.tabIndex=0,l.setAttribute("role","button"),l.setAttribute("for","toggle");const o=document.createElement("span");o.className="fp-playlist-toggle-title",o.textContent=t.i18n("playlist.autoplay","Autoplay");const a=document.createElement("div");return a.className="fp-playlist-toggle",a.append(o,i,l),l.addEventListener("click",e=>{e.preventDefault();const n=!i.checked;i.checked=n;const s=t.opts;s.playlist||(s.playlist={}),Object.assign(s.playlist,{advance:n}),l.ariaPressed=n+"",l.ariaLabel=n?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay")}),t.on(s,()=>{var e,s;const o=t.opts,a=null===(e=null==o?void 0:o.playlist)||void 0===e?void 0:e.advance;i.checked=!1!==a,l.ariaPressed=`${!1!==a}`,l.ariaLabel=!1!==a?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay"),n.textContent=(null===(s=o.playlist)||void 0===s?void 0:s.playlist_title)||t.i18n("playlist.playlist","Playlist")}),e.append(n,a),e}videoRow_onclick(t,e){var n;if(t.classList.contains("is-current"))return;const s=Array.from(this.querySelectorAll("li")).indexOf(t);-1!==s&&(null===(n=e.playlist)||void 0===n||n.play(s))}}const T="click",C="canplay";var S;function k(t,e){var n,s;const i=e.sort||H,l=null!==(n=e.mode)&&void 0!==n?n:S.FIFO;return t=i(t.slice(0),l),{mode:l,sort:i,members:t,last_idx:t.length-1,plays:null!==(s=e.plays)&&void 0!==s?s:0,idx:-1}}function F(t){return t.idx==t.last_idx}function M(t){const e=t.idx+1;return e>t.last_idx?0:e}function j(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 H(t,e){return(e&S.SHUFFLE)==S.SHUFFLE?t.sort(function(){return Math.random()-Math.random()}):t.slice(0)}function D(t){return k(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"}(S||(S={})),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 R=["touchstart","touchmove"];function U(t,e,n){const s=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(s),t}function Y(t,e,n,s){Array.isArray(e)?e.forEach(e=>W(t,e,n,s)):W(t,e,n,s)}function W(t,e,n,s){if(i=e,!~R.indexOf(i))return t.addEventListener(e,n,s),t;var i;const l=Object.assign(s||{},{passive:!0});return t.addEventListener(e,n,l),t}function B(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}function $(t,e,n){return t.setAttribute(e,n),t}function X(t,e,n){return e.split(" ").forEach(e=>t.classList.toggle(e,n)),t}function V(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}function z(e,n,s){const i=n.idx+n.plays<0;if(!i&&s.delay)return function(e,n){var s;const i=null===(s=e.playlist)||void 0===s?void 0:s.queue,l=B(e,I);if(!l||!i||!n.delay)return;e.root.classList.add(t);const o=i.members[M(i)];U(l,c,{next:o})}(e,s);G(e,j(n,i,s.start_index),i)}function G(t,n,s){s||(t.preload=n.preload="auto",!t.opts.autoplay&&t.setOpts({autoplay:1})),t.emit("playlist/advance"),"object"==typeof n&&t.setOpts(n),function(t,n){var s;const i=null===(s=t.playlist)||void 0===s?void 0:s.queue;if(!i)return;const l=i.idx,o=i.members[l],a=t.currentSrc;if(o.src&&t.setSrc(o.src),t.emit(e,{next_index:l}),t.opts.autoplay||n)return;const r=n=>{(n.type===C&&a!==t.currentSrc||n.type===e)&&(t.removeEventListener(C,r),t.removeEventListener(e,r),n.type===C&&t.togglePlay(!0))};t.on([C,e],r)}(t,s)}function J(e,n){return{queue:n,events:u,play:function(t){t<0||t>=n.members.length||(this.queue.idx=t,G(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(o,{index:t})):console.warn("there is no playlist item at this index")},push:function(...n){const s=e.root;if(0==this.queue.idx&&s.classList.contains(t))return console.warn("new items cannot be added when playlist has ended.");const i=this.queue.members;i.push(...n),this.queue.last_idx=i.length-1,e.emit(l,{members:n})},clear:function(){this.queue.members=[],this.queue.plays--,function(t,e){t.playlist&&(e=t.playlist.queue=D(e),t.emit(s,{queue:e,should_play:!1}))}(e,this.queue)}}}function K(t){const n=L(t,O);$(n,"role","button"),Y(n,T,function(){t.playlist&&t.playlist.prev()});const s=L(t,q);$(s,"role","button"),Y(s,T,function(){t.playlist&&t.playlist.next()});const i=V("fp-playlist-prev-preview"),a=V("fp-playlist-next-preview"),r=B(t,"flowplayer-control-buttons");return r&&(r.prepend(n),r.append(s),r.append(i),r.append(a)),t.on("reap",function(){t.skip_controls=void 0}),t.on([e,l,o],function(e){const n=A(e,"data.queue",A(t,"playlist.queue"));if(!n||!r||!t.skip_controls)return;X(r,"is-prev-button-disabled",!n.idx),X(r,"is-next-button-disabled",n.idx===n.last_idx);const s=n.idx<n.last_idx?function(t){if(!F(t)||0!==(t.mode&S.LOOP))return t.members[M(t)]}(n):null,l=n.idx>0?function(t){if(0!==t.idx||0!==(t.mode&S.LOOP))return t.members[function(t){const e=t.idx-1;return e<0?t.last_idx:e}(t)]}(n):null;a.style.backgroundImage=["url(",s?s.poster:null,")"].join(""),i.style.backgroundImage=["url(",l?l.poster:null,")"].join("")}),{prevButton:n,nextButton:s,prevPreview:i,nextPreview:a}}function Q(t,e){if(!e)return;!1!==e.skip_controls&&(t.skip_controls=K(t));const n=function(t){let e=null;if(n=t.controls,!v(n)&&!E(n))return;var n;E(t.controls)?e=t.controls:v(t.controls)&&(e=document.querySelector(t.controls));return y("Could not find controls by Selector["+t.controls+"]",E(e)),e}(e);if(!n)return;const s=L(t,N);n.append(s)}function Z(t,e,n){if(Array.isArray(e))return n(function(t,e){let n=e.shuffle?S.SHUFFLE:S.FIFO;return e.loop&&(n|=S.LOOP),k(t,{mode:n,sort:e.sort})}(e,t));throw new Error("config.playlist must be an Array")}function tt(e){var l;e.on(s,function(t){var n,s;const i=e.opt("playlist",{}),l=null===(n=t.detail)||void 0===n?void 0:n.queue,o=null===(s=t.detail)||void 0===s?void 0:s.should_play;l&&i&&(e.playlist=J(e,l),o&&z(e,l,i))}),e.on("ended",(l=()=>{const t=e.opt("playlist");if(e.playlist&&t)return F(e.playlist.queue)?function(t,e){if(t.emit(n),!e.loop)return;if(!t.playlist)return;const l=t.playlist.queue=D(t.playlist.queue);if(t.emit(i),!e.shuffle)return z(t,l,e);t.emit(s,{queue:l,should_play:!0})}(e,t):void(!1!==t.advance&&z(e,e.playlist.queue,t))},t=>{setTimeout(function(){if(!t.defaultPrevented&&!t.prevented)return l(t)},0)})),e.on(["playing","waiting","seeking","src"],function(){if(!e.root.classList.contains(t))return;const n=B(e,I);n&&U(n,r)})}const et=1,nt=.1;const st=(t,e)=>{t.once("health:ready",()=>{var n;if(null==e?void 0:e.controls){const e=null===(n=t.root)||void 0===n?void 0:n.closest("div.fp-playlist-layout");let s;s=e?e.classList.contains("right")?"right":e.classList.contains("left")?"left":"default":"custom",function(t,{feature_name:e,behavior:n,sample_rate:s}){e&&(s||(s=et),t.emit("flowplayer:feature",{feature_name:e,behavior:n,sample_rate:s}))}(t,{behavior:"playlist-ui-enhancement",feature_name:`positioning-${s}`,sample_rate:nt})}})};var it;const lt=(it=class Playlist{constructor(t){_(t,N,FlowplayerPlaylistControls),_(t,I,class extends UpNext{constructor(t){super(t),this.classList.add("fp-interstitial")}}),_(t,q,class extends FlowplayerIcon{constructor(t){super(t,p)}}),_(t,O,class extends FlowplayerIcon{constructor(t){super(t,d)}})}init(e,n,s){const i=e.playlist||{};i.delay="number"==typeof i.delay?i.delay:5,s.setOpts(Object.assign(Object.assign({},e),{playlist:i})),Q(s,e.playlist),function(e){var n;const s=L(e,I);s.addEventListener(r,()=>e.root.classList.remove(t)),s.addEventListener(a,()=>{var n;e.root.classList.remove(t);const s=null===(n=e.playlist)||void 0===n?void 0:n.queue;s&&G(e,j(s,!1))}),null===(n=B(e,"flowplayer-ui"))||void 0===n||n.prepend(s)}(s),tt(s),st(s,e.playlist)}onload(t,e,n,i){Z(t.playlist||{},i.items,function(t){n.setState("is-playlist",!0),n.emit(s,{queue:t,should_play:0===n.currentSrc.length})})}wants(t,e,n){return"flowplayer/playlist"==e.type&&!!e.items&&g(Object.assign(Object.assign({},n),{playlist:e.items}))}},it.pluginName="playlist",it.events=u,it);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,lt)});
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";const t="is-interstitial",e="playlist:next",n="playlist:ended",s="playlist:ready",i="playlist:loop",l="playlist:add",o="playlist:remove",a="interstitial/end",r="interstitial/cancel",c="interstitial/next_item";var u=Object.freeze({__proto__:null,PLAYLIST_NEXT:e,PLAYLIST_ENDED:n,PLAYLIST_READY:s,PLAYLIST_PREVIOUS:"playlist:previous",PLAYLIST_SELECTION:"playlist:selection",PLAYLIST_LOOP:i,PLAYLIST_ADD:l,PLAYLIST_REMOVE:o,INTERSTITIAL_END:a,INTERSTITIAL_CANCEL:r,INTERSTITIAL_NEXT_ITEM:c});const p={translation_key:"core.skip-next",name:"fp-skip-next"},d={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 y(t,e){if(!e)throw new Error(t)}function m(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 f(t,e){Pipe.of(t).fmap(m).fmap(y,e)}function h(t){return void 0!==t}function v(t){return"string"==typeof t}function b(t){return"object"==typeof t}function E(t){return t instanceof HTMLElement}function x(t){var e;f("Config must be an Object",h(t)&&b(t)),f("property `playlist` is required",h(t.playlist)),f("property `playlist` was not a String(MediaId)",v(t.playlist)||(e=t.playlist,f("playlist property was not of type PlaylistId|Array(MediaId|PlayConfig)",Array.isArray(e)),f("playlist property cannot be an empty Array",e.length>0),!e.forEach(function(t,e){f("item at playlist["+e+"] was not valid",v(t)||b(t))}))),"loop shuffle".split(" ").forEach(function(e){h(t[e])&&f(e+" must be a boolean value if present","boolean"==typeof t[e])}),h(t.delay)&&f("property `delay` must be a Number (Milliseconds)","number"==typeof t.delay)}function g(t){try{x(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 w=["title","delay","description","poster","src"];class UpNext extends FlowplayerComponent{static get observedAttributes(){return w}constructor(t){super(t),this.classList.add("up-next"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent(a))}),this.addEventListener("animationcancel",()=>{this.classList.add("cancelled"),this.dispatchEvent(new CustomEvent(r))}),this.addEventListener(c,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(),s=document.createElement("div");s.classList.add("pane","left");const i=document.createElement("div");i.classList.add("pane","right"),n.append(s,i);const l=document.createElement("div");l.classList.add("poster"),l.style.backgroundImage="url("+this.getPoster()+")",s.append(l),l.addEventListener("click",()=>this.dispatchEvent(new CustomEvent(a)));const o=document.createElement("span");o.classList.add("fp-icon","fp-play"),l.append(o);const r=document.createElement("span");r.classList.add("title"),r.textContent=this.getTitle();const c=document.createElement("span");c.classList.add("description"),c.textContent=this.getDescription();const u=document.createElement("span");u.classList.add("countdown"),this.getDelay()&&(u.style.setProperty("--up-next-delay",this.getDelay()+"s"),u.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",()=>u.classList.remove("go")),i.append(r,c,p,u),this.append(n)}_setUpNext(t){var e,n,s;const i=t.detail.next,l=this.player.opt("playlist.delay",void 0)||10;this.setAttribute("title",null!==(e=i.title)&&void 0!==e?e:""),this.setAttribute("description",null!==(n=i.description)&&void 0!==n?n:""),this.setAttribute("poster",null!==(s=i.poster)&&void 0!==s?s:""),this.setAttribute("delay",l+"")}}const L=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const s=window.customElements.get(e);if(!s)throw new Error(`no default flowplayer component with the name ${e} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(t._customElements,e))(t),_=(t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)};function A(t,e,n){const s=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;s.length;){if(null==t)return n;const e=s.shift();if("string"!=typeof e)return n;t=t[e]}return null==t?n:t}function P(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}const I="flowplayer-playlist-interstitial",q="flowplayer-skip-next-icon",O="flowplayer-skip-previous-icon",N="flowplayer-playlist-controls";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(s,e=>{const n=e.detail.queue;n&&(this.list(n,t),this.classList.toggle("is-empty",!n.members.length))}),t.on(e,()=>{var e;(null===(e=t.playlist)||void 0===e?void 0:e.queue)&&Array.from(this.querySelectorAll("li")).forEach((e,n)=>{var s;const i=n===(null===(s=t.playlist)||void 0===s?void 0:s.queue.idx);e.classList.toggle("is-current",i),e.setAttribute("aria-current",""+i)})}),t.on(l,e=>{var n;const s=null===(n=t.playlist)||void 0===n?void 0:n.queue;if(!e.data||!s)return;e.data.members.forEach(e=>{const n=this.videoRow(e,t);n&&this.playlistWrapper.append(n)})}),t.on(o,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 s=this.itemHeader(t,e),i=this.itemContent(e);return n.append(s,i),n}itemContent(t){var e,n;const s=document.createElement("div");s.className="fp-playlist-controls-item-content";const i=document.createElement("div");i.className="fp-playlist-controls-item-title",i.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)||"",s.append(i,l),s}itemHeader(t,e){var n,s;const i=document.createElement("div");i.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),i.append(l,o);const c=e.duration||(null===(s=e.metadata)||void 0===s?void 0:s.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 s=Math.floor(t/60);return t-=60*s,n>=1?(s-=60*n,e+n+":"+P(s)+":"+P(t)):e+P(s)+":"+P(t)}(c):"",i.append(t)}return i}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 l=document.createElement("label");l.className="fp-playlist-toggle-label",l.tabIndex=0,l.setAttribute("role","button"),l.setAttribute("for","toggle");const o=document.createElement("span");o.className="fp-playlist-toggle-title",o.textContent=t.i18n("playlist.autoplay","Autoplay");const a=document.createElement("div");return a.className="fp-playlist-toggle",a.append(o,i,l),l.addEventListener("click",e=>{e.preventDefault();const n=!i.checked;i.checked=n;const s=t.opts;s.playlist||(s.playlist={}),Object.assign(s.playlist,{advance:n}),l.ariaPressed=n+"",l.ariaLabel=n?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay")}),t.on(s,()=>{var e,s;const o=t.opts,a=null===(e=null==o?void 0:o.playlist)||void 0===e?void 0:e.advance;i.checked=!1!==a,l.ariaPressed=`${!1!==a}`,l.ariaLabel=!1!==a?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay"),n.textContent=(null===(s=o.playlist)||void 0===s?void 0:s.playlist_title)||t.i18n("playlist.playlist","Playlist")}),e.append(n,a),e}videoRow_onclick(t,e){var n;if(t.classList.contains("is-current"))return;const s=Array.from(this.querySelectorAll("li")).indexOf(t);-1!==s&&(null===(n=e.playlist)||void 0===n||n.play(s))}}const S="click",T="canplay";var C;function k(t,e){var n,s;const i=e.sort||H,l=null!==(n=e.mode)&&void 0!==n?n:C.FIFO;return t=i(t.slice(0),l),{mode:l,sort:i,members:t,last_idx:t.length-1,plays:null!==(s=e.plays)&&void 0!==s?s:0,idx:-1}}function F(t){return t.idx==t.last_idx}function M(t){const e=t.idx+1;return e>t.last_idx?0:e}function j(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 H(t,e){return(e&C.SHUFFLE)==C.SHUFFLE?t.sort(function(){return Math.random()-Math.random()}):t.slice(0)}function D(t){return k(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"}(C||(C={})),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 R=["touchstart","touchmove"];function U(t,e,n){const s=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(s),t}function Y(t,e,n,s){Array.isArray(e)?e.forEach(e=>W(t,e,n,s)):W(t,e,n,s)}function W(t,e,n,s){if(i=e,!~R.indexOf(i))return t.addEventListener(e,n,s),t;var i;const l=Object.assign(s||{},{passive:!0});return t.addEventListener(e,n,l),t}function $(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}function B(t,e,n){return t.setAttribute(e,n),t}function X(t,e,n){return e.split(" ").forEach(e=>t.classList.toggle(e,n)),t}function V(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}function z(e,n,s){const i=n.idx+n.plays<0;if(!i&&s.delay)return function(e,n){var s;const i=null===(s=e.playlist)||void 0===s?void 0:s.queue,l=$(e,I);if(!l||!i||!n.delay)return;e.root.classList.add(t);const o=i.members[M(i)];U(l,c,{next:o})}(e,s);G(e,j(n,i,s.start_index),i)}function G(t,n,s){s||(t.preload=n.preload="auto",!t.opts.autoplay&&t.setOpts({autoplay:1})),t.emit("playlist/advance"),"object"==typeof n&&t.setOpts(n),function(t,n){var s;const i=null===(s=t.playlist)||void 0===s?void 0:s.queue;if(!i)return;const l=i.idx,o=i.members[l],a=t.currentSrc;if(o.src&&t.setSrc(o.src),t.emit(e,{next_index:l}),t.opts.autoplay||n)return;const r=n=>{(n.type===T&&a!==t.currentSrc||n.type===e)&&(t.removeEventListener(T,r),t.removeEventListener(e,r),n.type===T&&t.togglePlay(!0))};t.on([T,e],r)}(t,s)}const J="health:ready",K=1,Q=.1,Z=.001;function tt(t,{feature_name:e,behavior:n,sample_rate:s}){e&&(s||(s=K),t.emit("flowplayer:feature",{feature_name:e,behavior:n,sample_rate:s}))}const et=new WeakMap;function nt(e,n){return{queue:n,events:u,play:function(t){t<0||t>=n.members.length||(!function(t,e,n="used"){var s;const i=`${e}:${n}`,l=null!==(s=et.get(t))&&void 0!==s?s:new Set;if(l.has(i))return;l.add(i),et.set(t,l);const o=()=>tt(t,{feature_name:e,behavior:n,sample_rate:Z});t.opt("metadata.media_id")?o():t.once(J,o)}(e,"playlist"),this.queue.idx=t,G(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(o,{index:t})):console.warn("there is no playlist item at this index")},push:function(...n){const s=e.root;if(0==this.queue.idx&&s.classList.contains(t))return console.warn("new items cannot be added when playlist has ended.");const i=this.queue.members;i.push(...n),this.queue.last_idx=i.length-1,e.emit(l,{members:n})},clear:function(){this.queue.members=[],this.queue.plays--,function(t,e){t.playlist&&(e=t.playlist.queue=D(e),t.emit(s,{queue:e,should_play:!1}))}(e,this.queue)}}}function st(t){const n=L(t,O);B(n,"role","button"),Y(n,S,function(){t.playlist&&t.playlist.prev()});const s=L(t,q);B(s,"role","button"),Y(s,S,function(){t.playlist&&t.playlist.next()});const i=V("fp-playlist-prev-preview"),a=V("fp-playlist-next-preview"),r=$(t,"flowplayer-control-buttons");return r&&(r.prepend(n),r.append(s),r.append(i),r.append(a)),t.on("reap",function(){t.skip_controls=void 0}),t.on([e,l,o],function(e){const n=A(e,"data.queue",A(t,"playlist.queue"));if(!n||!r||!t.skip_controls)return;X(r,"is-prev-button-disabled",!n.idx),X(r,"is-next-button-disabled",n.idx===n.last_idx);const s=n.idx<n.last_idx?function(t){if(!F(t)||0!==(t.mode&C.LOOP))return t.members[M(t)]}(n):null,l=n.idx>0?function(t){if(0!==t.idx||0!==(t.mode&C.LOOP))return t.members[function(t){const e=t.idx-1;return e<0?t.last_idx:e}(t)]}(n):null;a.style.backgroundImage=["url(",s?s.poster:null,")"].join(""),i.style.backgroundImage=["url(",l?l.poster:null,")"].join("")}),{prevButton:n,nextButton:s,prevPreview:i,nextPreview:a}}function it(t,e){if(!e)return;!1!==e.skip_controls&&(t.skip_controls=st(t));const n=function(t){let e=null;if(n=t.controls,!v(n)&&!E(n))return;var n;E(t.controls)?e=t.controls:v(t.controls)&&(e=document.querySelector(t.controls));return y("Could not find controls by Selector["+t.controls+"]",E(e)),e}(e);if(!n)return;const s=L(t,N);n.append(s)}function lt(t,e,n){if(Array.isArray(e))return n(function(t,e){let n=e.shuffle?C.SHUFFLE:C.FIFO;return e.loop&&(n|=C.LOOP),k(t,{mode:n,sort:e.sort})}(e,t));throw new Error("config.playlist must be an Array")}function ot(e){var l;e.on(s,function(t){var n,s;const i=e.opt("playlist",{}),l=null===(n=t.detail)||void 0===n?void 0:n.queue,o=null===(s=t.detail)||void 0===s?void 0:s.should_play;l&&i&&(e.playlist=nt(e,l),o&&z(e,l,i))}),e.on("ended",(l=()=>{const t=e.opt("playlist");if(e.playlist&&t)return F(e.playlist.queue)?function(t,e){if(t.emit(n),!e.loop)return;if(!t.playlist)return;const l=t.playlist.queue=D(t.playlist.queue);if(t.emit(i),!e.shuffle)return z(t,l,e);t.emit(s,{queue:l,should_play:!0})}(e,t):void(!1!==t.advance&&z(e,e.playlist.queue,t))},t=>{setTimeout(function(){if(!t.defaultPrevented&&!t.prevented)return l(t)},0)})),e.on(["playing","waiting","seeking","src"],function(){if(!e.root.classList.contains(t))return;const n=$(e,I);n&&U(n,r)})}var at;const rt=(at=class Playlist{constructor(t){_(t,N,FlowplayerPlaylistControls),_(t,I,class extends UpNext{constructor(t){super(t),this.classList.add("fp-interstitial")}}),_(t,q,class extends FlowplayerIcon{constructor(t){super(t,p)}}),_(t,O,class extends FlowplayerIcon{constructor(t){super(t,d)}})}init(e,n,s){const i=e.playlist||{};i.delay="number"==typeof i.delay?i.delay:5,s.setOpts(Object.assign(Object.assign({},e),{playlist:i})),it(s,e.playlist),function(e){var n;const s=L(e,I);s.addEventListener(r,()=>e.root.classList.remove(t)),s.addEventListener(a,()=>{var n;e.root.classList.remove(t);const s=null===(n=e.playlist)||void 0===n?void 0:n.queue;s&&G(e,j(s,!1))}),null===(n=$(e,"flowplayer-ui"))||void 0===n||n.prepend(s)}(s),ot(s),((t,e)=>{t.once(J,()=>{var n;if(null==e?void 0:e.controls){const e=null===(n=t.root)||void 0===n?void 0:n.closest("div.fp-playlist-layout");let s;s=e?e.classList.contains("right")?"right":e.classList.contains("left")?"left":"default":"custom",tt(t,{behavior:"playlist-ui-enhancement",feature_name:`positioning-${s}`,sample_rate:Q})}})})(s,e.playlist)}onload(t,e,n,i){lt(t.playlist||{},i.items,function(t){n.setState("is-playlist",!0),n.emit(s,{queue:t,should_play:0===n.currentSrc.length})})}wants(t,e,n){return"flowplayer/playlist"==e.type&&!!e.items&&g(Object.assign(Object.assign({},n),{playlist:e.items}))}},at.pluginName="playlist",at.events=u,at);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,rt)});
@@ -1 +1 @@
1
- !function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.preview=i())}(this,function(){"use strict";var e=Object.freeze({__proto__:null,MOUSEOVER:1,MOBILE_VIEWPORT_VISIBLE:2,VIEWPORT_VISIBLE:4});class PreviewPlugin{init(e,i,t){t.on("config",({detail:e})=>{e&&JSON.stringify(this.preview_config)!==JSON.stringify(e.preview)&&this.configure(e)}),this.root=i,this.player=t,this.configure(e)}configure(e){var i,t;if(null===(i=this.preview)||void 0===i||i.remove(),!e.preview||!e.poster)return;this.preview_config=Object.assign({},e.preview),this.createPreview(e.preview.src);const n=e.preview.trigger||3;(4&n||function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,i=e?navigator.userAgent:"",t=/iP(hone|od)/i.test(i)&&!/iPad/.test(i)&&!/IEMobile/i.test(i),n=/Android/.test(i)&&!/Firefox/.test(i),r=/^((?!chrome|android).)*safari/i.test(i),o=/chrome|crios/i.test(i)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(i),s=/firefox|fxios/i.test(i)&&!/seamonkey/i.test(i),a=/edg/i.test(i),d=/opr|opera/i.test(i),u=/SamsungBrowser/.test(i),l=u&&/SMART-TV/.test(i);return{controls:!t,video:function(i){return e&&document.createElement("video").canPlayType(i)},lang:e&&window.navigator.language,android:n,iphone:t,safari:r,edge:a,opera:d,chrome:o,firefox:s,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:u,samsung_tv:u&&l,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window,anyTv:"tizen"in window||"webos"in window}}().touch&&2&n)&&(null===(t=this.preview)||void 0===t||t.classList.add("in-viewport"))}createPreview(e){var i;if(!this.root||0===(null==e?void 0:e.length))return;if(this.preview=document.createElement("img"),this.preview.classList.add("fp-preview"),this.preview.alt="Video preview",this.player&&(null===(i=function(e,i){const t=e._customElements.get(i);return t&&e.root.querySelector(t)||void 0}(this.player,"flowplayer-ui"))||void 0===i||i.prepend(this.preview)),!Array.isArray(e))return this.preview.setAttribute("src",e);const t=this.root.clientWidth;this.preview.src=e.reduce((e,i)=>i.dimensions&&e.dimensions&&Math.abs(i.dimensions.width-t)<Math.abs(e.dimensions.width-t)?i:e).src}}PreviewPlugin.pluginName="preview",PreviewPlugin.trigger=e;return function(e,i){if("object"==typeof exports&&"undefined"!=typeof module)return i;if(null===document.currentScript)return i;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;return"function"==typeof t?(t(i),i):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(i)||t.extensions.push(i),i)}(window,PreviewPlugin)});
1
+ !function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.preview=i())}(this,function(){"use strict";var e=Object.freeze({__proto__:null,MOUSEOVER:1,MOBILE_VIEWPORT_VISIBLE:2,VIEWPORT_VISIBLE:4});const i=1,t=.001;const n=new WeakMap;function r(e,r,o="used"){var s;const a=`${r}:${o}`,d=null!==(s=n.get(e))&&void 0!==s?s:new Set;if(d.has(a))return;d.add(a),n.set(e,d);const u=()=>function(e,{feature_name:t,behavior:n,sample_rate:r}){t&&(r||(r=i),e.emit("flowplayer:feature",{feature_name:t,behavior:n,sample_rate:r}))}(e,{feature_name:r,behavior:o,sample_rate:t});e.opt("metadata.media_id")?u():e.once("health:ready",u)}class PreviewPlugin{init(e,i,t){t.on("config",({detail:e})=>{e&&JSON.stringify(this.preview_config)!==JSON.stringify(e.preview)&&this.configure(e)}),this.root=i,this.player=t,this.configure(e)}configure(e){var i,t;if(null===(i=this.preview)||void 0===i||i.remove(),!e.preview||!e.poster)return;this.preview_config=Object.assign({},e.preview),this.createPreview(e.preview.src);const n=e.preview.trigger||3;(4&n||function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,i=e?navigator.userAgent:"",t=/iP(hone|od)/i.test(i)&&!/iPad/.test(i)&&!/IEMobile/i.test(i),n=/Android/.test(i)&&!/Firefox/.test(i),r=/^((?!chrome|android).)*safari/i.test(i),o=/chrome|crios/i.test(i)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(i),s=/firefox|fxios/i.test(i)&&!/seamonkey/i.test(i),a=/edg/i.test(i),d=/opr|opera/i.test(i),u=/SamsungBrowser/.test(i),l=u&&/SMART-TV/.test(i);return{controls:!t,video:function(i){return e&&document.createElement("video").canPlayType(i)},lang:e&&window.navigator.language,android:n,iphone:t,safari:r,edge:a,opera:d,chrome:o,firefox:s,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:u,samsung_tv:u&&l,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window,anyTv:"tizen"in window||"webos"in window}}().touch&&2&n)&&(null===(t=this.preview)||void 0===t||t.classList.add("in-viewport"))}createPreview(e){var i;if(!this.root||0===(null==e?void 0:e.length))return;if(this.player&&r(this.player,"preview"),this.preview=document.createElement("img"),this.preview.classList.add("fp-preview"),this.preview.alt="Video preview",this.player&&(null===(i=function(e,i){const t=e._customElements.get(i);return t&&e.root.querySelector(t)||void 0}(this.player,"flowplayer-ui"))||void 0===i||i.prepend(this.preview)),!Array.isArray(e))return this.preview.setAttribute("src",e);const t=this.root.clientWidth;this.preview.src=e.reduce((e,i)=>i.dimensions&&e.dimensions&&Math.abs(i.dimensions.width-t)<Math.abs(e.dimensions.width-t)?i:e).src}}PreviewPlugin.pluginName="preview",PreviewPlugin.trigger=e;return function(e,i){if("object"==typeof exports&&"undefined"!=typeof module)return i;if(null===document.currentScript)return i;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;return"function"==typeof t?(t(i),i):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(i)||t.extensions.push(i),i)}(window,PreviewPlugin)});
package/plugins/qsel.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.qsel=t())}(this,function(){"use strict";function e(e,t,i){const n=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;n.length;){if(null==e)return i;const t=n.shift();if("string"!=typeof t)return i;e=e[t]}return null==e?i:e}const t="click",i="qualities",n=(e,t)=>new(((e,t)=>{const i=e.get(t);if(!i)throw new Error(`no flowplayer component with the name ${t} exists`);const n=window.customElements.get(t);if(!n)throw new Error(`no default flowplayer component with the name ${t} exists`);const s=window.customElements.get(i);return"function"!=typeof s?n:s})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const s="has-menu-opened",l="fp-menu-container",o="fp-on",r="fp-invis",a="details[open]."+l;class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.menuHeader=document.createElement("div"),this.menuTitle=document.createElement("h3"),this.olEle=document.createElement("ol"),this.olEle.id=c(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menuHeader.classList.add("fp-menu-header"),this.menuHeader.append(this.menuTitle,this.closeEle),this.menu.classList.add("fp-menu"),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add(l),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener(t,t=>{if(t.defaultPrevented)return;t.preventDefault();const i=this.menuContainer.open;i||(u(),document.active_menu=this.menuContainer),this.menuContainer.open=!i,e.root.classList.toggle(s,!i),this.summaryEle.setAttribute("aria-expanded",i?"false":"true")}),this.addEventListener("focusin",e=>{e.target;HTMLLIElement}),this.addEventListener("focusout",e=>{e.target;HTMLLIElement}),this.append(this.menuContainer),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("aria-expanded","false"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.className=e.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=e.id||c()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=n(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}e.menuTitle&&(this.menuTitle.textContent=e.menuTitle),this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.toggle_visibility(!(null==e?void 0:e.length)))}menuOption(e,i){const n=document.createElement("li");n.setAttribute("tabindex","0"),e.icon&&n.append(e.icon);const s=document.createElement("span");s.textContent=e.text,n.append(s),this.olEle.appendChild(n),e.isButton?(n.setAttribute("role","menuitem"),n.addEventListener(t,()=>{"function"==typeof e.onclick&&e.onclick()})):(n.setAttribute("role","menuitemradio"),n.setAttribute("aria-checked","false"),n.addEventListener(t,()=>{this.select_item(i),"function"==typeof e.onclick&&e.onclick()}),e.selected&&this.select_item(i))}select_item(e){var t;if(this.options[e]&&!(null===(t=this.options[e])||void 0===t?void 0:t.hasAttribute("aria-checked")))throw new Error("Cannot select a button-only item");this.options.forEach((t,i)=>{t.hasAttribute("aria-checked")&&(t.classList.toggle(o,i===e),t.setAttribute("aria-checked",i===e?"true":"false"))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(o),e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false")})}toggle_visibility(e){this.classList.toggle(r,e),this.menu.style.setProperty("display",e?"none":"flex")}}function u(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const i=e.root.querySelector(a);i&&(i.open=!1,null===(t=i.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle(s,!1))})}function c(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function d(e,t,i){const n=function(e,t){const i=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(i,"data",{get:()=>t}),i}(t,i);return e.dispatchEvent(n),e}function h(e,t){const i=e._customElements.get(t);return i&&e.root.querySelector(i)||void 0}document.addEventListener(t,function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(u(),this.active_menu=void 0)}),function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const m="flowplayer-quality-menu",p="quality:set";var f,y=Object.freeze({__proto__:null,SET_QUALITY:p,TRACKS:"quality:tracks",SWITCH:"quality:update",QUALITIES:i});function E(e){return e instanceof FlowplayerMenu}function v(e){return e.find(e=>"level"in e&&-1===e.level||"index"in e&&-1===e.index)}function g(e,t){return t||(e.height&&e.width&&e.height>e.width?`${e.width}p${e.height>1279?" HD":""}`:e.height?`${e.height}p${e.height>719?" HD":""}`:e.width?`${e.width}p${e.width>1279?" HD":""}`:"name"in e&&e.name?e.name:"0p")}function b(e,t,i,n){const s=v(t),l=e.querySelector("li:last-child span");l&&s&&(l.textContent=n?`${g(s)} - ${g(i)}`:g(s)+"")}function w(t,i,n,s){if(E(n)&&!e(i.opts,"qsel.labels")){const e=s===v(t.qualities);e&&-1===t.current.index||b(n,t.qualities,e?t.qualities[t.current.index]:s,e)}i.emit(p,s)}const x=((f=class Qsel{constructor(e){this.qualities=[],this.current={automatic:!0,index:-1},((e,t,i)=>{window.customElements.get(t)||window.customElements.define(t,i),e.customElements.get(t)||e.customElements.set(t,t)})(e,m,class extends FlowplayerMenu{})}init(t,s,l){const o=n(l,m);E(o)&&o.setMenuAttrs({summaryTitle:"HD",menuTitle:l.i18n("qsel.menu_title"),class:"fp-qsel",options_event:f.events.TRACKS,item_selected_event:f.events.SWITCH}),l.on("src",()=>{this.qualities=[],this.current={automatic:!0,index:-1},d(o,f.events.TRACKS,[])}),l.on("mount",function(){var e;const t=null!==(e=h(l,l.hasState("is-tv")?"flowplayer-tv-menu":"flowplayer-qsel-mount-zone"))&&void 0!==e?e:h(l,"flowplayer-control");null==t||t.append(o)}),l.on("qualitychange",i=>{const n=i.detail;var s,l;this.current.automatic=n.automatic,this.current.index=(s=this.qualities,l=n.after,s.findIndex(e=>"level"in e&&"level"in l?e.level===l.level:"id"in e?e.id===l.id:void 0)),!E(o)||e(t,"qsel.labels")||this.qualities.length<2||(d(o,f.events.SWITCH,{selected_index:this.current.automatic&&v(this.qualities)?this.qualities.length-1:this.current.index}),b(o,this.qualities,this.qualities[this.current.index],this.current.automatic))}),l.on(i,i=>{if(!Array.isArray(i.detail))return;this.qualities=i.detail;const n=e(t,"qsel.labels",[]);if(d(o,f.events.TRACKS,this.qualities.flatMap((e,t)=>"boolean"!=typeof n[t]||n[t]?{text:g(e,n[t]),onclick:w.bind(this,this,l,o,e)}:[])),E(o)&&o.toggle_visibility(this.qualities.length<2),this.qualities.length<2)return d(o,f.events.SWITCH,{selected_index:0});if(!e(t,"qsel.labels")){if(-1===this.current.index)return v(this.qualities)&&d(o,f.events.SWITCH,{selected_index:this.qualities.length-1});d(o,f.events.SWITCH,{selected_index:this.current.automatic&&v(this.qualities)?this.qualities.length-1:this.current.index}),E(o)&&this.current.automatic&&b(o,this.qualities,this.qualities[this.current.index],this.current.automatic)}})}}).pluginName="qsel",f.events=y,f);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const i=e.flowplayer;return"function"==typeof i?(i(t),t):(Array.isArray(i.extensions)||(i.extensions=[]),~i.extensions.indexOf(t)||i.extensions.push(t),t)}(window,x)});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.qsel=t())}(this,function(){"use strict";function e(e,t,i){const n=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;n.length;){if(null==e)return i;const t=n.shift();if("string"!=typeof t)return i;e=e[t]}return null==e?i:e}const t="click",i="qualities",n=(e,t)=>new(((e,t)=>{const i=e.get(t);if(!i)throw new Error(`no flowplayer component with the name ${t} exists`);const n=window.customElements.get(t);if(!n)throw new Error(`no default flowplayer component with the name ${t} exists`);const s=window.customElements.get(i);return"function"!=typeof s?n:s})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const s="has-menu-opened",l="fp-menu-container",o="fp-on",r="fp-invis",a="details[open]."+l;class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.menuHeader=document.createElement("div"),this.menuTitle=document.createElement("h3"),this.olEle=document.createElement("ol"),this.olEle.id=c(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menuHeader.classList.add("fp-menu-header"),this.menuHeader.append(this.menuTitle,this.closeEle),this.menu.classList.add("fp-menu"),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add(l),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener(t,t=>{if(t.defaultPrevented)return;t.preventDefault();const i=this.menuContainer.open;i||(u(),document.active_menu=this.menuContainer),this.menuContainer.open=!i,e.root.classList.toggle(s,!i),this.summaryEle.setAttribute("aria-expanded",i?"false":"true")}),this.addEventListener("focusin",e=>{e.target;HTMLLIElement}),this.addEventListener("focusout",e=>{e.target;HTMLLIElement}),this.append(this.menuContainer),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("aria-expanded","false"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.className=e.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=e.id||c()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=n(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}e.menuTitle&&(this.menuTitle.textContent=e.menuTitle),this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.toggle_visibility(!(null==e?void 0:e.length)))}menuOption(e,i){const n=document.createElement("li");n.setAttribute("tabindex","0"),e.icon&&n.append(e.icon);const s=document.createElement("span");s.textContent=e.text,n.append(s),this.olEle.appendChild(n),e.isButton?(n.setAttribute("role","menuitem"),n.addEventListener(t,()=>{"function"==typeof e.onclick&&e.onclick()})):(n.setAttribute("role","menuitemradio"),n.setAttribute("aria-checked","false"),n.addEventListener(t,()=>{this.select_item(i),"function"==typeof e.onclick&&e.onclick()}),e.selected&&this.select_item(i))}select_item(e){var t;if(this.options[e]&&!(null===(t=this.options[e])||void 0===t?void 0:t.hasAttribute("aria-checked")))throw new Error("Cannot select a button-only item");this.options.forEach((t,i)=>{t.hasAttribute("aria-checked")&&(t.classList.toggle(o,i===e),t.setAttribute("aria-checked",i===e?"true":"false"))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(o),e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false")})}toggle_visibility(e){this.classList.toggle(r,e),this.menu.style.setProperty("display",e?"none":"flex")}}function u(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const i=e.root.querySelector(a);i&&(i.open=!1,null===(t=i.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle(s,!1))})}function c(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function d(e,t,i){const n=function(e,t){const i=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(i,"data",{get:()=>t}),i}(t,i);return e.dispatchEvent(n),e}function m(e,t){const i=e._customElements.get(t);return i&&e.root.querySelector(i)||void 0}document.addEventListener(t,function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(u(),this.active_menu=void 0)}),function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const h="flowplayer-quality-menu",p="quality:set";var f=Object.freeze({__proto__:null,SET_QUALITY:p,TRACKS:"quality:tracks",SWITCH:"quality:update",QUALITIES:i});const y=1,v=.001;const E=new WeakMap;function g(e,t,i="used"){var n;const s=`${t}:${i}`,l=null!==(n=E.get(e))&&void 0!==n?n:new Set;if(l.has(s))return;l.add(s),E.set(e,l);const o=()=>function(e,{feature_name:t,behavior:i,sample_rate:n}){t&&(n||(n=y),e.emit("flowplayer:feature",{feature_name:t,behavior:i,sample_rate:n}))}(e,{feature_name:t,behavior:i,sample_rate:v});e.opt("metadata.media_id")?o():e.once("health:ready",o)}function b(e){return e instanceof FlowplayerMenu}function w(e){return e.find(e=>"level"in e&&-1===e.level||"index"in e&&-1===e.index)}function x(e,t){return t||(e.height&&e.width&&e.height>e.width?`${e.width}p${e.height>1279?" HD":""}`:e.height?`${e.height}p${e.height>719?" HD":""}`:e.width?`${e.width}p${e.width>1279?" HD":""}`:"name"in e&&e.name?e.name:"0p")}function q(e,t,i,n){const s=w(t),l=e.querySelector("li:last-child span");l&&s&&(l.textContent=n?`${x(s)} - ${x(i)}`:x(s)+"")}function _(t,i,n,s){if(b(n)&&!e(i.opts,"qsel.labels")){const e=s===w(t.qualities);e&&-1===t.current.index||q(n,t.qualities,e?t.qualities[t.current.index]:s,e)}g(i,"qsel"),i.emit(p,s)}var A;const T=((A=class Qsel{constructor(e){this.qualities=[],this.current={automatic:!0,index:-1},((e,t,i)=>{window.customElements.get(t)||window.customElements.define(t,i),e.customElements.get(t)||e.customElements.set(t,t)})(e,h,class extends FlowplayerMenu{})}init(t,s,l){const o=n(l,h);b(o)&&o.setMenuAttrs({summaryTitle:"HD",menuTitle:l.i18n("qsel.menu_title"),class:"fp-qsel",options_event:A.events.TRACKS,item_selected_event:A.events.SWITCH}),l.on("src",()=>{this.qualities=[],this.current={automatic:!0,index:-1},d(o,A.events.TRACKS,[])}),l.on("mount",function(){var e;const t=null!==(e=m(l,l.hasState("is-tv")?"flowplayer-tv-menu":"flowplayer-qsel-mount-zone"))&&void 0!==e?e:m(l,"flowplayer-control");null==t||t.append(o)}),l.on("qualitychange",i=>{const n=i.detail;var s,l;this.current.automatic=n.automatic,this.current.index=(s=this.qualities,l=n.after,s.findIndex(e=>"level"in e&&"level"in l?e.level===l.level:"id"in e?e.id===l.id:void 0)),!b(o)||e(t,"qsel.labels")||this.qualities.length<2||(d(o,A.events.SWITCH,{selected_index:this.current.automatic&&w(this.qualities)?this.qualities.length-1:this.current.index}),q(o,this.qualities,this.qualities[this.current.index],this.current.automatic))}),l.on(i,i=>{if(!Array.isArray(i.detail))return;this.qualities=i.detail;const n=e(t,"qsel.labels",[]);if(d(o,A.events.TRACKS,this.qualities.flatMap((e,t)=>"boolean"!=typeof n[t]||n[t]?{text:x(e,n[t]),onclick:_.bind(this,this,l,o,e)}:[])),b(o)&&o.toggle_visibility(this.qualities.length<2),this.qualities.length<2)return d(o,A.events.SWITCH,{selected_index:0});if(!e(t,"qsel.labels")){if(-1===this.current.index)return w(this.qualities)&&d(o,A.events.SWITCH,{selected_index:this.qualities.length-1});d(o,A.events.SWITCH,{selected_index:this.current.automatic&&w(this.qualities)?this.qualities.length-1:this.current.index}),b(o)&&this.current.automatic&&q(o,this.qualities,this.qualities[this.current.index],this.current.automatic)}})}}).pluginName="qsel",A.events=f,A);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const i=e.flowplayer;return"function"==typeof i?(i(t),t):(Array.isArray(i.extensions)||(i.extensions=[]),~i.extensions.indexOf(t)||i.extensions.push(t),t)}(window,T)});
package/plugins/qul.js CHANGED
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.qul=n())}(this,function(){"use strict";const e="error";const n="application/vnd.apple.mpegURL";document.createElement("video").canPlayType(n);function t(e){var t;return void 0===window.MediaSource&&void 0===window.WebKitMediaSource||function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,n=e?navigator.userAgent:"",t=/iP(hone|od)/i.test(n)&&!/iPad/.test(n)&&!/IEMobile/i.test(n),o=/Android/.test(n)&&!/Firefox/.test(n),i=/^((?!chrome|android).)*safari/i.test(n),r=/chrome|crios/i.test(n)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(n),s=/firefox|fxios/i.test(n)&&!/seamonkey/i.test(n),d=/edg/i.test(n),a=/opr|opera/i.test(n),u=/SamsungBrowser/.test(n),l=u&&/SMART-TV/.test(n);return{controls:!t,video:function(n){return e&&document.createElement("video").canPlayType(n)},lang:e&&window.navigator.language,android:o,iphone:t,safari:i,edge:d,opera:a,chrome:r,firefox:s,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:u,samsung_tv:u&&l,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window,anyTv:"tizen"in window||"webos"in window}}().video(n)&&(null===(t=null==e?void 0:e.hls)||void 0===t?void 0:t.native)}function o(e,n){n.id&&clearInterval(n.id)}function i(e,n){r(e.original_src,(e,t,i)=>{200!=t&&o(0,n)})}function r(e,n){const t=new XMLHttpRequest;t.onload=function(){if(200==t.status)return n(void 0,t.status);try{const e=JSON.parse(t.responseText);n(void 0,"qul:"+t.status,e)}catch(e){n(e)}},t.open("GET",function(e){const n=document.createElement("a");n.href=e;const t="bust="+Date.now();return[n.protocol,"//",n.hostname,n.pathname,n.search,n.search.length?"&":"?",t].join("")}(e)),t.send()}function s(e,n){const t=new CustomEvent(e,{detail:n,cancelable:!0});return n&&Object.defineProperty(t,"data",{get:()=>n}),t}!function(){let e=!1;try{const n=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,n),window.removeEventListener("testPassive",null,n)}catch(e){}}();const d="qul:error";function a(e,n,t){const o=document.createElement("a");o.href=e;let i=encodeURIComponent(n);return t&&(i+="/dId:"+encodeURIComponent(t)),[o.protocol,"//",o.hostname,o.pathname.replace(l(o.pathname,0),i+"/"+l(o.pathname,0))].join("")}class QULPlugin{init(n,s,d){var l,c,f;const v=(null===(l=n.qul)||void 0===l?void 0:l.device_id)||(null===(c=n.qul)||void 0===c?void 0:c.dId)||d.deviceId();let p,m=null===(f=n.qul)||void 0===f?void 0:f.token;const w={};d.on("src",function(e){var r;e.data&&(p=null===(r=e.data)||void 0===r?void 0:r.src,o(0,w),"string"==typeof p&&p.match(/\.m3u8$/)&&m&&(e.data.src=a(p,m,v),t(n)&&Object.assign(w,function(e,n){var t;const r=(null===(t=null==n?void 0:n.qul)||void 0===t?void 0:t.interval)||2e4,s={interval:Math.min(2e4,r)};return e.once("reap",function(){o(0,s)}),s.id=setInterval(i,s.interval,e,s),setTimeout(i,0,e,s),s}(d,d.opts))))}),d.on("config",function(e){var n,t,o,i,r,s;const u=null===(t=null===(n=e.data)||void 0===n?void 0:n.qul)||void 0===t?void 0:t.token,l=(null===(i=null===(o=e.data)||void 0===o?void 0:o.qul)||void 0===i?void 0:i.device_id)||(null===(s=null===(r=e.data)||void 0===r?void 0:r.qul)||void 0===s?void 0:s.dId);u&&u!==m&&function(e,n){m=e,d.setSrc({type:"application/x-mpegurl",src:a(p,m,n)})}(u,l)}),d.on(e,function(e){var n,t;const i=((null===(n=e.data)||void 0===n?void 0:n.code)||"").toString();if(!i.match(/^(qul|http)/))return;o(0,w),e.preventDefault();const s=null===(t=e.data)||void 0===t?void 0:t.resp;if(s)return u(d,s,i);r(d.original_src,(e,n,t)=>{!isNaN(Number(n))&&Number(n)<400||u(d,t,null==n?void 0:n.toString())})})}}QULPlugin.pluginName="qul",QULPlugin.events={QUL_ERROR:d};function u(n,t,o){const i=(null==t?void 0:t.message)||"an error occurred during this session",r=(null==t?void 0:t.key)?n.i18n(t.key,i):i;n.pause();const a=s(d,{code:o,resp:t});if(n.dispatchEvent(a),a.defaultPrevented)return;const u=window.customElements.get("flowplayer-error"),l=function(e,n){const t=e._customElements.get(n);return t&&e.root.querySelector(t)||void 0}(n,"flowplayer-ui");if(l&&u){if(n.setState("is-error",!0),!n.root.querySelector("#qul_error")){const e=new u(n);e.id="qul_error",l.append(e)}!function(e,n,t){const o=s(n,t);e.dispatchEvent(o)}(n.root.querySelector("#qul_error"),e,{formatted_data:{message:r}})}}function l(e,n){return e.split("/").reverse().slice(0,n+1).reverse().join("/")}return function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;if(null===document.currentScript)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;return"function"==typeof t?(t(n),n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n),n)}(window,QULPlugin)});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.qul=t())}(this,function(){"use strict";const e="error";const t="application/vnd.apple.mpegURL";document.createElement("video").canPlayType(t);function n(e){var n;return void 0===window.MediaSource&&void 0===window.WebKitMediaSource||function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",n=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),o=/Android/.test(t)&&!/Firefox/.test(t),i=/^((?!chrome|android).)*safari/i.test(t),r=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),a=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),s=/edg/i.test(t),d=/opr|opera/i.test(t),u=/SamsungBrowser/.test(t),l=u&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:o,iphone:n,safari:i,edge:s,opera:d,chrome:r,firefox:a,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:u,samsung_tv:u&&l,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window,anyTv:"tizen"in window||"webos"in window}}().video(t)&&(null===(n=null==e?void 0:e.hls)||void 0===n?void 0:n.native)}function o(e,t){t.id&&clearInterval(t.id)}function i(e,t){r(e.original_src,(e,n,i)=>{200!=n&&o(0,t)})}function r(e,t){const n=new XMLHttpRequest;n.onload=function(){if(200==n.status)return t(void 0,n.status);try{const e=JSON.parse(n.responseText);t(void 0,"qul:"+n.status,e)}catch(e){t(e)}},n.open("GET",function(e){const t=document.createElement("a");t.href=e;const n="bust="+Date.now();return[t.protocol,"//",t.hostname,t.pathname,t.search,t.search.length?"&":"?",n].join("")}(e)),n.send()}function a(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const s=1,d=.001;const u=new WeakMap;function l(e,t,n="used"){var o;const i=`${t}:${n}`,r=null!==(o=u.get(e))&&void 0!==o?o:new Set;if(r.has(i))return;r.add(i),u.set(e,r);const a=()=>function(e,{feature_name:t,behavior:n,sample_rate:o}){t&&(o||(o=s),e.emit("flowplayer:feature",{feature_name:t,behavior:n,sample_rate:o}))}(e,{feature_name:t,behavior:n,sample_rate:d});e.opt("metadata.media_id")?a():e.once("health:ready",a)}const c="qul:error";function f(e,t,n){const o=document.createElement("a");o.href=e;let i=encodeURIComponent(t);return n&&(i+="/dId:"+encodeURIComponent(n)),[o.protocol,"//",o.hostname,o.pathname.replace(p(o.pathname,0),i+"/"+p(o.pathname,0))].join("")}class QULPlugin{init(t,a,s){var d,u,c;const p=(null===(d=t.qul)||void 0===d?void 0:d.device_id)||(null===(u=t.qul)||void 0===u?void 0:u.dId)||s.deviceId();let m,w=null===(c=t.qul)||void 0===c?void 0:c.token;const g={};s.on("src",function(e){var r;e.data&&(m=null===(r=e.data)||void 0===r?void 0:r.src,o(0,g),"string"==typeof m&&m.match(/\.m3u8$/)&&w&&(e.data.src=f(m,w,p),l(s,"qul"),n(t)&&Object.assign(g,function(e,t){var n;const r=(null===(n=null==t?void 0:t.qul)||void 0===n?void 0:n.interval)||2e4,a={interval:Math.min(2e4,r)};return e.once("reap",function(){o(0,a)}),a.id=setInterval(i,a.interval,e,a),setTimeout(i,0,e,a),a}(s,s.opts))))}),s.on("config",function(e){var t,n,o,i,r,a;const d=null===(n=null===(t=e.data)||void 0===t?void 0:t.qul)||void 0===n?void 0:n.token,u=(null===(i=null===(o=e.data)||void 0===o?void 0:o.qul)||void 0===i?void 0:i.device_id)||(null===(a=null===(r=e.data)||void 0===r?void 0:r.qul)||void 0===a?void 0:a.dId);d&&d!==w&&function(e,t){w=e,s.setSrc({type:"application/x-mpegurl",src:f(m,w,t)})}(d,u)}),s.on(e,function(e){var t,n;const i=((null===(t=e.data)||void 0===t?void 0:t.code)||"").toString();if(!i.match(/^(qul|http)/))return;o(0,g),e.preventDefault();const a=null===(n=e.data)||void 0===n?void 0:n.resp;if(a)return v(s,a,i);r(s.original_src,(e,t,n)=>{!isNaN(Number(t))&&Number(t)<400||v(s,n,null==t?void 0:t.toString())})})}}QULPlugin.pluginName="qul",QULPlugin.events={QUL_ERROR:c};function v(t,n,o){const i=(null==n?void 0:n.message)||"an error occurred during this session",r=(null==n?void 0:n.key)?t.i18n(n.key,i):i;t.pause();const s=a(c,{code:o,resp:n});if(t.dispatchEvent(s),s.defaultPrevented)return;const d=window.customElements.get("flowplayer-error"),u=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(t,"flowplayer-ui");if(u&&d){if(t.setState("is-error",!0),!t.root.querySelector("#qul_error")){const e=new d(t);e.id="qul_error",u.append(e)}!function(e,t,n){const o=a(t,n);e.dispatchEvent(o)}(t.root.querySelector("#qul_error"),e,{formatted_data:{message:r}})}}function p(e,t){return e.split("/").reverse().slice(0,t+1).reverse().join("/")}return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,QULPlugin)});