From 0e9c12b3a672531ca44f8436026fb16808978f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Mon, 9 Aug 2021 21:59:43 -0500 Subject: [plyr]: Remove unimportant files --- youtube/static/modules/plyr/plyr.min.mjs | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 youtube/static/modules/plyr/plyr.min.mjs (limited to 'youtube/static/modules/plyr/plyr.min.mjs') diff --git a/youtube/static/modules/plyr/plyr.min.mjs b/youtube/static/modules/plyr/plyr.min.mjs deleted file mode 100644 index d008321..0000000 --- a/youtube/static/modules/plyr/plyr.min.mjs +++ /dev/null @@ -1,3 +0,0 @@ -function _defineProperties(e,t){for(var i=0;i=0||(s[i]=e[i]);return s}function _objectWithoutProperties(e,t){if(null==e)return{};var i,n,s=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _iterableToArrayLimit(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var i=[],n=!0,s=!1,a=void 0;try{for(var r,o=e[Symbol.iterator]();!(n=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);n=!0);}catch(e){s=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(s)throw a}}return i}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.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)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);it){var i=getDecimalPlaces(t);return parseFloat(e.toFixed(i))}return Math.round(e/t)*t}var RangeTouch=function(){function e(t,i){_classCallCheck$1(this,e),is.element(t)?this.element=t:is.string(t)&&(this.element=document.querySelector(t)),is.element(this.element)&&is.empty(this.element.rangeTouch)&&(this.config=_objectSpread2$1({},defaults,{},i),this.init())}return _createClass$1(e,[{key:"init",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,i=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach((function(e){t.element[i](e,(function(e){return t.set(e)}),!1)}))}},{key:"get",value:function(t){if(!e.enabled||!is.event(t))return null;var i,n=t.target,s=t.changedTouches[0],a=parseFloat(n.getAttribute("min"))||0,r=parseFloat(n.getAttribute("max"))||100,o=parseFloat(n.getAttribute("step"))||1,l=n.getBoundingClientRect(),c=100/l.width*(this.config.thumbWidth/2)/100;return 0>(i=100/l.width*(s.clientX-l.left))?i=0:100i?i-=(100-2*i)*c:500&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length,i=new Array(t>1?t-1:0),n=1;n0?t.cloneNode(!0):t,s=e.parentNode,a=e.nextSibling;n.appendChild(e),a?s.insertBefore(n,a):s.appendChild(n)}))}function setAttributes(e,t){is$1.element(e)&&!is$1.empty(t)&&Object.entries(t).filter((function(e){var t=_slicedToArray(e,2)[1];return!is$1.nullOrUndefined(t)})).forEach((function(t){var i=_slicedToArray(t,2),n=i[0],s=i[1];return e.setAttribute(n,s)}))}function createElement(e,t,i){var n=document.createElement(e);return is$1.object(t)&&setAttributes(n,t),is$1.string(i)&&(n.innerText=i),n}function insertAfter(e,t){is$1.element(e)&&is$1.element(t)&&t.parentNode.insertBefore(e,t.nextSibling)}function insertElement(e,t,i,n){is$1.element(t)&&t.appendChild(createElement(e,i,n))}function removeElement(e){is$1.nodeList(e)||is$1.array(e)?Array.from(e).forEach(removeElement):is$1.element(e)&&is$1.element(e.parentNode)&&e.parentNode.removeChild(e)}function emptyElement(e){if(is$1.element(e))for(var t=e.childNodes.length;t>0;)e.removeChild(e.lastChild),t-=1}function replaceElement(e,t){return is$1.element(t)&&is$1.element(t.parentNode)&&is$1.element(e)?(t.parentNode.replaceChild(e,t),e):null}function getAttributesFromSelector(e,t){if(!is$1.string(e)||is$1.empty(e))return{};var i={},n=extend({},t);return e.split(",").forEach((function(e){var t=e.trim(),s=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),r=_slicedToArray(a,1)[0],o=a.length>1?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":is$1.string(n.class)?i.class="".concat(n.class," ").concat(s):i.class=s;break;case"#":i.id=t.replace("#","");break;case"[":i[r]=o}})),extend(n,i)}function toggleHidden(e,t){if(is$1.element(e)){var i=t;is$1.boolean(i)||(i=!e.hidden),e.hidden=i}}function toggleClass(e,t,i){if(is$1.nodeList(e))return Array.from(e).map((function(e){return toggleClass(e,t,i)}));if(is$1.element(e)){var n="toggle";return void 0!==i&&(n=i?"add":"remove"),e.classList[n](t),e.classList.contains(t)}return!1}function hasClass(e,t){return is$1.element(e)&&e.classList.contains(t)}function matches$1(e,t){var i=Element.prototype;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function closest(e,t){return(Element.prototype.closest||function(){var e=this;do{if(matches$1.matches(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}).call(e,t)}function getElements(e){return this.elements.container.querySelectorAll(e)}function getElement(e){return this.elements.container.querySelector(e)}function setFocus(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];is$1.element(e)&&(e.focus({preventScroll:!0}),t&&toggleClass(e,this.config.classNames.tabFocus))}var defaultCodecs={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},support={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check:function(e,t,i){var n=browser.isIPhone&&i&&support.playsinline,s=support[e]||"html5"!==t;return{api:s,ui:s&&support.rangeInput&&("video"!==e||!browser.isIPhone||n)}},pip:!(browser.isIPhone||!is$1.function(createElement("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||createElement("video").disablePictureInPicture)),airplay:is$1.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime:function(e){if(is$1.empty(e))return!1;var t=_slicedToArray(e.split("/"),1)[0],i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(defaultCodecs).includes(i)&&(i+='; codecs="'.concat(defaultCodecs[e],'"'));try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:function(){var e=document.createElement("input");return e.type="range","range"===e.type}(),touch:"ontouchstart"in document.documentElement,transitions:!1!==transitionEndEvent,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},supportsPassiveListeners=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0,null}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}();function toggleListener(e,t,i){var n=this,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e&&"addEventListener"in e&&!is$1.empty(t)&&is$1.function(i)){var o=t.split(" "),l=r;supportsPassiveListeners&&(l={passive:a,capture:r}),o.forEach((function(t){n&&n.eventListeners&&s&&n.eventListeners.push({element:e,type:t,callback:i,options:l}),e[s?"addEventListener":"removeEventListener"](t,i,l)}))}}function on(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];toggleListener.call(this,e,t,i,!0,n,s)}function off(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];toggleListener.call(this,e,t,i,!1,n,s)}function once(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=function r(){off(e,i,r,s,a);for(var o=arguments.length,l=new Array(o),c=0;c1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(is$1.element(e)&&!is$1.empty(t)){var s=new CustomEvent(t,{bubbles:i,detail:_objectSpread2(_objectSpread2({},n),{},{plyr:this})});e.dispatchEvent(s)}}function unbindListeners(){this&&this.eventListeners&&(this.eventListeners.forEach((function(e){var t=e.element,i=e.type,n=e.callback,s=e.options;t.removeEventListener(i,n,s)})),this.eventListeners=[])}function ready(){var e=this;return new Promise((function(t){return e.ready?setTimeout(t,0):on.call(e,e.elements.container,"ready",t)})).then((function(){}))}function silencePromise(e){is$1.promise(e)&&e.then(null,(function(){}))}function validateRatio(e){return!!(is$1.array(e)||is$1.string(e)&&e.includes(":"))&&(is$1.array(e)?e:e.split(":")).map(Number).every(is$1.number)}function reduceAspectRatio(e){if(!is$1.array(e)||!e.every(is$1.number))return null;var t=_slicedToArray(e,2),i=t[0],n=t[1],s=function e(t,i){return 0===i?t:e(i,t%i)}(i,n);return[i/s,n/s]}function getAspectRatio(e){var t=function(e){return validateRatio(e)?e.split(":").map(Number):null},i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!is$1.empty(this.embed)&&is$1.array(this.embed.ratio)&&(i=this.embed.ratio),null===i&&this.isHTML5){var n=this.media;i=reduceAspectRatio([n.videoWidth,n.videoHeight])}return i}function setAspectRatio(e){if(!this.isVideo)return{};var t=this.elements.wrapper,i=getAspectRatio.call(this,e),n=_slicedToArray(is$1.array(i)?i:[0,0],2),s=100/n[0]*n[1];if(t.style.paddingBottom="".concat(s,"%"),this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){var a=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),r=(a-s)/(a/50);this.media.style.transform="translateY(-".concat(r,"%)")}else this.isHTML5&&t.classList.toggle(this.config.classNames.videoFixedRatio,null!==i);return{padding:s,ratio:i}}var html5={getSources:function(){var e=this;return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter((function(t){var i=t.getAttribute("type");return!!is$1.empty(i)||support.mime.call(e,i)})):[]},getQualityOptions:function(){return this.config.quality.forced?this.config.quality.options:html5.getSources.call(this).map((function(e){return Number(e.getAttribute("data-res"))})).filter(Boolean)},setup:function(){if(this.isHTML5){var e=this;e.options.speed=e.config.speed.options,is$1.empty(this.config.ratio)||setAspectRatio.call(e),Object.defineProperty(e.media,"quality",{get:function(){var t=html5.getSources.call(e).find((function(t){return t.getAttribute("src")===e.source}));return t&&Number(t.getAttribute("data-res"))},set:function(t){if(e.quality!==t){if(e.config.quality.forced&&is$1.function(e.config.quality.onChange))e.config.quality.onChange(t);else{var i=html5.getSources.call(e).find((function(e){return Number(e.getAttribute("data-res"))===t}));if(!i)return;var n=e.media,s=n.currentTime,a=n.paused,r=n.preload,o=n.readyState,l=n.playbackRate;e.media.src=i.getAttribute("src"),("none"!==r||o)&&(e.once("loadedmetadata",(function(){e.speed=l,e.currentTime=s,a||silencePromise(e.play())})),e.media.load())}triggerEvent.call(e,e.media,"qualitychange",!1,{quality:t})}}})}},cancelRequests:function(){this.isHTML5&&(removeElement(html5.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function dedupe(e){return is$1.array(e)?e.filter((function(t,i){return e.indexOf(t)===i})):e}function closest$1(e,t){return is$1.array(e)&&e.length?e.reduce((function(e,i){return Math.abs(i-t)1?t-1:0),n=1;n0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString())},toTitleCase=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.toString().replace(/\w\S*/g,(function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}))};function toPascalCase(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return t=replaceAll(t,"-"," "),t=replaceAll(t,"_"," "),t=toTitleCase(t),replaceAll(t," ","")}function toCamelCase(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return(t=toPascalCase(t)).charAt(0).toLowerCase()+t.slice(1)}function stripHTML(e){var t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.innerText}function getHTML(e){var t=document.createElement("div");return t.appendChild(e),t.innerHTML}var resources={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},i18n={get:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(is$1.empty(e)||is$1.empty(t))return"";var i=getDeep(t.i18n,e);if(is$1.empty(i))return Object.keys(resources).includes(e)?resources[e]:"";var n={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(n).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],s=t[1];i=replaceAll(i,n,s)})),i}},Storage=function(){function e(t){_classCallCheck(this,e),this.enabled=t.config.storage.enabled,this.key=t.config.storage.key}return _createClass(e,[{key:"get",value:function(t){if(!e.supported||!this.enabled)return null;var i=window.localStorage.getItem(this.key);if(is$1.empty(i))return null;var n=JSON.parse(i);return is$1.string(t)&&t.length?n[t]:n}},{key:"set",value:function(t){if(e.supported&&this.enabled&&is$1.object(t)){var i=this.get();is$1.empty(i)&&(i={}),extend(i,t),window.localStorage.setItem(this.key,JSON.stringify(i))}}}],[{key:"supported",get:function(){try{if(!("localStorage"in window))return!1;return window.localStorage.setItem("___test","___test"),window.localStorage.removeItem("___test"),!0}catch(e){return!1}}}]),e}();function fetch(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";return new Promise((function(i,n){try{var s=new XMLHttpRequest;if(!("withCredentials"in s))return;s.addEventListener("load",(function(){if("text"===t)try{i(JSON.parse(s.responseText))}catch(e){i(s.responseText)}else i(s.response)})),s.addEventListener("error",(function(){throw new Error(s.status)})),s.open("GET",e,!0),s.responseType=t,s.send()}catch(e){n(e)}}))}function loadSprite(e,t){if(is$1.string(e)){var i=is$1.string(t),n=function(){return null!==document.getElementById(t)},s=function(e,t){e.innerHTML=t,i&&n()||document.body.insertAdjacentElement("afterbegin",e)};if(!i||!n()){var a=Storage.supported,r=document.createElement("div");if(r.setAttribute("hidden",""),i&&r.setAttribute("id",t),a){var o=window.localStorage.getItem("".concat("cache","-").concat(t));if(null!==o){var l=JSON.parse(o);s(r,l.content)}}fetch(e).then((function(e){is$1.empty(e)||(a&&window.localStorage.setItem("".concat("cache","-").concat(t),JSON.stringify({content:e})),s(r,e))})).catch((function(){}))}}}var getHours=function(e){return Math.trunc(e/60/60%60,10)},getMinutes=function(e){return Math.trunc(e/60%60,10)},getSeconds=function(e){return Math.trunc(e%60,10)};function formatTime(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!is$1.number(e))return formatTime(void 0,t,i);var n=function(e){return"0".concat(e).slice(-2)},s=getHours(e),a=getMinutes(e),r=getSeconds(e);return s=t||s>0?"".concat(s,":"):"","".concat(i&&e>0?"-":"").concat(s).concat(n(a),":").concat(n(r))}var controls={getIconUrl:function(){var e=new URL(this.config.iconUrl,window.location).host!==window.location.host||browser.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:e}},findElements:function(){try{return this.elements.controls=getElement.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:getElements.call(this,this.config.selectors.buttons.play),pause:getElement.call(this,this.config.selectors.buttons.pause),restart:getElement.call(this,this.config.selectors.buttons.restart),rewind:getElement.call(this,this.config.selectors.buttons.rewind),fastForward:getElement.call(this,this.config.selectors.buttons.fastForward),mute:getElement.call(this,this.config.selectors.buttons.mute),pip:getElement.call(this,this.config.selectors.buttons.pip),airplay:getElement.call(this,this.config.selectors.buttons.airplay),settings:getElement.call(this,this.config.selectors.buttons.settings),captions:getElement.call(this,this.config.selectors.buttons.captions),fullscreen:getElement.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=getElement.call(this,this.config.selectors.progress),this.elements.inputs={seek:getElement.call(this,this.config.selectors.inputs.seek),volume:getElement.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:getElement.call(this,this.config.selectors.display.buffer),currentTime:getElement.call(this,this.config.selectors.display.currentTime),duration:getElement.call(this,this.config.selectors.display.duration)},is$1.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip))),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon:function(e,t){var i=controls.getIconUrl.call(this),n="".concat(i.cors?"":i.url,"#").concat(this.config.iconPrefix),s=document.createElementNS("http://www.w3.org/2000/svg","svg");setAttributes(s,extend(t,{"aria-hidden":"true",focusable:"false"}));var a=document.createElementNS("http://www.w3.org/2000/svg","use"),r="".concat(n,"-").concat(e);return"href"in a&&a.setAttributeNS("http://www.w3.org/1999/xlink","href",r),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r),s.appendChild(a),s},createLabel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=i18n.get(e,this.config),n=_objectSpread2(_objectSpread2({},t),{},{class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")});return createElement("span",n,i)},createBadge:function(e){if(is$1.empty(e))return null;var t=createElement("span",{class:this.config.classNames.menu.value});return t.appendChild(createElement("span",{class:this.config.classNames.menu.badge},e)),t},createButton:function(e,t){var i=this,n=extend({},t),s=toCamelCase(e),a={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((function(e){Object.keys(n).includes(e)&&(a[e]=n[e],delete n[e])})),"button"!==a.element||Object.keys(n).includes("type")||(n.type="button"),Object.keys(n).includes("class")?n.class.split(" ").some((function(e){return e===i.config.classNames.control}))||extend(n,{class:"".concat(n.class," ").concat(this.config.classNames.control)}):n.class=this.config.classNames.control,e){case"play":a.toggle=!0,a.label="play",a.labelPressed="pause",a.icon="play",a.iconPressed="pause";break;case"mute":a.toggle=!0,a.label="mute",a.labelPressed="unmute",a.icon="volume",a.iconPressed="muted";break;case"captions":a.toggle=!0,a.label="enableCaptions",a.labelPressed="disableCaptions",a.icon="captions-off",a.iconPressed="captions-on";break;case"fullscreen":a.toggle=!0,a.label="enterFullscreen",a.labelPressed="exitFullscreen",a.icon="enter-fullscreen",a.iconPressed="exit-fullscreen";break;case"play-large":n.class+=" ".concat(this.config.classNames.control,"--overlaid"),s="play",a.label="play",a.icon="play";break;default:is$1.empty(a.label)&&(a.label=s),is$1.empty(a.icon)&&(a.icon=e)}var r=createElement(a.element);return a.toggle?(r.appendChild(controls.createIcon.call(this,a.iconPressed,{class:"icon--pressed"})),r.appendChild(controls.createIcon.call(this,a.icon,{class:"icon--not-pressed"})),r.appendChild(controls.createLabel.call(this,a.labelPressed,{class:"label--pressed"})),r.appendChild(controls.createLabel.call(this,a.label,{class:"label--not-pressed"}))):(r.appendChild(controls.createIcon.call(this,a.icon)),r.appendChild(controls.createLabel.call(this,a.label))),extend(n,getAttributesFromSelector(this.config.selectors.buttons[s],n)),setAttributes(r,n),"play"===s?(is$1.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(r)):this.elements.buttons[s]=r,r},createRange:function(e,t){var i=createElement("input",extend(getAttributesFromSelector(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":i18n.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,controls.updateRangeFill.call(this,i),RangeTouch.setup(i),i},createProgress:function(e,t){var i=createElement("progress",extend(getAttributesFromSelector(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild(createElement("span",null,"0"));var n={played:"played",buffer:"buffered"}[e],s=n?i18n.get(n,this.config):"";i.innerText="% ".concat(s.toLowerCase())}return this.elements.display[e]=i,i},createTime:function(e,t){var i=getAttributesFromSelector(this.config.selectors.display[e],t),n=createElement("div",extend(i,{class:"".concat(i.class?i.class:""," ").concat(this.config.classNames.display.time," ").trim(),"aria-label":i18n.get(e,this.config)}),"00:00");return this.elements.display[e]=n,n},bindMenuItemShortcuts:function(e,t){var i=this;on.call(this,e,"keydown keyup",(function(n){if([32,38,39,40].includes(n.which)&&(n.preventDefault(),n.stopPropagation(),"keydown"!==n.type)){var s,a=matches$1(e,'[role="menuitemradio"]');if(!a&&[32,39].includes(n.which))controls.showMenuPanel.call(i,t,!0);else 32!==n.which&&(40===n.which||a&&39===n.which?(s=e.nextElementSibling,is$1.element(s)||(s=e.parentNode.firstElementChild)):(s=e.previousElementSibling,is$1.element(s)||(s=e.parentNode.lastElementChild)),setFocus.call(i,s,!0))}}),!1),on.call(this,e,"keyup",(function(e){13===e.which&&controls.focusFirstMenuItem.call(i,null,!0)}))},createMenuItem:function(e){var t=this,i=e.value,n=e.list,s=e.type,a=e.title,r=e.badge,o=void 0===r?null:r,l=e.checked,c=void 0!==l&&l,u=getAttributesFromSelector(this.config.selectors.inputs[s]),d=createElement("button",extend(u,{type:"button",role:"menuitemradio",class:"".concat(this.config.classNames.control," ").concat(u.class?u.class:"").trim(),"aria-checked":c,value:i})),h=createElement("span");h.innerHTML=a,is$1.element(o)&&h.appendChild(o),d.appendChild(h),Object.defineProperty(d,"checked",{enumerable:!0,get:function(){return"true"===d.getAttribute("aria-checked")},set:function(e){e&&Array.from(d.parentNode.children).filter((function(e){return matches$1(e,'[role="menuitemradio"]')})).forEach((function(e){return e.setAttribute("aria-checked","false")})),d.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(d,"click keyup",(function(e){if(!is$1.keyboardEvent(e)||32===e.which){switch(e.preventDefault(),e.stopPropagation(),d.checked=!0,s){case"language":t.currentTrack=Number(i);break;case"quality":t.quality=i;break;case"speed":t.speed=parseFloat(i)}controls.showMenuPanel.call(t,"home",is$1.keyboardEvent(e))}}),s,!1),controls.bindMenuItemShortcuts.call(this,d,s),n.appendChild(d)},formatTime:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!is$1.number(e))return e;var i=getHours(this.duration)>0;return formatTime(e,i,t)},updateTimeDisplay:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];is$1.element(e)&&is$1.number(t)&&(e.innerText=controls.formatTime(t,i))},updateVolume:function(){this.supported.ui&&(is$1.element(this.elements.inputs.volume)&&controls.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),is$1.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;is$1.element(e)&&(e.value=t,controls.updateRangeFill.call(this,e))},updateProgress:function(e){var t=this;if(this.supported.ui&&is$1.event(e)){var i=0;if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":i=getPercentage(this.currentTime,this.duration),"timeupdate"===e.type&&controls.setRange.call(this,this.elements.inputs.seek,i);break;case"playing":case"progress":!function(e,i){var n=is$1.number(i)?i:0,s=is$1.element(e)?e:t.elements.display.buffer;if(is$1.element(s)){s.value=n;var a=s.getElementsByTagName("span")[0];is$1.element(a)&&(a.childNodes[0].nodeValue=n)}}(this.elements.display.buffer,100*this.buffered)}}},updateRangeFill:function(e){var t=is$1.event(e)?e.target:e;if(is$1.element(t)&&"range"===t.getAttribute("type")){if(matches$1(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);var i=controls.formatTime(this.currentTime),n=controls.formatTime(this.duration),s=i18n.get("seekLabel",this.config);t.setAttribute("aria-valuetext",s.replace("{currentTime}",i).replace("{duration}",n))}else if(matches$1(t,this.config.selectors.inputs.volume)){var a=100*t.value;t.setAttribute("aria-valuenow",a),t.setAttribute("aria-valuetext","".concat(a.toFixed(1),"%"))}else t.setAttribute("aria-valuenow",t.value);browser.isWebkit&&t.style.setProperty("--value","".concat(t.value/t.max*100,"%"))}},updateSeekTooltip:function(e){var t=this;if(this.config.tooltips.seek&&is$1.element(this.elements.inputs.seek)&&is$1.element(this.elements.display.seekTooltip)&&0!==this.duration){var i="".concat(this.config.classNames.tooltip,"--visible"),n=function(e){return toggleClass(t.elements.display.seekTooltip,i,e)};if(this.touch)n(!1);else{var s=0,a=this.elements.progress.getBoundingClientRect();if(is$1.event(e))s=100/a.width*(e.pageX-a.left);else{if(!hasClass(this.elements.display.seekTooltip,i))return;s=parseFloat(this.elements.display.seekTooltip.style.left,10)}s<0?s=0:s>100&&(s=100),controls.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*s),this.elements.display.seekTooltip.style.left="".concat(s,"%"),is$1.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&n("mouseenter"===e.type)}}},timeUpdate:function(e){var t=!is$1.element(this.elements.display.duration)&&this.config.invertTime;controls.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||controls.updateProgress.call(this,e)},durationUpdate:function(){if(this.supported.ui&&(this.config.invertTime||!this.currentTime)){if(this.duration>=Math.pow(2,32))return toggleHidden(this.elements.display.currentTime,!0),void toggleHidden(this.elements.progress,!0);is$1.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);var e=is$1.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&controls.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&controls.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),controls.updateSeekTooltip.call(this)}},toggleMenuButton:function(e,t){toggleHidden(this.elements.settings.buttons[e],!t)},updateSetting:function(e,t,i){var n=this.elements.settings.panels[e],s=null,a=t;if("captions"===e)s=this.currentTrack;else{if(s=is$1.empty(i)?this[e]:i,is$1.empty(s)&&(s=this.config[e].default),!is$1.empty(this.options[e])&&!this.options[e].includes(s))return void this.debug.warn("Unsupported value of '".concat(s,"' for ").concat(e));if(!this.config[e].options.includes(s))return void this.debug.warn("Disabled value of '".concat(s,"' for ").concat(e))}if(is$1.element(a)||(a=n&&n.querySelector('[role="menu"]')),is$1.element(a)){this.elements.settings.buttons[e].querySelector(".".concat(this.config.classNames.menu.value)).innerHTML=controls.getLabel.call(this,e,s);var r=a&&a.querySelector('[value="'.concat(s,'"]'));is$1.element(r)&&(r.checked=!0)}},getLabel:function(e,t){switch(e){case"speed":return 1===t?i18n.get("normal",this.config):"".concat(t,"×");case"quality":if(is$1.number(t)){var i=i18n.get("qualityLabel.".concat(t),this.config);return i.length?i:"".concat(t,"p")}return toTitleCase(t);case"captions":return captions.getLabel.call(this);default:return null}},setQualityMenu:function(e){var t=this;if(is$1.element(this.elements.settings.panels.quality)){var i=this.elements.settings.panels.quality.querySelector('[role="menu"]');is$1.array(e)&&(this.options.quality=dedupe(e).filter((function(e){return t.config.quality.options.includes(e)})));var n=!is$1.empty(this.options.quality)&&this.options.quality.length>1;if(controls.toggleMenuButton.call(this,"quality",n),emptyElement(i),controls.checkMenu.call(this),n){var s=function(e){var i=i18n.get("qualityBadge.".concat(e),t.config);return i.length?controls.createBadge.call(t,i):null};this.options.quality.sort((function(e,i){var n=t.config.quality.options;return n.indexOf(e)>n.indexOf(i)?1:-1})).forEach((function(e){controls.createMenuItem.call(t,{value:e,list:i,type:"quality",title:controls.getLabel.call(t,"quality",e),badge:s(e)})})),controls.updateSetting.call(this,"quality",i)}}},setCaptionsMenu:function(){var e=this;if(is$1.element(this.elements.settings.panels.captions)){var t=this.elements.settings.panels.captions.querySelector('[role="menucaptions"]'),i=captions.getTracks.call(this),n=Boolean(i.length);if(controls.toggleMenuButton.call(this,"captions",n),emptyElement(t),controls.checkMenu.call(this),n){var s=i.map((function(i,n){return{value:n,checked:e.captions.toggled&&e.currentTrack===n,title:captions.getLabel.call(e,i),badge:i.language&&controls.createBadge.call(e,i.language.toUpperCase()),list:t,type:"language"}}));s.unshift({value:-1,checked:!this.captions.toggled,title:i18n.get("disabled",this.config),list:t,type:"language"}),s.forEach(controls.createMenuItem.bind(this)),controls.updateSetting.call(this,"captions",t)}}},setSpeedMenu:function(){var e=this;if(is$1.element(this.elements.settings.panels.speed)){var t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter((function(t){return t>=e.minimumSpeed&&t<=e.maximumSpeed}));var i=!is$1.empty(this.options.speed)&&this.options.speed.length>1;controls.toggleMenuButton.call(this,"speed",i),emptyElement(t),controls.checkMenu.call(this),i&&(this.options.speed.forEach((function(i){controls.createMenuItem.call(e,{value:i,list:t,type:"speed",title:controls.getLabel.call(e,"speed",i)})})),controls.updateSetting.call(this,"speed",t))}},checkMenu:function(){var e=this.elements.settings.buttons,t=!is$1.empty(e)&&Object.values(e).some((function(e){return!e.hidden}));toggleHidden(this.elements.settings.menu,!t)},focusFirstMenuItem:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.elements.settings.popup.hidden){var i=e;is$1.element(i)||(i=Object.values(this.elements.settings.panels).find((function(e){return!e.hidden})));var n=i.querySelector('[role^="menuitem"]');setFocus.call(this,n,t)}},toggleMenu:function(e){var t=this.elements.settings.popup,i=this.elements.buttons.settings;if(is$1.element(t)&&is$1.element(i)){var n=t.hidden,s=n;if(is$1.boolean(e))s=e;else if(is$1.keyboardEvent(e)&&27===e.which)s=!1;else if(is$1.event(e)){var a=is$1.function(e.composedPath)?e.composedPath()[0]:e.target,r=t.contains(a);if(r||!r&&e.target!==i&&s)return}i.setAttribute("aria-expanded",s),toggleHidden(t,!s),toggleClass(this.elements.container,this.config.classNames.menu.open,s),s&&is$1.keyboardEvent(e)?controls.focusFirstMenuItem.call(this,null,!0):s||n||setFocus.call(this,i,is$1.keyboardEvent(e))}},getMenuSize:function(e){var t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);var i=t.scrollWidth,n=t.scrollHeight;return removeElement(t),{width:i,height:n}},showMenuPanel:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.elements.container.querySelector("#plyr-settings-".concat(this.id,"-").concat(t));if(is$1.element(n)){var s=n.parentNode,a=Array.from(s.children).find((function(e){return!e.hidden}));if(support.transitions&&!support.reducedMotion){s.style.width="".concat(a.scrollWidth,"px"),s.style.height="".concat(a.scrollHeight,"px");var r=controls.getMenuSize.call(this,n),o=function t(i){i.target===s&&["width","height"].includes(i.propertyName)&&(s.style.width="",s.style.height="",off.call(e,s,transitionEndEvent,t))};on.call(this,s,transitionEndEvent,o),s.style.width="".concat(r.width,"px"),s.style.height="".concat(r.height,"px")}toggleHidden(a,!0),toggleHidden(n,!1),controls.focusFirstMenuItem.call(this,n,i)}},setDownloadUrl:function(){var e=this.elements.buttons.download;is$1.element(e)&&e.setAttribute("href",this.download)},create:function(e){var t=this,i=controls.bindMenuItemShortcuts,n=controls.createButton,s=controls.createProgress,a=controls.createRange,r=controls.createTime,o=controls.setQualityMenu,l=controls.setSpeedMenu,c=controls.showMenuPanel;this.elements.controls=null,is$1.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(n.call(this,"play-large"));var u=createElement("div",getAttributesFromSelector(this.config.selectors.controls.wrapper));this.elements.controls=u;var d={class:"plyr__controls__item"};return dedupe(is$1.array(this.config.controls)?this.config.controls:[]).forEach((function(o){if("restart"===o&&u.appendChild(n.call(t,"restart",d)),"rewind"===o&&u.appendChild(n.call(t,"rewind",d)),"play"===o&&u.appendChild(n.call(t,"play",d)),"fast-forward"===o&&u.appendChild(n.call(t,"fast-forward",d)),"progress"===o){var l=createElement("div",{class:"".concat(d.class," plyr__progress__container")}),h=createElement("div",getAttributesFromSelector(t.config.selectors.progress));if(h.appendChild(a.call(t,"seek",{id:"plyr-seek-".concat(e.id)})),h.appendChild(s.call(t,"buffer")),t.config.tooltips.seek){var m=createElement("span",{class:t.config.classNames.tooltip},"00:00");h.appendChild(m),t.elements.display.seekTooltip=m}t.elements.progress=h,l.appendChild(t.elements.progress),u.appendChild(l)}if("current-time"===o&&u.appendChild(r.call(t,"currentTime",d)),"duration"===o&&u.appendChild(r.call(t,"duration",d)),"mute"===o||"volume"===o){var p=t.elements.volume;if(is$1.element(p)&&u.contains(p)||(p=createElement("div",extend({},d,{class:"".concat(d.class," plyr__volume").trim()})),t.elements.volume=p,u.appendChild(p)),"mute"===o&&p.appendChild(n.call(t,"mute")),"volume"===o&&!browser.isIos){var g={max:1,step:.05,value:t.config.volume};p.appendChild(a.call(t,"volume",extend(g,{id:"plyr-volume-".concat(e.id)})))}}if("captions"===o&&u.appendChild(n.call(t,"captions",d)),"settings"===o&&!is$1.empty(t.config.settings)){var f=createElement("div",extend({},d,{class:"".concat(d.class," plyr__menu").trim(),hidden:""}));f.appendChild(n.call(t,"settings",{"aria-haspopup":!0,"aria-controls":"plyr-settings-".concat(e.id),"aria-expanded":!1}));var y=createElement("div",{class:"plyr__menu__container",id:"plyr-settings-".concat(e.id),hidden:""}),v=createElement("div"),b=createElement("div",{id:"plyr-settings-".concat(e.id,"-home")}),w=createElement("div",{role:"menu"});b.appendChild(w),v.appendChild(b),t.elements.settings.panels.home=b,t.config.settings.forEach((function(n){var s=createElement("button",extend(getAttributesFromSelector(t.config.selectors.buttons.settings),{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--forward"),role:"menuitem","aria-haspopup":!0,hidden:""}));i.call(t,s,n),on.call(t,s,"click",(function(){c.call(t,n,!1)}));var a=createElement("span",null,i18n.get(n,t.config)),r=createElement("span",{class:t.config.classNames.menu.value});r.innerHTML=e[n],a.appendChild(r),s.appendChild(a),w.appendChild(s);var o=createElement("div",{id:"plyr-settings-".concat(e.id,"-").concat(n),hidden:""}),l=createElement("button",{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--back")});l.appendChild(createElement("span",{"aria-hidden":!0},i18n.get(n,t.config))),l.appendChild(createElement("span",{class:t.config.classNames.hidden},i18n.get("menuBack",t.config))),on.call(t,o,"keydown",(function(e){37===e.which&&(e.preventDefault(),e.stopPropagation(),c.call(t,"home",!0))}),!1),on.call(t,l,"click",(function(){c.call(t,"home",!1)})),o.appendChild(l),o.appendChild(createElement("div",{role:"menu"})),o.appendChild(createElement("div",{role:"menucaptions"})),v.appendChild(o),t.elements.settings.buttons[n]=s,t.elements.settings.panels[n]=o})),y.appendChild(v),f.appendChild(y),u.appendChild(f),t.elements.settings.popup=y,t.elements.settings.menu=f}if("pip"===o&&support.pip&&u.appendChild(n.call(t,"pip",d)),"airplay"===o&&support.airplay&&u.appendChild(n.call(t,"airplay",d)),"download"===o){var k=extend({},d,{element:"a",href:t.download,target:"_blank"});t.isHTML5&&(k.download="");var T=t.config.urls.download;!is$1.url(T)&&t.isEmbed&&extend(k,{icon:"logo-".concat(t.provider),label:t.provider}),u.appendChild(n.call(t,"download",k))}"fullscreen"===o&&u.appendChild(n.call(t,"fullscreen",d))})),this.isHTML5&&o.call(this,html5.getQualityOptions.call(this)),l.call(this),u},inject:function(){var e=this;if(this.config.loadSprite){var t=controls.getIconUrl.call(this);t.cors&&loadSprite(t.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());var i=null;this.elements.controls=null;var n={id:this.id,seektime:this.config.seekTime,title:this.config.title},s=!0;is$1.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,n)),this.config.controls||(this.config.controls=[]),is$1.element(this.config.controls)||is$1.string(this.config.controls)?i=this.config.controls:(i=controls.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:captions.getLabel.call(this)}),s=!1);var a,r;if(s&&is$1.string(this.config.controls)&&(a=i,Object.entries(n).forEach((function(e){var t=_slicedToArray(e,2),i=t[0],n=t[1];a=replaceAll(a,"{".concat(i,"}"),n)})),i=a),is$1.string(this.config.selectors.controls.container)&&(r=document.querySelector(this.config.selectors.controls.container)),is$1.element(r)||(r=this.elements.container),r[is$1.element(i)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",i),is$1.element(this.elements.controls)||controls.findElements.call(this),!is$1.empty(this.elements.buttons)){var o=function(t){var i=e.config.classNames.controlPressed;Object.defineProperty(t,"pressed",{enumerable:!0,get:function(){return hasClass(t,i)},set:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];toggleClass(t,i,e)}})};Object.values(this.elements.buttons).filter(Boolean).forEach((function(e){is$1.array(e)||is$1.nodeList(e)?Array.from(e).filter(Boolean).forEach(o):o(e)}))}if(browser.isEdge&&repaint(r),this.config.tooltips.controls){var l=this.config,c=l.classNames,u=l.selectors,d="".concat(u.controls.wrapper," ").concat(u.labels," .").concat(c.hidden),h=getElements.call(this,d);Array.from(h).forEach((function(t){toggleClass(t,e.config.classNames.hidden,!1),toggleClass(t,e.config.classNames.tooltip,!0)}))}}};function parseUrl(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e;if(t){var n=document.createElement("a");n.href=i,i=n.href}try{return new URL(i)}catch(e){return null}}function buildUrlParams(e){var t=new URLSearchParams;return is$1.object(e)&&Object.entries(e).forEach((function(e){var i=_slicedToArray(e,2),n=i[0],s=i[1];t.set(n,s)})),t}var captions={setup:function(){if(this.supported.ui)if(!this.isVideo||this.isYouTube||this.isHTML5&&!support.textTracks)is$1.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&controls.setCaptionsMenu.call(this);else{if(is$1.element(this.elements.captions)||(this.elements.captions=createElement("div",getAttributesFromSelector(this.config.selectors.captions)),insertAfter(this.elements.captions,this.elements.wrapper)),browser.isIE&&window.URL){var e=this.media.querySelectorAll("track");Array.from(e).forEach((function(e){var t=e.getAttribute("src"),i=parseUrl(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&fetch(t,"blob").then((function(t){e.setAttribute("src",window.URL.createObjectURL(t))})).catch((function(){removeElement(e)}))}))}var t=dedupe((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map((function(e){return e.split("-")[0]}))),i=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();if("auto"===i)i=_slicedToArray(t,1)[0];var n=this.storage.get("captions");if(is$1.boolean(n)||(n=this.config.captions.active),Object.assign(this.captions,{toggled:!1,active:n,language:i,languages:t}),this.isHTML5){var s=this.config.captions.update?"addtrack removetrack":"removetrack";on.call(this,this.media.textTracks,s,captions.update.bind(this))}setTimeout(captions.update.bind(this),0)}},update:function(){var e=this,t=captions.getTracks.call(this,!0),i=this.captions,n=i.active,s=i.language,a=i.meta,r=i.currentTrackNode,o=Boolean(t.find((function(e){return e.language===s})));this.isHTML5&&this.isVideo&&t.filter((function(e){return!a.get(e)})).forEach((function(t){e.debug.log("Track added",t),a.set(t,{default:"showing"===t.mode}),"showing"===t.mode&&(t.mode="hidden"),on.call(e,t,"cuechange",(function(){return captions.updateCues.call(e)}))})),(o&&this.language!==s||!t.includes(r))&&(captions.setLanguage.call(this,s),captions.toggle.call(this,n&&o)),toggleClass(this.elements.container,this.config.classNames.captions.enabled,!is$1.empty(t)),is$1.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&controls.setCaptionsMenu.call(this)},toggle:function(e){var t=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.supported.ui){var n=this.captions.toggled,s=this.config.classNames.captions.active,a=is$1.nullOrUndefined(e)?!n:e;if(a!==n){if(i||(this.captions.active=a,this.storage.set({captions:a})),!this.language&&a&&!i){var r=captions.getTracks.call(this),o=captions.findTrack.call(this,[this.captions.language].concat(_toConsumableArray(this.captions.languages)),!0);return this.captions.language=o.language,void captions.set.call(this,r.indexOf(o))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=a),toggleClass(this.elements.container,s,a),this.captions.toggled=a,controls.updateSetting.call(this,"captions"),triggerEvent.call(this,this.media,a?"captionsenabled":"captionsdisabled")}setTimeout((function(){a&&t.captions.toggled&&(t.captions.currentTrackNode.mode="hidden")}))}},set:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=captions.getTracks.call(this);if(-1!==e)if(is$1.number(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;var n=i[e],s=n||{},a=s.language;this.captions.currentTrackNode=n,controls.updateSetting.call(this,"captions"),t||(this.captions.language=a,this.storage.set({language:a})),this.isVimeo&&this.embed.enableTextTrack(a),triggerEvent.call(this,this.media,"languagechange")}captions.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&captions.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else captions.toggle.call(this,!1,t)},setLanguage:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(is$1.string(e)){var i=e.toLowerCase();this.captions.language=i;var n=captions.getTracks.call(this),s=captions.findTrack.call(this,[i]);captions.set.call(this,n.indexOf(s),t)}else this.debug.warn("Invalid language argument",e)},getTracks:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=Array.from((this.media||{}).textTracks||[]);return i.filter((function(i){return!e.isHTML5||t||e.captions.meta.has(i)})).filter((function(e){return["captions","subtitles"].includes(e.kind)}))},findTrack:function(e){var t,i=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=captions.getTracks.call(this),a=function(e){return Number((i.captions.meta.get(e)||{}).default)},r=Array.from(s).sort((function(e,t){return a(t)-a(e)}));return e.every((function(e){return!(t=r.find((function(t){return t.language===e})))})),t||(n?r[0]:void 0)},getCurrentTrack:function(){return captions.getTracks.call(this)[this.currentTrack]},getLabel:function(e){var t=e;return!is$1.track(t)&&support.textTracks&&this.captions.toggled&&(t=captions.getCurrentTrack.call(this)),is$1.track(t)?is$1.empty(t.label)?is$1.empty(t.language)?i18n.get("enabled",this.config):e.language.toUpperCase():t.label:i18n.get("disabled",this.config)},updateCues:function(e){if(this.supported.ui)if(is$1.element(this.elements.captions))if(is$1.nullOrUndefined(e)||Array.isArray(e)){var t=e;if(!t){var i=captions.getCurrentTrack.call(this);t=Array.from((i||{}).activeCues||[]).map((function(e){return e.getCueAsHTML()})).map(getHTML)}var n=t.map((function(e){return e.trim()})).join("\n");if(n!==this.elements.captions.innerHTML){emptyElement(this.elements.captions);var s=createElement("span",getAttributesFromSelector(this.config.selectors.caption));s.innerHTML=n,this.elements.captions.appendChild(s),triggerEvent.call(this,this.media,"cuechange")}}else this.debug.warn("updateCues: Invalid input",e);else this.debug.warn("No captions element to render to")}},defaults$1={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"/theme/modules/plyr/plyr.svg",blankVideo:"/theme/modules/plyr/blank.webm",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/v2/video/{0}.json"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},tabFocus:"plyr__tab-focus",previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,premium:!1,referrerPolicy:null},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3,modestbranding:1}},pip={active:"picture-in-picture",inactive:"inline"},providers={html5:"html5",youtube:"youtube",vimeo:"vimeo"},types={audio:"audio",video:"video"};function getProviderByUrl(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?providers.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?providers.vimeo:null}var noop=function(){},Console=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];_classCallCheck(this,e),this.enabled=window.console&&t,this.enabled&&this.log("Debugging enabled")}return _createClass(e,[{key:"log",get:function(){return this.enabled?Function.prototype.bind.call(console.log,console):noop}},{key:"warn",get:function(){return this.enabled?Function.prototype.bind.call(console.warn,console):noop}},{key:"error",get:function(){return this.enabled?Function.prototype.bind.call(console.error,console):noop}}]),e}(),Fullscreen=function(){function e(t){var i=this;_classCallCheck(this,e),this.player=t,this.prefix=e.prefix,this.property=e.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===t.config.fullscreen.fallback,this.player.elements.fullscreen=t.config.fullscreen.container&&closest(this.player.elements.container,t.config.fullscreen.container),on.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":"".concat(this.prefix,"fullscreenchange"),(function(){i.onChange()})),on.call(this.player,this.player.elements.container,"dblclick",(function(e){is$1.element(i.player.elements.controls)&&i.player.elements.controls.contains(e.target)||i.toggle()})),on.call(this,this.player.elements.container,"keydown",(function(e){return i.trapFocus(e)})),this.update()}return _createClass(e,[{key:"onChange",value:function(){if(this.enabled){var e=this.player.elements.buttons.fullscreen;is$1.element(e)&&(e.pressed=this.active),triggerEvent.call(this.player,this.target,this.active?"enterfullscreen":"exitfullscreen",!0)}}},{key:"toggleFallback",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?"hidden":"",toggleClass(this.target,this.player.config.classNames.fullscreen.fallback,e),browser.isIos){var t=document.head.querySelector('meta[name="viewport"]'),i="viewport-fit=cover";t||(t=document.createElement("meta")).setAttribute("name","viewport");var n=is$1.string(t.content)&&t.content.includes(i);e?(this.cleanupViewport=!n,n||(t.content+=",".concat(i))):this.cleanupViewport&&(t.content=t.content.split(",").filter((function(e){return e.trim()!==i})).join(","))}this.onChange()}},{key:"trapFocus",value:function(e){if(!browser.isIos&&this.active&&"Tab"===e.key&&9===e.keyCode){var t=document.activeElement,i=getElements.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),n=_slicedToArray(i,1)[0],s=i[i.length-1];t!==s||e.shiftKey?t===n&&e.shiftKey&&(s.focus(),e.preventDefault()):(n.focus(),e.preventDefault())}}},{key:"update",value:function(){var t;this.enabled?(t=this.forceFallback?"Fallback (forced)":e.native?"Native":"Fallback",this.player.debug.log("".concat(t," fullscreen enabled"))):this.player.debug.log("Fullscreen not supported and fallback disabled");toggleClass(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}},{key:"enter",value:function(){this.enabled&&(browser.isIos&&this.player.config.fullscreen.iosNative?this.target.webkitEnterFullscreen():!e.native||this.forceFallback?this.toggleFallback(!0):this.prefix?is$1.empty(this.prefix)||this.target["".concat(this.prefix,"Request").concat(this.property)]():this.target.requestFullscreen({navigationUI:"hide"}))}},{key:"exit",value:function(){if(this.enabled)if(browser.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),silencePromise(this.player.play());else if(!e.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!is$1.empty(this.prefix)){var t="moz"===this.prefix?"Cancel":"Exit";document["".concat(this.prefix).concat(t).concat(this.property)]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}},{key:"toggle",value:function(){this.active?this.exit():this.enter()}},{key:"usingNative",get:function(){return e.native&&!this.forceFallback}},{key:"enabled",get:function(){return(e.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}},{key:"active",get:function(){if(!this.enabled)return!1;if(!e.native||this.forceFallback)return hasClass(this.target,this.player.config.classNames.fullscreen.fallback);var t=this.prefix?document["".concat(this.prefix).concat(this.property,"Element")]:document.fullscreenElement;return t&&t.shadowRoot?t===this.target.getRootNode().host:t===this.target}},{key:"target",get:function(){return browser.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}],[{key:"native",get:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},{key:"prefix",get:function(){if(is$1.function(document.exitFullscreen))return"";var e="";return["webkit","moz","ms"].some((function(t){return!(!is$1.function(document["".concat(t,"ExitFullscreen")])&&!is$1.function(document["".concat(t,"CancelFullScreen")]))&&(e=t,!0)})),e}},{key:"property",get:function(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}}]),e}();function loadImage(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise((function(i,n){var s=new Image,a=function(){delete s.onload,delete s.onerror,(s.naturalWidth>=t?i:n)(s)};Object.assign(s,{onload:a,onerror:a,src:e})}))}var ui={addStyleHook:function(){toggleClass(this.elements.container,this.config.selectors.container.replace(".",""),!0),toggleClass(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build:function(){var e=this;if(this.listeners.media(),!this.supported.ui)return this.debug.warn("Basic support only for ".concat(this.provider," ").concat(this.type)),void ui.toggleNativeControls.call(this,!0);is$1.element(this.elements.controls)||(controls.inject.call(this),this.listeners.controls()),ui.toggleNativeControls.call(this),this.isHTML5&&captions.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,controls.updateVolume.call(this),controls.timeUpdate.call(this),ui.checkPlaying.call(this),toggleClass(this.elements.container,this.config.classNames.pip.supported,support.pip&&this.isHTML5&&this.isVideo),toggleClass(this.elements.container,this.config.classNames.airplay.supported,support.airplay&&this.isHTML5),toggleClass(this.elements.container,this.config.classNames.isIos,browser.isIos),toggleClass(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((function(){triggerEvent.call(e,e.media,"ready")}),0),ui.setTitle.call(this),this.poster&&ui.setPoster.call(this,this.poster,!1).catch((function(){})),this.config.duration&&controls.durationUpdate.call(this)},setTitle:function(){var e=i18n.get("play",this.config);if(is$1.string(this.config.title)&&!is$1.empty(this.config.title)&&(e+=", ".concat(this.config.title)),Array.from(this.elements.buttons.play||[]).forEach((function(t){t.setAttribute("aria-label",e)})),this.isEmbed){var t=getElement.call(this,"iframe");if(!is$1.element(t))return;var i=is$1.empty(this.config.title)?"video":this.config.title,n=i18n.get("frameTitle",this.config);t.setAttribute("title",n.replace("{title}",i))}},togglePoster:function(e){toggleClass(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster:function(e){var t=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return i&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),ready.call(this).then((function(){return loadImage(e)})).catch((function(i){throw e===t.poster&&ui.togglePoster.call(t,!1),i})).then((function(){if(e!==t.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((function(){return Object.assign(t.elements.poster.style,{backgroundImage:"url('".concat(e,"')"),backgroundSize:""}),ui.togglePoster.call(t,!0),e})))},checkPlaying:function(e){var t=this;toggleClass(this.elements.container,this.config.classNames.playing,this.playing),toggleClass(this.elements.container,this.config.classNames.paused,this.paused),toggleClass(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((function(e){Object.assign(e,{pressed:t.playing}),e.setAttribute("aria-label",i18n.get(t.playing?"pause":"play",t.config))})),is$1.event(e)&&"timeupdate"===e.type||ui.toggleControls.call(this)},checkLoading:function(e){var t=this;this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((function(){toggleClass(t.elements.container,t.config.classNames.loading,t.loading),ui.toggleControls.call(t)}),this.loading?250:0)},toggleControls:function(e){var t=this.elements.controls;if(t&&this.config.hideControls){var i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||i))}},migrateStyles:function(){var e=this;Object.values(_objectSpread2({},this.media.style)).filter((function(e){return!is$1.empty(e)&&e.startsWith("--plyr")})).forEach((function(t){e.elements.container.style.setProperty(t,e.media.style.getPropertyValue(t)),e.media.style.removeProperty(t)})),is$1.empty(this.media.style)&&this.media.removeAttribute("style")}},Listeners=function(){function e(t){_classCallCheck(this,e),this.player=t,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}return _createClass(e,[{key:"handleKey",value:function(e){var t=this.player,i=t.elements,n=e.keyCode?e.keyCode:e.which,s="keydown"===e.type,a=s&&n===this.lastKey;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&is$1.number(n)){if(s){var r=document.activeElement;if(is$1.element(r)){var o=t.config.selectors.editable;if(r!==i.inputs.seek&&matches$1(r,o))return;if(32===e.which&&matches$1(r,'button, [role^="menuitem"]'))return}switch([32,37,38,39,40,48,49,50,51,52,53,54,56,57,67,70,73,75,76,77,79].includes(n)&&(e.preventDefault(),e.stopPropagation()),n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a||(t.currentTime=t.duration/10*(n-48));break;case 32:case 75:a||silencePromise(t.togglePlay());break;case 38:t.increaseVolume(.1);break;case 40:t.decreaseVolume(.1);break;case 77:a||(t.muted=!t.muted);break;case 39:t.forward();break;case 37:t.rewind();break;case 70:t.fullscreen.toggle();break;case 67:a||t.toggleCaptions();break;case 76:t.loop=!t.loop}27===n&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=n}else this.lastKey=null}}},{key:"toggleMenu",value:function(e){controls.toggleMenu.call(this.player,e)}},{key:"firstTouch",value:function(){var e=this.player,t=e.elements;e.touch=!0,toggleClass(t.container,e.config.classNames.isTouch,!0)}},{key:"setTabFocus",value:function(e){var t=this.player,i=t.elements;if(clearTimeout(this.focusTimer),"keydown"!==e.type||9===e.which){"keydown"===e.type&&(this.lastKeyDown=e.timeStamp);var n,s=e.timeStamp-this.lastKeyDown<=20;if("focus"!==e.type||s)n=t.config.classNames.tabFocus,toggleClass(getElements.call(t,".".concat(n)),n,!1),"focusout"!==e.type&&(this.focusTimer=setTimeout((function(){var e=document.activeElement;i.container.contains(e)&&toggleClass(document.activeElement,t.config.classNames.tabFocus,!0)}),10))}}},{key:"global",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.player;t.config.keyboard.global&&toggleListener.call(t,window,"keydown keyup",this.handleKey,e,!1),toggleListener.call(t,document.body,"click",this.toggleMenu,e),once.call(t,document.body,"touchstart",this.firstTouch),toggleListener.call(t,document.body,"keydown focus blur focusout",this.setTabFocus,e,!1,!0)}},{key:"container",value:function(){var e=this.player,t=e.config,i=e.elements,n=e.timers;!t.keyboard.global&&t.keyboard.focused&&on.call(e,i.container,"keydown keyup",this.handleKey,!1),on.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(function(t){var s=i.controls;s&&"enterfullscreen"===t.type&&(s.pressed=!1,s.hover=!1);var a=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(ui.toggleControls.call(e,!0),a=e.touch?3e3:2e3),clearTimeout(n.controls),n.controls=setTimeout((function(){return ui.toggleControls.call(e,!1)}),a)}));var s=function(t){if(!t)return setAspectRatio.call(e);var n=i.container.getBoundingClientRect(),s=n.width,a=n.height;return setAspectRatio.call(e,"".concat(s,":").concat(a))},a=function(){clearTimeout(n.resized),n.resized=setTimeout(s,50)};on.call(e,i.container,"enterfullscreen exitfullscreen",(function(t){var n=e.fullscreen,r=n.target,o=n.usingNative;if(r===i.container&&(e.isEmbed||!is$1.empty(e.config.ratio))){var l="enterfullscreen"===t.type,c=s(l);c.padding;!function(t,i,n){if(e.isVimeo&&!e.config.vimeo.premium){var s=e.elements.wrapper.firstChild,a=_slicedToArray(t,2)[1],r=_slicedToArray(getAspectRatio.call(e),2),o=r[0],l=r[1];s.style.maxWidth=n?"".concat(a/l*o,"px"):null,s.style.margin=n?"0 auto":null}}(c.ratio,0,l),o||(l?on.call(e,window,"resize",a):off.call(e,window,"resize",a))}}))}},{key:"media",value:function(){var e=this,t=this.player,i=t.elements;if(on.call(t,t.media,"timeupdate seeking seeked",(function(e){return controls.timeUpdate.call(t,e)})),on.call(t,t.media,"durationchange loadeddata loadedmetadata",(function(e){return controls.durationUpdate.call(t,e)})),on.call(t,t.media,"ended",(function(){t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())})),on.call(t,t.media,"progress playing seeking seeked",(function(e){return controls.updateProgress.call(t,e)})),on.call(t,t.media,"volumechange",(function(e){return controls.updateVolume.call(t,e)})),on.call(t,t.media,"playing play pause ended emptied timeupdate",(function(e){return ui.checkPlaying.call(t,e)})),on.call(t,t.media,"waiting canplay seeked playing",(function(e){return ui.checkLoading.call(t,e)})),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){var n=getElement.call(t,".".concat(t.config.classNames.video));if(!is$1.element(n))return;on.call(t,i.container,"click",(function(s){([i.container,n].includes(s.target)||n.contains(s.target))&&(t.touch&&t.config.hideControls||(t.ended?(e.proxy(s,t.restart,"restart"),e.proxy(s,(function(){silencePromise(t.play())}),"play")):e.proxy(s,(function(){silencePromise(t.togglePlay())}),"play")))}))}t.supported.ui&&t.config.disableContextMenu&&on.call(t,i.wrapper,"contextmenu",(function(e){e.preventDefault()}),!1),on.call(t,t.media,"volumechange",(function(){t.storage.set({volume:t.volume,muted:t.muted})})),on.call(t,t.media,"ratechange",(function(){controls.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})})),on.call(t,t.media,"qualitychange",(function(e){controls.updateSetting.call(t,"quality",null,e.detail.quality)})),on.call(t,t.media,"ready qualitychange",(function(){controls.setDownloadUrl.call(t)}));var s=t.config.events.concat(["keyup","keydown"]).join(" ");on.call(t,t.media,s,(function(e){var n=e.detail,s=void 0===n?{}:n;"error"===e.type&&(s=t.media.error),triggerEvent.call(t,i.container,e.type,!0,s)}))}},{key:"proxy",value:function(e,t,i){var n=this.player,s=n.config.listeners[i],a=!0;is$1.function(s)&&(a=s.call(n,e)),!1!==a&&is$1.function(t)&&t.call(n,e)}},{key:"bind",value:function(e,t,i,n){var s=this,a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=this.player,o=r.config.listeners[n],l=is$1.function(o);on.call(r,e,t,(function(e){return s.proxy(e,i,n)}),a&&!l)}},{key:"controls",value:function(){var e=this,t=this.player,i=t.elements,n=browser.isIE?"change":"input";if(i.buttons.play&&Array.from(i.buttons.play).forEach((function(i){e.bind(i,"click",(function(){silencePromise(t.togglePlay())}),"play")})),this.bind(i.buttons.restart,"click",t.restart,"restart"),this.bind(i.buttons.rewind,"click",t.rewind,"rewind"),this.bind(i.buttons.fastForward,"click",t.forward,"fastForward"),this.bind(i.buttons.mute,"click",(function(){t.muted=!t.muted}),"mute"),this.bind(i.buttons.captions,"click",(function(){return t.toggleCaptions()})),this.bind(i.buttons.download,"click",(function(){triggerEvent.call(t,t.media,"download")}),"download"),this.bind(i.buttons.fullscreen,"click",(function(){t.fullscreen.toggle()}),"fullscreen"),this.bind(i.buttons.pip,"click",(function(){t.pip="toggle"}),"pip"),this.bind(i.buttons.airplay,"click",t.airplay,"airplay"),this.bind(i.buttons.settings,"click",(function(e){e.stopPropagation(),e.preventDefault(),controls.toggleMenu.call(t,e)}),null,!1),this.bind(i.buttons.settings,"keyup",(function(e){var i=e.which;[13,32].includes(i)&&(13!==i?(e.preventDefault(),e.stopPropagation(),controls.toggleMenu.call(t,e)):controls.focusFirstMenuItem.call(t,null,!0))}),null,!1),this.bind(i.settings.menu,"keydown",(function(e){27===e.which&&controls.toggleMenu.call(t,e)})),this.bind(i.inputs.seek,"mousedown mousemove",(function(e){var t=i.progress.getBoundingClientRect(),n=100/t.width*(e.pageX-t.left);e.currentTarget.setAttribute("seek-value",n)})),this.bind(i.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(function(e){var i=e.currentTarget,n=e.keyCode?e.keyCode:e.which;if(!is$1.keyboardEvent(e)||39===n||37===n){t.lastSeekTime=Date.now();var s=i.hasAttribute("play-on-seeked"),a=["mouseup","touchend","keyup"].includes(e.type);s&&a?(i.removeAttribute("play-on-seeked"),silencePromise(t.play())):!a&&t.playing&&(i.setAttribute("play-on-seeked",""),t.pause())}})),browser.isIos){var s=getElements.call(t,'input[type="range"]');Array.from(s).forEach((function(t){return e.bind(t,n,(function(e){return repaint(e.target)}))}))}this.bind(i.inputs.seek,n,(function(e){var i=e.currentTarget,n=i.getAttribute("seek-value");is$1.empty(n)&&(n=i.value),i.removeAttribute("seek-value"),t.currentTime=n/i.max*t.duration}),"seek"),this.bind(i.progress,"mouseenter mouseleave mousemove",(function(e){return controls.updateSeekTooltip.call(t,e)})),this.bind(i.progress,"mousemove touchmove",(function(e){var i=t.previewThumbnails;i&&i.loaded&&i.startMove(e)})),this.bind(i.progress,"mouseleave touchend click",(function(){var e=t.previewThumbnails;e&&e.loaded&&e.endMove(!1,!0)})),this.bind(i.progress,"mousedown touchstart",(function(e){var i=t.previewThumbnails;i&&i.loaded&&i.startScrubbing(e)})),this.bind(i.progress,"mouseup touchend",(function(e){var i=t.previewThumbnails;i&&i.loaded&&i.endScrubbing(e)})),browser.isWebkit&&Array.from(getElements.call(t,'input[type="range"]')).forEach((function(i){e.bind(i,"input",(function(e){return controls.updateRangeFill.call(t,e.target)}))})),t.config.toggleInvert&&!is$1.element(i.display.duration)&&this.bind(i.display.currentTime,"click",(function(){0!==t.currentTime&&(t.config.invertTime=!t.config.invertTime,controls.timeUpdate.call(t))})),this.bind(i.inputs.volume,n,(function(e){t.volume=e.target.value}),"volume"),this.bind(i.controls,"mouseenter mouseleave",(function(e){i.controls.hover=!t.touch&&"mouseenter"===e.type})),i.fullscreen&&Array.from(i.fullscreen.children).filter((function(e){return!e.contains(i.container)})).forEach((function(n){e.bind(n,"mouseenter mouseleave",(function(e){i.controls.hover=!t.touch&&"mouseenter"===e.type}))})),this.bind(i.controls,"mousedown mouseup touchstart touchend touchcancel",(function(e){i.controls.pressed=["mousedown","touchstart"].includes(e.type)})),this.bind(i.controls,"focusin",(function(){var n=t.config,s=t.timers;toggleClass(i.controls,n.classNames.noTransition,!0),ui.toggleControls.call(t,!0),setTimeout((function(){toggleClass(i.controls,n.classNames.noTransition,!1)}),0);var a=e.touch?3e3:4e3;clearTimeout(s.controls),s.controls=setTimeout((function(){return ui.toggleControls.call(t,!1)}),a)})),this.bind(i.inputs.volume,"wheel",(function(e){var i=e.webkitDirectionInvertedFromDevice,n=_slicedToArray([e.deltaX,-e.deltaY].map((function(e){return i?-e:e})),2),s=n[0],a=n[1],r=Math.sign(Math.abs(s)>Math.abs(a)?s:a);t.increaseVolume(r/50);var o=t.media.volume;(1===r&&o<1||-1===r&&o>0)&&e.preventDefault()}),"volume",!1)}}]),e}(),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var loadjs_umd=createCommonjsModule((function(e,t){e.exports=function(){var e=function(){},t={},i={},n={};function s(e,t){if(e){var s=n[e];if(i[e]=t,s)for(;s.length;)s[0](e,t),s.splice(0,1)}}function a(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function r(t,i,n,s){var a,o,l=document,c=n.async,u=(n.numRetries||0)+1,d=n.before||e,h=t.replace(/[\?|#].*$/,""),m=t.replace(/^(css|img)!/,"");s=s||0,/(^css!|\.css$)/.test(h)?((o=l.createElement("link")).rel="stylesheet",o.href=m,(a="hideFocus"in o)&&o.relList&&(a=0,o.rel="preload",o.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(h)?(o=l.createElement("img")).src=m:((o=l.createElement("script")).src=t,o.async=void 0===c||c),o.onload=o.onerror=o.onbeforeload=function(e){var l=e.type[0];if(a)try{o.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l){if((s+=1)0&&void 0!==arguments[0]&&arguments[0];if(!t)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");var i=function(){var t=formatTime(Math.max(e.manager.getRemainingTime(),0)),i="".concat(i18n.get("advertisement",e.player.config)," - ").concat(t);e.elements.container.setAttribute("data-badge-text",i)};this.countdownTimer=setInterval(i,100)}},{key:"onAdsManagerLoaded",value:function(e){var t=this;if(this.enabled){var i=new google.ima.AdsRenderingSettings;i.restoreCustomPlaybackStateOnAdBreakComplete=!0,i.enablePreloading=!0,this.manager=e.getAdsManager(this.player,i),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(e){return t.onAdError(e)})),Object.keys(google.ima.AdEvent.Type).forEach((function(e){t.manager.addEventListener(google.ima.AdEvent.Type[e],(function(e){return t.onAdEvent(e)}))})),this.trigger("loaded")}}},{key:"addCuePoints",value:function(){var e=this;is$1.empty(this.cuePoints)||this.cuePoints.forEach((function(t){if(0!==t&&-1!==t&&t1?i-1:0),s=1;s ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);a&&(i.startTime=60*Number(a[1]||0)*60+60*Number(a[2])+Number(a[3])+Number("0.".concat(a[4])),i.endTime=60*Number(a[6]||0)*60+60*Number(a[7])+Number(a[8])+Number("0.".concat(a[9])))}})),i.text&&t.push(i)})),t},fitRatio=function(e,t){var i={};return e>t.width/t.height?(i.width=t.width,i.height=1/e*t.width):(i.height=t.height,i.width=e*t.height),i},PreviewThumbnails=function(){function e(t){_classCallCheck(this,e),this.player=t,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}return _createClass(e,[{key:"load",value:function(){var e=this;this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then((function(){e.enabled&&(e.render(),e.determineContainerAutoSizing(),e.loaded=!0)}))}},{key:"getThumbnails",value:function(){var e=this;return new Promise((function(t){var i=e.player.config.previewThumbnails.src;if(is$1.empty(i))throw new Error("Missing previewThumbnails.src config attribute");var n=function(){e.thumbnails.sort((function(e,t){return e.height-t.height})),e.player.debug.log("Preview thumbnails",e.thumbnails),t()};if(is$1.function(i))i((function(t){e.thumbnails=t,n()}));else{var s=(is$1.string(i)?[i]:i).map((function(t){return e.getThumbnail(t)}));Promise.all(s).then(n)}}))}},{key:"getThumbnail",value:function(e){var t=this;return new Promise((function(i){fetch(e).then((function(n){var s={frames:parseVtt(n),height:null,urlPrefix:""};s.frames[0].text.startsWith("/")||s.frames[0].text.startsWith("http://")||s.frames[0].text.startsWith("https://")||(s.urlPrefix=e.substring(0,e.lastIndexOf("/")+1));var a=new Image;a.onload=function(){s.height=a.naturalHeight,s.width=a.naturalWidth,t.thumbnails.push(s),i()},a.src=s.urlPrefix+s.frames[0].text}))}))}},{key:"startMove",value:function(e){if(this.loaded&&is$1.event(e)&&["touchmove","mousemove"].includes(e.type)&&this.player.media.duration){if("touchmove"===e.type)this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var t=this.player.elements.progress.getBoundingClientRect(),i=100/t.width*(e.pageX-t.left);this.seekTime=this.player.media.duration*(i/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=e.pageX,this.elements.thumb.time.innerText=formatTime(this.seekTime)}this.showImageAtCurrentTime()}}},{key:"endMove",value:function(){this.toggleThumbContainer(!1,!0)}},{key:"startScrubbing",value:function(e){(is$1.nullOrUndefined(e.button)||!1===e.button||0===e.button)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}},{key:"endScrubbing",value:function(){var e=this;this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):once.call(this.player,this.player.media,"timeupdate",(function(){e.mouseDown||e.toggleScrubbingContainer(!1)}))}},{key:"listeners",value:function(){var e=this;this.player.on("play",(function(){e.toggleThumbContainer(!1,!0)})),this.player.on("seeked",(function(){e.toggleThumbContainer(!1)})),this.player.on("timeupdate",(function(){e.lastTime=e.player.media.currentTime}))}},{key:"render",value:function(){this.elements.thumb.container=createElement("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=createElement("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);var e=createElement("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=createElement("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.container.appendChild(e),is$1.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=createElement("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}},{key:"destroy",value:function(){this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}},{key:"showImageAtCurrentTime",value:function(){var e=this;this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();var t=this.thumbnails[0].frames.findIndex((function(t){return e.seekTime>=t.startTime&&e.seekTime<=t.endTime})),i=t>=0,n=0;this.mouseDown||this.toggleThumbContainer(i),i&&(this.thumbnails.forEach((function(i,s){e.loadedImages.includes(i.frames[t].text)&&(n=s)})),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(n)))}},{key:"loadImage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=this.showingThumb,n=this.thumbnails[t],s=n.urlPrefix,a=n.frames[i],r=n.frames[i].text,o=s+r;if(this.currentImageElement&&this.currentImageElement.dataset.filename===r)this.showImage(this.currentImageElement,a,t,i,r,!1),this.currentImageElement.dataset.index=i,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);var l=new Image;l.src=o,l.dataset.index=i,l.dataset.filename=r,this.showingThumbFilename=r,this.player.debug.log("Loading image: ".concat(o)),l.onload=function(){return e.showImage(l,a,t,i,r,!0)},this.loadingImage=l,this.removeOldImages(l)}}},{key:"showImage",value:function(e,t,i,n,s){var a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];this.player.debug.log("Showing thumb: ".concat(s,". num: ").concat(n,". qual: ").concat(i,". newimg: ").concat(a)),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(s)||this.loadedImages.push(s)),this.preloadNearby(n,!0).then(this.preloadNearby(n,!1)).then(this.getHigherQuality(i,e,t,s))}},{key:"removeOldImages",value:function(e){var t=this;Array.from(this.currentImageContainer.children).forEach((function(i){if("img"===i.tagName.toLowerCase()){var n=t.usingSprites?500:1e3;if(i.dataset.index!==e.dataset.index&&!i.dataset.deleting){i.dataset.deleting=!0;var s=t.currentImageContainer;setTimeout((function(){s.removeChild(i),t.player.debug.log("Removing thumb: ".concat(i.dataset.filename))}),n)}}}))}},{key:"preloadNearby",value:function(e){var t=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new Promise((function(n){setTimeout((function(){var s=t.thumbnails[0].frames[e].text;if(t.showingThumbFilename===s){var a;a=i?t.thumbnails[0].frames.slice(e):t.thumbnails[0].frames.slice(0,e).reverse();var r=!1;a.forEach((function(e){var i=e.text;if(i!==s&&!t.loadedImages.includes(i)){r=!0,t.player.debug.log("Preloading thumb filename: ".concat(i));var a=t.thumbnails[0].urlPrefix+i,o=new Image;o.src=a,o.onload=function(){t.player.debug.log("Preloaded thumb filename: ".concat(i)),t.loadedImages.includes(i)||t.loadedImages.push(i),n()}}})),r||n()}}),300)}))}},{key:"getHigherQuality",value:function(e,t,i,n){var s=this;if(e0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"toggleScrubbingContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)}},{key:"determineContainerAutoSizing",value:function(){(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}},{key:"setThumbContainerSizeAndPos",value:function(){if(this.sizeSpecifiedInCSS){if(this.elements.thumb.imageContainer.clientHeight>20&&this.elements.thumb.imageContainer.clientWidth<20){var e=Math.floor(this.elements.thumb.imageContainer.clientHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.width="".concat(e,"px")}else if(this.elements.thumb.imageContainer.clientHeight<20&&this.elements.thumb.imageContainer.clientWidth>20){var t=Math.floor(this.elements.thumb.imageContainer.clientWidth/this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(t,"px")}}else{var i=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height="".concat(this.thumbContainerHeight,"px"),this.elements.thumb.imageContainer.style.width="".concat(i,"px")}this.setThumbContainerPos()}},{key:"setThumbContainerPos",value:function(){var e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),i=this.elements.thumb.container,n=t.left-e.left+10,s=t.right-e.left-i.clientWidth-10,a=this.mousePosX-e.left-i.clientWidth/2;as&&(a=s),i.style.left="".concat(a,"px")}},{key:"setScrubbingContainerSize",value:function(){var e=fitRatio(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight}),t=e.width,i=e.height;this.elements.scrubbing.container.style.width="".concat(t,"px"),this.elements.scrubbing.container.style.height="".concat(i,"px")}},{key:"setImageSizeAndOffset",value:function(e,t){if(this.usingSprites){var i=this.thumbContainerHeight/t.h;e.style.height="".concat(e.naturalHeight*i,"px"),e.style.width="".concat(e.naturalWidth*i,"px"),e.style.left="-".concat(t.x*i,"px"),e.style.top="-".concat(t.y*i,"px")}}},{key:"enabled",get:function(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}},{key:"currentImageContainer",get:function(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}},{key:"usingSprites",get:function(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}},{key:"thumbAspectRatio",get:function(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}},{key:"thumbContainerHeight",get:function(){return this.mouseDown?fitRatio(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight}).height:this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}},{key:"currentImageElement",get:function(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement},set:function(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}]),e}(),source={insertElements:function(e,t){var i=this;is$1.string(t)?insertElement(e,this.media,{src:t}):is$1.array(t)&&t.forEach((function(t){insertElement(e,i.media,t)}))},change:function(e){var t=this;getDeep(e,"sources.length")?(html5.cancelRequests.call(this),this.destroy.call(this,(function(){t.options.quality=[],removeElement(t.media),t.media=null,is$1.element(t.elements.container)&&t.elements.container.removeAttribute("class");var i=e.sources,n=e.type,s=_slicedToArray(i,1)[0],a=s.provider,r=void 0===a?providers.html5:a,o=s.src,l="html5"===r?n:"div",c="html5"===r?{}:{src:o};Object.assign(t,{provider:r,type:n,supported:support.check(n,r,t.config.playsinline),media:createElement(l,c)}),t.elements.container.appendChild(t.media),is$1.boolean(e.autoplay)&&(t.config.autoplay=e.autoplay),t.isHTML5&&(t.config.crossorigin&&t.media.setAttribute("crossorigin",""),t.config.autoplay&&t.media.setAttribute("autoplay",""),is$1.empty(e.poster)||(t.poster=e.poster),t.config.loop.active&&t.media.setAttribute("loop",""),t.config.muted&&t.media.setAttribute("muted",""),t.config.playsinline&&t.media.setAttribute("playsinline","")),ui.addStyleHook.call(t),t.isHTML5&&source.insertElements.call(t,"source",i),t.config.title=e.title,media.setup.call(t),t.isHTML5&&Object.keys(e).includes("tracks")&&source.insertElements.call(t,"track",e.tracks),(t.isHTML5||t.isEmbed&&!t.supported.ui)&&ui.build.call(t),t.isHTML5&&t.media.load(),is$1.empty(e.previewThumbnails)||(Object.assign(t.config.previewThumbnails,e.previewThumbnails),t.previewThumbnails&&t.previewThumbnails.loaded&&(t.previewThumbnails.destroy(),t.previewThumbnails=null),t.config.previewThumbnails.enabled&&(t.previewThumbnails=new PreviewThumbnails(t))),t.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};function clamp(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:255;return Math.min(Math.max(e,t),i)}var Plyr=function(){function e(t,i){var n=this;if(_classCallCheck(this,e),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=support.touch,this.media=t,is$1.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||is$1.nodeList(this.media)||is$1.array(this.media))&&(this.media=this.media[0]),this.config=extend({},defaults$1,e.defaults,i||{},function(){try{return JSON.parse(n.media.getAttribute("data-plyr-config"))}catch(e){return{}}}()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new Console(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",support),!is$1.nullOrUndefined(this.media)&&is$1.element(this.media))if(this.media.plyr)this.debug.warn("Target already setup");else if(this.config.enabled)if(support.check().api){var s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;var a=this.media.tagName.toLowerCase(),r=null,o=null;switch(a){case"div":if(r=this.media.querySelector("iframe"),is$1.element(r)){if(o=parseUrl(r.getAttribute("src")),this.provider=getProviderByUrl(o.toString()),this.elements.container=this.media,this.media=r,this.elements.container.className="",o.search.length){var l=["1","true"];l.includes(o.searchParams.get("autoplay"))&&(this.config.autoplay=!0),l.includes(o.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=l.includes(o.searchParams.get("playsinline")),this.config.youtube.hl=o.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(is$1.empty(this.provider)||!Object.keys(providers).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=types.video;break;case"video":case"audio":this.type=a,this.provider=providers.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=support.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new Listeners(this),this.storage=new Storage(this),this.media.plyr=this,is$1.element(this.elements.container)||(this.elements.container=createElement("div",{tabindex:0}),wrap(this.media,this.elements.container)),ui.migrateStyles.call(this),ui.addStyleHook.call(this),media.setup.call(this),this.config.debug&&on.call(this,this.elements.container,this.config.events.join(" "),(function(e){n.debug.log("event: ".concat(e.type))})),this.fullscreen=new Fullscreen(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&ui.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Ads(this)),this.isHTML5&&this.config.autoplay&&setTimeout((function(){return silencePromise(n.play())}),10),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new PreviewThumbnails(this))):this.debug.error("Setup failed: no support")}else this.debug.error("Setup failed: no support");else this.debug.error("Setup failed: disabled by config");else this.debug.error("Setup failed: no suitable element passed")}return _createClass(e,[{key:"play",value:function(){var e=this;return is$1.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((function(){return e.ads.play()})).catch((function(){return silencePromise(e.media.play())})),this.media.play()):null}},{key:"pause",value:function(){return this.playing&&is$1.function(this.media.pause)?this.media.pause():null}},{key:"togglePlay",value:function(e){return(is$1.boolean(e)?e:!this.playing)?this.play():this.pause()}},{key:"stop",value:function(){this.isHTML5?(this.pause(),this.restart()):is$1.function(this.media.stop)&&this.media.stop()}},{key:"restart",value:function(){this.currentTime=0}},{key:"rewind",value:function(e){this.currentTime-=is$1.number(e)?e:this.config.seekTime}},{key:"forward",value:function(e){this.currentTime+=is$1.number(e)?e:this.config.seekTime}},{key:"increaseVolume",value:function(e){var t=this.media.muted?0:this.volume;this.volume=t+(is$1.number(e)?e:0)}},{key:"decreaseVolume",value:function(e){this.increaseVolume(-e)}},{key:"toggleCaptions",value:function(e){captions.toggle.call(this,e,!1)}},{key:"airplay",value:function(){support.airplay&&this.media.webkitShowPlaybackTargetPicker()}},{key:"toggleControls",value:function(e){if(this.supported.ui&&!this.isAudio){var t=hasClass(this.elements.container,this.config.classNames.hideControls),i=void 0===e?void 0:!e,n=toggleClass(this.elements.container,this.config.classNames.hideControls,i);if(n&&is$1.array(this.config.controls)&&this.config.controls.includes("settings")&&!is$1.empty(this.config.settings)&&controls.toggleMenu.call(this,!1),n!==t){var s=n?"controlshidden":"controlsshown";triggerEvent.call(this,this.media,s)}return!n}return!1}},{key:"on",value:function(e,t){on.call(this,this.elements.container,e,t)}},{key:"once",value:function(e,t){once.call(this,this.elements.container,e,t)}},{key:"off",value:function(e,t){off(this.elements.container,e,t)}},{key:"destroy",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ready){var n=function(){document.body.style.overflow="",t.embed=null,i?(Object.keys(t.elements).length&&(removeElement(t.elements.buttons.play),removeElement(t.elements.captions),removeElement(t.elements.controls),removeElement(t.elements.wrapper),t.elements.buttons.play=null,t.elements.captions=null,t.elements.controls=null,t.elements.wrapper=null),is$1.function(e)&&e()):(unbindListeners.call(t),replaceElement(t.elements.original,t.elements.container),triggerEvent.call(t,t.elements.original,"destroyed",!0),is$1.function(e)&&e.call(t.elements.original),t.ready=!1,setTimeout((function(){t.elements=null,t.media=null}),200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(ui.toggleNativeControls.call(this,!0),n()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&is$1.function(this.embed.destroy)&&this.embed.destroy(),n()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(n),setTimeout(n,200))}}},{key:"supports",value:function(e){return support.mime.call(this,e)}},{key:"isHTML5",get:function(){return this.provider===providers.html5}},{key:"isEmbed",get:function(){return this.isYouTube||this.isVimeo}},{key:"isYouTube",get:function(){return this.provider===providers.youtube}},{key:"isVimeo",get:function(){return this.provider===providers.vimeo}},{key:"isVideo",get:function(){return this.type===types.video}},{key:"isAudio",get:function(){return this.type===types.audio}},{key:"playing",get:function(){return Boolean(this.ready&&!this.paused&&!this.ended)}},{key:"paused",get:function(){return Boolean(this.media.paused)}},{key:"stopped",get:function(){return Boolean(this.paused&&0===this.currentTime)}},{key:"ended",get:function(){return Boolean(this.media.ended)}},{key:"currentTime",set:function(e){if(this.duration){var t=is$1.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log("Seeking to ".concat(this.currentTime," seconds"))}},get:function(){return Number(this.media.currentTime)}},{key:"buffered",get:function(){var e=this.media.buffered;return is$1.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}},{key:"seeking",get:function(){return Boolean(this.media.seeking)}},{key:"duration",get:function(){var e=parseFloat(this.config.duration),t=(this.media||{}).duration,i=is$1.number(t)&&t!==1/0?t:0;return e||i}},{key:"volume",set:function(e){var t=e;is$1.string(t)&&(t=Number(t)),is$1.number(t)||(t=this.storage.get("volume")),is$1.number(t)||(t=this.config.volume),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!is$1.empty(e)&&this.muted&&t>0&&(this.muted=!1)},get:function(){return Number(this.media.volume)}},{key:"muted",set:function(e){var t=e;is$1.boolean(t)||(t=this.storage.get("muted")),is$1.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t},get:function(){return Boolean(this.media.muted)}},{key:"hasAudio",get:function(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}},{key:"speed",set:function(e){var t=this,i=null;is$1.number(e)&&(i=e),is$1.number(i)||(i=this.storage.get("speed")),is$1.number(i)||(i=this.config.speed.selected);var n=this.minimumSpeed,s=this.maximumSpeed;i=clamp(i,n,s),this.config.speed.selected=i,setTimeout((function(){t.media.playbackRate=i}),0)},get:function(){return Number(this.media.playbackRate)}},{key:"minimumSpeed",get:function(){return this.isYouTube?Math.min.apply(Math,_toConsumableArray(this.options.speed)):this.isVimeo?.5:.0625}},{key:"maximumSpeed",get:function(){return this.isYouTube?Math.max.apply(Math,_toConsumableArray(this.options.speed)):this.isVimeo?2:16}},{key:"quality",set:function(e){var t=this.config.quality,i=this.options.quality;if(i.length){var n=[!is$1.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(is$1.number),s=!0;if(!i.includes(n)){var a=closest$1(i,n);this.debug.warn("Unsupported quality option: ".concat(n,", using ").concat(a," instead")),n=a,s=!1}t.selected=n,this.media.quality=n,s&&this.storage.set({quality:n})}},get:function(){return this.media.quality}},{key:"loop",set:function(e){var t=is$1.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t},get:function(){return Boolean(this.media.loop)}},{key:"source",set:function(e){source.change.call(this,e)},get:function(){return this.media.currentSrc}},{key:"download",get:function(){var e=this.config.urls.download;return is$1.url(e)?e:this.source},set:function(e){is$1.url(e)&&(this.config.urls.download=e,controls.setDownloadUrl.call(this))}},{key:"poster",set:function(e){this.isVideo?ui.setPoster.call(this,e,!1).catch((function(){})):this.debug.warn("Poster can only be set for video")},get:function(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}},{key:"ratio",get:function(){if(!this.isVideo)return null;var e=reduceAspectRatio(getAspectRatio.call(this));return is$1.array(e)?e.join(":"):e},set:function(e){this.isVideo?is$1.string(e)&&validateRatio(e)?(this.config.ratio=e,setAspectRatio.call(this)):this.debug.error("Invalid aspect ratio specified (".concat(e,")")):this.debug.warn("Aspect ratio can only be set for video")}},{key:"autoplay",set:function(e){var t=is$1.boolean(e)?e:this.config.autoplay;this.config.autoplay=t},get:function(){return Boolean(this.config.autoplay)}},{key:"currentTrack",set:function(e){captions.set.call(this,e,!1)},get:function(){var e=this.captions,t=e.toggled,i=e.currentTrack;return t?i:-1}},{key:"language",set:function(e){captions.setLanguage.call(this,e,!1)},get:function(){return(captions.getCurrentTrack.call(this)||{}).language}},{key:"pip",set:function(e){if(support.pip){var t=is$1.boolean(e)?e:!this.pip;is$1.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?pip.active:pip.inactive),is$1.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}},get:function(){return support.pip?is$1.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===pip.active:null}}],[{key:"supported",value:function(e,t,i){return support.check(e,t,i)}},{key:"loadSprite",value:function(e,t){return loadSprite(e,t)}},{key:"setup",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null;return is$1.string(t)?n=Array.from(document.querySelectorAll(t)):is$1.nodeList(t)?n=Array.from(t):is$1.array(t)&&(n=t.filter(is$1.element)),is$1.empty(n)?null:n.map((function(t){return new e(t,i)}))}}]),e}();Plyr.defaults=cloneDeep(defaults$1);export default Plyr; \ No newline at end of file -- cgit v1.2.3