Advertisement
zhirzh

Untitled

Feb 9th, 2018
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ! function (e, t) {
  2.     "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define("Plyr", t) : e.Plyr = t()
  3. }(this, function () {
  4.     "use strict";
  5.     var e, t, i = {
  6.             html5: "html5",
  7.             youtube: "youtube",
  8.             vimeo: "vimeo"
  9.         },
  10.         n = {
  11.             audio: "audio",
  12.             video: "video"
  13.         },
  14.         s = {
  15.             enabled: !0,
  16.             title: "",
  17.             debug: !1,
  18.             autoplay: !1,
  19.             autopause: !0,
  20.             seekTime: 10,
  21.             volume: 1,
  22.             muted: !1,
  23.             duration: null,
  24.             displayDuration: !0,
  25.             invertTime: !0,
  26.             toggleInvert: !0,
  27.             ratio: "16:9",
  28.             clickToPlay: !0,
  29.             hideControls: !0,
  30.             showPosterOnEnd: !1,
  31.             disableContextMenu: !0,
  32.             loadSprite: !0,
  33.             iconPrefix: "plyr",
  34.             iconUrl: "https://cdn.plyr.io/3.0.0-beta.11/plyr.svg",
  35.             blankVideo: "https://cdn.plyr.io/static/blank.mp4",
  36.             quality: {
  37.                 default: "default",
  38.                 options: ["hd2160", "hd1440", "hd1080", "hd720", "large", "medium", "small", "tiny", "default"]
  39.             },
  40.             loop: {
  41.                 active: !1
  42.             },
  43.             speed: {
  44.                 selected: 1,
  45.                 options: [.5, .75, 1, 1.25, 1.5, 1.75, 2]
  46.             },
  47.             keyboard: {
  48.                 focused: !0,
  49.                 global: !1
  50.             },
  51.             tooltips: {
  52.                 controls: !1,
  53.                 seek: !0
  54.             },
  55.             captions: {
  56.                 active: !1,
  57.                 language: window.navigator.language.split("-")[0]
  58.             },
  59.             fullscreen: {
  60.                 enabled: !0,
  61.                 fallback: !0
  62.             },
  63.             storage: {
  64.                 enabled: !0,
  65.                 key: "plyr"
  66.             },
  67.             controls: ["play-large", "play", "progress", "current-time", "mute", "volume", "captions", "settings", "pip", "airplay", "fullscreen"],
  68.             settings: ["captions", "quality", "speed"],
  69.             i18n: {
  70.                 restart: "Restart",
  71.                 rewind: "Rewind {seektime} secs",
  72.                 play: "Play",
  73.                 pause: "Pause",
  74.                 forward: "Forward {seektime} secs",
  75.                 seek: "Seek",
  76.                 played: "Played",
  77.                 buffered: "Buffered",
  78.                 currentTime: "Current time",
  79.                 duration: "Duration",
  80.                 volume: "Volume",
  81.                 mute: "Mute",
  82.                 unmute: "Unmute",
  83.                 enableCaptions: "Enable captions",
  84.                 disableCaptions: "Disable captions",
  85.                 enterFullscreen: "Enter fullscreen",
  86.                 exitFullscreen: "Exit fullscreen",
  87.                 frameTitle: "Player for {title}",
  88.                 captions: "Captions",
  89.                 settings: "Settings",
  90.                 speed: "Speed",
  91.                 quality: "Quality",
  92.                 loop: "Loop",
  93.                 start: "Start",
  94.                 end: "End",
  95.                 all: "All",
  96.                 reset: "Reset",
  97.                 none: "None",
  98.                 disabled: "Disabled",
  99.                 advertisment: "Ad"
  100.             },
  101.             urls: {
  102.                 vimeo: {
  103.                     api: "https://player.vimeo.com/api/player.js"
  104.                 },
  105.                 youtube: {
  106.                     api: "https://www.youtube.com/iframe_api"
  107.                 },
  108.                 googleIMA: {
  109.                     api: "https://imasdk.googleapis.com/js/sdkloader/ima3.js"
  110.                 }
  111.             },
  112.             listeners: {
  113.                 seek: null,
  114.                 play: null,
  115.                 pause: null,
  116.                 restart: null,
  117.                 rewind: null,
  118.                 forward: null,
  119.                 mute: null,
  120.                 volume: null,
  121.                 captions: null,
  122.                 fullscreen: null,
  123.                 pip: null,
  124.                 airplay: null,
  125.                 speed: null,
  126.                 quality: null,
  127.                 loop: null,
  128.                 language: null
  129.             },
  130.             events: ["ended", "progress", "stalled", "playing", "waiting", "canplay", "canplaythrough", "loadstart", "loadeddata", "loadedmetadata", "timeupdate", "volumechange", "play", "pause", "error", "seeking", "seeked", "emptied", "ratechange", "cuechange", "enterfullscreen", "exitfullscreen", "captionsenabled", "captionsdisabled", "languagechange", "controlshidden", "controlsshown", "ready", "statechange", "qualitychange", "qualityrequested", "adsloaded", "adscontentpause", "adsconentresume", "adstarted", "adsmidpoint", "adscomplete", "adsallcomplete", "adsimpression", "adsclick"],
  131.             selectors: {
  132.                 editable: "input, textarea, select, [contenteditable]",
  133.                 container: ".plyr",
  134.                 controls: {
  135.                     container: null,
  136.                     wrapper: ".plyr__controls"
  137.                 },
  138.                 labels: "[data-plyr]",
  139.                 buttons: {
  140.                     play: '[data-plyr="play"]',
  141.                     pause: '[data-plyr="pause"]',
  142.                     restart: '[data-plyr="restart"]',
  143.                     rewind: '[data-plyr="rewind"]',
  144.                     forward: '[data-plyr="fast-forward"]',
  145.                     mute: '[data-plyr="mute"]',
  146.                     captions: '[data-plyr="captions"]',
  147.                     fullscreen: '[data-plyr="fullscreen"]',
  148.                     pip: '[data-plyr="pip"]',
  149.                     airplay: '[data-plyr="airplay"]',
  150.                     settings: '[data-plyr="settings"]',
  151.                     loop: '[data-plyr="loop"]'
  152.                 },
  153.                 inputs: {
  154.                     seek: '[data-plyr="seek"]',
  155.                     volume: '[data-plyr="volume"]',
  156.                     speed: '[data-plyr="speed"]',
  157.                     language: '[data-plyr="language"]',
  158.                     quality: '[data-plyr="quality"]'
  159.                 },
  160.                 display: {
  161.                     currentTime: ".plyr__time--current",
  162.                     duration: ".plyr__time--duration",
  163.                     buffer: ".plyr__progress--buffer",
  164.                     played: ".plyr__progress--played",
  165.                     loop: ".plyr__progress--loop",
  166.                     volume: ".plyr__volume--display"
  167.                 },
  168.                 progress: ".plyr__progress",
  169.                 captions: ".plyr__captions",
  170.                 menu: {
  171.                     quality: ".js-plyr__menu__list--quality"
  172.                 }
  173.             },
  174.             classNames: {
  175.                 video: "plyr__video-wrapper",
  176.                 embed: "plyr__video-embed",
  177.                 ads: "plyr__ads",
  178.                 control: "plyr__control",
  179.                 type: "plyr--{0}",
  180.                 provider: "plyr--{0}",
  181.                 stopped: "plyr--stopped",
  182.                 playing: "plyr--playing",
  183.                 loading: "plyr--loading",
  184.                 error: "plyr--has-error",
  185.                 hover: "plyr--hover",
  186.                 tooltip: "plyr__tooltip",
  187.                 cues: "plyr__cues",
  188.                 hidden: "plyr__sr-only",
  189.                 hideControls: "plyr--hide-controls",
  190.                 isIos: "plyr--is-ios",
  191.                 isTouch: "plyr--is-touch",
  192.                 uiSupported: "plyr--full-ui",
  193.                 noTransition: "plyr--no-transition",
  194.                 menu: {
  195.                     value: "plyr__menu__value",
  196.                     badge: "plyr__badge",
  197.                     open: "plyr--menu-open"
  198.                 },
  199.                 captions: {
  200.                     enabled: "plyr--captions-enabled",
  201.                     active: "plyr--captions-active"
  202.                 },
  203.                 fullscreen: {
  204.                     enabled: "plyr--fullscreen-enabled",
  205.                     fallback: "plyr--fullscreen-fallback"
  206.                 },
  207.                 pip: {
  208.                     supported: "plyr--pip-supported",
  209.                     active: "plyr--pip-active"
  210.                 },
  211.                 airplay: {
  212.                     supported: "plyr--airplay-supported",
  213.                     active: "plyr--airplay-active"
  214.                 },
  215.                 tabFocus: "plyr__tab-focus"
  216.             },
  217.             attributes: {
  218.                 embed: {
  219.                     provider: "data-plyr-provider",
  220.                     id: "data-plyr-embed-id"
  221.                 }
  222.             },
  223.             keys: {
  224.                 google: null
  225.             },
  226.             ads: {
  227.                 enabled: !1
  228.             }
  229.         },
  230.         a = (function () {
  231.             function e(e) {
  232.                 this.value = e
  233.             }
  234.  
  235.             function t(t) {
  236.                 var i, n;
  237.  
  238.                 function s(i, n) {
  239.                     try {
  240.                         var o = t[i](n),
  241.                             l = o.value;
  242.                         l instanceof e ? Promise.resolve(l.value).then(function (e) {
  243.                             s("next", e)
  244.                         }, function (e) {
  245.                             s("throw", e)
  246.                         }) : a(o.done ? "return" : "normal", o.value)
  247.                     } catch (e) {
  248.                         a("throw", e)
  249.                     }
  250.                 }
  251.  
  252.                 function a(e, t) {
  253.                     switch (e) {
  254.                         case "return":
  255.                             i.resolve({
  256.                                 value: t,
  257.                                 done: !0
  258.                             });
  259.                             break;
  260.                         case "throw":
  261.                             i.reject(t);
  262.                             break;
  263.                         default:
  264.                             i.resolve({
  265.                                 value: t,
  266.                                 done: !1
  267.                             })
  268.                     }(i = i.next) ? s(i.key, i.arg): n = null
  269.                 }
  270.                 this._invoke = function (e, t) {
  271.                     return new Promise(function (a, o) {
  272.                         var l = {
  273.                             key: e,
  274.                             arg: t,
  275.                             resolve: a,
  276.                             reject: o,
  277.                             next: null
  278.                         };
  279.                         n ? n = n.next = l : (i = n = l, s(e, t))
  280.                     })
  281.                 }, "function" != typeof t.return && (this.return = void 0)
  282.             }
  283.             "function" == typeof Symbol && Symbol.asyncIterator && (t.prototype[Symbol.asyncIterator] = function () {
  284.                 return this
  285.             }), t.prototype.next = function (e) {
  286.                 return this._invoke("next", e)
  287.             }, t.prototype.throw = function (e) {
  288.                 return this._invoke("throw", e)
  289.             }, t.prototype.return = function (e) {
  290.                 return this._invoke("return", e)
  291.             }
  292.         }(), function (e, t) {
  293.             if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  294.         }),
  295.         o = function () {
  296.             function e(e, t) {
  297.                 for (var i = 0; i < t.length; i++) {
  298.                     var n = t[i];
  299.                     n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
  300.                 }
  301.             }
  302.             return function (t, i, n) {
  303.                 return i && e(t.prototype, i), n && e(t, n), t
  304.             }
  305.         }(),
  306.         l = function (e, t, i) {
  307.             return t in e ? Object.defineProperty(e, t, {
  308.                 value: i,
  309.                 enumerable: !0,
  310.                 configurable: !0,
  311.                 writable: !0
  312.             }) : e[t] = i, e
  313.         },
  314.         r = function () {
  315.             return function (e, t) {
  316.                 if (Array.isArray(e)) return e;
  317.                 if (Symbol.iterator in Object(e)) return function (e, t) {
  318.                     var i = [],
  319.                         n = !0,
  320.                         s = !1,
  321.                         a = void 0;
  322.                     try {
  323.                         for (var o, l = e[Symbol.iterator](); !(n = (o = l.next()).done) && (i.push(o.value), !t || i.length !== t); n = !0);
  324.                     } catch (e) {
  325.                         s = !0, a = e
  326.                     } finally {
  327.                         try {
  328.                             !n && l.return && l.return()
  329.                         } finally {
  330.                             if (s) throw a
  331.                         }
  332.                     }
  333.                     return i
  334.                 }(e, t);
  335.                 throw new TypeError("Invalid attempt to destructure non-iterable instance")
  336.             }
  337.         }(),
  338.         c = {
  339.             is: {
  340.                 plyr: function (e) {
  341.                     return this.instanceof(e, window.Plyr)
  342.                 },
  343.                 object: function (e) {
  344.                     return this.getConstructor(e) === Object
  345.                 },
  346.                 number: function (e) {
  347.                     return this.getConstructor(e) === Number && !Number.isNaN(e)
  348.                 },
  349.                 string: function (e) {
  350.                     return this.getConstructor(e) === String
  351.                 },
  352.                 boolean: function (e) {
  353.                     return this.getConstructor(e) === Boolean
  354.                 },
  355.                 function: function (e) {
  356.                     return this.getConstructor(e) === Function
  357.                 },
  358.                 array: function (e) {
  359.                     return !this.nullOrUndefined(e) && Array.isArray(e)
  360.                 },
  361.                 weakMap: function (e) {
  362.                     return this.instanceof(e, window.WeakMap)
  363.                 },
  364.                 nodeList: function (e) {
  365.                     return this.instanceof(e, window.NodeList)
  366.                 },
  367.                 element: function (e) {
  368.                     return this.instanceof(e, window.Element)
  369.                 },
  370.                 textNode: function (e) {
  371.                     return this.getConstructor(e) === Text
  372.                 },
  373.                 event: function (e) {
  374.                     return this.instanceof(e, window.Event)
  375.                 },
  376.                 cue: function (e) {
  377.                     return this.instanceof(e, window.TextTrackCue) || this.instanceof(e, window.VTTCue)
  378.                 },
  379.                 track: function (e) {
  380.                     return this.instanceof(e, TextTrack) || !this.nullOrUndefined(e) && this.string(e.kind)
  381.                 },
  382.                 url: function (e) {
  383.                     return !this.nullOrUndefined(e) && /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(e)
  384.                 },
  385.                 nullOrUndefined: function (e) {
  386.                     return null === e || void 0 === e
  387.                 },
  388.                 empty: function (e) {
  389.                     return this.nullOrUndefined(e) || (this.string(e) || this.array(e) || this.nodeList(e)) && !e.length || this.object(e) && !Object.keys(e).length
  390.                 },
  391.                 instanceof: function (e, t) {
  392.                     return Boolean(e && t && e instanceof t)
  393.                 },
  394.                 getConstructor: function (e) {
  395.                     return this.nullOrUndefined(e) ? null : e.constructor
  396.                 }
  397.             },
  398.             getBrowser: function () {
  399.                 return {
  400.                     isIE: !!document.documentMode,
  401.                     isWebkit: "WebkitAppearance" in document.documentElement.style && !/Edge/.test(navigator.userAgent),
  402.                     isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),
  403.                     isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)
  404.                 }
  405.             },
  406.             fetch: function (e) {
  407.                 return new Promise(function (t, i) {
  408.                     try {
  409.                         var n = new XMLHttpRequest;
  410.                         if (!("withCredentials" in n)) return;
  411.                         n.addEventListener("load", function () {
  412.                             try {
  413.                                 t(JSON.parse(n.responseText))
  414.                             } catch (e) {
  415.                                 t(n.responseText)
  416.                             }
  417.                         }), n.addEventListener("error", function () {
  418.                             throw new Error(n.statusText)
  419.                         }), n.open("GET", e, !0), n.send()
  420.                     } catch (e) {
  421.                         i(e)
  422.                     }
  423.                 })
  424.             },
  425.             loadScript: function (e, t, i) {
  426.                 var n = document.querySelector('script[src="' + e + '"]');
  427.                 if (null !== n) return n.callbacks = n.callbacks || [], void n.callbacks.push(t);
  428.                 var s = document.createElement("script");
  429.                 s.callbacks = s.callbacks || [], s.callbacks.push(t), s.errors = s.errors || [], s.errors.push(i), c.is.function(t) && s.addEventListener("load", function (e) {
  430.                     s.callbacks.forEach(function (t) {
  431.                         return t.call(null, e)
  432.                     }), s.callbacks = null
  433.                 }, !1), s.addEventListener("error", function (e) {
  434.                     s.errors.forEach(function (t) {
  435.                         return t.call(null, e)
  436.                     }), s.errors = null
  437.                 }, !1), s.src = e;
  438.                 var a = document.getElementsByTagName("script")[0];
  439.                 a.parentNode.insertBefore(s, a)
  440.             },
  441.             loadSprite: function (e, t) {
  442.                 if (c.is.string(e)) {
  443.                     var i = c.is.string(t);
  444.                     if (!i || !document.querySelectorAll("#" + t).length) {
  445.                         var n = document.createElement("div");
  446.                         if (c.toggleHidden(n, !0), i && n.setAttribute("id", t), u.storage) {
  447.                             var s = window.localStorage.getItem("cache-" + t);
  448.                             if (null !== s) {
  449.                                 var a = JSON.parse(s);
  450.                                 return void o.call(n, a.content)
  451.                             }
  452.                         }
  453.                         c.fetch(e).then(function (e) {
  454.                             c.is.empty(e) || (u.storage && window.localStorage.setItem("cache-" + t, JSON.stringify({
  455.                                 content: e
  456.                             })), o.call(n, e))
  457.                         }).catch(function () {})
  458.                     }
  459.                 }
  460.  
  461.                 function o(e) {
  462.                     this.innerHTML = e, document.body.insertBefore(this, document.body.childNodes[0])
  463.                 }
  464.             },
  465.             generateId: function (e) {
  466.                 return e + "-" + Math.floor(1e4 * Math.random())
  467.             },
  468.             inFrame: function () {
  469.                 try {
  470.                     return window.self !== window.top
  471.                 } catch (e) {
  472.                     return !0
  473.                 }
  474.             },
  475.             wrap: function (e, t) {
  476.                 var i = e.length ? e : [e];
  477.                 Array.from(i).reverse().forEach(function (e, i) {
  478.                     var n = i > 0 ? t.cloneNode(!0) : t,
  479.                         s = e.parentNode,
  480.                         a = e.nextSibling;
  481.                     n.appendChild(e), a ? s.insertBefore(n, a) : s.appendChild(n)
  482.                 })
  483.             },
  484.             createElement: function (e, t, i) {
  485.                 var n = document.createElement(e);
  486.                 return c.is.object(t) && c.setAttributes(n, t), c.is.string(i) && (n.textContent = i), n
  487.             },
  488.             insertAfter: function (e, t) {
  489.                 t.parentNode.insertBefore(e, t.nextSibling)
  490.             },
  491.             insertElement: function (e, t, i, n) {
  492.                 t.appendChild(c.createElement(e, i, n))
  493.             },
  494.             removeElement: function (e) {
  495.                 return c.is.element(e) && c.is.element(e.parentNode) ? (e.parentNode.removeChild(e), e) : null
  496.             },
  497.             emptyElement: function (e) {
  498.                 for (var t = e.childNodes.length; t > 0;) e.removeChild(e.lastChild), t -= 1
  499.             },
  500.             replaceElement: function (e, t) {
  501.                 return c.is.element(t) && c.is.element(t.parentNode) && c.is.element(e) ? (t.parentNode.replaceChild(e, t), e) : null
  502.             },
  503.             setAttributes: function (e, t) {
  504.                 c.is.element(e) && !c.is.empty(t) && Object.keys(t).forEach(function (i) {
  505.                     e.setAttribute(i, t[i])
  506.                 })
  507.             },
  508.             getAttributesFromSelector: function (e, t) {
  509.                 if (!c.is.string(e) || c.is.empty(e)) return {};
  510.                 var i = {},
  511.                     n = t;
  512.                 return e.split(",").forEach(function (e) {
  513.                     var t = e.trim(),
  514.                         s = t.replace(".", ""),
  515.                         a = t.replace(/[[\]]/g, "").split("="),
  516.                         o = a[0],
  517.                         l = a.length > 1 ? a[1].replace(/["']/g, "") : "";
  518.                     switch (t.charAt(0)) {
  519.                         case ".":
  520.                             c.is.object(n) && c.is.string(n.class) && (n.class += " " + s), i.class = s;
  521.                             break;
  522.                         case "#":
  523.                             i.id = t.replace("#", "");
  524.                             break;
  525.                         case "[":
  526.                             i[o] = l
  527.                     }
  528.                 }), i
  529.             },
  530.             toggleClass: function (e, t, i) {
  531.                 if (c.is.element(e)) {
  532.                     var n = e.classList.contains(t);
  533.                     return e.classList[i ? "add" : "remove"](t), i && !n || !i && n
  534.                 }
  535.                 return null
  536.             },
  537.             hasClass: function (e, t) {
  538.                 return c.is.element(e) && e.classList.contains(t)
  539.             },
  540.             toggleHidden: function (e, t) {
  541.                 c.is.element(e) && (t ? e.setAttribute("hidden", "") : e.removeAttribute("hidden"))
  542.             },
  543.             matches: function (e, t) {
  544.                 var i = {
  545.                     Element: Element
  546.                 };
  547.                 var n = i.matches || i.webkitMatchesSelector || i.mozMatchesSelector || i.msMatchesSelector || function () {
  548.                     return Array.from(document.querySelectorAll(t)).includes(this)
  549.                 };
  550.                 return n.call(e, t)
  551.             },
  552.             getElements: function (e) {
  553.                 return this.elements.container.querySelectorAll(e)
  554.             },
  555.             getElement: function (e) {
  556.                 return this.elements.container.querySelector(e)
  557.             },
  558.             findElements: function () {
  559.                 try {
  560.                     return this.elements.controls = c.getElement.call(this, this.config.selectors.controls.wrapper), this.elements.buttons = {
  561.                         play: c.getElements.call(this, this.config.selectors.buttons.play),
  562.                         pause: c.getElement.call(this, this.config.selectors.buttons.pause),
  563.                         restart: c.getElement.call(this, this.config.selectors.buttons.restart),
  564.                         rewind: c.getElement.call(this, this.config.selectors.buttons.rewind),
  565.                         forward: c.getElement.call(this, this.config.selectors.buttons.forward),
  566.                         mute: c.getElement.call(this, this.config.selectors.buttons.mute),
  567.                         pip: c.getElement.call(this, this.config.selectors.buttons.pip),
  568.                         airplay: c.getElement.call(this, this.config.selectors.buttons.airplay),
  569.                         settings: c.getElement.call(this, this.config.selectors.buttons.settings),
  570.                         captions: c.getElement.call(this, this.config.selectors.buttons.captions),
  571.                         fullscreen: c.getElement.call(this, this.config.selectors.buttons.fullscreen)
  572.                     }, this.elements.progress = c.getElement.call(this, this.config.selectors.progress), this.elements.inputs = {
  573.                         seek: c.getElement.call(this, this.config.selectors.inputs.seek),
  574.                         volume: c.getElement.call(this, this.config.selectors.inputs.volume)
  575.                     }, this.elements.display = {
  576.                         buffer: c.getElement.call(this, this.config.selectors.display.buffer),
  577.                         duration: c.getElement.call(this, this.config.selectors.display.duration),
  578.                         currentTime: c.getElement.call(this, this.config.selectors.display.currentTime)
  579.                     }, c.is.element(this.elements.progress) && (this.elements.display.seekTooltip = this.elements.progress.querySelector("." + this.config.classNames.tooltip)), !0
  580.                 } catch (e) {
  581.                     return this.debug.warn("It looks like there is a problem with your custom controls HTML", e), this.toggleNativeControls(!0), !1
  582.                 }
  583.             },
  584.             getFocusElement: function () {
  585.                 var e = document.activeElement;
  586.                 return e = e && e !== document.body ? document.querySelector(":focus") : null
  587.             },
  588.             trapFocus: function () {
  589.                 var e = this,
  590.                     t = c.getElements.call(this, "button:not(:disabled), input:not(:disabled), [tabindex]"),
  591.                     i = t[0],
  592.                     n = t[t.length - 1];
  593.                 c.on(this.elements.container, "keydown", function (t) {
  594.                     if ("Tab" === t.key && 9 === t.keyCode && e.fullscreen.active) {
  595.                         var s = c.getFocusElement();
  596.                         s !== n || t.shiftKey ? s === i && t.shiftKey && (n.focus(), t.preventDefault()) : (i.focus(), t.preventDefault())
  597.                     }
  598.                 }, !1)
  599.             },
  600.             toggleListener: function (e, t, i, n, s, a) {
  601.                 if (!c.is.nullOrUndefined(e))
  602.                     if (c.is.nodeList(e)) Array.from(e).forEach(function (e) {
  603.                         e instanceof Node && c.toggleListener.call(null, e, t, i, n, s, a)
  604.                     });
  605.                     else {
  606.                         var o = t.split(" "),
  607.                             l = !!c.is.boolean(a) && a;
  608.                         u.passiveListeners && (l = {
  609.                             passive: !c.is.boolean(s) || s,
  610.                             capture: !!c.is.boolean(a) && a
  611.                         }), o.forEach(function (t) {
  612.                             e[n ? "addEventListener" : "removeEventListener"](t, i, l)
  613.                         })
  614.                     }
  615.             },
  616.             on: function (e, t, i, n, s) {
  617.                 c.toggleListener(e, t, i, !0, n, s)
  618.             },
  619.             off: function (e, t, i, n, s) {
  620.                 c.toggleListener(e, t, i, !1, n, s)
  621.             },
  622.             dispatchEvent: function (e, t, i, n) {
  623.                 if (e && t) {
  624.                     var s = new CustomEvent(t, {
  625.                         bubbles: !!c.is.boolean(i) && i,
  626.                         detail: Object.assign({}, n, {
  627.                             plyr: c.is.plyr(this) ? this : null
  628.                         })
  629.                     });
  630.                     e.dispatchEvent(s)
  631.                 }
  632.             },
  633.             toggleState: function (e, t) {
  634.                 if (c.is.element(e)) {
  635.                     var i = "true" === e.getAttribute("aria-pressed"),
  636.                         n = c.is.boolean(t) ? t : !i;
  637.                     e.setAttribute("aria-pressed", n)
  638.                 }
  639.             },
  640.             getPercentage: function (e, t) {
  641.                 return 0 === e || 0 === t || Number.isNaN(e) || Number.isNaN(t) ? 0 : (e / t * 100).toFixed(2)
  642.             },
  643.             getHours: function (e) {
  644.                 return parseInt(e / 60 / 60 % 60, 10)
  645.             },
  646.             getMinutes: function (e) {
  647.                 return parseInt(e / 60 % 60, 10)
  648.             },
  649.             getSeconds: function (e) {
  650.                 return parseInt(e % 60, 10)
  651.             },
  652.             formatTime: function () {
  653.                 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
  654.                     t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
  655.                     i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
  656.                 if (!c.is.number(e)) return this.formatTime(null, t, i);
  657.                 var n = function (e) {
  658.                         return ("0" + e).slice(-2)
  659.                     },
  660.                     s = this.getHours(e),
  661.                     a = this.getMinutes(e),
  662.                     o = this.getSeconds(e);
  663.                 return t || s > 0 ? s += ":" : s = "", (i ? "-" : "") + s + n(a) + ":" + n(o)
  664.             },
  665.             extend: function () {
  666.                 for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, t = arguments.length, i = Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++) i[n - 1] = arguments[n];
  667.                 if (!i.length) return e;
  668.                 var s = i.shift();
  669.                 return c.is.object(s) ? (Object.keys(s).forEach(function (t) {
  670.                     c.is.object(s[t]) ? (Object.keys(e).includes(t) || Object.assign(e, l({}, t, {})), c.extend(e[t], s[t])) : Object.assign(e, l({}, t, s[t]))
  671.                 }), c.extend.apply(c, [e].concat(function (e) {
  672.                     if (Array.isArray(e)) {
  673.                         for (var t = 0, i = Array(e.length); t < e.length; t++) i[t] = e[t];
  674.                         return i
  675.                     }
  676.                     return Array.from(e)
  677.                 }(i)))) : e
  678.             },
  679.             getProviderByUrl: function (e) {
  680.                 return /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$/.test(e) ? i.youtube : /^https?:\/\/player.vimeo.com\/video\/\d{8,}(?=\b|\/)/.test(e) ? i.vimeo : null
  681.             },
  682.             parseYouTubeId: function (e) {
  683.                 if (c.is.empty(e)) return null;
  684.                 return e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/) ? RegExp.$2 : e
  685.             },
  686.             parseVimeoId: function (e) {
  687.                 if (c.is.empty(e)) return null;
  688.                 if (c.is.number(Number(e))) return e;
  689.                 return e.match(/^.*(vimeo.com\/|video\/)(\d+).*/) ? RegExp.$2 : e
  690.             },
  691.             parseUrl: function (e) {
  692.                 var t = document.createElement("a");
  693.                 return t.href = e, t
  694.             },
  695.             getUrlParams: function (e) {
  696.                 var t = e;
  697.                 (e.startsWith("http://") || e.startsWith("https://")) && (t = this.parseUrl(e).search);
  698.                 return this.is.empty(t) ? null : t.slice(t.indexOf("?") + 1).split("&").reduce(function (e, t) {
  699.                     var i = t.split("="),
  700.                         n = r(i, 2),
  701.                         s = n[0],
  702.                         a = n[1];
  703.                     return Object.assign(e, l({}, s, decodeURIComponent(a)))
  704.                 }, {})
  705.             },
  706.             buildUrlParams: function (e) {
  707.                 return c.is.object(e) ? Object.keys(e).map(function (t) {
  708.                     return encodeURIComponent(t) + "=" + encodeURIComponent(e[t])
  709.                 }).join("&") : ""
  710.             },
  711.             stripHTML: function (e) {
  712.                 var t = document.createDocumentFragment(),
  713.                     i = document.createElement("div");
  714.                 return t.appendChild(i), i.innerHTML = e, t.firstChild.innerText
  715.             },
  716.             getAspectRatio: function (e, t) {
  717.                 var i = function e(t, i) {
  718.                     return 0 === i ? t : e(i, t % i)
  719.                 }(e, t);
  720.                 return e / i + ":" + t / i
  721.             },
  722.             get transitionEndEvent() {
  723.                 var e = document.createElement("span"),
  724.                     t = {
  725.                         WebkitTransition: "webkitTransitionEnd",
  726.                         MozTransition: "transitionend",
  727.                         OTransition: "oTransitionEnd otransitionend",
  728.                         transition: "transitionend"
  729.                     },
  730.                     i = Object.keys(t).find(function (t) {
  731.                         return void 0 !== e.style[t]
  732.                     });
  733.                 return !!c.is.string(i) && t[i]
  734.             },
  735.             repaint: function (e) {
  736.                 window.setTimeout(function () {
  737.                     c.toggleHidden(e, !0), e.offsetHeight, c.toggleHidden(e, !1)
  738.                 }, 0)
  739.             }
  740.         },
  741.         u = {
  742.             audio: "canPlayType" in document.createElement("audio"),
  743.             video: "canPlayType" in document.createElement("video"),
  744.             check: function (e, t, i) {
  745.                 var n = !1,
  746.                     s = !1,
  747.                     a = c.getBrowser(),
  748.                     o = a.isIPhone && i && u.inline;
  749.                 switch (t + ":" + e) {
  750.                     case "html5:video":
  751.                         s = (n = u.video) && u.rangeInput && (!a.isIPhone || o);
  752.                         break;
  753.                     case "html5:audio":
  754.                         s = (n = u.audio) && u.rangeInput;
  755.                         break;
  756.                     case "youtube:video":
  757.                         n = !0, s = u.rangeInput && (!a.isIPhone || o);
  758.                         break;
  759.                     case "vimeo:video":
  760.                         n = !0, s = u.rangeInput && !a.isIPhone;
  761.                         break;
  762.                     default:
  763.                         s = (n = u.audio && u.video) && u.rangeInput
  764.                 }
  765.                 return {
  766.                     api: n,
  767.                     ui: s
  768.                 }
  769.             },
  770.             pip: !c.getBrowser().isIPhone && c.is.function(c.createElement("video").webkitSetPresentationMode),
  771.             airplay: c.is.function(window.WebKitPlaybackTargetAvailabilityEvent),
  772.             inline: "playsInline" in document.createElement("video"),
  773.             mime: function (e) {
  774.                 var t = this.media;
  775.                 try {
  776.                     if (!this.isHTML5 || !c.is.function(t.canPlayType)) return !1;
  777.                     if (this.isVideo) switch (e) {
  778.                         case "video/webm":
  779.                             return t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, "");
  780.                         case "video/mp4":
  781.                             return t.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, "");
  782.                         case "video/ogg":
  783.                             return t.canPlayType('video/ogg; codecs="theora"').replace(/no/, "");
  784.                         default:
  785.                             return !1
  786.                     } else if (this.isAudio) switch (e) {
  787.                         case "audio/mpeg":
  788.                             return t.canPlayType("audio/mpeg;").replace(/no/, "");
  789.                         case "audio/ogg":
  790.                             return t.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/, "");
  791.                         case "audio/wav":
  792.                             return t.canPlayType('audio/wav; codecs="1"').replace(/no/, "");
  793.                         default:
  794.                             return !1
  795.                     }
  796.                 } catch (e) {
  797.                     return !1
  798.                 }
  799.                 return !1
  800.             },
  801.             textTracks: "textTracks" in document.createElement("video"),
  802.             passiveListeners: function () {
  803.                 var e = !1;
  804.                 try {
  805.                     var t = Object.defineProperty({}, "passive", {
  806.                         get: function () {
  807.                             return e = !0, null
  808.                         }
  809.                     });
  810.                     window.addEventListener("test", null, t)
  811.                 } catch (e) {}
  812.                 return e
  813.             }(),
  814.             rangeInput: (e = document.createElement("input"), e.type = "range", "range" === e.type),
  815.             touch: "ontouchstart" in document.documentElement,
  816.             transitions: !1 !== c.transitionEndEvent,
  817.             reducedMotion: "matchMedia" in window && window.matchMedia("(prefers-reduced-motion)").matches
  818.         },
  819.         d = function () {},
  820.         h = function () {
  821.             function e() {
  822.                 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
  823.                 a(this, e), this.enabled = window.console && t, this.enabled && this.log("Debugging enabled")
  824.             }
  825.             return o(e, [{
  826.                 key: "log",
  827.                 get: function () {
  828.                     return this.enabled ? Function.prototype.bind.call(console.log, console) : d
  829.                 }
  830.             }, {
  831.                 key: "warn",
  832.                 get: function () {
  833.                     return this.enabled ? Function.prototype.bind.call(console.warn, console) : d
  834.                 }
  835.             }, {
  836.                 key: "error",
  837.                 get: function () {
  838.                     return this.enabled ? Function.prototype.bind.call(console.error, console) : d
  839.                 }
  840.             }]), e
  841.         }(),
  842.         p = function () {
  843.             function e(t) {
  844.                 a(this, e), this.enabled = t.config.storage.enabled, this.key = t.config.storage.key
  845.             }
  846.             return o(e, [{
  847.                 key: "get",
  848.                 value: function (t) {
  849.                     var i = window.localStorage.getItem(this.key);
  850.                     if (!e.supported || c.is.empty(i)) return null;
  851.                     var n = JSON.parse(i);
  852.                     return c.is.string(t) && t.length ? n[t] : n
  853.                 }
  854.             }, {
  855.                 key: "set",
  856.                 value: function (t) {
  857.                     if (e.supported && this.enabled && c.is.object(t)) {
  858.                         var i = this.get();
  859.                         c.is.empty(i) && (i = {}), c.extend(i, t), window.localStorage.setItem(this.key, JSON.stringify(i))
  860.                     }
  861.                 }
  862.             }], [{
  863.                 key: "supported",
  864.                 get: function () {
  865.                     if (!("localStorage" in window)) return !1;
  866.                     try {
  867.                         return window.localStorage.setItem("___test", "___test"), window.localStorage.removeItem("___test"), !0
  868.                     } catch (e) {
  869.                         return !1
  870.                     }
  871.                 }
  872.             }]), e
  873.         }(),
  874.         m = function () {
  875.             function e(t) {
  876.                 var i = this;
  877.                 a(this, e), this.player = t, this.enabled = t.config.ads.enabled, this.playing = !1, this.initialized = !1, this.blocked = !1, this.enabled = c.is.url(t.config.ads.tag), this.enabled && (c.is.object(window.google) ? this.ready() : c.loadScript(t.config.urls.googleIMA.api, function () {
  878.                     i.ready()
  879.                 }, function () {
  880.                     i.blocked = !0, i.player.debug.log("Ads error: Google IMA SDK failed to load")
  881.                 }))
  882.             }
  883.             return o(e, [{
  884.                 key: "ready",
  885.                 value: function () {
  886.                     var e = this;
  887.                     this.elements = {
  888.                         container: null,
  889.                         displayContainer: null
  890.                     }, this.manager = null, this.loader = null, this.cuePoints = null, this.events = {}, this.safetyTimer = null, this.countdownTimer = null, this.listeners(), this.startSafetyTimer(12e3, "ready()"), this.loaderPromise = new Promise(function (t) {
  891.                         e.on("ADS_LOADER_LOADED", function () {
  892.                             return t()
  893.                         })
  894.                     }), this.managerPromise = new Promise(function (t) {
  895.                         e.on("ADS_MANAGER_LOADED", function () {
  896.                             return t()
  897.                         })
  898.                     }), this.managerPromise.then(function () {
  899.                         e.clearSafetyTimer("onAdsManagerLoaded()")
  900.                     }), this.setupIMA()
  901.                 }
  902.             }, {
  903.                 key: "setupIMA",
  904.                 value: function () {
  905.                     this.elements.container = c.createElement("div", {
  906.                         class: this.player.config.classNames.ads,
  907.                         hidden: ""
  908.                     }), 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), this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container), this.requestAds()
  909.                 }
  910.             }, {
  911.                 key: "requestAds",
  912.                 value: function () {
  913.                     var e = this,
  914.                         t = this.player.elements.container;
  915.                     try {
  916.                         this.loader = new google.ima.AdsLoader(this.elements.displayContainer), this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, function (t) {
  917.                             return e.onAdsManagerLoaded(t)
  918.                         }, !1), this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (t) {
  919.                             return e.onAdError(t)
  920.                         }, !1);
  921.                         var i = new google.ima.AdsRequest;
  922.                         i.adTagUrl = "https://go.aniview.com/api/adserver6/vast/?" + c.buildUrlParams({
  923.                             AV_PUBLISHERID: "58c25bb0073ef448b1087ad6",
  924.                             AV_CHANNELID: "5a0458dc28a06145e4519d21",
  925.                             AV_URL: "127.0.0.1:3000",
  926.                             cb: 1,
  927.                             AV_WIDTH: 640,
  928.                             AV_HEIGHT: 480
  929.                         }), i.linearAdSlotWidth = t.offsetWidth, i.linearAdSlotHeight = t.offsetHeight, i.nonLinearAdSlotWidth = t.offsetWidth, i.nonLinearAdSlotHeight = t.offsetHeight, i.forceNonLinearFullSlot = !1, this.loader.requestAds(i), this.handleEventListeners("ADS_LOADER_LOADED")
  930.                     } catch (e) {
  931.                         this.onAdError(e)
  932.                     }
  933.                 }
  934.             }, {
  935.                 key: "pollCountdown",
  936.                 value: function () {
  937.                     var e = this;
  938.                     if (!(arguments.length > 0 && void 0 !== arguments[0] && arguments[0])) return window.clearInterval(this.countdownTimer), void this.elements.container.removeAttribute("data-badge-text");
  939.                     this.countdownTimer = window.setInterval(function () {
  940.                         var t = c.formatTime(e.manager.getRemainingTime()),
  941.                             i = e.player.config.i18n.advertisment + " - " + t;
  942.                         e.elements.container.setAttribute("data-badge-text", i)
  943.                     }, 100)
  944.                 }
  945.             }, {
  946.                 key: "onAdsManagerLoaded",
  947.                 value: function (e) {
  948.                     var t = this,
  949.                         i = new google.ima.AdsRenderingSettings;
  950.                     i.restoreCustomPlaybackStateOnAdBreakComplete = !0, i.enablePreloading = !0, this.manager = e.getAdsManager(this.player, i), this.cuePoints = this.manager.getCuePoints(), this.cuePoints.forEach(function (e) {
  951.                         if (0 !== e && -1 !== e) {
  952.                             var i = t.player.elements.progress;
  953.                             if (i) {
  954.                                 var n = 100 / t.player.duration * e,
  955.                                     s = c.createElement("span", {
  956.                                         class: t.player.config.classNames.cues
  957.                                     });
  958.                                 s.style.left = n.toString() + "%", i.appendChild(s)
  959.                             }
  960.                         }
  961.                     }), this.manager.setVolume(this.player.volume), this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, function (e) {
  962.                         return t.onAdError(e)
  963.                     }), Object.keys(google.ima.AdEvent.Type).forEach(function (e) {
  964.                         t.manager.addEventListener(google.ima.AdEvent.Type[e], function (e) {
  965.                             return t.onAdEvent(e)
  966.                         })
  967.                     }), this.handleEventListeners("ADS_MANAGER_LOADED")
  968.                 }
  969.             }, {
  970.                 key: "onAdEvent",
  971.                 value: function (e) {
  972.                     var t = this,
  973.                         i = this.player.elements.container,
  974.                         n = e.getAd(),
  975.                         s = function (e) {
  976.                             c.dispatchEvent.call(t.player, t.player.media, "ads" + e)
  977.                         };
  978.                     switch (e.type) {
  979.                         case google.ima.AdEvent.Type.LOADED:
  980.                             this.handleEventListeners("LOADED"), s("loaded"), this.pollCountdown(!0), n.isLinear() || (n.width = i.offsetWidth, n.height = i.offsetHeight);
  981.                             break;
  982.                         case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
  983.                             this.handleEventListeners("ALL_ADS_COMPLETED"), s("allcomplete"), this.loadAds();
  984.                             break;
  985.                         case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:
  986.                             this.handleEventListeners("CONTENT_PAUSE_REQUESTED"), s("contentpause"), this.pauseContent();
  987.                             break;
  988.                         case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:
  989.                             this.handleEventListeners("CONTENT_RESUME_REQUESTED"), s("contentresume"), this.pollCountdown(), this.resumeContent();
  990.                             break;
  991.                         case google.ima.AdEvent.Type.STARTED:
  992.                             s("started");
  993.                             break;
  994.                         case google.ima.AdEvent.Type.MIDPOINT:
  995.                             s("midpoint");
  996.                             break;
  997.                         case google.ima.AdEvent.Type.COMPLETE:
  998.                             s("complete");
  999.                             break;
  1000.                         case google.ima.AdEvent.Type.IMPRESSION:
  1001.                             s("impression");
  1002.                             break;
  1003.                         case google.ima.AdEvent.Type.CLICK:
  1004.                             s("click")
  1005.                     }
  1006.                 }
  1007.             }, {
  1008.                 key: "onAdError",
  1009.                 value: function (e) {
  1010.                     this.cancel(), this.player.debug.log("Ads error", e)
  1011.                 }
  1012.             }, {
  1013.                 key: "listeners",
  1014.                 value: function () {
  1015.                     var e = this,
  1016.                         t = this.player.elements.container,
  1017.                         i = void 0;
  1018.                     this.player.on("ended", function () {
  1019.                         e.loader.contentComplete()
  1020.                     }), this.player.on("seeking", function () {
  1021.                         return i = e.player.currentTime
  1022.                     }), this.player.on("seeked", function () {
  1023.                         var t = e.player.currentTime;
  1024.                         e.cuePoints.forEach(function (n, s) {
  1025.                             i < n && n < t && (e.manager.discardAdBreak(), e.cuePoints.splice(s, 1))
  1026.                         })
  1027.                     }), window.addEventListener("resize", function () {
  1028.                         e.manager.resize(t.offsetWidth, t.offsetHeight, google.ima.ViewMode.NORMAL)
  1029.                     })
  1030.                 }
  1031.             }, {
  1032.                 key: "play",
  1033.                 value: function () {
  1034.                     var e = this,
  1035.                         t = this.player.elements.container;
  1036.                     this.managerPromise && this.managerPromise.then(function () {
  1037.                         e.elements.displayContainer.initialize();
  1038.                         try {
  1039.                             e.initialized || (e.manager.init(t.offsetWidth, t.offsetHeight, google.ima.ViewMode.NORMAL), e.manager.start()), e.initialized = !0
  1040.                         } catch (t) {
  1041.                             e.onAdError(t)
  1042.                         }
  1043.                     })
  1044.                 }
  1045.             }, {
  1046.                 key: "resumeContent",
  1047.                 value: function () {
  1048.                     c.toggleHidden(this.elements.container, !0), this.playing = !1, this.player.currentTime < this.player.duration && this.player.play()
  1049.                 }
  1050.             }, {
  1051.                 key: "pauseContent",
  1052.                 value: function () {
  1053.                     c.toggleHidden(this.elements.container, !1), this.playing = !0, this.player.pause()
  1054.                 }
  1055.             }, {
  1056.                 key: "cancel",
  1057.                 value: function () {
  1058.                     this.initialized && this.resumeContent(), this.handleEventListeners("ERROR"), this.loadAds()
  1059.                 }
  1060.             }, {
  1061.                 key: "loadAds",
  1062.                 value: function () {
  1063.                     var e = this;
  1064.                     this.managerPromise.then(function () {
  1065.                         e.manager && e.manager.destroy(), e.managerPromise = new Promise(function (t) {
  1066.                             e.on("ADS_MANAGER_LOADED", function () {
  1067.                                 return t()
  1068.                             }), e.player.debug.log(e.manager)
  1069.                         }), e.requestAds()
  1070.                     })
  1071.                 }
  1072.             }, {
  1073.                 key: "handleEventListeners",
  1074.                 value: function (e) {
  1075.                     c.is.function(this.events[e]) && this.events[e].call(this)
  1076.                 }
  1077.             }, {
  1078.                 key: "on",
  1079.                 value: function (e, t) {
  1080.                     return this.events[e] = t, this
  1081.                 }
  1082.             }, {
  1083.                 key: "startSafetyTimer",
  1084.                 value: function (e, t) {
  1085.                     var i = this;
  1086.                     this.player.debug.log("Safety timer invoked from: " + t), this.safetyTimer = window.setTimeout(function () {
  1087.                         i.cancel(), i.clearSafetyTimer("startSafetyTimer()")
  1088.                     }, e)
  1089.                 }
  1090.             }, {
  1091.                 key: "clearSafetyTimer",
  1092.                 value: function (e) {
  1093.                     c.is.nullOrUndefined(this.safetyTimer) || (this.player.debug.log("Safety timer cleared from: " + e), clearTimeout(this.safetyTimer), this.safetyTimer = null)
  1094.                 }
  1095.             }]), e
  1096.         }(),
  1097.         g = (t = !1, c.is.function(document.cancelFullScreen) ? t = "" : ["webkit", "o", "moz", "ms", "khtml"].some(function (e) {
  1098.             return c.is.function(document[e + "CancelFullScreen"]) ? (t = e, !0) : !(!c.is.function(document.msExitFullscreen) || !document.msFullscreenEnabled || (t = "ms", 0))
  1099.         }), t),
  1100.         f = {
  1101.             prefix: g,
  1102.             enabled: document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled,
  1103.             eventType: "ms" === g ? "MSFullscreenChange" : g + "fullscreenchange",
  1104.             isFullScreen: function (e) {
  1105.                 if (!f.enabled) return !1;
  1106.                 var t = c.is.nullOrUndefined(e) ? document.body : e;
  1107.                 switch (g) {
  1108.                     case "":
  1109.                         return document.fullscreenElement === t;
  1110.                     case "moz":
  1111.                         return document.mozFullScreenElement === t;
  1112.                     default:
  1113.                         return document[g + "FullscreenElement"] === t
  1114.                 }
  1115.             },
  1116.             requestFullScreen: function (e) {
  1117.                 if (!f.enabled) return !1;
  1118.                 var t = c.is.nullOrUndefined(e) ? document.body : e;
  1119.                 return g.length ? t[g + ("ms" === g ? "RequestFullscreen" : "RequestFullScreen")]() : t.requestFullScreen()
  1120.             },
  1121.             cancelFullScreen: function () {
  1122.                 return !!f.enabled && (g.length ? document[g + ("ms" === g ? "ExitFullscreen" : "CancelFullScreen")]() : document.cancelFullScreen())
  1123.             },
  1124.             element: function () {
  1125.                 return f.enabled ? g.length ? document[g + "FullscreenElement"] : document.fullscreenElement : null
  1126.             },
  1127.             setup: function () {
  1128.                 if (this.supported.ui && !this.isAudio && this.config.fullscreen.enabled) {
  1129.                     var e = f.enabled;
  1130.                     e || this.config.fullscreen.fallback && !c.inFrame() ? (this.debug.log((e ? "Native" : "Fallback") + " fullscreen enabled"), c.toggleClass(this.elements.container, this.config.classNames.fullscreen.enabled, !0)) : this.debug.log("Fullscreen not supported and fallback disabled"), this.elements.buttons && this.elements.buttons.fullscreen && c.toggleState(this.elements.buttons.fullscreen, !1), c.trapFocus.call(this)
  1131.                 }
  1132.             }
  1133.         },
  1134.         y = c.getBrowser(),
  1135.         v = {
  1136.             global: function () {
  1137.                 var e = this,
  1138.                     t = null,
  1139.                     i = function (i) {
  1140.                         var n = function (e) {
  1141.                                 return e.keyCode ? e.keyCode : e.which
  1142.                             }(i),
  1143.                             s = "keydown" === i.type,
  1144.                             a = s && n === t;
  1145.                         if (!(i.altKey || i.ctrlKey || i.metaKey || i.shiftKey) && c.is.number(n)) {
  1146.                             if (s) {
  1147.                                 var o = c.getFocusElement();
  1148.                                 if (c.is.element(o) && c.matches(o, e.config.selectors.editable)) return;
  1149.                                 switch ([48, 49, 50, 51, 52, 53, 54, 56, 57, 32, 75, 38, 40, 77, 39, 37, 70, 67, 73, 76, 79].includes(n) && (i.preventDefault(), i.stopPropagation()), n) {
  1150.                                     case 48:
  1151.                                     case 49:
  1152.                                     case 50:
  1153.                                     case 51:
  1154.                                     case 52:
  1155.                                     case 53:
  1156.                                     case 54:
  1157.                                     case 55:
  1158.                                     case 56:
  1159.                                     case 57:
  1160.                                         a || (e.currentTime = e.duration / 10 * (n - 48));
  1161.                                         break;
  1162.                                     case 32:
  1163.                                     case 75:
  1164.                                         a || e.togglePlay();
  1165.                                         break;
  1166.                                     case 38:
  1167.                                         e.increaseVolume(.1);
  1168.                                         break;
  1169.                                     case 40:
  1170.                                         e.decreaseVolume(.1);
  1171.                                         break;
  1172.                                     case 77:
  1173.                                         a || (e.muted = !e.muted);
  1174.                                         break;
  1175.                                     case 39:
  1176.                                         e.forward();
  1177.                                         break;
  1178.                                     case 37:
  1179.                                         e.rewind();
  1180.                                         break;
  1181.                                     case 70:
  1182.                                         e.toggleFullscreen();
  1183.                                         break;
  1184.                                     case 67:
  1185.                                         a || e.toggleCaptions();
  1186.                                         break;
  1187.                                     case 76:
  1188.                                         e.loop = !e.loop
  1189.                                 }!f.enabled && e.fullscreen.active && 27 === n && e.toggleFullscreen(), t = n
  1190.                             } else t = null
  1191.                         }
  1192.                     };
  1193.                 this.config.keyboard.global ? c.on(window, "keydown keyup", i, !1) : this.config.keyboard.focused && c.on(this.elements.container, "keydown keyup", i, !1), c.on(this.elements.container, "focusout", function (t) {
  1194.                     c.toggleClass(t.target, e.config.classNames.tabFocus, !1)
  1195.                 }), c.on(this.elements.container, "keydown", function (t) {
  1196.                     9 === t.keyCode && window.setTimeout(function () {
  1197.                         c.toggleClass(c.getFocusElement(), e.config.classNames.tabFocus, !0)
  1198.                     }, 0)
  1199.                 }), this.config.hideControls && c.on(this.elements.container, "mouseenter mouseleave mousemove touchstart touchend touchmove enterfullscreen exitfullscreen", function (t) {
  1200.                     e.toggleControls(t)
  1201.                 }), f.enabled && (c.on(document, f.eventType, function (t) {
  1202.                     e.toggleFullscreen(t)
  1203.                 }), c.on(this.elements.container, "dblclick", function (t) {
  1204.                     e.toggleFullscreen(t)
  1205.                 }))
  1206.             },
  1207.             media: function () {
  1208.                 var e = this;
  1209.                 if (c.on(this.media, "timeupdate seeking", function (t) {
  1210.                         return b.timeUpdate.call(e, t)
  1211.                     }), c.on(this.media, "durationchange loadedmetadata", function (t) {
  1212.                         return b.durationUpdate.call(e, t)
  1213.                     }), c.on(this.media, "loadeddata", function () {
  1214.                         c.toggleHidden(e.elements.volume, !e.hasAudio), c.toggleHidden(e.elements.buttons.mute, !e.hasAudio)
  1215.                     }), c.on(this.media, "ended", function () {
  1216.                         e.isHTML5 && e.isVideo && e.config.showPosterOnEnd && (e.restart(), e.media.load())
  1217.                     }), c.on(this.media, "progress playing", function (t) {
  1218.                         return b.updateProgress.call(e, t)
  1219.                     }), c.on(this.media, "volumechange", function (t) {
  1220.                         return b.updateVolume.call(e, t)
  1221.                     }), c.on(this.media, "playing play pause ended", function (t) {
  1222.                         return b.checkPlaying.call(e, t)
  1223.                     }), c.on(this.media, "stalled waiting canplay seeked playing", function (t) {
  1224.                         return b.checkLoading.call(e, t)
  1225.                     }), this.supported.ui && this.config.clickToPlay && !this.isAudio) {
  1226.                     var t = c.getElement.call(this, "." + this.config.classNames.video);
  1227.                     if (!c.is.element(t)) return;
  1228.                     c.on(t, "click", function () {
  1229.                         e.config.hideControls && u.touch && !e.paused || (e.paused ? e.play() : e.ended ? (e.restart(), e.play()) : e.pause())
  1230.                     })
  1231.                 }
  1232.                 this.supported.ui && this.config.disableContextMenu && c.on(this.media, "contextmenu", function (e) {
  1233.                     e.preventDefault()
  1234.                 }, !1), c.on(this.media, "volumechange", function () {
  1235.                     e.storage.set({
  1236.                         volume: e.volume,
  1237.                         muted: e.muted
  1238.                     })
  1239.                 }), c.on(this.media, "ratechange", function () {
  1240.                     w.updateSetting.call(e, "speed"), e.storage.set({
  1241.                         speed: e.speed
  1242.                     })
  1243.                 }), c.on(this.media, "qualitychange", function () {
  1244.                     w.updateSetting.call(e, "quality"), e.storage.set({
  1245.                         quality: e.quality
  1246.                     })
  1247.                 }), c.on(this.media, "languagechange", function () {
  1248.                     w.updateSetting.call(e, "captions"), e.storage.set({
  1249.                         language: e.language
  1250.                     })
  1251.                 }), c.on(this.media, "captionsenabled captionsdisabled", function () {
  1252.                     w.updateSetting.call(e, "captions"), e.storage.set({
  1253.                         captions: e.captions.active
  1254.                     })
  1255.                 }), c.on(this.media, this.config.events.concat(["keyup", "keydown"]).join(" "), function (t) {
  1256.                     var i = {};
  1257.                     "error" === t.type && (i = e.media.error), c.dispatchEvent.call(e, e.elements.container, t.type, !0, i)
  1258.                 })
  1259.             },
  1260.             controls: function () {
  1261.                 var e = this,
  1262.                     t = y.isIE ? "change" : "input",
  1263.                     i = function (t, i, n) {
  1264.                         var s = e.config.listeners[i];
  1265.                         c.is.function(s) && s.call(e, t), !t.defaultPrevented && c.is.function(n) && n.call(e, t)
  1266.                     };
  1267.                 c.on(this.elements.buttons.play, "click", function (t) {
  1268.                     return i(t, "play", function () {
  1269.                         e.togglePlay()
  1270.                     })
  1271.                 }), c.on(this.elements.buttons.restart, "click", function (t) {
  1272.                     return i(t, "restart", function () {
  1273.                         e.restart()
  1274.                     })
  1275.                 }), c.on(this.elements.buttons.rewind, "click", function (t) {
  1276.                     return i(t, "rewind", function () {
  1277.                         e.rewind()
  1278.                     })
  1279.                 }), c.on(this.elements.buttons.forward, "click", function (t) {
  1280.                     return i(t, "forward", function () {
  1281.                         e.forward()
  1282.                     })
  1283.                 }), c.on(this.elements.buttons.mute, "click", function (t) {
  1284.                     return i(t, "mute", function () {
  1285.                         e.muted = !e.muted
  1286.                     })
  1287.                 }), c.on(this.elements.buttons.captions, "click", function (t) {
  1288.                     return i(t, "captions", function () {
  1289.                         e.toggleCaptions()
  1290.                     })
  1291.                 }), c.on(this.elements.buttons.fullscreen, "click", function (t) {
  1292.                     return i(t, "fullscreen", function () {
  1293.                         e.toggleFullscreen()
  1294.                     })
  1295.                 }), c.on(this.elements.buttons.pip, "click", function (t) {
  1296.                     return i(t, "pip", function () {
  1297.                         e.pip = "toggle"
  1298.                     })
  1299.                 }), c.on(this.elements.buttons.airplay, "click", function (t) {
  1300.                     return i(t, "airplay", function () {
  1301.                         e.airplay()
  1302.                     })
  1303.                 }), c.on(this.elements.buttons.settings, "click", function (t) {
  1304.                     w.toggleMenu.call(e, t)
  1305.                 }), c.on(document.documentElement, "click", function (t) {
  1306.                     w.toggleMenu.call(e, t)
  1307.                 }), c.on(this.elements.settings.form, "click", function (t) {
  1308.                     t.stopPropagation(), c.matches(t.target, e.config.selectors.inputs.language) ? i(t, "language", function () {
  1309.                         e.language = t.target.value
  1310.                     }) : c.matches(t.target, e.config.selectors.inputs.quality) ? i(t, "quality", function () {
  1311.                         e.quality = t.target.value
  1312.                     }) : c.matches(t.target, e.config.selectors.inputs.speed) ? i(t, "speed", function () {
  1313.                         e.speed = parseFloat(t.target.value)
  1314.                     }) : w.showTab.call(e, t)
  1315.                 }), c.on(this.elements.inputs.seek, t, function (t) {
  1316.                     return i(t, "seek", function () {
  1317.                         e.currentTime = t.target.value / t.target.max * e.duration
  1318.                     })
  1319.                 }), this.config.toggleInvert && !c.is.element(this.elements.display.duration) && c.on(this.elements.display.currentTime, "click", function () {
  1320.                     0 !== e.currentTime && (e.config.invertTime = !e.config.invertTime, b.timeUpdate.call(e))
  1321.                 }), c.on(this.elements.inputs.volume, t, function (t) {
  1322.                     return i(t, "volume", function () {
  1323.                         e.volume = t.target.value
  1324.                     })
  1325.                 }), y.isWebkit && c.on(c.getElements.call(this, 'input[type="range"]'), "input", function (t) {
  1326.                     w.updateRangeFill.call(e, t.target)
  1327.                 }), c.on(this.elements.progress, "mouseenter mouseleave mousemove", function (t) {
  1328.                     return w.updateSeekTooltip.call(e, t)
  1329.                 }), this.config.hideControls && (c.on(this.elements.controls, "mouseenter mouseleave", function (t) {
  1330.                     e.elements.controls.hover = "mouseenter" === t.type
  1331.                 }), c.on(this.elements.controls, "mousedown mouseup touchstart touchend touchcancel", function (t) {
  1332.                     e.elements.controls.pressed = ["mousedown", "touchstart"].includes(t.type)
  1333.                 }), c.on(this.elements.controls, "focusin focusout", function (t) {
  1334.                     e.toggleControls(t)
  1335.                 })), c.on(this.elements.inputs.volume, "wheel", function (t) {
  1336.                     return i(t, "volume", function () {
  1337.                         var i = t.webkitDirectionInvertedFromDevice,
  1338.                             n = 0;
  1339.                         (t.deltaY < 0 || t.deltaX > 0) && (i ? (e.decreaseVolume(.02), n = -1) : (e.increaseVolume(.02), n = 1)), (t.deltaY > 0 || t.deltaX < 0) && (i ? (e.increaseVolume(.02), n = 1) : (e.decreaseVolume(.02), n = -1)), (1 === n && e.media.volume < 1 || -1 === n && e.media.volume > 0) && t.preventDefault()
  1340.                     })
  1341.                 }, !1)
  1342.             }
  1343.         },
  1344.         b = {
  1345.             addStyleHook: function () {
  1346.                 c.toggleClass(this.elements.container, this.config.selectors.container.replace(".", ""), !0), c.toggleClass(this.elements.container, this.config.classNames.uiSupported, this.supported.ui)
  1347.             },
  1348.             toggleNativeControls: function () {
  1349.                 arguments.length > 0 && void 0 !== arguments[0] && arguments[0] && this.isHTML5 ? this.media.setAttribute("controls", "") : this.media.removeAttribute("controls")
  1350.             },
  1351.             build: function () {
  1352.                 if (v.media.call(this), !this.supported.ui) return this.debug.warn("Basic support only for " + this.provider + " " + this.type), c.removeElement.call(this, "controls"), c.removeElement.call(this, "buttons.play"), void b.toggleNativeControls.call(this, !0);
  1353.                 c.is.element(this.elements.controls) || (w.inject.call(this), v.controls.call(this)), c.is.element(this.elements.controls) && (b.toggleNativeControls.call(this), f.setup.call(this), E.setup.call(this), this.volume = null, this.muted = null, this.speed = null, this.loop = null, this.options.quality = [], b.timeUpdate.call(this), b.checkPlaying.call(this), this.ready = !0, c.dispatchEvent.call(this, this.media, "ready"), b.setTitle.call(this))
  1354.             },
  1355.             setTitle: function () {
  1356.                 var e = this.config.i18n.play;
  1357.                 if (c.is.string(this.config.title) && !c.is.empty(this.config.title) && (e += ", " + this.config.title, this.elements.container.setAttribute("aria-label", this.config.title)), c.is.nodeList(this.elements.buttons.play) && Array.from(this.elements.buttons.play).forEach(function (t) {
  1358.                         t.setAttribute("aria-label", e)
  1359.                     }), this.isEmbed) {
  1360.                     var t = c.getElement.call(this, "iframe");
  1361.                     if (!c.is.element(t)) return;
  1362.                     var i = c.is.empty(this.config.title) ? "video" : this.config.title;
  1363.                     t.setAttribute("title", this.config.i18n.frameTitle.replace("{title}", i))
  1364.                 }
  1365.             },
  1366.             checkPlaying: function () {
  1367.                 var e = this;
  1368.                 c.toggleClass(this.elements.container, this.config.classNames.playing, this.playing), c.toggleClass(this.elements.container, this.config.classNames.stopped, this.paused), c.is.nodeList(this.elements.buttons.play) && Array.from(this.elements.buttons.play).forEach(function (t) {
  1369.                     return c.toggleState(t, e.playing)
  1370.                 }), this.toggleControls(!this.playing)
  1371.             },
  1372.             checkLoading: function (e) {
  1373.                 var t = this;
  1374.                 this.loading = ["stalled", "waiting"].includes(e.type), clearTimeout(this.timers.loading), this.timers.loading = setTimeout(function () {
  1375.                     c.toggleClass(t.elements.container, t.config.classNames.loading, t.loading), t.toggleControls(t.loading)
  1376.                 }, this.loading ? 250 : 0)
  1377.             },
  1378.             checkFailed: function () {
  1379.                 var e = this;
  1380.                 this.failed = 3 === this.media.networkState, this.failed && (c.toggleClass(this.elements.container, this.config.classNames.loading, !1), c.toggleClass(this.elements.container, this.config.classNames.error, !0)), clearTimeout(this.timers.failed), this.timers.loading = setTimeout(function () {
  1381.                     c.toggleClass(e.elements.container, e.config.classNames.loading, e.loading), e.toggleControls(e.loading)
  1382.                 }, this.loading ? 250 : 0)
  1383.             },
  1384.             updateVolume: function () {
  1385.                 this.supported.ui && (c.is.element(this.elements.inputs.volume) && b.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume), c.is.element(this.elements.buttons.mute) && c.toggleState(this.elements.buttons.mute, this.muted || 0 === this.volume))
  1386.             },
  1387.             setRange: function (e) {
  1388.                 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
  1389.                 c.is.element(e) && (e.value = t, w.updateRangeFill.call(this, e))
  1390.             },
  1391.             setProgress: function (e, t) {
  1392.                 var i = c.is.number(t) ? t : 0,
  1393.                     n = c.is.element(e) ? e : this.elements.display.buffer;
  1394.                 if (c.is.element(n)) {
  1395.                     n.value = i;
  1396.                     var s = n.getElementsByTagName("span")[0];
  1397.                     c.is.element(s) && (s.childNodes[0].nodeValue = i)
  1398.                 }
  1399.             },
  1400.             updateProgress: function (e) {
  1401.                 var t = this;
  1402.                 if (this.supported.ui && c.is.event(e)) {
  1403.                     var i, n = 0;
  1404.                     if (e) switch (e.type) {
  1405.                         case "timeupdate":
  1406.                         case "seeking":
  1407.                             n = c.getPercentage(this.currentTime, this.duration), "timeupdate" === e.type && b.setRange.call(this, this.elements.inputs.seek, n);
  1408.                             break;
  1409.                         case "playing":
  1410.                         case "progress":
  1411.                             n = (i = t.media.buffered) && i.length ? c.getPercentage(i.end(0), t.duration) : c.is.number(i) ? 100 * i : 0, b.setProgress.call(this, this.elements.display.buffer, n)
  1412.                     }
  1413.                 }
  1414.             },
  1415.             updateTimeDisplay: function () {
  1416.                 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null,
  1417.                     t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
  1418.                     i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
  1419.                 if (c.is.element(e) && c.is.number(t)) {
  1420.                     var n = c.getHours(this.duration) > 0;
  1421.                     e.textContent = c.formatTime(t, n, i)
  1422.                 }
  1423.             },
  1424.             timeUpdate: function (e) {
  1425.                 var t = !c.is.element(this.elements.display.duration) && this.config.invertTime;
  1426.                 b.updateTimeDisplay.call(this, this.elements.display.currentTime, t ? this.duration - this.currentTime : this.currentTime, t), e && "timeupdate" === e.type && this.media.seeking || b.updateProgress.call(this, e)
  1427.             },
  1428.             durationUpdate: function () {
  1429.                 if (this.supported.ui) {
  1430.                     var e = c.is.element(this.elements.display.duration);
  1431.                     !e && this.config.displayDuration && this.paused && b.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration), e && b.updateTimeDisplay.call(this, this.elements.display.duration, this.duration), w.updateSeekTooltip.call(this)
  1432.                 }
  1433.             }
  1434.         },
  1435.         k = c.getBrowser(),
  1436.         w = {
  1437.             updateRangeFill: function (e) {
  1438.                 if (k.isWebkit) {
  1439.                     var t = c.is.event(e) ? e.target : e;
  1440.                     c.is.element(t) && "range" === t.getAttribute("type") && t.style.setProperty("--value", t.value / t.max * 100 + "%")
  1441.                 }
  1442.             },
  1443.             getIconUrl: function () {
  1444.                 return {
  1445.                     url: this.config.iconUrl,
  1446.                     absolute: 0 === this.config.iconUrl.indexOf("http") || k.isIE && !window.svg4everybody
  1447.                 }
  1448.             },
  1449.             createIcon: function (e, t) {
  1450.                 var i = w.getIconUrl.call(this),
  1451.                     n = (i.absolute ? "" : i.url) + "#" + this.config.iconPrefix,
  1452.                     s = document.createElementNS("http://www.w3.org/2000/svg", "svg");
  1453.                 c.setAttributes(s, c.extend(t, {
  1454.                     role: "presentation"
  1455.                 }));
  1456.                 var a = document.createElementNS("http://www.w3.org/2000/svg", "use"),
  1457.                     o = n + "-" + e;
  1458.                 return "href" in a ? a.setAttributeNS("http://www.w3.org/1999/xlink", "href", o) : a.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", o), s.appendChild(a), s
  1459.             },
  1460.             createLabel: function (e, t) {
  1461.                 var i = this.config.i18n[e],
  1462.                     n = Object.assign({}, t);
  1463.                 switch (e) {
  1464.                     case "pip":
  1465.                         i = "PIP";
  1466.                         break;
  1467.                     case "airplay":
  1468.                         i = "AirPlay"
  1469.                 }
  1470.                 return "class" in n ? n.class += " " + this.config.classNames.hidden : n.class = this.config.classNames.hidden, c.createElement("span", n, i)
  1471.             },
  1472.             createBadge: function (e) {
  1473.                 if (c.is.empty(e)) return null;
  1474.                 var t = c.createElement("span", {
  1475.                     class: this.config.classNames.menu.value
  1476.                 });
  1477.                 return t.appendChild(c.createElement("span", {
  1478.                     class: this.config.classNames.menu.badge
  1479.                 }, e)), t
  1480.             },
  1481.             createButton: function (e, t) {
  1482.                 var i = c.createElement("button"),
  1483.                     n = Object.assign({}, t),
  1484.                     s = e,
  1485.                     a = !1,
  1486.                     o = void 0,
  1487.                     l = void 0,
  1488.                     r = void 0,
  1489.                     u = void 0;
  1490.                 switch ("type" in n || (n.type = "button"), "class" in n ? n.class.includes(this.config.classNames.control) && (n.class += " " + this.config.classNames.control) : n.class = this.config.classNames.control, s) {
  1491.                     case "play":
  1492.                         a = !0, o = "play", r = "pause", l = "play", u = "pause";
  1493.                         break;
  1494.                     case "mute":
  1495.                         a = !0, o = "mute", r = "unmute", l = "volume", u = "muted";
  1496.                         break;
  1497.                     case "captions":
  1498.                         a = !0, o = "enableCaptions", r = "disableCaptions", l = "captions-off", u = "captions-on";
  1499.                         break;
  1500.                     case "fullscreen":
  1501.                         a = !0, o = "enterFullscreen", r = "exitFullscreen", l = "enter-fullscreen", u = "exit-fullscreen";
  1502.                         break;
  1503.                     case "play-large":
  1504.                         n.class += " " + this.config.classNames.control + "--overlaid", s = "play", o = "play", l = "play";
  1505.                         break;
  1506.                     default:
  1507.                         o = s, l = s
  1508.                 }
  1509.                 return a ? (i.appendChild(w.createIcon.call(this, u, {
  1510.                     class: "icon--pressed"
  1511.                 })), i.appendChild(w.createIcon.call(this, l, {
  1512.                     class: "icon--not-pressed"
  1513.                 })), i.appendChild(w.createLabel.call(this, r, {
  1514.                     class: "label--pressed"
  1515.                 })), i.appendChild(w.createLabel.call(this, o, {
  1516.                     class: "label--not-pressed"
  1517.                 })), n["aria-pressed"] = !1, n["aria-label"] = this.config.i18n[o]) : (i.appendChild(w.createIcon.call(this, l)), i.appendChild(w.createLabel.call(this, o))), c.extend(n, c.getAttributesFromSelector(this.config.selectors.buttons[s], n)), c.setAttributes(i, n), this.elements.buttons[s] = i, i
  1518.             },
  1519.             createRange: function (e, t) {
  1520.                 var i = c.createElement("label", {
  1521.                         for: t.id,
  1522.                         class: this.config.classNames.hidden
  1523.                     }, this.config.i18n[e]),
  1524.                     n = c.createElement("input", c.extend(c.getAttributesFromSelector(this.config.selectors.inputs[e]), {
  1525.                         type: "range",
  1526.                         min: 0,
  1527.                         max: 100,
  1528.                         step: .01,
  1529.                         value: 0,
  1530.                         autocomplete: "off"
  1531.                     }, t));
  1532.                 return this.elements.inputs[e] = n, w.updateRangeFill.call(this, n), {
  1533.                     label: i,
  1534.                     input: n
  1535.                 }
  1536.             },
  1537.             createProgress: function (e, t) {
  1538.                 var i = c.createElement("progress", c.extend(c.getAttributesFromSelector(this.config.selectors.display[e]), {
  1539.                     min: 0,
  1540.                     max: 100,
  1541.                     value: 0
  1542.                 }, t));
  1543.                 if ("volume" !== e) {
  1544.                     i.appendChild(c.createElement("span", null, "0"));
  1545.                     var n = "";
  1546.                     switch (e) {
  1547.                         case "played":
  1548.                             n = this.config.i18n.played;
  1549.                             break;
  1550.                         case "buffer":
  1551.                             n = this.config.i18n.buffered
  1552.                     }
  1553.                     i.textContent = "% " + n.toLowerCase()
  1554.                 }
  1555.                 return this.elements.display[e] = i, i
  1556.             },
  1557.             createTime: function (e) {
  1558.                 var t = c.createElement("div", {
  1559.                     class: "plyr__time"
  1560.                 });
  1561.                 return t.appendChild(c.createElement("span", {
  1562.                     class: this.config.classNames.hidden
  1563.                 }, this.config.i18n[e])), t.appendChild(c.createElement("span", c.getAttributesFromSelector(this.config.selectors.display[e]), "00:00")), this.elements.display[e] = t, t
  1564.             },
  1565.             createMenuItem: function (e, t, i, n) {
  1566.                 var s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null,
  1567.                     a = arguments.length > 5 && void 0 !== arguments[5] && arguments[5],
  1568.                     o = c.createElement("li"),
  1569.                     l = c.createElement("label", {
  1570.                         class: this.config.classNames.control
  1571.                     }),
  1572.                     r = c.createElement("input", c.extend(c.getAttributesFromSelector(this.config.selectors.inputs[i]), {
  1573.                         type: "radio",
  1574.                         name: "plyr-" + i,
  1575.                         value: e,
  1576.                         checked: a,
  1577.                         class: "plyr__sr-only"
  1578.                     })),
  1579.                     u = c.createElement("span", {
  1580.                         "aria-hidden": !0
  1581.                     });
  1582.                 l.appendChild(r), l.appendChild(u), l.insertAdjacentHTML("beforeend", n), c.is.element(s) && l.appendChild(s), o.appendChild(l), t.appendChild(o)
  1583.             },
  1584.             updateSeekTooltip: function (e) {
  1585.                 if (this.config.tooltips.seek && c.is.element(this.elements.inputs.seek) && c.is.element(this.elements.display.seekTooltip) && 0 !== this.duration) {
  1586.                     var t = 0,
  1587.                         i = this.elements.inputs.seek.getBoundingClientRect(),
  1588.                         n = this.config.classNames.tooltip + "--visible";
  1589.                     if (c.is.event(e)) t = 100 / i.width * (e.pageX - i.left);
  1590.                     else {
  1591.                         if (!c.hasClass(this.elements.display.seekTooltip, n)) return;
  1592.                         t = parseFloat(this.elements.display.seekTooltip.style.left, 10)
  1593.                     }
  1594.                     t < 0 ? t = 0 : t > 100 && (t = 100), b.updateTimeDisplay.call(this, this.elements.display.seekTooltip, this.duration / 100 * t), this.elements.display.seekTooltip.style.left = t + "%", c.is.event(e) && ["mouseenter", "mouseleave"].includes(e.type) && c.toggleClass(this.elements.display.seekTooltip, n, "mouseenter" === e.type)
  1595.                 }
  1596.             },
  1597.             toggleTab: function (e, t) {
  1598.                 var i = this.elements.settings.tabs[e],
  1599.                     n = this.elements.settings.panes[e];
  1600.                 c.toggleHidden(i, !t), c.toggleHidden(n, !t)
  1601.             },
  1602.             setQualityMenu: function (e) {
  1603.                 var t = this,
  1604.                     i = this.elements.settings.panes.quality.querySelector("ul");
  1605.                 c.is.array(e) ? this.options.quality = e.filter(function (e) {
  1606.                     return t.config.quality.options.includes(e)
  1607.                 }) : this.options.quality = this.config.quality.options;
  1608.                 var n = !c.is.empty(this.options.quality) && this.isYouTube;
  1609.                 if (w.toggleTab.call(this, "quality", n), n) {
  1610.                     c.emptyElement(i);
  1611.                     this.options.quality.forEach(function (e) {
  1612.                         return w.createMenuItem.call(t, e, i, "quality", w.getLabel.call(t, "quality", e), function (e) {
  1613.                             var i = "";
  1614.                             switch (e) {
  1615.                                 case "hd2160":
  1616.                                     i = "4K";
  1617.                                     break;
  1618.                                 case "hd1440":
  1619.                                     i = "WQHD";
  1620.                                     break;
  1621.                                 case "hd1080":
  1622.                                 case "hd720":
  1623.                                     i = "HD"
  1624.                             }
  1625.                             return i.length ? w.createBadge.call(t, i) : null
  1626.                         }(e))
  1627.                     }), w.updateSetting.call(this, "quality", i)
  1628.                 }
  1629.             },
  1630.             getLabel: function (e, t) {
  1631.                 switch (e) {
  1632.                     case "speed":
  1633.                         return 1 === t ? "Normal" : t + "&times;";
  1634.                     case "quality":
  1635.                         switch (t) {
  1636.                             case "hd2160":
  1637.                                 return "2160P";
  1638.                             case "hd1440":
  1639.                                 return "1440P";
  1640.                             case "hd1080":
  1641.                                 return "1080P";
  1642.                             case "hd720":
  1643.                                 return "720P";
  1644.                             case "large":
  1645.                                 return "480P";
  1646.                             case "medium":
  1647.                                 return "360P";
  1648.                             case "small":
  1649.                                 return "240P";
  1650.                             case "tiny":
  1651.                                 return "Tiny";
  1652.                             case "default":
  1653.                                 return "Auto";
  1654.                             default:
  1655.                                 return t
  1656.                         }
  1657.                     case "captions":
  1658.                         return w.getLanguage.call(this);
  1659.                     default:
  1660.                         return null
  1661.                 }
  1662.             },
  1663.             updateSetting: function (e, t) {
  1664.                 var i = this.elements.settings.panes[e],
  1665.                     n = null,
  1666.                     s = t;
  1667.                 switch (e) {
  1668.                     case "captions":
  1669.                         n = this.captions.active ? this.captions.language : "";
  1670.                         break;
  1671.                     default:
  1672.                         if (n = this[e], c.is.empty(n) && (n = this.config[e].default), !this.options[e].includes(n)) return void this.debug.warn("Unsupported value of '" + n + "' for " + e);
  1673.                         if (!this.config[e].options.includes(n)) return void this.debug.warn("Disabled value of '" + n + "' for " + e)
  1674.                 }(c.is.element(s) || (s = i && i.querySelector("ul")), c.is.empty(n)) || (this.elements.settings.tabs[e].querySelector("." + this.config.classNames.menu.value).innerHTML = w.getLabel.call(this, e, n));
  1675.                 var a = s && s.querySelector('input[value="' + n + '"]');
  1676.                 c.is.element(a) && (a.checked = !0)
  1677.             },
  1678.             getLanguage: function () {
  1679.                 if (!this.supported.ui) return null;
  1680.                 if (!u.textTracks || !E.getTracks.call(this).length) return this.config.i18n.none;
  1681.                 if (this.captions.active) {
  1682.                     var e = E.getCurrentTrack.call(this);
  1683.                     if (c.is.track(e)) return e.label
  1684.                 }
  1685.                 return this.config.i18n.disabled
  1686.             },
  1687.             setCaptionsMenu: function () {
  1688.                 var e = this,
  1689.                     t = this.elements.settings.panes.captions.querySelector("ul"),
  1690.                     i = E.getTracks.call(this).length;
  1691.                 if (w.toggleTab.call(this, "captions", i), c.emptyElement(t), i) {
  1692.                     var n = E.getTracks.call(this).map(function (e) {
  1693.                         return {
  1694.                             language: e.language,
  1695.                             label: c.is.empty(e.label) ? e.language.toUpperCase() : e.label
  1696.                         }
  1697.                     });
  1698.                     n.unshift({
  1699.                         language: "",
  1700.                         label: this.config.i18n.none
  1701.                     }), n.forEach(function (i) {
  1702.                         w.createMenuItem.call(e, i.language, t, "language", i.label || i.language, w.createBadge.call(e, i.language.toUpperCase()), i.language.toLowerCase() === e.captions.language.toLowerCase())
  1703.                     }), w.updateSetting.call(this, "captions", t)
  1704.                 }
  1705.             },
  1706.             setSpeedMenu: function () {
  1707.                 var e = this;
  1708.                 c.is.object(this.options.speed) && Object.keys(this.options.speed).length || (this.options.speed = [.5, .75, 1, 1.25, 1.5, 1.75, 2]), this.options.speed = this.options.speed.filter(function (t) {
  1709.                     return e.config.speed.options.includes(t)
  1710.                 });
  1711.                 var t = !c.is.empty(this.options.speed);
  1712.                 if (w.toggleTab.call(this, "speed", t), t) {
  1713.                     var i = this.elements.settings.panes.speed.querySelector("ul");
  1714.                     c.toggleHidden(this.elements.settings.tabs.speed, !1), c.toggleHidden(this.elements.settings.panes.speed, !1), c.emptyElement(i), this.options.speed.forEach(function (t) {
  1715.                         return w.createMenuItem.call(e, t, i, "speed", w.getLabel.call(e, "speed", t))
  1716.                     }), w.updateSetting.call(this, "speed", i)
  1717.                 }
  1718.             },
  1719.             toggleMenu: function (e) {
  1720.                 var t = this.elements.settings.form,
  1721.                     i = this.elements.buttons.settings,
  1722.                     n = c.is.boolean(e) ? e : c.is.element(t) && "true" === t.getAttribute("aria-hidden");
  1723.                 if (c.is.event(e)) {
  1724.                     var s = c.is.element(t) && t.contains(e.target),
  1725.                         a = e.target === this.elements.buttons.settings;
  1726.                     if (s || !s && !a && n) return;
  1727.                     a && e.stopPropagation()
  1728.                 }
  1729.                 c.is.element(i) && i.setAttribute("aria-expanded", n), c.is.element(t) && (t.setAttribute("aria-hidden", !n), c.toggleClass(this.elements.container, this.config.classNames.menu.open, n), n ? t.removeAttribute("tabindex") : t.setAttribute("tabindex", -1))
  1730.             },
  1731.             getTabSize: function (e) {
  1732.                 var t = e.cloneNode(!0);
  1733.                 t.style.position = "absolute", t.style.opacity = 0, t.setAttribute("aria-hidden", !1), Array.from(t.querySelectorAll("input[name]")).forEach(function (e) {
  1734.                     var t = e.getAttribute("name");
  1735.                     e.setAttribute("name", t + "-clone")
  1736.                 }), e.parentNode.appendChild(t);
  1737.                 var i = t.scrollWidth,
  1738.                     n = t.scrollHeight;
  1739.                 return c.removeElement(t), {
  1740.                     width: i,
  1741.                     height: n
  1742.                 }
  1743.             },
  1744.             showTab: function (e) {
  1745.                 var t = this.elements.settings.menu,
  1746.                     i = e.target,
  1747.                     n = "false" === i.getAttribute("aria-expanded"),
  1748.                     s = document.getElementById(i.getAttribute("aria-controls"));
  1749.                 if (c.is.element(s) && "tabpanel" === s.getAttribute("role")) {
  1750.                     var a = t.querySelector('[role="tabpanel"][aria-hidden="false"]'),
  1751.                         o = a.parentNode;
  1752.                     if (Array.from(t.querySelectorAll('[aria-controls="' + a.getAttribute("id") + '"]')).forEach(function (e) {
  1753.                             e.setAttribute("aria-expanded", !1)
  1754.                         }), u.transitions && !u.reducedMotion) {
  1755.                         o.style.width = a.scrollWidth + "px", o.style.height = a.scrollHeight + "px";
  1756.                         var l = w.getTabSize.call(this, s);
  1757.                         c.on(o, c.transitionEndEvent, function e(t) {
  1758.                             t.target === o && ["width", "height"].includes(t.propertyName) && (o.style.width = "", o.style.height = "", c.off(o, c.transitionEndEvent, e))
  1759.                         }), o.style.width = l.width + "px", o.style.height = l.height + "px"
  1760.                     }
  1761.                     a.setAttribute("aria-hidden", !0), a.setAttribute("tabindex", -1), s.setAttribute("aria-hidden", !n), i.setAttribute("aria-expanded", n), s.removeAttribute("tabindex"), s.querySelectorAll("button:not(:disabled), input:not(:disabled), [tabindex]")[0].focus()
  1762.                 }
  1763.             },
  1764.             create: function (e) {
  1765.                 var t = this;
  1766.                 if (c.is.empty(this.config.controls)) return null;
  1767.                 var i = c.createElement("div", c.getAttributesFromSelector(this.config.selectors.controls.wrapper));
  1768.                 if (this.config.controls.includes("restart") && i.appendChild(w.createButton.call(this, "restart")), this.config.controls.includes("rewind") && i.appendChild(w.createButton.call(this, "rewind")), this.config.controls.includes("play") && i.appendChild(w.createButton.call(this, "play")), this.config.controls.includes("fast-forward") && i.appendChild(w.createButton.call(this, "fast-forward")), this.config.controls.includes("progress")) {
  1769.                     var n = c.createElement("div", c.getAttributesFromSelector(this.config.selectors.progress)),
  1770.                         s = w.createRange.call(this, "seek", {
  1771.                             id: "plyr-seek-" + e.id
  1772.                         });
  1773.                     if (n.appendChild(s.label), n.appendChild(s.input), n.appendChild(w.createProgress.call(this, "buffer")), this.config.tooltips.seek) {
  1774.                         var a = c.createElement("span", {
  1775.                             role: "tooltip",
  1776.                             class: this.config.classNames.tooltip
  1777.                         }, "00:00");
  1778.                         n.appendChild(a), this.elements.display.seekTooltip = a
  1779.                     }
  1780.                     this.elements.progress = n, i.appendChild(this.elements.progress)
  1781.                 }
  1782.                 if (this.config.controls.includes("current-time") && i.appendChild(w.createTime.call(this, "currentTime")), this.config.controls.includes("duration") && i.appendChild(w.createTime.call(this, "duration")), this.config.controls.includes("mute") && i.appendChild(w.createButton.call(this, "mute")), this.config.controls.includes("volume")) {
  1783.                     var o = c.createElement("div", {
  1784.                             class: "plyr__volume"
  1785.                         }),
  1786.                         l = {
  1787.                             max: 1,
  1788.                             step: .05,
  1789.                             value: this.config.volume
  1790.                         },
  1791.                         r = w.createRange.call(this, "volume", c.extend(l, {
  1792.                             id: "plyr-volume-" + e.id
  1793.                         }));
  1794.                     o.appendChild(r.label), o.appendChild(r.input), this.elements.volume = o, i.appendChild(o)
  1795.                 }
  1796.                 if (this.config.controls.includes("captions") && i.appendChild(w.createButton.call(this, "captions")), this.config.controls.includes("settings") && !c.is.empty(this.config.settings)) {
  1797.                     var d = c.createElement("div", {
  1798.                         class: "plyr__menu"
  1799.                     });
  1800.                     d.appendChild(w.createButton.call(this, "settings", {
  1801.                         id: "plyr-settings-toggle-" + e.id,
  1802.                         "aria-haspopup": !0,
  1803.                         "aria-controls": "plyr-settings-" + e.id,
  1804.                         "aria-expanded": !1
  1805.                     }));
  1806.                     var h = c.createElement("form", {
  1807.                             class: "plyr__menu__container",
  1808.                             id: "plyr-settings-" + e.id,
  1809.                             "aria-hidden": !0,
  1810.                             "aria-labelled-by": "plyr-settings-toggle-" + e.id,
  1811.                             role: "tablist",
  1812.                             tabindex: -1
  1813.                         }),
  1814.                         p = c.createElement("div"),
  1815.                         m = c.createElement("div", {
  1816.                             id: "plyr-settings-" + e.id + "-home",
  1817.                             "aria-hidden": !1,
  1818.                             "aria-labelled-by": "plyr-settings-toggle-" + e.id,
  1819.                             role: "tabpanel"
  1820.                         }),
  1821.                         g = c.createElement("ul", {
  1822.                             role: "tablist"
  1823.                         });
  1824.                     this.config.settings.forEach(function (i) {
  1825.                         var n = c.createElement("li", {
  1826.                                 role: "tab",
  1827.                                 hidden: ""
  1828.                             }),
  1829.                             s = c.createElement("button", c.extend(c.getAttributesFromSelector(t.config.selectors.buttons.settings), {
  1830.                                 type: "button",
  1831.                                 class: t.config.classNames.control + " " + t.config.classNames.control + "--forward",
  1832.                                 id: "plyr-settings-" + e.id + "-" + i + "-tab",
  1833.                                 "aria-haspopup": !0,
  1834.                                 "aria-controls": "plyr-settings-" + e.id + "-" + i,
  1835.                                 "aria-expanded": !1
  1836.                             }), t.config.i18n[i]),
  1837.                             a = c.createElement("span", {
  1838.                                 class: t.config.classNames.menu.value
  1839.                             });
  1840.                         a.innerHTML = e[i], s.appendChild(a), n.appendChild(s), g.appendChild(n), t.elements.settings.tabs[i] = n
  1841.                     }), m.appendChild(g), p.appendChild(m), this.config.settings.forEach(function (i) {
  1842.                         var n = c.createElement("div", {
  1843.                                 id: "plyr-settings-" + e.id + "-" + i,
  1844.                                 "aria-hidden": !0,
  1845.                                 "aria-labelled-by": "plyr-settings-" + e.id + "-" + i + "-tab",
  1846.                                 role: "tabpanel",
  1847.                                 tabindex: -1,
  1848.                                 hidden: ""
  1849.                             }),
  1850.                             s = c.createElement("button", {
  1851.                                 type: "button",
  1852.                                 class: t.config.classNames.control + " " + t.config.classNames.control + "--back",
  1853.                                 "aria-haspopup": !0,
  1854.                                 "aria-controls": "plyr-settings-" + e.id + "-home",
  1855.                                 "aria-expanded": !1
  1856.                             }, t.config.i18n[i]);
  1857.                         n.appendChild(s);
  1858.                         var a = c.createElement("ul");
  1859.                         n.appendChild(a), p.appendChild(n), t.elements.settings.panes[i] = n
  1860.                     }), h.appendChild(p), d.appendChild(h), i.appendChild(d), this.elements.settings.form = h, this.elements.settings.menu = d
  1861.                 }
  1862.                 return this.config.controls.includes("pip") && u.pip && i.appendChild(w.createButton.call(this, "pip")), this.config.controls.includes("airplay") && u.airplay && i.appendChild(w.createButton.call(this, "airplay")), this.config.controls.includes("fullscreen") && i.appendChild(w.createButton.call(this, "fullscreen")), this.config.controls.includes("play-large") && this.elements.container.appendChild(w.createButton.call(this, "play-large")), this.elements.controls = i, this.config.controls.includes("settings") && this.config.settings.includes("speed") && w.setSpeedMenu.call(this), i
  1863.             },
  1864.             inject: function () {
  1865.                 var e = this;
  1866.                 if (this.config.loadSprite) {
  1867.                     var t = w.getIconUrl.call(this);
  1868.                     t.absolute && c.loadSprite(t.url, "sprite-plyr")
  1869.                 }
  1870.                 this.id = Math.floor(1e4 * Math.random());
  1871.                 var i = null;
  1872.                 i = c.is.string(this.config.controls) ? this.config.controls : c.is.function(this.config.controls) ? this.config.controls({
  1873.                     id: this.id,
  1874.                     seektime: this.config.seekTime,
  1875.                     title: this.config.title
  1876.                 }) : w.create.call(this, {
  1877.                     id: this.id,
  1878.                     seektime: this.config.seekTime,
  1879.                     speed: this.speed,
  1880.                     quality: this.quality,
  1881.                     captions: w.getLanguage.call(this)
  1882.                 });
  1883.                 var n = void 0;
  1884.                 if (c.is.string(this.config.selectors.controls.container) && (n = document.querySelector(this.config.selectors.controls.container)), c.is.element(n) || (n = this.elements.container), c.is.element(i) ? n.appendChild(i) : n.insertAdjacentHTML("beforeend", i), c.is.element(this.elements.controls) && c.findElements.call(this), window.navigator.userAgent.includes("Edge") && c.repaint(n), this.config.tooltips.controls) {
  1885.                     var s = c.getElements.call(this, [this.config.selectors.controls.wrapper, " ", this.config.selectors.labels, " .", this.config.classNames.hidden].join(""));
  1886.                     Array.from(s).forEach(function (t) {
  1887.                         c.toggleClass(t, e.config.classNames.hidden, !1), c.toggleClass(t, e.config.classNames.tooltip, !0), t.setAttribute("role", "tooltip")
  1888.                     })
  1889.                 }
  1890.             }
  1891.         },
  1892.         E = {
  1893.             setup: function () {
  1894.                 if (this.supported.ui) {
  1895.                     var e = this.storage.get("language");
  1896.                     if (c.is.empty(e) || (this.captions.language = e), c.is.empty(this.captions.language) && (this.captions.language = this.config.captions.language.toLowerCase()), !c.is.boolean(this.captions.active)) {
  1897.                         var t = this.storage.get("captions");
  1898.                         c.is.boolean(t) ? this.captions.active = t : this.captions.active = this.config.captions.active
  1899.                     }!this.isVideo || this.isYouTube || this.isHTML5 && !u.textTracks ? this.config.controls.includes("settings") && this.config.settings.includes("captions") && w.setCaptionsMenu.call(this) : (c.is.element(this.elements.captions) || (this.elements.captions = c.createElement("div", c.getAttributesFromSelector(this.config.selectors.captions)), c.insertAfter(this.elements.captions, this.elements.wrapper)), c.toggleClass(this.elements.container, this.config.classNames.captions.enabled, !c.is.empty(E.getTracks.call(this))), c.is.empty(E.getTracks.call(this)) || (E.setLanguage.call(this), E.show.call(this), this.config.controls.includes("settings") && this.config.settings.includes("captions") && w.setCaptionsMenu.call(this)))
  1900.                 }
  1901.             },
  1902.             setLanguage: function () {
  1903.                 var e = this;
  1904.                 if (this.isHTML5 && this.isVideo) {
  1905.                     E.getTracks.call(this).forEach(function (t) {
  1906.                         c.on(t, "cuechange", function (t) {
  1907.                             return E.setCue.call(e, t)
  1908.                         }), t.mode = "hidden"
  1909.                     });
  1910.                     var t = E.getCurrentTrack.call(this);
  1911.                     c.is.track(t) && Array.from(t.activeCues || []).length && E.setCue.call(this, t)
  1912.                 } else this.isVimeo && this.captions.active && this.embed.enableTextTrack(this.language)
  1913.             },
  1914.             getTracks: function () {
  1915.                 return c.is.nullOrUndefined(this.media) ? [] : Array.from(this.media.textTracks || []).filter(function (e) {
  1916.                     return ["captions", "subtitles"].includes(e.kind)
  1917.                 })
  1918.             },
  1919.             getCurrentTrack: function () {
  1920.                 var e = this;
  1921.                 return E.getTracks.call(this).find(function (t) {
  1922.                     return t.language.toLowerCase() === e.language
  1923.                 })
  1924.             },
  1925.             setCue: function (e) {
  1926.                 var t = c.is.event(e) ? e.target : e,
  1927.                     i = t.activeCues[0];
  1928.                 t === E.getCurrentTrack.call(this) && (c.is.cue(i) ? E.setText.call(this, i.getCueAsHTML()) : E.setText.call(this, null), c.dispatchEvent.call(this, this.media, "cuechange"))
  1929.             },
  1930.             setText: function (e) {
  1931.                 if (this.supported.ui)
  1932.                     if (c.is.element(this.elements.captions)) {
  1933.                         var t = c.createElement("span");
  1934.                         c.emptyElement(this.elements.captions);
  1935.                         var i = c.is.nullOrUndefined(e) ? "" : e;
  1936.                         c.is.string(i) ? t.textContent = i.trim() : t.appendChild(i), this.elements.captions.appendChild(t)
  1937.                     } else this.debug.warn("No captions element to render to")
  1938.             },
  1939.             show: function () {
  1940.                 if (c.is.element(this.elements.buttons.captions)) {
  1941.                     var e = this.storage.get("captions");
  1942.                     c.is.boolean(e) ? this.captions.active = e : e = this.config.captions.active, e && (c.toggleClass(this.elements.container, this.config.classNames.captions.active, !0), c.toggleState(this.elements.buttons.captions, !0))
  1943.                 }
  1944.             }
  1945.         },
  1946.         T = {
  1947.             setup: function () {
  1948.                 var e = this;
  1949.                 c.toggleClass(this.elements.wrapper, this.config.classNames.embed, !0), T.setAspectRatio.call(this), c.is.object(window.YT) && c.is.function(window.YT.Player) ? T.ready.call(this) : (c.loadScript(this.config.urls.youtube.api), window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || [], window.onYouTubeReadyCallbacks.push(function () {
  1950.                     T.ready.call(e)
  1951.                 }), window.onYouTubeIframeAPIReady = function () {
  1952.                     window.onYouTubeReadyCallbacks.forEach(function (e) {
  1953.                         e()
  1954.                     })
  1955.                 })
  1956.             },
  1957.             getTitle: function (e) {
  1958.                 var t = this;
  1959.                 if (c.is.function(this.embed.getVideoData)) {
  1960.                     var i = this.embed.getVideoData().title;
  1961.                     if (c.is.empty(i)) return this.config.title = i, void b.setTitle.call(this)
  1962.                 }
  1963.                 var n = this.config.keys.google;
  1964.                 if (c.is.string(n) && !c.is.empty(n)) {
  1965.                     var s = "https://www.googleapis.com/youtube/v3/videos?id=" + e + "&key=" + n + "&fields=items(snippet(title))&part=snippet";
  1966.                     c.fetch(s).then(function (e) {
  1967.                         c.is.object(e) && (t.config.title = e.items[0].snippet.title, b.setTitle.call(t))
  1968.                     }).catch(function () {})
  1969.                 }
  1970.             },
  1971.             setAspectRatio: function () {
  1972.                 var e = this.config.ratio.split(":");
  1973.                 this.elements.wrapper.style.paddingBottom = 100 / e[0] * e[1] + "%"
  1974.             },
  1975.             ready: function () {
  1976.                 var e = this,
  1977.                     t = e.media.getAttribute("id");
  1978.                 if (c.is.empty(t) || !t.startsWith("youtube-")) {
  1979.                     var i = e.media.getAttribute("src");
  1980.                     c.is.empty(i) && (i = e.media.getAttribute(this.config.attributes.embed.id));
  1981.                     var n = c.parseYouTubeId(i),
  1982.                         s = c.generateId(e.provider),
  1983.                         a = c.createElement("div", {
  1984.                             id: s
  1985.                         });
  1986.                     e.media = c.replaceElement(a, e.media), e.embed = new window.YT.Player(s, {
  1987.                         videoId: n,
  1988.                         playerVars: {
  1989.                             autoplay: e.config.autoplay ? 1 : 0,
  1990.                             controls: e.supported.ui ? 0 : 1,
  1991.                             rel: 0,
  1992.                             showinfo: 0,
  1993.                             iv_load_policy: 3,
  1994.                             modestbranding: 1,
  1995.                             disablekb: 1,
  1996.                             playsinline: 1,
  1997.                             widget_referrer: window ? window.location.href : null,
  1998.                             cc_load_policy: e.captions.active ? 1 : 0,
  1999.                             cc_lang_pref: e.config.captions.language
  2000.                         },
  2001.                         events: {
  2002.                             onError: function (t) {
  2003.                                 if (!c.is.object(e.media.error)) {
  2004.                                     var i = {
  2005.                                         code: t.data
  2006.                                     };
  2007.                                     switch (t.data) {
  2008.                                         case 2:
  2009.                                             i.message = "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.";
  2010.                                             break;
  2011.                                         case 5:
  2012.                                             i.message = "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.";
  2013.                                             break;
  2014.                                         case 100:
  2015.                                             i.message = "The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.";
  2016.                                             break;
  2017.                                         case 101:
  2018.                                         case 150:
  2019.                                             i.message = "The owner of the requested video does not allow it to be played in embedded players.";
  2020.                                             break;
  2021.                                         default:
  2022.                                             i.message = "An unknown error occured"
  2023.                                     }
  2024.                                     e.media.error = i, c.dispatchEvent.call(e, e.media, "error")
  2025.                                 }
  2026.                             },
  2027.                             onPlaybackQualityChange: function (t) {
  2028.                                 var i = t.target;
  2029.                                 e.media.quality = i.getPlaybackQuality(), c.dispatchEvent.call(e, e.media, "qualitychange")
  2030.                             },
  2031.                             onPlaybackRateChange: function (t) {
  2032.                                 var i = t.target;
  2033.                                 e.media.playbackRate = i.getPlaybackRate(), c.dispatchEvent.call(e, e.media, "ratechange")
  2034.                             },
  2035.                             onReady: function (t) {
  2036.                                 var i = t.target;
  2037.                                 T.getTitle.call(e, n), e.media.play = function () {
  2038.                                     i.playVideo(), e.media.paused = !1
  2039.                                 }, e.media.pause = function () {
  2040.                                     i.pauseVideo(), e.media.paused = !0
  2041.                                 }, e.media.stop = function () {
  2042.                                     i.stopVideo(), e.media.paused = !0
  2043.                                 }, e.media.duration = i.getDuration(), e.media.paused = !0, e.media.currentTime = 0, Object.defineProperty(e.media, "currentTime", {
  2044.                                     get: function () {
  2045.                                         return Number(i.getCurrentTime())
  2046.                                     },
  2047.                                     set: function (t) {
  2048.                                         e.media.seeking = !0, c.dispatchEvent.call(e, e.media, "seeking"), i.seekTo(t)
  2049.                                     }
  2050.                                 }), Object.defineProperty(e.media, "playbackRate", {
  2051.                                     get: function () {
  2052.                                         return i.getPlaybackRate()
  2053.                                     },
  2054.                                     set: function (e) {
  2055.                                         i.setPlaybackRate(e)
  2056.                                     }
  2057.                                 }), Object.defineProperty(e.media, "quality", {
  2058.                                     get: function () {
  2059.                                         return i.getPlaybackQuality()
  2060.                                     },
  2061.                                     set: function (t) {
  2062.                                         c.dispatchEvent.call(e, e.media, "qualityrequested", !1, {
  2063.                                             quality: t
  2064.                                         }), i.setPlaybackQuality(t)
  2065.                                     }
  2066.                                 });
  2067.                                 var s = e.config.volume;
  2068.                                 Object.defineProperty(e.media, "volume", {
  2069.                                     get: function () {
  2070.                                         return s
  2071.                                     },
  2072.                                     set: function (t) {
  2073.                                         s = t, i.setVolume(100 * s), c.dispatchEvent.call(e, e.media, "volumechange")
  2074.                                     }
  2075.                                 });
  2076.                                 var a = e.config.muted;
  2077.                                 Object.defineProperty(e.media, "muted", {
  2078.                                     get: function () {
  2079.                                         return a
  2080.                                     },
  2081.                                     set: function (t) {
  2082.                                         var n = c.is.boolean(t) ? t : a;
  2083.                                         a = n, i[n ? "mute" : "unMute"](), c.dispatchEvent.call(e, e.media, "volumechange")
  2084.                                     }
  2085.                                 }), Object.defineProperty(e.media, "currentSrc", {
  2086.                                     get: function () {
  2087.                                         return i.getVideoUrl()
  2088.                                     }
  2089.                                 }), Object.defineProperty(e.media, "ended", {
  2090.                                     get: function () {
  2091.                                         return e.currentTime === e.duration
  2092.                                     }
  2093.                                 }), e.options.speed = i.getAvailablePlaybackRates(), e.supported.ui && e.media.setAttribute("tabindex", -1), c.dispatchEvent.call(e, e.media, "timeupdate"), c.dispatchEvent.call(e, e.media, "durationchange"), window.clearInterval(e.timers.buffering), e.timers.buffering = window.setInterval(function () {
  2094.                                     e.media.buffered = i.getVideoLoadedFraction(), (null === e.media.lastBuffered || e.media.lastBuffered < e.media.buffered) && c.dispatchEvent.call(e, e.media, "progress"), e.media.lastBuffered = e.media.buffered, 1 === e.media.buffered && (window.clearInterval(e.timers.buffering), c.dispatchEvent.call(e, e.media, "canplaythrough"))
  2095.                                 }, 200), window.setTimeout(function () {
  2096.                                     return b.build.call(e)
  2097.                                 }, 50)
  2098.                             },
  2099.                             onStateChange: function (t) {
  2100.                                 var i = t.target;
  2101.                                 switch (window.clearInterval(e.timers.playing), t.data) {
  2102.                                     case 0:
  2103.                                         e.media.paused = !0, e.media.loop ? (i.stopVideo(), i.playVideo()) : c.dispatchEvent.call(e, e.media, "ended");
  2104.                                         break;
  2105.                                     case 1:
  2106.                                         e.media.seeking && c.dispatchEvent.call(e, e.media, "seeked"), e.media.seeking = !1, e.media.paused && c.dispatchEvent.call(e, e.media, "play"), e.media.paused = !1, c.dispatchEvent.call(e, e.media, "playing"), e.timers.playing = window.setInterval(function () {
  2107.                                             c.dispatchEvent.call(e, e.media, "timeupdate")
  2108.                                         }, 50), e.media.duration !== i.getDuration() && (e.media.duration = i.getDuration(), c.dispatchEvent.call(e, e.media, "durationchange")), w.setQualityMenu.call(e, i.getAvailableQualityLevels());
  2109.                                         break;
  2110.                                     case 2:
  2111.                                         e.media.paused = !0, c.dispatchEvent.call(e, e.media, "pause")
  2112.                                 }
  2113.                                 c.dispatchEvent.call(e, e.elements.container, "statechange", !1, {
  2114.                                     code: t.data
  2115.                                 })
  2116.                             }
  2117.                         }
  2118.                     })
  2119.                 }
  2120.             }
  2121.         },
  2122.         A = {
  2123.             setup: function () {
  2124.                 var e = this;
  2125.                 c.toggleClass(this.elements.wrapper, this.config.classNames.embed, !0), A.setAspectRatio.call(this), c.is.object(window.Vimeo) ? A.ready.call(this) : c.loadScript(this.config.urls.vimeo.api, function () {
  2126.                     A.ready.call(e)
  2127.                 })
  2128.             },
  2129.             setAspectRatio: function (e) {
  2130.                 var t = c.is.string(e) ? e.split(":") : this.config.ratio.split(":"),
  2131.                     i = 100 / t[0] * t[1],
  2132.                     n = (200 - i) / 4;
  2133.                 this.elements.wrapper.style.paddingBottom = i + "%", this.media.style.transform = "translateY(-" + n + "%)"
  2134.             },
  2135.             ready: function () {
  2136.                 var e = this,
  2137.                     t = this,
  2138.                     i = {
  2139.                         loop: t.config.loop.active,
  2140.                         autoplay: t.autoplay,
  2141.                         byline: !1,
  2142.                         portrait: !1,
  2143.                         title: !1,
  2144.                         speed: !0,
  2145.                         transparent: 0,
  2146.                         gesture: "media"
  2147.                     },
  2148.                     n = c.buildUrlParams(i),
  2149.                     s = t.media.getAttribute("src");
  2150.                 c.is.empty(s) && (s = t.media.getAttribute(this.config.attributes.embed.id));
  2151.                 var a = c.parseVimeoId(s),
  2152.                     o = c.createElement("iframe"),
  2153.                     l = "https://player.vimeo.com/video/" + a + "?" + n;
  2154.                 o.setAttribute("src", l), o.setAttribute("allowfullscreen", ""), o.setAttribute("allowtransparency", ""), o.setAttribute("allow", "autoplay");
  2155.                 var r = c.createElement("div");
  2156.                 r.appendChild(o), t.media = c.replaceElement(r, t.media), t.embed = new window.Vimeo.Player(o), t.media.paused = !0, t.media.currentTime = 0, t.media.play = function () {
  2157.                     t.embed.play().then(function () {
  2158.                         t.media.paused = !1
  2159.                     })
  2160.                 }, t.media.pause = function () {
  2161.                     t.embed.pause().then(function () {
  2162.                         t.media.paused = !0
  2163.                     })
  2164.                 }, t.media.stop = function () {
  2165.                     t.embed.stop().then(function () {
  2166.                         t.media.paused = !0, t.currentTime = 0
  2167.                     })
  2168.                 };
  2169.                 var u = t.media.currentTime;
  2170.                 Object.defineProperty(t.media, "currentTime", {
  2171.                     get: function () {
  2172.                         return u
  2173.                     },
  2174.                     set: function (e) {
  2175.                         var i = t.media.paused;
  2176.                         t.media.seeking = !0, c.dispatchEvent.call(t, t.media, "seeking"), t.embed.setCurrentTime(e), i && t.pause()
  2177.                     }
  2178.                 });
  2179.                 var d = t.config.speed.selected;
  2180.                 Object.defineProperty(t.media, "playbackRate", {
  2181.                     get: function () {
  2182.                         return d
  2183.                     },
  2184.                     set: function (e) {
  2185.                         t.embed.setPlaybackRate(e).then(function () {
  2186.                             d = e, c.dispatchEvent.call(t, t.media, "ratechange")
  2187.                         })
  2188.                     }
  2189.                 });
  2190.                 var h = t.config.volume;
  2191.                 Object.defineProperty(t.media, "volume", {
  2192.                     get: function () {
  2193.                         return h
  2194.                     },
  2195.                     set: function (e) {
  2196.                         t.embed.setVolume(e).then(function () {
  2197.                             h = e, c.dispatchEvent.call(t, t.media, "volumechange")
  2198.                         })
  2199.                     }
  2200.                 });
  2201.                 var p = t.config.muted;
  2202.                 Object.defineProperty(t.media, "muted", {
  2203.                     get: function () {
  2204.                         return p
  2205.                     },
  2206.                     set: function (e) {
  2207.                         var i = !!c.is.boolean(e) && e;
  2208.                         t.embed.setVolume(i ? 0 : t.config.volume).then(function () {
  2209.                             p = i, c.dispatchEvent.call(t, t.media, "volumechange")
  2210.                         })
  2211.                     }
  2212.                 });
  2213.                 var m = t.config.loop;
  2214.                 Object.defineProperty(t.media, "loop", {
  2215.                     get: function () {
  2216.                         return m
  2217.                     },
  2218.                     set: function (e) {
  2219.                         var i = c.is.boolean(e) ? e : t.config.loop.active;
  2220.                         t.embed.setLoop(i).then(function () {
  2221.                             m = i
  2222.                         })
  2223.                     }
  2224.                 });
  2225.                 var g = void 0;
  2226.                 t.embed.getVideoUrl().then(function (e) {
  2227.                     g = e
  2228.                 }), Object.defineProperty(t.media, "currentSrc", {
  2229.                     get: function () {
  2230.                         return g
  2231.                     }
  2232.                 }), Object.defineProperty(t.media, "ended", {
  2233.                     get: function () {
  2234.                         return t.currentTime === t.duration
  2235.                     }
  2236.                 }), Promise.all([t.embed.getVideoWidth(), t.embed.getVideoHeight()]).then(function (t) {
  2237.                     var i = c.getAspectRatio(t[0], t[1]);
  2238.                     A.setAspectRatio.call(e, i)
  2239.                 }), t.embed.setAutopause(t.config.autopause).then(function (e) {
  2240.                     t.config.autopause = e
  2241.                 }), t.embed.getVideoTitle().then(function (i) {
  2242.                     t.config.title = i, b.setTitle.call(e)
  2243.                 }), t.embed.getCurrentTime().then(function (e) {
  2244.                     u = e, c.dispatchEvent.call(t, t.media, "timeupdate")
  2245.                 }), t.embed.getDuration().then(function (e) {
  2246.                     t.media.duration = e, c.dispatchEvent.call(t, t.media, "durationchange")
  2247.                 }), t.embed.getTextTracks().then(function (e) {
  2248.                     t.media.textTracks = e, E.setup.call(t)
  2249.                 }), t.embed.on("cuechange", function (e) {
  2250.                     var i = null;
  2251.                     e.cues.length && (i = c.stripHTML(e.cues[0].text)), E.setText.call(t, i)
  2252.                 }), t.embed.on("loaded", function () {
  2253.                     c.is.element(t.embed.element) && t.supported.ui && t.embed.element.setAttribute("tabindex", -1)
  2254.                 }), t.embed.on("play", function () {
  2255.                     t.media.paused && c.dispatchEvent.call(t, t.media, "play"), t.media.paused = !1, c.dispatchEvent.call(t, t.media, "playing")
  2256.                 }), t.embed.on("pause", function () {
  2257.                     t.media.paused = !0, c.dispatchEvent.call(t, t.media, "pause")
  2258.                 }), t.embed.on("timeupdate", function (e) {
  2259.                     t.media.seeking = !1, u = e.seconds, c.dispatchEvent.call(t, t.media, "timeupdate")
  2260.                 }), t.embed.on("progress", function (e) {
  2261.                     t.media.buffered = e.percent, c.dispatchEvent.call(t, t.media, "progress"), 1 === parseInt(e.percent, 10) && c.dispatchEvent.call(t, t.media, "canplaythrough")
  2262.                 }), t.embed.on("seeked", function () {
  2263.                     t.media.seeking = !1, c.dispatchEvent.call(t, t.media, "seeked"), c.dispatchEvent.call(t, t.media, "play")
  2264.                 }), t.embed.on("ended", function () {
  2265.                     t.media.paused = !0, c.dispatchEvent.call(t, t.media, "ended")
  2266.                 }), t.embed.on("error", function (e) {
  2267.                     t.media.error = e, c.dispatchEvent.call(t, t.media, "error")
  2268.                 }), window.setTimeout(function () {
  2269.                     return b.build.call(t)
  2270.                 }, 0)
  2271.             }
  2272.         },
  2273.         C = c.getBrowser(),
  2274.         S = {
  2275.             setup: function () {
  2276.                 if (this.media)
  2277.                     if (c.toggleClass(this.elements.container, this.config.classNames.type.replace("{0}", this.type), !0), c.toggleClass(this.elements.container, this.config.classNames.provider.replace("{0}", this.provider), !0), this.isEmbed && c.toggleClass(this.elements.container, this.config.classNames.type.replace("{0}", "video"), !0), this.supported.ui && (c.toggleClass(this.elements.container, this.config.classNames.pip.supported, u.pip && this.isHTML5 && this.isVideo), c.toggleClass(this.elements.container, this.config.classNames.airplay.supported, u.airplay && this.isHTML5), c.toggleClass(this.elements.container, this.config.classNames.stopped, this.config.autoplay), c.toggleClass(this.elements.container, this.config.classNames.isIos, C.isIos), c.toggleClass(this.elements.container, this.config.classNames.isTouch, u.touch)), this.isVideo && (this.elements.wrapper = c.createElement("div", {
  2278.                             class: this.config.classNames.video
  2279.                         }), c.wrap(this.media, this.elements.wrapper)), this.isEmbed) switch (this.provider) {
  2280.                         case "youtube":
  2281.                             T.setup.call(this);
  2282.                             break;
  2283.                         case "vimeo":
  2284.                             A.setup.call(this)
  2285.                     } else this.isHTML5 && b.setTitle.call(this);
  2286.                     else this.debug.warn("No media element found!")
  2287.             },
  2288.             cancelRequests: function () {
  2289.                 this.isHTML5 && (Array.from(this.media.querySelectorAll("source")).forEach(c.removeElement), this.media.setAttribute("src", this.config.blankVideo), this.media.load(), this.debug.log("Cancelled network requests"))
  2290.             }
  2291.         },
  2292.         N = {
  2293.             insertElements: function (e, t) {
  2294.                 var i = this;
  2295.                 c.is.string(t) ? c.insertElement(e, this.media, {
  2296.                     src: t
  2297.                 }) : c.is.array(t) && t.forEach(function (t) {
  2298.                     c.insertElement(e, i.media, t)
  2299.                 })
  2300.             },
  2301.             change: function (e) {
  2302.                 var t = this;
  2303.                 c.is.object(e) && "sources" in e && e.sources.length ? (S.cancelRequests.call(this), this.destroy.call(this, function () {
  2304.                     switch (c.removeElement(t.media), t.media = null, c.is.element(t.elements.container) && t.elements.container.removeAttribute("class"), t.type = e.type, t.provider = c.is.empty(e.sources[0].provider) ? i.html5 : e.sources[0].provider, t.supported = u.check(t.type, t.provider, t.config.inline), t.provider + ":" + t.type) {
  2305.                         case "html5:video":
  2306.                             t.media = c.createElement("video");
  2307.                             break;
  2308.                         case "html5:audio":
  2309.                             t.media = c.createElement("audio");
  2310.                             break;
  2311.                         case "youtube:video":
  2312.                         case "vimeo:video":
  2313.                             t.media = c.createElement("div", {
  2314.                                 src: e.sources[0].src
  2315.                             })
  2316.                     }
  2317.                     t.elements.container.appendChild(t.media), c.is.boolean(e.autoplay) && (t.config.autoplay = e.autoplay), t.isHTML5 && (t.config.crossorigin && t.media.setAttribute("crossorigin", ""), t.config.autoplay && t.media.setAttribute("autoplay", ""), "poster" in e && t.media.setAttribute("poster", e.poster), t.config.loop.active && t.media.setAttribute("loop", ""), t.config.muted && t.media.setAttribute("muted", ""), t.config.inline && t.media.setAttribute("playsinline", "")), b.addStyleHook.call(t), t.isHTML5 && N.insertElements.call(t, "source", e.sources), t.config.title = e.title, S.setup.call(t), t.isHTML5 && ("tracks" in e && N.insertElements.call(t, "track", e.tracks), t.media.load()), (t.isHTML5 || t.isEmbed && !t.supported.ui) && b.build.call(t)
  2318.                 }, !0)) : this.debug.warn("Invalid source format")
  2319.             }
  2320.         },
  2321.         P = {
  2322.             x: 0,
  2323.             y: 0
  2324.         };
  2325.     return function () {
  2326.         function e(t, o) {
  2327.             var l = this;
  2328.             if (a(this, e), this.timers = {}, this.ready = !1, this.loading = !1, this.failed = !1, this.media = t, c.is.string(this.media) && (this.media = document.querySelectorAll(this.media)), (window.jQuery && this.media instanceof jQuery || c.is.nodeList(this.media) || c.is.array(this.media)) && (this.media = this.media[0]), this.config = c.extend({}, s, o, function () {
  2329.                     try {
  2330.                         return JSON.parse(l.media.getAttribute("data-plyr-config"))
  2331.                     } catch (e) {
  2332.                         return {}
  2333.                     }
  2334.                 }()), this.elements = {
  2335.                     container: null,
  2336.                     buttons: {},
  2337.                     display: {},
  2338.                     progress: {},
  2339.                     inputs: {},
  2340.                     settings: {
  2341.                         menu: null,
  2342.                         panes: {},
  2343.                         tabs: {}
  2344.                     },
  2345.                     captions: null
  2346.                 }, this.captions = {
  2347.                     active: null,
  2348.                     currentTrack: null
  2349.                 }, this.fullscreen = {
  2350.                     active: !1
  2351.                 }, this.options = {
  2352.                     speed: [],
  2353.                     quality: []
  2354.                 }, this.debug = new h(this.config.debug), this.debug.log("Config", this.config), this.debug.log("Support", u), !c.is.nullOrUndefined(this.media) && c.is.element(this.media))
  2355.                 if (this.media.plyr) this.debug.warn("Target already setup");
  2356.                 else if (this.config.enabled)
  2357.                 if (u.check().api) {
  2358.                     this.elements.original = this.media.cloneNode(!0);
  2359.                     var r = this.media.tagName.toLowerCase(),
  2360.                         d = null,
  2361.                         g = null,
  2362.                         f = null;
  2363.                     switch (r) {
  2364.                         case "div":
  2365.                             if (d = this.media.querySelector("iframe"), c.is.element(d)) {
  2366.                                 if (g = d.getAttribute("src"), this.provider = c.getProviderByUrl(g), this.elements.container = this.media, this.media = d, this.elements.container.className = "", f = c.getUrlParams(g), !c.is.empty(f)) {
  2367.                                     var y = ["1", "true"];
  2368.                                     y.includes(f.autoplay) && (this.config.autoplay = !0), y.includes(f.playsinline) && (this.config.inline = !0), y.includes(f.loop) && (this.config.loop.active = !0)
  2369.                                 }
  2370.                             } else this.provider = this.media.getAttribute(this.config.attributes.embed.provider), this.media.removeAttribute(this.config.attributes.embed.provider);
  2371.                             if (c.is.empty(this.provider) || !Object.keys(i).includes(this.provider)) return void this.debug.error("Setup failed: Invalid provider");
  2372.                             this.type = n.video;
  2373.                             break;
  2374.                         case "video":
  2375.                         case "audio":
  2376.                             this.type = r, this.provider = i.html5, this.media.hasAttribute("crossorigin") && (this.config.crossorigin = !0), this.media.hasAttribute("autoplay") && (this.config.autoplay = !0), this.media.hasAttribute("playsinline") && (this.config.inline = !0), this.media.hasAttribute("muted") && (this.config.muted = !0), this.media.hasAttribute("loop") && (this.config.loop.active = !0);
  2377.                             break;
  2378.                         default:
  2379.                             return void this.debug.error("Setup failed: unsupported type")
  2380.                     }
  2381.                     this.storage = new p(this), this.supported = u.check(this.type, this.provider, this.config.inline), this.supported.api ? (this.media.plyr = this, c.is.element(this.elements.container) || (this.elements.container = c.createElement("div"), c.wrap(this.media, this.elements.container)), this.elements.container.setAttribute("tabindex", 0), v.global.call(this), b.addStyleHook.call(this), S.setup.call(this), this.config.debug && c.on(this.elements.container, this.config.events.join(" "), function (e) {
  2382.                         l.debug.log("event: " + e.type)
  2383.                     }), (this.isHTML5 || this.isEmbed && !this.supported.ui) && b.build.call(this), this.ads = new m(this)) : this.debug.error("Setup failed: no support")
  2384.                 } else this.debug.error("Setup failed: no support");
  2385.             else this.debug.error("Setup failed: disabled by config");
  2386.             else this.debug.error("Setup failed: no suitable element passed")
  2387.         }
  2388.         return o(e, [{
  2389.             key: "play",
  2390.             value: function () {
  2391.                 return !this.ads.enabled || this.ads.initialized || this.ads.blocked ? this.media.play() : (this.ads.play(), null)
  2392.             }
  2393.         }, {
  2394.             key: "pause",
  2395.             value: function () {
  2396.                 this.playing && this.media.pause()
  2397.             }
  2398.         }, {
  2399.             key: "togglePlay",
  2400.             value: function (e) {
  2401.                 (c.is.boolean(e) ? e : !this.playing) ? this.play(): this.pause()
  2402.             }
  2403.         }, {
  2404.             key: "stop",
  2405.             value: function () {
  2406.                 this.restart(), this.pause()
  2407.             }
  2408.         }, {
  2409.             key: "restart",
  2410.             value: function () {
  2411.                 this.currentTime = 0
  2412.             }
  2413.         }, {
  2414.             key: "rewind",
  2415.             value: function (e) {
  2416.                 this.currentTime = this.currentTime - (c.is.number(e) ? e : this.config.seekTime)
  2417.             }
  2418.         }, {
  2419.             key: "forward",
  2420.             value: function (e) {
  2421.                 this.currentTime = this.currentTime + (c.is.number(e) ? e : this.config.seekTime)
  2422.             }
  2423.         }, {
  2424.             key: "increaseVolume",
  2425.             value: function (e) {
  2426.                 var t = this.media.muted ? 0 : this.volume;
  2427.                 this.volume = t + (c.is.number(e) ? e : 1)
  2428.             }
  2429.         }, {
  2430.             key: "decreaseVolume",
  2431.             value: function (e) {
  2432.                 var t = this.media.muted ? 0 : this.volume;
  2433.                 this.volume = t - (c.is.number(e) ? e : 1)
  2434.             }
  2435.         }, {
  2436.             key: "toggleCaptions",
  2437.             value: function (e) {
  2438.                 if (this.supported.ui && c.is.element(this.elements.buttons.captions)) {
  2439.                     var t = c.is.boolean(e) ? e : -1 === this.elements.container.className.indexOf(this.config.classNames.captions.active);
  2440.                     this.captions.active !== t && (this.captions.active = t, c.toggleState(this.elements.buttons.captions, this.captions.active), c.toggleClass(this.elements.container, this.config.classNames.captions.active, this.captions.active), c.dispatchEvent.call(this, this.media, this.captions.active ? "captionsenabled" : "captionsdisabled"))
  2441.                 }
  2442.             }
  2443.         }, {
  2444.             key: "toggleFullscreen",
  2445.             value: function (e) {
  2446.                 if (!this.isAudio) {
  2447.                     if (f.enabled) {
  2448.                         if (!c.is.event(e) || e.type !== f.eventType) return void(this.fullscreen.active ? f.cancelFullScreen() : f.requestFullScreen(this.elements.container));
  2449.                         this.fullscreen.active = f.isFullScreen(this.elements.container)
  2450.                     } else this.fullscreen.active = !this.fullscreen.active, c.toggleClass(this.elements.container, this.config.classNames.fullscreen.fallback, this.fullscreen.active), this.fullscreen.active ? P = {
  2451.                         x: window.pageXOffset || 0,
  2452.                         y: window.pageYOffset || 0
  2453.                     } : window.scrollTo(P.x, P.y), document.body.style.overflow = this.fullscreen.active ? "hidden" : "";
  2454.                     c.is.element(this.elements.buttons.fullscreen) && c.toggleState(this.elements.buttons.fullscreen, this.fullscreen.active), c.dispatchEvent.call(this, this.media, this.fullscreen.active ? "enterfullscreen" : "exitfullscreen")
  2455.                 }
  2456.             }
  2457.         }, {
  2458.             key: "airplay",
  2459.             value: function () {
  2460.                 u.airplay && this.media.webkitShowPlaybackTargetPicker()
  2461.             }
  2462.         }, {
  2463.             key: "toggleControls",
  2464.             value: function (e) {
  2465.                 var t = this;
  2466.                 if (c.is.element(this.elements.controls) && this.supported.ui && !this.isAudio) {
  2467.                     var i = 0,
  2468.                         n = e,
  2469.                         s = !1;
  2470.                     if (c.is.boolean(e) || (c.is.event(e) ? (s = "enterfullscreen" === e.type, n = ["mouseenter", "mousemove", "touchstart", "touchmove", "focusin"].includes(e.type), ["mousemove", "touchmove", "touchend"].includes(e.type) && (i = 2e3), "focusin" === e.type && (i = 3e3, c.toggleClass(this.elements.controls, this.config.classNames.noTransition, !0))) : n = c.hasClass(this.elements.container, this.config.classNames.hideControls)), window.clearTimeout(this.timers.controls), n || this.paused || this.loading) {
  2471.                         if (c.toggleClass(this.elements.container, this.config.classNames.hideControls, !1) && c.dispatchEvent.call(this, this.media, "controlsshown"), this.paused || this.loading) return;
  2472.                         u.touch && (i = 3e3)
  2473.                     }
  2474.                     n && !this.playing || (this.timers.controls = window.setTimeout(function () {
  2475.                         (!t.elements.controls.pressed && !t.elements.controls.hover || s) && (c.hasClass(t.elements.container, t.config.classNames.hideControls) || c.toggleClass(t.elements.controls, t.config.classNames.noTransition, !1), c.toggleClass(t.elements.container, t.config.classNames.hideControls, !0) && (c.dispatchEvent.call(t, t.media, "controlshidden"), t.config.controls.includes("settings") && !c.is.empty(t.config.settings) && w.toggleMenu.call(t, !1)))
  2476.                     }, i))
  2477.                 }
  2478.             }
  2479.         }, {
  2480.             key: "on",
  2481.             value: function (e, t) {
  2482.                 c.on(this.elements.container, e, t)
  2483.             }
  2484.         }, {
  2485.             key: "off",
  2486.             value: function (e, t) {
  2487.                 c.off(this.elements.container, e, t)
  2488.             }
  2489.         }, {
  2490.             key: "destroy",
  2491.             value: function (e) {
  2492.                 var t = this,
  2493.                     i = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
  2494.                     n = function () {
  2495.                         document.body.style.overflow = "", t.embed = null, i ? (Object.keys(t.elements).length && (t.elements.buttons && t.elements.buttons.play && Array.from(t.elements.buttons.play).forEach(function (e) {
  2496.                             return c.removeElement(e)
  2497.                         }), c.removeElement(t.elements.captions), c.removeElement(t.elements.controls), c.removeElement(t.elements.wrapper), t.elements.buttons.play = null, t.elements.captions = null, t.elements.controls = null, t.elements.wrapper = null), c.is.function(e) && e()) : (c.replaceElement(t.elements.original, t.elements.container), c.dispatchEvent.call(t, t.elements.original, "destroyed", !0), c.is.function(e) && e.call(t.elements.original), t.elements = null)
  2498.                     };
  2499.                 switch (this.provider + ":" + this.type) {
  2500.                     case "html5:video":
  2501.                     case "html5:audio":
  2502.                         b.toggleNativeControls.call(this, !0), n();
  2503.                         break;
  2504.                     case "youtube:video":
  2505.                         window.clearInterval(this.timers.buffering), window.clearInterval(this.timers.playing), null !== this.embed && this.embed.destroy(), n();
  2506.                         break;
  2507.                     case "vimeo:video":
  2508.                         null !== this.embed && this.embed.unload().then(n), window.setTimeout(n, 200)
  2509.                 }
  2510.             }
  2511.         }, {
  2512.             key: "supports",
  2513.             value: function (e) {
  2514.                 return u.mime.call(this, e)
  2515.             }
  2516.         }, {
  2517.             key: "isHTML5",
  2518.             get: function () {
  2519.                 return this.provider === i.html5
  2520.             }
  2521.         }, {
  2522.             key: "isEmbed",
  2523.             get: function () {
  2524.                 return this.isYouTube || this.isVimeo
  2525.             }
  2526.         }, {
  2527.             key: "isYouTube",
  2528.             get: function () {
  2529.                 return this.provider === i.youtube
  2530.             }
  2531.         }, {
  2532.             key: "isVimeo",
  2533.             get: function () {
  2534.                 return this.provider === i.vimeo
  2535.             }
  2536.         }, {
  2537.             key: "isVideo",
  2538.             get: function () {
  2539.                 return this.type === n.video
  2540.             }
  2541.         }, {
  2542.             key: "isAudio",
  2543.             get: function () {
  2544.                 return this.type === n.audio
  2545.             }
  2546.         }, {
  2547.             key: "paused",
  2548.             get: function () {
  2549.                 return this.media.paused
  2550.             }
  2551.         }, {
  2552.             key: "playing",
  2553.             get: function () {
  2554.                 return !this.paused && !this.ended && (!this.isHTML5 || this.media.readyState > 2)
  2555.             }
  2556.         }, {
  2557.             key: "ended",
  2558.             get: function () {
  2559.                 return this.media.ended
  2560.             }
  2561.         }, {
  2562.             key: "currentTime",
  2563.             set: function (e) {
  2564.                 var t = 0;
  2565.                 c.is.number(e) && (t = e), t < 0 ? t = 0 : t > this.duration && (t = this.duration), this.media.currentTime = t.toFixed(4), this.debug.log("Seeking to " + this.currentTime + " seconds")
  2566.             },
  2567.             get: function () {
  2568.                 return Number(this.media.currentTime)
  2569.             }
  2570.         }, {
  2571.             key: "seeking",
  2572.             get: function () {
  2573.                 return this.media.seeking
  2574.             }
  2575.         }, {
  2576.             key: "duration",
  2577.             get: function () {
  2578.                 var e = parseInt(this.config.duration, 10),
  2579.                     t = Number(this.media.duration);
  2580.                 return Number.isNaN(e) ? t : e
  2581.             }
  2582.         }, {
  2583.             key: "volume",
  2584.             set: function (e) {
  2585.                 var t = e;
  2586.                 c.is.string(t) && (t = Number(t)), c.is.number(t) || (t = this.storage.get("volume")), c.is.number(t) || (t = this.config.volume), t > 1 && (t = 1), t < 0 && (t = 0), this.config.volume = t, this.media.volume = t, this.muted && t > 0 && (this.muted = !1)
  2587.             },
  2588.             get: function () {
  2589.                 return this.media.volume
  2590.             }
  2591.         }, {
  2592.             key: "muted",
  2593.             set: function (e) {
  2594.                 var t = e;
  2595.                 c.is.boolean(t) || (t = this.storage.get("muted")), c.is.boolean(t) || (t = this.config.muted), this.config.muted = t, this.media.muted = t
  2596.             },
  2597.             get: function () {
  2598.                 return this.media.muted
  2599.             }
  2600.         }, {
  2601.             key: "hasAudio",
  2602.             get: function () {
  2603.                 return !this.isHTML5 || (!!this.isAudio || (this.media.mozHasAudio || Boolean(this.media.webkitAudioDecodedByteCount) || Boolean(this.media.audioTracks && this.media.audioTracks.length)))
  2604.             }
  2605.         }, {
  2606.             key: "speed",
  2607.             set: function (e) {
  2608.                 var t = null;
  2609.                 c.is.number(e) && (t = e), c.is.number(t) || (t = this.storage.get("speed")), c.is.number(t) || (t = this.config.speed.selected), t < .1 && (t = .1), t > 2 && (t = 2), this.config.speed.options.includes(t) ? (this.config.speed.selected = t, this.media.playbackRate = t) : this.debug.warn("Unsupported speed (" + t + ")")
  2610.             },
  2611.             get: function () {
  2612.                 return this.media.playbackRate
  2613.             }
  2614.         }, {
  2615.             key: "quality",
  2616.             set: function (e) {
  2617.                 var t = null;
  2618.                 c.is.string(e) && (t = e), c.is.string(t) || (t = this.storage.get("quality")), c.is.string(t) || (t = this.config.quality.selected), this.options.quality.includes(t) ? (this.config.quality.selected = t, this.media.quality = t) : this.debug.warn("Unsupported quality option (" + t + ")")
  2619.             },
  2620.             get: function () {
  2621.                 return this.media.quality
  2622.             }
  2623.         }, {
  2624.             key: "loop",
  2625.             set: function (e) {
  2626.                 var t = c.is.boolean(e) ? e : this.config.loop.active;
  2627.                 this.config.loop.active = t, this.media.loop = t
  2628.             },
  2629.             get: function () {
  2630.                 return this.media.loop
  2631.             }
  2632.         }, {
  2633.             key: "source",
  2634.             set: function (e) {
  2635.                 N.change.call(this, e)
  2636.             },
  2637.             get: function () {
  2638.                 return this.media.currentSrc
  2639.             }
  2640.         }, {
  2641.             key: "poster",
  2642.             set: function (e) {
  2643.                 this.isHTML5 && this.isVideo ? c.is.string(e) && this.media.setAttribute("poster", e) : this.debug.warn("Poster can only be set on HTML5 video")
  2644.             },
  2645.             get: function () {
  2646.                 return this.isHTML5 && this.isVideo ? this.media.getAttribute("poster") : null
  2647.             }
  2648.         }, {
  2649.             key: "autoplay",
  2650.             set: function (e) {
  2651.                 var t = c.is.boolean(e) ? e : this.config.autoplay;
  2652.                 this.config.autoplay = t
  2653.             },
  2654.             get: function () {
  2655.                 return this.config.autoplay
  2656.             }
  2657.         }, {
  2658.             key: "language",
  2659.             set: function (e) {
  2660.                 if (c.is.string(e) && (this.toggleCaptions(!c.is.empty(e)), !c.is.empty(e))) {
  2661.                     var t = e.toLowerCase();
  2662.                     this.language !== t && (this.captions.language = t, E.setText.call(this, null), E.setLanguage.call(this), c.dispatchEvent.call(this, this.media, "languagechange"))
  2663.                 }
  2664.             },
  2665.             get: function () {
  2666.                 return this.captions.language
  2667.             }
  2668.         }, {
  2669.             key: "pip",
  2670.             set: function (e) {
  2671.                 var t = "picture-in-picture",
  2672.                     i = "inline";
  2673.                 if (u.pip) {
  2674.                     var n = c.is.boolean(e) ? e : this.pip === i;
  2675.                     this.media.webkitSetPresentationMode(n ? t : i)
  2676.                 }
  2677.             },
  2678.             get: function () {
  2679.                 return u.pip ? this.media.webkitPresentationMode : null
  2680.             }
  2681.         }], [{
  2682.             key: "supported",
  2683.             value: function (e, t, i) {
  2684.                 return u.check(e, t, i)
  2685.             }
  2686.         }, {
  2687.             key: "loadSprite",
  2688.             value: function (e, t) {
  2689.                 return c.loadSprite(e, t)
  2690.             }
  2691.         }]), e
  2692.     }()
  2693. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement