ddplayer 1.0.0 → 25.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +31 -9
  2. package/dist/plyr.css +1 -1
  3. package/dist/plyr.js +5093 -5779
  4. package/dist/plyr.min.js +1 -3
  5. package/dist/plyr.min.js.map +1 -1
  6. package/dist/plyr.mjs +5093 -5779
  7. package/dist/plyr.polyfilled.js +8164 -14812
  8. package/dist/plyr.polyfilled.min.js +1 -3
  9. package/dist/plyr.polyfilled.min.js.map +1 -1
  10. package/dist/plyr.polyfilled.min.mjs +1 -3
  11. package/dist/plyr.polyfilled.min.mjs.map +1 -1
  12. package/dist/plyr.polyfilled.mjs +8163 -14811
  13. package/package.json +12 -8
  14. package/src/js/config/defaults.js +4 -4
  15. package/src/js/plugins/vimeo.js +5 -11
  16. package/src/js/plyr.d.ts +2 -2
  17. package/src/js/plyr.js +1 -1
  18. package/src/js/plyr.polyfilled.js +1 -1
  19. package/src/sass/base.scss +10 -6
  20. package/src/sass/components/badges.scss +7 -4
  21. package/src/sass/components/captions.scss +14 -10
  22. package/src/sass/components/control.scss +8 -5
  23. package/src/sass/components/controls.scss +5 -3
  24. package/src/sass/components/menus.scss +39 -34
  25. package/src/sass/components/progress.scss +16 -12
  26. package/src/sass/components/sliders.scss +22 -18
  27. package/src/sass/components/times.scss +7 -3
  28. package/src/sass/components/tooltips.scss +18 -14
  29. package/src/sass/components/volume.scss +4 -2
  30. package/src/sass/lib/animation.scss +3 -1
  31. package/src/sass/lib/css-vars.scss +15 -11
  32. package/src/sass/lib/mixins.scss +15 -10
  33. package/src/sass/plugins/ads.scss +9 -5
  34. package/src/sass/plugins/preview-thumbnails/index.scss +17 -17
  35. package/src/sass/plugins/preview-thumbnails/settings.scss +11 -7
  36. package/src/sass/plyr.scss +44 -45
  37. package/src/sass/settings/badges.scss +6 -3
  38. package/src/sass/settings/captions.scss +9 -6
  39. package/src/sass/settings/colors.scss +3 -1
  40. package/src/sass/settings/controls.scss +19 -16
  41. package/src/sass/settings/cosmetics.scss +4 -1
  42. package/src/sass/settings/menus.scss +12 -9
  43. package/src/sass/settings/progress.scss +8 -5
  44. package/src/sass/settings/sliders.scss +19 -15
  45. package/src/sass/settings/tooltips.scss +11 -7
  46. package/src/sass/settings/type.scss +13 -11
  47. package/src/sass/states/fullscreen.scss +7 -5
  48. package/src/sass/types/audio.scss +17 -12
  49. package/src/sass/types/video.scss +30 -23
  50. package/src/sass/utils/hidden.scss +3 -1
  51. package/src/sass/youtube.scss +16 -11
  52. package/tasks/build.js +4 -4
  53. package/.travis.yml +0 -12
  54. package/dist/plyr.min.mjs +0 -3
  55. package/dist/plyr.min.mjs.map +0 -1
