<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(a,b){"use strict";"object"==typeof module&amp;&amp;"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a&lt;0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a&lt;0?b:0);return this.pushStack(c&gt;=0&amp;&amp;c&lt;b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&amp;&amp;(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&amp;&amp;(g=this,h--);h&lt;i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&amp;&amp;(j&amp;&amp;d&amp;&amp;(r.isPlainObject(d)||(e=Array.isArray(d)))?(e?(e=!1,f=c&amp;&amp;Array.isArray(c)?c:[]):f=c&amp;&amp;r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&amp;&amp;(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isWindow:function(a){return null!=a&amp;&amp;a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&amp;&amp;!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&amp;&amp;(!(b=e(a))||(c=l.call(b,"constructor")&amp;&amp;b.constructor,"function"==typeof c&amp;&amp;m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d&lt;c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&amp;&amp;(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d&lt;c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f&lt;g;f++)d=!b(a[f],f),d!==h&amp;&amp;e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f&lt;d;f++)e=b(a[f],f,c),null!=e&amp;&amp;h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&amp;&amp;h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&amp;&amp;(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&amp;&amp;(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&amp;&amp;"length"in a&amp;&amp;a.length,c=r.type(a);return"function"!==c&amp;&amp;!r.isWindow(a)&amp;&amp;("array"===c||0===b||"number"==typeof b&amp;&amp;b&gt;0&amp;&amp;b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&amp;&amp;(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c&lt;d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([&gt;+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[&gt;+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d&lt;0?String.fromCharCode(d+65536):String.fromCharCode(d&gt;&gt;10|55296,1023&amp;d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&amp;&amp;("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&amp;&amp;b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&amp;&amp;9!==w&amp;&amp;11!==w)return d;if(!e&amp;&amp;((b?b.ownerDocument||b:v)!==n&amp;&amp;m(b),b=b||n,p)){if(11!==w&amp;&amp;(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&amp;&amp;(j=s.getElementById(f))&amp;&amp;t(b,j)&amp;&amp;j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&amp;&amp;c.getElementsByClassName&amp;&amp;b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&amp;&amp;!A[a+" "]&amp;&amp;(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&amp;&amp;qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&amp;&amp;b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")&gt;d.cacheLength&amp;&amp;delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&amp;&amp;b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&amp;&amp;a,d=c&amp;&amp;1===a.nodeType&amp;&amp;1===b.nodeType&amp;&amp;a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&amp;&amp;b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&amp;&amp;b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&amp;&amp;b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&amp;&amp;ea(b)===a:b.disabled===a:"label"in b&amp;&amp;b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&amp;&amp;(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&amp;&amp;"undefined"!=typeof a.getElementsByTagName&amp;&amp;a}c=ga.support={},f=ga.isXML=function(a){var b=a&amp;&amp;(a.ownerDocument||a).documentElement;return!!b&amp;&amp;"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&amp;&amp;9===g.nodeType&amp;&amp;g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&amp;&amp;(e=n.defaultView)&amp;&amp;e.top!==e&amp;&amp;(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&amp;&amp;e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&amp;&amp;p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&amp;&amp;a.getAttributeNode("id");return c&amp;&amp;c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&amp;&amp;p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&amp;&amp;c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&amp;&amp;c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&amp;&amp;d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&amp;&amp;function(a,b){if("undefined"!=typeof b.getElementsByClassName&amp;&amp;p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&amp;&amp;(ja(function(a){o.appendChild(a).innerHTML="&lt;a id='"+u+"'&gt;&lt;/a&gt;&lt;select id='"+u+"-\r\\' msallowcapture=''&gt;&lt;option selected=''&gt;&lt;/option&gt;&lt;/select&gt;",a.querySelectorAll("[msallowcapture^='']").length&amp;&amp;q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="&lt;a href='' disabled='disabled'&gt;&lt;/a&gt;&lt;select disabled='disabled'&gt;&lt;option/&gt;&lt;/select&gt;";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&amp;&amp;q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&amp;&amp;q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&amp;&amp;q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&amp;&amp;ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&amp;&amp;new RegExp(q.join("|")),r=r.length&amp;&amp;new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&amp;&amp;b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&amp;&amp;16&amp;a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&amp;d||!c.sortDetached&amp;&amp;b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&amp;&amp;t(v,a)?-1:b===n||b.ownerDocument===v&amp;&amp;t(v,b)?1:k?I(k,a)-I(k,b):0:4&amp;d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&amp;&amp;m(a),b=b.replace(S,"='$1']"),c.matchesSelector&amp;&amp;p&amp;&amp;!A[b+" "]&amp;&amp;(!r||!r.test(b))&amp;&amp;(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&amp;&amp;11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length&gt;0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&amp;&amp;m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&amp;&amp;m(a);var e=d.attrHandle[b.toLowerCase()],f=e&amp;&amp;C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&amp;&amp;f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&amp;&amp;a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&amp;&amp;(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{"&gt;":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&amp;&amp;(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&amp;&amp;ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&amp;&amp;a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&amp;&amp;T.test(c)&amp;&amp;(b=g(c,!0))&amp;&amp;(b=c.indexOf(")",c.length-b)-c.length)&amp;&amp;(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&amp;&amp;a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&amp;&amp;y(a,function(a){return b.test("string"==typeof a.className&amp;&amp;a.className||"undefined"!=typeof a.getAttribute&amp;&amp;a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&amp;&amp;0===e.indexOf(c):"*="===b?c&amp;&amp;e.indexOf(c)&gt;-1:"$="===b?c&amp;&amp;e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)&gt;-1:"|="===b&amp;&amp;(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&amp;&amp;0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&amp;&amp;b.nodeName.toLowerCase(),s=!i&amp;&amp;!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&amp;&amp;!o&amp;&amp;"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&amp;&amp;s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&amp;&amp;j[1],t=n&amp;&amp;j[2],m=n&amp;&amp;q.childNodes[n];while(m=++n&amp;&amp;m&amp;&amp;m[p]||(t=n=0)||o.pop())if(1===m.nodeType&amp;&amp;++t&amp;&amp;m===b){k[a]=[w,n,t];break}}else if(s&amp;&amp;(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&amp;&amp;j[1],t=n),t===!1)while(m=++n&amp;&amp;m&amp;&amp;m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&amp;&amp;++t&amp;&amp;(s&amp;&amp;(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&amp;&amp;t/d&gt;=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length&gt;1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&amp;&amp;(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length&gt;0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)&gt;-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&amp;&amp;1===b.nodeType);return!1}}),target:function(b){var c=a.location&amp;&amp;a.location.hash;return c&amp;&amp;c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&amp;&amp;(!n.hasFocus||n.hasFocus())&amp;&amp;!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&amp;&amp;!!a.checked||"option"===b&amp;&amp;!!a.selected},selected:function(a){return a.parentNode&amp;&amp;a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType&lt;6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&amp;&amp;"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&amp;&amp;"text"===a.type&amp;&amp;(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c&lt;0?c+b:c]}),even:pa(function(a,b){for(var c=0;c&lt;b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c&lt;b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c&lt;0?c+b:c;--d&gt;=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c&lt;0?c+b:c;++d&lt;b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&amp;&amp;!(e=Q.exec(h))||(e&amp;&amp;(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&amp;&amp;(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&amp;&amp;!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b&lt;c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&amp;&amp;"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&amp;&amp;a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&amp;&amp;e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&amp;&amp;j[0]===w&amp;&amp;j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(a){return a.length&gt;1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d&lt;e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h&lt;i;h++)(f=a[h])&amp;&amp;(c&amp;&amp;!c(f,d,e)||(g.push(f),j&amp;&amp;b.push(h)));return g}function xa(a,b,c,d,e,f){return d&amp;&amp;!d[u]&amp;&amp;(d=xa(d)),e&amp;&amp;!e[u]&amp;&amp;(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&amp;&amp;b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&amp;&amp;c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&amp;&amp;(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&amp;&amp;j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&amp;&amp;(j=e?I(f,l):m[k])&gt;-1&amp;&amp;(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)&gt;-1},h,!0),m=[function(a,c,d){var e=!g&amp;&amp;(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i&lt;f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e&lt;f;e++)if(d.relative[a[e].type])break;return xa(i&gt;1&amp;&amp;ua(m),i&gt;1&amp;&amp;sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i&lt;e&amp;&amp;ya(a.slice(i,e)),e&lt;f&amp;&amp;ya(a=a.slice(e)),e&lt;f&amp;&amp;sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length&gt;0,e=a.length&gt;0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&amp;&amp;[],u=[],v=j,x=f||e&amp;&amp;d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&amp;&amp;(j=g===n||g||k);s!==z&amp;&amp;null!=(l=x[s]);s++){if(e&amp;&amp;l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&amp;&amp;(w=y)}c&amp;&amp;((l=!q&amp;&amp;l)&amp;&amp;r--,f&amp;&amp;t.push(l))}if(r+=s,c&amp;&amp;s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r&gt;0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&amp;&amp;!f&amp;&amp;u.length&gt;0&amp;&amp;r+b.length&gt;1&amp;&amp;ga.uniqueSort(i)}return k&amp;&amp;(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&amp;&amp;a,n=!e&amp;&amp;g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length&gt;2&amp;&amp;"ID"===(j=i[0]).type&amp;&amp;9===b.nodeType&amp;&amp;p&amp;&amp;d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&amp;&amp;(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&amp;&amp;(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&amp;&amp;qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&amp;&amp;sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&amp;&amp;qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&amp;a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="&lt;a href='#'&gt;&lt;/a&gt;","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&amp;&amp;ja(function(a){return a.innerHTML="&lt;input/&gt;",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&amp;&amp;"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&amp;&amp;d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&amp;&amp;9!==a.nodeType)if(1===a.nodeType){if(e&amp;&amp;r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&amp;&amp;a!==b&amp;&amp;c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&amp;&amp;a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^&lt;([a-z][^\/\0&gt;:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?&gt;(?:&lt;\/\1&gt;|)$/i,D=/^.[^:#\[\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)&gt;-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)&gt;-1!==c&amp;&amp;1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&amp;&amp;(a=":not("+a+")"),1===b.length&amp;&amp;1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b&lt;d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b&lt;d;b++)r.find(a,e[b],c);return d&gt;1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,"string"==typeof a&amp;&amp;A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\s*(&lt;[\w\W]+&gt;)[^&gt;]*|#([\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,"string"==typeof a){if(e="&lt;"===a[0]&amp;&amp;"&gt;"===a[a.length-1]&amp;&amp;a.length&gt;=3?[null,a,null]:G.exec(a),!e||!e[1]&amp;&amp;b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&amp;&amp;b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&amp;&amp;r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&amp;&amp;(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a&lt;c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&amp;&amp;r(a);if(!A.test(a))for(;d&lt;e;d++)for(c=this[d];c&amp;&amp;c!==b;c=c.parentNode)if(c.nodeType&lt;11&amp;&amp;(g?g.index(c)&gt;-1:1===c.nodeType&amp;&amp;r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length&gt;1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&amp;&amp;this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&amp;&amp;1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&amp;&amp;11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return K(a,"nextSibling")},prev:function(a){return K(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,"iframe")?a.contentDocument:(B(a,"template")&amp;&amp;(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&amp;&amp;(d=c),d&amp;&amp;"string"==typeof d&amp;&amp;(e=r.filter(d,e)),this.length&gt;1&amp;&amp;(J[a]||r.uniqueSort(e),I.test(a)&amp;&amp;e.reverse()),this.pushStack(e)}});var L=/[^\x20\t\r\n\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h&lt;f.length)f[h].apply(c[0],c[1])===!1&amp;&amp;a.stopOnFalse&amp;&amp;(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&amp;&amp;(f=c?[]:"")},j={add:function(){return f&amp;&amp;(c&amp;&amp;!b&amp;&amp;(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&amp;&amp;j.has(c)||f.push(c):c&amp;&amp;c.length&amp;&amp;"string"!==r.type(c)&amp;&amp;d(c)})}(arguments),c&amp;&amp;!b&amp;&amp;i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))&gt;-1)f.splice(c,1),c&lt;=h&amp;&amp;h--}),this},has:function(a){return a?r.inArray(a,f)&gt;-1:f.length&gt;0},empty:function(){return f&amp;&amp;(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&amp;&amp;r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&amp;&amp;r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&amp;&amp;a[d[4]];f[d[1]](function(){var a=e&amp;&amp;e.apply(this,arguments);a&amp;&amp;r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b&lt;f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&amp;&amp;("object"==typeof a||"function"==typeof a)&amp;&amp;a.then,r.isFunction(j)?e?j.call(a,g(f,c,N,e),g(f,c,O,e)):(f++,j.call(a,g(f,c,N,e),g(f,c,O,e),g(f,c,N,c.notifyWith))):(d!==N&amp;&amp;(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&amp;&amp;r.Deferred.exceptionHook(a,k.stackTrace),b+1&gt;=f&amp;&amp;(d!==O&amp;&amp;(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&amp;&amp;(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&amp;&amp;g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&amp;&amp;b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length&gt;1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b&lt;=1&amp;&amp;(P(a,g.done(h(c)).resolve,g.reject,!b),"pending"===g.state()||r.isFunction(e[c]&amp;&amp;e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&amp;&amp;a.console.warn&amp;&amp;b&amp;&amp;Q.test(b.name)&amp;&amp;a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&amp;&amp;--r.readyWait&gt;0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener("DOMContentLoaded",S),
a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&amp;&amp;!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&amp;&amp;(e=!0,r.isFunction(d)||(g=!0),j&amp;&amp;(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h&lt;i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},U=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function V(){this.expando=r.expando+V.uid++}V.uid=1,V.prototype={cache:function(a){var b=a[this.expando];return b||(b={},U(a)&amp;&amp;(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&amp;&amp;a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&amp;&amp;"string"==typeof b&amp;&amp;void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){Array.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(L)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&amp;&amp;(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&amp;&amp;!r.isEmptyObject(b)}};var W=new V,X=new V,Y=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Z=/[A-Z]/g;function $(a){return"true"===a||"false"!==a&amp;&amp;("null"===a?null:a===+a+""?+a:Y.test(a)?JSON.parse(a):a)}function _(a,b,c){var d;if(void 0===c&amp;&amp;1===a.nodeType)if(d="data-"+b.replace(Z,"-$&amp;").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=$(c)}catch(e){}X.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return X.hasData(a)||W.hasData(a)},data:function(a,b,c){return X.access(a,b,c)},removeData:function(a,b){X.remove(a,b)},_data:function(a,b,c){return W.access(a,b,c)},_removeData:function(a,b){W.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&amp;&amp;f.attributes;if(void 0===a){if(this.length&amp;&amp;(e=X.get(f),1===f.nodeType&amp;&amp;!W.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&amp;&amp;(d=g[c].name,0===d.indexOf("data-")&amp;&amp;(d=r.camelCase(d.slice(5)),_(f,d,e[d])));W.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){X.set(this,a)}):T(this,function(b){var c;if(f&amp;&amp;void 0===b){if(c=X.get(f,a),void 0!==c)return c;if(c=_(f,a),void 0!==c)return c}else this.each(function(){X.set(this,a,b)})},null,b,arguments.length&gt;1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&amp;&amp;(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&amp;&amp;(e=c.shift(),d--),e&amp;&amp;("fx"===b&amp;&amp;c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&amp;&amp;f&amp;&amp;f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&amp;&amp;(b=a,a="fx",c--),arguments.length&lt;c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&amp;&amp;"inprogress"!==c[0]&amp;&amp;r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&amp;&amp;(b=a,a=void 0),a=a||"fx";while(g--)c=W.get(f[g],a+"queueHooks"),c&amp;&amp;c.empty&amp;&amp;(d++,c.empty.add(h));return h(),e.promise(b)}});var aa=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ba=new RegExp("^(?:([+-])=|)("+aa+")([a-z%]*)$","i"),ca=["Top","Right","Bottom","Left"],da=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&amp;&amp;r.contains(a.ownerDocument,a)&amp;&amp;"none"===r.css(a,"display")},ea=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function fa(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&amp;&amp;c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&amp;&amp;+i)&amp;&amp;ba.exec(r.css(a,b));if(k&amp;&amp;k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&amp;&amp;1!==f&amp;&amp;--g)}return c&amp;&amp;(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&amp;&amp;(d.unit=j,d.start=k,d.end=e)),e}var ga={};function ha(a){var b,c=a.ownerDocument,d=a.nodeName,e=ga[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&amp;&amp;(e="block"),ga[d]=e,e)}function ia(a,b){for(var c,d,e=[],f=0,g=a.length;f&lt;g;f++)d=a[f],d.style&amp;&amp;(c=d.style.display,b?("none"===c&amp;&amp;(e[f]=W.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&amp;&amp;da(d)&amp;&amp;(e[f]=ha(d))):"none"!==c&amp;&amp;(e[f]="none",W.set(d,"display",c)));for(f=0;f&lt;g;f++)null!=e[f]&amp;&amp;(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ia(this,!0)},hide:function(){return ia(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){da(this)?r(this).show():r(this).hide()})}});var ja=/^(?:checkbox|radio)$/i,ka=/&lt;([a-z][^\/\0&gt;\x20\t\r\n\f]+)/i,la=/^$|\/(?:java|ecma)script/i,ma={option:[1,"&lt;select multiple='multiple'&gt;","&lt;/select&gt;"],thead:[1,"&lt;table&gt;","&lt;/table&gt;"],col:[2,"&lt;table&gt;&lt;colgroup&gt;","&lt;/colgroup&gt;&lt;/table&gt;"],tr:[2,"&lt;table&gt;&lt;tbody&gt;","&lt;/tbody&gt;&lt;/table&gt;"],td:[3,"&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;","&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;"],_default:[0,"",""]};ma.optgroup=ma.option,ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead,ma.th=ma.td;function na(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&amp;&amp;B(a,b)?r.merge([a],c):c}function oa(a,b){for(var c=0,d=a.length;c&lt;d;c++)W.set(a[c],"globalEval",!b||W.get(b[c],"globalEval"))}var pa=/&lt;|&amp;#?\w+;/;function qa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n&lt;o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(pa.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ka.exec(f)||["",""])[1].toLowerCase(),i=ma[h]||ma._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&amp;&amp;r.inArray(f,d)&gt;-1)e&amp;&amp;e.push(f);else if(j=r.contains(f.ownerDocument,f),g=na(l.appendChild(f),"script"),j&amp;&amp;oa(g),c){k=0;while(f=g[k++])la.test(f.type||"")&amp;&amp;c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="&lt;textarea&gt;x&lt;/textarea&gt;",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&amp;&amp;(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&amp;&amp;null==e?(e=c,d=c=void 0):null==e&amp;&amp;("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&amp;&amp;(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&amp;&amp;(f=c,c=f.handler,e=f.selector),e&amp;&amp;r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&amp;&amp;r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(L)||[""],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&amp;&amp;(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&amp;&amp;r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&amp;&amp;l.setup.call(a,d,o,g)!==!1||a.addEventListener&amp;&amp;a.addEventListener(n,g)),l.add&amp;&amp;(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&amp;&amp;W.get(a);if(q&amp;&amp;(i=q.events)){b=(b||"").match(L)||[""],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&amp;&amp;new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&amp;&amp;p!==k.origType||c&amp;&amp;c.guid!==k.guid||h&amp;&amp;!h.test(k.namespace)||d&amp;&amp;d!==k.selector&amp;&amp;("**"!==d||!k.selector)||(m.splice(f,1),k.selector&amp;&amp;m.delegateCount--,l.remove&amp;&amp;l.remove.call(a,k));g&amp;&amp;!m.length&amp;&amp;(l.teardown&amp;&amp;l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&amp;&amp;W.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c&lt;arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&amp;&amp;!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&amp;&amp;!b.isImmediatePropagationStopped())b.rnamespace&amp;&amp;!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&amp;&amp;(b.result=e)===!1&amp;&amp;(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&amp;&amp;k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&amp;&amp;j.nodeType&amp;&amp;!("click"===a.type&amp;&amp;a.button&gt;=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&amp;&amp;("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c&lt;i;c++)d=b[c],e=d.selector+" ",void 0===g[e]&amp;&amp;(g[e]=d.needsContext?r(e,this).index(j)&gt;-1:r.find(e,this,null,[j]).length),g[e]&amp;&amp;f.push(d);f.length&amp;&amp;h.push({elem:j,handlers:f})}return j=this,i&lt;b.length&amp;&amp;h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==xa()&amp;&amp;this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===xa()&amp;&amp;this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&amp;&amp;this.click&amp;&amp;B(this,"input"))return this.click(),!1},_default:function(a){return B(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&amp;&amp;a.originalEvent&amp;&amp;(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&amp;&amp;a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&amp;&amp;a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&amp;&amp;a.returnValue===!1?va:wa,this.target=a.target&amp;&amp;3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&amp;&amp;r.extend(this,b),this.timeStamp=a&amp;&amp;a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:wa,isPropagationStopped:wa,isImmediatePropagationStopped:wa,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=va,a&amp;&amp;!this.isSimulated&amp;&amp;a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=va,a&amp;&amp;!this.isSimulated&amp;&amp;a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=va,a&amp;&amp;!this.isSimulated&amp;&amp;a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&amp;&amp;sa.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&amp;&amp;void 0!==b&amp;&amp;ta.test(a.type)?1&amp;b?1:2&amp;b?3:4&amp;b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&amp;&amp;(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return ya(this,a,b,c,d)},one:function(a,b,c,d){return ya(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&amp;&amp;a.preventDefault&amp;&amp;a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&amp;&amp;"function"!=typeof b||(c=b,b=void 0),c===!1&amp;&amp;(c=wa),this.each(function(){r.event.remove(this,a,c,b)})}});var za=/&lt;(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0&gt;\x20\t\r\n\f]*)[^&gt;]*)\/&gt;/gi,Aa=/&lt;script|&lt;style|&lt;link/i,Ba=/checked\s*(?:[^=]|=\s*.checked.)/i,Ca=/^true\/(.*)/,Da=/^\s*&lt;!(?:\[CDATA\[|--)|(?:\]\]|--)&gt;\s*$/g;function Ea(a,b){return B(a,"table")&amp;&amp;B(11!==b.nodeType?b:b.firstChild,"tr")?r("&gt;tbody",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&amp;&amp;(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c&lt;d;c++)r.event.add(b,e,j[e][c])}X.hasData(a)&amp;&amp;(h=X.access(a),i=r.extend({},h),X.set(b,i))}}function Ia(a,b){var c=b.nodeName.toLowerCase();"input"===c&amp;&amp;ja.test(a.type)?b.checked=a.checked:"input"!==c&amp;&amp;"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ja(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m&gt;1&amp;&amp;"string"==typeof q&amp;&amp;!o.checkClone&amp;&amp;Ba.test(q))return a.each(function(e){var f=a.eq(e);s&amp;&amp;(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&amp;&amp;(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&amp;&amp;(e=f),f||d)){for(h=r.map(na(e,"script"),Fa),i=h.length;l&lt;m;l++)j=e,l!==n&amp;&amp;(j=r.clone(j,!0,!0),i&amp;&amp;r.merge(h,na(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ga),l=0;l&lt;i;l++)j=h[l],la.test(j.type||"")&amp;&amp;!W.access(j,"globalEval")&amp;&amp;r.contains(k,j)&amp;&amp;(j.src?r._evalUrl&amp;&amp;r._evalUrl(j.src):p(j.textContent.replace(Da,""),k))}return a}function Ka(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(na(d)),d.parentNode&amp;&amp;(c&amp;&amp;r.contains(d.ownerDocument,d)&amp;&amp;oa(na(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(za,"&lt;$1&gt;&lt;/$2&gt;")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&amp;&amp;11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d&lt;e;d++)Ia(f[d],g[d]);if(b)if(c)for(f=f||na(a),g=g||na(h),d=0,e=f.length;d&lt;e;d++)Ha(f[d],g[d]);else Ha(a,h);return g=na(h,"script"),g.length&gt;0&amp;&amp;oa(g,!i&amp;&amp;na(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&amp;&amp;(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&amp;&amp;11!==this.nodeType&amp;&amp;9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&amp;&amp;this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&amp;&amp;this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&amp;&amp;(r.cleanData(na(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&amp;&amp;a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&amp;&amp;1===b.nodeType)return b.innerHTML;if("string"==typeof a&amp;&amp;!Aa.test(a)&amp;&amp;!ma[(ka.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c&lt;d;c++)b=this[c]||{},1===b.nodeType&amp;&amp;(r.cleanData(na(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&amp;&amp;this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ja(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)&lt;0&amp;&amp;(r.cleanData(na(this)),c&amp;&amp;c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g&lt;=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var La=/^margin/,Ma=new RegExp("^("+aa+")(?!px)[a-z%]+$","i"),Na=function(b){var c=b.ownerDocument.defaultView;return c&amp;&amp;c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",ra.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,ra.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&amp;&amp;(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Oa(a,b,c){var d,e,f,g,h=a.style;return c=c||Na(a),c&amp;&amp;(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&amp;&amp;Ma.test(g)&amp;&amp;La.test(b)&amp;&amp;(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Pa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Qa=/^(none|table(?!-c[ea]).+)/,Ra=/^--/,Sa={position:"absolute",visibility:"hidden",display:"block"},Ta={letterSpacing:"0",fontWeight:"400"},Ua=["Webkit","Moz","ms"],Va=d.createElement("div").style;function Wa(a){if(a in Va)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ua.length;while(c--)if(a=Ua[c]+b,a in Va)return a}function Xa(a){var b=r.cssProps[a];return b||(b=r.cssProps[a]=Wa(a)||a),b}function Ya(a,b,c){var d=ba.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Za(a,b,c,d,e){var f,g=0;for(f=c===(d?"border":"content")?4:"width"===b?1:0;f&lt;4;f+=2)"margin"===c&amp;&amp;(g+=r.css(a,c+ca[f],!0,e)),d?("content"===c&amp;&amp;(g-=r.css(a,"padding"+ca[f],!0,e)),"margin"!==c&amp;&amp;(g-=r.css(a,"border"+ca[f]+"Width",!0,e))):(g+=r.css(a,"padding"+ca[f],!0,e),"padding"!==c&amp;&amp;(g+=r.css(a,"border"+ca[f]+"Width",!0,e)));return g}function $a(a,b,c){var d,e=Na(a),f=Oa(a,b,e),g="border-box"===r.css(a,"boxSizing",!1,e);return Ma.test(f)?f:(d=g&amp;&amp;(o.boxSizingReliable()||f===a.style[b]),"auto"===f&amp;&amp;(f=a["offset"+b[0].toUpperCase()+b.slice(1)]),f=parseFloat(f)||0,f+Za(a,b,c||(g?"border":"content"),d,e)+"px")}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Oa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&amp;&amp;3!==a.nodeType&amp;&amp;8!==a.nodeType&amp;&amp;a.style){var e,f,g,h=r.camelCase(b),i=Ra.test(b),j=a.style;return i||(b=Xa(h)),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&amp;&amp;"get"in g&amp;&amp;void 0!==(e=g.get(a,!1,d))?e:j[b]:(f=typeof c,"string"===f&amp;&amp;(e=ba.exec(c))&amp;&amp;e[1]&amp;&amp;(c=fa(a,b,e),f="number"),null!=c&amp;&amp;c===c&amp;&amp;("number"===f&amp;&amp;(c+=e&amp;&amp;e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(j[b]="inherit"),g&amp;&amp;"set"in g&amp;&amp;void 0===(c=g.set(a,c,d))||(i?j.setProperty(b,c):j[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b),i=Ra.test(b);return i||(b=Xa(h)),g=r.cssHooks[b]||r.cssHooks[h],g&amp;&amp;"get"in g&amp;&amp;(e=g.get(a,!0,c)),void 0===e&amp;&amp;(e=Oa(a,b,d)),"normal"===e&amp;&amp;b in Ta&amp;&amp;(e=Ta[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Qa.test(r.css(a,"display"))||a.getClientRects().length&amp;&amp;a.getBoundingClientRect().width?$a(a,b,d):ea(a,Sa,function(){return $a(a,b,d)})},set:function(a,c,d){var e,f=d&amp;&amp;Na(a),g=d&amp;&amp;Za(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&amp;&amp;(e=ba.exec(c))&amp;&amp;"px"!==(e[3]||"px")&amp;&amp;(a.style[b]=c,c=r.css(a,b)),Ya(a,c,g)}}}),r.cssHooks.marginLeft=Pa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Oa(a,"marginLeft"))||a.getBoundingClientRect().left-ea(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d&lt;4;d++)e[a+ca[d]+b]=f[d]||f[d-2]||f[0];return e}},La.test(a)||(r.cssHooks[a+b].set=Ya)}),r.fn.extend({css:function(a,b){return T(this,function(a,b,c){var d,e,f={},g=0;if(Array.isArray(b)){for(d=Na(a),e=b.length;g&lt;e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length&gt;1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=_a.propHooks[this.prop];return a&amp;&amp;a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&amp;&amp;this.options.step.call(this.elem,this.now,this),c&amp;&amp;c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&amp;&amp;null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&amp;&amp;"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&amp;&amp;!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&amp;&amp;a.elem.parentNode&amp;&amp;(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&amp;&amp;(d.hidden===!1&amp;&amp;a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d&lt;4;d+=2-b)c=ca[d],e["margin"+c]=e["padding"+c]=a;return b&amp;&amp;(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners["*"]),f=0,g=e.length;f&lt;g;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&amp;&amp;da(a),q=W.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&amp;&amp;(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],cb.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&amp;&amp;q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&amp;&amp;1===a.nodeType&amp;&amp;(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&amp;&amp;q.display,null==j&amp;&amp;(j=W.get(a,"display")),k=r.css(a,"display"),"none"===k&amp;&amp;(j?k=j:(ia([a],!0),j=a.style.display||j,k=r.css(a,"display"),ia([a]))),("inline"===k||"inline-block"===k&amp;&amp;null!=j)&amp;&amp;"none"===r.css(a,"float")&amp;&amp;(i||(m.done(function(){o.display=j}),null==j&amp;&amp;(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&amp;&amp;(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&amp;&amp;(p=q.hidden):q=W.access(a,"fxshow",{display:j}),f&amp;&amp;(q.hidden=!p),p&amp;&amp;ia([a],!0),m.done(function(){p||ia([a]),W.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=hb(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&amp;&amp;(i.end=i.start,i.start=0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],Array.isArray(f)&amp;&amp;(e=f[1],f=a[c]=f[0]),c!==d&amp;&amp;(a[d]=f,delete a[c]),g=r.cssHooks[d],g&amp;&amp;"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=kb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=ab||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g&lt;i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f&lt;1&amp;&amp;i?c:(i||h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:ab||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c&lt;d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);f&lt;g;f++)if(d=kb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&amp;&amp;(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,hb,j),r.isFunction(j.opts.start)&amp;&amp;j.opts.start.call(a,j),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j}r.Animation=r.extend(kb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return fa(c.elem,a,ba.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(L);for(var c,d=0,e=a.length;d&lt;e;d++)c=a[d],kb.tweeners[c]=kb.tweeners[c]||[],kb.tweeners[c].unshift(b)},prefilters:[ib],prefilter:function(a,b){b?kb.prefilters.unshift(a):kb.prefilters.push(a)}}),r.speed=function(a,b,c){var d=a&amp;&amp;"object"==typeof a?r.extend({},a):{complete:c||!c&amp;&amp;b||r.isFunction(a)&amp;&amp;a,duration:a,easing:c&amp;&amp;b||b&amp;&amp;!r.isFunction(b)&amp;&amp;b};return r.fx.off?d.duration=0:"number"!=typeof d.duration&amp;&amp;(d.duration in r.fx.speeds?d.duration=r.fx.speeds[d.duration]:d.duration=r.fx.speeds._default),null!=d.queue&amp;&amp;d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){r.isFunction(d.old)&amp;&amp;d.old.call(this),d.queue&amp;&amp;r.dequeue(this,d.queue)},d},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(da).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=kb(this,r.extend({},a),f);(e||W.get(this,"finish"))&amp;&amp;b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&amp;&amp;(c=b,b=a,a=void 0),b&amp;&amp;a!==!1&amp;&amp;this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&amp;&amp;a+"queueHooks",f=r.timers,g=W.get(this);if(e)g[e]&amp;&amp;g[e].stop&amp;&amp;d(g[e]);else for(e in g)g[e]&amp;&amp;g[e].stop&amp;&amp;db.test(e)&amp;&amp;d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&amp;&amp;f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&amp;&amp;c||r.dequeue(this,a)})},finish:function(a){return a!==!1&amp;&amp;(a=a||"fx"),this.each(function(){var b,c=W.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&amp;&amp;e.stop&amp;&amp;e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&amp;&amp;f[b].queue===a&amp;&amp;(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b&lt;g;b++)d[b]&amp;&amp;d[b].finish&amp;&amp;d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),r.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(ab=r.now();b&lt;c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),ab=void 0},r.fx.timer=function(a){r.timers.push(a),r.fx.start()},r.fx.interval=13,r.fx.start=function(){bb||(bb=!0,eb())},r.fx.stop=function(){bb=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var lb,mb=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return T(this,r.attr,a,b,arguments.length&gt;1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&amp;&amp;8!==f&amp;&amp;2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&amp;&amp;r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&amp;&amp;"set"in e&amp;&amp;void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&amp;&amp;"get"in e&amp;&amp;null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),
null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&amp;&amp;"radio"===b&amp;&amp;B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&amp;&amp;(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&amp;&amp;b.match(L);if(e&amp;&amp;1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length&gt;1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&amp;&amp;8!==f&amp;&amp;2!==f)return 1===f&amp;&amp;r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&amp;&amp;"set"in e&amp;&amp;void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&amp;&amp;"get"in e&amp;&amp;null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&amp;&amp;a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&amp;&amp;b.parentNode&amp;&amp;b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&amp;&amp;(b.selectedIndex,b.parentNode&amp;&amp;b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&amp;&amp;a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&amp;&amp;a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&amp;&amp;" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")&lt;0&amp;&amp;(d+=f+" ");h=pb(d),e!==h&amp;&amp;c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&amp;&amp;a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&amp;&amp;" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")&gt;-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&amp;&amp;c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&amp;&amp;"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&amp;&amp;"boolean"!==c||(b=qb(this),b&amp;&amp;W.set(this,"__className__",b),this.setAttribute&amp;&amp;this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&amp;&amp;(" "+pb(qb(c))+" ").indexOf(b)&gt;-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&amp;&amp;(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&amp;&amp;(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&amp;&amp;"set"in b&amp;&amp;void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&amp;&amp;"get"in b&amp;&amp;void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f&lt;0?i:g?f:0;d&lt;i;d++)if(c=e[d],(c.selected||d===f)&amp;&amp;!c.disabled&amp;&amp;(!c.parentNode.disabled||!B(c.parentNode,"optgroup"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)&gt;-1)&amp;&amp;(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)&gt;-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&amp;&amp;8!==e.nodeType&amp;&amp;!sb.test(p+r.event.triggered)&amp;&amp;(p.indexOf(".")&gt;-1&amp;&amp;(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")&lt;0&amp;&amp;"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&amp;&amp;b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&amp;&amp;!n.noBubble&amp;&amp;!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&amp;&amp;o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&amp;&amp;!b.isPropagationStopped())b.type=g&gt;1?j:n.bindType||p,m=(W.get(h,"events")||{})[b.type]&amp;&amp;W.get(h,"handle"),m&amp;&amp;m.apply(h,c),m=k&amp;&amp;h[k],m&amp;&amp;m.apply&amp;&amp;U(h)&amp;&amp;(b.result=m.apply(h,c),b.result===!1&amp;&amp;b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&amp;&amp;n._default.apply(o.pop(),c)!==!1||!U(e)||k&amp;&amp;r.isFunction(e[p])&amp;&amp;!r.isWindow(e)&amp;&amp;(i=e[k],i&amp;&amp;(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&amp;&amp;(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length&gt;0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&amp;&amp;!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e&amp;&amp;null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(Array.isArray(a)||a.jquery&amp;&amp;!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&amp;")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&amp;&amp;!r(this).is(":disabled")&amp;&amp;zb.test(this.nodeName)&amp;&amp;!yb.test(a)&amp;&amp;(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&amp;])_=[^&amp;]*/,Eb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\/\//,Ib={},Jb={},Kb="*/".concat("*"),Lb=d.createElement("a");Lb.href=tb.href;function Mb(a){return function(b,c){"string"!=typeof b&amp;&amp;(c=b,b="*");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&amp;&amp;g("*")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&amp;&amp;((e[c]?a:d||(d={}))[c]=b[c]);return d&amp;&amp;r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&amp;&amp;(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&amp;&amp;h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&amp;&amp;i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&amp;&amp;(c[a.responseFields[f]]=b),!i&amp;&amp;d&amp;&amp;a.dataFilter&amp;&amp;(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&amp;&amp;i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&amp;&amp;(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&amp;&amp;(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&amp;&amp;a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:"GET",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){"object"==typeof b&amp;&amp;(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&amp;&amp;(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&amp;&amp;(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&amp;&amp;(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&amp;&amp;e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+"").replace(Hb,tb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(L)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+"//"+Lb.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&amp;&amp;o.processData&amp;&amp;"string"!=typeof o.data&amp;&amp;(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&amp;&amp;o.global,l&amp;&amp;0===r.active++&amp;&amp;r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,""),o.hasContent?o.data&amp;&amp;o.processData&amp;&amp;0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&amp;&amp;(o.data=o.data.replace(Bb,"+")):(n=o.url.slice(f.length),o.data&amp;&amp;(f+=(vb.test(f)?"&amp;":"?")+o.data,delete o.data),o.cache===!1&amp;&amp;(f=f.replace(Db,"$1"),n=(vb.test(f)?"&amp;":"?")+"_="+ub++ +n),o.url=f+n),o.ifModified&amp;&amp;(r.lastModified[f]&amp;&amp;y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&amp;&amp;y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&amp;&amp;o.hasContent&amp;&amp;o.contentType!==!1||c.contentType)&amp;&amp;y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&amp;&amp;o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Kb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&amp;&amp;(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&amp;&amp;q.trigger("ajaxSend",[y,o]),k)return y;o.async&amp;&amp;o.timeout&gt;0&amp;&amp;(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&amp;&amp;a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b&gt;0?4:0,j=b&gt;=200&amp;&amp;b&lt;300||304===b,d&amp;&amp;(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&amp;&amp;(w=y.getResponseHeader("Last-Modified"),w&amp;&amp;(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&amp;&amp;(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&amp;&amp;x||(x="error",b&lt;0&amp;&amp;(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&amp;&amp;q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&amp;&amp;(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&amp;&amp;(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&amp;&amp;a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&amp;&amp;(r.isFunction(a)&amp;&amp;(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&amp;&amp;b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&amp;&amp;"withCredentials"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&amp;&amp;!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&amp;&amp;h.overrideMimeType&amp;&amp;h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&amp;&amp;(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&amp;&amp;a.setTimeout(function(){c&amp;&amp;d()})},c=c("abort");try{h.send(b.hasContent&amp;&amp;b.data||null)}catch(i){if(c)throw i}},abort:function(){c&amp;&amp;c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&amp;&amp;(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&amp;&amp;(a.cache=!1),a.crossDomain&amp;&amp;(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("&lt;script&gt;").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&amp;&amp;f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&amp;&amp;c()}}}});var Tb=[],Ub=/(=)\?(?=&amp;|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Tb.pop()||r.expando+"_"+ub++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&amp;&amp;(Ub.test(b.url)?"url":"string"==typeof b.data&amp;&amp;0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&amp;&amp;Ub.test(b.data)&amp;&amp;"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Ub,"$1"+e):b.jsonp!==!1&amp;&amp;(b.url+=(vb.test(b.url)?"&amp;":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&amp;&amp;(b.jsonpCallback=c.jsonpCallback,Tb.push(e)),g&amp;&amp;r.isFunction(f)&amp;&amp;f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="&lt;form&gt;&lt;/form&gt;&lt;form&gt;&lt;/form&gt;",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&amp;&amp;(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=C.exec(a),g=!c&amp;&amp;[],f?[b.createElement(f[1])]:(f=qa([a],b,g),g&amp;&amp;g.length&amp;&amp;r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h&gt;-1&amp;&amp;(d=pb(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&amp;&amp;"object"==typeof b&amp;&amp;(e="POST"),g.length&gt;0&amp;&amp;r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("&lt;div&gt;").append(r.parseHTML(a)).find(d):a)}).always(c&amp;&amp;function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length},r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&amp;&amp;(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&amp;&amp;(f+i).indexOf("auto")&gt;-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&amp;&amp;(b=b.call(a,c,r.extend({},h))),null!=b.top&amp;&amp;(m.top=b.top-h.top+g),null!=b.left&amp;&amp;(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),b=f.ownerDocument,c=b.documentElement,e=b.defaultView,{top:d.top+e.pageYOffset-c.clientTop,left:d.left+e.pageXOffset-c.clientLeft}):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),B(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&amp;&amp;"static"===r.css(a,"position"))a=a.offsetParent;return a||ra})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return T(this,function(a,d,e){var f;return r.isWindow(a)?f=a:9===a.nodeType&amp;&amp;(f=a.defaultView),void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Pa(o.pixelPosition,function(a,c){if(c)return c=Oa(a,b),Ma.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&amp;&amp;(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return T(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),r.holdReady=function(a){a?r.readyWait++:r.ready(!0)},r.isArray=Array.isArray,r.parseJSON=JSON.parse,r.nodeName=B,"function"==typeof define&amp;&amp;define.amd&amp;&amp;define("jquery",[],function(){return r});var Vb=a.jQuery,Wb=a.$;return r.noConflict=function(b){return a.$===r&amp;&amp;(a.$=Wb),b&amp;&amp;a.jQuery===r&amp;&amp;(a.jQuery=Vb),r},b||(a.jQuery=a.$=r),r});

/*!
 * shariff - v3.2.1 - Mon, 27 May 2019 08:23:32 GMT
 * https://github.com/heiseonline/shariff
 * Copyright (c) 2019 Ines Pauer, Philipp Busse, Sebastian Hilbig, Erich Kramer, Deniz Sesli
 * Licensed under the MIT license
 */
!function(e){function t(a){if(r[a])return r[a].exports;var n=r[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};t.m=e,t.c=r,t.d=function(e,r,a){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var r=e&amp;&amp;e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t,r){"use strict";function a(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function n(e,t,r){if(e&amp;&amp;p.isObject(e)&amp;&amp;e instanceof a)return e;var n=new a;return n.parse(e,t,r),n}function i(e){return p.isString(e)&amp;&amp;(e=n(e)),e instanceof a?e.format():a.prototype.format.call(e)}function o(e,t){return n(e,!1,!0).resolve(t)}function s(e,t){return e?n(e,!1,!0).resolveObject(t):t}var l=r(10),p=r(12);t.parse=n,t.resolve=o,t.resolveObject=s,t.format=i,t.Url=a;var u=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,d=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["&lt;","&gt;",'"',"`"," ","\r","\n","\t"],f=["{","}","|","\\","^","`"].concat(c),m=["'"].concat(f),b=["%","/","?",";","#"].concat(m),g=["/","?","#"],v=/^[+a-z0-9A-Z_-]{0,63}$/,k=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,j={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},z={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},T=r(13);a.prototype.parse=function(e,t,r){if(!p.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),n=-1!==a&amp;&amp;a&lt;e.indexOf("#")?"?":"#",i=e.split(n),o=/\\/g;i[0]=i[0].replace(o,"/"),e=i.join(n);var s=e;if(s=s.trim(),!r&amp;&amp;1===e.split("#").length){var h=d.exec(s);if(h)return this.path=s,this.href=s,this.pathname=h[1],h[2]?(this.search=h[2],this.query=t?T.parse(this.search.substr(1)):this.search.substr(1)):t&amp;&amp;(this.search="",this.query={}),this}var c=u.exec(s);if(c){c=c[0];var f=c.toLowerCase();this.protocol=f,s=s.substr(c.length)}if(r||c||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var P="//"===s.substr(0,2);!P||c&amp;&amp;y[c]||(s=s.substr(2),this.slashes=!0)}if(!y[c]&amp;&amp;(P||c&amp;&amp;!z[c])){for(var w=-1,x=0;x&lt;g.length;x++){var C=s.indexOf(g[x]);-1!==C&amp;&amp;(-1===w||C&lt;w)&amp;&amp;(w=C)}var U,R;R=-1===w?s.lastIndexOf("@"):s.lastIndexOf("@",w),-1!==R&amp;&amp;(U=s.slice(0,R),s=s.slice(R+1),this.auth=decodeURIComponent(U)),w=-1;for(var x=0;x&lt;b.length;x++){var C=s.indexOf(b[x]);-1!==C&amp;&amp;(-1===w||C&lt;w)&amp;&amp;(w=C)}-1===w&amp;&amp;(w=s.length),this.host=s.slice(0,w),s=s.slice(w),this.parseHost(),this.hostname=this.hostname||"";var I="["===this.hostname[0]&amp;&amp;"]"===this.hostname[this.hostname.length-1];if(!I)for(var S=this.hostname.split(/\./),x=0,D=S.length;x&lt;D;x++){var O=S[x];if(O&amp;&amp;!O.match(v)){for(var L="",A=0,N=O.length;A&lt;N;A++)O.charCodeAt(A)&gt;127?L+="x":L+=O[A];if(!L.match(v)){var F=S.slice(0,x),M=S.slice(x+1),q=O.match(k);q&amp;&amp;(F.push(q[1]),M.unshift(q[2])),M.length&amp;&amp;(s="/"+M.join(".")+s),this.hostname=F.join(".");break}}}this.hostname.length&gt;255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=l.toASCII(this.hostname));var J=this.port?":"+this.port:"",E=this.hostname||"";this.host=E+J,this.href+=this.host,I&amp;&amp;(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&amp;&amp;(s="/"+s))}if(!j[f])for(var x=0,D=m.length;x&lt;D;x++){var V=m[x];if(-1!==s.indexOf(V)){var W=encodeURIComponent(V);W===V&amp;&amp;(W=escape(V)),s=s.split(V).join(W)}}var G=s.indexOf("#");-1!==G&amp;&amp;(this.hash=s.substr(G),s=s.slice(0,G));var B=s.indexOf("?");if(-1!==B?(this.search=s.substr(B),this.query=s.substr(B+1),t&amp;&amp;(this.query=T.parse(this.query)),s=s.slice(0,B)):t&amp;&amp;(this.search="",this.query={}),s&amp;&amp;(this.pathname=s),z[f]&amp;&amp;this.hostname&amp;&amp;!this.pathname&amp;&amp;(this.pathname="/"),this.pathname||this.search){var J=this.pathname||"",Q=this.search||"";this.path=J+Q}return this.href=this.format(),this},a.prototype.format=function(){var e=this.auth||"";e&amp;&amp;(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",a=this.hash||"",n=!1,i="";this.host?n=e+this.host:this.hostname&amp;&amp;(n=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&amp;&amp;(n+=":"+this.port)),this.query&amp;&amp;p.isObject(this.query)&amp;&amp;Object.keys(this.query).length&amp;&amp;(i=T.stringify(this.query));var o=this.search||i&amp;&amp;"?"+i||"";return t&amp;&amp;":"!==t.substr(-1)&amp;&amp;(t+=":"),this.slashes||(!t||z[t])&amp;&amp;!1!==n?(n="//"+(n||""),r&amp;&amp;"/"!==r.charAt(0)&amp;&amp;(r="/"+r)):n||(n=""),a&amp;&amp;"#"!==a.charAt(0)&amp;&amp;(a="#"+a),o&amp;&amp;"?"!==o.charAt(0)&amp;&amp;(o="?"+o),r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),o=o.replace("#","%23"),t+n+r+o+a},a.prototype.resolve=function(e){return this.resolveObject(n(e,!1,!0)).format()},a.prototype.resolveObject=function(e){if(p.isString(e)){var t=new a;t.parse(e,!1,!0),e=t}for(var r=new a,n=Object.keys(this),i=0;i&lt;n.length;i++){var o=n[i];r[o]=this[o]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&amp;&amp;!e.protocol){for(var s=Object.keys(e),l=0;l&lt;s.length;l++){var u=s[l];"protocol"!==u&amp;&amp;(r[u]=e[u])}return z[r.protocol]&amp;&amp;r.hostname&amp;&amp;!r.pathname&amp;&amp;(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&amp;&amp;e.protocol!==r.protocol){if(!z[e.protocol]){for(var h=Object.keys(e),d=0;d&lt;h.length;d++){var c=h[d];r[c]=e[c]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||y[e.protocol])r.pathname=e.pathname;else{for(var f=(e.pathname||"").split("/");f.length&amp;&amp;!(e.host=f.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==f[0]&amp;&amp;f.unshift(""),f.length&lt;2&amp;&amp;f.unshift(""),r.pathname=f.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var m=r.pathname||"",b=r.search||"";r.path=m+b}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var g=r.pathname&amp;&amp;"/"===r.pathname.charAt(0),v=e.host||e.pathname&amp;&amp;"/"===e.pathname.charAt(0),k=v||g||r.host&amp;&amp;e.pathname,j=k,T=r.pathname&amp;&amp;r.pathname.split("/")||[],f=e.pathname&amp;&amp;e.pathname.split("/")||[],P=r.protocol&amp;&amp;!z[r.protocol];if(P&amp;&amp;(r.hostname="",r.port=null,r.host&amp;&amp;(""===T[0]?T[0]=r.host:T.unshift(r.host)),r.host="",e.protocol&amp;&amp;(e.hostname=null,e.port=null,e.host&amp;&amp;(""===f[0]?f[0]=e.host:f.unshift(e.host)),e.host=null),k=k&amp;&amp;(""===f[0]||""===T[0])),v)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,T=f;else if(f.length)T||(T=[]),T.pop(),T=T.concat(f),r.search=e.search,r.query=e.query;else if(!p.isNullOrUndefined(e.search)){if(P){r.hostname=r.host=T.shift();var w=!!(r.host&amp;&amp;r.host.indexOf("@")&gt;0)&amp;&amp;r.host.split("@");w&amp;&amp;(r.auth=w.shift(),r.host=r.hostname=w.shift())}return r.search=e.search,r.query=e.query,p.isNull(r.pathname)&amp;&amp;p.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!T.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var x=T.slice(-1)[0],C=(r.host||e.host||T.length&gt;1)&amp;&amp;("."===x||".."===x)||""===x,U=0,R=T.length;R&gt;=0;R--)x=T[R],"."===x?T.splice(R,1):".."===x?(T.splice(R,1),U++):U&amp;&amp;(T.splice(R,1),U--);if(!k&amp;&amp;!j)for(;U--;U)T.unshift("..");!k||""===T[0]||T[0]&amp;&amp;"/"===T[0].charAt(0)||T.unshift(""),C&amp;&amp;"/"!==T.join("/").substr(-1)&amp;&amp;T.push("");var I=""===T[0]||T[0]&amp;&amp;"/"===T[0].charAt(0);if(P){r.hostname=r.host=I?"":T.length?T.shift():"";var w=!!(r.host&amp;&amp;r.host.indexOf("@")&gt;0)&amp;&amp;r.host.split("@");w&amp;&amp;(r.auth=w.shift(),r.host=r.hostname=w.shift())}return k=k||r.host&amp;&amp;T.length,k&amp;&amp;!I&amp;&amp;T.unshift(""),T.length?r.pathname=T.join("/"):(r.pathname=null,r.path=null),p.isNull(r.pathname)&amp;&amp;p.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},a.prototype.parseHost=function(){var e=this.host,t=h.exec(e);t&amp;&amp;(t=t[0],":"!==t&amp;&amp;(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&amp;&amp;(this.hostname=e)}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&amp;&amp;(r=window)}e.exports=r},function(e,t,r){"use strict";r(3),e.exports=r(4)},function(e,t){},function(e,t,r){"use strict";(function(t){function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n="function"==typeof Symbol&amp;&amp;"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&amp;&amp;"function"==typeof Symbol&amp;&amp;e.constructor===Symbol&amp;&amp;e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r&lt;t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&amp;&amp;(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&amp;&amp;e(t.prototype,r),a&amp;&amp;e(t,a),t}}(),o=r(5),s=r(6),l=r(0),p={theme:"color",backendUrl:null,infoUrl:"http://ct.de/-2467514",infoDisplay:"blank",lang:"de",langFallback:"en",mailUrl:function(){var e=l.parse(this.getURL(),!0);return e.query.view="mail",delete e.search,l.format(e)},mailBody:function(){return this.getURL()},mediaUrl:null,orientation:"horizontal",buttonStyle:"standard",referrerTrack:null,services:["twitter","facebook","info"],title:t.document.title,twitterVia:null,flattrUser:null,flattrCategory:null,url:function(){var e=t.document.location.href,r=o("link[rel=canonical]").attr("href")||this.getMeta("og:url")||"";return r.length&gt;0&amp;&amp;(r.indexOf("http")&lt;0&amp;&amp;(r=0!==r.indexOf("//")?t.document.location.protocol+"//"+t.document.location.host+r:t.document.location.protocol+r),e=r),e}},u=function(){function e(t,r){var n=this;a(this,e),this.element=t,o(t).empty(),this.options=o.extend({},p,r,o(t).data()),this.services=Object.keys(s).filter(function(e){return n.isEnabledService(e)}).sort(function(e,t){var r=n.options.services;return r.indexOf(e)-r.indexOf(t)}).map(function(e){return s[e](n)}),this._addButtonList(),null!==this.options.backendUrl&amp;&amp;"icon"!==this.options.buttonStyle&amp;&amp;this.getShares(this._updateCounts.bind(this))}return i(e,[{key:"isEnabledService",value:function(e){return this.options.services.indexOf(e)&gt;-1}},{key:"$socialshareElement",value:function(){return o(this.element)}},{key:"getLocalized",value:function(e,t){return"object"===n(e[t])?void 0===e[t][this.options.lang]?e[t][this.options.langFallback]:e[t][this.options.lang]:"string"==typeof e[t]?e[t]:void 0}},{key:"getMeta",value:function(e){return o('meta[name="'+e+'"],[property="'+e+'"]').attr("content")||""}},{key:"getInfoUrl",value:function(){return this.options.infoUrl}},{key:"getInfoDisplayPopup",value:function(){return"popup"===this.options.infoDisplay}},{key:"getInfoDisplayBlank",value:function(){return"popup"!==this.options.infoDisplay&amp;&amp;"self"!==this.options.infoDisplay}},{key:"getURL",value:function(){return this.getOption("url")}},{key:"getOption",value:function(e){var t=this.options[e];return"function"==typeof t?t.call(this):t}},{key:"getTitle",value:function(){var e=this.getOption("title");if(o(this.element).data().title)return e;e=e||this.getMeta("DC.title");var t=this.getMeta("DC.creator");return e&amp;&amp;t?e+" - "+t:e}},{key:"getReferrerTrack",value:function(){return this.options.referrerTrack||""}},{key:"getShares",value:function(e){var t=l.parse(this.options.backendUrl,!0);return t.query.url=this.getURL(),delete t.search,o.getJSON(l.format(t),e)}},{key:"_updateCounts",value:function(e,t,r){var a=this;e&amp;&amp;o.each(e,function(e,t){a.isEnabledService(e)&amp;&amp;(t&gt;=1e3&amp;&amp;(t=Math.round(t/1e3)+"k"),o(a.element).find("."+e+" a").append(o("&lt;span/&gt;").addClass("share_count").text(t)))})}},{key:"_addButtonList",value:function(){var e=this,r=o("&lt;ul/&gt;").addClass(["theme-"+this.options.theme,"orientation-"+this.options.orientation,"button-style-"+this.options.buttonStyle,"shariff-col-"+this.options.services.length].join(" "));this.services.forEach(function(t){var a=o("&lt;li/&gt;").addClass("shariff-button "+t.name),n=o("&lt;a/&gt;").attr("href",t.shareUrl);if("standard"===e.options.buttonStyle){var i=o("&lt;span/&gt;").addClass("share_text").text(e.getLocalized(t,"shareText"));n.append(i)}void 0!==t.faPrefix&amp;&amp;void 0!==t.faName&amp;&amp;n.prepend(o("&lt;span/&gt;").addClass(t.faPrefix+" "+t.faName)),t.popup?(n.attr("data-rel","popup"),"info"!==t.name&amp;&amp;n.attr("rel","nofollow")):t.blank?(n.attr("target","_blank"),"info"===t.name?n.attr("rel","noopener noreferrer"):n.attr("rel","nofollow noopener noreferrer")):"info"!==t.name&amp;&amp;n.attr("rel","nofollow"),n.attr("title",e.getLocalized(t,"title")),n.attr("role","button"),n.attr("aria-label",e.getLocalized(t,"title")),a.append(n),r.append(a)}),r.on("click",'[data-rel="popup"]',function(e){e.preventDefault();var r=o(this).attr("href");if(r.match(/twitter\.com\/intent\/(\w+)/)){var a=t.window;if(a.__twttr&amp;&amp;a.__twttr.widgets&amp;&amp;a.__twttr.widgets.loaded)return}t.window.open(r,"_blank","width=600,height=460")}),this.$socialshareElement().append(r)}}]),e}();e.exports=u,t.Shariff=u,o(function(){o(".shariff").each(function(){this.hasOwnProperty("shariff")||(this.shariff=new u(this))})})}).call(t,r(1))},function(e,t,r){"use strict";function a(e,t){var r=[];return t=t||document,"function"==typeof e?(t.attachEvent?"complete"===t.readyState:"loading"!==t.readyState)?e():t.addEventListener("DOMContentLoaded",e):r=e instanceof Element?[e]:"string"==typeof e?"&lt;"===e[0]?Array.prototype.slice.call(l(e)):Array.prototype.slice.call(t.querySelectorAll(e)):e,new n(r,t)}function n(e,t){this.length=e.length,this.context=t;var r=this;s(e,function(e){r[e]=this})}"function"!=typeof Object.assign&amp;&amp;(Object.assign=function(e,t){if(null===e)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(e),a=1;a&lt;arguments.length;a++){var n=arguments[a];if(null!==n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&amp;&amp;(r[i]=n[i])}return r}),n.prototype.each=function(e){for(var t=this.length-1;t&gt;=0;t--)e.call(this[t],t,this[t]);return this},n.prototype.empty=function(){return this.each(i)},n.prototype.text=function(e){return void 0===e?this[0].textContent:this.each(function(){this.textContent=e})},n.prototype.attr=function(e,t){return this.length&lt;1?null:void 0===t?this[0].getAttribute(e):this.each(function(){this.setAttribute(e,t)})},n.prototype.data=function(e,t){if(t)return this.attr("data-"+e,t);if(e)return this.attr("data-"+e);var r=Object.assign({},this[0].dataset);return s(r,function(e,t){r[e]=m(t)}),r},n.prototype.find=function(e){var t;return t=o(this,function(t){return t.querySelectorAll(e)}),t=o(t,function(e){return Array.prototype.slice.call(e)}),t=Array.prototype.concat.apply([],t),new n(t)},n.prototype.append=function(e){return"string"==typeof e&amp;&amp;(e=l(e)),p(this[0],e),this},n.prototype.prepend=function(e){return"string"==typeof e&amp;&amp;(e=l(e)),u(this[0],e),this},n.prototype.addClass=function(e){return this.each(function(){var t=this;e.split(" ").forEach(function(e){t.classList.add(e)})})},n.prototype.removeClass=function(e){return this.each(function(){this.classList.remove(e)})},n.prototype.on=function(e,t,r){return this.each(function(){d(t,e,r,this)})};var i=function(){for(;this.hasChildNodes();)this.removeChild(this.firstChild)},o=function(e,t){return Array.prototype.map.call(e,t)},s=function(e,t){if(e instanceof Array)for(var r=0;r&lt;e.length;r++)t.call(e[r],r,e[r]);else if(e instanceof Object)for(var a in e)t.call(e[a],a,e[a],e);return e},l=function(e){var t=document.createElement("div");return t.innerHTML=e,t.children},p=function(e,t){for(var r=0;r&lt;t.length;r++)e.appendChild(t[r])},u=function(e,t){for(var r=t.length-1;r&gt;=0;r--)e.insertBefore(t[t.length-1],e.firstChild)},h=function(){var e=HTMLElement.prototype,t=e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector;return function e(r,a){if(null!==r)return t.call(r,a)?r:e(r.parentElement,a)}}(),d=function(e,t,r,a){(a||document).addEventListener(t,function(t){var a=h(t.target,e);a&amp;&amp;r.call(a,t)})},c=function e(t){var r={},a=!1,n=0,i=arguments.length;for("[object Boolean]"===Object.prototype.toString.call(arguments[0])&amp;&amp;(a=arguments[0],n++);n&lt;i;n++){var o=arguments[n];!function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&amp;&amp;(a&amp;&amp;"[object Object]"===Object.prototype.toString.call(t[n])?r[n]=e(!0,r[n],t[n]):r[n]=t[n])}(o)}return r},f=function(e,t){var r=new XMLHttpRequest;r.open("GET",e,!0),r.setRequestHeader("Content-Type","application/json"),r.setRequestHeader("Accept","application/json"),r.onload=function(){if(r.status&gt;=200&amp;&amp;r.status&lt;400){var e=JSON.parse(r.responseText);t(e,r.status,r)}else t(null,r.status,r)},r.onerror=function(e){t(new Error(e),null,r)},r.send()},m=function(e){if("true"===e)return!0;if("false"===e)return!1;if("null"===e)return null;if(+e+""===e)return+e;if(/^[[{]/.test(e))try{return JSON.parse(e)}catch(t){return e}return e};a.extend=c,a.map=o,a.each=s,a.getJSON=f,e.exports=a},function(e,t,r){"use strict";e.exports={addthis:r(7),buffer:r(8),diaspora:r(9),facebook:r(16),flattr:r(17),flipboard:r(18),info:r(19),linkedin:r(20),mail:r(21),pinterest:r(22),pocket:r(23),print:r(24),qzone:r(25),reddit:r(26),stumbleupon:r(27),telegram:r(28),tencent:r(29),threema:r(30),tumblr:r(31),twitter:r(32),vk:r(33),weibo:r(34),whatsapp:r(35),xing:r(36)}},function(e,t,r){"use strict";e.exports=function(e){return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"addthis",faPrefix:"fas",faName:"fa-plus",title:{bg:"Сподели в AddThis",cs:"Sdílet na AddThis",da:"Del på AddThis",de:"Bei AddThis teilen",en:"Share on AddThis",es:"Compartir en AddThis",fi:"Jaa AddThisissä",fr:"Partager sur AddThis",hr:"Podijelite na AddThis",hu:"Megosztás AddThisen",it:"Condividi su AddThis",ja:"AddThis上で共有",ko:"AddThis에서 공유하기",nl:"Delen op AddThis",no:"Del på AddThis",pl:"Udostępnij przez AddThis",pt:"Compartilhar no AddThis",ro:"Partajează pe AddThis",ru:"Поделиться на AddThis",sk:"Zdieľať na AddThis",sl:"Deli na AddThis",sr:"Podeli na AddThis",sv:"Dela på AddThis",tr:"AddThis'ta paylaş",zh:"在AddThis上分享"},shareUrl:"http://api.addthis.com/oexchange/0.8/offer?url="+encodeURIComponent(e.getURL())+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){var t=encodeURIComponent(e.getURL());return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"buffer",faPrefix:"fab",faName:"fa-buffer",title:{bg:"Сподели в buffer",cs:"Sdílet na buffer",da:"Del på buffer",de:"Bei buffer teilen",en:"Share on buffer",es:"Compartir en buffer",fi:"Jaa bufferissä",fr:"Partager sur buffer",hr:"Podijelite na buffer",hu:"Megosztás bufferen",it:"Condividi su buffer",ja:"buffer上で共有",ko:"buffer에서 공유하기",nl:"Delen op buffer",no:"Del på buffer",pl:"Udostępnij przez buffer",pt:"Compartilhar no buffer",ro:"Partajează pe buffer",ru:"Поделиться на buffer",sk:"Zdieľať na buffer",sl:"Deli na buffer",sr:"Podeli na buffer",sv:"Dela på buffer",tr:"buffer'ta paylaş",zh:"在buffer上分享"},shareUrl:"https://buffer.com/add?text="+encodeURIComponent(e.getTitle())+"&amp;url="+t+e.getReferrerTrack()}}},function(e,t,r){"use strict";var a=r(0);e.exports=function(e){var t=a.parse("https://share.diasporafoundation.org/",!0);return t.query.url=e.getURL(),t.query.title=e.getTitle(),t.protocol="https",delete t.search,{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"diaspora",faPrefix:"fas",faName:"fa-asterisk",title:{bg:"Сподели в diaspora*",cs:"Sdílet na diaspora*",da:"Del på diaspora*",de:"Bei diaspora* teilen",en:"Share on diaspora*",es:"Compartir en diaspora*",fi:"Jaa Diasporaissä",fr:"Partager sur diaspora*",hr:"Podijelite na diaspora*",hu:"Megosztás diaspora*",it:"Condividi su diaspora*",ja:"diaspora*上で共有",ko:"diaspora*에서 공유하기",nl:"Delen op diaspora*",no:"Del på diaspora*",pl:"Udostępnij przez diaspora*",pt:"Compartilhar no diaspora*",ro:"Partajează pe diaspora*",ru:"Поделиться на diaspora*",sk:"Zdieľať na diaspora*",sl:"Deli na diaspora*",sr:"Podeli na diaspora*-u",sv:"Dela på diaspora*",tr:"diaspora*'ta paylaş",zh:"分享至diaspora*"},shareUrl:a.format(t)+e.getReferrerTrack()}}},function(e,t,r){(function(e,a){var n;!function(a){function i(e){throw new RangeError(I[e])}function o(e,t){for(var r=e.length,a=[];r--;)a[r]=t(e[r]);return a}function s(e,t){var r=e.split("@"),a="";return r.length&gt;1&amp;&amp;(a=r[0]+"@",e=r[1]),e=e.replace(R,"."),a+o(e.split("."),t).join(".")}function l(e){for(var t,r,a=[],n=0,i=e.length;n&lt;i;)t=e.charCodeAt(n++),t&gt;=55296&amp;&amp;t&lt;=56319&amp;&amp;n&lt;i?(r=e.charCodeAt(n++),56320==(64512&amp;r)?a.push(((1023&amp;t)&lt;&lt;10)+(1023&amp;r)+65536):(a.push(t),n--)):a.push(t);return a}function p(e){return o(e,function(e){var t="";return e&gt;65535&amp;&amp;(e-=65536,t+=O(e&gt;&gt;&gt;10&amp;1023|55296),e=56320|1023&amp;e),t+=O(e)}).join("")}function u(e){return e-48&lt;10?e-22:e-65&lt;26?e-65:e-97&lt;26?e-97:k}function h(e,t){return e+22+75*(e&lt;26)-((0!=t)&lt;&lt;5)}function d(e,t,r){var a=0;for(e=r?D(e/T):e&gt;&gt;1,e+=D(e/t);e&gt;S*y&gt;&gt;1;a+=k)e=D(e/S);return D(a+(S+1)*e/(e+z))}function c(e){var t,r,a,n,o,s,l,h,c,f,m=[],b=e.length,g=0,z=w,T=P;for(r=e.lastIndexOf(x),r&lt;0&amp;&amp;(r=0),a=0;a&lt;r;++a)e.charCodeAt(a)&gt;=128&amp;&amp;i("not-basic"),m.push(e.charCodeAt(a));for(n=r&gt;0?r+1:0;n&lt;b;){for(o=g,s=1,l=k;n&gt;=b&amp;&amp;i("invalid-input"),h=u(e.charCodeAt(n++)),(h&gt;=k||h&gt;D((v-g)/s))&amp;&amp;i("overflow"),g+=h*s,c=l&lt;=T?j:l&gt;=T+y?y:l-T,!(h&lt;c);l+=k)f=k-c,s&gt;D(v/f)&amp;&amp;i("overflow"),s*=f;t=m.length+1,T=d(g-o,t,0==o),D(g/t)&gt;v-z&amp;&amp;i("overflow"),z+=D(g/t),g%=t,m.splice(g++,0,z)}return p(m)}function f(e){var t,r,a,n,o,s,p,u,c,f,m,b,g,z,T,C=[];for(e=l(e),b=e.length,t=w,r=0,o=P,s=0;s&lt;b;++s)(m=e[s])&lt;128&amp;&amp;C.push(O(m));for(a=n=C.length,n&amp;&amp;C.push(x);a&lt;b;){for(p=v,s=0;s&lt;b;++s)(m=e[s])&gt;=t&amp;&amp;m&lt;p&amp;&amp;(p=m);for(g=a+1,p-t&gt;D((v-r)/g)&amp;&amp;i("overflow"),r+=(p-t)*g,t=p,s=0;s&lt;b;++s)if(m=e[s],m&lt;t&amp;&amp;++r&gt;v&amp;&amp;i("overflow"),m==t){for(u=r,c=k;f=c&lt;=o?j:c&gt;=o+y?y:c-o,!(u&lt;f);c+=k)T=u-f,z=k-f,C.push(O(h(f+T%z,0))),u=D(T/z);C.push(O(h(u,0))),o=d(r,g,a==n),r=0,++a}++r,++t}return C.join("")}function m(e){return s(e,function(e){return C.test(e)?c(e.slice(4).toLowerCase()):e})}function b(e){return s(e,function(e){return U.test(e)?"xn--"+f(e):e})}var g,v=("object"==typeof t&amp;&amp;t&amp;&amp;t.nodeType,"object"==typeof e&amp;&amp;e&amp;&amp;e.nodeType,2147483647),k=36,j=1,y=26,z=38,T=700,P=72,w=128,x="-",C=/^xn--/,U=/[^\x20-\x7E]/,R=/[\x2E\u3002\uFF0E\uFF61]/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input &gt;= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=k-j,D=Math.floor,O=String.fromCharCode;g={version:"1.4.1",ucs2:{decode:l,encode:p},decode:c,encode:f,toASCII:b,toUnicode:m},void 0!==(n=function(){return g}.call(t,r,t,e))&amp;&amp;(e.exports=n)}()}).call(t,r(11)(e),r(1))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&amp;&amp;null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){"use strict";t.decode=t.parse=r(14),t.encode=t.stringify=r(15)},function(e,t,r){"use strict";function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,i){t=t||"&amp;",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var s=/\+/g;e=e.split(t);var l=1e3;i&amp;&amp;"number"==typeof i.maxKeys&amp;&amp;(l=i.maxKeys);var p=e.length;l&gt;0&amp;&amp;p&gt;l&amp;&amp;(p=l);for(var u=0;u&lt;p;++u){var h,d,c,f,m=e[u].replace(s,"%20"),b=m.indexOf(r);b&gt;=0?(h=m.substr(0,b),d=m.substr(b+1)):(h=m,d=""),c=decodeURIComponent(h),f=decodeURIComponent(d),a(o,c)?n(o[c])?o[c].push(f):o[c]=[o[c],f]:o[c]=f}return o};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";function a(e,t){if(e.map)return e.map(t);for(var r=[],a=0;a&lt;e.length;a++)r.push(t(e[a],a));return r}var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,s){return t=t||"&amp;",r=r||"=",null===e&amp;&amp;(e=void 0),"object"==typeof e?a(o(e),function(o){var s=encodeURIComponent(n(o))+r;return i(e[o])?a(e[o],function(e){return s+encodeURIComponent(n(e))}).join(t):s+encodeURIComponent(n(e[o]))}).join(t):s?encodeURIComponent(n(s))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&amp;&amp;t.push(r);return t}},function(e,t,r){"use strict";e.exports=function(e){return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"facebook",faPrefix:"fab",faName:"fa-facebook-f",title:{bg:"Сподели във Facebook",cs:"Sdílet na Facebooku",da:"Del på Facebook",de:"Bei Facebook teilen",en:"Share on Facebook",es:"Compartir en Facebook",fi:"Jaa Facebookissa",fr:"Partager sur Facebook",hr:"Podijelite na Facebooku",hu:"Megosztás Facebookon",it:"Condividi su Facebook",ja:"フェイスブック上で共有",ko:"페이스북에서 공유하기",nl:"Delen op Facebook",no:"Del på Facebook",pl:"Udostępnij na Facebooku",pt:"Compartilhar no Facebook",ro:"Partajează pe Facebook",ru:"Поделиться на Facebook",sk:"Zdieľať na Facebooku",sl:"Deli na Facebooku",sr:"Podeli na Facebook-u",sv:"Dela på Facebook",tr:"Facebook'ta paylaş",zh:"在Facebook上分享"},shareUrl:"https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(e.getURL())+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){var t=encodeURIComponent(e.getURL()),r=e.getTitle(),a=e.getMeta("description");return{popup:!0,shareText:"Flattr",name:"flattr",faPrefix:"far",faName:"fa-money-bill-alt",title:{de:"Artikel flattrn",en:"Flattr this"},shareUrl:"https://flattr.com/submit/auto?title="+encodeURIComponent(r)+"&amp;description="+encodeURIComponent(a)+"&amp;category="+encodeURIComponent(e.options.flattrCategory||"text")+"&amp;user_id="+encodeURIComponent(e.options.flattrUser)+"&amp;url="+t+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){var t=encodeURIComponent(e.getURL());return{popup:!0,shareText:"flip it",name:"flipboard",faPrefix:"fab",faName:"fa-flipboard",title:{bg:"Сподели в Flipboard",cs:"Sdílet na Flipboardu",da:"Del på Flipboard",de:"Bei Flipboard teilen",en:"Share on Flipboard",es:"Compartir en Flipboard",fi:"Jaa Flipboardissä",fr:"Partager sur Flipboard",hr:"Podijelite na Flipboardu",hu:"Megosztás Flipboardon",it:"Condividi su Flipboard",ja:"Flipboard上で共有",ko:"Flipboard에서 공유하기",nl:"Delen op Flipboard",no:"Del på Flipboard",pl:"Udostępnij na Flipboardu",pt:"Compartilhar no Flipboard",ro:"Partajează pe Flipboard",ru:"Поделиться на Flipboard",sk:"Zdieľať na Flipboardu",sl:"Deli na Flipboardu",sr:"Podeli na Flipboard-u",sv:"Dela på Flipboard",tr:"Flipboard'ta paylaş",zh:"在Flipboard上分享"},shareUrl:"https://share.flipboard.com/bookmarklet/popout?v=2&amp;title="+encodeURIComponent(e.getTitle())+"&amp;url="+t+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){return{blank:e.getInfoDisplayBlank(),popup:e.getInfoDisplayPopup(),shareText:"Info",name:"info",faPrefix:"fas",faName:"fa-info",title:{bg:"Повече информация",cs:"Více informací",da:"Flere oplysninger",de:"Weitere Informationen",en:"More information",es:"Más informaciones",fi:"Lisätietoja",fr:"Plus d'informations",hr:"Više informacija",hu:"Több információ",it:"Maggiori informazioni",ja:"詳しい情報",ko:"추가 정보",nl:"Verdere informatie",no:"Mer informasjon",pl:"Więcej informacji",pt:"Mais informações",ro:"Mai multe informatii",ru:"Больше информации",sk:"Viac informácií",sl:"Več informacij",sr:"Više informacija",sv:"Mer information",tr:"Daha fazla bilgi",zh:"更多信息"},shareUrl:e.getInfoUrl()}}},function(e,t,r){"use strict";e.exports=function(e){var t=encodeURIComponent(e.getURL()),r=encodeURIComponent(e.getTitle());return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"mitteilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"シェア",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"distribuiți",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"linkedin",faPrefix:"fab",faName:"fa-linkedin-in",title:{bg:"Сподели в LinkedIn",cs:"Sdílet na LinkedIn",da:"Del på LinkedIn",de:"Bei LinkedIn teilen",en:"Share on LinkedIn",es:"Compartir en LinkedIn",fi:"Jaa LinkedInissä",fr:"Partager sur LinkedIn",hr:"Podijelite na LinkedIn",hu:"Megosztás LinkedInen",it:"Condividi su LinkedIn",ja:"LinkedIn上で共有",ko:"LinkedIn에서 공유하기",nl:"Delen op LinkedIn",no:"Del på LinkedIn",pl:"Udostępnij przez LinkedIn",pt:"Compartilhar no LinkedIn",ro:"Partajează pe LinkedIn",ru:"Поделиться на LinkedIn",sk:"Zdieľať na LinkedIn",sl:"Deli na LinkedIn",sr:"Podeli na LinkedIn-u",sv:"Dela på LinkedIn",tr:"LinkedIn'ta paylaş",zh:"在LinkedIn上分享"},shareUrl:"https://www.linkedin.com/shareArticle?mini=true&amp;summary="+encodeURIComponent(e.getMeta("description"))+"&amp;title="+r+"&amp;url="+t}}},function(e,t,r){"use strict";e.exports=function(e){var t=e.getOption("mailUrl");return 0===t.indexOf("mailto:")&amp;&amp;(t+="?subject="+encodeURIComponent(e.getOption("mailSubject")||e.getTitle()),t+="&amp;body="+encodeURIComponent(e.getOption("mailBody").replace(/\{url\}/i,e.getURL()))),{blank:0===t.indexOf("http"),popup:!1,shareText:{en:"mail",zh:"分享"},name:"mail",faPrefix:"fas",faName:"fa-envelope",title:{bg:"Изпрати по имейл",cs:"Poslat mailem",da:"Sende via e-mail",de:"Per E-Mail versenden",en:"Send by email",es:"Enviar por email",fi:"Lähetä sähköpostitse",fr:"Envoyer par courriel",hr:"Pošaljite emailom",hu:"Elküldés e-mailben",it:"Inviare via email",ja:"電子メールで送信",ko:"이메일로 보내기",nl:"Sturen via e-mail",no:"Send via epost",pl:"Wyślij e-mailem",pt:"Enviar por e-mail",ro:"Trimite prin e-mail",ru:"Отправить по эл. почте",sk:"Poslať e-mailom",sl:"Pošlji po elektronski pošti",sr:"Pošalji putem email-a",sv:"Skicka via e-post",tr:"E-posta ile gönder",zh:"通过电子邮件传送"},shareUrl:t}}},function(e,t,r){"use strict";var a=r(0);e.exports=function(e){var t=e.getTitle(),r=e.getMeta("DC.creator");r.length&gt;0&amp;&amp;(t+=" - "+r);var n=e.getOption("mediaUrl");(!n||n.length&lt;=0)&amp;&amp;(n=e.getMeta("og:image"));var i=a.parse("https://www.pinterest.com/pin/create/link/",!0);return i.query.url=e.getURL(),i.query.media=n,i.query.description=t,delete i.search,{popup:!0,shareText:"pin it",name:"pinterest",faPrefix:"fab",faName:"fa-pinterest-p",title:{bg:"Сподели в Pinterest",cs:"Přidat na Pinterest",da:"Del på Pinterest",de:"Bei Pinterest pinnen",en:"Pin it on Pinterest",es:"Compartir en Pinterest",fi:"Jaa Pinterestissä",fr:"Partager sur Pinterest",hr:"Podijelite na Pinterest",hu:"Megosztás Pinteresten",it:"Condividi su Pinterest",ja:"Pinterest上で共有",ko:"Pinterest에서 공유하기",nl:"Delen op Pinterest",no:"Del på Pinterest",pl:"Udostępnij przez Pinterest",pt:"Compartilhar no Pinterest",ro:"Partajează pe Pinterest",ru:"Поделиться на Pinterest",sk:"Zdieľať na Pinterest",sl:"Deli na Pinterest",sr:"Podeli na Pinterest-u",sv:"Dela på Pinterest",tr:"Pinterest'ta paylaş",zh:"分享至Pinterest"},shareUrl:a.format(i)+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){var t=encodeURIComponent(e.getURL());return{popup:!0,shareText:"Pocket",name:"pocket",faPrefix:"fab",faName:"fa-get-pocket",title:{bg:"Запазване в Pocket",cs:"Uložit do Pocket",da:"Gem i Pocket",de:"In Pocket speichern",en:"Save to Pocket",es:"Guardar en Pocket",fi:"Tallenna kohtaan Pocket",fr:"Enregistrer dans Pocket",hr:"Spremi u Pocket",hu:'Mentés "Pocket"-be',it:"Salva in Pocket",ja:"「ポケット」に保存",ko:"Pocket에 저장",nl:"Opslaan in Pocket",no:"Lagre i Pocket",pl:"Zapisz w Pocket",pt:"Salvar em Pocket",ro:"Salvați în Pocket",ru:"Сохранить в Pocket",sk:"Uložiť do priečinka Pocket",sl:"Shrani v Pocket",sr:"Sačuvaj u Pocket",sv:"Spara till Pocket",tr:"Pocket e kaydet",zh:"保存到Pocket"},shareUrl:"https://getpocket.com/save?title="+encodeURIComponent(e.getTitle())+"&amp;url="+t+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){return{name:"print",faPrefix:"fas",faName:"fa-print",popup:!1,shareText:{bg:"",cs:"tlačit",da:"",de:"drucken",en:"print",es:"impresión",fi:"",fr:"imprimer",hr:"",hu:"",it:"stampa",ja:"",ko:"",nl:"afdrukken",no:"",pl:"drukuj",pt:"",ro:"",ru:"Распечатать",sk:"",sl:"",sr:"",sv:"",tr:"",zh:""},title:{bg:"",cs:"tlačit",da:"",de:"drucken",en:"print",es:"impresión",fi:"",fr:"imprimer",hr:"",hu:"",it:"stampa",ja:"",ko:"",nl:"afdrukken",no:"",pl:"drukuj",pt:"",ro:"",ru:"Распечатать",sk:"",sl:"",sr:"",sv:"",tr:"",zh:""},shareUrl:"javascript:window.print();"}}},function(e,t,r){"use strict";e.exports=function(e){return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"qzone",faPrefix:"fab",faName:"fa-qq",title:{bg:"Сподели в Qzone",cs:"Sdílet na Qzone",da:"Del på Qzone",de:"Bei Qzone teilen",en:"Share on Qzone",es:"Compartir en Qzone",fi:"Jaa Qzoneissä",fr:"Partager sur Qzone",hr:"Podijelite na Qzone",hu:"Megosztás Qzone",it:"Condividi su Qzone",ja:"Qzone上で共有",ko:"Qzone에서 공유하기",nl:"Delen op Qzone",no:"Del på Qzone",pl:"Udostępnij przez Qzone",pt:"Compartilhar no Qzone",ro:"Partajează pe Qzone",ru:"Поделиться на Qzone",sk:"Zdieľať na Qzone",sl:"Deli na Qzone",sr:"Podeli na Qzone-u",sv:"Dela på Qzone",tr:"Qzone'ta paylaş",zh:"分享至QQ空间"},shareUrl:"http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+encodeURIComponent(e.getURL())+"&amp;title="+e.getTitle()+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){var t=encodeURIComponent(e.getURL()),r=encodeURIComponent(e.getTitle());return""!==r&amp;&amp;(r="&amp;title="+r),{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"reddit",faPrefix:"fab",faName:"fa-reddit-alien",title:{bg:"Сподели в Reddit",cs:"Sdílet na Redditu",da:"Del på Reddit",de:"Bei Reddit teilen",en:"Share on Reddit",es:"Compartir en Reddit",fi:"Jaa Redditissä",fr:"Partager sur Reddit",hr:"Podijelite na Reddit",hu:"Megosztás Redditen",it:"Condividi su Reddit",ja:"Reddit上で共有",ko:"Reddit에서 공유하기",nl:"Delen op Reddit",no:"Del på Reddit",pl:"Udostępnij przez Reddit",pt:"Compartilhar no Reddit",ro:"Partajează pe Reddit",ru:"Поделиться на Reddit",sk:"Zdieľať na Reddit",sl:"Deli na Reddit",sr:"Podeli na Reddit-u",sv:"Dela på Reddit",tr:"Reddit'ta paylaş",zh:"分享至Reddit"},shareUrl:"https://reddit.com/submit?url="+t+r+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){var t=encodeURIComponent(e.getURL()),r=encodeURIComponent(e.getTitle());return""!==r&amp;&amp;(r="&amp;title="+r),{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"stumbleupon",faPrefix:"fab",faName:"fa-stumbleupon",title:{bg:"Сподели в Stumbleupon",cs:"Sdílet na Stumbleuponu",da:"Del på Stumbleupon",de:"Bei Stumbleupon teilen",en:"Share on Stumbleupon",es:"Compartir en Stumbleupon",fi:"Jaa Stumbleuponissä",fr:"Partager sur Stumbleupon",hr:"Podijelite na Stumbleupon",hu:"Megosztás Stumbleupon",it:"Condividi su Stumbleupon",ja:"Stumbleupon上で共有",ko:"Stumbleupon에서 공유하기",nl:"Delen op Stumbleupon",no:"Del på Stumbleupon",pl:"Udostępnij przez Stumbleupon",pt:"Compartilhar no Stumbleupon",ro:"Partajează pe Stumbleupon",ru:"Поделиться на Stumbleupon",sk:"Zdieľať na Stumbleupon",sl:"Deli na Stumbleupon",sr:"Podeli na Stumbleupon-u",sv:"Dela på Stumbleupon",tr:"Stumbleupon'ta paylaş",zh:"分享至Stumbleupon"},shareUrl:"https://www.stumbleupon.com/submit?url="+t+r+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"telegram",faPrefix:"fab",faName:"fa-telegram",title:{bg:"Сподели в Telegram",cs:"Sdílet na Telegramu",da:"Del på Telegram",de:"Bei Telegram teilen",en:"Share on Telegram",es:"Compartir en Telegram",fi:"Jaa Telegramissä",fr:"Partager sur Telegram",hr:"Podijelite na Telegram",hu:"Megosztás Telegramen",it:"Condividi su Telegram",ja:"Telegram上で共有",ko:"Telegram에서 공유하기",nl:"Delen op Telegram",no:"Del på Telegram",pl:"Udostępnij przez Telegram",pt:"Compartilhar no Telegram",ro:"Partajează pe Telegram",ru:"Поделиться на Telegram",sk:"Zdieľať na Telegram",sl:"Deli na Telegram",sr:"Podeli na Telegram-u",sv:"Dela på Telegram",tr:"Telegram'ta paylaş",zh:"在Telegram上分享"},shareUrl:"https://t.me/share/url?url="+encodeURIComponent(e.getURL())+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"tencent-weibo",faPrefix:"fab",faName:"fa-tencent-weibo",title:{bg:"Сподели в tencent weibo",cs:"Sdílet na tencent weibo",da:"Del på tencent weibo",de:"Bei tencent weibo teilen",en:"Share on tencent weibo",es:"Compartir en tencent weibo",fi:"Jaa tencent weiboissä",fr:"Partager sur tencent weibo",hr:"Podijelite na tencent weibo",hu:"Megosztás tencent weiboen",it:"Condividi su tencent weibo",ja:"Tencent weibo上で共有",ko:"Tencent weibo에서 공유하기",nl:"Delen op tencent weibo",no:"Del på tencent weibo",pl:"Udostępnij przez tencent weibo",pt:"Compartilhar no tencent weibo",ro:"Partajează pe tencent weibo",ru:"Поделиться на tencent weibo",sk:"Zdieľať na tencent weibo",sl:"Deli na tencent weibo",sr:"Podeli na tencent weibo-u",sv:"Dela på tencent weibo",tr:"Tencent weibo'ta paylaş",zh:"分享至腾讯微博"},shareUrl:"http://v.t.qq.com/share/share.php?url="+encodeURIComponent(e.getURL())+"&amp;title="+e.getTitle()+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){var t=encodeURIComponent(e.getURL()),r=e.getTitle();return{popup:!1,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"threema",faPrefix:"fas",faName:"fa-lock",title:{bg:"Сподели в Threema",cs:"Sdílet na Threema",da:"Del på Threema",de:"Bei Threema teilen",en:"Share on Threema",es:"Compartir en Threema",fi:"Jaa Threemaissä",fr:"Partager sur Threema",hr:"Podijelite na Threema",hu:"Megosztás Threemaen",it:"Condividi su Threema",ja:"Threema上で共有",ko:"Threema에서 공유하기",nl:"Delen op Threema",no:"Del på Threema",pl:"Udostępnij przez Threema",pt:"Compartilhar no Threema",ro:"Partajează pe Threema",ru:"Поделиться на Threema",sk:"Zdieľať na Threema",sl:"Deli na Threema",sr:"Podeli na Threema-u",sv:"Dela på Threema",tr:"Threema'ta paylaş",zh:"在Threema上分享"},shareUrl:"threema://compose?text="+encodeURIComponent(r)+"%20"+t+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"tumblr",faPrefix:"fab",faName:"fa-tumblr",title:{bg:"Сподели в tumblr",cs:"Sdílet na tumblru",da:"Del på tumblr",de:"Bei tumblr teilen",en:"Share on tumblr",es:"Compartir en tumblr",fi:"Jaa tumblrissä",fr:"Partager sur tumblr",hr:"Podijelite na tumblr",hu:"Megosztás tumblren",it:"Condividi su tumblr",ja:"tumblr上で共有",ko:"tumblr에서 공유하기",nl:"Delen op tumblr",no:"Del på tumblr",pl:"Udostępnij przez tumblr",pt:"Compartilhar no tumblr",ro:"Partajează pe tumblr",ru:"Поделиться на tumblr",sk:"Zdieľať na tumblr",sl:"Deli na tumblr",sr:"Podeli na tumblr-u",sv:"Dela på tumblr",tr:"tumblr'ta paylaş",zh:"在tumblr上分享"},shareUrl:"http://tumblr.com/widgets/share/tool?canonicalUrl="+encodeURIComponent(e.getURL())+e.getReferrerTrack()}}},function(e,t,r){"use strict";var a=r(0),n=function(e,t){var r=document.createElement("div"),a=document.createTextNode(e);r.appendChild(a);var n=r.textContent;if(n.length&lt;=t)return e;var i=n.substring(0,t-1).lastIndexOf(" ");return n=n.substring(0,i)+"…"};e.exports=function(e){var t=a.parse("https://twitter.com/intent/tweet",!0),r=e.getTitle();return t.query.text=n(r,120),t.query.url=e.getURL(),null!==e.options.twitterVia&amp;&amp;(t.query.via=e.options.twitterVia),delete t.search,{popup:!0,shareText:{en:"tweet",ja:"のつぶやき",ko:"짹짹",ru:"твит",sr:"твеет",zh:"鸣叫"},name:"twitter",faPrefix:"fab",faName:"fa-twitter",title:{bg:"Сподели в Twitter",cs:"Sdílet na Twiiteru",da:"Del på Twitter",de:"Bei Twitter teilen",en:"Share on Twitter",es:"Compartir en Twitter",fi:"Jaa Twitterissä",fr:"Partager sur Twitter",hr:"Podijelite na Twitteru",hu:"Megosztás Twitteren",it:"Condividi su Twitter",ja:"ツイッター上で共有",ko:"트위터에서 공유하기",nl:"Delen op Twitter",no:"Del på Twitter",pl:"Udostępnij na Twitterze",pt:"Compartilhar no Twitter",ro:"Partajează pe Twitter",ru:"Поделиться на Twitter",sk:"Zdieľať na Twitteri",sl:"Deli na Twitterju",sr:"Podeli na Twitter-u",sv:"Dela på Twitter",tr:"Twitter'da paylaş",zh:"在Twitter上分享"},shareUrl:a.format(t)+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"vk",faPrefix:"fab",faName:"fa-vk",title:{bg:"Сподели във VK",cs:"Sdílet na VKu",da:"Del på VK",de:"Bei VK teilen",en:"Share on VK",es:"Compartir en VK",fi:"Jaa VKissa",fr:"Partager sur VK",hr:"Podijelite na VKu",hu:"Megosztás VKon",it:"Condividi su VK",ja:"フェイスブック上で共有",ko:"페이스북에서 공유하기",nl:"Delen op VK",no:"Del på VK",pl:"Udostępnij na VKu",pt:"Compartilhar no VK",ro:"Partajează pe VK",ru:"Поделиться на ВКонтакте",sk:"Zdieľať na VKu",sl:"Deli na VKu",sr:"Podeli na VK-u",sv:"Dela på VK",tr:"VK'ta paylaş",zh:"在VK上分享"},shareUrl:"https://vk.com/share.php?url="+encodeURIComponent(e.getURL())+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"weibo",faPrefix:"fab",faName:"fa-weibo",title:{bg:"Сподели в weibo",cs:"Sdílet na weibo",da:"Del på weibo",de:"Bei weibo teilen",en:"Share on weibo",es:"Compartir en weibo",fi:"Jaa weiboissä",fr:"Partager sur weibo",hr:"Podijelite na weibo",hu:"Megosztás weiboen",it:"Condividi su weibo",ja:"Weibo上で共有",ko:"Weibo에서 공유하기",nl:"Delen op weibo",no:"Del på weibo",pl:"Udostępnij przez weibo",pt:"Compartilhar no weibo",ro:"Partajează pe weibo",ru:"Поделиться на weibo",sk:"Zdieľať na weibo",sl:"Deli na weibo",sr:"Podeli na weibo-u",sv:"Dela på weibo",tr:"Weibo'ta paylaş",zh:"分享至新浪微博"},shareUrl:"http://service.weibo.com/share/share.php?url="+encodeURIComponent(e.getURL())+"&amp;title="+e.getTitle()+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){var t=encodeURIComponent(e.getURL()),r=e.getTitle();return{popup:!1,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"whatsapp",faPrefix:"fab",faName:"fa-whatsapp",title:{bg:"Сподели в Whatsapp",cs:"Sdílet na Whatsappu",da:"Del på Whatsapp",de:"Bei Whatsapp teilen",en:"Share on Whatsapp",es:"Compartir en Whatsapp",fi:"Jaa WhatsAppissä",fr:"Partager sur Whatsapp",hr:"Podijelite na Whatsapp",hu:"Megosztás WhatsAppen",it:"Condividi su Whatsapp",ja:"Whatsapp上で共有",ko:"Whatsapp에서 공유하기",nl:"Delen op Whatsapp",no:"Del på Whatsapp",pl:"Udostępnij przez WhatsApp",pt:"Compartilhar no Whatsapp",ro:"Partajează pe Whatsapp",ru:"Поделиться на Whatsapp",sk:"Zdieľať na Whatsapp",sl:"Deli na Whatsapp",sr:"Podeli na WhatsApp-u",sv:"Dela på Whatsapp",tr:"Whatsapp'ta paylaş",zh:"在Whatsapp上分享"},shareUrl:"whatsapp://send?text="+encodeURIComponent(r)+"%20"+t+e.getReferrerTrack()}}},function(e,t,r){"use strict";e.exports=function(e){return{popup:!0,shareText:{bg:"cподеляне",cs:"sdílet",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"共有",ko:"공유하기",nl:"delen",no:"del",pl:"udostępnij",pt:"compartilhar",ro:"partajează",ru:"поделиться",sk:"zdieľať",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaş",zh:"分享"},name:"xing",faPrefix:"fab",faName:"fa-xing",title:{bg:"Сподели в XING",cs:"Sdílet na XINGu",da:"Del på XING",de:"Bei XING teilen",en:"Share on XING",es:"Compartir en XING",fi:"Jaa XINGissä",fr:"Partager sur XING",hr:"Podijelite na XING",hu:"Megosztás XINGen",it:"Condividi su XING",ja:"XING上で共有",ko:"XING에서 공유하기",nl:"Delen op XING",no:"Del på XING",pl:"Udostępnij przez XING",pt:"Compartilhar no XING",ro:"Partajează pe XING",ru:"Поделиться на XING",sk:"Zdieľať na XING",sl:"Deli na XING",sr:"Podeli na XING-u",sv:"Dela på XING",tr:"XING'ta paylaş",zh:"分享至XING"},shareUrl:"https://www.xing.com/spi/shares/new?url="+encodeURIComponent(e.getURL())+e.getReferrerTrack()}}}]);
$(document).ready(function(){
    /* Ajax Services */
    var resultContainer = $('[id^="project__list"]');
    function initializeAjaxLinks() {
        $('[id^="project__list"] .navigation-pagination__item__link').click(function(ev) {
            ev.preventDefault();
            var url = $(this).attr('href');
            ajaxLinkPagination.ajaxCall($(this), url);
        });
    }
    initializeAjaxLinks();

    /* Filterform Ajax Service */
    var form = $('#projectListAjaxForm');
    var ajaxForm = {
        ajaxCall: function ajaxCall(data) {
            $.ajax({
                url: form.attr('action'),
                type: form.attr('method'),
                cache: false,
                data: data.serialize(),
                success: function success(result) {
                    setTimeout(function(){
                        resultContainer.html(result).css('opacity', 1);
                        initializeAjaxLinks();
                        initModal();
                    },125);
                },
                error: function error(jqXHR, textStatus, errorThrow) {
                    resultContainer.html('Ajax request - ' + textStatus + ': ' + errorThrow).css('opacity', 1);
                    console.warn(jqXHR);
                }
            });
        }
    };
    var ajaxLink = {
        ajaxCall: function ajaxCall(data, url) {
            $.post({
                url: url,
                cache: false,
                data: data.serialize(),
                success: function success(result) {
                    setTimeout(function(){
                        resultContainer.html(result).css('opacity', 1);
                        initializeAjaxLinks();
                    },125);
                },
                error: function error(jqXHR, textStatus, errorThrow) {
                    resultContainer.html('Ajax request - ' + textStatus + ': ' + errorThrow).css('opacity', 1);
                }
            });
        }
    };
    form.submit(function(ev) {
        ev.preventDefault();
        resultContainer = $(this).siblings('[id^="project__list"]');

        resultContainer.css('opacity', 0);
        ajaxForm.ajaxCall($(this));
    });
    form.change(function(){
        form.find('button[type="reset"].t8_references__filter__item__label').removeClass('t8_references__filter__item__label--active');
        form.submit();
    });
    form.on('reset', function(){
        setTimeout(function() {
            form.submit();
        }, 1);
        form.find('.t8_references__filter__item__radio[checked="checked"]').removeAttr('checked');
        form.find('button[type="reset"].t8_references__filter__item__label').addClass('t8_references__filter__item__label--active');
    });



    $(".t8_references__filter__item").click(function() {
        $(".t8_references__filter").find('.t8_references__filter__item').each(function (i) {
            $(this).removeClass("t8_references__filter__item__checked");
        })
        $(this).addClass("t8_references__filter__item__checked");

    });


/*    $(".t8_references__modal__content__link").each(function() {
        let test = $(this).text();
        let updatedURL = test.replace("https://", "");
        let updatedURL2 = updatedURL.replace("http://", "");
        let updatedURL3 = updatedURL2.replace("/", "");
        console.log(updatedURL2);
        $(this).text(updatedURL2)
    });*/


    /* Ajax Service for Pagination Button */
    var ajaxLinkPagination = {
        ajaxCall: function ajaxCall(data, url) {
            $.post({
                url: url,
                cache: false,
                data: data.serialize(),
                success: function success(result) {
                  setTimeout(function(){
                      resultContainer.html(result).css('opacity', 1);
                      initializeAjaxLinks();
                      initModal();
                  },125);
                },
                error: function error(jqXHR, textStatus, errorThrow) {
                    resultContainer.html('Ajax request - ' + textStatus + ': ' + errorThrow).fadeIn('fast');
                }
            });
        }
    };




    /* Modals */
    // init micromodal
/*    MicroModal.init({
        awaitCloseAnimation: true,
        disableScroll: true
    });*/

    function initModal() {
        try {
            MicroModal.init({
                disableScroll: true,
                awaitCloseAnimation: true, // set to false, to remove close animation
                onShow: function(modal) {
                    addModalContentHeight('short', modal.id);
                    $('.header').addClass("header__background");
                    $('.slicknav_menu').addClass("header__background");
                    $('.totop-button').addClass("totop__background");
                    /**************************
                     For full screen scrolling modal,
                     uncomment line below &amp; comment line above
                     **************************/
                    //addModalContentHeight('tall');
                },
                onClose: function () {
                    $('.header').removeClass("header__background");
                    $('.slicknav_menu').removeClass("header__background");
                    $('.totop-button').removeClass("totop__background");
                }
            });
        } catch (e) {
            console.log("micromodal error: ", e);
        }
    }


    function addModalContentHeight(type, id) {
        var type = (arguments[0] != null) ? arguments[0] : 'short';

        let build_modalContainer = "#" + id + " .modal__container";

        let build_modalHeader = "#" + id + " .modal__header";
        let build_modalContentContent = "#" + id + " .modal-content-content";
        let build_modalContent = "#" + id + " .modal__content";
        let build_modalFooter = "#" + id + " .modal__footer";

        var modalContainer = $(build_modalContainer);
        var modalHeader = $(build_modalHeader);
        var modalContentContent = $(build_modalContentContent);
        var modalContent = $(build_modalContent);
        var modalFooter = $(build_modalFooter);

        var modalIsDefined =
            modalContainer.length &amp;&amp;
            modalHeader.length &amp;&amp;
            modalContent.length &amp;&amp;
            modalFooter.length;

        if (modalIsDefined) {
            var modalContainerHeight = modalContainer.outerHeight();
            var modalHeaderHeight = modalHeader.outerHeight();
            var modalFooterHeight = modalFooter.outerHeight();


            var offset = 80;

            var height = modalContainerHeight - (modalHeaderHeight + modalFooterHeight + offset);


            if(!isNaN(height)){
                height = height &gt; 0 ? height: 20;
                if(type == 'short'){
                    modalContent.css({'height': height + 'px'});
                }
                else{
                    modalContainer.css({'height': '100%', 'overflow-y': 'hidden', 'margin-top': '40px'});
                    modalContentContent.css({'height': '100%', 'overflow-y': 'auto'});
                    modalContent.css({'overflow-y': 'visible'});
                    modalFooter.css({'margin-bottom': '120px'});
                }
                setTimeout(function(){
                    modalContent.css({'display': 'block'});
                    var modalContentDOM = document.querySelector('#modal-content');
                    modalContentDOM.scrollTop = 0;
                });
            }
        }
    }


    //init
    initModal();

});


/* Photoswipe */
$(document).ready(function(){
    var initPhotoSwipeFromDOM = function(gallerySelector) {
        // parse slide data (url, title, size ...) from DOM elements
        // (children of gallerySelector)
        var parseThumbnailElements = function(el) {
            var thumbElements = el.childNodes,
                numNodes = thumbElements.length,
                items = [],
                figureEl,
                linkEl,
                size,
                item;

            for(var i = 0; i &lt; numNodes; i++) {

                figureEl = thumbElements[i]; // &lt;figure&gt; element

                // include only element nodes
                if(figureEl.nodeType !== 1) {
                    continue;
                }

                linkEl = figureEl.children[0]; // &lt;a&gt; element

                size = linkEl.getAttribute('data-size').split('x');

                // create slide object
                if ($(linkEl).data('type') == 'video') {
                    item = {
                        //html: $(linkEl).data('video')
                        html: $(linkEl).find('.video__video__wrap').clone()[0]
                    };
                } else {
                    item = {
                        src: linkEl.getAttribute('href'),
                        w: parseInt(size[0], 10),
                        h: parseInt(size[1], 10)
                    };
                }

                if(figureEl.children.length &gt; 1) {
                    // &lt;figcaption&gt; content
                    item.title = figureEl.children[1].innerHTML;
                }

                if(linkEl.children.length &gt; 0) {
                    // &lt;img&gt; thumbnail element, retrieving thumbnail url
                    item.msrc = linkEl.children[0].getAttribute('src');
                }

                item.el = figureEl; // save link to element for getThumbBoundsFn
                items.push(item);
            }

            return items;
        };

        // find nearest parent element
        var closest = function closest(el, fn) {
            return el &amp;&amp; ( fn(el) ? el : closest(el.parentNode, fn) );
        };

        // triggers when user clicks on thumbnail
        var onThumbnailsClick = function(e) {
            e = e || window.event;
            e.preventDefault ? e.preventDefault() : e.returnValue = false;

            var eTarget = e.target || e.srcElement;

            // find root element of slide
            var clickedListItem = closest(eTarget, function(el) {
                //return (el.tagName &amp;&amp; el.tagName.toUpperCase() === 'FIGURE' &amp;&amp; !el.classList.contains('gallery__figure--video'));
                return el.tagName &amp;&amp; el.tagName.toUpperCase() === 'FIGURE';
            });
            if(!clickedListItem) {
                return;
            }

            // find index of clicked item by looping through all child nodes
            // alternatively, you may define index via data- attribute
            var clickedGallery = clickedListItem.parentNode,
                childNodes = clickedListItem.parentNode.childNodes,
                numChildNodes = childNodes.length,
                nodeIndex = 0,
                index;

            for (var i = 0; i &lt; numChildNodes; i++) {
                if(childNodes[i].nodeType !== 1) {
                    continue;
                }

                if(childNodes[i] === clickedListItem) {
                    index = nodeIndex;
                    break;
                }
                nodeIndex++;
            }

            if(index &gt;= 0) {
                // open PhotoSwipe if valid index found
                openPhotoSwipe( index, clickedGallery );
            }
            return false;
        };

        // parse picture index and gallery index from URL (#&amp;pid=1&amp;gid=2)
        var photoswipeParseHash = function() {
            var hash = window.location.hash.substring(1),
            params = {};

            if(hash.length &lt; 5) {
                return params;
            }

            var vars = hash.split('&amp;');
            for (var i = 0; i &lt; vars.length; i++) {
                if(!vars[i]) {
                    continue;
                }
                var pair = vars[i].split('=');
                if(pair.length &lt; 2) {
                    continue;
                }
                params[pair[0]] = pair[1];
            }

            if(params.gid) {
                params.gid = parseInt(params.gid, 10);
            }

            return params;
        };

        var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL) {
            var pswpElement = document.querySelectorAll('.pswp')[0],
                gallery,
                options,
                items;

            items = parseThumbnailElements(galleryElement);

            // define options (if needed)
            options = {

                // define gallery index (for URL)
                galleryUID: galleryElement.getAttribute('data-pswp-uid'),

                getThumbBoundsFn: function(index) {
                    // See Options -&gt; getThumbBoundsFn section of documentation for more info
                    var thumbnail = items[index].el.getElementsByTagName('img')[0]; // find thumbnail
                    if (!thumbnail) {
                        var thumbnail = items[index].el.getElementsByTagName('a')[0]; // find link
                    }

                    var pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
                        rect = thumbnail.getBoundingClientRect();
                    return {x:rect.left, y:rect.top + pageYScroll, w:rect.width};
                },

                history: false,
                closeEl:true,
                captionEl: true,
                fullscreenEl: false,
                zoomEl: false,
                shareEl: false,
                counterEl: true,
                arrowEl: true,
                preloaderEl: true,
                isClickableElement: function(el) {
                    return (el.tagName === 'A' || el.classList.contains('plyr__controls') || el.classList.contains('plyr__control'));
                }


            };

            // PhotoSwipe opened from URL
            if(fromURL) {
                if(options.galleryPIDs) {
                    // parse real index when custom PIDs are used
                    // http://photoswipe.com/documentation/faq.html#custom-pid-in-url
                    for(var j = 0; j &lt; items.length; j++) {
                        if(items[j].pid == index) {
                            options.index = j;
                            break;
                        }
                    }
                } else {
                    // in URL indexes start from 1
                    options.index = parseInt(index, 10) - 1;
                }
            } else {
                options.index = parseInt(index, 10);
            }

            // exit if index not found
            if( isNaN(options.index) ) {
                return;
            }

            if(disableAnimation) {
                options.showAnimationDuration = 0;
            }

            // Pass data to PhotoSwipe and initialize it
            gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
            gallery.init();

            gallery.listen('initialZoomIn', function() {
                plyrConfig();
            });

            gallery.listen('beforeChange', function() {
                plyrConfig();
                var currItem = $(gallery.currItem.container);
                $('.pswp__video').removeClass('active');
                var currItemIframe = currItem.find('.pswp__video').addClass('active');
                $('.pswp__video').each(function() {
                    if (!$(this).hasClass('active')) {
                        $(this).attr('src', $(this).attr('src'));
                    }
                });
            });

            gallery.listen('close', function() {
                $('.pswp__video').each(function() {
                  $(this).attr('src', $(this).attr('src'));
                });
                $('.pswp__item .plyr').remove();
            });
        };

        // loop through all gallery elements and bind events
        var galleryElements = document.querySelectorAll( gallerySelector );

        for(var i = 0, l = galleryElements.length; i &lt; l; i++) {
            galleryElements[i].setAttribute('data-pswp-uid', i+1);
            galleryElements[i].onclick = onThumbnailsClick;
        }

        // Parse URL and open gallery if it contains #&amp;pid=3&amp;gid=1
        var hashData = photoswipeParseHash();
        if(hashData.pid &amp;&amp; hashData.gid) {
            openPhotoSwipe( hashData.pid ,  galleryElements[ hashData.gid - 1 ], true, true );
        }
    };

    // execute above function
    if ($('.t8_references__show .gallery').length &gt; 0 &amp;&amp; $('.pswp').length &gt; 0) {
        // lightbox video &amp; cookie consent
        /*if ($("#cc-notification").length == 0) {
            $('[data-video].gallery__link--video').each(function(){
                var video = $(this).attr('data-video');
                video = video.replace('&lt;script type="text/plain" class="cc-onconsent-social"&gt; jQuery("#id_inutile").html("', '');
                video = video.replace('")&lt;/script&gt;', '');
                $(this).attr('data-video', video);
            });
        }*/
        initPhotoSwipeFromDOM('.t8_references__show .gallery');
    }


    function plyrConfig() {
        $('.pswp__item .video__video--plyrwait').each(function() {
            var src = $(this).find('iframe').attr('src');
            if (src.includes('youtube.com') || src.includes('youtube-nocookie.com') || src.includes('youtu.be')) {
                src += '&amp;playsinline=1';
                $(this).find('iframe').attr('src',src);
            }
        });
        const players = Plyr.setup(document.querySelectorAll('.pswp__item .video__video--plyrwait'), {
            // https://github.com/sampotts/plyr#options
            // controls: [],
            //hideControls: true,
        });
    }

});

/**
 * Get / Set Cookies
 *
 * inspired by: https://www.w3schools.com/js/js_cookies.asp
 */
function getC(cname) {
  let name = cname + "=";
  let decodedC = decodeURIComponent(document.cookie);
  let ca = decodedC.split(';');
  for(let i = 0; i &lt;ca.length; i++) {
      let c = ca[i];
      while (c.charAt(0) == ' ') {
          c = c.substring(1);
      }
      if (c.indexOf(name) == 0) {
          return c.substring(name.length, c.length);
      }
  }
  return "";
}

function setC(cname, cvalue, exdays) {
  const d = new Date();
  d.setTime(d.getTime() + (exdays*24*60*60*1000));
  let expires = "expires="+ d.toUTCString();
  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}


/**
 * Save Settings
 */
function saveCSettings() {
  let saveSettingsBtn = document.getElementById('csettings-savebtn');
  let analytics = document.getElementById('csettings-analytics');
  let external = document.getElementById('csettings-external');
  let exdays = saveSettingsBtn.dataset.expire;

  setC("cs-analytics", analytics.checked, exdays);
  setC("cs-external", external.checked, exdays);
  setC("cs-hidebanner", true, exdays);
  closeModal(saveSettingsBtn.closest('.cwindow').getAttribute('id'));

  // remove overlays if external accepted
  removeMediaPreviewOverlay();

  if (document.querySelectorAll('.cbanner').length &gt; 0) {
    let banner = document.querySelectorAll('.cbanner');
    for (let i = 0; i &lt; banner.length; i++) {
      banner[i].classList.add('cbanner--fadeout');
      setTimeout(function(){
        banner[i].remove();
        removeCBannerFooterMargin();
      }, 500);
    }
  }
}

/* Allow all options =&gt; enable all options &amp; save */
function allowAllSettings() {
  let analytics = document.getElementById('csettings-analytics');
  let external = document.getElementById('csettings-external');

  analytics.checked = true;
  external.checked = true;
  saveCSettings();
}

/* Allow essential only =&gt; disable the other options &amp; save */
function allowEssential() {
  let analytics = document.getElementById('csettings-analytics');
  let external = document.getElementById('csettings-external');

  analytics.checked = false;
  external.checked = false;
  saveCSettings();
}


/**
 * Initialize the Settings Functionality
 */
let initCBannerSettings = function initCBannerSettings() {
  let saveSettingsBtn = document.getElementById('csettings-savebtn');
  if (saveSettingsBtn) {
    saveSettingsBtn.addEventListener("click", saveCSettings);
  }
  let allowAllBtns = document.querySelectorAll('[data-trigger="csettings-allowall"]');
  for (let i = 0; i &lt; allowAllBtns.length; i++) {
    allowAllBtns[i].addEventListener("click", allowAllSettings);
  }
  let allowEssentialBtns = document.querySelectorAll('[data-trigger="csettings-allowessential"]');
  for (let i = 0; i &lt; allowEssentialBtns.length; i++) {
    allowEssentialBtns[i].addEventListener("click", allowEssential);
  }
}



/**
 * Load Banner via Ajax
 */
function loadViaAjax(url, resultContainer, callback) {
  var xmlhttp = new XMLHttpRequest();

  xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState == XMLHttpRequest.DONE) {
         if (xmlhttp.status == 200) {
            resultContainer.innerHTML = xmlhttp.responseText;
            callback();
         } else {
            console.error("Error loading the cookie banner.");
         }
      }
  };

  xmlhttp.open("GET", url, true);
  xmlhttp.send();
}


/**
 * Modal Window + Settings
 */
function openModal(modalId) {
  let el = document.getElementById(modalId);
  if (el) {
    el.classList.add('cwindow--open');
    el.setAttribute('aria-hidden', 'false');
    document.body.style.setProperty('overflow', 'hidden');
  }
}

function closeModal(modalId) {
  let el = document.getElementById(modalId);
  if (el) {
    el.classList.remove('cwindow--open');
    el.setAttribute('aria-hidden', 'true');
    document.body.style.removeProperty('overflow');
  }
}

let initCBannerModals = function initCBannerModals() {
  let triggers = document.querySelectorAll('[data-cwindow-trigger]');
  for (let i = 0; i &lt; triggers.length; i++) {
    triggers[i].addEventListener("click", function(event) { event.preventDefault(); openModal(triggers[i].dataset.cwindowTrigger); });
  }
  if (document.querySelectorAll('.cwindow--open').length &gt; 0) {
    document.body.style.overflow = 'hidden';
  }
}


/**
 * Settings Accordions
 */
function toggleAccordion(accordion) {
  let accHead = accordion.querySelector('.csettings__item__head'),
      accContent = accordion.querySelector('.csettings__item__content');
  accContent.classList.add('csettings__item__content--inprogress');
  var closable_height = accContent.querySelector('.csettings__item__content__inner').clientHeight;
  accContent.style.setProperty('height', closable_height + 'px');
  accHead.classList.toggle('csettings__item__head--open');
  accContent.classList.toggle('csettings__item__content--closed');

  setTimeout(function () {
    accContent.classList.remove('csettings__item__content--inprogress');
  }, 350);
}

let initCBannerAccordions = function initCBannerAccordions() {
  let accordions = document.querySelectorAll('.csettings__item');
  for (let i = 0; i &lt; accordions.length; i++) {
    accordions[i].querySelector('.csettings__item__head').addEventListener("click", function() { toggleAccordion(accordions[i]) });
  }
}


/**
 * External Content Preview/Replacements
 */
let cBannerMediaPreviewOverlay = function cBannerMediaPreviewOverlay() {
  if (getC('cs-external') !== 'true') {
    // if external content is not allowed
    let replacedContent = document.querySelectorAll('.creplacement__external:not(.creplacement__external--noinfo)');
    let replaceText = document.getElementById('creplace-text');
    for (let i = 0; i &lt; replacedContent.length; i++) {
      let image = replacedContent[i].parentElement.dataset.preview;
      if (image != '') {
        replacedContent[i].style.backgroundImage = `url('${image}')`;
      }
      replacedContent[i].innerHTML = replaceText.innerHTML;
    }
  }
}

/**
 * Remove Media Overlays
 *
 * if the page was cached the typoscript condition request.getCookieParams() would not
 * always return the correct result
 * so the replacement might still be done even if external content was accepted
 * that's why we check it again here and replace the content if external group is allowed
 */
let removeMediaPreviewOverlay = function removeMediaPreviewOverlay() {
  if (getC('cs-external') === 'true') {
    const replacedContent = document.querySelectorAll('.creplacement__external');
    for (let i = 0; i &lt; replacedContent.length; i++) {
      // add all elements from the data attribute to the parent
      const parentEl = replacedContent[i].parentElement,
            tempEl = document.createElement('div');
      tempEl.innerHTML = replacedContent[i].dataset.content;
      for (let j = 0; j &lt; tempEl.childNodes.length; j++) {
        parentEl.insertBefore(tempEl.childNodes[j], replacedContent[i]);
      }
      // remove the replacement placeholder
      replacedContent[i].remove();

      // check if a script was added
      // if yes =&gt; needs to be created as own element if the script shall be executed
      if (parentEl.querySelectorAll('script').length &gt; 0) {
        const scripts = parentEl.querySelectorAll('script');
        for (let j = 0; j &lt; scripts.length; j++) {
          let script = document.createElement('script'),
              attrs = scripts[j].getAttributeNames(),
              siblingAfter = scripts[j].nextElementSibling;
          for (let k = 0; k &lt; attrs.length; k++) {
            script.setAttribute(attrs[k], scripts[j].getAttribute(attrs[k]));
          }
          script.async = true;
          scripts[j].remove();
          if (siblingAfter != undefined) {
            parentEl.insertBefore(script, siblingAfter);
          } else {
            parentEl.appendChild(script);
          }
        }
      }
    }
    handleRemoveReplacementCallback();
  }
}

/**
 * Handle Initialization of Replaced Content
 * -&gt; this function can be overridden in your own js to init other stuff.
 */
let handleRemoveReplacementCallback = function handleRemoveReplacementCallback() {
  // init videos
  if (typeof initVideos === "function") {
    initVideos();
  }
}


/** Footer Margin **/
// add footer/totop margin to be able to see them even if the banner is visible
let addCBannerFooterMargin = function addCBannerFooterMargin() {
  let bannerBottom = document.querySelector('.cbanner'),
      footer = document.querySelector('.footer'),
      topBtn = document.querySelector('.totop-button');
  if (bannerBottom) {
    let bannerHeight = bannerBottom.clientHeight;
    if (footer) {
      footer.style.setProperty('padding-bottom', bannerHeight + 'px')
    }
    if (footer) {
      topBtn.style.setProperty('margin-bottom', bannerHeight + 'px')
    }
  }
}

// remove footer/totop margin if banner is removed
let removeCBannerFooterMargin = function removeCBannerFooterMargin() {
  let footer = document.querySelector('.footer'),
      topBtn = document.querySelector('.totop-button');
  if (footer) {
    footer.style.removeProperty('padding-bottom')
  }
  if (footer) {
    topBtn.style.removeProperty('margin-bottom')
  }
}

/**
 * Initialize all Elements
 */
let initAllCBannerElements = function initAllCBannerElements() {
  // run the scripts added via ajax call
  if (getC('cs-analytics') === 'true') {
    if (document.querySelectorAll('[data-init="ga"]').length &gt; 0) {
      initGa();
    }
    if (document.querySelectorAll('[data-init="mtm"]').length &gt; 0) {
      initMtm();
    }
    if (document.querySelectorAll('[data-init="additional"]').length &gt; 0) {
      initAdditionalScripts();
    }
  } else {
    if (document.querySelectorAll('[data-init="dga"]').length &gt; 0) {
      gaDisable();
    }
  }

  // init the cookie banner elements
  cBannerMediaPreviewOverlay();
  removeMediaPreviewOverlay();
  addCBannerFooterMargin();

  initCBannerSettings();
  initCBannerModals();
  initCBannerAccordions();
}
window.addEventListener("DOMContentLoaded", function(event) {
  // load the banner elements via ajax
  let urlEl = document.getElementById('cbanner-loader'),
      resultContainer = document.getElementById('c-container');
  if (urlEl &amp;&amp; resultContainer &amp;&amp; urlEl.dataset.loadUrl) {
    loadViaAjax(urlEl.dataset.loadUrl, resultContainer, initAllCBannerElements);
  } else {
    console.error("Cookie banner coould not be loaded. Either the load url or the result container is missing");
  }
});

/*!
 * SlickNav Responsive Mobile Menu v1.0.10
 * (c) 2016 Josh Cope
 * licensed under MIT
 */
!function(e,t,n){function a(t,n){this.element=t,this.settings=e.extend({},i,n),this.settings.duplicate||n.hasOwnProperty("removeIds")||(this.settings.removeIds=!1),this._defaults=i,this._name=s,this.init()}var i={label:"MENU",duplicate:!0,duration:200,easingOpen:"swing",easingClose:"swing",closedSymbol:"&amp;#9658;",openedSymbol:"&amp;#9660;",prependTo:"body",appendTo:"",parentTag:"a",closeOnClick:!1,allowParentLinks:!1,nestedParentLinks:!0,showChildren:!1,removeIds:!0,removeClasses:!1,removeStyles:!1,brand:"",animations:"jquery",init:function(){},beforeOpen:function(){},beforeClose:function(){},afterOpen:function(){},afterClose:function(){}},s="slicknav",o="slicknav";Keyboard={DOWN:40,ENTER:13,ESCAPE:27,LEFT:37,RIGHT:39,SPACE:32,TAB:9,UP:38},a.prototype.init=function(){var n,a,i=this,s=e(this.element),r=this.settings;if(r.duplicate?i.mobileNav=s.clone():i.mobileNav=s,r.removeIds&amp;&amp;(i.mobileNav.removeAttr("id"),i.mobileNav.find("*").each(function(t,n){e(n).removeAttr("id")})),r.removeClasses&amp;&amp;(i.mobileNav.removeAttr("class"),i.mobileNav.find("*").each(function(t,n){e(n).removeAttr("class")})),r.removeStyles&amp;&amp;(i.mobileNav.removeAttr("style"),i.mobileNav.find("*").each(function(t,n){e(n).removeAttr("style")})),n=o+"_icon",""===r.label&amp;&amp;(n+=" "+o+"_no-text"),"a"==r.parentTag&amp;&amp;(r.parentTag='a href="#"'),i.mobileNav.attr("class",o+"_nav"),a=e('&lt;div class="'+o+'_menu"&gt;&lt;/div&gt;'),""!==r.brand){var l=e('&lt;div class="'+o+'_brand"&gt;'+r.brand+"&lt;/div&gt;");e(a).append(l)}i.btn=e(["&lt;"+r.parentTag+' aria-haspopup="true" role="button" tabindex="0" class="'+o+"_btn "+o+'_collapsed"&gt;','&lt;span class="'+o+'_menutxt"&gt;'+r.label+"&lt;/span&gt;",'&lt;span class="'+n+'"&gt;','&lt;span class="'+o+'_icon-bar"&gt;&lt;/span&gt;','&lt;span class="'+o+'_icon-bar"&gt;&lt;/span&gt;','&lt;span class="'+o+'_icon-bar"&gt;&lt;/span&gt;',"&lt;/span&gt;","&lt;/"+r.parentTag+"&gt;"].join("")),e(a).append(i.btn),""!==r.appendTo?e(r.appendTo).append(a):e(r.prependTo).prepend(a),a.append(i.mobileNav);var c=i.mobileNav.find("li");e(c).each(function(){var t=e(this),n={};if(n.children=t.children("ul").attr("role","menu"),t.data("menu",n),n.children.length&gt;0){var a=t.contents(),s=!1,l=[];e(a).each(function(){return e(this).is("ul")?!1:(l.push(this),void(e(this).is("a")&amp;&amp;(s=!0)))});var c=e("&lt;"+r.parentTag+' role="menuitem" aria-haspopup="true" tabindex="-1" class="'+o+'_item"/&gt;');if(r.allowParentLinks&amp;&amp;!r.nestedParentLinks&amp;&amp;s)e(l).wrapAll('&lt;span class="'+o+"_parent-link "+o+'_row"/&gt;').parent();else{var d=e(l).wrapAll(c).parent();d.addClass(o+"_row")}r.showChildren?t.addClass(o+"_open"):t.addClass(o+"_collapsed"),t.addClass(o+"_parent");var p=e('&lt;span class="'+o+'_arrow"&gt;'+(r.showChildren?r.openedSymbol:r.closedSymbol)+"&lt;/span&gt;");r.allowParentLinks&amp;&amp;!r.nestedParentLinks&amp;&amp;s&amp;&amp;(p=p.wrap(c).parent()),e(l).last().after(p)}else 0===t.children().length&amp;&amp;t.addClass(o+"_txtnode");t.children("a").attr("role","menuitem").click(function(t){r.closeOnClick&amp;&amp;!e(t.target).parent().closest("li").hasClass(o+"_parent")&amp;&amp;e(i.btn).click()}),r.closeOnClick&amp;&amp;r.allowParentLinks&amp;&amp;(t.children("a").children("a").click(function(t){e(i.btn).click()}),t.find("."+o+"_parent-link a:not(."+o+"_item)").click(function(t){e(i.btn).click()}))}),e(c).each(function(){var t=e(this).data("menu");r.showChildren||i._visibilityToggle(t.children,null,!1,null,!0)}),i._visibilityToggle(i.mobileNav,null,!1,"init",!0),i.mobileNav.attr("role","menu"),e(t).mousedown(function(){i._outlines(!1)}),e(t).keyup(function(){i._outlines(!0)}),e(i.btn).click(function(e){e.preventDefault(),i._menuToggle()}),i.mobileNav.on("click","."+o+"_item",function(t){t.preventDefault(),i._itemClick(e(this))}),e(i.btn).keydown(function(t){var n=t||event;switch(n.keyCode){case Keyboard.ENTER:case Keyboard.SPACE:case Keyboard.DOWN:t.preventDefault(),n.keyCode===Keyboard.DOWN&amp;&amp;e(i.btn).hasClass(o+"_open")||i._menuToggle(),e(i.btn).next().find('[role="menuitem"]').first().focus()}}),i.mobileNav.on("keydown","."+o+"_item",function(t){var n=t||event;switch(n.keyCode){case Keyboard.ENTER:t.preventDefault(),i._itemClick(e(t.target));break;case Keyboard.RIGHT:t.preventDefault(),e(t.target).parent().hasClass(o+"_collapsed")&amp;&amp;i._itemClick(e(t.target)),e(t.target).next().find('[role="menuitem"]').first().focus()}}),i.mobileNav.on("keydown",'[role="menuitem"]',function(t){var n=t||event;switch(n.keyCode){case Keyboard.DOWN:t.preventDefault();var a=e(t.target).parent().parent().children().children('[role="menuitem"]:visible'),s=a.index(t.target),r=s+1;a.length&lt;=r&amp;&amp;(r=0);var l=a.eq(r);l.focus();break;case Keyboard.UP:t.preventDefault();var a=e(t.target).parent().parent().children().children('[role="menuitem"]:visible'),s=a.index(t.target),l=a.eq(s-1);l.focus();break;case Keyboard.LEFT:if(t.preventDefault(),e(t.target).parent().parent().parent().hasClass(o+"_open")){var c=e(t.target).parent().parent().prev();c.focus(),i._itemClick(c)}else e(t.target).parent().parent().hasClass(o+"_nav")&amp;&amp;(i._menuToggle(),e(i.btn).focus());break;case Keyboard.ESCAPE:t.preventDefault(),i._menuToggle(),e(i.btn).focus()}}),r.allowParentLinks&amp;&amp;r.nestedParentLinks&amp;&amp;e("."+o+"_item a").click(function(e){e.stopImmediatePropagation()})},a.prototype._menuToggle=function(e){var t=this,n=t.btn,a=t.mobileNav;n.hasClass(o+"_collapsed")?(n.removeClass(o+"_collapsed"),n.addClass(o+"_open")):(n.removeClass(o+"_open"),n.addClass(o+"_collapsed")),n.addClass(o+"_animating"),t._visibilityToggle(a,n.parent(),!0,n)},a.prototype._itemClick=function(e){var t=this,n=t.settings,a=e.data("menu");a||(a={},a.arrow=e.children("."+o+"_arrow"),a.ul=e.next("ul"),a.parent=e.parent(),a.parent.hasClass(o+"_parent-link")&amp;&amp;(a.parent=e.parent().parent(),a.ul=e.parent().next("ul")),e.data("menu",a)),a.parent.hasClass(o+"_collapsed")?(a.arrow.html(n.openedSymbol),a.parent.removeClass(o+"_collapsed"),a.parent.addClass(o+"_open"),a.parent.addClass(o+"_animating"),t._visibilityToggle(a.ul,a.parent,!0,e)):(a.arrow.html(n.closedSymbol),a.parent.addClass(o+"_collapsed"),a.parent.removeClass(o+"_open"),a.parent.addClass(o+"_animating"),t._visibilityToggle(a.ul,a.parent,!0,e))},a.prototype._visibilityToggle=function(t,n,a,i,s){function r(t,n){e(t).removeClass(o+"_animating"),e(n).removeClass(o+"_animating"),s||d.afterOpen(t)}function l(n,a){t.attr("aria-hidden","true"),p.attr("tabindex","-1"),c._setVisAttr(t,!0),t.hide(),e(n).removeClass(o+"_animating"),e(a).removeClass(o+"_animating"),s?"init"==n&amp;&amp;d.init():d.afterClose(n)}var c=this,d=c.settings,p=c._getActionItems(t),u=0;a&amp;&amp;(u=d.duration),t.hasClass(o+"_hidden")?(t.removeClass(o+"_hidden"),s||d.beforeOpen(i),"jquery"===d.animations?t.stop(!0,!0).slideDown(u,d.easingOpen,function(){r(i,n)}):"velocity"===d.animations&amp;&amp;t.velocity("finish").velocity("slideDown",{duration:u,easing:d.easingOpen,complete:function(){r(i,n)}}),t.attr("aria-hidden","false"),p.attr("tabindex","0"),c._setVisAttr(t,!1)):(t.addClass(o+"_hidden"),s||d.beforeClose(i),"jquery"===d.animations?t.stop(!0,!0).slideUp(u,this.settings.easingClose,function(){l(i,n)}):"velocity"===d.animations&amp;&amp;t.velocity("finish").velocity("slideUp",{duration:u,easing:d.easingClose,complete:function(){l(i,n)}}))},a.prototype._setVisAttr=function(t,n){var a=this,i=t.children("li").children("ul").not("."+o+"_hidden");n?i.each(function(){var t=e(this);t.attr("aria-hidden","true");var i=a._getActionItems(t);i.attr("tabindex","-1"),a._setVisAttr(t,n)}):i.each(function(){var t=e(this);t.attr("aria-hidden","false");var i=a._getActionItems(t);i.attr("tabindex","0"),a._setVisAttr(t,n)})},a.prototype._getActionItems=function(e){var t=e.data("menu");if(!t){t={};var n=e.children("li"),a=n.find("a");t.links=a.add(n.find("."+o+"_item")),e.data("menu",t)}return t.links},a.prototype._outlines=function(t){t?e("."+o+"_item, ."+o+"_btn").css("outline",""):e("."+o+"_item, ."+o+"_btn").css("outline","none")},a.prototype.toggle=function(){var e=this;e._menuToggle()},a.prototype.open=function(){var e=this;e.btn.hasClass(o+"_collapsed")&amp;&amp;e._menuToggle()},a.prototype.close=function(){var e=this;e.btn.hasClass(o+"_open")&amp;&amp;e._menuToggle()},e.fn[s]=function(t){var n=arguments;if(void 0===t||"object"==typeof t)return this.each(function(){e.data(this,"plugin_"+s)||e.data(this,"plugin_"+s,new a(this,t))});if("string"==typeof t&amp;&amp;"_"!==t[0]&amp;&amp;"init"!==t){var i;return this.each(function(){var o=e.data(this,"plugin_"+s);o instanceof a&amp;&amp;"function"==typeof o[t]&amp;&amp;(i=o[t].apply(o,Array.prototype.slice.call(n,1)))}),void 0!==i?i:this}}}(jQuery,document,window);
/*!
 * Lightbox v2.10.0
 * by Lokesh Dhakar
 *
 * More info:
 * http://lokeshdhakar.com/projects/lightbox2/
 *
 * Copyright 2007, 2018 Lokesh Dhakar
 * Released under the MIT license
 * https://github.com/lokesh/lightbox2/blob/master/LICENSE
 *
 * @preserve
 */
!function(a,b){"function"==typeof define&amp;&amp;define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):a.lightbox=b(a.jQuery)}(this,function(a){function b(b){this.album=[],this.currentImageIndex=void 0,this.init(),this.options=a.extend({},this.constructor.defaults),this.option(b)}return b.defaults={albumLabel:"Image %1 of %2",alwaysShowNavOnTouchDevices:!1,fadeDuration:600,fitImagesInViewport:!0,imageFadeDuration:600,positionFromTop:50,resizeDuration:700,showImageNumberLabel:!0,wrapAround:!1,disableScrolling:!1,sanitizeTitle:!1},b.prototype.option=function(b){a.extend(this.options,b)},b.prototype.imageCountLabel=function(a,b){return this.options.albumLabel.replace(/%1/g,a).replace(/%2/g,b)},b.prototype.init=function(){var b=this;a(document).ready(function(){b.enable(),b.build()})},b.prototype.enable=function(){var b=this;a("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(c){return b.start(a(c.currentTarget)),!1})},b.prototype.build=function(){if(!(a("#lightbox").length&gt;0)){var b=this;a('&lt;div id="lightboxOverlay" class="lightboxOverlay"&gt;&lt;/div&gt;&lt;div id="lightbox" class="lightbox"&gt;&lt;div class="lb-outerContainer"&gt;&lt;div class="lb-container"&gt;&lt;img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /&gt;&lt;div class="lb-nav"&gt;&lt;a class="lb-prev" href="" &gt;&lt;/a&gt;&lt;a class="lb-next" href="" &gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="lb-loader"&gt;&lt;a class="lb-cancel"&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="lb-dataContainer"&gt;&lt;div class="lb-data"&gt;&lt;div class="lb-details"&gt;&lt;span class="lb-caption"&gt;&lt;/span&gt;&lt;span class="lb-number"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="lb-closeContainer"&gt;&lt;a class="lb-close"&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;').appendTo(a("body")),this.$lightbox=a("#lightbox"),this.$overlay=a("#lightboxOverlay"),this.$outerContainer=this.$lightbox.find(".lb-outerContainer"),this.$container=this.$lightbox.find(".lb-container"),this.$image=this.$lightbox.find(".lb-image"),this.$nav=this.$lightbox.find(".lb-nav"),this.containerPadding={top:parseInt(this.$container.css("padding-top"),10),right:parseInt(this.$container.css("padding-right"),10),bottom:parseInt(this.$container.css("padding-bottom"),10),left:parseInt(this.$container.css("padding-left"),10)},this.imageBorderWidth={top:parseInt(this.$image.css("border-top-width"),10),right:parseInt(this.$image.css("border-right-width"),10),bottom:parseInt(this.$image.css("border-bottom-width"),10),left:parseInt(this.$image.css("border-left-width"),10)},this.$overlay.hide().on("click",function(){return b.end(),!1}),this.$lightbox.hide().on("click",function(c){return"lightbox"===a(c.target).attr("id")&amp;&amp;b.end(),!1}),this.$outerContainer.on("click",function(c){return"lightbox"===a(c.target).attr("id")&amp;&amp;b.end(),!1}),this.$lightbox.find(".lb-prev").on("click",function(){return 0===b.currentImageIndex?b.changeImage(b.album.length-1):b.changeImage(b.currentImageIndex-1),!1}),this.$lightbox.find(".lb-next").on("click",function(){return b.currentImageIndex===b.album.length-1?b.changeImage(0):b.changeImage(b.currentImageIndex+1),!1}),this.$nav.on("mousedown",function(a){3===a.which&amp;&amp;(b.$nav.css("pointer-events","none"),b.$lightbox.one("contextmenu",function(){setTimeout(function(){this.$nav.css("pointer-events","auto")}.bind(b),0)}))}),this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){return b.end(),!1})}},b.prototype.start=function(b){function c(a){d.album.push({alt:a.attr("data-alt"),link:a.attr("href"),title:a.attr("data-title")||a.attr("title")})}var d=this,e=a(window);e.on("resize",a.proxy(this.sizeOverlay,this)),a("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var f,g=0,h=b.attr("data-lightbox");if(h){f=a(b.prop("tagName")+'[data-lightbox="'+h+'"]');for(var i=0;i&lt;f.length;i=++i)c(a(f[i])),f[i]===b[0]&amp;&amp;(g=i)}else if("lightbox"===b.attr("rel"))c(b);else{f=a(b.prop("tagName")+'[rel="'+b.attr("rel")+'"]');for(var j=0;j&lt;f.length;j=++j)c(a(f[j])),f[j]===b[0]&amp;&amp;(g=j)}var k=e.scrollTop()+this.options.positionFromTop,l=e.scrollLeft();this.$lightbox.css({top:k+"px",left:l+"px"}).fadeIn(this.options.fadeDuration),this.options.disableScrolling&amp;&amp;a("html").addClass("lb-disable-scrolling"),this.changeImage(g)},b.prototype.changeImage=function(b){var c=this;this.disableKeyboardNav();var d=this.$lightbox.find(".lb-image");this.$overlay.fadeIn(this.options.fadeDuration),a(".lb-loader").fadeIn("slow"),this.$lightbox.find(".lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption").hide(),this.$outerContainer.addClass("animating");var e=new Image;e.onload=function(){var f,g,h,i,j,k;d.attr({alt:c.album[b].alt,src:c.album[b].link}),a(e),d.width(e.width),d.height(e.height),c.options.fitImagesInViewport&amp;&amp;(k=a(window).width(),j=a(window).height(),i=k-c.containerPadding.left-c.containerPadding.right-c.imageBorderWidth.left-c.imageBorderWidth.right-20,h=j-c.containerPadding.top-c.containerPadding.bottom-c.imageBorderWidth.top-c.imageBorderWidth.bottom-120,c.options.maxWidth&amp;&amp;c.options.maxWidth&lt;i&amp;&amp;(i=c.options.maxWidth),c.options.maxHeight&amp;&amp;c.options.maxHeight&lt;i&amp;&amp;(h=c.options.maxHeight),(e.width&gt;i||e.height&gt;h)&amp;&amp;(e.width/i&gt;e.height/h?(g=i,f=parseInt(e.height/(e.width/g),10),d.width(g),d.height(f)):(f=h,g=parseInt(e.width/(e.height/f),10),d.width(g),d.height(f)))),c.sizeContainer(d.width(),d.height())},e.src=this.album[b].link,this.currentImageIndex=b},b.prototype.sizeOverlay=function(){this.$overlay.width(a(document).width()).height(a(document).height())},b.prototype.sizeContainer=function(a,b){function c(){d.$lightbox.find(".lb-dataContainer").width(g),d.$lightbox.find(".lb-prevLink").height(h),d.$lightbox.find(".lb-nextLink").height(h),d.showImage()}var d=this,e=this.$outerContainer.outerWidth(),f=this.$outerContainer.outerHeight(),g=a+this.containerPadding.left+this.containerPadding.right+this.imageBorderWidth.left+this.imageBorderWidth.right,h=b+this.containerPadding.top+this.containerPadding.bottom+this.imageBorderWidth.top+this.imageBorderWidth.bottom;e!==g||f!==h?this.$outerContainer.animate({width:g,height:h},this.options.resizeDuration,"swing",function(){c()}):c()},b.prototype.showImage=function(){this.$lightbox.find(".lb-loader").stop(!0).hide(),this.$lightbox.find(".lb-image").fadeIn(this.options.imageFadeDuration),this.updateNav(),this.updateDetails(),this.preloadNeighboringImages(),this.enableKeyboardNav()},b.prototype.updateNav=function(){var a=!1;try{document.createEvent("TouchEvent"),a=!!this.options.alwaysShowNavOnTouchDevices}catch(a){}this.$lightbox.find(".lb-nav").show(),this.album.length&gt;1&amp;&amp;(this.options.wrapAround?(a&amp;&amp;this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1"),this.$lightbox.find(".lb-prev, .lb-next").show()):(this.currentImageIndex&gt;0&amp;&amp;(this.$lightbox.find(".lb-prev").show(),a&amp;&amp;this.$lightbox.find(".lb-prev").css("opacity","1")),this.currentImageIndex&lt;this.album.length-1&amp;&amp;(this.$lightbox.find(".lb-next").show(),a&amp;&amp;this.$lightbox.find(".lb-next").css("opacity","1"))))},b.prototype.updateDetails=function(){var b=this;if(void 0!==this.album[this.currentImageIndex].title&amp;&amp;""!==this.album[this.currentImageIndex].title){var c=this.$lightbox.find(".lb-caption");this.options.sanitizeTitle?c.text(this.album[this.currentImageIndex].title):c.html(this.album[this.currentImageIndex].title),c.fadeIn("fast").find("a").on("click",function(b){void 0!==a(this).attr("target")?window.open(a(this).attr("href"),a(this).attr("target")):location.href=a(this).attr("href")})}if(this.album.length&gt;1&amp;&amp;this.options.showImageNumberLabel){var d=this.imageCountLabel(this.currentImageIndex+1,this.album.length);this.$lightbox.find(".lb-number").text(d).fadeIn("fast")}else this.$lightbox.find(".lb-number").hide();this.$outerContainer.removeClass("animating"),this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return b.sizeOverlay()})},b.prototype.preloadNeighboringImages=function(){if(this.album.length&gt;this.currentImageIndex+1){(new Image).src=this.album[this.currentImageIndex+1].link}if(this.currentImageIndex&gt;0){(new Image).src=this.album[this.currentImageIndex-1].link}},b.prototype.enableKeyboardNav=function(){a(document).on("keyup.keyboard",a.proxy(this.keyboardAction,this))},b.prototype.disableKeyboardNav=function(){a(document).off(".keyboard")},b.prototype.keyboardAction=function(a){var b=a.keyCode,c=String.fromCharCode(b).toLowerCase();27===b||c.match(/x|o|c/)?this.end():"p"===c||37===b?0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&amp;&amp;this.album.length&gt;1&amp;&amp;this.changeImage(this.album.length-1):"n"!==c&amp;&amp;39!==b||(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&amp;&amp;this.album.length&gt;1&amp;&amp;this.changeImage(0))},b.prototype.end=function(){this.disableKeyboardNav(),a(window).off("resize",this.sizeOverlay),this.$lightbox.fadeOut(this.options.fadeDuration),this.$overlay.fadeOut(this.options.fadeDuration),a("select, object, embed").css({visibility:"visible"}),this.options.disableScrolling&amp;&amp;a("html").removeClass("lb-disable-scrolling")},new b});
//# sourceMappingURL=lightbox.min.map
/*
* onScreen 0.0.0
* Checks if matched elements are inside the viewport.
* Built on Mon Mar 09 2015 12:00:07
*
* Copyright 2015 Silvestre Herrera &lt;silvestre.herrera@gmail.com&gt; and contributors, Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* You can find a list of contributors at:
* https://github.com/silvestreh/onScreen/graphs/contributors
*/


!function(a){a.fn.onScreen=function(b){var c={container:window,direction:"vertical",toggleClass:null,doIn:null,doOut:null,tolerance:0,throttle:null,lazyAttr:null,lazyPlaceholder:"data:image/gif;base64,R0lGODlhEAAFAIAAAP///////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCQAAACwAAAAAEAAFAAACCIyPqcvtD00BACH5BAkJAAIALAAAAAAQAAUAgfT29Pz6/P///wAAAAIQTGCiywKPmjxUNhjtMlWrAgAh+QQJCQAFACwAAAAAEAAFAIK8urzc2tzEwsS8vrzc3tz///8AAAAAAAADFEiyUf6wCEBHvLPemIHdTzCMDegkACH5BAkJAAYALAAAAAAQAAUAgoSChLS2tIyKjLy+vIyOjMTCxP///wAAAAMUWCQ09jAaAiqQmFosdeXRUAkBCCUAIfkECQkACAAsAAAAABAABQCDvLq83N7c3Nrc9Pb0xMLE/P78vL68/Pr8////AAAAAAAAAAAAAAAAAAAAAAAAAAAABCEwkCnKGbegvQn4RjGMx8F1HxBi5Il4oEiap2DcVYlpZwQAIfkECQkACAAsAAAAABAABQCDvLq85OLkxMLE9Pb0vL685ObkxMbE/Pr8////AAAAAAAAAAAAAAAAAAAAAAAAAAAABCDwnCGHEcIMxPn4VAGMQNBx0zQEZHkiYNiap5RaBKG9EQAh+QQJCQAJACwAAAAAEAAFAIOEgoTMysyMjozs6uyUlpSMiozMzsyUkpTs7uz///8AAAAAAAAAAAAAAAAAAAAAAAAEGTBJiYgoBM09DfhAwHEeKI4dGKLTIHzCwEUAIfkECQkACAAsAAAAABAABQCDvLq85OLkxMLE9Pb0vL685ObkxMbE/Pr8////AAAAAAAAAAAAAAAAAAAAAAAAAAAABCAQSTmMEGaco8+UBSACwWBqHxKOJYd+q1iaXFoRRMbtEQAh+QQJCQAIACwAAAAAEAAFAIO8urzc3tzc2tz09vTEwsT8/vy8vrz8+vz///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAEIhBJWc6wJZAtJh3gcRBAaXiIZV2kiRbgNZbA6VXiUAhGL0QAIfkECQkABgAsAAAAABAABQCChIKEtLa0jIqMvL68jI6MxMLE////AAAAAxRoumxFgoxGCbiANos145e3DJcQJAAh+QQJCQAFACwAAAAAEAAFAIK8urzc2tzEwsS8vrzc3tz///8AAAAAAAADFFi6XCQwtCmAHbPVm9kGWKcEQxkkACH5BAkJAAIALAAAAAAQAAUAgfT29Pz6/P///wAAAAIRlI8SAZsPYnuJMUCRnNksWwAAOw==",debug:!1};return"remove"!==b&amp;&amp;a.extend(c,b),"check"!==b&amp;&amp;a.extend(c,b),this.each(function(){function d(){a(l).off("scroll.onScreen resize.onScreen"),a(window).off("resize.onScreen")}function e(){return z?v&lt;r-c.tolerance&amp;&amp;m&lt;v+t-c.tolerance:v&lt;p-c.tolerance&amp;&amp;v&gt;-t+c.tolerance}function f(){return z?v+(t-c.tolerance)&lt;m||v&gt;r-c.tolerance:v&gt;p-c.tolerance||-t+c.tolerance&gt;v}function g(){return z?w&lt;s-c.tolerance&amp;&amp;n&lt;w+u-c.tolerance:w&lt;q-c.tolerance&amp;&amp;w&gt;-u+c.tolerance}function h(){return z?w+(u-c.tolerance)&lt;n||w&gt;s-c.tolerance:w&gt;q-c.tolerance||-u+c.tolerance&gt;w}function i(){return x?!1:"horizontal"===c.direction?g():e()}function j(){return x?"horizontal"===c.direction?h():f():!1}function k(a,b,c){var d,e,f;return function(){e=arguments,f=!0,c=c||this,d||!function(){f?(a.apply(c,e),f=!1,d=setTimeout(arguments.callee,b)):d=null}()}}var l=this;if("remove"===b)return void d();var m,n,o,p,q,r,s,t,u,v,w,x=!1,y=a(this),z=a.isWindow(c.container),A=function(){if(z||"static"!==a(c.container).css("position")||a(c.container).css("position","relative"),o=a(c.container),p=o.height(),q=o.width(),r=o.scrollTop()+p,s=o.scrollLeft()+q,t=y.outerHeight(!0),u=y.outerWidth(!0),z){var d=y.offset();v=d.top,w=d.left}else{var e=y.position();v=e.top,w=e.left}if(m=o.scrollTop(),n=o.scrollLeft(),c.debug,i()){if(c.toggleClass&amp;&amp;y.addClass(c.toggleClass),a.isFunction(c.doIn)&amp;&amp;c.doIn.call(y[0]),c.lazyAttr&amp;&amp;"IMG"===y.prop("tagName")){var f=y.attr(c.lazyAttr);f!==y.prop("src")&amp;&amp;(y.css({background:"url("+c.lazyPlaceholder+") 50% 50% no-repeat",minHeight:"5px",minWidth:"16px"}),y.prop("src",f).load(function(){a(this).css({background:"none"})}))}x=!0}else j()&amp;&amp;(c.toggleClass&amp;&amp;y.removeClass(c.toggleClass),a.isFunction(c.doOut)&amp;&amp;c.doOut.call(y[0]),x=!1);return"check"===b?x:void 0};window.location.hash?k(A,50):A(),c.throttle&amp;&amp;(A=k(A,c.throttle)),a(c.container).on("scroll.onScreen resize.onScreen",A),z||a(window).on("resize.onScreen",A),"object"==typeof module&amp;&amp;module&amp;&amp;"object"==typeof module.exports?module.exports=jQuery:"function"==typeof define&amp;&amp;define.amd&amp;&amp;define("jquery-onscreen",[],function(){return jQuery})})}}(jQuery);
//# sourceMappingURL=jquery.onscreen.min.js.map

/**
 * https://github.com/bendc/anchor-scroll
 * Terminal8 GmbH mod, 25.2.18, mf:
 * changed history.pushState(null,null,b) to
 * history.pushState(null,null,window.location.pathname + b)
 * this keeps the pathname in the URL after scroll animation.
 */
document.addEventListener("DOMContentLoaded",function(){var e=function(){if("scrollingElement"in document)return document.scrollingElement;var a=document.documentElement,b=a.scrollTop;a.scrollTop=b+1;var c=a.scrollTop;a.scrollTop=b;return c&gt;b?a:document.body}(),h=function(a){var b=e.scrollTop;if(2&gt;a.length)a=-b;else if(a=document.querySelector(a)){a=a.getBoundingClientRect().top;var c=e.scrollHeight-window.innerHeight;a=b+a&lt;c?a:c-b}else a=void 0;if(a)return new Map([["start",b],["delta",a]])},m=function(a){var b=
a.getAttribute("href"),c=h(b);if(c){var d=new Map([["duration",800]]),k=performance.now();requestAnimationFrame(function l(a){d.set("elapsed",a-k);a=d.get("duration");var f=d.get("elapsed"),g=c.get("start"),h=c.get("delta");e.scrollTop=Math.round(h*(-Math.pow(2,-10*f/a)+1)+g);d.get("elapsed")&lt;d.get("duration")?requestAnimationFrame(l):(history.pushState(null,null,window.location.pathname + b),e.scrollTop=c.get("start")+c.get("delta"))})}},n=function b(c,d){var e=c.item(d);e.addEventListener("click",function(b){b.preventDefault();
m(e)});if(d)return b(c,d-1)},f=document.querySelectorAll("a.scroll"),g=f.length-1;0&gt;g||n(f,g)});

!function(t,e){"use strict";"object"==typeof module&amp;&amp;"object"==typeof module.exports?module.exports=e(t,document):"function"==typeof define&amp;&amp;define.amd?define(null,function(){e(t,document)}):t.rangetouch=e(t,document)}("undefined"!=typeof window?window:this,function(t,e){"use strict";function n(t){return t instanceof HTMLElement&amp;&amp;t.classList.contains(l.selectors.disabled)}function o(t,e,n){t.addEventListener(e,n,!1)}function i(t){var e=(""+t).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0}function u(t,e){if(e&lt;1){var n=i(e);return parseFloat(t.toFixed(n))}return Math.round(t/e)*e}function r(t){var e,n=t.target,o=t.changedTouches[0],i=parseFloat(n.getAttribute("min"))||0,r=parseFloat(n.getAttribute("max"))||100,a=parseFloat(n.getAttribute("step"))||1,c=r-i,s=n.getBoundingClientRect(),d=100/s.width*(l.thumbWidth/2)/100;return e=100/s.width*(o.clientX-s.left),e&lt;0?e=0:e&gt;100&amp;&amp;(e=100),e&lt;50?e-=(100-2*e)*d:e&gt;50&amp;&amp;(e+=2*(e-50)*d),i+u(c*(e/100),a)}function a(t){l.enabled&amp;&amp;"range"===t.target.type&amp;&amp;!n(t.target)&amp;&amp;(t.preventDefault(),t.target.value=r(t),s(t.target,t.type===l.events.end?"change":"input"))}function c(){o(e.body,l.events.start,a),o(e.body,l.events.move,a),o(e.body,l.events.end,a)}function s(t,e,n){t.dispatchEvent(new CustomEvent(e,n))}function d(){return[l.selectors.range,":not(.",l.selectors.disabled,")"].join("")}var l={enabled:!0,selectors:{range:'[type="range"]',disabled:"rangetouch--disabled"},thumbWidth:15,events:{start:"touchstart",move:"touchmove",end:"touchend"}};return function(){if("ontouchstart"in e.documentElement){for(var t=e.querySelectorAll(d()),n=t.length-1;n&gt;=0;n--)t[n].style.touchAction="manipulation",t[n].style.webkitUserSelect="none";c()}}(),{set:function(t,e){l[t]=e}}}),function(){"use strict";function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}if("function"==typeof window.CustomEvent)return!1;t.prototype=window.Event.prototype,window.CustomEvent=t}();
typeof navigator === "object" &amp;&amp; (function (global, factory) {
  typeof exports === 'object' &amp;&amp; typeof module !== 'undefined' ? module.exports = factory() :
  typeof define === 'function' &amp;&amp; define.amd ? define('Plyr', factory) :
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Plyr = factory());
})(this, (function () { 'use strict';

  function _defineProperty$1(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }
    return obj;
  }

  function _classCallCheck(e, t) {
    if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
  }
  function _defineProperties(e, t) {
    for (var n = 0; n &lt; t.length; n++) {
      var r = t[n];
      r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r &amp;&amp; (r.writable = !0), Object.defineProperty(e, r.key, r);
    }
  }
  function _createClass(e, t, n) {
    return t &amp;&amp; _defineProperties(e.prototype, t), n &amp;&amp; _defineProperties(e, n), e;
  }
  function _defineProperty(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  function ownKeys(e, t) {
    var n = Object.keys(e);
    if (Object.getOwnPropertySymbols) {
      var r = Object.getOwnPropertySymbols(e);
      t &amp;&amp; (r = r.filter(function (t) {
        return Object.getOwnPropertyDescriptor(e, t).enumerable;
      })), n.push.apply(n, r);
    }
    return n;
  }
  function _objectSpread2(e) {
    for (var t = 1; t &lt; arguments.length; t++) {
      var n = null != arguments[t] ? arguments[t] : {};
      t % 2 ? ownKeys(Object(n), !0).forEach(function (t) {
        _defineProperty(e, t, n[t]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys(Object(n)).forEach(function (t) {
        Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
      });
    }
    return e;
  }
  var defaults$1 = {
    addCSS: !0,
    thumbWidth: 15,
    watch: !0
  };
  function matches$1(e, t) {
    return function () {
      return Array.from(document.querySelectorAll(t)).includes(this);
    }.call(e, t);
  }
  function trigger(e, t) {
    if (e &amp;&amp; t) {
      var n = new Event(t, {
        bubbles: !0
      });
      e.dispatchEvent(n);
    }
  }
  var getConstructor$1 = function (e) {
      return null != e ? e.constructor : null;
    },
    instanceOf$1 = function (e, t) {
      return !!(e &amp;&amp; t &amp;&amp; e instanceof t);
    },
    isNullOrUndefined$1 = function (e) {
      return null == e;
    },
    isObject$1 = function (e) {
      return getConstructor$1(e) === Object;
    },
    isNumber$1 = function (e) {
      return getConstructor$1(e) === Number &amp;&amp; !Number.isNaN(e);
    },
    isString$1 = function (e) {
      return getConstructor$1(e) === String;
    },
    isBoolean$1 = function (e) {
      return getConstructor$1(e) === Boolean;
    },
    isFunction$1 = function (e) {
      return getConstructor$1(e) === Function;
    },
    isArray$1 = function (e) {
      return Array.isArray(e);
    },
    isNodeList$1 = function (e) {
      return instanceOf$1(e, NodeList);
    },
    isElement$1 = function (e) {
      return instanceOf$1(e, Element);
    },
    isEvent$1 = function (e) {
      return instanceOf$1(e, Event);
    },
    isEmpty$1 = function (e) {
      return isNullOrUndefined$1(e) || (isString$1(e) || isArray$1(e) || isNodeList$1(e)) &amp;&amp; !e.length || isObject$1(e) &amp;&amp; !Object.keys(e).length;
    },
    is$1 = {
      nullOrUndefined: isNullOrUndefined$1,
      object: isObject$1,
      number: isNumber$1,
      string: isString$1,
      boolean: isBoolean$1,
      function: isFunction$1,
      array: isArray$1,
      nodeList: isNodeList$1,
      element: isElement$1,
      event: isEvent$1,
      empty: isEmpty$1
    };
  function getDecimalPlaces(e) {
    var t = "".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
    return t ? Math.max(0, (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0)) : 0;
  }
  function round(e, t) {
    if (1 &gt; t) {
      var n = getDecimalPlaces(t);
      return parseFloat(e.toFixed(n));
    }
    return Math.round(e / t) * t;
  }
  var RangeTouch = function () {
    function e(t, n) {
      _classCallCheck(this, e), is$1.element(t) ? this.element = t : is$1.string(t) &amp;&amp; (this.element = document.querySelector(t)), is$1.element(this.element) &amp;&amp; is$1.empty(this.element.rangeTouch) &amp;&amp; (this.config = _objectSpread2({}, defaults$1, {}, n), this.init());
    }
    return _createClass(e, [{
      key: "init",
      value: function () {
        e.enabled &amp;&amp; (this.config.addCSS &amp;&amp; (this.element.style.userSelect = "none", this.element.style.webKitUserSelect = "none", this.element.style.touchAction = "manipulation"), this.listeners(!0), this.element.rangeTouch = this);
      }
    }, {
      key: "destroy",
      value: function () {
        e.enabled &amp;&amp; (this.config.addCSS &amp;&amp; (this.element.style.userSelect = "", this.element.style.webKitUserSelect = "", this.element.style.touchAction = ""), this.listeners(!1), this.element.rangeTouch = null);
      }
    }, {
      key: "listeners",
      value: function (e) {
        var t = this,
          n = e ? "addEventListener" : "removeEventListener";
        ["touchstart", "touchmove", "touchend"].forEach(function (e) {
          t.element[n](e, function (e) {
            return t.set(e);
          }, !1);
        });
      }
    }, {
      key: "get",
      value: function (t) {
        if (!e.enabled || !is$1.event(t)) return null;
        var n,
          r = t.target,
          i = t.changedTouches[0],
          o = parseFloat(r.getAttribute("min")) || 0,
          s = parseFloat(r.getAttribute("max")) || 100,
          u = parseFloat(r.getAttribute("step")) || 1,
          c = r.getBoundingClientRect(),
          a = 100 / c.width * (this.config.thumbWidth / 2) / 100;
        return 0 &gt; (n = 100 / c.width * (i.clientX - c.left)) ? n = 0 : 100 &lt; n &amp;&amp; (n = 100), 50 &gt; n ? n -= (100 - 2 * n) * a : 50 &lt; n &amp;&amp; (n += 2 * (n - 50) * a), o + round(n / 100 * (s - o), u);
      }
    }, {
      key: "set",
      value: function (t) {
        e.enabled &amp;&amp; is$1.event(t) &amp;&amp; !t.target.disabled &amp;&amp; (t.preventDefault(), t.target.value = this.get(t), trigger(t.target, "touchend" === t.type ? "change" : "input"));
      }
    }], [{
      key: "setup",
      value: function (t) {
        var n = 1 &lt; arguments.length &amp;&amp; void 0 !== arguments[1] ? arguments[1] : {},
          r = null;
        if (is$1.empty(t) || is$1.string(t) ? r = Array.from(document.querySelectorAll(is$1.string(t) ? t : 'input[type="range"]')) : is$1.element(t) ? r = [t] : is$1.nodeList(t) ? r = Array.from(t) : is$1.array(t) &amp;&amp; (r = t.filter(is$1.element)), is$1.empty(r)) return null;
        var i = _objectSpread2({}, defaults$1, {}, n);
        if (is$1.string(t) &amp;&amp; i.watch) {
          var o = new MutationObserver(function (n) {
            Array.from(n).forEach(function (n) {
              Array.from(n.addedNodes).forEach(function (n) {
                is$1.element(n) &amp;&amp; matches$1(n, t) &amp;&amp; new e(n, i);
              });
            });
          });
          o.observe(document.body, {
            childList: !0,
            subtree: !0
          });
        }
        return r.map(function (t) {
          return new e(t, n);
        });
      }
    }, {
      key: "enabled",
      get: function () {
        return "ontouchstart" in document.documentElement;
      }
    }]), e;
  }();

  // ==========================================================================
  // Type checking utils
  // ==========================================================================

  const getConstructor = input =&gt; input !== null &amp;&amp; typeof input !== 'undefined' ? input.constructor : null;
  const instanceOf = (input, constructor) =&gt; Boolean(input &amp;&amp; constructor &amp;&amp; input instanceof constructor);
  const isNullOrUndefined = input =&gt; input === null || typeof input === 'undefined';
  const isObject = input =&gt; getConstructor(input) === Object;
  const isNumber = input =&gt; getConstructor(input) === Number &amp;&amp; !Number.isNaN(input);
  const isString = input =&gt; getConstructor(input) === String;
  const isBoolean = input =&gt; getConstructor(input) === Boolean;
  const isFunction = input =&gt; typeof input === 'function';
  const isArray = input =&gt; Array.isArray(input);
  const isWeakMap = input =&gt; instanceOf(input, WeakMap);
  const isNodeList = input =&gt; instanceOf(input, NodeList);
  const isTextNode = input =&gt; getConstructor(input) === Text;
  const isEvent = input =&gt; instanceOf(input, Event);
  const isKeyboardEvent = input =&gt; instanceOf(input, KeyboardEvent);
  const isCue = input =&gt; instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue);
  const isTrack = input =&gt; instanceOf(input, TextTrack) || !isNullOrUndefined(input) &amp;&amp; isString(input.kind);
  const isPromise = input =&gt; instanceOf(input, Promise) &amp;&amp; isFunction(input.then);
  const isElement = input =&gt; input !== null &amp;&amp; typeof input === 'object' &amp;&amp; input.nodeType === 1 &amp;&amp; typeof input.style === 'object' &amp;&amp; typeof input.ownerDocument === 'object';
  const isEmpty = input =&gt; isNullOrUndefined(input) || (isString(input) || isArray(input) || isNodeList(input)) &amp;&amp; !input.length || isObject(input) &amp;&amp; !Object.keys(input).length;
  const isUrl = input =&gt; {
    // Accept a URL object
    if (instanceOf(input, window.URL)) {
      return true;
    }

    // Must be string from here
    if (!isString(input)) {
      return false;
    }

    // Add the protocol if required
    let string = input;
    if (!input.startsWith('http://') || !input.startsWith('https://')) {
      string = `http://${input}`;
    }
    try {
      return !isEmpty(new URL(string).hostname);
    } catch (_) {
      return false;
    }
  };
  var is = {
    nullOrUndefined: isNullOrUndefined,
    object: isObject,
    number: isNumber,
    string: isString,
    boolean: isBoolean,
    function: isFunction,
    array: isArray,
    weakMap: isWeakMap,
    nodeList: isNodeList,
    element: isElement,
    textNode: isTextNode,
    event: isEvent,
    keyboardEvent: isKeyboardEvent,
    cue: isCue,
    track: isTrack,
    promise: isPromise,
    url: isUrl,
    empty: isEmpty
  };

  // ==========================================================================
  const transitionEndEvent = (() =&gt; {
    const element = document.createElement('span');
    const events = {
      WebkitTransition: 'webkitTransitionEnd',
      MozTransition: 'transitionend',
      OTransition: 'oTransitionEnd otransitionend',
      transition: 'transitionend'
    };
    const type = Object.keys(events).find(event =&gt; element.style[event] !== undefined);
    return is.string(type) ? events[type] : false;
  })();

  // Force repaint of element
  function repaint(element, delay) {
    setTimeout(() =&gt; {
      try {
        // eslint-disable-next-line no-param-reassign
        element.hidden = true;

        // eslint-disable-next-line no-unused-expressions
        element.offsetHeight;

        // eslint-disable-next-line no-param-reassign
        element.hidden = false;
      } catch (_) {
        // Do nothing
      }
    }, delay);
  }

  // ==========================================================================
  // Browser sniffing
  // Unfortunately, due to mixed support, UA sniffing is required
  // ==========================================================================

  const browser = {
    isIE: Boolean(window.document.documentMode),
    isEdge: /Edge/g.test(navigator.userAgent),
    isWebkit: 'WebkitAppearance' in document.documentElement.style &amp;&amp; !/Edge/g.test(navigator.userAgent),
    isIPhone: /iPhone|iPod/gi.test(navigator.userAgent) &amp;&amp; navigator.maxTouchPoints &gt; 1,
    isIos: /iPad|iPhone|iPod/gi.test(navigator.userAgent) &amp;&amp; navigator.maxTouchPoints &gt; 1
  };

  // ==========================================================================

  // Clone nested objects
  function cloneDeep(object) {
    return JSON.parse(JSON.stringify(object));
  }

  // Get a nested value in an object
  function getDeep(object, path) {
    return path.split('.').reduce((obj, key) =&gt; obj &amp;&amp; obj[key], object);
  }

  // Deep extend destination object with N more objects
  function extend(target = {}, ...sources) {
    if (!sources.length) {
      return target;
    }
    const source = sources.shift();
    if (!is.object(source)) {
      return target;
    }
    Object.keys(source).forEach(key =&gt; {
      if (is.object(source[key])) {
        if (!Object.keys(target).includes(key)) {
          Object.assign(target, {
            [key]: {}
          });
        }
        extend(target[key], source[key]);
      } else {
        Object.assign(target, {
          [key]: source[key]
        });
      }
    });
    return extend(target, ...sources);
  }

  // ==========================================================================

  // Wrap an element
  function wrap(elements, wrapper) {
    // Convert `elements` to an array, if necessary.
    const targets = elements.length ? elements : [elements];

    // Loops backwards to prevent having to clone the wrapper on the
    // first element (see `child` below).
    Array.from(targets).reverse().forEach((element, index) =&gt; {
      const child = index &gt; 0 ? wrapper.cloneNode(true) : wrapper;
      // Cache the current parent and sibling.
      const parent = element.parentNode;
      const sibling = element.nextSibling;

      // Wrap the element (is automatically removed from its current
      // parent).
      child.appendChild(element);

      // If the element had a sibling, insert the wrapper before
      // the sibling to maintain the HTML structure; otherwise, just
      // append it to the parent.
      if (sibling) {
        parent.insertBefore(child, sibling);
      } else {
        parent.appendChild(child);
      }
    });
  }

  // Set attributes
  function setAttributes(element, attributes) {
    if (!is.element(element) || is.empty(attributes)) {
      return;
    }

    // Assume null and undefined attributes should be left out,
    // Setting them would otherwise convert them to "null" and "undefined"
    Object.entries(attributes).filter(([, value]) =&gt; !is.nullOrUndefined(value)).forEach(([key, value]) =&gt; element.setAttribute(key, value));
  }

  // Create a DocumentFragment
  function createElement(type, attributes, text) {
    // Create a new &lt;element&gt;
    const element = document.createElement(type);

    // Set all passed attributes
    if (is.object(attributes)) {
      setAttributes(element, attributes);
    }

    // Add text node
    if (is.string(text)) {
      element.innerText = text;
    }

    // Return built element
    return element;
  }

  // Inaert an element after another
  function insertAfter(element, target) {
    if (!is.element(element) || !is.element(target)) {
      return;
    }
    target.parentNode.insertBefore(element, target.nextSibling);
  }

  // Insert a DocumentFragment
  function insertElement(type, parent, attributes, text) {
    if (!is.element(parent)) {
      return;
    }
    parent.appendChild(createElement(type, attributes, text));
  }

  // Remove element(s)
  function removeElement(element) {
    if (is.nodeList(element) || is.array(element)) {
      Array.from(element).forEach(removeElement);
      return;
    }
    if (!is.element(element) || !is.element(element.parentNode)) {
      return;
    }
    element.parentNode.removeChild(element);
  }

  // Remove all child elements
  function emptyElement(element) {
    if (!is.element(element)) {
      return;
    }
    let {
      length
    } = element.childNodes;
    while (length &gt; 0) {
      element.removeChild(element.lastChild);
      length -= 1;
    }
  }

  // Replace element
  function replaceElement(newChild, oldChild) {
    if (!is.element(oldChild) || !is.element(oldChild.parentNode) || !is.element(newChild)) {
      return null;
    }
    oldChild.parentNode.replaceChild(newChild, oldChild);
    return newChild;
  }

  // Get an attribute object from a string selector
  function getAttributesFromSelector(sel, existingAttributes) {
    // For example:
    // '.test' to { class: 'test' }
    // '#test' to { id: 'test' }
    // '[data-test="test"]' to { 'data-test': 'test' }

    if (!is.string(sel) || is.empty(sel)) {
      return {};
    }
    const attributes = {};
    const existing = extend({}, existingAttributes);
    sel.split(',').forEach(s =&gt; {
      // Remove whitespace
      const selector = s.trim();
      const className = selector.replace('.', '');
      const stripped = selector.replace(/[[\]]/g, '');
      // Get the parts and value
      const parts = stripped.split('=');
      const [key] = parts;
      const value = parts.length &gt; 1 ? parts[1].replace(/["']/g, '') : '';
      // Get the first character
      const start = selector.charAt(0);
      switch (start) {
        case '.':
          // Add to existing classname
          if (is.string(existing.class)) {
            attributes.class = `${existing.class} ${className}`;
          } else {
            attributes.class = className;
          }
          break;
        case '#':
          // ID selector
          attributes.id = selector.replace('#', '');
          break;
        case '[':
          // Attribute selector
          attributes[key] = value;
          break;
      }
    });
    return extend(existing, attributes);
  }

  // Toggle hidden
  function toggleHidden(element, hidden) {
    if (!is.element(element)) {
      return;
    }
    let hide = hidden;
    if (!is.boolean(hide)) {
      hide = !element.hidden;
    }

    // eslint-disable-next-line no-param-reassign
    element.hidden = hide;
  }

  // Mirror Element.classList.toggle, with IE compatibility for "force" argument
  function toggleClass(element, className, force) {
    if (is.nodeList(element)) {
      return Array.from(element).map(e =&gt; toggleClass(e, className, force));
    }
    if (is.element(element)) {
      let method = 'toggle';
      if (typeof force !== 'undefined') {
        method = force ? 'add' : 'remove';
      }
      element.classList[method](className);
      return element.classList.contains(className);
    }
    return false;
  }

  // Has class name
  function hasClass(element, className) {
    return is.element(element) &amp;&amp; element.classList.contains(className);
  }

  // Element matches selector
  function matches(element, selector) {
    const {
      prototype
    } = Element;
    function match() {
      return Array.from(document.querySelectorAll(selector)).includes(this);
    }
    const method = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match;
    return method.call(element, selector);
  }

  // Closest ancestor element matching selector (also tests element itself)
  function closest$1(element, selector) {
    const {
      prototype
    } = Element;

    // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
    function closestElement() {
      let el = this;
      do {
        if (matches.matches(el, selector)) return el;
        el = el.parentElement || el.parentNode;
      } while (el !== null &amp;&amp; el.nodeType === 1);
      return null;
    }
    const method = prototype.closest || closestElement;
    return method.call(element, selector);
  }

  // Find all elements
  function getElements(selector) {
    return this.elements.container.querySelectorAll(selector);
  }

  // Find a single element
  function getElement(selector) {
    return this.elements.container.querySelector(selector);
  }

  // Set focus and tab focus class
  function setFocus(element = null, tabFocus = false) {
    if (!is.element(element)) {
      return;
    }

    // Set regular focus
    element.focus({
      preventScroll: true
    });

    // If we want to mimic keyboard focus via tab
    if (tabFocus) {
      toggleClass(element, this.config.classNames.tabFocus);
    }
  }

  // ==========================================================================

  // Default codecs for checking mimetype support
  const defaultCodecs = {
    'audio/ogg': 'vorbis',
    'audio/wav': '1',
    'video/webm': 'vp8, vorbis',
    'video/mp4': 'avc1.42E01E, mp4a.40.2',
    'video/ogg': 'theora'
  };

  // Check for feature support
  const support = {
    // Basic support
    audio: 'canPlayType' in document.createElement('audio'),
    video: 'canPlayType' in document.createElement('video'),
    // Check for support
    // Basic functionality vs full UI
    check(type, provider, playsinline) {
      const canPlayInline = browser.isIPhone &amp;&amp; playsinline &amp;&amp; support.playsinline;
      const api = support[type] || provider !== 'html5';
      const ui = api &amp;&amp; support.rangeInput &amp;&amp; (type !== 'video' || !browser.isIPhone || canPlayInline);
      return {
        api,
        ui
      };
    },
    // Picture-in-picture support
    // Safari &amp; Chrome only currently
    pip: (() =&gt; {
      // While iPhone's support picture-in-picture for some apps, seemingly Safari isn't one of them
      // It will throw the following error when trying to enter picture-in-picture
      // `NotSupportedError: The Picture-in-Picture mode is not supported.`
      if (browser.isIPhone) {
        return false;
      }

      // Safari
      // https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls
      if (is.function(createElement('video').webkitSetPresentationMode)) {
        return true;
      }

      // Chrome
      // https://developers.google.com/web/updates/2018/10/watch-video-using-picture-in-picture
      if (document.pictureInPictureEnabled &amp;&amp; !createElement('video').disablePictureInPicture) {
        return true;
      }
      return false;
    })(),
    // Airplay support
    // Safari only currently
    airplay: is.function(window.WebKitPlaybackTargetAvailabilityEvent),
    // Inline playback support
    // https://webkit.org/blog/6784/new-video-policies-for-ios/
    playsinline: 'playsInline' in document.createElement('video'),
    // Check for mime type support against a player instance
    // Credits: http://diveintohtml5.info/everything.html
    // Related: http://www.leanbackplayer.com/test/h5mt.html
    mime(input) {
      if (is.empty(input)) {
        return false;
      }
      const [mediaType] = input.split('/');
      let type = input;

      // Verify we're using HTML5 and there's no media type mismatch
      if (!this.isHTML5 || mediaType !== this.type) {
        return false;
      }

      // Add codec if required
      if (Object.keys(defaultCodecs).includes(type)) {
        type += `; codecs="${defaultCodecs[input]}"`;
      }
      try {
        return Boolean(type &amp;&amp; this.media.canPlayType(type).replace(/no/, ''));
      } catch (_) {
        return false;
      }
    },
    // Check for textTracks support
    textTracks: 'textTracks' in document.createElement('video'),
    // &lt;input type="range"&gt; Sliders
    rangeInput: (() =&gt; {
      const range = document.createElement('input');
      range.type = 'range';
      return range.type === 'range';
    })(),
    // Touch
    // NOTE: Remember a device can be mouse + touch enabled so we check on first touch event
    touch: 'ontouchstart' in document.documentElement,
    // Detect transitions support
    transitions: transitionEndEvent !== false,
    // Reduced motion iOS &amp; MacOS setting
    // https://webkit.org/blog/7551/responsive-design-for-motion/
    reducedMotion: 'matchMedia' in window &amp;&amp; window.matchMedia('(prefers-reduced-motion)').matches
  };

  // ==========================================================================

  // Check for passive event listener support
  // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
  // https://www.youtube.com/watch?v=NPM6172J22g
  const supportsPassiveListeners = (() =&gt; {
    // Test via a getter in the options object to see if the passive property is accessed
    let supported = false;
    try {
      const options = Object.defineProperty({}, 'passive', {
        get() {
          supported = true;
          return null;
        }
      });
      window.addEventListener('test', null, options);
      window.removeEventListener('test', null, options);
    } catch (_) {
      // Do nothing
    }
    return supported;
  })();

  // Toggle event listener
  function toggleListener(element, event, callback, toggle = false, passive = true, capture = false) {
    // Bail if no element, event, or callback
    if (!element || !('addEventListener' in element) || is.empty(event) || !is.function(callback)) {
      return;
    }

    // Allow multiple events
    const events = event.split(' ');
    // Build options
    // Default to just the capture boolean for browsers with no passive listener support
    let options = capture;

    // If passive events listeners are supported
    if (supportsPassiveListeners) {
      options = {
        // Whether the listener can be passive (i.e. default never prevented)
        passive,
        // Whether the listener is a capturing listener or not
        capture
      };
    }

    // If a single node is passed, bind the event listener
    events.forEach(type =&gt; {
      if (this &amp;&amp; this.eventListeners &amp;&amp; toggle) {
        // Cache event listener
        this.eventListeners.push({
          element,
          type,
          callback,
          options
        });
      }
      element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
    });
  }

  // Bind event handler
  function on(element, events = '', callback, passive = true, capture = false) {
    toggleListener.call(this, element, events, callback, true, passive, capture);
  }

  // Unbind event handler
  function off(element, events = '', callback, passive = true, capture = false) {
    toggleListener.call(this, element, events, callback, false, passive, capture);
  }

  // Bind once-only event handler
  function once(element, events = '', callback, passive = true, capture = false) {
    const onceCallback = (...args) =&gt; {
      off(element, events, onceCallback, passive, capture);
      callback.apply(this, args);
    };
    toggleListener.call(this, element, events, onceCallback, true, passive, capture);
  }

  // Trigger event
  function triggerEvent(element, type = '', bubbles = false, detail = {}) {
    // Bail if no element
    if (!is.element(element) || is.empty(type)) {
      return;
    }

    // Create and dispatch the event
    const event = new CustomEvent(type, {
      bubbles,
      detail: {
        ...detail,
        plyr: this
      }
    });

    // Dispatch the event
    element.dispatchEvent(event);
  }

  // Unbind all cached event listeners
  function unbindListeners() {
    if (this &amp;&amp; this.eventListeners) {
      this.eventListeners.forEach(item =&gt; {
        const {
          element,
          type,
          callback,
          options
        } = item;
        element.removeEventListener(type, callback, options);
      });
      this.eventListeners = [];
    }
  }

  // Run method when / if player is ready
  function ready() {
    return new Promise(resolve =&gt; this.ready ? setTimeout(resolve, 0) : on.call(this, this.elements.container, 'ready', resolve)).then(() =&gt; {});
  }

  /**
   * Silence a Promise-like object.
   * This is useful for avoiding non-harmful, but potentially confusing "uncaught
   * play promise" rejection error messages.
   * @param  {Object} value An object that may or may not be `Promise`-like.
   */
  function silencePromise(value) {
    if (is.promise(value)) {
      value.then(null, () =&gt; {});
    }
  }

  // ==========================================================================

  // Remove duplicates in an array
  function dedupe(array) {
    if (!is.array(array)) {
      return array;
    }
    return array.filter((item, index) =&gt; array.indexOf(item) === index);
  }

  // Get the closest value in an array
  function closest(array, value) {
    if (!is.array(array) || !array.length) {
      return null;
    }
    return array.reduce((prev, curr) =&gt; Math.abs(curr - value) &lt; Math.abs(prev - value) ? curr : prev);
  }

  // ==========================================================================

  // Check support for a CSS declaration
  function supportsCSS(declaration) {
    if (!window || !window.CSS) {
      return false;
    }
    return window.CSS.supports(declaration);
  }

  // Standard/common aspect ratios
  const standardRatios = [[1, 1], [4, 3], [3, 4], [5, 4], [4, 5], [3, 2], [2, 3], [16, 10], [10, 16], [16, 9], [9, 16], [21, 9], [9, 21], [32, 9], [9, 32]].reduce((out, [x, y]) =&gt; ({
    ...out,
    [x / y]: [x, y]
  }), {});

  // Validate an aspect ratio
  function validateAspectRatio(input) {
    if (!is.array(input) &amp;&amp; (!is.string(input) || !input.includes(':'))) {
      return false;
    }
    const ratio = is.array(input) ? input : input.split(':');
    return ratio.map(Number).every(is.number);
  }

  // Reduce an aspect ratio to it's lowest form
  function reduceAspectRatio(ratio) {
    if (!is.array(ratio) || !ratio.every(is.number)) {
      return null;
    }
    const [width, height] = ratio;
    const getDivider = (w, h) =&gt; h === 0 ? w : getDivider(h, w % h);
    const divider = getDivider(width, height);
    return [width / divider, height / divider];
  }

  // Calculate an aspect ratio
  function getAspectRatio(input) {
    const parse = ratio =&gt; validateAspectRatio(ratio) ? ratio.split(':').map(Number) : null;
    // Try provided ratio
    let ratio = parse(input);

    // Get from config
    if (ratio === null) {
      ratio = parse(this.config.ratio);
    }

    // Get from embed
    if (ratio === null &amp;&amp; !is.empty(this.embed) &amp;&amp; is.array(this.embed.ratio)) {
      ({
        ratio
      } = this.embed);
    }

    // Get from HTML5 video
    if (ratio === null &amp;&amp; this.isHTML5) {
      const {
        videoWidth,
        videoHeight
      } = this.media;
      ratio = [videoWidth, videoHeight];
    }
    return reduceAspectRatio(ratio);
  }

  // Set aspect ratio for responsive container
  function setAspectRatio(input) {
    if (!this.isVideo) {
      return {};
    }
    const {
      wrapper
    } = this.elements;
    const ratio = getAspectRatio.call(this, input);
    if (!is.array(ratio)) {
      return {};
    }
    const [x, y] = reduceAspectRatio(ratio);
    const useNative = supportsCSS(`aspect-ratio: ${x}/${y}`);
    const padding = 100 / x * y;
    if (useNative) {
      wrapper.style.aspectRatio = `${x}/${y}`;
    } else {
      wrapper.style.paddingBottom = `${padding}%`;
    }

    // For Vimeo we have an extra &lt;div&gt; to hide the standard controls and UI
    if (this.isVimeo &amp;&amp; !this.config.vimeo.premium &amp;&amp; this.supported.ui) {
      const height = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);
      const offset = (height - padding) / (height / 50);
      if (this.fullscreen.active) {
        wrapper.style.paddingBottom = null;
      } else {
        this.media.style.transform = `translateY(-${offset}%)`;
      }
    } else if (this.isHTML5) {
      wrapper.classList.add(this.config.classNames.videoFixedRatio);
    }
    return {
      padding,
      ratio
    };
  }

  // Round an aspect ratio to closest standard ratio
  function roundAspectRatio(x, y, tolerance = 0.05) {
    const ratio = x / y;
    const closestRatio = closest(Object.keys(standardRatios), ratio);

    // Check match is within tolerance
    if (Math.abs(closestRatio - ratio) &lt;= tolerance) {
      return standardRatios[closestRatio];
    }

    // No match
    return [x, y];
  }

  // Get the size of the viewport
  // https://stackoverflow.com/questions/1248081/how-to-get-the-browser-viewport-dimensions
  function getViewportSize() {
    const width = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
    const height = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
    return [width, height];
  }

  // ==========================================================================
  const html5 = {
    getSources() {
      if (!this.isHTML5) {
        return [];
      }
      const sources = Array.from(this.media.querySelectorAll('source'));

      // Filter out unsupported sources (if type is specified)
      return sources.filter(source =&gt; {
        const type = source.getAttribute('type');
        if (is.empty(type)) {
          return true;
        }
        return support.mime.call(this, type);
      });
    },
    // Get quality levels
    getQualityOptions() {
      // Whether we're forcing all options (e.g. for streaming)
      if (this.config.quality.forced) {
        return this.config.quality.options;
      }

      // Get sizes from &lt;source&gt; elements
      return html5.getSources.call(this).map(source =&gt; Number(source.getAttribute('size'))).filter(Boolean);
    },
    setup() {
      if (!this.isHTML5) {
        return;
      }
      const player = this;

      // Set speed options from config
      player.options.speed = player.config.speed.options;

      // Set aspect ratio if fixed
      if (!is.empty(this.config.ratio)) {
        setAspectRatio.call(player);
      }

      // Quality
      Object.defineProperty(player.media, 'quality', {
        get() {
          // Get sources
          const sources = html5.getSources.call(player);
          const source = sources.find(s =&gt; s.getAttribute('src') === player.source);

          // Return size, if match is found
          return source &amp;&amp; Number(source.getAttribute('size'));
        },
        set(input) {
          if (player.quality === input) {
            return;
          }

          // If we're using an external handler...
          if (player.config.quality.forced &amp;&amp; is.function(player.config.quality.onChange)) {
            player.config.quality.onChange(input);
          } else {
            // Get sources
            const sources = html5.getSources.call(player);
            // Get first match for requested size
            const source = sources.find(s =&gt; Number(s.getAttribute('size')) === input);

            // No matching source found
            if (!source) {
              return;
            }

            // Get current state
            const {
              currentTime,
              paused,
              preload,
              readyState,
              playbackRate
            } = player.media;

            // Set new source
            player.media.src = source.getAttribute('src');

            // Prevent loading if preload="none" and the current source isn't loaded (#1044)
            if (preload !== 'none' || readyState) {
              // Restore time
              player.once('loadedmetadata', () =&gt; {
                player.speed = playbackRate;
                player.currentTime = currentTime;

                // Resume playing
                if (!paused) {
                  silencePromise(player.play());
                }
              });

              // Load new source
              player.media.load();
            }
          }

          // Trigger change event
          triggerEvent.call(player, player.media, 'qualitychange', false, {
            quality: input
          });
        }
      });
    },
    // Cancel current network requests
    // See https://github.com/sampotts/plyr/issues/174
    cancelRequests() {
      if (!this.isHTML5) {
        return;
      }

      // Remove child sources
      removeElement(html5.getSources.call(this));

      // Set blank video src attribute
      // This is to prevent a MEDIA_ERR_SRC_NOT_SUPPORTED error
      // Info: http://stackoverflow.com/questions/32231579/how-to-properly-dispose-of-an-html5-video-and-close-socket-or-connection
      this.media.setAttribute('src', this.config.blankVideo);

      // Load the new empty source
      // This will cancel existing requests
      // See https://github.com/sampotts/plyr/issues/174
      this.media.load();

      // Debugging
      this.debug.log('Cancelled network requests');
    }
  };

  // ==========================================================================

  // Generate a random ID
  function generateId(prefix) {
    return `${prefix}-${Math.floor(Math.random() * 10000)}`;
  }

  // Format string
  function format(input, ...args) {
    if (is.empty(input)) return input;
    return input.toString().replace(/{(\d+)}/g, (match, i) =&gt; args[i].toString());
  }

  // Get percentage
  function getPercentage(current, max) {
    if (current === 0 || max === 0 || Number.isNaN(current) || Number.isNaN(max)) {
      return 0;
    }
    return (current / max * 100).toFixed(2);
  }

  // Replace all occurrences of a string in a string
  const replaceAll = (input = '', find = '', replace = '') =&gt; input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'), 'g'), replace.toString());

  // Convert to title case
  const toTitleCase = (input = '') =&gt; input.toString().replace(/\w\S*/g, text =&gt; text.charAt(0).toUpperCase() + text.slice(1).toLowerCase());

  // Convert string to pascalCase
  function toPascalCase(input = '') {
    let string = input.toString();

    // Convert kebab case
    string = replaceAll(string, '-', ' ');

    // Convert snake case
    string = replaceAll(string, '_', ' ');

    // Convert to title case
    string = toTitleCase(string);

    // Convert to pascal case
    return replaceAll(string, ' ', '');
  }

  // Convert string to pascalCase
  function toCamelCase(input = '') {
    let string = input.toString();

    // Convert to pascal case
    string = toPascalCase(string);

    // Convert first character to lowercase
    return string.charAt(0).toLowerCase() + string.slice(1);
  }

  // Remove HTML from a string
  function stripHTML(source) {
    const fragment = document.createDocumentFragment();
    const element = document.createElement('div');
    fragment.appendChild(element);
    element.innerHTML = source;
    return fragment.firstChild.innerText;
  }

  // Like outerHTML, but also works for DocumentFragment
  function getHTML(element) {
    const wrapper = document.createElement('div');
    wrapper.appendChild(element);
    return wrapper.innerHTML;
  }

  // ==========================================================================

  // Skip i18n for abbreviations and brand names
  const resources = {
    pip: 'PIP',
    airplay: 'AirPlay',
    html5: 'HTML5',
    vimeo: 'Vimeo',
    youtube: 'YouTube'
  };
  const i18n = {
    get(key = '', config = {}) {
      if (is.empty(key) || is.empty(config)) {
        return '';
      }
      let string = getDeep(config.i18n, key);
      if (is.empty(string)) {
        if (Object.keys(resources).includes(key)) {
          return resources[key];
        }
        return '';
      }
      const replace = {
        '{seektime}': config.seekTime,
        '{title}': config.title
      };
      Object.entries(replace).forEach(([k, v]) =&gt; {
        string = replaceAll(string, k, v);
      });
      return string;
    }
  };

  class Storage {
    constructor(player) {
      _defineProperty$1(this, "get", key =&gt; {
        if (!Storage.supported || !this.enabled) {
          return null;
        }
        const store = window.localStorage.getItem(this.key);
        if (is.empty(store)) {
          return null;
        }
        const json = JSON.parse(store);
        return is.string(key) &amp;&amp; key.length ? json[key] : json;
      });
      _defineProperty$1(this, "set", object =&gt; {
        // Bail if we don't have localStorage support or it's disabled
        if (!Storage.supported || !this.enabled) {
          return;
        }

        // Can only store objectst
        if (!is.object(object)) {
          return;
        }

        // Get current storage
        let storage = this.get();

        // Default to empty object
        if (is.empty(storage)) {
          storage = {};
        }

        // Update the working copy of the values
        extend(storage, object);

        // Update storage
        try {
          window.localStorage.setItem(this.key, JSON.stringify(storage));
        } catch (_) {
          // Do nothing
        }
      });
      this.enabled = player.config.storage.enabled;
      this.key = player.config.storage.key;
    }

    // Check for actual support (see if we can use it)
    static get supported() {
      try {
        if (!('localStorage' in window)) {
          return false;
        }
        const test = '___test';

        // Try to use it (it might be disabled, e.g. user is in private mode)
        // see: https://github.com/sampotts/plyr/issues/131
        window.localStorage.setItem(test, test);
        window.localStorage.removeItem(test);
        return true;
      } catch (_) {
        return false;
      }
    }
  }

  // ==========================================================================
  // Fetch wrapper
  // Using XHR to avoid issues with older browsers
  // ==========================================================================

  function fetch(url, responseType = 'text') {
    return new Promise((resolve, reject) =&gt; {
      try {
        const request = new XMLHttpRequest();

        // Check for CORS support
        if (!('withCredentials' in request)) {
          return;
        }
        request.addEventListener('load', () =&gt; {
          if (responseType === 'text') {
            try {
              resolve(JSON.parse(request.responseText));
            } catch (_) {
              resolve(request.responseText);
            }
          } else {
            resolve(request.response);
          }
        });
        request.addEventListener('error', () =&gt; {
          throw new Error(request.status);
        });
        request.open('GET', url, true);

        // Set the required response type
        request.responseType = responseType;
        request.send();
      } catch (error) {
        reject(error);
      }
    });
  }

  // ==========================================================================

  // Load an external SVG sprite
  function loadSprite(url, id) {
    if (!is.string(url)) {
      return;
    }
    const prefix = 'cache';
    const hasId = is.string(id);
    let isCached = false;
    const exists = () =&gt; document.getElementById(id) !== null;
    const update = (container, data) =&gt; {
      // eslint-disable-next-line no-param-reassign
      container.innerHTML = data;

      // Check again incase of race condition
      if (hasId &amp;&amp; exists()) {
        return;
      }

      // Inject the SVG to the body
      document.body.insertAdjacentElement('afterbegin', container);
    };

    // Only load once if ID set
    if (!hasId || !exists()) {
      const useStorage = Storage.supported;
      // Create container
      const container = document.createElement('div');
      container.setAttribute('hidden', '');
      if (hasId) {
        container.setAttribute('id', id);
      }

      // Check in cache
      if (useStorage) {
        const cached = window.localStorage.getItem(`${prefix}-${id}`);
        isCached = cached !== null;
        if (isCached) {
          const data = JSON.parse(cached);
          update(container, data.content);
        }
      }

      // Get the sprite
      fetch(url).then(result =&gt; {
        if (is.empty(result)) {
          return;
        }
        if (useStorage) {
          try {
            window.localStorage.setItem(`${prefix}-${id}`, JSON.stringify({
              content: result
            }));
          } catch (_) {
            // Do nothing
          }
        }
        update(container, result);
      }).catch(() =&gt; {});
    }
  }

  // ==========================================================================

  // Time helpers
  const getHours = value =&gt; Math.trunc(value / 60 / 60 % 60, 10);
  const getMinutes = value =&gt; Math.trunc(value / 60 % 60, 10);
  const getSeconds = value =&gt; Math.trunc(value % 60, 10);

  // Format time to UI friendly string
  function formatTime(time = 0, displayHours = false, inverted = false) {
    // Bail if the value isn't a number
    if (!is.number(time)) {
      return formatTime(undefined, displayHours, inverted);
    }

    // Format time component to add leading zero
    const format = value =&gt; `0${value}`.slice(-2);
    // Breakdown to hours, mins, secs
    let hours = getHours(time);
    const mins = getMinutes(time);
    const secs = getSeconds(time);

    // Do we need to display hours?
    if (displayHours || hours &gt; 0) {
      hours = `${hours}:`;
    } else {
      hours = '';
    }

    // Render
    return `${inverted &amp;&amp; time &gt; 0 ? '-' : ''}${hours}${format(mins)}:${format(secs)}`;
  }

  // ==========================================================================

  // TODO: Don't export a massive object - break down and create class
  const controls = {
    // Get icon URL
    getIconUrl() {
      const url = new URL(this.config.iconUrl, window.location);
      const host = window.location.host ? window.location.host : window.top.location.host;
      const cors = url.host !== host || browser.isIE &amp;&amp; !window.svg4everybody;
      return {
        url: this.config.iconUrl,
        cors
      };
    },
    // Find the UI controls
    findElements() {
      try {
        this.elements.controls = getElement.call(this, this.config.selectors.controls.wrapper);

        // Buttons
        this.elements.buttons = {
          play: getElements.call(this, this.config.selectors.buttons.play),
          pause: getElement.call(this, this.config.selectors.buttons.pause),
          restart: getElement.call(this, this.config.selectors.buttons.restart),
          rewind: getElement.call(this, this.config.selectors.buttons.rewind),
          fastForward: getElement.call(this, this.config.selectors.buttons.fastForward),
          mute: getElement.call(this, this.config.selectors.buttons.mute),
          pip: getElement.call(this, this.config.selectors.buttons.pip),
          airplay: getElement.call(this, this.config.selectors.buttons.airplay),
          settings: getElement.call(this, this.config.selectors.buttons.settings),
          captions: getElement.call(this, this.config.selectors.buttons.captions),
          fullscreen: getElement.call(this, this.config.selectors.buttons.fullscreen)
        };

        // Progress
        this.elements.progress = getElement.call(this, this.config.selectors.progress);

        // Inputs
        this.elements.inputs = {
          seek: getElement.call(this, this.config.selectors.inputs.seek),
          volume: getElement.call(this, this.config.selectors.inputs.volume)
        };

        // Display
        this.elements.display = {
          buffer: getElement.call(this, this.config.selectors.display.buffer),
          currentTime: getElement.call(this, this.config.selectors.display.currentTime),
          duration: getElement.call(this, this.config.selectors.display.duration)
        };

        // Seek tooltip
        if (is.element(this.elements.progress)) {
          this.elements.display.seekTooltip = this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`);
        }
        return true;
      } catch (error) {
        // Log it
        this.debug.warn('It looks like there is a problem with your custom controls HTML', error);

        // Restore native video controls
        this.toggleNativeControls(true);
        return false;
      }
    },
    // Create &lt;svg&gt; icon
    createIcon(type, attributes) {
      const namespace = 'http://www.w3.org/2000/svg';
      const iconUrl = controls.getIconUrl.call(this);
      const iconPath = `${!iconUrl.cors ? iconUrl.url : ''}#${this.config.iconPrefix}`;
      // Create &lt;svg&gt;
      const icon = document.createElementNS(namespace, 'svg');
      setAttributes(icon, extend(attributes, {
        'aria-hidden': 'true',
        focusable: 'false'
      }));

      // Create the &lt;use&gt; to reference sprite
      const use = document.createElementNS(namespace, 'use');
      const path = `${iconPath}-${type}`;

      // Set `href` attributes
      // https://github.com/sampotts/plyr/issues/460
      // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href
      if ('href' in use) {
        use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);
      }

      // Always set the older attribute even though it's "deprecated" (it'll be around for ages)
      use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path);

      // Add &lt;use&gt; to &lt;svg&gt;
      icon.appendChild(use);
      return icon;
    },
    // Create hidden text label
    createLabel(key, attr = {}) {
      const text = i18n.get(key, this.config);
      const attributes = {
        ...attr,
        class: [attr.class, this.config.classNames.hidden].filter(Boolean).join(' ')
      };
      return createElement('span', attributes, text);
    },
    // Create a badge
    createBadge(text) {
      if (is.empty(text)) {
        return null;
      }
      const badge = createElement('span', {
        class: this.config.classNames.menu.value
      });
      badge.appendChild(createElement('span', {
        class: this.config.classNames.menu.badge
      }, text));
      return badge;
    },
    // Create a &lt;button&gt;
    createButton(buttonType, attr) {
      const attributes = extend({}, attr);
      let type = toCamelCase(buttonType);
      const props = {
        element: 'button',
        toggle: false,
        label: null,
        icon: null,
        labelPressed: null,
        iconPressed: null
      };
      ['element', 'icon', 'label'].forEach(key =&gt; {
        if (Object.keys(attributes).includes(key)) {
          props[key] = attributes[key];
          delete attributes[key];
        }
      });

      // Default to 'button' type to prevent form submission
      if (props.element === 'button' &amp;&amp; !Object.keys(attributes).includes('type')) {
        attributes.type = 'button';
      }

      // Set class name
      if (Object.keys(attributes).includes('class')) {
        if (!attributes.class.split(' ').some(c =&gt; c === this.config.classNames.control)) {
          extend(attributes, {
            class: `${attributes.class} ${this.config.classNames.control}`
          });
        }
      } else {
        attributes.class = this.config.classNames.control;
      }

      // Large play button
      switch (buttonType) {
        case 'play':
          props.toggle = true;
          props.label = 'play';
          props.labelPressed = 'pause';
          props.icon = 'play';
          props.iconPressed = 'pause';
          break;
        case 'mute':
          props.toggle = true;
          props.label = 'mute';
          props.labelPressed = 'unmute';
          props.icon = 'volume';
          props.iconPressed = 'muted';
          break;
        case 'captions':
          props.toggle = true;
          props.label = 'enableCaptions';
          props.labelPressed = 'disableCaptions';
          props.icon = 'captions-off';
          props.iconPressed = 'captions-on';
          break;
        case 'fullscreen':
          props.toggle = true;
          props.label = 'enterFullscreen';
          props.labelPressed = 'exitFullscreen';
          props.icon = 'enter-fullscreen';
          props.iconPressed = 'exit-fullscreen';
          break;
        case 'play-large':
          attributes.class += ` ${this.config.classNames.control}--overlaid`;
          type = 'play';
          props.label = 'play';
          props.icon = 'play';
          break;
        default:
          if (is.empty(props.label)) {
            props.label = type;
          }
          if (is.empty(props.icon)) {
            props.icon = buttonType;
          }
      }
      const button = createElement(props.element);

      // Setup toggle icon and labels
      if (props.toggle) {
        // Icon
        button.appendChild(controls.createIcon.call(this, props.iconPressed, {
          class: 'icon--pressed'
        }));
        button.appendChild(controls.createIcon.call(this, props.icon, {
          class: 'icon--not-pressed'
        }));

        // Label/Tooltip
        button.appendChild(controls.createLabel.call(this, props.labelPressed, {
          class: 'label--pressed'
        }));
        button.appendChild(controls.createLabel.call(this, props.label, {
          class: 'label--not-pressed'
        }));
      } else {
        button.appendChild(controls.createIcon.call(this, props.icon));
        button.appendChild(controls.createLabel.call(this, props.label));
      }

      // Merge and set attributes
      extend(attributes, getAttributesFromSelector(this.config.selectors.buttons[type], attributes));
      setAttributes(button, attributes);

      // We have multiple play buttons
      if (type === 'play') {
        if (!is.array(this.elements.buttons[type])) {
          this.elements.buttons[type] = [];
        }
        this.elements.buttons[type].push(button);
      } else {
        this.elements.buttons[type] = button;
      }
      return button;
    },
    // Create an &lt;input type='range'&gt;
    createRange(type, attributes) {
      // Seek input
      const input = createElement('input', extend(getAttributesFromSelector(this.config.selectors.inputs[type]), {
        type: 'range',
        min: 0,
        max: 100,
        step: 0.01,
        value: 0,
        autocomplete: 'off',
        // A11y fixes for https://github.com/sampotts/plyr/issues/905
        role: 'slider',
        'aria-label': i18n.get(type, this.config),
        'aria-valuemin': 0,
        'aria-valuemax': 100,
        'aria-valuenow': 0
      }, attributes));
      this.elements.inputs[type] = input;

      // Set the fill for webkit now
      controls.updateRangeFill.call(this, input);

      // Improve support on touch devices
      RangeTouch.setup(input);
      return input;
    },
    // Create a &lt;progress&gt;
    createProgress(type, attributes) {
      const progress = createElement('progress', extend(getAttributesFromSelector(this.config.selectors.display[type]), {
        min: 0,
        max: 100,
        value: 0,
        role: 'progressbar',
        'aria-hidden': true
      }, attributes));

      // Create the label inside
      if (type !== 'volume') {
        progress.appendChild(createElement('span', null, '0'));
        const suffixKey = {
          played: 'played',
          buffer: 'buffered'
        }[type];
        const suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';
        progress.innerText = `% ${suffix.toLowerCase()}`;
      }
      this.elements.display[type] = progress;
      return progress;
    },
    // Create time display
    createTime(type, attrs) {
      const attributes = getAttributesFromSelector(this.config.selectors.display[type], attrs);
      const container = createElement('div', extend(attributes, {
        class: `${attributes.class ? attributes.class : ''} ${this.config.classNames.display.time} `.trim(),
        'aria-label': i18n.get(type, this.config)
      }), '00:00');

      // Reference for updates
      this.elements.display[type] = container;
      return container;
    },
    // Bind keyboard shortcuts for a menu item
    // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
    // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
    bindMenuItemShortcuts(menuItem, type) {
      // Navigate through menus via arrow keys and space
      on.call(this, menuItem, 'keydown keyup', event =&gt; {
        // We only care about space and ⬆️ ⬇️️ ➡️
        if (!['Space', 'ArrowUp', 'ArrowDown', 'ArrowRight'].includes(event.key)) {
          return;
        }

        // Prevent play / seek
        event.preventDefault();
        event.stopPropagation();

        // We're just here to prevent the keydown bubbling
        if (event.type === 'keydown') {
          return;
        }
        const isRadioButton = matches(menuItem, '[role="menuitemradio"]');

        // Show the respective menu
        if (!isRadioButton &amp;&amp; ['Space', 'ArrowRight'].includes(event.key)) {
          controls.showMenuPanel.call(this, type, true);
        } else {
          let target;
          if (event.key !== 'Space') {
            if (event.key === 'ArrowDown' || isRadioButton &amp;&amp; event.key === 'ArrowRight') {
              target = menuItem.nextElementSibling;
              if (!is.element(target)) {
                target = menuItem.parentNode.firstElementChild;
              }
            } else {
              target = menuItem.previousElementSibling;
              if (!is.element(target)) {
                target = menuItem.parentNode.lastElementChild;
              }
            }
            setFocus.call(this, target, true);
          }
        }
      }, false);

      // Enter will fire a `click` event but we still need to manage focus
      // So we bind to keyup which fires after and set focus here
      on.call(this, menuItem, 'keyup', event =&gt; {
        if (event.key !== 'Return') return;
        controls.focusFirstMenuItem.call(this, null, true);
      });
    },
    // Create a settings menu item
    createMenuItem({
      value,
      list,
      type,
      title,
      badge = null,
      checked = false
    }) {
      const attributes = getAttributesFromSelector(this.config.selectors.inputs[type]);
      const menuItem = createElement('button', extend(attributes, {
        type: 'button',
        role: 'menuitemradio',
        class: `${this.config.classNames.control} ${attributes.class ? attributes.class : ''}`.trim(),
        'aria-checked': checked,
        value
      }));
      const flex = createElement('span');

      // We have to set as HTML incase of special characters
      flex.innerHTML = title;
      if (is.element(badge)) {
        flex.appendChild(badge);
      }
      menuItem.appendChild(flex);

      // Replicate radio button behavior
      Object.defineProperty(menuItem, 'checked', {
        enumerable: true,
        get() {
          return menuItem.getAttribute('aria-checked') === 'true';
        },
        set(check) {
          // Ensure exclusivity
          if (check) {
            Array.from(menuItem.parentNode.children).filter(node =&gt; matches(node, '[role="menuitemradio"]')).forEach(node =&gt; node.setAttribute('aria-checked', 'false'));
          }
          menuItem.setAttribute('aria-checked', check ? 'true' : 'false');
        }
      });
      this.listeners.bind(menuItem, 'click keyup', event =&gt; {
        if (is.keyboardEvent(event) &amp;&amp; event.key !== 'Space') {
          return;
        }
        event.preventDefault();
        event.stopPropagation();
        menuItem.checked = true;
        switch (type) {
          case 'language':
            this.currentTrack = Number(value);
            break;
          case 'quality':
            this.quality = value;
            break;
          case 'speed':
            this.speed = parseFloat(value);
            break;
        }
        controls.showMenuPanel.call(this, 'home', is.keyboardEvent(event));
      }, type, false);
      controls.bindMenuItemShortcuts.call(this, menuItem, type);
      list.appendChild(menuItem);
    },
    // Format a time for display
    formatTime(time = 0, inverted = false) {
      // Bail if the value isn't a number
      if (!is.number(time)) {
        return time;
      }

      // Always display hours if duration is over an hour
      const forceHours = getHours(this.duration) &gt; 0;
      return formatTime(time, forceHours, inverted);
    },
    // Update the displayed time
    updateTimeDisplay(target = null, time = 0, inverted = false) {
      // Bail if there's no element to display or the value isn't a number
      if (!is.element(target) || !is.number(time)) {
        return;
      }

      // eslint-disable-next-line no-param-reassign
      target.innerText = controls.formatTime(time, inverted);
    },
    // Update volume UI and storage
    updateVolume() {
      if (!this.supported.ui) {
        return;
      }

      // Update range
      if (is.element(this.elements.inputs.volume)) {
        controls.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume);
      }

      // Update mute state
      if (is.element(this.elements.buttons.mute)) {
        this.elements.buttons.mute.pressed = this.muted || this.volume === 0;
      }
    },
    // Update seek value and lower fill
    setRange(target, value = 0) {
      if (!is.element(target)) {
        return;
      }

      // eslint-disable-next-line
      target.value = value;

      // Webkit range fill
      controls.updateRangeFill.call(this, target);
    },
    // Update &lt;progress&gt; elements
    updateProgress(event) {
      if (!this.supported.ui || !is.event(event)) {
        return;
      }
      let value = 0;
      const setProgress = (target, input) =&gt; {
        const val = is.number(input) ? input : 0;
        const progress = is.element(target) ? target : this.elements.display.buffer;

        // Update value and label
        if (is.element(progress)) {
          progress.value = val;

          // Update text label inside
          const label = progress.getElementsByTagName('span')[0];
          if (is.element(label)) {
            label.childNodes[0].nodeValue = val;
          }
        }
      };
      if (event) {
        switch (event.type) {
          // Video playing
          case 'timeupdate':
          case 'seeking':
          case 'seeked':
            value = getPercentage(this.currentTime, this.duration);

            // Set seek range value only if it's a 'natural' time event
            if (event.type === 'timeupdate') {
              controls.setRange.call(this, this.elements.inputs.seek, value);
            }
            break;

          // Check buffer status
          case 'playing':
          case 'progress':
            setProgress(this.elements.display.buffer, this.buffered * 100);
            break;
        }
      }
    },
    // Webkit polyfill for lower fill range
    updateRangeFill(target) {
      // Get range from event if event passed
      const range = is.event(target) ? target.target : target;

      // Needs to be a valid &lt;input type='range'&gt;
      if (!is.element(range) || range.getAttribute('type') !== 'range') {
        return;
      }

      // Set aria values for https://github.com/sampotts/plyr/issues/905
      if (matches(range, this.config.selectors.inputs.seek)) {
        range.setAttribute('aria-valuenow', this.currentTime);
        const currentTime = controls.formatTime(this.currentTime);
        const duration = controls.formatTime(this.duration);
        const format = i18n.get('seekLabel', this.config);
        range.setAttribute('aria-valuetext', format.replace('{currentTime}', currentTime).replace('{duration}', duration));
      } else if (matches(range, this.config.selectors.inputs.volume)) {
        const percent = range.value * 100;
        range.setAttribute('aria-valuenow', percent);
        range.setAttribute('aria-valuetext', `${percent.toFixed(1)}%`);
      } else {
        range.setAttribute('aria-valuenow', range.value);
      }

      // WebKit only
      if (!browser.isWebkit) {
        return;
      }

      // Set CSS custom property
      range.style.setProperty('--value', `${range.value / range.max * 100}%`);
    },
    // Update hover tooltip for seeking
    updateSeekTooltip(event) {
      var _this$config$markers, _this$config$markers$;
      // Bail if setting not true
      if (!this.config.tooltips.seek || !is.element(this.elements.inputs.seek) || !is.element(this.elements.display.seekTooltip) || this.duration === 0) {
        return;
      }
      const tipElement = this.elements.display.seekTooltip;
      const visible = `${this.config.classNames.tooltip}--visible`;
      const toggle = show =&gt; toggleClass(tipElement, visible, show);

      // Hide on touch
      if (this.touch) {
        toggle(false);
        return;
      }

      // Determine percentage, if already visible
      let percent = 0;
      const clientRect = this.elements.progress.getBoundingClientRect();
      if (is.event(event)) {
        percent = 100 / clientRect.width * (event.pageX - clientRect.left);
      } else if (hasClass(tipElement, visible)) {
        percent = parseFloat(tipElement.style.left, 10);
      } else {
        return;
      }

      // Set bounds
      if (percent &lt; 0) {
        percent = 0;
      } else if (percent &gt; 100) {
        percent = 100;
      }
      const time = this.duration / 100 * percent;

      // Display the time a click would seek to
      tipElement.innerText = controls.formatTime(time);

      // Get marker point for time
      const point = (_this$config$markers = this.config.markers) === null || _this$config$markers === void 0 ? void 0 : (_this$config$markers$ = _this$config$markers.points) === null || _this$config$markers$ === void 0 ? void 0 : _this$config$markers$.find(({
        time: t
      }) =&gt; t === Math.round(time));

      // Append the point label to the tooltip
      if (point) {
        tipElement.insertAdjacentHTML('afterbegin', `${point.label}&lt;br&gt;`);
      }

      // Set position
      tipElement.style.left = `${percent}%`;

      // Show/hide the tooltip
      // If the event is a moues in/out and percentage is inside bounds
      if (is.event(event) &amp;&amp; ['mouseenter', 'mouseleave'].includes(event.type)) {
        toggle(event.type === 'mouseenter');
      }
    },
    // Handle time change event
    timeUpdate(event) {
      // Only invert if only one time element is displayed and used for both duration and currentTime
      const invert = !is.element(this.elements.display.duration) &amp;&amp; this.config.invertTime;

      // Duration
      controls.updateTimeDisplay.call(this, this.elements.display.currentTime, invert ? this.duration - this.currentTime : this.currentTime, invert);

      // Ignore updates while seeking
      if (event &amp;&amp; event.type === 'timeupdate' &amp;&amp; this.media.seeking) {
        return;
      }

      // Playing progress
      controls.updateProgress.call(this, event);
    },
    // Show the duration on metadataloaded or durationchange events
    durationUpdate() {
      // Bail if no UI or durationchange event triggered after playing/seek when invertTime is false
      if (!this.supported.ui || !this.config.invertTime &amp;&amp; this.currentTime) {
        return;
      }

      // If duration is the 2**32 (shaka), Infinity (HLS), DASH-IF (Number.MAX_SAFE_INTEGER || Number.MAX_VALUE) indicating live we hide the currentTime and progressbar.
      // https://github.com/video-dev/hls.js/blob/5820d29d3c4c8a46e8b75f1e3afa3e68c1a9a2db/src/controller/buffer-controller.js#L415
      // https://github.com/google/shaka-player/blob/4d889054631f4e1cf0fbd80ddd2b71887c02e232/lib/media/streaming_engine.js#L1062
      // https://github.com/Dash-Industry-Forum/dash.js/blob/69859f51b969645b234666800d4cb596d89c602d/src/dash/models/DashManifestModel.js#L338
      if (this.duration &gt;= 2 ** 32) {
        toggleHidden(this.elements.display.currentTime, true);
        toggleHidden(this.elements.progress, true);
        return;
      }

      // Update ARIA values
      if (is.element(this.elements.inputs.seek)) {
        this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
      }

      // If there's a spot to display duration
      const hasDuration = is.element(this.elements.display.duration);

      // If there's only one time display, display duration there
      if (!hasDuration &amp;&amp; this.config.displayDuration &amp;&amp; this.paused) {
        controls.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration);
      }

      // If there's a duration element, update content
      if (hasDuration) {
        controls.updateTimeDisplay.call(this, this.elements.display.duration, this.duration);
      }
      if (this.config.markers.enabled) {
        controls.setMarkers.call(this);
      }

      // Update the tooltip (if visible)
      controls.updateSeekTooltip.call(this);
    },
    // Hide/show a tab
    toggleMenuButton(setting, toggle) {
      toggleHidden(this.elements.settings.buttons[setting], !toggle);
    },
    // Update the selected setting
    updateSetting(setting, container, input) {
      const pane = this.elements.settings.panels[setting];
      let value = null;
      let list = container;
      if (setting === 'captions') {
        value = this.currentTrack;
      } else {
        value = !is.empty(input) ? input : this[setting];

        // Get default
        if (is.empty(value)) {
          value = this.config[setting].default;
        }

        // Unsupported value
        if (!is.empty(this.options[setting]) &amp;&amp; !this.options[setting].includes(value)) {
          this.debug.warn(`Unsupported value of '${value}' for ${setting}`);
          return;
        }

        // Disabled value
        if (!this.config[setting].options.includes(value)) {
          this.debug.warn(`Disabled value of '${value}' for ${setting}`);
          return;
        }
      }

      // Get the list if we need to
      if (!is.element(list)) {
        list = pane &amp;&amp; pane.querySelector('[role="menu"]');
      }

      // If there's no list it means it's not been rendered...
      if (!is.element(list)) {
        return;
      }

      // Update the label
      const label = this.elements.settings.buttons[setting].querySelector(`.${this.config.classNames.menu.value}`);
      label.innerHTML = controls.getLabel.call(this, setting, value);

      // Find the radio option and check it
      const target = list &amp;&amp; list.querySelector(`[value="${value}"]`);
      if (is.element(target)) {
        target.checked = true;
      }
    },
    // Translate a value into a nice label
    getLabel(setting, value) {
      switch (setting) {
        case 'speed':
          return value === 1 ? i18n.get('normal', this.config) : `${value}&amp;times;`;
        case 'quality':
          if (is.number(value)) {
            const label = i18n.get(`qualityLabel.${value}`, this.config);
            if (!label.length) {
              return `${value}p`;
            }
            return label;
          }
          return toTitleCase(value);
        case 'captions':
          return captions.getLabel.call(this);
        default:
          return null;
      }
    },
    // Set the quality menu
    setQualityMenu(options) {
      // Menu required
      if (!is.element(this.elements.settings.panels.quality)) {
        return;
      }
      const type = 'quality';
      const list = this.elements.settings.panels.quality.querySelector('[role="menu"]');

      // Set options if passed and filter based on uniqueness and config
      if (is.array(options)) {
        this.options.quality = dedupe(options).filter(quality =&gt; this.config.quality.options.includes(quality));
      }

      // Toggle the pane and tab
      const toggle = !is.empty(this.options.quality) &amp;&amp; this.options.quality.length &gt; 1;
      controls.toggleMenuButton.call(this, type, toggle);

      // Empty the menu
      emptyElement(list);

      // Check if we need to toggle the parent
      controls.checkMenu.call(this);

      // If we're hiding, nothing more to do
      if (!toggle) {
        return;
      }

      // Get the badge HTML for HD, 4K etc
      const getBadge = quality =&gt; {
        const label = i18n.get(`qualityBadge.${quality}`, this.config);
        if (!label.length) {
          return null;
        }
        return controls.createBadge.call(this, label);
      };

      // Sort options by the config and then render options
      this.options.quality.sort((a, b) =&gt; {
        const sorting = this.config.quality.options;
        return sorting.indexOf(a) &gt; sorting.indexOf(b) ? 1 : -1;
      }).forEach(quality =&gt; {
        controls.createMenuItem.call(this, {
          value: quality,
          list,
          type,
          title: controls.getLabel.call(this, 'quality', quality),
          badge: getBadge(quality)
        });
      });
      controls.updateSetting.call(this, type, list);
    },
    // Set the looping options
    /* setLoopMenu() {
          // Menu required
          if (!is.element(this.elements.settings.panels.loop)) {
              return;
          }
           const options = ['start', 'end', 'all', 'reset'];
          const list = this.elements.settings.panels.loop.querySelector('[role="menu"]');
           // Show the pane and tab
          toggleHidden(this.elements.settings.buttons.loop, false);
          toggleHidden(this.elements.settings.panels.loop, false);
           // Toggle the pane and tab
          const toggle = !is.empty(this.loop.options);
          controls.toggleMenuButton.call(this, 'loop', toggle);
           // Empty the menu
          emptyElement(list);
           options.forEach(option =&gt; {
              const item = createElement('li');
               const button = createElement(
                  'button',
                  extend(getAttributesFromSelector(this.config.selectors.buttons.loop), {
                      type: 'button',
                      class: this.config.classNames.control,
                      'data-plyr-loop-action': option,
                  }),
                  i18n.get(option, this.config)
              );
               if (['start', 'end'].includes(option)) {
                  const badge = controls.createBadge.call(this, '00:00');
                  button.appendChild(badge);
              }
               item.appendChild(button);
              list.appendChild(item);
          });
      }, */

    // Get current selected caption language
    // TODO: rework this to user the getter in the API?

    // Set a list of available captions languages
    setCaptionsMenu() {
      // Menu required
      if (!is.element(this.elements.settings.panels.captions)) {
        return;
      }

      // TODO: Captions or language? Currently it's mixed
      const type = 'captions';
      const list = this.elements.settings.panels.captions.querySelector('[role="menu"]');
      const tracks = captions.getTracks.call(this);
      const toggle = Boolean(tracks.length);

      // Toggle the pane and tab
      controls.toggleMenuButton.call(this, type, toggle);

      // Empty the menu
      emptyElement(list);

      // Check if we need to toggle the parent
      controls.checkMenu.call(this);

      // If there's no captions, bail
      if (!toggle) {
        return;
      }

      // Generate options data
      const options = tracks.map((track, value) =&gt; ({
        value,
        checked: this.captions.toggled &amp;&amp; this.currentTrack === value,
        title: captions.getLabel.call(this, track),
        badge: track.language &amp;&amp; controls.createBadge.call(this, track.language.toUpperCase()),
        list,
        type: 'language'
      }));

      // Add the "Disabled" option to turn off captions
      options.unshift({
        value: -1,
        checked: !this.captions.toggled,
        title: i18n.get('disabled', this.config),
        list,
        type: 'language'
      });

      // Generate options
      options.forEach(controls.createMenuItem.bind(this));
      controls.updateSetting.call(this, type, list);
    },
    // Set a list of available captions languages
    setSpeedMenu() {
      // Menu required
      if (!is.element(this.elements.settings.panels.speed)) {
        return;
      }
      const type = 'speed';
      const list = this.elements.settings.panels.speed.querySelector('[role="menu"]');

      // Filter out invalid speeds
      this.options.speed = this.options.speed.filter(o =&gt; o &gt;= this.minimumSpeed &amp;&amp; o &lt;= this.maximumSpeed);

      // Toggle the pane and tab
      const toggle = !is.empty(this.options.speed) &amp;&amp; this.options.speed.length &gt; 1;
      controls.toggleMenuButton.call(this, type, toggle);

      // Empty the menu
      emptyElement(list);

      // Check if we need to toggle the parent
      controls.checkMenu.call(this);

      // If we're hiding, nothing more to do
      if (!toggle) {
        return;
      }

      // Create items
      this.options.speed.forEach(speed =&gt; {
        controls.createMenuItem.call(this, {
          value: speed,
          list,
          type,
          title: controls.getLabel.call(this, 'speed', speed)
        });
      });
      controls.updateSetting.call(this, type, list);
    },
    // Check if we need to hide/show the settings menu
    checkMenu() {
      const {
        buttons
      } = this.elements.settings;
      const visible = !is.empty(buttons) &amp;&amp; Object.values(buttons).some(button =&gt; !button.hidden);
      toggleHidden(this.elements.settings.menu, !visible);
    },
    // Focus the first menu item in a given (or visible) menu
    focusFirstMenuItem(pane, tabFocus = false) {
      if (this.elements.settings.popup.hidden) {
        return;
      }
      let target = pane;
      if (!is.element(target)) {
        target = Object.values(this.elements.settings.panels).find(p =&gt; !p.hidden);
      }
      const firstItem = target.querySelector('[role^="menuitem"]');
      setFocus.call(this, firstItem, tabFocus);
    },
    // Show/hide menu
    toggleMenu(input) {
      const {
        popup
      } = this.elements.settings;
      const button = this.elements.buttons.settings;

      // Menu and button are required
      if (!is.element(popup) || !is.element(button)) {
        return;
      }

      // True toggle by default
      const {
        hidden
      } = popup;
      let show = hidden;
      if (is.boolean(input)) {
        show = input;
      } else if (is.keyboardEvent(input) &amp;&amp; input.key === 'Escape') {
        show = false;
      } else if (is.event(input)) {
        // If Plyr is in a shadowDOM, the event target is set to the component, instead of the
        // Element in the shadowDOM. The path, if available, is complete.
        const target = is.function(input.composedPath) ? input.composedPath()[0] : input.target;
        const isMenuItem = popup.contains(target);

        // If the click was inside the menu or if the click
        // wasn't the button or menu item and we're trying to
        // show the menu (a doc click shouldn't show the menu)
        if (isMenuItem || !isMenuItem &amp;&amp; input.target !== button &amp;&amp; show) {
          return;
        }
      }

      // Set button attributes
      button.setAttribute('aria-expanded', show);

      // Show the actual popup
      toggleHidden(popup, !show);

      // Add class hook
      toggleClass(this.elements.container, this.config.classNames.menu.open, show);

      // Focus the first item if key interaction
      if (show &amp;&amp; is.keyboardEvent(input)) {
        controls.focusFirstMenuItem.call(this, null, true);
      } else if (!show &amp;&amp; !hidden) {
        // If closing, re-focus the button
        setFocus.call(this, button, is.keyboardEvent(input));
      }
    },
    // Get the natural size of a menu panel
    getMenuSize(tab) {
      const clone = tab.cloneNode(true);
      clone.style.position = 'absolute';
      clone.style.opacity = 0;
      clone.removeAttribute('hidden');

      // Append to parent so we get the "real" size
      tab.parentNode.appendChild(clone);

      // Get the sizes before we remove
      const width = clone.scrollWidth;
      const height = clone.scrollHeight;

      // Remove from the DOM
      removeElement(clone);
      return {
        width,
        height
      };
    },
    // Show a panel in the menu
    showMenuPanel(type = '', tabFocus = false) {
      const target = this.elements.container.querySelector(`#plyr-settings-${this.id}-${type}`);

      // Nothing to show, bail
      if (!is.element(target)) {
        return;
      }

      // Hide all other panels
      const container = target.parentNode;
      const current = Array.from(container.children).find(node =&gt; !node.hidden);

      // If we can do fancy animations, we'll animate the height/width
      if (support.transitions &amp;&amp; !support.reducedMotion) {
        // Set the current width as a base
        container.style.width = `${current.scrollWidth}px`;
        container.style.height = `${current.scrollHeight}px`;

        // Get potential sizes
        const size = controls.getMenuSize.call(this, target);

        // Restore auto height/width
        const restore = event =&gt; {
          // We're only bothered about height and width on the container
          if (event.target !== container || !['width', 'height'].includes(event.propertyName)) {
            return;
          }

          // Revert back to auto
          container.style.width = '';
          container.style.height = '';

          // Only listen once
          off.call(this, container, transitionEndEvent, restore);
        };

        // Listen for the transition finishing and restore auto height/width
        on.call(this, container, transitionEndEvent, restore);

        // Set dimensions to target
        container.style.width = `${size.width}px`;
        container.style.height = `${size.height}px`;
      }

      // Set attributes on current tab
      toggleHidden(current, true);

      // Set attributes on target
      toggleHidden(target, false);

      // Focus the first item
      controls.focusFirstMenuItem.call(this, target, tabFocus);
    },
    // Set the download URL
    setDownloadUrl() {
      const button = this.elements.buttons.download;

      // Bail if no button
      if (!is.element(button)) {
        return;
      }

      // Set attribute
      button.setAttribute('href', this.download);
    },
    // Build the default HTML
    create(data) {
      const {
        bindMenuItemShortcuts,
        createButton,
        createProgress,
        createRange,
        createTime,
        setQualityMenu,
        setSpeedMenu,
        showMenuPanel
      } = controls;
      this.elements.controls = null;

      // Larger overlaid play button
      if (is.array(this.config.controls) &amp;&amp; this.config.controls.includes('play-large')) {
        this.elements.container.appendChild(createButton.call(this, 'play-large'));
      }

      // Create the container
      const container = createElement('div', getAttributesFromSelector(this.config.selectors.controls.wrapper));
      this.elements.controls = container;

      // Default item attributes
      const defaultAttributes = {
        class: 'plyr__controls__item'
      };

      // Loop through controls in order
      dedupe(is.array(this.config.controls) ? this.config.controls : []).forEach(control =&gt; {
        // Restart button
        if (control === 'restart') {
          container.appendChild(createButton.call(this, 'restart', defaultAttributes));
        }

        // Rewind button
        if (control === 'rewind') {
          container.appendChild(createButton.call(this, 'rewind', defaultAttributes));
        }

        // Play/Pause button
        if (control === 'play') {
          container.appendChild(createButton.call(this, 'play', defaultAttributes));
        }

        // Fast forward button
        if (control === 'fast-forward') {
          container.appendChild(createButton.call(this, 'fast-forward', defaultAttributes));
        }

        // Progress
        if (control === 'progress') {
          const progressContainer = createElement('div', {
            class: `${defaultAttributes.class} plyr__progress__container`
          });
          const progress = createElement('div', getAttributesFromSelector(this.config.selectors.progress));

          // Seek range slider
          progress.appendChild(createRange.call(this, 'seek', {
            id: `plyr-seek-${data.id}`
          }));

          // Buffer progress
          progress.appendChild(createProgress.call(this, 'buffer'));

          // TODO: Add loop display indicator

          // Seek tooltip
          if (this.config.tooltips.seek) {
            const tooltip = createElement('span', {
              class: this.config.classNames.tooltip
            }, '00:00');
            progress.appendChild(tooltip);
            this.elements.display.seekTooltip = tooltip;
          }
          this.elements.progress = progress;
          progressContainer.appendChild(this.elements.progress);
          container.appendChild(progressContainer);
        }

        // Media current time display
        if (control === 'current-time') {
          container.appendChild(createTime.call(this, 'currentTime', defaultAttributes));
        }

        // Media duration display
        if (control === 'duration') {
          container.appendChild(createTime.call(this, 'duration', defaultAttributes));
        }

        // Volume controls
        if (control === 'mute' || control === 'volume') {
          let {
            volume
          } = this.elements;

          // Create the volume container if needed
          if (!is.element(volume) || !container.contains(volume)) {
            volume = createElement('div', extend({}, defaultAttributes, {
              class: `${defaultAttributes.class} plyr__volume`.trim()
            }));
            this.elements.volume = volume;
            container.appendChild(volume);
          }

          // Toggle mute button
          if (control === 'mute') {
            volume.appendChild(createButton.call(this, 'mute'));
          }

          // Volume range control
          // Ignored on iOS as it's handled globally
          // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
          if (control === 'volume' &amp;&amp; !browser.isIos) {
            // Set the attributes
            const attributes = {
              max: 1,
              step: 0.05,
              value: this.config.volume
            };

            // Create the volume range slider
            volume.appendChild(createRange.call(this, 'volume', extend(attributes, {
              id: `plyr-volume-${data.id}`
            })));
          }
        }

        // Toggle captions button
        if (control === 'captions') {
          container.appendChild(createButton.call(this, 'captions', defaultAttributes));
        }

        // Settings button / menu
        if (control === 'settings' &amp;&amp; !is.empty(this.config.settings)) {
          const wrapper = createElement('div', extend({}, defaultAttributes, {
            class: `${defaultAttributes.class} plyr__menu`.trim(),
            hidden: ''
          }));
          wrapper.appendChild(createButton.call(this, 'settings', {
            'aria-haspopup': true,
            'aria-controls': `plyr-settings-${data.id}`,
            'aria-expanded': false
          }));
          const popup = createElement('div', {
            class: 'plyr__menu__container',
            id: `plyr-settings-${data.id}`,
            hidden: ''
          });
          const inner = createElement('div');
          const home = createElement('div', {
            id: `plyr-settings-${data.id}-home`
          });

          // Create the menu
          const menu = createElement('div', {
            role: 'menu'
          });
          home.appendChild(menu);
          inner.appendChild(home);
          this.elements.settings.panels.home = home;

          // Build the menu items
          this.config.settings.forEach(type =&gt; {
            // TODO: bundle this with the createMenuItem helper and bindings
            const menuItem = createElement('button', extend(getAttributesFromSelector(this.config.selectors.buttons.settings), {
              type: 'button',
              class: `${this.config.classNames.control} ${this.config.classNames.control}--forward`,
              role: 'menuitem',
              'aria-haspopup': true,
              hidden: ''
            }));

            // Bind menu shortcuts for keyboard users
            bindMenuItemShortcuts.call(this, menuItem, type);

            // Show menu on click
            on.call(this, menuItem, 'click', () =&gt; {
              showMenuPanel.call(this, type, false);
            });
            const flex = createElement('span', null, i18n.get(type, this.config));
            const value = createElement('span', {
              class: this.config.classNames.menu.value
            });

            // Speed contains HTML entities
            value.innerHTML = data[type];
            flex.appendChild(value);
            menuItem.appendChild(flex);
            menu.appendChild(menuItem);

            // Build the panes
            const pane = createElement('div', {
              id: `plyr-settings-${data.id}-${type}`,
              hidden: ''
            });

            // Back button
            const backButton = createElement('button', {
              type: 'button',
              class: `${this.config.classNames.control} ${this.config.classNames.control}--back`
            });

            // Visible label
            backButton.appendChild(createElement('span', {
              'aria-hidden': true
            }, i18n.get(type, this.config)));

            // Screen reader label
            backButton.appendChild(createElement('span', {
              class: this.config.classNames.hidden
            }, i18n.get('menuBack', this.config)));

            // Go back via keyboard
            on.call(this, pane, 'keydown', event =&gt; {
              if (event.key !== 'ArrowLeft') return;

              // Prevent seek
              event.preventDefault();
              event.stopPropagation();

              // Show the respective menu
              showMenuPanel.call(this, 'home', true);
            }, false);

            // Go back via button click
            on.call(this, backButton, 'click', () =&gt; {
              showMenuPanel.call(this, 'home', false);
            });

            // Add to pane
            pane.appendChild(backButton);

            // Menu
            pane.appendChild(createElement('div', {
              role: 'menu'
            }));
            inner.appendChild(pane);
            this.elements.settings.buttons[type] = menuItem;
            this.elements.settings.panels[type] = pane;
          });
          popup.appendChild(inner);
          wrapper.appendChild(popup);
          container.appendChild(wrapper);
          this.elements.settings.popup = popup;
          this.elements.settings.menu = wrapper;
        }

        // Picture in picture button
        if (control === 'pip' &amp;&amp; support.pip) {
          container.appendChild(createButton.call(this, 'pip', defaultAttributes));
        }

        // Airplay button
        if (control === 'airplay' &amp;&amp; support.airplay) {
          container.appendChild(createButton.call(this, 'airplay', defaultAttributes));
        }

        // Download button
        if (control === 'download') {
          const attributes = extend({}, defaultAttributes, {
            element: 'a',
            href: this.download,
            target: '_blank'
          });

          // Set download attribute for HTML5 only
          if (this.isHTML5) {
            attributes.download = '';
          }
          const {
            download
          } = this.config.urls;
          if (!is.url(download) &amp;&amp; this.isEmbed) {
            extend(attributes, {
              icon: `logo-${this.provider}`,
              label: this.provider
            });
          }
          container.appendChild(createButton.call(this, 'download', attributes));
        }

        // Toggle fullscreen button
        if (control === 'fullscreen') {
          container.appendChild(createButton.call(this, 'fullscreen', defaultAttributes));
        }
      });

      // Set available quality levels
      if (this.isHTML5) {
        setQualityMenu.call(this, html5.getQualityOptions.call(this));
      }
      setSpeedMenu.call(this);
      return container;
    },
    // Insert controls
    inject() {
      // Sprite
      if (this.config.loadSprite) {
        const icon = controls.getIconUrl.call(this);

        // Only load external sprite using AJAX
        if (icon.cors) {
          loadSprite(icon.url, 'sprite-plyr');
        }
      }

      // Create a unique ID
      this.id = Math.floor(Math.random() * 10000);

      // Null by default
      let container = null;
      this.elements.controls = null;

      // Set template properties
      const props = {
        id: this.id,
        seektime: this.config.seekTime,
        title: this.config.title
      };
      let update = true;

      // If function, run it and use output
      if (is.function(this.config.controls)) {
        this.config.controls = this.config.controls.call(this, props);
      }

      // Convert falsy controls to empty array (primarily for empty strings)
      if (!this.config.controls) {
        this.config.controls = [];
      }
      if (is.element(this.config.controls) || is.string(this.config.controls)) {
        // HTMLElement or Non-empty string passed as the option
        container = this.config.controls;
      } else {
        // Create controls
        container = controls.create.call(this, {
          id: this.id,
          seektime: this.config.seekTime,
          speed: this.speed,
          quality: this.quality,
          captions: captions.getLabel.call(this)
          // TODO: Looping
          // loop: 'None',
        });

        update = false;
      }

      // Replace props with their value
      const replace = input =&gt; {
        let result = input;
        Object.entries(props).forEach(([key, value]) =&gt; {
          result = replaceAll(result, `{${key}}`, value);
        });
        return result;
      };

      // Update markup
      if (update) {
        if (is.string(this.config.controls)) {
          container = replace(container);
        }
      }

      // Controls container
      let target;

      // Inject to custom location
      if (is.string(this.config.selectors.controls.container)) {
        target = document.querySelector(this.config.selectors.controls.container);
      }

      // Inject into the container by default
      if (!is.element(target)) {
        target = this.elements.container;
      }

      // Inject controls HTML (needs to be before captions, hence "afterbegin")
      const insertMethod = is.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML';
      target[insertMethod]('afterbegin', container);

      // Find the elements if need be
      if (!is.element(this.elements.controls)) {
        controls.findElements.call(this);
      }

      // Add pressed property to buttons
      if (!is.empty(this.elements.buttons)) {
        const addProperty = button =&gt; {
          const className = this.config.classNames.controlPressed;
          button.setAttribute('aria-pressed', 'false');
          Object.defineProperty(button, 'pressed', {
            configurable: true,
            enumerable: true,
            get() {
              return hasClass(button, className);
            },
            set(pressed = false) {
              toggleClass(button, className, pressed);
              button.setAttribute('aria-pressed', pressed ? 'true' : 'false');
            }
          });
        };

        // Toggle classname when pressed property is set
        Object.values(this.elements.buttons).filter(Boolean).forEach(button =&gt; {
          if (is.array(button) || is.nodeList(button)) {
            Array.from(button).filter(Boolean).forEach(addProperty);
          } else {
            addProperty(button);
          }
        });
      }

      // Edge sometimes doesn't finish the paint so force a repaint
      if (browser.isEdge) {
        repaint(target);
      }

      // Setup tooltips
      if (this.config.tooltips.controls) {
        const {
          classNames,
          selectors
        } = this.config;
        const selector = `${selectors.controls.wrapper} ${selectors.labels} .${classNames.hidden}`;
        const labels = getElements.call(this, selector);
        Array.from(labels).forEach(label =&gt; {
          toggleClass(label, this.config.classNames.hidden, false);
          toggleClass(label, this.config.classNames.tooltip, true);
        });
      }
    },
    // Set media metadata
    setMediaMetadata() {
      try {
        if ('mediaSession' in navigator) {
          navigator.mediaSession.metadata = new window.MediaMetadata({
            title: this.config.mediaMetadata.title,
            artist: this.config.mediaMetadata.artist,
            album: this.config.mediaMetadata.album,
            artwork: this.config.mediaMetadata.artwork
          });
        }
      } catch (_) {
        // Do nothing
      }
    },
    // Add markers
    setMarkers() {
      var _this$config$markers2, _this$config$markers3;
      if (!this.duration || this.elements.markers) return;

      // Get valid points
      const points = (_this$config$markers2 = this.config.markers) === null || _this$config$markers2 === void 0 ? void 0 : (_this$config$markers3 = _this$config$markers2.points) === null || _this$config$markers3 === void 0 ? void 0 : _this$config$markers3.filter(({
        time
      }) =&gt; time &gt; 0 &amp;&amp; time &lt; this.duration);
      if (!(points !== null &amp;&amp; points !== void 0 &amp;&amp; points.length)) return;
      const containerFragment = document.createDocumentFragment();
      const pointsFragment = document.createDocumentFragment();
      let tipElement = null;
      const tipVisible = `${this.config.classNames.tooltip}--visible`;
      const toggleTip = show =&gt; toggleClass(tipElement, tipVisible, show);

      // Inject markers to progress container
      points.forEach(point =&gt; {
        const markerElement = createElement('span', {
          class: this.config.classNames.marker
        }, '');
        const left = `${point.time / this.duration * 100}%`;
        if (tipElement) {
          // Show on hover
          markerElement.addEventListener('mouseenter', () =&gt; {
            if (point.label) return;
            tipElement.style.left = left;
            tipElement.innerHTML = point.label;
            toggleTip(true);
          });

          // Hide on leave
          markerElement.addEventListener('mouseleave', () =&gt; {
            toggleTip(false);
          });
        }
        markerElement.addEventListener('click', () =&gt; {
          this.currentTime = point.time;
        });
        markerElement.style.left = left;
        pointsFragment.appendChild(markerElement);
      });
      containerFragment.appendChild(pointsFragment);

      // Inject a tooltip if needed
      if (!this.config.tooltips.seek) {
        tipElement = createElement('span', {
          class: this.config.classNames.tooltip
        }, '');
        containerFragment.appendChild(tipElement);
      }
      this.elements.markers = {
        points: pointsFragment,
        tip: tipElement
      };
      this.elements.progress.appendChild(containerFragment);
    }
  };

  // ==========================================================================

  /**
   * Parse a string to a URL object
   * @param {String} input - the URL to be parsed
   * @param {Boolean} safe - failsafe parsing
   */
  function parseUrl(input, safe = true) {
    let url = input;
    if (safe) {
      const parser = document.createElement('a');
      parser.href = url;
      url = parser.href;
    }
    try {
      return new URL(url);
    } catch (_) {
      return null;
    }
  }

  // Convert object to URLSearchParams
  function buildUrlParams(input) {
    const params = new URLSearchParams();
    if (is.object(input)) {
      Object.entries(input).forEach(([key, value]) =&gt; {
        params.set(key, value);
      });
    }
    return params;
  }

  // ==========================================================================
  const captions = {
    // Setup captions
    setup() {
      // Requires UI support
      if (!this.supported.ui) {
        return;
      }

      // Only Vimeo and HTML5 video supported at this point
      if (!this.isVideo || this.isYouTube || this.isHTML5 &amp;&amp; !support.textTracks) {
        // Clear menu and hide
        if (is.array(this.config.controls) &amp;&amp; this.config.controls.includes('settings') &amp;&amp; this.config.settings.includes('captions')) {
          controls.setCaptionsMenu.call(this);
        }
        return;
      }

      // Inject the container
      if (!is.element(this.elements.captions)) {
        this.elements.captions = createElement('div', getAttributesFromSelector(this.config.selectors.captions));
        this.elements.captions.setAttribute('dir', 'auto');
        insertAfter(this.elements.captions, this.elements.wrapper);
      }

      // Fix IE captions if CORS is used
      // Fetch captions and inject as blobs instead (data URIs not supported!)
      if (browser.isIE &amp;&amp; window.URL) {
        const elements = this.media.querySelectorAll('track');
        Array.from(elements).forEach(track =&gt; {
          const src = track.getAttribute('src');
          const url = parseUrl(src);
          if (url !== null &amp;&amp; url.hostname !== window.location.href.hostname &amp;&amp; ['http:', 'https:'].includes(url.protocol)) {
            fetch(src, 'blob').then(blob =&gt; {
              track.setAttribute('src', window.URL.createObjectURL(blob));
            }).catch(() =&gt; {
              removeElement(track);
            });
          }
        });
      }

      // Get and set initial data
      // The "preferred" options are not realized unless / until the wanted language has a match
      // * languages: Array of user's browser languages.
      // * language:  The language preferred by user settings or config
      // * active:    The state preferred by user settings or config
      // * toggled:   The real captions state

      const browserLanguages = navigator.languages || [navigator.language || navigator.userLanguage || 'en'];
      const languages = dedupe(browserLanguages.map(language =&gt; language.split('-')[0]));
      let language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase();

      // Use first browser language when language is 'auto'
      if (language === 'auto') {
        [language] = languages;
      }
      let active = this.storage.get('captions');
      if (!is.boolean(active)) {
        ({
          active
        } = this.config.captions);
      }
      Object.assign(this.captions, {
        toggled: false,
        active,
        language,
        languages
      });

      // Watch changes to textTracks and update captions menu
      if (this.isHTML5) {
        const trackEvents = this.config.captions.update ? 'addtrack removetrack' : 'removetrack';
        on.call(this, this.media.textTracks, trackEvents, captions.update.bind(this));
      }

      // Update available languages in list next tick (the event must not be triggered before the listeners)
      setTimeout(captions.update.bind(this), 0);
    },
    // Update available language options in settings based on tracks
    update() {
      const tracks = captions.getTracks.call(this, true);
      // Get the wanted language
      const {
        active,
        language,
        meta,
        currentTrackNode
      } = this.captions;
      const languageExists = Boolean(tracks.find(track =&gt; track.language === language));

      // Handle tracks (add event listener and "pseudo"-default)
      if (this.isHTML5 &amp;&amp; this.isVideo) {
        tracks.filter(track =&gt; !meta.get(track)).forEach(track =&gt; {
          this.debug.log('Track added', track);

          // Attempt to store if the original dom element was "default"
          meta.set(track, {
            default: track.mode === 'showing'
          });

          // Turn off native caption rendering to avoid double captions
          // Note: mode='hidden' forces a track to download. To ensure every track
          // isn't downloaded at once, only 'showing' tracks should be reassigned
          // eslint-disable-next-line no-param-reassign
          if (track.mode === 'showing') {
            // eslint-disable-next-line no-param-reassign
            track.mode = 'hidden';
          }

          // Add event listener for cue changes
          on.call(this, track, 'cuechange', () =&gt; captions.updateCues.call(this));
        });
      }

      // Update language first time it matches, or if the previous matching track was removed
      if (languageExists &amp;&amp; this.language !== language || !tracks.includes(currentTrackNode)) {
        captions.setLanguage.call(this, language);
        captions.toggle.call(this, active &amp;&amp; languageExists);
      }

      // Enable or disable captions based on track length
      if (this.elements) {
        toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is.empty(tracks));
      }

      // Update available languages in list
      if (is.array(this.config.controls) &amp;&amp; this.config.controls.includes('settings') &amp;&amp; this.config.settings.includes('captions')) {
        controls.setCaptionsMenu.call(this);
      }
    },
    // Toggle captions display
    // Used internally for the toggleCaptions method, with the passive option forced to false
    toggle(input, passive = true) {
      // If there's no full support
      if (!this.supported.ui) {
        return;
      }
      const {
        toggled
      } = this.captions; // Current state
      const activeClass = this.config.classNames.captions.active;
      // Get the next state
      // If the method is called without parameter, toggle based on current value
      const active = is.nullOrUndefined(input) ? !toggled : input;

      // Update state and trigger event
      if (active !== toggled) {
        // When passive, don't override user preferences
        if (!passive) {
          this.captions.active = active;
          this.storage.set({
            captions: active
          });
        }

        // Force language if the call isn't passive and there is no matching language to toggle to
        if (!this.language &amp;&amp; active &amp;&amp; !passive) {
          const tracks = captions.getTracks.call(this);
          const track = captions.findTrack.call(this, [this.captions.language, ...this.captions.languages], true);

          // Override user preferences to avoid switching languages if a matching track is added
          this.captions.language = track.language;

          // Set caption, but don't store in localStorage as user preference
          captions.set.call(this, tracks.indexOf(track));
          return;
        }

        // Toggle button if it's enabled
        if (this.elements.buttons.captions) {
          this.elements.buttons.captions.pressed = active;
        }

        // Add class hook
        toggleClass(this.elements.container, activeClass, active);
        this.captions.toggled = active;

        // Update settings menu
        controls.updateSetting.call(this, 'captions');

        // Trigger event (not used internally)
        triggerEvent.call(this, this.media, active ? 'captionsenabled' : 'captionsdisabled');
      }

      // Wait for the call stack to clear before setting mode='hidden'
      // on the active track - forcing the browser to download it
      setTimeout(() =&gt; {
        if (active &amp;&amp; this.captions.toggled) {
          this.captions.currentTrackNode.mode = 'hidden';
        }
      });
    },
    // Set captions by track index
    // Used internally for the currentTrack setter with the passive option forced to false
    set(index, passive = true) {
      const tracks = captions.getTracks.call(this);

      // Disable captions if setting to -1
      if (index === -1) {
        captions.toggle.call(this, false, passive);
        return;
      }
      if (!is.number(index)) {
        this.debug.warn('Invalid caption argument', index);
        return;
      }
      if (!(index in tracks)) {
        this.debug.warn('Track not found', index);
        return;
      }
      if (this.captions.currentTrack !== index) {
        this.captions.currentTrack = index;
        const track = tracks[index];
        const {
          language
        } = track || {};

        // Store reference to node for invalidation on remove
        this.captions.currentTrackNode = track;

        // Update settings menu
        controls.updateSetting.call(this, 'captions');

        // When passive, don't override user preferences
        if (!passive) {
          this.captions.language = language;
          this.storage.set({
            language
          });
        }

        // Handle Vimeo captions
        if (this.isVimeo) {
          this.embed.enableTextTrack(language);
        }

        // Trigger event
        triggerEvent.call(this, this.media, 'languagechange');
      }

      // Show captions
      captions.toggle.call(this, true, passive);
      if (this.isHTML5 &amp;&amp; this.isVideo) {
        // If we change the active track while a cue is already displayed we need to update it
        captions.updateCues.call(this);
      }
    },
    // Set captions by language
    // Used internally for the language setter with the passive option forced to false
    setLanguage(input, passive = true) {
      if (!is.string(input)) {
        this.debug.warn('Invalid language argument', input);
        return;
      }
      // Normalize
      const language = input.toLowerCase();
      this.captions.language = language;

      // Set currentTrack
      const tracks = captions.getTracks.call(this);
      const track = captions.findTrack.call(this, [language]);
      captions.set.call(this, tracks.indexOf(track), passive);
    },
    // Get current valid caption tracks
    // If update is false it will also ignore tracks without metadata
    // This is used to "freeze" the language options when captions.update is false
    getTracks(update = false) {
      // Handle media or textTracks missing or null
      const tracks = Array.from((this.media || {}).textTracks || []);
      // For HTML5, use cache instead of current tracks when it exists (if captions.update is false)
      // Filter out removed tracks and tracks that aren't captions/subtitles (for example metadata)
      return tracks.filter(track =&gt; !this.isHTML5 || update || this.captions.meta.has(track)).filter(track =&gt; ['captions', 'subtitles'].includes(track.kind));
    },
    // Match tracks based on languages and get the first
    findTrack(languages, force = false) {
      const tracks = captions.getTracks.call(this);
      const sortIsDefault = track =&gt; Number((this.captions.meta.get(track) || {}).default);
      const sorted = Array.from(tracks).sort((a, b) =&gt; sortIsDefault(b) - sortIsDefault(a));
      let track;
      languages.every(language =&gt; {
        track = sorted.find(t =&gt; t.language === language);
        return !track; // Break iteration if there is a match
      });

      // If no match is found but is required, get first
      return track || (force ? sorted[0] : undefined);
    },
    // Get the current track
    getCurrentTrack() {
      return captions.getTracks.call(this)[this.currentTrack];
    },
    // Get UI label for track
    getLabel(track) {
      let currentTrack = track;
      if (!is.track(currentTrack) &amp;&amp; support.textTracks &amp;&amp; this.captions.toggled) {
        currentTrack = captions.getCurrentTrack.call(this);
      }
      if (is.track(currentTrack)) {
        if (!is.empty(currentTrack.label)) {
          return currentTrack.label;
        }
        if (!is.empty(currentTrack.language)) {
          return track.language.toUpperCase();
        }
        return i18n.get('enabled', this.config);
      }
      return i18n.get('disabled', this.config);
    },
    // Update captions using current track's active cues
    // Also optional array argument in case there isn't any track (ex: vimeo)
    updateCues(input) {
      // Requires UI
      if (!this.supported.ui) {
        return;
      }
      if (!is.element(this.elements.captions)) {
        this.debug.warn('No captions element to render to');
        return;
      }

      // Only accept array or empty input
      if (!is.nullOrUndefined(input) &amp;&amp; !Array.isArray(input)) {
        this.debug.warn('updateCues: Invalid input', input);
        return;
      }
      let cues = input;

      // Get cues from track
      if (!cues) {
        const track = captions.getCurrentTrack.call(this);
        cues = Array.from((track || {}).activeCues || []).map(cue =&gt; cue.getCueAsHTML()).map(getHTML);
      }

      // Set new caption text
      const content = cues.map(cueText =&gt; cueText.trim()).join('\n');
      const changed = content !== this.elements.captions.innerHTML;
      if (changed) {
        // Empty the container and create a new child element
        emptyElement(this.elements.captions);
        const caption = createElement('span', getAttributesFromSelector(this.config.selectors.caption));
        caption.innerHTML = content;
        this.elements.captions.appendChild(caption);

        // Trigger event
        triggerEvent.call(this, this.media, 'cuechange');
      }
    }
  };

  // ==========================================================================
  // Plyr default config
  // ==========================================================================

  const defaults = {
    // Disable
    enabled: true,
    // Custom media title
    title: '',
    // Logging to console
    debug: false,
    // Auto play (if supported)
    autoplay: false,
    // Only allow one media playing at once (vimeo only)
    autopause: true,
    // Allow inline playback on iOS (this effects YouTube/Vimeo - HTML5 requires the attribute present)
    // TODO: Remove iosNative fullscreen option in favour of this (logic needs work)
    playsinline: true,
    // Default time to skip when rewind/fast forward
    seekTime: 10,
    // Default volume
    volume: 1,
    muted: false,
    // Pass a custom duration
    duration: null,
    // Display the media duration on load in the current time position
    // If you have opted to display both duration and currentTime, this is ignored
    displayDuration: true,
    // Invert the current time to be a countdown
    invertTime: true,
    // Clicking the currentTime inverts it's value to show time left rather than elapsed
    toggleInvert: true,
    // Force an aspect ratio
    // The format must be `'w:h'` (e.g. `'16:9'`)
    ratio: null,
    // Click video container to play/pause
    clickToPlay: true,
    // Auto hide the controls
    hideControls: true,
    // Reset to start when playback ended
    resetOnEnd: false,
    // Disable the standard context menu
    disableContextMenu: true,
    // Sprite (for icons)
    loadSprite: true,
    iconPrefix: 'plyr',
    iconUrl: 'https://cdn.plyr.io/3.7.3/plyr.svg',
    // Blank video (used to prevent errors on source change)
    blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
    // Quality default
    quality: {
      default: 576,
      // The options to display in the UI, if available for the source media
      options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
      forced: false,
      onChange: null
    },
    // Set loops
    loop: {
      active: false
      // start: null,
      // end: null,
    },

    // Speed default and options to display
    speed: {
      selected: 1,
      // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)
      options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
    },
    // Keyboard shortcut settings
    keyboard: {
      focused: true,
      global: false
    },
    // Display tooltips
    tooltips: {
      controls: false,
      seek: true
    },
    // Captions settings
    captions: {
      active: false,
      language: 'auto',
      // Listen to new tracks added after Plyr is initialized.
      // This is needed for streaming captions, but may result in unselectable options
      update: false
    },
    // Fullscreen settings
    fullscreen: {
      enabled: true,
      // Allow fullscreen?
      fallback: true,
      // Fallback using full viewport/window
      iosNative: false // Use the native fullscreen in iOS (disables custom controls)
      // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode
      // Non-ancestors of the player element will be ignored
      // container: null, // defaults to the player element
    },

    // Local storage
    storage: {
      enabled: true,
      key: 'plyr'
    },
    // Default controls
    controls: ['play-large',
    // 'restart',
    // 'rewind',
    'play',
    // 'fast-forward',
    'progress', 'current-time',
    // 'duration',
    'mute', 'volume', 'captions', 'settings', 'pip', 'airplay',
    // 'download',
    'fullscreen'],
    settings: ['captions', 'quality', 'speed'],
    // Localisation
    i18n: {
      restart: 'Restart',
      rewind: 'Rewind {seektime}s',
      play: 'Play',
      pause: 'Pause',
      fastForward: 'Forward {seektime}s',
      seek: 'Seek',
      seekLabel: '{currentTime} of {duration}',
      played: 'Played',
      buffered: 'Buffered',
      currentTime: 'Current time',
      duration: 'Duration',
      volume: 'Volume',
      mute: 'Mute',
      unmute: 'Unmute',
      enableCaptions: 'Enable captions',
      disableCaptions: 'Disable captions',
      download: 'Download',
      enterFullscreen: 'Enter fullscreen',
      exitFullscreen: 'Exit fullscreen',
      frameTitle: 'Player for {title}',
      captions: 'Captions',
      settings: 'Settings',
      pip: 'PIP',
      menuBack: 'Go back to previous menu',
      speed: 'Speed',
      normal: 'Normal',
      quality: 'Quality',
      loop: 'Loop',
      start: 'Start',
      end: 'End',
      all: 'All',
      reset: 'Reset',
      disabled: 'Disabled',
      enabled: 'Enabled',
      advertisement: 'Ad',
      qualityBadge: {
        2160: '4K',
        1440: 'HD',
        1080: 'HD',
        720: 'HD',
        576: 'SD',
        480: 'SD'
      }
    },
    // URLs
    urls: {
      download: null,
      vimeo: {
        sdk: 'https://player.vimeo.com/api/player.js',
        iframe: 'https://player.vimeo.com/video/{0}?{1}',
        api: 'https://vimeo.com/api/oembed.json?url={0}'
      },
      youtube: {
        sdk: 'https://www.youtube.com/iframe_api',
        api: 'https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}'
      },
      googleIMA: {
        sdk: 'https://imasdk.googleapis.com/js/sdkloader/ima3.js'
      }
    },
    // Custom control listeners
    listeners: {
      seek: null,
      play: null,
      pause: null,
      restart: null,
      rewind: null,
      fastForward: null,
      mute: null,
      volume: null,
      captions: null,
      download: null,
      fullscreen: null,
      pip: null,
      airplay: null,
      speed: null,
      quality: null,
      loop: null,
      language: null
    },
    // Events to watch and bubble
    events: [
    // Events to watch on HTML5 media elements and bubble
    // https://developer.mozilla.org/en/docs/Web/Guide/Events/Media_events
    'ended', 'progress', 'stalled', 'playing', 'waiting', 'canplay', 'canplaythrough', 'loadstart', 'loadeddata', 'loadedmetadata', 'timeupdate', 'volumechange', 'play', 'pause', 'error', 'seeking', 'seeked', 'emptied', 'ratechange', 'cuechange',
    // Custom events
    'download', 'enterfullscreen', 'exitfullscreen', 'captionsenabled', 'captionsdisabled', 'languagechange', 'controlshidden', 'controlsshown', 'ready',
    // YouTube
    'statechange',
    // Quality
    'qualitychange',
    // Ads
    'adsloaded', 'adscontentpause', 'adscontentresume', 'adstarted', 'adsmidpoint', 'adscomplete', 'adsallcomplete', 'adsimpression', 'adsclick'],
    // Selectors
    // Change these to match your template if using custom HTML
    selectors: {
      editable: 'input, textarea, select, [contenteditable]',
      container: '.plyr',
      controls: {
        container: null,
        wrapper: '.plyr__controls'
      },
      labels: '[data-plyr]',
      buttons: {
        play: '[data-plyr="play"]',
        pause: '[data-plyr="pause"]',
        restart: '[data-plyr="restart"]',
        rewind: '[data-plyr="rewind"]',
        fastForward: '[data-plyr="fast-forward"]',
        mute: '[data-plyr="mute"]',
        captions: '[data-plyr="captions"]',
        download: '[data-plyr="download"]',
        fullscreen: '[data-plyr="fullscreen"]',
        pip: '[data-plyr="pip"]',
        airplay: '[data-plyr="airplay"]',
        settings: '[data-plyr="settings"]',
        loop: '[data-plyr="loop"]'
      },
      inputs: {
        seek: '[data-plyr="seek"]',
        volume: '[data-plyr="volume"]',
        speed: '[data-plyr="speed"]',
        language: '[data-plyr="language"]',
        quality: '[data-plyr="quality"]'
      },
      display: {
        currentTime: '.plyr__time--current',
        duration: '.plyr__time--duration',
        buffer: '.plyr__progress__buffer',
        loop: '.plyr__progress__loop',
        // Used later
        volume: '.plyr__volume--display'
      },
      progress: '.plyr__progress',
      captions: '.plyr__captions',
      caption: '.plyr__caption'
    },
    // Class hooks added to the player in different states
    classNames: {
      type: 'plyr--{0}',
      provider: 'plyr--{0}',
      video: 'plyr__video-wrapper',
      embed: 'plyr__video-embed',
      videoFixedRatio: 'plyr__video-wrapper--fixed-ratio',
      embedContainer: 'plyr__video-embed__container',
      poster: 'plyr__poster',
      posterEnabled: 'plyr__poster-enabled',
      ads: 'plyr__ads',
      control: 'plyr__control',
      controlPressed: 'plyr__control--pressed',
      playing: 'plyr--playing',
      paused: 'plyr--paused',
      stopped: 'plyr--stopped',
      loading: 'plyr--loading',
      hover: 'plyr--hover',
      tooltip: 'plyr__tooltip',
      cues: 'plyr__cues',
      marker: 'plyr__progress__marker',
      hidden: 'plyr__sr-only',
      hideControls: 'plyr--hide-controls',
      isIos: 'plyr--is-ios',
      isTouch: 'plyr--is-touch',
      uiSupported: 'plyr--full-ui',
      noTransition: 'plyr--no-transition',
      display: {
        time: 'plyr__time'
      },
      menu: {
        value: 'plyr__menu__value',
        badge: 'plyr__badge',
        open: 'plyr--menu-open'
      },
      captions: {
        enabled: 'plyr--captions-enabled',
        active: 'plyr--captions-active'
      },
      fullscreen: {
        enabled: 'plyr--fullscreen-enabled',
        fallback: 'plyr--fullscreen-fallback'
      },
      pip: {
        supported: 'plyr--pip-supported',
        active: 'plyr--pip-active'
      },
      airplay: {
        supported: 'plyr--airplay-supported',
        active: 'plyr--airplay-active'
      },
      tabFocus: 'plyr__tab-focus',
      previewThumbnails: {
        // Tooltip thumbs
        thumbContainer: 'plyr__preview-thumb',
        thumbContainerShown: 'plyr__preview-thumb--is-shown',
        imageContainer: 'plyr__preview-thumb__image-container',
        timeContainer: 'plyr__preview-thumb__time-container',
        // Scrubbing
        scrubbingContainer: 'plyr__preview-scrubbing',
        scrubbingContainerShown: 'plyr__preview-scrubbing--is-shown'
      }
    },
    // Embed attributes
    attributes: {
      embed: {
        provider: 'data-plyr-provider',
        id: 'data-plyr-embed-id',
        hash: 'data-plyr-embed-hash'
      }
    },
    // Advertisements plugin
    // Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio
    ads: {
      enabled: false,
      publisherId: '',
      tagUrl: ''
    },
    // Preview Thumbnails plugin
    previewThumbnails: {
      enabled: false,
      src: ''
    },
    // Vimeo plugin
    vimeo: {
      byline: false,
      portrait: false,
      title: false,
      speed: true,
      transparent: false,
      // Custom settings from Plyr
      customControls: true,
      referrerPolicy: null,
      // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
      // Whether the owner of the video has a Pro or Business account
      // (which allows us to properly hide controls without CSS hacks, etc)
      premium: false
    },
    // YouTube plugin
    youtube: {
      rel: 0,
      // No related vids
      showinfo: 0,
      // Hide info
      iv_load_policy: 3,
      // Hide annotations
      modestbranding: 1,
      // Hide logos as much as possible (they still show one in the corner when paused)
      // Custom settings from Plyr
      customControls: true,
      noCookie: false // Whether to use an alternative version of YouTube without cookies
    },

    // Media Metadata
    mediaMetadata: {
      title: '',
      artist: '',
      album: '',
      artwork: []
    },
    // Markers
    markers: {
      enabled: false,
      points: []
    }
  };

  // ==========================================================================
  // Plyr states
  // ==========================================================================

  const pip = {
    active: 'picture-in-picture',
    inactive: 'inline'
  };

  // ==========================================================================
  // Plyr supported types and providers
  // ==========================================================================

  const providers = {
    html5: 'html5',
    youtube: 'youtube',
    vimeo: 'vimeo'
  };
  const types = {
    audio: 'audio',
    video: 'video'
  };

  /**
   * Get provider by URL
   * @param {String} url
   */
  function getProviderByUrl(url) {
    // YouTube
    if (/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(url)) {
      return providers.youtube;
    }

    // Vimeo
    if (/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(url)) {
      return providers.vimeo;
    }
    return null;
  }

  // ==========================================================================
  // Console wrapper
  // ==========================================================================

  const noop = () =&gt; {};
  class Console {
    constructor(enabled = false) {
      this.enabled = window.console &amp;&amp; enabled;
      if (this.enabled) {
        this.log('Debugging enabled');
      }
    }
    get log() {
      // eslint-disable-next-line no-console
      return this.enabled ? Function.prototype.bind.call(console.log, console) : noop;
    }
    get warn() {
      // eslint-disable-next-line no-console
      return this.enabled ? Function.prototype.bind.call(console.warn, console) : noop;
    }
    get error() {
      // eslint-disable-next-line no-console
      return this.enabled ? Function.prototype.bind.call(console.error, console) : noop;
    }
  }

  class Fullscreen {
    constructor(player) {
      _defineProperty$1(this, "onChange", () =&gt; {
        if (!this.enabled) {
          return;
        }

        // Update toggle button
        const button = this.player.elements.buttons.fullscreen;
        if (is.element(button)) {
          button.pressed = this.active;
        }

        // Always trigger events on the plyr / media element (not a fullscreen container) and let them bubble up
        const target = this.target === this.player.media ? this.target : this.player.elements.container;
        // Trigger an event
        triggerEvent.call(this.player, target, this.active ? 'enterfullscreen' : 'exitfullscreen', true);
      });
      _defineProperty$1(this, "toggleFallback", (toggle = false) =&gt; {
        // Store or restore scroll position
        if (toggle) {
          this.scrollPosition = {
            x: window.scrollX || 0,
            y: window.scrollY || 0
          };
        } else {
          window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
        }

        // Toggle scroll
        document.body.style.overflow = toggle ? 'hidden' : '';

        // Toggle class hook
        toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle);

        // Force full viewport on iPhone X+
        if (browser.isIos) {
          let viewport = document.head.querySelector('meta[name="viewport"]');
          const property = 'viewport-fit=cover';

          // Inject the viewport meta if required
          if (!viewport) {
            viewport = document.createElement('meta');
            viewport.setAttribute('name', 'viewport');
          }

          // Check if the property already exists
          const hasProperty = is.string(viewport.content) &amp;&amp; viewport.content.includes(property);
          if (toggle) {
            this.cleanupViewport = !hasProperty;
            if (!hasProperty) {
              viewport.content += `,${property}`;
            }
          } else if (this.cleanupViewport) {
            viewport.content = viewport.content.split(',').filter(part =&gt; part.trim() !== property).join(',');
          }
        }

        // Toggle button and fire events
        this.onChange();
      });
      _defineProperty$1(this, "trapFocus", event =&gt; {
        // Bail if iOS, not active, not the tab key
        if (browser.isIos || !this.active || event.key !== 'Tab') {
          return;
        }

        // Get the current focused element
        const focused = document.activeElement;
        const focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');
        const [first] = focusable;
        const last = focusable[focusable.length - 1];
        if (focused === last &amp;&amp; !event.shiftKey) {
          // Move focus to first element that can be tabbed if Shift isn't used
          first.focus();
          event.preventDefault();
        } else if (focused === first &amp;&amp; event.shiftKey) {
          // Move focus to last element that can be tabbed if Shift is used
          last.focus();
          event.preventDefault();
        }
      });
      _defineProperty$1(this, "update", () =&gt; {
        if (this.enabled) {
          let mode;
          if (this.forceFallback) {
            mode = 'Fallback (forced)';
          } else if (Fullscreen.native) {
            mode = 'Native';
          } else {
            mode = 'Fallback';
          }
          this.player.debug.log(`${mode} fullscreen enabled`);
        } else {
          this.player.debug.log('Fullscreen not supported and fallback disabled');
        }

        // Add styling hook to show button
        toggleClass(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled);
      });
      _defineProperty$1(this, "enter", () =&gt; {
        if (!this.enabled) {
          return;
        }

        // iOS native fullscreen doesn't need the request step
        if (browser.isIos &amp;&amp; this.player.config.fullscreen.iosNative) {
          if (this.player.isVimeo) {
            this.player.embed.requestFullscreen();
          } else {
            this.target.webkitEnterFullscreen();
          }
        } else if (!Fullscreen.native || this.forceFallback) {
          this.toggleFallback(true);
        } else if (!this.prefix) {
          this.target.requestFullscreen({
            navigationUI: 'hide'
          });
        } else if (!is.empty(this.prefix)) {
          this.target[`${this.prefix}Request${this.property}`]();
        }
      });
      _defineProperty$1(this, "exit", () =&gt; {
        if (!this.enabled) {
          return;
        }

        // iOS native fullscreen
        if (browser.isIos &amp;&amp; this.player.config.fullscreen.iosNative) {
          this.target.webkitExitFullscreen();
          silencePromise(this.player.play());
        } else if (!Fullscreen.native || this.forceFallback) {
          this.toggleFallback(false);
        } else if (!this.prefix) {
          (document.cancelFullScreen || document.exitFullscreen).call(document);
        } else if (!is.empty(this.prefix)) {
          const action = this.prefix === 'moz' ? 'Cancel' : 'Exit';
          document[`${this.prefix}${action}${this.property}`]();
        }
      });
      _defineProperty$1(this, "toggle", () =&gt; {
        if (!this.active) {
          this.enter();
        } else {
          this.exit();
        }
      });
      // Keep reference to parent
      this.player = player;

      // Get prefix
      this.prefix = Fullscreen.prefix;
      this.property = Fullscreen.property;

      // Scroll position
      this.scrollPosition = {
        x: 0,
        y: 0
      };

      // Force the use of 'full window/browser' rather than fullscreen
      this.forceFallback = player.config.fullscreen.fallback === 'force';

      // Get the fullscreen element
      // Checks container is an ancestor, defaults to null
      this.player.elements.fullscreen = player.config.fullscreen.container &amp;&amp; closest$1(this.player.elements.container, player.config.fullscreen.container);

      // Register event listeners
      // Handle event (incase user presses escape etc)
      on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : `${this.prefix}fullscreenchange`, () =&gt; {
        // TODO: Filter for target??
        this.onChange();
      });

      // Fullscreen toggle on double click
      on.call(this.player, this.player.elements.container, 'dblclick', event =&gt; {
        // Ignore double click in controls
        if (is.element(this.player.elements.controls) &amp;&amp; this.player.elements.controls.contains(event.target)) {
          return;
        }
        this.player.listeners.proxy(event, this.toggle, 'fullscreen');
      });

      // Tap focus when in fullscreen
      on.call(this, this.player.elements.container, 'keydown', event =&gt; this.trapFocus(event));

      // Update the UI
      this.update();

      // this.toggle = this.toggle.bind(this);
    }

    // Determine if native supported
    static get native() {
      return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
    }

    // If we're actually using native
    get usingNative() {
      return Fullscreen.native &amp;&amp; !this.forceFallback;
    }

    // Get the prefix for handlers
    static get prefix() {
      // No prefix
      if (is.function(document.exitFullscreen)) {
        return '';
      }

      // Check for fullscreen support by vendor prefix
      let value = '';
      const prefixes = ['webkit', 'moz', 'ms'];
      prefixes.some(pre =&gt; {
        if (is.function(document[`${pre}ExitFullscreen`]) || is.function(document[`${pre}CancelFullScreen`])) {
          value = pre;
          return true;
        }
        return false;
      });
      return value;
    }
    static get property() {
      return this.prefix === 'moz' ? 'FullScreen' : 'Fullscreen';
    }

    // Determine if fullscreen is enabled
    get enabled() {
      return (Fullscreen.native || this.player.config.fullscreen.fallback) &amp;&amp; this.player.config.fullscreen.enabled &amp;&amp; this.player.supported.ui &amp;&amp; this.player.isVideo;
    }

    // Get active state
    get active() {
      if (!this.enabled) {
        return false;
      }

      // Fallback using classname
      if (!Fullscreen.native || this.forceFallback) {
        return hasClass(this.target, this.player.config.classNames.fullscreen.fallback);
      }
      const element = !this.prefix ? this.target.getRootNode().fullscreenElement : this.target.getRootNode()[`${this.prefix}${this.property}Element`];
      return element &amp;&amp; element.shadowRoot ? element === this.target.getRootNode().host : element === this.target;
    }

    // Get target element
    get target() {
      return browser.isIos &amp;&amp; this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.fullscreen || this.player.elements.container;
    }
  }

  // ==========================================================================
  // Load image avoiding xhr/fetch CORS issues
  // Server status can't be obtained this way unfortunately, so this uses "naturalWidth" to determine if the image has loaded
  // By default it checks if it is at least 1px, but you can add a second argument to change this
  // ==========================================================================

  function loadImage(src, minWidth = 1) {
    return new Promise((resolve, reject) =&gt; {
      const image = new Image();
      const handler = () =&gt; {
        delete image.onload;
        delete image.onerror;
        (image.naturalWidth &gt;= minWidth ? resolve : reject)(image);
      };
      Object.assign(image, {
        onload: handler,
        onerror: handler,
        src
      });
    });
  }

  // ==========================================================================
  const ui = {
    addStyleHook() {
      toggleClass(this.elements.container, this.config.selectors.container.replace('.', ''), true);
      toggleClass(this.elements.container, this.config.classNames.uiSupported, this.supported.ui);
    },
    // Toggle native HTML5 media controls
    toggleNativeControls(toggle = false) {
      if (toggle &amp;&amp; this.isHTML5) {
        this.media.setAttribute('controls', '');
      } else {
        this.media.removeAttribute('controls');
      }
    },
    // Setup the UI
    build() {
      // Re-attach media element listeners
      // TODO: Use event bubbling?
      this.listeners.media();

      // Don't setup interface if no support
      if (!this.supported.ui) {
        this.debug.warn(`Basic support only for ${this.provider} ${this.type}`);

        // Restore native controls
        ui.toggleNativeControls.call(this, true);

        // Bail
        return;
      }

      // Inject custom controls if not present
      if (!is.element(this.elements.controls)) {
        // Inject custom controls
        controls.inject.call(this);

        // Re-attach control listeners
        this.listeners.controls();
      }

      // Remove native controls
      ui.toggleNativeControls.call(this);

      // Setup captions for HTML5
      if (this.isHTML5) {
        captions.setup.call(this);
      }

      // Reset volume
      this.volume = null;

      // Reset mute state
      this.muted = null;

      // Reset loop state
      this.loop = null;

      // Reset quality setting
      this.quality = null;

      // Reset speed
      this.speed = null;

      // Reset volume display
      controls.updateVolume.call(this);

      // Reset time display
      controls.timeUpdate.call(this);

      // Reset duration display
      controls.durationUpdate.call(this);

      // Update the UI
      ui.checkPlaying.call(this);

      // Check for picture-in-picture support
      toggleClass(this.elements.container, this.config.classNames.pip.supported, support.pip &amp;&amp; this.isHTML5 &amp;&amp; this.isVideo);

      // Check for airplay support
      toggleClass(this.elements.container, this.config.classNames.airplay.supported, support.airplay &amp;&amp; this.isHTML5);

      // Add iOS class
      toggleClass(this.elements.container, this.config.classNames.isIos, browser.isIos);

      // Add touch class
      toggleClass(this.elements.container, this.config.classNames.isTouch, this.touch);

      // Ready for API calls
      this.ready = true;

      // Ready event at end of execution stack
      setTimeout(() =&gt; {
        triggerEvent.call(this, this.media, 'ready');
      }, 0);

      // Set the title
      ui.setTitle.call(this);

      // Assure the poster image is set, if the property was added before the element was created
      if (this.poster) {
        ui.setPoster.call(this, this.poster, false).catch(() =&gt; {});
      }

      // Manually set the duration if user has overridden it.
      // The event listeners for it doesn't get called if preload is disabled (#701)
      if (this.config.duration) {
        controls.durationUpdate.call(this);
      }

      // Media metadata
      if (this.config.mediaMetadata) {
        controls.setMediaMetadata.call(this);
      }
    },
    // Setup aria attribute for play and iframe title
    setTitle() {
      // Find the current text
      let label = i18n.get('play', this.config);

      // If there's a media title set, use that for the label
      if (is.string(this.config.title) &amp;&amp; !is.empty(this.config.title)) {
        label += `, ${this.config.title}`;
      }

      // If there's a play button, set label
      Array.from(this.elements.buttons.play || []).forEach(button =&gt; {
        button.setAttribute('aria-label', label);
      });

      // Set iframe title
      // https://github.com/sampotts/plyr/issues/124
      if (this.isEmbed) {
        const iframe = getElement.call(this, 'iframe');
        if (!is.element(iframe)) {
          return;
        }

        // Default to media type
        const title = !is.empty(this.config.title) ? this.config.title : 'video';
        const format = i18n.get('frameTitle', this.config);
        iframe.setAttribute('title', format.replace('{title}', title));
      }
    },
    // Toggle poster
    togglePoster(enable) {
      toggleClass(this.elements.container, this.config.classNames.posterEnabled, enable);
    },
    // Set the poster image (async)
    // Used internally for the poster setter, with the passive option forced to false
    setPoster(poster, passive = true) {
      // Don't override if call is passive
      if (passive &amp;&amp; this.poster) {
        return Promise.reject(new Error('Poster already set'));
      }

      // Set property synchronously to respect the call order
      this.media.setAttribute('data-poster', poster);

      // Show the poster
      this.elements.poster.removeAttribute('hidden');

      // Wait until ui is ready
      return ready.call(this)
      // Load image
      .then(() =&gt; loadImage(poster)).catch(error =&gt; {
        // Hide poster on error unless it's been set by another call
        if (poster === this.poster) {
          ui.togglePoster.call(this, false);
        }
        // Rethrow
        throw error;
      }).then(() =&gt; {
        // Prevent race conditions
        if (poster !== this.poster) {
          throw new Error('setPoster cancelled by later call to setPoster');
        }
      }).then(() =&gt; {
        Object.assign(this.elements.poster.style, {
          backgroundImage: `url('${poster}')`,
          // Reset backgroundSize as well (since it can be set to "cover" for padded thumbnails for youtube)
          backgroundSize: ''
        });
        ui.togglePoster.call(this, true);
        return poster;
      });
    },
    // Check playing state
    checkPlaying(event) {
      // Class hooks
      toggleClass(this.elements.container, this.config.classNames.playing, this.playing);
      toggleClass(this.elements.container, this.config.classNames.paused, this.paused);
      toggleClass(this.elements.container, this.config.classNames.stopped, this.stopped);

      // Set state
      Array.from(this.elements.buttons.play || []).forEach(target =&gt; {
        Object.assign(target, {
          pressed: this.playing
        });
        target.setAttribute('aria-label', i18n.get(this.playing ? 'pause' : 'play', this.config));
      });

      // Only update controls on non timeupdate events
      if (is.event(event) &amp;&amp; event.type === 'timeupdate') {
        return;
      }

      // Toggle controls
      ui.toggleControls.call(this);
    },
    // Check if media is loading
    checkLoading(event) {
      this.loading = ['stalled', 'waiting'].includes(event.type);

      // Clear timer
      clearTimeout(this.timers.loading);

      // Timer to prevent flicker when seeking
      this.timers.loading = setTimeout(() =&gt; {
        // Update progress bar loading class state
        toggleClass(this.elements.container, this.config.classNames.loading, this.loading);

        // Update controls visibility
        ui.toggleControls.call(this);
      }, this.loading ? 250 : 0);
    },
    // Toggle controls based on state and `force` argument
    toggleControls(force) {
      const {
        controls: controlsElement
      } = this.elements;
      if (controlsElement &amp;&amp; this.config.hideControls) {
        // Don't hide controls if a touch-device user recently seeked. (Must be limited to touch devices, or it occasionally prevents desktop controls from hiding.)
        const recentTouchSeek = this.touch &amp;&amp; this.lastSeekTime + 2000 &gt; Date.now();

        // Show controls if force, loading, paused, button interaction, or recent seek, otherwise hide
        this.toggleControls(Boolean(force || this.loading || this.paused || controlsElement.pressed || controlsElement.hover || recentTouchSeek));
      }
    },
    // Migrate any custom properties from the media to the parent
    migrateStyles() {
      // Loop through values (as they are the keys when the object is spread 🤔)
      Object.values({
        ...this.media.style
      })
      // We're only fussed about Plyr specific properties
      .filter(key =&gt; !is.empty(key) &amp;&amp; is.string(key) &amp;&amp; key.startsWith('--plyr')).forEach(key =&gt; {
        // Set on the container
        this.elements.container.style.setProperty(key, this.media.style.getPropertyValue(key));

        // Clean up from media element
        this.media.style.removeProperty(key);
      });

      // Remove attribute if empty
      if (is.empty(this.media.style)) {
        this.media.removeAttribute('style');
      }
    }
  };

  class Listeners {
    constructor(_player) {
      _defineProperty$1(this, "firstTouch", () =&gt; {
        const {
          player
        } = this;
        const {
          elements
        } = player;
        player.touch = true;

        // Add touch class
        toggleClass(elements.container, player.config.classNames.isTouch, true);
      });
      _defineProperty$1(this, "setTabFocus", event =&gt; {
        const {
          player
        } = this;
        const {
          elements
        } = player;
        const {
          key,
          type,
          timeStamp
        } = event;
        clearTimeout(this.focusTimer);

        // Ignore any key other than tab
        if (type === 'keydown' &amp;&amp; key !== 'Tab') {
          return;
        }

        // Store reference to event timeStamp
        if (type === 'keydown') {
          this.lastKeyDown = timeStamp;
        }

        // Remove current classes
        const removeCurrent = () =&gt; {
          const className = player.config.classNames.tabFocus;
          const current = getElements.call(player, `.${className}`);
          toggleClass(current, className, false);
        };

        // Determine if a key was pressed to trigger this event
        const wasKeyDown = timeStamp - this.lastKeyDown &lt;= 20;

        // Ignore focus events if a key was pressed prior
        if (type === 'focus' &amp;&amp; !wasKeyDown) {
          return;
        }

        // Remove all current
        removeCurrent();

        // Delay the adding of classname until the focus has changed
        // This event fires before the focusin event
        if (type !== 'focusout') {
          this.focusTimer = setTimeout(() =&gt; {
            const focused = document.activeElement;

            // Ignore if current focus element isn't inside the player
            if (!elements.container.contains(focused)) {
              return;
            }
            toggleClass(document.activeElement, player.config.classNames.tabFocus, true);
          }, 10);
        }
      });
      _defineProperty$1(this, "global", (toggle = true) =&gt; {
        const {
          player
        } = this;

        // Keyboard shortcuts
        if (player.config.keyboard.global) {
          toggleListener.call(player, window, 'keydown keyup', this.handleKey, toggle, false);
        }

        // Click anywhere closes menu
        toggleListener.call(player, document.body, 'click', this.toggleMenu, toggle);

        // Detect touch by events
        once.call(player, document.body, 'touchstart', this.firstTouch);

        // Tab focus detection
        toggleListener.call(player, document.body, 'keydown focus blur focusout', this.setTabFocus, toggle, false, true);
      });
      _defineProperty$1(this, "container", () =&gt; {
        const {
          player
        } = this;
        const {
          config,
          elements,
          timers
        } = player;

        // Keyboard shortcuts
        if (!config.keyboard.global &amp;&amp; config.keyboard.focused) {
          on.call(player, elements.container, 'keydown keyup', this.handleKey, false);
        }

        // Toggle controls on mouse events and entering fullscreen
        on.call(player, elements.container, 'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen', event =&gt; {
          const {
            controls: controlsElement
          } = elements;

          // Remove button states for fullscreen
          if (controlsElement &amp;&amp; event.type === 'enterfullscreen') {
            controlsElement.pressed = false;
            controlsElement.hover = false;
          }

          // Show, then hide after a timeout unless another control event occurs
          const show = ['touchstart', 'touchmove', 'mousemove'].includes(event.type);
          let delay = 0;
          if (show) {
            ui.toggleControls.call(player, true);
            // Use longer timeout for touch devices
            delay = player.touch ? 3000 : 2000;
          }

          // Clear timer
          clearTimeout(timers.controls);

          // Set new timer to prevent flicker when seeking
          timers.controls = setTimeout(() =&gt; ui.toggleControls.call(player, false), delay);
        });

        // Set a gutter for Vimeo
        const setGutter = () =&gt; {
          if (!player.isVimeo || player.config.vimeo.premium) {
            return;
          }
          const target = elements.wrapper;
          const {
            active
          } = player.fullscreen;
          const [videoWidth, videoHeight] = getAspectRatio.call(player);
          const useNativeAspectRatio = supportsCSS(`aspect-ratio: ${videoWidth} / ${videoHeight}`);

          // If not active, remove styles
          if (!active) {
            if (useNativeAspectRatio) {
              target.style.width = null;
              target.style.height = null;
            } else {
              target.style.maxWidth = null;
              target.style.margin = null;
            }
            return;
          }

          // Determine which dimension will overflow and constrain view
          const [viewportWidth, viewportHeight] = getViewportSize();
          const overflow = viewportWidth / viewportHeight &gt; videoWidth / videoHeight;
          if (useNativeAspectRatio) {
            target.style.width = overflow ? 'auto' : '100%';
            target.style.height = overflow ? '100%' : 'auto';
          } else {
            target.style.maxWidth = overflow ? `${viewportHeight / videoHeight * videoWidth}px` : null;
            target.style.margin = overflow ? '0 auto' : null;
          }
        };

        // Handle resizing
        const resized = () =&gt; {
          clearTimeout(timers.resized);
          timers.resized = setTimeout(setGutter, 50);
        };
        on.call(player, elements.container, 'enterfullscreen exitfullscreen', event =&gt; {
          const {
            target
          } = player.fullscreen;

          // Ignore events not from target
          if (target !== elements.container) {
            return;
          }

          // If it's not an embed and no ratio specified
          if (!player.isEmbed &amp;&amp; is.empty(player.config.ratio)) {
            return;
          }

          // Set Vimeo gutter
          setGutter();

          // Watch for resizes
          const method = event.type === 'enterfullscreen' ? on : off;
          method.call(player, window, 'resize', resized);
        });
      });
      _defineProperty$1(this, "media", () =&gt; {
        const {
          player
        } = this;
        const {
          elements
        } = player;

        // Time change on media
        on.call(player, player.media, 'timeupdate seeking seeked', event =&gt; controls.timeUpdate.call(player, event));

        // Display duration
        on.call(player, player.media, 'durationchange loadeddata loadedmetadata', event =&gt; controls.durationUpdate.call(player, event));

        // Handle the media finishing
        on.call(player, player.media, 'ended', () =&gt; {
          // Show poster on end
          if (player.isHTML5 &amp;&amp; player.isVideo &amp;&amp; player.config.resetOnEnd) {
            // Restart
            player.restart();

            // Call pause otherwise IE11 will start playing the video again
            player.pause();
          }
        });

        // Check for buffer progress
        on.call(player, player.media, 'progress playing seeking seeked', event =&gt; controls.updateProgress.call(player, event));

        // Handle volume changes
        on.call(player, player.media, 'volumechange', event =&gt; controls.updateVolume.call(player, event));

        // Handle play/pause
        on.call(player, player.media, 'playing play pause ended emptied timeupdate', event =&gt; ui.checkPlaying.call(player, event));

        // Loading state
        on.call(player, player.media, 'waiting canplay seeked playing', event =&gt; ui.checkLoading.call(player, event));

        // Click video
        if (player.supported.ui &amp;&amp; player.config.clickToPlay &amp;&amp; !player.isAudio) {
          // Re-fetch the wrapper
          const wrapper = getElement.call(player, `.${player.config.classNames.video}`);

          // Bail if there's no wrapper (this should never happen)
          if (!is.element(wrapper)) {
            return;
          }

          // On click play, pause or restart
          on.call(player, elements.container, 'click', event =&gt; {
            const targets = [elements.container, wrapper];

            // Ignore if click if not container or in video wrapper
            if (!targets.includes(event.target) &amp;&amp; !wrapper.contains(event.target)) {
              return;
            }

            // Touch devices will just show controls (if hidden)
            if (player.touch &amp;&amp; player.config.hideControls) {
              return;
            }
            if (player.ended) {
              this.proxy(event, player.restart, 'restart');
              this.proxy(event, () =&gt; {
                silencePromise(player.play());
              }, 'play');
            } else {
              this.proxy(event, () =&gt; {
                silencePromise(player.togglePlay());
              }, 'play');
            }
          });
        }

        // Disable right click
        if (player.supported.ui &amp;&amp; player.config.disableContextMenu) {
          on.call(player, elements.wrapper, 'contextmenu', event =&gt; {
            event.preventDefault();
          }, false);
        }

        // Volume change
        on.call(player, player.media, 'volumechange', () =&gt; {
          // Save to storage
          player.storage.set({
            volume: player.volume,
            muted: player.muted
          });
        });

        // Speed change
        on.call(player, player.media, 'ratechange', () =&gt; {
          // Update UI
          controls.updateSetting.call(player, 'speed');

          // Save to storage
          player.storage.set({
            speed: player.speed
          });
        });

        // Quality change
        on.call(player, player.media, 'qualitychange', event =&gt; {
          // Update UI
          controls.updateSetting.call(player, 'quality', null, event.detail.quality);
        });

        // Update download link when ready and if quality changes
        on.call(player, player.media, 'ready qualitychange', () =&gt; {
          controls.setDownloadUrl.call(player);
        });

        // Proxy events to container
        // Bubble up key events for Edge
        const proxyEvents = player.config.events.concat(['keyup', 'keydown']).join(' ');
        on.call(player, player.media, proxyEvents, event =&gt; {
          let {
            detail = {}
          } = event;

          // Get error details from media
          if (event.type === 'error') {
            detail = player.media.error;
          }
          triggerEvent.call(player, elements.container, event.type, true, detail);
        });
      });
      _defineProperty$1(this, "proxy", (event, defaultHandler, customHandlerKey) =&gt; {
        const {
          player
        } = this;
        const customHandler = player.config.listeners[customHandlerKey];
        const hasCustomHandler = is.function(customHandler);
        let returned = true;

        // Execute custom handler
        if (hasCustomHandler) {
          returned = customHandler.call(player, event);
        }

        // Only call default handler if not prevented in custom handler
        if (returned !== false &amp;&amp; is.function(defaultHandler)) {
          defaultHandler.call(player, event);
        }
      });
      _defineProperty$1(this, "bind", (element, type, defaultHandler, customHandlerKey, passive = true) =&gt; {
        const {
          player
        } = this;
        const customHandler = player.config.listeners[customHandlerKey];
        const hasCustomHandler = is.function(customHandler);
        on.call(player, element, type, event =&gt; this.proxy(event, defaultHandler, customHandlerKey), passive &amp;&amp; !hasCustomHandler);
      });
      _defineProperty$1(this, "controls", () =&gt; {
        const {
          player
        } = this;
        const {
          elements
        } = player;
        // IE doesn't support input event, so we fallback to change
        const inputEvent = browser.isIE ? 'change' : 'input';

        // Play/pause toggle
        if (elements.buttons.play) {
          Array.from(elements.buttons.play).forEach(button =&gt; {
            this.bind(button, 'click', () =&gt; {
              silencePromise(player.togglePlay());
            }, 'play');
          });
        }

        // Pause
        this.bind(elements.buttons.restart, 'click', player.restart, 'restart');

        // Rewind
        this.bind(elements.buttons.rewind, 'click', () =&gt; {
          // Record seek time so we can prevent hiding controls for a few seconds after rewind
          player.lastSeekTime = Date.now();
          player.rewind();
        }, 'rewind');

        // Rewind
        this.bind(elements.buttons.fastForward, 'click', () =&gt; {
          // Record seek time so we can prevent hiding controls for a few seconds after fast forward
          player.lastSeekTime = Date.now();
          player.forward();
        }, 'fastForward');

        // Mute toggle
        this.bind(elements.buttons.mute, 'click', () =&gt; {
          player.muted = !player.muted;
        }, 'mute');

        // Captions toggle
        this.bind(elements.buttons.captions, 'click', () =&gt; player.toggleCaptions());

        // Download
        this.bind(elements.buttons.download, 'click', () =&gt; {
          triggerEvent.call(player, player.media, 'download');
        }, 'download');

        // Fullscreen toggle
        this.bind(elements.buttons.fullscreen, 'click', () =&gt; {
          player.fullscreen.toggle();
        }, 'fullscreen');

        // Picture-in-Picture
        this.bind(elements.buttons.pip, 'click', () =&gt; {
          player.pip = 'toggle';
        }, 'pip');

        // Airplay
        this.bind(elements.buttons.airplay, 'click', player.airplay, 'airplay');

        // Settings menu - click toggle
        this.bind(elements.buttons.settings, 'click', event =&gt; {
          // Prevent the document click listener closing the menu
          event.stopPropagation();
          event.preventDefault();
          controls.toggleMenu.call(player, event);
        }, null, false); // Can't be passive as we're preventing default

        // Settings menu - keyboard toggle
        // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
        // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
        this.bind(elements.buttons.settings, 'keyup', event =&gt; {
          if (!['Space', 'Enter'].includes(event.key)) {
            return;
          }

          // Because return triggers a click anyway, all we need to do is set focus
          if (event.key === 'Enter') {
            controls.focusFirstMenuItem.call(player, null, true);
            return;
          }

          // Prevent scroll
          event.preventDefault();

          // Prevent playing video (Firefox)
          event.stopPropagation();

          // Toggle menu
          controls.toggleMenu.call(player, event);
        }, null, false // Can't be passive as we're preventing default
        );

        // Escape closes menu
        this.bind(elements.settings.menu, 'keydown', event =&gt; {
          if (event.key === 'Escape') {
            controls.toggleMenu.call(player, event);
          }
        });

        // Set range input alternative "value", which matches the tooltip time (#954)
        this.bind(elements.inputs.seek, 'mousedown mousemove', event =&gt; {
          const rect = elements.progress.getBoundingClientRect();
          const percent = 100 / rect.width * (event.pageX - rect.left);
          event.currentTarget.setAttribute('seek-value', percent);
        });

        // Pause while seeking
        this.bind(elements.inputs.seek, 'mousedown mouseup keydown keyup touchstart touchend', event =&gt; {
          const seek = event.currentTarget;
          const attribute = 'play-on-seeked';
          if (is.keyboardEvent(event) &amp;&amp; !['ArrowLeft', 'ArrowRight'].includes(event.key)) {
            return;
          }

          // Record seek time so we can prevent hiding controls for a few seconds after seek
          player.lastSeekTime = Date.now();

          // Was playing before?
          const play = seek.hasAttribute(attribute);
          // Done seeking
          const done = ['mouseup', 'touchend', 'keyup'].includes(event.type);

          // If we're done seeking and it was playing, resume playback
          if (play &amp;&amp; done) {
            seek.removeAttribute(attribute);
            silencePromise(player.play());
          } else if (!done &amp;&amp; player.playing) {
            seek.setAttribute(attribute, '');
            player.pause();
          }
        });

        // Fix range inputs on iOS
        // Super weird iOS bug where after you interact with an &lt;input type="range"&gt;,
        // it takes over further interactions on the page. This is a hack
        if (browser.isIos) {
          const inputs = getElements.call(player, 'input[type="range"]');
          Array.from(inputs).forEach(input =&gt; this.bind(input, inputEvent, event =&gt; repaint(event.target)));
        }

        // Seek
        this.bind(elements.inputs.seek, inputEvent, event =&gt; {
          const seek = event.currentTarget;
          // If it exists, use seek-value instead of "value" for consistency with tooltip time (#954)
          let seekTo = seek.getAttribute('seek-value');
          if (is.empty(seekTo)) {
            seekTo = seek.value;
          }
          seek.removeAttribute('seek-value');
          player.currentTime = seekTo / seek.max * player.duration;
        }, 'seek');

        // Seek tooltip
        this.bind(elements.progress, 'mouseenter mouseleave mousemove', event =&gt; controls.updateSeekTooltip.call(player, event));

        // Preview thumbnails plugin
        // TODO: Really need to work on some sort of plug-in wide event bus or pub-sub for this
        this.bind(elements.progress, 'mousemove touchmove', event =&gt; {
          const {
            previewThumbnails
          } = player;
          if (previewThumbnails &amp;&amp; previewThumbnails.loaded) {
            previewThumbnails.startMove(event);
          }
        });

        // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering
        this.bind(elements.progress, 'mouseleave touchend click', () =&gt; {
          const {
            previewThumbnails
          } = player;
          if (previewThumbnails &amp;&amp; previewThumbnails.loaded) {
            previewThumbnails.endMove(false, true);
          }
        });

        // Show scrubbing preview
        this.bind(elements.progress, 'mousedown touchstart', event =&gt; {
          const {
            previewThumbnails
          } = player;
          if (previewThumbnails &amp;&amp; previewThumbnails.loaded) {
            previewThumbnails.startScrubbing(event);
          }
        });
        this.bind(elements.progress, 'mouseup touchend', event =&gt; {
          const {
            previewThumbnails
          } = player;
          if (previewThumbnails &amp;&amp; previewThumbnails.loaded) {
            previewThumbnails.endScrubbing(event);
          }
        });

        // Polyfill for lower fill in &lt;input type="range"&gt; for webkit
        if (browser.isWebkit) {
          Array.from(getElements.call(player, 'input[type="range"]')).forEach(element =&gt; {
            this.bind(element, 'input', event =&gt; controls.updateRangeFill.call(player, event.target));
          });
        }

        // Current time invert
        // Only if one time element is used for both currentTime and duration
        if (player.config.toggleInvert &amp;&amp; !is.element(elements.display.duration)) {
          this.bind(elements.display.currentTime, 'click', () =&gt; {
            // Do nothing if we're at the start
            if (player.currentTime === 0) {
              return;
            }
            player.config.invertTime = !player.config.invertTime;
            controls.timeUpdate.call(player);
          });
        }

        // Volume
        this.bind(elements.inputs.volume, inputEvent, event =&gt; {
          player.volume = event.target.value;
        }, 'volume');

        // Update controls.hover state (used for ui.toggleControls to avoid hiding when interacting)
        this.bind(elements.controls, 'mouseenter mouseleave', event =&gt; {
          elements.controls.hover = !player.touch &amp;&amp; event.type === 'mouseenter';
        });

        // Also update controls.hover state for any non-player children of fullscreen element (as above)
        if (elements.fullscreen) {
          Array.from(elements.fullscreen.children).filter(c =&gt; !c.contains(elements.container)).forEach(child =&gt; {
            this.bind(child, 'mouseenter mouseleave', event =&gt; {
              if (elements.controls) {
                elements.controls.hover = !player.touch &amp;&amp; event.type === 'mouseenter';
              }
            });
          });
        }

        // Update controls.pressed state (used for ui.toggleControls to avoid hiding when interacting)
        this.bind(elements.controls, 'mousedown mouseup touchstart touchend touchcancel', event =&gt; {
          elements.controls.pressed = ['mousedown', 'touchstart'].includes(event.type);
        });

        // Show controls when they receive focus (e.g., when using keyboard tab key)
        this.bind(elements.controls, 'focusin', () =&gt; {
          const {
            config,
            timers
          } = player;

          // Skip transition to prevent focus from scrolling the parent element
          toggleClass(elements.controls, config.classNames.noTransition, true);

          // Toggle
          ui.toggleControls.call(player, true);

          // Restore transition
          setTimeout(() =&gt; {
            toggleClass(elements.controls, config.classNames.noTransition, false);
          }, 0);

          // Delay a little more for mouse users
          const delay = this.touch ? 3000 : 4000;

          // Clear timer
          clearTimeout(timers.controls);

          // Hide again after delay
          timers.controls = setTimeout(() =&gt; ui.toggleControls.call(player, false), delay);
        });

        // Mouse wheel for volume
        this.bind(elements.inputs.volume, 'wheel', event =&gt; {
          // Detect "natural" scroll - supported on OS X Safari only
          // Other browsers on OS X will be inverted until support improves
          const inverted = event.webkitDirectionInvertedFromDevice;
          // Get delta from event. Invert if `inverted` is true
          const [x, y] = [event.deltaX, -event.deltaY].map(value =&gt; inverted ? -value : value);
          // Using the biggest delta, normalize to 1 or -1 (or 0 if no delta)
          const direction = Math.sign(Math.abs(x) &gt; Math.abs(y) ? x : y);

          // Change the volume by 2%
          player.increaseVolume(direction / 50);

          // Don't break page scrolling at max and min
          const {
            volume
          } = player.media;
          if (direction === 1 &amp;&amp; volume &lt; 1 || direction === -1 &amp;&amp; volume &gt; 0) {
            event.preventDefault();
          }
        }, 'volume', false);
      });
      this.player = _player;
      this.lastKey = null;
      this.focusTimer = null;
      this.lastKeyDown = null;
      this.handleKey = this.handleKey.bind(this);
      this.toggleMenu = this.toggleMenu.bind(this);
      this.setTabFocus = this.setTabFocus.bind(this);
      this.firstTouch = this.firstTouch.bind(this);
    }

    // Handle key presses
    handleKey(event) {
      const {
        player
      } = this;
      const {
        elements
      } = player;
      const {
        key,
        type,
        altKey,
        ctrlKey,
        metaKey,
        shiftKey
      } = event;
      const pressed = type === 'keydown';
      const repeat = pressed &amp;&amp; key === this.lastKey;

      // Bail if a modifier key is set
      if (altKey || ctrlKey || metaKey || shiftKey) {
        return;
      }

      // If the event is bubbled from the media element
      // Firefox doesn't get the key for whatever reason
      if (!key) {
        return;
      }

      // Seek by increment
      const seekByIncrement = increment =&gt; {
        // Divide the max duration into 10th's and times by the number value
        player.currentTime = player.duration / 10 * increment;
      };

      // Handle the key on keydown
      // Reset on keyup
      if (pressed) {
        // Check focused element
        // and if the focused element is not editable (e.g. text input)
        // and any that accept key input http://webaim.org/techniques/keyboard/
        const focused = document.activeElement;
        if (is.element(focused)) {
          const {
            editable
          } = player.config.selectors;
          const {
            seek
          } = elements.inputs;
          if (focused !== seek &amp;&amp; matches(focused, editable)) {
            return;
          }
          if (event.key === 'Space' &amp;&amp; matches(focused, 'button, [role^="menuitem"]')) {
            return;
          }
        }

        // Which keys should we prevent default
        const preventDefault = ['Space', 'ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'c', 'f', 'k', 'l', 'm'];

        // If the key is found prevent default (e.g. prevent scrolling for arrows)
        if (preventDefault.includes(key)) {
          event.preventDefault();
          event.stopPropagation();
        }
        switch (key) {
          case '0':
          case '1':
          case '2':
          case '3':
          case '4':
          case '5':
          case '6':
          case '7':
          case '8':
          case '9':
            if (!repeat) {
              seekByIncrement(parseInt(key, 10));
            }
            break;
          case 'Space':
          case 'k':
            if (!repeat) {
              silencePromise(player.togglePlay());
            }
            break;
          case 'ArrowUp':
            player.increaseVolume(0.1);
            break;
          case 'ArrowDown':
            player.decreaseVolume(0.1);
            break;
          case 'm':
            if (!repeat) {
              player.muted = !player.muted;
            }
            break;
          case 'ArrowRight':
            player.forward();
            break;
          case 'ArrowLeft':
            player.rewind();
            break;
          case 'f':
            player.fullscreen.toggle();
            break;
          case 'c':
            if (!repeat) {
              player.toggleCaptions();
            }
            break;
          case 'l':
            player.loop = !player.loop;
            break;
        }

        // Escape is handle natively when in full screen
        // So we only need to worry about non native
        if (key === 'Escape' &amp;&amp; !player.fullscreen.usingNative &amp;&amp; player.fullscreen.active) {
          player.fullscreen.toggle();
        }

        // Store last key for next cycle
        this.lastKey = key;
      } else {
        this.lastKey = null;
      }
    }

    // Toggle menu
    toggleMenu(event) {
      controls.toggleMenu.call(this.player, event);
    }

    // Device is touch enabled
  }

  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

  function createCommonjsModule(fn, module) {
  	return module = { exports: {} }, fn(module, module.exports), module.exports;
  }

  var loadjs_umd = createCommonjsModule(function (module, exports) {
    (function (root, factory) {
      {
        module.exports = factory();
      }
    })(commonjsGlobal, function () {
      /**
       * Global dependencies.
       * @global {Object} document - DOM
       */

      var devnull = function () {},
        bundleIdCache = {},
        bundleResultCache = {},
        bundleCallbackQueue = {};

      /**
       * Subscribe to bundle load event.
       * @param {string[]} bundleIds - Bundle ids
       * @param {Function} callbackFn - The callback function
       */
      function subscribe(bundleIds, callbackFn) {
        // listify
        bundleIds = bundleIds.push ? bundleIds : [bundleIds];
        var depsNotFound = [],
          i = bundleIds.length,
          numWaiting = i,
          fn,
          bundleId,
          r,
          q;

        // define callback function
        fn = function (bundleId, pathsNotFound) {
          if (pathsNotFound.length) depsNotFound.push(bundleId);
          numWaiting--;
          if (!numWaiting) callbackFn(depsNotFound);
        };

        // register callback
        while (i--) {
          bundleId = bundleIds[i];

          // execute callback if in result cache
          r = bundleResultCache[bundleId];
          if (r) {
            fn(bundleId, r);
            continue;
          }

          // add to callback queue
          q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || [];
          q.push(fn);
        }
      }

      /**
       * Publish bundle load event.
       * @param {string} bundleId - Bundle id
       * @param {string[]} pathsNotFound - List of files not found
       */
      function publish(bundleId, pathsNotFound) {
        // exit if id isn't defined
        if (!bundleId) return;
        var q = bundleCallbackQueue[bundleId];

        // cache result
        bundleResultCache[bundleId] = pathsNotFound;

        // exit if queue is empty
        if (!q) return;

        // empty callback queue
        while (q.length) {
          q[0](bundleId, pathsNotFound);
          q.splice(0, 1);
        }
      }

      /**
       * Execute callbacks.
       * @param {Object or Function} args - The callback args
       * @param {string[]} depsNotFound - List of dependencies not found
       */
      function executeCallbacks(args, depsNotFound) {
        // accept function as argument
        if (args.call) args = {
          success: args
        };

        // success and error callbacks
        if (depsNotFound.length) (args.error || devnull)(depsNotFound);else (args.success || devnull)(args);
      }

      /**
       * Load individual file.
       * @param {string} path - The file path
       * @param {Function} callbackFn - The callback function
       */
      function loadFile(path, callbackFn, args, numTries) {
        var doc = document,
          async = args.async,
          maxTries = (args.numRetries || 0) + 1,
          beforeCallbackFn = args.before || devnull,
          pathname = path.replace(/[\?|#].*$/, ''),
          pathStripped = path.replace(/^(css|img)!/, ''),
          isLegacyIECss,
          e;
        numTries = numTries || 0;
        if (/(^css!|\.css$)/.test(pathname)) {
          // css
          e = doc.createElement('link');
          e.rel = 'stylesheet';
          e.href = pathStripped;

          // tag IE9+
          isLegacyIECss = 'hideFocus' in e;

          // use preload in IE Edge (to detect load errors)
          if (isLegacyIECss &amp;&amp; e.relList) {
            isLegacyIECss = 0;
            e.rel = 'preload';
            e.as = 'style';
          }
        } else if (/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(pathname)) {
          // image
          e = doc.createElement('img');
          e.src = pathStripped;
        } else {
          // javascript
          e = doc.createElement('script');
          e.src = path;
          e.async = async === undefined ? true : async;
        }
        e.onload = e.onerror = e.onbeforeload = function (ev) {
          var result = ev.type[0];

          // treat empty stylesheets as failures to get around lack of onerror
          // support in IE9-11
          if (isLegacyIECss) {
            try {
              if (!e.sheet.cssText.length) result = 'e';
            } catch (x) {
              // sheets objects created from load errors don't allow access to
              // `cssText` (unless error is Code:18 SecurityError)
              if (x.code != 18) result = 'e';
            }
          }

          // handle retries in case of load failure
          if (result == 'e') {
            // increment counter
            numTries += 1;

            // exit function and try again
            if (numTries &lt; maxTries) {
              return loadFile(path, callbackFn, args, numTries);
            }
          } else if (e.rel == 'preload' &amp;&amp; e.as == 'style') {
            // activate preloaded stylesheets
            return e.rel = 'stylesheet'; // jshint ignore:line
          }

          // execute callback
          callbackFn(path, result, ev.defaultPrevented);
        };

        // add to document (unless callback returns `false`)
        if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e);
      }

      /**
       * Load multiple files.
       * @param {string[]} paths - The file paths
       * @param {Function} callbackFn - The callback function
       */
      function loadFiles(paths, callbackFn, args) {
        // listify paths
        paths = paths.push ? paths : [paths];
        var numWaiting = paths.length,
          x = numWaiting,
          pathsNotFound = [],
          fn,
          i;

        // define callback function
        fn = function (path, result, defaultPrevented) {
          // handle error
          if (result == 'e') pathsNotFound.push(path);

          // handle beforeload event. If defaultPrevented then that means the load
          // will be blocked (ex. Ghostery/ABP on Safari)
          if (result == 'b') {
            if (defaultPrevented) pathsNotFound.push(path);else return;
          }
          numWaiting--;
          if (!numWaiting) callbackFn(pathsNotFound);
        };

        // load scripts
        for (i = 0; i &lt; x; i++) loadFile(paths[i], fn, args);
      }

      /**
       * Initiate script load and register bundle.
       * @param {(string|string[])} paths - The file paths
       * @param {(string|Function|Object)} [arg1] - The (1) bundleId or (2) success
       *   callback or (3) object literal with success/error arguments, numRetries,
       *   etc.
       * @param {(Function|Object)} [arg2] - The (1) success callback or (2) object
       *   literal with success/error arguments, numRetries, etc.
       */
      function loadjs(paths, arg1, arg2) {
        var bundleId, args;

        // bundleId (if string)
        if (arg1 &amp;&amp; arg1.trim) bundleId = arg1;

        // args (default is {})
        args = (bundleId ? arg2 : arg1) || {};

        // throw error if bundle is already defined
        if (bundleId) {
          if (bundleId in bundleIdCache) {
            throw "LoadJS";
          } else {
            bundleIdCache[bundleId] = true;
          }
        }
        function loadFn(resolve, reject) {
          loadFiles(paths, function (pathsNotFound) {
            // execute callbacks
            executeCallbacks(args, pathsNotFound);

            // resolve Promise
            if (resolve) {
              executeCallbacks({
                success: resolve,
                error: reject
              }, pathsNotFound);
            }

            // publish bundle load event
            publish(bundleId, pathsNotFound);
          }, args);
        }
        if (args.returnPromise) return new Promise(loadFn);else loadFn();
      }

      /**
       * Execute callbacks when dependencies have been satisfied.
       * @param {(string|string[])} deps - List of bundle ids
       * @param {Object} args - success/error arguments
       */
      loadjs.ready = function ready(deps, args) {
        // subscribe to bundle load event
        subscribe(deps, function (depsNotFound) {
          // execute callbacks
          executeCallbacks(args, depsNotFound);
        });
        return loadjs;
      };

      /**
       * Manually satisfy bundle dependencies.
       * @param {string} bundleId - The bundle id
       */
      loadjs.done = function done(bundleId) {
        publish(bundleId, []);
      };

      /**
       * Reset loadjs dependencies statuses
       */
      loadjs.reset = function reset() {
        bundleIdCache = {};
        bundleResultCache = {};
        bundleCallbackQueue = {};
      };

      /**
       * Determine if bundle has already been defined
       * @param String} bundleId - The bundle id
       */
      loadjs.isDefined = function isDefined(bundleId) {
        return bundleId in bundleIdCache;
      };

      // export
      return loadjs;
    });
  });

  // ==========================================================================
  function loadScript(url) {
    return new Promise((resolve, reject) =&gt; {
      loadjs_umd(url, {
        success: resolve,
        error: reject
      });
    });
  }

  // ==========================================================================

  // Parse Vimeo ID from URL
  function parseId$1(url) {
    if (is.empty(url)) {
      return null;
    }
    if (is.number(Number(url))) {
      return url;
    }
    const regex = /^.*(vimeo.com\/|video\/)(\d+).*/;
    return url.match(regex) ? RegExp.$2 : url;
  }

  // Try to extract a hash for private videos from the URL
  function parseHash(url) {
    /* This regex matches a hexadecimal hash if given in any of these forms:
     *  - [https://player.]vimeo.com/video/{id}/{hash}[?params]
     *  - [https://player.]vimeo.com/video/{id}?h={hash}[&amp;params]
     *  - [https://player.]vimeo.com/video/{id}?[params]&amp;h={hash}
     *  - video/{id}/{hash}
     * If matched, the hash is available in capture group 4
     */
    const regex = /^.*(vimeo.com\/|video\/)(\d+)(\?.*&amp;*h=|\/)+([\d,a-f]+)/;
    const found = url.match(regex);
    return found &amp;&amp; found.length === 5 ? found[4] : null;
  }

  // Set playback state and trigger change (only on actual change)
  function assurePlaybackState$1(play) {
    if (play &amp;&amp; !this.embed.hasPlayed) {
      this.embed.hasPlayed = true;
    }
    if (this.media.paused === play) {
      this.media.paused = !play;
      triggerEvent.call(this, this.media, play ? 'play' : 'pause');
    }
  }
  const vimeo = {
    setup() {
      const player = this;

      // Add embed class for responsive
      toggleClass(player.elements.wrapper, player.config.classNames.embed, true);

      // Set speed options from config
      player.options.speed = player.config.speed.options;

      // Set intial ratio
      setAspectRatio.call(player);

      // Load the SDK if not already
      if (!is.object(window.Vimeo)) {
        loadScript(player.config.urls.vimeo.sdk).then(() =&gt; {
          vimeo.ready.call(player);
        }).catch(error =&gt; {
          player.debug.warn('Vimeo SDK (player.js) failed to load', error);
        });
      } else {
        vimeo.ready.call(player);
      }
    },
    // API Ready
    ready() {
      const player = this;
      const config = player.config.vimeo;
      const {
        premium,
        referrerPolicy,
        ...frameParams
      } = config;
      // Get the source URL or ID
      let source = player.media.getAttribute('src');
      let hash = '';
      // Get from &lt;div&gt; if needed
      if (is.empty(source)) {
        source = player.media.getAttribute(player.config.attributes.embed.id);
        // hash can also be set as attribute on the &lt;div&gt;
        hash = player.media.getAttribute(player.config.attributes.embed.hash);
      } else {
        hash = parseHash(source);
      }
      const hashParam = hash ? {
        h: hash
      } : {};

      // If the owner has a pro or premium account then we can hide controls etc
      if (premium) {
        Object.assign(frameParams, {
          controls: false,
          sidedock: false
        });
      }

      // Get Vimeo params for the iframe
      const params = buildUrlParams({
        loop: player.config.loop.active,
        autoplay: player.autoplay,
        muted: player.muted,
        gesture: 'media',
        playsinline: !this.config.fullscreen.iosNative,
        // hash has to be added to iframe-URL
        ...hashParam,
        ...frameParams
      });
      const id = parseId$1(source);
      // Build an iframe
      const iframe = createElement('iframe');
      const src = format(player.config.urls.vimeo.iframe, id, params);
      iframe.setAttribute('src', src);
      iframe.setAttribute('allowfullscreen', '');
      iframe.setAttribute('allow', ['autoplay', 'fullscreen', 'picture-in-picture', 'encrypted-media', 'accelerometer', 'gyroscope'].join('; '));

      // Set the referrer policy if required
      if (!is.empty(referrerPolicy)) {
        iframe.setAttribute('referrerPolicy', referrerPolicy);
      }

      // Inject the package
      if (premium || !config.customControls) {
        iframe.setAttribute('data-poster', player.poster);
        player.media = replaceElement(iframe, player.media);
      } else {
        const wrapper = createElement('div', {
          class: player.config.classNames.embedContainer,
          'data-poster': player.poster
        });
        wrapper.appendChild(iframe);
        player.media = replaceElement(wrapper, player.media);
      }

      // Get poster image
      if (!config.customControls) {
        fetch(format(player.config.urls.vimeo.api, src)).then(response =&gt; {
          if (is.empty(response) || !response.thumbnail_url) {
            return;
          }

          // Set and show poster
          ui.setPoster.call(player, response.thumbnail_url).catch(() =&gt; {});
        });
      }

      // Setup instance
      // https://github.com/vimeo/player.js
      player.embed = new window.Vimeo.Player(iframe, {
        autopause: player.config.autopause,
        muted: player.muted
      });
      player.media.paused = true;
      player.media.currentTime = 0;

      // Disable native text track rendering
      if (player.supported.ui) {
        player.embed.disableTextTrack();
      }

      // Create a faux HTML5 API using the Vimeo API
      player.media.play = () =&gt; {
        assurePlaybackState$1.call(player, true);
        return player.embed.play();
      };
      player.media.pause = () =&gt; {
        assurePlaybackState$1.call(player, false);
        return player.embed.pause();
      };
      player.media.stop = () =&gt; {
        player.pause();
        player.currentTime = 0;
      };

      // Seeking
      let {
        currentTime
      } = player.media;
      Object.defineProperty(player.media, 'currentTime', {
        get() {
          return currentTime;
        },
        set(time) {
          // Vimeo will automatically play on seek if the video hasn't been played before

          // Get current paused state and volume etc
          const {
            embed,
            media,
            paused,
            volume
          } = player;
          const restorePause = paused &amp;&amp; !embed.hasPlayed;

          // Set seeking state and trigger event
          media.seeking = true;
          triggerEvent.call(player, media, 'seeking');

          // If paused, mute until seek is complete
          Promise.resolve(restorePause &amp;&amp; embed.setVolume(0))
          // Seek
          .then(() =&gt; embed.setCurrentTime(time))
          // Restore paused
          .then(() =&gt; restorePause &amp;&amp; embed.pause())
          // Restore volume
          .then(() =&gt; restorePause &amp;&amp; embed.setVolume(volume)).catch(() =&gt; {
            // Do nothing
          });
        }
      });

      // Playback speed
      let speed = player.config.speed.selected;
      Object.defineProperty(player.media, 'playbackRate', {
        get() {
          return speed;
        },
        set(input) {
          player.embed.setPlaybackRate(input).then(() =&gt; {
            speed = input;
            triggerEvent.call(player, player.media, 'ratechange');
          }).catch(() =&gt; {
            // Cannot set Playback Rate, Video is probably not on Pro account
            player.options.speed = [1];
          });
        }
      });

      // Volume
      let {
        volume
      } = player.config;
      Object.defineProperty(player.media, 'volume', {
        get() {
          return volume;
        },
        set(input) {
          player.embed.setVolume(input).then(() =&gt; {
            volume = input;
            triggerEvent.call(player, player.media, 'volumechange');
          });
        }
      });

      // Muted
      let {
        muted
      } = player.config;
      Object.defineProperty(player.media, 'muted', {
        get() {
          return muted;
        },
        set(input) {
          const toggle = is.boolean(input) ? input : false;
          player.embed.setVolume(toggle ? 0 : player.config.volume).then(() =&gt; {
            muted = toggle;
            triggerEvent.call(player, player.media, 'volumechange');
          });
        }
      });

      // Loop
      let {
        loop
      } = player.config;
      Object.defineProperty(player.media, 'loop', {
        get() {
          return loop;
        },
        set(input) {
          const toggle = is.boolean(input) ? input : player.config.loop.active;
          player.embed.setLoop(toggle).then(() =&gt; {
            loop = toggle;
          });
        }
      });

      // Source
      let currentSrc;
      player.embed.getVideoUrl().then(value =&gt; {
        currentSrc = value;
        controls.setDownloadUrl.call(player);
      }).catch(error =&gt; {
        this.debug.warn(error);
      });
      Object.defineProperty(player.media, 'currentSrc', {
        get() {
          return currentSrc;
        }
      });

      // Ended
      Object.defineProperty(player.media, 'ended', {
        get() {
          return player.currentTime === player.duration;
        }
      });

      // Set aspect ratio based on video size
      Promise.all([player.embed.getVideoWidth(), player.embed.getVideoHeight()]).then(dimensions =&gt; {
        const [width, height] = dimensions;
        player.embed.ratio = roundAspectRatio(width, height);
        setAspectRatio.call(this);
      });

      // Set autopause
      player.embed.setAutopause(player.config.autopause).then(state =&gt; {
        player.config.autopause = state;
      });

      // Get title
      player.embed.getVideoTitle().then(title =&gt; {
        player.config.title = title;
        ui.setTitle.call(this);
      });

      // Get current time
      player.embed.getCurrentTime().then(value =&gt; {
        currentTime = value;
        triggerEvent.call(player, player.media, 'timeupdate');
      });

      // Get duration
      player.embed.getDuration().then(value =&gt; {
        player.media.duration = value;
        triggerEvent.call(player, player.media, 'durationchange');
      });

      // Get captions
      player.embed.getTextTracks().then(tracks =&gt; {
        player.media.textTracks = tracks;
        captions.setup.call(player);
      });
      player.embed.on('cuechange', ({
        cues = []
      }) =&gt; {
        const strippedCues = cues.map(cue =&gt; stripHTML(cue.text));
        captions.updateCues.call(player, strippedCues);
      });
      player.embed.on('loaded', () =&gt; {
        // Assure state and events are updated on autoplay
        player.embed.getPaused().then(paused =&gt; {
          assurePlaybackState$1.call(player, !paused);
          if (!paused) {
            triggerEvent.call(player, player.media, 'playing');
          }
        });
        if (is.element(player.embed.element) &amp;&amp; player.supported.ui) {
          const frame = player.embed.element;

          // Fix keyboard focus issues
          // https://github.com/sampotts/plyr/issues/317
          frame.setAttribute('tabindex', -1);
        }
      });
      player.embed.on('bufferstart', () =&gt; {
        triggerEvent.call(player, player.media, 'waiting');
      });
      player.embed.on('bufferend', () =&gt; {
        triggerEvent.call(player, player.media, 'playing');
      });
      player.embed.on('play', () =&gt; {
        assurePlaybackState$1.call(player, true);
        triggerEvent.call(player, player.media, 'playing');
      });
      player.embed.on('pause', () =&gt; {
        assurePlaybackState$1.call(player, false);
      });
      player.embed.on('timeupdate', data =&gt; {
        player.media.seeking = false;
        currentTime = data.seconds;
        triggerEvent.call(player, player.media, 'timeupdate');
      });
      player.embed.on('progress', data =&gt; {
        player.media.buffered = data.percent;
        triggerEvent.call(player, player.media, 'progress');

        // Check all loaded
        if (parseInt(data.percent, 10) === 1) {
          triggerEvent.call(player, player.media, 'canplaythrough');
        }

        // Get duration as if we do it before load, it gives an incorrect value
        // https://github.com/sampotts/plyr/issues/891
        player.embed.getDuration().then(value =&gt; {
          if (value !== player.media.duration) {
            player.media.duration = value;
            triggerEvent.call(player, player.media, 'durationchange');
          }
        });
      });
      player.embed.on('seeked', () =&gt; {
        player.media.seeking = false;
        triggerEvent.call(player, player.media, 'seeked');
      });
      player.embed.on('ended', () =&gt; {
        player.media.paused = true;
        triggerEvent.call(player, player.media, 'ended');
      });
      player.embed.on('error', detail =&gt; {
        player.media.error = detail;
        triggerEvent.call(player, player.media, 'error');
      });

      // Rebuild UI
      if (config.customControls) {
        setTimeout(() =&gt; ui.build.call(player), 0);
      }
    }
  };

  // ==========================================================================

  // Parse YouTube ID from URL
  function parseId(url) {
    if (is.empty(url)) {
      return null;
    }
    const regex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&amp;v=)([^#&amp;?]*).*/;
    return url.match(regex) ? RegExp.$2 : url;
  }

  // Set playback state and trigger change (only on actual change)
  function assurePlaybackState(play) {
    if (play &amp;&amp; !this.embed.hasPlayed) {
      this.embed.hasPlayed = true;
    }
    if (this.media.paused === play) {
      this.media.paused = !play;
      triggerEvent.call(this, this.media, play ? 'play' : 'pause');
    }
  }
  function getHost(config) {
    if (config.noCookie) {
      return 'https://www.youtube-nocookie.com';
    }
    if (window.location.protocol === 'http:') {
      return 'http://www.youtube.com';
    }

    // Use YouTube's default
    return undefined;
  }
  const youtube = {
    setup() {
      // Add embed class for responsive
      toggleClass(this.elements.wrapper, this.config.classNames.embed, true);

      // Setup API
      if (is.object(window.YT) &amp;&amp; is.function(window.YT.Player)) {
        youtube.ready.call(this);
      } else {
        // Reference current global callback
        const callback = window.onYouTubeIframeAPIReady;

        // Set callback to process queue
        window.onYouTubeIframeAPIReady = () =&gt; {
          // Call global callback if set
          if (is.function(callback)) {
            callback();
          }
          youtube.ready.call(this);
        };

        // Load the SDK
        loadScript(this.config.urls.youtube.sdk).catch(error =&gt; {
          this.debug.warn('YouTube API failed to load', error);
        });
      }
    },
    // Get the media title
    getTitle(videoId) {
      const url = format(this.config.urls.youtube.api, videoId);
      fetch(url).then(data =&gt; {
        if (is.object(data)) {
          const {
            title,
            height,
            width
          } = data;

          // Set title
          this.config.title = title;
          ui.setTitle.call(this);

          // Set aspect ratio
          this.embed.ratio = roundAspectRatio(width, height);
        }
        setAspectRatio.call(this);
      }).catch(() =&gt; {
        // Set aspect ratio
        setAspectRatio.call(this);
      });
    },
    // API ready
    ready() {
      const player = this;
      const config = player.config.youtube;
      // Ignore already setup (race condition)
      const currentId = player.media &amp;&amp; player.media.getAttribute('id');
      if (!is.empty(currentId) &amp;&amp; currentId.startsWith('youtube-')) {
        return;
      }

      // Get the source URL or ID
      let source = player.media.getAttribute('src');

      // Get from &lt;div&gt; if needed
      if (is.empty(source)) {
        source = player.media.getAttribute(this.config.attributes.embed.id);
      }

      // Replace the &lt;iframe&gt; with a &lt;div&gt; due to YouTube API issues
      const videoId = parseId(source);
      const id = generateId(player.provider);
      // Replace media element
      const container = createElement('div', {
        id,
        'data-poster': config.customControls ? player.poster : undefined
      });
      player.media = replaceElement(container, player.media);

      // Only load the poster when using custom controls
      if (config.customControls) {
        const posterSrc = s =&gt; `https://i.ytimg.com/vi/${videoId}/${s}default.jpg`;

        // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
        loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded
        .catch(() =&gt; loadImage(posterSrc('sd'), 121)) // 480p padded 4:3
        .catch(() =&gt; loadImage(posterSrc('hq'))) // 360p padded 4:3. Always exists
        .then(image =&gt; ui.setPoster.call(player, image.src)).then(src =&gt; {
          // If the image is padded, use background-size "cover" instead (like youtube does too with their posters)
          if (!src.includes('maxres')) {
            player.elements.poster.style.backgroundSize = 'cover';
          }
        }).catch(() =&gt; {});
      }

      // Setup instance
      // https://developers.google.com/youtube/iframe_api_reference
      player.embed = new window.YT.Player(player.media, {
        videoId,
        host: getHost(config),
        playerVars: extend({}, {
          // Autoplay
          autoplay: player.config.autoplay ? 1 : 0,
          // iframe interface language
          hl: player.config.hl,
          // Only show controls if not fully supported or opted out
          controls: player.supported.ui &amp;&amp; config.customControls ? 0 : 1,
          // Disable keyboard as we handle it
          disablekb: 1,
          // Allow iOS inline playback
          playsinline: !player.config.fullscreen.iosNative ? 1 : 0,
          // Captions are flaky on YouTube
          cc_load_policy: player.captions.active ? 1 : 0,
          cc_lang_pref: player.config.captions.language,
          // Tracking for stats
          widget_referrer: window ? window.location.href : null
        }, config),
        events: {
          onError(event) {
            // YouTube may fire onError twice, so only handle it once
            if (!player.media.error) {
              const code = event.data;
              // Messages copied from https://developers.google.com/youtube/iframe_api_reference#onError
              const message = {
                2: 'The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.',
                5: 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.',
                100: 'The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.',
                101: 'The owner of the requested video does not allow it to be played in embedded players.',
                150: 'The owner of the requested video does not allow it to be played in embedded players.'
              }[code] || 'An unknown error occured';
              player.media.error = {
                code,
                message
              };
              triggerEvent.call(player, player.media, 'error');
            }
          },
          onPlaybackRateChange(event) {
            // Get the instance
            const instance = event.target;

            // Get current speed
            player.media.playbackRate = instance.getPlaybackRate();
            triggerEvent.call(player, player.media, 'ratechange');
          },
          onReady(event) {
            // Bail if onReady has already been called. See issue #1108
            if (is.function(player.media.play)) {
              return;
            }
            // Get the instance
            const instance = event.target;

            // Get the title
            youtube.getTitle.call(player, videoId);

            // Create a faux HTML5 API using the YouTube API
            player.media.play = () =&gt; {
              assurePlaybackState.call(player, true);
              instance.playVideo();
            };
            player.media.pause = () =&gt; {
              assurePlaybackState.call(player, false);
              instance.pauseVideo();
            };
            player.media.stop = () =&gt; {
              instance.stopVideo();
            };
            player.media.duration = instance.getDuration();
            player.media.paused = true;

            // Seeking
            player.media.currentTime = 0;
            Object.defineProperty(player.media, 'currentTime', {
              get() {
                return Number(instance.getCurrentTime());
              },
              set(time) {
                // If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
                if (player.paused &amp;&amp; !player.embed.hasPlayed) {
                  player.embed.mute();
                }

                // Set seeking state and trigger event
                player.media.seeking = true;
                triggerEvent.call(player, player.media, 'seeking');

                // Seek after events sent
                instance.seekTo(time);
              }
            });

            // Playback speed
            Object.defineProperty(player.media, 'playbackRate', {
              get() {
                return instance.getPlaybackRate();
              },
              set(input) {
                instance.setPlaybackRate(input);
              }
            });

            // Volume
            let {
              volume
            } = player.config;
            Object.defineProperty(player.media, 'volume', {
              get() {
                return volume;
              },
              set(input) {
                volume = input;
                instance.setVolume(volume * 100);
                triggerEvent.call(player, player.media, 'volumechange');
              }
            });

            // Muted
            let {
              muted
            } = player.config;
            Object.defineProperty(player.media, 'muted', {
              get() {
                return muted;
              },
              set(input) {
                const toggle = is.boolean(input) ? input : muted;
                muted = toggle;
                instance[toggle ? 'mute' : 'unMute']();
                instance.setVolume(volume * 100);
                triggerEvent.call(player, player.media, 'volumechange');
              }
            });

            // Source
            Object.defineProperty(player.media, 'currentSrc', {
              get() {
                return instance.getVideoUrl();
              }
            });

            // Ended
            Object.defineProperty(player.media, 'ended', {
              get() {
                return player.currentTime === player.duration;
              }
            });

            // Get available speeds
            const speeds = instance.getAvailablePlaybackRates();
            // Filter based on config
            player.options.speed = speeds.filter(s =&gt; player.config.speed.options.includes(s));

            // Set the tabindex to avoid focus entering iframe
            if (player.supported.ui &amp;&amp; config.customControls) {
              player.media.setAttribute('tabindex', -1);
            }
            triggerEvent.call(player, player.media, 'timeupdate');
            triggerEvent.call(player, player.media, 'durationchange');

            // Reset timer
            clearInterval(player.timers.buffering);

            // Setup buffering
            player.timers.buffering = setInterval(() =&gt; {
              // Get loaded % from YouTube
              player.media.buffered = instance.getVideoLoadedFraction();

              // Trigger progress only when we actually buffer something
              if (player.media.lastBuffered === null || player.media.lastBuffered &lt; player.media.buffered) {
                triggerEvent.call(player, player.media, 'progress');
              }

              // Set last buffer point
              player.media.lastBuffered = player.media.buffered;

              // Bail if we're at 100%
              if (player.media.buffered === 1) {
                clearInterval(player.timers.buffering);

                // Trigger event
                triggerEvent.call(player, player.media, 'canplaythrough');
              }
            }, 200);

            // Rebuild UI
            if (config.customControls) {
              setTimeout(() =&gt; ui.build.call(player), 50);
            }
          },
          onStateChange(event) {
            // Get the instance
            const instance = event.target;

            // Reset timer
            clearInterval(player.timers.playing);
            const seeked = player.media.seeking &amp;&amp; [1, 2].includes(event.data);
            if (seeked) {
              // Unset seeking and fire seeked event
              player.media.seeking = false;
              triggerEvent.call(player, player.media, 'seeked');
            }

            // Handle events
            // -1   Unstarted
            // 0    Ended
            // 1    Playing
            // 2    Paused
            // 3    Buffering
            // 5    Video cued
            switch (event.data) {
              case -1:
                // Update scrubber
                triggerEvent.call(player, player.media, 'timeupdate');

                // Get loaded % from YouTube
                player.media.buffered = instance.getVideoLoadedFraction();
                triggerEvent.call(player, player.media, 'progress');
                break;
              case 0:
                assurePlaybackState.call(player, false);

                // YouTube doesn't support loop for a single video, so mimick it.
                if (player.media.loop) {
                  // YouTube needs a call to `stopVideo` before playing again
                  instance.stopVideo();
                  instance.playVideo();
                } else {
                  triggerEvent.call(player, player.media, 'ended');
                }
                break;
              case 1:
                // Restore paused state (YouTube starts playing on seek if the video hasn't been played yet)
                if (config.customControls &amp;&amp; !player.config.autoplay &amp;&amp; player.media.paused &amp;&amp; !player.embed.hasPlayed) {
                  player.media.pause();
                } else {
                  assurePlaybackState.call(player, true);
                  triggerEvent.call(player, player.media, 'playing');

                  // Poll to get playback progress
                  player.timers.playing = setInterval(() =&gt; {
                    triggerEvent.call(player, player.media, 'timeupdate');
                  }, 50);

                  // Check duration again due to YouTube bug
                  // https://github.com/sampotts/plyr/issues/374
                  // https://code.google.com/p/gdata-issues/issues/detail?id=8690
                  if (player.media.duration !== instance.getDuration()) {
                    player.media.duration = instance.getDuration();
                    triggerEvent.call(player, player.media, 'durationchange');
                  }
                }
                break;
              case 2:
                // Restore audio (YouTube starts playing on seek if the video hasn't been played yet)
                if (!player.muted) {
                  player.embed.unMute();
                }
                assurePlaybackState.call(player, false);
                break;
              case 3:
                // Trigger waiting event to add loading classes to container as the video buffers.
                triggerEvent.call(player, player.media, 'waiting');
                break;
            }
            triggerEvent.call(player, player.elements.container, 'statechange', false, {
              code: event.data
            });
          }
        }
      });
    }
  };

  // ==========================================================================
  const media = {
    // Setup media
    setup() {
      // If there's no media, bail
      if (!this.media) {
        this.debug.warn('No media element found!');
        return;
      }

      // Add type class
      toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', this.type), true);

      // Add provider class
      toggleClass(this.elements.container, this.config.classNames.provider.replace('{0}', this.provider), true);

      // Add video class for embeds
      // This will require changes if audio embeds are added
      if (this.isEmbed) {
        toggleClass(this.elements.container, this.config.classNames.type.replace('{0}', 'video'), true);
      }

      // Inject the player wrapper
      if (this.isVideo) {
        // Create the wrapper div
        this.elements.wrapper = createElement('div', {
          class: this.config.classNames.video
        });

        // Wrap the video in a container
        wrap(this.media, this.elements.wrapper);

        // Poster image container
        this.elements.poster = createElement('div', {
          class: this.config.classNames.poster
        });
        this.elements.wrapper.appendChild(this.elements.poster);
      }
      if (this.isHTML5) {
        html5.setup.call(this);
      } else if (this.isYouTube) {
        youtube.setup.call(this);
      } else if (this.isVimeo) {
        vimeo.setup.call(this);
      }
    }
  };

  const destroy = instance =&gt; {
    // Destroy our adsManager
    if (instance.manager) {
      instance.manager.destroy();
    }

    // Destroy our adsManager
    if (instance.elements.displayContainer) {
      instance.elements.displayContainer.destroy();
    }
    instance.elements.container.remove();
  };
  class Ads {
    /**
     * Ads constructor.
     * @param {Object} player
     * @return {Ads}
     */
    constructor(player) {
      _defineProperty$1(this, "load", () =&gt; {
        if (!this.enabled) {
          return;
        }

        // Check if the Google IMA3 SDK is loaded or load it ourselves
        if (!is.object(window.google) || !is.object(window.google.ima)) {
          loadScript(this.player.config.urls.googleIMA.sdk).then(() =&gt; {
            this.ready();
          }).catch(() =&gt; {
            // Script failed to load or is blocked
            this.trigger('error', new Error('Google IMA SDK failed to load'));
          });
        } else {
          this.ready();
        }
      });
      _defineProperty$1(this, "ready", () =&gt; {
        // Double check we're enabled
        if (!this.enabled) {
          destroy(this);
        }

        // Start ticking our safety timer. If the whole advertisement
        // thing doesn't resolve within our set time; we bail
        this.startSafetyTimer(12000, 'ready()');

        // Clear the safety timer
        this.managerPromise.then(() =&gt; {
          this.clearSafetyTimer('onAdsManagerLoaded()');
        });

        // Set listeners on the Plyr instance
        this.listeners();

        // Setup the IMA SDK
        this.setupIMA();
      });
      _defineProperty$1(this, "setupIMA", () =&gt; {
        // Create the container for our advertisements
        this.elements.container = createElement('div', {
          class: this.player.config.classNames.ads
        });
        this.player.elements.container.appendChild(this.elements.container);

        // So we can run VPAID2
        google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED);

        // Set language
        google.ima.settings.setLocale(this.player.config.ads.language);

        // Set playback for iOS10+
        google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline);

        // We assume the adContainer is the video container of the plyr element that will house the ads
        this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media);

        // Create ads loader
        this.loader = new google.ima.AdsLoader(this.elements.displayContainer);

        // Listen and respond to ads loaded and error events
        this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, event =&gt; this.onAdsManagerLoaded(event), false);
        this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, error =&gt; this.onAdError(error), false);

        // Request video ads to be pre-loaded
        this.requestAds();
      });
      _defineProperty$1(this, "requestAds", () =&gt; {
        const {
          container
        } = this.player.elements;
        try {
          // Request video ads
          const request = new google.ima.AdsRequest();
          request.adTagUrl = this.tagUrl;

          // Specify the linear and nonlinear slot sizes. This helps the SDK
          // to select the correct creative if multiple are returned
          request.linearAdSlotWidth = container.offsetWidth;
          request.linearAdSlotHeight = container.offsetHeight;
          request.nonLinearAdSlotWidth = container.offsetWidth;
          request.nonLinearAdSlotHeight = container.offsetHeight;

          // We only overlay ads as we only support video.
          request.forceNonLinearFullSlot = false;

          // Mute based on current state
          request.setAdWillPlayMuted(!this.player.muted);
          this.loader.requestAds(request);
        } catch (error) {
          this.onAdError(error);
        }
      });
      _defineProperty$1(this, "pollCountdown", (start = false) =&gt; {
        if (!start) {
          clearInterval(this.countdownTimer);
          this.elements.container.removeAttribute('data-badge-text');
          return;
        }
        const update = () =&gt; {
          const time = formatTime(Math.max(this.manager.getRemainingTime(), 0));
          const label = `${i18n.get('advertisement', this.player.config)} - ${time}`;
          this.elements.container.setAttribute('data-badge-text', label);
        };
        this.countdownTimer = setInterval(update, 100);
      });
      _defineProperty$1(this, "onAdsManagerLoaded", event =&gt; {
        // Load could occur after a source change (race condition)
        if (!this.enabled) {
          return;
        }

        // Get the ads manager
        const settings = new google.ima.AdsRenderingSettings();

        // Tell the SDK to save and restore content video state on our behalf
        settings.restoreCustomPlaybackStateOnAdBreakComplete = true;
        settings.enablePreloading = true;

        // The SDK is polling currentTime on the contentPlayback. And needs a duration
        // so it can determine when to start the mid- and post-roll
        this.manager = event.getAdsManager(this.player, settings);

        // Get the cue points for any mid-rolls by filtering out the pre- and post-roll
        this.cuePoints = this.manager.getCuePoints();

        // Add listeners to the required events
        // Advertisement error events
        this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, error =&gt; this.onAdError(error));

        // Advertisement regular events
        Object.keys(google.ima.AdEvent.Type).forEach(type =&gt; {
          this.manager.addEventListener(google.ima.AdEvent.Type[type], e =&gt; this.onAdEvent(e));
        });

        // Resolve our adsManager
        this.trigger('loaded');
      });
      _defineProperty$1(this, "addCuePoints", () =&gt; {
        // Add advertisement cue's within the time line if available
        if (!is.empty(this.cuePoints)) {
          this.cuePoints.forEach(cuePoint =&gt; {
            if (cuePoint !== 0 &amp;&amp; cuePoint !== -1 &amp;&amp; cuePoint &lt; this.player.duration) {
              const seekElement = this.player.elements.progress;
              if (is.element(seekElement)) {
                const cuePercentage = 100 / this.player.duration * cuePoint;
                const cue = createElement('span', {
                  class: this.player.config.classNames.cues
                });
                cue.style.left = `${cuePercentage.toString()}%`;
                seekElement.appendChild(cue);
              }
            }
          });
        }
      });
      _defineProperty$1(this, "onAdEvent", event =&gt; {
        const {
          container
        } = this.player.elements;
        // Retrieve the ad from the event. Some events (e.g. ALL_ADS_COMPLETED)
        // don't have ad object associated
        const ad = event.getAd();
        const adData = event.getAdData();

        // Proxy event
        const dispatchEvent = type =&gt; {
          triggerEvent.call(this.player, this.player.media, `ads${type.replace(/_/g, '').toLowerCase()}`);
        };

        // Bubble the event
        dispatchEvent(event.type);
        switch (event.type) {
          case google.ima.AdEvent.Type.LOADED:
            // This is the first event sent for an ad - it is possible to determine whether the
            // ad is a video ad or an overlay
            this.trigger('loaded');

            // Start countdown
            this.pollCountdown(true);
            if (!ad.isLinear()) {
              // Position AdDisplayContainer correctly for overlay
              ad.width = container.offsetWidth;
              ad.height = container.offsetHeight;
            }

            // console.info('Ad type: ' + event.getAd().getAdPodInfo().getPodIndex());
            // console.info('Ad time: ' + event.getAd().getAdPodInfo().getTimeOffset());

            break;
          case google.ima.AdEvent.Type.STARTED:
            // Set volume to match player
            this.manager.setVolume(this.player.volume);
            break;
          case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
            // All ads for the current videos are done. We can now request new advertisements
            // in case the video is re-played

            // TODO: Example for what happens when a next video in a playlist would be loaded.
            // So here we load a new video when all ads are done.
            // Then we load new ads within a new adsManager. When the video
            // Is started - after - the ads are loaded, then we get ads.
            // You can also easily test cancelling and reloading by running
            // player.ads.cancel() and player.ads.play from the console I guess.
            // this.player.source = {
            //     type: 'video',
            //     title: 'View From A Blue Moon',
            //     sources: [{
            //         src:
            // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4', type:
            // 'video/mp4', }], poster:
            // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg', tracks:
            // [ { kind: 'captions', label: 'English', srclang: 'en', src:
            // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',
            // default: true, }, { kind: 'captions', label: 'French', srclang: 'fr', src:
            // 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt', }, ],
            // };

            // TODO: So there is still this thing where a video should only be allowed to start
            // playing when the IMA SDK is ready or has failed

            if (this.player.ended) {
              this.loadAds();
            } else {
              // The SDK won't allow new ads to be called without receiving a contentComplete()
              this.loader.contentComplete();
            }
            break;
          case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:
            // This event indicates the ad has started - the video player can adjust the UI,
            // for example display a pause button and remaining time. Fired when content should
            // be paused. This usually happens right before an ad is about to cover the content

            this.pauseContent();
            break;
          case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:
            // This event indicates the ad has finished - the video player can perform
            // appropriate UI actions, such as removing the timer for remaining time detection.
            // Fired when content should be resumed. This usually happens when an ad finishes
            // or collapses

            this.pollCountdown();
            this.resumeContent();
            break;
          case google.ima.AdEvent.Type.LOG:
            if (adData.adError) {
              this.player.debug.warn(`Non-fatal ad error: ${adData.adError.getMessage()}`);
            }
            break;
        }
      });
      _defineProperty$1(this, "onAdError", event =&gt; {
        this.cancel();
        this.player.debug.warn('Ads error', event);
      });
      _defineProperty$1(this, "listeners", () =&gt; {
        const {
          container
        } = this.player.elements;
        let time;
        this.player.on('canplay', () =&gt; {
          this.addCuePoints();
        });
        this.player.on('ended', () =&gt; {
          this.loader.contentComplete();
        });
        this.player.on('timeupdate', () =&gt; {
          time = this.player.currentTime;
        });
        this.player.on('seeked', () =&gt; {
          const seekedTime = this.player.currentTime;
          if (is.empty(this.cuePoints)) {
            return;
          }
          this.cuePoints.forEach((cuePoint, index) =&gt; {
            if (time &lt; cuePoint &amp;&amp; cuePoint &lt; seekedTime) {
              this.manager.discardAdBreak();
              this.cuePoints.splice(index, 1);
            }
          });
        });

        // Listen to the resizing of the window. And resize ad accordingly
        // TODO: eventually implement ResizeObserver
        window.addEventListener('resize', () =&gt; {
          if (this.manager) {
            this.manager.resize(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL);
          }
        });
      });
      _defineProperty$1(this, "play", () =&gt; {
        const {
          container
        } = this.player.elements;
        if (!this.managerPromise) {
          this.resumeContent();
        }

        // Play the requested advertisement whenever the adsManager is ready
        this.managerPromise.then(() =&gt; {
          // Set volume to match player
          this.manager.setVolume(this.player.volume);

          // Initialize the container. Must be done via a user action on mobile devices
          this.elements.displayContainer.initialize();
          try {
            if (!this.initialized) {
              // Initialize the ads manager. Ad rules playlist will start at this time
              this.manager.init(container.offsetWidth, container.offsetHeight, google.ima.ViewMode.NORMAL);

              // Call play to start showing the ad. Single video and overlay ads will
              // start at this time; the call will be ignored for ad rules
              this.manager.start();
            }
            this.initialized = true;
          } catch (adError) {
            // An error may be thrown if there was a problem with the
            // VAST response
            this.onAdError(adError);
          }
        }).catch(() =&gt; {});
      });
      _defineProperty$1(this, "resumeContent", () =&gt; {
        // Hide the advertisement container
        this.elements.container.style.zIndex = '';

        // Ad is stopped
        this.playing = false;

        // Play video
        silencePromise(this.player.media.play());
      });
      _defineProperty$1(this, "pauseContent", () =&gt; {
        // Show the advertisement container
        this.elements.container.style.zIndex = 3;

        // Ad is playing
        this.playing = true;

        // Pause our video.
        this.player.media.pause();
      });
      _defineProperty$1(this, "cancel", () =&gt; {
        // Pause our video
        if (this.initialized) {
          this.resumeContent();
        }

        // Tell our instance that we're done for now
        this.trigger('error');

        // Re-create our adsManager
        this.loadAds();
      });
      _defineProperty$1(this, "loadAds", () =&gt; {
        // Tell our adsManager to go bye bye
        this.managerPromise.then(() =&gt; {
          // Destroy our adsManager
          if (this.manager) {
            this.manager.destroy();
          }

          // Re-set our adsManager promises
          this.managerPromise = new Promise(resolve =&gt; {
            this.on('loaded', resolve);
            this.player.debug.log(this.manager);
          });
          // Now that the manager has been destroyed set it to also be un-initialized
          this.initialized = false;

          // Now request some new advertisements
          this.requestAds();
        }).catch(() =&gt; {});
      });
      _defineProperty$1(this, "trigger", (event, ...args) =&gt; {
        const handlers = this.events[event];
        if (is.array(handlers)) {
          handlers.forEach(handler =&gt; {
            if (is.function(handler)) {
              handler.apply(this, args);
            }
          });
        }
      });
      _defineProperty$1(this, "on", (event, callback) =&gt; {
        if (!is.array(this.events[event])) {
          this.events[event] = [];
        }
        this.events[event].push(callback);
        return this;
      });
      _defineProperty$1(this, "startSafetyTimer", (time, from) =&gt; {
        this.player.debug.log(`Safety timer invoked from: ${from}`);
        this.safetyTimer = setTimeout(() =&gt; {
          this.cancel();
          this.clearSafetyTimer('startSafetyTimer()');
        }, time);
      });
      _defineProperty$1(this, "clearSafetyTimer", from =&gt; {
        if (!is.nullOrUndefined(this.safetyTimer)) {
          this.player.debug.log(`Safety timer cleared from: ${from}`);
          clearTimeout(this.safetyTimer);
          this.safetyTimer = null;
        }
      });
      this.player = player;
      this.config = player.config.ads;
      this.playing = false;
      this.initialized = false;
      this.elements = {
        container: null,
        displayContainer: null
      };
      this.manager = null;
      this.loader = null;
      this.cuePoints = null;
      this.events = {};
      this.safetyTimer = null;
      this.countdownTimer = null;

      // Setup a promise to resolve when the IMA manager is ready
      this.managerPromise = new Promise((resolve, reject) =&gt; {
        // The ad is loaded and ready
        this.on('loaded', resolve);

        // Ads failed
        this.on('error', reject);
      });
      this.load();
    }
    get enabled() {
      const {
        config
      } = this;
      return this.player.isHTML5 &amp;&amp; this.player.isVideo &amp;&amp; config.enabled &amp;&amp; (!is.empty(config.publisherId) || is.url(config.tagUrl));
    }

    /**
     * Load the IMA SDK
     */

    // Build the tag URL
    get tagUrl() {
      const {
        config
      } = this;
      if (is.url(config.tagUrl)) {
        return config.tagUrl;
      }
      const params = {
        AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
        AV_CHANNELID: '5a0458dc28a06145e4519d21',
        AV_URL: window.location.hostname,
        cb: Date.now(),
        AV_WIDTH: 640,
        AV_HEIGHT: 480,
        AV_CDIM2: config.publisherId
      };
      const base = 'https://go.aniview.com/api/adserver6/vast/';
      return `${base}?${buildUrlParams(params)}`;
    }

    /**
     * In order for the SDK to display ads for our video, we need to tell it where to put them,
     * so here we define our ad container. This div is set up to render on top of the video player.
     * Using the code below, we tell the SDK to render ads within that div. We also provide a
     * handle to the content video player - the SDK will poll the current time of our player to
     * properly place mid-rolls. After we create the ad display container, we initialize it. On
     * mobile devices, this initialization is done as the result of a user action.
     */
  }

  /**
   * Returns a number whose value is limited to the given range.
   *
   * Example: limit the output of this computation to between 0 and 255
   * (x * 255).clamp(0, 255)
   *
   * @param {Number} input
   * @param {Number} min The lower boundary of the output range
   * @param {Number} max The upper boundary of the output range
   * @returns A number within the bounds of min and max
   * @type Number
   */
  function clamp(input = 0, min = 0, max = 255) {
    return Math.min(Math.max(input, min), max);
  }

  // Arg: vttDataString example: "WEBVTT\n\n1\n00:00:05.000 --&gt; 00:00:10.000\n1080p-00001.jpg"
  const parseVtt = vttDataString =&gt; {
    const processedList = [];
    const frames = vttDataString.split(/\r\n\r\n|\n\n|\r\r/);
    frames.forEach(frame =&gt; {
      const result = {};
      const lines = frame.split(/\r\n|\n|\r/);
      lines.forEach(line =&gt; {
        if (!is.number(result.startTime)) {
          // The line with start and end times on it is the first line of interest
          const matchTimes = line.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--&gt; ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/); // Note that this currently ignores caption formatting directives that are optionally on the end of this line - fine for non-captions VTT

          if (matchTimes) {
            result.startTime = Number(matchTimes[1] || 0) * 60 * 60 + Number(matchTimes[2]) * 60 + Number(matchTimes[3]) + Number(`0.${matchTimes[4]}`);
            result.endTime = Number(matchTimes[6] || 0) * 60 * 60 + Number(matchTimes[7]) * 60 + Number(matchTimes[8]) + Number(`0.${matchTimes[9]}`);
          }
        } else if (!is.empty(line.trim()) &amp;&amp; is.empty(result.text)) {
          // If we already have the startTime, then we're definitely up to the text line(s)
          const lineSplit = line.trim().split('#xywh=');
          [result.text] = lineSplit;

          // If there's content in lineSplit[1], then we have sprites. If not, then it's just one frame per image
          if (lineSplit[1]) {
            [result.x, result.y, result.w, result.h] = lineSplit[1].split(',');
          }
        }
      });
      if (result.text) {
        processedList.push(result);
      }
    });
    return processedList;
  };

  /**
   * Preview thumbnails for seek hover and scrubbing
   * Seeking: Hover over the seek bar (desktop only): shows a small preview container above the seek bar
   * Scrubbing: Click and drag the seek bar (desktop and mobile): shows the preview image over the entire video, as if the video is scrubbing at very high speed
   *
   * Notes:
   * - Thumbs are set via JS settings on Plyr init, not HTML5 'track' property. Using the track property would be a bit gross, because it doesn't support custom 'kinds'. kind=metadata might be used for something else, and we want to allow multiple thumbnails tracks. Tracks must have a unique combination of 'kind' and 'label'. We would have to do something like kind=metadata,label=thumbnails1 / kind=metadata,label=thumbnails2. Square peg, round hole
   * - VTT info: the image URL is relative to the VTT, not the current document. But if the url starts with a slash, it will naturally be relative to the current domain. https://support.jwplayer.com/articles/how-to-add-preview-thumbnails
   * - This implementation uses multiple separate img elements. Other implementations use background-image on one element. This would be nice and simple, but Firefox and Safari have flickering issues with replacing backgrounds of larger images. It seems that YouTube perhaps only avoids this because they don't have the option for high-res previews (even the fullscreen ones, when mousedown/seeking). Images appear over the top of each other, and previous ones are discarded once the new ones have been rendered
   */

  const fitRatio = (ratio, outer) =&gt; {
    const targetRatio = outer.width / outer.height;
    const result = {};
    if (ratio &gt; targetRatio) {
      result.width = outer.width;
      result.height = 1 / ratio * outer.width;
    } else {
      result.height = outer.height;
      result.width = ratio * outer.height;
    }
    return result;
  };
  class PreviewThumbnails {
    /**
     * PreviewThumbnails constructor.
     * @param {Plyr} player
     * @return {PreviewThumbnails}
     */
    constructor(player) {
      _defineProperty$1(this, "load", () =&gt; {
        // Toggle the regular seek tooltip
        if (this.player.elements.display.seekTooltip) {
          this.player.elements.display.seekTooltip.hidden = this.enabled;
        }
        if (!this.enabled) return;
        this.getThumbnails().then(() =&gt; {
          if (!this.enabled) {
            return;
          }

          // Render DOM elements
          this.render();

          // Check to see if thumb container size was specified manually in CSS
          this.determineContainerAutoSizing();
          this.loaded = true;
        });
      });
      _defineProperty$1(this, "getThumbnails", () =&gt; {
        return new Promise(resolve =&gt; {
          const {
            src
          } = this.player.config.previewThumbnails;
          if (is.empty(src)) {
            throw new Error('Missing previewThumbnails.src config attribute');
          }

          // Resolve promise
          const sortAndResolve = () =&gt; {
            // Sort smallest to biggest (e.g., [120p, 480p, 1080p])
            this.thumbnails.sort((x, y) =&gt; x.height - y.height);
            this.player.debug.log('Preview thumbnails', this.thumbnails);
            resolve();
          };

          // Via callback()
          if (is.function(src)) {
            src(thumbnails =&gt; {
              this.thumbnails = thumbnails;
              sortAndResolve();
            });
          }
          // VTT urls
          else {
            // If string, convert into single-element list
            const urls = is.string(src) ? [src] : src;
            // Loop through each src URL. Download and process the VTT file, storing the resulting data in this.thumbnails
            const promises = urls.map(u =&gt; this.getThumbnail(u));
            // Resolve
            Promise.all(promises).then(sortAndResolve);
          }
        });
      });
      _defineProperty$1(this, "getThumbnail", url =&gt; {
        return new Promise(resolve =&gt; {
          fetch(url).then(response =&gt; {
            const thumbnail = {
              frames: parseVtt(response),
              height: null,
              urlPrefix: ''
            };

            // If the URLs don't start with '/', then we need to set their relative path to be the location of the VTT file
            // If the URLs do start with '/', then they obviously don't need a prefix, so it will remain blank
            // If the thumbnail URLs start with with none of '/', 'http://' or 'https://', then we need to set their relative path to be the location of the VTT file
            if (!thumbnail.frames[0].text.startsWith('/') &amp;&amp; !thumbnail.frames[0].text.startsWith('http://') &amp;&amp; !thumbnail.frames[0].text.startsWith('https://')) {
              thumbnail.urlPrefix = url.substring(0, url.lastIndexOf('/') + 1);
            }

            // Download the first frame, so that we can determine/set the height of this thumbnailsDef
            const tempImage = new Image();
            tempImage.onload = () =&gt; {
              thumbnail.height = tempImage.naturalHeight;
              thumbnail.width = tempImage.naturalWidth;
              this.thumbnails.push(thumbnail);
              resolve();
            };
            tempImage.src = thumbnail.urlPrefix + thumbnail.frames[0].text;
          });
        });
      });
      _defineProperty$1(this, "startMove", event =&gt; {
        if (!this.loaded) return;
        if (!is.event(event) || !['touchmove', 'mousemove'].includes(event.type)) return;

        // Wait until media has a duration
        if (!this.player.media.duration) return;
        if (event.type === 'touchmove') {
          // Calculate seek hover position as approx video seconds
          this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100);
        } else {
          var _this$player$config$m, _this$player$config$m2;
          // Calculate seek hover position as approx video seconds
          const clientRect = this.player.elements.progress.getBoundingClientRect();
          const percentage = 100 / clientRect.width * (event.pageX - clientRect.left);
          this.seekTime = this.player.media.duration * (percentage / 100);
          if (this.seekTime &lt; 0) {
            // The mousemove fires for 10+px out to the left
            this.seekTime = 0;
          }
          if (this.seekTime &gt; this.player.media.duration - 1) {
            // Took 1 second off the duration for safety, because different players can disagree on the real duration of a video
            this.seekTime = this.player.media.duration - 1;
          }
          this.mousePosX = event.pageX;

          // Set time text inside image container
          this.elements.thumb.time.innerText = formatTime(this.seekTime);

          // Get marker point for time
          const point = (_this$player$config$m = this.player.config.markers) === null || _this$player$config$m === void 0 ? void 0 : (_this$player$config$m2 = _this$player$config$m.points) === null || _this$player$config$m2 === void 0 ? void 0 : _this$player$config$m2.find(({
            time: t
          }) =&gt; t === Math.round(this.seekTime));

          // Append the point label to the tooltip
          if (point) {
            // this.elements.thumb.time.innerText.concat('\n');
            this.elements.thumb.time.insertAdjacentHTML('afterbegin', `${point.label}&lt;br&gt;`);
          }
        }

        // Download and show image
        this.showImageAtCurrentTime();
      });
      _defineProperty$1(this, "endMove", () =&gt; {
        this.toggleThumbContainer(false, true);
      });
      _defineProperty$1(this, "startScrubbing", event =&gt; {
        // Only act on left mouse button (0), or touch device (event.button does not exist or is false)
        if (is.nullOrUndefined(event.button) || event.button === false || event.button === 0) {
          this.mouseDown = true;

          // Wait until media has a duration
          if (this.player.media.duration) {
            this.toggleScrubbingContainer(true);
            this.toggleThumbContainer(false, true);

            // Download and show image
            this.showImageAtCurrentTime();
          }
        }
      });
      _defineProperty$1(this, "endScrubbing", () =&gt; {
        this.mouseDown = false;

        // Hide scrubbing preview. But wait until the video has successfully seeked before hiding the scrubbing preview
        if (Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime)) {
          // The video was already seeked/loaded at the chosen time - hide immediately
          this.toggleScrubbingContainer(false);
        } else {
          // The video hasn't seeked yet. Wait for that
          once.call(this.player, this.player.media, 'timeupdate', () =&gt; {
            // Re-check mousedown - we might have already started scrubbing again
            if (!this.mouseDown) {
              this.toggleScrubbingContainer(false);
            }
          });
        }
      });
      _defineProperty$1(this, "listeners", () =&gt; {
        // Hide thumbnail preview - on mouse click, mouse leave (in listeners.js for now), and video play/seek. All four are required, e.g., for buffering
        this.player.on('play', () =&gt; {
          this.toggleThumbContainer(false, true);
        });
        this.player.on('seeked', () =&gt; {
          this.toggleThumbContainer(false);
        });
        this.player.on('timeupdate', () =&gt; {
          this.lastTime = this.player.media.currentTime;
        });
      });
      _defineProperty$1(this, "render", () =&gt; {
        // Create HTML element: plyr__preview-thumbnail-container
        this.elements.thumb.container = createElement('div', {
          class: this.player.config.classNames.previewThumbnails.thumbContainer
        });

        // Wrapper for the image for styling
        this.elements.thumb.imageContainer = createElement('div', {
          class: this.player.config.classNames.previewThumbnails.imageContainer
        });
        this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);

        // Create HTML element, parent+span: time text (e.g., 01:32:00)
        const timeContainer = createElement('div', {
          class: this.player.config.classNames.previewThumbnails.timeContainer
        });
        this.elements.thumb.time = createElement('span', {}, '00:00');
        timeContainer.appendChild(this.elements.thumb.time);
        this.elements.thumb.imageContainer.appendChild(timeContainer);

        // Inject the whole thumb
        if (is.element(this.player.elements.progress)) {
          this.player.elements.progress.appendChild(this.elements.thumb.container);
        }

        // Create HTML element: plyr__preview-scrubbing-container
        this.elements.scrubbing.container = createElement('div', {
          class: this.player.config.classNames.previewThumbnails.scrubbingContainer
        });
        this.player.elements.wrapper.appendChild(this.elements.scrubbing.container);
      });
      _defineProperty$1(this, "destroy", () =&gt; {
        if (this.elements.thumb.container) {
          this.elements.thumb.container.remove();
        }
        if (this.elements.scrubbing.container) {
          this.elements.scrubbing.container.remove();
        }
      });
      _defineProperty$1(this, "showImageAtCurrentTime", () =&gt; {
        if (this.mouseDown) {
          this.setScrubbingContainerSize();
        } else {
          this.setThumbContainerSizeAndPos();
        }

        // Find the desired thumbnail index
        // TODO: Handle a video longer than the thumbs where thumbNum is null
        const thumbNum = this.thumbnails[0].frames.findIndex(frame =&gt; this.seekTime &gt;= frame.startTime &amp;&amp; this.seekTime &lt;= frame.endTime);
        const hasThumb = thumbNum &gt;= 0;
        let qualityIndex = 0;

        // Show the thumb container if we're not scrubbing
        if (!this.mouseDown) {
          this.toggleThumbContainer(hasThumb);
        }

        // No matching thumb found
        if (!hasThumb) {
          return;
        }

        // Check to see if we've already downloaded higher quality versions of this image
        this.thumbnails.forEach((thumbnail, index) =&gt; {
          if (this.loadedImages.includes(thumbnail.frames[thumbNum].text)) {
            qualityIndex = index;
          }
        });

        // Only proceed if either thumb num or thumbfilename has changed
        if (thumbNum !== this.showingThumb) {
          this.showingThumb = thumbNum;
          this.loadImage(qualityIndex);
        }
      });
      _defineProperty$1(this, "loadImage", (qualityIndex = 0) =&gt; {
        const thumbNum = this.showingThumb;
        const thumbnail = this.thumbnails[qualityIndex];
        const {
          urlPrefix
        } = thumbnail;
        const frame = thumbnail.frames[thumbNum];
        const thumbFilename = thumbnail.frames[thumbNum].text;
        const thumbUrl = urlPrefix + thumbFilename;
        if (!this.currentImageElement || this.currentImageElement.dataset.filename !== thumbFilename) {
          // If we're already loading a previous image, remove its onload handler - we don't want it to load after this one
          // Only do this if not using sprites. Without sprites we really want to show as many images as possible, as a best-effort
          if (this.loadingImage &amp;&amp; this.usingSprites) {
            this.loadingImage.onload = null;
          }

          // We're building and adding a new image. In other implementations of similar functionality (YouTube), background image
          // is instead used. But this causes issues with larger images in Firefox and Safari - switching between background
          // images causes a flicker. Putting a new image over the top does not
          const previewImage = new Image();
          previewImage.src = thumbUrl;
          previewImage.dataset.index = thumbNum;
          previewImage.dataset.filename = thumbFilename;
          this.showingThumbFilename = thumbFilename;
          this.player.debug.log(`Loading image: ${thumbUrl}`);

          // For some reason, passing the named function directly causes it to execute immediately. So I've wrapped it in an anonymous function...
          previewImage.onload = () =&gt; this.showImage(previewImage, frame, qualityIndex, thumbNum, thumbFilename, true);
          this.loadingImage = previewImage;
          this.removeOldImages(previewImage);
        } else {
          // Update the existing image
          this.showImage(this.currentImageElement, frame, qualityIndex, thumbNum, thumbFilename, false);
          this.currentImageElement.dataset.index = thumbNum;
          this.removeOldImages(this.currentImageElement);
        }
      });
      _defineProperty$1(this, "showImage", (previewImage, frame, qualityIndex, thumbNum, thumbFilename, newImage = true) =&gt; {
        this.player.debug.log(`Showing thumb: ${thumbFilename}. num: ${thumbNum}. qual: ${qualityIndex}. newimg: ${newImage}`);
        this.setImageSizeAndOffset(previewImage, frame);
        if (newImage) {
          this.currentImageContainer.appendChild(previewImage);
          this.currentImageElement = previewImage;
          if (!this.loadedImages.includes(thumbFilename)) {
            this.loadedImages.push(thumbFilename);
          }
        }

        // Preload images before and after the current one
        // Show higher quality of the same frame
        // Each step here has a short time delay, and only continues if still hovering/seeking the same spot. This is to protect slow connections from overloading
        this.preloadNearby(thumbNum, true).then(this.preloadNearby(thumbNum, false)).then(this.getHigherQuality(qualityIndex, previewImage, frame, thumbFilename));
      });
      _defineProperty$1(this, "removeOldImages", currentImage =&gt; {
        // Get a list of all images, convert it from a DOM list to an array
        Array.from(this.currentImageContainer.children).forEach(image =&gt; {
          if (image.tagName.toLowerCase() !== 'img') {
            return;
          }
          const removeDelay = this.usingSprites ? 500 : 1000;
          if (image.dataset.index !== currentImage.dataset.index &amp;&amp; !image.dataset.deleting) {
            // Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients
            // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
            // eslint-disable-next-line no-param-reassign
            image.dataset.deleting = true;

            // This has to be set before the timeout - to prevent issues switching between hover and scrub
            const {
              currentImageContainer
            } = this;
            setTimeout(() =&gt; {
              currentImageContainer.removeChild(image);
              this.player.debug.log(`Removing thumb: ${image.dataset.filename}`);
            }, removeDelay);
          }
        });
      });
      _defineProperty$1(this, "preloadNearby", (thumbNum, forward = true) =&gt; {
        return new Promise(resolve =&gt; {
          setTimeout(() =&gt; {
            const oldThumbFilename = this.thumbnails[0].frames[thumbNum].text;
            if (this.showingThumbFilename === oldThumbFilename) {
              // Find the nearest thumbs with different filenames. Sometimes it'll be the next index, but in the case of sprites, it might be 100+ away
              let thumbnailsClone;
              if (forward) {
                thumbnailsClone = this.thumbnails[0].frames.slice(thumbNum);
              } else {
                thumbnailsClone = this.thumbnails[0].frames.slice(0, thumbNum).reverse();
              }
              let foundOne = false;
              thumbnailsClone.forEach(frame =&gt; {
                const newThumbFilename = frame.text;
                if (newThumbFilename !== oldThumbFilename) {
                  // Found one with a different filename. Make sure it hasn't already been loaded on this page visit
                  if (!this.loadedImages.includes(newThumbFilename)) {
                    foundOne = true;
                    this.player.debug.log(`Preloading thumb filename: ${newThumbFilename}`);
                    const {
                      urlPrefix
                    } = this.thumbnails[0];
                    const thumbURL = urlPrefix + newThumbFilename;
                    const previewImage = new Image();
                    previewImage.src = thumbURL;
                    previewImage.onload = () =&gt; {
                      this.player.debug.log(`Preloaded thumb filename: ${newThumbFilename}`);
                      if (!this.loadedImages.includes(newThumbFilename)) this.loadedImages.push(newThumbFilename);

                      // We don't resolve until the thumb is loaded
                      resolve();
                    };
                  }
                }
              });

              // If there are none to preload then we want to resolve immediately
              if (!foundOne) {
                resolve();
              }
            }
          }, 300);
        });
      });
      _defineProperty$1(this, "getHigherQuality", (currentQualityIndex, previewImage, frame, thumbFilename) =&gt; {
        if (currentQualityIndex &lt; this.thumbnails.length - 1) {
          // Only use the higher quality version if it's going to look any better - if the current thumb is of a lower pixel density than the thumbnail container
          let previewImageHeight = previewImage.naturalHeight;
          if (this.usingSprites) {
            previewImageHeight = frame.h;
          }
          if (previewImageHeight &lt; this.thumbContainerHeight) {
            // Recurse back to the loadImage function - show a higher quality one, but only if the viewer is on this frame for a while
            setTimeout(() =&gt; {
              // Make sure the mouse hasn't already moved on and started hovering at another image
              if (this.showingThumbFilename === thumbFilename) {
                this.player.debug.log(`Showing higher quality thumb for: ${thumbFilename}`);
                this.loadImage(currentQualityIndex + 1);
              }
            }, 300);
          }
        }
      });
      _defineProperty$1(this, "toggleThumbContainer", (toggle = false, clearShowing = false) =&gt; {
        const className = this.player.config.classNames.previewThumbnails.thumbContainerShown;
        this.elements.thumb.container.classList.toggle(className, toggle);
        if (!toggle &amp;&amp; clearShowing) {
          this.showingThumb = null;
          this.showingThumbFilename = null;
        }
      });
      _defineProperty$1(this, "toggleScrubbingContainer", (toggle = false) =&gt; {
        const className = this.player.config.classNames.previewThumbnails.scrubbingContainerShown;
        this.elements.scrubbing.container.classList.toggle(className, toggle);
        if (!toggle) {
          this.showingThumb = null;
          this.showingThumbFilename = null;
        }
      });
      _defineProperty$1(this, "determineContainerAutoSizing", () =&gt; {
        if (this.elements.thumb.imageContainer.clientHeight &gt; 20 || this.elements.thumb.imageContainer.clientWidth &gt; 20) {
          // This will prevent auto sizing in this.setThumbContainerSizeAndPos()
          this.sizeSpecifiedInCSS = true;
        }
      });
      _defineProperty$1(this, "setThumbContainerSizeAndPos", () =&gt; {
        const {
          imageContainer
        } = this.elements.thumb;
        if (!this.sizeSpecifiedInCSS) {
          const thumbWidth = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio);
          imageContainer.style.height = `${this.thumbContainerHeight}px`;
          imageContainer.style.width = `${thumbWidth}px`;
        } else if (imageContainer.clientHeight &gt; 20 &amp;&amp; imageContainer.clientWidth &lt; 20) {
          const thumbWidth = Math.floor(imageContainer.clientHeight * this.thumbAspectRatio);
          imageContainer.style.width = `${thumbWidth}px`;
        } else if (imageContainer.clientHeight &lt; 20 &amp;&amp; imageContainer.clientWidth &gt; 20) {
          const thumbHeight = Math.floor(imageContainer.clientWidth / this.thumbAspectRatio);
          imageContainer.style.height = `${thumbHeight}px`;
        }
        this.setThumbContainerPos();
      });
      _defineProperty$1(this, "setThumbContainerPos", () =&gt; {
        const scrubberRect = this.player.elements.progress.getBoundingClientRect();
        const containerRect = this.player.elements.container.getBoundingClientRect();
        const {
          container
        } = this.elements.thumb;
        // Find the lowest and highest desired left-position, so we don't slide out the side of the video container
        const min = containerRect.left - scrubberRect.left + 10;
        const max = containerRect.right - scrubberRect.left - container.clientWidth - 10;
        // Set preview container position to: mousepos, minus seekbar.left, minus half of previewContainer.clientWidth
        const position = this.mousePosX - scrubberRect.left - container.clientWidth / 2;
        const clamped = clamp(position, min, max);

        // Move the popover position
        container.style.left = `${clamped}px`;

        // The arrow can follow the cursor
        container.style.setProperty('--preview-arrow-offset', `${position - clamped}px`);
      });
      _defineProperty$1(this, "setScrubbingContainerSize", () =&gt; {
        const {
          width,
          height
        } = fitRatio(this.thumbAspectRatio, {
          width: this.player.media.clientWidth,
          height: this.player.media.clientHeight
        });
        this.elements.scrubbing.container.style.width = `${width}px`;
        this.elements.scrubbing.container.style.height = `${height}px`;
      });
      _defineProperty$1(this, "setImageSizeAndOffset", (previewImage, frame) =&gt; {
        if (!this.usingSprites) return;

        // Find difference between height and preview container height
        const multiplier = this.thumbContainerHeight / frame.h;

        // eslint-disable-next-line no-param-reassign
        previewImage.style.height = `${previewImage.naturalHeight * multiplier}px`;
        // eslint-disable-next-line no-param-reassign
        previewImage.style.width = `${previewImage.naturalWidth * multiplier}px`;
        // eslint-disable-next-line no-param-reassign
        previewImage.style.left = `-${frame.x * multiplier}px`;
        // eslint-disable-next-line no-param-reassign
        previewImage.style.top = `-${frame.y * multiplier}px`;
      });
      this.player = player;
      this.thumbnails = [];
      this.loaded = false;
      this.lastMouseMoveTime = Date.now();
      this.mouseDown = false;
      this.loadedImages = [];
      this.elements = {
        thumb: {},
        scrubbing: {}
      };
      this.load();
    }
    get enabled() {
      return this.player.isHTML5 &amp;&amp; this.player.isVideo &amp;&amp; this.player.config.previewThumbnails.enabled;
    }
    get currentImageContainer() {
      return this.mouseDown ? this.elements.scrubbing.container : this.elements.thumb.imageContainer;
    }
    get usingSprites() {
      return Object.keys(this.thumbnails[0].frames[0]).includes('w');
    }
    get thumbAspectRatio() {
      if (this.usingSprites) {
        return this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h;
      }
      return this.thumbnails[0].width / this.thumbnails[0].height;
    }
    get thumbContainerHeight() {
      if (this.mouseDown) {
        const {
          height
        } = fitRatio(this.thumbAspectRatio, {
          width: this.player.media.clientWidth,
          height: this.player.media.clientHeight
        });
        return height;
      }

      // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset)
      if (this.sizeSpecifiedInCSS) {
        return this.elements.thumb.imageContainer.clientHeight;
      }
      return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4);
    }
    get currentImageElement() {
      return this.mouseDown ? this.currentScrubbingImageElement : this.currentThumbnailImageElement;
    }
    set currentImageElement(element) {
      if (this.mouseDown) {
        this.currentScrubbingImageElement = element;
      } else {
        this.currentThumbnailImageElement = element;
      }
    }
  }

  // ==========================================================================
  const source = {
    // Add elements to HTML5 media (source, tracks, etc)
    insertElements(type, attributes) {
      if (is.string(attributes)) {
        insertElement(type, this.media, {
          src: attributes
        });
      } else if (is.array(attributes)) {
        attributes.forEach(attribute =&gt; {
          insertElement(type, this.media, attribute);
        });
      }
    },
    // Update source
    // Sources are not checked for support so be careful
    change(input) {
      if (!getDeep(input, 'sources.length')) {
        this.debug.warn('Invalid source format');
        return;
      }

      // Cancel current network requests
      html5.cancelRequests.call(this);

      // Destroy instance and re-setup
      this.destroy.call(this, () =&gt; {
        // Reset quality options
        this.options.quality = [];

        // Remove elements
        removeElement(this.media);
        this.media = null;

        // Reset class name
        if (is.element(this.elements.container)) {
          this.elements.container.removeAttribute('class');
        }

        // Set the type and provider
        const {
          sources,
          type
        } = input;
        const [{
          provider = providers.html5,
          src
        }] = sources;
        const tagName = provider === 'html5' ? type : 'div';
        const attributes = provider === 'html5' ? {} : {
          src
        };
        Object.assign(this, {
          provider,
          type,
          // Check for support
          supported: support.check(type, provider, this.config.playsinline),
          // Create new element
          media: createElement(tagName, attributes)
        });

        // Inject the new element
        this.elements.container.appendChild(this.media);

        // Autoplay the new source?
        if (is.boolean(input.autoplay)) {
          this.config.autoplay = input.autoplay;
        }

        // Set attributes for audio and video
        if (this.isHTML5) {
          if (this.config.crossorigin) {
            this.media.setAttribute('crossorigin', '');
          }
          if (this.config.autoplay) {
            this.media.setAttribute('autoplay', '');
          }
          if (!is.empty(input.poster)) {
            this.poster = input.poster;
          }
          if (this.config.loop.active) {
            this.media.setAttribute('loop', '');
          }
          if (this.config.muted) {
            this.media.setAttribute('muted', '');
          }
          if (this.config.playsinline) {
            this.media.setAttribute('playsinline', '');
          }
        }

        // Restore class hook
        ui.addStyleHook.call(this);

        // Set new sources for html5
        if (this.isHTML5) {
          source.insertElements.call(this, 'source', sources);
        }

        // Set video title
        this.config.title = input.title;

        // Set up from scratch
        media.setup.call(this);

        // HTML5 stuff
        if (this.isHTML5) {
          // Setup captions
          if (Object.keys(input).includes('tracks')) {
            source.insertElements.call(this, 'track', input.tracks);
          }
        }

        // If HTML5 or embed but not fully supported, setupInterface and call ready now
        if (this.isHTML5 || this.isEmbed &amp;&amp; !this.supported.ui) {
          // Setup interface
          ui.build.call(this);
        }

        // Load HTML5 sources
        if (this.isHTML5) {
          this.media.load();
        }

        // Update previewThumbnails config &amp; reload plugin
        if (!is.empty(input.previewThumbnails)) {
          Object.assign(this.config.previewThumbnails, input.previewThumbnails);

          // Cleanup previewThumbnails plugin if it was loaded
          if (this.previewThumbnails &amp;&amp; this.previewThumbnails.loaded) {
            this.previewThumbnails.destroy();
            this.previewThumbnails = null;
          }

          // Create new instance if it is still enabled
          if (this.config.previewThumbnails.enabled) {
            this.previewThumbnails = new PreviewThumbnails(this);
          }
        }

        // Update the fullscreen support
        this.fullscreen.update();
      }, true);
    }
  };

  // Private properties
  // TODO: Use a WeakMap for private globals
  // const globals = new WeakMap();

  // Plyr instance
  class Plyr {
    constructor(target, options) {
      _defineProperty$1(this, "play", () =&gt; {
        if (!is.function(this.media.play)) {
          return null;
        }

        // Intecept play with ads
        if (this.ads &amp;&amp; this.ads.enabled) {
          this.ads.managerPromise.then(() =&gt; this.ads.play()).catch(() =&gt; silencePromise(this.media.play()));
        }

        // Return the promise (for HTML5)
        return this.media.play();
      });
      _defineProperty$1(this, "pause", () =&gt; {
        if (!this.playing || !is.function(this.media.pause)) {
          return null;
        }
        return this.media.pause();
      });
      _defineProperty$1(this, "togglePlay", input =&gt; {
        // Toggle based on current state if nothing passed
        const toggle = is.boolean(input) ? input : !this.playing;
        if (toggle) {
          return this.play();
        }
        return this.pause();
      });
      _defineProperty$1(this, "stop", () =&gt; {
        if (this.isHTML5) {
          this.pause();
          this.restart();
        } else if (is.function(this.media.stop)) {
          this.media.stop();
        }
      });
      _defineProperty$1(this, "restart", () =&gt; {
        this.currentTime = 0;
      });
      _defineProperty$1(this, "rewind", seekTime =&gt; {
        this.currentTime -= is.number(seekTime) ? seekTime : this.config.seekTime;
      });
      _defineProperty$1(this, "forward", seekTime =&gt; {
        this.currentTime += is.number(seekTime) ? seekTime : this.config.seekTime;
      });
      _defineProperty$1(this, "increaseVolume", step =&gt; {
        const volume = this.media.muted ? 0 : this.volume;
        this.volume = volume + (is.number(step) ? step : 0);
      });
      _defineProperty$1(this, "decreaseVolume", step =&gt; {
        this.increaseVolume(-step);
      });
      _defineProperty$1(this, "airplay", () =&gt; {
        // Show dialog if supported
        if (support.airplay) {
          this.media.webkitShowPlaybackTargetPicker();
        }
      });
      _defineProperty$1(this, "toggleControls", toggle =&gt; {
        // Don't toggle if missing UI support or if it's audio
        if (this.supported.ui &amp;&amp; !this.isAudio) {
          // Get state before change
          const isHidden = hasClass(this.elements.container, this.config.classNames.hideControls);
          // Negate the argument if not undefined since adding the class to hides the controls
          const force = typeof toggle === 'undefined' ? undefined : !toggle;
          // Apply and get updated state
          const hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force);

          // Close menu
          if (hiding &amp;&amp; is.array(this.config.controls) &amp;&amp; this.config.controls.includes('settings') &amp;&amp; !is.empty(this.config.settings)) {
            controls.toggleMenu.call(this, false);
          }

          // Trigger event on change
          if (hiding !== isHidden) {
            const eventName = hiding ? 'controlshidden' : 'controlsshown';
            triggerEvent.call(this, this.media, eventName);
          }
          return !hiding;
        }
        return false;
      });
      _defineProperty$1(this, "on", (event, callback) =&gt; {
        on.call(this, this.elements.container, event, callback);
      });
      _defineProperty$1(this, "once", (event, callback) =&gt; {
        once.call(this, this.elements.container, event, callback);
      });
      _defineProperty$1(this, "off", (event, callback) =&gt; {
        off(this.elements.container, event, callback);
      });
      _defineProperty$1(this, "destroy", (callback, soft = false) =&gt; {
        if (!this.ready) {
          return;
        }
        const done = () =&gt; {
          // Reset overflow (incase destroyed while in fullscreen)
          document.body.style.overflow = '';

          // GC for embed
          this.embed = null;

          // If it's a soft destroy, make minimal changes
          if (soft) {
            if (Object.keys(this.elements).length) {
              // Remove elements
              removeElement(this.elements.buttons.play);
              removeElement(this.elements.captions);
              removeElement(this.elements.controls);
              removeElement(this.elements.wrapper);

              // Clear for GC
              this.elements.buttons.play = null;
              this.elements.captions = null;
              this.elements.controls = null;
              this.elements.wrapper = null;
            }

            // Callback
            if (is.function(callback)) {
              callback();
            }
          } else {
            // Unbind listeners
            unbindListeners.call(this);

            // Cancel current network requests
            html5.cancelRequests.call(this);

            // Replace the container with the original element provided
            replaceElement(this.elements.original, this.elements.container);

            // Event
            triggerEvent.call(this, this.elements.original, 'destroyed', true);

            // Callback
            if (is.function(callback)) {
              callback.call(this.elements.original);
            }

            // Reset state
            this.ready = false;

            // Clear for garbage collection
            setTimeout(() =&gt; {
              this.elements = null;
              this.media = null;
            }, 200);
          }
        };

        // Stop playback
        this.stop();

        // Clear timeouts
        clearTimeout(this.timers.loading);
        clearTimeout(this.timers.controls);
        clearTimeout(this.timers.resized);

        // Provider specific stuff
        if (this.isHTML5) {
          // Restore native video controls
          ui.toggleNativeControls.call(this, true);

          // Clean up
          done();
        } else if (this.isYouTube) {
          // Clear timers
          clearInterval(this.timers.buffering);
          clearInterval(this.timers.playing);

          // Destroy YouTube API
          if (this.embed !== null &amp;&amp; is.function(this.embed.destroy)) {
            this.embed.destroy();
          }

          // Clean up
          done();
        } else if (this.isVimeo) {
          // Destroy Vimeo API
          // then clean up (wait, to prevent postmessage errors)
          if (this.embed !== null) {
            this.embed.unload().then(done);
          }

          // Vimeo does not always return
          setTimeout(done, 200);
        }
      });
      _defineProperty$1(this, "supports", type =&gt; support.mime.call(this, type));
      this.timers = {};

      // State
      this.ready = false;
      this.loading = false;
      this.failed = false;

      // Touch device
      this.touch = support.touch;

      // Set the media element
      this.media = target;

      // String selector passed
      if (is.string(this.media)) {
        this.media = document.querySelectorAll(this.media);
      }

      // jQuery, NodeList or Array passed, use first element
      if (window.jQuery &amp;&amp; this.media instanceof jQuery || is.nodeList(this.media) || is.array(this.media)) {
        // eslint-disable-next-line
        this.media = this.media[0];
      }

      // Set config
      this.config = extend({}, defaults, Plyr.defaults, options || {}, (() =&gt; {
        try {
          return JSON.parse(this.media.getAttribute('data-plyr-config'));
        } catch (_) {
          return {};
        }
      })());

      // Elements cache
      this.elements = {
        container: null,
        fullscreen: null,
        captions: null,
        buttons: {},
        display: {},
        progress: {},
        inputs: {},
        settings: {
          popup: null,
          menu: null,
          panels: {},
          buttons: {}
        }
      };

      // Captions
      this.captions = {
        active: null,
        currentTrack: -1,
        meta: new WeakMap()
      };

      // Fullscreen
      this.fullscreen = {
        active: false
      };

      // Options
      this.options = {
        speed: [],
        quality: []
      };

      // Debugging
      // TODO: move to globals
      this.debug = new Console(this.config.debug);

      // Log config options and support
      this.debug.log('Config', this.config);
      this.debug.log('Support', support);

      // We need an element to setup
      if (is.nullOrUndefined(this.media) || !is.element(this.media)) {
        this.debug.error('Setup failed: no suitable element passed');
        return;
      }

      // Bail if the element is initialized
      if (this.media.plyr) {
        this.debug.warn('Target already setup');
        return;
      }

      // Bail if not enabled
      if (!this.config.enabled) {
        this.debug.error('Setup failed: disabled by config');
        return;
      }

      // Bail if disabled or no basic support
      // You may want to disable certain UAs etc
      if (!support.check().api) {
        this.debug.error('Setup failed: no support');
        return;
      }

      // Cache original element state for .destroy()
      const clone = this.media.cloneNode(true);
      clone.autoplay = false;
      this.elements.original = clone;

      // Set media type based on tag or data attribute
      // Supported: video, audio, vimeo, youtube
      const _type = this.media.tagName.toLowerCase();
      // Embed properties
      let iframe = null;
      let url = null;

      // Different setup based on type
      switch (_type) {
        case 'div':
          // Find the frame
          iframe = this.media.querySelector('iframe');

          // &lt;iframe&gt; type
          if (is.element(iframe)) {
            // Detect provider
            url = parseUrl(iframe.getAttribute('src'));
            this.provider = getProviderByUrl(url.toString());

            // Rework elements
            this.elements.container = this.media;
            this.media = iframe;

            // Reset classname
            this.elements.container.className = '';

            // Get attributes from URL and set config
            if (url.search.length) {
              const truthy = ['1', 'true'];
              if (truthy.includes(url.searchParams.get('autoplay'))) {
                this.config.autoplay = true;
              }
              if (truthy.includes(url.searchParams.get('loop'))) {
                this.config.loop.active = true;
              }

              // TODO: replace fullscreen.iosNative with this playsinline config option
              // YouTube requires the playsinline in the URL
              if (this.isYouTube) {
                this.config.playsinline = truthy.includes(url.searchParams.get('playsinline'));
                this.config.youtube.hl = url.searchParams.get('hl'); // TODO: Should this be setting language?
              } else {
                this.config.playsinline = true;
              }
            }
          } else {
            // &lt;div&gt; with attributes
            this.provider = this.media.getAttribute(this.config.attributes.embed.provider);

            // Remove attribute
            this.media.removeAttribute(this.config.attributes.embed.provider);
          }

          // Unsupported or missing provider
          if (is.empty(this.provider) || !Object.values(providers).includes(this.provider)) {
            this.debug.error('Setup failed: Invalid provider');
            return;
          }

          // Audio will come later for external providers
          this.type = types.video;
          break;
        case 'video':
        case 'audio':
          this.type = _type;
          this.provider = providers.html5;

          // Get config from attributes
          if (this.media.hasAttribute('crossorigin')) {
            this.config.crossorigin = true;
          }
          if (this.media.hasAttribute('autoplay')) {
            this.config.autoplay = true;
          }
          if (this.media.hasAttribute('playsinline') || this.media.hasAttribute('webkit-playsinline')) {
            this.config.playsinline = true;
          }
          if (this.media.hasAttribute('muted')) {
            this.config.muted = true;
          }
          if (this.media.hasAttribute('loop')) {
            this.config.loop.active = true;
          }
          break;
        default:
          this.debug.error('Setup failed: unsupported type');
          return;
      }

      // Check for support again but with type
      this.supported = support.check(this.type, this.provider, this.config.playsinline);

      // If no support for even API, bail
      if (!this.supported.api) {
        this.debug.error('Setup failed: no support');
        return;
      }
      this.eventListeners = [];

      // Create listeners
      this.listeners = new Listeners(this);

      // Setup local storage for user settings
      this.storage = new Storage(this);

      // Store reference
      this.media.plyr = this;

      // Wrap media
      if (!is.element(this.elements.container)) {
        this.elements.container = createElement('div', {
          tabindex: 0
        });
        wrap(this.media, this.elements.container);
      }

      // Migrate custom properties from media to container (so they work 😉)
      ui.migrateStyles.call(this);

      // Add style hook
      ui.addStyleHook.call(this);

      // Setup media
      media.setup.call(this);

      // Listen for events if debugging
      if (this.config.debug) {
        on.call(this, this.elements.container, this.config.events.join(' '), event =&gt; {
          this.debug.log(`event: ${event.type}`);
        });
      }

      // Setup fullscreen
      this.fullscreen = new Fullscreen(this);

      // Setup interface
      // If embed but not fully supported, build interface now to avoid flash of controls
      if (this.isHTML5 || this.isEmbed &amp;&amp; !this.supported.ui) {
        ui.build.call(this);
      }

      // Container listeners
      this.listeners.container();

      // Global listeners
      this.listeners.global();

      // Setup ads if provided
      if (this.config.ads.enabled) {
        this.ads = new Ads(this);
      }

      // Autoplay if required
      if (this.isHTML5 &amp;&amp; this.config.autoplay) {
        this.once('canplay', () =&gt; silencePromise(this.play()));
      }

      // Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek
      this.lastSeekTime = 0;

      // Setup preview thumbnails if enabled
      if (this.config.previewThumbnails.enabled) {
        this.previewThumbnails = new PreviewThumbnails(this);
      }
    }

    // ---------------------------------------
    // API
    // ---------------------------------------

    /**
     * Types and provider helpers
     */
    get isHTML5() {
      return this.provider === providers.html5;
    }
    get isEmbed() {
      return this.isYouTube || this.isVimeo;
    }
    get isYouTube() {
      return this.provider === providers.youtube;
    }
    get isVimeo() {
      return this.provider === providers.vimeo;
    }
    get isVideo() {
      return this.type === types.video;
    }
    get isAudio() {
      return this.type === types.audio;
    }

    /**
     * Play the media, or play the advertisement (if they are not blocked)
     */

    /**
     * Get playing state
     */
    get playing() {
      return Boolean(this.ready &amp;&amp; !this.paused &amp;&amp; !this.ended);
    }

    /**
     * Get paused state
     */
    get paused() {
      return Boolean(this.media.paused);
    }

    /**
     * Get stopped state
     */
    get stopped() {
      return Boolean(this.paused &amp;&amp; this.currentTime === 0);
    }

    /**
     * Get ended state
     */
    get ended() {
      return Boolean(this.media.ended);
    }

    /**
     * Toggle playback based on current status
     * @param {Boolean} input
     */

    /**
     * Seek to a time
     * @param {Number} input - where to seek to in seconds. Defaults to 0 (the start)
     */
    set currentTime(input) {
      // Bail if media duration isn't available yet
      if (!this.duration) {
        return;
      }

      // Validate input
      const inputIsValid = is.number(input) &amp;&amp; input &gt; 0;

      // Set
      this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0;

      // Logging
      this.debug.log(`Seeking to ${this.currentTime} seconds`);
    }

    /**
     * Get current time
     */
    get currentTime() {
      return Number(this.media.currentTime);
    }

    /**
     * Get buffered
     */
    get buffered() {
      const {
        buffered
      } = this.media;

      // YouTube / Vimeo return a float between 0-1
      if (is.number(buffered)) {
        return buffered;
      }

      // HTML5
      // TODO: Handle buffered chunks of the media
      // (i.e. seek to another section buffers only that section)
      if (buffered &amp;&amp; buffered.length &amp;&amp; this.duration &gt; 0) {
        return buffered.end(0) / this.duration;
      }
      return 0;
    }

    /**
     * Get seeking status
     */
    get seeking() {
      return Boolean(this.media.seeking);
    }

    /**
     * Get the duration of the current media
     */
    get duration() {
      // Faux duration set via config
      const fauxDuration = parseFloat(this.config.duration);
      // Media duration can be NaN or Infinity before the media has loaded
      const realDuration = (this.media || {}).duration;
      const duration = !is.number(realDuration) || realDuration === Infinity ? 0 : realDuration;

      // If config duration is funky, use regular duration
      return fauxDuration || duration;
    }

    /**
     * Set the player volume
     * @param {Number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage
     */
    set volume(value) {
      let volume = value;
      const max = 1;
      const min = 0;
      if (is.string(volume)) {
        volume = Number(volume);
      }

      // Load volume from storage if no value specified
      if (!is.number(volume)) {
        volume = this.storage.get('volume');
      }

      // Use config if all else fails
      if (!is.number(volume)) {
        ({
          volume
        } = this.config);
      }

      // Maximum is volumeMax
      if (volume &gt; max) {
        volume = max;
      }
      // Minimum is volumeMin
      if (volume &lt; min) {
        volume = min;
      }

      // Update config
      this.config.volume = volume;

      // Set the player volume
      this.media.volume = volume;

      // If muted, and we're increasing volume manually, reset muted state
      if (!is.empty(value) &amp;&amp; this.muted &amp;&amp; volume &gt; 0) {
        this.muted = false;
      }
    }

    /**
     * Get the current player volume
     */
    get volume() {
      return Number(this.media.volume);
    }

    /**
     * Increase volume
     * @param {Boolean} step - How much to decrease by (between 0 and 1)
     */

    /**
     * Set muted state
     * @param {Boolean} mute
     */
    set muted(mute) {
      let toggle = mute;

      // Load muted state from storage
      if (!is.boolean(toggle)) {
        toggle = this.storage.get('muted');
      }

      // Use config if all else fails
      if (!is.boolean(toggle)) {
        toggle = this.config.muted;
      }

      // Update config
      this.config.muted = toggle;

      // Set mute on the player
      this.media.muted = toggle;
    }

    /**
     * Get current muted state
     */
    get muted() {
      return Boolean(this.media.muted);
    }

    /**
     * Check if the media has audio
     */
    get hasAudio() {
      // Assume yes for all non HTML5 (as we can't tell...)
      if (!this.isHTML5) {
        return true;
      }
      if (this.isAudio) {
        return true;
      }

      // Get audio tracks
      return Boolean(this.media.mozHasAudio) || Boolean(this.media.webkitAudioDecodedByteCount) || Boolean(this.media.audioTracks &amp;&amp; this.media.audioTracks.length);
    }

    /**
     * Set playback speed
     * @param {Number} input - the speed of playback (0.5-2.0)
     */
    set speed(input) {
      let speed = null;
      if (is.number(input)) {
        speed = input;
      }
      if (!is.number(speed)) {
        speed = this.storage.get('speed');
      }
      if (!is.number(speed)) {
        speed = this.config.speed.selected;
      }

      // Clamp to min/max
      const {
        minimumSpeed: min,
        maximumSpeed: max
      } = this;
      speed = clamp(speed, min, max);

      // Update config
      this.config.speed.selected = speed;

      // Set media speed
      setTimeout(() =&gt; {
        if (this.media) {
          this.media.playbackRate = speed;
        }
      }, 0);
    }

    /**
     * Get current playback speed
     */
    get speed() {
      return Number(this.media.playbackRate);
    }

    /**
     * Get the minimum allowed speed
     */
    get minimumSpeed() {
      if (this.isYouTube) {
        // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
        return Math.min(...this.options.speed);
      }
      if (this.isVimeo) {
        // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
        return 0.5;
      }

      // https://stackoverflow.com/a/32320020/1191319
      return 0.0625;
    }

    /**
     * Get the maximum allowed speed
     */
    get maximumSpeed() {
      if (this.isYouTube) {
        // https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate
        return Math.max(...this.options.speed);
      }
      if (this.isVimeo) {
        // https://github.com/vimeo/player.js/#setplaybackrateplaybackrate-number-promisenumber-rangeerrorerror
        return 2;
      }

      // https://stackoverflow.com/a/32320020/1191319
      return 16;
    }

    /**
     * Set playback quality
     * Currently HTML5 &amp; YouTube only
     * @param {Number} input - Quality level
     */
    set quality(input) {
      const config = this.config.quality;
      const options = this.options.quality;
      if (!options.length) {
        return;
      }
      let quality = [!is.empty(input) &amp;&amp; Number(input), this.storage.get('quality'), config.selected, config.default].find(is.number);
      let updateStorage = true;
      if (!options.includes(quality)) {
        const value = closest(options, quality);
        this.debug.warn(`Unsupported quality option: ${quality}, using ${value} instead`);
        quality = value;

        // Don't update storage if quality is not supported
        updateStorage = false;
      }

      // Update config
      config.selected = quality;

      // Set quality
      this.media.quality = quality;

      // Save to storage
      if (updateStorage) {
        this.storage.set({
          quality
        });
      }
    }

    /**
     * Get current quality level
     */
    get quality() {
      return this.media.quality;
    }

    /**
     * Toggle loop
     * TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config
     * @param {Boolean} input - Whether to loop or not
     */
    set loop(input) {
      const toggle = is.boolean(input) ? input : this.config.loop.active;
      this.config.loop.active = toggle;
      this.media.loop = toggle;

      // Set default to be a true toggle
      /* const type = ['start', 'end', 'all', 'none', 'toggle'].includes(input) ? input : 'toggle';
           switch (type) {
              case 'start':
                  if (this.config.loop.end &amp;&amp; this.config.loop.end &lt;= this.currentTime) {
                      this.config.loop.end = null;
                  }
                  this.config.loop.start = this.currentTime;
                  // this.config.loop.indicator.start = this.elements.display.played.value;
                  break;
               case 'end':
                  if (this.config.loop.start &gt;= this.currentTime) {
                      return this;
                  }
                  this.config.loop.end = this.currentTime;
                  // this.config.loop.indicator.end = this.elements.display.played.value;
                  break;
               case 'all':
                  this.config.loop.start = 0;
                  this.config.loop.end = this.duration - 2;
                  this.config.loop.indicator.start = 0;
                  this.config.loop.indicator.end = 100;
                  break;
               case 'toggle':
                  if (this.config.loop.active) {
                      this.config.loop.start = 0;
                      this.config.loop.end = null;
                  } else {
                      this.config.loop.start = 0;
                      this.config.loop.end = this.duration - 2;
                  }
                  break;
               default:
                  this.config.loop.start = 0;
                  this.config.loop.end = null;
                  break;
          } */
    }

    /**
     * Get current loop state
     */
    get loop() {
      return Boolean(this.media.loop);
    }

    /**
     * Set new media source
     * @param {Object} input - The new source object (see docs)
     */
    set source(input) {
      source.change.call(this, input);
    }

    /**
     * Get current source
     */
    get source() {
      return this.media.currentSrc;
    }

    /**
     * Get a download URL (either source or custom)
     */
    get download() {
      const {
        download
      } = this.config.urls;
      return is.url(download) ? download : this.source;
    }

    /**
     * Set the download URL
     */
    set download(input) {
      if (!is.url(input)) {
        return;
      }
      this.config.urls.download = input;
      controls.setDownloadUrl.call(this);
    }

    /**
     * Set the poster image for a video
     * @param {String} input - the URL for the new poster image
     */
    set poster(input) {
      if (!this.isVideo) {
        this.debug.warn('Poster can only be set for video');
        return;
      }
      ui.setPoster.call(this, input, false).catch(() =&gt; {});
    }

    /**
     * Get the current poster image
     */
    get poster() {
      if (!this.isVideo) {
        return null;
      }
      return this.media.getAttribute('poster') || this.media.getAttribute('data-poster');
    }

    /**
     * Get the current aspect ratio in use
     */
    get ratio() {
      if (!this.isVideo) {
        return null;
      }
      const ratio = reduceAspectRatio(getAspectRatio.call(this));
      return is.array(ratio) ? ratio.join(':') : ratio;
    }

    /**
     * Set video aspect ratio
     */
    set ratio(input) {
      if (!this.isVideo) {
        this.debug.warn('Aspect ratio can only be set for video');
        return;
      }
      if (!is.string(input) || !validateAspectRatio(input)) {
        this.debug.error(`Invalid aspect ratio specified (${input})`);
        return;
      }
      this.config.ratio = reduceAspectRatio(input);
      setAspectRatio.call(this);
    }

    /**
     * Set the autoplay state
     * @param {Boolean} input - Whether to autoplay or not
     */
    set autoplay(input) {
      this.config.autoplay = is.boolean(input) ? input : this.config.autoplay;
    }

    /**
     * Get the current autoplay state
     */
    get autoplay() {
      return Boolean(this.config.autoplay);
    }

    /**
     * Toggle captions
     * @param {Boolean} input - Whether to enable captions
     */
    toggleCaptions(input) {
      captions.toggle.call(this, input, false);
    }

    /**
     * Set the caption track by index
     * @param {Number} input - Caption index
     */
    set currentTrack(input) {
      captions.set.call(this, input, false);
      captions.setup.call(this);
    }

    /**
     * Get the current caption track index (-1 if disabled)
     */
    get currentTrack() {
      const {
        toggled,
        currentTrack
      } = this.captions;
      return toggled ? currentTrack : -1;
    }

    /**
     * Set the wanted language for captions
     * Since tracks can be added later it won't update the actual caption track until there is a matching track
     * @param {String} input - Two character ISO language code (e.g. EN, FR, PT, etc)
     */
    set language(input) {
      captions.setLanguage.call(this, input, false);
    }

    /**
     * Get the current track's language
     */
    get language() {
      return (captions.getCurrentTrack.call(this) || {}).language;
    }

    /**
     * Toggle picture-in-picture playback on WebKit/MacOS
     * TODO: update player with state, support, enabled
     * TODO: detect outside changes
     */
    set pip(input) {
      // Bail if no support
      if (!support.pip) {
        return;
      }

      // Toggle based on current state if not passed
      const toggle = is.boolean(input) ? input : !this.pip;

      // Toggle based on current state
      // Safari
      if (is.function(this.media.webkitSetPresentationMode)) {
        this.media.webkitSetPresentationMode(toggle ? pip.active : pip.inactive);
      }

      // Chrome
      if (is.function(this.media.requestPictureInPicture)) {
        if (!this.pip &amp;&amp; toggle) {
          this.media.requestPictureInPicture();
        } else if (this.pip &amp;&amp; !toggle) {
          document.exitPictureInPicture();
        }
      }
    }

    /**
     * Get the current picture-in-picture state
     */
    get pip() {
      if (!support.pip) {
        return null;
      }

      // Safari
      if (!is.empty(this.media.webkitPresentationMode)) {
        return this.media.webkitPresentationMode === pip.active;
      }

      // Chrome
      return this.media === document.pictureInPictureElement;
    }

    /**
     * Sets the preview thubmnails for the current source
     */
    setPreviewThumbnails(thumbnailSource) {
      if (this.previewThumbnails &amp;&amp; this.previewThumbnails.loaded) {
        this.previewThumbnails.destroy();
        this.previewThumbnails = null;
      }
      Object.assign(this.config.previewThumbnails, thumbnailSource);

      // Create new instance if it is still enabled
      if (this.config.previewThumbnails.enabled) {
        this.previewThumbnails = new PreviewThumbnails(this);
      }
    }

    /**
     * Trigger the airplay dialog
     * TODO: update player with state, support, enabled
     */

    /**
     * Check for support
     * @param {String} type - Player type (audio/video)
     * @param {String} provider - Provider (html5/youtube/vimeo)
     * @param {Boolean} inline - Where player has `playsinline` sttribute
     */
    static supported(type, provider, inline) {
      return support.check(type, provider, inline);
    }

    /**
     * Load an SVG sprite into the page
     * @param {String} url - URL for the SVG sprite
     * @param {String} [id] - Unique ID
     */
    static loadSprite(url, id) {
      return loadSprite(url, id);
    }

    /**
     * Setup multiple instances
     * @param {*} selector
     * @param {Object} options
     */
    static setup(selector, options = {}) {
      let targets = null;
      if (is.string(selector)) {
        targets = Array.from(document.querySelectorAll(selector));
      } else if (is.nodeList(selector)) {
        targets = Array.from(selector);
      } else if (is.array(selector)) {
        targets = selector.filter(is.element);
      }
      if (is.empty(targets)) {
        return null;
      }
      return targets.map(t =&gt; new Plyr(t, options));
    }
  }
  Plyr.defaults = cloneDeep(defaults);

  return Plyr;

}));
//# sourceMappingURL=plyr.js.map

/* Chosen v1.8.3 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */

(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&amp;&amp;(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s&lt;i;s++)n=r[s],o.push(this.add_option(n,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&amp;&amp;(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,r,o;for(r=new i,s=0,n=(o=t.childNodes).length;s&lt;n;s++)e=o[s],r.add_node(e);return r.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&amp;&amp;(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&amp;&amp;null!=this.form_field.options[0]&amp;&amp;""===this.form_field.options[0].text&amp;&amp;this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&amp;&amp;null!=t.group_label?"&lt;b class='group-name'&gt;"+t.group_label+"&lt;/b&gt;"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n&lt;r&amp;&amp;(s=o[n],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&amp;&amp;(h++,e+=i),(null!=t?t.first:void 0)&amp;&amp;(s.selected&amp;&amp;this.is_multiple?this.choice_build(s):s.selected&amp;&amp;!this.is_multiple&amp;&amp;this.single_set_selected_text(this.choice_label(s))),!(h&gt;=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&amp;&amp;this.include_option_in_results(t)?(e=[],t.disabled||t.selected&amp;&amp;this.is_multiple||e.push("active-result"),!t.disabled||t.selected&amp;&amp;this.is_multiple||e.push("disabled-result"),t.selected&amp;&amp;e.push("result-selected"),null!=t.group_array_index&amp;&amp;e.push("group-option"),""!==t.classes&amp;&amp;e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.style.cssText=t.style,s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&amp;&amp;(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&amp;&amp;t.active_options&gt;0?((e=[]).push("group-result"),t.classes&amp;&amp;e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&amp;&amp;(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t&lt;e;t++)(i=s[t]).selected?n.push(i.selected=!1):n.push(void 0);return n},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(){var t,e,s,i,n,r,o,h,l,c,_,a,u,d,p;for(this.no_results_clear(),c=0,t=(o=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&amp;"),l=this.get_search_regex(t),s=0,i=(h=this.results_data).length;s&lt;i;s++)(n=h[s]).search_match=!1,_=null,a=null,n.highlighted_html="",this.include_option_in_results(n)&amp;&amp;(n.group&amp;&amp;(n.group_match=!1,n.active_options=0),null!=n.group_array_index&amp;&amp;this.results_data[n.group_array_index]&amp;&amp;(0===(_=this.results_data[n.group_array_index]).active_options&amp;&amp;_.search_match&amp;&amp;(c+=1),_.active_options+=1),p=n.group?n.label:n.text,n.group&amp;&amp;!this.group_search||(a=this.search_string_match(p,l),n.search_match=null!=a,n.search_match&amp;&amp;!n.group&amp;&amp;(c+=1),n.search_match?(o.length&amp;&amp;(u=a.index,r=p.slice(0,u),e=p.slice(u,u+o.length),d=p.slice(u+o.length),n.highlighted_html=this.escape_html(r)+"&lt;em&gt;"+this.escape_html(e)+"&lt;/em&gt;"+this.escape_html(d)),null!=_&amp;&amp;(_.group_match=!0)):null!=n.group_array_index&amp;&amp;this.results_data[n.group_array_index].search_match&amp;&amp;(n.search_match=!0)));return this.result_clear_highlight(),c&lt;1&amp;&amp;o.length?(this.update_results_content(""),this.no_results(o)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&amp;&amp;(null!=s?s[1]:void 0)&amp;&amp;(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t&lt;e;t++)s[t].selected&amp;&amp;(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&amp;&amp;!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&amp;&amp;this.pending_backstroke&amp;&amp;this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&amp;&amp;!this.is_multiple&amp;&amp;this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&amp;&amp;t.preventDefault();break;case 32:this.disable_search&amp;&amp;t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&amp;&amp;this.backstroke_length&lt;1&amp;&amp;this.choices_count()&gt;0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&amp;&amp;this.result_select(t);break;case 27:this.results_showing&amp;&amp;this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&amp;&amp;!this.display_selected_options&amp;&amp;t.selected)&amp;&amp;(!(!this.display_disabled_options&amp;&amp;t.disabled)&amp;&amp;!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'&lt;a class="chosen-single chosen-default"&gt;\n  &lt;input class="chosen-search-input" type="text" autocomplete="off" /&gt;\n  &lt;span&gt;'+this.default_text+'&lt;/span&gt;\n  &lt;div&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;\n&lt;/a&gt;\n&lt;div class="chosen-drop"&gt;\n  &lt;div class="chosen-search"&gt;\n  &lt;/div&gt;\n  &lt;ul class="chosen-results"&gt;&lt;/ul&gt;\n&lt;/div&gt;'},t.prototype.get_multi_html=function(){return'&lt;ul class="chosen-choices"&gt;\n  &lt;li class="search-field"&gt;\n    &lt;input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" /&gt;\n  &lt;/li&gt;\n&lt;/ul&gt;\n&lt;div class="chosen-drop"&gt;\n  &lt;ul class="chosen-results"&gt;&lt;/ul&gt;\n&lt;/div&gt;'},t.prototype.get_no_results_html=function(t){return'&lt;li class="no-results"&gt;\n  '+this.results_none_found+" &lt;span&gt;"+this.escape_html(t)+"&lt;/span&gt;\n&lt;/li&gt;"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode&gt;=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&amp;&amp;r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&amp;&amp;this.form_field.className&amp;&amp;e.push(this.form_field.className),this.is_rtl&amp;&amp;e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&amp;&amp;(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("&lt;div /&gt;",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length&gt;0&amp;&amp;this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&amp;&amp;(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&amp;&amp;"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&amp;&amp;t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&amp;&amp;!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&amp;&amp;this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&amp;&amp;!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&amp;&amp;(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&amp;&amp;(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&amp;&amp;this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&amp;&amp;this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length&lt;=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())&gt;=n)return this.search_results.scrollTop(e-i&gt;0?e-i:0);if(s&lt;r)return this.search_results.scrollTop(s)}},n.prototype.result_clear_highlight=function(){return this.result_highlight&amp;&amp;this.result_highlight.removeClass("highlighted"),this.result_highlight=null},n.prototype.results_show=function(){return this.is_multiple&amp;&amp;this.max_selected_options&lt;=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple||this.search_container.append(this.search_field),this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},n.prototype.update_results_content=function(t){return this.search_results.html(t)},n.prototype.results_hide=function(){return this.results_showing&amp;&amp;(this.result_clear_highlight(),this.is_multiple||(this.selected_item.prepend(this.search_field),this.search_field.focus()),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},n.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},n.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&amp;&amp;this.form_field.id.length&amp;&amp;(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length&gt;0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&amp;&amp;this.choices_count()&lt;1&amp;&amp;!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("&lt;li /&gt;",{"class":"search-choice"}).html("&lt;span&gt;"+this.choice_label(e)+"&lt;/span&gt;"),e.disabled?s.addClass("search-choice-disabled"):((i=t("&lt;a /&gt;",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&amp;&amp;this.choices_count()&gt;0&amp;&amp;this.get_search_field_value().length&lt;1&amp;&amp;this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&amp;&amp;this.max_selected_options&lt;=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.search_field.val(""),this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&amp;&amp;(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?this.winnow_results():(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&amp;&amp;this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&amp;&amp;(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&amp;&amp;(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&amp;&amp;this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('&lt;abbr class="search-choice-close"&gt;&lt;/abbr&gt;'),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("&lt;div/&gt;").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&amp;&amp;this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()&gt;0&amp;&amp;this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&amp;&amp;!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&amp;&amp;this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s&lt;i;s++)r[n=o[s]]=this.search_field.css(n);return(e=t("&lt;div /&gt;").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&amp;&amp;(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this);
/**
* @version 2.0.0
* @link https://github.com/gajus/wholly for the canonical source repository
* @license https://github.com/gajus/wholly/blob/master/LICENSE BSD 3-Clause
*/
"use strict";!function(e){var t,l=!1,a=[],o={};t={highlightHorizontal:null,highlightVertical:null},o.calcTableMaxCellLength=function(t){var l=0;return t.find("tr").each(function(){var t=o.calcRowCellLength(e(this));t&gt;l&amp;&amp;(l=t)}),l},o.calcRowCellLength=function(t){var l=0;return t.find("td, th").each(function(){var t=parseInt(e(this).attr("colspan"),10)||1;l+=t}),l},o.generateTableMatrix=function(e){var t=o.calcTableMaxCellLength(e),a=e.find("tr").length;return l&amp;&amp;console.log("generateTableMatrix","width:",t,"height:",a),o.generateMatrix(t,a)},o.generateMatrix=function(e,t){for(var l=[];t--;)l.push(new Array(e));return l},o.indexTable=function(t){var a=o.generateTableMatrix(t),r=t.find("tr");return e.each(a,function(t){var o=r.eq(t),n=o.children(),i=0;l&amp;&amp;console.groupCollapsed("Table row.","y:",t,"columns.length:",n.length),e.each(a[t],function(e){var o,r,h,s,c=a[t][e];if(c)l&amp;&amp;console.log("x:",i,"cell:",c[0],"state: already indexed");else{for(c=n.eq(i++),o=parseInt(c.attr("colspan"),10)||1,r=parseInt(c.attr("rowspan"),10)||1,l&amp;&amp;(o&gt;1||r&gt;1?console.group("x:",e,"colspan:",o,"rowspan:",r,"cell:",c[0]):console.log("x:",e,"colspan:",o,"rowspan:",r,"cell:",c[0])),h=0;r&gt;h;h++)for(s=0;o&gt;s;s++)l&amp;&amp;console.log("relative row:",h,"relative cell:",s,"absolute row:",t+h,"absolute cell:",e+s),a[t+h][e+s]=c[0];(o&gt;1||r&gt;1)&amp;&amp;console.groupEnd()}c.data&amp;&amp;void 0===c.data("wholly.offsetInMatrix")&amp;&amp;c.data("wholly.offsetInMatrix",[e,t])}),l&amp;&amp;console.groupEnd()}),a},e.fn.wholly=function(r){this.each(function(){var n,i,h,s,c,g=e.extend({},t,r);if(-1!==e.inArray(this,a))return void(l&amp;&amp;console.warn("Wholly has been applied twice on the same table."));if(a.push(this),n=e(this),!n.is("table"))throw new Error("Wholly works only with tables.");i=o.indexTable(n),n.on("mouseenter","td, th",function(){var t=e(this),a=parseInt(t.attr("rowspan"),10)||1,o=parseInt(t.attr("colspan"),10)||1,r=t.data("wholly.offsetInMatrix");c(),h=e([]),s=e([]),e.each(i.slice(r[1],r[1]+a),function(e,t){h=h.add(t)}),e.each(i,function(e,t){s=s.add(t.slice(r[0],r[0]+o))}),l&amp;&amp;console.log("mouseenter","horizontal:",h.length,"vertical:",s.length),h.trigger("wholly.mouseenter-horizontal"),s.trigger("wholly.mouseenter-vertical"),g.highlightHorizontal&amp;&amp;h.addClass(g.highlightHorizontal),g.highlightVertical&amp;&amp;s.addClass(g.highlightVertical),n.trigger("wholly.mouseenter",{horizontal:h,vertical:s})}),c=function(){(h||s)&amp;&amp;(h.trigger("wholly.mouseleave-horizontal"),s.trigger("wholly.mouseleave-vertical"),g.highlightHorizontal&amp;&amp;h.removeClass(g.highlightHorizontal),g.highlightVertical&amp;&amp;s.removeClass(g.highlightVertical),n.trigger("wholly.mouseleave",{horizontal:h,vertical:s}),h=s=void 0)},n.on("mouseleave","td, th",c)})}}(jQuery);
$(document).ready(function() {

    $('.navigation-language__button').click(function(event) {
        $(this).toggleClass('navigation-language__button--active').next().toggleClass('navigation-language__list--active');
    });

    //Get Mobile Logo from Main Navi, input through TypoScript on every subpage
    var mobileLogoPath = document.getElementsByClassName("header__logo-image")[0].getAttribute("data-logo");
    var mobileHomeLink = document.getElementsByClassName("header__logo-image")[0].getAttribute("data-home-url");
    var siteTitle = document.getElementsByClassName("header__logo-image")[0].getAttribute("title");
    // Get :hover on tap events to take effect
    // document.addEventListener("touchstart", function(){}, true);


    // Mobile navigation
    function createMobileMenu() {

        // Normalize UL/LI for SlickNav
        var navigationNormalized = $('#navigation').clone();
        navigationNormalized
            .find('.content')
            .removeClass('content');
        navigationNormalized
            .find('.col9')
            .removeClass('col9');
        navigationNormalized
            .find('.navigation__level2-items')
            .unwrap()
            .removeClass('navigation__level2-items')
            .addClass('navigation__level2');
        // navigationNormalized.find('.navigation__level3').remove();

        navigationNormalized
            .find('.navigation__item--uid-8911')
            .remove();

        // Create Mobile Navigation
        navigationNormalized.slicknav({
            // Logo integration


            brand: '&lt;a class="slicknav__logo-link" href="' + mobileHomeLink + '" title="Home"&gt;&lt;img src="'+ mobileLogoPath +'" alt="'+siteTitle+'" title="'+siteTitle+'" class="slicknav__logo-img"&gt;&lt;/a&gt;',

            // ermöglich Klick auf Hauptnavigationspunkt
            allowParentLinks: true,

            // Sinnvoll wenn Link auf Ankerpunkt auf der selben Seite.
            closeOnClick: true,

            // Verhindert dass ein a tag in einem a tag ausgegeben wird
            parentTag: 'span',

            // Fügt Slicknav als erstes Kind in den .wrapper
            // die ToTop-Funktionalität scrollt somit zur slicknav
            prependTo: $('.wrapper'),

            // Auf- und Zuklapp-Geschwindigkeit
            duration: 100, // default: 200

            // Text neben Burger entfernen
            label: '',


            init: function(){

                var theSlickNav = $('.slicknav_nav');

                // Einfügen Meta-Navigationspunkte an unterster Stelle.
                var navigationMetaItems = $('.navigation-meta-pages__item').clone();
                navigationMetaItems.find('.navigation-meta-pages__level2-list').remove();
                navigationMetaItems.filter(':first').addClass('navigation-meta-pages__item--first');
                navigationMetaItems.filter(':last').addClass('navigation-meta-pages__item--last');
                navigationMetaItems.appendTo(theSlickNav);

                // Einfügen Social Media Meta-Navigationspunkte an unterster Stelle.
                var navigationSocialMediaMetaItems = $('.navigation-social__item').clone();
                navigationSocialMediaMetaItems.filter(':first').addClass('navigation-social__item--first');
                navigationSocialMediaMetaItems.filter(':last').addClass('navigation-social__item--last');
                navigationSocialMediaMetaItems.appendTo(theSlickNav);

                // Einfügen Sprachnavigation an unterster Stelle.
                var navigationLanguageItems = $('.navigation-language__item').clone();
                navigationLanguageItems.filter(':first').addClass('navigation-language__item--first');
                navigationLanguageItems.filter(':last').addClass('navigation-language__item--last');
                navigationLanguageItems.appendTo(theSlickNav);

                $('#navigation')
                    .clone()
                    .find('.mega-search__form')
                    .prependTo(theSlickNav);
                theSlickNav.find('.mega-search__form').wrap('&lt;li class="slicknav__search-form"&gt;&lt;/li&gt;');
                theSlickNav.find('.mega-search__searchfield').addClass('mega-search__searchfield--mobile');
                theSlickNav.find('.mega-search__searchsubmit').addClass('mega-search__searchsubmit--mobile');
                theSlickNav.find('.mega-search__searchsubmit').addClass('mega-search__searchsubmit--mobile');
                theSlickNav.find('.mega-search__searchsubmit .fa-long-arrow-right').addClass('fa-long-arrow-right--mobile');

                // Austausch CSS-Klassen-Teil "navigation" durch "slicknav"
                // So muss man die mobile Navigation nicht prüfen, wenn in der
                // Desktop-Navigation gestalterische Anpassungen vorgenommen werden.
                var navigationTags = theSlickNav.find('[class*="navigation"]');
                navigationTags.each(function() {
                    var currentClassName = $(this).attr('class');
                    var newClassName = currentClassName.replace(/navigation/g, "slicknav");
                    $(this).attr('class', newClassName);
                });
            }
        });
    }
    createMobileMenu();

    // Lightbox
    // http://lokeshdhakar.com/projects/lightbox2/#options
    function applyLightboxFunctionality() {
        lightbox.option({
            'albumLabel': "%1 / %2"
        });
    }
    applyLightboxFunctionality();

    // Dateiliste, Filelist, Uploads
    // Filter
    function fileListFilter() {
        $('.navigation-category__list[data-file-list-target]').each(function(index, el) {
            var $this = $(this);
            var targetListID = $this.attr('data-file-list-target');
            var targetListItems = $('[data-file-list-id="' + targetListID + '"]').find('.files__item');
            var filterButtons = $this.find('[data-file-filter-uid]');
            var filterResetButton = $this.closest('.navigation-category').find('[data-file-list-reset]');

            filterButtons.click(function(event) {
                var catUid = $(this).attr('data-file-filter-uid');
                targetListItems.filter(':not([data-file-categories*="' + catUid + '"])').slideUp('fast');
                targetListItems.filter('[data-file-categories*="' + catUid + '"]').slideDown('fast');
                $this.prev('.button--dropdown-button').removeClass('button--dropdown-button-active');
            });

            filterResetButton.click(function(event) {
                targetListItems.slideDown('fast');
            });
        });
    }
    fileListFilter();

    // Filter DropDown
    function categoryFilterDropDown() {
        $('.navigation-category__drowndown-children-list').slideUp(0);
        $('.button--dropdown-button').click(function(event) {
            $(this).toggleClass('button--active button--dropdown-button-active');
        });
        $('.button--expand-button').click(function(event) {
            $(this).toggleClass('button--expand-button-active');
            $(this).parent().next().slideToggle('fast');
        });
        $('.button--dropdown:not(.form__checkbox-wrap--disabled)').click(function(event) {
            $('.button--dropdown').removeClass('button--active');
            $(this).addClass('button--active');
            var thisText = $(this).text();
            $(this).closest('.navigation-category--dropdown').find('.button--dropdown-button').text(thisText);
        });
        $('.navigation-category__list--dropdown').each(function(index, el) {
            $(this).find('.button--active').each(function(index, el) {
                var currentCategoryText = $(this).text();
                $(this).closest('.navigation-category--dropdown').find('.button--dropdown-button').text(currentCategoryText);
            });
        });
        $('.navigation-category--dropdown').each(function(index, el) {
            var dropDownCE = $(this);
            dropDownCE.find('.button--reset').click(function(event) {
                dropDownCE.find('.button--dropdown-button').removeClass('button--dropdown-button-active');
                dropDownCE.find('.button--active').removeClass('button--active');
                var theDropDownButton = dropDownCE.find('.button--dropdown-button');
                var theDropDownButtonOriginText = theDropDownButton.attr('data-category-header-text');
                theDropDownButton.text(theDropDownButtonOriginText);
            });
        });
    }
    categoryFilterDropDown();

    /* category navigation multiselect */
    /*function updateSelectAll() {
        if($('#t8_newsfilter_field_category_all:checked').length &lt;= 0) {
            $('#t8_newsfilter_field_category_all').parents('.navigation-category__item--select-all').siblings('.navigation-category__item--dropdown').find('.form__checkbox').not(':disabled').prop('checked', false);
        } else {
            $('#t8_newsfilter_field_category_all').parents('.navigation-category__item--select-all').siblings('.navigation-category__item--dropdown').find('.form__checkbox').not(':disabled').prop('checked', true);
        }
    }

    function updateSelectAllFromAnother() {
        if($('#t8_newsfilter_field_category_all:checked').length &gt; 0) {
            if ($('#t8_newsfilter_field_category_all').parents('.navigation-category__item--select-all').siblings('.navigation-category__item--dropdown').find('.form__checkbox:not(:checked)').length &gt; 0) {
                $('#t8_newsfilter_field_category_all:checked').not(':disabled').prop('checked', false);
            }
        }
    }

    function updateBtnTextMultiselect() {
        $('.navigation-category--dropdown--multiselect').each(function(){
            var btnText = [];
            if ($(this).find('#t8_newsfilter_field_category_all:checked').length &gt; 0) {
                btnText = $(this).find('#t8_newsfilter_field_category_all').siblings('label').text();
            } else if ($(this).find('.navigation-category__list--dropdown').find('.form__checkbox:checked').length &gt; 0) {
                $(this).find('.navigation-category__list--dropdown').find('.form__checkbox:checked').each(function(){
                    btnText.push($(this).siblings('label').text());
                });
                btnText = btnText.join(', ');
            } else {
                btnText = $(this).find('button[data-category-header-text]').attr('data-category-header-text');
            }

            $(this).find('button[data-category-header-text]').text(btnText);
        });
    }
    updateBtnTextMultiselect();*/

    function updateSelectAll(el) {
        if (el.is(':checked')) {
            el.parents('.navigation-category__item--select-all').siblings('.navigation-category__item--dropdown').find('.form__checkbox').not(':disabled').prop('checked', true);
        } else {
            el.parents('.navigation-category__item--select-all').siblings('.navigation-category__item--dropdown').find('.form__checkbox').not(':disabled').prop('checked', false);
        }
    }

    function updateSelectAllFromAnother() {
        $('[id^="t8_newsfilter_field_"][id$="_all"], [id^="searchfilter_"][id$="_all"]').each(function(){
            if ($(this).is(':checked')) {
                if ($(this).parents('.navigation-category__item--select-all').siblings('.navigation-category__item--dropdown').find('.form__checkbox:not(:checked)').length &gt; 0) {
                    $(this).not(':disabled').prop('checked', false);
                }
            }
        });
    }

    function updateBtnTextMultiselect() {
        $('.navigation-category--dropdown--multiselect').each(function(){
            var btnText = [];
            if ($(this).find('[id^="t8_newsfilter_field_"][id$="_all"]:checked, [id^="searchfilter_"][id$="_all"]:checked').length &gt; 0) {
                btnText = $(this).find('[id^="t8_newsfilter_field_"][id$="_all"], [id^="searchfilter_"][id$="_all"]').siblings('label').text();
            } else if ($(this).find('.navigation-category__list--dropdown').find('.form__checkbox:checked').length &gt; 0) {
                $(this).find('.navigation-category__list--dropdown').find('.form__checkbox:checked').each(function(){
                    btnText.push($(this).siblings('label').text());
                });
                btnText = btnText.join(', ');
            } else {
                btnText = $(this).find('button[data-category-header-text]').attr('data-category-header-text');
            }

            $(this).find('button[data-category-header-text]').text(btnText);
        });
    }
    updateBtnTextMultiselect();

    /*$('#t8_newsfilter_field_category_all').change(function(){
        updateSelectAll();
        updateBtnTextMultiselect();
    });

    $('.navigation-category--dropdown--multiselect').not('#t8_newsfilter_field_category_all').find('.form__checkbox').change(function(){
        updateSelectAllFromAnother();
        updateBtnTextMultiselect();
    });*/

    $('[id^="t8_newsfilter_field_"][id$="_all"], [id^="searchfilter_"][id$="_all"]').change(function(){
        // defined in extensions js (t8_studyprograms)
        if ($(this).parents('#t8_studyprograms__ajaxform').length == 0) {
            updateSelectAll($(this));
            updateBtnTextMultiselect();
        }
    });

    $('.navigation-category--dropdown--multiselect').find('.form__checkbox').not('[id^="t8_newsfilter_field_"][id$="_all"]').not('[id^="searchfilter_"][id$="_all"]').change(function(){
        updateSelectAllFromAnother();
        updateBtnTextMultiselect();
    });

    function updateBtnTextRadioSelect() {
        $('.navigation-category--dropdown--radio').each(function(){
            var btnText = [];
            if ($(this).find('.navigation-category__list--dropdown').find('.form__radio:checked').length &gt; 0) {
                btnText = $(this).find('.navigation-category__list--dropdown').find('.form__radio:checked').siblings('label').text();
            } else {
                if ($(this).find('.navigation-category__dropdown-main-cat-wrap').length &gt; 0) {
                    $(this).find('.navigation-category__dropdown-main-cat-wrap').find('.form__label--radio').not(':disabled').prop('checked', true);
                    btnText = $(this).find('.navigation-category__dropdown-main-cat-wrap').find('.form__label--radio').siblings('label').text();
                } else {
                    btnText = $(this).find('button[data-category-header-text]').attr('data-category-header-text');
                }
            }

            $(this).find('button[data-category-header-text]').text(btnText);
        });
    }
    updateBtnTextRadioSelect();

    $('.navigation-category--dropdown--radio .form__label--radio').click(function(){
        $(this).parents('.navigation-category__list--dropdown').siblings('.button--dropdown-button').click();
    });

    $('.button--dropdown-button').click(function(){
        var num = $('.button--dropdown-button-active').length;
        $('.button--dropdown-button-active').each(function(){
            $(this).siblings('.navigation-category__list--dropdown').css('z-index', num);
            num -= 1;
        });
    })
    /**
     * onScreen - jQuery Library
     * Details: https://silvestreh.github.io/onScreen/
     *
     * Prüft Position von Element in Viewport
     */
    function totopFunctionality() {

        var toTopButton = $('.totop-button');

        // onScreen: Scroll events
        // Sobald .header nicht mehr sichtbar, dann erscheint ToTop-Button
        $('.header').onScreen({
            doIn: function() {
                toTopButton.removeClass('totop-button--visible');
            },
            doOut: function() {
                toTopButton.addClass('totop-button--visible');
            },
            tolerance: 0,
            toggleClass: false
        });
    }
    totopFunctionality();

    // Powermail frontend required checkbox
    function powermailRequiredCheckbox() {
        $('.form').submit(function(event) {
            var $this = $(this);
            var checkboxGroups = {};

            var allCheckboxes = $this.find('.form__checkbox[data-parsley-required="true"]');
            allCheckboxes.each(function(index, el) {
                var thisCheckbox = $(this);
                var checkboxName = thisCheckbox.attr('name');
                if ( !checkboxGroups[checkboxName] ) {
                    checkboxGroups[checkboxName] = true;
                }
            });
            $.each( checkboxGroups, function( key, value ) {
                if ($('[name="' + key + '"]:checked').length === 0) {
                    event.preventDefault();
                    $('[name="' + key + '"]:first').closest('.form__checkboxes').addClass('form__checkboxes--error');
                } else {
                    $('[name="' + key + '"]:first').closest('.form__checkboxes').removeClass('form__checkboxes--error');
                }
            });
        });
    }
    powermailRequiredCheckbox();

    // Bannerelements Video
    function bannerVideoElements() {
        var bannerSliderVideoButtons = $('.banner-slider__video-button');
        var bannerPlayers = Plyr.setup('.banner-slider__element--video', {
            // https://github.com/sampotts/plyr#options
            // debug: true,
            controls: []
        });
        if (bannerPlayers) {
            bannerPlayers.forEach(function(instance) {
                instance.on('ended', function() {
                    bannerSliderVideoButtons.removeClass('banner-slider__video-button--playing');
                });
                instance.on('playing', function() {
                    bannerSliderVideoButtons.addClass('banner-slider__video-button--playing');
                });
                instance.on('pause', function() {
                    bannerSliderVideoButtons.removeClass('banner-slider__video-button--playing');
                });
            });
            bannerSliderVideoButtons.each(function(index, el) {
                $(this).click(function(event) {
                    bannerPlayers[index].togglePlay();
                });
            });
        }
    }
    bannerVideoElements();

    // Videos: Konfiguration für reguläre Inhaltselemente
    function videos() {
      $('.video__video').each(function () {
        if ($(this).find('iframe').length &gt; 0) {
          let src = $(this).find('iframe').attr('src');
          // add playsinline for youtube
          if (src.includes('youtube.com') || src.includes('youtube-nocookie.com') || src.includes('youtu.be')) {
            src += '&amp;playsinline=1';
            $(this).find('iframe').attr('src', src);
          }
          // add do not track param for vimeo videos
          if (src.includes('vimeo.com')) {
            src += '&amp;dnt=1';
            $(this).find('iframe').attr('src', src);
          }
        }
        if ($(this).prev('.video__plyrconfig').attr('data-plyr-config')) {
          let config = $(this).prev('.video__plyrconfig').attr('data-plyr-config')
          $(this).attr('data-plyr-config', config);
        }
      });
      const players = Plyr.setup('.video__video', {
        vimeo: {
          sidedock: 0,
          controls: 0,
        },
        // do not load blank video &amp; iconUrl from cdn
        // todo: find a better solution without the path including the hash..
        iconUrl: '/fileadmin/theme/javascript/plyr-3.7.3/res/plyr.svg',
        // Blank video (used to prevent errors on source change)
        blankVideo: '/fileadmin/theme/javascript/plyr-3.7.3/res/blank.mp4',
      });

    }
    videos();

    // Style Select Boxes
    function styleSelectBoxes() {
        var config = {
            '.chosen-select:not(.chosen-select--deselect,.chosen-select--no-single,.chosen-select--no-results,.chosen-select--no-search,.chosen-select--rtl,.chosen-select--width)' : { allow_single_deselect: true, width: '100%' },
            '.chosen-select.chosen-select--deselect'   : { allow_single_deselect: true, width: '100%' },
            '.chosen-select.chosen-select--no-single'  : { allow_single_deselect: true, disable_search_threshold: 10, width: '100%' },
            '.chosen-select.chosen-select--no-results' : { allow_single_deselect: true, no_results_text: 'Oops, nothing found!', width: '100%' },
            '.chosen-select.chosen-select--no-search'  : { allow_single_deselect: true, disable_search: true, width: '100%' },
            '.chosen-select.chosen-select--rtl'        : { allow_single_deselect: true, rtl: true, width: '100%' }
        }
        for (var selector in config) {
            $(selector).chosen(config[selector]);
        }
    }
    styleSelectBoxes();

    // Produkte-DB, genericcatalogue, default Meta-Description
    var defaultDescription = $('meta[name=description]').attr('content');

    function changeFilter($this) {
        var selectedOption = $this.find('option:selected').val();

        if (selectedOption !== undefined) {
            showCategoryDescription($this.find('option:selected'));
            $this
                .nextAll('.maincategory')
                .find('a:contains("' + selectedOption + '")')
                // .addClass('tx_genericcatalogue__item--active')
                .trigger('click');
        }
    }

    // Produkete-DB, genericcatalogue, Filter trigger
    function productsDBFilterTrigger() {
        $('.tx_genericcatalogue__select').on('change', function(event) {
            var $this = $(this);
            changeFilter($this);
            updateURL();
        });
    }
    productsDBFilterTrigger();

    // Produkte-DB, genericcatalogue, Reset Funktionalität
    function productDBFilterReset() {
        $('#filters').on('click', '.tx-genericcatalogue__reset', function(event) {
            $(this).closest('#filters').find('.search-choice-close').trigger('mouseup');

            $('.category__description').addClass('category__description--hidden');
            $('meta[name=description]').remove();
            $('head').append( '&lt;meta name="description" content="'+defaultDescription+'"&gt;');

            updateURL(1);
            preselectFilter();
            // $(this).trigger('click');
        });
    }
    productDBFilterReset();

    // Produkte-DB, genericcatalogue, Kategorie-Beschreibung anzeigen/ausblenden
    function showCategoryDescription(element){
        var maincategory = element.attr('data-main-category'),
            description = element.attr('data-category');
        var metaDescription = $('.category__description[data-main-category="'+maincategory+'"][data-category="'+description+'"]').attr('data-meta-description');
        $('.category__description').addClass('category__description--hidden');
        $('.category__description[data-main-category="'+maincategory+'"][data-category="'+description+'"]').removeClass('category__description--hidden');
        $('meta[name=description]').remove();
        if(metaDescription != ''){
            $('head').append( '&lt;meta name="description" content="'+metaDescription+'"&gt;');
        } else {
            $('head').append( '&lt;meta name="description" content="'+defaultDescription+'"&gt;');
        }
    }

    // Produkte-DB, genericcatalogue, preselect: getUrlParameter
    var getUrlParameter = function getUrlParameter(sParam) {
        var sPageURL = decodeURIComponent(window.location.search.substring(1)),
            sURLVariables = sPageURL.split('&amp;'),
            sParameterName,
            i;

        for (i = 0; i &lt; sURLVariables.length; i++) {
            sParameterName = sURLVariables[i].split('=');

            if (sParameterName[0] === sParam) {
                return sParameterName[1] === undefined ? true : sParameterName[1];
            }
        }
    };

    // Produkte-DB, genericcatalogue, preselect
    function preselectFilter() {
        var urlEnd = '';
        if ($('.tx_genericcatalogue__select').length &gt; 0) {
            $('.tx_genericcatalogue__select').each(function(){
                var maincategory = $(this).attr('data-placeholder');
                var option = getUrlParameter(maincategory);

                if (option != undefined) {
                    $(this).val(option);
                    $(this).trigger("chosen:updated");
                    //$(this).trigger("change");

                    var $this = $(this);
                    changeFilter($this);

                    if (urlEnd == '') {
                        urlEnd += '?'+maincategory+'='+option;
                    } else {
                        urlEnd += '&amp;'+maincategory+'='+option;
                    }
                } else {
                    // set to standard
                    $(this).val(maincategory);
                    $(this).trigger("chosen:updated");
                    /*var $this = $(this);
                    changeFilter($this);*/
                }

            });
            localStorage.setItem("selectedCategories", urlEnd);
        }
    }
    preselectFilter();

    // Produkte-DB, genericcatalogue, url update
    function updateURL(del) {
        if (del === undefined) { del = 0 }
        if (history.pushState) {
            var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname,
                newurlEnd = '';
            if (del == 0) {
                $('.tx_genericcatalogue__select').each(function(){
                    var maincategory = $(this).attr('data-placeholder'),
                        subcategory = $(this).val();
                    if (subcategory != null){
                        if(newurlEnd == ''){
                            newurlEnd += '?'+maincategory+'='+subcategory;
                        } else {
                            newurlEnd += '&amp;'+maincategory+'='+subcategory;
                        }
                    }
                });
                newurl += newurlEnd;
            }
            localStorage.setItem("selectedCategories", newurlEnd);
            window.history.pushState({path:newurl},'',newurl);
        }
    }

    // Produkte-DB update backlink on detail page with local storage
    if (localStorage.getItem("selectedCategories") !== undefined &amp;&amp; localStorage.getItem("selectedCategories") !== null &amp;&amp; localStorage.getItem("selectedCategories") !== "" &amp;&amp; $('.news-detail__backlink').length &gt; 0) {
        var url = $('.news-detail__backlink').attr('href');
        newurl = url + localStorage.getItem("selectedCategories");
        $('.news-detail__backlink').attr('href', newurl);
    }

    // Tabellen Mouseover
    function tableMouseover() {
        var table = $('.contenttable');
        table.wholly({
            highlightHorizontal: 'contenttablecell-hover contenttablecell-hover--horizontal',
            highlightVertical: 'contenttablecell-hover contenttablecell-hover--vertical'
        });
    }
    tableMouseover();

    function masonryLayout() {
        $('.news-masonry__wrap-inner').masonry({
            itemSelector: '.news-masonry__item',
            columnWidth: '.news-masonry__item--resizer',
            percentPosition: true
        });
    }
    masonryLayout();

    // google analytics opt out
    $('[href$="#gaOptout"]').click(function(){
        gaOptout();
    });

    setTimeout(function(){
        var bannerHeight = $('#cc-notification').outerHeight();
        $('.footer').css('margin-bottom', bannerHeight + 'px');
        $('.totop-button').css('margin-bottom', bannerHeight + 'px');
    }, 500);

    // force z-index of next elements always to be lower than the previous
    var contentSections = $('.main .container &gt; .content-section');
    var totalAmountOfContentSections = contentSections.length;
    contentSections.each(function(index, el) {
        $(this).css({
            "position": "relative",
            "z-index": totalAmountOfContentSections
        });
        totalAmountOfContentSections--;
    });

    if ($(".t8_references__list.content").parent(".ctype-list").parent(".content-section")) {
        $(".t8_references__list.content").parent(".ctype-list").parent(".content-section").css( "z-index", contentSections.length + 1 )
    }

    // get value from form data (email for newsletter)
    var $_GET = {};
    document.location.search.replace(/\??(?:([^=]+)=([^&amp;]*)&amp;?)/g, function () {
        function decode(s) {
            return decodeURIComponent(s.split("+").join(" "));
        }

        $_GET[decode(arguments[1])] = decode(arguments[2]);
    });

    if ($('.form__newsletter').length &gt; 0) {
        $('.form__newsletter').find('.form__input[name="email"]').val($_GET["email"]);
    }

    /* Accordion */
    $('.accordion .accordion__head').click(function() {
        $(this).siblings('.accordion__content').addClass('accordion__content--inprogress');
        var closable_height = $(this).siblings('.accordion__content').children('.accordion__content__inner').outerHeight();
        $(this).siblings('.accordion__content').css('height', closable_height);
        $(this).toggleClass('accordion__head--open');
        $(this).siblings('.accordion__content').toggleClass('accordion__content--closed');

        var self = $(this);
        setTimeout(function() {
            self.siblings().removeClass('accordion__content--inprogress');
        }, 500);
    });

    $('.accordion__head--open').each(function() {
        var closable_height = $(this).siblings('.accordion__content').children('.accordion__content__inner').outerHeight();
        $(this).siblings('.accordion__content').css('height', closable_height);
    });

    if (window.innerWidth &lt; 1023) {
        $('#seventyFive').appendTo('.slicknav__logo-link')[0];
    }

    /* Search (ke_search) */
    $('.searchfield__reset').click(function(){
      $(this).parents('.searchfield').find('.form__input').val('');
      $(this).parents('form').submit();
    });
    $('.t8_filterList__heading--filter__reset').click(function(){
      $('#kesearch_filters').find('.form__input, .form__checkbox')
        .val('')
        .removeAttr('checked')
        .removeAttr('selected');

        updateBtnTextMultiselect();
        $(this).parents('form').submit();
    });

});

// Check scroll position on page load
window.addEventListener('load', function() {
    if ( document.documentElement.scrollTop &gt; 0 ) {
        // show totop button if scroll position is grater than 0
        $('.totop-button').addClass('totop-button--visible')
    }
});

$(document).ready(function() {
    var currentLanguage = $('html').attr('lang');

    var body = $('body');
    body.append('&lt;div class="darkened"&gt;&lt;/div&gt;');
    var darkened = $('.darkened');
    var wrapper = $('.wrapper');
    var footer = $('.footer');
    var navOverviewWord = $('#navOverviewWord').text();

    $('.navigation__item').each(function(index, el) {
        var submenuLayout = $(this).attr('data-submenu-layout');
        $(this).find('.navigation__level2').addClass(submenuLayout);
    });

    darkened.click(function(event) {
        $('.navigation__item').removeClass('navigation__item--opened');
        $(this).removeClass('darkened--visible');
    });

    $('.navigation__link.navigation__link--has-children').click(function(event) {
        event.preventDefault();
        if($(this).parent().hasClass('navigation__item--opened')) {
            $('.navigation__item').removeClass('navigation__item--opened');
        } else {
            $('.navigation__item').removeClass('navigation__item--opened');
            $(this).parent().addClass('navigation__item--opened')
        }

        if ($('.navigation__item--opened').length) {
            darkened.addClass('darkened--visible');
        } else {
            darkened.removeClass('darkened--visible');
        }
    });

    $('.navigation__level2').each(function(index, el) {
        $this = $(this);
        var link = $this.closest('.navigation__item').find('&gt; a:first-child').attr('href');
        var text = $this.closest('.navigation__item').find('&gt; a:first-child').text();

        if ($(this).parent().hasClass('navigation__item--uid-8911')) {
            $(this).find('.mega-search').nextAll().remove();
        }

        if (!$(this).parent().hasClass('navigation__item--uid-8911')) {
            $(this).append(
                '&lt;li class="navigation__level2-item navigation__level2-item--fullwidth"&gt;' +
                '&lt;a href="' + link + '" class="button button--arrow-before no-hyphenation" title="'+ navOverviewWord +' ' + text + '"&gt;&lt;span class="navigation__level2-text navigation__level2-text--fullwidth"&gt;'+ navOverviewWord +' ' + text + '&lt;/span&gt;&lt;/a&gt;' +
                '&lt;/li&gt;'
            );
        }
    });

});

/*!
 * Masonry PACKAGED v4.2.2
 * Cascading grid layout library
 * https://masonry.desandro.com
 * MIT License
 * by David DeSandro
 */

!function(t,e){"function"==typeof define&amp;&amp;define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&amp;&amp;module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function h(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,h){var u=a.data(h,i);if(!u)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=u[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var l=d.apply(u,n);o=void 0===o?l:o}),void 0!==o?o:t}function u(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&amp;&amp;(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&amp;&amp;(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return u(this,t),this},n(a))}function n(t){!t||t&amp;&amp;t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&amp;&amp;define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&amp;&amp;module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&amp;&amp;e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&amp;&amp;n.push(e),this}},e.once=function(t,e){if(t&amp;&amp;e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&amp;&amp;this._events[t];if(i&amp;&amp;i.length){var n=i.indexOf(e);return-1!=n&amp;&amp;i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&amp;&amp;this._events[t];if(i&amp;&amp;i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&amp;&amp;this._onceEvents[t],o=0;o&lt;i.length;o++){var r=i[o],s=n&amp;&amp;n[r];s&amp;&amp;(this.off(t,r),delete n[r]),r.apply(this,e)}return this}},e.allOff=function(){delete this._events,delete this._onceEvents},t}),function(t,e){"function"==typeof define&amp;&amp;define.amd?define("get-size/get-size",e):"object"==typeof module&amp;&amp;module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=-1==t.indexOf("%")&amp;&amp;!isNaN(e);return i&amp;&amp;e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;u&gt;e;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);s=200==Math.round(t(o.width)),r.isBoxSizeOuter=s,i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&amp;&amp;(e=document.querySelector(e)),e&amp;&amp;"object"==typeof e&amp;&amp;e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,l=0;u&gt;l;l++){var c=h[l],f=r[c],m=parseFloat(f);a[c]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,z=a.borderTopWidth+a.borderBottomWidth,E=d&amp;&amp;s,b=t(r.width);b!==!1&amp;&amp;(a.width=b+(E?0:p+_));var x=t(r.height);return x!==!1&amp;&amp;(a.height=x+(E?0:g+z)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(g+z),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&amp;&amp;define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&amp;&amp;module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i&lt;e.length;i++){var n=e[i],o=n+"MatchesSelector";if(t[o])return o}}();return function(e,i){return e[t](i)}}),function(t,e){"function"==typeof define&amp;&amp;define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(i){return e(t,i)}):"object"==typeof module&amp;&amp;module.exports?module.exports=e(t,require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.matchesSelector)}(window,function(t,e){var i={};i.extend=function(t,e){for(var i in e)t[i]=e[i];return t},i.modulo=function(t,e){return(t%e+e)%e};var n=Array.prototype.slice;i.makeArray=function(t){if(Array.isArray(t))return t;if(null===t||void 0===t)return[];var e="object"==typeof t&amp;&amp;"number"==typeof t.length;return e?n.call(t):[t]},i.removeFrom=function(t,e){var i=t.indexOf(e);-1!=i&amp;&amp;t.splice(i,1)},i.getParent=function(t,i){for(;t.parentNode&amp;&amp;t!=document.body;)if(t=t.parentNode,e(t,i))return t},i.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},i.handleEvent=function(t){var e="on"+t.type;this[e]&amp;&amp;this[e](t)},i.filterFindElements=function(t,n){t=i.makeArray(t);var o=[];return t.forEach(function(t){if(t instanceof HTMLElement){if(!n)return void o.push(t);e(t,n)&amp;&amp;o.push(t);for(var i=t.querySelectorAll(n),r=0;r&lt;i.length;r++)o.push(i[r])}}),o},i.debounceMethod=function(t,e,i){i=i||100;var n=t.prototype[e],o=e+"Timeout";t.prototype[e]=function(){var t=this[o];clearTimeout(t);var e=arguments,r=this;this[o]=setTimeout(function(){n.apply(r,e),delete r[o]},i)}},i.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},i.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var o=t.console;return i.htmlInit=function(e,n){i.docReady(function(){var r=i.toDashed(n),s="data-"+r,a=document.querySelectorAll("["+s+"]"),h=document.querySelectorAll(".js-"+r),u=i.makeArray(a).concat(i.makeArray(h)),d=s+"-options",l=t.jQuery;u.forEach(function(t){var i,r=t.getAttribute(s)||t.getAttribute(d);try{i=r&amp;&amp;JSON.parse(r)}catch(a){return void(o&amp;&amp;o.error("Error parsing "+s+" on "+t.className+": "+a))}var h=new e(t,i);l&amp;&amp;l.data(t,n,h)})})},i}),function(t,e){"function"==typeof define&amp;&amp;define.amd?define("outlayer/item",["ev-emitter/ev-emitter","get-size/get-size"],e):"object"==typeof module&amp;&amp;module.exports?module.exports=e(require("ev-emitter"),require("get-size")):(t.Outlayer={},t.Outlayer.Item=e(t.EvEmitter,t.getSize))}(window,function(t,e){"use strict";function i(t){for(var e in t)return!1;return e=null,!0}function n(t,e){t&amp;&amp;(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}function o(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}var r=document.documentElement.style,s="string"==typeof r.transition?"transition":"WebkitTransition",a="string"==typeof r.transform?"transform":"WebkitTransform",h={WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[s],u={transform:a,transition:s,transitionDuration:s+"Duration",transitionProperty:s+"Property",transitionDelay:s+"Delay"},d=n.prototype=Object.create(t.prototype);d.constructor=n,d._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},d.handleEvent=function(t){var e="on"+t.type;this[e]&amp;&amp;this[e](t)},d.getSize=function(){this.size=e(this.element)},d.css=function(t){var e=this.element.style;for(var i in t){var n=u[i]||i;e[n]=t[i]}},d.getPosition=function(){var t=getComputedStyle(this.element),e=this.layout._getOption("originLeft"),i=this.layout._getOption("originTop"),n=t[e?"left":"right"],o=t[i?"top":"bottom"],r=parseFloat(n),s=parseFloat(o),a=this.layout.size;-1!=n.indexOf("%")&amp;&amp;(r=r/100*a.width),-1!=o.indexOf("%")&amp;&amp;(s=s/100*a.height),r=isNaN(r)?0:r,s=isNaN(s)?0:s,r-=e?a.paddingLeft:a.paddingRight,s-=i?a.paddingTop:a.paddingBottom,this.position.x=r,this.position.y=s},d.layoutPosition=function(){var t=this.layout.size,e={},i=this.layout._getOption("originLeft"),n=this.layout._getOption("originTop"),o=i?"paddingLeft":"paddingRight",r=i?"left":"right",s=i?"right":"left",a=this.position.x+t[o];e[r]=this.getXValue(a),e[s]="";var h=n?"paddingTop":"paddingBottom",u=n?"top":"bottom",d=n?"bottom":"top",l=this.position.y+t[h];e[u]=this.getYValue(l),e[d]="",this.css(e),this.emitEvent("layout",[this])},d.getXValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&amp;&amp;!e?t/this.layout.size.width*100+"%":t+"px"},d.getYValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&amp;&amp;e?t/this.layout.size.height*100+"%":t+"px"},d._transitionTo=function(t,e){this.getPosition();var i=this.position.x,n=this.position.y,o=t==this.position.x&amp;&amp;e==this.position.y;if(this.setPosition(t,e),o&amp;&amp;!this.isTransitioning)return void this.layoutPosition();var r=t-i,s=e-n,a={};a.transform=this.getTranslate(r,s),this.transition({to:a,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},d.getTranslate=function(t,e){var i=this.layout._getOption("originLeft"),n=this.layout._getOption("originTop");return t=i?t:-t,e=n?e:-e,"translate3d("+t+"px, "+e+"px, 0)"},d.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},d.moveTo=d._transitionTo,d.setPosition=function(t,e){this.position.x=parseFloat(t),this.position.y=parseFloat(e)},d._nonTransition=function(t){this.css(t.to),t.isCleaning&amp;&amp;this._removeStyles(t.to);for(var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this)},d.transition=function(t){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(t);var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&amp;&amp;(e.clean[i]=!0);if(t.from){this.css(t.from);var n=this.element.offsetHeight;n=null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0};var l="opacity,"+o(a);d.enableTransition=function(){if(!this.isTransitioning){var t=this.layout.options.transitionDuration;t="number"==typeof t?t+"ms":t,this.css({transitionProperty:l,transitionDuration:t,transitionDelay:this.staggerDelay||0}),this.element.addEventListener(h,this,!1)}},d.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},d.onotransitionend=function(t){this.ontransitionend(t)};var c={"-webkit-transform":"transform"};d.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,n=c[t.propertyName]||t.propertyName;if(delete e.ingProperties[n],i(e.ingProperties)&amp;&amp;this.disableTransition(),n in e.clean&amp;&amp;(this.element.style[t.propertyName]="",delete e.clean[n]),n in e.onEnd){var o=e.onEnd[n];o.call(this),delete e.onEnd[n]}this.emitEvent("transitionEnd",[this])}},d.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(h,this,!1),this.isTransitioning=!1},d._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var f={transitionProperty:"",transitionDuration:"",transitionDelay:""};return d.removeTransitionStyles=function(){this.css(f)},d.stagger=function(t){t=isNaN(t)?0:t,this.staggerDelay=t+"ms"},d.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},d.remove=function(){return s&amp;&amp;parseFloat(this.layout.options.transitionDuration)?(this.once("transitionEnd",function(){this.removeElem()}),void this.hide()):void this.removeElem()},d.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("visibleStyle");e[i]=this.onRevealTransitionEnd,this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0,onTransitionEnd:e})},d.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},d.getHideRevealTransitionEndProperty=function(t){var e=this.layout.options[t];if(e.opacity)return"opacity";for(var i in e)return i},d.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("hiddenStyle");e[i]=this.onHideTransitionEnd,this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:e})},d.onHideTransitionEnd=function(){this.isHidden&amp;&amp;(this.css({display:"none"}),this.emitEvent("hide"))},d.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},n}),function(t,e){"use strict";"function"==typeof define&amp;&amp;define.amd?define("outlayer/outlayer",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(i,n,o,r){return e(t,i,n,o,r)}):"object"==typeof module&amp;&amp;module.exports?module.exports=e(t,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):t.Outlayer=e(t,t.EvEmitter,t.getSize,t.fizzyUIUtils,t.Outlayer.Item)}(window,function(t,e,i,n,o){"use strict";function r(t,e){var i=n.getQueryElement(t);if(!i)return void(h&amp;&amp;h.error("Bad element for "+this.constructor.namespace+": "+(i||t)));this.element=i,u&amp;&amp;(this.$element=u(this.element)),this.options=n.extend({},this.constructor.defaults),this.option(e);var o=++l;this.element.outlayerGUID=o,c[o]=this,this._create();var r=this._getOption("initLayout");r&amp;&amp;this.layout()}function s(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e}function a(t){if("number"==typeof t)return t;var e=t.match(/(^\d*\.?\d*)(\w*)/),i=e&amp;&amp;e[1],n=e&amp;&amp;e[2];if(!i.length)return 0;i=parseFloat(i);var o=m[n]||1;return i*o}var h=t.console,u=t.jQuery,d=function(){},l=0,c={};r.namespace="outlayer",r.Item=o,r.defaults={containerStyle:{position:"relative"},initLayout:!0,originLeft:!0,originTop:!0,resize:!0,resizeContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}};var f=r.prototype;n.extend(f,e.prototype),f.option=function(t){n.extend(this.options,t)},f._getOption=function(t){var e=this.constructor.compatOptions[t];return e&amp;&amp;void 0!==this.options[e]?this.options[e]:this.options[t]},r.compatOptions={initLayout:"isInitLayout",horizontal:"isHorizontal",layoutInstant:"isLayoutInstant",originLeft:"isOriginLeft",originTop:"isOriginTop",resize:"isResizeBound",resizeContainer:"isResizingContainer"},f._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),n.extend(this.element.style,this.options.containerStyle);var t=this._getOption("resize");t&amp;&amp;this.bindResize()},f.reloadItems=function(){this.items=this._itemize(this.element.children)},f._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,n=[],o=0;o&lt;e.length;o++){var r=e[o],s=new i(r,this);n.push(s)}return n},f._filterFindItemElements=function(t){return n.filterFindElements(t,this.options.itemSelector)},f.getItemElements=function(){return this.items.map(function(t){return t.element})},f.layout=function(){this._resetLayout(),this._manageStamps();var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;this.layoutItems(this.items,e),this._isLayoutInited=!0},f._init=f.layout,f._resetLayout=function(){this.getSize()},f.getSize=function(){this.size=i(this.element)},f._getMeasurement=function(t,e){var n,o=this.options[t];o?("string"==typeof o?n=this.element.querySelector(o):o instanceof HTMLElement&amp;&amp;(n=o),this[t]=n?i(n)[e]:o):this[t]=0},f.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},f._getItemsForLayout=function(t){return t.filter(function(t){return!t.isIgnored})},f._layoutItems=function(t,e){if(this._emitCompleteOnItems("layout",t),t&amp;&amp;t.length){var i=[];t.forEach(function(t){var n=this._getItemLayoutPosition(t);n.item=t,n.isInstant=e||t.isLayoutInstant,i.push(n)},this),this._processLayoutQueue(i)}},f._getItemLayoutPosition=function(){return{x:0,y:0}},f._processLayoutQueue=function(t){this.updateStagger(),t.forEach(function(t,e){this._positionItem(t.item,t.x,t.y,t.isInstant,e)},this)},f.updateStagger=function(){var t=this.options.stagger;return null===t||void 0===t?void(this.stagger=0):(this.stagger=a(t),this.stagger)},f._positionItem=function(t,e,i,n,o){n?t.goTo(e,i):(t.stagger(o*this.stagger),t.moveTo(e,i))},f._postLayout=function(){this.resizeContainer()},f.resizeContainer=function(){var t=this._getOption("resizeContainer");if(t){var e=this._getContainerSize();e&amp;&amp;(this._setContainerMeasure(e.width,!0),this._setContainerMeasure(e.height,!1))}},f._getContainerSize=d,f._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&amp;&amp;(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},f._emitCompleteOnItems=function(t,e){function i(){o.dispatchEvent(t+"Complete",null,[e])}function n(){s++,s==r&amp;&amp;i()}var o=this,r=e.length;if(!e||!r)return void i();var s=0;e.forEach(function(e){e.once(t,n)})},f.dispatchEvent=function(t,e,i){var n=e?[e].concat(i):i;if(this.emitEvent(t,n),u)if(this.$element=this.$element||u(this.element),e){var o=u.Event(e);o.type=t,this.$element.trigger(o,i)}else this.$element.trigger(t,i)},f.ignore=function(t){var e=this.getItem(t);e&amp;&amp;(e.isIgnored=!0)},f.unignore=function(t){var e=this.getItem(t);e&amp;&amp;delete e.isIgnored},f.stamp=function(t){t=this._find(t),t&amp;&amp;(this.stamps=this.stamps.concat(t),t.forEach(this.ignore,this))},f.unstamp=function(t){t=this._find(t),t&amp;&amp;t.forEach(function(t){n.removeFrom(this.stamps,t),this.unignore(t)},this)},f._find=function(t){return t?("string"==typeof t&amp;&amp;(t=this.element.querySelectorAll(t)),t=n.makeArray(t)):void 0},f._manageStamps=function(){this.stamps&amp;&amp;this.stamps.length&amp;&amp;(this._getBoundingRect(),this.stamps.forEach(this._manageStamp,this))},f._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},f._manageStamp=d,f._getElementOffset=function(t){var e=t.getBoundingClientRect(),n=this._boundingRect,o=i(t),r={left:e.left-n.left-o.marginLeft,top:e.top-n.top-o.marginTop,right:n.right-e.right-o.marginRight,bottom:n.bottom-e.bottom-o.marginBottom};return r},f.handleEvent=n.handleEvent,f.bindResize=function(){t.addEventListener("resize",this),this.isResizeBound=!0},f.unbindResize=function(){t.removeEventListener("resize",this),this.isResizeBound=!1},f.onresize=function(){this.resize()},n.debounceMethod(r,"onresize",100),f.resize=function(){this.isResizeBound&amp;&amp;this.needsResizeLayout()&amp;&amp;this.layout()},f.needsResizeLayout=function(){var t=i(this.element),e=this.size&amp;&amp;t;return e&amp;&amp;t.innerWidth!==this.size.innerWidth},f.addItems=function(t){var e=this._itemize(t);return e.length&amp;&amp;(this.items=this.items.concat(e)),e},f.appended=function(t){var e=this.addItems(t);e.length&amp;&amp;(this.layoutItems(e,!0),this.reveal(e))},f.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},f.reveal=function(t){if(this._emitCompleteOnItems("reveal",t),t&amp;&amp;t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.reveal()})}},f.hide=function(t){if(this._emitCompleteOnItems("hide",t),t&amp;&amp;t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.hide()})}},f.revealItemElements=function(t){var e=this.getItems(t);this.reveal(e)},f.hideItemElements=function(t){var e=this.getItems(t);this.hide(e)},f.getItem=function(t){for(var e=0;e&lt;this.items.length;e++){var i=this.items[e];if(i.element==t)return i}},f.getItems=function(t){t=n.makeArray(t);var e=[];return t.forEach(function(t){var i=this.getItem(t);i&amp;&amp;e.push(i)},this),e},f.remove=function(t){var e=this.getItems(t);this._emitCompleteOnItems("remove",e),e&amp;&amp;e.length&amp;&amp;e.forEach(function(t){t.remove(),n.removeFrom(this.items,t)},this)},f.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="",this.items.forEach(function(t){t.destroy()}),this.unbindResize();var e=this.element.outlayerGUID;delete c[e],delete this.element.outlayerGUID,u&amp;&amp;u.removeData(this.element,this.constructor.namespace)},r.data=function(t){t=n.getQueryElement(t);var e=t&amp;&amp;t.outlayerGUID;return e&amp;&amp;c[e]},r.create=function(t,e){var i=s(r);return i.defaults=n.extend({},r.defaults),n.extend(i.defaults,e),i.compatOptions=n.extend({},r.compatOptions),i.namespace=t,i.data=r.data,i.Item=s(o),n.htmlInit(i,t),u&amp;&amp;u.bridget&amp;&amp;u.bridget(t,i),i};var m={ms:1,s:1e3};return r.Item=o,r}),function(t,e){"function"==typeof define&amp;&amp;define.amd?define(["outlayer/outlayer","get-size/get-size"],e):"object"==typeof module&amp;&amp;module.exports?module.exports=e(require("outlayer"),require("get-size")):t.Masonry=e(t.Outlayer,t.getSize)}(window,function(t,e){var i=t.create("masonry");i.compatOptions.fitWidth="isFitWidth";var n=i.prototype;return n._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns(),this.colYs=[];for(var t=0;t&lt;this.cols;t++)this.colYs.push(0);this.maxY=0,this.horizontalColIndex=0},n.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var t=this.items[0],i=t&amp;&amp;t.element;this.columnWidth=i&amp;&amp;e(i).outerWidth||this.containerWidth}var n=this.columnWidth+=this.gutter,o=this.containerWidth+this.gutter,r=o/n,s=n-o%n,a=s&amp;&amp;1&gt;s?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},n.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&amp;&amp;n.innerWidth},n._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&amp;&amp;1&gt;e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this.options.horizontalOrder?"_getHorizontalColPosition":"_getTopColPosition",r=this[o](n,t),s={x:this.columnWidth*r.col,y:r.y},a=r.y+t.size.outerHeight,h=n+r.col,u=r.col;h&gt;u;u++)this.colYs[u]=a;return s},n._getTopColPosition=function(t){var e=this._getTopColGroup(t),i=Math.min.apply(Math,e);return{col:e.indexOf(i),y:i}},n._getTopColGroup=function(t){if(2&gt;t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i&gt;n;n++)e[n]=this._getColGroupY(n,t);return e},n._getColGroupY=function(t,e){if(2&gt;e)return this.colYs[t];var i=this.colYs.slice(t,t+e);return Math.max.apply(Math,i)},n._getHorizontalColPosition=function(t,e){var i=this.horizontalColIndex%this.cols,n=t&gt;1&amp;&amp;i+t&gt;this.cols;i=n?0:i;var o=e.size.outerWidth&amp;&amp;e.size.outerHeight;return this.horizontalColIndex=o?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},n._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var h=Math.floor(s/this.columnWidth);h-=s%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var u=this._getOption("originTop"),d=(u?n.top:n.bottom)+i.outerHeight,l=a;h&gt;=l;l++)this.colYs[l]=Math.max(d,this.colYs[l])},n._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&amp;&amp;(t.width=this._getContainerFitWidth()),t},n._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&amp;&amp;0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},n.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i});
$(document).ready(function() {

    var slideElements = [];

    // read all event elements
    // auskommentiert da nicht ausgeben
    // gem. bespr. MO 21.1.19 (FR)
    // $('.events__article').each(function(index, el) {
    //     $this = $(this);
    //     var event = {
    //         "date": $this.attr('data-date'),
    //         "humandate": $this.find('.events__dates').text().trim(),
    //         "title": $this.find('.events__title').text(),
    //         "link": $this.find('.events__link-overlay').attr('href'),
    //         "image": $this.find('.events__image').attr('data-slider-bg-img'),
    //         "address": $this.find('.events__address').text().trim()
    //     };
    //     slideElements.push(event);
    // });

    // read all news elements
    $('.news-slider__article').each(function(index, el) {
        $this = $(this);
        var news = {
            "date": $this.attr('data-date'),
            "humandate": $this.find('.news-slider__date-time').text().trim(),
            "title": $this.find('.news-slider__heading').text(),
            "link": $this.find('.news-list__heading-link').attr('href'),
            "image": $this.find('.news-home-image').attr('data-slider-bg-img')
        }
        slideElements.push(news);
    });

    // Sort by date, newest first.
    // nicht nötig ohne Events
    /*slideElements.sort(function(a, b) {
        return new Date(b.date) - new Date(a.date)
    });*/

    // remove all after 10 elements
    // reason: slider does support up to 10 elements
    slideElements.slice(0, 10).filter(function (el) {
        return el != null; // remove empty elements
    });

    // slider preparation
    // remove all radios
    var slider = $('.news-slider');
    slider.find('.news-slider__radio').remove();

    // remove all slide elements
    $('.news-home-image--fallback').css({'margin-bottom': 0});
    slider.find('.news-slider__article').remove();

    // remove all slider arrows
    slider.find('.news-slider__arrows-list').remove();

    // Insert slider elements
    var elementIndex = 0;

    var atLeastOneImageNotFound = slideElements.filter(function(elem) {
        return elem.image === undefined;
    }).length;
    atLeastOneImageNotFound = atLeastOneImageNotFound &gt; 0 ? true : false;

    slideElements.forEach(function(sliderElement, el, slideElements) {
        // insert radios
        var checked = elementIndex === 0 ? "checked" : "";
        slider.prepend('&lt;input class="news-slider__radio news-slider__radio-nr-' + (elementIndex+1) + ' visuallyhidden" type="radio" name="slider-radio-540" id="540-' + (elementIndex+1) + '" ' + checked + '&gt;');

        sliderElement.image = sliderElement.image || $('.news-home-image--fallback').attr('data-news-fallback-img');

        var address = sliderElement.address ? ', ' + sliderElement.address : '';

        var readMore;

        // check which language is set and change text for Header News accordingly
        let lang = document.documentElement.lang.substring(0, 2);
        switch (lang) {
            case "de":
                readMore = "Weiterlesen";
                break;
            case "fr":
                readMore = "Lire la suite";
                break;
            case "it":
                readMore = "Approfondisci";
                break;
            case "en":
                readMore = "Read more";
                break;
            default:
                readMore = "Weiterlesen";
        }
        // insert slider elements
        slider.find('.news-slider__elements').append(
            '&lt;article class="news-slider__article news-slider__article--index-' + (elementIndex+1) + ' news-slider__article--type-0" itemscope="itemscope" itemtype="http://schema.org/Article"&gt;' +
              '&lt;div&gt;' +
                '&lt;div class="news-home-image" style="background-image: url(' + sliderElement.image + ')" ' + atLeastOneImageNotFound + '&gt;&lt;/div&gt;' +
              '&lt;/div&gt;' +
              '&lt;div class=" news-slider__contents-wrapper"&gt;' +
                '&lt;div class="news-slider__contents"&gt;' +
                  '&lt;header class=" news-slider__header"&gt;' +
                    '&lt;h3 class="news-slider__heading"&gt;&lt;a class="news-list__heading-link" title="' + sliderElement.title + '" target="_self" href="' + sliderElement.link + '"&gt;&lt;span class="news-list__heading-text" itemprop="headline"&gt;' + sliderElement.title + '&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;' +
                  '&lt;/header&gt;' +
                  '&lt;div class=" news-slider__date"&gt;&lt;time class="news-slider__date-time" itemprop="datePublished" datetime="' + sliderElement.date + '"&gt;' + sliderElement.humandate + '&lt;/time&gt;' + address + '&lt;/div&gt;' +
                  '&lt;div class=" news-slider__categories"&gt;' +
                    '&lt;ul class="news-slider__category-list"&gt;' +
                      '&lt;li class="news-slider__category-item"&gt;&lt;a class="button button--category button--ghost button--small" title="' + 0 + '" href="' + 0 +'"&gt;' + 0 + '&lt;/a&gt;&lt;/li&gt;' +
                    '&lt;/ul&gt;' +
                  '&lt;/div&gt;' +
                  '&lt;div class=" news-slider__teaser"&gt;' +
                    '&lt;div class="news-slider__teaser-text" itemprop="description"&gt;' +
                      '&lt;p&gt;' + 0 + '&lt;/p&gt;' +
                    '&lt;/div&gt;' +
                  '&lt;/div&gt;' +
                  '&lt;footer class=" news-slider__footer"&gt;&lt;a class="button button--arrow-before" title="' + sliderElement.title + '" target="_self" href="' + sliderElement.link + '"&gt;' + readMore + '&lt;/a&gt;&lt;/footer&gt;' +
                '&lt;/div&gt;' +
              '&lt;/div&gt;' +
            '&lt;/article&gt;'
        );

        // insert arrow navigation
        slider.find('.news-slider__arrows').append(function() {
            if (elementIndex === 0) {
                return '&lt;ul class="news-slider__arrows-list news-slider__arrows-list--' + (elementIndex+1) + '"&gt;' +
            '&lt;li class="news-slider__arrow-item"&gt;&lt;label for="540-' + slideElements.length + '" class="news-slider__arrow-button news-slider__arrow-button--previous"&gt;&lt;/label&gt;&lt;/li&gt;' +
            '&lt;li class="news-slider__arrow-item"&gt;&lt;label for="540-2" class="news-slider__arrow-button news-slider__arrow-button--next"&gt;&lt;/label&gt;&lt;/li&gt;' +
          '&lt;/ul&gt;'
            } else if (slideElements.length === elementIndex+1 ) {
                return '&lt;ul class="news-slider__arrows-list news-slider__arrows-list--' + (elementIndex+1) + '"&gt;' +
            '&lt;li class="news-slider__arrow-item"&gt;&lt;label for="540-' + (slideElements.length-1) + '" class="news-slider__arrow-button news-slider__arrow-button--previous"&gt;&lt;/label&gt;&lt;/li&gt;' +
            '&lt;li class="news-slider__arrow-item"&gt;&lt;label for="540-1" class="news-slider__arrow-button news-slider__arrow-button--next"&gt;&lt;/label&gt;&lt;/li&gt;' +
          '&lt;/ul&gt;'
            } else {
                return '&lt;ul class="news-slider__arrows-list news-slider__arrows-list--' + (elementIndex+1) + '"&gt;' +
            '&lt;li class="news-slider__arrow-item"&gt;&lt;label for="540-' + elementIndex + '" class="news-slider__arrow-button news-slider__arrow-button--previous"&gt;&lt;/label&gt;&lt;/li&gt;' +
            '&lt;li class="news-slider__arrow-item"&gt;&lt;label for="540-' + (elementIndex+2) + '" class="news-slider__arrow-button news-slider__arrow-button--next"&gt;&lt;/label&gt;&lt;/li&gt;' +
          '&lt;/ul&gt;'
            }
        });
        elementIndex++;
    });

    if (atLeastOneImageNotFound) {
        $('.news-home-image:not(.news-home-image--fallback)').addClass('news-home-image--invisible');
    }

    $('.news-home-image--invisible').removeClass('news-home-image--invisible');

    $('.news-slider').addClass('news-slider--loaded');
    $('.news-home-image--fallback').css('margin-bottom', '');

    // automatic slider
    function autoSlide(){
        var autoSlideInterval = setInterval(function(){
            if ($('.news-slider__radio:checked').prev('.news-slider__radio').length &gt; 0) {
                $('.news-slider__radio:checked').prev('.news-slider__radio').prop('checked', true);
            } else {
                $('.news-slider__radio-nr-1').prop('checked', true);
            }
        }, 7500);
        return autoSlideInterval;
    }
    interval = autoSlide();

    $('.news-slider')
        .mouseenter(function(){
            clearInterval(interval);
        })
        .mouseleave(function(){
            interval = autoSlide();
        });
});

$(function() {
    submitComment();
    hashValue();
    onFocusValidation();
    $parentCommentId = '';
    replyComment();
});

function replyComment() {
    $(document).on("click", '.comment-btn.reply', function(event) {
        var parentCommentId = $(this).parent().attr('id');
        $('#'+ parentCommentId + ' .comment-btn.reply').hide();
    });
}

// Scroll to paramlink
function hashValue() {
    // get hash value
    var hash = window.location.hash;
    // now scroll to element with that id
    if (hash != '') {
        $('html, body').stop().animate({
            scrollTop: ($(hash).offset().top)
        }, 2000);
    }
}

// Submit form using ajax
function submitComment() {

    // Submit comment
    $(document).on('submit', '.tx_nsnewscomments #comment-form', function(event) {
        var captcha = $('.tx_nsnewscomments #captcha').val();
        var ajaxURL = $(this).attr('action');
        var datatype = $('.tx_nsnewscomments #dataType').val();
        var commentHTML = $('.active-comment-form').html();
        if (!event.isDefaultPrevented()) {
            if (validateField()) {
                $.ajax({
                    type: 'POST',
                    url: ajaxURL,
                    dataType: datatype,
                    cache:true,
                    data: $(this).serialize(),
                    beforeSend: function() {
                        $('.tx_nsnewscomments #submit').attr('disabled', true);
                        $('.tx_nsnewscomments #submit').css('cursor', 'default');
                    },
                    success: function(response) {
                        // GET HTML for comment list
                        $(".tx_nsnewscomments #comments-list").load(location.href + " .tx_nsnewscomments #comments-list&gt;*", function(responseTxt, statusTxt, jqXHR) {
                           if(statusTxt == "success"){
                                // Scroll to comment
                                $.each(response, function(key, val) {
                                    if (val.parentId == '') {
                                        $('.tx_nsnewscomments .thanksmsg').show();
                                        $('html, body').stop().animate({
                                            scrollTop: ($('.tx_nsnewscomments .thanksmsg').offset().top)
                                        }, 2000);
                                        setTimeout(function() {
                                            $('.tx_nsnewscomments .thanksmsg').fadeOut("slow");
                                        }, 7000);
                                    } else {

                                        $('.tx_nsnewscomments .thanksmsg-' + val.parentId).show();
                                        $('html, body').stop().animate({
                                            scrollTop: ($('.tx_nsnewscomments .thanksmsg-' + val.parentId).offset().top)
                                        }, 2000);
                                        setTimeout(function() {
                                            $('.tx_nsnewscomments .thanksmsg-' + val.parentId).fadeOut("slow");
                                        }, 7000);
                                        $('.tx_nsnewscomments #comments-' + val.parentId).fadeIn('slow');
                                        $('.tx_nsnewscomments #parentId').val('');
                                    }
                                });
                            }
                            if(statusTxt == "error"){
                                alert("Error: " + jqXHR.status + " " + jqXHR.statusText);
                            }
                        });
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        alert(textStatus + " " + errorThrown);
                    },
                    complete: function(response) {
                        $('.tx_nsnewscomments #comment-form')[0].reset();
                        var captcha = document.getElementById("captcha");
                        if(captcha){
                            refreshCaptcha();
                        }
                        $('.tx_nsnewscomments #submit').attr('disabled', false);
                        $('.tx_nsnewscomments #submit').css('cursor', 'pointer');
                        addForm();
                    },
                });
                event.preventDefault();
            } else {
                return false;
            }
        }
    });

    // Reply form
    $(document).on("click", '.reply', function(event) {
        var parentCommentId = $(this).parent().attr('id');
        var commentHTML = $('.active-comment-form').html();
        $('.active-comment-form .comment-form')[0].reset();
        $('.active-comment-form').html('');
        $('.active-comment-form').removeClass('active-comment-form');
        $(this).parent().parent().parent().parent().find('#reply-form-' + parentCommentId).append(commentHTML);
        $(this).parent().parent().parent().parent().find('#reply-form-' + parentCommentId).addClass('active-comment-form');
        $('#comment-form-close-btn').show();
        removeDefaultValidation();

        // Scroll to form position
        $('html, body').stop().animate({
            scrollTop: ($('.tx_nsnewscomments #reply-form-' + parentCommentId).offset().top)
        }, 1000);

        // Set hidden parentId
        $('.tx_nsnewscomments #parentId').val(parentCommentId);
        onFocusValidation();
    });

    // Close form
    $(document).on("click", ".tx_nsnewscomments #comment-form-close-btn", function(event) {
        var parentCommentIdClose = $('#parentId').val();;
        $('#'+ parentCommentIdClose + ' .comment-btn.reply').show();
        addForm();
    });
}

// Open form on close button click
function addForm() {
    var commentHTML = $('.active-comment-form').html();
    $('.tx_nsnewscomments .active-comment-form').html('');
    $('.tx_nsnewscomments .active-comment-form').removeClass('active-comment-form');
    $('.tx_nsnewscomments #form-comment-view').html(commentHTML);
    $('.tx_nsnewscomments #form-comment-view').addClass('active-comment-form');
    $('.tx_nsnewscomments #comment-form-close-btn').hide();
    $('.tx_nsnewscomments #parentId').val('');
    removeDefaultValidation();
    onFocusValidation();
}

// Custom Validation 
function validateField() {
    var flag = 1;
    var elementObj;
    var captcha = document.getElementById("captcha");
    var terms = document.getElementsByName('tx_nsnewscomments_newscomment[newComment][terms]').length;

    if (!$('.tx_nsnewscomments #name').val()) {
        $(".tx_nsnewscomments #name").parent().addClass('has-error');
        $('.tx_nsnewscomments #name_error').show();
        var flag = 0;
    } else {
        if (!validateName($('.tx_nsnewscomments #name').val())) {
            $(".tx_nsnewscomments #name_error_msg").show();
            $(".tx_nsnewscomments #name_error").hide();
            $(".tx_nsnewscomments #name").parent().addClass('has-error');
            var flag = 0;
        } else {
            $(".tx_nsnewscomments #name").parent().removeClass('has-error');
            $(".tx_nsnewscomments #name_error_msg").hide();
            $(".tx_nsnewscomments #name_error").hide();
        }
    }

    if (!$('.tx_nsnewscomments #email').val()) {
        $(".tx_nsnewscomments #email").parent().addClass('has-error');
        $(".tx_nsnewscomments #email_error").show();
        $(".tx_nsnewscomments #email_error_msg").hide();
        var flag = 0;
    } else {
        if (!validateEmail($('.tx_nsnewscomments #email').val())) {
            $(".tx_nsnewscomments #email_error_msg").show();
            $(".tx_nsnewscomments #email_error").hide();
            $(".tx_nsnewscomments #email").parent().addClass('has-error');
            var flag = 0;
        } else {
            $(".tx_nsnewscomments #email").parent().removeClass('has-error');
        }
    }

    if (!$('.tx_nsnewscomments #comment').val()) {
        $(".tx_nsnewscomments #comment").parent().addClass('has-error');
        $(".tx_nsnewscomments #comment_error").show();
        var flag = 0;
    } else {
        var length = $.trim($(".tx_nsnewscomments #comment").val()).length;
        if (length == 0) {
            $(".tx_nsnewscomments #comment_error").show();
            $(".tx_nsnewscomments #comment").parent().addClass('has-error');
            var flag = 0;
        } else {
            $(".tx_nsnewscomments #comment").parent().removeClass('has-error'); // remove it
        }
    }

    if(captcha){
        if (!$('.tx_nsnewscomments #captcha').val()) {
            $(".tx_nsnewscomments #captcha").parent().addClass('has-error');
            $(".tx_nsnewscomments #captcha_error").show();
            $(".tx_nsnewscomments #captcha_valid_error").hide();
            var flag = 0;
        } else {
            if (validateCaptcha($('.tx_nsnewscomments #captcha').val()) == 'true') {
                $(".tx_nsnewscomments #captcha").parent().removeClass('has-error'); // remove it
            } else {
                $(".tx_nsnewscomments #captcha_valid_error").show();
                $(".tx_nsnewscomments #captcha_error").hide();
                $(".tx_nsnewscomments #captcha").parent().addClass('has-error');
                var flag = 0;
            }
        }
    }

    if (terms) {
        if ( !$('.tx_nsnewscomments input[name="tx_nsnewscomments_newscomment[newComment][terms]"]:checked').length ) {
            $(".tx_nsnewscomments #terms").closest('.ns-form-group').addClass('has-error');
            $(".tx_nsnewscomments #terms_error").show();
            var flag = 0;
        } else {
            $(".tx_nsnewscomments #terms").closest('.ns-form-group').removeClass('has-error');
            $(".tx_nsnewscomments #terms_error").hide();
        }
    }

    if (flag == 1) {
        return true;
    }
}

// Custom validation for onfocus
function onFocusValidation() {

    $(".tx_nsnewscomments #name").focusout(function() {
        elementObj = $(this);
        if (elementObj.val() != '') {
            if (!validateName($('.tx_nsnewscomments #name').val())) {
                $(".tx_nsnewscomments #name_error_msg").show();
                $(".tx_nsnewscomments #name_error").hide();
                $(".tx_nsnewscomments #name").parent().addClass('has-error');
                var flag = 0;
            } else {
                elementObj.parent().removeClass('has-error');
                $(".tx_nsnewscomments #name_error_msg").hide();
                $(".tx_nsnewscomments #name_error").hide();
            }
        } else {
            $(".tx_nsnewscomments #name").parent().addClass('has-error');
            $(".tx_nsnewscomments #name_error").show();
            $(".tx_nsnewscomments #name_error_msg").hide();
        }
    });

    $(".tx_nsnewscomments #email").focusout(function() {
        elementObj = $(this);
        if (elementObj.val() != '') {
            if (!validateEmail($('.tx_nsnewscomments #email').val())) {
                $(".tx_nsnewscomments #email_error_msg").show();
                $(".tx_nsnewscomments #email_error").hide();
                $(".tx_nsnewscomments #email").parent().addClass('has-error');
                var flag = 0;
            } else {
                elementObj.parent().removeClass('has-error');
                $(".tx_nsnewscomments #email_error_msg").hide();
                $(".tx_nsnewscomments #email_error").hide();
            }
        } else {
            $(".tx_nsnewscomments #email").parent().addClass('has-error');
            $(".tx_nsnewscomments #email_error").show();
            $(".tx_nsnewscomments #email_error_msg").hide();
        }
    });

    $(".tx_nsnewscomments #comment").focusout(function() {
        elementObj = $(this);
        if (elementObj.val() != '') {
            var length = $.trim($(".tx_nsnewscomments #comment").val()).length;
            if (length == 0) {
                $(".tx_nsnewscomments #comment_error").show();
                $(".tx_nsnewscomments #comment").parent().addClass('has-error');
                var flag = 0;
            } else {
                $(".tx_nsnewscomments #comment").parent().removeClass('has-error'); // remove it
                $(".tx_nsnewscomments #comment_error").hide();
            }

        } else {
            $(".tx_nsnewscomments #comment").parent().addClass('has-error');
            $(".tx_nsnewscomments #comment_error").show();
        }
    });

    $(".tx_nsnewscomments #captcha").focusout(function() {
        elementObj = $(this);
        if (elementObj.val() != '') {
            var length = $.trim($(".tx_nsnewscomments #captcha").val()).length;
            if (length == 0) {
                $(".tx_nsnewscomments #captcha_error").show();
                $(".tx_nsnewscomments #captcha").parent().addClass('has-error');
                var flag = 0;
            } else {
                $(".tx_nsnewscomments #captcha").parent().removeClass('has-error'); // remove it
                $(".tx_nsnewscomments #captcha_error").hide();
                $(".tx_nsnewscomments #captcha_valid_error").hide();
            }
        } else {
            $(".tx_nsnewscomments #captcha").parent().addClass('has-error');
            $(".tx_nsnewscomments #captcha_error").show();
        }
    });

    $('.tx_nsnewscomments input[name="tx_nsnewscomments_newscomment[newComment][terms]"]').on('change', function(){
        if ( !$('.tx_nsnewscomments input[name="tx_nsnewscomments_newscomment[newComment][terms]"]:checked').length ) {
            $(".tx_nsnewscomments #terms").closest('.ns-form-group').addClass('has-error');
            $(".tx_nsnewscomments #terms_error").show();
            var flag = 0;
        } else {
            $(".tx_nsnewscomments #terms").closest('.ns-form-group').removeClass('has-error');
            $(".tx_nsnewscomments #terms_error").hide();
        }
    });

}

// Remove Default Validation in reply form
function removeDefaultValidation() {
    $(".tx_nsnewscomments #name").parent().removeClass('has-error'); // remove it
    $(".tx_nsnewscomments #name_error").hide();
    $(".tx_nsnewscomments #name_error_msg").hide();

    $(".tx_nsnewscomments #email").parent().removeClass('has-error');
    $(".tx_nsnewscomments #email_error").hide();
    $(".tx_nsnewscomments #email_error_msg").hide();

    $(".tx_nsnewscomments #comment").parent().removeClass('has-error');
    $(".tx_nsnewscomments #comment_error").hide();

    $(".tx_nsnewscomments #captcha").parent().removeClass('has-error');
    $(".tx_nsnewscomments #captcha_error").hide();
    $(".tx_nsnewscomments #captcha_valid_error").hide();
}

// Validate Captcha field using ajax request
function validateCaptcha(captcha) {

    var dataString = 'captcha=' + captcha;
    var url = $('.verification').val();
    var response = $.ajax({
        type: 'POST',
        async: false,
        url: url,
        data: dataString,
        success: function(response) {

        },
        error: function() {
            alert('Captcha not Mathched');
        }
    });
    return response.responseText;
}

// Validate Email field
function validateEmail($email) {
    var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
    return emailReg.test($email);
}

// Validate Name field
function validateName($name) {
    var nameReg = /[^0-9]/g;
    return nameReg.test($name);
}

// Referech Captcha
function refreshCaptcha() {
    var img = document.images['captchaimg'];
    img.src = img.src.substring(0, img.src.lastIndexOf("?")) + "?rand=" + Math.random() * 1000;
}</pre></body></html>