openplayerjs
Version:
HTML5 video and audio player
1 lines • 162 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.openplayerjs=t():e.openplayerjs=t()}(this,function(){return function(){var e={172:function(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},373:function(e){e.exports=function(e){var t=Object(e),i=[];for(var n in t)i.unshift(n);return function e(){for(;i.length;)if((n=i.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},546:function(e){function t(i,n,s,a){var r=Object.defineProperty;try{r({},"",{})}catch(i){r=0}e.exports=t=function(e,i,n,s){function a(i,n){t(e,i,function(e){return this._invoke(i,n,e)})}i?r?r(e,i,{value:n,enumerable:!s,configurable:!s,writable:!s}):e[i]=n:(a("next",0),a("throw",1),a("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(i,n,s,a)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},579:function(e,t,i){var n=i(738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],i=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}}}throw new TypeError(n(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},633:function(e,t,i){var n=i(172),s=i(993),a=i(869),r=i(887),o=i(791),l=i(373),f=i(579);function u(){"use strict";var t=s(),i=t.m(u),c=(Object.getPrototypeOf?Object.getPrototypeOf(i):i.__proto__).constructor;function d(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===c||"GeneratorFunction"===(t.displayName||t.name))}var h={throw:1,return:2,break:3,continue:3};function v(e){var t,i;return function(n){t||(t={stop:function(){return i(n.a,2)},catch:function(){return n.v},abrupt:function(e,t){return i(n.a,h[e],t)},delegateYield:function(e,s,a){return t.resultName=s,i(n.d,f(e),a)},finish:function(e){return i(n.f,e)}},i=function(e,i,s){n.p=t.prev,n.n=t.next;try{return e(i,s)}finally{t.next=n.n}}),t.resultName&&(t[t.resultName]=n.v,t.resultName=void 0),t.sent=n.v,t.next=n.n;try{return e.call(this,t)}finally{n.p=t.prev,n.n=t.next}}}return(e.exports=u=function(){return{wrap:function(e,i,n,s){return t.w(v(e),i,n,s&&s.reverse())},isGeneratorFunction:d,mark:t.m,awrap:function(e,t){return new n(e,t)},AsyncIterator:o,async:function(e,t,i,n,s){return(d(t)?r:a)(v(e),t,i,n,s)},keys:l,values:f}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=u,e.exports.__esModule=!0,e.exports.default=e.exports},738:function(e){function t(i){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},756:function(e,t,i){var n=i(633)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},791:function(e,t,i){var n=i(172),s=i(546);e.exports=function e(t,i){function a(e,s,r,o){try{var l=t[e](s),f=l.value;return f instanceof n?i.resolve(f.v).then(function(e){a("next",e,r,o)},function(e){a("throw",e,r,o)}):i.resolve(f).then(function(e){l.value=e,r(l)},function(e){return a("throw",e,r,o)})}catch(e){o(e)}}var r;this.next||(s(e.prototype),s(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),s(this,"_invoke",function(e,t,n){function s(){return new i(function(t,i){a(e,n,t,i)})}return r=r?r.then(s,s):s()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},869:function(e,t,i){var n=i(887);e.exports=function(e,t,i,s,a){var r=n(e,t,i,s,a);return r.next().then(function(e){return e.done?e.value:r.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887:function(e,t,i){var n=i(993),s=i(791);e.exports=function(e,t,i,a,r){return new s(n().w(e,t,i,a),r||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},993:function(e,t,i){var n=i(546);function s(){var t,i,a="function"==typeof Symbol?Symbol:{},r=a.iterator||"@@iterator",o=a.toStringTag||"@@toStringTag";function l(e,s,a,r){var o=s&&s.prototype instanceof u?s:u,l=Object.create(o.prototype);return n(l,"_invoke",function(e,n,s){var a,r,o,l=0,u=s||[],c=!1,d={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,i){return a=e,r=0,o=t,d.n=i,f}};function h(e,n){for(r=e,o=n,i=0;!c&&l&&!s&&i<u.length;i++){var s,a=u[i],h=d.p,v=a[2];e>3?(s=v===n)&&(o=a[(r=a[4])?5:(r=3,3)],a[4]=a[5]=t):a[0]<=h&&((s=e<2&&h<a[1])?(r=0,d.v=n,d.n=a[1]):h<v&&(s=e<3||a[0]>n||n>v)&&(a[4]=e,a[5]=n,d.n=v,r=0))}if(s||e>1)return f;throw c=!0,n}return function(s,u,v){if(l>1)throw TypeError("Generator is already running");for(c&&1===u&&h(u,v),r=u,o=v;(i=r<2?t:o)||!c;){a||(r?r<3?(r>1&&(d.n=-1),h(r,o)):d.n=o:d.v=o);try{if(l=2,a){if(r||(s="next"),i=a[s]){if(!(i=i.call(a,o)))throw TypeError("iterator result is not an object");if(!i.done)return i;o=i.value,r<2&&(r=0)}else 1===r&&(i=a.return)&&i.call(a),r<2&&(o=TypeError("The iterator does not provide a '"+s+"' method"),r=1);a=t}else if((i=(c=d.n<0)?o:e.call(n,d))!==f)break}catch(e){a=t,r=1,o=e}finally{l=1}}return{value:i,done:c}}}(e,a,r),!0),l}var f={};function u(){}function c(){}function d(){}i=Object.getPrototypeOf;var h=[][r]?i(i([][r]())):(n(i={},r,function(){return this}),i),v=d.prototype=u.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,n(e,o,"GeneratorFunction")),e.prototype=Object.create(v),e}return c.prototype=d,n(v,"constructor",d),n(d,"constructor",c),c.displayName="GeneratorFunction",n(d,o,"GeneratorFunction"),n(v),n(v,o,"Generator"),n(v,r,function(){return this}),n(v,"toString",function(){return"[object Generator]"}),(e.exports=s=function(){return{w:l,m:p}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function i(n){var s=t[n];if(void 0!==s)return s.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,i),a.exports}i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var i=function(t,i){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var s=n.call(t,i||"default");if("object"!=e(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(t)}(t,"string");return"symbol"==e(i)?i:i+""}function s(e,i,n){return(i=t(i))in e?Object.defineProperty(e,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[i]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,t(s.key),s)}}function o(e,t,i){return t&&r(e.prototype,t),i&&r(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}i.r(n),i.d(n,{default:function(){return $n}});var l=i(756),f=i.n(l);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,s,a,r,o=[],l=!0,f=!1;try{if(a=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=a.call(i)).done)&&(o.push(n.value),o.length!==t);l=!0);}catch(e){f=!0,s=e}finally{try{if(!l&&null!=i.return&&(r=i.return(),Object(r)!==r))return}finally{if(f)throw s}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var d="undefined"!=typeof window?window.navigator:null,h=d?d.userAgent.toLowerCase():null,v=(!!h&&(/ipad/i.test(h)&&window.MSStream),!!h&&(/iphone/i.test(h)&&!window.MSStream)),p=(!!h&&(/ipod/i.test(h)&&window.MSStream),!!h&&(/ipad|iphone|ipod/i.test(h)&&!window.MSStream)),m=!!h&&/android/i.test(h),y=(!!d&&("msLaunchUri"in d&&document),!!h&&/chrome/i.test(h)),g=(!!h&&/firefox/i.test(h),!!h&&(/safari/i.test(h)&&!y)),b=(!!h&&/^mozilla\/\d+\.\d+\s\(linux;\su;/i.test(h),"undefined"!=typeof window&&"MediaSource"in window),E={passive:!1};function w(e){return"video"===e.tagName.toLowerCase()}function k(e){return"audio"===e.tagName.toLowerCase()}function _(e){return new Promise(function(t,i){var n=document.createElement("script");n.src=e,n.async=!0,n.onload=function(){n.remove(),t()},n.onerror=function(){n.remove(),i(new Error("".concat(e," could not be loaded")))},document.head&&document.head.appendChild(n)})}function A(e){var t=e.getBoundingClientRect();return{left:t.left+(window.pageXOffset||document.documentElement.scrollLeft),top:t.top+(window.pageYOffset||document.documentElement.scrollTop)}}function L(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body"),n=i.querySelectorAll("script"),s=0,a=n.length;s<a;s++)n[s].remove();var r=function(e){for(var t=e.children,i=0,n=t.length;i<n;i++){for(var s=t[i],a=s.attributes,o=0,l=a.length;o<l;o++){var f=a[o],u=f.name,c=f.value.replace(/\s+/g,"").toLowerCase();["src","href","xlink:href"].includes(u)&&(c.includes("javascript:")||c.includes("data:"))&&s.removeAttribute(u),u.startsWith("on")&&s.removeAttribute(u)}r(s)}};return r(i),t?(i.textContent||"").replace(/\s{2,}/g,""):i.innerHTML}function M(e,t){var i={};return t&&t.detail&&(i={detail:t.detail}),new CustomEvent(e,i)}function T(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return C(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?C(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,o=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return r=e.done,e},e:function(e){o=!0,a=e},f:function(){try{r||null==i.return||i.return()}finally{if(o)throw a}}}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}var S,x,O,P,j,W,R,N,I,D,B,F=function(e,t,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,i):s?s.value=i:t.set(e,i),i},q=function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},H=o(function e(t,i,n){a(this,e),S.set(this,void 0),x.set(this,void 0),O.set(this,void 0),P.set(this,void 0),j.set(this,{button:{},global:{},media:{}}),W.set(this,void 0),R.set(this,void 0),N.set(this,void 0),I.set(this,"off"),D.set(this,void 0),B.set(this,void 0),F(this,S,t,"f"),F(this,D,i,"f"),F(this,B,n,"f"),this._formatMenuItems=this._formatMenuItems.bind(this),this._setDefaultTrack=this._setDefaultTrack.bind(this),this._showCaptions=this._showCaptions.bind(this),this._hideCaptions=this._hideCaptions.bind(this)},[{key:"create",value:function(){var e,t=this,i=q(this,S,"f").getElement().textTracks,n=q(this,S,"f").getOptions(),s=n.labels,a=n.detachMenus;if(F(this,W,Object.keys(i).map(function(e){return i[Number(e)]}).filter(function(e){return["subtitles","captions"].includes(e.kind)&&e.language}),"f"),F(this,R,!!q(this,W,"f").length,"f"),q(this,R,"f")){F(this,x,document.createElement("button"),"f"),q(this,x,"f").className="op-controls__captions op-control__".concat(q(this,D,"f")),q(this,x,"f").tabIndex=0,q(this,x,"f").type="button",q(this,x,"f").title=(null==s?void 0:s.toggleCaptions)||"",q(this,x,"f").setAttribute("aria-controls",q(this,S,"f").id),q(this,x,"f").setAttribute("aria-pressed","false"),q(this,x,"f").setAttribute("aria-label",(null==s?void 0:s.toggleCaptions)||""),q(this,x,"f").setAttribute("data-active-captions","off"),F(this,O,document.createElement("div"),"f"),q(this,O,"f").className="op-captions";var r=q(this,S,"f").getContainer();if(r.insertBefore(q(this,O,"f"),r.firstChild),a){q(this,x,"f").classList.add("op-control--no-hover"),F(this,P,document.createElement("div"),"f"),q(this,P,"f").className="op-settings op-captions__menu",q(this,P,"f").setAttribute("aria-hidden","true"),q(this,P,"f").innerHTML='<div class="op-settings__menu" role="menu" id="menu-item-captions">\n <div class="op-settings__submenu-item" tabindex="0" role="menuitemradio" aria-checked="'.concat("off"===q(this,I,"f")?"true":"false",'">\n <div class="op-settings__submenu-label op-subtitles__option" data-value="captions-off">').concat(null==s?void 0:s.off,"</div>\n </div>\n </div>");var o=document.createElement("div");o.className="op-controls__container op-control__".concat(q(this,D,"f")),o.append(q(this,x,"f"),q(this,P,"f")),q(this,S,"f").getControls().getLayer(q(this,B,"f")).append(o);var l,f=T(q(this,W,"f"));try{for(f.s();!(l=f.n()).done;){var u=l.value,c=document.createElement("div"),d=(null===(e=null==s?void 0:s.lang)||void 0===e?void 0:e[u.language])||null;c.className="op-settings__submenu-item",c.tabIndex=0,c.setAttribute("role","menuitemradio"),c.setAttribute("aria-checked",q(this,I,"f")===u.language?"true":"false"),c.innerHTML='<div class="op-settings__submenu-label op-subtitles__option"\n data-value="captions-'.concat(u.language,'">\n ').concat(d||u.label,"\n </div>"),q(this,P,"f").append(c)}}catch(e){f.e(e)}finally{f.f()}}else q(this,S,"f").getControls().getLayer(q(this,B,"f")).append(q(this,x,"f"));q(this,j,"f").button.click=function(e){var i,n=e.target;if(a){for(var s=q(t,S,"f").getContainer().querySelectorAll(".op-settings"),r=0,o=Array.from(s);r<o.length;r++){var l=o[r];l!==q(t,P,"f")&&l.setAttribute("aria-hidden","true")}"true"===q(t,P,"f").getAttribute("aria-hidden")?q(t,P,"f").setAttribute("aria-hidden","false"):q(t,P,"f").setAttribute("aria-hidden","true")}else{n.setAttribute("aria-pressed","true"),n.classList.contains("op-controls__captions--on")?(n.classList.remove("op-controls__captions--on"),n.setAttribute("data-active-captions","off"),t._hideCaptions()):(n.classList.add("op-controls__captions--on"),n.setAttribute("data-active-captions",(null===(i=q(t,N,"f"))||void 0===i?void 0:i.language)||"off"),t._showCaptions());var f,u=T(q(t,W,"f"));try{for(u.s();!(f=u.n()).done;){var c=f.value;c.mode=n.getAttribute("data-active-captions")===c.language?"showing":"hidden"}}catch(e){u.e(e)}finally{u.f()}}},q(this,j,"f").button.mouseover=function(){if(!p&&!m&&a){for(var e=q(t,S,"f").getContainer().querySelectorAll(".op-settings"),i=0,n=e.length;i<n;++i)e[i]!==q(t,P,"f")&&e[i].setAttribute("aria-hidden","true");"true"===q(t,P,"f").getAttribute("aria-hidden")&&q(t,P,"f").setAttribute("aria-hidden","false")}},q(this,j,"f").button.mouseout=function(){if(!p&&!m&&a){for(var e=q(t,S,"f").getContainer().querySelectorAll(".op-settings"),i=0,n=e.length;i<n;++i)e[i].setAttribute("aria-hidden","true");"false"===q(t,P,"f").getAttribute("aria-hidden")&&q(t,P,"f").setAttribute("aria-hidden","true")}},q(this,x,"f").addEventListener("click",q(this,j,"f").button.click,E),q(this,j,"f").global.click=function(e){var i=e.target;if(i.closest("#".concat(q(t,S,"f").id))&&i.classList.contains("op-subtitles__option")){var n=i.getAttribute("data-value").replace("captions-","");t._hideCaptions(),"off"===n&&F(t,N,void 0,"f");var s,r=T(q(t,W,"f"));try{for(r.s();!(s=r.n()).done;){var o=s.value;o.mode=o.language===n?"showing":"hidden",o.language===n&&(F(t,N,o,"f"),t._showCaptions())}}catch(e){r.e(e)}finally{r.f()}if(a){q(t,x,"f").classList.contains("op-controls__captions--on")?(q(t,x,"f").classList.remove("op-controls__captions--on"),q(t,x,"f").setAttribute("data-active-captions","off")):(q(t,x,"f").classList.add("op-controls__captions--on"),q(t,x,"f").setAttribute("data-active-captions",n));for(var l=q(t,P,"f").querySelectorAll(".op-settings__submenu-item"),f=0,u=Array.from(l);f<u.length;f++)u[f].setAttribute("aria-checked","false");i.parentElement.setAttribute("aria-checked","true"),q(t,P,"f").setAttribute("aria-hidden","false")}else q(t,x,"f").setAttribute("data-active-captions",n);var c=M("captionschanged");q(t,S,"f").getElement().dispatchEvent(c)}},q(this,j,"f").global.cuechange=function(e){var i;t._hideCaptions();var n=e.target;"showing"===n.mode&&"off"!==q(t,x,"f").getAttribute("data-active-captions")&&n.activeCues&&(null===(i=n.activeCues)||void 0===i?void 0:i.length)>0&&t._showCaptions()},a&&(q(this,x,"f").addEventListener("mouseover",q(this,j,"f").button.mouseover,E),q(this,P,"f").addEventListener("mouseover",q(this,j,"f").button.mouseover,E),q(this,P,"f").addEventListener("mouseout",q(this,j,"f").button.mouseout,E),q(this,S,"f").getElement().addEventListener("controlshidden",q(this,j,"f").button.mouseout,E)),document.addEventListener("click",q(this,j,"f").global.click,E);var h,v=T(q(this,W,"f"));try{for(v.s();!(h=v.n()).done;){var y=h.value;y.mode="showing"!==y.mode?"hidden":y.mode,y.addEventListener("cuechange",q(this,j,"f").global.cuechange,E)}}catch(e){v.e(e)}finally{v.f()}var g=q(this,S,"f").getElement().querySelector('track:is([kind="subtitles"],[kind="captions"])[default]');if(g){var b=q(this,W,"f").find(function(e){return e.language===g.srclang});b&&this._setDefaultTrack(b)}}}},{key:"destroy",value:function(){var e=q(this,S,"f").getOptions().detachMenus;if(q(this,R,"f")){var t,i=T(q(this,W,"f"));try{for(i.s();!(t=i.n()).done;)t.value.removeEventListener("cuechange",q(this,j,"f").global.cuechange)}catch(e){i.e(e)}finally{i.f()}document.removeEventListener("click",q(this,j,"f").global.click),q(this,x,"f").removeEventListener("click",q(this,j,"f").button.click),e&&(q(this,x,"f").removeEventListener("mouseover",q(this,j,"f").button.mouseover),q(this,P,"f").removeEventListener("mouseover",q(this,j,"f").button.mouseover),q(this,P,"f").removeEventListener("mouseout",q(this,j,"f").button.mouseout),q(this,S,"f").getElement().removeEventListener("controlshidden",q(this,j,"f").button.mouseout),q(this,P,"f").remove()),q(this,x,"f").remove()}}},{key:"addSettings",value:function(){var e=q(this,S,"f").getOptions(),t=e.detachMenus,i=e.labels;if(t||q(this,W,"f").length<=1)return{};var n=this._formatMenuItems();return n.length>2?{className:"op-subtitles__option",default:q(this,I,"f")||"off",key:"captions",name:(null==i?void 0:i.captions)||"",subitems:n}:{}}},{key:"_formatMenuItems",value:function(){var e=q(this,S,"f").getOptions(),t=e.labels,i=e.detachMenus;if(q(this,W,"f").length<=1&&!i)return[];var n,s=[{key:"off",label:(null==t?void 0:t.off)||""}],a=T(q(this,W,"f"));try{var r=function(){var e=n.value,i=(null==t?void 0:t.lang)?t.lang[e.language]:null;(s=s.filter(function(t){return t.key!==e.language})).push({key:e.language,label:i||e.label})};for(a.s();!(n=a.n()).done;)r()}catch(e){a.e(e)}finally{a.f()}return s}},{key:"_setDefaultTrack",value:function(e){var t,i;e.mode="showing",F(this,I,e.language,"f"),q(this,x,"f").setAttribute("data-active-captions",q(this,I,"f")),q(this,x,"f").classList.add("op-controls__captions--on"),q(this,O,"f").classList.add("op-captions--on"),F(this,N,e,"f");for(var n=document.querySelectorAll(".op-settings__submenu-item")||[],s=0,a=Array.from(n);s<a.length;s++)a[s].setAttribute("aria-checked","false");null===(i=null===(t=document.querySelector('.op-subtitles__option[data-value="captions-'.concat(e.language,'"]')))||void 0===t?void 0:t.parentElement)||void 0===i||i.setAttribute("aria-checked","true")}},{key:"_showCaptions",value:function(){for(var e,t=0,i=Array.from((null===(e=q(this,N,"f"))||void 0===e?void 0:e.activeCues)||[]);t<i.length;t++){var n=i[t],s=(null==n?void 0:n.text)||"";if(s&&q(this,O,"f")){var a=document.createElement("span");a.innerHTML=s,q(this,O,"f").prepend(a),q(this,O,"f").classList.add("op-captions--on")}else this._hideCaptions()}}},{key:"_hideCaptions",value:function(){for(var e;null===(e=q(this,O,"f"))||void 0===e?void 0:e.lastChild;)q(this,O,"f").removeChild(q(this,O,"f").lastChild)}}]);S=new WeakMap,x=new WeakMap,O=new WeakMap,P=new WeakMap,j=new WeakMap,W=new WeakMap,R=new WeakMap,N=new WeakMap,I=new WeakMap,D=new WeakMap,B=new WeakMap;var K,V,z,U,G,Q,$,Y,X,J=H,Z=function(e,t,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,i):s?s.value=i:t.set(e,i),i},ee=function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},te=o(function e(t,i,n){var s=this;a(this,e),K.set(this,void 0),V.set(this,void 0),z.set(this,void 0),U.set(this,[]),G.set(this,0),Q.set(this,0),$.set(this,void 0),Y.set(this,void 0),X.set(this,void 0),Z(this,K,t,"f"),Z(this,Y,i,"f"),Z(this,X,n,"f"),Z(this,V,document.body.classList.contains("op-fullscreen__on"),"f");var r=document;this.fullScreenEnabled=!!(r.fullscreenEnabled||r.mozFullScreenEnabled||r.msFullscreenEnabled||r.webkitSupportsFullscreen||r.webkitFullscreenEnabled||document.createElement("video").webkitRequestFullScreen),this._enterSpaceKeyEvent=this._enterSpaceKeyEvent.bind(this),this._resize=this._resize.bind(this),this._fullscreenChange=this._fullscreenChange.bind(this),this._setFullscreen=this._setFullscreen.bind(this),this._unsetFullscreen=this._unsetFullscreen.bind(this),Z(this,U,["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange"],"f"),ee(this,U,"f").forEach(function(e){document.addEventListener(e,s._fullscreenChange,E)}),this._setFullscreenData(!1),ee(this,K,"f").getContainer().addEventListener("keydown",this._enterSpaceKeyEvent,E),v&&(ee(this,K,"f").getElement().addEventListener("webkitbeginfullscreen",this._setFullscreen,E),ee(this,K,"f").getElement().addEventListener("webkitendfullscreen",this._unsetFullscreen,E))},[{key:"create",value:function(){var e=this,t=ee(this,K,"f").getOptions().labels;Z(this,z,document.createElement("button"),"f"),ee(this,z,"f").type="button",ee(this,z,"f").className="op-controls__fullscreen op-control__".concat(ee(this,Y,"f")),ee(this,z,"f").tabIndex=0,ee(this,z,"f").title=(null==t?void 0:t.fullscreen)||"",ee(this,z,"f").setAttribute("aria-controls",ee(this,K,"f").id),ee(this,z,"f").setAttribute("aria-pressed","false"),ee(this,z,"f").setAttribute("aria-label",(null==t?void 0:t.fullscreen)||""),Z(this,$,function(){ee(e,z,"f").setAttribute("aria-pressed","true"),e.toggleFullscreen()},"f"),Z(this,$,ee(this,$,"f").bind(this),"f"),ee(this,z,"f").addEventListener("click",ee(this,$,"f"),E),ee(this,K,"f").getControls().getLayer(ee(this,X,"f")).appendChild(ee(this,z,"f"))}},{key:"destroy",value:function(){var e=this;ee(this,K,"f").getContainer().removeEventListener("keydown",this._enterSpaceKeyEvent),ee(this,U,"f").forEach(function(t){document.removeEventListener(t,e._fullscreenChange)}),v&&(ee(this,K,"f").getElement().removeEventListener("webkitbeginfullscreen",this._setFullscreen),ee(this,K,"f").getElement().removeEventListener("webkitendfullscreen",this._unsetFullscreen)),ee(this,z,"f").removeEventListener("click",ee(this,$,"f")),ee(this,z,"f").remove()}},{key:"toggleFullscreen",value:function(){if(ee(this,V,"f")){var e=document;e.exitFullscreen?e.exitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.msExitFullscreen?e.msExitFullscreen():this._fullscreenChange(),document.body.classList.remove("op-fullscreen__on")}else{var t=ee(this,K,"f").getElement();Z(this,G,window.screen.width,"f"),Z(this,Q,window.screen.height,"f"),t.requestFullscreen?t.parentElement.requestFullscreen():t.mozRequestFullScreen?t.parentElement.mozRequestFullScreen():t.webkitRequestFullScreen?t.parentElement.webkitRequestFullScreen():t.msRequestFullscreen?t.parentElement.msRequestFullscreen():t.webkitEnterFullscreen?t.webkitEnterFullscreen():this._fullscreenChange(),document.body.classList.add("op-fullscreen__on")}if("undefined"!=typeof window&&(m||v)){var i=window.screen;i.orientation&&!ee(this,V,"f")&&i.orientation.lock("landscape")}}},{key:"_fullscreenChange",value:function(){var e=ee(this,V,"f")?void 0:ee(this,G,"f"),t=ee(this,V,"f")?void 0:ee(this,Q,"f");this._setFullscreenData(!ee(this,V,"f")),ee(this,K,"f").isAd()&&ee(this,K,"f").getAd().resizeAds(e,t),Z(this,V,!ee(this,V,"f"),"f"),ee(this,V,"f")?document.body.classList.add("op-fullscreen__on"):document.body.classList.remove("op-fullscreen__on"),this._resize(e,t)}},{key:"_setFullscreenData",value:function(e){ee(this,K,"f").getContainer().setAttribute("data-fullscreen",(!!e).toString()),ee(this,z,"f")&&(e?ee(this,z,"f").classList.add("op-controls__fullscreen--out"):ee(this,z,"f").classList.remove("op-controls__fullscreen--out"))}},{key:"_resize",value:function(e,t){var i=ee(this,K,"f").getContainer(),n=ee(this,K,"f").getElement(),s=ee(this,K,"f").getOptions(),a="";if(e)i.style.width="100%",n.style.width="100%";else if(s.width){var r="number"==typeof s.width?"".concat(s.width,"px"):s.width;a+="width: ".concat(r," !important;"),n.style.removeProperty("width")}else n.style.removeProperty("width"),i.style.removeProperty("width");if(t)n.style.height="100%",i.style.height="100%";else if(s.height){var o="number"==typeof s.height?"".concat(s.height,"px"):s.height;a+="height: ".concat(o," !important;"),n.style.removeProperty("height")}else n.style.removeProperty("height"),i.style.removeProperty("height");a&&i.setAttribute("style",a)}},{key:"_enterSpaceKeyEvent",value:function(e){var t,i=e.which||e.keyCode||0;!(null===(t=null===document||void 0===document?void 0:document.activeElement)||void 0===t?void 0:t.classList.contains("op-controls__fullscreen"))||13!==i&&32!==i||(this.toggleFullscreen(),e.preventDefault(),e.stopPropagation())}},{key:"_setFullscreen",value:function(){Z(this,V,!0,"f"),this._setFullscreenData(!0),document.body.classList.add("op-fullscreen__on")}},{key:"_unsetFullscreen",value:function(){Z(this,V,!1,"f"),this._setFullscreenData(!1),document.body.classList.remove("op-fullscreen__on")}}]);K=new WeakMap,V=new WeakMap,z=new WeakMap,U=new WeakMap,G=new WeakMap,Q=new WeakMap,$=new WeakMap,Y=new WeakMap,X=new WeakMap;var ie=te;function ne(e){return/\.m3u8$/i.test(e.src)||["application/x-mpegURL","application/vnd.apple.mpegurl"].includes(e.type)}function se(e){return/\.mpd/i.test(e.src)||"application/dash+xml"===e.type}function ae(e){return/(^rtmp:\/\/|\.flv$)/i.test(e.src)||["video/x-flv","video/flv"].includes(e.type)}function re(e,t){var i=function(e){var t=((((e.split("?")[0]||"").split("\\")||[]).pop()||"").split("/")||[]).pop()||"";return t.includes(".")?t.substring(t.lastIndexOf(".")+1):""}(e);if(!i)return k(t)?"audio/mp3":"video/mp4";switch(i){case"m3u8":case"m3u":return"application/x-mpegURL";case"mpd":return"application/dash+xml";case"mp4":return k(t)?"audio/mp4":"video/mp4";case"mp3":return"audio/mp3";case"webm":return k(t)?"audio/webm":"video/webm";case"ogg":return k(t)?"audio/ogg":"video/ogg";case"ogv":return"video/ogg";case"oga":return"audio/ogg";case"3gp":return"audio/3gpp";case"wav":return"audio/wav";case"aac":return"audio/aac";case"flac":return"audio/flac";default:return k(t)?"audio/mp3":"video/mp4"}}var oe,le,fe,ue,ce,de,he,ve,pe=function(e,t,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,i):s?s.value=i:t.set(e,i),i},me=function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},ye=o(function e(t,i,n){a(this,e),oe.set(this,void 0),le.set(this,void 0),fe.set(this,void 0),ue.set(this,{button:{},global:{},media:{}}),ce.set(this,[]),de.set(this,""),he.set(this,void 0),ve.set(this,void 0),pe(this,oe,t,"f"),pe(this,he,i,"f"),pe(this,ve,n,"f")},[{key:"create",value:function(){var e=this,t=me(this,oe,"f").getOptions(),i=t.labels,n=t.defaultLevel,s=t.detachMenus,a=null!==n?parseInt(n||"0",10):me(this,oe,"f").getMedia().level;pe(this,de,"".concat(a),"f");var r=this._formatMenuItems(),o=r.length?r.find(function(t){return t.key===me(e,de,"f")}):null,l=o?o.label:(null==i?void 0:i.auto)||"",f=!1;pe(this,le,document.createElement("button"),"f"),me(this,le,"f").className="op-controls__levels op-control__".concat(me(this,he,"f")),me(this,le,"f").tabIndex=0,me(this,le,"f").type="button",me(this,le,"f").title=(null==i?void 0:i.mediaLevels)||"",me(this,le,"f").setAttribute("aria-controls",me(this,oe,"f").id),me(this,le,"f").setAttribute("aria-label",(null==i?void 0:i.mediaLevels)||""),me(this,le,"f").setAttribute("data-active-level",me(this,de,"f")),me(this,le,"f").innerHTML="<span>".concat(l,"</span>");var u=function(){me(e,ce,"f").length?f||(me(e,oe,"f").getMedia().level=a,f=!0):(e._gatherLevels(),setTimeout(function(){me(e,oe,"f").getMedia().level=a;var t=M("controlschanged");me(e,oe,"f").getElement().dispatchEvent(t)},0))};me(this,ue,"f").media.loadedmetadata=u.bind(this),me(this,ue,"f").media.manifestLoaded=u.bind(this),me(this,ue,"f").media.hlsManifestParsed=u.bind(this),s&&(this._buildMenu(),me(this,ue,"f").button.click=function(){if(s){for(var t=me(e,oe,"f").getContainer().querySelectorAll(".op-settings"),i=0,n=t.length;i<n;++i)t[i]!==me(e,fe,"f")&&t[i].setAttribute("aria-hidden","true");"true"===me(e,fe,"f").getAttribute("aria-hidden")?me(e,fe,"f").setAttribute("aria-hidden","false"):me(e,fe,"f").setAttribute("aria-hidden","true")}},me(this,ue,"f").button.mouseover=function(){if(!p&&!m){for(var t=me(e,oe,"f").getContainer().querySelectorAll(".op-settings"),i=0,n=t.length;i<n;++i)t[i]!==me(e,fe,"f")&&t[i].setAttribute("aria-hidden","true");"true"===me(e,fe,"f").getAttribute("aria-hidden")&&me(e,fe,"f").setAttribute("aria-hidden","false")}},me(this,ue,"f").button.mouseout=function(){if(!p&&!m){for(var t=me(e,oe,"f").getContainer().querySelectorAll(".op-settings"),i=0,n=t.length;i<n;++i)t[i].setAttribute("aria-hidden","true");"false"===me(e,fe,"f").getAttribute("aria-hidden")&&me(e,fe,"f").setAttribute("aria-hidden","true")}},me(this,le,"f").addEventListener("click",me(this,ue,"f").button.click,E),me(this,le,"f").addEventListener("mouseover",me(this,ue,"f").button.mouseover,E),me(this,fe,"f").addEventListener("mouseover",me(this,ue,"f").button.mouseover,E),me(this,fe,"f").addEventListener("mouseout",me(this,ue,"f").button.mouseout,E),me(this,oe,"f").getElement().addEventListener("controlshidden",me(this,ue,"f").button.mouseout,E)),me(this,ue,"f").global.click=function(t){var i=t.target,n=me(e,oe,"f").getMedia().currentTime,a=me(e,oe,"f").getMedia().paused;if(i.closest("#".concat(me(e,oe,"f").id))&&i.classList.contains("op-levels__option")){var r=i.getAttribute("data-value"),o=r?r.replace("levels-",""):"-1";if(pe(e,de,"".concat(o),"f"),s){me(e,le,"f").setAttribute("data-active-level","".concat(o)),me(e,le,"f").innerHTML="<span>".concat(L(i.innerText,!0),"</span>");for(var l=i.parentElement&&i.parentElement.parentElement?i.parentElement.parentElement.querySelectorAll(".op-settings__submenu-item"):[],f=0,u=l.length;f<u;++f)l[f].setAttribute("aria-checked","false");i.parentElement&&i.parentElement.setAttribute("aria-checked","true"),me(e,fe,"f").setAttribute("aria-hidden","false")}me(e,oe,"f").getMedia().level=o,me(e,oe,"f").getMedia().currentTime=n,a||me(e,oe,"f").play();var c=M("levelchanged",{detail:{label:i.innerText.trim(),level:o}});me(e,oe,"f").getElement().dispatchEvent(c),t.preventDefault(),t.stopPropagation()}};var c=(null==d?void 0:d.connection)||(null==d?void 0:d.mozConnection)||(null==d?void 0:d.webkitConnection);me(this,ue,"f").global.connection=function(){var t=me(e,oe,"f").getMedia().current;if(!se(t)&&!ne(t)){var i=(null==c?void 0:c.effectiveType)||"",n=me(e,ce,"f").map(function(e){return Object.assign(Object.assign({},e),{resolution:parseInt(e.label.replace("p",""),10)})}),s=n.find(function(e){return e.resolution<360});"4g"===i?s=n.find(function(e){return e.resolution>=720}):"3g"===i&&(s=n.find(function(e){return e.resolution>=360&&e.resolution<720})),s&&(me(e,oe,"f").pause(),me(e,oe,"f").getMedia().level=s.id,me(e,oe,"f").play())}},Object.keys(me(this,ue,"f").media).forEach(function(t){me(e,oe,"f").getElement().addEventListener(t,me(e,ue,"f").media[t],E)}),document.addEventListener("click",me(this,ue,"f").global.click,E),c&&c.addEventListener("change",me(this,ue,"f").global.connection,E)}},{key:"destroy",value:function(){var e=this,t=me(this,oe,"f").getOptions().detachMenus,i=(null==d?void 0:d.connection)||(null==d?void 0:d.mozConnection)||(null==d?void 0:d.webkitConnection);Object.keys(me(this,ue,"f").media).forEach(function(t){me(e,oe,"f").getElement().removeEventListener(t,me(e,ue,"f").media[t])}),document.removeEventListener("click",me(this,ue,"f").global.click),i&&i.removeEventListener("change",me(this,ue,"f").global.connection),t&&(me(this,le,"f").removeEventListener("click",me(this,ue,"f").button.click),me(this,le,"f").remove(),me(this,le,"f").removeEventListener("mouseover",me(this,ue,"f").button.mouseover),me(this,fe,"f").removeEventListener("mouseover",me(this,ue,"f").button.mouseover),me(this,fe,"f").removeEventListener("mouseout",me(this,ue,"f").button.mouseout),me(this,oe,"f").getElement().removeEventListener("controlshidden",me(this,ue,"f").button.mouseout),me(this,fe,"f").remove())}},{key:"addSettings",value:function(){var e=me(this,oe,"f").getOptions(),t=e.labels;if(e.detachMenus)return{};var i=this._formatMenuItems();return i.length>2?{className:"op-levels__option",default:me(this,de,"f")||"-1",key:"levels",name:null==t?void 0:t.levels,subitems:i}:{}}},{key:"_formatMenuItems",value:function(){for(var e=me(this,oe,"f").getOptions().labels,t=this._gatherLevels(),i=t.length,n=i?[{key:"-1",label:null==e?void 0:e.auto}]:[],s=function(){var e=t[a];(n=n.filter(function(t){return t.key!==e.id})).push({key:e.id,label:e.label})},a=0;a<i;a++)s();return n.reduce(function(e,t){return e.find(function(e){return e.label===t.label})?e:e.concat([t])},[]).sort(function(e,t){return parseInt((null==e?void 0:e.label)||"",10)>parseInt((null==t?void 0:t.label)||"",10)?1:-1})}},{key:"_getResolutionsLabel",value:function(e){var t=me(this,oe,"f").getOptions().labels;return e>=4320?"8K":e>=2160?"4K":e>=1440?"1440p":e>=1080?"1080p":e>=720?"720p":e>=480?"480p":e>=360?"360p":e>=240?"240p":e>=144?"144p":(null==t?void 0:t.auto)||""}},{key:"_gatherLevels",value:function(){var e=this;return me(this,ce,"f").length||me(this,oe,"f").getMedia().levels.forEach(function(t){me(e,ce,"f").push(Object.assign(Object.assign({},t),{label:t.label||e._getResolutionsLabel(t.height)}))}),me(this,ce,"f")}},{key:"_buildMenu",value:function(){var e=this;if(me(this,oe,"f").getOptions().detachMenus){me(this,le,"f").classList.add("op-control--no-hover"),pe(this,fe,document.createElement("div"),"f"),me(this,fe,"f").className="op-settings op-levels__menu",me(this,fe,"f").setAttribute("aria-hidden","true");var t=this._formatMenuItems(),i='<div class="op-settings__menu" role="menu" id="menu-item-levels">\n '.concat(t.map(function(t){return'\n <div class="op-settings__submenu-item" tabindex="0" role="menuitemradio"\n aria-checked="'.concat(me(e,de,"f")===t.key?"true":"false",'">\n <div class="op-settings__submenu-label ').concat("op-levels__option",'" data-value="levels-').concat(t.key,'">').concat(t.label,"</div>\n </div>")}).join(""),"\n </div>");me(this,fe,"f").innerHTML=i;var n=document.createElement("div");n.className="op-controls__container op-control__".concat(me(this,he,"f")),n.appendChild(me(this,le,"f")),n.appendChild(me(this,fe,"f")),me(this,oe,"f").getControls().getLayer(me(this,ve,"f")).appendChild(n)}}}]);oe=new WeakMap,le=new WeakMap,fe=new WeakMap,ue=new WeakMap,ce=new WeakMap,de=new WeakMap,he=new WeakMap,ve=new WeakMap;var ge,be,Ee,we,ke,_e=ye,Ae=function(e,t,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,i):s?s.value=i:t.set(e,i),i},Le=function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},Me=o(function e(t,i,n){a(this,e),ge.set(this,void 0),be.set(this,void 0),Ee.set(this,{controls:{},media:{}}),we.set(this,void 0),ke.set(this,void 0),Ae(this,ge,t,"f"),Ae(this,we,i,"f"),Ae(this,ke,n,"f"),this._enterSpaceKeyEvent=this._enterSpaceKeyEvent.bind(this)},[{key:"create",value:function(){var e,t=this,i=Le(this,ge,"f").getOptions().labels;Ae(this,be,document.createElement("button"),"f"),Le(this,be,"f").type="button",Le(this,be,"f").className="op-controls__playpause op-control__".concat(Le(this,we,"f")),Le(this,be,"f").tabIndex=0,Le(this,be,"f").title=(null==i?void 0:i.play)||"",Le(this,be,"f").setAttribute("aria-controls",Le(this,ge,"f").id),Le(this,be,"f").setAttribute("aria-pressed","false"),Le(this,be,"f").setAttribute("aria-label",(null==i?void 0:i.play)||""),Le(this,ge,"f").getControls().getLayer(Le(this,ke,"f")).appendChild(Le(this,be,"f")),Le(this,Ee,"f").button=function(e){Le(t,be,"f").setAttribute("aria-pressed","true");var i=Le(t,ge,"f").activeElement();i.paused||i.ended?(Le(t,ge,"f").getAd()&&(Le(t,ge,"f").getAd().playRequested=!0),i.play(),Le(t,Ee,"f").media.play()):(i.pause(),Le(t,Ee,"f").media.pause()),e.preventDefault(),e.stopPropagation()};var n=k(Le(this,ge,"f").getElement());Le(this,Ee,"f").media.play=function(){var e;Le(t,ge,"f").activeElement().ended?(Le(t,ge,"f").isMedia()?Le(t,be,"f").classList.add("op-controls__playpause--replay"):Le(t,be,"f").classList.add("op-controls__playpause--pause"),Le(t,be,"f").title=(null==i?void 0:i.play)||"",Le(t,be,"f").setAttribute("aria-label",(null==i?void 0:i.play)||"")):(Le(t,be,"f").classList.remove("op-controls__playpause--replay"),Le(t,be,"f").classList.add("op-controls__playpause--pause"),Le(t,be,"f").title=(null==i?void 0:i.pause)||"",Le(t,be,"f").setAttribute("aria-label",(null==i?void 0:i.pause)||""),(null===(e=Le(t,ge,"f").getOptions())||void 0===e?void 0:e.pauseOthers)&&Object.keys($n.instances).forEach(function(e){e!==Le(t,ge,"f").id&&$n.instances[e].activeElement().pause()}))},Le(this,Ee,"f").media.loadedmetadata=function(){(Le(t,be,"f").classList.contains("op-controls__playpause--pause")||Le(t,be,"f").classList.contains("op-controls__playpause--replay"))&&(Le(t,be,"f").classList.remove("op-controls__playpause--replay"),Le(t,be,"f").classList.remove("op-controls__playpause--pause"),Le(t,be,"f").title=(null==i?void 0:i.play)||"",Le(t,be,"f").setAttribute("aria-label",(null==i?void 0:i.play)||""))},Le(this,Ee,"f").media.playing=function(){Le(t,be,"f").classList.contains("op-controls__playpause--pause")||(Le(t,be,"f").classList.remove("op-controls__playpause--replay"),Le(t,be,"f").classList.add("op-controls__playpause--pause"),Le(t,be,"f").title=(null==i?void 0:i.pause)||"",Le(t,be,"f").setAttribute("aria-label",(null==i?void 0:i.pause)||""))},Le(this,Ee,"f").media.pause=function(){Le(t,be,"f").classList.remove("op-controls__playpause--pause"),Le(t,be,"f").title=(null==i?void 0:i.play)||"",Le(t,be,"f").setAttribute("aria-label",(null==i?void 0:i.play)||"")},Le(this,Ee,"f").media.ended=function(){Le(t,ge,"f").activeElement().ended&&Le(t,ge,"f").isMedia()||Le(t,ge,"f").getElement().currentTime>=Le(t,ge,"f").getElement().duration||Le(t,ge,"f").getElement().currentTime<=0?(Le(t,be,"f").classList.add("op-controls__playpause--replay"),Le(t,be,"f").classList.remove("op-controls__playpause--pause")):(Le(t,be,"f").classList.remove("op-controls__playpause--replay"),Le(t,be,"f").classList.add("op-controls__playpause--pause")),Le(t,be,"f").title=(null==i?void 0:i.play)||"",Le(t,be,"f").setAttribute("aria-label",(null==i?void 0:i.play)||"")},Le(this,Ee,"f").media.adsmediaended=function(){Le(t,be,"f").classList.remove("op-controls__playpause--replay"),Le(t,be,"f").classList.add("op-controls__playpause--pause"),Le(t,be,"f").title=(null==i?void 0:i.pause)||"",Le(t,be,"f").setAttribute("aria-label",(null==i?void 0:i.pause)||"")},Le(this,Ee,"f").media.playererror=function(){n&&Le(t,ge,"f").activeElement().pause()};var s=Le(this,ge,"f").getElement();Le(this,Ee,"f").controls.controlschanged=function(){if(!Le(t,ge,"f").activeElement().paused){var e=M("playing");s.dispatchEvent(e)}},Object.keys(Le(this,Ee,"f").media).forEach(function(e){s.addEventListener(e,Le(t,Ee,"f").media[e],E)}),(null===(e=Le(this,ge,"f").getOptions().media)||void 0===e?void 0:e.pauseOnClick)&&s.addEventListener("click",Le(this,Ee,"f").button,E),Le(this,ge,"f").getControls().getContainer().addEventListener("controlschanged",Le(this,Ee,"f").controls.controlschanged,E),Le(this,ge,"f").getContainer().addEventListener("keydown",this._enterSpaceKeyEvent,E),Le(this,be,"f").addEventListener("click",Le(this,Ee,"f").button,E)}},{key:"destroy",value:function(){var e,t=this;Object.keys(Le(this,Ee,"f").media).forEach(function(e){Le(t,ge,"f").getElement().removeEventListener(e,Le(t,Ee,"f").media[e])}),(null===(e=Le(this,ge,"f").getOptions().media)||void 0===e?void 0:e.pauseOnClick)&&Le(this,ge,"f").getElement().removeEventListener("click",Le(this,Ee,"f").button),Le(this,ge,"f").getControls().getContainer().removeEventListener("controlschanged",Le(this,Ee,"f").controls.controlschanged),Le(this,ge,"f").getContainer().removeEventListener("keydown",this._enterSpaceKeyEvent),Le(this,be,"f").removeEventListener("click",Le(this,Ee,"f").button),Le(this,be,"f").remove()}},{key:"_enterSpaceKeyEvent",value:function(e){var t,i=e.which||e.keyCode||0;!(null===(t=null===document||void 0===document?void 0:document.activeElement)||void 0===t?void 0:t.classList.contains("op-controls__playpause"))||13!==i&&32!==i||Le(this,Ee,"f").button(e)}}]);ge=new WeakMap,be=new WeakMap,Ee=new WeakMap,we=new WeakMap,ke=new WeakMap;var Te=Me;function Ce(e,t){var i=Math.floor(e%1*(t||0)),n=Math.floor(e),s=Math.floor(n/60),a=Math.floor(s/60),r=function(e){var t=e.toString();return e<10?e<=0?"00":"0".concat(t):t};return s%=60,n%=60,"".concat(a>0?"".concat(r(a),":"):"").concat(r(s),":").concat(r(n)).concat(i?":".concat(r(i)):"")}var Se,xe,Oe,Pe,je,We,Re,Ne,Ie,De,Be=function(e,t,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,i):s?s.value=i:t.set(e,i),i},Fe=function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},qe=o(function e(t,i,n){a(this,e),Se.set(this,void 0),xe.set(this,void 0),Oe.set(this,void 0),Pe.set(this,void 0),je.set(this,void 0),We.set(this,void 0),Re.set(this,{container:{},controls:{},global:{},media:{},slider:{}}),Ne.set(this,!1),Ie.set(this,void 0),De.set(this,void 0),Be(this,Se,t,"f"),Be(this,Ie,i,"f"),Be(this,De,n,"f"),this._enterSpaceKeyEvent=this._enterSpaceKeyEvent.bind(this)},[{key:"create",value:function(){var e,t=this,i=Fe(this,Se,"f").getOptions(),n=i.labels,s=i.progress;Be(this,xe,document.createElement("div"),"f"),Fe(this,xe,"f").className="op-controls__progress op-control__".concat(Fe(this,Ie,"f")),Fe(this,xe,"f").tabIndex=0,Fe(this,xe,"f").setAttribute("aria-label",(null==n?void 0:n.progressSlider)||""),Fe(this,xe,"f").setAttribute("aria-valuemin","0"),Fe(this,xe,"f").setAttribute("aria-valuenow","0"),Fe(this,xe,"f").setAttribute("role","slider"),Be(this,Oe,document.createElement("input"),"f"),Fe(this,Oe,"f").type="range",Fe(this,Oe,"f").className="op-controls__progress--seek",Fe(this,Oe,"f").tabIndex=-1,Fe(this,Oe,"f").setAttribute("min","0"),Fe(this,Oe,"f").setAttribute("step","0.1"),Fe(this,Oe,"f").value="0",Fe(this,Oe,"f").setAttribute("aria-label",(null==n?void 0:n.progressRail)||""),Fe(this,Oe,"f").setAttribute("role","slider"),Be(this,Pe,document.createElement("progress"),"f"),Fe(this,Pe,"f").className="op-controls__progress--buffer",Fe(this,Pe,"f").setAttribute("max","100"),Fe(this,Pe,"f").value=0,Be(this,je,document.createElement("progress"),"f"),Fe(this,je,"f").className="op-controls__progress--played",Fe(this,je,"f").setAttribute("max","100"),Fe(this,je,"f").value=0,Fe(this,xe,"f").appendChild(Fe(this,Oe,"f")),Fe(this,xe,"f").appendChild(Fe(this,je,"f")),Fe(this,xe,"f").appendChild(Fe(this,Pe,"f")),p||m||(Be(this,We,document.createElement("span"),"f"),Fe(this,We,"f").className="op-controls__tooltip",Fe(this,We,"f").tabIndex=-1,Fe(this,We,"f").innerHTML="00:00",Fe(this,xe,"f").appendChild(Fe(this,We,"f")));var a=function(){var e;Fe(t,Oe,"f").classList.contains("error")&&Fe(t,Oe,"f").classList.remove("error");var i=Fe(t,Se,"f").activeElement();if(i.duration===1/0||Fe(t,Se,"f").getElement().getAttribute("op-live__enabled")||Fe(t,Se,"f").getElement().getAttribute("op-dvr__enabled"))Fe(t,Se,"f").getElement().getAttribute("op-dvr__enabled")?(Fe(t,Oe,"f").setAttribute("max","1"),Fe(t,Oe,"f").value="1",Fe(t,Oe,"f").style.backgroundSize="100% 100%",Fe(t,je,"f").value=1,Fe(t,xe,"f").setAttribute("aria-valuemax","1"),Fe(t,xe,"f").setAttribute("aria-hidden","false")):(null===(e=Fe(t,Se,"f").getOptions().live)||void 0===e?void 0:e.showProgress)||Fe(t,xe,"f").setAttribute("aria-hidden","true");else{var n=Fe(t,Se,"f").isMedia()?i.currentTime:i.duration-i.currentTime;Fe(t,Oe,"f").value=n.toString(),Number.isNaN(i.duration)||(Fe(t,Oe,"f").setAttribute("max","".concat(i.duration)),Fe(t,xe,"f").setAttribute("aria-valuemax",i.duration.toString()))}},r=0,o=(null===(e=Fe(this,Se,"f").getOptions().progress)||void 0===e?void 0:e.duration)||0,l=k(Fe(this,Se,"f").getElement());Fe(this,Re,"f").media.loadedmetadata=a.bind(this),Fe(this,Re,"f").controls.controlschanged=a.bind(this),Fe(this,Re,"f").media.progress=function(e){var i,n=e.target;if(n.duration===1/0||Fe(t,Se,"f").getElement().getAttribute("op-live__enabled"))Fe(t,Se,"f").getElement().getAttribute("op-dvr__enabled")||"false"!==Fe(t,xe,"f").getAttribute("aria-hidden")||(null===(i=Fe(t,Se,"f").getOptions().live)||void 0===i?void 0:i.showProgress)||Fe(t,xe,"f").setAttribute("aria-hidden","true");else if(n.duration>0)for(var s=0,a=n.buffered.length;s<a;s++)if(n.buffered.start(n.buffered.length-1-s)<n.currentTime){Fe(t,Pe,"f").value=n.buffered.end(n.buffered.length-1-s)/n.duration*100;break}},Fe(this,Re,"f").media.waiting=function(){l&&!Fe(t,Oe,"f").classList.contains("loading")&&Fe(t,Oe,"f").classList.add("loading"),l&&Fe(t,Oe,"f").classList.contains("error")&&Fe(t,Oe,"f").classList.remove("error")},Fe(this,Re,"f").media.playererror=function(){l&&!Fe(t,Oe,"f").classList.contains("error")&&Fe(t,Oe,"f").classList.add("error"),l&&Fe(t,Oe,"f").classList.contains("loading")&&Fe(t,Oe,"f").classList.remove("loading")},Fe(this,Re,"f").media.pause=function(){var e=Fe(t,Se,"f").activeElement();if(e.duration!==1/0&&!Fe(t,Se,"f").getElement().getAttribute("op-live__enabled")){var i=e.currentTime;Fe(t,xe,"f").setAttribute("aria-valuenow",i.toString(