package/dist/plyr.min.js CHANGED
@@ -1,4 +1,2 @@
1
- "object"==typeof navigator&&function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Plyr",t):(e="undefined"!=typeof globalThis?globalThis:e||self).Plyr=t()}(this,(function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}function n(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function a(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function s(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a(Object(i),!0).forEach((function(t){n(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function r(e,t){if(null==e)return{};var i,n,a=function(e,t){if(null==e)return{};var i,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||(a[i]=e[i]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(a[i]=e[i])}return a}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var i=[],n=!0,a=!1,s=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){a=!0,s=e}finally{try{n||null==o.return||o.return()}finally{if(a)throw s}}return i}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return u(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)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var d,h,p,m=function(e){return null!=e?e.constructor:null},f=function(e,t){return Boolean(e&&t&&e instanceof t)},g=function(e){return null==e},y=function(e){return m(e)===Object},v=function(e){return m(e)===String},b=function(e){return m(e)===Function},w=function(e){return Array.isArray(e)},k=function(e){return f(e,NodeList)},T=function(e){return g(e)||(v(e)||w(e)||k(e))&&!e.length||y(e)&&!Object.keys(e).length},C=g,A=y,S=function(e){return m(e)===Number&&!Number.isNaN(e)},P=v,E=function(e){return m(e)===Boolean},M=b,x=w,N=k,I=function(e){return f(e,Element)},L=function(e){return f(e,Event)},j=function(e){return f(e,KeyboardEvent)},O=function(e){return f(e,TextTrack)||!g(e)&&v(e.kind)},_=function(e){return f(e,Promise)&&b(e.then)},q=function(e){if(f(e,window.URL))return!0;if(!v(e))return!1;var t=e;e.startsWith("http://")&&e.startsWith("https://")||(t="http://".concat(e));try{return!T(new URL(t).hostname)}catch(e){return!1}},D=T,H=(d=document.createElement("span"),h={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},p=Object.keys(h).find((function(e){return void 0!==d.style[e]})),!!P(p)&&h[p]);function F(e,t){setTimeout((function(){try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}}),t)}var R={isIE:
2
- /* @cc_on!@ */
3
- !!document.documentMode,isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:/(iPad|iPhone|iPod)/gi.test(navigator.platform)};function V(e,t){return t.split(".").reduce((function(e,t){return e&&e[t]}),e)}function B(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length,i=new Array(t>1?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];if(!i.length)return e;var s=i.shift();return A(s)?(Object.keys(s).forEach((function(t){A(s[t])?(Object.keys(e).includes(t)||Object.assign(e,n({},t,{})),B(e[t],s[t])):Object.assign(e,n({},t,s[t]))})),B.apply(void 0,[e].concat(i))):e}function U(e,t){var i=e.length?e:[e];Array.from(i).reverse().forEach((function(e,i){var n=i>0?t.cloneNode(!0):t,a=e.parentNode,s=e.nextSibling;n.appendChild(e),s?a.insertBefore(n,s):a.appendChild(n)}))}function W(e,t){I(e)&&!D(t)&&Object.entries(t).filter((function(e){var t=o(e,2)[1];return!C(t)})).forEach((function(t){var i=o(t,2),n=i[0],a=i[1];return e.setAttribute(n,a)}))}function z(e,t,i){var n=document.createElement(e);return A(t)&&W(n,t),P(i)&&(n.innerText=i),n}function K(e,t,i,n){I(t)&&t.appendChild(z(e,i,n))}function Y(e){N(e)||x(e)?Array.from(e).forEach(Y):I(e)&&I(e.parentNode)&&e.parentNode.removeChild(e)}function Q(e){if(I(e))for(var t=e.childNodes.length;t>0;)e.removeChild(e.lastChild),t-=1}function J(e,t){return I(t)&&I(t.parentNode)&&I(e)?(t.parentNode.replaceChild(e,t),e):null}function X(e,t){if(!P(e)||D(e))return{};var i={},n=B({},t);return e.split(",").forEach((function(e){var t=e.trim(),a=t.replace(".",""),s=t.replace(/[[\]]/g,"").split("="),r=o(s,1)[0],l=s.length>1?s[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":P(n.class)?i.class="".concat(n.class," ").concat(a):i.class=a;break;case"#":i.id=t.replace("#","");break;case"[":i[r]=l}})),B(n,i)}function $(e,t){if(I(e)){var i=t;E(i)||(i=!e.hidden),e.hidden=i}}function G(e,t,i){if(N(e))return Array.from(e).map((function(e){return G(e,t,i)}));if(I(e)){var n="toggle";return void 0!==i&&(n=i?"add":"remove"),e.classList[n](t),e.classList.contains(t)}return!1}function Z(e,t){return I(e)&&e.classList.contains(t)}function ee(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 te(e){return this.elements.container.querySelectorAll(e)}function ie(e){return this.elements.container.querySelector(e)}function ne(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];I(e)&&(e.focus({preventScroll:!0}),t&&G(e,this.config.classNames.tabFocus))}var ae,se={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},re={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check:function(e,t,i){var n=R.isIPhone&&i&&re.playsinline,a=re[e]||"html5"!==t;return{api:a,ui:a&&re.rangeInput&&("video"!==e||!R.isIPhone||n)}},pip:!(R.isIPhone||!M(z("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||z("video").disablePictureInPicture)),airplay:M(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime:function(e){if(D(e))return!1;var t=o(e.split("/"),1)[0],i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(se).includes(i)&&(i+='; codecs="'.concat(se[e],'"'));try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(ae=document.createElement("input"),ae.type="range","range"===ae.type),touch:"ontouchstart"in document.documentElement,transitions:!1!==H,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches};function oe(e){return x(e)?e.filter((function(t,i){return e.indexOf(t)===i})):e}var le=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 ce(e,t,i){var n=this,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e&&"addEventListener"in e&&!D(t)&&M(i)){var o=t.split(" "),l=r;le&&(l={passive:s,capture:r}),o.forEach((function(t){n&&n.eventListeners&&a&&n.eventListeners.push({element:e,type:t,callback:i,options:l}),e[a?"addEventListener":"removeEventListener"](t,i,l)}))}}function ue(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],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];ce.call(this,e,t,i,!0,n,a)}function de(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],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];ce.call(this,e,t,i,!1,n,a)}function he(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=function r(){de(e,i,r,a,s);for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];n.apply(t,l)};ce.call(this,e,i,r,!0,a,s)}function pe(e){var t=arguments.length>1&&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(I(e)&&!D(t)){var a=new CustomEvent(t,{bubbles:i,detail:s(s({},n),{},{plyr:this})});e.dispatchEvent(a)}}function me(){this&&this.eventListeners&&(this.eventListeners.forEach((function(e){var t=e.element,i=e.type,n=e.callback,a=e.options;t.removeEventListener(i,n,a)})),this.eventListeners=[])}function fe(){var e=this;return new Promise((function(t){return e.ready?setTimeout(t,0):ue.call(e,e.elements.container,"ready",t)})).then((function(){}))}function ge(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";return new Promise((function(i,n){try{var a=new XMLHttpRequest;if(!("withCredentials"in a))return;a.addEventListener("load",(function(){if("text"===t)try{i(JSON.parse(a.responseText))}catch(e){i(a.responseText)}else i(a.response)})),a.addEventListener("error",(function(){throw new Error(a.status)})),a.open("GET",e,!0),a.responseType=t,a.send()}catch(e){n(e)}}))}function ye(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return D(e)?e:e.toString().replace(/{(\d+)}/g,(function(e,t){return i[t].toString()}))}var ve=function(){var e=arguments.length>0&&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())},be=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 we(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toString();return t=ve(t,"-"," "),t=ve(t,"_"," "),t=be(t),ve(t," ","")}function ke(e){var t=document.createElement("div");return t.appendChild(e),t.innerHTML}var Te={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},Ce=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(D(e)||D(t))return"";var i=V(t.i18n,e);if(D(i))return Object.keys(Te).includes(e)?Te[e]:"";var n={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(n).forEach((function(e){var t=o(e,2),n=t[0],a=t[1];i=ve(i,n,a)})),i};function Ae(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 Se(e){var t=new URLSearchParams;return A(e)&&Object.entries(e).forEach((function(e){var i=o(e,2),n=i[0],a=i[1];t.set(n,a)})),t}var Pe={setup:function(){if(this.supported.ui)if(!this.isVideo||this.isYouTube||this.isHTML5&&!re.textTracks)x(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&this.setCaptionsMenu.call(this);else{if(I(this.elements.captions)||(this.elements.captions=z("div",X(this.config.selectors.captions)),function(e,t){I(e)&&I(t)&&t.parentNode.insertBefore(e,t.nextSibling)}(this.elements.captions,this.elements.wrapper)),R.isIE&&window.URL){var e=this.media.querySelectorAll("track");Array.from(e).forEach((function(e){var t=e.getAttribute("src"),i=Ae(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&ge(t,"blob").then((function(t){e.setAttribute("src",window.URL.createObjectURL(t))})).catch((function(){Y(e)}))}))}var t=oe((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=o(t,1)[0];var n=this.storage.get("captions");if(E(n)||(n=this.config.captions.active),Object.assign(this.captions,{toggled:!1,active:n,language:i,languages:t}),this.isHTML5){var a=this.config.captions.update?"addtrack removetrack":"removetrack";ue.call(this,this.media.textTracks,a,Pe.update.bind(this))}setTimeout(Pe.update.bind(this),0)}},update:function(){var e=this,t=Pe.getTracks.call(this,!0),i=this.captions,n=i.active,a=i.language,s=i.meta,r=i.currentTrackNode,o=Boolean(t.find((function(e){return e.language===a})));this.isHTML5&&this.isVideo&&t.filter((function(e){return!s.get(e)})).forEach((function(t){e.debug.log("Track added",t),s.set(t,{default:"showing"===t.mode}),"showing"===t.mode&&(t.mode="hidden"),ue.call(e,t,"cuechange",(function(){return Pe.updateCues.call(e)}))})),(o&&this.language!==a||!t.includes(r))&&(Pe.setLanguage.call(this,a),Pe.toggle.call(this,n&&o)),G(this.elements.container,this.config.classNames.captions.enabled,!D(t)),x(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&this.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,a=this.config.classNames.captions.active,s=C(e)?!n:e;if(s!==n){if(i||(this.captions.active=s,this.storage.set({captions:s})),!this.language&&s&&!i){var r=Pe.getTracks.call(this),o=Pe.findTrack.call(this,[this.captions.language].concat(l(this.captions.languages)),!0);return this.captions.language=o.language,void Pe.set.call(this,r.indexOf(o))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=s),G(this.elements.container,a,s),this.captions.toggled=s,this.updateSetting.call(this,"captions"),pe.call(this,this.media,s?"captionsenabled":"captionsdisabled")}setTimeout((function(){s&&t.captions.toggled&&(t.captions.currentTrackNode.mode="hidden")}))}},set:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=Pe.getTracks.call(this);if(-1!==e)if(S(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;var n=i[e],a=n||{},s=a.language;this.captions.currentTrackNode=n,this.updateSetting.call(this,"captions"),t||(this.captions.language=s,this.storage.set({language:s})),this.isVimeo&&this.embed.enableTextTrack(s),pe.call(this,this.media,"languagechange")}Pe.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&Pe.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else Pe.toggle.call(this,!1,t)},setLanguage:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(P(e)){var i=e.toLowerCase();this.captions.language=i;var n=Pe.getTracks.call(this),a=Pe.findTrack.call(this,[i]);Pe.set.call(this,n.indexOf(a),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],a=Pe.getTracks.call(this),s=function(e){return Number((i.captions.meta.get(e)||{}).default)},r=Array.from(a).sort((function(e,t){return s(t)-s(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 Pe.getTracks.call(this)[this.currentTrack]},getLabel:function(e){var t=e;return!O(t)&&re.textTracks&&this.captions.toggled&&(t=Pe.getCurrentTrack.call(this)),O(t)?D(t.label)?D(t.language)?Ce("enabled",this.config):e.language.toUpperCase():t.label:Ce("disabled",this.config)},updateCues:function(e){if(this.supported.ui)if(I(this.elements.captions))if(C(e)||Array.isArray(e)){var t=e;if(!t){var i=Pe.getCurrentTrack.call(this);t=Array.from((i||{}).activeCues||[]).map((function(e){return e.getCueAsHTML()})).map(ke)}var n=t.map((function(e){return e.trim()})).join("\n");if(n!==this.elements.captions.innerHTML){Q(this.elements.captions);var a=z("span",X(this.config.selectors.caption));a.innerHTML=n,this.elements.captions.appendChild(a),pe.call(this,this.media,"cuechange")}}else this.debug.warn("updateCues: Invalid input",e);else this.debug.warn("No captions element to render to")}},Ee={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:"https://cdn.plyr.io/3.6.1/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",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:!0},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","mute","volume","current-time","progress","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{auto:"Auto",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"}},buffer:{maxBufferLength:10,maxMaxBufferLength:60},urls:{hlsjs:{sdk:"https://cdn.jsdelivr.net/npm/hls.js@0.14.10/dist/hls.min.js"},dashjs:{sdk:"https://cdn.jsdelivr.net/npm/dashjs@3.1.2/dist/dash.all.min.js"},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}},Me="picture-in-picture",xe="inline",Ne={html5:"html5",hlsjs:"hlsjs",dashjs:"dashjs",youtube:"youtube",vimeo:"vimeo"},Ie="audio",Le="video";function je(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?Ne.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?Ne.vimeo:/^https?:\/\/(.*).m3u8(.?)/.test(e)?Ne.hlsjs:/^https?:\/\/(.*).mpd(.?)/.test(e)?Ne.dashjs:null}var Oe=function(){},_e=function(){function t(){var i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e(this,t),this.enabled=window.console&&i,this.enabled&&this.log("Debugging enabled")}return i(t,[{key:"log",get:function(){return this.enabled?Function.prototype.bind.call(console.log,console):Oe}},{key:"warn",get:function(){return this.enabled?Function.prototype.bind.call(console.warn,console):Oe}},{key:"error",get:function(){return this.enabled?Function.prototype.bind.call(console.error,console):Oe}}]),t}();function qe(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function De(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function He(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function Fe(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?He(Object(i),!0).forEach((function(t){De(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):He(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var Re={addCSS:!0,thumbWidth:15,watch:!0};function Ve(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}var Be=function(e){return null!=e?e.constructor:null},Ue=function(e,t){return!!(e&&t&&e instanceof t)},We=function(e){return null==e},ze=function(e){return Be(e)===Object},Ke=function(e){return Be(e)===String},Ye=function(e){return Array.isArray(e)},Qe=function(e){return Ue(e,NodeList)},Je=Ke,Xe=Ye,$e=Qe,Ge=function(e){return Ue(e,Element)},Ze=function(e){return Ue(e,Event)},et=function(e){return We(e)||(Ke(e)||Ye(e)||Qe(e))&&!e.length||ze(e)&&!Object.keys(e).length};function tt(e,t){if(1>t){var i=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(i))}return Math.round(e/t)*t}var it=function(){function e(t,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),Ge(t)?this.element=t:Je(t)&&(this.element=document.querySelector(t)),Ge(this.element)&&et(this.element.rangeTouch)&&(this.config=Fe({},Re,{},i),this.init())}return function(e,t,i){t&&qe(e.prototype,t),i&&qe(e,i)}(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||!Ze(t))return null;var i,n=t.target,a=t.changedTouches[0],s=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*(a.clientX-l.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*c:50<i&&(i+=2*(i-50)*c),s+tt(i/100*(r-s),o)}},{key:"set",value:function(t){e.enabled&&Ze(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),function(e,t){if(e&&t){var i=new Event(t,{bubbles:!0});e.dispatchEvent(i)}}(t.target,"touchend"===t.type?"change":"input"))}}],[{key:"setup",value:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=null;if(et(t)||Je(t)?n=Array.from(document.querySelectorAll(Je(t)?t:'input[type="range"]')):Ge(t)?n=[t]:$e(t)?n=Array.from(t):Xe(t)&&(n=t.filter(Ge)),et(n))return null;var a=Fe({},Re,{},i);if(Je(t)&&a.watch){var s=new MutationObserver((function(i){Array.from(i).forEach((function(i){Array.from(i.addedNodes).forEach((function(i){Ge(i)&&Ve(i,t)&&new e(i,a)}))}))}));s.observe(document.body,{childList:!0,subtree:!0})}return n.map((function(t){return new e(t,i)}))}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}();function nt(e){_(e)&&e.then(null,(function(){}))}function at(e){return!!(x(e)||P(e)&&e.includes(":"))&&(x(e)?e:e.split(":")).map(Number).every(S)}function st(e){if(!x(e)||!e.every(S))return null;var t=o(e,2),i=t[0],n=t[1],a=function e(t,i){return 0===i?t:e(i,t%i)}(i,n);return[i/a,n/a]}function rt(e){var t=function(e){return at(e)?e.split(":").map(Number):null},i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!D(this.embed)&&x(this.embed.ratio)&&(i=this.embed.ratio),null===i&&this.isHTML5){var n=this.media;i=st([n.videoWidth,n.videoHeight])}return i}function ot(e){if(!this.isVideo)return{};var t=this.elements.wrapper,i=rt.call(this,e),n=o(x(i)?i:[0,0],2),a=100/n[0]*n[1];if(t.style.paddingBottom="".concat(a,"%"),this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){var s=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),r=(s-a)/(s/50);this.media.style.transform="translateY(-".concat(r,"%)")}else this.isHTML5&&t.classList.toggle(this.config.classNames.videoFixedRatio,null!==i);return{padding:a,ratio:i}}var lt={getSources:function(){var e=this;return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter((function(t){var i=t.getAttribute("type");return!!D(i)||re.mime.call(e,i)})):[]},getQualityOptions:function(){return this.config.quality.forced?this.config.quality.options:lt.getSources.call(this).map((function(e){return Number(e.getAttribute("size"))})).filter(Boolean)},setup:function(){if(this.isHTML5){var e=this;e.options.speed=e.config.speed.options,D(this.config.ratio)||ot.call(e),Object.defineProperty(e.media,"quality",{get:function(){var t=lt.getSources.call(e).find((function(t){return t.getAttribute("src")===e.source}));return t&&Number(t.getAttribute("size"))},set:function(t){if(e.quality!==t){if(e.config.quality.forced&&M(e.config.quality.onChange))e.config.quality.onChange(t);else{var i=lt.getSources.call(e).find((function(e){return Number(e.getAttribute("size"))===t}));if(!i)return;var n=e.media,a=n.currentTime,s=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=a,s||nt(e.play())})),e.media.load())}pe.call(e,e.media,"qualitychange",!1,{quality:t})}}})}},cancelRequests:function(){this.isHTML5&&(Y(lt.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}},ct=function(){function t(i){e(this,t),this.enabled=i.config.storage.enabled,this.key=i.config.storage.key}return i(t,[{key:"get",value:function(e){if(!t.supported||!this.enabled)return null;var i=window.localStorage.getItem(this.key);if(D(i))return null;var n=JSON.parse(i);return P(e)&&e.length?n[e]:n}},{key:"set",value:function(e){if(t.supported&&this.enabled&&A(e)){var i=this.get();D(i)&&(i={}),B(i,e),window.localStorage.setItem(this.key,JSON.stringify(i))}}}],[{key:"supported",get:function(){try{if(!("localStorage"in window))return!1;var e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}}}]),t}();function ut(e,t){if(P(e)){var i="cache",n=P(t),a=function(){return null!==document.getElementById(t)},s=function(e,t){e.innerHTML=t,n&&a()||document.body.insertAdjacentElement("afterbegin",e)};if(!n||!a()){var r=ct.supported,o=document.createElement("div");if(o.setAttribute("hidden",""),n&&o.setAttribute("id",t),r){var l=window.localStorage.getItem("".concat(i,"-").concat(t));if(null!==l){var c=JSON.parse(l);s(o,c.content)}}ge(e).then((function(e){D(e)||(r&&window.localStorage.setItem("".concat(i,"-").concat(t),JSON.stringify({content:e})),s(o,e))})).catch((function(){}))}}}var dt=function(e){return Math.trunc(e/60/60%60,10)},ht=function(e){return Math.trunc(e/60%60,10)},pt=function(e){return Math.trunc(e%60,10)};function mt(){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(!S(e))return mt(void 0,t,i);var n=function(e){return"0".concat(e).slice(-2)},a=dt(e),s=ht(e),r=pt(e);return a=t||a>0?"".concat(a,":"):"","".concat(i&&e>0?"-":"").concat(a).concat(n(s),":").concat(n(r))}var ft={getIconUrl:function(){var e=new URL(this.config.iconUrl,window.location).host!==window.location.host||R.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:e}},findElements:function(){try{return this.elements.controls=ie.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:te.call(this,this.config.selectors.buttons.play),pause:ie.call(this,this.config.selectors.buttons.pause),restart:ie.call(this,this.config.selectors.buttons.restart),rewind:ie.call(this,this.config.selectors.buttons.rewind),fastForward:ie.call(this,this.config.selectors.buttons.fastForward),mute:ie.call(this,this.config.selectors.buttons.mute),pip:ie.call(this,this.config.selectors.buttons.pip),airplay:ie.call(this,this.config.selectors.buttons.airplay),settings:ie.call(this,this.config.selectors.buttons.settings),captions:ie.call(this,this.config.selectors.buttons.captions),fullscreen:ie.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=ie.call(this,this.config.selectors.progress),this.elements.inputs={seek:ie.call(this,this.config.selectors.inputs.seek),volume:ie.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:ie.call(this,this.config.selectors.display.buffer),currentTime:ie.call(this,this.config.selectors.display.currentTime),duration:ie.call(this,this.config.selectors.display.duration)},I(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="http://www.w3.org/2000/svg",n=ft.getIconUrl.call(this),a="".concat(n.cors?"":n.url,"#").concat(this.config.iconPrefix),s=document.createElementNS(i,"svg");W(s,B(t,{"aria-hidden":"true",focusable:"false"}));var r=document.createElementNS(i,"use"),o="".concat(a,"-").concat(e);return"href"in r&&r.setAttributeNS("http://www.w3.org/1999/xlink","href",o),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),s.appendChild(r),s},createLabel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Ce(e,this.config),n=s(s({},t),{},{class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")});return z("span",n,i)},createBadge:function(e){if(D(e))return null;var t=z("span",{class:this.config.classNames.menu.value});return t.appendChild(z("span",{class:this.config.classNames.menu.badge},e)),t},createButton:function(e,t){var i=this,n=B({},t),a=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString();return(e=we(e)).charAt(0).toLowerCase()+e.slice(1)}(e),s={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((function(e){Object.keys(n).includes(e)&&(s[e]=n[e],delete n[e])})),"button"!==s.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}))||B(n,{class:"".concat(n.class," ").concat(this.config.classNames.control)}):n.class=this.config.classNames.control,e){case"play":s.toggle=!0,s.label="play",s.labelPressed="pause",s.icon="play",s.iconPressed="pause";break;case"mute":s.toggle=!0,s.label="mute",s.labelPressed="unmute",s.icon="volume",s.iconPressed="muted";break;case"captions":s.toggle=!0,s.label="enableCaptions",s.labelPressed="disableCaptions",s.icon="captions-off",s.iconPressed="captions-on";break;case"fullscreen":s.toggle=!0,s.label="enterFullscreen",s.labelPressed="exitFullscreen",s.icon="enter-fullscreen",s.iconPressed="exit-fullscreen";break;case"play-large":n.class+=" ".concat(this.config.classNames.control,"--overlaid"),a="play",s.label="play",s.icon="play";break;default:D(s.label)&&(s.label=a),D(s.icon)&&(s.icon=e)}var r=z(s.element);return s.toggle?(r.appendChild(ft.createIcon.call(this,s.iconPressed,{class:"icon--pressed"})),r.appendChild(ft.createIcon.call(this,s.icon,{class:"icon--not-pressed"})),r.appendChild(ft.createLabel.call(this,s.labelPressed,{class:"label--pressed"})),r.appendChild(ft.createLabel.call(this,s.label,{class:"label--not-pressed"}))):(r.appendChild(ft.createIcon.call(this,s.icon)),r.appendChild(ft.createLabel.call(this,s.label))),B(n,X(this.config.selectors.buttons[a],n)),W(r,n),"play"===a?(x(this.elements.buttons[a])||(this.elements.buttons[a]=[]),this.elements.buttons[a].push(r)):this.elements.buttons[a]=r,r},createRange:function(e,t){var i=z("input",B(X(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":Ce(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,ft.updateRangeFill.call(this,i),it.setup(i),i},createProgress:function(e,t){var i=z("progress",B(X(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild(z("span",null,"0"));var n={played:"played",buffer:"buffered"}[e],a=n?Ce(n,this.config):"";i.innerText="% ".concat(a.toLowerCase())}return this.elements.display[e]=i,i},createTime:function(e,t){var i=X(this.config.selectors.display[e],t),n=z("div",B(i,{class:"".concat(i.class?i.class:""," ").concat(this.config.classNames.display.time," ").trim(),"aria-label":Ce(e,this.config)}),"00:00");return this.elements.display[e]=n,n},bindMenuItemShortcuts:function(e,t){var i=this;ue.call(this,e,"keydown keyup",(function(n){if([32,38,39,40].includes(n.which)&&(n.preventDefault(),n.stopPropagation(),"keydown"!==n.type)){var a,s=ee(e,'[role="menuitemradio"]');if(!s&&[32,39].includes(n.which))ft.showMenuPanel.call(i,t,!0);else 32!==n.which&&(40===n.which||s&&39===n.which?(a=e.nextElementSibling,I(a)||(a=e.parentNode.firstElementChild)):(a=e.previousElementSibling,I(a)||(a=e.parentNode.lastElementChild)),ne.call(i,a,!0))}}),!1),ue.call(this,e,"keyup",(function(e){13===e.which&&ft.focusFirstMenuItem.call(i,null,!0)}))},createMenuItem:function(e){var t=this,i=e.value,n=e.list,a=e.type,s=e.title,r=e.badge,o=void 0===r?null:r,l=e.checked,c=void 0!==l&&l,u=X(this.config.selectors.inputs[a]),d=z("button",B(u,{type:"button",role:"menuitemradio",class:"".concat(this.config.classNames.control," ").concat(u.class?u.class:"").trim(),"aria-checked":c,value:i})),h=z("span");h.innerHTML=s,I(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 ee(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(!j(e)||32===e.which){switch(e.preventDefault(),e.stopPropagation(),d.checked=!0,a){case"language":t.currentTrack=Number(i);break;case"quality":t.quality=i;break;case"speed":t.speed=parseFloat(i)}ft.showMenuPanel.call(t,"home",j(e))}}),a,!1),ft.bindMenuItemShortcuts.call(this,d,a),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(!S(e))return e;var i=dt(this.duration)>0;return mt(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];I(e)&&S(t)&&(e.innerText=ft.formatTime(t,i))},updateVolume:function(){this.supported.ui&&(I(this.elements.inputs.volume)&&ft.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),I(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;I(e)&&(e.value=t,ft.updateRangeFill.call(this,e))},updateProgress:function(e){var t=this;if(this.supported.ui&&L(e)){var i,n,a=0;if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":i=this.currentTime,n=this.duration,a=0===i||0===n||Number.isNaN(i)||Number.isNaN(n)?0:(i/n*100).toFixed(2),"timeupdate"===e.type&&ft.setRange.call(this,this.elements.inputs.seek,a);break;case"playing":case"progress":!function(e,i){var n=S(i)?i:0,a=I(e)?e:t.elements.display.buffer;if(I(a)){a.value=n;var s=a.getElementsByTagName("span")[0];I(s)&&(s.childNodes[0].nodeValue=n)}}(this.elements.display.buffer,100*this.buffered)}}},updateRangeFill:function(e){var t=L(e)?e.target:e;if(I(t)&&"range"===t.getAttribute("type")){if(ee(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);var i=ft.formatTime(this.currentTime),n=ft.formatTime(this.duration),a=Ce("seekLabel",this.config);t.setAttribute("aria-valuetext",a.replace("{currentTime}",i).replace("{duration}",n))}else if(ee(t,this.config.selectors.inputs.volume)){var s=100*t.value;t.setAttribute("aria-valuenow",s),t.setAttribute("aria-valuetext","".concat(s.toFixed(1),"%"))}else t.setAttribute("aria-valuenow",t.value);R.isWebkit&&t.style.setProperty("--value","".concat(t.value/t.max*100,"%"))}},updateSeekTooltip:function(e){var t=this;if(this.config.tooltips.seek&&I(this.elements.inputs.seek)&&I(this.elements.display.seekTooltip)&&0!==this.duration){var i="".concat(this.config.classNames.tooltip,"--visible"),n=function(e){return G(t.elements.display.seekTooltip,i,e)};if(this.touch)n(!1);else{var a=0,s=this.elements.progress.getBoundingClientRect();if(L(e))a=100/s.width*(e.pageX-s.left);else{if(!Z(this.elements.display.seekTooltip,i))return;a=parseFloat(this.elements.display.seekTooltip.style.left,10)}a<0?a=0:a>100&&(a=100),ft.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*a),this.elements.display.seekTooltip.style.left="".concat(a,"%"),L(e)&&["mouseenter","mouseleave"].includes(e.type)&&n("mouseenter"===e.type)}}},timeUpdate:function(e){var t=!I(this.elements.display.duration)&&this.config.invertTime;ft.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||ft.updateProgress.call(this,e)},durationUpdate:function(){if(this.supported.ui&&(this.config.invertTime||!this.currentTime)){if(this.duration>=Math.pow(2,32))return $(this.elements.display.currentTime,!0),void $(this.elements.progress,!0);I(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);var e=I(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&ft.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&ft.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),ft.updateSeekTooltip.call(this)}},toggleMenuButton:function(e,t){$(this.elements.settings.buttons[e],!t)},updateSetting:function(e,t,i){var n=this.elements.settings.panels[e],a=null,s=t;if("captions"===e)a=this.currentTrack;else{if(a=D(i)?this[e]:i,D(a)&&(a=this.config[e].default),!D(this.options[e])&&!this.options[e].includes(a))return void this.debug.warn("Unsupported value of '".concat(a,"' for ").concat(e));if(!this.config[e].options.includes(a))return void this.debug.warn("Disabled value of '".concat(a,"' for ").concat(e))}if(I(s)||(s=n&&n.querySelector('[role="menu"]')),I(s)){this.elements.settings.buttons[e].querySelector(".".concat(this.config.classNames.menu.value)).innerHTML=ft.getLabel.call(this,e,a);var r=s&&s.querySelector('[value="'.concat(a,'"]'));I(r)&&(r.checked=!0)}},getLabel:function(e,t){switch(e){case"speed":return 1===t?Ce("normal",this.config):"".concat(t,"&times;");case"quality":if(S(t)){if(-1===t)return Ce("auto",this.config);var i=Ce("qualityLabel.".concat(t),this.config);return i.length?i:"".concat(t,"p")}return be(t);case"captions":return Pe.getLabel.call(this);default:return null}},setQualityMenu:function(e){var t=this;if(I(this.elements.settings.panels.quality)){var i="quality",n=this.elements.settings.panels.quality.querySelector('[role="menu"]');x(e)&&(this.options.quality=oe(e).filter((function(e){return t.config.quality.options.includes(e)})));var a=!D(this.options.quality)&&this.options.quality.length>1;if(ft.toggleMenuButton.call(this,i,a),Q(n),ft.checkMenu.call(this),a){var s=function(e){var i=Ce("qualityBadge.".concat(e),t.config);return i.length?ft.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){ft.createMenuItem.call(t,{value:e,list:n,type:i,title:ft.getLabel.call(t,"quality",e),badge:s(e)})})),ft.updateSetting.call(this,i,n)}}},setCaptionsMenu:function(){var e=this;if(I(this.elements.settings.panels.captions)){var t="captions",i=this.elements.settings.panels.captions.querySelector('[role="menu"]'),n=Pe.getTracks.call(this),a=Boolean(n.length);if(ft.toggleMenuButton.call(this,t,a),Q(i),ft.checkMenu.call(this),a){var s=n.map((function(t,n){return{value:n,checked:e.captions.toggled&&e.currentTrack===n,title:Pe.getLabel.call(e,t),badge:t.language&&ft.createBadge.call(e,t.language.toUpperCase()),list:i,type:"language"}}));s.unshift({value:-1,checked:!this.captions.toggled,title:Ce("disabled",this.config),list:i,type:"language"}),s.forEach(ft.createMenuItem.bind(this)),ft.updateSetting.call(this,t,i)}}},setSpeedMenu:function(){var e=this;if(I(this.elements.settings.panels.speed)){var t="speed",i=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 n=!D(this.options.speed)&&this.options.speed.length>1;ft.toggleMenuButton.call(this,t,n),Q(i),ft.checkMenu.call(this),n&&(this.options.speed.forEach((function(n){ft.createMenuItem.call(e,{value:n,list:i,type:t,title:ft.getLabel.call(e,"speed",n)})})),ft.updateSetting.call(this,t,i))}},checkMenu:function(){var e=this.elements.settings.buttons,t=!D(e)&&Object.values(e).some((function(e){return!e.hidden}));$(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;I(i)||(i=Object.values(this.elements.settings.panels).find((function(e){return!e.hidden})));var n=i.querySelector('[role^="menuitem"]');ne.call(this,n,t)}},toggleMenu:function(e){var t=this.elements.settings.popup,i=this.elements.buttons.settings;if(I(t)&&I(i)){var n=t.hidden,a=n;if(E(e))a=e;else if(j(e)&&27===e.which)a=!1;else if(L(e)){var s=M(e.composedPath)?e.composedPath()[0]:e.target,r=t.contains(s);if(r||!r&&e.target!==i&&a)return}i.setAttribute("aria-expanded",a),$(t,!a),G(this.elements.container,this.config.classNames.menu.open,a),a&&j(e)?ft.focusFirstMenuItem.call(this,null,!0):a||n||ne.call(this,i,j(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 Y(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(I(n)){var a=n.parentNode,s=Array.from(a.children).find((function(e){return!e.hidden}));if(re.transitions&&!re.reducedMotion){a.style.width="".concat(s.scrollWidth,"px"),a.style.height="".concat(s.scrollHeight,"px");var r=ft.getMenuSize.call(this,n),o=function t(i){i.target===a&&["width","height"].includes(i.propertyName)&&(a.style.width="",a.style.height="",de.call(e,a,H,t))};ue.call(this,a,H,o),a.style.width="".concat(r.width,"px"),a.style.height="".concat(r.height,"px")}$(s,!0),$(n,!1),ft.focusFirstMenuItem.call(this,n,i)}},setDownloadUrl:function(){var e=this.elements.buttons.download;I(e)&&e.setAttribute("href",this.download)},create:function(e){var t=this,i=ft.bindMenuItemShortcuts,n=ft.createButton,a=ft.createProgress,s=ft.createRange,r=ft.createTime,o=ft.setQualityMenu,l=ft.setSpeedMenu,c=ft.showMenuPanel;this.elements.controls=null,x(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(n.call(this,"play-large"));var u=z("div",X(this.config.selectors.controls.wrapper));this.elements.controls=u;var d={class:"plyr__controls__item"};return oe(x(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=z("div",{class:"".concat(d.class," plyr__progress__container")}),h=z("div",X(t.config.selectors.progress));if(h.appendChild(s.call(t,"seek",{id:"plyr-seek-".concat(e.id)})),h.appendChild(a.call(t,"buffer")),t.config.tooltips.seek){var p=z("span",{class:t.config.classNames.tooltip},"00:00");h.appendChild(p),t.elements.display.seekTooltip=p}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 m=t.elements.volume;if(I(m)&&u.contains(m)||(m=z("div",B({},d,{class:"".concat(d.class," plyr__volume").trim()})),t.elements.volume=m,u.appendChild(m)),"mute"===o&&m.appendChild(n.call(t,"mute")),"volume"===o&&!R.isIos){var f={max:1,step:.05,value:t.config.volume};m.appendChild(s.call(t,"volume",B(f,{id:"plyr-volume-".concat(e.id)})))}}if("captions"===o&&u.appendChild(n.call(t,"captions",d)),"settings"===o&&!D(t.config.settings)){var g=z("div",B({},d,{class:"".concat(d.class," plyr__menu").trim(),hidden:""}));g.appendChild(n.call(t,"settings",{"aria-haspopup":!0,"aria-controls":"plyr-settings-".concat(e.id),"aria-expanded":!1}));var y=z("div",{class:"plyr__menu__container",id:"plyr-settings-".concat(e.id),hidden:""}),v=z("div"),b=z("div",{id:"plyr-settings-".concat(e.id,"-home")}),w=z("div",{role:"menu"});b.appendChild(w),v.appendChild(b),t.elements.settings.panels.home=b,t.config.settings.forEach((function(n){var a=z("button",B(X(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,a,n),ue.call(t,a,"click",(function(){c.call(t,n,!1)}));var s=z("span",null,Ce(n,t.config)),r=z("span",{class:t.config.classNames.menu.value});r.innerHTML=e[n],s.appendChild(r),a.appendChild(s),w.appendChild(a);var o=z("div",{id:"plyr-settings-".concat(e.id,"-").concat(n),hidden:""}),l=z("button",{type:"button",class:"".concat(t.config.classNames.control," ").concat(t.config.classNames.control,"--back")});l.appendChild(z("span",{"aria-hidden":!0},Ce(n,t.config))),l.appendChild(z("span",{class:t.config.classNames.hidden},Ce("menuBack",t.config))),ue.call(t,o,"keydown",(function(e){37===e.which&&(e.preventDefault(),e.stopPropagation(),c.call(t,"home",!0))}),!1),ue.call(t,l,"click",(function(){c.call(t,"home",!1)})),o.appendChild(l),o.appendChild(z("div",{role:"menu"})),v.appendChild(o),t.elements.settings.buttons[n]=a,t.elements.settings.panels[n]=o})),y.appendChild(v),g.appendChild(y),u.appendChild(g),t.elements.settings.popup=y,t.elements.settings.menu=g}if("pip"===o&&re.pip&&u.appendChild(n.call(t,"pip",d)),"airplay"===o&&re.airplay&&u.appendChild(n.call(t,"airplay",d)),"download"===o){var k=B({},d,{element:"a",href:t.download,target:"_blank"});t.isHTML5&&(k.download="");var T=t.config.urls.download;!q(T)&&t.isEmbed&&B(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,lt.getQualityOptions.call(this)),l.call(this),u},inject:function(){var e=this;if(this.config.loadSprite){var t=ft.getIconUrl.call(this);t.cors&&ut(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},a=!0;M(this.config.controls)&&(this.config.controls=this.config.controls.call(this,n)),this.config.controls||(this.config.controls=[]),I(this.config.controls)||P(this.config.controls)?i=this.config.controls:(i=ft.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:Pe.getLabel.call(this)}),a=!1);var s,r;if(a&&P(this.config.controls)&&(s=i,Object.entries(n).forEach((function(e){var t=o(e,2),i=t[0],n=t[1];s=ve(s,"{".concat(i,"}"),n)})),i=s),P(this.config.selectors.controls.container)&&(r=document.querySelector(this.config.selectors.controls.container)),I(r)||(r=this.elements.container),r[I(i)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",i),I(this.elements.controls)||ft.findElements.call(this),!D(this.elements.buttons)){var l=function(t){var i=e.config.classNames.controlPressed;Object.defineProperty(t,"pressed",{enumerable:!0,get:function(){return Z(t,i)},set:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];G(t,i,e)}})};Object.values(this.elements.buttons).filter(Boolean).forEach((function(e){x(e)||N(e)?Array.from(e).filter(Boolean).forEach(l):l(e)}))}if(R.isEdge&&F(r),this.config.tooltips.controls){var c=this.config,u=c.classNames,d=c.selectors,h="".concat(d.controls.wrapper," ").concat(d.labels," .").concat(u.hidden),p=te.call(this,h);Array.from(p).forEach((function(t){G(t,e.config.classNames.hidden,!1),G(t,e.config.classNames.tooltip,!0)}))}}},gt=function(){function t(i){var n=this;e(this,t),this.player=i,this.prefix=t.prefix,this.property=t.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===i.config.fullscreen.fallback,this.player.elements.fullscreen=i.config.fullscreen.container&&function(e,t){return(Element.prototype.closest||function(){var e=this;do{if(ee.matches(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}).call(e,t)}(this.player.elements.container,i.config.fullscreen.container),ue.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":"".concat(this.prefix,"fullscreenchange"),(function(){n.onChange()})),ue.call(this.player,this.player.elements.container,"dblclick",(function(e){I(n.player.elements.controls)&&n.player.elements.controls.contains(e.target)||n.toggle()})),ue.call(this,this.player.elements.container,"keydown",(function(e){return n.trapFocus(e)})),this.update()}return i(t,[{key:"onChange",value:function(){if(this.enabled){var e=this.player.elements.buttons.fullscreen;I(e)&&(e.pressed=this.active);var t=this.target===this.player.media?this.target:this.player.elements.container;pe.call(this.player,t,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":"",G(this.target,this.player.config.classNames.fullscreen.fallback,e),R.isIos){var t=document.head.querySelector('meta[name="viewport"]'),i="viewport-fit=cover";t||(t=document.createElement("meta")).setAttribute("name","viewport");var n=P(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(!R.isIos&&this.active&&"Tab"===e.key&&9===e.keyCode){var t=document.activeElement,i=te.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),n=o(i,1)[0],a=i[i.length-1];t!==a||e.shiftKey?t===n&&e.shiftKey&&(a.focus(),e.preventDefault()):(n.focus(),e.preventDefault())}}},{key:"update",value:function(){var e;this.enabled?(e=this.forceFallback?"Fallback (forced)":t.native?"Native":"Fallback",this.player.debug.log("".concat(e," fullscreen enabled"))):this.player.debug.log("Fullscreen not supported and fallback disabled");G(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}},{key:"enter",value:function(){this.enabled&&(R.isIos&&this.player.config.fullscreen.iosNative?this.target.webkitEnterFullscreen():!t.native||this.forceFallback?this.toggleFallback(!0):this.prefix?D(this.prefix)||this.target["".concat(this.prefix,"Request").concat(this.property)]():this.target.requestFullscreen({navigationUI:"hide"}))}},{key:"exit",value:function(){if(this.enabled)if(R.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),nt(this.player.play());else if(!t.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!D(this.prefix)){var e="moz"===this.prefix?"Cancel":"Exit";document["".concat(this.prefix).concat(e).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 t.native&&!this.forceFallback}},{key:"enabled",get:function(){return(t.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(!t.native||this.forceFallback)return Z(this.target,this.player.config.classNames.fullscreen.fallback);var e=this.prefix?document["".concat(this.prefix).concat(this.property,"Element")]:document.fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}},{key:"target",get:function(){return R.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(M(document.exitFullscreen))return"";var e="";return["webkit","moz","ms"].some((function(t){return!(!M(document["".concat(t,"ExitFullscreen")])&&!M(document["".concat(t,"CancelFullScreen")]))&&(e=t,!0)})),e}},{key:"property",get:function(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}}]),t}();function yt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise((function(i,n){var a=new Image,s=function(){delete a.onload,delete a.onerror,(a.naturalWidth>=t?i:n)(a)};Object.assign(a,{onload:s,onerror:s,src:e})}))}var vt={addStyleHook:function(){G(this.elements.container,this.config.selectors.container.replace(".",""),!0),G(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 vt.toggleNativeControls.call(this,!0);I(this.elements.controls)||(ft.inject.call(this),this.listeners.controls()),vt.toggleNativeControls.call(this),this.isHTML5&&Pe.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,ft.updateVolume.call(this),ft.timeUpdate.call(this),vt.checkPlaying.call(this),G(this.elements.container,this.config.classNames.pip.supported,re.pip&&this.isHTML5&&this.isVideo),G(this.elements.container,this.config.classNames.airplay.supported,re.airplay&&this.isHTML5),G(this.elements.container,this.config.classNames.isIos,R.isIos),G(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((function(){pe.call(e,e.media,"ready")}),0),vt.setTitle.call(this),this.poster&&vt.setPoster.call(this,this.poster,!1).catch((function(){})),this.config.duration&&ft.durationUpdate.call(this)},setTitle:function(){var e=Ce("play",this.config);if(P(this.config.title)&&!D(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=ie.call(this,"iframe");if(!I(t))return;var i=D(this.config.title)?"video":this.config.title,n=Ce("frameTitle",this.config);t.setAttribute("title",n.replace("{title}",i))}},togglePoster:function(e){G(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),fe.call(this).then((function(){return yt(e)})).catch((function(i){throw e===t.poster&&vt.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:""}),vt.togglePoster.call(t,!0),e})))},checkPlaying:function(e){var t=this;G(this.elements.container,this.config.classNames.playing,this.playing),G(this.elements.container,this.config.classNames.paused,this.paused),G(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",Ce(t.playing?"pause":"play",t.config))})),L(e)&&"timeupdate"===e.type||vt.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(){G(t.elements.container,t.config.classNames.loading,t.loading),vt.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(s({},this.media.style)).filter((function(e){return!D(e)&&e.startsWith("--plyr")})).forEach((function(t){e.elements.container.style.setProperty(t,e.media.style.getPropertyValue(t)),e.media.style.removeProperty(t)})),D(this.media.style)&&this.media.removeAttribute("style")}},bt=function(){function t(i){e(this,t),this.player=i,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 i(t,[{key:"handleKey",value:function(e){var t=this.player,i=t.elements,n=e.keyCode?e.keyCode:e.which,a="keydown"===e.type,s=a&&n===this.lastKey;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&S(n)){if(a){var r=document.activeElement;if(I(r)){var o=t.config.selectors.editable;if(r!==i.inputs.seek&&ee(r,o))return;if(32===e.which&&ee(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:s||(t.currentTime=t.duration/10*(n-48));break;case 32:case 75:s||nt(t.togglePlay());break;case 38:t.increaseVolume(.1);break;case 40:t.decreaseVolume(.1);break;case 77:s||(t.muted=!t.muted);break;case 39:t.forward();break;case 37:t.rewind();break;case 70:t.fullscreen.toggle();break;case 67:s||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){ft.toggleMenu.call(this.player,e)}},{key:"firstTouch",value:function(){var e=this.player,t=e.elements;e.touch=!0,G(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,a=e.timeStamp-this.lastKeyDown<=20;if("focus"!==e.type||a)n=t.config.classNames.tabFocus,G(te.call(t,".".concat(n)),n,!1),"focusout"!==e.type&&(this.focusTimer=setTimeout((function(){var e=document.activeElement;i.container.contains(e)&&G(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&&ce.call(t,window,"keydown keyup",this.handleKey,e,!1),ce.call(t,document.body,"click",this.toggleMenu,e),he.call(t,document.body,"touchstart",this.firstTouch),ce.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&&ue.call(e,i.container,"keydown keyup",this.handleKey,!1),ue.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(function(t){var a=i.controls;a&&"enterfullscreen"===t.type&&(a.pressed=!1,a.hover=!1);var s=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(vt.toggleControls.call(e,!0),s=e.touch?3e3:2e3),clearTimeout(n.controls),n.controls=setTimeout((function(){return vt.toggleControls.call(e,!1)}),s)}));var a=function(t){if(!t)return ot.call(e);var n=i.container.getBoundingClientRect(),a=n.width,s=n.height;return ot.call(e,"".concat(a,":").concat(s))},s=function(){clearTimeout(n.resized),n.resized=setTimeout(a,50)};ue.call(e,i.container,"enterfullscreen exitfullscreen",(function(t){var n=e.fullscreen,r=n.target,l=n.usingNative;if(r===i.container&&(e.isEmbed||!D(e.config.ratio))){var c="enterfullscreen"===t.type,u=a(c);u.padding;!function(t,i,n){if(e.isVimeo&&!e.config.vimeo.premium){var a=e.elements.wrapper.firstChild,s=o(t,2)[1],r=o(rt.call(e),2),l=r[0],c=r[1];a.style.maxWidth=n?"".concat(s/c*l,"px"):null,a.style.margin=n?"0 auto":null}}(u.ratio,0,c),l||(c?ue.call(e,window,"resize",s):de.call(e,window,"resize",s))}}))}},{key:"media",value:function(){var e=this,t=this.player,i=t.elements;if(ue.call(t,t.media,"timeupdate seeking seeked",(function(e){return ft.timeUpdate.call(t,e)})),ue.call(t,t.media,"durationchange loadeddata loadedmetadata",(function(e){return ft.durationUpdate.call(t,e)})),ue.call(t,t.media,"ended",(function(){t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())})),ue.call(t,t.media,"progress playing seeking seeked",(function(e){return ft.updateProgress.call(t,e)})),ue.call(t,t.media,"volumechange",(function(e){return ft.updateVolume.call(t,e)})),ue.call(t,t.media,"playing play pause ended emptied timeupdate",(function(e){return vt.checkPlaying.call(t,e)})),ue.call(t,t.media,"waiting canplay seeked playing",(function(e){return vt.checkLoading.call(t,e)})),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){var n=ie.call(t,".".concat(t.config.classNames.video));if(!I(n))return;ue.call(t,i.container,"click",(function(a){([i.container,n].includes(a.target)||n.contains(a.target))&&(t.touch&&t.config.hideControls||(t.ended?(e.proxy(a,t.restart,"restart"),e.proxy(a,(function(){nt(t.play())}),"play")):e.proxy(a,(function(){nt(t.togglePlay())}),"play")))}))}t.supported.ui&&t.config.disableContextMenu&&ue.call(t,i.wrapper,"contextmenu",(function(e){e.preventDefault()}),!1),ue.call(t,t.media,"volumechange",(function(){t.storage.set({volume:t.volume,muted:t.muted})})),ue.call(t,t.media,"ratechange",(function(){ft.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})})),ue.call(t,t.media,"qualitychange",(function(e){ft.updateSetting.call(t,"quality",null,e.detail.quality)})),ue.call(t,t.media,"ready qualitychange",(function(){ft.setDownloadUrl.call(t)}));var a=t.config.events.concat(["keyup","keydown"]).join(" ");ue.call(t,t.media,a,(function(e){var n=e.detail,a=void 0===n?{}:n;"error"===e.type&&(a=t.media.error),pe.call(t,i.container,e.type,!0,a)}))}},{key:"proxy",value:function(e,t,i){var n=this.player,a=n.config.listeners[i],s=!0;M(a)&&(s=a.call(n,e)),!1!==s&&M(t)&&t.call(n,e)}},{key:"bind",value:function(e,t,i,n){var a=this,s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=this.player,o=r.config.listeners[n],l=M(o);ue.call(r,e,t,(function(e){return a.proxy(e,i,n)}),s&&!l)}},{key:"controls",value:function(){var e=this,t=this.player,i=t.elements,n=R.isIE?"change":"input";if(i.buttons.play&&Array.from(i.buttons.play).forEach((function(i){e.bind(i,"click",(function(){nt(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(){pe.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(),ft.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(),ft.toggleMenu.call(t,e)):ft.focusFirstMenuItem.call(t,null,!0))}),null,!1),this.bind(i.settings.menu,"keydown",(function(e){27===e.which&&ft.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,a="play-on-seeked";if(!j(e)||39===n||37===n){t.lastSeekTime=Date.now();var s=i.hasAttribute(a),r=["mouseup","touchend","keyup"].includes(e.type);s&&r?(i.removeAttribute(a),nt(t.play())):!r&&t.playing&&(i.setAttribute(a,""),t.pause())}})),R.isIos){var a=te.call(t,'input[type="range"]');Array.from(a).forEach((function(t){return e.bind(t,n,(function(e){return F(e.target)}))}))}this.bind(i.inputs.seek,n,(function(e){var i=e.currentTarget,n=i.getAttribute("seek-value");D(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 ft.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)})),R.isWebkit&&Array.from(te.call(t,'input[type="range"]')).forEach((function(i){e.bind(i,"input",(function(e){return ft.updateRangeFill.call(t,e.target)}))})),t.config.toggleInvert&&!I(i.display.duration)&&this.bind(i.display.currentTime,"click",(function(){0!==t.currentTime&&(t.config.invertTime=!t.config.invertTime,ft.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,a=t.timers;G(i.controls,n.classNames.noTransition,!0),vt.toggleControls.call(t,!0),setTimeout((function(){G(i.controls,n.classNames.noTransition,!1)}),0);var s=e.touch?3e3:4e3;clearTimeout(a.controls),a.controls=setTimeout((function(){return vt.toggleControls.call(t,!1)}),s)})),this.bind(i.inputs.volume,"wheel",(function(e){var i=e.webkitDirectionInvertedFromDevice,n=o([e.deltaX,-e.deltaY].map((function(e){return i?-e:e})),2),a=n[0],s=n[1],r=Math.sign(Math.abs(a)>Math.abs(s)?a:s);t.increaseVolume(r/50);var l=t.media.volume;(1===r&&l<1||-1===r&&l>0)&&e.preventDefault()}),"volume",!1)}}]),t}();"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var wt=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){e.exports=function(){var e=function(){},t={},i={},n={};function a(e,t){e=e.push?e:[e];var a,s,r,o=[],l=e.length,c=l;for(a=function(e,i){i.length&&o.push(e),--c||t(o)};l--;)s=e[l],(r=i[s])?a(s,r):(n[s]=n[s]||[]).push(a)}function s(e,t){if(e){var a=n[e];if(i[e]=t,a)for(;a.length;)a[0](e,t),a.splice(0,1)}}function r(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function o(t,i,n,a){var s,r,l=document,c=n.async,u=(n.numRetries||0)+1,d=n.before||e,h=t.replace(/[\?|#].*$/,""),p=t.replace(/^(css|img)!/,"");a=a||0,/(^css!|\.css$)/.test(h)?((r=l.createElement("link")).rel="stylesheet",r.href=p,(s="hideFocus"in r)&&r.relList&&(s=0,r.rel="preload",r.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(h)?(r=l.createElement("img")).src=p:((r=l.createElement("script")).src=t,r.async=void 0===c||c),r.onload=r.onerror=r.onbeforeload=function(e){var l=e.type[0];if(s)try{r.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l){if((a+=1)<u)return o(t,i,n,a)}else if("preload"==r.rel&&"style"==r.as)return r.rel="stylesheet";i(t,l,e.defaultPrevented)},!1!==d(t,r)&&l.head.appendChild(r)}function l(e,t,i){var n,a,s=(e=e.push?e:[e]).length,r=s,l=[];for(n=function(e,i,n){if("e"==i&&l.push(e),"b"==i){if(!n)return;l.push(e)}--s||t(l)},a=0;a<r;a++)o(e[a],n,i)}function c(e,i,n){var a,o;if(i&&i.trim&&(a=i),o=(a?n:i)||{},a){if(a in t)throw"LoadJS";t[a]=!0}function c(t,i){l(e,(function(e){r(o,e),t&&r({success:t,error:i},e),s(a,e)}),o)}if(o.returnPromise)return new Promise(c);c()}return c.ready=function(e,t){return a(e,(function(e){r(t,e)})),c},c.done=function(e){s(e,[])},c.reset=function(){t={},i={},n={}},c.isDefined=function(e){return e in t},c}()}));function kt(e){return new Promise((function(t,i){wt(e,{success:t,error:i})}))}var Tt={setup:function(){var e=this;M(window.dashjs)?Tt.ready.call(this):kt(this.config.urls.dashjs.sdk).then((function(){Tt.ready.call(e)})).catch((function(t){e.debug.warn("dashjs failed to load",t)}))},ready:function(){if(this.isDashjs){var e=this;e.options.speed=e.config.speed.options,D(this.config.ratio)||ot.call(e);var t=window.dashjs.MediaPlayer().create();t.initialize(e.media,this.config.src,!0),window.dash=t}}},Ct={setup:function(){var e=this;M(window.Hls)?Ct.ready.call(this):kt(this.config.urls.hlsjs.sdk).then((function(){Ct.ready.call(e)})).catch((function(t){e.debug.warn("Hlsjs failed to load",t)}))},ready:function(){var e=this,t=this;if(window.Hls.isSupported()){var i=new Hls({maxBufferLength:this.config.buffer.maxBufferLength<30?this.config.buffer.maxBufferLength:10,maxMaxBufferLength:this.config.buffer.maxMaxBufferLength<60?this.config.buffer.maxMaxBufferLength:60});i.on(window.Hls.Events.MANIFEST_PARSED,(function(){var n=i.levels.map((function(e){return e.height}));t.options.quality=[-1].concat(l(n)),t.config.quality.options=n[0]<n[n.length-1]?[-1].concat(l(n.reverse())):[-1].concat(l(n)),t.quality=-1,e.setQualityMenu.call(t,t.options.quality)})),i.on(window.Hls.Events.MEDIA_ATTACHED,(function(){i.loadSource(e.config.src)})),i.detachMedia(),i.attachMedia(t.media),window.hls=i,Object.defineProperty(t.media,"quality",{get:function(){var e=window.hls,t=e.currentLevel,i=e.levels;return i&&i[t]?i[t].height:-1},set:function(e){if(t.config.quality.forced&&M(t.config.quality.onChange))t.config.quality.onChange(e);else if(-1===e)t.debug.log("Set quality to auto"),window.hls.nextLevel=-1;else{t.debug.log("Set quality to manual: ".concat(e,"p"));var i=window.hls.levels.map((function(e){return e.height})).indexOf(e);window.hls.currentLevel=i}pe.call(t,t.media,"qualitychange",!1,{quality:e})}})}else this.provider=Ne.html5,t.media.src=t.config.src}};function At(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,pe.call(this,this.media,e?"play":"pause"))}var St={setup:function(){var e=this;G(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,ot.call(e),A(window.Vimeo)?St.ready.call(e):kt(e.config.urls.vimeo.sdk).then((function(){St.ready.call(e)})).catch((function(t){e.debug.warn("Vimeo SDK (player.js) failed to load",t)}))},ready:function(){var e=this,t=this,i=t.config.vimeo,n=i.premium,a=i.referrerPolicy,l=r(i,["premium","referrerPolicy"]);n&&Object.assign(l,{controls:!1,sidedock:!1});var c=Se(s({loop:t.config.loop.active,autoplay:t.autoplay,muted:t.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},l)),u=t.media.getAttribute("src");D(u)&&(u=t.media.getAttribute(t.config.attributes.embed.id));var d,h=D(d=u)?null:S(Number(d))?d:d.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:d,p=z("iframe"),m=ye(t.config.urls.vimeo.iframe,h,c);p.setAttribute("src",m),p.setAttribute("allowfullscreen",""),p.setAttribute("allow","autoplay,fullscreen,picture-in-picture"),D(a)||p.setAttribute("referrerPolicy",a);var f=t.poster;if(n)p.setAttribute("data-poster",f),t.media=J(p,t.media);else{var g=z("div",{class:t.config.classNames.embedContainer,"data-poster":f});g.appendChild(p),t.media=J(g,t.media)}ge(ye(t.config.urls.vimeo.api,h),"json").then((function(e){if(!D(e)){var i=new URL(e[0].thumbnail_large);i.pathname="".concat(i.pathname.split("_")[0],".jpg"),vt.setPoster.call(t,i.href).catch((function(){}))}})),t.embed=new window.Vimeo.Player(p,{autopause:t.config.autopause,muted:t.muted}),t.media.paused=!0,t.media.currentTime=0,t.supported.ui&&t.embed.disableTextTrack(),t.media.play=function(){return At.call(t,!0),t.embed.play()},t.media.pause=function(){return At.call(t,!1),t.embed.pause()},t.media.stop=function(){t.pause(),t.currentTime=0};var y=t.media.currentTime;Object.defineProperty(t.media,"currentTime",{get:function(){return y},set:function(e){var i=t.embed,n=t.media,a=t.paused,s=t.volume,r=a&&!i.hasPlayed;n.seeking=!0,pe.call(t,n,"seeking"),Promise.resolve(r&&i.setVolume(0)).then((function(){return i.setCurrentTime(e)})).then((function(){return r&&i.pause()})).then((function(){return r&&i.setVolume(s)})).catch((function(){}))}});var v=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:function(){return v},set:function(e){t.embed.setPlaybackRate(e).then((function(){v=e,pe.call(t,t.media,"ratechange")})).catch((function(){t.options.speed=[1]}))}});var b=t.config.volume;Object.defineProperty(t.media,"volume",{get:function(){return b},set:function(e){t.embed.setVolume(e).then((function(){b=e,pe.call(t,t.media,"volumechange")}))}});var w=t.config.muted;Object.defineProperty(t.media,"muted",{get:function(){return w},set:function(e){var i=!!E(e)&&e;t.embed.setVolume(i?0:t.config.volume).then((function(){w=i,pe.call(t,t.media,"volumechange")}))}});var k,T=t.config.loop;Object.defineProperty(t.media,"loop",{get:function(){return T},set:function(e){var i=E(e)?e:t.config.loop.active;t.embed.setLoop(i).then((function(){T=i}))}}),t.embed.getVideoUrl().then((function(e){k=e,ft.setDownloadUrl.call(t)})).catch((function(t){e.debug.warn(t)})),Object.defineProperty(t.media,"currentSrc",{get:function(){return k}}),Object.defineProperty(t.media,"ended",{get:function(){return t.currentTime===t.duration}}),Promise.all([t.embed.getVideoWidth(),t.embed.getVideoHeight()]).then((function(i){var n=o(i,2),a=n[0],s=n[1];t.embed.ratio=[a,s],ot.call(e)})),t.embed.setAutopause(t.config.autopause).then((function(e){t.config.autopause=e})),t.embed.getVideoTitle().then((function(i){t.config.title=i,vt.setTitle.call(e)})),t.embed.getCurrentTime().then((function(e){y=e,pe.call(t,t.media,"timeupdate")})),t.embed.getDuration().then((function(e){t.media.duration=e,pe.call(t,t.media,"durationchange")})),t.embed.getTextTracks().then((function(e){t.media.textTracks=e,Pe.setup.call(t)})),t.embed.on("cuechange",(function(e){var i=e.cues,n=(void 0===i?[]:i).map((function(e){return function(e){var t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.innerText}(e.text)}));Pe.updateCues.call(t,n)})),t.embed.on("loaded",(function(){(t.embed.getPaused().then((function(e){At.call(t,!e),e||pe.call(t,t.media,"playing")})),I(t.embed.element)&&t.supported.ui)&&t.embed.element.setAttribute("tabindex",-1)})),t.embed.on("bufferstart",(function(){pe.call(t,t.media,"waiting")})),t.embed.on("bufferend",(function(){pe.call(t,t.media,"playing")})),t.embed.on("play",(function(){At.call(t,!0),pe.call(t,t.media,"playing")})),t.embed.on("pause",(function(){At.call(t,!1)})),t.embed.on("timeupdate",(function(e){t.media.seeking=!1,y=e.seconds,pe.call(t,t.media,"timeupdate")})),t.embed.on("progress",(function(e){t.media.buffered=e.percent,pe.call(t,t.media,"progress"),1===parseInt(e.percent,10)&&pe.call(t,t.media,"canplaythrough"),t.embed.getDuration().then((function(e){e!==t.media.duration&&(t.media.duration=e,pe.call(t,t.media,"durationchange"))}))})),t.embed.on("seeked",(function(){t.media.seeking=!1,pe.call(t,t.media,"seeked")})),t.embed.on("ended",(function(){t.media.paused=!0,pe.call(t,t.media,"ended")})),t.embed.on("error",(function(e){t.media.error=e,pe.call(t,t.media,"error")})),setTimeout((function(){return vt.build.call(t)}),0)}};function Pt(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,pe.call(this,this.media,e?"play":"pause"))}function Et(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}var Mt={setup:function(){var e=this;if(G(this.elements.wrapper,this.config.classNames.embed,!0),A(window.YT)&&M(window.YT.Player))Mt.ready.call(this);else{var t=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=function(){M(t)&&t(),Mt.ready.call(e)},kt(this.config.urls.youtube.sdk).catch((function(t){e.debug.warn("YouTube API failed to load",t)}))}},getTitle:function(e){var t=this;ge(ye(this.config.urls.youtube.api,e)).then((function(e){if(A(e)){var i=e.title,n=e.height,a=e.width;t.config.title=i,vt.setTitle.call(t),t.embed.ratio=[a,n]}ot.call(t)})).catch((function(){ot.call(t)}))},ready:function(){var e=this,t=e.media&&e.media.getAttribute("id");if(D(t)||!t.startsWith("youtube-")){var i=e.media.getAttribute("src");D(i)&&(i=e.media.getAttribute(this.config.attributes.embed.id));var n,a,s=D(n=i)?null:n.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:n,r=(a=e.provider,"".concat(a,"-").concat(Math.floor(1e4*Math.random()))),o=z("div",{id:r,"data-poster":e.poster});e.media=J(o,e.media);var l=function(e){return"https://i.ytimg.com/vi/".concat(s,"/").concat(e,"default.jpg")};yt(l("maxres"),121).catch((function(){return yt(l("sd"),121)})).catch((function(){return yt(l("hq"))})).then((function(t){return vt.setPoster.call(e,t.src)})).then((function(t){t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")})).catch((function(){}));var c=e.config.youtube;e.embed=new window.YT.Player(r,{videoId:s,host:Et(c),playerVars:B({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui?0:1,disablekb:1,playsinline:e.config.fullscreen.iosNative?0:1,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},c),events:{onError:function(t){if(!e.media.error){var i=t.data,n={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[i]||"An unknown error occured";e.media.error={code:i,message:n},pe.call(e,e.media,"error")}},onPlaybackRateChange:function(t){var i=t.target;e.media.playbackRate=i.getPlaybackRate(),pe.call(e,e.media,"ratechange")},onReady:function(t){if(!M(e.media.play)){var i=t.target;Mt.getTitle.call(e,s),e.media.play=function(){Pt.call(e,!0),i.playVideo()},e.media.pause=function(){Pt.call(e,!1),i.pauseVideo()},e.media.stop=function(){i.stopVideo()},e.media.duration=i.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:function(){return Number(i.getCurrentTime())},set:function(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,pe.call(e,e.media,"seeking"),i.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:function(){return i.getPlaybackRate()},set:function(e){i.setPlaybackRate(e)}});var n=e.config.volume;Object.defineProperty(e.media,"volume",{get:function(){return n},set:function(t){n=t,i.setVolume(100*n),pe.call(e,e.media,"volumechange")}});var a=e.config.muted;Object.defineProperty(e.media,"muted",{get:function(){return a},set:function(t){var n=E(t)?t:a;a=n,i[n?"mute":"unMute"](),pe.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:function(){return i.getVideoUrl()}}),Object.defineProperty(e.media,"ended",{get:function(){return e.currentTime===e.duration}});var r=i.getAvailablePlaybackRates();e.options.speed=r.filter((function(t){return e.config.speed.options.includes(t)})),e.supported.ui&&e.media.setAttribute("tabindex",-1),pe.call(e,e.media,"timeupdate"),pe.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval((function(){e.media.buffered=i.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&pe.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),pe.call(e,e.media,"canplaythrough"))}),200),setTimeout((function(){return vt.build.call(e)}),50)}},onStateChange:function(t){var i=t.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(t.data)&&(e.media.seeking=!1,pe.call(e,e.media,"seeked")),t.data){case-1:pe.call(e,e.media,"timeupdate"),e.media.buffered=i.getVideoLoadedFraction(),pe.call(e,e.media,"progress");break;case 0:Pt.call(e,!1),e.media.loop?(i.stopVideo(),i.playVideo()):pe.call(e,e.media,"ended");break;case 1:e.config.autoplay||!e.media.paused||e.embed.hasPlayed?(Pt.call(e,!0),pe.call(e,e.media,"playing"),e.timers.playing=setInterval((function(){pe.call(e,e.media,"timeupdate")}),50),e.media.duration!==i.getDuration()&&(e.media.duration=i.getDuration(),pe.call(e,e.media,"durationchange"))):e.media.pause();break;case 2:e.muted||e.embed.unMute(),Pt.call(e,!1);break;case 3:pe.call(e,e.media,"waiting")}pe.call(e,e.elements.container,"statechange",!1,{code:t.data})}}})}}},xt={setup:function(){this.media?(G(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),G(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&G(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=z("div",{class:this.config.classNames.video}),U(this.media,this.elements.wrapper),this.elements.poster=z("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHlsjs?Ct.setup.call(this):this.isDashjs?Tt.setup.call(this):this.isYouTube?Mt.setup.call(this):this.isVimeo?St.setup.call(this):this.isHTML5&&lt.setup.call(this)):this.debug.warn("No media element found!")}},Nt=function(){function t(i){var n=this;e(this,t),this.player=i,this.config=i.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((function(e,t){n.on("loaded",e),n.on("error",t)})),this.load()}return i(t,[{key:"load",value:function(){var e=this;this.enabled&&(A(window.google)&&A(window.google.ima)?this.ready():kt(this.player.config.urls.googleIMA.sdk).then((function(){e.ready()})).catch((function(){e.trigger("error",new Error("Google IMA SDK failed to load"))})))}},{key:"ready",value:function(){var e,t=this;this.enabled||((e=this).manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then((function(){t.clearSafetyTimer("onAdsManagerLoaded()")})),this.listeners(),this.setupIMA()}},{key:"setupIMA",value:function(){var e=this;this.elements.container=z("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(function(t){return e.onAdsManagerLoaded(t)}),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(t){return e.onAdError(t)}),!1),this.requestAds()}},{key:"requestAds",value:function(){var e=this.player.elements.container;try{var t=new google.ima.AdsRequest;t.adTagUrl=this.tagUrl,t.linearAdSlotWidth=e.offsetWidth,t.linearAdSlotHeight=e.offsetHeight,t.nonLinearAdSlotWidth=e.offsetWidth,t.nonLinearAdSlotHeight=e.offsetHeight,t.forceNonLinearFullSlot=!1,t.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(t)}catch(e){this.onAdError(e)}}},{key:"pollCountdown",value:function(){var e=this,t=arguments.length>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=mt(Math.max(e.manager.getRemainingTime(),0)),i="".concat(Ce("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;D(this.cuePoints)||this.cuePoints.forEach((function(t){if(0!==t&&-1!==t&&t<e.player.duration){var i=e.player.elements.progress;if(I(i)){var n=100/e.player.duration*t,a=z("span",{class:e.player.config.classNames.cues});a.style.left="".concat(n.toString(),"%"),i.appendChild(a)}}}))}},{key:"onAdEvent",value:function(e){var t=this,i=this.player.elements.container,n=e.getAd(),a=e.getAdData();switch(function(e){pe.call(t.player,t.player.media,"ads".concat(e.replace(/_/g,"").toLowerCase()))}(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),n.isLinear()||(n.width=i.offsetWidth,n.height=i.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:a.adError&&this.player.debug.warn("Non-fatal ad error: ".concat(a.adError.getMessage()))}}},{key:"onAdError",value:function(e){this.cancel(),this.player.debug.warn("Ads error",e)}},{key:"listeners",value:function(){var e,t=this,i=this.player.elements.container;this.player.on("canplay",(function(){t.addCuePoints()})),this.player.on("ended",(function(){t.loader.contentComplete()})),this.player.on("timeupdate",(function(){e=t.player.currentTime})),this.player.on("seeked",(function(){var i=t.player.currentTime;D(t.cuePoints)||t.cuePoints.forEach((function(n,a){e<n&&n<i&&(t.manager.discardAdBreak(),t.cuePoints.splice(a,1))}))})),window.addEventListener("resize",(function(){t.manager&&t.manager.resize(i.offsetWidth,i.offsetHeight,google.ima.ViewMode.NORMAL)}))}},{key:"play",value:function(){var e=this,t=this.player.elements.container;this.managerPromise||this.resumeContent(),this.managerPromise.then((function(){e.manager.setVolume(e.player.volume),e.elements.displayContainer.initialize();try{e.initialized||(e.manager.init(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),e.manager.start()),e.initialized=!0}catch(t){e.onAdError(t)}})).catch((function(){}))}},{key:"resumeContent",value:function(){this.elements.container.style.zIndex="",this.playing=!1,nt(this.player.media.play())}},{key:"pauseContent",value:function(){this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}},{key:"cancel",value:function(){this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}},{key:"loadAds",value:function(){var e=this;this.managerPromise.then((function(){e.manager&&e.manager.destroy(),e.managerPromise=new Promise((function(t){e.on("loaded",t),e.player.debug.log(e.manager)})),e.initialized=!1,e.requestAds()})).catch((function(){}))}},{key:"trigger",value:function(e){for(var t=this,i=arguments.length,n=new Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];var s=this.events[e];x(s)&&s.forEach((function(e){M(e)&&e.apply(t,n)}))}},{key:"on",value:function(e,t){return x(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this}},{key:"startSafetyTimer",value:function(e,t){var i=this;this.player.debug.log("Safety timer invoked from: ".concat(t)),this.safetyTimer=setTimeout((function(){i.cancel(),i.clearSafetyTimer("startSafetyTimer()")}),e)}},{key:"clearSafetyTimer",value:function(e){C(this.safetyTimer)||(this.player.debug.log("Safety timer cleared from: ".concat(e)),clearTimeout(this.safetyTimer),this.safetyTimer=null)}},{key:"enabled",get:function(){var e=this.config;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!D(e.publisherId)||q(e.tagUrl))}},{key:"tagUrl",get:function(){var e=this.config;if(q(e.tagUrl))return e.tagUrl;var t={AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId};return"".concat("https://go.aniview.com/api/adserver6/vast/","?").concat(Se(t))}}]),t}(),It={setup:function(){It.ready.call(this)},ready:function(){var e=this,t=this;if(t.setState({api_embed:this.config.api_embed}),t.config.sharing)try{var i={method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({url:this.config.src})};fetch("".concat(this.states.api_embed,"/link"),i).then((function(e){return e.json()})).then((function(i){var n="".concat(e.states.api_embed,"/").concat(i.code);t.setState({shareLink:n,embed:'<iframe width="1280" height="720" src="'.concat(n,'" frameborder="0" allow="accelerometer; autoplay; encrypted-media; picture-in-picture" allowfullscreen></iframe>')})}))}catch(e){this.debug.log(e)}}},Lt=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},jt=function(){function t(i){e(this,t),this.player=i,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}return i(t,[{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(D(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(M(i))i((function(t){e.thumbnails=t,n()}));else{var a=(P(i)?[i]:i).map((function(t){return e.getThumbnail(t)}));Promise.all(a).then(n)}}))}},{key:"getThumbnail",value:function(e){var t=this;return new Promise((function(i){ge(e).then((function(n){var a,s,r={frames:(a=n,s=[],a.split(/\r\n\r\n|\n\n|\r\r/).forEach((function(e){var t={};e.split(/\r\n|\n|\r/).forEach((function(e){if(S(t.startTime)){if(!D(e.trim())&&D(t.text)){var i=e.trim().split("#xywh="),n=o(i,1);if(t.text=n[0],i[1]){var a=o(i[1].split(","),4);t.x=a[0],t.y=a[1],t.w=a[2],t.h=a[3]}}}else{var s=e.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);s&&(t.startTime=60*Number(s[1]||0)*60+60*Number(s[2])+Number(s[3])+Number("0.".concat(s[4])),t.endTime=60*Number(s[6]||0)*60+60*Number(s[7])+Number(s[8])+Number("0.".concat(s[9])))}})),t.text&&s.push(t)})),s),height:null,urlPrefix:""};r.frames[0].text.startsWith("/")||r.frames[0].text.startsWith("http://")||r.frames[0].text.startsWith("https://")||(r.urlPrefix=e.substring(0,e.lastIndexOf("/")+1));var l=new Image;l.onload=function(){r.height=l.naturalHeight,r.width=l.naturalWidth,t.thumbnails.push(r),i()},l.src=r.urlPrefix+r.frames[0].text}))}))}},{key:"startMove",value:function(e){if(this.loaded&&L(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=mt(this.seekTime)}this.showImageAtCurrentTime()}}},{key:"endMove",value:function(){this.toggleThumbContainer(!1,!0)}},{key:"startScrubbing",value:function(e){(C(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):he.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=z("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=z("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);var e=z("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=z("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.container.appendChild(e),I(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=z("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,a){e.loadedImages.includes(i.frames[t].text)&&(n=a)})),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],a=n.urlPrefix,s=n.frames[i],r=n.frames[i].text,o=a+r;if(this.currentImageElement&&this.currentImageElement.dataset.filename===r)this.showImage(this.currentImageElement,s,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,s,t,i,r,!0)},this.loadingImage=l,this.removeOldImages(l)}}},{key:"showImage",value:function(e,t,i,n,a){var s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];this.player.debug.log("Showing thumb: ".concat(a,". num: ").concat(n,". qual: ").concat(i,". newimg: ").concat(s)),this.setImageSizeAndOffset(e,t),s&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(a)||this.loadedImages.push(a)),this.preloadNearby(n,!0).then(this.preloadNearby(n,!1)).then(this.getHigherQuality(i,e,t,a))}},{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 a=t.currentImageContainer;setTimeout((function(){a.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 a=t.thumbnails[0].frames[e].text;if(t.showingThumbFilename===a){var s;s=i?t.thumbnails[0].frames.slice(e):t.thumbnails[0].frames.slice(0,e).reverse();var r=!1;s.forEach((function(e){var i=e.text;if(i!==a&&!t.loadedImages.includes(i)){r=!0,t.player.debug.log("Preloading thumb filename: ".concat(i));var s=t.thumbnails[0].urlPrefix+i,o=new Image;o.src=s,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 a=this;if(e<this.thumbnails.length-1){var s=t.naturalHeight;this.usingSprites&&(s=i.h),s<this.thumbContainerHeight&&setTimeout((function(){a.showingThumbFilename===n&&(a.player.debug.log("Showing higher quality thumb for: ".concat(n)),a.loadImage(e+1))}),300)}}},{key:"toggleThumbContainer",value:function(){var e=arguments.length>0&&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,a=t.right-e.left-i.clientWidth-10,s=this.mousePosX-e.left-i.clientWidth/2;s<n&&(s=n),s>a&&(s=a),i.style.left="".concat(s,"px")}},{key:"setScrubbingContainerSize",value:function(){var e=Lt(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?Lt(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}}]),t}(),Ot={insertElements:function(e,t){var i=this;P(t)?K(e,this.media,{src:t}):x(t)&&t.forEach((function(t){K(e,i.media,t)}))},change:function(e){var t=this;V(e,"sources.length")?(lt.cancelRequests.call(this),this.destroy.call(this,(function(){t.options.quality=[],Y(t.media),t.media=null,I(t.elements.container)&&t.elements.container.removeAttribute("class");var i=e.sources,n=e.type,a=o(i,1)[0],s=a.provider,r=void 0===s?Ne.html5:s,l=a.src,c="html5"===r?n:"div",u="html5"===r?{}:{src:l};Object.assign(t,{provider:r,type:n,supported:re.check(n,r,t.config.playsinline),media:z(c,u)}),t.elements.container.appendChild(t.media),E(e.autoplay)&&(t.config.autoplay=e.autoplay),t.isHTML5&&(t.config.crossorigin&&t.media.setAttribute("crossorigin",""),t.config.autoplay&&t.media.setAttribute("autoplay",""),D(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","")),vt.addStyleHook.call(t),t.isHTML5&&Ot.insertElements.call(t,"source",i),t.config.title=e.title,xt.setup.call(t),t.isHTML5&&Object.keys(e).includes("tracks")&&Ot.insertElements.call(t,"track",e.tracks),(t.isHTML5||t.isEmbed&&!t.supported.ui)&&vt.build.call(t),t.isHTML5&&t.media.load(),D(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 jt(t))),t.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};var _t,qt=function(){function t(i,n){var a=this;if(e(this,t),this.timers={},this.states={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=re.touch,this.media=i,P(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||N(this.media)||x(this.media))&&(this.media=this.media[0]),this.config=B({},Ee,t.defaults,n||{},function(){try{return JSON.parse(a.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 _e(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",re),!C(this.media)&&I(this.media))if(this.media.plyr)this.debug.warn("Target already setup");else if(this.config.enabled)if(re.check().api){var s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;var r=this.media.tagName.toLowerCase(),o=null,l=null;switch(r){case"div":if(o=this.media.querySelector("iframe"),I(o)){if(l=Ae(o.getAttribute("src")),this.provider=je(l.toString()),this.elements.container=this.media,this.media=o,this.elements.container.className="",l.search.length){var c=["1","true"];c.includes(l.searchParams.get("autoplay"))&&(this.config.autoplay=!0),c.includes(l.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=c.includes(l.searchParams.get("playsinline")),this.config.youtube.hl=l.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(D(this.provider)||!Object.keys(Ne).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=Le;break;case"video":case"audio":this.type=r,this.provider=je(this.config.src)||Ne.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=re.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new bt(this),this.storage=new ct(this),this.media.plyr=this,this.setQualityMenu=ft.setQualityMenu,this.setCaptionsMenu=ft.setCaptionsMenu,this.updateSetting=ft.updateSetting,I(this.elements.container)||(this.elements.container=z("div",{tabindex:0}),U(this.media,this.elements.container)),vt.migrateStyles.call(this),vt.addStyleHook.call(this),xt.setup.call(this),this.config.debug&&ue.call(this,this.elements.container,this.config.events.join(" "),(function(e){a.debug.log("event: ".concat(e.type))})),this.fullscreen=new gt(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&vt.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Nt(this)),this.isHTML5&&this.config.autoplay&&setTimeout((function(){return nt(a.play())}),10),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new jt(this)),this.config.sharing&&It.setup.call(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 i(t,[{key:"setState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B(this.states,e)}},{key:"play",value:function(){var e=this;return M(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((function(){return e.ads.play()})).catch((function(){return nt(e.media.play())})),this.media.play()):null}},{key:"pause",value:function(){return this.playing&&M(this.media.pause)?this.media.pause():null}},{key:"togglePlay",value:function(e){return(E(e)?e:!this.playing)?this.play():this.pause()}},{key:"stop",value:function(){this.isHTML5?(this.pause(),this.restart()):M(this.media.stop)&&this.media.stop()}},{key:"restart",value:function(){this.currentTime=0}},{key:"rewind",value:function(e){this.currentTime-=S(e)?e:this.config.seekTime}},{key:"forward",value:function(e){this.currentTime+=S(e)?e:this.config.seekTime}},{key:"increaseVolume",value:function(e){var t=this.media.muted?0:this.volume;this.volume=t+(S(e)?e:0)}},{key:"decreaseVolume",value:function(e){this.increaseVolume(-e)}},{key:"toggleCaptions",value:function(e){Pe.toggle.call(this,e,!1)}},{key:"airplay",value:function(){re.airplay&&this.media.webkitShowPlaybackTargetPicker()}},{key:"toggleControls",value:function(e){if(this.supported.ui&&!this.isAudio){var t=Z(this.elements.container,this.config.classNames.hideControls),i=void 0===e?void 0:!e,n=G(this.elements.container,this.config.classNames.hideControls,i);if(n&&x(this.config.controls)&&this.config.controls.includes("settings")&&!D(this.config.settings)&&ft.toggleMenu.call(this,!1),n!==t){var a=n?"controlshidden":"controlsshown";pe.call(this,this.media,a)}return!n}return!1}},{key:"on",value:function(e,t){ue.call(this,this.elements.container,e,t)}},{key:"once",value:function(e,t){he.call(this,this.elements.container,e,t)}},{key:"off",value:function(e,t){de(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&&(Y(t.elements.buttons.play),Y(t.elements.captions),Y(t.elements.controls),Y(t.elements.wrapper),t.elements.buttons.play=null,t.elements.captions=null,t.elements.controls=null,t.elements.wrapper=null),M(e)&&e()):(me.call(t),J(t.elements.original,t.elements.container),pe.call(t,t.elements.original,"destroyed",!0),M(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?(vt.toggleNativeControls.call(this,!0),n()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&M(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 re.mime.call(this,e)}},{key:"isHTML5",get:function(){return this.provider===Ne.html5||Ne.hlsjs||Ne.dashjs}},{key:"isHlsjs",get:function(){return this.provider===Ne.hlsjs}},{key:"isDashjs",get:function(){return this.provider===Ne.dashjs}},{key:"isEmbed",get:function(){return this.isYouTube||this.isVimeo}},{key:"isYouTube",get:function(){return this.provider===Ne.youtube}},{key:"isVimeo",get:function(){return this.provider===Ne.vimeo}},{key:"isVideo",get:function(){return this.type===Le}},{key:"isAudio",get:function(){return this.type===Ie}},{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=S(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 S(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=S(t)&&t!==1/0?t:0;return e||i}},{key:"volume",set:function(e){var t=e;P(t)&&(t=Number(t)),S(t)||(t=this.storage.get("volume")),S(t)||(t=this.config.volume),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!D(e)&&this.muted&&t>0&&(this.muted=!1)},get:function(){return Number(this.media.volume)}},{key:"muted",set:function(e){var t=e;E(t)||(t=this.storage.get("muted")),E(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;S(e)&&(i=e),S(i)||(i=this.storage.get("speed")),S(i)||(i=this.config.speed.selected);var n=this.minimumSpeed,a=this.maximumSpeed;i=function(){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)}(i,n,a),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,l(this.options.speed)):this.isVimeo?.5:.0625}},{key:"maximumSpeed",get:function(){return this.isYouTube?Math.max.apply(Math,l(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=[!D(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(S),a=!0;if(!i.includes(n)){var s=function(e,t){return x(e)&&e.length?e.reduce((function(e,i){return Math.abs(i-t)<Math.abs(e-t)?i:e})):null}(i,n);this.debug.warn("Unsupported quality option: ".concat(n,", using ").concat(s," instead")),n=s,a=!1}t.selected=n,this.media.quality=n,a&&this.storage.set({quality:n})}},get:function(){return this.media.quality}},{key:"loop",set:function(e){var t=E(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){Ot.change.call(this,e)},get:function(){return this.media.currentSrc}},{key:"download",get:function(){var e=this.config.urls.download;return q(e)?e:this.source},set:function(e){q(e)&&(this.config.urls.download=e,ft.setDownloadUrl.call(this))}},{key:"poster",set:function(e){this.isVideo?vt.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=st(rt.call(this));return x(e)?e.join(":"):e},set:function(e){this.isVideo?P(e)&&at(e)?(this.config.ratio=e,ot.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=E(e)?e:this.config.autoplay;this.config.autoplay=t},get:function(){return Boolean(this.config.autoplay)}},{key:"currentTrack",set:function(e){Pe.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){Pe.setLanguage.call(this,e,!1)},get:function(){return(Pe.getCurrentTrack.call(this)||{}).language}},{key:"pip",set:function(e){if(re.pip){var t=E(e)?e:!this.pip;M(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?Me:xe),M(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}},get:function(){return re.pip?D(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===Me:null}}],[{key:"supported",value:function(e,t,i){return re.check(e,t,i)}},{key:"loadSprite",value:function(e,t){return ut(e,t)}},{key:"setup",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null;return P(e)?n=Array.from(document.querySelectorAll(e)):N(e)?n=Array.from(e):x(e)&&(n=e.filter(I)),D(n)?null:n.map((function(e){return new t(e,i)}))}}]),t}();return qt.defaults=(_t=Ee,JSON.parse(JSON.stringify(_t))),qt}));
1
+ "object"==typeof navigator&&function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Plyr",t):(e="undefined"!=typeof globalThis?globalThis:e||self).Plyr=t()}(this,function(){"use strict";const e=e=>null!=e?e.constructor:null,t=(e,t)=>Boolean(e&&t&&e instanceof t),i=e=>null==e,s=t=>e(t)===Object,n=t=>e(t)===String,a=t=>e(t)===Function,l=e=>Array.isArray(e),o=e=>t(e,NodeList),r=e=>i(e)||(n(e)||l(e)||o(e))&&!e.length||s(e)&&!Object.keys(e).length;var c=i,h=s,u=t=>e(t)===Number&&!Number.isNaN(t),d=n,m=t=>e(t)===Boolean,p=a,g=l,f=o,y=e=>t(e,Element),b=e=>t(e,Event),v=e=>t(e,KeyboardEvent),w=e=>t(e,TextTrack)||!i(e)&&n(e.kind),T=e=>t(e,Promise)&&a(e.then),k=e=>{if(t(e,window.URL))return!0;if(!n(e))return!1;let i=e;e.startsWith("http://")&&e.startsWith("https://")||(i=`http://${e}`);try{return!r(new URL(i).hostname)}catch(e){return!1}},C=r;const A=(()=>{const e=document.createElement("span"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(t).find(t=>void 0!==e.style[t]);return!!d(i)&&t[i]})();function S(e,t){setTimeout(()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}},t)}const E={isIE:/* @cc_on!@ */!!document.documentMode,isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:/(iPad|iPhone|iPod)/gi.test(navigator.platform)};function P(e,t){return t.split(".").reduce((e,t)=>e&&e[t],e)}function M(e={},...t){if(!t.length)return e;const i=t.shift();return h(i)?(Object.keys(i).forEach(t=>{h(i[t])?(Object.keys(e).includes(t)||Object.assign(e,{[t]:{}}),M(e[t],i[t])):Object.assign(e,{[t]:i[t]})}),M(e,...t)):e}function x(e,t){const i=e.length?e:[e];Array.from(i).reverse().forEach((e,i)=>{const s=i>0?t.cloneNode(!0):t,n=e.parentNode,a=e.nextSibling;s.appendChild(e),a?n.insertBefore(s,a):n.appendChild(s)})}function N(e,t){y(e)&&!C(t)&&Object.entries(t).filter(([,e])=>!c(e)).forEach(([t,i])=>e.setAttribute(t,i))}function I(e,t,i){const s=document.createElement(e);return h(t)&&N(s,t),d(i)&&(s.innerText=i),s}function L(e,t,i,s){y(t)&&t.appendChild(I(e,i,s))}function $(e){f(e)||g(e)?Array.from(e).forEach($):y(e)&&y(e.parentNode)&&e.parentNode.removeChild(e)}function _(e){if(!y(e))return;let{length:t}=e.childNodes;for(;t>0;)e.removeChild(e.lastChild),t-=1}function j(e,t){return y(t)&&y(t.parentNode)&&y(e)?(t.parentNode.replaceChild(e,t),e):null}function O(e,t){if(!d(e)||C(e))return{};const i={},s=M({},t);return e.split(",").forEach(e=>{const t=e.trim(),n=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),[l]=a,o=a.length>1?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":d(s.class)?i.class=`${s.class} ${n}`:i.class=n;break;case"#":i.id=t.replace("#","");break;case"[":i[l]=o}}),M(s,i)}function q(e,t){if(!y(e))return;let i=t;m(i)||(i=!e.hidden),e.hidden=i}function H(e,t,i){if(f(e))return Array.from(e).map(e=>H(e,t,i));if(y(e)){let s="toggle";return void 0!==i&&(s=i?"add":"remove"),e.classList[s](t),e.classList.contains(t)}return!1}function D(e,t){return y(e)&&e.classList.contains(t)}function F(e,t){const{prototype:i}=Element;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function R(e){return this.elements.container.querySelectorAll(e)}function V(e){return this.elements.container.querySelector(e)}function B(e=null,t=!1){y(e)&&(e.focus({preventScroll:!0}),t&&H(e,this.config.classNames.tabFocus))}const U={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},W={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,t,i){const s=E.isIPhone&&i&&W.playsinline,n=W[e]||"html5"!==t;return{api:n,ui:n&&W.rangeInput&&("video"!==e||!E.isIPhone||s)}},pip:!(E.isIPhone||!p(I("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||I("video").disablePictureInPicture)),airplay:p(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(C(e))return!1;const[t]=e.split("/");let i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(U).includes(i)&&(i+=`; codecs="${U[e]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const e=document.createElement("input");return e.type="range","range"===e.type})(),touch:"ontouchstart"in document.documentElement,transitions:!1!==A,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches};function z(e){return g(e)?e.filter((t,i)=>e.indexOf(t)===i):e}const K=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,null)});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e})();function Y(e,t,i,s=!1,n=!0,a=!1){if(!e||!("addEventListener"in e)||C(t)||!p(i))return;const l=t.split(" ");let o=a;K&&(o={passive:n,capture:a}),l.forEach(t=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:e,type:t,callback:i,options:o}),e[s?"addEventListener":"removeEventListener"](t,i,o)})}function Q(e,t="",i,s=!0,n=!1){Y.call(this,e,t,i,!0,s,n)}function J(e,t="",i,s=!0,n=!1){Y.call(this,e,t,i,!1,s,n)}function X(e,t="",i,s=!0,n=!1){const a=(...l)=>{J(e,t,a,s,n),i.apply(this,l)};Y.call(this,e,t,a,!0,s,n)}function G(e,t="",i=!1,s={}){if(!y(e)||C(t))return;const n=new CustomEvent(t,{bubbles:i,detail:{...s,plyr:this}});e.dispatchEvent(n)}function Z(){this&&this.eventListeners&&(this.eventListeners.forEach(e=>{const{element:t,type:i,callback:s,options:n}=e;t.removeEventListener(i,s,n)}),this.eventListeners=[])}function ee(){return new Promise(e=>this.ready?setTimeout(e,0):Q.call(this,this.elements.container,"ready",e)).then(()=>{})}function te(e,t="text"){return new Promise((i,s)=>{try{const s=new XMLHttpRequest;if(!("withCredentials"in s))return;s.addEventListener("load",()=>{if("text"===t)try{i(JSON.parse(s.responseText))}catch(e){i(s.responseText)}else i(s.response)}),s.addEventListener("error",()=>{throw new Error(s.status)}),s.open("GET",e,!0),s.responseType=t,s.send()}catch(e){s(e)}})}function ie(e,...t){return C(e)?e:e.toString().replace(/{(\d+)}/g,(e,i)=>t[i].toString())}const se=(e="",t="",i="")=>e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString()),ne=(e="")=>e.toString().replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase());function ae(e=""){let t=e.toString();return t=function(e=""){let t=e.toString();return t=se(t,"-"," "),t=se(t,"_"," "),t=ne(t),se(t," ","")}(t),t.charAt(0).toLowerCase()+t.slice(1)}function le(e){const t=document.createElement("div");return t.appendChild(e),t.innerHTML}const oe={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},re={get(e="",t={}){if(C(e)||C(t))return"";let i=P(t.i18n,e);if(C(i))return Object.keys(oe).includes(e)?oe[e]:"";const s={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(s).forEach(([e,t])=>{i=se(i,e,t)}),i}};function ce(e,t=!0){let i=e;if(t){const e=document.createElement("a");e.href=i,i=e.href}try{return new URL(i)}catch(e){return null}}function he(e){const t=new URLSearchParams;return h(e)&&Object.entries(e).forEach(([e,i])=>{t.set(e,i)}),t}const ue={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!W.textTracks)return void(g(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&this.setCaptionsMenu.call(this));var e,t;if(y(this.elements.captions)||(this.elements.captions=I("div",O(this.config.selectors.captions)),e=this.elements.captions,t=this.elements.wrapper,y(e)&&y(t)&&t.parentNode.insertBefore(e,t.nextSibling)),E.isIE&&window.URL){const e=this.media.querySelectorAll("track");Array.from(e).forEach(e=>{const t=e.getAttribute("src"),i=ce(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&te(t,"blob").then(t=>{e.setAttribute("src",window.URL.createObjectURL(t))}).catch(()=>{$(e)})})}const i=z((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map(e=>e.split("-")[0]));let s=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();"auto"===s&&([s]=i);let n=this.storage.get("captions");if(m(n)||({active:n}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:n,language:s,languages:i}),this.isHTML5){const e=this.config.captions.update?"addtrack removetrack":"removetrack";Q.call(this,this.media.textTracks,e,ue.update.bind(this))}setTimeout(ue.update.bind(this),0)},update(){const e=ue.getTracks.call(this,!0),{active:t,language:i,meta:s,currentTrackNode:n}=this.captions,a=Boolean(e.find(e=>e.language===i));this.isHTML5&&this.isVideo&&e.filter(e=>!s.get(e)).forEach(e=>{this.debug.log("Track added",e),s.set(e,{default:"showing"===e.mode}),"showing"===e.mode&&(e.mode="hidden"),Q.call(this,e,"cuechange",()=>ue.updateCues.call(this))}),(a&&this.language!==i||!e.includes(n))&&(ue.setLanguage.call(this,i),ue.toggle.call(this,t&&a)),H(this.elements.container,this.config.classNames.captions.enabled,!C(e)),g(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&this.setCaptionsMenu.call(this)},toggle(e,t=!0){if(!this.supported.ui)return;const{toggled:i}=this.captions,s=this.config.classNames.captions.active,n=c(e)?!i:e;if(n!==i){if(t||(this.captions.active=n,this.storage.set({captions:n})),!this.language&&n&&!t){const e=ue.getTracks.call(this),t=ue.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=t.language,void ue.set.call(this,e.indexOf(t))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=n),H(this.elements.container,s,n),this.captions.toggled=n,this.updateSetting.call(this,"captions"),G.call(this,this.media,n?"captionsenabled":"captionsdisabled")}setTimeout(()=>{n&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(e,t=!0){const i=ue.getTracks.call(this);if(-1!==e)if(u(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const s=i[e],{language:n}=s||{};this.captions.currentTrackNode=s,this.updateSetting.call(this,"captions"),t||(this.captions.language=n,this.storage.set({language:n})),this.isVimeo&&this.embed.enableTextTrack(n),G.call(this,this.media,"languagechange")}ue.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&ue.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else ue.toggle.call(this,!1,t)},setLanguage(e,t=!0){if(!d(e))return void this.debug.warn("Invalid language argument",e);const i=e.toLowerCase();this.captions.language=i;const s=ue.getTracks.call(this),n=ue.findTrack.call(this,[i]);ue.set.call(this,s.indexOf(n),t)},getTracks(e=!1){return Array.from((this.media||{}).textTracks||[]).filter(t=>!this.isHTML5||e||this.captions.meta.has(t)).filter(e=>["captions","subtitles"].includes(e.kind))},findTrack(e,t=!1){const i=ue.getTracks.call(this),s=e=>Number((this.captions.meta.get(e)||{}).default),n=Array.from(i).sort((e,t)=>s(t)-s(e));let a;return e.every(e=>(a=n.find(t=>t.language===e),!a)),a||(t?n[0]:void 0)},getCurrentTrack(){return ue.getTracks.call(this)[this.currentTrack]},getLabel(e){let t=e;return!w(t)&&W.textTracks&&this.captions.toggled&&(t=ue.getCurrentTrack.call(this)),w(t)?C(t.label)?C(t.language)?re.get("enabled",this.config):e.language.toUpperCase():t.label:re.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!y(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!c(e)&&!Array.isArray(e))return void this.debug.warn("updateCues: Invalid input",e);let t=e;if(!t){const e=ue.getCurrentTrack.call(this);t=Array.from((e||{}).activeCues||[]).map(e=>e.getCueAsHTML()).map(le)}const i=t.map(e=>e.trim()).join("\n");if(i!==this.elements.captions.innerHTML){_(this.elements.captions);const e=I("span",O(this.config.selectors.caption));e.innerHTML=i,this.elements.captions.appendChild(e),G.call(this,this.media,"cuechange")}}},de={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:"https://cdn.plyr.io/3.6.2/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",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:!0},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","mute","volume","current-time","progress","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{auto:"Auto",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"}},buffer:{maxBufferLength:10,maxMaxBufferLength:60},urls:{hlsjs:{sdk:"https://cdn.jsdelivr.net/npm/hls.js@1.6.15/dist/hls.min.js"},dashjs:{sdk:"https://cdn.jsdelivr.net/npm/dashjs@5.1.0/dist/legacy/umd/dash.all.min.js"},download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},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}},me="picture-in-picture",pe="inline",ge={html5:"html5",hlsjs:"hlsjs",dashjs:"dashjs",youtube:"youtube",vimeo:"vimeo"},fe="audio",ye="video";function be(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?ge.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?ge.vimeo:/^https?:\/\/(.*).m3u8(.?)/.test(e)?ge.hlsjs:/^https?:\/\/(.*).mpd(.?)/.test(e)?ge.dashjs:null}const ve=()=>{};class we{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):ve}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):ve}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):ve}}function Te(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function ke(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ce(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function Ae(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(i),!0).forEach(function(t){ke(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Ce(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var Se={addCSS:!0,thumbWidth:15,watch:!0};var Ee=function(e){return null!=e?e.constructor:null},Pe=function(e,t){return!!(e&&t&&e instanceof t)},Me=function(e){return null==e},xe=function(e){return Ee(e)===Object},Ne=function(e){return Ee(e)===String},Ie=function(e){return Array.isArray(e)},Le=function(e){return Pe(e,NodeList)},$e=Ne,_e=Ie,je=Le,Oe=function(e){return Pe(e,Element)},qe=function(e){return Pe(e,Event)},He=function(e){return Me(e)||(Ne(e)||Ie(e)||Le(e))&&!e.length||xe(e)&&!Object.keys(e).length};function De(e,t){if(1>t){var i=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(i))}return Math.round(e/t)*t}var Fe=function(){function e(t,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),Oe(t)?this.element=t:$e(t)&&(this.element=document.querySelector(t)),Oe(this.element)&&He(this.element.rangeTouch)&&(this.config=Ae({},Se,{},i),this.init())}return function(e,t,i){t&&Te(e.prototype,t),i&&Te(e,i)}(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||!qe(t))return null;var i,s=t.target,n=t.changedTouches[0],a=parseFloat(s.getAttribute("min"))||0,l=parseFloat(s.getAttribute("max"))||100,o=parseFloat(s.getAttribute("step"))||1,r=s.getBoundingClientRect(),c=100/r.width*(this.config.thumbWidth/2)/100;return 0>(i=100/r.width*(n.clientX-r.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*c:50<i&&(i+=2*(i-50)*c),a+De(i/100*(l-a),o)}},{key:"set",value:function(t){e.enabled&&qe(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),function(e,t){if(e&&t){var i=new Event(t,{bubbles:!0});e.dispatchEvent(i)}}(t.target,"touchend"===t.type?"change":"input"))}}],[{key:"setup",value:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=null;if(He(t)||$e(t)?s=Array.from(document.querySelectorAll($e(t)?t:'input[type="range"]')):Oe(t)?s=[t]:je(t)?s=Array.from(t):_e(t)&&(s=t.filter(Oe)),He(s))return null;var n=Ae({},Se,{},i);if($e(t)&&n.watch){var a=new MutationObserver(function(i){Array.from(i).forEach(function(i){Array.from(i.addedNodes).forEach(function(i){Oe(i)&&function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(i,t)&&new e(i,n)})})});a.observe(document.body,{childList:!0,subtree:!0})}return s.map(function(t){return new e(t,i)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}();function Re(e){T(e)&&e.then(null,()=>{})}function Ve(e){if(!(g(e)||d(e)&&e.includes(":")))return!1;return(g(e)?e:e.split(":")).map(Number).every(u)}function Be(e){if(!g(e)||!e.every(u))return null;const[t,i]=e,s=(e,t)=>0===t?e:s(t,e%t),n=s(t,i);return[t/n,i/n]}function Ue(e){const t=e=>Ve(e)?e.split(":").map(Number):null;let i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!C(this.embed)&&g(this.embed.ratio)&&({ratio:i}=this.embed),null===i&&this.isHTML5){const{videoWidth:e,videoHeight:t}=this.media;i=Be([e,t])}return i}function We(e){if(!this.isVideo)return{};const{wrapper:t}=this.elements,i=Ue.call(this,e),[s,n]=g(i)?i:[0,0],a=100/s*n;if(t.style.paddingBottom=`${a}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const e=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),t=(e-a)/(e/50);this.media.style.transform=`translateY(-${t}%)`}else this.isHTML5&&t.classList.toggle(this.config.classNames.videoFixedRatio,null!==i);return{padding:a,ratio:i}}const ze={getSources(){if(!this.isHTML5)return[];return Array.from(this.media.querySelectorAll("source")).filter(e=>{const t=e.getAttribute("type");return!!C(t)||W.mime.call(this,t)})},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:ze.getSources.call(this).map(e=>Number(e.getAttribute("size"))).filter(Boolean)},setup(){if(!this.isHTML5)return;const e=this;e.options.speed=e.config.speed.options,C(this.config.ratio)||We.call(e),Object.defineProperty(e.media,"quality",{get(){const t=ze.getSources.call(e).find(t=>t.getAttribute("src")===e.source);return t&&Number(t.getAttribute("size"))},set(t){if(e.quality!==t){if(e.config.quality.forced&&p(e.config.quality.onChange))e.config.quality.onChange(t);else{const i=ze.getSources.call(e).find(e=>Number(e.getAttribute("size"))===t);if(!i)return;const{currentTime:s,paused:n,preload:a,readyState:l,playbackRate:o}=e.media;e.media.src=i.getAttribute("src"),("none"!==a||l)&&(e.once("loadedmetadata",()=>{e.speed=o,e.currentTime=s,n||Re(e.play())}),e.media.load())}G.call(e,e.media,"qualitychange",!1,{quality:t})}}})},cancelRequests(){this.isHTML5&&($(ze.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};class Ke{constructor(e){this.enabled=e.config.storage.enabled,this.key=e.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}}get(e){if(!Ke.supported||!this.enabled)return null;const t=window.localStorage.getItem(this.key);if(C(t))return null;const i=JSON.parse(t);return d(e)&&e.length?i[e]:i}set(e){if(!Ke.supported||!this.enabled)return;if(!h(e))return;let t=this.get();C(t)&&(t={}),M(t,e),window.localStorage.setItem(this.key,JSON.stringify(t))}}function Ye(e,t){if(!d(e))return;const i="cache",s=d(t);let n=!1;const a=()=>null!==document.getElementById(t),l=(e,t)=>{e.innerHTML=t,s&&a()||document.body.insertAdjacentElement("afterbegin",e)};if(!s||!a()){const a=Ke.supported,o=document.createElement("div");if(o.setAttribute("hidden",""),s&&o.setAttribute("id",t),a){const e=window.localStorage.getItem(`${i}-${t}`);if(n=null!==e,n){const t=JSON.parse(e);l(o,t.content)}}te(e).then(e=>{C(e)||(a&&window.localStorage.setItem(`${i}-${t}`,JSON.stringify({content:e})),l(o,e))}).catch(()=>{})}}const Qe=e=>Math.trunc(e/60/60%60,10);function Je(e=0,t=!1,i=!1){if(!u(e))return Je(void 0,t,i);const s=e=>`0${e}`.slice(-2);let n=Qe(e);const a=(l=e,Math.trunc(l/60%60,10));var l;const o=(e=>Math.trunc(e%60,10))(e);return n=t||n>0?`${n}:`:"",`${i&&e>0?"-":""}${n}${s(a)}:${s(o)}`}const Xe={getIconUrl(){const e=new URL(this.config.iconUrl,window.location).host!==window.location.host||E.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:e}},findElements(){try{return this.elements.controls=V.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:R.call(this,this.config.selectors.buttons.play),pause:V.call(this,this.config.selectors.buttons.pause),restart:V.call(this,this.config.selectors.buttons.restart),rewind:V.call(this,this.config.selectors.buttons.rewind),fastForward:V.call(this,this.config.selectors.buttons.fastForward),mute:V.call(this,this.config.selectors.buttons.mute),pip:V.call(this,this.config.selectors.buttons.pip),airplay:V.call(this,this.config.selectors.buttons.airplay),settings:V.call(this,this.config.selectors.buttons.settings),captions:V.call(this,this.config.selectors.buttons.captions),fullscreen:V.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=V.call(this,this.config.selectors.progress),this.elements.inputs={seek:V.call(this,this.config.selectors.inputs.seek),volume:V.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:V.call(this,this.config.selectors.display.buffer),currentTime:V.call(this,this.config.selectors.display.currentTime),duration:V.call(this,this.config.selectors.display.duration)},y(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${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(e,t){const i="http://www.w3.org/2000/svg",s=Xe.getIconUrl.call(this),n=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");N(a,M(t,{"aria-hidden":"true",focusable:"false"}));const l=document.createElementNS(i,"use"),o=`${n}-${e}`;return"href"in l&&l.setAttributeNS("http://www.w3.org/1999/xlink","href",o),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),a.appendChild(l),a},createLabel(e,t={}){const i=re.get(e,this.config);return I("span",{...t,class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")},i)},createBadge(e){if(C(e))return null;const t=I("span",{class:this.config.classNames.menu.value});return t.appendChild(I("span",{class:this.config.classNames.menu.badge},e)),t},createButton(e,t){const i=M({},t);let s=ae(e);const n={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(e=>{Object.keys(i).includes(e)&&(n[e]=i[e],delete i[e])}),"button"!==n.element||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some(e=>e===this.config.classNames.control)||M(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,e){case"play":n.toggle=!0,n.label="play",n.labelPressed="pause",n.icon="play",n.iconPressed="pause";break;case"mute":n.toggle=!0,n.label="mute",n.labelPressed="unmute",n.icon="volume",n.iconPressed="muted";break;case"captions":n.toggle=!0,n.label="enableCaptions",n.labelPressed="disableCaptions",n.icon="captions-off",n.iconPressed="captions-on";break;case"fullscreen":n.toggle=!0,n.label="enterFullscreen",n.labelPressed="exitFullscreen",n.icon="enter-fullscreen",n.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,s="play",n.label="play",n.icon="play";break;default:C(n.label)&&(n.label=s),C(n.icon)&&(n.icon=e)}const a=I(n.element);return n.toggle?(a.appendChild(Xe.createIcon.call(this,n.iconPressed,{class:"icon--pressed"})),a.appendChild(Xe.createIcon.call(this,n.icon,{class:"icon--not-pressed"})),a.appendChild(Xe.createLabel.call(this,n.labelPressed,{class:"label--pressed"})),a.appendChild(Xe.createLabel.call(this,n.label,{class:"label--not-pressed"}))):(a.appendChild(Xe.createIcon.call(this,n.icon)),a.appendChild(Xe.createLabel.call(this,n.label))),M(i,O(this.config.selectors.buttons[s],i)),N(a,i),"play"===s?(g(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(a)):this.elements.buttons[s]=a,a},createRange(e,t){const i=I("input",M(O(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":re.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,Xe.updateRangeFill.call(this,i),Fe.setup(i),i},createProgress(e,t){const i=I("progress",M(O(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild(I("span",null,"0"));const t={played:"played",buffer:"buffered"}[e],s=t?re.get(t,this.config):"";i.innerText=`% ${s.toLowerCase()}`}return this.elements.display[e]=i,i},createTime(e,t){const i=O(this.config.selectors.display[e],t),s=I("div",M(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":re.get(e,this.config)}),"00:00");return this.elements.display[e]=s,s},bindMenuItemShortcuts(e,t){Q.call(this,e,"keydown keyup",i=>{if(![32,38,39,40].includes(i.which))return;if(i.preventDefault(),i.stopPropagation(),"keydown"===i.type)return;const s=F(e,'[role="menuitemradio"]');if(!s&&[32,39].includes(i.which))Xe.showMenuPanel.call(this,t,!0);else{let t;32!==i.which&&(40===i.which||s&&39===i.which?(t=e.nextElementSibling,y(t)||(t=e.parentNode.firstElementChild)):(t=e.previousElementSibling,y(t)||(t=e.parentNode.lastElementChild)),B.call(this,t,!0))}},!1),Q.call(this,e,"keyup",e=>{13===e.which&&Xe.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:e,list:t,type:i,title:s,badge:n=null,checked:a=!1}){const l=O(this.config.selectors.inputs[i]),o=I("button",M(l,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${l.class?l.class:""}`.trim(),"aria-checked":a,value:e})),r=I("span");r.innerHTML=s,y(n)&&r.appendChild(n),o.appendChild(r),Object.defineProperty(o,"checked",{enumerable:!0,get:()=>"true"===o.getAttribute("aria-checked"),set(e){e&&Array.from(o.parentNode.children).filter(e=>F(e,'[role="menuitemradio"]')).forEach(e=>e.setAttribute("aria-checked","false")),o.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(o,"click keyup",t=>{if(!v(t)||32===t.which){switch(t.preventDefault(),t.stopPropagation(),o.checked=!0,i){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=parseFloat(e)}Xe.showMenuPanel.call(this,"home",v(t))}},i,!1),Xe.bindMenuItemShortcuts.call(this,o,i),t.appendChild(o)},formatTime(e=0,t=!1){if(!u(e))return e;return Je(e,Qe(this.duration)>0,t)},updateTimeDisplay(e=null,t=0,i=!1){y(e)&&u(t)&&(e.innerText=Xe.formatTime(t,i))},updateVolume(){this.supported.ui&&(y(this.elements.inputs.volume)&&Xe.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),y(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange(e,t=0){y(e)&&(e.value=t,Xe.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!b(e))return;let t=0;const i=(e,t)=>{const i=u(t)?t:0,s=y(e)?e:this.elements.display.buffer;if(y(s)){s.value=i;const e=s.getElementsByTagName("span")[0];y(e)&&(e.childNodes[0].nodeValue=i)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":s=this.currentTime,n=this.duration,t=0===s||0===n||Number.isNaN(s)||Number.isNaN(n)?0:(s/n*100).toFixed(2),"timeupdate"===e.type&&Xe.setRange.call(this,this.elements.inputs.seek,t);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered)}var s,n},updateRangeFill(e){const t=b(e)?e.target:e;if(y(t)&&"range"===t.getAttribute("type")){if(F(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);const e=Xe.formatTime(this.currentTime),i=Xe.formatTime(this.duration),s=re.get("seekLabel",this.config);t.setAttribute("aria-valuetext",s.replace("{currentTime}",e).replace("{duration}",i))}else if(F(t,this.config.selectors.inputs.volume)){const e=100*t.value;t.setAttribute("aria-valuenow",e),t.setAttribute("aria-valuetext",`${e.toFixed(1)}%`)}else t.setAttribute("aria-valuenow",t.value);E.isWebkit&&t.style.setProperty("--value",t.value/t.max*100+"%")}},updateSeekTooltip(e){if(!this.config.tooltips.seek||!y(this.elements.inputs.seek)||!y(this.elements.display.seekTooltip)||0===this.duration)return;const t=`${this.config.classNames.tooltip}--visible`,i=e=>H(this.elements.display.seekTooltip,t,e);if(this.touch)return void i(!1);let s=0;const n=this.elements.progress.getBoundingClientRect();if(b(e))s=100/n.width*(e.pageX-n.left);else{if(!D(this.elements.display.seekTooltip,t))return;s=parseFloat(this.elements.display.seekTooltip.style.left,10)}s<0?s=0:s>100&&(s=100),Xe.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*s),this.elements.display.seekTooltip.style.left=`${s}%`,b(e)&&["mouseenter","mouseleave"].includes(e.type)&&i("mouseenter"===e.type)},timeUpdate(e){const t=!y(this.elements.display.duration)&&this.config.invertTime;Xe.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||Xe.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return q(this.elements.display.currentTime,!0),void q(this.elements.progress,!0);y(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=y(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&Xe.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&Xe.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),Xe.updateSeekTooltip.call(this)},toggleMenuButton(e,t){q(this.elements.settings.buttons[e],!t)},updateSetting(e,t,i){const s=this.elements.settings.panels[e];let n=null,a=t;if("captions"===e)n=this.currentTrack;else{if(n=C(i)?this[e]:i,C(n)&&(n=this.config[e].default),!C(this.options[e])&&!this.options[e].includes(n))return void this.debug.warn(`Unsupported value of '${n}' for ${e}`);if(!this.config[e].options.includes(n))return void this.debug.warn(`Disabled value of '${n}' for ${e}`)}if(y(a)||(a=s&&s.querySelector('[role="menu"]')),!y(a))return;this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=Xe.getLabel.call(this,e,n);const l=a&&a.querySelector(`[value="${n}"]`);y(l)&&(l.checked=!0)},getLabel(e,t){switch(e){case"speed":return 1===t?re.get("normal",this.config):`${t}&times;`;case"quality":if(u(t)){if(-1===t)return re.get("auto",this.config);const e=re.get(`qualityLabel.${t}`,this.config);return e.length?e:`${t}p`}return ne(t);case"captions":return ue.getLabel.call(this);default:return null}},setQualityMenu(e){if(!y(this.elements.settings.panels.quality))return;const t="quality",i=this.elements.settings.panels.quality.querySelector('[role="menu"]');g(e)&&(this.options.quality=z(e).filter(e=>this.config.quality.options.includes(e)));const s=!C(this.options.quality)&&this.options.quality.length>1;if(Xe.toggleMenuButton.call(this,t,s),_(i),Xe.checkMenu.call(this),!s)return;const n=e=>{const t=re.get(`qualityBadge.${e}`,this.config);return t.length?Xe.createBadge.call(this,t):null};this.options.quality.sort((e,t)=>{const i=this.config.quality.options;return i.indexOf(e)>i.indexOf(t)?1:-1}).forEach(e=>{Xe.createMenuItem.call(this,{value:e,list:i,type:t,title:Xe.getLabel.call(this,"quality",e),badge:n(e)})}),Xe.updateSetting.call(this,t,i)},setCaptionsMenu(){if(!y(this.elements.settings.panels.captions))return;const e="captions",t=this.elements.settings.panels.captions.querySelector('[role="menu"]'),i=ue.getTracks.call(this),s=Boolean(i.length);if(Xe.toggleMenuButton.call(this,e,s),_(t),Xe.checkMenu.call(this),!s)return;const n=i.map((e,i)=>({value:i,checked:this.captions.toggled&&this.currentTrack===i,title:ue.getLabel.call(this,e),badge:e.language&&Xe.createBadge.call(this,e.language.toUpperCase()),list:t,type:"language"}));n.unshift({value:-1,checked:!this.captions.toggled,title:re.get("disabled",this.config),list:t,type:"language"}),n.forEach(Xe.createMenuItem.bind(this)),Xe.updateSetting.call(this,e,t)},setSpeedMenu(){if(!y(this.elements.settings.panels.speed))return;const e="speed",t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter(e=>e>=this.minimumSpeed&&e<=this.maximumSpeed);const i=!C(this.options.speed)&&this.options.speed.length>1;Xe.toggleMenuButton.call(this,e,i),_(t),Xe.checkMenu.call(this),i&&(this.options.speed.forEach(i=>{Xe.createMenuItem.call(this,{value:i,list:t,type:e,title:Xe.getLabel.call(this,"speed",i)})}),Xe.updateSetting.call(this,e,t))},checkMenu(){const{buttons:e}=this.elements.settings,t=!C(e)&&Object.values(e).some(e=>!e.hidden);q(this.elements.settings.menu,!t)},focusFirstMenuItem(e,t=!1){if(this.elements.settings.popup.hidden)return;let i=e;y(i)||(i=Object.values(this.elements.settings.panels).find(e=>!e.hidden));const s=i.querySelector('[role^="menuitem"]');B.call(this,s,t)},toggleMenu(e){const{popup:t}=this.elements.settings,i=this.elements.buttons.settings;if(!y(t)||!y(i))return;const{hidden:s}=t;let n=s;if(m(e))n=e;else if(v(e)&&27===e.which)n=!1;else if(b(e)){const s=p(e.composedPath)?e.composedPath()[0]:e.target,a=t.contains(s);if(a||!a&&e.target!==i&&n)return}i.setAttribute("aria-expanded",n),q(t,!n),H(this.elements.container,this.config.classNames.menu.open,n),n&&v(e)?Xe.focusFirstMenuItem.call(this,null,!0):n||s||B.call(this,i,v(e))},getMenuSize(e){const t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);const i=t.scrollWidth,s=t.scrollHeight;return $(t),{width:i,height:s}},showMenuPanel(e="",t=!1){const i=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!y(i))return;const s=i.parentNode,n=Array.from(s.children).find(e=>!e.hidden);if(W.transitions&&!W.reducedMotion){s.style.width=`${n.scrollWidth}px`,s.style.height=`${n.scrollHeight}px`;const e=Xe.getMenuSize.call(this,i),t=e=>{e.target===s&&["width","height"].includes(e.propertyName)&&(s.style.width="",s.style.height="",J.call(this,s,A,t))};Q.call(this,s,A,t),s.style.width=`${e.width}px`,s.style.height=`${e.height}px`}q(n,!0),q(i,!1),Xe.focusFirstMenuItem.call(this,i,t)},setDownloadUrl(){const e=this.elements.buttons.download;y(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:t,createButton:i,createProgress:s,createRange:n,createTime:a,setQualityMenu:l,setSpeedMenu:o,showMenuPanel:r}=Xe;this.elements.controls=null,g(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const c=I("div",O(this.config.selectors.controls.wrapper));this.elements.controls=c;const h={class:"plyr__controls__item"};return z(g(this.config.controls)?this.config.controls:[]).forEach(l=>{if("restart"===l&&c.appendChild(i.call(this,"restart",h)),"rewind"===l&&c.appendChild(i.call(this,"rewind",h)),"play"===l&&c.appendChild(i.call(this,"play",h)),"fast-forward"===l&&c.appendChild(i.call(this,"fast-forward",h)),"progress"===l){const t=I("div",{class:`${h.class} plyr__progress__container`}),i=I("div",O(this.config.selectors.progress));if(i.appendChild(n.call(this,"seek",{id:`plyr-seek-${e.id}`})),i.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const e=I("span",{class:this.config.classNames.tooltip},"00:00");i.appendChild(e),this.elements.display.seekTooltip=e}this.elements.progress=i,t.appendChild(this.elements.progress),c.appendChild(t)}if("current-time"===l&&c.appendChild(a.call(this,"currentTime",h)),"duration"===l&&c.appendChild(a.call(this,"duration",h)),"mute"===l||"volume"===l){let{volume:t}=this.elements;if(y(t)&&c.contains(t)||(t=I("div",M({},h,{class:`${h.class} plyr__volume`.trim()})),this.elements.volume=t,c.appendChild(t)),"mute"===l&&t.appendChild(i.call(this,"mute")),"volume"===l&&!E.isIos){const i={max:1,step:.05,value:this.config.volume};t.appendChild(n.call(this,"volume",M(i,{id:`plyr-volume-${e.id}`})))}}if("captions"===l&&c.appendChild(i.call(this,"captions",h)),"settings"===l&&!C(this.config.settings)){const s=I("div",M({},h,{class:`${h.class} plyr__menu`.trim(),hidden:""}));s.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const n=I("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),a=I("div"),l=I("div",{id:`plyr-settings-${e.id}-home`}),o=I("div",{role:"menu"});l.appendChild(o),a.appendChild(l),this.elements.settings.panels.home=l,this.config.settings.forEach(i=>{const s=I("button",M(O(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));t.call(this,s,i),Q.call(this,s,"click",()=>{r.call(this,i,!1)});const n=I("span",null,re.get(i,this.config)),l=I("span",{class:this.config.classNames.menu.value});l.innerHTML=e[i],n.appendChild(l),s.appendChild(n),o.appendChild(s);const c=I("div",{id:`plyr-settings-${e.id}-${i}`,hidden:""}),h=I("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});h.appendChild(I("span",{"aria-hidden":!0},re.get(i,this.config))),h.appendChild(I("span",{class:this.config.classNames.hidden},re.get("menuBack",this.config))),Q.call(this,c,"keydown",e=>{37===e.which&&(e.preventDefault(),e.stopPropagation(),r.call(this,"home",!0))},!1),Q.call(this,h,"click",()=>{r.call(this,"home",!1)}),c.appendChild(h),c.appendChild(I("div",{role:"menu"})),a.appendChild(c),this.elements.settings.buttons[i]=s,this.elements.settings.panels[i]=c}),n.appendChild(a),s.appendChild(n),c.appendChild(s),this.elements.settings.popup=n,this.elements.settings.menu=s}if("pip"===l&&W.pip&&c.appendChild(i.call(this,"pip",h)),"airplay"===l&&W.airplay&&c.appendChild(i.call(this,"airplay",h)),"download"===l){const e=M({},h,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(e.download="");const{download:t}=this.config.urls;!k(t)&&this.isEmbed&&M(e,{icon:`logo-${this.provider}`,label:this.provider}),c.appendChild(i.call(this,"download",e))}"fullscreen"===l&&c.appendChild(i.call(this,"fullscreen",h))}),this.isHTML5&&l.call(this,ze.getQualityOptions.call(this)),o.call(this),c},inject(){if(this.config.loadSprite){const e=Xe.getIconUrl.call(this);e.cors&&Ye(e.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let e=null;this.elements.controls=null;const t={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i=!0;p(this.config.controls)&&(this.config.controls=this.config.controls.call(this,t)),this.config.controls||(this.config.controls=[]),y(this.config.controls)||d(this.config.controls)?e=this.config.controls:(e=Xe.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:ue.getLabel.call(this)}),i=!1);let s;i&&d(this.config.controls)&&(e=(e=>{let i=e;return Object.entries(t).forEach(([e,t])=>{i=se(i,`{${e}}`,t)}),i})(e)),d(this.config.selectors.controls.container)&&(s=document.querySelector(this.config.selectors.controls.container)),y(s)||(s=this.elements.container);if(s[y(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),y(this.elements.controls)||Xe.findElements.call(this),!C(this.elements.buttons)){const e=e=>{const t=this.config.classNames.controlPressed;Object.defineProperty(e,"pressed",{enumerable:!0,get:()=>D(e,t),set(i=!1){H(e,t,i)}})};Object.values(this.elements.buttons).filter(Boolean).forEach(t=>{g(t)||f(t)?Array.from(t).filter(Boolean).forEach(e):e(t)})}if(E.isEdge&&S(s),this.config.tooltips.controls){const{classNames:e,selectors:t}=this.config,i=`${t.controls.wrapper} ${t.labels} .${e.hidden}`,s=R.call(this,i);Array.from(s).forEach(e=>{H(e,this.config.classNames.hidden,!1),H(e,this.config.classNames.tooltip,!0)})}}};class Ge{constructor(e){this.player=e,this.prefix=Ge.prefix,this.property=Ge.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===e.config.fullscreen.fallback,this.player.elements.fullscreen=e.config.fullscreen.container&&function(e,t){const{prototype:i}=Element;return(i.closest||function(){let e=this;do{if(F.matches(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}).call(e,t)}(this.player.elements.container,e.config.fullscreen.container),Q.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),Q.call(this.player,this.player.elements.container,"dblclick",e=>{y(this.player.elements.controls)&&this.player.elements.controls.contains(e.target)||this.toggle()}),Q.call(this,this.player.elements.container,"keydown",e=>this.trapFocus(e)),this.update()}static get native(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get usingNative(){return Ge.native&&!this.forceFallback}static get prefix(){if(p(document.exitFullscreen))return"";let e="";return["webkit","moz","ms"].some(t=>!(!p(document[`${t}ExitFullscreen`])&&!p(document[`${t}CancelFullScreen`]))&&(e=t,!0)),e}static get property(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}get enabled(){return(Ge.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}get active(){if(!this.enabled)return!1;if(!Ge.native||this.forceFallback)return D(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?document[`${this.prefix}${this.property}Element`]:document.fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){return E.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}onChange(){if(!this.enabled)return;const e=this.player.elements.buttons.fullscreen;y(e)&&(e.pressed=this.active);const t=this.target===this.player.media?this.target:this.player.elements.container;G.call(this.player,t,this.active?"enterfullscreen":"exitfullscreen",!0)}toggleFallback(e=!1){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":"",H(this.target,this.player.config.classNames.fullscreen.fallback,e),E.isIos){let t=document.head.querySelector('meta[name="viewport"]');const i="viewport-fit=cover";t||(t=document.createElement("meta"),t.setAttribute("name","viewport"));const s=d(t.content)&&t.content.includes(i);e?(this.cleanupViewport=!s,s||(t.content+=`,${i}`)):this.cleanupViewport&&(t.content=t.content.split(",").filter(e=>e.trim()!==i).join(","))}this.onChange()}trapFocus(e){if(E.isIos||!this.active||"Tab"!==e.key||9!==e.keyCode)return;const t=document.activeElement,i=R.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[s]=i,n=i[i.length-1];t!==n||e.shiftKey?t===s&&e.shiftKey&&(n.focus(),e.preventDefault()):(s.focus(),e.preventDefault())}update(){if(this.enabled){let e;e=this.forceFallback?"Fallback (forced)":Ge.native?"Native":"Fallback",this.player.debug.log(`${e} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");H(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}enter(){this.enabled&&(E.isIos&&this.player.config.fullscreen.iosNative?this.target.webkitEnterFullscreen():!Ge.native||this.forceFallback?this.toggleFallback(!0):this.prefix?C(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))}exit(){if(this.enabled)if(E.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),Re(this.player.play());else if(!Ge.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!C(this.prefix)){const e="moz"===this.prefix?"Cancel":"Exit";document[`${this.prefix}${e}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}toggle(){this.active?this.exit():this.enter()}}function Ze(e,t=1){return new Promise((i,s)=>{const n=new Image,a=()=>{delete n.onload,delete n.onerror,(n.naturalWidth>=t?i:s)(n)};Object.assign(n,{onload:a,onerror:a,src:e})})}const et={addStyleHook(){H(this.elements.container,this.config.selectors.container.replace(".",""),!0),H(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(e=!1){e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void et.toggleNativeControls.call(this,!0);y(this.elements.controls)||(Xe.inject.call(this),this.listeners.controls()),et.toggleNativeControls.call(this),this.isHTML5&&ue.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,Xe.updateVolume.call(this),Xe.timeUpdate.call(this),et.checkPlaying.call(this),H(this.elements.container,this.config.classNames.pip.supported,W.pip&&this.isHTML5&&this.isVideo),H(this.elements.container,this.config.classNames.airplay.supported,W.airplay&&this.isHTML5),H(this.elements.container,this.config.classNames.isIos,E.isIos),H(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{G.call(this,this.media,"ready")},0),et.setTitle.call(this),this.poster&&et.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&Xe.durationUpdate.call(this)},setTitle(){let e=re.get("play",this.config);if(d(this.config.title)&&!C(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach(t=>{t.setAttribute("aria-label",e)}),this.isEmbed){const e=V.call(this,"iframe");if(!y(e))return;const t=C(this.config.title)?"video":this.config.title,i=re.get("frameTitle",this.config);e.setAttribute("title",i.replace("{title}",t))}},togglePoster(e){H(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,t=!0){return t&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),ee.call(this).then(()=>Ze(e)).catch(t=>{throw e===this.poster&&et.togglePoster.call(this,!1),t}).then(()=>{if(e!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")}).then(()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${e}')`,backgroundSize:""}),et.togglePoster.call(this,!0),e)))},checkPlaying(e){H(this.elements.container,this.config.classNames.playing,this.playing),H(this.elements.container,this.config.classNames.paused,this.paused),H(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",re.get(this.playing?"pause":"play",this.config))}),b(e)&&"timeupdate"===e.type||et.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{H(this.elements.container,this.config.classNames.loading,this.loading),et.toggleControls.call(this)},this.loading?250:0)},toggleControls(e){const{controls:t}=this.elements;if(t&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||i))}},migrateStyles(){Object.values({...this.media.style}).filter(e=>!C(e)&&e.startsWith("--plyr")).forEach(e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)}),C(this.media.style)&&this.media.removeAttribute("style")}};class tt{constructor(e){this.player=e,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)}handleKey(e){const{player:t}=this,{elements:i}=t,s=e.keyCode?e.keyCode:e.which,n="keydown"===e.type,a=n&&s===this.lastKey;if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;if(!u(s))return;if(n){const n=document.activeElement;if(y(n)){const{editable:s}=t.config.selectors,{seek:a}=i.inputs;if(n!==a&&F(n,s))return;if(32===e.which&&F(n,'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(s)&&(e.preventDefault(),e.stopPropagation()),s){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*(s-48));break;case 32:case 75:a||Re(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===s&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=s}else this.lastKey=null}toggleMenu(e){Xe.toggleMenu.call(this.player,e)}firstTouch(){const{player:e}=this,{elements:t}=e;e.touch=!0,H(t.container,e.config.classNames.isTouch,!0)}setTabFocus(e){const{player:t}=this,{elements:i}=t;if(clearTimeout(this.focusTimer),"keydown"===e.type&&9!==e.which)return;"keydown"===e.type&&(this.lastKeyDown=e.timeStamp);const s=e.timeStamp-this.lastKeyDown<=20;("focus"!==e.type||s)&&((()=>{const e=t.config.classNames.tabFocus;H(R.call(t,`.${e}`),e,!1)})(),"focusout"!==e.type&&(this.focusTimer=setTimeout(()=>{const e=document.activeElement;i.container.contains(e)&&H(document.activeElement,t.config.classNames.tabFocus,!0)},10)))}global(e=!0){const{player:t}=this;t.config.keyboard.global&&Y.call(t,window,"keydown keyup",this.handleKey,e,!1),Y.call(t,document.body,"click",this.toggleMenu,e),X.call(t,document.body,"touchstart",this.firstTouch),Y.call(t,document.body,"keydown focus blur focusout",this.setTabFocus,e,!1,!0)}container(){const{player:e}=this,{config:t,elements:i,timers:s}=e;!t.keyboard.global&&t.keyboard.focused&&Q.call(e,i.container,"keydown keyup",this.handleKey,!1),Q.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",t=>{const{controls:n}=i;n&&"enterfullscreen"===t.type&&(n.pressed=!1,n.hover=!1);let a=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(et.toggleControls.call(e,!0),a=e.touch?3e3:2e3),clearTimeout(s.controls),s.controls=setTimeout(()=>et.toggleControls.call(e,!1),a)});const n=t=>{if(!t)return We.call(e);const s=i.container.getBoundingClientRect(),{width:n,height:a}=s;return We.call(e,`${n}:${a}`)},a=()=>{clearTimeout(s.resized),s.resized=setTimeout(n,50)};Q.call(e,i.container,"enterfullscreen exitfullscreen",t=>{const{target:s,usingNative:l}=e.fullscreen;if(s!==i.container)return;if(!e.isEmbed&&C(e.config.ratio))return;const o="enterfullscreen"===t.type,{padding:r,ratio:c}=n(o);((t,i,s)=>{if(!e.isVimeo||e.config.vimeo.premium)return;const n=e.elements.wrapper.firstChild,[,a]=t,[l,o]=Ue.call(e);n.style.maxWidth=s?a/o*l+"px":null,n.style.margin=s?"0 auto":null})(c,0,o),l||(o?Q.call(e,window,"resize",a):J.call(e,window,"resize",a))})}media(){const{player:e}=this,{elements:t}=e;if(Q.call(e,e.media,"timeupdate seeking seeked",t=>Xe.timeUpdate.call(e,t)),Q.call(e,e.media,"durationchange loadeddata loadedmetadata",t=>Xe.durationUpdate.call(e,t)),Q.call(e,e.media,"ended",()=>{e.isHTML5&&e.isVideo&&e.config.resetOnEnd&&(e.restart(),e.pause())}),Q.call(e,e.media,"progress playing seeking seeked",t=>Xe.updateProgress.call(e,t)),Q.call(e,e.media,"volumechange",t=>Xe.updateVolume.call(e,t)),Q.call(e,e.media,"playing play pause ended emptied timeupdate",t=>et.checkPlaying.call(e,t)),Q.call(e,e.media,"waiting canplay seeked playing",t=>et.checkLoading.call(e,t)),e.supported.ui&&e.config.clickToPlay&&!e.isAudio){const i=V.call(e,`.${e.config.classNames.video}`);if(!y(i))return;Q.call(e,t.container,"click",s=>{([t.container,i].includes(s.target)||i.contains(s.target))&&(e.touch&&e.config.hideControls||(e.ended?(this.proxy(s,e.restart,"restart"),this.proxy(s,()=>{Re(e.play())},"play")):this.proxy(s,()=>{Re(e.togglePlay())},"play")))})}e.supported.ui&&e.config.disableContextMenu&&Q.call(e,t.wrapper,"contextmenu",e=>{e.preventDefault()},!1),Q.call(e,e.media,"volumechange",()=>{e.storage.set({volume:e.volume,muted:e.muted})}),Q.call(e,e.media,"ratechange",()=>{Xe.updateSetting.call(e,"speed"),e.storage.set({speed:e.speed})}),Q.call(e,e.media,"qualitychange",t=>{Xe.updateSetting.call(e,"quality",null,t.detail.quality)}),Q.call(e,e.media,"ready qualitychange",()=>{Xe.setDownloadUrl.call(e)});const i=e.config.events.concat(["keyup","keydown"]).join(" ");Q.call(e,e.media,i,i=>{let{detail:s={}}=i;"error"===i.type&&(s=e.media.error),G.call(e,t.container,i.type,!0,s)})}proxy(e,t,i){const{player:s}=this,n=s.config.listeners[i];let a=!0;p(n)&&(a=n.call(s,e)),!1!==a&&p(t)&&t.call(s,e)}bind(e,t,i,s,n=!0){const{player:a}=this,l=a.config.listeners[s],o=p(l);Q.call(a,e,t,e=>this.proxy(e,i,s),n&&!o)}controls(){const{player:e}=this,{elements:t}=e,i=E.isIE?"change":"input";if(t.buttons.play&&Array.from(t.buttons.play).forEach(t=>{this.bind(t,"click",()=>{Re(e.togglePlay())},"play")}),this.bind(t.buttons.restart,"click",e.restart,"restart"),this.bind(t.buttons.rewind,"click",e.rewind,"rewind"),this.bind(t.buttons.fastForward,"click",e.forward,"fastForward"),this.bind(t.buttons.mute,"click",()=>{e.muted=!e.muted},"mute"),this.bind(t.buttons.captions,"click",()=>e.toggleCaptions()),this.bind(t.buttons.download,"click",()=>{G.call(e,e.media,"download")},"download"),this.bind(t.buttons.fullscreen,"click",()=>{e.fullscreen.toggle()},"fullscreen"),this.bind(t.buttons.pip,"click",()=>{e.pip="toggle"},"pip"),this.bind(t.buttons.airplay,"click",e.airplay,"airplay"),this.bind(t.buttons.settings,"click",t=>{t.stopPropagation(),t.preventDefault(),Xe.toggleMenu.call(e,t)},null,!1),this.bind(t.buttons.settings,"keyup",t=>{const i=t.which;[13,32].includes(i)&&(13!==i?(t.preventDefault(),t.stopPropagation(),Xe.toggleMenu.call(e,t)):Xe.focusFirstMenuItem.call(e,null,!0))},null,!1),this.bind(t.settings.menu,"keydown",t=>{27===t.which&&Xe.toggleMenu.call(e,t)}),this.bind(t.inputs.seek,"mousedown mousemove",e=>{const i=t.progress.getBoundingClientRect(),s=100/i.width*(e.pageX-i.left);e.currentTarget.setAttribute("seek-value",s)}),this.bind(t.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",t=>{const i=t.currentTarget,s=t.keyCode?t.keyCode:t.which,n="play-on-seeked";if(v(t)&&39!==s&&37!==s)return;e.lastSeekTime=Date.now();const a=i.hasAttribute(n),l=["mouseup","touchend","keyup"].includes(t.type);a&&l?(i.removeAttribute(n),Re(e.play())):!l&&e.playing&&(i.setAttribute(n,""),e.pause())}),E.isIos){const t=R.call(e,'input[type="range"]');Array.from(t).forEach(e=>this.bind(e,i,e=>S(e.target)))}this.bind(t.inputs.seek,i,t=>{const i=t.currentTarget;let s=i.getAttribute("seek-value");C(s)&&(s=i.value),i.removeAttribute("seek-value"),e.currentTime=s/i.max*e.duration},"seek"),this.bind(t.progress,"mouseenter mouseleave mousemove",t=>Xe.updateSeekTooltip.call(e,t)),this.bind(t.progress,"mousemove touchmove",t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startMove(t)}),this.bind(t.progress,"mouseleave touchend click",()=>{const{previewThumbnails:t}=e;t&&t.loaded&&t.endMove(!1,!0)}),this.bind(t.progress,"mousedown touchstart",t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startScrubbing(t)}),this.bind(t.progress,"mouseup touchend",t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.endScrubbing(t)}),E.isWebkit&&Array.from(R.call(e,'input[type="range"]')).forEach(t=>{this.bind(t,"input",t=>Xe.updateRangeFill.call(e,t.target))}),e.config.toggleInvert&&!y(t.display.duration)&&this.bind(t.display.currentTime,"click",()=>{0!==e.currentTime&&(e.config.invertTime=!e.config.invertTime,Xe.timeUpdate.call(e))}),this.bind(t.inputs.volume,i,t=>{e.volume=t.target.value},"volume"),this.bind(t.controls,"mouseenter mouseleave",i=>{t.controls.hover=!e.touch&&"mouseenter"===i.type}),t.fullscreen&&Array.from(t.fullscreen.children).filter(e=>!e.contains(t.container)).forEach(i=>{this.bind(i,"mouseenter mouseleave",i=>{t.controls.hover=!e.touch&&"mouseenter"===i.type})}),this.bind(t.controls,"mousedown mouseup touchstart touchend touchcancel",e=>{t.controls.pressed=["mousedown","touchstart"].includes(e.type)}),this.bind(t.controls,"focusin",()=>{const{config:i,timers:s}=e;H(t.controls,i.classNames.noTransition,!0),et.toggleControls.call(e,!0),setTimeout(()=>{H(t.controls,i.classNames.noTransition,!1)},0);const n=this.touch?3e3:4e3;clearTimeout(s.controls),s.controls=setTimeout(()=>et.toggleControls.call(e,!1),n)}),this.bind(t.inputs.volume,"wheel",t=>{const i=t.webkitDirectionInvertedFromDevice,[s,n]=[t.deltaX,-t.deltaY].map(e=>i?-e:e),a=Math.sign(Math.abs(s)>Math.abs(n)?s:n);e.increaseVolume(a/50);const{volume:l}=e.media;(1===a&&l<1||-1===a&&l>0)&&t.preventDefault()},"volume",!1)}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var it=function(e,t){return e(t={exports:{}},t.exports),t.exports}(function(e,t){e.exports=function(){var e=function(){},t={},i={},s={};function n(e,t){e=e.push?e:[e];var n,a,l,o=[],r=e.length,c=r;for(n=function(e,i){i.length&&o.push(e),--c||t(o)};r--;)a=e[r],(l=i[a])?n(a,l):(s[a]=s[a]||[]).push(n)}function a(e,t){if(e){var n=s[e];if(i[e]=t,n)for(;n.length;)n[0](e,t),n.splice(0,1)}}function l(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function o(t,i,s,n){var a,l,r,c=document,h=s.async,u=(s.numRetries||0)+1,d=s.before||e,m=t.replace(/[\?|#].*$/,""),p=t.replace(/^(css|img|module|nomodule)!/,"");if(n=n||0,/(^css!|\.css$)/.test(m))(r=c.createElement("link")).rel="stylesheet",r.href=p,(a="hideFocus"in r)&&r.relList&&(a=0,r.rel="preload",r.as="style");else if(/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(m))(r=c.createElement("img")).src=p;else if((r=c.createElement("script")).src=p,r.async=void 0===h||h,l="noModule"in r,/^module!/.test(m)){if(!l)return i(t,"l");r.type="module"}else if(/^nomodule!/.test(m)&&l)return i(t,"l");r.onload=r.onerror=r.onbeforeload=function(e){var l=e.type[0];if(a)try{r.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l){if((n+=1)<u)return o(t,i,s,n)}else if("preload"==r.rel&&"style"==r.as)return r.rel="stylesheet";i(t,l,e.defaultPrevented)},!1!==d(t,r)&&c.head.appendChild(r)}function r(e,t,i){var s,n,a=(e=e.push?e:[e]).length,l=a,r=[];for(s=function(e,i,s){if("e"==i&&r.push(e),"b"==i){if(!s)return;r.push(e)}--a||t(r)},n=0;n<l;n++)o(e[n],s,i)}function c(e,i,s){var n,o;if(i&&i.trim&&(n=i),o=(n?s:i)||{},n){if(n in t)throw"LoadJS";t[n]=!0}function c(t,i){r(e,function(e){l(o,e),t&&l({success:t,error:i},e),a(n,e)},o)}if(o.returnPromise)return new Promise(c);c()}return c.ready=function(e,t){return n(e,function(e){l(t,e)}),c},c.done=function(e){a(e,[])},c.reset=function(){t={},i={},s={}},c.isDefined=function(e){return e in t},c}()});function st(e){return new Promise((t,i)=>{it(e,{success:t,error:i})})}const nt={setup(){p(window.dashjs)?nt.ready.call(this):st(this.config.urls.dashjs.sdk).then(()=>{nt.ready.call(this)}).catch(e=>{this.debug.warn("dashjs failed to load",e)})},ready(){if(!this.isDashjs)return;const e=this;e.options.speed=e.config.speed.options,C(this.config.ratio)||We.call(e);const t=window.dashjs.MediaPlayer().create();t.initialize(e.media,this.config.src,!0),window.dash=t}},at={setup(){p(window.Hls)?at.ready.call(this):st(this.config.urls.hlsjs.sdk).then(()=>{at.ready.call(this)}).catch(e=>{this.debug.warn("Hlsjs failed to load",e)})},ready(){const e=this;if(window.Hls.isSupported()){const t=new Hls({maxBufferLength:this.config.buffer.maxBufferLength<30?this.config.buffer.maxBufferLength:10,maxMaxBufferLength:this.config.buffer.maxMaxBufferLength<60?this.config.buffer.maxMaxBufferLength:60});t.on(window.Hls.Events.MANIFEST_PARSED,()=>{const i=t.levels.map(e=>e.height);e.options.quality=[-1,...i],e.config.quality.options=i[0]<i[i.length-1]?[-1,...i.reverse()]:[-1,...i],e.quality=-1,this.setQualityMenu.call(e,e.options.quality)}),t.on(window.Hls.Events.MEDIA_ATTACHED,()=>{t.loadSource(this.config.src)}),t.detachMedia(),t.attachMedia(e.media),window.hls=t,Object.defineProperty(e.media,"quality",{get(){const{currentLevel:e,levels:t}=window.hls;return t&&t[e]?t[e].height:-1},set(t){if(e.config.quality.forced&&p(e.config.quality.onChange))e.config.quality.onChange(t);else if(-1===t)e.debug.log("Set quality to auto"),window.hls.nextLevel=-1;else{e.debug.log(`Set quality to manual: ${t}p`);const i=window.hls.levels.map(e=>e.height).indexOf(t);window.hls.currentLevel=i}G.call(e,e.media,"qualitychange",!1,{quality:t})}})}else this.provider=ge.html5,e.media.src=e.config.src}};function lt(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,G.call(this,this.media,e?"play":"pause"))}const ot={setup(){const e=this;H(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,We.call(e),h(window.Vimeo)?ot.ready.call(e):st(e.config.urls.vimeo.sdk).then(()=>{ot.ready.call(e)}).catch(t=>{e.debug.warn("Vimeo SDK (player.js) failed to load",t)})},ready(){const e=this,t=e.config.vimeo,{premium:i,referrerPolicy:s,...n}=t;i&&Object.assign(n,{controls:!1,sidedock:!1});const a=he({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative,...n});let l=e.media.getAttribute("src");C(l)&&(l=e.media.getAttribute(e.config.attributes.embed.id));const o=C(r=l)?null:u(Number(r))?r:r.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:r;var r;const c=I("iframe"),h=ie(e.config.urls.vimeo.iframe,o,a);c.setAttribute("src",h),c.setAttribute("allowfullscreen",""),c.setAttribute("allow","autoplay,fullscreen,picture-in-picture"),C(s)||c.setAttribute("referrerPolicy",s);const{poster:d}=e;if(i)c.setAttribute("data-poster",d),e.media=j(c,e.media);else{const t=I("div",{class:e.config.classNames.embedContainer,"data-poster":d});t.appendChild(c),e.media=j(t,e.media)}te(ie(e.config.urls.vimeo.api,h)).then(t=>{!C(t)&&t.thumbnail_url&&et.setPoster.call(e,t.thumbnail_url).catch(()=>{})}),e.embed=new window.Vimeo.Player(c,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>(lt.call(e,!0),e.embed.play()),e.media.pause=()=>(lt.call(e,!1),e.embed.pause()),e.media.stop=()=>{e.pause(),e.currentTime=0};let{currentTime:p}=e.media;Object.defineProperty(e.media,"currentTime",{get:()=>p,set(t){const{embed:i,media:s,paused:n,volume:a}=e,l=n&&!i.hasPlayed;s.seeking=!0,G.call(e,s,"seeking"),Promise.resolve(l&&i.setVolume(0)).then(()=>i.setCurrentTime(t)).then(()=>l&&i.pause()).then(()=>l&&i.setVolume(a)).catch(()=>{})}});let g=e.config.speed.selected;Object.defineProperty(e.media,"playbackRate",{get:()=>g,set(t){e.embed.setPlaybackRate(t).then(()=>{g=t,G.call(e,e.media,"ratechange")}).catch(()=>{e.options.speed=[1]})}});let{volume:f}=e.config;Object.defineProperty(e.media,"volume",{get:()=>f,set(t){e.embed.setVolume(t).then(()=>{f=t,G.call(e,e.media,"volumechange")})}});let{muted:b}=e.config;Object.defineProperty(e.media,"muted",{get:()=>b,set(t){const i=!!m(t)&&t;e.embed.setVolume(i?0:e.config.volume).then(()=>{b=i,G.call(e,e.media,"volumechange")})}});let v,{loop:w}=e.config;Object.defineProperty(e.media,"loop",{get:()=>w,set(t){const i=m(t)?t:e.config.loop.active;e.embed.setLoop(i).then(()=>{w=i})}}),e.embed.getVideoUrl().then(t=>{v=t,Xe.setDownloadUrl.call(e)}).catch(e=>{this.debug.warn(e)}),Object.defineProperty(e.media,"currentSrc",{get:()=>v}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then(t=>{const[i,s]=t;e.embed.ratio=[i,s],We.call(this)}),e.embed.setAutopause(e.config.autopause).then(t=>{e.config.autopause=t}),e.embed.getVideoTitle().then(t=>{e.config.title=t,et.setTitle.call(this)}),e.embed.getCurrentTime().then(t=>{p=t,G.call(e,e.media,"timeupdate")}),e.embed.getDuration().then(t=>{e.media.duration=t,G.call(e,e.media,"durationchange")}),e.embed.getTextTracks().then(t=>{e.media.textTracks=t,ue.setup.call(e)}),e.embed.on("cuechange",({cues:t=[]})=>{const i=t.map(e=>function(e){const t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.innerText}(e.text));ue.updateCues.call(e,i)}),e.embed.on("loaded",()=>{if(e.embed.getPaused().then(t=>{lt.call(e,!t),t||G.call(e,e.media,"playing")}),y(e.embed.element)&&e.supported.ui){e.embed.element.setAttribute("tabindex",-1)}}),e.embed.on("bufferstart",()=>{G.call(e,e.media,"waiting")}),e.embed.on("bufferend",()=>{G.call(e,e.media,"playing")}),e.embed.on("play",()=>{lt.call(e,!0),G.call(e,e.media,"playing")}),e.embed.on("pause",()=>{lt.call(e,!1)}),e.embed.on("timeupdate",t=>{e.media.seeking=!1,p=t.seconds,G.call(e,e.media,"timeupdate")}),e.embed.on("progress",t=>{e.media.buffered=t.percent,G.call(e,e.media,"progress"),1===parseInt(t.percent,10)&&G.call(e,e.media,"canplaythrough"),e.embed.getDuration().then(t=>{t!==e.media.duration&&(e.media.duration=t,G.call(e,e.media,"durationchange"))})}),e.embed.on("seeked",()=>{e.media.seeking=!1,G.call(e,e.media,"seeked")}),e.embed.on("ended",()=>{e.media.paused=!0,G.call(e,e.media,"ended")}),e.embed.on("error",t=>{e.media.error=t,G.call(e,e.media,"error")}),setTimeout(()=>et.build.call(e),0)}};function rt(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,G.call(this,this.media,e?"play":"pause"))}function ct(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}const ht={setup(){if(H(this.elements.wrapper,this.config.classNames.embed,!0),h(window.YT)&&p(window.YT.Player))ht.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{p(e)&&e(),ht.ready.call(this)},st(this.config.urls.youtube.sdk).catch(e=>{this.debug.warn("YouTube API failed to load",e)})}},getTitle(e){te(ie(this.config.urls.youtube.api,e)).then(e=>{if(h(e)){const{title:t,height:i,width:s}=e;this.config.title=t,et.setTitle.call(this),this.embed.ratio=[s,i]}We.call(this)}).catch(()=>{We.call(this)})},ready(){const e=this,t=e.media&&e.media.getAttribute("id");if(!C(t)&&t.startsWith("youtube-"))return;let i=e.media.getAttribute("src");C(i)&&(i=e.media.getAttribute(this.config.attributes.embed.id));const s=C(n=i)?null:n.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:n;var n;const a=`${e.provider}-${Math.floor(1e4*Math.random())}`;const{poster:l}=e,o=I("div",{id:a,"data-poster":l});e.media=j(o,e.media);const r=e=>`https://i.ytimg.com/vi/${s}/${e}default.jpg`;Ze(r("maxres"),121).catch(()=>Ze(r("sd"),121)).catch(()=>Ze(r("hq"))).then(t=>et.setPoster.call(e,t.src)).then(t=>{t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")}).catch(()=>{});const c=e.config.youtube;e.embed=new window.YT.Player(a,{videoId:s,host:ct(c),playerVars:M({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui?0:1,disablekb:1,playsinline:e.config.fullscreen.iosNative?0:1,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},c),events:{onError(t){if(!e.media.error){const i=t.data,s={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[i]||"An unknown error occured";e.media.error={code:i,message:s},G.call(e,e.media,"error")}},onPlaybackRateChange(t){const i=t.target;e.media.playbackRate=i.getPlaybackRate(),G.call(e,e.media,"ratechange")},onReady(t){if(p(e.media.play))return;const i=t.target;ht.getTitle.call(e,s),e.media.play=()=>{rt.call(e,!0),i.playVideo()},e.media.pause=()=>{rt.call(e,!1),i.pauseVideo()},e.media.stop=()=>{i.stopVideo()},e.media.duration=i.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:()=>Number(i.getCurrentTime()),set(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,G.call(e,e.media,"seeking"),i.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:()=>i.getPlaybackRate(),set(e){i.setPlaybackRate(e)}});let{volume:n}=e.config;Object.defineProperty(e.media,"volume",{get:()=>n,set(t){n=t,i.setVolume(100*n),G.call(e,e.media,"volumechange")}});let{muted:a}=e.config;Object.defineProperty(e.media,"muted",{get:()=>a,set(t){const s=m(t)?t:a;a=s,i[s?"mute":"unMute"](),G.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:()=>i.getVideoUrl()}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration});const l=i.getAvailablePlaybackRates();e.options.speed=l.filter(t=>e.config.speed.options.includes(t)),e.supported.ui&&e.media.setAttribute("tabindex",-1),G.call(e,e.media,"timeupdate"),G.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval(()=>{e.media.buffered=i.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&G.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),G.call(e,e.media,"canplaythrough"))},200),setTimeout(()=>et.build.call(e),50)},onStateChange(t){const i=t.target;clearInterval(e.timers.playing);switch(e.media.seeking&&[1,2].includes(t.data)&&(e.media.seeking=!1,G.call(e,e.media,"seeked")),t.data){case-1:G.call(e,e.media,"timeupdate"),e.media.buffered=i.getVideoLoadedFraction(),G.call(e,e.media,"progress");break;case 0:rt.call(e,!1),e.media.loop?(i.stopVideo(),i.playVideo()):G.call(e,e.media,"ended");break;case 1:e.config.autoplay||!e.media.paused||e.embed.hasPlayed?(rt.call(e,!0),G.call(e,e.media,"playing"),e.timers.playing=setInterval(()=>{G.call(e,e.media,"timeupdate")},50),e.media.duration!==i.getDuration()&&(e.media.duration=i.getDuration(),G.call(e,e.media,"durationchange"))):e.media.pause();break;case 2:e.muted||e.embed.unMute(),rt.call(e,!1);break;case 3:G.call(e,e.media,"waiting")}G.call(e,e.elements.container,"statechange",!1,{code:t.data})}}})}},ut={setup(){this.media?(H(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),H(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&H(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=I("div",{class:this.config.classNames.video}),x(this.media,this.elements.wrapper),this.elements.poster=I("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHlsjs?at.setup.call(this):this.isDashjs?nt.setup.call(this):this.isYouTube?ht.setup.call(this):this.isVimeo?ot.setup.call(this):this.isHTML5&&ze.setup.call(this)):this.debug.warn("No media element found!")}};class dt{constructor(e){this.player=e,this.config=e.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((e,t)=>{this.on("loaded",e),this.on("error",t)}),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!C(e.publisherId)||k(e.tagUrl))}load(){this.enabled&&(h(window.google)&&h(window.google.ima)?this.ready():st(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))}))}ready(){var e;this.enabled||((e=this).manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(()=>{this.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}get tagUrl(){const{config:e}=this;if(k(e.tagUrl))return e.tagUrl;return`https://go.aniview.com/api/adserver6/vast/?${he({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}setupIMA(){this.elements.container=I("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e=>this.onAdsManagerLoaded(e),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,e=>this.onAdError(e),!1),this.requestAds()}requestAds(){const{container:e}=this.player.elements;try{const t=new google.ima.AdsRequest;t.adTagUrl=this.tagUrl,t.linearAdSlotWidth=e.offsetWidth,t.linearAdSlotHeight=e.offsetHeight,t.nonLinearAdSlotWidth=e.offsetWidth,t.nonLinearAdSlotHeight=e.offsetHeight,t.forceNonLinearFullSlot=!1,t.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(t)}catch(e){this.onAdError(e)}}pollCountdown(e=!1){if(!e)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval(()=>{const e=Je(Math.max(this.manager.getRemainingTime(),0)),t=`${re.get("advertisement",this.player.config)} - ${e}`;this.elements.container.setAttribute("data-badge-text",t)},100)}onAdsManagerLoaded(e){if(!this.enabled)return;const t=new google.ima.AdsRenderingSettings;t.restoreCustomPlaybackStateOnAdBreakComplete=!0,t.enablePreloading=!0,this.manager=e.getAdsManager(this.player,t),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,e=>this.onAdError(e)),Object.keys(google.ima.AdEvent.Type).forEach(e=>{this.manager.addEventListener(google.ima.AdEvent.Type[e],e=>this.onAdEvent(e))}),this.trigger("loaded")}addCuePoints(){C(this.cuePoints)||this.cuePoints.forEach(e=>{if(0!==e&&-1!==e&&e<this.player.duration){const t=this.player.elements.progress;if(y(t)){const i=100/this.player.duration*e,s=I("span",{class:this.player.config.classNames.cues});s.style.left=`${i.toString()}%`,t.appendChild(s)}}})}onAdEvent(e){const{container:t}=this.player.elements,i=e.getAd(),s=e.getAdData();switch((e=>{G.call(this.player,this.player.media,`ads${e.replace(/_/g,"").toLowerCase()}`)})(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),i.isLinear()||(i.width=t.offsetWidth,i.height=t.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:s.adError&&this.player.debug.warn(`Non-fatal ad error: ${s.adError.getMessage()}`)}}onAdError(e){this.cancel(),this.player.debug.warn("Ads error",e)}listeners(){const{container:e}=this.player.elements;let t;this.player.on("canplay",()=>{this.addCuePoints()}),this.player.on("ended",()=>{this.loader.contentComplete()}),this.player.on("timeupdate",()=>{t=this.player.currentTime}),this.player.on("seeked",()=>{const e=this.player.currentTime;C(this.cuePoints)||this.cuePoints.forEach((i,s)=>{t<i&&i<e&&(this.manager.discardAdBreak(),this.cuePoints.splice(s,1))})}),window.addEventListener("resize",()=>{this.manager&&this.manager.resize(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL)})}play(){const{container:e}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then(()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(e){this.onAdError(e)}}).catch(()=>{})}resumeContent(){this.elements.container.style.zIndex="",this.playing=!1,Re(this.player.media.play())}pauseContent(){this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}cancel(){this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}loadAds(){this.managerPromise.then(()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise(e=>{this.on("loaded",e),this.player.debug.log(this.manager)}),this.initialized=!1,this.requestAds()}).catch(()=>{})}trigger(e,...t){const i=this.events[e];g(i)&&i.forEach(e=>{p(e)&&e.apply(this,t)})}on(e,t){return g(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this}startSafetyTimer(e,t){this.player.debug.log(`Safety timer invoked from: ${t}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")},e)}clearSafetyTimer(e){c(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${e}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)}}const mt={setup(){mt.ready.call(this)},ready(){const e=this;if(e.setState({api_embed:this.config.api_embed}),e.config.sharing)try{const t={method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({url:this.config.src})};fetch(`${this.states.api_embed}/link`,t).then(e=>e.json()).then(t=>{const i=`${this.states.api_embed}/${t.code}`;e.setState({shareLink:i,embed:`<iframe width="1280" height="720" src="${i}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; picture-in-picture" allowfullscreen></iframe>`})})}catch(e){this.debug.log(e)}}},pt=e=>{const t=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach(e=>{const i={};e.split(/\r\n|\n|\r/).forEach(e=>{if(u(i.startTime)){if(!C(e.trim())&&C(i.text)){const t=e.trim().split("#xywh=");[i.text]=t,t[1]&&([i.x,i.y,i.w,i.h]=t[1].split(","))}}else{const t=e.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);t&&(i.startTime=60*Number(t[1]||0)*60+60*Number(t[2])+Number(t[3])+Number(`0.${t[4]}`),i.endTime=60*Number(t[6]||0)*60+60*Number(t[7])+Number(t[8])+Number(`0.${t[9]}`))}}),i.text&&t.push(i)}),t},gt=(e,t)=>{const 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};class ft{constructor(e){this.player=e,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}load(){this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then(()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.loaded=!0)})}getThumbnails(){return new Promise(e=>{const{src:t}=this.player.config.previewThumbnails;if(C(t))throw new Error("Missing previewThumbnails.src config attribute");const i=()=>{this.thumbnails.sort((e,t)=>e.height-t.height),this.player.debug.log("Preview thumbnails",this.thumbnails),e()};if(p(t))t(e=>{this.thumbnails=e,i()});else{const e=(d(t)?[t]:t).map(e=>this.getThumbnail(e));Promise.all(e).then(i)}})}getThumbnail(e){return new Promise(t=>{te(e).then(i=>{const s={frames:pt(i),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));const n=new Image;n.onload=()=>{s.height=n.naturalHeight,s.width=n.naturalWidth,this.thumbnails.push(s),t()},n.src=s.urlPrefix+s.frames[0].text})})}startMove(e){if(this.loaded&&b(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{const 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=Je(this.seekTime)}this.showImageAtCurrentTime()}}endMove(){this.toggleThumbContainer(!1,!0)}startScrubbing(e){(c(e.button)||!1===e.button||0===e.button)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}endScrubbing(){this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):X.call(this.player,this.player.media,"timeupdate",()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}listeners(){this.player.on("play",()=>{this.toggleThumbContainer(!1,!0)}),this.player.on("seeked",()=>{this.toggleThumbContainer(!1)}),this.player.on("timeupdate",()=>{this.lastTime=this.player.media.currentTime})}render(){this.elements.thumb.container=I("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=I("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const e=I("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=I("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.container.appendChild(e),y(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=I("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}destroy(){this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}showImageAtCurrentTime(){this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const e=this.thumbnails[0].frames.findIndex(e=>this.seekTime>=e.startTime&&this.seekTime<=e.endTime),t=e>=0;let i=0;this.mouseDown||this.toggleThumbContainer(t),t&&(this.thumbnails.forEach((t,s)=>{this.loadedImages.includes(t.frames[e].text)&&(i=s)}),e!==this.showingThumb&&(this.showingThumb=e,this.loadImage(i)))}loadImage(e=0){const t=this.showingThumb,i=this.thumbnails[e],{urlPrefix:s}=i,n=i.frames[t],a=i.frames[t].text,l=s+a;if(this.currentImageElement&&this.currentImageElement.dataset.filename===a)this.showImage(this.currentImageElement,n,e,t,a,!1),this.currentImageElement.dataset.index=t,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const i=new Image;i.src=l,i.dataset.index=t,i.dataset.filename=a,this.showingThumbFilename=a,this.player.debug.log(`Loading image: ${l}`),i.onload=()=>this.showImage(i,n,e,t,a,!0),this.loadingImage=i,this.removeOldImages(i)}}showImage(e,t,i,s,n,a=!0){this.player.debug.log(`Showing thumb: ${n}. num: ${s}. qual: ${i}. newimg: ${a}`),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(n)||this.loadedImages.push(n)),this.preloadNearby(s,!0).then(this.preloadNearby(s,!1)).then(this.getHigherQuality(i,e,t,n))}removeOldImages(e){Array.from(this.currentImageContainer.children).forEach(t=>{if("img"!==t.tagName.toLowerCase())return;const i=this.usingSprites?500:1e3;if(t.dataset.index!==e.dataset.index&&!t.dataset.deleting){t.dataset.deleting=!0;const{currentImageContainer:e}=this;setTimeout(()=>{e.removeChild(t),this.player.debug.log(`Removing thumb: ${t.dataset.filename}`)},i)}})}preloadNearby(e,t=!0){return new Promise(i=>{setTimeout(()=>{const s=this.thumbnails[0].frames[e].text;if(this.showingThumbFilename===s){let n;n=t?this.thumbnails[0].frames.slice(e):this.thumbnails[0].frames.slice(0,e).reverse();let a=!1;n.forEach(e=>{const t=e.text;if(t!==s&&!this.loadedImages.includes(t)){a=!0,this.player.debug.log(`Preloading thumb filename: ${t}`);const{urlPrefix:e}=this.thumbnails[0],s=e+t,n=new Image;n.src=s,n.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${t}`),this.loadedImages.includes(t)||this.loadedImages.push(t),i()}}}),a||i()}},300)})}getHigherQuality(e,t,i,s){if(e<this.thumbnails.length-1){let n=t.naturalHeight;this.usingSprites&&(n=i.h),n<this.thumbContainerHeight&&setTimeout(()=>{this.showingThumbFilename===s&&(this.player.debug.log(`Showing higher quality thumb for: ${s}`),this.loadImage(e+1))},300)}}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=gt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}toggleThumbContainer(e=!1,t=!1){const i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)}toggleScrubbingContainer(e=!1){const t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)}determineContainerAutoSizing(){(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}setThumbContainerSizeAndPos(){if(this.sizeSpecifiedInCSS){if(this.elements.thumb.imageContainer.clientHeight>20&&this.elements.thumb.imageContainer.clientWidth<20){const e=Math.floor(this.elements.thumb.imageContainer.clientHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.width=`${e}px`}else if(this.elements.thumb.imageContainer.clientHeight<20&&this.elements.thumb.imageContainer.clientWidth>20){const e=Math.floor(this.elements.thumb.imageContainer.clientWidth/this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height=`${e}px`}}else{const e=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height=`${this.thumbContainerHeight}px`,this.elements.thumb.imageContainer.style.width=`${e}px`}this.setThumbContainerPos()}setThumbContainerPos(){const e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),{container:i}=this.elements.thumb,s=t.left-e.left+10,n=t.right-e.left-i.clientWidth-10;let a=this.mousePosX-e.left-i.clientWidth/2;a<s&&(a=s),a>n&&(a=n),i.style.left=`${a}px`}setScrubbingContainerSize(){const{width:e,height:t}=gt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${e}px`,this.elements.scrubbing.container.style.height=`${t}px`}setImageSizeAndOffset(e,t){if(!this.usingSprites)return;const i=this.thumbContainerHeight/t.h;e.style.height=e.naturalHeight*i+"px",e.style.width=e.naturalWidth*i+"px",e.style.left=`-${t.x*i}px`,e.style.top=`-${t.y*i}px`}}const yt={insertElements(e,t){d(t)?L(e,this.media,{src:t}):g(t)&&t.forEach(t=>{L(e,this.media,t)})},change(e){P(e,"sources.length")?(ze.cancelRequests.call(this),this.destroy.call(this,()=>{this.options.quality=[],$(this.media),this.media=null,y(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:t,type:i}=e,[{provider:s=ge.html5,src:n}]=t,a="html5"===s?i:"div",l="html5"===s?{}:{src:n};Object.assign(this,{provider:s,type:i,supported:W.check(i,s,this.config.playsinline),media:I(a,l)}),this.elements.container.appendChild(this.media),m(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),C(e.poster)||(this.poster=e.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),et.addStyleHook.call(this),this.isHTML5&&yt.insertElements.call(this,"source",t),this.config.title=e.title,ut.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&yt.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&et.build.call(this),this.isHTML5&&this.media.load(),C(e.previewThumbnails)||(Object.assign(this.config.previewThumbnails,e.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new ft(this))),this.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}};class bt{constructor(e,t){if(this.timers={},this.states={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=W.touch,this.media=e,d(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||f(this.media)||g(this.media))&&(this.media=this.media[0]),this.config=M({},de,bt.defaults,t||{},(()=>{try{return JSON.parse(this.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 we(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",W),c(this.media)||!y(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!W.check().api)return void this.debug.error("Setup failed: no support");const i=this.media.cloneNode(!0);i.autoplay=!1,this.elements.original=i;const s=this.media.tagName.toLowerCase();let n=null,a=null;switch(s){case"div":if(n=this.media.querySelector("iframe"),y(n)){if(a=ce(n.getAttribute("src")),this.provider=be(a.toString()),this.elements.container=this.media,this.media=n,this.elements.container.className="",a.search.length){const e=["1","true"];e.includes(a.searchParams.get("autoplay"))&&(this.config.autoplay=!0),e.includes(a.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=e.includes(a.searchParams.get("playsinline")),this.config.youtube.hl=a.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(C(this.provider)||!Object.keys(ge).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=ye;break;case"video":case"audio":this.type=s,this.provider=be(this.config.src)||ge.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=W.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new tt(this),this.storage=new Ke(this),this.media.plyr=this,this.setQualityMenu=Xe.setQualityMenu,this.setCaptionsMenu=Xe.setCaptionsMenu,this.updateSetting=Xe.updateSetting,y(this.elements.container)||(this.elements.container=I("div",{tabindex:0}),x(this.media,this.elements.container)),et.migrateStyles.call(this),et.addStyleHook.call(this),ut.setup.call(this),this.config.debug&&Q.call(this,this.elements.container,this.config.events.join(" "),e=>{this.debug.log(`event: ${e.type}`)}),this.fullscreen=new Ge(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&et.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new dt(this)),this.isHTML5&&this.config.autoplay&&setTimeout(()=>Re(this.play()),10),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new ft(this)),this.config.sharing&&mt.setup.call(this)):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===ge.html5||ge.hlsjs||ge.dashjs}get isHlsjs(){return this.provider===ge.hlsjs}get isDashjs(){return this.provider===ge.dashjs}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===ge.youtube}get isVimeo(){return this.provider===ge.vimeo}get isVideo(){return this.type===ye}get isAudio(){return this.type===fe}setState(e={}){M(this.states,e)}play(){return p(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>Re(this.media.play())),this.media.play()):null}pause(){return this.playing&&p(this.media.pause)?this.media.pause():null}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&0===this.currentTime)}get ended(){return Boolean(this.media.ended)}togglePlay(e){return(m(e)?e:!this.playing)?this.play():this.pause()}stop(){this.isHTML5?(this.pause(),this.restart()):p(this.media.stop)&&this.media.stop()}restart(){this.currentTime=0}rewind(e){this.currentTime-=u(e)?e:this.config.seekTime}forward(e){this.currentTime+=u(e)?e:this.config.seekTime}set currentTime(e){if(!this.duration)return;const t=u(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return u(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const e=parseFloat(this.config.duration),t=(this.media||{}).duration,i=u(t)&&t!==1/0?t:0;return e||i}set volume(e){let t=e;d(t)&&(t=Number(t)),u(t)||(t=this.storage.get("volume")),u(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!C(e)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}increaseVolume(e){const t=this.media.muted?0:this.volume;this.volume=t+(u(e)?e:0)}decreaseVolume(e){this.increaseVolume(-e)}set muted(e){let t=e;m(t)||(t=this.storage.get("muted")),m(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}set speed(e){let t=null;u(e)&&(t=e),u(t)||(t=this.storage.get("speed")),u(t)||(t=this.config.speed.selected);const{minimumSpeed:i,maximumSpeed:s}=this;t=function(e=0,t=0,i=255){return Math.min(Math.max(e,t),i)}(t,i,s),this.config.speed.selected=t,setTimeout(()=>{this.media.playbackRate=t},0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const t=this.config.quality,i=this.options.quality;if(!i.length)return;let s=[!C(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(u),n=!0;if(!i.includes(s)){const e=function(e,t){return g(e)&&e.length?e.reduce((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e):null}(i,s);this.debug.warn(`Unsupported quality option: ${s}, using ${e} instead`),s=e,n=!1}t.selected=s,this.media.quality=s,n&&this.storage.set({quality:s})}get quality(){return this.media.quality}set loop(e){const t=m(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return Boolean(this.media.loop)}set source(e){yt.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return k(e)?e:this.source}set download(e){k(e)&&(this.config.urls.download=e,Xe.setDownloadUrl.call(this))}set poster(e){this.isVideo?et.setPoster.call(this,e,!1).catch(()=>{}):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=Be(Ue.call(this));return g(e)?e.join(":"):e}set ratio(e){this.isVideo?d(e)&&Ve(e)?(this.config.ratio=e,We.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){const t=m(e)?e:this.config.autoplay;this.config.autoplay=t}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(e){ue.toggle.call(this,e,!1)}set currentTrack(e){ue.set.call(this,e,!1)}get currentTrack(){const{toggled:e,currentTrack:t}=this.captions;return e?t:-1}set language(e){ue.setLanguage.call(this,e,!1)}get language(){return(ue.getCurrentTrack.call(this)||{}).language}set pip(e){if(!W.pip)return;const t=m(e)?e:!this.pip;p(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?me:pe),p(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return W.pip?C(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===me:null}airplay(){W.airplay&&this.media.webkitShowPlaybackTargetPicker()}toggleControls(e){if(this.supported.ui&&!this.isAudio){const t=D(this.elements.container,this.config.classNames.hideControls),i=void 0===e?void 0:!e,s=H(this.elements.container,this.config.classNames.hideControls,i);if(s&&g(this.config.controls)&&this.config.controls.includes("settings")&&!C(this.config.settings)&&Xe.toggleMenu.call(this,!1),s!==t){const e=s?"controlshidden":"controlsshown";G.call(this,this.media,e)}return!s}return!1}on(e,t){Q.call(this,this.elements.container,e,t)}once(e,t){X.call(this,this.elements.container,e,t)}off(e,t){J(this.elements.container,e,t)}destroy(e,t=!1){if(!this.ready)return;const i=()=>{document.body.style.overflow="",this.embed=null,t?(Object.keys(this.elements).length&&($(this.elements.buttons.play),$(this.elements.captions),$(this.elements.controls),$(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),p(e)&&e()):(Z.call(this),j(this.elements.original,this.elements.container),G.call(this,this.elements.original,"destroyed",!0),p(e)&&e.call(this.elements.original),this.ready=!1,setTimeout(()=>{this.elements=null,this.media=null},200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(et.toggleNativeControls.call(this,!0),i()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&p(this.embed.destroy)&&this.embed.destroy(),i()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(i),setTimeout(i,200))}supports(e){return W.mime.call(this,e)}static supported(e,t,i){return W.check(e,t,i)}static loadSprite(e,t){return Ye(e,t)}static setup(e,t={}){let i=null;return d(e)?i=Array.from(document.querySelectorAll(e)):f(e)?i=Array.from(e):g(e)&&(i=e.filter(y)),C(i)?null:i.map(e=>new bt(e,t))}}var vt;return bt.defaults=(vt=de,JSON.parse(JSON.stringify(vt))),bt});
4
2
  //# sourceMappingURL=plyr.min.js.map