openplayerjs
Version:
HTML5 video and audio player
1 lines • 163 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={633:function(e,t,i){var n=i(738).default;function s(){"use strict";e.exports=s=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var t,i={},a=Object.prototype,r=a.hasOwnProperty,o=Object.defineProperty||function(e,t,i){e[t]=i.value},l="function"==typeof Symbol?Symbol:{},f=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function d(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(t){d=function(e,t,i){return e[t]=i}}function h(e,t,i,n){var s=t&&t.prototype instanceof E?t:E,a=Object.create(s.prototype),r=new j(n||[]);return o(a,"_invoke",{value:S(e,i,r)}),a}function v(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}i.wrap=h;var p="suspendedStart",m="suspendedYield",y="executing",g="completed",b={};function E(){}function w(){}function k(){}var _={};d(_,f,(function(){return this}));var A=Object.getPrototypeOf,L=A&&A(A(W([])));L&&L!==a&&r.call(L,f)&&(_=L);var M=k.prototype=E.prototype=Object.create(_);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function i(s,a,o,l){var f=v(e[s],e,a);if("throw"!==f.type){var c=f.arg,u=c.value;return u&&"object"==n(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){i("next",e,o,l)}),(function(e){i("throw",e,o,l)})):t.resolve(u).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,l)}))}l(f.arg)}var s;o(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,s){i(e,n,t,s)}))}return s=s?s.then(a,a):a()}})}function S(e,i,n){var s=p;return function(a,r){if(s===y)throw Error("Generator is already running");if(s===g){if("throw"===a)throw r;return{value:t,done:!0}}for(n.method=a,n.arg=r;;){var o=n.delegate;if(o){var l=O(o,n);if(l){if(l===b)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(s===p)throw s=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);s=y;var f=v(e,i,n);if("normal"===f.type){if(s=n.done?g:m,f.arg===b)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(s=g,n.method="throw",n.arg=f.arg)}}}function O(e,i){var n=i.method,s=e.iterator[n];if(s===t)return i.delegate=null,"throw"===n&&e.iterator.return&&(i.method="return",i.arg=t,O(e,i),"throw"===i.method)||"return"!==n&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var a=v(s,e.iterator,i.arg);if("throw"===a.type)return i.method="throw",i.arg=a.arg,i.delegate=null,b;var r=a.arg;return r?r.done?(i[e.resultName]=r.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,b):r:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,b)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function W(e){if(e||""===e){var i=e[f];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var s=-1,a=function i(){for(;++s<e.length;)if(r.call(e,s))return i.value=e[s],i.done=!1,i;return i.value=t,i.done=!0,i};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=k,o(M,"constructor",{value:k,configurable:!0}),o(k,"constructor",{value:w,configurable:!0}),w.displayName=d(k,u,"GeneratorFunction"),i.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},i.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,d(e,u,"GeneratorFunction")),e.prototype=Object.create(M),e},i.awrap=function(e){return{__await:e}},T(C.prototype),d(C.prototype,c,(function(){return this})),i.AsyncIterator=C,i.async=function(e,t,n,s,a){void 0===a&&(a=Promise);var r=new C(h(e,t,n,s),a);return i.isGeneratorFunction(t)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(M),d(M,u,"Generator"),d(M,f,(function(){return this})),d(M,"toString",(function(){return"[object Generator]"})),i.keys=function(e){var t=Object(e),i=[];for(var n in t)i.push(n);return i.reverse(),function e(){for(;i.length;){var n=i.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},i.values=W,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(x),!e)for(var i in this)"t"===i.charAt(0)&&r.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function n(n,s){return o.type="throw",o.arg=e,i.next=n,s&&(i.method="next",i.arg=t),!!s}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),f=r.call(a,"finallyLoc");if(l&&f){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!f)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var s=n;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=e,a.arg=t,s?(this.method="next",this.next=s.finallyLoc,b):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),b},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),x(i),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var n=i.completion;if("throw"===n.type){var s=n.arg;x(i)}return s}}throw Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:W(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),b}},i}e.exports=s,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)}}},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 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}function u(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 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)||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],c=f.name,u=f.value.replace(/\s+/g,"").toLowerCase();["src","href","xlink:href"].includes(c)&&(u.includes("javascript:")||u.includes("data:"))&&s.removeAttribute(c),c.startsWith("on")&&s.removeAttribute(c)}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,O,P,x,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),O.set(this,void 0),P.set(this,void 0),x.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,O,document.createElement("button"),"f"),q(this,O,"f").className="op-controls__captions op-control__".concat(q(this,D,"f")),q(this,O,"f").tabIndex=0,q(this,O,"f").title=(null==s?void 0:s.toggleCaptions)||"",q(this,O,"f").setAttribute("aria-controls",q(this,S,"f").id),q(this,O,"f").setAttribute("aria-pressed","false"),q(this,O,"f").setAttribute("aria-label",(null==s?void 0:s.toggleCaptions)||""),q(this,O,"f").setAttribute("data-active-captions","off"),F(this,P,document.createElement("div"),"f"),q(this,P,"f").className="op-captions";var r=q(this,S,"f").getContainer();if(r.insertBefore(q(this,P,"f"),r.firstChild),a){q(this,O,"f").classList.add("op-control--no-hover"),F(this,x,document.createElement("div"),"f"),q(this,x,"f").className="op-settings op-captions__menu",q(this,x,"f").setAttribute("aria-hidden","true"),q(this,x,"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,O,"f"),q(this,x,"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 c=l.value,u=document.createElement("div"),d=(null===(e=null==s?void 0:s.lang)||void 0===e?void 0:e[c.language])||null;u.className="op-settings__submenu-item",u.tabIndex=0,u.setAttribute("role","menuitemradio"),u.setAttribute("aria-checked",q(this,I,"f")===c.language?"true":"false"),u.innerHTML='<div class="op-settings__submenu-label op-subtitles__option"\n data-value="captions-'.concat(c.language,'">\n ').concat(d||c.label,"\n </div>"),q(this,x,"f").append(u)}}catch(e){f.e(e)}finally{f.f()}}else q(this,S,"f").getControls().getLayer(q(this,B,"f")).append(q(this,O,"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,x,"f")&&l.setAttribute("aria-hidden","true")}"true"===q(t,x,"f").getAttribute("aria-hidden")?q(t,x,"f").setAttribute("aria-hidden","false"):q(t,x,"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,c=T(q(t,W,"f"));try{for(c.s();!(f=c.n()).done;){var u=f.value;u.mode=n.getAttribute("data-active-captions")===u.language?"showing":"hidden"}}catch(e){c.e(e)}finally{c.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,x,"f")&&e[i].setAttribute("aria-hidden","true");"true"===q(t,x,"f").getAttribute("aria-hidden")&&q(t,x,"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,x,"f").getAttribute("aria-hidden")&&q(t,x,"f").setAttribute("aria-hidden","true")}},q(this,O,"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,O,"f").classList.contains("op-controls__captions--on")?(q(t,O,"f").classList.remove("op-controls__captions--on"),q(t,O,"f").setAttribute("data-active-captions","off")):(q(t,O,"f").classList.add("op-controls__captions--on"),q(t,O,"f").setAttribute("data-active-captions",n));for(var l=q(t,x,"f").querySelectorAll(".op-settings__submenu-item"),f=0,c=Array.from(l);f<c.length;f++)c[f].setAttribute("aria-checked","false");i.parentElement.setAttribute("aria-checked","true"),q(t,x,"f").setAttribute("aria-hidden","false")}else q(t,O,"f").setAttribute("data-active-captions",n);var u=M("captionschanged");q(t,S,"f").getElement().dispatchEvent(u)}},q(this,j,"f").global.cuechange=function(e){var i;t._hideCaptions();var n=e.target;"showing"===n.mode&&"off"!==q(t,O,"f").getAttribute("data-active-captions")&&n.activeCues&&(null===(i=n.activeCues)||void 0===i?void 0:i.length)>0&&t._showCaptions()},a&&(q(this,O,"f").addEventListener("mouseover",q(this,j,"f").button.mouseover,E),q(this,x,"f").addEventListener("mouseover",q(this,j,"f").button.mouseover,E),q(this,x,"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,O,"f").removeEventListener("click",q(this,j,"f").button.click),e&&(q(this,O,"f").removeEventListener("mouseover",q(this,j,"f").button.mouseover),q(this,x,"f").removeEventListener("mouseover",q(this,j,"f").button.mouseover),q(this,x,"f").removeEventListener("mouseout",q(this,j,"f").button.mouseout),q(this,S,"f").getElement().removeEventListener("controlshidden",q(this,j,"f").button.mouseout),q(this,x,"f").remove()),q(this,O,"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,O,"f").setAttribute("data-active-captions",q(this,I,"f")),q(this,O,"f").classList.add("op-controls__captions--on"),q(this,P,"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,P,"f")){var a=document.createElement("span");a.innerHTML=s,q(this,P,"f").prepend(a),q(this,P,"f").classList.add("op-captions--on")}else this._hideCaptions()}}},{key:"_hideCaptions",value:function(){for(var e;null===(e=q(this,P,"f"))||void 0===e?void 0:e.lastChild;)q(this,P,"f").removeChild(q(this,P,"f").lastChild)}}]);S=new WeakMap,O=new WeakMap,P=new WeakMap,x=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,ce,ue,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),ce.set(this,{button:{},global:{},media:{}}),ue.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").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 c=function(){me(e,ue,"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,ce,"f").media.loadedmetadata=c.bind(this),me(this,ce,"f").media.manifestLoaded=c.bind(this),me(this,ce,"f").media.hlsManifestParsed=c.bind(this),s&&(this._buildMenu(),me(this,ce,"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,ce,"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,ce,"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,ce,"f").button.click,E),me(this,le,"f").addEventListener("mouseover",me(this,ce,"f").button.mouseover,E),me(this,fe,"f").addEventListener("mouseover",me(this,ce,"f").button.mouseover,E),me(this,fe,"f").addEventListener("mouseout",me(this,ce,"f").button.mouseout,E),me(this,oe,"f").getElement().addEventListener("controlshidden",me(this,ce,"f").button.mouseout,E)),me(this,ce,"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,c=l.length;f<c;++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 u=M("levelchanged",{detail:{label:i.innerText.trim(),level:o}});me(e,oe,"f").getElement().dispatchEvent(u),t.preventDefault(),t.stopPropagation()}};var u=(null==d?void 0:d.connection)||(null==d?void 0:d.mozConnection)||(null==d?void 0:d.webkitConnection);me(this,ce,"f").global.connection=function(){var t=me(e,oe,"f").getMedia().current;if(!se(t)&&!ne(t)){var i=(null==u?void 0:u.effectiveType)||"",n=me(e,ue,"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,ce,"f").media).forEach((function(t){me(e,oe,"f").getElement().addEventListener(t,me(e,ce,"f").media[t],E)})),document.addEventListener("click",me(this,ce,"f").global.click,E),u&&u.addEventListener("change",me(this,ce,"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,ce,"f").media).forEach((function(t){me(e,oe,"f").getElement().removeEventListener(t,me(e,ce,"f").media[t])})),document.removeEventListener("click",me(this,ce,"f").global.click),i&&i.removeEventListener("change",me(this,ce,"f").global.connection),t&&(me(this,le,"f").removeEventListener("click",me(this,ce,"f").button.click),me(this,le,"f").remove(),me(this,le,"f").removeEventListener("mouseover",me(this,ce,"f").button.mouseover),me(this,fe,"f").removeEventListener("mouseover",me(this,ce,"f").button.mouseover),me(this,fe,"f").removeEventListener("mouseout",me(this,ce,"f").button.mouseout),me(this,oe,"f").getElement().removeEventListener("controlshidden",me(this,ce,"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,ue,"f").length||me(this,oe,"f").getMedia().levels.forEach((function(t){me(e,ue,"f").push(Object.assign(Object.assign({},t),{label:t.label||e._getResolutionsLabel(t.height)}))})),me(this,ue,"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,ce=new WeakMap,ue=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,Oe,Pe,xe,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),Oe.set(this,void 0),Pe.set(this,void 0),xe.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,Oe,document.createElement("div"),"f"),Fe(this,Oe,"f").className="op-controls__progress op-control__".concat(Fe(this,Ie,"f")),Fe(this,Oe,"f").tabIndex=0,Fe(this,Oe,"f").setAttribute("aria-label",(null==n?void 0:n.progressSlider)||""),Fe(this,Oe,"f").setAttribute("aria-valuemin","0"),Fe(this,Oe,"f").setAttribute("aria-valuenow","0"),Fe(this,Oe,"f").setAttribute("role","slider"),Be(this,Pe,document.createElement("input"),"f"),Fe(this,Pe,"f").type="range",Fe(this,Pe,"f").className="op-controls__progress--seek",Fe(this,Pe,"f").tabIndex=-1,Fe(this,Pe,"f").setAttribute("min","0"),Fe(this,Pe,"f").setAttribute("step","0.1"),Fe(this,Pe,"f").value="0",Fe(this,Pe,"f").setAttribute("aria-label",(null==n?void 0:n.progressRail)||""),Fe(this,Pe,"f").setAttribute("role","slider"),Be(this,xe,document.createElement("progress"),"f"),Fe(this,xe,"f").className="op-controls__progress--buffer",Fe(this,xe,"f").setAttribute("max","100"),Fe(this,xe,"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,Oe,"f").appendChild(Fe(this,Pe,"f")),Fe(this,Oe,"f").appendChild(Fe(this,je,"f")),Fe(this,Oe,"f").appendChild(Fe(this,xe,"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,Oe,"f").appendChild(Fe(this,We,"f")));var a=function(){var e;Fe(t,Pe,"f").classList.contains("error")&&Fe(t,Pe,"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,Pe,"f").setAttribute("max","1"),Fe(t,Pe,"f").value="1",Fe(t,Pe,"f").style.backgroundSize="100% 100%",Fe(t,je,"f").value=1,Fe(t,Oe,"f").setAttribute("aria-valuemax","1"),Fe(t,Oe,"f").setAttribute("aria-hidden","false")):(null===(e=Fe(t,Se,"f").getOptions().live)||void 0===e?void 0:e.showProgress)||Fe(t,Oe,"f").setAttribute("aria-hidden","true");else{var n=Fe(t,Se,"f").isMedia()?i.currentTime:i.duration-i.currentTime;Fe(t,Pe,"f").value=n.toString(),Number.isNaN(i.duration)||(Fe(t,Pe,"f").setAttribute("max","".concat(i.duration)),Fe(t,Oe,"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())