1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18240,e=>{"use strict";var t=e.i(57688),i=e.i(26411);e.s(["sanityPosterUrl",0,function(e,r){let a=(0,i.sanityImageSource)(e,r);if(!(0,i.isSanityImageUrl)(a))return a;let s=Math.min(r??i.NEXT_IMAGE_MAX_WIDTH,i.NEXT_IMAGE_MAX_WIDTH),{props:n}=(0,t.getImageProps)({src:a,alt:"",width:s,height:s});return n.src}])},45728,e=>{"use strict";let t,i,r,a,s,n,o,l,d,h,u;var c=e.i(43476),m=e.i(71645),p=Object.create,f=Object.defineProperty,g=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,E=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty,y=function(e,t){return function(){return e&&(t=e(e=0)),t}},T=function(e,t){return function(){return t||e((t={exports:{}}).exports,t),t.exports}},A=function(e,t,i,r){if(t&&"object"==typeof t||"function"==typeof t)for(var a,s=v(t),n=0,o=s.length;n<o;n++)a=s[n],b.call(e,a)||a===i||f(e,a,{get:(function(e){return t[e]}).bind(null,a),enumerable:!(r=g(t,a))||r.enumerable});return e},_=function(e,t,i){return i=null!=e?p(E(e)):{},A(!t&&e&&e.__esModule?i:f(i,"default",{value:e,enumerable:!0}),e)},k=T(function(t,i){i.exports="u">typeof window?window:e.g});function S(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var w=y(function(){}),L=T(function(t,i){var r;let a;w(),r=function(){var e=function(){},t="undefined",i=("u"<typeof window?"undefined":S(window))!==t&&S(window.navigator)!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function a(e,t){var i=e[t];if("function"==typeof i.bind)return i.bind(e);try{return Function.prototype.bind.call(i,e)}catch(t){return function(){return Function.prototype.apply.apply(i,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function n(t,i){for(var a=0;a<r.length;a++){var s=r[a];this[s]=a<t?e:this.methodFactory(s,t,i)}this.log=this.debug}function o(e,i,r){return function(){("u"<typeof console?"undefined":S(console))!==t&&(n.call(this,i,r),this[e].apply(this,arguments))}}function l(r,n,l){var d;return"debug"===(d=r)&&(d="log"),("u"<typeof console?"undefined":S(console))!==t&&("trace"===d&&i?s:void 0!==console[d]?a(console,d):void 0!==console.log?a(console,"log"):e)||o.apply(this,arguments)}function d(e,i,a){var s,o=this;i=null==i?"WARN":i;var d="loglevel";function h(){var e;if(!(("u"<typeof window?"undefined":S(window))===t||!d)){try{e=window.localStorage[d]}catch(e){}if((void 0===e?"undefined":S(e))===t)try{var i=window.document.cookie,r=i.indexOf(encodeURIComponent(d)+"=");-1!==r&&(e=/^([^;]+)/.exec(i.slice(r))[1])}catch(e){}return void 0===o.levels[e]&&(e=void 0),e}}"string"==typeof e?d+=":"+e:(void 0===e?"undefined":S(e))==="symbol"&&(d=void 0),o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=a||l,o.getLevel=function(){return s},o.setLevel=function(i,a){if("string"==typeof i&&void 0!==o.levels[i.toUpperCase()]&&(i=o.levels[i.toUpperCase()]),"number"==typeof i&&i>=0&&i<=o.levels.SILENT){if(s=i,!1!==a&&function(e){var i=(r[e]||"silent").toUpperCase();if(!(("u"<typeof window?"undefined":S(window))===t||!d)){try{window.localStorage[d]=i;return}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"="+i+";"}catch(e){}}}(i),n.call(o,i,e),("u"<typeof console?"undefined":S(console))===t&&i<o.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+i},o.setDefaultLevel=function(e){i=e,h()||o.setLevel(e,!1)},o.resetLevel=function(){o.setLevel(i,!1),function(){if(!(("u"<typeof window?"undefined":S(window))===t||!d)){try{window.localStorage.removeItem(d);return}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}()},o.enableAll=function(e){o.setLevel(o.levels.TRACE,e)},o.disableAll=function(e){o.setLevel(o.levels.SILENT,e)};var u=h();null==u&&(u=i),o.setLevel(u,!1)}var h=new d,u={};h.getLogger=function(e){if((void 0===e?"undefined":S(e))!=="symbol"&&"string"!=typeof e||""===e)throw TypeError("You must supply a name when creating a logger.");var t=u[e];return t||(t=u[e]=new d(e,h.getLevel(),h.methodFactory)),t};var c=("u"<typeof window?"undefined":S(window))!==t?window.log:void 0;return h.noConflict=function(){return("u"<typeof window?"undefined":S(window))!==t&&window.log===h&&
1(window.log=c),h},h.getLoggers=function(){return u},h.default=h,h},"function"==typeof define&&define.amd?void 0!==(a=r(e.r,exports,module))&&e.v(a):"object"==typeof i&&i.exports?i.exports=r():t.log=r()});function R(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):R(e,t)}var I=y(function(){I()}),C=T(function(e){var t,i=Object.prototype.hasOwnProperty;function r(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function a(e){try{return encodeURIComponent(e)}catch(e){return null}}e.stringify=function(e,r){var s,n,o=[];for(n in"string"!=typeof(r=r||"")&&(r="?"),e)if(i.call(e,n)){if(!(s=e[n])&&(null===s||s===t||isNaN(s))&&(s=""),n=a(n),s=a(s),null===n||null===s)continue;o.push(n+"="+s)}return o.length?r+o.join("&"):""},e.parse=function(e){for(var t,i=/([^=?#&]+)=?([^&]*)/g,a={};t=i.exec(e);){var s=r(t[1]),n=r(t[2]);null===s||null===n||s in a||(a[s]=n)}return a}}),D=T(function(t,i){!function(r){let a;var s=!1;if("function"==typeof define&&define.amd&&(void 0!==(a=r(e.r,exports,module))&&e.v(a),s=!0),"object"==typeof t&&(i.exports=r(),s=!0),!s){var n=window.Cookies,o=window.Cookies=r();o.noConflict=function(){return window.Cookies=n,o}}}(function(){var e=function(){for(var e=0,t={};e<arguments.length;e++){var i=arguments[e];for(var r in i)t[r]=i[r]}return t};return function t(i){function r(t,a,s){var n;if("u">typeof document){if(arguments.length>1){if("number"==typeof(s=e({path:"/"},r.defaults,s)).expires){var o=new Date;o.setMilliseconds(o.getMilliseconds()+864e5*s.expires),s.expires=o}try{n=JSON.stringify(a),/^[\{\[]/.test(n)&&(a=n)}catch(e){}return a=i.write?i.write(a,t):encodeURIComponent(String(a)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[t,"=",a,s.expires?"; expires="+s.expires.toUTCString():"",s.path?"; path="+s.path:"",s.domain?"; domain="+s.domain:"",s.secure?"; secure":""].join("")}t||(n={});for(var l=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,h=0;h<l.length;h++){var u=l[h].split("="),c=u.slice(1).join("=");'"'===c.charAt(0)&&(c=c.slice(1,-1));try{var m=u[0].replace(d,decodeURIComponent);if(c=i.read?i.read(c,m):i(c,m)||c.replace(d,decodeURIComponent),this.json)try{c=JSON.parse(c)}catch(e){}if(t===m){n=c;break}t||(n[m]=c)}catch(e){}}return n}}return r.set=r,r.get=function(e){return r.call(r,e)},r.getJSON=function(){return r.apply({json:!0},[].slice.call(arguments))},r.defaults={},r.remove=function(t,i){r(t,"",e(i,{expires:-1}))},r.withConverter=t,r}(function(){})})}),x=T(function(e,t){var i=Array.prototype.slice;t.exports=function(e,t){for(("length"in e)||(e=[e]),e=i.call(e);e.length;){var r=e.shift(),a=t(r);if(a)return a;r.childNodes&&r.childNodes.length&&(e=i.call(r.childNodes).concat(e))}}}),M=T(function(e,t){function i(e,t){if(!R(this,i))return new i(e,t);this.data=e,this.nodeValue=e,this.length=e.length,this.ownerDocument=t||null}I(),t.exports=i,i.prototype.nodeType=8,i.prototype.nodeName="#comment",i.prototype.toString=function(){return"[object Comment]"}}),O=T(function(e,t){function i(e,t){if(!R(this,i))return new i(e);this.data=e||"",this.length=this.data.length,this.ownerDocument=t||null}I(),t.exports=i,i.prototype.type="DOMTextNode",i.prototype.nodeType=3,i.prototype.nodeName="#text",i.prototype.toString=function(){return this.data},i.prototype.replaceData=function(e,t,i){var r=this.data,a=r.substring(0,e),s=r.substring(e+t,r.length);this.data=a+i+s,this.length=this.data.length}}),P=T(function(e,t){t.exports=function(e){var t=this,i=e.type;e.target||(e.target=t),t.listeners||(t.listeners={});var r=t.listeners[i];if(r)return r.forEach(function(i){e.currentTarget=t,"function"==typeof i?i(e):i.handleEvent(e)});t.parentNode&&t.parentNode.dispatchEvent(e)}}),N=T(function(e,t){t.exports=function(e,t){this.listeners||(this.listeners={}),this.listeners[e]||(this.listeners[e]=[]),-1===this.listeners[e].indexOf(t)&&this.listeners[e].push(t)}}),U=T(function(e,t){t.exports=function(e,t){if(this.listeners&&this.listeners[e]){var i=this.listeners[e],r=i.indexOf(t);-1!==r&&i.splice(r,1)}}}),F=T(function(e,t){w(),t.exports=function e(t){switch(t.nodeType){case 3:return a(t.data);case 8:return"<!--"+t.data+"-->";default:var s,n,o;return n=[],o=(s=t).tagName,"http://www.w3.org/1999/xhtml"===s.namespaceURI&&(o=o.toLowerCase()),n.push("<"+o+function(e){var t=[];for(var i in e)(function(e,t){var i=S(e[t]);return"style"===t&&Object.keys(e.style).length>0||e.hasOwnProperty(t)&&("string"===i||"boolean"===i||"number"===i)&&"nodeName"!==t&&"className"!==t&&"tagName"!==t&&"textContent"!==t&&"innerText"!==t&&"namespaceURI"!==t&&"innerHTML"!==t}
1)(e,i)&&t.push({name:i,value:e[i]});for(var a in e._attributes)for(var s in e._attributes[a]){var n=e._attributes[a][s],o=(n.prefix?n.prefix+":":"")+s;t.push({name:o,value:n.value})}return e.className&&t.push({name:"class",value:e.className}),t.length?r(t):""}(s)+function(e){var t=e.dataset,i=[];for(var a in t)i.push({name:"data-"+a,value:t[a]});return i.length?r(i):""}(s)),i.indexOf(o)>-1?n.push(" />"):(n.push(">"),s.childNodes.length?n.push.apply(n,s.childNodes.map(e)):s.textContent||s.innerText?n.push(a(s.textContent||s.innerText)):s.innerHTML&&n.push(s.innerHTML),n.push("</"+o+">")),n.join("")}};var i=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function r(e){var t=[];return e.forEach(function(e){var i=e.name,r=e.value;"style"===i&&(r=function(e){if("string"==typeof e)return e;var t="";return Object.keys(e).forEach(function(i){var r=e[i];i=i.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()}),t+=i+":"+r+";"}),t}(r)),t.push(i+'="'+a(r).replace(/"/g,""")+'"')}),t.length?" "+t.join(" "):""}function a(e){var t="";return"string"==typeof e?t=e:e&&(t=e.toString()),t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}),B=T(function(e,t){I();var i=x(),r=P(),a=N(),s=U(),n=F(),o="http://www.w3.org/1999/xhtml";function l(e,t,i){if(!R(this,l))return new l(e);var r=void 0===i?o:i||null;this.tagName=r===o?String(e).toUpperCase():e,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=t||null,this.namespaceURI=r,this._attributes={},"INPUT"===this.tagName&&(this.type="text")}t.exports=l,l.prototype.type="DOMElement",l.prototype.nodeType=1,l.prototype.appendChild=function(e){return e.parentNode&&e.parentNode.removeChild(e),this.childNodes.push(e),e.parentNode=this,e},l.prototype.replaceChild=function(e,t){e.parentNode&&e.parentNode.removeChild(e);var i=this.childNodes.indexOf(t);return t.parentNode=null,this.childNodes[i]=e,e.parentNode=this,t},l.prototype.removeChild=function(e){var t=this.childNodes.indexOf(e);return this.childNodes.splice(t,1),e.parentNode=null,e},l.prototype.insertBefore=function(e,t){e.parentNode&&e.parentNode.removeChild(e);var i=null==t?-1:this.childNodes.indexOf(t);return i>-1?this.childNodes.splice(i,0,e):this.childNodes.push(e),e.parentNode=this,e},l.prototype.setAttributeNS=function(e,t,i){var r=null,a=t,s=t.indexOf(":");(s>-1&&(r=t.substr(0,s),a=t.substr(s+1)),"INPUT"===this.tagName&&"type"===t)?this.type=i:(this._attributes[e]||(this._attributes[e]={}))[a]={value:i,prefix:r}},l.prototype.getAttributeNS=function(e,t){var i=this._attributes[e],r=i&&i[t]&&i[t].value;return"INPUT"===this.tagName&&"type"===t?this.type:"string"!=typeof r?null:r},l.prototype.removeAttributeNS=function(e,t){var i=this._attributes[e];i&&delete i[t]},l.prototype.hasAttributeNS=function(e,t){var i=this._attributes[e];return!!i&&t in i},l.prototype.setAttribute=function(e,t){return this.setAttributeNS(null,e,t)},l.prototype.getAttribute=function(e){return this.getAttributeNS(null,e)},l.prototype.removeAttribute=function(e){return this.removeAttributeNS(null,e)},l.prototype.hasAttribute=function(e){return this.hasAttributeNS(null,e)},l.prototype.removeEventListener=s,l.prototype.addEventListener=a,l.prototype.dispatchEvent=r,l.prototype.focus=function(){},l.prototype.toString=function(){return n(this)},l.prototype.getElementsByClassName=function(e){var t=e.split(" "),r=[];return i(this,function(e){if(1===e.nodeType){var i=(e.className||"").split(" ");t.every(function(e){return -1!==i.indexOf(e)})&&r.push(e)}}),r},l.prototype.getElementsByTagName=function(e){e=e.toLowerCase();var t=[];return i(this.childNodes,function(i){1===i.nodeType&&("*"===e||i.tagName.toLowerCase()===e)&&t.push(i)}),t},l.prototype.contains=function(e){return i(this,function(t){return e===t})||!1}}),$=T(function(e,t){I();var i=B();function r(e){if(!R(this,r))return new r;this.childNodes=[],this.parentNode=null,this.ownerDocument=e||null}t.exports=r,r.prototype.type="DocumentFragment",r.prototype.nodeType=11,r.prototype.nodeName="#document-fragment",r.prototype.appendChild=i.prototype.appendChild,r.prototype.replaceChild=i.prototype.replaceChild,r.prototype.removeChild=i.prototype.removeChild,r.prototype.toString=function(){return this.childNodes.map(function(e){return String(e)}).join("")}}),H=T(function(e,t){function i(e){}t.exports=i,i.prototype.initEvent=function(e,t,i){this.type=e,this.bubbles=t,this.cancelable=i},i.prototype.preventDefault=function(){}}),W=T(function(e,t){I();var i=x(),r=M(),a=O(),s=B(),n=$(),o=H(),l=P(),d=N(),h=U();function u(){if(!R(this,u))return new u;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}t.exports=u;var c=u.prototype;c.createTextNode=function(e){return new a(e,this)},c.createElementNS=function(e,t){return new s(t,this,null===e?null:String(e))},c.createElement=function(e){return new s(e,this)},c.createDocumentFragment=function(){return new n(this)},c.createEvent=function(e){return new o(e)},c.createComment=function(e){return new r(e,this)},c.getElementById=function(e){return e=String(e),i(this.childNodes,function(t){if(String(t.id)===e)return t})||null},c.getElementsByClassName=s.prototype.getElementsByClassName,c.getElementsByTagName=s.prototype.getElementsByTagName,c.contains=s.prototype.contains,c.removeEventListener=h,c.addEventListener=d,c.dispatchEvent=l}),G=T(function(e,t){t.exports=new(W())}),V=T(function(t,i){var r,a=e.g,s=G();"u">typeof document?r=document:(r=a["__GLOBAL_DOCUMENT_CACHE@4"])||(r=a["__GLOBAL_DOCUMENT_CACHE@4"]=s),i.exports=r});function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,a,s=[],n=!0,o=!1;try{for(i=i.call(e);!(n=(r=i.next()).done)&&(s.push(r.value),!(t&&s.length===t));n=!0);}catch(e){o=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(o)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return K(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);if("Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return K(e,t)}}
1(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var j=_(k()),Y=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},z=function(){return("000000"+(0x81bf1000*Math.random()|0).toString(36)).slice(-6)},X=function(e){var t;if(e&&void 0!==e.nodeName)return e.muxId||(e.muxId=z()),e.muxId;try{t=document.querySelector(e)}catch(e){}return t&&!t.muxId&&(t.muxId=e),(null==t?void 0:t.muxId)||e},Q=function(e){e&&void 0!==e.nodeName?e=X(t=e):t=document.querySelector(e);var t,i=t&&t.nodeName?t.nodeName.toLowerCase():"";return[t,e,i]},Z=_(L()),J=Z.default.methodFactory;Z.default.methodFactory=function(e,t,i){var r=J(e,t,i);return function(){for(var e=["[mux]"],t=0;t<arguments.length;t++)e.push(arguments[t]);r.apply(void 0,e)}},Z.default.setLevel(Z.default.getLevel());var ee=Z.default,et=_(k());function ei(){return"1"===(et.default.doNotTrack||et.default.navigator&&et.default.navigator.doNotTrack)}var er=_(k()),ea=function(){var e=er.default.performance,t=e&&e.timing,i=t&&t.navigationStart;return Math.round("number"==typeof i&&"function"==typeof e.now?i+e.now():Date.now())};function es(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function en(e,t){if(!R(e,t))throw TypeError("Cannot call a class as a function")}function eo(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function el(e,t,i){return t&&eo(e.prototype,t),i&&eo(e,i),e}function ed(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function eh(e,t){return(eh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eu(e){return(eu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}I(),w();var ec=function(e){return em(e)[0]},em=function(e){if("string"!=typeof e||""===e)return["localhost"];var t,i=(e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return i&&(t=(i.match(/[^\.]+\.[^\.]+$/)||[])[0]),[i,t]},ep=_(k()),ef=function(){var e=ep.default.performance;return void 0!==(e&&e.timing)},eg=function(){var e=ep.default.performance,t=e&&e.timing;return t&&t.domContentLoadedEventEnd},ev=function(){var e=ep.default.performance,t=e&&e.timing;return t&&t.navigationStart};function eE(e,t,i){i=void 0===i?1:i,e[t]=e[t]||0,e[t]+=i}function eb(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.forEach(function(t){ed(e,t,i[t])})}return e}function ey(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t})(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}var eT=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],eA=["x-cdn","content-type"].concat(eT);function e_(e){var t={};return(e=e||"").trim().split(/[\r\n]+/).forEach(function(e){if(e){var i=e.split(": "),r=i.shift();r&&(eA.indexOf(r.toLowerCase())>=0||0===r.toLowerCase().indexOf("x-litix-"))&&(t[r]=i.join(": "))}}),t}function ek(e){if(e){var t=eT.find(function(t){return void 0!==e[t]});return t?e[t]:void 0}}var eS=function(e){var t={};for(var i in e){var r=e[i];-1!==r["DATA-ID"].search("io.litix.data.")&&(t[r["DATA-ID"].replace("io.litix.data.","")]=r.VALUE)}return t},ew=function(e){if(!e)return{};var t=ev(),i=e.loading,r=i?i.start:e.trequest,a=i?i.first:e.tfirst,s=i?i.end:e.tload;return{bytesLoaded:e.total,requestStart:Math.round(t+r),responseStart:Math.round(t+a),responseEnd:Math.round(t+s)}},eL=function(e){if(!(!e||"function"!=typeof e.getAllResponseHeaders))return e_(e.getAllResponseHeaders())},eR=function(e,t,i){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=arguments.length>
14?arguments[4]:void 0,a=e.log,s=e.utils.secondsToMs,n=function(e){var t,i=parseInt(r.version);return 1===i&&null!==e.programDateTime&&(t=e.programDateTime),0===i&&null!==e.pdt&&(t=e.pdt),t};if(!ef())return void a.warn("performance timing not supported. Not tracking HLS.js.");var o=function(i,r){return e.emit(t,i,r)},l=function(e,t){var i=t.levels,r=t.audioTracks,a=t.url,s=t.stats,n=t.networkDetails,l=t.sessionData,d={},h={};i.forEach(function(e,t){d[t]={width:e.width,height:e.height,bitrate:e.bitrate,attrs:e.attrs}}),r.forEach(function(e,t){h[t]={name:e.name,language:e.lang,bitrate:e.bitrate}});var u=ew(s),c=u.bytesLoaded,m=u.requestStart,p=u.responseStart,f=u.responseEnd;o("requestcompleted",ey(eb({},eS(l)),{request_event_type:e,request_bytes_loaded:c,request_start:m,request_response_start:p,request_response_end:f,request_type:"manifest",request_hostname:ec(a),request_response_headers:eL(n),request_rendition_lists:{media:d,audio:h,video:{}}}))};i.on(r.Events.MANIFEST_LOADED,l);var d=function(e,t){var i=t.details,r=t.level,a=t.networkDetails,l=ew(t.stats),d=l.bytesLoaded,h=l.requestStart,u=l.responseStart,c=l.responseEnd,m=i.fragments[i.fragments.length-1],p=n(m)+s(m.duration);o("requestcompleted",{request_event_type:e,request_bytes_loaded:d,request_start:h,request_response_start:u,request_response_end:c,request_current_level:r,request_type:"manifest",request_hostname:ec(i.url),request_response_headers:eL(a),video_holdback:i.holdBack&&s(i.holdBack),video_part_holdback:i.partHoldBack&&s(i.partHoldBack),video_part_target_duration:i.partTarget&&s(i.partTarget),video_target_duration:i.targetduration&&s(i.targetduration),video_source_is_live:i.live,player_manifest_newest_program_time:isNaN(p)?void 0:p})};i.on(r.Events.LEVEL_LOADED,d);var h=function(e,t){var i=t.details,r=t.networkDetails,a=ew(t.stats);o("requestcompleted",{request_event_type:e,request_bytes_loaded:a.bytesLoaded,request_start:a.requestStart,request_response_start:a.responseStart,request_response_end:a.responseEnd,request_type:"manifest",request_hostname:ec(i.url),request_response_headers:eL(r)})};i.on(r.Events.AUDIO_TRACK_LOADED,h);var u=function(e,t){var r=t.stats,a=t.networkDetails,s=t.frag,n=ew(r=r||s.stats),l=n.bytesLoaded,d=n.requestStart,h=n.responseStart,u=n.responseEnd,c=a?eL(a):void 0,m={request_event_type:e,request_bytes_loaded:l,request_start:d,request_response_start:h,request_response_end:u,request_hostname:a?ec(a.responseURL):void 0,request_id:c?ek(c):void 0,request_response_headers:c,request_media_duration:s.duration,request_url:null==a?void 0:a.responseURL};"main"===s.type?(m.request_type="media",m.request_current_level=s.level,m.request_video_width=(i.levels[s.level]||{}).width,m.request_video_height=(i.levels[s.level]||{}).height,m.request_labeled_bitrate=(i.levels[s.level]||{}).bitrate):m.request_type=s.type,o("requestcompleted",m)};i.on(r.Events.FRAG_LOADED,u);var c=function(e,t){var i=t.frag,r=i.start;o("fragmentchange",{currentFragmentPDT:n(i),currentFragmentStart:s(r)})};i.on(r.Events.FRAG_CHANGED,c);var m=function(e,t){var i,a=t.type,s=t.details,n=t.response,l=t.fatal,d=t.frag,h=t.networkDetails,u=(null==d?void 0:d.url)||t.url||"",c=h?eL(h):void 0;(s===r.ErrorDetails.MANIFEST_LOAD_ERROR||s===r.ErrorDetails.MANIFEST_LOAD_TIMEOUT||s===r.ErrorDetails.FRAG_LOAD_ERROR||s===r.ErrorDetails.FRAG_LOAD_TIMEOUT||s===r.ErrorDetails.LEVEL_LOAD_ERROR||s===r.ErrorDetails.LEVEL_LOAD_TIMEOUT||s===r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||s===r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT||s===r.ErrorDetails.SUBTITLE_LOAD_ERROR||s===r.ErrorDetails.SUBTITLE_LOAD_TIMEOUT||s===r.ErrorDetails.KEY_LOAD_ERROR||s===r.ErrorDetails.KEY_LOAD_TIMEOUT)&&o("requestfailed",{request_error:s,request_url:u,request_hostname:ec(u),request_id:c?ek(c):void 0,request_type:s===r.ErrorDetails.FRAG_LOAD_ERROR||s===r.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":s===r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||s===r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":s===r.ErrorDetails.SUBTITLE_LOAD_ERROR||s===r.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":s===r.ErrorDetails.KEY_LOAD_ERROR||s===r.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:null==n?void 0:n.code,request_error_text:null==n?void 0:n.text}),l&&o("error",{player_error_code:a,player_error_message:s,player_error_context:"".concat(u?"url: ".concat(u,"\n"):"")+"".concat(n&&(n.code||n.text)?"response: ".concat(n.code,", ").concat(n.text,"\n"):"")+"".concat(t.reason?"failure reason: ".concat(t.reason,"\n"):"")+"".concat(t.level?"level: ".concat(t.level,"\n"):"")+"".concat(t.parent?"parent stream controller: ".concat(t.parent,"\n"):"")+"".concat(t.buffer?"buffer length: ".concat(t.buffer,"\n"):"")+"".concat(t.error?"error: ".concat(t.error,"\n"):"")+"".concat(t.event?"event: ".concat(t.event,"\n"):"")+"".concat(t.err?"error message: ".concat(null==(i=t.err)?void 0:i.message,"\n"):"")})};i.on(r.Events.ERROR,m);var p=function(e,t){var i=t.frag,r=i&&i._url||"";o("requestcanceled",{request_event_type:e,request_url:r,request_type:"media",request_hostname:ec(r)})};i.on(r.Events.FRAG_LOAD_EMERGENCY_ABORTED,p);var f=function(e,t){var r=t.level,s=i.levels[r];if(s&&s.attrs&&s.attrs.BANDWIDTH){var n,l=s.attrs.BANDWIDTH,d=parseFloat(s.attrs["FRAME-RATE"]);isNaN(d)||(n=d),l?o("renditionchange",{video_source_fps:n,video_source_bitrate:l,video_source_width:s.width,video_source_height:s.height,video_source_rendition_name:s.name,video_source_codec:null==s?void 0:s.videoCodec}):a.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};i.on(r.Events.LEVEL_SWITCHED,f),i._stopMuxMonitor=function(){i.off(r.Events.MANIFEST_LOADED,l),i.off(r.Events.LEVEL_LOADED,d),i.off(r.Events.AUDIO_TRACK_LOADED,h),i.off(r.Events.FRAG_LOADED,u),i.off(r.Events.FRAG_CHANGED,c),i.off(r.Events.ERROR,m),i.off(r.Events.FRAG_LOAD_EMERGENCY_ABORTED,p),i.off(r.Events.LEVEL_SWITCHED,f),i.off(r.Events.DESTROYING,i._stopMuxMonitor),delete i._stopMuxMonitor},i.on(r.Events.DESTROYING,i._stopMuxMonitor)},eI=function(e){e&&"function"==typeof e._stopMuxMonitor&&e._stopMuxMonitor()},eC=function(e,t){if(!e||!e.requestEndDate)return{};var i,r=ec(e.url),a=e.url,s=e.bytesLoaded,n=new Date(e.requestStartDate).getTime(),o=new Date(e.firstByteDate).getTime(),l=new Date(e.requestEndDate).getTime(),d=isNaN(e.duration)?0:e.duration,h="function"==typeof t.getMetricsFor?t.getMetricsFor(e.mediaType).HttpList:t.getDashMetrics().getHttpRequests(e.mediaType);h.length>0&&(i=e_(h[h.length-1]._responseHeaders||""));var u=i?ek(i):void 0;return{requestStart:n,requestResponseStart:o,requestResponseEnd:l,requestBytesLoaded:s,requestResponseHeaders:i,requestMediaDuration:d,requestHostname:r,requestUrl:a,requestId:u}},eD=function(e,t){var i=t.getQualityFor(e),r=t.getCurrentTrackFor(e).bitrateList;return r?{currentLevel:i,renditionWidth:r[i].width||null,renditionHeight:r[i].height||null,renditionBitrate:r[i].bandwidth}:{}},ex=function(e){var t;return null==(t=e.match(/.*codecs\*?="(.*)"/))?void 0:t[1]},eM=function(e){try{var t,i;return null==(i=e.getVersion)||null==(t=i.call(e))?void 0:t.split(".").map(function(e){return parseInt(e)})[0]}catch(e){return!1}},eO=function(e,t,i){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=e.log;if(!i||!i.on)return void r.warn("Invalid dash.js player reference. Monitoring blocked.");var a=eM(i),s=function(i,r){return e.emit(t,i,r)},n=function(e){var t=e.type,i=(e.data||{}).url;s("requestcompleted",{request_event_type:t,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:ec(i),request_url:i})};i.on("manifestLoaded",n);var o={},l=function(e){if("function"!=typeof e.getRequests)return null;var t=e.getRequests({state:"executed"});return 0===t.length?null:t[t.length-1]},d=function(e){var t=e.type,r=e.chunk,a=e.request,n=(r||{}).mediaInfo||{},l=n.type,d=n.bitrateList,h={};
1(d=d||[]).forEach(function(e,t){h[t]={},h[t].width=e.width,h[t].height=e.height,h[t].bitrate=e.bandwidth,h[t].attrs={}}),"video"===l?o.video=h:"audio"===l?o.audio=h:o.media=h;var u=eC(a,i),c=u.requestStart,m=u.requestResponseStart,p=u.requestResponseEnd,f=u.requestResponseHeaders,g=u.requestMediaDuration,v=u.requestHostname,E=u.requestUrl;s("requestcompleted",{request_event_type:t,request_start:c,request_response_start:m,request_response_end:p,request_bytes_loaded:-1,request_type:l+"_init",request_response_headers:f,request_hostname:v,request_id:u.requestId,request_url:E,request_media_duration:g,request_rendition_lists:o})};a>=4?i.on("initFragmentLoaded",d):i.on("initFragmentLoaded",function(e){var t=e.type,i=e.fragmentModel,r=e.chunk;d({type:t,request:l(i),chunk:r})});var h=function(e){var t=e.type,r=e.chunk,a=e.request,n=r||{},o=n.mediaInfo,l=n.start,d=(o||{}).type,h=eC(a,i),u=h.requestStart,c=h.requestResponseStart,m=h.requestResponseEnd,p=h.requestBytesLoaded,f=h.requestResponseHeaders,g=h.requestMediaDuration,v=h.requestHostname,E=h.requestUrl,b=h.requestId,y=eD(d,i),T=y.currentLevel,A=y.renditionWidth,_=y.renditionHeight;s("requestcompleted",{request_event_type:t,request_start:u,request_response_start:c,request_response_end:m,request_bytes_loaded:p,request_type:d,request_response_headers:f,request_hostname:v,request_id:b,request_url:E,request_media_start_time:l,request_media_duration:g,request_current_level:T,request_labeled_bitrate:y.renditionBitrate,request_video_width:A,request_video_height:_})};a>=4?i.on("mediaFragmentLoaded",h):i.on("mediaFragmentLoaded",function(e){var t=e.type,i=e.fragmentModel,r=e.chunk;h({type:t,request:l(i),chunk:r})});var u={video:void 0,audio:void 0,totalBitrate:void 0},c=function(){if(u.video&&"number"==typeof u.video.bitrate){if(!(u.video.width&&u.video.height))return void r.warn("have bitrate info for video but missing width/height");var e=u.video.bitrate;if(u.audio&&"number"==typeof u.audio.bitrate&&(e+=u.audio.bitrate),e!==u.totalBitrate)return u.totalBitrate=e,{video_source_bitrate:e,video_source_height:u.video.height,video_source_width:u.video.width,video_source_codec:ex(u.video.codec)}}},m=function(e,t,a){if("number"!=typeof e.newQuality)return void r.warn("missing evt.newQuality in qualityChangeRendered event",e);var n=e.mediaType;if("audio"===n||"video"===n){var o=i.getBitrateInfoListFor(n).find(function(t){return t.qualityIndex===e.newQuality});if(!(o&&"number"==typeof o.bitrate))return void r.warn("missing bitrate info for ".concat(n));u[n]=ey(eb({}
1,o),{codec:i.getCurrentTrackFor(n).codec});var l=c();l&&s("renditionchange",l)}};i.on("qualityChangeRendered",m);var p=function(e){var t=e.request,i=e.mediaType;s("requestcanceled",{request_event_type:(t=t||{}).type+"_"+t.action,request_url:t.url,request_type:i,request_hostname:ec(t.url)})};i.on("fragmentLoadingAbandoned",p);var f=function(e){var t,i,r=e.error,a=(null==r||null==(t=r.data)?void 0:t.request)||{},n=(null==r||null==(i=r.data)?void 0:i.response)||{};(null==r?void 0:r.code)===27&&s("requestfailed",{request_error:a.type+"_"+a.action,request_url:a.url,request_hostname:ec(a.url),request_type:a.mediaType,request_error_code:n.status,request_error_text:n.statusText});var o="".concat(null!=a&&a.url?"url: ".concat(a.url,"\n"):"")+"".concat(null!=n&&n.status||null!=n&&n.statusText?"response: ".concat(null==n?void 0:n.status,", ").concat(null==n?void 0:n.statusText,"\n"):"");s("error",{player_error_code:null==r?void 0:r.code,player_error_message:null==r?void 0:r.message,player_error_context:o})};i.on("error",f),i._stopMuxMonitor=function(){i.off("manifestLoaded",n),i.off("initFragmentLoaded",d),i.off("mediaFragmentLoaded",h),i.off("qualityChangeRendered",m),i.off("error",f),i.off("fragmentLoadingAbandoned",p),delete i._stopMuxMonitor}},eP=function(e){e&&"function"==typeof e._stopMuxMonitor&&e._stopMuxMonitor()},eN=0,eU=function(){function e(){en(this,e),ed(this,"_listeners",void 0)}return el(e,[{key:"on",value:function(e,t,i){return t._eventEmitterGuid=t._eventEmitterGuid||++eN,this._listeners=this._listeners||{},this._listeners[e]=this._listeners[e]||[],i&&(t=t.bind(i)),this._listeners[e].push(t),t}},{key:"off",value:function(e,t){var i=this._listeners&&this._listeners[e];i&&i.forEach(function(e,r){e._eventEmitterGuid===t._eventEmitterGuid&&i.splice(r,1)})}},{key:"one",value:function(e,t,i){var r=this;t._eventEmitterGuid=t._eventEmitterGuid||++eN;var a=function(){r.off(e,a),t.apply(i||this,arguments)};a._eventEmitterGuid=t._eventEmitterGuid,this.on(e,a)}},{key:"emit",value:function(e,t){var i=this;if(this._listeners){t=t||{};var r=this._listeners["before*"]||[],a=this._listeners[e]||[],s=this._listeners["after"+e]||[],n=function(t,r){(t=t.slice()).forEach(function(t){t.call(i,{type:e},r)})};n(r,t),n(a,t),n(s,t)}}}]),e}(),eF=_(k()),eB=function(){function e(t){var i=this;en(this,e),ed(this,"_playbackHeartbeatInterval",void 0),ed(this,"_playheadShouldBeProgressing",void 0),ed(this,"pm",void 0),this.pm=t,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,t.on("playing",function(){i._playheadShouldBeProgressing=!0}),t.on("play",this._startPlaybackHeartbeatInterval.bind(this)),t.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),t.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),t.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),t.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),t.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),t.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),t.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),t.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("seeked",function(){t.data.player_is_paused?i._stopPlaybackHeartbeatInterval():i._startPlaybackHeartbeatInterval()}),t.on("timeupdate",function(){null!==i._playbackHeartbeatInterval&&t.emit("playbackheartbeat")}),t.on("devicesleep",function(e,r){null!==i._playbackHeartbeatInterval&&(eF.default.clearInterval(i._playbackHeartbeatInterval),t.emit("playbackheartbeatend",{viewer_time:r.viewer_time}),i._playbackHeartbeatInterval=null)})}return el(e,[{key:"_startPlaybackHeartbeatInterval",value:function(){var e=this;null===this._playbackHeartbeatInterval&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=eF.default.setInterval(function(){e.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,null!==this._playbackHeartbeatInterval&&(eF.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),e}(),e$=function e(t){var i=this;en(this,e),ed(this,"viewErrored",void 0),t.on("viewinit",function(){i.viewErrored=!1}),t.on("error",function(e,r){try{var a=t.errorTranslator({player_error_code:r.player_error_code,player_error_message:r.player_error_message,player_error_context:r.player_error_context,player_error_severity:r.player_error_severity,player_error_business_exception:r.player_error_business_exception});a&&(t.data.player_error_code=a.player_error_code||r.player_error_code,t.data.player_error_message=a.player_error_message||r.player_error_message,t.data.player_error_context=a.player_error_context||r.player_error_context,t.data.player_error_severity=a.player_error_severity||r.player_error_severity,t.data.player_error_business_exception=a.player_error_business_exception||r.player_error_business_exception,i.viewErrored=!0)}catch(e){t.mux.log.warn("Exception in error translator callback.",e),i.viewErrored=!0}}),t.on("aftererror",function(){var e,i,r,a,s;null==(e=t.data)||delete e.player_error_code,null==(i=t.data)||delete i.player_error_message,null==(r=t.data)||delete r.player_error_context,null==(a=t.data)||delete a.player_error_severity,null==(s=t.data)||delete s.player_error_business_exception})},eH=function(){function e(t){en(this,e),ed(this,"_watchTimeTrackerLastCheckedTime",void 0),ed(this,"pm",void 0),this.pm=t,this._watchTimeTrackerLastCheckedTime=null,t.on("playbackheartbeat",this._updateWatchTime.bind(this)),t.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}return el(e,[{key:"_updateWatchTime",value:function(e,t){var i=t.viewer_time;null===this._watchTimeTrackerLastCheckedTime&&(this._watchTimeTrackerLastCheckedTime=i),eE(this.pm.data,"view_watch_time",i-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=i}},{key:"_clearWatchTimeState",value:function(e,t){this._updateWatchTime(e,t),this._watchTimeTrackerLastCheckedTime=null}}]),e}(),eW=function(){function e(t){var i=this;en(this,e),ed(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),ed(this,"_lastTime",void 0),ed(this,"_isAdPlaying",void 0),ed(this,"_callbackUpdatePlaybackTime",void 0),ed(this,"pm",void 0),this.pm=t,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=ea(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null;var r=this._startPlaybackTimeTracking.bind(this);t.on("playing",r),t.on("adplaying",r),t.on("seeked",r);var a=this._stopPlaybackTimeTracking.bind(this);t.on("playbackheartbeatend",a),t.on("seeking",a),t.on("adplaying",function(){i._isAdPlaying=!0}),t.on("adended",function(){i._isAdPlaying=!1}),t.on("adpause",function(){i._isAdPlaying=!1}),t.on("adbreakstart",function(){i._isAdPlaying=!1}),t.on("adbreakend",function(){i._isAdPlaying=!1}),t.on("adplay",function(){i._isAdPlaying=!1}),t.on("viewinit",function(){i._playbackTimeTrackerLastPlayheadPosition=-1,i._lastTime=ea(),i._isAdPlaying=!1,i._callbackUpdatePlaybackTime=null})}return el(e,[{key:"_startPlaybackTimeTracking",value:function(){null===this._callbackUpdatePlaybackTime&&(this._callbackUpdatePlaybackTime=this._updatePlaybackTime.bind(this),this._playbackTimeTrackerLastPlayheadPosition=this.pm.data.player_playhead_time,this.pm.on("playbackheartbeat",this._callbackUpdatePlaybackTime))}},{key:"_stopPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime&&(this._updatePlaybackTime(),this.pm.off("playbackheartbeat",this._callbackUpdatePlaybackTime),this._callbackUpdatePlaybackTime=null,this._playbackTimeTrackerLastPlayheadPosition=-1)}},{key:"_updatePlaybackTime",value:function(){var e=this.pm.data.player_playhead_time,t=ea(),i=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&e>this._playbackTimeTrackerLastPlayheadPosition?i=e-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(i=t-this._lastTime),i>0&&i<=1e3&&eE(this.pm.data,"view_content_playback_time",i),this._playbackTimeTrackerLastPlayheadPosition=e,this._lastTime=t}}]),e}(),eG=function(){function e(t){en(this,e),ed(this,"pm",void 0),this.pm=t;var i=this._updatePlayheadTime.bind(this);t.on("playbackheartbeat",i),t.on("playbackheartbeatend",i),t.on("timeupdate",i),t.on("destroy",function(){t.off("timeupdate",i)})}return el(e,[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=void 0===this.pm.data.view_max_playhead_position?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(e,t){var i=this,r=function(){i.pm.currentFragmentPDT&&i.pm.currentFragmentStart&&(i.pm.data.player_program_time=i.pm.currentFragmentPDT+i.pm.data.player_playhead_time-i.pm.currentFragmentStart)};if(t&&t.player_playhead_time)this.pm.data.player_playhead_time=t.player_playhead_time,r(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var a=this.pm.getPlayheadTime();void 0!==a&&(this.pm.data.player_playhead_time=a,r(),this._updateMaxPlayheadPosition())}}}]),e}(),eV=function e(t){if(en(this,e),!t.disableRebufferTracking){var i,r=function(e,t){a(t),i=void 0},a=function(e){if(i){var r=e.viewer_time-i;eE(t.data,"view_rebuffer_duration",r),i=e.viewer_time,t.data.view_rebuffer_duration>3e5&&(t.emit("viewend"),t.send("viewend"),t.mux.log.warn("Ending view after rebuffering for longer than ".concat(3e5,"ms, future events will be ignored unless a programchange or videochange occurs.")))}t.data.view_watch_time>=0&&t.data.view_rebuffer_count>0&&(t.data.view_rebuffer_frequency=t.data.view_rebuffer_count/t.data.view_watch_time,t.data.view_rebuffer_percentage=t.data.view_rebuffer_duration/t.data.view_watch_time)};t.on("playbackheartbeat",function(e,t){return a(t)}),t.on("rebufferstart",function(e,a){i||(eE(t.data,"view_rebuffer_count",1),i=a.viewer_time,t.one("rebufferend",r))}),t.on("viewinit",function(){i=void 0,t.off("rebufferend",r)})}},eK=function(){function e(t){var i=this;en(this,e),ed(this,"_lastCheckedTime",void 0),ed(this,"_lastPlayheadTime",void 0),ed(this,"_lastPlayheadTimeUpdatedTime",void 0),ed(this,"_rebuffering",void 0),ed(this,"pm",void 0),this.pm=t,t.disableRebufferTracking||t.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,t.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),t.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),t.on("seeking",function(){i._cleanupRebufferTracker(null,{viewer_time:ea()})}))}return el(e,[{key:"_checkIfRebuffering",value:function(e,t){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)return void this._cleanupRebufferTracker(e,t);if(null===this._lastCheckedTime)return void this._prepareRebufferTrackerState(t.viewer_time);if(this._lastPlayheadTime!==this.pm.data.player_playhead_time)return void this._cleanupRebufferTracker(e,t,!0);var i=t.viewer_time-this._lastPlayheadTimeUpdatedTime;"number"==typeof this.pm.sustainedRebufferThreshold&&i>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=t.viewer_time}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(e){this._lastCheckedTime=e,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=e}},{key:"_cleanupRebufferTracker",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:t.viewer_time});else{if(null===this._lastCheckedTime)return;var r=this.pm.data.player_playhead_time-this._lastPlayheadTime,a=t.viewer_time-this._lastPlayheadTimeUpdatedTime;"number"==typeof this.pm.minimumRebufferDuration&&r>0&&a-r>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+a-r}))}i?this._prepareRebufferTrackerState(t.viewer_time):this._clearRebufferTrackerState()}}]),e}(),eq=function(){function e(t){var i=this;en(this,e),ed(this,"NAVIGATION_START",void 0),ed(this,"pm",void 0),this.pm=t,t.on("viewinit",function(){var e=t.data,r=e.view_id;if(!e.view_program_changed){var a=function(e,a){var s=a.viewer_time;"playing"===e.type&&void 0===t.data.view_time_to_first_frame?i.calculateTimeToFirstFrame(s||ea(),r):"adplaying"===e.type&&(void 0===t.data.view_time_to_first_frame||i._inPrerollPosition())&&i.calculateTimeToFirstFrame(s||ea(),r)};t.one("playing",a),t.one("adplaying",a),t.one("viewend",function(){t.off("playing",a),t.off("adplaying",a)})}})}return el(e,[{key:"_inPrerollPosition",value:function(){return void 0===this.pm.data.view_content_playback_time||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(e,t){t===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:e}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.NAVIGATION_START&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.NAVIGATION_START))}}]),e}(),ej=function e(t){var i=this;en(this,e),ed(this,"_lastPlayerHeight",void 0),ed(this,"_lastPlayerWidth",void 0),ed(this,"_lastPlayheadPosition",void 0),ed(this,"_lastSourceHeight",void 0),ed(this,"_lastSourceWidth",void 0),t.on("viewinit",function(){i._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(e){t.on(e,function(){if(i._lastPlayheadPosition>=0&&t.data.player_playhead_time>=0&&i._lastPlayerWidth>=0&&i._lastSourceWidth>0&&i._lastPlayerHeight>=0&&i._lastSourceHeight>0){var e=t.data.player_playhead_time-i._lastPlayheadPosition;if(e<0){i._lastPlayheadPosition=-1;return}var r=Math.min(i._lastPlayerWidth/i._lastSourceWidth,i._lastPlayerHeight/i._lastSourceHeight),a=Math.max(0,r-1),s=Math.max(0,1-r);t.data.view_max_upscale_percentage=Math.max(t.data.view_max_upscale_percentage||0,a),t.data.view_max_downscale_percentage=Math.max(t.data.view_max_downscale_percentage||0,s),eE(t.data,"view_total_content_playback_time",e),eE(t.data,"view_total_upscaling",a*e),eE(t.data,"view_total_downscaling",s*e)}i._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(e){t.on(e,function(){i._lastPlayheadPosition=t.data.player_playhead_time,i._lastPlayerWidth=t.data.player_width,i._lastPlayerHeight=t.data.player_height,i._lastSourceWidth=t.data.video_source_width,i._lastSourceHeight=t.data.video_source_height})})},eY=function e(t){var i=this;en(this,e),ed(this,"isSeeking",void 0),this.isSeeking=!1;var r=-1,a=function(){var e=ea(),a=(t.data.viewer_time||e)-(r||e);eE(t.data,"view_seek_duration",a),t.data.view_max_seek_time=Math.max(t.data.view_max_seek_time||0,a),i.isSeeking=!1,r=-1};t.on("seeking",function(e,s){if(Object.assign(t.data,s),i.isSeeking&&s.viewer_time-r<=2e3){r=s.viewer_time;return}i.isSeeking&&a(),i.isSeeking=!0,r=s.viewer_time,eE(t.data,"view_seek_count",1),t.send("seeking")}),t.on("seeked",function(){a()}),t.on("viewend",function(){i.isSeeking&&(a(),t.send("seeked")),i.isSeeking=!1,r=-1})},ez=function(e,t){e.push(t),e.sort(function(e,t){return e.viewer_time-t.viewer_time})},eX=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],eQ=function(){function e(t){var i=this;en(this,e),ed(this,"_adHasPlayed",void 0),ed(this,"_adRequests",void 0),ed(this,"_adResponses",void 0),ed(this,"_curre
1ntAdRequestNumber",void 0),ed(this,"_currentAdResponseNumber",void 0),ed(this,"_prerollPlayTime",void 0),ed(this,"_wouldBeNewAdPlay",void 0),ed(this,"isAdBreak",void 0),ed(this,"pm",void 0),this.pm=t,t.on("viewinit",function(){i.isAdBreak=!1,i._currentAdRequestNumber=0,i._currentAdResponseNumber=0,i._adRequests=[],i._adResponses=[],i._adHasPlayed=!1,i._wouldBeNewAdPlay=!0,i._prerollPlayTime=void 0}),eX.forEach(function(e){return t.on(e,i._updateAdData.bind(i))});var r=function(){i.isAdBreak=!1};t.on("adbreakstart",function(){i.isAdBreak=!0}),t.on("play",r),t.on("playing",r),t.on("viewend",r),t.on("adrequest",function(e,r){r=Object.assign({ad_request_id:"generatedAdRequestId"+i._currentAdRequestNumber++},r),ez(i._adRequests,r),eE(t.data,"view_ad_request_count"),i.inPrerollPosition()&&(t.data.view_preroll_requested=!0,i._adHasPlayed||eE(t.data,"view_preroll_request_count"))}),t.on("adresponse",function(e,r){r=Object.assign({ad_request_id:"generatedAdRequestId"+i._currentAdResponseNumber++},r),ez(i._adResponses,r);var a=i.findAdRequest(r.ad_request_id);a&&eE(t.data,"view_ad_request_time",Math.max(0,r.viewer_time-a.viewer_time))}),t.on("adplay",function(e,r){i._adHasPlayed=!0,i._wouldBeNewAdPlay&&(i._wouldBeNewAdPlay=!1,eE(t.data,"view_ad_played_count")),i.inPrerollPosition()&&!t.data.view_preroll_played&&(t.data.view_preroll_played=!0,i._adRequests.length>0&&(t.data.view_preroll_request_time=Math.max(0,r.viewer_time-i._adRequests[0].viewer_time)),t.data.view_start&&(t.data.view_startup_preroll_request_time=Math.max(0,r.viewer_time-t.data.view_start)),i._prerollPlayTime=r.viewer_time)}),t.on("adplaying",function(e,r){i.inPrerollPosition()&&void 0===t.data.view_preroll_load_time&&void 0!==i._prerollPlayTime&&(t.data.view_preroll_load_time=r.viewer_time-i._prerollPlayTime,t.data.view_startup_preroll_load_time=r.viewer_time-i._prerollPlayTime)}),t.on("adclicked",function(e,r){i._wouldBeNewAdPlay||eE(t.data,"view_ad_clicked_count")}),t.on("adskipped",function(e,r){i._wouldBeNewAdPlay||eE(t.data,"view_ad_skipped_count")}),t.on("adended",function(){i._wouldBeNewAdPlay=!0}),t.on("aderror",function(){i._wouldBeNewAdPlay=!0})}return el(e,[{key:"inPrerollPosition",value:function(){return void 0===this.pm.data.view_content_playback_time||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",value:function(e){for(var t=0;t<this._adRequests.length;t++)if(this._adRequests[t].ad_request_id===e)return this._adRequests[t]}},{key:"_updateAdData",value:function(e,t){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&t.ad_tag_url){var i=q(em(t.ad_tag_url),2),r=i[0],a=i[1];this.pm.data.view_preroll_ad_tag_domain=a,this.pm.data.view_preroll_ad_tag_hostname=r}if(!this.pm.data.view_preroll_ad_asset_hostname&&t.ad_asset_url){var s=q(em(t.ad_asset_url),2),n=s[0],o=s[1];this.pm.data.view_preroll_ad_asset_domain=o,this.pm.data.view_preroll_ad_asset_hostname=n}}this.pm.data.ad_asset_url=null==t?void 0:t.ad_asset_url,this.pm.data.ad_tag_url=null==t?void 0:t.ad_tag_url,this.pm.data.ad_creative_id=null==t?void 0:t.ad_creative_id,this.pm.data.ad_id=null==t?void 0:t.ad_id,this.pm.data.ad_universal_id=null==t?void 0:t.ad_universal_id}}]),e}(),eZ=_(k()),eJ=function e(t){en(this,e);var i,r,a=function(){t.disableRebufferTracking||(eE(t.data,"view_waiting_rebuffer_count",1),i=ea(),r=eZ.default.setInterval(function(){if(i){var e=ea();eE(t.data,"view_waiting_rebuffer_duration",e-i),i=e}},250))},s=function(){t.disableRebufferTracking||i&&(eE(t.data,"view_waiting_rebuffer_duration",ea()-i),i=!1,eZ.default.clearInterval(r))},n=!1,o=function(){n=!0},l=function(){n=!1,s()};t.on("waiting",function(){n&&a()}),t.on("playing",function(){s(),o()}),t.on("pause",l),t.on("seeking",l)},e0=function e(t){var i=this;en(this,e),ed(this,"lastWallClockTime",void 0);var r=function(){i.lastWallClockTime=ea(),t.on("before*",a)},a=function(e){var r=ea(),a=i.lastWallClockTime;i.lastWallClockTime=r,r-a>3e4&&(t.emit("devicesleep",{viewer_time:a}),Object.assign(t.data,{viewer_time:a}),t.send("devicesleep"),t.emit("devicewake",{viewer_time:r}),Object.assign(t.data,{viewer_time:r}),t.send("devicewake"))};t.one("playbackheartbeat",r),t.on("playbackheartbeatend",function(){t.off("before*",a),t.one("playbackheartbeat",r)})},e1=_(k()),e2=_(C()),e3=_(D()),e4="muxData",e5=function(){var e;try{e=e2.default.parse(e3.default.get(e4)||"")}catch(t){e={}}return e},e8=function(e){try{e3.default.set(e4,e2.default.stringify(e),{expires:365})}catch(e){}},e9=function(){var e=e5();return e.mux_viewer_id=e.mux_viewer_id||Y(),e.msn=e.msn||Math.random(),e8(e),{mux_viewer_id:e.mux_viewer_id,mux_sample_number:e.msn}},e6=function(){var e=e5(),t=ea();return e.session_start&&(e.sst=e.session_start,delete e.session_start),e.session_id&&(e.sid=e.session_id,delete e.session_id),e.session_expires&&(e.sex=e.session_expires,delete e.session_expires),(!e.sex||e.sex<t)&&(e.sid=Y(),e.sst=t),e.sex=t+15e5,e8(e),{session_id:e.sid,session_start:e.sst,session_expires:e.sex}},e7=_(k()),te=function(){var e;switch(tt()){case"cellular":e="cellular";break;case"ethernet":e="wired";break;case"wifi":e="wifi";break;case void 0:break;default:e="other"}return e},tt=function(){var e=e7.default.navigator,t=e&&(e.connection||e.mozConnection||e.webkitConnection);return t&&t.type};te.getConnectionFromAPI=tt;var ti=ta({a:"env",b:"beacon",c:"custom",d:"ad",e:"event",f:"experiment",i:"internal",m:"mux",n:"response",p:"player",q:"request",r:"retry",s:"session",t:"timestamp",u:"viewer",v:"video",w:"page",x:"view",y:"sub"}),tr=ta({ad:"ad",ag:"aggregate",ap:"api",al:"application",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",br:"break",bw:"browser",by:"bytes",bz:"business",ca:"cached",cb:"cancel",cc:"codec",cd:"code",cg:"category",ch:"changed",ck:"clicked",cl:"canceled",cn:"config",co:"count",ce:"counter",cp:"complete",cr:"creative",ct:"content",cu:"current",cx:"c
1onnection",cz:"context",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",dr:"drm",dp:"dropped",du:"duration",dv:"device",ec:"encoding",ed:"edge",en:"end",eg:"engine",em:"embed",er:"error",ep:"experiments",es:"errorcode",et:"errortext",ee:"event",ev:"events",ex:"expires",ez:"exception",fa:"failed",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",ha:"has",hb:"holdback",he:"headers",ho:"host",hn:"hostname",ht:"height",id:"id",ii:"init",in:"instance",ip:"ip",is:"is",ke:"key",la:"language",lb:"labeled",le:"level",li:"live",ld:"loaded",lo:"load",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pr:"preload",ps:"position",pt:"part",py:"property",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",sd:"skipped",se:"session",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",st:"start",su:"startup",sv:"server",sw:"software",sy:"severity",ta:"tag",tc:"tech",te:"text",tg:"target",th:"throughput",ti:"time",tl:"total",to:"to",tt:"title",ty:"type",ug:"upscaling",un:"universal",up:"upscale",ur:"url",us:"user",va:"variant",vd:"viewed",vi:"video",ve:"version",vw:"view",vr:"viewer",wd:"width",wa:"watch",wt:"waiting"});function ta(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=i);return t}function ts(e){var t={},i={};return Object.keys(e).forEach(function(r){var a=!1;if(e.hasOwnProperty(r)&&void 0!==e[r]){var s=r.split("_"),n=s[0],o=ti[n];o||(ee.info("Data key word `"+s[0]+"` not expected in "+r),o=n+"_"),s.splice(1).forEach(function(e){"url"===e&&(a=!0),tr[e]?o+=tr[e]:Number(e)&&Math.floor(Number(e))===Number(e)?o+=e:(ee.info("Data key word `"+e+"` not expected in "+r),o+="_"+e+"_")}),a?i[o]=e[r]:t[o]=e[r]}}),Object.assign(t,i)}var tn=_(k()),to={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},tl=["hb","requestcompleted","requestfailed","requestcanceled"],td=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._beaconUrl=e||"https://img.litix.io",this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},to,t)};td.prototype.queueEvent=function(e,t){var i=Object.assign({},t);return(this._eventQueue.length<=this._options.maxQueueLength||"eventrateexceeded"===e)&&(this._eventQueue.push(i),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},td.prototype.flushEvents=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&1===this._eventQueue.length?this._eventQueue.pop():(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},td.prototype.destroy=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.destroyed=!0,e?this._clearBeaconQueue():this.flushEvents(),tn.default.clearTimeout(this._sendTimeout)},td.prototype._clearBeaconQueue=function(){var e=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,t=this._eventQueue.slice(e);e>0&&Object.assign(t[t.length-1],ts({mux_view_message:"event queue truncated"}));var i=this._createPayload(t);th(this._beaconUrl,i,!0,function(){})},td.prototype._sendBeaconQueue=function(){var e=this;if(!this._postInFlight){var t=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var i=this._createPayload(t),r=ea();th(this._beaconUrl,i,!1,function(i,a){a?(e._eventQueue=t.concat(e._eventQueue),e._failureCount+=1,ee.info("Error sending beacon: "+a)):e._failureCount=0,e._roundTripTime=ea()-r,e._postInFlight=!1})}},td.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var e=Math.pow(2,this._failureCount-1);return(1+(e*=Math.random()))*this._options.baseTimeBetweenBeacons},td.prototype._startBeaconSending=function(){var e=this;tn.default.clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=tn.default.setTimeout(function(){e._eventQueue.length&&e._sendBeaconQueue(),e._startBeaconSending()},this._getNextBeaconTime()))},td.prototype._createPayload=function(e){var t=this,i={transmission_timestamp:Math.round(ea())};this._roundTripTime&&(i.rtt_ms=Math.round(this._roundTripTime));var r,a,s,n=function(){s=(r=JSON.stringify({metadata:i,events:a||e})).length/1024},o=function(){return s<=t._options.maxPayloadKBSize};return n(),o()||(ee.info("Payload size is too big ("+s+" kb). Removing unnecessary events."),a=e.filter(function(e){return -1===tl.indexOf(e.e)}),n()),o()||(ee.info("Payload size still too big ("+s+" kb). Cropping fields.."),a.forEach(function(e){for(var t in e){var i=e[t];"string"==typeof i&&i.length>51200&&(e[t]=i.substring(0,51200))}}),n()),r};var th=function(e,t,i,r){if(i&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(e,t))return void r();if(tn.default.fetch)return void tn.default.fetch(e,{method:"POST",body:t,headers:{"Content-Type":"text/plain"},keepalive:t.length<=57344}).then(function(e){return r(null,e.ok?null:"Error")}).catch(function(e){return r(null,e)});if(tn.default.XMLHttpRequest){var a=new tn.default.XMLHttpRequest;a.onreadystatechange=function(){if(4===a.readyState)return r(null,200!==a.status?"error":void 0)},a.open("POST",e),a.setRequestHeader("Content-Type","text/plain"),a.send(t);return}r()},tu=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id","player_error_code","player_error_message","player_error_context","player_error_severity","player_error_business_exception"],tc=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],tm=["ad_id","ad_creative_id","ad_universal_id"],tp=["viewstart","error","ended","viewend"],tf=function(){function e(t,i){var r,a,s,n,o,l,d,h,u,c,m,p,f,g,v,E,b,y,T,A=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};en(this,e),ed(this,"mux",void 0),ed(this,"envKey",void 0),ed(this,"options",void 0),ed(this,"eventQueue",void 0),ed(this,"sampleRate",void 0),ed(this,"disableCookies",void 0),ed(this,"respectDoNotTrack",void 0),ed(this,"previousBeaconData",void 0),ed(this,"lastEventTime",void 0),ed(this,"rateLimited",void 0),ed(this,"pageLevelData",void 0),ed(this,"viewerData",void 0),this.mux=t,this.envKey=i,this.options=A,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.eventQueue=new td((r=this.envKey,s=(a=this.options).beaconCollectionDomain,n=a.beaconDomain,s?"https://"+s:(r=r||"inferred").match(/^[a-z0-9]+$/)?"https://"+r+"."+(n||"litix.io"):"https://img.litix.io/a.gif")),this.sampleRate=null!=(b=this.options.sampleRate)?b:1,this.disableCookies=null!=(y=this.options.disableCookies)&&y,this.respectDoNotTrack=null!=(T=this.options.respectDoNotTrack)&&T,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:null==(o=this.options.platform)?void 0:o.name,viewer_application_version:null==(l=this.options.platform)?void 0:l.version,viewer_application_engine:null==(d=this.options.platform)?void 0:d.layout,viewer_device_name:null==(h=this.options.platform)?void 0:h.product,viewer_device_category:"",viewer_device_manufacturer:null==(u=this.options.platform)?void 0:u.manufacturer,viewer_os_family:null==(m=this.options.platform)||null==(c=m.os)?void 0:c.family,viewer_os_architecture:null==(f=this.options.platform)||null==(p=f.os)?void 0:p.architecture,viewer_os_version:null==(v=this.options.platform)||null==(g=v.os)?void 0:g.version,viewer_connection_type:te(),page_url:null===e1.default||void 0===e1.default||null==(E=e1.default.location)?void 0:E.href},this.viewerData=this.disableCookies?{}:e9()}return el(e,[{key:"send",value:function(e,t){if(!(!e||!(null!=t&&t.view_id))){if(this.respectDoNotTrack&&ei())return ee.info("Not sending `"+e+"` because Do Not Track is enabled");if(!t||"object"!=typeof t)return ee.error("A data object was expected in send() but was not provided");var i=this.disableCookies?{}:e6(),r=ey(eb({},this.pageLevelData,t,i,this.viewerData),{event:e,env_key:this.envKey});r.user_id&&(r.viewer_user_id=r.user_id,delete r.user_id);var a,s=(null!=(a=r.mux_sample_number)?a:0)>=this.sampleRate,n=ts(this._deduplicateBeaconData(e,r));if(this.lastEventTime=this.mux.utils.now(),s)return ee.info("Not sending event due to sample rate restriction",e,r,n);
1if(this.envKey||ee.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",e,r,n),!this.rateLimited){if(ee.info("Sending event",e,r,n),this.rateLimited=!this.eventQueue.queueEvent(e,n),this.mux.WINDOW_UNLOADING&&"viewend"===e)this.eventQueue.destroy(!0);else if(this.mux.WINDOW_HIDDEN&&"hb"===e?this.eventQueue.flushEvents(!0):tp.indexOf(e)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return r.event="eventrateexceeded",n=ts(r),this.eventQueue.queueEvent(r.event,n),ee.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(e,t){var i=this,r={},a=t.view_id;if("-1"===a||"viewstart"===e||"viewend"===e||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)r=eb({},t),a&&(this.previousBeaconData=r),a&&"viewend"===e&&(this.previousBeaconData=null);else{var s=0===e.indexOf("request");Object.entries(t).forEach(function(t){var a=q(t,2),n=a[0],o=a[1];i.previousBeaconData&&(o!==i.previousBeaconData[n]||tu.indexOf(n)>-1||i.objectHasChanged(s,n,o,i.previousBeaconData[n])||i.eventRequiresKey(e,n))&&(r[n]=o,i.previousBeaconData[n]=o)})}return r}},{key:"objectHasChanged",value:function(e,t,i,r){return!!e&&0===t.indexOf("request_")&&("request_response_headers"===t||"object"!=typeof i||"object"!=typeof r||Object.keys(i||{}).length!==Object.keys(r||{}).length)}},{key:"eventRequiresKey",value:function(e,t){return!!("renditionchange"===e&&0===t.indexOf("video_source_")||tm.includes(t)&&tc.includes(e))}}]),e}(),tg=function e(t){en(this,e);var i=0,r=0,a=0,s=0,n=0,o=0,l=0;t.on("requestcompleted",function(e,o){var l,d,h=o.request_start,u=o.request_response_start,c=o.request_response_end,m=o.request_bytes_loaded;if(s++,u?(l=u-(null!=h?h:0),d=(null!=c?c:0)-u):d=(null!=c?c:0)-(null!=h?h:0),d>0&&m&&m>0){var p=m/d*8e3;n++,r+=m,a+=d,t.data.view_min_request_throughput=Math.min(t.data.view_min_request_throughput||1/0,p),t.data.view_average_request_throughput=r/a*8e3,t.data.view_request_count=s,l>0&&(i+=l,t.data.view_max_request_latency=Math.max(t.data.view_max_request_latency||0,l),t.data.view_average_request_latency=i/n)}}),t.on("requestfailed",function(e,i){s++,o++,t.data.view_request_count=s,t.data.view_request_failed_count=o}),t.on("requestcanceled",function(e,i){s++,l++,t.data.view_request_count=s,t.data.view_request_canceled_count=l})},tv=function e(t){var i=this;en(this,e),ed(this,"_lastEventTime",void 0),t.on("before*",function(e,r){var a=r.viewer_time,s=ea(),n=i._lastEventTime;if(i._lastEventTime=s,n&&s-n>36e5){var o=Object.keys(t.data).reduce(function(e,i){return 0===i.indexOf("video_")?Object.assign(e,ed({},i,t.data[i])):e},{});t.mux.log.info("Received event after at least an hour inactivity, creating a new view"),t.emit("viewinit",Object.assign({viewer_time:a},o)),t.playbackHeartbeat._playheadShouldBeProgressing&&"play"!==e.type&&"adbreakstart"!==e.type&&(t.emit("play",{viewer_time:a}),"playing"!==e.type&&t.emit("playing",{viewer_time:a}))}})},tE=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange"],tb=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&eh(r,e);var t,i=(t=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,i=eu(r);return e=t?Reflect.construct(i,arguments,eu(this).constructor):i.apply(this,arguments),e&&("object"===S(e)||"function"==typeof e)?e:es(this)});function r(e,t,a){en(this,r),ed(es(s=i.call(this)),"DOM_CONTENT_LOADED_EVENT_END",void 0),ed(es(s),"NAVIGATION_START",void 0),ed(es(s),"_destroyed",void 0),ed(es(s),"_heartBeatTimeout",void 0),ed(es(s),"adTracker",void 0),ed(es(s),"dashjs",void 0),ed(es(s),"data",void 0),ed(es(s),"disablePlayheadRebufferTracking",void 0),ed(es(s),"disableRebufferTracking",void 0),ed(es(s),"errorTracker",void 0),ed(es(s),"errorTranslator",void 0),ed(es(s),"getAdData",void 0),ed(es(s),"getPlayheadTime",void 0),ed(es(s),"getStateData",void 0),ed(es(s),"hlsjs",void 0),ed(es(s),"id",void 0),ed(es(s),"longResumeTracker",void 0),ed(es(s),"minimumRebufferDuration",void 0),ed(es(s),"mux",void 0),ed(es(s),"oldEmit",void 0),ed(es(s),"playbackEventDispatcher",void 0),ed(es(s),"playbackHeartbeat",void 0),ed(es(s),"playbackHeartbeatTime",void 0),ed(es(s),"playheadTime",void 0),ed(es(s),"seekingTracker",void 0),ed(es(s),"sustainedRebufferThreshold",void 0),ed(es(s),"watchTimeTracker",void 0),ed(es(s),"currentFragmentPDT",void 0),ed(es(s),"currentFragmentStart",void 0),s.DOM_CONTENT_LOADED_EVENT_END=eg(),s.NAVIGATION_START=ev(),s.mux=e,s.id=t,null!=a&&a.beaconDomain&&s.mux.log.warn("The `beaconDomain` setting has been deprecated
1in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."),(a=Object.assign({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(e){return e}},a)).data=a.data||{},a.data.property_key&&(a.data.env_key=a.data.property_key,delete a.data.property_key),ee.setLevel(a.debug?"debug":"warn"),s.getPlayheadTime=a.getPlayheadTime,s.getStateData=a.getStateData||function(){return{}},s.getAdData=a.getAdData||function(){},s.minimumRebufferDuration=a.minimumRebufferDuration,s.sustainedRebufferThreshold=a.sustainedRebufferThreshold,s.playbackHeartbeatTime=a.playbackHeartbeatTime,s.disableRebufferTracking=a.disableRebufferTracking,s.disableRebufferTracking&&s.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),s.disablePlayheadRebufferTracking=a.disablePlayheadRebufferTracking,s.errorTranslator=a.errorTranslator,s.playbackEventDispatcher=new tf(e,a.data.env_key,a),s.data={player_instance_id:Y(),mux_sample_rate:a.sampleRate,beacon_domain:a.beaconCollectionDomain||a.beaconDomain},s.data.view_sequence_number=1,s.data.player_sequence_number=1,s.oldEmit=s.emit,s.emit=function(e,t){t=Object.assign({viewer_time:this.mux.utils.now()},t),this.oldEmit(e,t)};var s,n=(function(){void 0===this.data.view_start&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}).bind(es(s));s.on("viewinit",function(e,t){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,t),this._initializeViewData(),this.one("play",n),this.one("adbreakstart",n)});var o=(function(e){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",e)}).bind(es(s));if(s.on("videochange",function(e,t){o(t)}),s.on("programchange",function(e,t){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),o(Object.assign(t,{view_program_changed:!0})),n(),this.emit("play"),this.emit("playing")}),s.on("fragmentchange",function(e,t){this.currentFragmentPDT=t.currentFragmentPDT,this.currentFragmentStart=t.currentFragmentStart}),s.on("destroy",s.destroy),"u">typeof window&&"function"==typeof window.addEventListener&&"function"==typeof window.removeEventListener){var l=function(){var e=void 0!==s.data.view_start;s.mux.WINDOW_HIDDEN="hidden"===document.visibilityState,e&&s.mux.WINDOW_HIDDEN&&(s.data.player_is_paused||s.emit("hb"))};window.addEventListener("visibilitychange",l,!1);var d=function(e){e.persisted||s.destroy()};window.addEventListener("pagehide",d,!1),s.on("destroy",function(){window.removeEventListener("visibilitychange",l),window.removeEventListener("pagehide",d)})}return s.on("playerready",function(e,t){Object.assign(this.data,t)}),tE.forEach(function(e){s.on(e,function(t,i){0!==e.indexOf("ad")&&this._updateStateData(),Object.assign(this.data,i),this._sanitizeData()}),s.on("after"+e,function(){("error"!==e||this.errorTracker.viewErrored)&&this.send(e)})}),s.on("viewend",function(e,t){Object.assign(s.data,t)}),s.one("playerready",function(e){var t=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=t-this.data.player_init_time),!this.mux.PLAYER_TRACKED&&this.NAVIGATION_START&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.DOM_CONTENT_LOADED_EVENT_END)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.DOM_CONTENT_LOADED_EVENT_END||1/0)-this.NAVIGATION_START)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time}),s.longResumeTracker=new tv(es(s)),s.errorTracker=new e$(es(s)),new e0(es(s)),s.seekingTracker=new eY(es(s)),s.playheadTime=new eG(es(s)),s.playbackHeartbeat=new eB(es(s)),new ej(es(s)),s.watchTimeTracker=new eH(es(s)),new eW(es(s)),s.adTracker=new eQ(es(s)),new eK(es(s)),new eV(es(s)),new eq(es(s)),new eJ(es(s)),new tg(es(s)),a.hlsjs&&s.addHLSJS(a),a.dashjs&&s.addDashJS(a),s.emit("viewinit",a.data),s}
1return el(r,[{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,void 0!==this.data.view_start&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(e){if(this.data.view_id){var t=Object.assign({},this.data);if(void 0===t.video_source_is_live&&(t.player_source_duration===1/0||t.video_source_duration===1/0?t.video_source_is_live=!0:(t.player_source_duration>0||t.video_source_duration>0)&&(t.video_source_is_live=!1)),t.video_source_is_live||["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"].forEach(function(e){t[e]=void 0}),t.video_source_url=t.video_source_url||t.player_source_url,t.video_source_url){var i=q(em(t.video_source_url),2),r=i[0];t.video_source_domain=i[1],t.video_source_hostname=r}delete t.ad_request_id,this.playbackEventDispatcher.send(e,t),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat(),"viewend"===e&&delete this.data.view_id}}},{key:"_updateStateData",value:function(){Object.assign(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var e=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(t){var i=parseInt(e.data[t],10);e.data[t]=isNaN(i)?void 0:i}),["player_source_url","video_source_url"].forEach(function(t){if(e.data[t]){var i=e.data[t].toLowerCase();(0===i.indexOf("data:")||0===i.indexOf("blob:"))&&(e.data[t]="MSE style URL")}})}},{key:"_resetVideoData",value:function(){var e=this;Object.keys(this.data).forEach(function(t){0===t.indexOf("video_")&&delete e.data[t]})}},{key:"_resetViewData",value:function(){var e=this;Object.keys(this.data).forEach(function(t){0===t.indexOf("view_")&&delete e.data[t]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(){delete this.data.player_error_code,delete this.data.player_error_message,delete this.data.player_error_context,delete this.data.player_error_severity,delete this.data.player_error_business_exception}},{key:"_initializeViewData",value:function(){var e=this,t=this.data.view_id=Y(),i=function(){t===e.data.view_id&&eE(e.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",i):i()}},{key:"_restartHeartBeat",value:function(){var e=this;window.clearTimeout(this._heartBeatTimeout),this._heartBeatTimeout=window.setTimeout(function(){e.data.player_is_paused||e.emit("hb")},1e4)}},{key:"addHLSJS",value:function(e){e.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=e.hlsjs,eR(this.mux,this.id,e.hlsjs,{},e.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){this.hlsjs&&(eI(this.hlsjs),this.hlsjs=void 0)}},{key:"addDashJS",value:function(e){e.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=e.dashjs,eO(this.mux,this.id,e.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){this.dashjs&&(eP(this.dashjs),this.dashjs=void 0)}}]),r}(eU);w();var ty,tT=_(V()),tA=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],t_={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"},tk=_(k());tk.default&&tk.default.WeakMap&&(ty=new WeakMap);var tS=function(e){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(e),this.manifest};tS.prototype.process=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.processLine(this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}
1,tS.prototype.processLine=function(e){var t=e.indexOf(":"),i=tx(e,t),r=i[0],a=2===i.length?tR(i[1]):void 0;if("#"!==r[0])this.currentUri.uri=r,this.manifest.segments.push(this.currentUri),!this.manifest.targetDuration||"duration"in this.currentUri||(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(r){case"#EXT-X-TARGETDURATION":if(!isFinite(a)||a<0)return;this.manifest.targetDuration=a,this.setHoldBack();break;case"#EXT-X-PART-INF":tw(this.manifest,i),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case"#EXT-X-SERVER-CONTROL":tw(this.manifest,i),this.setHoldBack();break;case"#EXTINF":0===a?this.currentUri.duration=.01:a>0&&(this.currentUri.duration=a);break;case"#EXT-X-PROGRAM-DATE-TIME":var s=new Date(a);this.manifest.dateTimeString||(this.manifest.dateTimeString=a,this.manifest.dateTimeObject=s),this.currentUri.dateTimeString=a,this.currentUri.dateTimeObject=s;break;case"#EXT-X-VERSION":tw(this.manifest,i);break;case"#EXT-X-SESSION-DATA":var n=eS(tM(i[1]));Object.assign(this.manifest.sessionData,n)}},tS.prototype.setHoldBack=function(){var e=this.manifest,t=e.serverControl,i=e.targetDuration,r=e.partTargetDuration;if(t){var a="holdBack",s="partHoldBack",n=i&&3*i,o=r&&2*r;i&&!t.hasOwnProperty(a)&&(t[a]=n),n&&t[a]<n&&(t[a]=n),r&&!t.hasOwnProperty(s)&&(t[s]=3*r),r&&t[s]<o&&(t[s]=o)}};var tw=function(e,t){var i,r=tL(t[0].replace("#EXT-X-",""));tD(t[1])?(i={},i=Object.assign(tC(t[1]),i)):i=tR(t[1]),e[r]=i},tL=function(e){return e.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()})},tR=function(e){if("yes"===e.toLowerCase()||"no"===e.toLowerCase())return"yes"===e.toLowerCase();var t=-1!==e.indexOf(":")?e:parseFloat(e);return isNaN(t)?e:t},tI=function(e){var t={},i=e.split("=");return i.length>1&&(t[tL(i[0])]=tR(i[1])),t},tC=function(e){for(var t=e.split(","),i={},r=0;t.length>r;r++)i=Object.assign(tI(t[r]),i);return i},tD=function(e){return e.indexOf("=")>-1},tx=function(e,t){return -1===t?[e]:[e.substring(0,t),e.substring(t+1)]},tM=function(e){var t={};if(e){var i=e.search(",");return[e.slice(0,i),e.slice(i+1)].forEach(function(e,i){for(var r=e.replace(/['"]+/g,"").split("="),a=0;a<r.length;a++)"DATA-ID"===r[a]&&(t["DATA-ID"]=r[1-a]),"VALUE"===r[a]&&(t.VALUE=r[1-a])}),{data:t}}},tO={safeCall:function(e,t,i,r){var a=r;if(e&&"function"==typeof e[t])try{a=e[t].apply(e,i)}catch(e){ee.info("safeCall error",e)}return a},safeIncrement:eE,getComputedStyle:function(e,t){var i;return e&&t&&tk.default&&"function"==typeof tk.default.getComputedStyle?(ty&&ty.has(e)&&(i=ty.get(e)),i||(i=tk.default.getComputedStyle(e,null),ty&&ty.set(e,i)),i.getPropertyValue(t)):""},secondsToMs:function(e){return Math.floor(1e3*e)},assign:Object.assign,headersStringToObject:e_,cdnHeadersToRequestId:ek,extractHostnameAndDomain:em,extractHostname:ec,manifestParser:tS,generateShortID:z,generateUUID:Y,now:ea},tP={},tN=function(e){var t=arguments;"string"==typeof e?tN.hasOwnProperty(e)?j.default.setTimeout(function(){t=Array.prototype.splice.call(t,1),tN[e].apply(null,t)},0):ee.warn("`"+e+"` is an unknown task"):"function"==typeof e?j.default.setTimeout(function(){e(tN)},0):ee.warn("`"+e+"` is invalid.")},tU={loaded:ea(),NAME:"mux-embed",VERSION:"5.2.1",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(e,t){return function(e,t,i){var r=q(Q(t),3),a=r[0],s=r[1],n=r[2],o=e.log,l=e.utils.getComputedStyle,d=e.utils.secondsToMs;if(!a)return o.error("No element was found with the `"+s+"` query selector.");if("video"!==n&&"audio"!==n)return o.error("The element of `"+s+"` was not a media element.");a.mux&&(a.mux.destroy(),delete a.mux,o.warn("Already monitoring this video element, replacing existing event listeners")),(i=Object.assign({automaticErrorTracking:!0},i)).data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:e.VERSION},i.data),i.getPlayheadTime=function(){return d(a.currentTime)},i.getStateData=function(){var e,t=this.hlsjs&&this.hlsjs.url,r=this.dashjs&&S("function"===this.dashjs.getSource)&&this.dashjs.getSource(),s={player_is_paused:a.paused,player_playhead_time:d(a.currentTime),player_width:parseInt(l(a,"width")),player_height:parseInt(l(a,"he
1ight")),player_autoplay_on:a.autoplay,player_preload_on:a.preload,player_language_code:a.lang,player_is_fullscreen:tT.default&&!!(tT.default.fullscreenElement||tT.default.webkitFullscreenElement||tT.default.mozFullScreenElement||tT.default.msFullscreenElement),video_poster_url:a.poster,video_source_url:t||r||a.currentSrc,video_source_duration:d(a.duration),video_source_height:a.videoHeight,video_source_width:a.videoWidth,view_dropped_frame_count:null==a||null==(e=a.getVideoPlaybackQuality)?void 0:e.call(a).droppedVideoFrames},n=i.getPlayheadTime();if(a.getStartDate&&n>0){var o=a.getStartDate();if(o&&"function"==typeof o.getTime&&o.getTime()){var h=o.getTime();s.player_program_time=h+n,a.seekable.length>0&&(s.player_live_edge_program_time=h+a.seekable.end(a.seekable.length-1))}}return s},a.mux=a.mux||{},a.mux.deleted=!1,a.mux.emit=function(t,i){e.emit(s,t,i)};var h=function(){o.error("The monitor for this video element has already been destroyed.")};a.mux.destroy=function(){Object.keys(a.mux.listeners).forEach(function(e){a.removeEventListener(e,a.mux.listeners[e],!1)}),delete a.mux.listeners,a.mux.destroy=h,a.mux.swapElement=h,a.mux.emit=h,a.mux.addHLSJS=h,a.mux.addDashJS=h,a.mux.removeHLSJS=h,a.mux.removeDashJS=h,a.mux.deleted=!0,e.emit(s,"destroy")},a.mux.swapElement=function(t){var i=q(Q(t),3),r=i[0],s=i[1],n=i[2];return r?"video"!==n&&"audio"!==n?e.log.error("The element of `"+s+"` was not a media element."):void(r.muxId=a.muxId,delete a.muxId,r.mux=r.mux||{},r.mux.listeners=Object.assign({},a.mux.listeners),delete a.mux.listeners,Object.keys(r.mux.listeners).forEach(function(e){a.removeEventListener(e,r.mux.listeners[e],!1),r.addEventListener(e,r.mux.listeners[e],!1)}),r.mux.swapElement=a.mux.swapElement,r.mux.destroy=a.mux.destroy,delete a.mux,a=r):e.log.error("No element was found with the `"+s+"` query selector.")},a.mux.addHLSJS=function(t){e.addHLSJS(s,t)},a.mux.addDashJS=function(t){e.addDashJS(s,t)},a.mux.removeHLSJS=function(){e.removeHLSJS(s)},a.mux.removeDashJS=function(){e.removeDashJS(s)},e.init(s,i),e.emit(s,"playerready"),a.paused||(e.emit(s,"play"),a.readyState>2&&e.emit(s,"playing")),a.mux.listeners={},tA.forEach(function(t){("error"!==t||i.automaticErrorTracking)&&(a.mux.listeners[t]=function(){var i={};if("error"===t){if(!a.error||1===a.error.code)return;i.player_error_code=a.error.code,i.player_error_message=t_[a.error.code]||a.error.message}e.emit(s,t,i)},a.addEventListener(t,a.mux.listeners[t],!1))})}(tN,e,t)},destroyMonitor:function(e){var t=q(Q(e),1)[0];t&&t.mux&&"function"==typeof t.mux.destroy?t.mux.destroy():ee.error("A video element monitor for `"+e+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(e,t){var i=X(e);tP[i]?tP[i].addHLSJS(t):ee.error("A monitor for `"+i+"` has not been initialized.")},addDashJS:function(e,t){var i=X(e);tP[i]?tP[i].addDashJS(t):ee.error("A monitor for `"+i+"` has not been initialized.")},removeHLSJS:function(e){var t=X(e);tP[t]?tP[t].removeHLSJS():ee.error("A monitor for `"+t+"` has not been initialized.")},removeDashJS:function(e){var t=X(e);tP[t]?tP[t].removeDashJS():ee.error("A monitor for `"+t+"` has not been initialized.")},init:function(e,t){ei()&&t&&t.respectDoNotTrack&&ee.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var i=X(e);tP[i]=new tb(tN,i,t)},emit:function(e,t,i){var r=X(e);tP[r]?(tP[r].emit(t,i),"destroy"===t&&delete tP[r]):ee.error("A monitor for `"+r+"` has not been initialized.")},checkDoNotTrack:ei,log:ee,utils:tO,events:{PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled"},WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(tN,tU),void 0!==j.default&&"function"==typeof j.default.addEventListener&&j.default.addEventListener("pagehide",function(e){e.persisted||(tN.WINDOW_UNLOADING=!0)},!1);var tF={exports:{}};oM=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,oO=/^(?=([^\/?#]*))\1([^]*)$/,oP=/(?:\/|^)\.(?=\/)/g,oN=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,tF.exports=oU={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=oU.parseURL(e);if(!r)throw Error("Error trying to parse base URL.");return r.path=oU.normalizePath(r.path),oU.buildURLFromParts(r)}var a=oU.parseURL(t);if(!a)throw Error("Error trying to parse relative URL.");
1if(a.scheme)return i.alwaysNormalize?(a.path=oU.normalizePath(a.path),oU.buildURLFromParts(a)):t;var s=oU.parseURL(e);if(!s)throw Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var n=oO.exec(s.path);s.netLoc=n[1],s.path=n[2]}s.netLoc&&!s.path&&(s.path="/");var o={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(o.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var l=s.path,d=l.substring(0,l.lastIndexOf("/")+1)+a.path;o.path=oU.normalizePath(d)}else o.path=s.path,!a.params&&(o.params=s.params,a.query||(o.query=s.query));return null===o.path&&(o.path=i.alwaysNormalize?oU.normalizePath(a.path):a.path),oU.buildURLFromParts(o)},parseURL:function(e){var t=oM.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(oP,"");e.length!==(e=e.replace(oN,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};var tB=tF.exports;function t$(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function tH(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?t$(Object(i),!0).forEach(function(t){!function(e,t,i){var r;(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:String(r))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i}(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t$(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function tW(){return(tW=Object.assign.bind()).apply(this,arguments)}let tG=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},tV=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=tK},tK=Number.MAX_SAFE_INTEGER||0x1fffffffffffff,tq=((oF={}).MEDIA_ATTACHING="hlsMediaAttaching",oF.MEDIA_ATTACHED="hlsMediaAttached",oF.MEDIA_DETACHING="hlsMediaDetaching",oF.MEDIA_DETACHED="hlsMediaDetached",oF.BUFFER_RESET="hlsBufferReset",oF.BUFFER_CODECS="hlsBufferCodecs",oF.BUFFER_CREATED="hlsBufferCreated",oF.BUFFER_APPENDING="hlsBufferAppending",oF.BUFFER_APPENDED="hlsBufferAppended",oF.BUFFER_EOS="hlsBufferEos",oF.BUFFER_FLUSHING="hlsBufferFlushing",oF.BUFFER_FLUSHED="hlsBufferFlushed",oF.MANIFEST_LOADING="hlsManifestLoading",oF.MANIFEST_LOADED="hlsManifestLoaded",oF.MANIFEST_PARSED="hlsManifestParsed",oF.LEVEL_SWITCHING="hlsLevelSwitching",oF.LEVEL_SWITCHED="hlsLevelSwitched",oF.LEVEL_LOADING="hlsLevelLoading",oF.LEVEL_LOADED="hlsLevelLoaded",oF.LEVEL_UPDATED="hlsLevelUpdated",oF.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",oF.LEVELS_UPDATED="hlsLevelsUpdated",oF.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",oF.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",oF.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",oF.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",oF.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",oF.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",oF.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",oF.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",oF.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",oF.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",oF.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",oF.CUES_PARSED="hlsCuesParsed",oF.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",oF.INIT_PTS_FOUND="hlsInitPtsFound",oF.FRAG_LOADING="hlsFragLoading",oF.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",oF.FRAG_LOADED="hlsFragLoaded",oF.FRAG_DECRYPTED="hlsFragDecrypted",oF.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",oF.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",oF.FRAG_PARSING_METADATA="hlsFragParsingMetadata",oF.FRAG_PARSED="hl
1sFragParsed",oF.FRAG_BUFFERED="hlsFragBuffered",oF.FRAG_CHANGED="hlsFragChanged",oF.FPS_DROP="hlsFpsDrop",oF.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",oF.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",oF.ERROR="hlsError",oF.DESTROYING="hlsDestroying",oF.KEY_LOADING="hlsKeyLoading",oF.KEY_LOADED="hlsKeyLoaded",oF.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",oF.BACK_BUFFER_REACHED="hlsBackBufferReached",oF.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",oF),tj=((oB={}).NETWORK_ERROR="networkError",oB.MEDIA_ERROR="mediaError",oB.KEY_SYSTEM_ERROR="keySystemError",oB.MUX_ERROR="muxError",oB.OTHER_ERROR="otherError",oB),tY=((o$={}).KEY_SYSTEM_NO_KEYS="keySystemNoKeys",o$.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",o$.KEY_SYSTEM_NO_SESSION="keySystemNoSession",o$.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",o$.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",o$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",o$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",o$.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",o$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",o$.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",o$.MANIFEST_LOAD_ERROR="manifestLoadError",o$.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",o$.MANIFEST_PARSING_ERROR="manifestParsingError",o$.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",o$.LEVEL_EMPTY_ERROR="levelEmptyError",o$.LEVEL_LOAD_ERROR="levelLoadError",o$.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",o$.LEVEL_PARSING_ERROR="levelParsingError",o$.LEVEL_SWITCH_ERROR="levelSwitchError",o$.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",o$.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",o$.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",o$.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",o$.FRAG_LOAD_ERROR="fragLoadError",o$.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",o$.FRAG_DECRYPT_ERROR="fragDecryptError",o$.FRAG_PARSING_ERROR="fragParsingError",o$.FRAG_GAP="fragGap",o$.REMUX_ALLOC_ERROR="remuxAllocError",o$.KEY_LOAD_ERROR="keyLoadError",o$.KEY_LOAD_TIMEOUT="keyLoadTimeOut",o$.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",o$.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",o$.BUFFER_APPEND_ERROR="bufferAppendError",o$.BUFFER_APPENDING_ERROR="bufferAppendingError",o$.BUFFER_STALLED_ERROR="bufferStalledError",o$.BUFFER_FULL_ERROR="bufferFullError",o$.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",o$.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",o$.INTERNAL_EXCEPTION="internalException",o$.INTERNAL_ABORTED="aborted",o$.UNKNOWN="unknown",o$),tz=function(){},tX={trace:tz,debug:tz,log:tz,warn:tz,info:tz,error:tz},tQ=tX,tZ=tQ,tJ=/^(\d+)x(\d+)$/,t0=/(.+?)=(".*?"|.*?)(?:,|$)/g;class t1{constructor(e){"string"==typeof e&&(e=t1.parseAttrList(e)),tW(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>"X-"===e.substring(0,2))}decimalInteger(e){let t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(!this[e])return null;{let t=(this[e]||"0x").slice(2),i=new Uint8Array((t=(1&t.length?"0":"")+t).length/2);for(let e=0;e<t.length/2;e++)i[e]=parseInt(t.slice(2*e,2*e+2),16);return i}}hexadecimalIntegerAsNumber(e){let t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){let i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return"YES"===this[e]}decimalResolution(e){let t=tJ.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t,i={};for(t0.lastIndex=0;null!==(t=t0.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1)),i[t[1].trim()]=e}return i}}class t2{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){tZ.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=tW(new t1({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=new Date(this.attr["END-DATE"]);tG(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;let e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){let e=this.attr.decimalFloatingPoint("DURATION");if(tG(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&tG(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class t3{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var t4="audio",t5="video",t8="audiovideo";class t9{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[t4]:null,[t5]:null,[t8]:null},this.baseurl=e}setByteRange(e,t){let i,r=e.split("@",2);i=1===r.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(r[1]),this._byteRange=[i,parseInt(r[0])+i]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=tB.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class t6 extends t9{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new t3,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){let{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){let e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{let e=Object.keys(this.levelkeys);if(1===e.length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime||!tG(this.programDateTime))return null;let e=tG(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;
1if(this.levelkeys){let e=Object.keys(this.levelkeys),t=e.length;if(t>1||1===t&&this.levelkeys[e[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){let t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,r,a,s=!1){let{elementaryStreams:n}=this,o=n[e];if(!o){n[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:a,partial:s};return}o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,a)}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[t4]=null,e[t5]=null,e[t8]=null}}class t7 extends t9{constructor(e,t,i,r,a){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new t3,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const s=e.enumeratedString("BYTERANGE");s&&this.setByteRange(s,a),a&&(this.fragOffset=a.fragOffset+a.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}class ie{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}let t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return!!this.fragments.length&&tG(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}
1get drift(){let e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function it(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function ii(e){return Uint8Array.from(unescape(encodeURIComponent(e)),e=>e.charCodeAt(0))}let ir="u">typeof self?self:void 0;var ia="org.w3.clearkey",is="com.apple.fps",io="com.microsoft.playready",il="com.widevine.alpha",id="org.w3.clearkey",ih="com.apple.streamingkeydelivery",iu="com.microsoft.playready",ic="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function im(e){switch(e){case ih:return is;case iu:return io;case ic:return il;case id:return ia}}function ip(e){return"edef8ba979d64acea3c827dcd51d21ed"===e?il:"9a04f07998404286ab92e65be0885f95"===e?io:"1077efecc0b24d02ace33c1e52e2fb4b"===e||"e2719d58a985b3c9781ab030af78d30e"===e?ia:void 0}function ig(e){switch(e){case is:return ih;case io:return iu;case il:return ic;case ia:return id}}function iv(e){let{drmSystems:t,widevineLicenseUrl:i}=e,r=t?[is,il,io,ia].filter(e=>!!t[e]):[];return!r[il]&&i&&r.push(il),r}let iE=null!=ir&&null!=(oH=ir.navigator)&&oH.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function ib(e){let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=String.fromCharCode.apply(null,Array.from(t)),r=i.substring(i.indexOf("<"),i.length),a=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(a){let e=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(e){let t,i=it(e).subarray(0,16);return(t=function(e,t,i){let r=e[t];e[t]=e[i],e[i]=r})(i,0,3),t(i,1,2),t(i,4,5),t(i,6,7),i}}return null}function iy(e,t,i){return Uint8Array.prototype.slice?e.slice(t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))}let iT=(e,t)=>t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128||!1,iA=(e,t)=>t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128||!1,i_=(e,t)=>{let i=t,r=0;for(;iT(e,t);)r+=10,r+=ik(e,t+6),iA(e,t+10)&&(r+=10),t+=r;if(r>0)return e.subarray(i,i+r)},ik=(e,t)=>(127&e[t])<<21|(127&e[t+1])<<14|(127&e[t+2])<<7|127&e[t+3],iS=(e,t)=>iT(e,t)&&ik(e,t+6)+10<=e.length-t,iw=e=>{let t=iI(e);for(let e=0;e<t.length;e++){let i=t[e];if(iL(i))return iO(i)}},iL=e=>e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info,iR=e=>{let t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=ik(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}},iI=e=>{let t=0,i=[];for(;iT(e,t);){let r=ik(e,t+6),a=(t+=10)+r;for(;t+8<a;){let r=iR(e.subarray(t)),a=iC(r);a&&i.push(a),t+=r.size+10}iA(e,t)&&(t+=10)}return i},iC=e=>"PRIV"===e.type?iD(e):"W"===e.type[0]?iM(e):ix(e),iD=e=>{if(e.size<2)return;let t=iP(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}},ix=e=>{if(e.size<2)return;if("TXXX"===e.type){let t=1,i=iP(e.data.subarray(t),!0);t+=i.length+1;let r=iP(e.data.subarray(t));return{key:e.type,info:i,data:r}}let t=iP(e.data.subarray(1));return{key:e.type,data:t}},iM=e=>{if("WXXX"===e.type){if(e.size<2)return;let t=1,i=iP(e.data.subarray(t),!0);t+=i.length+1;let r=iP(e.data.subarray(t));return{key:e.type,info:i,data:r}}let t=iP(e.data);return{key:e.type,data:t}},iO=e=>{if(8===e.data.byteLength){let t=new Uint8Array(e.data),i=1&t[3],r=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return r/=45,i&&(r+=47721858.84),Math.round(r)}},iP=(e,i=!1)=>{let r,a,s=function(){if(!navigator.userAgent.includes("PlayStation 4"))return t||void 0===self.TextDecoder||(t=new self.TextDecoder("utf-8")),t}();if(s){let t=s.decode(e);if(i){let e=t.indexOf("\0");return -1!==e?t.substring(0,e):t}return t.replace(/\0/g,"")}let n=e.length,o="",l=0;for(;l<n&&(0!==(r=e[l++])||!i);)if(0!==r&&3!==r)switch(r>>
14){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:o+=String.fromCharCode((31&r)<<6|63&(a=e[l++]));break;case 14:o+=String.fromCharCode((15&r)<<12|(63&(a=e[l++]))<<6|63&e[l++])}return o},iN=function(e){let t="";for(let i=0;i<e.length;i++){let r=e[i].toString(16);r.length<2&&(r="0"+r),t+=r}return t},iU=[].push,iF={video:1,audio:2,id3:3,text:4};function iB(e){return String.fromCharCode.apply(null,e)}function i$(e,t){let i=e[t]<<8|e[t+1];return i<0?65536+i:i}function iH(e,t){let i=iG(e,t);return i<0?0x100000000+i:i}function iW(e,t){let i=iH(e,t);return i*=0x100000000,i+=iH(e,t+4)}function iG(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function iV(e,t,i){e[t]=i>>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function iK(e,t){let i=[];if(!t.length)return i;let r=e.byteLength;for(let a=0;a<r;){let s=iH(e,a),n=iB(e.subarray(a+4,a+8)),o=s>1?a+s:r;if(n===t[0])if(1===t.length)i.push(e.subarray(a+8,o));else{let r=iK(e.subarray(a+8,o),t.slice(1));r.length&&iU.apply(i,r)}a=o}return i}function iq(e){let t=[],i=iK(e,["moov","trak"]);for(let e=0;e<i.length;e++){let r=i[e],a=iK(r,["tkhd"])[0];if(a){let e=a[0],i=iH(a,0===e?12:20),s=iK(r,["mdia","mdhd"])[0];if(s){e=s[0];let a=iH(s,0===e?12:20),n=iK(r,["mdia","hdlr"])[0];if(n){let e={soun:t4,vide:t5}[iB(n.subarray(8,12))];if(e){let s=function(e){let t=e.subarray(8),i=t.subarray(86),r=iB(t.subarray(4,8)),a=r,s="enca"===r||"encv"===r;if(s){let e=iK(t,[r])[0].subarray("enca"===r?28:78);iK(e,["sinf"]).forEach(e=>{let t=iK(e,["schm"])[0];if(t){let i=iB(t.subarray(4,8));if("cbcs"===i||"cenc"===i){let t=iK(e,["frma"])[0];t&&(a=iB(t))}}})}switch(a){case"avc1":case"avc2":case"avc3":case"avc4":{let e=iK(i,["avcC"])[0];a+="."+iY(e[1])+iY(e[2])+iY(e[3]);break}case"mp4a":{let e=iK(t,[r])[0],i=iK(e.subarray(28),["esds"])[0];if(i&&i.length>12){let e=4;if(3!==i[e++])break;e=ij(i,e)+2;let t=i[e++];if(128&t&&(e+=2),64&t&&(e+=i[e++]),4!==i[e++])break;e=ij(i,e);let r=i[e++];if(64===r)a+="."+iY(r);else break;if(e+=12,5!==i[e++])break;e=ij(i,e);let s=i[e++],n=(248&s)>>3;31===n&&(n+=1+((7&s)<<3)+((224&i[e])>>5)),a+="."+n}break}case"hvc1":case"hev1":{let e=iK(i,["hvcC"])[0],t=e[1],r=["","A","B","C"][t>>6],s=iH(e,2),n=e[12],o=e.subarray(6,12);a+="."+r+(31&t),a+="."+s.toString(16).toUpperCase(),a+="."+((32&t)>>5?"H":"L")+n;let l="";for(let e=o.length;e--;){let t=o[e];(t||l)&&(l="."+t.toString(16).toUpperCase()+l)}a+=l;break}case"dvh1":case"dvhe":{let e=iK(i,["dvcC"])[0],t=e[2]>>1&127,r=e[2]<<5&32|e[3]>>3&31;a+="."+iz(t)+"."+iz(r);break}case"vp09":{let e=iK(i,["vpcC"])[0],t=e[4],r=e[5],s=e[6]>>4&15;a+="."+iz(t)+"."+iz(r)+"."+iz(s);break}case"av01":{let e=iK(i,["av1C"])[0],t=e[1]>>>5,r=31&e[1],s=e[2]>>>7?"H":"M",n=(64&e[2])>>6,o=(32&e[2])>>5,l=(16&e[2])>>4,d=(8&e[2])>>3,h=(4&e[2])>>2,u=3&e[2];a+="."+t+"."+iz(r)+s+"."+iz(2===t&&n?o?12:10:n?10:8)+"."+l+"."+d+h+u+"."+iz(1)+"."+iz(1)+"."+iz(1)+".0"}}return{codec:a,encrypted:s}}(iK(r,["mdia","minf","stbl","stsd"])[0]);t[i]={timescale:a,type:e},t[e]=tH({timescale:a,id:i},s)}}}}}return iK(e,["moov","mvex","trex"]).forEach(e=>{let i=t[iH(e,4)];i&&(i.default={duration:iH(e,12),flags:iH(e,20)})}),t}function ij(e,t){let i=t+5;for(;128&e[t++]&&t<i;);return t}function iY(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function iz(e){return(e<10?"0":"")+e}function iX(e){let t=iK(e,["schm"])[0];if(t){let i=iB(t.subarray(4,8));if("cbcs"===i||"cenc"===i)return iK(e,["schi","tenc"])[0]}return null}function iQ(e,t){let i=new Uint8Array(e.length+t.length);return i.set(e),i.set(t,e.length),i}function iZ(e,t){let i=[],r=t.samples,a=t.timescale,s=t.id,n=!1;return iK(r,["moof"]).map(o=>{let l=o.byteOffset-8;iK(o,["traf"]).map(o=>{let d=iK(o,["tfdt"]).map(e=>{let t=e[0],i=iH(e,4);return 1===t&&(i*=0x100000000,i+=iH(e,8)),i/a})[0];return void 0!==d&&(e=d),iK(o,["tfhd"]).map(d=>{let h=iH(d,4),u=0xffffff&iH(d,0),c=0,m=0,p=8;h===s&&((1&u)!=0&&(p+=8),(2&u)!=0&&(p+=4),(8&u)!=0&&(c=iH(d,p),p+=4),(16&u)!=0&&(m=iH(d,p),p+=4),(32&u)!=0&&(p+=4),"video"===t.type&&(n=function(e){if(!e)return!1;let t=e.indexOf("."),i=t<0?e:e.substring(0,t);return"hvc1"===i||"hev1"===i||"dvh1"===i||"dvhe"===i}(t.codec)),iK(o,["trun"]).map(s=>{let o=s[0],d=0xffffff&iH(s,0),h=0,u=(256&d)!=0,p=0,f=(512&d)!=0,g=0,v=(1024&d)!=0,E=(2048&d)!=0,b=0,y=iH(s,4),T=8;(1&d)!=0&&(h=iH(s,T),T+=4),(4&d)!=0&&(T+=4);let A=h+l;for(let l=0;l<y;l++){if(u?(p=iH(s,T),T+=4):p=c,f?(g=iH(s,T),T+=4):g=m,v&&(T+=4),E&&(b=0===o?iH(s,T):iG(s,T),T+=4),t.type===t5){let t=0;for(;t<g;){let s=iH(r,A);A+=4,function(e,t){if(!e)return 6==(31&t);{let e=t>>1&63;return 39===e||40===e}}(n,r[A])&&iJ(r.subarray(A,A+s),n?2:1,e+b/a,i),A+=s,t+=s+4}}e+=p/a}}))})})}),i}function iJ(e,t,i,r){let a,s=i0(e);a=0+t;let n=0,o=0,l=0;for(;a<s.length;){n=0;do{if(a>=s.length)break;n+=l=s[a++]}while(255===l)o=0;do{if(a>=s.length)break;o+=l=s[a++]}while(255===l)let e=s.length-a,t=a;if(o<e)a+=o;else if(o>e){tZ.error(`Malformed SEI payload. ${o} is too small, only ${e} bytes left to parse.`);break}if(4===n){if(181===s[t++]){let e=i$(s,t);if(t+=2,49===e){let e=iH(s,t);if(t+=4,0x47413934===e){let e=s[t++];if(3===e){let a=s[t++],o=31&a,l=64&a,d=l?2+3*o:0,h=new Uint8Array(d);if(l){h[0]=a;for(let e=1;e<d;e++)h[e]=s[t++]}r.push({type:e,payloadType:n,pts:i,bytes:h})}}}}}else if(5===n&&o>16){let e=[];for(let i=0;i<16;i++){let r=s[t++].toString(16);e.push(1==r.length?"0"+r:r),(3===i||5===i||7===i||9===i)&&e.push("-")}let a=o-16,l=new Uint8Array(a);for(let e=0;e<a;e++)l[e]=s[t++];r.push({payloadType:n,pts:i,uuid:e.join(""),userData:iP(l),userDataBytes:l})}}}function i0(e){let t=e.byteLength,i=[],r=1;for(;r<t-2;)0===e[r]&&0===e[r+1]&&3===e[r+2]?(i.push(r+2),r+=2):r++;if(0===i.length)return e;let a=t-i.length,s=new Uint8Array(a),n=0;for(r=0;r<a;n++,r++)n===i[0]&&(n++,i.shift()),s[r]=e[n];return s}let i1={};class i2{static clearKeyUriToKeyIdMap(){i1={}}constructor(e,t,i,r=[1],a=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pss
1h=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=a,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&"AES-128"!==e}isSupported(){if(this.method){if("AES-128"===this.method||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case ih:case ic:case iu:case id:return -1!==["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if("AES-128"===this.method&&this.uri&&!this.iv){"number"!=typeof e&&("AES-128"!==this.method||this.iv||tZ.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);let t=function(e){let t=new Uint8Array(16);for(let i=12;i<16;i++)t[i]=e>>8*(15-i)&255;return t}(e);return new i2(this.method,this.uri,"identity",this.keyFormatVersions,t)}let t=function(e){let t=e.split(":"),i=null;if("data"===t[0]&&2===t.length){let e=t[1].split(";"),r=e[e.length-1].split(",");if(2===r.length){let t="base64"===r[0],a=r[1];if(t)e.splice(-1,1),i=it(a);else{let e,t;e=ii(a).subarray(0,16),(t=new Uint8Array(16)).set(e,16-e.length),i=t}}}return i}(this.uri);if(t)switch(this.keyFormat){case ic:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case iu:{let e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=function(e,t){let i,r;if(16!==e.byteLength)throw RangeError("Invalid system id");i=new Uint8Array,r=new Uint8Array;let a=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),function(e,...t){let i=t.length,r=8,a=i;for(;a--;)r+=t[a].byteLength;let s=new Uint8Array(r);for(s[0]=r>>24&255,s[1]=r>>16&255,s[2]=r>>8&255,s[3]=255&r,s.set(e,4),a=0,r=8;a<i;a++)s.set(t[a],r),r+=t[a].byteLength;return s}([112,115,115,104],new Uint8Array([0,0,0,0]),e,r,i,a,t||new Uint8Array)}(e,t),this.keyId=ib(t);break}default:{let e=t.subarray(0,16);if(16!==e.length){let t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e}}if(!this.keyId||16!==this.keyId.byteLength){let e=i1[this.uri];if(!e){let t=Object.keys(i1).length%Number.MAX_SAFE_INTEGER;new DataView((e=new Uint8Array(16)).buffer,12,4).setUint32(0,t),i1[this.uri]=e}this.keyId=e}return this}}let i3=/\{\$([a-zA-Z0-9-_]+)\}/g;function i4(e,t,i){if(null!==e.variableList||e.hasVariableRefs)for(let r=i.length;r--;){let a=i[r],s=t[a];s&&(t[a]=i5(e,s))}}function i5(e,t){if(null!==e.variableList||e.hasVariableRefs){let i=e.variableList;return t.replace(i3,t=>{let r=t.substring(2,t.length-1),a=null==i?void 0:i[r];return void 0===a?(e.playlistParsingError||(e.playlistParsingError=Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),t):a})}return t}function i8(e,t,i){let r,a,s=e.variableList;if(s||(e.variableList=s={}),"QUERYPARAM"in t){r=t.QUERYPARAM;try{let e=new self.URL(i).searchParams;if(e.has(r))a=e.get(r);else throw Error(`"${r}" does not match any query parameter in URI: "${i}"`)}catch(t){e.playlistParsingError||(e.playlistParsingError=Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else r=t.NAME,a=t.VALUE;r in s?e.playlistParsingError||(e.playlistParsingError=Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):s[r]=a||""}function i9(e=!0){if(!("u"<typeof self))return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}let i6={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function i7(e,t,i=!0){return!e.split(",").some(e=>!re(e,t,i))}function re(e,t,i=!0){var r;let a=i9(i);
1return null!=(r=null==a?void 0:a.isTypeSupported(rt(e,t)))&&r}function rt(e,t){return`${t}/mp4;codecs="${e}"`}function ri(e){if(e){let t=e.substring(0,4);return i6.video[t]}return 2}function rr(e){return e.split(",").reduce((e,t)=>{let i=i6.video[t];return i?(2*i+e)/(e?3:2):(i6.audio[t]+e)/(e?2:1)},0)}let ra={},rs=/flac|opus/i;function rn(e,t=!0){return e.replace(rs,e=>(function(e,t=!0){if(ra[e])return ra[e];let i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e];for(let r=0;r<i.length;r++)if(re(i[r],"audio",t))return ra[e]=i[r],i[r];return e})(e.toLowerCase(),t))}function ro(e,t){return e&&"mp4a"!==e?e:t?t.split(",")[0]:t}let rl=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,rd=/#EXT-X-MEDIA:(.*)/g,rh=/^#EXT(?:INF|-X-TARGETDURATION):/m,ru=RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),rc=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class rm{static findGroup(e,t){for(let i=0;i<e.length;i++){let r=e[i];if(r.id===t)return r}}static resolve(e,t){return tB.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return rh.test(e)}static parseMasterPlaylist(e,t){var i;let r,a={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i3.test(e)},s=[];for(rl.lastIndex=0;null!=(r=rl.exec(e));)if(r[1]){let e=new t1(r[1]);i4(a,e,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);let n=i5(a,r[2]),o={attrs:e,bitrate:e.decimalInteger("BANDWIDTH")||e.decimalInteger("AVERAGE-BANDWIDTH"),name:e.NAME,url:rm.resolve(n,t)},l=e.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),function(e,t){let i=(e||"").split(/[ ,]+/).filter(e=>e);["video","audio","text"].forEach(e=>{let r=i.filter(t=>{let i;return!!(i=i6[e])&&!!i[t.slice(0,4)]});r.length&&(t[`${e}Codec`]=r.join(","),i=i.filter(e=>-1===r.indexOf(e)))}),t.unknownCodecs=i}(e.CODECS,o),null!=(i=o.unknownCodecs)&&i.length||s.push(o),a.levels.push(o)}else if(r[3]){let e=r[3],i=r[4];switch(e){case"SESSION-DATA":{let e=new t1(i);i4(a,e,["DATA-ID","LANGUAGE","VALUE","URI"]);let t=e["DATA-ID"];t&&(null===a.sessionData&&(a.sessionData={}),a.sessionData[t]=e);break}case"SESSION-KEY":{let e=rp(i,t,a);e.encrypted&&e.isSupported()?(null===a.sessionKeys&&(a.sessionKeys=[]),a.sessionKeys.push(e)):tZ.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${i}"`);break}case"DEFINE":{let e=new t1(i);i4(a,e,["NAME","VALUE","QUERYPARAM"]),i8(a,e,t)}break;case"CONTENT-STEERING":{let e=new t1(i);i4(a,e,["SERVER-URI","PATHWAY-ID"]),a.contentSteering={uri:rm.resolve(e["SERVER-URI"],t),pathwayId:e["PATHWAY-ID"]||"."};break}case"START":a.startTimeOffset=rf(i)}}let n=s.length>0&&s.length<a.levels.length;return a.levels=n?s:a.levels,0===a.levels.length&&(a.playlistParsingError=Error("no levels found in manifest")),a}static parseMasterPlaylistMedia(e,t,i){let r,a={},s=i.levels,n={AUDIO:s.map(e=>({id:e.attrs.AUDIO,audioCodec:e.audioCodec})),SUBTITLES:s.map(e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec})),"CLOSED-CAPTIONS":[]},o=0;for(rd.lastIndex=0;null!==(r=rd.exec(e));){let e=new t1(r[1]),s=e.TYPE;if(s){let r=n[s],l=a[s]||[];a[s]=l,i4(i,e,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);let d=e.LANGUAGE,h=e["ASSOC-LANGUAGE"],u=e.CHANNELS,c=e.CHARACTERISTICS,m=e["INSTREAM-ID"],p={attrs:e,bitrate:0,id:o++,groupId:e["GROUP-ID"]||"",name:e.NAME||d||"",type:s,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:d,url:e.URI?rm.resolve(e.URI,t):""};if(h&&(p.assocLang=h),u&&(p.channels=u),c&&(p.characteristics=c),m&&(p.instreamId=m),null!=r&&r.length){let e=rm.findGroup(r,p.groupId)||r[0];rg(p,e,"audioCodec"),rg(p,e,"textCodec")}l.push(p)}}return a}static parseLevelPlaylist(e,t,i,r,a,s){let n,o,l,d=new ie(t),h=d.fragments,u=null,c=0,m=0,p=0,f=0,g=null,v=new t6(r,t),E=-1,b=!1,y=null;for(ru.lastIndex=0,d.m3u8=e,d.hasVariableRefs=i3.test(e);null!==(n=ru.exec(e));){b&&(b=!1,(v=new t6(r,t)).start=p,v.sn=c,v.cc=f,v.level=i,u&&(v.initSegment=u,v.rawProgramDateTime=u.rawProgramDateTime,u.rawProgramDateTime=null,y&&(v.setByteRange(y),y=null)));let e=n[1];if(e){v.duration=parseFloat(e);let t=(" "+n[2]).slice(1);v.title=t||null,v.tagList.push(t?["INF",e,t]:["INF",e])}else if(n[3]){if(tG(v.duration)){v.start=p,l&&rb(v,l,d),v.sn=c,v.level=i,v.cc=f,h.push(v);let e=(" "+n[3]).slice(1);v.relurl=i5(d,e),rv(v,g),g=v,p+=v.duration,c++,m=0,b=!0}}else if(n[4]){let e=(" "+n[4]).slice(1);g?v.setByteRange(e,g):v.setByteRange(e)}else if(n[5])v.rawProgramDateTime=(" "+n[5]).slice(1),v.tagList.push(["PROGRAM-DATE-TIME",v.rawProgramDateTime]),-1===E&&(E=h.length);
1else{if(!(n=n[0].match(rc))){tZ.warn("No matches on slow regex match for level playlist!");continue}for(o=1;o<n.length&&void 0===n[o];o++);let e=(" "+n[o]).slice(1),a=(" "+n[o+1]).slice(1),p=n[o+2]?(" "+n[o+2]).slice(1):"";switch(e){case"PLAYLIST-TYPE":d.type=a.toUpperCase();break;case"MEDIA-SEQUENCE":c=d.startSN=parseInt(a);break;case"SKIP":{let e=new t1(a);i4(d,e,["RECENTLY-REMOVED-DATERANGES"]);let t=e.decimalInteger("SKIPPED-SEGMENTS");if(tG(t)){d.skippedSegments=t;for(let e=t;e--;)h.unshift(null);c+=t}let i=e.enumeratedString("RECENTLY-REMOVED-DATERANGES");i&&(d.recentlyRemovedDateranges=i.split(" "));break}case"TARGETDURATION":d.targetduration=Math.max(parseInt(a),1);break;case"VERSION":d.version=parseInt(a);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":d.live=!1;break;case"#":(a||p)&&v.tagList.push(p?[a,p]:[a]);break;case"DISCONTINUITY":f++,v.tagList.push(["DIS"]);break;case"GAP":v.gap=!0,v.tagList.push([e]);break;case"BITRATE":v.tagList.push([e,a]);break;case"DATERANGE":{let e=new t1(a);i4(d,e,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),i4(d,e,e.clientAttrs);let t=new t2(e,d.dateRanges[e.ID]);t.isValid||d.skippedSegments?d.dateRanges[t.id]=t:tZ.warn(`Ignoring invalid DATERANGE tag: "${a}"`),v.tagList.push(["EXT-X-DATERANGE",a]);break}case"DEFINE":{let e=new t1(a);i4(d,e,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in e?function(e,t,i){let r=t.IMPORT;if(i&&r in i){let t=e.variableList;t||(e.variableList=t={}),t[r]=i[r]}else e.playlistParsingError||(e.playlistParsingError=Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${r}"`))}(d,e,s):i8(d,e,t)}break;case"DISCONTINUITY-SEQUENCE":f=parseInt(a);break;case"KEY":{let e=rp(a,t,d);if(e.isSupported()){if("NONE"===e.method){l=void 0;break}l||(l={}),l[e.keyFormat]&&(l=tW({},l)),l[e.keyFormat]=e}else tZ.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${a}"`);break}case"START":d.startTimeOffset=rf(a);break;case"MAP":{let e=new t1(a);if(i4(d,e,["BYTERANGE","URI"]),v.duration){let a=new t6(r,t);rE(a,e,i,l),u=a,v.initSegment=u,u.rawProgramDateTime&&!v.rawProgramDateTime&&(v.rawProgramDateTime=u.rawProgramDateTime)}else{let t=v.byteRangeEndOffset;if(t){let e=v.byteRangeStartOffset;y=`${t-e}@${e}`}else y=null;rE(v,e,i,l),u=v,b=!0}break}case"SERVER-CONTROL":{let e=new t1(a);d.canBlockReload=e.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=e.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&e.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=e.optionalFloat("PART-HOLD-BACK",0),d.holdBack=e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":d.partTarget=new t1(a).decimalFloatingPoint("PART-TARGET");break;case"PART":{let e=d.partList;e||(e=d.partList=[]);let i=m>0?e[e.length-1]:void 0,r=m++,s=new t1(a);i4(d,s,["BYTERANGE","URI"]);let n=new t7(s,v,t,r,i);e.push(n),v.duration+=n.duration;break}case"PRELOAD-HINT":{let e=new t1(a);i4(d,e,["URI"]),d.preloadHint=e;break}case"RENDITION-REPORT":{let e=new t1(a);i4(d,e,["URI"]),d.renditionReports=d.renditionReports||[],d.renditionReports.push(e);break}default:tZ.warn(`line parsed but not handled: ${n}`)}}}g&&!g.relurl?(h.pop(),p-=g.duration,d.partList&&(d.fragmentHint=g)):d.partList&&(rv(v,g),v.cc=f,d.fragmentHint=v,l&&rb(v,l,d));let T=h.length,A=h[0],_=h[T-1];if((p+=d.skippedSegments*d.targetduration)>0&&T&&_){d.averagetargetduration=p/T;let e=_.sn;d.endSN="initSegment"!==e?e:0,d.live||(_.endList=!0),A&&(d.startCC=A.cc)}else d.endSN=0,d.startCC=0;return d.fragmentHint&&(p+=d.fragmentHint.duration),d.totalduration=p,d.endCC=f,E>0&&function(e,t){let i=e[t];for(let r=t;r--;){let t=e[r];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(h,E),d}}function rp(e,t,i){var r,a;let s=new t1(e);i4(i,s,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);let n=null!=(r=s.METHOD)?r:"",o=s.URI,l=s.hexadecimalInteger("IV"),d=s.KEYFORMATVERSIONS,h=null!=(a=s.KEYFORMAT)?a:"identity";return o&&s.IV&&!l&&tZ.error(`Invalid IV: ${s.IV}`),new i2(n,o?rm.resolve(o,t):"",h,(d||"1").split("/").map(Number).filter(Number.isFinite),l)}function rf(e){let t=new t1(e).decimalFloatingPoint("TIME-OFFSET");return tG(t)?t:null}function rg(e,t,i){let r=t[i];r&&(e[i]=r)}function rv(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),tG(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function rE(e,t,i,r){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",r&&(e.levelkeys=r),e.initSegment=null}function rb(e,t,i){e.levelkeys=t;let{encryptedFragments:r}=i;(!r.length||r[r.length-1].levelkeys!==t)&&Object.keys(t).some(e=>t[e].isCommonEncryption)&&r.push(e)}var ry="manifest",rT="level",rA="audioTrack",r_="subtitleTrack",rk="main",rS="audio",rw="subtitle";function rL(e){let{type:t}=e;switch(t){case rA:return rS;case r_:return rw;default:return rk}}function rR(e,t){let i=e.url;return(void 0===i||0===i.indexOf("data:"))&&(i=t.url),i}class rI{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}
1startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){let{hls:e}=this;e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.LEVEL_LOADING,this.onLevelLoading,this),e.on(tq.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(tq.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){let{hls:e}=this;e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.LEVEL_LOADING,this.onLevelLoading,this),e.off(tq.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(tq.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){let t=this.hls.config,i=t.pLoader,r=t.loader,a=new(i||r)(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(let e in this.loaders){let t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){let{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ry,url:i,deliveryDirectives:null})}onLevelLoading(e,t){let{id:i,level:r,pathwayId:a,url:s,deliveryDirectives:n}=t;this.load({id:i,level:r,pathwayId:a,responseType:"text",type:rT,url:s,deliveryDirectives:n})}onAudioTrackLoading(e,t){let{id:i,groupId:r,url:a,deliveryDirectives:s}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:rA,url:a,deliveryDirectives:s})}onSubtitleTrackLoading(e,t){let{id:i,groupId:r,url:a,deliveryDirectives:s}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:r_,url:a,deliveryDirectives:s})}load(e){var t;let i,r=this.hls.config,a=this.getInternalLoader(e);if(a){let t=a.context;if(t&&t.url===e.url&&t.level===e.level)return void tZ.trace("[playlist-loader]: playlist request ongoing");tZ.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),a.abort()}if(i=e.type===ry?r.manifestLoadPolicy.default:tW({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),a=this.createInternalLoader(e),tG(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===rT&&null!==e.level?t=this.hls.levels[e.level].details:e.type===rA&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===r_&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){let e=t.partTarget,r=t.targetduration;if(e&&r){let t=1e3*Math.max(3*e,.8*r);i=tW({},i,{maxTimeToFirstByteMs:Math.min(t,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,i.maxTimeToFirstByteMs)})}}}let s=i.errorRetry||i.timeoutRetry||{},n={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0};a.load(e,n,{onSuccess:(e,t,i,r)=>{let a=this.getInternalLoader(i);this.resetInternalLoader(i.type);let s=e.data;0!==s.indexOf("#EXTM3U")?this.handleManifestParsingError(e,i,Error("no EXTM3U delimiter"),r||null,t):(t.parsing.start=performance.now(),rm.isMediaPlaylist(s)?this.handleTrackOrLevelPlaylist(e,t,i,r||null,a):this.handleMasterPlaylist(e,t,i,r))},onError:(e,t,i,r)=>{this.handleNetworkError(t,i,!1,e,r)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}})}handleMasterPlaylist(e,t,i,r){let a=this.hls,s=e.data,n=rR(e,i),o=rm.parseMasterPlaylist(s,n);if(o.playlistParsingError)return void this.handleManifestParsingError(e,i,o.playlistParsingError,r,t);let{contentSteering:l,levels:d,sessionData:h,sessionKeys:u,startTimeOffset:c,variableList:m}=o;this.variableList=m;let{AUDIO:p=[],SUBTITLES:f,"CLOSED-CAPTIONS":g}=rm.parseMasterPlaylistMedia(s,n,o);p.length&&(p.some(e=>!e.url)||!d[0].audioCodec||d[0].attrs.AUDIO||(tZ.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new t1({}),bitrate:0,url:""}))),a.trigger(tq.MANIFEST_LOADED,{levels:d,audioTracks:p,subtitles:f,captions:g,contentSteering:l,url:n,stats:t,networkDetails:r,sessionData:h,sessionKeys:u,startTimeOffset:c,variableList:m})}handleTrackOrLevelPlaylist(e,t,i,r,a){let s=this.hls,{id:n,level:o,type:l}=i,d=rR(e,i),h=tG(o)?o:tG(n)?n:0,u=rL(i),c=rm.parseLevelPlaylist(e.data,d,h,u,0,this.variableList);if(l===ry){let e={attrs:new t1({}),bitrate:0,details:c,name:"",url:d};s.trigger(tq.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=c,this.handlePlaylistLoaded(c,e,t,i,r,a)}handleManifestParsingError(e,t,i,r,a){this.hls.trigger(tq.ERROR,{type:tj.NETWORK_E
1RROR,details:tY.MANIFEST_PARSING_ERROR,fatal:t.type===ry,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:a})}handleNetworkError(e,t,i=!1,r,a){let s=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===rT?s+=`: ${e.level} id: ${e.id}`:(e.type===rA||e.type===r_)&&(s+=` id: ${e.id} group-id: "${e.groupId}"`);let n=Error(s);tZ.warn(`[playlist-loader]: ${s}`);let o=tY.UNKNOWN,l=!1,d=this.getInternalLoader(e);switch(e.type){case ry:o=i?tY.MANIFEST_LOAD_TIMEOUT:tY.MANIFEST_LOAD_ERROR,l=!0;break;case rT:o=i?tY.LEVEL_LOAD_TIMEOUT:tY.LEVEL_LOAD_ERROR,l=!1;break;case rA:o=i?tY.AUDIO_TRACK_LOAD_TIMEOUT:tY.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case r_:o=i?tY.SUBTITLE_TRACK_LOAD_TIMEOUT:tY.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);let h={type:tj.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:d,context:e,error:n,networkDetails:t,stats:a};r&&(h.response=tH({url:(null==t?void 0:t.url)||e.url,data:void 0},r)),this.hls.trigger(tq.ERROR,h)}handlePlaylistLoaded(e,t,i,r,a,s){let n=this.hls,{type:o,level:l,id:d,groupId:h,deliveryDirectives:u}=r,c=rR(t,r),m=rL(r),p="number"==typeof r.level&&m===rk?l:void 0;if(!e.fragments.length){let e=Error("No Segments found in Playlist");n.trigger(tq.ERROR,{type:tj.NETWORK_ERROR,details:tY.LEVEL_EMPTY_ERROR,fatal:!1,url:c,error:e,reason:e.message,response:t,context:r,level:p,parent:m,networkDetails:a,stats:i});return}e.targetduration||(e.playlistParsingError=Error("Missing Target Duration"));let f=e.playlistParsingError;if(f)return void n.trigger(tq.ERROR,{type:tj.NETWORK_ERROR,details:tY.LEVEL_PARSING_ERROR,fatal:!1,url:c,error:f,reason:f.message,response:t,context:r,level:p,parent:m,networkDetails:a,stats:i});switch(e.live&&s&&(s.getCacheAge&&(e.ageHeader=s.getCacheAge()||0),(!s.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),o){case ry:case rT:n.trigger(tq.LEVEL_LOADED,{details:e,level:p||0,id:d||0,stats:i,networkDetails:a,deliveryDirectives:u});break;case rA:n.trigger(tq.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:a,deliveryDirectives:u});break;case r_:n.trigger(tq.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:a,deliveryDirectives:u})}}}function rC(e,t){let i;try{i=new Event("addtrack")}catch(e){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function rD(e,t){let i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw Error(`addCue is failed for: ${t}`)}catch(i){tZ.debug(`[texttrack-utils]: ${i}`);try{let i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){tZ.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===i&&(e.mode=i)}function rx(e){let t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(let t=e.cues.length;t--;)e.removeCue(e.cues[t]);"disabled"===t&&(e.mode=t)}function rM(e,t,i,r){let a=e.mode;if("disabled"===a&&(e.mode="hidden"),e.cues&&e.cues.length>0){let a=function(e,t,i){let r=[],a=function(e,t){if(t<e[0].startTime)return 0;let i=e.length-1;if(t>e[i].endTime)return -1;let r=0,a=i;for(;r<=a;){let s=Math.floor((a+r)/2);if(t<e[s].startTime)a=s-1;else{if(!(t>e[s].startTime)||!(r<i))return s;r=s+1}}return e[r].startTime-t<t-e[a].startTime?r:a}(e,t);if(a>-1)for(let s=a,n=e.length;s<n;s++){let a=e[s];if(a.startTime>=t&&a.endTime<=i)r.push(a);else if(a.startTime>i)break}return r}(e.cues,t,i);for(let t=0;t<a.length;t++)(!r||r(a[t]))&&e.removeCue(a[t])}"disabled"===a&&(e.mode=a)}function rO(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i];("subtitles"===r.kind||"captions"===r.kind)&&r.label&&t.push(e[i])}return t}var rP="org.id3",rN="https://aomedia.org/emsg/ID3";function rU(){if("u">typeof self)return self.VTTCue||self.TextTrackCue}function rF(e,t,i,r,a){let s=new e(t,i,"");try{s.value=r,a&&(s.type=a)}catch(n){s=new e(t,i,JSON.stringify(a?tH({type:a},r):r))}return s}let rB=(()=>{let e=rU();try{e&&new e(0,1/0,"")}catch(e){return Number.MAX_VALUE}return 1/0})();function r$(e,t){return e.getTime()/1e3-t}class rH{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){let{hls:e}=this;
1e.on(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(tq.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(tq.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){let{hls:e}=this;e.off(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(tq.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(tq.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(rx(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){let t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){let i=e[t];if("metadata"===i.kind&&"id3"===i.label)return rC(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;let{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:r}}}=this;if(!i&&!r)return;let{samples:a}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));let s=rU();if(s)for(let e=0;e<a.length;e++){let t=a[e].type;if(t===rN&&!i||!r)continue;let n=iI(a[e].data);{let i=a[e].pts,r=i+a[e].duration;r>rB&&(r=rB),r-i<=0&&(r=i+.25);for(let e=0;e<n.length;e++){let a=n[e];if(!iL(a)){this.updateId3CueEnds(i,t);let e=rF(s,i,r,a,t);e&&this.id3Track.addCue(e)}}}}}updateId3CueEnds(e,t){var i;let r=null==(i=this.id3Track)?void 0:i.cues;if(r)for(let i=r.length;i--;){let a=r[i];a.type===t&&a.startTime<e&&a.endTime===rB&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){let{id3Track:a,hls:s}=this;if(!s)return;let{config:{enableEmsgMetadataCues:n,enableID3MetadataCues:o}}=s;a&&(n||o)&&rM(a,t,i,"audio"===r?e=>e.type===rP&&o:"video"===r?e=>e.type===rN&&n:e=>e.type===rP&&o||e.type===rN&&n)}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;let{dateRangeCuesAppended:i,id3Track:r}=this,{dateRanges:a}=t,s=Object.keys(a);if(r){let e=Object.keys(i).filter(e=>!s.includes(e));for(let t=e.length;t--;){let a=e[t];Object.keys(i[a].cues).forEach(e=>{r.removeCue(i[a].cues[e])}),delete i[a]}}let n=t.fragments[t.fragments.length-1];if(0===s.length||!tG(null==n?void 0:n.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));let o=n.programDateTime/1e3-n.start,l=rU();for(let e=0;e<s.length;e++){let t=s[e],r=a[t],n=r$(r.startDate,o),h=i[t],u=(null==h?void 0:h.cues)||{},c=(null==h?void 0:h.durationKnown)||!1,m=rB,p=r.endDate;if(p)m=r$(p,o),c=!0;else if(r.endOnNext&&!c){let e=s.reduce((e,t)=>{if(t!==r.id){let i=a[t];if(i.class===r.class&&i.startDate>r.startDate&&(!e||r.startDate<e.startDate))return i}return e},null);e&&(m=r$(e.startDate,o),c=!0)}let f=Object.keys(r.attr);for(let e=0;e<f.length;e++){var d;let i=f[e];if("ID"===i||"CLASS"===i||"START-DATE"===i||"DURATION"===i||"END-DATE"===i||"END-ON-NEXT"===i)continue;let a=u[i];if(a)c&&!h.durationKnown&&(a.endTime=m);else if(l){let e=r.attr[i];("SCTE35-OUT"===i||"SCTE35-IN"===i)&&(d=e,e=Uint8Array.from(d.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer);let a=rF(l,n,m,{key:i,data:e},"com.apple.quicktime.HLS");a&&(a.id=t,this.id3Track.addCue(a),u[i]=a)}}i[t]={cues:u,dateRange:r,durationKnown:c}}}}class rW{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){let{config:e,levelDetails:t}=this;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){let{levelDetails:e}=this;if(null===e)return null;let{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:a,liveSyncDurationCount:s,lowLatencyMode:n}=this.config,o=this.hls.userConfig,l=n&&i||t;return(o.liveSyncDuration||o.liveSyncDurationCount||0===l)&&(l=void 0!==a?a:s*r),l+Math.min(+this.stallCount,r)}get liveSyncPosition(){let e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(null===e||null===t||null===i)return null;let r=i.edge,a=e-t-this.edgeStalled;return Math.min(Math.max(r-i.totalduration,a),r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration))}get drift(){let{levelDetails:e}=this;return null===e?1:e.drift}get edgeStalled(){let{levelDetails:e}=this;if(null===e)return 0;let t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){let{media:e,levelDetails:t}=this;if(!e||!t)return 0;let i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}
1registerListeners(){this.hls.on(tq.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(tq.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(tq.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(tq.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(tq.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(tq.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(tq.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(tq.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===tY.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(i=this.levelDetails)&&i.live&&tZ.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){let{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;let i=this.computeLatency();if(null===i)return;this._latency=i;let{lowLatencyMode:r,maxLiveSyncPlaybackRate:a}=this.config;if(!r||1===a||!t.live)return;let s=this.targetLatency;if(null===s)return;let n=i-s;n<Math.min(this.maxLatency,s+t.targetduration)&&n>.05&&this.forwardBufferLength>1?e.playbackRate=Math.min(Math.min(2,Math.max(1,a)),Math.max(1,Math.round(2/(1+Math.exp(-.75*n-this.edgeStalled))*20)/20)):1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}estimateLiveEdge(){let{levelDetails:e}=this;return null===e?null:e.edge+e.age}computeLatency(){let e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}let rG=["NONE","TYPE-0","TYPE-1",null],rV=["SDR","PQ","HLG"];function rK(e){let{canSkipUntil:t,canSkipDateRanges:i,age:r}=e;return t&&r<t/2?i?"v2":"YES":""}class rq{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){let t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class rj{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(e=>!!e).map(e=>e.substring(0,4)).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return rY(this._audioGroups,e)}hasSubtitleGroup(e){return rY(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function rY(e,t){return!!t&&!!e&&-1!==e.indexOf(t)}function rz(e,t){let i=t.startPTS;if(tG(i)){let r,a=0;t.sn>e.sn?(a=i-e.start,r=e):(a=e.start-i,r=t),r.duration!==a&&(r.duration=a)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function rX(e,t,i,r,a,s){let n;r-i<=0&&(tZ.warn("Fragment should have a positive duration",t),r=i+t.duration,s=a+t.duration);let o=i,l=r,d=t.startPTS,h=t.endPTS;if(tG(d)){let e=Math.abs(d-i);tG(t.deltaPTS)?t.deltaPTS=Math.max(e,t.deltaPTS):t.deltaPTS=e,o=Math.max(i,d),i=Math.min(i,d),a=Math.min(a,t.startDTS),l=Math.min(r,h),r=Math.max(r,h),s=Math.max(s,t.endDTS)}let u=i-t.start;0!==t.start&&(t.start=i),t.duration=r-t.start,t.startPTS=i,t.maxStartPTS=o,t.startDTS=a,t.endPTS=r,t.minEndPTS=l,t.endDTS=s;let c=t.sn;if(!e||c<e.startSN||c>e.endSN)return 0;let m=c-e.startSN,p=e.fragments;for(p[m]=t,n=m;n>0;n--)rz(p[n],p[n-1]);for(n=m;n<p.length-1;n++)rz(p[n],p[n+1]);return e.fragmentHint&&rz(p[p.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,u}function rQ(e,t){let i=t.startSN+t.skippedSegments-e.startSN,r=e.fragments;i<0||i>=r.length||rZ(t,r[i].start)}function rZ(e,t){if(t){let i=e.fragments;for(let r=e.skippedSegments;r<i.length;r++)i[r].start+=t;e.fragmentHint&&(e.fragmentHint.start+=t)}}function rJ(e,t,i){var r;return null!=e&&e.details?r0(null==(r=e.details)?void 0:r.partList,t,i):null}function r0(e,t,i){if(e)for(let r=e.length;r--;){let a=e[r];if(a.index===i&&a.fragment.sn===t)return a}return null}function r1(e){e.forEach((e,t)=>{let{details:i}=e;
1null!=i&&i.fragments&&i.fragments.forEach(e=>{e.level=t})})}function r2(e){switch(e.details){case tY.FRAG_LOAD_TIMEOUT:case tY.KEY_LOAD_TIMEOUT:case tY.LEVEL_LOAD_TIMEOUT:case tY.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function r3(e,t){let i=r2(t);return e.default[`${i?"timeout":"error"}Retry`]}function r4(e,t){return Math.min(("linear"===e.backoff?1:Math.pow(2,t))*e.retryDelayMs,e.maxRetryDelayMs)}function r5(e){return tH(tH({},e),{errorRetry:null,timeoutRetry:null})}function r8(e,t,i,r){var a;if(!e)return!1;let s=null==r?void 0:r.code,n=t<e.maxNumRetry&&(0===(a=s)&&!1===navigator.onLine||!!a&&(a<400||a>499)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,r,n):n}let r9=function(e,t){let i=0,r=e.length-1,a=null,s=null;for(;i<=r;){let n=t(s=e[a=(i+r)/2|0]);if(n>0)i=a+1;else{if(!(n<0))return s;r=a-1}}return null};function r6(e,t,i=0,r=0,a=.005){let s=null;if(e){s=t[e.sn-t[0].sn+1]||null;let r=e.endDTS-i;r>0&&r<15e-7&&(i+=15e-7)}else 0===i&&0===t[0].start&&(s=t[0]);if(s&&((!e||e.level===s.level)&&0===r7(i,r,s)||function(e,t,i){if(t&&0===t.start&&t.level<e.level&&(t.endPTS||0)>0){let r=t.tagList.reduce((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e),i);return e.start<=r}return!1}(s,e,Math.min(a,r))))return s;let n=r9(t,r7.bind(null,i,r));return n&&(n!==e||!s)?n:s}function r7(e=0,t=0,i){if(i.start<=e&&i.start+i.duration>e)return 0;let r=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-r<=e?1:i.start-r>e&&i.start?-1:0}class ae{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=tZ.log.bind(tZ,`${t}:`),this.warn=tZ.warn.bind(tZ,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){let r=null==t?void 0:t.renditionReports;if(r){let a=-1;for(let i=0;i<r.length;i++){let s,n=r[i];try{s=new self.URL(n.URI,t.url).href}catch(e){tZ.warn(`Could not construct new URL for Rendition Report: ${e}`),s=n.URI||""}if(s===e){a=i;break}s===e.substring(0,s.length)&&(a=i)}if(-1!==a){let e=r[a],s=parseInt(e["LAST-MSN"])||(null==t?void 0:t.lastPartSn),n=parseInt(e["LAST-PART"])||(null==t?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){let e=Math.min(t.age-t.partTarget,t.targetduration);n>=0&&e>t.partTarget&&(n+=1)}return new rq(s,n>=0?n:void 0,i&&rK(i))}}}loadPlaylist(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return -1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){let{details:r,stats:a}=t,s=self.performance.now(),n=a.loading.first?Math.max(0,s-a.loading.first):0;if(r.advancedDateTime=Date.now()-n,r.live||null!=i&&i.live){let n,o,l;if(r.reloaded(i),i&&this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),i&&r.fragments.length>0&&function(e,t){let i,r=null,a=e.fragments;for(let e=a.length-1;e>=0;e--){let t=a[e].initSegment;if(t){r=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS,function(e,t,i){let r=t.skippedSegments,a=Math.max(e.startSN,t.startSN)-t.startSN,s=+!!e.fragmentHint+(r?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,n=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let e=a;e<=s;e++){let a=l[n+e],s=o[e];r&&!s&&e<r&&(s=t.fragments[e]=a),a&&s&&i(a,s,e,o)}}(e,t,(e,a,s,n)=>{if(t.skippedSegments&&a.cc!==e.cc){let t=e.cc-a.cc;for(let e=s;e<n.length;e++)n[e].cc+=t}tG(e.startPTS)&&tG(e.endPTS)&&(a.start=a.startPTS=e.startPTS,a.startDTS=e.startDTS,a.maxStartPTS=e.maxStartPTS,a.endPTS=e.endPTS,a.endDTS=e.endDTS,a.minEndPTS=e.minEndPTS,a.duration=e.endPTS-e.startPTS,a.duration&&(i=a),t.PTSKnown=t.alignedSliding=!0),a.elementaryStreams=e.elementaryStreams,a.loader=e.loader,a.stats=e.stats,e.initSegment&&(a.initSegment=e.initSegment,r=e.initSegment)});let s=t.fragments;
1if(r&&(t.fragmentHint?s.concat(t.fragmentHint):s).forEach(e=>{var t;e&&(!e.initSegment||e.initSegment.relurl===(null==(t=r)?void 0:t.relurl))&&(e.initSegment=r)}),t.skippedSegments){if(t.deltaUpdateFailed=s.some(e=>!e),t.deltaUpdateFailed){tZ.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)s.shift();t.startSN=s[0].sn}else{var n,o,l;let i;t.canSkipDateRanges&&(n=e.dateRanges,o=t.dateRanges,l=t.recentlyRemovedDateranges,i=tW({},n),l&&l.forEach(e=>{delete i[e]}),Object.keys(o).forEach(e=>{let t=new t2(o[e].attr,i[e]);t.isValid?i[e]=t:tZ.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(o[e].attr)}"`)}),t.dateRanges=i)}t.startCC=t.fragments[0].cc,t.endCC=s[s.length-1].cc}(function(e,t,i){if(e&&t){let r=0;for(let a=0,s=e.length;a<=s;a++){let s=e[a],n=t[a+r];s&&n&&s.index===n.index&&s.fragment.sn===n.fragment.sn?i(s,n):r--}}})(e.partList,t.partList,(e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),i?rX(t,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS):rQ(e,t),s.length&&(t.totalduration=t.edge-s[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;let d=t.advancedDateTime;if(t.advanced&&d){let e=t.edge;t.driftStart||(t.driftStartTime=d,t.driftStart=e),t.driftEndTime=d,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}(i,r),!this.canLoad||!r.live)return;if(r.canBlockReload&&r.endSN&&r.advanced){let e=this.hls.config.lowLatencyMode,a=r.lastPartSn,s=r.endSN,d=r.lastPartIndex,h=a===s;-1!==d?(o=h?s+1:a,l=h?e?0:d:d+1):o=s+1;let u=r.age,c=Math.min(u+r.ageHeader-r.partTarget,1.5*r.targetduration);if(c>0){if(i&&c>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${c} with playlist age: ${r.age}`),c=0;else{let e=Math.floor(c/r.targetduration);o+=e,void 0!==l&&(l+=Math.round(c%r.targetduration/r.partTarget)),this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${u.toFixed(2)}s goal: ${c} skip sn ${e} to part ${l}`)}r.tuneInGoal=c}if(n=this.getDeliveryDirectives(r,t.deliveryDirectives,o,l),e||!h)return void this.loadPlaylist(n)}else(r.canBlockReload||r.canSkipUntil)&&(n=this.getDeliveryDirectives(r,t.deliveryDirectives,o,l));let d=this.hls.mainForwardBufferInfo,h=d?d.end-d.len:0,u=(r.edge-h)*1e3,c=function(e,t=1/0){let i=1e3*e.targetduration;if(e.updated){let r=e.fragments;if(r.length&&4*i>t){let e=1e3*r[r.length-1].duration;e<i&&(i=e)}}else i/=2;return Math.round(i)}(r,u);r.updated&&s>this.requestScheduled+c&&(this.requestScheduled=a.loading.start),void 0!==o&&r.canBlockReload?this.requestScheduled=a.loading.first+c-(1e3*r.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+c<s?this.requestScheduled=s:this.requestScheduled-s<=0&&(this.requestScheduled+=c);let m=this.requestScheduled-s;m=Math.max(0,m),this.log(`reload live playlist ${e} in ${Math.round(m)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(n),m)}else this.clearTimer()}getDeliveryDirectives(e,t,i,r){let a=rK(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,a=""),new rq(i,r,a)}checkRetry(e){let t=e.details,i=r2(e),r=e.errorAction,{action:a,retryCount:s=0,retryConfig:n}=r||{},o=!!r&&!!n&&(5===a||!r.resolved&&2===a);if(o){var l;if(this.requestScheduled=-1,s>=n.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${n.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{let e=r4(n,s);this.timer=self.setTimeout(()=>this.loadPlaylist(),e),this.warn(`Retrying playlist loading ${s+1}/${n.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,r.resolved=!0}return o}}class at{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){let i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class ai{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_
1=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new at(e),this.fast_=new at(t),this.defaultTTFB_=r,this.ttfb_=new at(e)}update(e,t){let{slow_:i,fast_:r,ttfb_:a}=this;i.halfLife!==e&&(this.slow_=new at(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new at(t,r.getEstimate(),r.getTotalWeight())),a.halfLife!==e&&(this.ttfb_=new at(e,a.getEstimate(),a.getTotalWeight()))}sample(e,t){let i=(e=Math.max(e,this.minDelayMs_))/1e3,r=8*t/i;this.fast_.sample(i,r),this.slow_.sample(i,r)}sampleTTFB(e){let t=Math.sqrt(2)*Math.exp(-Math.pow(e/1e3,2)/2);this.ttfb_.sample(t,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}let ar={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},aa={};function as(e,t){tZ.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function an(e,t,i){if("attrs"in e){let i=t.indexOf(e);if(-1!==i)return i}for(let r=0;r<t.length;r++)if(ao(e,t[r],i))return r;return -1}function ao(e,t,i){let{groupId:r,name:a,lang:s,assocLang:n,default:o}=e,l=e.forced;return(void 0===r||t.groupId===r)&&(void 0===a||t.name===a)&&(void 0===s||t.lang===s)&&(void 0===s||t.assocLang===n)&&(void 0===o||t.default===o)&&(void 0===l||t.forced===l)&&(!("characteristics"in e)||function(e,t=""){let i=e.split(","),r=t.split(",");return i.length===r.length&&!i.some(e=>-1===r.indexOf(e))}(e.characteristics||"",t.characteristics))&&(void 0===i||i(e,t))}function al(e,t){let{audioCodec:i,channels:r}=e;return(void 0===i||(t.audioCodec||"").substring(0,4)===i.substring(0,4))&&(void 0===r||r===(t.channels||"2"))}function ad(e,t,i){for(let r=t;r>-1;r--)if(i(e[r]))return r;for(let r=t+1;r<e.length;r++)if(i(e[r]))return r;return -1}class ah{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var au="NOT_LOADED",ac="APPENDING",am="PARTIAL";class ap{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){let{hls:e}=this;e.on(tq.BUFFER_APPENDED,this.onBufferAppended,this),e.on(tq.FRAG_BUFFERED,this.onFragBuffered,this),e.on(tq.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){let{hls:e}=this;e.off(tq.BUFFER_APPENDED,this.onBufferAppended,this),e.off(tq.FRAG_BUFFERED,this.onFragBuffered,this),e.off(tq.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){let i=this.activePartLists[t];if(i)for(let t=i.length;t--;){let r=i[t];if(!r)break;let a=r.end;if(r.start<=e&&null!==a&&e<=a)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){let{fragments:i}=this,r=Object.keys(i);for(let a=r.length;a--;){let s=i[r[a]];if((null==s?void 0:s.body.type)===t&&s.buffered){let t=s.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,i,r){this.timeRanges&&(this.timeRanges[e]=t);let a=(null==r?void 0:r.fragment.sn)||-1;
1Object.keys(this.fragments).forEach(r=>{let s=this.fragments[r];if(!s||a>=s.body.sn)return;if(!s.buffered&&!s.loaded){s.body.type===i&&this.removeFragment(s.body);return}let n=s.range[e];n&&n.time.some(e=>{let i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(s.body),i})})}detectPartialFragments(e){let t=this.timeRanges,{frag:i,part:r}=e;if(!t||"initSegment"===i.sn)return;let a=ag(i),s=this.fragments[a];if(!s||s.buffered&&i.gap)return;let n=!i.relurl;Object.keys(t).forEach(e=>{let a=i.elementaryStreams[e];if(!a)return;let o=t[e],l=n||!0===a.partial;s.range[e]=this.getBufferedTimes(i,r,l,o)}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,(s.body.endList=i.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),af(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){let i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(t=>t.fragment.sn>=e))}fragBuffered(e,t){let i=ag(e),r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){let a={time:[],partial:i},s=e.start,n=e.end,o=e.minEndPTS||n,l=e.maxStartPTS||s;for(let e=0;e<r.length;e++){let t=r.start(e)-this.bufferPadding,i=r.end(e)+this.bufferPadding;if(l>=t&&o<=i){a.time.push({startPTS:Math.max(s,r.start(e)),endPTS:Math.min(n,r.end(e))});break}if(s<i&&n>t){let t=Math.max(s,r.start(e)),i=Math.min(n,r.end(e));i>t&&(a.partial=!0,a.time.push({startPTS:t,endPTS:i}))}else if(n<=t)break}return a}getPartialFragment(e){let t,i,r,a=null,s=0,{bufferPadding:n,fragments:o}=this;return Object.keys(o).forEach(l=>{let d=o[l];d&&af(d)&&(i=d.body.start-n,r=d.body.end+n,e>=i&&e<=r&&s<=(t=Math.min(e-i,r-e))&&(a=d.body,s=t))}),a}isEndListAppended(e){let t=this.endListFragments[e];return void 0!==t&&(t.buffered||af(t))}getState(e){let t=ag(e),i=this.fragments[t];if(i)if(!i.buffered)return ac;else if(af(i))return am;else return"OK";return au}isTimeBuffered(e,t,i){let r,a;for(let s=0;s<i.length;s++){if(r=i.start(s)-this.bufferPadding,a=i.end(s)+this.bufferPadding,e>=r&&t<=a)return!0;if(t<=r)break}return!1}onFragLoaded(e,t){let{frag:i,part:r}=t;if("initSegment"===i.sn||i.bitrateTest)return;let a=ag(i);this.fragments[a]={body:i,appendedPTS:null,loaded:r?null:t,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){let{frag:i,part:r,timeRanges:a}=t;if("initSegment"===i.sn)return;let s=i.type;if(r){let e=this.activePartLists[s];e||(this.activePartLists[s]=e=[]),e.push(r)}this.timeRanges=a,Object.keys(a).forEach(e=>{let t=a[e];this.detectEvictedFragments(e,t,s,r)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){let t=ag(e);return!!this.fragments[t]}hasParts(e){var t;return!!(null!=(t=this.activePartLists[e])&&t.length)}removeFragmentsInRange(e,t,i,r,a){(!r||this.hasGaps)&&Object.keys(this.fragments).forEach(s=>{let n=this.fragments[s];if(!n)return;let o=n.body;o.type===i&&(!r||o.gap)&&o.start<t&&o.end>e&&(n.buffered||a)&&this.removeFragment(o)})}removeFragment(e){let t=ag(e);e.stats.loaded=0,e.clearElementaryStreamInfo();let i=this.activePartLists[e.type];if(i){let t=e.sn;this.activePartLists[e.type]=i.filter(e=>e.fragment.sn!==t)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function af(e){var t,i,r;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(i=e.range.audio)?void 0:i.partial)||(null==(r=e.range.audiovideo)?void 0:r.partial))}function ag(e){return`${e.type}_${e.level}_${e.sn}`}let av={length:0,start:()=>0,end:()=>0};class aE{static isBuffered(e,t){try{if(e){let i=aE.getBuffered(e);for(let e=0;e<i.length;e++)if(t>=i.start(e)&&t<=i.end(e))return!0}}catch(e){}return!1}static bufferInfo(e,t,i){try{if(e){let r,a=aE.getBuffered(e),s=[];for(r=0;r<a.length;r++)s.push({start:a.start(r),end:a.end(r)});return this.bufferedInfo(s,t,i)}}catch(e){}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,i){let r;t=Math.max(0,t),e.sort(function(e,t){let i=e.start-t.start;return i||t.end-e.end});let a=[];if(i)for(let t=0;t<e.length;t++){let r=a.length;if(r){let s=a[r-1].end;e[t].start-s<i?e[t].end>s&&(a[r-1].end=e[t].end):a.push(e[t])}else a.push(e[t])}else a=e;let s=0,n=t,o=t;for(let e=0;e<a.length;e++){let l=a[e].start,d=a[e].end;if(t+i>=l&&t<d)n=l,s=(o=d)-t;else if(t+i<l){r=l;break}}return{len:s,start:n||0,end:o||0,nextStart:r}}static getBuffered(e){try{return e.buffered}catch(e){return tZ.log("failed to get media.buffered",e),av}}}class ab{constructor(e,t,i,r=0,a=-1,s=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=ay(),this.buffering={audio:ay(),video:ay(),audiovideo:ay()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=a,this.partial=s}}function ay(){return{start:0,executeStart:0,executeEnd:0,end:0}}function aT(e,t){for(let r=0,a=e.length;r<a;r++){var i;if((null==(i=e[r])?void 0:i.cc)===t)return e[r]}return null}function aA(e,t){if(e){let i=e.start+t;e.start=e.startPTS=i,e.endPTS=i+e.duration}}function a_(e,t){let i=t.fragments;for(let t=0,r=i.length;t<r;t++)aA(i[t],e);t.fragmentHint&&aA(t.fragmentHint,e),t.alignedSliding=!0}function ak(e,t){let i,r;if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;let a=e.fragments,s=t.fragments;if(!a.length||!s.length)return;let n=Math.min(t.endCC,e.endCC);
1t.startCC<n&&e.startCC<n&&(i=aT(s,n),r=aT(a,n)),i&&r||(r=aT(a,(i=s[Math.floor(s.length/2)]).cc)||a[Math.floor(a.length/2)]);let o=i.programDateTime,l=r.programDateTime;o&&l&&a_((l-o)/1e3-(r.start-i.start),e)}class aS{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){let i=e.url;if(!i)return Promise.reject(new aR({type:tj.NETWORK_ERROR,details:tY.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();let r=this.config,a=r.fLoader,s=r.loader;return new Promise((n,o)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(e=>"GAP"===e[0]))return void o(aL(e));else e.gap=!1;let l=this.loader=e.loader=a?new a(r):new s(r),d=aw(e),h=r5(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:131072};e.stats=l.stats,l.load(d,u,{onSuccess:(t,i,r,a)=>{this.resetLoader(e,l);let s=t.data;r.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),n({frag:e,part:null,payload:s,networkDetails:a})},onError:(t,r,a,s)=>{this.resetLoader(e,l),o(new aR({type:tj.NETWORK_ERROR,details:tY.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:tH({url:i,data:void 0},t),error:Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:a,stats:s}))},onAbort:(t,i,r)=>{this.resetLoader(e,l),o(new aR({type:tj.NETWORK_ERROR,details:tY.INTERNAL_ABORTED,fatal:!1,frag:e,error:Error("Aborted"),networkDetails:r,stats:t}))},onTimeout:(t,i,r)=>{this.resetLoader(e,l),o(new aR({type:tj.NETWORK_ERROR,details:tY.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:Error(`Timeout after ${u.timeout}ms`),networkDetails:r,stats:t}))},onProgress:(i,r,a,s)=>{t&&t({frag:e,part:null,payload:a,networkDetails:s})}})})}loadPart(e,t,i){this.abort();let r=this.config,a=r.fLoader,s=r.loader;return new Promise((n,o)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void o(aL(e,t));let l=this.loader=e.loader=a?new a(r):new s(r),d=aw(e,t),h=r5(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:131072};t.stats=l.stats,l.load(d,u,{onSuccess:(r,a,s,o)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);let d={frag:e,part:t,payload:r.data,networkDetails:o};i(d),n(d)},onError:(i,r,a,s)=>{this.resetLoader(e,l),o(new aR({type:tj.NETWORK_ERROR,details:tY.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:tH({url:d.url,data:void 0},i),error:Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:a,stats:s}))},onAbort:(i,r,a)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),o(new aR({type:tj.NETWORK_ERROR,details:tY.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:Error("Aborted"),networkDetails:a,stats:i}))},onTimeout:(i,r,a)=>{this.resetLoader(e,l),o(new aR({type:tj.NETWORK_ERROR,details:tY.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:Error(`Timeout after ${u.timeout}ms`),networkDetails:a,stats:i}))}})})}updateStatsFromPart(e,t){let i=e.stats,r=t.stats,a=r.total;if(i.loaded+=r.loaded,a){let r=Math.round(e.duration/t.duration),s=Math.min(Math.round(i.loaded/a),r),n=(r-s)*Math.round(i.loaded/s);i.total=i.loaded+n}else i.total=Math.max(i.loaded,i.total);let s=i.loading,n=r.loading;s.start?s.first+=n.first-n.start:(s.start=n.start,s.first=n.first),s.end=n.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function aw(e,t=null){let i=t||e,r={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},a=i.byteRangeStartOffset,s=i.byteRangeEndOffset;if(tG(a)&&tG(s)){var n;let t=a,i=s;if("initSegment"===e.sn&&(null==(n=e.decryptdata)?void 0:n.method)==="AES-128"){let e=s-a;e%16&&(i=s+(16-e%16)),0!==a&&(r.resetIV=!0,t=a-16)}r.rangeStart=t,r.rangeEnd=i}return r}function aL(e,t){let i=Error(`GAP ${e.gap?"tag":"attribute"} found`),r={type:tj.MEDIA_ERROR,details:tY.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(r.part=t),(t||e).stats.aborted=!0,new aR(r)}
1class aR extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class aI{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class aC{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class aD{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){let t=new DataView(e),i=new Uint32Array(4);for(let e=0;e<4;e++)i[e]=t.getUint32(4*e);return i}initTable(){let e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],a=i[1],s=i[2],n=i[3],o=this.invSubMix,l=o[0],d=o[1],h=o[2],u=o[3],c=new Uint32Array(256),m=0,p=0,f=0;for(f=0;f<256;f++)f<128?c[f]=f<<1:c[f]=f<<1^283;for(f=0;f<256;f++){let i=p^p<<1^p<<2^p<<3^p<<4;i=i>>>8^255&i^99,e[m]=i,t[i]=m;let o=c[m],f=c[o],g=c[f],v=257*c[i]^0x1010100*i;r[m]=v<<24|v>>>8,a[m]=v<<16|v>>>16,s[m]=v<<8|v>>>24,n[m]=v,v=0x1010101*g^65537*f^257*o^0x1010100*m,l[i]=v<<24|v>>>8,d[i]=v<<16|v>>>16,h[i]=v<<8|v>>>24,u[i]=v,m?(m=o^c[c[c[g^o]]],p^=c[c[p]]):m=p=1}}expandKey(e){let t,i,r,a,s=this.uint8ArrayToUint32Array_(e),n=!0,o=0;for(;o<s.length&&n;)n=s[o]===this.key[o],o++;if(n)return;this.key=s;let l=this.keySize=s.length;if(4!==l&&6!==l&&8!==l)throw Error("Invalid aes key size="+l);let d=this.ksRows=(l+6+1)*4,h=this.keySchedule=new Uint32Array(d),u=this.invKeySchedule=new Uint32Array(d),c=this.sBox,m=this.rcon,p=this.invSubMix,f=p[0],g=p[1],v=p[2],E=p[3];for(t=0;t<d;t++){if(t<l){r=h[t]=s[t];continue}a=r,t%l==0?a=(c[(a=a<<8|a>>>24)>>>24]<<24|c[a>>>16&255]<<16|c[a>>>8&255]<<8|c[255&a])^m[t/l|0]<<24:l>6&&t%l==4&&(a=c[a>>>24]<<24|c[a>>>16&255]<<16|c[a>>>8&255]<<8|c[255&a]),h[t]=r=(h[t-l]^a)>>>0}for(i=0;i<d;i++)t=d-i,a=3&i?h[t]:h[t-4],i<4||t<=4?u[i]=a:u[i]=f[c[a>>>24]]^g[c[a>>>16&255]]^v[c[a>>>8&255]]^E[c[255&a]],u[i]=u[i]>>>0}networkToHostOrderSwap(e){return e<<24|(65280&e)<<8|(0xff0000&e)>>8|e>>>24}decrypt(e,t,i){let r,a,s,n,o,l,d,h,u,c,m,p,f,g,v=this.keySize+6,E=this.invKeySchedule,b=this.invSBox,y=this.invSubMix,T=y[0],A=y[1],_=y[2],k=y[3],S=this.uint8ArrayToUint32Array_(i),w=S[0],L=S[1],R=S[2],I=S[3],C=new Int32Array(e),D=new Int32Array(C.length),x=this.networkToHostOrderSwap;for(;t<C.length;){for(u=x(C[t]),c=x(C[t+1]),m=x(C[t+2]),p=x(C[t+3]),o=u^E[0],l=p^E[1],d=m^E[2],h=c^E[3],f=4,g=1;g<v;g++)r=T[o>>>24]^A[l>>16&255]^_[d>>8&255]^k[255&h]^E[f],a=T[l>>>24]^A[d>>16&255]^_[h>>8&255]^k[255&o]^E[f+1],s=T[d>>>24]^A[h>>16&255]^_[o>>8&255]^k[255&l]^E[f+2],n=T[h>>>24]^A[o>>16&255]^_[l>>8&255]^k[255&d]^E[f+3],o=r,l=a,d=s,h=n,f+=4;r=b[o>>>24]<<24^b[l>>16&255]<<16^b[d>>8&255]<<8^b[255&h]^E[f],a=b[l>>>24]<<24^b[d>>16&255]<<16^b[h>>8&255]<<8^b[255&o]^E[f+1],s=b[d>>>24]<<24^b[h>>16&255]<<16^b[o>>8&255]<<8^b[255&l]^E[f+2],n=b[h>>>24]<<24^b[o>>16&255]<<16^b[l>>8&255]<<8^b[255&d]^E[f+3],D[t]=x(r^w),D[t+1]=x(n^L),D[t+2]=x(s^R),D[t+3]=x(a^I),w=u,L=c,R=m,I=p,t+=4}return D.buffer}}class ax{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch(e){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){let{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;let i=new Uint8Array(e);if(this.reset(),this.removePKCS7Padding){let e,t;return(t=(e=i.byteLength)&&new DataView(i.buffer).getUint8(e-1))?iy(i,0,e-t):i}return i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i){return this.useSoftware?new Promise((r,a)=>
1{this.softwareDecrypt(new Uint8Array(e),t,i);let s=this.flush();s?r(s.buffer):a(Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)}softwareDecrypt(e,t,i){let{currentIV:r,currentResult:a,remainderData:s}=this;this.logOnce("JS AES decrypt"),s&&(e=iQ(s,e),this.remainderData=null);let n=this.getValidChunk(e);if(!n.length)return null;r&&(i=r);let o=this.softwareDecrypter;return(o||(o=this.softwareDecrypter=new aD),o.expandKey(t),this.currentResult=o.decrypt(n.buffer,0,i),this.currentIV=iy(n,-16).buffer,a)?a:null}webCryptoDecrypt(e,t,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i));this.key=t,this.fastAesKey=new aC(this.subtle,t)}return this.fastAesKey.expandKey().then(t=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new aI(this.subtle,new Uint8Array(i)).decrypt(e.buffer,t)):Promise.reject(Error("web crypto not initialized"))).catch(r=>(tZ.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,i)))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);let r=this.flush();if(r)return r.buffer;throw Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e,i=e.length-e.length%16;return i!==e.length&&(t=iy(e,0,i),this.remainderData=iy(e,i)),t}logOnce(e){this.logEnabled&&(tZ.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}let aM=function(e){let t="",i=e.length;for(let r=0;r<i;r++)t+=`[${e.start(r).toFixed(3)}-${e.end(r).toFixed(3)}]`;return t},aO="STOPPED",aP="IDLE",aN="KEY_LOADING",aU="FRAG_LOADING",aF="FRAG_LOADING_WAITING_RETRY",aB="WAITING_TRACK",a$="PARSING",aH="PARSED",aW="ENDED",aG="ERROR",aV="WAITING_INIT_PTS",aK="WAITING_LEVEL";class aq extends ah{constructor(e,t,i,r,a){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=aO,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=a,this.logPrefix=r,this.log=tZ.log.bind(tZ,`${r}:`),this.warn=tZ.warn.bind(tZ,`${r}:`),this.hls=e,this.fragmentLoader=new aS(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new ax(e.config),e.on(tq.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);let e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=aO}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;let i=t.partList;if(null!=i&&i.length){let e=i[i.length-1];return aE.isBuffered(this.media,e.start+e.duration/2)}let r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&null!==this.levelLastLoaded){var e;return null==(e=this.levelLastLoaded)?void 0:e.details}}onMediaAttached(e,t){let i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);let r=this.config;this.levels&&r.autoStartLoad&&this.state===aO&&this.startLoad(r.startPosition)}onMediaDetaching(){let e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){let{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:a}=this,s=i?i.currentTime:0,n=aE.bufferInfo(r||i,s,e.maxBufferHole);if(this.log(`media seeking to ${tG(s)?s.toFixed(3):s}, state: ${a}`),this.state===aW)this.resetLoadingState();else if(t){let i=e.maxFragLookUpTolerance,r=t.start-i,a=t.start+t.duration+i;if(!n.len||a<n.start||r>n.end){let e=s>a;(s<r||e)&&(e&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}i&&(this.fragmentTracker.removeFragmentsInRange(s,1/0,this.playlistType,!0),this.lastCurrentTime=s),this.loadedmetadata||n.len||(this.nextLoadPosition=this.startPosition=s),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(tq.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}
1onHandlerDestroyed(){this.state=aO,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){let r=t=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${t.part?" p: "+t.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(t)};this._doFragLoad(e,t,i,r).then(t=>{if(!t)return;let i=this.state;if(this.fragContextChanged(e)){i!==aU&&(this.fragCurrent||i!==a$)||(this.fragmentTracker.removeFragment(e),this.state=aP);return}"payload"in t&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(tq.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t)}).catch(t=>{this.state!==aO&&this.state!==aG&&(this.warn(`Frag error: ${(null==t?void 0:t.message)||t}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;let{fragmentTracker:i}=this;if(i.getState(e)===ac){let t=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,t),a=Math.max(e.duration,r?r.len:this.config.maxBufferLength),s=this.backtrackFragment;(1==(s?e.sn-s.sn:0)||this.reduceMaxBufferLength(a,e.duration))&&i.removeFragment(e)}else(null==(t=this.mediaBuffer)?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===am&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){let t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){e-t&&this.hls.trigger(tq.BUFFER_FLUSHING,{startOffset:e,endOffset:t,type:i})}_loadInitSegment(e,t){this._doFragLoad(e,t).then(t=>{if(!t||this.fragContextChanged(e)||!this.levels)throw Error("init load aborted");return t}).then(t=>{let{hls:i}=this,{payload:r}=t,a=e.decryptdata;if(r&&r.byteLength>0&&null!=a&&a.key&&a.iv&&"AES-128"===a.method){let s=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),a.key.buffer,a.iv.buffer).catch(t=>{throw i.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t}).then(r=>{let a=self.performance.now();return i.trigger(tq.FRAG_DECRYPTED,{frag:e,payload:r,stats:{tstart:s,tdecrypt:a}}),t.payload=r,this.completeInitSegmentLoad(t)})}return this.completeInitSegmentLoad(t)}).catch(t=>{this.state!==aO&&this.state!==aG&&(this.warn(t),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){let{levels:t}=this;if(!t)throw Error("init load aborted, missing levels");let i=e.frag.stats;this.state=aP,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){let{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,r,a,s,n;let o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===rk?"level":"track"} ${e.level} (frag:[${(null!=(i=e.startPTS)?i:NaN).toFixed(3)}-${(null!=(r=e.endPTS)?r:NaN).toFixed(3)}] > buffer:${o?aM(aE.getBuffered(o)):"(detached)"})`),"initSegment"!==e.sn){if(e.type!==rw){let t=e.elementaryStreams;if(!Object.keys(t).some(e=>!!t[e])){this.state=aP;return}}let t=null==(n=this.levels)?void 0:n[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=aP,o&&(!this.loadedmetadata&&e.type==rk&&o.buffered.length&&(null==(a=this.fragCurrent)?void 0:a.sn)===(null==(s=this.fragPrevious)?void 0:s.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){let{transmuxer:t}=this;if(!t)return;let{frag:i,part:r,partsLoaded:a}=e,s=!a||0===a.length||a.some(e=>!e),n=new ab(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!s);t.flush(n)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var a;let s,n=null==t?void 0:t.details;if(!this.levels||!n)throw Error(`frag load aborted, missing level${n?"":" detail"}s`);let o=null;if(e.encrypted&&!(null!=(a=e.decryptdata)&&a.key)?(this.log(`Loading key for ${e.sn} of [${n.startSN}-${n.endSN}], ${"[stream-controller]"===this.logPrefix?"level":"track"} ${e.level}`),this.state=aN,this.fragCurrent=e,o=this.keyLoader.load(e).then(e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(tq.KEY_LOADED,e),this.state===aN&&(this.state=aP),e}),this.hls.trigger(tq.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(o=Promise.reject(Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&n.encryptedFragments.length&&this.keyLoader.loadClear(e,n.encryptedFragments),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){let a=n.partList;if(a&&r){i>e.end&&n.fragmentHint&&(e=n.fragmentHint);let s=this.getNextPart(a,e,i);if(s>-1){let l,d=a[s];return(this.log(`Loading part sn: ${e.sn} p: ${d.index} cc: ${e.cc} of playlist [${n.startSN}-${n.endSN}] parts [0-${s}-${a.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=d.start+d.duration,this.state=aU,l=o?o.then(i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,d,t,r)).catch(e=>this.handleFragLoadError(e)):this.doFragPartsLoad(e,d,t,r).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(tq.FRAG_LOADING,{frag:e,part:d,targetBufferTime:i}),null===this.fragCurrent)?Promise.reject(Error("frag load aborted, context changed in FRAG_LOADING parts")):l}if(!e.url||this.loadedEndOfParts(a,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${n?"of ["+n.startSN+"-"+n.endSN+"] ":""}${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),tG(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=aU;let l=this.config.progressive;return(s=l&&o?o.then(t=>!t||this.fragContextChanged(null==t?void 0:t.frag)?null:this.fragmentLoader.load(e,r)).catch(e=>this.handleFragLoadError(e)):Promise.all([this.fragmentLoader.load(e,l?r:void 0),o]).then(([e])=>(!l&&e&&r&&r(e),e)).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(tq.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent)?Promise.reject(Error("frag load aborted, context changed in FRAG_LOADING")):s}doFragPartsLoad(e,t,i,r){return new Promise((a,s)=>{var n;let o=[],l=null==(n=i.details)?void 0:n.partList,d=t=>{this.fragmentLoader.loadPart(e,t,r).then(r=>{o[t.index]=r;let s=r.part;this.hls.trigger(tq.FRAG_LOADED,r);let n=rJ(i,e.sn,t.index+1)||r0(l,e.sn,t.index+1);if(!n)return a({frag:e,part:s,partsLoaded:o});d(n)}).catch(s)};d(t)})}handleFragLoadError(e){if("data"in e){let t=e.data;e.data&&t.details===tY.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(tq.ERROR,t)}else this.hls.trigger(tq.ERROR,{type:tj.OTHER_ERROR,details:tY.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){let t=this.getCurrentContext(e);if(!t||this.state!==a$){this.fragCurrent||this.state===aO||this.state===aG||(this.state=aP);return}let{frag:i,part:r,level:a}=t,s=self.performance.now();i.stats.parsing.end=s,r&&(r.stats.parsing.end=s),this.updateLevelTiming(i,r,a,e.partial)}getCurrentContext(e){let{levels:t,fragCurrent:i}=this,{level:r,sn:a,part:s}=e;if(!(null!=t&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${a} of level ${r}. The current chunk will not be buffered.`),null;let n=t[r],o=s>-1?rJ(n,a,s):null,l=o?o.fragment:function(e,t,i){if(!(null!=e&&e.details))return null;let r=e.details,a=r.fragments[t-r.startSN];return a||(a=r.fragmentHint)&&a.sn===t?a:t<r.startSN&&i&&i.sn===t?i:null}(n,a,i);return l?(i&&i!==l&&(l.stats=i.stats),{frag:l,part:o,level:n}):null}bufferFragmentData(e,t,i,r,a){var s;if(!e||this.state!==a$)return;let{data1:n,data2:o}=e,l=n;if(n&&o&&(l=iQ(n,o)),!(null!=(s=l)&&s.length))return;let d={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:l};if(this.hls.trigger(tq.BUFFER_APPENDING,d),e.dropped&&e.independent&&!i){if(a)return;this.flushBufferGap(t)}}flushBufferGap(e){let t=this.media;if(!t)return;if(!aE.isBuffered(t,t.currentTime))return void this.flushMainBuffer(0,e.start);let i=t.currentTime,r=aE.bufferInfo(t,i,0),a=e.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*a),n=Math.max(Math.min(e.start-s,r.end-s),i+s);e.start-n>s&&this.flushMainBuffer(n,e.start)}getFwdBufferInfo(e,t){let i=this.getLoadPosition();return tG(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){let{config:{maxBufferHole:r}}=this,a=aE.bufferInfo(e,t,r);if(0===a.len&&void 0!==a.nextStart){let s=this.fragmentTracker.getBufferedFrag(t,i);if(s&&a.nextStart<s.end)return aE.bufferInfo(e,t,Math.max(a.nextStart,r))}return a}
1getMaxBufferLength(e){let{config:t}=this;return Math.min(e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){let i=this.config,r=Math.max(Math.min(e-t,i.maxBufferLength),t),a=Math.max(e-3*t,i.maxMaxBufferLength/2,r);return a>=r&&(i.maxMaxBufferLength=a,this.warn(`Reduce max buffer length to ${a}s`),!0)}getAppendedFrag(e,t=rk){let i=this.fragmentTracker.getAppendedFrag(e,rk);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){let i,r=t.fragments,a=r.length;if(!a)return null;let{config:s}=this,n=r[0].start;if(t.live){let o=s.initialLiveManifestSize;if(a<o)return this.warn(`Not enough fragments to start playback (have: ${a}, need: ${o})`),null;(t.PTSKnown||this.startFragRequested||-1!==this.startPosition)&&!(e<n)||(i=this.getInitialLiveFragment(t,r),this.startPosition=this.nextLoadPosition=i?this.hls.liveSyncPosition||i.start:e)}else e<=n&&(i=r[0]);if(!i){let r=s.lowLatencyMode?t.partEnd:t.fragmentEnd;i=this.getFragmentAtPosition(e,r,t)}return this.mapToInitFragWhenRequired(i)}isLoopLoading(e,t){let i=this.fragmentTracker.getState(e);return("OK"===i||i===am&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,a){let s=e.gap,n=this.getNextFragment(this.nextLoadPosition,t);if(null===n)return n;if(e=n,s&&e&&!e.gap&&i.nextStart){let t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r);if(null!==t&&i.len+t.len>=a)return this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let r=-1,a=!1,s=!0;for(let n=0,o=e.length;n<o;n++){let o=e[n];if(s=s&&!o.independent,r>-1&&i<o.start)break;let l=o.loaded;l?r=-1:(a||o.independent||s)&&o.fragment===t&&(r=n),a=l}return r}loadedEndOfParts(e,t){let i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){let i=this.fragPrevious,r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!tG(t)||t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))return null;i=i||0;for(let r=0;r<e.length;++r){let a=e[r];if(function(e,t,i){let r=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-r>e}(t,i,a))return a}return null}(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){let s=i.sn+1;if(s>=e.startSN&&s<=e.endSN){let a=t[s-e.startSN];i.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}if(!r){var a;a=i.cc,(r=r9(t,e=>e.cc<a?1:e.cc>a?-1:0))&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`)}}}else{let t=this.hls.liveSyncPosition;null!==t&&(r=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){let r,{config:a}=this,{fragPrevious:s}=this,{fragments:n,endSN:o}=i,{fragmentHint:l}=i,{maxFragLookUpTolerance:d}=a,h=i.partList,u=!!(a.lowLatencyMode&&null!=h&&h.length&&l);if(u&&l&&!this.bitrateTest&&(n=n.concat(l),o=l.sn),r=e<t?r6(s,n,e,e>t-d?0:d):n[n.length-1]){let e=r.sn-i.startSN,t=this.fragmentTracker.getState(r);if(("OK"===t||t===am&&r.gap)&&(s=r),s&&r.sn===s.sn&&(!u||h[0].fragment.sn>r.sn)&&s&&r.level===s.level){let t=n[e+1];r=r.sn<o&&"OK"!==this.fragmentTracker.getState(t)?t:null}}return r}synchronizeToLiveEdge(e){let{config:t,media:i}=this;if(!i)return;let r=this.hls.liveSyncPosition,a=i.currentTime,s=e.fragments[0].start,n=e.edge,o=a>=s-t.maxFragLookUpTolerance&&a<=n;if(null!==r&&i.duration>r&&(a<r||!o)){let s=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!o&&i.readyState<4||a<n-s)&&(this.loadedmetadata||(this.nextLoadPosition=r),i.readyState&&(this.warn(`Playback: ${a.toFixed(3)} is located too far from the end of live sliding playlist: ${n}, reset currentTime to : ${r.toFixed(3)}`),i.currentTime=r))}}alignPlaylists(e,t,i){let r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;let a=e.fragments[0].start,s=!t,n=e.alignedSliding&&tG(a);if(s||!n&&!a){let{fragPrevious:a}=this;i&&(function(e,t,i){if(i&&(t.endCC>t.startCC||e&&e.cc<t.startCC)){let e=function(e,t){let i=e.fragments,r=t.fragments;if(!r.length||!i.length)return void tZ.log("No fragments to align");let a=aT(i,r[0].cc);return a&&(!a||a.startPTS)?a:void tZ.log("No frag in previous level to align on")}(i,t);e&&tG(e.start)&&(tZ.log(`Adjusting PTS using last level due to CC increase within current level ${t.url}`),a_(e.start,t))}}(a,e,i),!e.alignedSliding&&i&&ak(e,i),e.alignedSliding||!i||e.skippedSegments||rQ(i,e));let s=e.fragments[0].start;return this.log(`Live playlist sliding: ${s.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${a?a.sn:"na"} fragments: ${r}`),s}return a}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;if(i<t&&(i=-1),-1===i||-1===this.lastCurrentTime){let r=null!==this.startTimeOffset,a=r?this.startTimeOffset:e.startTimeOffset;null!==a&&tG(a)?(i=t+a,a<0&&(i+=e.totalduration),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Start time offset ${a} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):e.live?i=this.hls.liveSyncPosition||t:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}getLoadPosition(){let{media:e}=this,t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&"initSegment"!==e.sn&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===aF)||
1(this.state=aP)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){let e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}let i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${null==(r=this.fragCurrent)?void 0:r.url}`);return}let a=t.details===tY.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(i,!0);let s=t.errorAction,{action:n,retryCount:o=0,retryConfig:l}=s||{};if(s&&5===n&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);let r=r4(l,o);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${o+1}/${l.maxNumRetry} in ${r}ms`),s.resolved=!0,this.retryDate=self.performance.now()+r,this.state=aF}else if(l&&s){if(this.resetFragmentErrors(e),!(o<l.maxNumRetry))return void tZ.warn(`${t.details} reached or exceeded max retry (${o})`);a||3===n||(s.resolved=!0)}else(null==s?void 0:s.action)===2?this.state=aK:this.state=aG;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===a$||this.state===aH){let t=e.frag,i=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,i),a=r&&r.len>.5;a&&this.reduceMaxBufferLength(r.len,(null==t?void 0:t.duration)||10);let s=!a;return s&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(e){e===rS&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==aO&&(this.state=aP)}afterBufferFlushed(e,t,i){if(!e)return;let r=aE.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===aW&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=aP}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;let t=e?e.details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){var a;let s=i.details;if(!s)return void this.warn("level.details undefined");if(!Object.keys(e.elementaryStreams).reduce((t,a)=>{let n=e.elementaryStreams[a];if(n){let o=n.endPTS-n.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${e.sn} ${a} duration reliably (${o})`),t||!1;let l=r?0:rX(s,e,n.startPTS,n.endPTS,n.startDTS,n.endDTS);return this.hls.trigger(tq.LEVEL_PTS_UPDATED,{details:s,level:i,drift:l,type:a,frag:e,start:n.startPTS,end:n.endPTS}),!0}return t},!1)&&(null==(a=this.transmuxer)?void 0:a.error)===null){let t=Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(0===i.fragmentError&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(t.message),this.hls.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=aH,this.hls.trigger(tq.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){let t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class aj{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){let e,{chunks:t,dataLength:i}=this;return t.length?(e=1===t.length?t[0]:function(e,t){let i=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++){let a=e[t];i.set(a,r),r+=a.length}return i}(t,i),this.reset(),e):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}function aY(e="",t=9e4){return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class az{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){let i;this.cachedData&&(e=iQ(this.cachedData,e),this.cachedData=null);let r=i_(e,0),a=r?r.length:0,s=this._audioTrack,n=this._id3Track,o=r?iw(r):void 0,l=e.length;
1for((null===this.basePTS||0===this.frameIndex&&tG(o))&&(this.basePTS=aX(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),r&&r.length>0&&n.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:rP,duration:1/0});a<l;){if(this.canParse(e,a)){let t=this.appendFrame(s,e,a);t?(this.frameIndex++,this.lastPTS=t.sample.pts,a+=t.length,i=a):a=l}else iS(e,a)?(r=i_(e,a),n.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:rP,duration:1/0}),a+=r.length,i=a):a++;if(a===l&&i!==l){let t=iy(e,i);this.cachedData?this.cachedData=iQ(this.cachedData,t):this.cachedData=t}}return{audioTrack:s,videoTrack:aY(),id3Track:n,textTrack:aY()}}demuxSampleAes(e,t,i){return Promise.reject(Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){let t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:aY(),id3Track:this._id3Track,textTrack:aY()}}destroy(){}}let aX=(e,t,i)=>tG(e)?90*e:9e4*t+(i?9e4*i.baseTime/i.timescale:0);function aQ(e,t){return 255===e[t]&&(246&e[t+1])==240}function aZ(e,t){return 1&e[t+1]?7:9}function aJ(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function a0(e,t){return t+1<e.length&&aQ(e,t)}function a1(e,t,i,r,a){if(!e.samplerate){let s=function(e,t,i,r){let a,s,n,o,l=navigator.userAgent.toLowerCase(),d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];a=((192&t[i+2])>>>6)+1;let h=(60&t[i+2])>>>2;if(h>d.length-1){let t=Error(`invalid ADTS sampling index:${h}`);e.emit(tq.ERROR,tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message});return}return n=(1&t[i+2])<<2|(192&t[i+3])>>>6,tZ.log(`manifest codec:${r}, ADTS type:${a}, samplingIndex:${h}`),/firefox/i.test(l)?h>=6?(a=5,o=[,,,,],s=h-3):(a=2,o=[,,],s=h):-1!==l.indexOf("android")?(a=2,o=[,,],s=h):(a=5,o=[,,,,],r&&(-1!==r.indexOf("mp4a.40.29")||-1!==r.indexOf("mp4a.40.5"))||!r&&h>=6?s=h-3:((r&&-1!==r.indexOf("mp4a.40.2")&&(h>=6&&1===n||/vivaldi/i.test(l))||!r&&1===n)&&(a=2,o=[,,]),s=h)),o[0]=a<<3,o[0]|=(14&h)>>1,o[1]|=(1&h)<<7,o[1]|=n<<3,5===a&&(o[1]|=(14&s)>>1,o[2]=(1&s)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:d[h],channelCount:n,codec:"mp4a.40."+a,manifestCodec:r}}(t,i,r,a);s&&(e.config=s.config,e.samplerate=s.samplerate,e.channelCount=s.channelCount,e.codec=s.codec,e.manifestCodec=s.manifestCodec,tZ.log(`parsed codec:${e.codec}, rate:${s.samplerate}, channels:${s.channelCount}`))}}function a2(e,t,i,r,a){let s,n=r+a*(9216e4/e.samplerate),o=function(e,t){let i=aZ(e,t);if(t+i<=e.length){let r=aJ(e,t)-i;if(r>0)return{headerLength:i,frameLength:r}}}(t,i);if(o){let{frameLength:r,headerLength:a}=o,l=a+r,d=Math.max(0,i+l-t.length);d?(s=new Uint8Array(l-a)).set(t.subarray(i+a,t.length),0):s=t.subarray(i+a,i+l);let h={unit:s,pts:n};return d||e.samples.push(h),{sample:h,length:l,missing:d}}let l=t.length-i;return(s=new Uint8Array(l)).set(t.subarray(i,t.length),0),{sample:{unit:s,pts:n},length:l,missing:-1}}let a3=null,a4=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],a5=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],a8=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],a9=[0,1,1,4];function a6(e,t,i,r,a){if(i+24>t.length)return;let s=a7(t,i);if(s&&i+s.frameLength<=t.length){let n=r+a*(9e4*s.samplesPerFrame/s.sampleRate),o={unit:t.subarray(i,i+s.frameLength),pts:n,dts:n};return e.config=[],e.channelCount=s.channelCount,e.samplerate=s.sampleRate,e.samples.push(o),{sample:o,length:s.frameLength,missing:0}}}function a7(e,t){let i=e[t+1]>>3&3,r=e[t+1]>>1&3,a=e[t+2]>>4&15,s=e[t+2]>>2&3;if(1!==i&&0!==a&&15!==a&&3!==s){let n=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*a4[14*(3===i?3-r:3===r?3:4)+a-1],d=a5[3*(3===i?0:2===i?1:2)+s],h=a8[i][r],u=a9[r],c=Math.floor(h*l/d+n)*u;if(null===a3){let e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);a3=e?parseInt(e[1]):0}return a3&&a3<=87&&2===r&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:3===o?1:2,frameLength:c,samplesPerFrame:8*h*u}}}
1function se(e,t){return 255===e[t]&&(224&e[t+1])==224&&(6&e[t+1])!=0}function st(e,t){return t+1<e.length&&se(e,t)}function si(e,t){if(t+1<e.length&&se(e,t)){let i=a7(e,t),r=4;null!=i&&i.frameLength&&(r=i.frameLength);let a=t+r;return a===e.length||st(e,a)}return!1}let sr=/\/emsg[-/]ID3/i,sa=(e,t)=>{let i=0,r=5;t+=5;let a=new Uint32Array(1),s=new Uint32Array(1),n=new Uint8Array(1);for(;r>0;){n[0]=e[t];let o=Math.min(r,8),l=8-o;s[0]=0xff000000>>>24+l<<l,a[0]=(n[0]&s[0])>>l,i=i?i<<o|a[0]:a[0],t+=1,r-=o}return i};function ss(e,t,i,r,a){if(i+8>t.length||11!==t[i]||119!==t[i+1])return -1;let s=t[i+4]>>6;if(s>=3)return -1;let n=[48e3,44100,32e3][s],o=63&t[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+s];if(i+l>t.length)return -1;let d=t[i+6]>>5,h=0;2===d?h+=2:(1&d&&1!==d&&(h+=2),4&d&&(h+=2));let u=(t[i+6]<<8|t[i+7])>>12-h&1,c=[2,1,2,3,3,4,4,5][d]+u,m=t[i+5]>>3,p=7&t[i+5],f=new Uint8Array([s<<6|m<<1|p>>2,(3&p)<<6|d<<3|u<<2|o>>4,o<<4&224]),g=t.subarray(i,i+l);return e.config=f,e.channelCount=c,e.samplerate=n,e.samples.push({unit:g,pts:r+1536/n*9e4*a}),l}class sn{constructor(){this.VideoSample=null}createVideoSample(e,t,i,r){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:r,length:0}}getLastNalUnit(e){var t;let i,r=this.VideoSample;if(r&&0!==r.units.length||(r=e[e.length-1]),null!=(t=r)&&t.units){let e=r.units;i=e[e.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){let i=t.samples,r=i.length;if(!r)return void t.dropped++;{let t=i[r-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}e.debug.length&&tZ.log(e.pts+"/"+e.dts+":"+e.debug)}}class so{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){let e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw Error("no bytes available");r.set(e.subarray(i,i+a)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*a,this.bytesAvailable-=a}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e||(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord()),this.word<<=e,this.bitsAvailable-=e}readBits(e){let t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;if(e>32&&tZ.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw Error("no bits available");return(t=e-t)>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if((this.word&0x80000000>>>e)!=0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){let e=this.skipLZ();return this.readBits(e+1)-1}readEG(){let e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,i=8;for(let r=0;r<e;r++)0!==i&&(i=(t+this.readEG()+256)%256),t=0===i?t:i}readSPS(){let e,t,i,r=0,a=0,s=0,n=0,o=this.readUByte.bind(this),l=this.readBits.bind(this),d=this.readUEG.bind(this),h=this.readBoolean.bind(this),u=this.skipBits.bind(this),c=this.skipEG.bind(this),m=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);o();let f=o();if(l(5),u(3),o(),m(),100===f||110===f||122===f||244===f||44===f||83===f||86===f||118===f||128===f){let e=d();if(3===e&&u(1),m(),m(),u(1),h())for(t=3!==e?8:12,i=0;i<t;i++)h()&&p(i<6?16:64)}m();let g=d();if(0===g)d();else if(1===g)for(u(1),c(),c(),e=d(),i=0;i<e;i++)c();m(),u(1);let v=d(),E=d(),b=l(1);0===b&&u(1),u(1),h()&&(r=d(),a=d(),s=d(),n=d());let y=[1,1];if(h()&&h())switch(o()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil((v+1)*16-2*r-2*a),height:(2-b)*(E+1)*16-(b?2:4)*(s+n),pixelRatio:y}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}
1class sl extends sn{parseAVCPES(e,t,i,r,a){let s,n=this.parseAVCNALu(e,i.data),o=this.VideoSample,l=!1;i.data=null,o&&n.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"")),n.forEach(r=>{var n,d,h,u;switch(r.type){case 1:{let t=!1;s=!0;let a=r.data;if(l&&a.length>4){let e=new so(a).readSliceType();(2===e||4===e||7===e||9===e)&&(t=!0)}t&&null!=(d=o)&&d.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),o.frame=!0,o.key=t;break}case 5:s=!0,null!=(n=o)&&n.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),o.key=!0,o.frame=!0;break;case 6:s=!0,iJ(r.data,1,i.pts,t.samples);break;case 7:{s=!0,l=!0;let t=r.data,i=new so(t).readSPS();if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(h=e.pixelRatio)?void 0:h[0])!==i.pixelRatio[0]||(null==(u=e.pixelRatio)?void 0:u[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t],e.duration=a;let r=t.subarray(1,4),s="avc1.";for(let e=0;e<3;e++){let t=r[e].toString(16);t.length<2&&(t="0"+t),s+=t}e.codec=s}break}case 8:s=!0,e.pps=[r.data];break;case 9:s=!0,e.audFound=!0,o&&this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:s=!0;break;default:s=!1,o&&(o.debug+="unknown NAL "+r.type+" ")}o&&s&&o.units.push(r)}),r&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}parseAVCNALu(e,t){let i,r,a,s=t.byteLength,n=e.naluState||0,o=n,l=[],d=0,h=-1,u=0;for(-1===n&&(h=0,u=31&t[0],n=0,d=1);d<s;){if(i=t[d++],!n){n=+!i;continue}if(1===n){n=2*!i;continue}if(i)if(1===i){if(r=d-n-1,h>=0){let e={data:t.subarray(h,r),type:u};l.push(e)}else{let i=this.getLastNalUnit(e.samples);i&&(o&&d<=4-o&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-o)),r>0&&(i.data=iQ(i.data,t.subarray(0,r)),i.state=0))}d<s?(a=31&t[d],h=d,u=a,n=0):n=-1}else n=0;else n=3}if(h>=0&&n>=0){let e={data:t.subarray(h,s),type:u,state:n};l.push(e)}if(0===l.length){let i=this.getLastNalUnit(e.samples);i&&(i.data=iQ(i.data,t))}return e.naluState=n,l}}class sd{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new ax(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){let r=e[t].unit;if(r.length<=16)return;let a=r.subarray(16,r.length-r.length%16),s=a.buffer.slice(a.byteOffset,a.byteOffset+a.length);this.decryptBuffer(s).then(a=>{let s=new Uint8Array(a);r.set(s,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){let t=new Int8Array(16*Math.floor((e.length-48)/160)+16),i=0;for(let r=32;r<e.length-16;r+=160,i+=16)t.set(e.subarray(r,r+16),i);return t}getAvcDecryptedUnit(e,t){let i=new Uint8Array(t),r=0;for(let t=32;t<e.length-16;t+=160,r+=16)e.set(i.subarray(r,r+16),t);return e}decryptAvcSample(e,t,i,r,a){let s=i0(a.data),n=this.getAvcEncryptedData(s);this.decryptBuffer(n.buffer).then(n=>{a.data=this.getAvcDecryptedUnit(s,n),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)})}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();let a=e[t].units;for(;!(i>=a.length);i++){let s=a[i];if(!(s.data.length<=48)&&(1===s.type||5===s.type)&&(this.decryptAvcSample(e,t,i,r,s),!this.decrypter.isSync()))return}}}}function sh(e,t){return((31&e[t+1])<<8)+e[t+2]}function su(e,t,i){tZ.warn(`parsing error: ${t.message}`),e.emit(tq.ERROR,tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:t,reason:t.message})}function sc(e){tZ.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function sm(e){let t,i,r,a,s,n=0,o=e.data;if(!e||0===e.size)return null;for(;o[0].length<19&&o.length>1;)o[0]=iQ(o[0],o[1]),o.splice(1,1);if(1===((t=o[0])[0]<<16)+(t[1]<<8)+t[2]){if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;let l=t[7];192&l&&(a=(14&t[9])*0x20000000+(255&t[10])*4194304+(254&t[11])*16384+(255&t[12])*128+(254&t[13])/2,64&l?a-(s=(14&t[14])*0x20000000+(255&t[15])*4194304+(254&t[16])*16384+(255&t[17])*128+(254&t[18])/2)>54e5&&(tZ.warn(`${Math.round((a-s)/9e4)}s delta between PTS and DTS, align them`),a=s):s=a);let d=(r=t[8])+9;if(e.size<=d)return null;e.size-=d;let h=new Uint8Array(e.size);for(let e=0,i=o.length;e<i;e++){let i=(t=o[e]).byteLength;if(d)if(d>i){d-=i;continue}else t=t.subarray(d),i-=d,d=0;h.set(t,n),n+=i}return i&&(i-=r+3),{data:h,pts:a,dts:s,len:i}}return null}class sp{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);else if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);else if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);else if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}class sf{static init(){let e;for(e in sf.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},sf.types)sf.types.hasOwnProperty(e)&&(sf.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);sf.HDLR_TYPES={video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])};let t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);sf.STTS=sf.STSC=sf.STCO=new Uint8Array([0,0,0,0,0,0,0,0]),sf.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),sf.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),sf.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),sf.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);
1let i=new Uint8Array([105,115,111,109]),r=new Uint8Array([97,118,99,49]),a=new Uint8Array([0,0,0,1]);sf.FTYP=sf.box(sf.types.ftyp,i,a,i,r),sf.DINF=sf.box(sf.types.dinf,sf.box(sf.types.dref,t))}static box(e,...t){let i=8,r=t.length,a=r;for(;r--;)i+=t[r].byteLength;let s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=255&i,s.set(e,4),r=0,i=8;r<a;r++)s.set(t[r],i),i+=t[r].byteLength;return s}static hdlr(e){return sf.box(sf.types.hdlr,sf.HDLR_TYPES[e])}static mdat(e){return sf.box(sf.types.mdat,e)}static mdhd(e,t){let i=Math.floor((t*=e)/0x100000000),r=Math.floor(t%0x100000000);return sf.box(sf.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}static mdia(e){return sf.box(sf.types.mdia,sf.mdhd(e.timescale,e.duration),sf.hdlr(e.type),sf.minf(e))}static mfhd(e){return sf.box(sf.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?sf.box(sf.types.minf,sf.box(sf.types.smhd,sf.SMHD),sf.DINF,sf.stbl(e)):sf.box(sf.types.minf,sf.box(sf.types.vmhd,sf.VMHD),sf.DINF,sf.stbl(e))}static moof(e,t,i){return sf.box(sf.types.moof,sf.mfhd(e),sf.traf(i,t))}static moov(e){let t=e.length,i=[];for(;t--;)i[t]=sf.trak(e[t]);return sf.box.apply(null,[sf.types.moov,sf.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(sf.mvex(e)))}static mvex(e){let t=e.length,i=[];for(;t--;)i[t]=sf.trex(e[t]);return sf.box.apply(null,[sf.types.mvex,...i])}static mvhd(e,t){let i=Math.floor((t*=e)/0x100000000),r=Math.floor(t%0x100000000),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return sf.box(sf.types.mvhd,a)}static sdtp(e){let t,i,r=e.samples||[],a=new Uint8Array(4+r.length);for(t=0;t<r.length;t++)i=r[t].flags,a[t+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return sf.box(sf.types.sdtp,a)}static stbl(e){return sf.box(sf.types.stbl,sf.stsd(e),sf.box(sf.types.stts,sf.STTS),sf.box(sf.types.stsc,sf.STSC),sf.box(sf.types.stsz,sf.STSZ),sf.box(sf.types.stco,sf.STCO))}static avc1(e){let t,i,r,a=[],s=[];for(t=0;t<e.sps.length;t++)r=(i=e.sps[t]).byteLength,a.push(r>>>8&255),a.push(255&r),a=a.concat(Array.prototype.slice.call(i));for(t=0;t<e.pps.length;t++)r=(i=e.pps[t]).byteLength,s.push(r>>>8&255),s.push(255&r),s=s.concat(Array.prototype.slice.call(i));let n=sf.box(sf.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|e.sps.length].concat(a).concat([e.pps.length]).concat(s))),o=e.width,l=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return sf.box(sf.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n,sf.box(sf.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),sf.box(sf.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,h>>24,h>>16&255,h>>8&255,255&h])))}static esds(e){let t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){let t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return sf.box(sf.types.mp4a,sf.audioStsd(e),sf.box(sf.types.esds,sf.esds(e)))}static mp3(e){return sf.box(sf.types[".mp3"],sf.audioStsd(e))}static ac3(e){return sf.box(sf.types["ac-3"],sf.audioStsd(e),sf.box(sf.types.dac3,e.config))}static stsd(e){return"audio"!==e.type?sf.box(sf.types.stsd,sf.STSD,sf.avc1(e)):"mp3"===e.segmentCodec&&"mp3"===e.codec?sf.box(sf.types.stsd,sf.STSD,sf.mp3(e)):"ac3"===e.segmentCodec?sf.box(sf.types.stsd,sf.STSD,sf.ac3(e)):sf.box(sf.types.stsd,sf.STSD,sf.mp4a(e))}static tkhd(e){let t=e.id,i=e.duration*e.timescale,r=e.width,a=e.height,s=Math.floor(i/0x100000000),n=Math.floor(i%0x100000000);return sf.box(sf.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,a>>8&255,255&a,0,0]))}static traf(e,t){let i=sf.sdtp(e),r=e.id,a=Math.floor(t/0x100000000),s=Math.floor(t%0x100000000);return sf.box(sf.types.traf,sf.box(sf.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),sf.box(sf.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,s>>24,s>>16&255,s>>8&255,255&s])),sf.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||0xffffffff,sf.box(sf.types.trak,sf.tkhd(e),sf.mdia(e))}static trex(e){let t=e.id;return sf.box(sf.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){let i,r,a,s,n,o,l=e.samples||[],d=l.length,h=12+16*d,u=new Uint8Array(h);for(t+=8+h,u.set([+("video"===e.type),0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),i=0;i<d;i++)a=(r=l[i]).duration,s=r.size,n=r.flags,o=r.cts,u.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.paddingValue<<1|n.isNonSync,61440&n.degradPrio,15&n.degradPrio,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12+16*i);return sf.box(sf.types.trun,u)}static initSegment(e){sf.types||sf.init();let t=sf.moov(e);return iQ(sf.FTYP,t)}}function sg(e,t,i=1,r=!1){let a=e*t*i;return r?Math.round(a):a}function sv(e,t=!1){return sg(e,1e3,11111111111111112e-21,t)}sf.types=void 0,sf.HDLR_TYPES=void 0,sf.STTS=void 0,sf.STSC=void 0,sf.STCO=void 0,sf.STSZ=void 0,sf.VMHD=void 0,sf.SMHD=void 0,sf.STSD=void 0,sf.FTYP=void 0,sf.DINF=void 0;let sE=null,sb=null;class sy{constructor(e,t,i,r=""){if(this.observer=void 0,this.config=void 0,this.typeSupp
1orted=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===sE){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);sE=e?parseInt(e[1]):0}if(null===sb){const e=navigator.userAgent.match(/Safari\/(\d+)/i);sb=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){tZ.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){tZ.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){tZ.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1,i=e[0].pts,r=e.reduce((e,r)=>{let a=r.pts,s=a-e;return(s<-0x100000000&&(t=!0,s=(a=sT(a,i))-e),s>0)?e:a},i);return t&&tZ.debug("PTS rollover detected"),r}remux(e,t,i,r,a,s,n,o){let l,d,h,u,c,m,p=a,f=a,g=e.pid>-1,v=t.pid>-1,E=t.samples.length,b=e.samples.length>0,y=n&&E>0||E>1;if((!g||b)&&(!v||y)||this.ISGenerated||n){let i;if(this.ISGenerated){var T,A,_,k;let e=this.videoTrackConfig;e&&(t.width!==e.width||t.height!==e.height||(null==(T=t.pixelRatio)?void 0:T[0])!==(null==(A=e.pixelRatio)?void 0:A[0])||(null==(_=t.pixelRatio)?void 0:_[1])!==(null==(k=e.pixelRatio)?void 0:k[1]))&&this.resetInitSegment()}else h=this.generateIS(e,t,a,s);let r=this.isVideoContiguous,n=-1;if(y&&(n=function(e){for(let t=0;t<e.length;t++)if(e[t].key)return t;return -1}(t.samples),!r&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,n>0){tZ.warn(`[mp4-remuxer]: Dropped ${n} out of ${E} video samples due to a missing keyframe`);let e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(n),t.dropped+=n,f+=(t.samples[0].pts-e)/t.inputTimeScale,i=f}else -1===n&&(tZ.warn(`[mp4-remuxer]: No keyframe found out of ${E} video samples`),m=!1);if(this.ISGenerated){if(b&&y){let i=this.getVideoStartPts(t.samples),r=(sT(e.samples[0].pts,i)-i)/t.inputTimeScale;p+=Math.max(0,r),f+=Math.max(0,-r)}if(b){if(e.samplerate||(tZ.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,a,s)),d=this.remuxAudio(e,p,this.isAudioContiguous,s,v||y||o===rS?f:void 0),y){let i=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(tZ.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,a,s)),l=this.remuxVideo(t,f,r,i)}}else y&&(l=this.remuxVideo(t,f,r,0));l&&(l.firstKeyFrame=n,l.independent=-1!==n,l.firstKeyFramePTS=i)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(c=sA(i,a,this._initPTS,this._initDTS)),r.samples.length&&(u=s_(r,a,this._initPTS))),{audio:d,video:l,initSegment:h,independent:m,text:u,id3:c}}generateIS(e,t,i,r){let a,s,n,o=e.samples,l=t.samples,d=this.typeSupported,h={},u=this._initPTS,c=!u||r,m="audio/mp4";if(c&&(a=s=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":d.mpeg?(m="audio/mpeg",e.codec=""):d.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}h.audio={id:"audio",container:m,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&d.mpeg?new Uint8Array(0):sf.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(n=e.inputTimeScale,u&&n===u.timescale?c=!1:a=s=o[0].pts-Math.round(n*i))}if(t.sps&&t.pps&&l.length){if(t.timescale=t.inputTimeScale,h.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:sf.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(n=t.inputTimeScale,u&&n===u.timescale)c=!1;else{let e=this.getVideoStartPts(l),t=Math.round(n*i);s=Math.min(s,sT(l[0].dts,e)-t),a=Math.min(a,e-t)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(h).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:a,timescale:n},this._initDTS={baseTime:s,timescale:n}):a=n=void 0,{tracks:h,initPTS:a,timescale:n}}remuxVideo(e,t,i,r){let a,s,n,o=e.inputTimeScale,l=e.samples,d=[],h=l.length,u=this._initPTS,c=this.nextAvcDts,m=8,p=this.videoSampleDuration,f=1/0,g=-1/0,v=!1;if(!i||null===c){let e=t*o,r=l[0].pts-sT(l[0].dts,l[0].pts);sE&&null!==c&&15e3>Math.abs(e-r-c)?i=!0:c=e-r}let E=u.baseTime*o/u.timescale;for(let e=0;e<h;e++){let t=l[e];t.pts=sT(t.pts-E,c),t.dts=sT(t.dts-E,c),t.dts<l[e>0?e-1:e].dts&&(v=!0)}v&&l.sort(function(e,t){let i=e.dts-t.dts,r=e.pts-t.pts;return i||r}),a=l[0].dts;let b=(s=l[l.length-1].dts)-a,y=b?Math.round(b/(h-1)):p||e.inputTimeScale/30;if(i){let e=a-c,i=e>y,r=e<-1;if((i||r)&&(i?tZ.warn(`AVC: ${sv(e,!0)} ms (${e}dts) hole between fragments detected at ${t.toFixed(3)}`):tZ.warn(`AVC: ${sv(-e,!0)} ms (${e}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!r||c>=l[0].pts||sE)){a=c;let t=l[0].pts-e;if(i)l[0].dts=a,l[0].pts=t;else for(let i=0;i<l.length&&!(l[i].dts>t);i++)l[i].dts-=e,l[i].pts-=e;tZ.log(`Video: Initial PTS/DTS adjusted: ${sv(t,!0)}/${sv(a,!0)}, delta: ${sv(e,!0)} ms`)}}let T=0,A=0,_=a=Math.max(0,a);for(let e=0;e<h;e++){let t=l[e],i=t.units,r=i.length,a=0;for(let e=0;e<r;e++)a+=i[e].data.length;A+=a,T+=r,t.length=a,t.dts<_?(t.dts=_,_+=y/4|0||1):_=t.dts,f=Math.min(t.pts,f),g=Math.max(t.pts,g)}s=l[h-1].dts;let k=A+4*T+8;try{n=new Uint8Array(k)}catch(e){this.observer.emit(tq.ERROR,tq.ERROR,{type:tj.MUX_ERROR,details:tY.REMUX_ALLOC_ER
1ROR,fatal:!1,error:e,bytes:k,reason:`fail allocating video mdat ${k}`});return}let S=new DataView(n.buffer);S.setUint32(0,k),n.set(sf.types.mdat,4);let w=!1,L=1/0,R=1/0,I=-1/0,C=-1/0;for(let e=0;e<h;e++){let t,i=l[e],a=i.units,s=0;for(let e=0,t=a.length;e<t;e++){let t=a[e],i=t.data,r=t.data.byteLength;S.setUint32(m,r),m+=4,n.set(i,m),m+=r,s+=4+r}if(e<h-1)p=l[e+1].dts-i.dts,t=l[e+1].pts-i.pts;else{let a=this.config,s=e>0?i.dts-l[e-1].dts:y;if(t=e>0?i.pts-l[e-1].pts:y,a.stretchShortVideoTrack&&null!==this.nextAudioPts){let e=Math.floor(a.maxBufferHole*o),t=(r?f+r*o:this.nextAudioPts)-i.pts;t>e?((p=t-s)<0?p=s:w=!0,tZ.log(`[mp4-remuxer]: It is approximately ${t/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=s}else p=s}let u=Math.round(i.pts-i.dts);L=Math.min(L,p),I=Math.max(I,p),R=Math.min(R,t),C=Math.max(C,t),d.push(new sk(i.key,p,s,u))}if(d.length){if(sE){if(sE<70){let e=d[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(sb&&C-R<I-L&&y/I<.025&&0===d[0].cts){tZ.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let e=a;for(let t=0,i=d.length;t<i;t++){let r=e+d[t].duration,a=e+d[t].cts;if(t<i-1){let e=r+d[t+1].cts;d[t].duration=e-a}else d[t].duration=t?d[t-1].duration:y;d[t].cts=0,e=r}}}p=w||!p?y:p,this.nextAvcDts=c=s+p,this.videoSampleDuration=p,this.isVideoContiguous=!0;let D={data1:sf.moof(e.sequenceNumber++,a,tW({},e,{samples:d})),data2:n,startPTS:f/o,endPTS:(g+p)/o,startDTS:a/o,endDTS:c/o,type:"video",hasAudio:!1,hasVideo:!0,nb:d.length,dropped:e.dropped};return e.samples=[],e.dropped=0,D}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(e,t,i,r,a){let s,n=e.inputTimeScale,o=e.samplerate?e.samplerate:n,l=n/o,d=this.getSamplesPerFrame(e),h=d*l,u=this._initPTS,c="mp3"===e.segmentCodec&&this.typeSupported.mpeg,m=[],p=void 0!==a,f=e.samples,g=8*!c,v=this.nextAudioPts||-1,E=t*n,b=u.baseTime*n/u.timescale;if(this.isAudioContiguous=i=i||f.length&&v>0&&(r&&9e3>Math.abs(E-v)||Math.abs(sT(f[0].pts-b,E)-v)<20*h),f.forEach(function(e){e.pts=sT(e.pts-b,E)}),!i||v<0){if(!(f=f.filter(e=>e.pts>=0)).length)return;v=0===a?0:r&&!p?Math.max(0,E):f[0].pts}if("aac"===e.segmentCodec){let t=this.config.maxAudioFramesDrift;for(let i=0,r=v;i<f.length;i++){let a=f[i],s=a.pts,o=s-r,l=Math.abs(1e3*o/n);if(o<=-t*h&&p)0===i&&(tZ.warn(`Audio frame @ ${(s/n).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*o/n)} ms.`),this.nextAudioPts=v=r=s);else if(o>=t*h&&l<1e4&&p){let t=Math.round(o/h);(r=s-t*h)<0&&(t--,r+=h),0===i&&(this.nextAudioPts=v=r),tZ.warn(`[mp4-remuxer]: Injecting ${t} audio frame @ ${(r/n).toFixed(3)}s due to ${Math.round(1e3*o/n)} ms gap.`);for(let s=0;s<t;s++){let t=Math.max(r,0),s=sp.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);s||(tZ.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),s=a.unit.subarray()),f.splice(i,0,{unit:s,pts:t}),r+=h,i++}}a.pts=r,r+=h}}let y=null,T=null,A=0,_=f.length;for(;_--;)A+=f[_].unit.byteLength;for(let t=0,r=f.length;t<r;t++){let r=f[t],a=r.unit,n=r.pts;if(null!==T)m[t-1].duration=Math.round((n-T)/l);else{if(i&&"aac"===e.segmentCodec&&(n=v),y=n,!(A>0))return;A+=g;try{s=new Uint8Array(A)}catch(e){this.observer.emit(tq.ERROR,tq.ERROR,{type:tj.MUX_ERROR,details:tY.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:A,reason:`fail allocating audio mdat ${A}`});return}c||(new DataView(s.buffer).setUint32(0,A),s.set(sf.types.mdat,4))}s.set(a,g);let o=a.byteLength;g+=o,m.push(new sk(!0,d,o,0)),T=n}let k=m.length;if(!k)return;let S=m[m.length-1];this.nextAudioPts=v=T+l*S.duration;let w=c?new Uint8Array(0):sf.moof(e.sequenceNumber++,y/l,tW({},e,{samples:m}));e.samples=[];let L=y/n,R=v/n,I={data1:w,data2:s,startPTS:L,endPTS:R,startDTS:L,endDTS:R,type:"audio",hasAudio:!0,hasVideo:!1,nb:k};return this.isAudioContiguous=!0,I}remuxEmptyAudio(e,t,i,r){let a=e.inputTimeScale,s=e.samplerate?e.samplerate:a,n=this.nextAudioPts,o=this._initDTS,l=9e4*o.baseTime/o.timescale,d=(null!==n?n:r.startDTS*a)+l,h=r.endDTS*a+l,u=a/s*1024,c=Math.ceil((h-d)/u),m=sp.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(tZ.warn("[mp4-remuxer]: remux empty Audio"),!m)return void tZ.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");let p=[];for(let e=0;e<c;e++){let t=d+e*u;p.push({unit:m,pts:t,dts:t})}return e.samples=p,this.remuxAudio(e,t,i,!1)}}function sT(e,t){let i;if(null===t)return e;for(i=t<e?-0x200000000:0x200000000;Math.abs(e-t)>0x100000000;)e+=i;return e}function sA(e,t,i,r){let a=e.samples.length;if(!a)return;let s=e.inputTimeScale;for(let n=0;n<a;n++){let a=e.samples[n];a.pts=sT(a.pts-i.baseTime*s/i.timescale,t*s)/s,a.dts=sT(a.dts-r.baseTime*s/r.timescale,t*s)/s}let n=e.samples;return e.samples=[],{samples:n}}function s_(e,t,i){let r=e.samples.length;if(!r)return;let a=e.inputTimeScale;for(let s=0;s<r;s++){let r=e.samples[s];r.pts=sT(r.pts-i.baseTime*a/i.timescale,t*a)/a}
1e.samples.sort((e,t)=>e.pts-t.pts);let s=e.samples;return e.samples=[],{samples:s}}class sk{constructor(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:+!e}}}function sS(e,t){let i=null==e?void 0:e.codec;if(i&&i.length>4)return i;if(t===t4){if("ec-3"===i||"ac-3"===i||"alac"===i)return i;if("fLaC"===i||"Opus"===i)return rn(i,!1);let e="mp4a.40.5";return tZ.info(`Parsed audio codec "${i}" or audio object type not handled. Using "${e}"`),e}return(tZ.warn(`Unhandled video codec "${i}"`),"hvc1"===i||"hev1"===i)?"hvc1.1.6.L120.90":"av01"===i?"av01.0.04M.08":"avc1.42e01e"}try{i=self.performance.now.bind(self.performance)}catch(e){tZ.debug("Unable to use Performance API on this environment"),i=null==ir?void 0:ir.Date.now}let sw=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,r){let a=this.videoTrack=aY("video",1),s=this.audioTrack=aY("audio",1),n=this.txtTrack=aY("text",1);if(this.id3Track=aY("id3",1),this.timeOffset=0,!(null!=e&&e.byteLength))return;let o=iq(e);if(o.video){let{id:e,timescale:t,codec:i}=o.video;a.id=e,a.timescale=n.timescale=t,a.codec=i}if(o.audio){let{id:e,timescale:t,codec:i}=o.audio;s.id=e,s.timescale=t,s.codec=i}n.id=iF.text,a.sampleDuration=0,a.duration=s.duration=r}resetContiguity(){this.remainderData=null}static probe(e){let t=e.byteLength;for(let i=0;i<t;){let r=iH(e,i);if(r>8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=r>1?i+r:t}return!1}demux(e,t){this.timeOffset=t;let i=e,r=this.videoTrack,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=iQ(this.remainderData,e));let t=function(e){let t={valid:null,remainder:null},i=iK(e,["moof"]);if(i.length<2)return t.remainder=e,t;let r=i[i.length-1];return t.valid=iy(e,0,r.byteOffset-8),t.remainder=iy(e,r.byteOffset-8),t}(i);this.remainderData=t.remainder,r.samples=t.valid||new Uint8Array}else r.samples=i;let s=this.extractID3Track(r,t);return a.samples=iZ(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){let e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;let r=this.extractID3Track(t,this.timeOffset);return i.samples=iZ(e,t),{videoTrack:t,audioTrack:aY(),id3Track:r,textTrack:aY()}}extractID3Track(e,t){let i=this.id3Track;return e.samples.length&&iK(e.samples,["emsg"]).forEach(e=>{let r=function(e){let t=e[0],i="",r="",a=0,s=0,n=0,o=0,l=0,d=0;if(0===t){for(;"\0"!==iB(e.subarray(d,d+1));)i+=iB(e.subarray(d,d+1)),d+=1;for(i+=iB(e.subarray(d,d+1)),d+=1;"\0"!==iB(e.subarray(d,d+1));)r+=iB(e.subarray(d,d+1)),d+=1;r+=iB(e.subarray(d,d+1)),d+=1,a=iH(e,12),s=iH(e,16),o=iH(e,20),l=iH(e,24),d=28}else if(1===t){d+=4,a=iH(e,d);let t=iH(e,d+=4),s=iH(e,d+=4);for(d+=4,tV(n=0x100000000*t+s)||(n=Number.MAX_SAFE_INTEGER,tZ.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=iH(e,d),d+=4,l=iH(e,d),d+=4;"\0"!==iB(e.subarray(d,d+1));)i+=iB(e.subarray(d,d+1)),d+=1;for(i+=iB(e.subarray(d,d+1)),d+=1;"\0"!==iB(e.subarray(d,d+1));)r+=iB(e.subarray(d,d+1)),d+=1;r+=iB(e.subarray(d,d+1)),d+=1}return{schemeIdUri:i,value:r,timeScale:a,presentationTime:n,presentationTimeDelta:s,eventDuration:o,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(sr.test(r.schemeIdUri)){let e=tG(r.presentationTime)?r.presentationTime/r.timeScale:t+r.presentationTimeDelta/r.timeScale,a=0xffffffff===r.eventDuration?1/0:r.eventDuration/r.timeScale;a<=.001&&(a=1/0);let s=r.payload;i.samples.push({data:s,len:s.byteLength,dts:e,pts:e,type:rN,duration:a})}}),i}demuxSampleAes(e,t,i){return Promise.reject(Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(e,t){if(!e||!t)return e;let i=t.keyId;
1return i&&t.isCommonEncryption&&iK(e,["moov","trak"]).forEach(e=>{let t=iK(e,["mdia","minf","stbl","stsd"])[0].subarray(8),r=iK(t,["enca"]),a=r.length>0;a||(r=iK(t,["encv"])),r.forEach(e=>{iK(a?e.subarray(28):e.subarray(78),["sinf"]).forEach(e=>{let t=iX(e);if(t){let e=t.subarray(8,24);e.some(e=>0!==e)||(tZ.log(`[eme] Patching keyId in 'enc${a?"a":"v"}>sinf>>tenc' box: ${iN(e)} -> ${iN(i)}`),t.set(i,8))}})})}),e}(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(null!=e&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}let r=this.initData=iq(e);r.audio&&(t=sS(r.audio,t4)),r.video&&(i=sS(r.video,t5));let a={};r.audio&&r.video?a.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?a.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?a.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:tZ.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a}remux(e,t,i,r,a,s){var n,o,l,d,h;let{initPTS:u,lastEndTime:c}=this,m={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};tG(c)||(c=this.lastEndTime=a||0);let p=t.samples;if(!(null!=p&&p.length))return m;let f={initPTS:void 0,timescale:1},g=this.initData;if(null!=(n=g)&&n.length||(this.generateInitSegment(p),g=this.initData),!(null!=(o=g)&&o.length))return tZ.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),m;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);let v=function(e,t){let i=0,r=0,a=0,s=iK(e,["moof","traf"]);for(let e=0;e<s.length;e++){let n=s[e],o=iK(n,["tfhd"])[0],l=t[iH(o,4)];if(!l)continue;let d=l.default,h=iH(o,0)|(null==d?void 0:d.flags),u=null==d?void 0:d.duration;8&h&&(u=2&h?iH(o,12):iH(o,8));let c=l.timescale||9e4,m=iK(n,["trun"]);for(let e=0;e<m.length;e++)(i=function(e){let t=iH(e,0),i=8;1&t&&(i+=4),4&t&&(i+=4);let r=0,a=iH(e,4);for(let s=0;s<a;s++)256&t&&(r+=iH(e,i),i+=4),512&t&&(i+=4),1024&t&&(i+=4),2048&t&&(i+=4);return r}(m[e]))||!u||(i=u*iH(m[e],4)),l.type===t5?r+=i/c:l.type===t4&&(a+=i/c)}if(0===r&&0===a){let t=1/0,i=0,r=0,a=iK(e,["sidx"]);for(let e=0;e<a.length;e++){let s=function(e){let t=[],i=e[0],r=8,a=iH(e,8);r+=4;let s=0,n=0;0===i?(s=iH(e,r),n=iH(e,r+4),r+=8):(s=iW(e,r),n=iW(e,r+8),r+=16),r+=2;let o=e.length+n,l=i$(e,r);r+=2;for(let i=0;i<l;i++){let i=r,s=iH(e,i);i+=4;let n=0x7fffffff&s;if(1==(0x80000000&s)>>>31)return tZ.warn("SIDX has hierarchical references (not supported)"),null;let l=iH(e,i);i+=4,t.push({referenceSize:n,subsegmentDuration:l,info:{duration:l/a,start:o,end:o+n-1}}),o+=n,i+=4,r=i}return{earliestPresentationTime:s,timescale:a,version:i,referencesCount:l,references:t}}(a[e]);null!=s&&s.references&&(t=Math.min(t,s.earliestPresentationTime/s.timescale),r=(i=Math.max(i,s.references.reduce((e,t)=>e+t.info.duration||0,0)+s.earliestPresentationTime/s.timescale))-t)}if(r&&tG(r))return r}return r||a}(p,g),E=(l=g,iK(p,["moof","traf"]).reduce((e,t)=>{let i=iK(t,["tfdt"])[0],r=i[0],a=iK(t,["tfhd"]).reduce((e,t)=>{let a=l[iH(t,4)];if(a){let t=iH(i,4);if(1===r){if(0xffffffff===t)return tZ.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;t*=0x100000000,t+=iH(i,8)}let s=t/(a.timescale||9e4);if(tG(s)&&(null===e||s<e))return s}return e},null);return null!==a&&tG(a)&&(null===e||a<e)?a:e},null)),b=null===E?a:E;((function(e,t,i,r){if(null===e)return!0;let a=Math.max(r,1);return Math.abs(t-e.baseTime/e.timescale-i)>a})(u,b,a,v)||f.timescale!==u.timescale&&s)&&(f.initPTS=b-a,u&&1===u.timescale&&tZ.warn(`Adjusting initPTS by ${f.initPTS-u.baseTime}`),this.initPTS=u={baseTime:f.initPTS,timescale:1});let y=e?b-u.baseTime/u.timescale:c,T=y+v;d=g,h=u.baseTime/u.timescale,iK(p,["moof","traf"]).forEach(e=>{iK(e,["tfhd"]).forEach(t=>{let i=d[iH(t,4)];if(!i)return;let r=i.timescale||9e4;iK(e,["tfdt"]).forEach(e=>{let t=e[0],i=h*r;if(i){let r=iH(e,4);if(0===t)r-=i,iV(e,4,r=Math.max(r,0));else{r*=0x100000000,r+=iH(e,8),r-=i;let t=Math.floor((r=Math.max(r,0))/0x100000000),a=Math.floor(r%0x100000000);iV(e,4,t),iV(e,8,a)}}})})}),v>0?this.lastEndTime=T:(tZ.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());let A=!!g.audio,_=!!g.video,k="";A&&(k+="audio"),_&&(k+="video");let S={data1:p,startPTS:y,startDTS:y,endPTS:T,endDTS:T,type:k,hasAudio:A,hasVideo:_,nb:1,dropped:0};return m.audio="audio"===S.type?S:void 0,m.video="audio"!==S.type?S:void 0,m.initSegment=f,m.id3=sA(i,a,u,u),r.samples.length&&(m.text=s_(r,a,u)),m}}},{demux:class e{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupp
1orted=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=new sl}static probe(t){let i=e.syncOffset(t);return i>0&&tZ.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),-1!==i}static syncOffset(e){let t=e.length,i=Math.min(940,t-188)+1,r=0;for(;r<i;){let a=!1,s=-1,n=0;for(let o=r;o<t;o+=188)if(71===e[o]&&(t-o==188||71===e[o+188])){if(n++,-1===s&&0!==(s=o)&&(i=Math.min(s+18612,e.length-188)+1),a||(a=0===sh(e,o)),a&&n>1&&(0===s&&n>2||o+188>i))return s}else if(n)return -1;else break;r++}return -1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:iF[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(t,i,r,a){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._audioTrack=e.createTrack("audio",a),this._id3Track=e.createTrack("id3"),this._txtTrack=e.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=i,this.videoCodec=r,this._duration=a}resetTimeStamp(){}resetContiguity(){let{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,i,r=!1,a=!1){let s;r||(this.sampleAes=null);let n=this._videoTrack,o=this._audioTrack,l=this._id3Track,d=this._txtTrack,h=n.pid,u=n.pesData,c=o.pid,m=l.pid,p=o.pesData,f=l.pesData,g=null,v=this.pmtParsed,E=this._pmtId,b=t.length;if(this.remainderData&&(b=(t=iQ(this.remainderData,t)).length,this.remainderData=null),b<188&&!a)return this.remainderData=t,{audioTrack:o,videoTrack:n,id3Track:l,textTrack:d};let y=Math.max(0,e.syncOffset(t));(b-=(b-y)%188)<t.byteLength&&!a&&(this.remainderData=new Uint8Array(t.buffer,b,t.buffer.byteLength-b));let T=0;for(let e=y;e<b;e+=188)if(71===t[e]){let i,a=!!(64&t[e+1]),b=sh(t,e);if((48&t[e+3])>>4>1){if((i=e+5+t[e+4])===e+188)continue}else i=e+4;switch(b){case h:a&&(u&&(s=sm(u))&&this.videoParser.parseAVCPES(n,d,s,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(t.subarray(i,e+188)),u.size+=e+188-i);break;case c:if(a){if(p&&(s=sm(p)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,s);break;case"mp3":this.parseMPEGPES(o,s);break;case"ac3":this.parseAC3PES(o,s)}p={data:[],size:0}}p&&(p.data.push(t.subarray(i,e+188)),p.size+=e+188-i);break;case m:a&&(f&&(s=sm(f))&&this.parseID3PES(l,s),f={data:[],size:0}),f&&(f.data.push(t.subarray(i,e+188)),f.size+=e+188-i);break;case 0:var A,_;a&&(i+=t[i]+1),E=this._pmtId=(31&(A=t)[(_=i)+10])<<8|A[_+11];break;case E:{a&&(i+=t[i]+1);let s=function(e,t,i,r,a){let s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},n=(15&e[t+1])<<8|e[t+2],o=t+3+n-4,l=(15&e[t+10])<<8|e[t+11];for(t+=12+l;t<o;){let n=sh(e,t),o=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!r){sc("ADTS AAC");break}case 15:-1===s.audioPid&&(s.audioPid=n);break;case 21:-1===s.id3Pid&&(s.id3Pid=n);break;case 219:if(!r){sc("H.264");break}case 27:-1===s.videoPid&&(s.videoPid=n,s.segmentVideoCodec="avc");break;case 3:case 4:i.mpeg||i.mp3?-1===s.audioPid&&(s.audioPid=n,s.segmentAudioCodec="mp3"):tZ.log("MPEG audio found, not supported in this browser");break;case 193:if(!r){sc("AC-3");break}case 129:i.ac3?-1===s.audioPid&&(s.audioPid=n,s.segmentAudioCodec="ac3"):tZ.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===s.audioPid&&o>0){let r=t+5,a=o;for(;a>2;){106===e[r]&&(!0!==i.ac3?tZ.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=n,s.segmentAudioCodec="ac3"));let t=e[r+1]+2;r+=t,a-=t}}break;case 194:case 135:return su(a,Error("Unsupported EC-3 in M2TS found")),s;case 36:return su(a,Error("Unsupported HEVC in M2TS found")),s}t+=o+5}return s}(t,i,this.typeSupported,r,this.observer);(h=s.videoPid)>0&&(n.pid=h,n.segmentCodec=s.segmentVideoCodec),(c=s.audioPid)>0&&(o.pid=c,o.segmentCodec=s.segmentAudioCodec),(m=s.id3Pid)>0&&(l.pid=m),null===g||v||(tZ.warn(`MPEG-TS PMT found at ${e} after unknown PID '${g}'. Backtracking to sync byte @${y} to parse all TS packets.`),g=null,e=y-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=b}}else T++;T>0&&su(this.observer,Error(`Found ${T} TS packet/s that do not start with 0x47`)),n.pesData=u,o.pesData=p,l.pesData=f;let k={audioTrack:o,videoTrack:n,id3Track:l,textTrack:d};return a&&this.extractRemainingSamples(k),k}flush(){let e,{remainderData:t}=this;
1return(this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes)?this.decrypt(e,this.sampleAes):e}extractRemainingSamples(e){let t,{audioTrack:i,videoTrack:r,id3Track:a,textTrack:s}=e,n=r.pesData,o=i.pesData,l=a.pesData;if(n&&(t=sm(n))?(this.videoParser.parseAVCPES(r,s,t,!0,this._duration),r.pesData=null):r.pesData=n,o&&(t=sm(o))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,t);break;case"mp3":this.parseMPEGPES(i,t);break;case"ac3":this.parseAC3PES(i,t)}i.pesData=null}else null!=o&&o.size&&tZ.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=o;l&&(t=sm(l))?(this.parseID3PES(a,t),a.pesData=null):a.pesData=l}demuxSampleAes(e,t,i){let r=this.demux(e,i,!0,!this.config.progressive),a=this.sampleAes=new sd(this.observer,this.config,t);return this.decrypt(r,a)}decrypt(e,t){return new Promise(i=>{let{audioTrack:r,videoTrack:a}=e;r.samples&&"aac"===r.segmentCodec?t.decryptAacSamples(r.samples,0,()=>{a.samples?t.decryptAvcSamples(a.samples,0,0,()=>{i(e)}):i(e)}):a.samples&&t.decryptAvcSamples(a.samples,0,0,()=>{i(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let i,r,a,s,n=0,o=this.aacOverFlow,l=t.data;if(o){this.aacOverFlow=null;let t=o.missing,i=o.sample.unit.byteLength;-1===t?l=iQ(o.sample.unit,l):(o.sample.unit.set(l.subarray(0,t),i-t),e.samples.push(o.sample),n=o.missing)}for(i=n,r=l.length;i<r-1&&!a0(l,i);i++);if(i!==n){let e,t=i<r-1;if(e=t?`AAC PES did not start with ADTS header,offset:${i}`:"No ADTS header found in AAC PES",su(this.observer,Error(e),t),!t)return}if(a1(e,this.observer,l,i,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!o)return void tZ.warn("[tsdemuxer]: AAC PES unknown PTS");let t=9216e4/e.samplerate;a=o.sample.pts+t}let d=0;for(;i<r;){if(s=a2(e,l,i,a,d),i+=s.length,s.missing){this.aacOverFlow=s;break}for(d++;i<r-1&&!a0(l,i);i++);}}parseMPEGPES(e,t){let i=t.data,r=i.length,a=0,s=0,n=t.pts;if(void 0===n)return void tZ.warn("[tsdemuxer]: MPEG PES unknown PTS");for(;s<r;)if(st(i,s)){let t=a6(e,i,s,n,a);if(t)s+=t.length,a++;else break}else s++}parseAC3PES(e,t){{let i,r=t.data,a=t.pts;if(void 0===a)return void tZ.warn("[tsdemuxer]: AC3 PES unknown PTS");let s=r.length,n=0,o=0;for(;o<s&&(i=ss(e,r,o,a,n++))>0;)o+=i}}parseID3PES(e,t){if(void 0===t.pts)return void tZ.warn("[tsdemuxer]: ID3 PES unknown PTS");let i=tW({},t,{type:this._videoTrack?rN:rP,duration:1/0});e.samples.push(i)}},remux:sy},{demux:class extends az{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let t=i_(e,0),i=(null==t?void 0:t.length)||0;if(si(e,i))return!1;for(let t=e.length;i<t;i++)if(function(e,t){if(a0(e,t)){let i=aZ(e,t);if(t+i>=e.length)return!1;let r=aJ(e,t);if(r<=i)return!1;let a=t+r;return a===e.length||a0(e,a)}return!1}(e,i))return tZ.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return t+5<e.length&&aQ(e,t)&&aJ(e,t)<=e.length-t}appendFrame(e,t,i){a1(e,this.observer,t,i,e.manifestCodec);let r=a2(e,t,i,this.basePTS,this.frameIndex);if(r&&0===r.missing)return r}},remux:sy},{demux:class extends az{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let t=i_(e,0),i=(null==t?void 0:t.length)||0;if(t&&11===e[i]&&119===e[i+1]&&void 0!==iw(t)&&16>=sa(e,i))return!1;for(let t=e.length;i<t;i++)if(si(e,i))return tZ.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return se(e,t)&&4<=e.length-t}appendFrame(e,t,i){if(null!==this.basePTS)return a6(e,t,i,this.basePTS,this.frameIndex)}},remux:sy}];sw.splice(2,0,{demux:class extends az{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){let r=ss(e,t,i,this.basePTS,this.frameIndex);if(-1!==r)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;let t=i_(e,0);if(!t)return!1;let i=t.length;return!!(11===e[i]&&119===e[i+1]&&void 0!==iw(t)&&16>sa(e,i))}},remux:sy});class sL{constructor(e,t,i,r,a){this.async=!1,this.observer=void 0,this.typeSupp
1orted=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,r,a){var s,n;let o,l=r.transmuxing;l.executeStart=i();let d=new Uint8Array(e),{currentTransmuxState:h,transmuxConfig:u}=this;a&&(this.currentTransmuxState=a);let{contiguous:c,discontinuity:m,trackSwitch:p,accurateTimeOffset:f,timeOffset:g,initSegmentChange:v}=a||h,{audioCodec:E,videoCodec:b,defaultInitPts:y,duration:T,initSegmentData:A}=u,_=(s=d,n=t,o=null,s.byteLength>0&&(null==n?void 0:n.key)!=null&&null!==n.iv&&null!=n.method&&(o=n),o);if(_&&"AES-128"===_.method){let e=this.getDecrypter();if(!e.isSync())return this.decryptionPromise=e.webCryptoDecrypt(d,_.key.buffer,_.iv.buffer).then(e=>{let t=this.push(e,null,r);return this.decryptionPromise=null,t}),this.decryptionPromise;{let t=e.softwareDecrypt(d,_.key.buffer,_.iv.buffer);if(r.part>-1&&(t=e.flush()),!t)return l.executeEnd=i(),sR(r);d=new Uint8Array(t)}}let k=this.needsProbing(m,p);if(k){let e=this.configureTransmuxer(d);if(e)return tZ.warn(`[transmuxer] ${e.message}`),this.observer.emit(tq.ERROR,tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),l.executeEnd=i(),sR(r)}(m||p||v||k)&&this.resetInitSegment(A,E,b,T,t),(m||v||k)&&this.resetInitialTimestamp(y),c||this.resetContiguity();let S=this.transmux(d,_,g,f,r),w=this.currentTransmuxState;return w.contiguous=!0,w.discontinuity=!1,w.trackSwitch=!1,l.executeEnd=i(),S}flush(e){let t=e.transmuxing;t.executeStart=i();let{decrypter:r,currentTransmuxState:a,decryptionPromise:s}=this;if(s)return s.then(()=>this.flush(e));let n=[],{timeOffset:o}=a;if(r){let t=r.flush();t&&n.push(this.push(t,null,e))}let{demuxer:l,remuxer:d}=this;if(!l||!d)return t.executeEnd=i(),[sR(e)];let h=l.flush(o);return sI(h)?h.then(t=>(this.flushRemux(n,t,e),n)):(this.flushRemux(n,h,e),n)}flushRemux(e,t,r){let{audioTrack:a,videoTrack:s,id3Track:n,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:d}=this.currentTransmuxState;tZ.log(`[transmuxer.ts]: Flushed fragment ${r.sn}${r.part>-1?" p: "+r.part:""} of level ${r.level}`);let h=this.remuxer.remux(a,s,n,o,d,l,!0,this.id);e.push({remuxResult:h,chunkMeta:r}),r.transmuxing.executeEnd=i()}resetInitialTimestamp(e){let{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){let{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,r,a){let{demuxer:s,remuxer:n}=this;s&&n&&(s.resetInitSegment(e,t,i,r),n.resetInitSegment(e,t,i,a))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,a){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,r,a):this.transmuxUnencrypted(e,i,r,a)}transmuxUnencrypted(e,t,i,r){let{audioTrack:a,videoTrack:s,id3Track:n,textTrack:o}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(a,s,n,o,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,a){return this.demuxer.demuxSampleAes(e,t,i).then(e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,r,!1,this.id),chunkMeta:a}))}
1configureTransmuxer(e){let t,{config:i,observer:r,typeSupported:a,vendor:s}=this;for(let i=0,r=sw.length;i<r;i++){var n;if(null!=(n=sw[i].demux)&&n.probe(e)){t=sw[i];break}}if(!t)return Error("Failed to find demuxer by probing fragment data");let o=this.demuxer,l=this.remuxer,d=t.remux,h=t.demux;l&&l instanceof d||(this.remuxer=new d(r,i,a,s)),o&&o instanceof h||(this.demuxer=new h(r,i,a),this.probe=h.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new ax(this.config)),e}}let sR=e=>({remuxResult:{},chunkMeta:e});function sI(e){return"then"in e&&e.then instanceof Function}class sC{constructor(e,t,i,r,a){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=a||null}}class sD{constructor(e,t,i,r,a,s){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=a,this.initSegmentChange=s}}var sx={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function r(){}function a(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function s(e,t,r,s,n){if("function"!=typeof r)throw TypeError("The listener must be a function");var o=new a(r,s||e,n),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function n(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(i=!1)),o.prototype.eventNames=function(){var e,r,a=[];if(0===this._eventsCount)return a;for(r in e=this._events)t.call(e,r)&&a.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},o.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var a=0,s=r.length,n=Array(s);a<s;a++)n[a]=r[a].fn;return n},o.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},o.prototype.emit=function(e,t,r,a,s,n){var o=i?i+e:e;if(!this._events[o])return!1;var l,d,h=this._events[o],u=arguments.length;if(h.fn){switch(h.once&&this.removeListener(e,h.fn,void 0,!0),u){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,t),!0;case 3:return h.fn.call(h.context,t,r),!0;case 4:return h.fn.call(h.context,t,r,a),!0;case 5:return h.fn.call(h.context,t,r,a,s),!0;case 6:return h.fn.call(h.context,t,r,a,s,n),!0}for(d=1,l=Array(u-1);d<u;d++)l[d-1]=arguments[d];h.fn.apply(h.context,l)}else{var c,m=h.length;for(d=0;d<m;d++)switch(h[d].once&&this.removeListener(e,h[d].fn,void 0,!0),u){case 1:h[d].fn.call(h[d].context);break;case 2:h[d].fn.call(h[d].context,t);break;case 3:h[d].fn.call(h[d].context,t,r);break;case 4:h[d].fn.call(h[d].context,t,r,a);break;default:if(!l)for(c=1,l=Array(u-1);c<u;c++)l[c-1]=arguments[c];h[d].fn.apply(h[d].context,l)}}return!0},o.prototype.on=function(e,t,i){return s(this,e,t,i,!1)},o.prototype.once=function(e,t,i){return s(this,e,t,i,!0)},o.prototype.removeListener=function(e,t,r,a){var s=i?i+e:e;if(!this._events[s])return this;if(!t)return n(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||a&&!o.once||r&&o.context!==r||n(this,s);else{for(var l=0,d=[],h=o.length;l<h;l++)(o[l].fn!==t||a&&!o[l].once||r&&o[l].context!==r)&&d.push(o[l]);d.length?this._events[s]=1===d.length?d[0]:d:n(this,s)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&n(this,t)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,e.exports=o}(sx);var sM=(oW=sx.exports)&&oW.__esModule&&Object.prototype.hasOwnProperty.call(oW,"default")?oW.default:oW;class sO{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const a=e.config;this.hls=e,this.id=t,this.useWorker=!!a.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const s=(e,t)=>{(t=t||{}).frag=this.frag,t.id=this.id,e===tq.ERROR&&(this.error=t.error),this.hls.trigger(e,t)};this.observer=new sM,this.observer.on(tq.FRAG_DECRYPTED,s),this.observer.on(tq.E
1RROR,s);const n=i9(a.preferManagedMediaSource)||{isTypeSupported:()=>!1},o={mpeg:n.isTypeSupported("audio/mpeg"),mp3:n.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:n.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&"u">typeof Worker&&(a.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__)){try{a.workerPath?(tZ.log(`loading Web Worker ${a.workerPath} for "${t}"`),this.workerContext=function(e){let t=new self.URL(e,self.location.href).href;return{worker:new self.Worker(t),scriptURL:t}}(a.workerPath)):(tZ.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){let e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e);return{worker:new self.Worker(t),objectURL:t}}()),this.onwmsg=e=>this.onWorkerMessage(e);const{worker:e}=this.workerContext;e.addEventListener("message",this.onwmsg),e.onerror=e=>{let i=Error(`${e.message} (${e.filename}:${e.lineno})`);a.enableWorker=!1,tZ.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(tq.ERROR,{type:tj.OTHER_ERROR,details:tY.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:i})},e.postMessage({cmd:"init",typeSupported:o,vendor:"",id:t,config:JSON.stringify(a)})}catch(e){tZ.warn(`Error setting up "${t}" Web Worker, fallback to inline`,e),this.resetWorker(),this.error=null,this.transmuxer=new sL(this.observer,o,a,"",t)}return}this.transmuxer=new sL(this.observer,o,a,"",t)}resetWorker(){if(this.workerContext){let{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{let e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}let e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,r,a,s,n,o,l,d){var h,u;l.transmuxing.start=self.performance.now();let{transmuxer:c}=this,m=s?s.start:a.start,p=a.decryptdata,f=this.frag,g=!(f&&a.cc===f.cc),v=!(f&&l.level===f.level),E=f?l.sn-f.sn:-1,b=this.part?l.part-this.part.index:-1,y=0===E&&l.id>1&&l.id===(null==f?void 0:f.stats.chunkCount),T=!v&&(1===E||0===E&&(1===b||y&&b<=0)),A=self.performance.now();(v||E||0===a.stats.parsing.start)&&(a.stats.parsing.start=A),s&&(b||!T)&&(s.stats.parsing.start=A);let _=!(f&&(null==(h=a.initSegment)?void 0:h.url)===(null==(u=f.initSegment)?void 0:u.url)),k=new sD(g,T,o,v,m,_);if(!T||g||_){tZ.log(`[transmuxer-interface, ${a.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id} 2 discontinuity: ${g} 3 trackSwitch: ${v} 4 contiguous: ${T} 5 accurateTimeOffset: ${o} 6 timeOffset: ${m} 7 initSegmentChange: ${_}`);let e=new sC(i,r,t,n,d);this.configureTransmuxer(e)}if(this.frag=a,this.part=s,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:p,chunkMeta:l,state:k},e instanceof ArrayBuffer?[e]:[]);else if(c){let t=c.push(e,p,l,k);sI(t)?(c.async=!0,t.then(e=>{this.handleTransmuxComplete(e)}).catch(e=>{this.transmuxerError(e,l,"transmuxer-interface push error")})):(c.async=!1,this.handleTransmuxComplete(t))}}flush(e){e.transmuxing.start=self.performance.now();let{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);sI(i)||t.async?(sI(i)||(i=Promise.resolve(i)),i.then(t=>{this.handleFlushResult(t,e)}).catch(t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")})):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(e=>{this.handleTransmuxComplete(e)}),this.onFlush(t)}onWorkerMessage(e){let t=e.data;if(!(null!=t&&t.event))return void tZ.warn(`worker message received with no ${t?"event name":"data"}`);let i=this.hls;if(this.hls)switch(t.event){case"init":{var r;let e=null==(r=this.workerContext)?void 0:r.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":tZ[t.data.logType]&&tZ[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}}configureTransmuxer(e){let{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function sP(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!sN(e[i].attrs,t[i].attrs))return!1;return!0}function sN(e,t,i){let r=e["STABLE-RENDITION-ID"];return r&&!i?r===t["STABLE-RENDITION-ID"]:!(i||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>e[i]!==t[i])}function sU(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class sF{constructor(e){this.buffered=void 0;const t=(t,i,r)=>{if((i>>>=0)>r-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${r})`);return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}class sB{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){let r=this.queues[t];r.push(e),1!==r.length||i||this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t,i=new Promise(e=>{t=e}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),i}executeNext(e){let t=this.queues[e];if(t.length){let i=t[0];try{i.execute()}catch(r){tZ.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${r}`),i.onError(r);let t=this.buffers[e];null!=t&&t.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}let s$=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function sH(e){let t=e.querySelectorAll("source");[].slice.call(t).forEach(t=>{e.removeChild(t)})}let sW={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,
7185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},sG=e=>String.fromCharCode(sW[e]||e),sV={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},sK={17:2,18:4,21:6,22:8,23:10,19:13,20:15},sq={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},sj={25:2,26:4,29:6,30:8,31:10,27:13,28:15},sY=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class sz{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){let i="function"==typeof t?t():t;tZ.log(`${this.time} [${e}] ${i}`)}}}let sX=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class sQ{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){let t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){let r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class sZ{constructor(){this.uchar=" ",this.penState=new sQ}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return" "===this.uchar&&this.penState.isDefault()}}class sJ{constructor(e){this.chars=[],this.pos=0,this.currPenState=new sQ,this.cueStartTime=null,this.logger=void 0;for(let e=0;e<100;e++)this.chars.push(new sZ);this.logger=e}equals(e){for(let t=0;t<100;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<100;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<100;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=100)}moveCursor(e){let t=this.pos+e;if(e>1)for(let e=this.pos+1;e<t+1;e++)this.chars[e].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();let t=sG(e);this.pos>=100?this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t<100;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){let e=[],t=!0;for(let i=0;i<100;i++){let r=this.chars[i].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class s0{constructor(e){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<15;t++)this.rows.push(new sJ(e));this.logger=e}reset(){for(let e=0;e<15;e++)this.rows[e].clear();this.currRow=14}equals(e){let t=!0;for(let i=0;i<15;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<15;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let e=0;e<15;e++)this.rows[e].clear();let e=this.currRow+1-this.nrRollUpRows,i=this.lastOutputScreen;if(i){let r=i.rows[e].cueStartTime,a=this.logger.time;if(null!==r&&null!==a&&r<a)for(let r=0;r<this.nrRollUpRows;r++)this.rows[t-this.nrRollUpRows+r+1].copy(i.rows[e+r])}}this.currRow=t;let i=this.rows[this.currRow];if(null!==e.indent){let t=Math.max(e.indent-1,0);i.setCursor(e.indent),e.color=i.chars[t].penState.foreground}let r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,()=>this.getDisplayText());let e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;let t=[],i="",r=-1;for(let i=0;i<15;i++){let a=this.rows[i].getTextString();a&&(r=i+1,e?t.push("Row "+r+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class s1{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new s0(i),this.nonDisplayedMemory=new s0(i),this.lastOutputScreen=new s0(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);let t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),("MODE_PAINT-ON"===this.mode||"MODE_ROLL-UP"===this.mode)&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}
7ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){let e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){let t={flash:!1};(t.underline=e%2==1,t.italics=e>=46,t.italics)?t.foreground="white":t.foreground=["white","green","blue","cyan","red","yellow","magenta"][Math.floor(e/2)-16],this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){let t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&!this.displayedMemory.isEmpty()&&(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e)}}class s2{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const r=this.logger=new sz;this.channels=[null,new s1(e,t,r),new s1(e+1,i,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e<t.length;e+=2){var i,r,a,s,n,o,l,d;let h=127&t[e],u=127&t[e+1],c=!1,m=null;if(0===h&&0===u)continue;this.logger.log(3,()=>"["+sX([t[e],t[e+1]])+"] -> ("+sX([h,u])+")");let p=this.cmdHistory;if(h>=16&&h<=31){if(i=h,r=u,(a=p).a===i&&a.b===r){(s=p).a=null,s.b=null,this.logger.log(3,()=>"Repeated command ("+sX([h,u])+") is dropped");continue}n=h,o=u,(l=this.cmdHistory).a=n,l.b=o,(c=this.parseCmd(h,u))||(c=this.parseMidrow(h,u)),c||(c=this.parsePAC(h,u)),c||(c=this.parseBackgroundAttributes(h,u))}else{(d=p).a=null,d.b=null}if(!c&&(m=this.parseChars(h,u))){let e=this.currentChannel;e&&e>0?this.channels[e].insertChars(m):this.logger.log(2,"No channel found yet. TEXT-MODE?")}c||m||this.logger.log(2,()=>"Couldn't parse cleaned data "+sX([h,u])+" orig: "+sX([t[e],t[e+1]]))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;let i=20===e||21===e||23===e?1:2,r=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if((i=17===e?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;let r=this.channels[i];return!!r&&(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+sX([e,t])+")"),!0)}return!1}parsePAC(e,t){let i,r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,a=(16===e||24===e)&&t>=64&&t<=95;if(!(r||a))return!1;let s=e<=23?1:2;i=t>
7=64&&t<=95?1===s?sV[e]:sq[e]:1===s?sK[e]:sj[e];let n=this.channels[s];return!!n&&(n.setPAC(this.interpretPAC(i,t)),this.currentChannel=s,!0)}interpretPAC(e,t){let i,r={color:null,italics:!1,indent:null,underline:!1,row:e};return r.underline=(1&(i=t>95?t-96:t-64))==1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((i-16)/2),r}parseChars(e,t){let i,r=null,a=null;if(e>=25?(i=2,a=e-8):(i=1,a=e),a>=17&&a<=19){let e;e=17===a?t+80:18===a?t+112:t+144,this.logger.log(2,()=>"Special char '"+sG(e)+"' in channel "+i),r=[e]}else e>=32&&e<=127&&(r=0===t?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+sX(r).join(",")),r}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;let i={};return 16===e||24===e?(i.background=sY[Math.floor((t-32)/2)],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0)),this.channels[e<=23?1:2].setBkgData(i),!0}reset(){var e;for(let e=0;e<Object.keys(this.channels).length;e++){let t=this.channels[e];t&&t.reset()}(e=this.cmdHistory).a=null,e.b=null}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){let i=this.channels[t];i&&i.cueSplitAtTime(e)}}}class s3{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var s4=function(){if(null!=ir&&ir.VTTCue)return self.VTTCue;let e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t||!Array.isArray(e))return!1;let i=t.toLowerCase();return!!~e.indexOf(i)&&i}function r(e){let t=1;for(;t<arguments.length;t++){let i=arguments[t];for(let t in i)e[t]=i[t]}return e}function a(a,s,n){let o={enumerable:!0};this.hasBeenReset=!1;let l="",d=!1,h=a,u=s,c=n,m=null,p="",f=!0,g="auto",v="start",E=50,b="middle",y=50,T="middle";Object.defineProperty(this,"id",r({},o,{get:function(){return l},set:function(e){l=""+e}})),Object.defineProperty(this,"pauseOnExit",r({},o,{get:function(){return d},set:function(e){d=!!e}})),Object.defineProperty(this,"startTime",r({},o,{get:function(){return h},set:function(e){if("number"!=typeof e)throw TypeError("Start time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"endTime",r({},o,{get:function(){return u},set:function(e){if("number"!=typeof e)throw TypeError("End time must be set to a number.");u=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"text",r({},o,{get:function(){return c},set:function(e){c=""+e,this.hasBeenReset=!0}})),Object.defineProperty(this,"region",r({},o,{get:function(){return m},set:function(e){m=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"vertical",r({},o,{get:function(){return p},set:function(t){let r=i(e,t);if(!1===r)throw SyntaxError("An invalid or illegal string was specified.");p=r,this.hasBeenReset=!0}})),Object.defineProperty(this,"snapToLines",r({},o,{get:function(){return f},set:function(e){f=!!e,this.hasBeenReset=!0}})),Object.defineProperty(this,"line",r({},o,{get:function(){return g},set:function(e){if("number"!=typeof e&&"auto"!==e)throw SyntaxError("An invalid number or illegal string was specified.");g=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"lineAlign",r({},o,{get:function(){return v},set:function(e){let r=i(t,e);if(!r)throw SyntaxError("An invalid or illegal string was specified.");v=r,this.hasBeenReset=!0}})),Object.defineProperty(this,"position",r({},o,{get:function(){return E},set:function(e){if(e<0||e>100)throw Error("Position must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"positionAlign",r({},o,{get:function(){return b},set:function(e){let r=i(t,e);if(!r)throw SyntaxError("An invalid or illegal string was specified.");b=r,this.hasBeenReset=!0}})),Object.defineProperty(this,"size",r({},o,{get:function(){return y},set:function(e){if(e<0||e>100)throw Error("Size must be between 0 and 100.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"align",r({},o,{get:function(){return T},set:function(e){let r=i(t,e);if(!r)throw SyntaxError("An invalid or illegal string was specified.");T=r,this.hasBeenReset=!0}})),this.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class s5{decode(e,t){if(!e)return"";if("string"!=typeof e)throw Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function s8(e){function t(e,t,i,r){return(0|e)*3600+(0|t)*60+(0|i)+parseFloat(r||0)}let i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class s9{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){let i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function s6(e,t,i,r){let a=r?e.split(r):[e];for(let e in a){if("string"!=typeof a[e])continue;let r=a[e].split(i);if(2===r.length)t(r[0],r[1])}}let s7=new s4(0,0,""),ne="middle"===s7.align?"middle":"center";function nt(e){return e.replace(/<br(?: \/)?>/gi,"\n")}class ni{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new s5,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){let t=this;function i(){let e=t.buffer,i=0;for(e=nt(e);i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;let r=e.slice(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.slice(i),r}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{let e="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;let r=(e=i()).match(/^()?WEBVTT([ \t].*)?$/);if(!(null!=r&&r[0]))throw Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer&&/\r\n|\n/.test(t.buffer);)switch(a?a=!1:e=i(),t.state){case"HEADER":if(/:/.test(e)){var r;r=e,s6(r,function(e,t){},/:/)}else e||(t.state="ID");continue;case"NOTE":e||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(e)){t.state="NOTE";break}if(!e)continue;if(t.cue=new s4(0,0,""),t.state="CUE",-1===e.indexOf("-->")){t.cue.id=e;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{!function(e,t,i){var r;let a,s,n,o=e;function l(){let t=s8(e);if(null===t)throw Error("Malformed timestamp: "+o);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function d(){e=e.replace(/^\s+/,"")}if(d(),t.startTime=l(),d(),"-->"!==e.slice(0,3))throw Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);e=e.slice(3),d(),t.endTime=l(),d(),r=e,a=new s9,s6(r,function(e,t){let r;switch(e){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===t){a.set(e,i[r].region);break}break;case"vertical":a.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),a.integer(e,r[0]),a.percent(e,r[0])&&a.set("snapToLines",!1),a.alt(e,r[0],["auto"]),2===r.length&&a.alt("lineAlign",r[1],["start",ne,"end"]);break;case"position":r=t.split(","),a.percent(e,r[0]),2===r.length&&a.alt("positionAlign",r[1],["start",ne,"end","line-left","line-right","auto"]);break;case"size":a.percent(e,t);break;case"align":a.alt(e,t,["start",ne,"end","left","right"])}},/:/,/\s/),t.region=a.get("region",null),t.vertical=a.get("vertical",""),"auto"===(s=a.get("line","auto"))&&-1===s7.line&&(s=-1),t.line=s,t.lineAlign=a.get("lineAlign","start"),t.snapToLines=a.get("snapToLines",!0),t.size=a.get("size",100),t.align=a.get("align",ne),"auto"===(n=a.get("position","auto"))&&50===s7.position&&(n="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=n}(e,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{let i=-1!==e.indexOf("-->");if(!e||i&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=e}continue;case"BADCUE":e||(t.state="ID")}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this}flush(){try{if((this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state||"BADWEBVTT"===this.state)throw Error("Malformed WebVTT signature.")}catch(e){this.onparsingerror&&this.onparsingerror(e)}return this.onflush&&this.onflush(),this}}let nr=/\r\n|\n\r|\n|\r/g,na=function(e,t,i=0){return e.slice(i,i+t.length)===t},ns=function(e){let t=parseInt(e.slice(-3)),i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),a=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!tG(t)||!tG(i)||!tG(r)||!tG(a))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=6e4*r,t+=36e5*a},nn=function(e){let t=5381,i=e.length;for(;i;)t=33*t^e.charCodeAt(--i);return(t>>>0).toString()};function no(e,t,i){return nn(e.toString())+nn(t.toString())+nn(i)}
7let nl=function(e,t,i){let r=e[t],a=e[r.prevCC];if(!a||!a.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;null!=(s=a)&&s.new;){var s;e.ccOffset+=r.start-a.start,r.new=!1,a=e[(r=a).prevCC]}e.presentationOffset=i},nd="stpp.ttml.im1t",nh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,nu=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,nc={left:"start",center:"center",right:"end",start:"start",end:"end"};function nm(e,t,i,r){let a=iK(new Uint8Array(e),["mdat"]);if(0===a.length)return void r(Error("Could not parse IMSC1 mdat"));let s=a.map(e=>iP(e)),n=function(e,t=1,i=!1){return sg(e,1,1/t,i)}(t.baseTime,t.timescale);try{s.forEach(e=>i(function(e,t){let i=new DOMParser().parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!i)throw Error("Invalid ttml");let r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(r).reduce((e,t)=>(e[t]=i.getAttribute(`ttp:${t}`)||r[t],e),{}),s="preserve"!==i.getAttribute("xml:space"),n=nf(np(i,"styling","style")),o=nf(np(i,"layout","region")),l=np(i,"body","[begin]");return[].map.call(l,e=>{var i,r,l;let d,h,u,c=function e(t,i){return[].slice.call(t.childNodes).reduce((t,r,a)=>{var s;return"br"===r.nodeName&&a?t+"\n":null!=(s=r.childNodes)&&s.length?e(r,i):i?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent},"")}(e,s);if(!c||!e.hasAttribute("begin"))return null;let m=nE(e.getAttribute("begin"),a),p=nE(e.getAttribute("dur"),a),f=nE(e.getAttribute("end"),a);if(null===m)throw nv(e);if(null===f){if(null===p)throw nv(e);f=m+p}let g=new s4(m-t,f-t,c);g.id=no(g.startTime,g.endTime,g.text);let v=(i=o[e.getAttribute("region")],r=n[e.getAttribute("style")],l=n,d="http://www.w3.org/ns/ttml#styling",h=null,(u=null!=i&&i.hasAttribute("style")?i.getAttribute("style"):null)&&l.hasOwnProperty(u)&&(h=l[u]),["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((e,t)=>{let a=ng(r,d,t)||ng(i,d,t)||ng(h,d,t);return a&&(e[t]=a),e},{})),{textAlign:E}=v;if(E){let e=nc[E];e&&(g.lineAlign=e),g.align=E}return tW(g,v),g}).filter(e=>null!==e)}(e,n)))}catch(e){r(e)}}function np(e,t,i){let r=e.getElementsByTagName(t)[0];return r?[].slice.call(r.querySelectorAll(i)):[]}function nf(e){return e.reduce((e,t)=>{let i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function ng(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function nv(e){return Error(`Could not parse ttml timestamp ${e}`)}function nE(e,t){var i,r;let a,s;if(!e)return null;let n=s8(e);return null===n&&(nh.test(e)?(i=e,r=t,s=(0|(a=nh.exec(i))[4])+(0|a[5])/r.subFrameRate,n=(0|a[1])*3600+(0|a[2])*60+(0|a[3])+s/r.frameRate):nu.test(e)&&(n=function(e,t){let i=nu.exec(e),r=Number(i[1]);switch(i[2]){case"h":return 3600*r;case"m":return 60*r;case"ms":return 1e3*r;case"f":return r/t.frameRate;case"t":return r/t.tickRate}return r}(e,t))),n}function nb(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function ny(e,t){return!!e&&e.kind===nb(t)&&sU(t,e)}function nT(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class nA{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=1/0,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){let{hls:e}=this;e.on(tq.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(tq.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tq.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tq.BUFFER_CODECS,this.onBufferCodecs,this),e.on(tq.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){let{hls:e}=this;e.off(tq.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(tq.MEDIA_ATTA
7CHING,this.onMediaAttaching,this),e.off(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tq.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tq.BUFFER_CODECS,this.onBufferCodecs,this),e.off(tq.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){let i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){let i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&tG(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}let e=this.hls.levels;if(e.length){let t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&tZ.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){let t=this.hls.levels;if(!t.length)return -1;let i=t.filter((t,i)=>this.isLevelAllowed(t)&&i<=e);return this.clientRect=null,nA.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=1/0,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=1/0,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;let e=this.media,t={width:0,height:0};if(e){let i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}isLevelAllowed(e){return!this.restrictedLevels.some(t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height)}static getMaxLevelByMediaSize(e,t,i){if(!(null!=e&&e.length))return -1;let r=(e,t)=>!t||e.width!==t.width||e.height!==t.height,a=e.length-1,s=Math.max(t,i);for(let t=0;t<e.length;t+=1){let i=e[t];if((i.width>=s||i.height>=s)&&r(i,e[t+1])){a=t;break}}return a}}let n_="[eme]";class nk{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=nk.CDMCleanupPromise?[nk.CDMCleanupPromise]:[],this.debug=tZ.debug.bind(tZ,n_),this.log=tZ.log.bind(tZ,n_),this.warn=tZ.warn.bind(tZ,n_),this.error=tZ.error.bind(tZ,n_),this.onMediaEncrypted=e=>{let{initDataType:t,initData:i}=e,r=`"${e.type}" event: init data type: "${t}"`;if(this.debug(r),null!==i){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=iv(this.config));let t=e.map(ig).filter(e=>!!e);this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then(a=>{let s,n,o=im(a);if("sinf"===t){if(o!==is)return void this.warn(`Ignoring unexpected "${e.type}" event with init data type: "${t}" for selected key-system ${o}`);let a=iB(new Uint8Array(i));try{let e=it(JSON.parse(a).sinf),t=iX(e);if(!t)throw Error("'schm' box missing or not cbcs/cenc with schi > tenc");s=t.subarray(8,24),n=is}catch(e){this.warn(`${r} Failed to parse sinf: ${e}`);return}}else{if(o!==il&&o!==io)return void this.warn(`Ignoring unexpected "${e.type}" event with init data type: "${t}" for selected key-system ${o}`);let a=function(e){let t=[];if(e instanceof ArrayBuffer){let i=e.byteLength,r=0;for(;r+32<i;){let i=function(e){let t=e.getUint32(0),i=e.byteOffset,r=e.byteLength;if(r<t)return{offset:i,size:r};if(0x70737368!==e.getUint32(4))return{offset:i,size:t};let a=e.getUint32(8)>>>24;if(0!==a&&1!==a)return{offset:i,size:t};let s=e.buffer,n=iN(new Uint8Array(s,i+12,16)),o=e.getUint32(28),l=null,d=null;if(0===a){if(t-32<o||o<22)return{offset:i,size:t};d=new Uint8Array(s,i+32,o)}else if(1===a){if(!o||r<i+32+16*o+16)return{offset:i,size:t};l=[];for(let e=0;e<o;e++)l.push(new Uint8Array(s,i+32+16*e,16))}return{version:a,systemId:n,kids:l,data:d,offset:i,size:t}}(new DataView(e,r));t.push(i),r+=i.size}}return t}(i),l=a.filter(e=>!!e.systemId&&ip(e.systemId)===o);l.length>1&&this.warn(`${r} Using first of ${l.length} pssh found for selected key-system ${o}`);let d=l[0];if(!d)return void(0===a.length||a.some(e=>!e.systemId)?this.warn(`${r} contains incomplete or invalid pssh data`):this.log(`ignoring ${r} for ${a.map(e=>ip(e.systemId)).join(",")} pssh data in favor of playlist keys`));if(n=ip(d.systemId),0===d.version&&d.data)if(n===il){let e=d.data.length-22;s=d.data.subarray(e,e+16)}else n===io&&(s=ib(d.data))}if(!n||!s)return void this.log(`Unable to handle ${r} with key-system ${o}`);let l=iN(s),{keyIdToKeySessionPromise:d,mediaKeySessions:h}=this,u=d[l];for(let e=0;e<h.length;e++){let r=h[e],a=r.decryptdata;if(!a.keyId)continue;let n=iN(a.keyId);if(l===n||-1!==a.uri.replace(/-/g,"").indexOf(l)){if(u=d[n],a.pssh)break;delete d[n],a.pssh=new Uint8Array(i),a.keyId=s,(u=d[l]=u.then(()=>this.generateRequestWithPreferredKeySession(r,t,i,"encrypted-event-key-match"))).catch(e=>this.handleError(e));break}}if(!u){if(n!==o)return void this.log(`Ignoring "${r}" with ${n} init data for selected key-system ${o}`);(u=d[l]=this.getKeySystemSelectionPromise([n]).then(({keySystem:e,mediaKeys:r})=>{var a;this.throwIfDestroyed();let n=new i2("ISO-23001-7",l,null!=(a=ig(e))?a:"");return n.pssh=new Uint8Array(i),n.keyId=s,this.attemptSetMediaKeys(e,r).then(()=>{this.throwIfDestroyed();let a=this.createMediaKeySessionContext({decryptdata:n,keySystem:e,mediaKeys:r});return this.generateRequestWithPreferredKeySession(a,t,i,"encrypted-event-no-match")})})).catch(e=>this.handleError(e))}})}},this.onWaitingForKey=e=>{this.log(`"${e.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();let e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}
7registerListeners(){this.hls.on(tq.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(tq.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(tq.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(tq.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(tq.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(tq.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){let{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t[e];return r?r.licenseUrl:e===il&&i?i:void 0}getLicenseServerUrlOrThrow(e){let t=this.getLicenseServerUrl(e);if(void 0===t)throw Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){let{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){let t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,r=t.map(e=>e.audioCodec).filter(i),a=t.map(e=>e.videoCodec).filter(i);return r.length+a.length===0&&a.push("avc1.42e01e"),new Promise((t,i)=>{let s=e=>{let n=e.shift();this.getMediaKeysPromise(n,r,a).then(e=>t({keySystem:n,mediaKeys:e})).catch(t=>{e.length?s(e):t instanceof nS?i(t):i(new nS({type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})};s(e)})}requestMediaKeySystemAccess(e,t){let{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===iE&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){let r=function(e,t,i,r){var a,s,n,o;let l;switch(e){case is:l=["cenc","sinf"];break;case il:case io:l=["cenc"];break;case ia:l=["cenc","keyids"];break;default:throw Error(`Unknown key-system: ${e}`)}return a=l,s=t,n=i,[{initDataTypes:a,persistentState:(o=r).persistentState||"optional",distinctiveIdentifier:o.distinctiveIdentifier||"optional",sessionTypes:o.sessionTypes||[o.sessionType||"temporary"],audioCapabilities:s.map(e=>({contentType:`audio/mp4; codecs="${e}"`,robustness:o.audioRobustness||"",encryptionScheme:o.audioEncryptionScheme||null})),videoCapabilities:n.map(e=>({contentType:`video/mp4; codecs="${e}"`,robustness:o.videoRobustness||"",encryptionScheme:o.videoEncryptionScheme||null}))}]}(e,t,i,this.config.drmSystemOptions),a=this.keySystemAccessPromises[e],s=null==a?void 0:a.keySystemAccess;if(!s){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(r)}`),s=this.requestMediaKeySystemAccess(e,r);let t=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch(t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)}),s.then(i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);let r=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),t.mediaKeys=i.createMediaKeys().then(t=>(this.log(`Media-keys created for "${e}"`),r.then(i=>i?this.setMediaKeysServerCertificate(t,e,i):t))),t.mediaKeys.catch(t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)}),t.mediaKeys})}return s.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${iN(e.keyId||[])}`);let r=i.createSession(),a={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(a),a}renewKeySession(e){let t=e.decryptdata;if(t.pssh){let i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t);this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,"cenc",t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw Error("keyId is null");return iN(e.keyId)}updateKeySession(e,t){var i;let r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${iN((null==(i=e.decryptdata)?void 0:i.keyId)||[])} 8 } (data length: ${t?t.byteLength:t})`),r.update(t)}selectKeySystemFormat(e){let t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{let r=iv(this.config),a=e.map(im).filter(e=>!!e&&-1!==r.indexOf(e));return this.getKeySystemSelectionPromise(a).then(({keySystem:e})=>{let r=ig(e);r?t(r):i(Error(`Unable to find format for key-system "${e}"`))}).catch(i)})}loadKey(e){let t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let a=this.keyIdToKeySessionPromise[i];return a||(a=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then(({keySystem:i,mediaKeys:a})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(i,a).then(()=>{this.throwIfDestroyed();let e=this.createMediaKeySessionContext({keySystem:i,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(e,"cenc",t.pssh,"playlist-key")})))).catch(e=>this.handleError(e)),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof nS?this.hls.trigger(tq.ERROR,e.data):this.hls.trigger(tq.ERROR,{type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}
8getKeySystemForKeyPromise(e){let t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){let t=im(e.keyFormat),i=t?[t]:iv(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=iv(this.config)),0===e.length)throw new nS({type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){let i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);let r=Promise.all(i).then(()=>{if(!this.media)throw Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>-1===i.indexOf(e))})}generateRequestWithPreferredKeySession(e,t,i,r){var a,s,n;let o=null==(a=this.config.drmSystems)||null==(s=a[e.keySystem])?void 0:s.generateRequest;if(o)try{let r=o.call(this.hls,t,i,e);if(!r)throw Error("Invalid response from configured generateRequest filter");t=r.initDataType,i=e.decryptdata.pssh=r.initData?new Uint8Array(r.initData):null}catch(e){if(this.warn(e.message),null!=(n=this.hls)&&n.config.debug)throw e}if(null===i)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);let l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);let d=new sM,h=e._onmessage=t=>{let i=e.mediaKeysSession;if(!i)return void d.emit("error",Error("invalid state"));let{messageType:r,message:a}=t;this.log(`"${r}" message event for session "${i.sessionId}" message size: ${a.byteLength}`),"license-request"===r||"license-renewal"===r?this.renewLicense(e,a).catch(e=>{this.handleError(e),d.emit("error",e)}):"license-release"===r?e.keySystem===is&&(this.updateKeySession(e,ii("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${r}"`)},u=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void d.emit("error",Error("invalid state"));this.onKeyStatusChange(e);let i=e.keyStatus;d.emit("keyStatus",i),"expired"===i&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",u);let c=new Promise((e,t)=>{d.on("error",t),d.on("keyStatus",i=>{i.startsWith("usable")?e():"output-restricted"===i?t(new nS({type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===i?t(new nS({type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${i}"`)):"expired"===i?t(Error("key expired while generating request")):this.warn(`unhandled key status change "${i}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var t;this.log(`Request generated for key-session "${null==(t=e.mediaKeysSession)?void 0:t.sessionId}" keyId: ${l}`)}).catch(e=>{throw new nS({type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},`Error generating key-session request: ${e}`)}).then(()=>c).catch(t=>{throw d.removeAllListeners(),this.removeSession(e),t}).then(()=>(d.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${iN("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${iN(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){let t=this.config,i=new t.loader(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,s)=>{let n={responseType:"arraybuffer",url:r},o=t.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};i.load(n,l,{onSuccess:(e,t,i,r)=>{a(e.data)},onError:(t,i,a,o)=>{s(new nS({type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:tH({url:n.url,data:void 0},t)},`"${e}" certificate request failed (${r}). Status: ${t.code} (${t.text})`))},onTimeout:(t,i,a)=>{s(new nS({type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:n.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(e,t,i)=>{s(Error("aborted"))}})})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,a)=>{e.setServerCertificate(i).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${null==i?void 0:i.byteLength}) on "${t}"`),r(e)}).catch(e=>{a(new nS({type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(t=>this.updateKeySession(e,new Uint8Array(t)).catch(e=>{throw new nS({type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))}unpackPlayReadyKeyMessage(e,t){let i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;let r=new DOMParser().parseFromString(i,"application/xml"),a=r.querySelectorAll("HttpHeader");if(a.length>0){let t;for(let i=0,r=a.length;i<r;i++){var s,n;let r=null==(s=(t=a[i]).querySelector("name"))?void 0:s.textContent,o=null==(n=t.querySelector("value"))?void 0:n.textContent;r&&o&&e.setRequestHeader(r,o)}}let o=r.querySelector("Challenge"),l=null==o?void 0:o.textContent;
8if(!l)throw Error("Cannot find <Challenge> in key message");return ii(atob(l))}setupLicenseXHR(e,t,i,r){let a=this.config.licenseXhrSetup;return a?Promise.resolve().then(()=>{if(!i.decryptdata)throw Error("Key removed");return a.call(this.hls,e,t,i,r)}).catch(s=>{if(!i.decryptdata)throw s;return e.open("POST",t,!0),a.call(this.hls,e,t,i,r)}).then(i=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:i||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){let i=this.config.keyLoadPolicy.default;return new Promise((r,a)=>{let s=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${s}`);let n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return a(Error("invalid state"));if(4===n.readyState)if(200===n.status){this._requestLicenseFailureCount=0;let t=n.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);let i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,n,s,e)}catch(e){this.error(e)}r(t)}else{let o=i.errorRetry,l=o?o.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||n.status>=400&&n.status<500)a(new nS({type:tj.KEY_SYSTEM_ERROR,details:tY.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:{url:s,data:void 0,code:n.status,text:n.statusText}},`License Request XHR failed (${s}). Status: ${n.status} (${n.statusText})`));else{let i=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(e,t).then(r,a)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=n,this.setupLicenseXHR(n,s,e,t).then(({xhr:t,licenseChallenge:i})=>{e.keySystem==io&&(i=this.unpackPlayReadyKeyMessage(t,i)),t.send(i)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;let i=t.media;this.media=i,i.removeEventListener("encrypted",this.onMediaEncrypted),i.removeEventListener("waitingforkey",this.onWaitingForKey),i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){let e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},i2.clearKeyUriToKeyIdMap();let i=t.length;nk.CDMCleanupPromise=Promise.all(t.map(e=>this.removeSession(e)).concat(null==e?void 0:e.setMediaKeys(null).catch(e=>{this.log(`Could not clear media keys: ${e}`)}))).then(()=>
8{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(e=>{this.log(`Could not close sessions and clear media keys: ${e}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){let e=t.reduce((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){let{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;let r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(e=>{this.log(`Could not remove session: ${e}`)}).then(()=>t.close()).catch(e=>{this.log(`Could not close session: ${e}`)})}}}nk.CDMCleanupPromise=void 0;class nS extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=Error(t)),this.data=e,e.err=e.error}}(oG=oq||(oq={})).MANIFEST="m",oG.AUDIO="a",oG.VIDEO="v",oG.MUXED="av",oG.INIT="i",oG.CAPTION="c",oG.TIMED_TEXT="tt",oG.KEY="k",oG.OTHER="o",(oV=oj||(oj={})).DASH="d",oV.HLS="h",oV.SMOOTH="s",oV.OTHER="o",(oK=oY||(oY={})).OBJECT="CMCD-Object",oK.REQUEST="CMCD-Request",oK.SESSION="CMCD-Session",oK.STATUS="CMCD-Status";let nw={[oY.OBJECT]:["br","d","ot","tb"],[oY.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[oY.SESSION]:["cid","pr","sf","sid","st","v"],[oY.STATUS]:["bs","rtp"]};class nL{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(e=>e instanceof nL?e:new nL(e))),this.value=e,this.params=t}}class nR{constructor(e){this.description=void 0,this.description=e}}let nI="Bare Item",nC=/[\x00-\x1f\x7f]+/;function nD(e,t,i){return Error(`failed to serialize "${Array.isArray(e)?JSON.stringify(e):e instanceof Map?"Map{}":e instanceof Set?"Set{}":"object"==typeof e?JSON.stringify(e):String(e)}" as ${t}`,{cause:i})}function nx(e){if(e<-0x38d7ea4c67fff||0x38d7ea4c67fff<e)throw nD(e,"Integer");return e.toString()}function nM(e){let t=e.description||e.toString().slice(7,-1);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw nD(t,"Token");return t}function nO(e){switch(typeof e){case"number":if(!tG(e))throw nD(e,nI);if(Number.isInteger(e))return nx(e);let t=function e(t,i){if(t<0)return-e(-t,i);let r=Math.pow(10,i);if(!(Math.abs(t*r%1-.5)<Number.EPSILON))return Math.round(t*r)/r;{let e=Math.floor(t*r);return(e%2==0?e:e+1)/r}}(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw nD(e,"Decimal");let i=t.toString();return i.includes(".")?i:`${i}.0`;case"string":if(nC.test(e))throw nD(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;case"symbol":return nM(e);case"boolean":if("boolean"!=typeof e)throw nD(e,"Boolean");return e?"?1":"?0";case"object":if(e instanceof Date)return`@${nx(e.getTime()/1e3)}`;if(e instanceof Uint8Array){if(!1===ArrayBuffer.isView(e))throw nD(e,"Byte Sequence");return`:${btoa(String.fromCharCode(...e))}:`}if(e instanceof nR)return nM(e);default:throw nD(e,nI)}}function nP(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw nD(e,"Key");return e}function nN(e){return null==e?"":Object.entries(e).map(([e,t])=>!0===t?`;${nP(e)}`:`;${nP(e)}=${nO(t)}`).join("")}function nU(e){return e instanceof nL?`${nO(e.value)}${nN(e.params)}`:nO(e)}let nF=e=>Math.round(e),nB=e=>100*nF(e/100),n$={br:nF,d:nF,bl:nB,dl:nB,mtp:nB,nor:(e,t)=>(null!=t&&t.baseUrl&&(e=function(e,t){let i=new URL(e),r=new URL(t);if(i.origin!==r.origin)return e;let a=i.pathname.split("/").slice(1),s=r.pathname.split("/").slice(1,-1);for(;a[0]===s[0];)a.shift(),s.shift();for(;s.length;)s.shift(),a.unshift("..");return a.join("/")}(e,t.baseUrl)),encodeURIComponent(e)),rtp:nB,tb:nF};function nH(e,t={}){return e?function(e,t={whitespace:!0}){if("object"!=typeof e)throw nD(e,"Dict");let i=e instanceof Map?e.entries():Object.entries(e),r=null!=t&&t.whitespace?" ":"";return Array.from(i).map(([e,t])=>{t instanceof nL==!1&&(t=new nL(t));let i=nP(e);if(!0===t.value)i+=nN(t.params);else if(i+="=",Array.isArray(t.value)){var r;i+=(r=t,`(${r.value.map(nU).join(" ")})${nN(r.params)}`)}else i+=nU(t);return i}).join(`,${r}`)}(function(e,t){let i={};if(null==e||"object"!=typeof e)return i;let r=Object.keys(e).sort(),a=tW({},n$,null==t?void 0:t.formatters),s=null==t?void 0:t.filter;return r.forEach(r=>{var n;if(null!=s&&s(r))return;let o=e[r],l=a[r];(l&&(o=l(o,t)),("v"!==r||1!==o)&&("pr"!=r||1!==o))&&("number"==typeof(n=o)?tG(n):null!=n&&""!==n&&!1!==n)&&(("ot"===r||"sf"===r||"st"===r)&&"string"==typeof o&&(o=new nR(o)),i[r]=o)}),i}(e,t),tW({whitespace:!1},t)):""}let nW=/CMCD=[^&#]+/;function nG(e,t,i,r){e&&Object.keys(t).forEach(a=>{let s=e.filter(e=>e.groupId===a).map(e=>{let s=tW({},e);return s.details=void 0,s.attrs=new t1(s.attrs),s.url=s.attrs.URI=nV(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),s.groupId=s.attrs["GROUP-ID"]=t[a],s.attrs["PATHWAY-ID"]=r,s});e.push(...s)})}function nV(e,t,i,r){let a,{HOST:s,PARAMS:n,[i]:o}=r;t&&(a=null==o?void 0:o[t])&&(e=a);let l=new self.URL(e);
8return s&&!a&&(l.host=s),n&&Object.keys(n).sort().forEach(e=>{e&&l.searchParams.set(e,n[e])}),l.href}let nK=/^age:\s*[\d.]+\s*$/im;class nq{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new t3,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){let e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){let{config:e,context:t}=this;if(!e||!t)return;let i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;let a=this.xhrSetup;a?Promise.resolve().then(()=>{if(this.loader===i&&!this.stats.aborted)return a(i,t.url)}).catch(e=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",t.url,!0),a(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(e=>{this.callbacks.onError({code:i.status,text:e.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);let r=t.headers,{maxTimeToFirstByteMs:a,maxLoadTimeMs:s}=i.loadPolicy;if(r)for(let t in r)e.setRequestHeader(t,r[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=a&&tG(a)?a:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:i}=this;if(!e||!t)return;let r=t.readyState,a=this.config;if(!i.aborted&&r>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),a.timeout!==a.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),a.timeout=a.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===r)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;let r=t.status,s="text"===t.responseType?t.responseText:null;if(r>=200&&r<300){let a=null!=s?s:t.response;if(null!=a){if(i.loading.end=Math.max(self.performance.now(),i.loading.first),i.loaded=i.total="arraybuffer"===t.responseType?a.byteLength:a.length,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;let s=this.callbacks.onProgress;if(s&&s(i,e,a,t),!this.callbacks)return;let n={url:t.responseURL,data:a,code:r};this.callbacks.onSuccess(n,i,e,t);return}}let n=a.loadPolicy.errorRetry;r8(n,i.retry,!1,{url:e.url,data:void 0,code:r})?this.retry(n):(tZ.error(`${r} while loading ${e.url}`),this.callbacks.onError({code:r,text:t.statusText},e,t,i))}}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry;if(r8(e,this.stats.retry,!0))this.retry(e);else{var t;tZ.warn(`timeout while loading ${null==(t=this.context)?void 0:t.url}`);let e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){let{context:t,stats:i}=this;this.retryDelay=r4(e,i.retry),i.retry++,tZ.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&nK.test(this.loader.getAllResponseHeaders())){let t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}let nj=/(\d+)-(\d+)\/(\d+)/;
8class nY{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||nz,this.controller=new self.AbortController,this.stats=new t3}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){var r;let a,s=this.stats;if(s.loading.start)throw Error("Loader can only be used once.");s.loading.start=self.performance.now();let n=(r=e,a={method:"GET",mode:"cors",credentials:"same-origin",signal:this.controller.signal,headers:new self.Headers(tW({},r.headers))},r.rangeEnd&&a.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),a),o=i.onProgress,l="arraybuffer"===e.responseType,d=l?"byteLength":"length",{maxTimeToFirstByteMs:h,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=h&&tG(h)?h:u,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(s,e,this.response)},t.timeout),self.fetch(this.request).then(r=>{this.response=this.loader=r;let a=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(s,e,this.response)},u-(a-s.loading.start)),!r.ok){let{status:e,statusText:t}=r;throw new nX(t||"fetch, bad network response",e,r)}return(s.loading.first=a,s.total=function(e){let t=e.get("Content-Range");if(t){let e=function(e){let t=nj.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(tG(e))return e}let i=e.get("Content-Length");if(i)return parseInt(i)}(r.headers)||s.total,o&&tG(t.highWaterMark))?this.loadProgressively(r,s,e,t.highWaterMark,o):l?r.arrayBuffer():"json"===e.responseType?r.json():r.text()}).then(r=>{let a=this.response;if(!a)throw Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);let n=r[d];n&&(s.loaded=s.total=n);let l={url:a.url,data:r,code:a.status};o&&!tG(t.highWaterMark)&&o(s,e,r,a),i.onSuccess(l,s,e,a)}).catch(t=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;let r=t&&t.code||0,a=t?t.message:null;i.onError({code:r,text:a},e,t?t.details:null,s)})}getCacheAge(){let e=null;if(this.response){let t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,r=0,a){let s=new aj,n=e.body.getReader(),o=()=>n.read().then(n=>{if(n.done)return s.dataLength&&a(t,i,s.flush(),e),Promise.resolve(new ArrayBuffer(0));let l=n.value,d=l.length;return t.loaded+=d,d<r||s.dataLength?(s.push(l),s.dataLength>=r&&a(t,i,s.flush(),e)):a(t,i,l,e),o()}).catch(()=>Promise.reject());return o()}}function nz(e,t){return new self.Request(e.url,t)}class nX extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}let nQ=/\s/,nZ={newCue(e,t,i,r){let a,s,n,o,l,d=[],h=self.VTTCue||self.TextTrackCue;for(let c=0;c<r.rows.length;c++)if(a=r.rows[c],n=!0,o=0,l="",!a.isEmpty()){var u;for(let e=0;e<a.chars.length;e++)nQ.test(a.chars[e].uchar)&&n?o++:(l+=a.chars[e].uchar,n=!1);a.cueStartTime=t,t===i&&(i+=1e-4),o>=16?o--:o++;let r=nt(l.trim()),m=no(t,i,r);null!=e&&null!=(u=e.cues)&&u.getCueById(m)||((s=new h(t,i,r)).id=m,s.line=c+1,s.align="left",s.position=10+Math.min(80,10*Math.floor(8*o/32)),d.push(s))}return e&&d.length&&(d.sort((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),d.forEach(t=>rD(e,t))),d}},nJ=tH(tH({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftw
8areAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:nq,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{let e,{fragCurrent:t,partCurrent:i,hls:r}=this,{autoLevelEnabled:a,media:s}=r;if(!t||!s)return;let n=performance.now(),o=i?i.stats:t.stats,l=i?i.duration:t.duration,d=n-o.loading.start,h=r.minAutoLevel;if(o.aborted||o.loaded&&o.loaded===o.total||t.level<=h){this.clearTimer(),this._nextAutoLevel=-1;return}if(!a||s.paused||!s.playbackRate||!s.readyState)return;let u=r.mainForwardBufferInfo;if(null===u)return;let c=this.bwEstimator.getEstimateTTFB(),m=Math.abs(s.playbackRate);if(d<=Math.max(c,l/(2*m)*1e3))return;let p=u.len/m,f=o.loading.first?o.loading.first-o.loading.start:-1,g=o.loaded&&f>-1,v=this.getBwEstimate(),E=r.levels,b=E[t.level],y=o.total||Math.max(o.loaded,Math.round(l*b.averageBitrate/8)),T=g?d-f:d;T<1&&g&&(T=Math.min(d,8*o.loaded/v));let A=g?1e3*o.loaded/T:0,_=A?(y-o.loaded)/A:8*y/v+c/1e3;if(_<=p)return;let k=A?8*A:v,S=1/0;for(e=t.level-1;e>h;e--){let t=E[e].maxBitrate;if((S=this.getTimeToLoadFrag(c/1e3,k,l*t,!E[e].details))<p)break}if(S>=_||S>10*l)return;r.nextLoadLevel=r.nextAutoLevel=e,g?this.bwEstimator.sample(d-Math.min(c,f),o.loaded):this.bwEstimator.sampleTTFB(d);let w=E[e].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>w&&this.resetEstimator(w),this.clearTimer(),tZ.warn(`[abr] Fragment ${t.sn}${i?" part "+i.index:""} of level ${t.level} is loading too slowly; 9 Time to underbuffer: ${p.toFixed(3)} s 10 Estimated load time for current fragment: ${_.toFixed(3)} s 11 Estimated load time for down switch fragment: ${S.toFixed(3)} s 12 TTFB estimate: ${0|f} ms 13 Current BW estimate: ${tG(v)?0|v:"Unknown"} bps 14 New BW estimate: ${0|this.getBwEstimate()} bps 15 Switching to level ${e} @ ${0|w} bps`),r.trigger(tq.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:i,stats:o})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(tZ.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){let e=this.hls.config;return new ai(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){let{hls:e}=this;e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.FRAG_LOADING,this.onFragLoading,this),e.on(tq.FRAG_LOADED,this.onFragLoaded,this),e.on(tq.FRAG_BUFFERED,this.onFragBuffered,this),e.on(tq.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(tq.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tq.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tq.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(tq.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e&&(e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.FRAG_LOADING,this.onFragLoading,this),e.off(tq.FRAG_LOADED,this.onFragLoaded,this),e.off(tq.FRAG_BUFFERED,this.onFragBuffered,this),e.off(tq.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(tq.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tq.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tq.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(tq.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){let i=t.frag;
15if(!this.ignoreFragment(i)){if(!i.bitrateTest){var r;this.fragCurrent=i,this.partCurrent=null!=(r=t.part)?r:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case tY.BUFFER_ADD_CODEC_ERROR:case tY.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case tY.FRAG_LOAD_TIMEOUT:{let e=t.frag,{fragCurrent:i,partCurrent:r}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){let t=performance.now(),i=r?r.stats:e.stats,a=t-i.loading.start,s=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&s>-1){let e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(a-Math.min(e,s),i.loaded)}else this.bwEstimator.sampleTTFB(a)}}}}getTimeToLoadFrag(e,t,i,r){return e+i/t+(r?this.lastLevelLoadSec:0)}onLevelLoaded(e,t){let i=this.hls.config,{loading:r}=t.stats,a=r.end-r.start;tG(a)&&(this.lastLevelLoadSec=a/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){let r=i?i.stats:t.stats;if(t.type===rk&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){let e=i?i.duration:t.duration,a=this.hls.levels[t.level],s=(a.loaded?a.loaded.bytes:0)+r.loaded,n=(a.loaded?a.loaded.duration:0)+e;a.loaded={bytes:s,duration:n},a.realBitrate=Math.round(8*s/n)}if(t.bitrateTest){let e={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(tq.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){let{frag:i,part:r}=t,a=null!=r&&r.stats.loaded?r.stats:i.stats;if(a.aborted||this.ignoreFragment(i))return;let s=a.parsing.end-a.loading.start-Math.min(a.loading.first-a.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,a.loaded),a.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==rk||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){let{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,a=this.findBestLevel(i,t,e,0,r,1,1);if(a>-1)return a;let s=this.hls.firstLevel,n=Math.min(Math.max(s,t),e);return tZ.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${s} clamped to ${n}`),n}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){let e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(-1!==e&&(!t||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;let r=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){let t=this.hls.levels;if(t.length>Math.max(e,r)&&t[e].loadError<=t[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}
15_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){let{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:r,config:a,minAutoLevel:s}=i,n=t?t.duration:e?e.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay(),d=a.abrBandWidthFactor,h=a.abrBandWidthUpFactor;if(l){let e=this.findBestLevel(o,s,r,l,0,d,h);if(e>=0)return e}let u=n?Math.min(n,a.maxStarvationDelay):a.maxStarvationDelay;if(!l){let e=this.bitrateTestDelay;e&&(u=(n?Math.min(n,a.maxLoadingDelay):a.maxLoadingDelay)-e,tZ.info(`[abr] bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*u)} ms`),d=h=1)}let c=this.findBestLevel(o,s,r,l,u,d,h);if(tZ.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${c}`),c>-1)return c;let m=i.levels[s],p=i.levels[i.loadLevel];return(null==m?void 0:m.bitrate)<(null==p?void 0:p.bitrate)?s:i.loadLevel}getStarvationDelay(){let e=this.hls,t=e.media;if(!t)return 1/0;let i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,r,a,s,n){var o,l;let d,h=r+a,u=this.lastLoadedFragLevel,c=-1===u?this.hls.firstLevel:u,{fragCurrent:m,partCurrent:p}=this,{levels:f,allAudioTracks:g,loadLevel:v,config:E}=this.hls;if(1===f.length)return 0;let b=f[c],y=!!(null!=b&&null!=(o=b.details)&&o.live),T=-1===v||-1===u,A="SDR",_=(null==b?void 0:b.frameRate)||0,{audioPreference:k,videoPreference:S}=E,w=this.audioTracksByGroup||(this.audioTracksByGroup=g.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);let r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}}));if(T){if(-1!==this.firstSelection)return this.firstSelection;let r=function(e,t,i,r,a){var s;let n,o,l=Object.keys(e),d=null==r?void 0:r.channels,h=null==r?void 0:r.audioCodec,u=d&&2===parseInt(d),c=!0,m=!1,p=1/0,f=1/0,g=1/0,v=0,E=[],{preferHDR:b,allowedVideoRanges:y}=(n=!1,o=[],(s=t)&&(n="SDR"!==s,o=[s]),a&&(o=a.allowedVideoRanges||rV.slice(0),o=(n=void 0!==a.preferHDR?a.preferHDR:function(){if("function"==typeof matchMedia){let e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}())?o.filter(e=>"SDR"!==e):["SDR"]),{preferHDR:n,allowedVideoRanges:o});for(let t=l.length;t--;){let i=e[l[t]];c=i.channels[2]>0,p=Math.min(p,i.minHeight),f=Math.min(f,i.minFramerate),g=Math.min(g,i.minBitrate);let r=y.filter(e=>i.videoRanges[e]>0);r.length>0&&(m=!0,E=r)}p=tG(p)?p:0,f=tG(f)?f:0;let T=Math.max(1080,p),A=Math.max(30,f);return i=Math.max(g=tG(g)?g:i,i),m||(t=void 0,E=[]),{codecSet:l.reduce((t,r)=>{let a=e[r];if(r===t)return t;if(a.minBitrate>i)return as(r,`min bitrate of ${a.minBitrate} > current estimate of ${i}`),t;if(!a.hasDefaultAudio)return as(r,"no renditions with default or auto-select sound found"),t;if(h&&r.indexOf(h.substring(0,4))%5!=0)return as(r,`audio codec preference "${h}" not found`),t;if(d&&!u){if(!a.channels[d])return as(r,`no renditions with ${d} channel sound found (channels options: ${Object.keys(a.channels)})`),t}else if((!h||u)&&c&&0===a.channels["2"])return as(r,"no renditions with stereo sound found"),t;return a.minHeight>T?(as(r,`min resolution of ${a.minHeight} > maximum of ${T}`),t):a.minFramerate>A?(as(r,`min framerate of ${a.minFramerate} > maximum of ${A}`),t):E.some(e=>a.videoRanges[e]>0)?a.maxScore<v?(as(r,`max score of ${a.maxScore} < selected max of ${v}`),t):t&&(rr(r)>=rr(t)||a.fragmentError>e[t].fragmentError)?t:(v=a.maxScore,r):(as(r,`no variants with VIDEO-RANGE of ${JSON.stringify(E)} found`),t)},void 0),videoRanges:E,preferHDR:b,minFramerate:f,minBitrate:g}}(this.codecTiers||(this.codecTiers=f.slice(t,i+1).reduce((e,t)=>{if(!t.codecSet)return e;let i=t.audioGroups,r=e[t.codecSet];r||(e[t.codecSet]=r={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}
15),r.minBitrate=Math.min(r.minBitrate,t.bitrate);let a=Math.min(t.height,t.width);return r.minHeight=Math.min(r.minHeight,a),r.minFramerate=Math.min(r.minFramerate,t.frameRate),r.maxScore=Math.max(r.maxScore,t.score),r.fragmentError+=t.fragmentError,r.videoRanges[t.videoRange]=(r.videoRanges[t.videoRange]||0)+1,i&&i.forEach(e=>{if(!e)return;let t=w.groups[e];t&&(r.hasDefaultAudio=r.hasDefaultAudio||w.hasDefaultAudio?t.hasDefault:t.hasAutoSelect||!w.hasDefaultAudio&&!w.hasAutoSelectAudio,Object.keys(t.channels).forEach(e=>{r.channels[e]=(r.channels[e]||0)+t.channels[e]}))}),e},{})),A,e,k,S),{codecSet:a,videoRanges:s,minFramerate:n,minBitrate:o,preferHDR:l}=r;d=a,A=l?s[s.length-1]:s[0],_=n,e=Math.max(e,o),tZ.log(`[abr] picked start tier ${JSON.stringify(r)}`)}else d=null==b?void 0:b.codecSet,A=null==b?void 0:b.videoRange;let L=p?p.duration:m?m.duration:0,R=this.bwEstimator.getEstimateTTFB()/1e3,I=[];for(let o=i;o>=t;o--){let t,m=f[o],g=o>c;if(!m)continue;if(E.useMediaCapabilities&&!m.supportedResult&&!m.supportedPromise){let t=navigator.mediaCapabilities;"function"==typeof(null==t?void 0:t.decodingInfo)&&function(e,t,i,r,a,s){let n=e.audioCodec?e.audioGroups:null,o=null==s?void 0:s.audioCodec,l=null==s?void 0:s.channels,d=l?parseInt(l):o?1/0:2,h=null;if(null!=n&&n.length)try{h=1===n.length&&n[0]?t.groups[n[0]].channels:n.reduce((e,i)=>{if(i){let r=t.groups[i];if(!r)throw Error(`Audio track group ${i} not found`);Object.keys(r.channels).forEach(t=>{e[t]=(e[t]||0)+r.channels[t]})}return e},{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(a,8e6))||!!h&&tG(d)&&Object.keys(h).some(e=>parseInt(e)>d)}(m,w,A,_,e,k)?(m.supportedPromise=function(e,t,i){let r=e.videoCodec,a=e.audioCodec;if(!r||!a||!i)return Promise.resolve(ar);let s={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},n=e.videoRange;"SDR"!==n&&(s.transferFunction=n.toLowerCase());let o=r.split(",").map(e=>({type:"media-source",video:tH(tH({},s),{},{contentType:rt(e,"video")})}));return a&&e.audioGroups&&e.audioGroups.forEach(e=>{var i;e&&(null==(i=t.groups[e])||i.tracks.forEach(t=>{if(t.groupId===e){let e=parseFloat(t.channels||"");tG(e)&&e>2&&o.push.apply(o,a.split(",").map(t=>({type:"media-source",audio:{contentType:rt(t,"audio"),channels:""+e}})))}}))}),Promise.all(o.map(e=>{let t=function(e){let{audio:t,video:i}=e,r=i||t;if(r){let e=r.contentType.split('"')[1];if(i)return`r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${e}_${Math.ceil(i.bitrate/1e5)}`;if(t)return`c${t.channels}${t.spatialRendering?"s":"n"}_${e}`}return""}(e);return aa[t]||(aa[t]=i.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:o,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:o,decodingInfoResults:[],error:e}))}(m,w,t),m.supportedPromise.then(e=>{if(!this.hls)return;m.supportedResult=e;let t=this.hls.levels,i=t.indexOf(m);e.error?tZ.warn(`[abr] MediaCapabilities decodingInfo error: "${e.error}" for level ${i} ${JSON.stringify(e)}`):!e.supported&&(tZ.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${i} ${JSON.stringify(e)}`),i>-1&&t.length>1&&(tZ.log(`[abr] Removing unsupported level ${i}`),this.hls.removeLevel(i)))})):m.supportedResult=ar}if(d&&m.codecSet!==d||A&&m.videoRange!==A||g&&_>m.frameRate||!g&&_>0&&_<m.frameRate||m.supportedResult&&!(null!=(l=m.supportedResult.decodingInfoResults)&&l[0].smooth)){I.push(o);continue}let S=m.details,C=(p?null==S?void 0:S.partTarget:null==S?void 0:S.averagetargetduration)||L;t=g?n*e:s*e;let D=L&&r>=2*L&&0===a?f[o].averageBitrate:f[o].maxBitrate,x=this.getTimeToLoadFrag(R,t,D*C,void 0===S);if(t>=D&&(o===u||0===m.loadError&&0===m.fragmentError)&&(x<=R||!tG(x)||y&&!this.bitrateTestDelay||x<h)){let e=this.forcedAutoLevel;return o!==v&&(-1===e||e!==v)&&(I.length&&tZ.trace(`[abr] Skipped level(s) ${I.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${f[I[0]].codecs}" ${f[I[0]].videoRange}; not compatible with "${b.codecs}" ${A}`),tZ.info(`[abr] switch candidate:${c}->${o} adjustedbw(${Math.round(t)})-bitrate=${Math.round(t-D)} ttfb:${R.toFixed(1)} avgDuration:${C.toFixed(1)} maxFetchDuration:${h.toFixed(1)} fetchDuration:${x.toFixed(1)}
15 firstSelection:${T} codecSet:${d} videoRange:${A} hls.loadLevel:${v}`)),T&&(this.firstSelection=o),o}}return -1}set nextAutoLevel(e){let{maxAutoLevel:t,minAutoLevel:i}=this.hls,r=Math.min(Math.max(e,i),t);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}},bufferController:class{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=e=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{let{media:e,mediaSource:t}=this;this.log("Media source opened"),e&&(e.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(tq.MEDIA_ATTACHED,{media:e,mediaSource:t})),t&&t.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{let{mediaSrc:e,_objectUrl:t}=this;e!==t&&tZ.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=function(e){return"u">typeof self&&e===self.ManagedMediaSource}(i9(e.config.preferManagedMediaSource)),this.log=tZ.log.bind(tZ,t),this.warn=tZ.warn.bind(tZ,t),this.error=tZ.error.bind(tZ,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){let{hls:e}=this;e.on(tq.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tq.BUFFER_RESET,this.onBufferReset,this),e.on(tq.BUFFER_APPENDING,this.onBufferAppending,this),e.on(tq.BUFFER_CODECS,this.onBufferCodecs,this),e.on(tq.BUFFER_EOS,this.onBufferEos,this),e.on(tq.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(tq.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(tq.FRAG_PARSED,this.onFragParsed,this),e.on(tq.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){let{hls:e}=this;e.off(tq.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tq.BUFFER_RESET,this.onBufferReset,this),e.off(tq.BUFFER_APPENDING,this.onBufferAppending,this),e.off(tq.BUFFER_CODECS,this.onBufferCodecs,this),e.off(tq.BUFFER_EOS,this.onBufferEos,this),e.off(tq.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(tq.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(tq.FRAG_PARSED,this.onFragParsed,this),e.off(tq.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new sB(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(!t.audio||t.video)&&t.altAudio||(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){let i=this.media=t.media,r=i9(this.appendSource);if(i&&r){var a,s,n;let e=this.mediaSource=new r;this.log(`created media source: ${null==(a=e.constructor)?void 0:a.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming));let t=this._objectUrl=self.URL.createObjectURL(e);if(this.appendSource)try{let r;i.removeAttribute("src");let a=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||a&&e instanceof a,sH(i),s=i,n=t,(r=self.document.createElement("source")).type="video/mp4",r.src=n,s.appendChild(r),i.load()}catch(e){i.src=t}else i.src=t;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){let{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&sH(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(tq.MEDIA_DETACHED,void 0)}
15onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer(),this.hls.resumeBuffering()}resetBuffer(e){let t=this.sourceBuffer[e];try{if(t){var i;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(t){this.warn(`onBufferReset ${e}`,t)}}onBufferCodecs(e,t){let i=this.getSourceBufferTypes().length,r=Object.keys(t);if(r.forEach(e=>{if(i){let i=this.tracks[e];if(i&&"function"==typeof i.buffer.changeType){var r;let{id:a,codec:s,levelCodec:n,container:o,metadata:l}=t[e],d=ro(i.codec,i.levelCodec),h=null==d?void 0:d.replace(s$,"$1"),u=ro(s,n),c=null==(r=u)?void 0:r.replace(s$,"$1");if(u&&h!==c){"audio"===e.slice(0,5)&&(u=rn(u,this.appendSource));let t=`${o};codecs=${u}`;this.appendChangeType(e,t),this.log(`switching codec ${d} to ${u}`),this.tracks[e]={buffer:i.buffer,codec:s,container:o,levelCodec:n,metadata:l,id:a}}}}else this.pendingTracks[e]=t[e]}),i)return;let a=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==a&&(this.log(`${a} bufferCodec event(s) expected ${r.join(",")}`),this.bufferCodecEventsExpected=a),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}appendChangeType(e,t){let{operationQueue:i}=this;i.append({execute:()=>{let r=this.sourceBuffer[e];r&&(this.log(`changing ${e} sourceBuffer type to ${t}`),r.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}},e,!!this.pendingTracks[e])}onBufferAppending(e,t){let{hls:i,operationQueue:r,tracks:a}=this,{data:s,type:n,frag:o,part:l,chunkMeta:d}=t,h=d.buffering[n],u=self.performance.now();h.start=u;let c=o.stats.buffering,m=l?l.stats.buffering:null;0===c.start&&(c.start=u),m&&0===m.start&&(m.start=u);let p=a.audio,f=!1;"audio"===n&&(null==p?void 0:p.container)==="audio/mpeg"&&(f=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);let g=o.start;r.append({execute:()=>{if(h.executeStart=self.performance.now(),f){let e=this.sourceBuffer[n];if(e){let t=g-e.timestampOffset;Math.abs(t)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${g} (delta: ${t}) sn: ${o.sn})`),e.timestampOffset=g)}}this.appendExecutor(s,n)},onStart:()=>{},onComplete:()=>{let e=self.performance.now();h.executeEnd=h.end=e,0===c.first&&(c.first=e),m&&0===m.first&&(m.first=e);let{sourceBuffer:t}=this,i={};for(let e in t)i[e]=aE.getBuffered(t[e]);this.appendErrors[n]=0,"audio"===n||"video"===n?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(tq.BUFFER_APPENDED,{type:n,frag:o,part:l,chunkMeta:d,parent:o.type,timeRanges:i})},onError:e=>{let t={type:tj.MEDIA_ERROR,parent:o.type,details:tY.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:o,part:l,chunkMeta:d,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=tY.BUFFER_FULL_ERROR;else{let e=++this.appendErrors[n];t.details=tY.BUFFER_APPEND_ERROR,this.warn(`Failed ${e}/${i.config.appendErrorMaxRetry} times to append segment in "${n}" sourceBuffer`),e>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(tq.ERROR,t)}},n,!!this.pendingTracks[n])}onBufferFlushing(e,t){let{operationQueue:i}=this,r=e=>({execute:this.removeExecutor.bind(this,e,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(tq.BUFFER_FLUSHED,{type:e})},onError:t=>{this.warn(`Failed to remove from ${e} SourceBuffer`,t)}});t.type?i.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(e=>{i.append(r(e),e)})}onFragParsed(e,t){let{frag:i,part:r}=t,a=[],s=r?r.elementaryStreams:i.elementaryStreams;s[t8]?a.push("audiovideo"):(s[t4]&&a.push("audio"),s[t5]&&a.push("video"));let n=()=>{let e=self.performance.now();i.stats.buffering.end=e,r&&(r.stats.buffering.end=e);let t=r?r.stats:i.stats;this.hls.trigger(tq.FRAG_BUFFERED,{frag:i,part:r,stats:t,id:i.type})};0===a.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(n,a)}onFragChanged(e,t){this.trimBuffers()}
15onBufferEos(e,t){this.getSourceBufferTypes().reduce((e,i)=>{let r=this.sourceBuffer[i];return r&&(!t.type||t.type===i)&&(r.ending=!0,r.ended||(r.ended=!0,this.log(`${i} sourceBuffer now EOS`))),e&&!!(!r||r.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(e=>{let t=this.sourceBuffer[e];t&&(t.ending=!1)});let{mediaSource:e}=this;if(!e||"open"!==e.readyState){e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),e.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){let{hls:e,details:t,media:i}=this;if(!i||null===t||!this.getSourceBufferTypes().length)return;let r=e.config,a=i.currentTime,s=t.levelTargetDuration,n=t.live&&null!==r.liveBackBufferLength?r.liveBackBufferLength:r.backBufferLength;if(tG(n)&&n>0){let e=Math.max(n,s),t=Math.floor(a/s)*s-e;this.flushBackBuffer(a,s,t)}if(tG(r.frontBufferFlushThreshold)&&r.frontBufferFlushThreshold>0){let e=Math.max(Math.max(r.maxBufferLength,r.frontBufferFlushThreshold),s),t=Math.floor(a/s)*s+e;this.flushFrontBuffer(a,s,t)}}flushBackBuffer(e,t,i){let{details:r,sourceBuffer:a}=this;this.getSourceBufferTypes().forEach(s=>{let n=a[s];if(n){let a=aE.getBuffered(n);if(a.length>0&&i>a.start(0)){if(this.hls.trigger(tq.BACK_BUFFER_REACHED,{bufferEnd:i}),null!=r&&r.live)this.hls.trigger(tq.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(n.ended&&a.end(a.length-1)-e<2*t)return void this.log(`Cannot flush ${s} back buffer while SourceBuffer is in ended state`);this.hls.trigger(tq.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:s})}}})}flushFrontBuffer(e,t,i){let{sourceBuffer:r}=this;this.getSourceBufferTypes().forEach(a=>{let s=r[a];if(s){let r=aE.getBuffered(s),n=r.length;if(n<2)return;let o=r.start(n-1),l=r.end(n-1);if(i>o||e>=o&&e<=l)return;if(s.ended&&e-l<2*t)return void this.log(`Cannot flush ${a} front buffer while SourceBuffer is in ended state`);this.hls.trigger(tq.BUFFER_FLUSHING,{startOffset:o,endOffset:1/0,type:a})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;let{details:e,hls:t,media:i,mediaSource:r}=this,a=e.fragments[0].start+e.totalduration,s=i.duration,n=tG(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(r.duration=1/0,this.updateSeekableRange(e)):(a>n&&a>s||!tG(s))&&(this.log(`Updating Media Source duration to ${a.toFixed(3)}`),r.duration=a)}updateSeekableRange(e){let t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&null!=t&&t.setLiveSeekableRange){let r=Math.max(0,i[0].start),a=Math.max(r,r+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${r}-${a}.`),t.setLiveSeekableRange(r,a)}}checkPendingTracks(){let{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,r=Object.keys(i).length;if(r&&(!e||2===r||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};let e=this.getSourceBufferTypes();if(e.length)this.hls.trigger(tq.BUFFER_CREATED,{tracks:this.tracks}),e.forEach(e=>{t.executeNext(e)});else{let e=Error("could not create source buffer for media codec(s)");this.hls.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}}createSourceBuffers(e){let{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(let a in e)if(!t[a]){var r;let s=e[a];if(!s)throw Error(`source buffer exists for track ${a}, however track does not`);let n=(null==(r=s.levelCodec)?void 0:r.indexOf(","))===-1?s.levelCodec:s.codec;n&&"audio"===a.slice(0,5)&&(n=rn(n,this.appendSource));let o=`${s.container};codecs=${n}`;this.log(`creating sourceBuffer(${o})`);try{let e=t[a]=i.addSourceBuffer(o);this.addBufferListener(a,"updatestart",this._onSBUpdateStart),this.addBufferListener(a,"updateend",this._onSBUpdateEnd),this.addBufferListener(a,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(a,"bufferedchange",(e,t)=>{let i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(tq.BUFFER_FLUSHED,{type:a})}),this.tracks[a]={buffer:e,codec:n,container:s.container,levelCodec:s.levelCodec,metadata:s.metadata,id:s.id}}catch(e){this.error(`error while trying to add sourceBuffer: ${e.message}`),this.hls.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:a,mimeType:o})}}}get mediaSrc(){var e,t;let i=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==i?void 0:i.src}_onSBUpdateStart(e){let{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if((null==(t=this.mediaSource)?void 0:t.readyState)==="closed")return void this.resetBuffer(e);let{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;let r=Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${r}`,t),this.hls.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});let a=this.operationQueue.current(e);a&&a.onError(r)}removeExecutor(e,t,i){let{media:r,mediaSource:a,operationQueue:s,sourceBuffer:n}=this,o=n[e];if(!r||!a||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),s.shiftAndExecuteNext(e);return}let l=tG(r.duration)?r.duration:1/0,d=tG(a.duration)?a.duration:1/0,h=Math.max(0,t),u=Math.min(i,l,d);u>h&&(!o.ending||o.ended)?(o.ended=!1,this.log(`Removing [${h},${u}] from the ${e} SourceBuffer`),o.remove(h,u)):s.shiftAndExecuteNext(e)}appendExecutor(e,t){let i=this.sourceBuffer[t];if(!i){if(!this.pendingTracks[t])throw Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}i.ended=!1,i.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}let{operationQueue:i}=this;Promise.all(t.map(e=>i.appendBlocker(e))).then(()=>
15{e(),t.forEach(e=>{let t=this.sourceBuffer[e];null!=t&&t.updating||i.shiftAndExecuteNext(e)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){let r=this.sourceBuffer[e];if(!r)return;let a=i.bind(this,e);this.listeners[e].push({event:t,listener:a}),r.addEventListener(t,a)}removeBufferListeners(e){let t=this.sourceBuffer[e];t&&this.listeners[e].forEach(e=>{t.removeEventListener(e.event,e.listener)})}},capLevelController:nA,errorController:class{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=tZ.log.bind(tZ,"[info]:"),this.warn=tZ.warn.bind(tZ,"[warning]:"),this.error=tZ.error.bind(tZ,"[error]:"),this.registerListeners()}registerListeners(){let e=this.hls;e.on(tq.ERROR,this.onError,this),e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){let e=this.hls;e&&(e.off(tq.ERROR,this.onError,this),e.off(tq.ERROR,this.onErrorOut,this),e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===rk?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,r,a,s;if(t.fatal)return;let n=this.hls,o=t.context;switch(t.details){case tY.FRAG_LOAD_ERROR:case tY.FRAG_LOAD_TIMEOUT:case tY.KEY_LOAD_ERROR:case tY.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case tY.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap){t.errorAction={action:0,flags:0};return}case tY.FRAG_GAP:case tY.FRAG_DECRYPT_ERROR:t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=2;return;case tY.LEVEL_EMPTY_ERROR:case tY.LEVEL_PARSING_ERROR:{let e=t.parent===rk?t.level:n.loadLevel;t.details===tY.LEVEL_EMPTY_ERROR&&null!=(a=t.context)&&null!=(s=a.levelDetails)&&s.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case tY.LEVEL_LOAD_ERROR:case tY.LEVEL_LOAD_TIMEOUT:"number"==typeof(null==o?void 0:o.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case tY.AUDIO_TRACK_LOAD_ERROR:case tY.AUDIO_TRACK_LOAD_TIMEOUT:case tY.SUBTITLE_LOAD_ERROR:case tY.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){let e=n.levels[n.loadLevel];e&&(o.type===rA&&e.hasAudioGroup(o.groupId)||o.type===r_&&e.hasSubtitleGroup(o.groupId))&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=2,t.errorAction.flags=1)}return;case tY.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{let e=n.levels[n.loadLevel],i=null==e?void 0:e.attrs["HDCP-LEVEL"];i?t.errorAction={action:2,flags:2,hdcpLevel:i}:this.keySystemError(t)}return;case tY.BUFFER_ADD_CODEC_ERROR:case tY.REMUX_ALLOC_ERROR:case tY.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,null!=(r=t.level)?r:n.loadLevel);return;case tY.INTERNAL_EXCEPTION:case tY.BUFFER_APPENDING_ERROR:case tY.BUFFER_FULL_ERROR:case tY.LEVEL_SWITCH_ERROR:case tY.BUFFER_STALLED_ERROR:case tY.BUFFER_SEEK_OVER_HOLE:case tY.BUFFER_NUDGE_ON_STALL:t.errorAction={action:0,flags:0};return}t.type===tj.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){let t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){let i=r3(this.hls.config.playlistLoadPolicy,e),r=this.playlistError++;if(r8(i,r,r2(e),e.response))return{action:5,flags:0,retryConfig:i,retryCount:r};let a=this.getLevelSwitchAction(e,t);return i&&(a.retryConfig=i,a.retryCount=r),a}getFragRetryOrSwitchAction(e){let t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:a,keyLoadPolicy:s}=t.config,n=r3(e.details.startsWith("key")?s:a,e),o=t.levels.reduce((e,t)=>e+t.fragmentError,0);if(r&&(e.details!==tY.FRAG_GAP&&r.fragmentError++,r8(n,o,r2(e),e.response)))return{action:5,flags:0,retryConfig:n,retryCount:o};let l=this.getLevelSwitchAction(e,i);return n&&(l.retryConfig=n,l.retryCount=o),l}getLevelSwitchAction(e,t){let i=this.hls;null==t&&(t=i.loadLevel);let r=this.hls.levels[t];if(r){var a,s,n,o;let t=e.details;r.loadError++,t===tY.BUFFER_APPEND_ERROR&&r.fragmentError++;let l=-1,{levels:d,loadLevel:h,minAutoLevel:u,maxAutoLevel:c}=i;i.autoLevelEnabled||(i.loadLevel=-1);let m=null==(a=e.frag)?void 0:a.type,p=(m===rS&&t===tY.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===tY.BUFFER_ADD_CODEC_ERROR||t===tY.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:e})=>r.audioCodec!==e),f="video"===e.sourceBufferName&&(t===tY.BUFFER_ADD_CODEC_ERROR||t===tY.BUFFER_APPEND_ERROR)&&d.some(({codecSet:e,audioCodec:t})=>r.codecSet!==e&&r.audioCodec===t),{type:g,groupId:v}=null!=(s=e.context)?s:{};for(let i=d.length;i--;){let a=(i+h)%d.length;if(a!==h&&a>=u&&a<=c&&0===d[a].loadError){let i=d[a];if(t===tY.FRAG_GAP&&m===rk&&e.frag){let t=d[a].details;if(t){let i=r6(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else if(g===rA&&i.hasAudioGroup(v)||g===r_&&i.hasSubtitleGroup(v))continue;else if(m===rS&&null!=(n=r.audioGroups)&&n.some(e=>i.hasAudioGroup(e))||m===rw&&null!=(o=r.subtitleGroups)&&o.some(e=>i.hasSubtitleGroup(e))||p&&r.audioCodec===i.audioCodec||!p&&r.audioCodec!==i.audioCodec||f&&r.codecSet===i.codecSet)continue;l=a;break}}if(l>-1&&i.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:2,flags:0,nextAutoLevel:l}}return{action:2,flags:1}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case 0:break;case 2:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===tY.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}
15" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):t.fatal=!0}if(t.fatal)return void this.hls.stopLoad()}sendAlternateToPenaltyBox(e){let t=this.hls,i=e.errorAction;if(!i)return;let{flags:r,hdcpLevel:a,nextAutoLevel:s}=i;switch(r){case 0:this.switchLevel(e,s);break;case 2:a&&(t.maxHdcpLevel=rG[rG.indexOf(a)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`)}i.resolved||this.switchLevel(e,s)}switchLevel(e,t){void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(tq.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(tq.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){let i=this.hls.config;if(i.capLevelOnFPSDrop){let e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){let r=performance.now();if(t){if(this.lastTime){let e=r-this.lastTime,a=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,n=1e3*a/e,o=this.hls;if(o.trigger(tq.FPS_DROP,{currentDropped:a,currentDecoded:s,totalDroppedFrames:i}),n>0&&a>o.config.fpsDroppedMonitoringThreshold*s){let e=o.currentLevel;tZ.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=e)&&(e-=1,o.trigger(tq.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:o.currentLevel}),o.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){let e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){let t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:iE,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:nZ,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends aq{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",rw),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){let{hls:e}=this;
15e.on(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tq.ERROR,this.onError,this),e.on(tq.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(tq.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(tq.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(tq.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(tq.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(tq.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){let{hls:e}=this;e.off(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tq.ERROR,this.onError,this),e.off(tq.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(tq.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(tq.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(tq.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(tq.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(tq.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=aP,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){let i,{frag:r,success:a}=t;if(this.fragPrevious=r,this.state=aP,!a)return;let s=this.tracksBuffered[this.currentTrackId];if(!s)return;let n=r.start;for(let e=0;e<s.length;e++)if(n>=s[e].start&&n<=s[e].end){i=s[e];break}let o=r.start+r.duration;i?i.end=o:(i={start:n,end:o},s.push(i)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null)}onBufferFlushing(e,t){let{startOffset:i,endOffset:r}=t;if(0===i&&r!==1/0){let e=r-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach(t=>{for(let i=0;i<t.length;){if(t[i].end<=e){t.shift();continue}if(t[i].start<e)t[i].start=e;else break;i++}}),this.fragmentTracker.removeFragmentsInRange(i,e,rw)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===rk){var i;null!=(i=this.media)&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){let i=t.frag;(null==i?void 0:i.type)===rw&&(t.details===tY.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==aO&&(this.state=aP))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&sP(this.levels,t)){this.levels=t.map(e=>new rj(e));return}this.tracksBuffered=[],this.levels=t.map(e=>{let t=new rj(e);return this.tracksBuffered[t.id]=[],t}),this.fragmentTracker.removeFragmentsInRange(0,1/0,rw),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!(null!=(i=this.levels)&&i.length)||-1===this.currentTrackId)return void this.clearInterval();let r=this.levels[this.currentTrackId];null!=r&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i,r;let{currentTrackId:a,levels:s}=this,{details:n,id:o}=t;if(!s)return void this.warn(`Subtitle tracks were reset while loading level ${o}`);let l=s[o];if(o>=s.length||!l)return;this.log(`Subtitle track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let d=0;if(n.live||null!=(i=l.details)&&i.live){let e=this.mainDetails;if(n.deltaUpdateFailed||!e)return;let t=e.fragments[0];l.details?0===(d=this.alignPlaylists(n,l.details,null==(r=this.levelLastLoaded)?void 0:r.details))&&t&&rZ(n,d=t.start):n.hasProgramDateTime&&e.hasProgramDateTime?(ak(n,e),d=n.fragments[0].start):t&&rZ(n,d=t.start)}l.details=n,this.levelLastLoaded=l,o===a&&(this.startFragRequested||!this.mainDetails&&n.live||this.setStartPosition(this.mainDetails||n,d),this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===aP&&(r6(null,n.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){let{frag:t,payload:i}=e,r=t.decryptdata,a=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>
150&&null!=r&&r.key&&r.iv&&"AES-128"===r.method){let e=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer).catch(e=>{throw a.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e}).then(i=>{let r=performance.now();a.trigger(tq.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:r}})}).catch(e=>{this.warn(`${e.name}: ${e.message}`),this.state=aP})}}doTick(){if(!this.media){this.state=aP;return}if(this.state===aP){let{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;let{config:r}=this,a=this.getLoadPosition(),{end:s,len:n}=aE.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],a,r.maxBufferHole),o=this.getFwdBufferInfo(this.media,rk),l=i.details;if(n>this.getMaxBufferLength(null==o?void 0:o.len)+l.levelTargetDuration)return;let d=l.fragments,h=d.length,u=l.edge,c=null,m=this.fragPrevious;if(s<u){let e=r.maxFragLookUpTolerance;(c=r6(m,d,Math.max(d[0].start,s),s>u-e?0:e))||!m||!(m.start<d[0].start)||(c=d[0])}else c=d[h-1];if(!c)return;if("initSegment"!==(c=this.mapToInitFragWhenRequired(c)).sn){let e=d[c.sn-l.startSN-1];e&&e.cc===c.cc&&this.fragmentTracker.getState(e)===au&&(c=e)}this.fragmentTracker.getState(c)===au&&this.loadFragment(c,i,s)}}getMaxBufferLength(e){let t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,i){this.fragCurrent=e,"initSegment"===e.sn?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,i))}get mediaBufferTimeRanges(){return new sF(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends ae{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null,t=rO(this.media.textTracks);for(let i=0;i<t.length;i++)if("hidden"===t[i].mode)e=t[i];else if("showing"===t[i].mode){e=t[i];break}let i=this.findTrackForTextTrack(e);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){let{hls:e}=this;e.on(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tq.LEVEL_LOADING,this.onLevelLoading,this),e.on(tq.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(tq.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(tq.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tq.LEVEL_LOADING,this.onLevelLoading,this),e.off(tq.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(tq.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(tq.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),rO(this.media.textTracks).forEac
15h(e=>{rx(e)}),this.subtitleTrack=-1,this.media=null)}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){let{id:i,groupId:r,details:a}=t,s=this.tracksInGroup[i];if(!s||s.groupId!==r)return void this.warn(`Subtitle track with id:${i} and group:${r} not found in active group ${null==s?void 0:s.groupId}`);let n=s.details;s.details=t.details,this.log(`Subtitle track ${i} "${s.name}" lang:${s.lang} group:${r} loaded [${a.startSN}-${a.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,n)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let i=t.subtitleGroups||null,r=this.groupIds,a=this.currentTrack;if(!i||(null==r?void 0:r.length)!==(null==i?void 0:i.length)||null!=i&&i.some(e=>(null==r?void 0:r.indexOf(e))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;let e=this.tracks.filter(e=>!i||-1!==i.indexOf(e.groupId));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!a&&!this.tracksInGroup.length)return;this.tracksInGroup=e;let t=this.hls.config.subtitlePreference;if(!a&&t){this.selectDefaultTrack=!1;let i=an(t,e);if(i>-1)a=e[i];else{let e=an(t,this.tracks);a=this.tracks[e]}}let r=this.findTrackId(a);-1===r&&a&&(r=this.findTrackId(null)),this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger(tq.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:e}),-1!==r&&-1===this.trackId&&this.setSubtitleTrack(r)}else this.shouldReloadPlaylist(a)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){let t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r<t.length;r++){let a=t[r];if((!i||a.default)&&(i||e)&&(!e||ao(a,e)))return r}if(e){for(let i=0;i<t.length;i++){let r=t[i];if(sN(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){let r=t[i];if(sN(e.attrs,r.attrs,["LANGUAGE"]))return i}}return -1}findTrackForTextTrack(e){if(e){let t=this.tracksInGroup;for(let i=0;i<t.length;i++)if(sU(t[i],e))return i}return -1}onError(e,t){!t.fatal&&t.context&&(t.context.type!==r_||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){let t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){let i=this.currentTrack;if(i&&ao(e,i))return i;let r=an(e,this.tracksInGroup);if(r>-1){let e=this.tracksInGroup[r];return this.setSubtitleTrack(r),e}{if(i)return null;let r=an(e,t);if(r>-1)return t[r]}}}return null}loadPlaylist(e){super.loadPlaylist();let t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){let i=t.id,r=t.groupId,a=t.url;if(e)try{a=e.addDirectives(a)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(tq.SUBTITLE_TRACK_LOADING,{url:a,id:i,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(){let e,{media:t}=this;if(!t)return;let i=rO(t.textTracks),r=this.currentTrack;if(r&&((e=i.filter(e=>sU(r,e))[0])||this.warn(`Unable to find subtitle TextTrack with name "${r.name}" and language "${r.lang}"`)),[].slice.call(i).forEach(t=>{"disabled"!==t.mode&&t!==e&&(t.mode="disabled")}),e){let t=this.subtitleDisplay?"showing":"hidden";e.mode!==t&&(e.mode=t)}}setSubtitleTrack(e){let t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!tG(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;let i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r)return void this.hls.trigger(tq.SUBTITLE_TRACK_SWITCH,{id:e});let a=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&a)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));let{id:s,groupId:n="",name:o,type:l,url:d}=r;this.hls.trigger(tq.SUBTITLE_TRACK_SWITCH,{id:s,groupId:n,name:o,type:l,url:d});let h=this.switchParams(r.url,null==i?void 0:i.details,r.details);this.loadPlaylist(h)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=nT(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}}
15,e.on(tq.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tq.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(tq.FRAG_LOADING,this.onFragLoading,this),e.on(tq.FRAG_LOADED,this.onFragLoaded,this),e.on(tq.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(tq.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(tq.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(tq.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(tq.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){let{hls:e}=this;e.off(tq.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tq.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(tq.FRAG_LOADING,this.onFragLoading,this),e.off(tq.FRAG_LOADED,this.onFragLoaded,this),e.off(tq.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(tq.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(tq.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(tq.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(tq.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){let e=new s3(this,"textTrack1"),t=new s3(this,"textTrack2"),i=new s3(this,"textTrack3"),r=new s3(this,"textTrack4");this.cea608Parser1=new s2(1,e,t),this.cea608Parser2=new s2(3,i,r)}}addCues(e,t,i,r,a){let s=!1;for(let e=a.length;e--;){var n,o;let r=a[e],l=(n=r[0],o=r[1],Math.min(o,i)-Math.max(n,t));if(l>=0&&(r[0]=Math.min(r[0],t),r[1]=Math.max(r[1],i),s=!0,l/(i-t)>.5))return}if(s||a.push([t,i]),this.config.renderTextTracksNatively){let a=this.captionsTracks[e];this.Cues.newCue(a,t,i,r)}else{let a=this.Cues.newCue(null,t,i,r);this.hls.trigger(tq.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:a}){let{unparsedVttFrags:s}=this;"main"===i&&(this.initPTS[t.cc]={baseTime:r,timescale:a}),s.length&&(this.unparsedVttFrags=[],s.forEach(e=>{this.onFragLoaded(tq.FRAG_LOADED,e)}))}getExistingTrack(e,t){let{media:i}=this;if(i)for(let r=0;r<i.textTracks.length;r++){let a=i.textTracks[r];if(ny(a,{name:e,lang:t,attrs:{}}))return a}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;let{captionsProperties:t,captionsTracks:i,media:r}=this,{label:a,languageCode:s}=t[e],n=this.getExistingTrack(a,s);if(n)i[e]=n,rx(i[e]),rC(i[e],r);else{let t=this.createTextTrack("captions",a,s);t&&(t[e]=!0,i[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;let t=this.captionsProperties[e];if(!t)return;let i={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(tq.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,i){let r=this.media;if(r)return r.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){let{captionsTracks:e}=this;Object.keys(e).forEach(t=>{rx(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=nT(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){let{media:e}=this;if(!e)return;let t=e.textTracks;if(t)for(let e=0;e<t.length;e++)rx(t[e])}onSubtitleTracksUpdated(e,t){let i=t.subtitleTracks||[],r=i.some(e=>e.textCodec===nd);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(sP(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){let e=this.media,t=e?rO(e.textTracks):null;if(this.tracks.forEach((e,i)=>{let r;if(t){let i=null;for(let r=0;r<t.length;r++)if(t[r]&&ny(t[r],e)){i=t[r],t[r]=null;break}i&&(r=i)}if(r)rx(r);else{let t=nb(e);(r=this.createTextTrack(t,e.name,e.lang))&&(r.mode="disabled")}r&&this.textTracks.push(r)}),null!=t&&t.length){let e=t.filter(e=>null!==e).map(e=>e.label);e.length&&tZ.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}
15}else if(this.tracks.length){let e=this.tracks.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(tq.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{let t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;let i=`textTrack${t[1]}`,r=this.captionsProperties[i];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.media=e)})}closedCaptionsForLevel(e){let t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===rk){var i,r;let{cea608Parser1:e,cea608Parser2:a,lastSn:s}=this,{cc:n,sn:o}=t.frag,l=null!=(i=null==(r=t.part)?void 0:r.index)?i:-1;e&&a&&(o!==s+1||o===s&&l!==this.lastPartIndex+1||n!==this.lastCc)&&(e.reset(),a.reset()),this.lastCc=n,this.lastSn=o,this.lastPartIndex=l}}onFragLoaded(e,t){let{frag:i,payload:r}=t;if(i.type===rw)if(r.byteLength){let e=i.decryptdata,a="stats"in t;if(null==e||!e.encrypted||a){let e=this.tracks[i.level],a=this.vttCCs;a[i.cc]||(a[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===nd?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(tq.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:Error("Empty subtitle payload")})}_parseIMSC1(e,t){let i=this.hls;nm(t,this.initPTS[e.cc],t=>{this._appendCues(t,e.level),i.trigger(tq.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},t=>{tZ.log(`Failed to parse IMSC1: ${t}`),i.trigger(tq.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})}_parseVTTs(e){var t,i,r,a,s,n,o,l;let d,h,u,c,m,p,f,g,v,{frag:E,payload:b}=e,{initPTS:y,unparsedVttFrags:T}=this,A=y.length-1;if(!y[E.cc]&&-1===A)return void T.push(e);let _=this.hls;i=null!=(t=E.initSegment)&&t.data?iQ(E.initSegment.data,new Uint8Array(b)):b,r=this.initPTS[E.cc],a=this.vttCCs,s=E.cc,n=E.start,o=e=>{this._appendCues(e,E.level),_.trigger(tq.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:E})},l=t=>{let i="Missing initPTS for VTT MPEGTS"===t.message;i?T.push(e):this._fallbackToIMSC1(E,b),tZ.log(`Failed to parse VTT cue: ${t}`),i&&A>E.cc||_.trigger(tq.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:E,error:t})},h=new ni,u=iP(new Uint8Array(i)).trim().replace(nr,"\n").split("\n"),c=[],m=r?function(e,t=1){return sg(e,9e4,1/t)}(r.baseTime,r.timescale):0,p="00:00.000",f=0,g=0,v=!0,h.oncue=function(e){let t=a[s],i=a.ccOffset,o=(f-m)/9e4;if(null!=t&&t.new&&(void 0!==g?i=a.ccOffset=t.start:nl(a,s,o)),o){if(!r){d=Error("Missing initPTS for VTT MPEGTS");return}i=o-a.presentationOffset}let l=e.endTime-e.startTime,h=sT((e.startTime+i-g)*9e4,9e4*n)/9e4;e.startTime=Math.max(h,0),e.endTime=Math.max(h+l,0);let u=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(u)),e.id||(e.id=no(e.startTime,e.endTime,u)),e.endTime>0&&c.push(e)},h.onparsingerror=function(e){d=e},h.onflush=function(){d?l(d):o(c)},u.forEach(e=>{if(v)if(na(e,"X-TIMESTAMP-MAP=")){v=!1,e.slice(16).split(",").forEach(e=>{na(e,"LOCAL:")?p=e.slice(6):na(e,"MPEGTS:")&&(f=parseInt(e.slice(7)))});try{g=ns(p)/1e3}catch(e){d=e}return}else""===e&&(v=!1);h.parse(e+"\n")}),h.flush()}_fallbackToIMSC1(e,t){let i=this.tracks[e.level];i.textCodec||nm(t,this.initPTS[e.cc],()=>{i.textCodec=nd,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){let i=this.hls;if(this.config.renderTextTracksNatively){let i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach(e=>rD(i,e))}else{let r=this.tracks[t];if(!r)return;let a=r.default?"default":"subtitles"+t;i.trigger(tq.CUES_PARSED,{type:"subtitles",cues:e,track:a})}}onFragDecrypted(e,t){let{frag:i}=t;i.type===rw&&this.onFragLoaded(tq.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();let{cea608Parser1:i,cea608Parser2:r}=this;if(!this.enabled||!i||!r)return;let{frag:a,samples:s}=t;if(a.type!==rk||"NONE"!==this.closedCaptionsForLevel(a))for(let e=0;e<s.length;e++){let t=s[e].bytes;if(t){let a=this.extractCea608Data(t);i.addData(s[e].pts,a[0]),r.addData(s[e].pts,a[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:a}){let{media:s}=this;
15if(s&&!(s.currentTime<i)){if(!a||"video"===a){let{captionsTracks:e}=this;Object.keys(e).forEach(r=>rM(e[r],t,i))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==r){let{textTracks:e}=this;Object.keys(e).forEach(i=>rM(e[i],t,r))}}}extractCea608Data(e){let t=[[],[]],i=31&e[0],r=2;for(let a=0;a<i;a++){let i=e[r++],a=127&e[r++],s=127&e[r++];if((0!==a||0!==s)&&(4&i)!=0){let e=3&i;(0===e||1===e)&&(t[e].push(a),t[e].push(s))}}return t}},audioStreamController:class extends aq{constructor(e,t,i){super(e,t,i,"[audio-stream-controller]",rS),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){let{hls:e}=this;e.on(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tq.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(tq.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(tq.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(tq.ERROR,this.onError,this),e.on(tq.BUFFER_RESET,this.onBufferReset,this),e.on(tq.BUFFER_CREATED,this.onBufferCreated,this),e.on(tq.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(tq.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(tq.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(tq.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){let{hls:e}=this;e.off(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tq.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(tq.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(tq.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(tq.ERROR,this.onError,this),e.off(tq.BUFFER_RESET,this.onBufferReset,this),e.off(tq.BUFFER_CREATED,this.onBufferCreated,this),e.off(tq.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(tq.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(tq.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(tq.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:a}){if("main"===i){let e=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:a},this.log(`InitPTS for cc: ${e} found from main: ${r}`),this.videoTrackCC=e,this.state===aV&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=aO;return}let t=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),t>0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=aP):(this.loadedmetadata=!1,this.state=aB),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){var e,t;switch(this.state){case aP:this.doTickIdle();break;case aB:{let{levels:t,trackId:i}=this,r=null==t||null==(e=t[i])?void 0:e.details;if(r){if(this.waitForCdnTuneIn(r))break;this.state=aV}break}case aF:{let e=performance.now(),i=this.retryDate;if(!i||e>=i||null!=(t=this.media)&&t.seeking){let{levels:e,trackId:t}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==e?void 0:e[t])||null),this.state=aP}break}case aV:{let e=this.waitingData;if(e){let{frag:t,part:i,cache:r,complete:a}=e;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=aU;let e={frag:t,part:i,payload:r.flush(),networkDetails:null};this._handleFragmentLoadProgress(e),a&&super._handleFragmentLoadComplete(e)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${t.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{let e=this.getLoadPosition(),i=aE.bufferInfo(this.mediaBuffer,e,this.config.maxBufferHole);0>r7(i.end,this.config.maxFragLookUpTolerance,t)&&(this.log(`Waiting fragment cc (${t.cc}) @ ${t.start} cancelled because another fragment at ${i.end} is needed`),this.clearWaitingFragment())}}else this.state=aP}}this.onTickEnd()}clearWaitingFragment(){let e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=aP)}
15resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){let{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){let{hls:e,levels:t,media:i,trackId:r}=this,a=e.config;if(!this.buffering||!i&&(this.startFragRequested||!a.startFragPrefetch)||!(null!=t&&t[r]))return;let s=t[r],n=s.details;if(!n||n.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(n)){this.state=aB;return}let o=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&o&&(this.bufferFlushed=!1,this.afterBufferFlushed(o,t4,rS));let l=this.getFwdBufferInfo(o,rS);if(null===l)return;if(!this.switchingTrack&&this._streamEnded(l,n)){e.trigger(tq.BUFFER_EOS,{type:"audio"}),this.state=aW;return}let d=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,rk),h=l.len,u=this.getMaxBufferLength(null==d?void 0:d.len),c=n.fragments,m=c[0].start,p=this.getLoadPosition(),f=this.flushing?p:l.end;if(this.switchingTrack&&i&&n.PTSKnown&&p<m&&(l.end>m||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=m+.05),h>=u&&!this.switchingTrack&&f<c[c.length-1].start)return;let g=this.getNextFragment(f,n),v=!1;if(g&&this.isLoopLoading(g,f)&&(v=!!g.gap,g=this.getNextFragmentLoopLoading(g,n,l,rk,u)),!g){this.bufferFlushed=!0;return}let E=d&&g.start>d.end+n.targetduration;if(E||!(null!=d&&d.len)&&l.len){let e=this.getAppendedFrag(g.start,rk);if(null===e||(v||(v=!!e.gap||!!E&&0===d.len),E&&!v||v&&l.nextStart&&l.nextStart<e.end))return}this.loadFragment(g,s,f)}getMaxBufferLength(e){let t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(e=>new rj(e))}onAudioTrackSwitching(e,t){let i=!!t.url;this.trackId=t.id;let{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=aP,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=aO),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(tq.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i,r;if(null==this.mainDetails){this.cachedTrackLoadedData=t;return}let{levels:a}=this,{details:s,id:n}=t;if(!a)return void this.warn(`Audio tracks were reset while loading level ${n}`);this.log(`Audio track ${n} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);let o=a[n],l=0;if(s.live||null!=(i=o.details)&&i.live){this.checkLiveUpdate(s);let e=this.mainDetails;if(s.deltaUpdateFailed||!e)return;!o.details&&s.hasProgramDateTime&&e.hasProgramDateTime?(ak(s,e),l=s.fragments[0].start):l=this.alignPlaylists(s,o.details,null==(r=this.levelLastLoaded)?void 0:r.details)}o.details=s,this.levelLastLoaded=o,this.startFragRequested||!this.mainDetails&&s.live||this.setStartPosition(this.mainDetails||s,l),this.state!==aB||this.waitForCdnTuneIn(s)||(this.state=aP),this.tick()}_handleFragmentLoadProgress(e){var t;let{frag:i,part:r,payload:a}=e,{config:s,trackId:n,levels:o}=this;if(!o)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);let l=o[n];if(!l)return void this.warn("Audio track is undefined on fragment load progress");let d=l.details;if(!d){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}let h=s.defaultAudioCodec||l.audioCodec||"mp4a.40.2",u=this.transmuxer;u||(u=this.transmuxer=new sO(this.hls,rS,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));let c=this.initPTS[i.cc],m=null==(t=i.initSegment)?void 0:t.data;if(void 0!==c){let e=r?r.index:-1,t=new ab(i.level,i.sn,i.stats.chunkCount,a.byteLength,e,-1!==e);u.push(a,m,h,"",i,r,d.totalduration,!1,t,c)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${n}`);let{cache:e}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new aj,complete:!1};e.push(new Uint8Array(a)),this.waitingVideoCC=this.videoTrackCC,this.state=aV}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){let i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){let{frag:i,part:r}=t;if(i.type!==rS){if(!this.loadedmetadata&&i.type===rk){let e=this.videoBuffer||this.media;e&&aE.getBuffered(e).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(i))return void this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);if("initSegment"!==i.sn){this.fragPrevious=i;let e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(tq.AUDIO_TRACK_SWITCHED,tH({},e)))}this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=aG;return}switch(t.details){case tY.FRAG_GAP:case tY.FRAG_PARSING_ERROR:case tY.FRAG_DECRYPT_ERROR:case tY.FRAG_LOAD_ERROR:case tY.FRAG_LOAD_TIMEOUT:case tY.KEY_LOAD_ERROR:case tY.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(rS,t);break;case tY.AUDIO_TRACK_LOAD_ERROR:case tY.AUDIO_TRACK_LOAD_TIMEOUT:case tY.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==aB||(null==(i=t.context)?void 0:i.type)!==rA||(this.state=aP);break;case tY.BUFFER_APPEND_ERROR:case tY.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;if(t.details===tY.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,1/0,"audio"));break;case tY.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==t5&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==t5){this.flushing=!1,this.bufferFlushed=!0,this.state===aW&&(this.state=aP);let e=this.mediaBuffer||this.media;
15e&&(this.afterBufferFlushed(e,t,rS),this.tick())}}_handleTransmuxComplete(e){var t;let i="audio",{hls:r}=this,{remuxResult:a,chunkMeta:s}=e,n=this.getCurrentContext(s);if(!n)return void this.resetWhenMissingContext(s);let{frag:o,part:l,level:d}=n,{details:h}=d,{audio:u,text:c,id3:m,initSegment:p}=a;if(this.fragContextChanged(o)||!h)return void this.fragmentTracker.removeFragment(o);if(this.state=a$,this.switchingTrack&&u&&this.completeAudioSwitch(this.switchingTrack),null!=p&&p.tracks){let e=o.initSegment||o;this._bufferInitSegment(d,p.tracks,e,s),r.trigger(tq.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:p.tracks})}if(u){let{startPTS:e,endPTS:t,startDTS:i,endDTS:r}=u;l&&(l.elementaryStreams[t4]={startPTS:e,endPTS:t,startDTS:i,endDTS:r}),o.setElementaryStreamInfo(t4,e,t,i,r),this.bufferFragmentData(u,o,l,s)}if(null!=m&&null!=(t=m.samples)&&t.length){let e=tW({id:i,frag:o,details:h},m);r.trigger(tq.FRAG_PARSING_METADATA,e)}if(c){let e=tW({id:i,frag:o,details:h},c);r.trigger(tq.FRAG_PARSING_USERDATA,e)}}_bufferInitSegment(e,t,i,r){if(this.state!==a$)return;t.video&&delete t.video;let a=t.audio;if(!a)return;a.id="audio";let s=e.audioCodec;this.log(`Init audio buffer, container:${a.container}, codecs[level/parsed]=[${s}/${a.codec}]`),s&&1===s.split(",").length&&(a.levelCodec=s),this.hls.trigger(tq.BUFFER_CODECS,t);let n=a.initSegment;if(null!=n&&n.byteLength){let e={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:n};this.hls.trigger(tq.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){let r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===au||r===am){var a;if("initSegment"===e.sn)this._loadInitSegment(e,t);else if(null!=(a=t.details)&&a.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=aV;let i=this.mainDetails;i&&i.fragments[0].start!==t.details.fragments[0].start&&ak(t.details,i)}else this.startFragRequested=!0,super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){let{name:t,lang:i,assocLang:r,characteristics:a,audioCodec:s,channels:n}=this.bufferedTrack;ao({name:t,lang:i,assocLang:r,characteristics:a,audioCodec:s,channels:n},e,al)||(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,1/0,"audio"),this.bufferedTrack=null)}}completeAudioSwitch(e){let{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(tq.AUDIO_TRACK_SWITCHED,tH({},e))}},audioTrackController:class extends ae{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){let{hls:e}=this;e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tq.LEVEL_LOADING,this.onLevelLoading,this),e.on(tq.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(tq.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(tq.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tq.LEVEL_LOADING,this.onLevelLoading,this),e.off(tq.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(tq.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(tq.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){let{id:i,groupId:r,details:a}=t,s=this.tracksInGroup[i];if(!s||s.groupId!==r)return void this.warn(`Audio track with id:${i} and group:${r} not found in active group ${null==s?void 0:s.groupId}`);let n=s.details;s.details=t.details,this.log(`Audio track ${i} "${s.name}" lang:${s.lang} group:${r} loaded [${a.startSN}-${a.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,n)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let i=t.audioGroups||null,r=this.groupIds,a=this.currentTrack;if(!i||(null==r?void 0:r.length)!==(null==i?void 0:i.length)||null!=i&&i.some(e=>(null==r?void 0:r.indexOf(e))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;let e=this.tracks.filter(e=>!i||-1!==i.indexOf(e.groupId));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>
15{e.id=t});else if(!a&&!this.tracksInGroup.length)return;this.tracksInGroup=e;let t=this.hls.config.audioPreference;if(!a&&t){let i=an(t,e,al);if(i>-1)a=e[i];else{let e=an(t,this.tracks);a=this.tracks[e]}}let r=this.findTrackId(a);-1===r&&a&&(r=this.findTrackId(null)),this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger(tq.AUDIO_TRACKS_UPDATED,{audioTracks:e});let n=this.trackId;if(-1!==r&&-1===n)this.setAudioTrack(r);else if(e.length&&-1===n){var s;let t=Error(`No audio track selected for current audio group-ID(s): ${null==(s=this.groupIds)?void 0:s.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}else this.shouldReloadPlaylist(a)&&this.setAudioTrack(this.trackId)}onError(e,t){!t.fatal&&t.context&&(t.context.type!==rA||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){let t=this.hls;if(t.config.audioPreference=e,e){let a=this.allAudioTracks;
15if(this.selectDefaultTrack=!1,a.length){let s=this.currentTrack;if(s&&ao(e,s,al))return s;let n=an(e,this.tracksInGroup,al);if(n>-1){let e=this.tracksInGroup[n];return this.setAudioTrack(n),e}if(s){var i,r;let s,n,o,l,d,h,u=t.loadLevel;-1===u&&(u=t.firstAutoLevel);let c=(i=t.levels,s=i[r=u],(n=i.reduce((e,t,i)=>{let r=t.uri;return(e[r]||(e[r]=[])).push(i),e},{})[s.uri]).length>1&&(r=Math.max.apply(Math,n)),o=s.videoRange,l=s.frameRate,d=s.codecSet.substring(0,4),(h=ad(i,r,t=>{if(t.videoRange!==o||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;let i=t.audioGroups;return an(e,a.filter(e=>!i||-1!==i.indexOf(e.groupId)),al)>-1}))>-1?h:ad(i,r,t=>{let i=t.audioGroups;return an(e,a.filter(e=>!i||-1!==i.indexOf(e.groupId)),al)>-1}));if(-1===c)return null;t.nextLoadLevel=c}if(e.channels||e.audioCodec){let t=an(e,a);if(t>-1)return a[t]}}}return null}setAudioTrack(e){let t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;let i=this.currentTrack,r=t[e],a=r.details&&!r.details.live;if(e===this.trackId&&r===i&&a||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(tq.AUDIO_TRACK_SWITCHING,tH({},r)),a))return;let s=this.switchParams(r.url,null==i?void 0:i.details,r.details);this.loadPlaylist(s)}findTrackId(e){let t=this.tracksInGroup;for(let i=0;i<t.length;i++){let r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||ao(e,r,al)))return i}if(e){let{name:i,lang:r,assocLang:a,characteristics:s,audioCodec:n,channels:o}=e;for(let e=0;e<t.length;e++)if(ao({name:i,lang:r,assocLang:a,characteristics:s,audioCodec:n,channels:o},t[e],al))return e;for(let i=0;i<t.length;i++){let r=t[i];if(sN(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){let r=t[i];if(sN(e.attrs,r.attrs,["LANGUAGE"]))return i}}return -1}loadPlaylist(e){let t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();let i=t.id,r=t.groupId,a=t.url;if(e)try{a=e.addDirectives(a)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}this.log(`loading audio-track playlist ${i} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(tq.AUDIO_TRACK_LOADING,{url:a,id:i,groupId:r,deliveryDirectives:e||null})}}},emeController:nk,cmcdController:class{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:oq.MANIFEST,su:!this.initialized})}catch(e){tZ.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{let t=e.frag,i=this.hls.levels[t.level],r=this.getObjectType(t),a={d:1e3*t.duration,ot:r};(r===oq.VIDEO||r===oq.AUDIO||r==oq.MUXED)&&(a.br=i.bitrate/1e3,a.tb=this.getTopBandwidth(r)/1e3,a.bl=this.getBufferLength(r)),this.apply(e,a)}catch(e){tZ.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||function(){try{return crypto.randomUUID()}catch(e){try{let e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(t){let e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?i:3&i|8).toString(16)})}}}(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){let e=this.hls;e.on(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tq.MEDIA_DETACHED,this.onMediaDetached,this),e.on(tq.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){let e=this.hls;
15e.off(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tq.MEDIA_DETACHED,this.onMediaDetached,this),e.off(tq.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,r;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(r=t.tracks.video)?void 0:r.buffer}createData(){var e;return{v:1,sf:oj.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){tW(t,this.createData());let i=t.ot===oq.INIT||t.ot===oq.VIDEO||t.ot===oq.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);let{includeKeys:r}=this;if(r&&(t=Object.keys(t).reduce((e,i)=>(r.includes(i)&&(e[i]=t[i]),e),{})),this.useHeaders){var a;e.headers||(e.headers={}),a=e.headers,tW(a,function(e,t={}){if(!e)return{};let i=Object.entries(e),r=Object.entries(nw).concat(Object.entries((null==t?void 0:t.customHeaderMap)||{}));return Object.entries(i.reduce((e,t)=>{var i;let[a,s]=t,n=(null==(i=r.find(e=>e[1].includes(a)))?void 0:i[0])||oY.REQUEST;return null!=e[n]||(e[n]={}),e[n][a]=s,e},{})).reduce((e,[i,r])=>(e[i]=nH(r,t),e),{})}(t,void 0))}else e.url=function(e,t){let i=function(e,t={}){if(!e)return"";let i=nH(e,t);return`CMCD=${encodeURIComponent(i)}`}(t,void 0);if(!i)return e;if(nW.test(e))return e.replace(nW,i);let r=e.includes("?")?"&":"?";return`${e}${r}${i}`}(e.url,t)}getObjectType(e){let{type:t}=e;return"subtitle"===t?oq.TIMED_TEXT:"initSegment"===e.sn?oq.INIT:"audio"===t?oq.AUDIO:"main"===t?this.hls.audioTracks.length?oq.VIDEO:oq.MUXED:void 0}getTopBandwidth(e){let t,i=0,r=this.hls;if(e===oq.AUDIO)t=r.audioTracks;else{let e=r.maxAutoLevel,i=e>-1?e+1:r.levels.length;t=r.levels.slice(0,i)}for(let e of t)e.bitrate>i&&(i=e.bitrate);return i>0?i:NaN}getBufferLength(e){let t=this.hls.media,i=e===oq.AUDIO?this.audioBuffer:this.videoBuffer;return i&&t?1e3*aE.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN}createPlaylistLoader(){let{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,r){t(e),this.loader.load(e,i,r)}}}createFragmentLoader(){let{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,r){t(e),this.loader.load(e,i,r)}}}},contentSteeringController:class{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=tZ.log.bind(tZ,"[content-steering]:"),this.registerListeners()}registerListeners(){let e=this.hls;e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tq.ERROR,this.onError,this)}unregisterListeners(){let e=this.hls;e&&(e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tq.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){let e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){let t=this.levels;t&&(this.levels=t.filter(t=>t!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}
15onManifestLoaded(e,t){let{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){let{errorAction:i}=t;if((null==i?void 0:i.action)===2&&1===i.flags){let e=this.levels,r=this.pathwayPriority,a=this.pathwayId;if(t.context){let{groupId:i,pathwayId:r,type:s}=t.context;i&&e?a=this.getPathwayForGroupId(i,s,a):r&&(a=r)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!r&&e&&(r=e.reduce((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e),[])),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==a),i.resolved||tZ.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${e?e.length:e} priorities: ${JSON.stringify(r)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){let i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){let t;this.pathwayPriority=e;let i=this.penalizedPathways,r=performance.now();
15Object.keys(i).forEach(e=>{r-i[e]>3e5&&delete i[e]});for(let r=0;r<e.length;r++){let a=e[r];if(a in i)continue;if(a===this.pathwayId)return;let s=this.hls.nextLoadLevel,n=this.hls.levels[s];if((t=this.getLevelsForPathway(a)).length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,r1(t),this.hls.trigger(tq.LEVELS_UPDATED,{levels:t});let e=this.hls.levels[s];n&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==n.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==n.bitrate&&this.log(`Unstable Pathways change from bitrate ${n.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=s);break}}}getPathwayForGroupId(e,t,i){let r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let i=0;i<r.length;i++)if(t===rA&&r[i].hasAudioGroup(e)||t===r_&&r[i].hasSubtitleGroup(e))return r[i].pathwayId;return i}clonePathways(e){let t=this.levels;if(!t)return;let i={},r={};e.forEach(e=>{let{ID:a,"BASE-ID":s,"URI-REPLACEMENT":n}=e;if(t.some(e=>e.pathwayId===a))return;let o=this.getLevelsForPathway(s).map(e=>{let t=new t1(e.attrs);t["PATHWAY-ID"]=a;let s=t.AUDIO&&`${t.AUDIO}_clone_${a}`,o=t.SUBTITLES&&`${t.SUBTITLES}_clone_${a}`;s&&(i[t.AUDIO]=s,t.AUDIO=s),o&&(r[t.SUBTITLES]=o,t.SUBTITLES=o);let l=nV(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",n),d=new rj({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t<e.audioGroups.length;t++)d.addGroupId("audio",`${e.audioGroups[t]}_clone_${a}`);if(e.subtitleGroups)for(let t=1;t<e.subtitleGroups.length;t++)d.addGroupId("text",`${e.subtitleGroups[t]}_clone_${a}`);return d});t.push(...o),nG(this.audioTracks,i,n,a),nG(this.subtitleTracks,r,n,a)})}loadSteeringManifest(e){let t,i=this.hls.config,r=i.loader;this.loader&&this.loader.destroy(),this.loader=new r(i);try{t=new self.URL(e)}catch(t){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if("data:"!==t.protocol){let e=0|(this.hls.bandwidthEstimate||i.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+e)}let a={responseType:"json",url:t.href},s=i.steeringManifestLoadPolicy.default,n=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:n.maxNumRetry||0,retryDelay:n.retryDelayMs||0,maxRetryDelay:n.maxRetryDelayMs||0};this.log(`Requesting steering manifest: ${t}`),this.loader.load(a,o,{onSuccess:(e,i,r,a)=>{this.log(`Loaded steering manifest: "${t}"`);let s=e.data;if(1!==s.VERSION)return void this.log(`Steering VERSION ${s.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=s.TTL;let{"RELOAD-URI":n,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":l}=s;if(n)try{this.uri=new self.URL(n,t).href}catch(e){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${n}`);return}this.scheduleRefresh(this.uri||r.url),o&&this.clonePathways(o);let d={steeringManifest:s,url:t.toString()};this.hls.trigger(tq.STEERING_MANIFEST_LOADED,d),l&&this.updatePathwayPriority(l)},onError:(e,t,i,r)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code){this.enabled=!1,this.log(`Steering manifest ${t.url} no longer available`);return}let a=1e3*this.timeToLoad;if(429===e.code){let e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){let t=e.getResponseHeader("Retry-After");t&&(a=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`);return}this.scheduleRefresh(this.uri||t.url,a)},onTimeout:(e,t,i)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}})}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var t;let i=null==(t=this.hls)?void 0:t.media;i&&!i.ended?this.loadSteeringManifest(e):this.scheduleRefresh(e,1e3*this.timeToLoad)},t)}}});class n0 extends ae{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){let{hls:e}=this;e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tq.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tq.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tq.FRAG_BUFFERED,this.onFragBuffered,this),e.on(tq.E
15RROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tq.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tq.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tq.FRAG_BUFFERED,this.onFragBuffered,this),e.off(tq.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){let i=this.hls.config.preferManagedMediaSource,a=[],s={},n={},o=!1,l=!1,d=!1;t.levels.forEach(e=>{var t,h;let u=e.attrs,{audioCodec:c,videoCodec:m}=e;(null==(t=c)?void 0:t.indexOf("mp4a.40.34"))!==-1&&(r||(r=/chrome|firefox/i.test(navigator.userAgent)),r&&(e.audioCodec=c=void 0)),c&&(e.audioCodec=c=rn(c,i)),(null==(h=m)?void 0:h.indexOf("avc1"))===0&&(m=e.videoCodec=function(e){let t=e.split(",");for(let e=0;e<t.length;e++){let i=t[e].split(".");if(i.length>2){let r=i.shift()+".";r+=parseInt(i.shift()).toString(16),r+=("000"+parseInt(i.shift()).toString(16)).slice(-4),t[e]=r}}return t.join(",")}(m));let{width:p,height:f,unknownCodecs:g}=e;if(o||(o=!!(p&&f)),l||(l=!!m),d||(d=!!c),null!=g&&g.length||c&&!i7(c,"audio",i)||m&&!i7(m,"video",i))return;let{CODECS:v,"FRAME-RATE":E,"HDCP-LEVEL":b,"PATHWAY-ID":y,RESOLUTION:T,"VIDEO-RANGE":A}=u,_=`${y||"."}-`,k=`${_}${e.bitrate}-${T}-${E}-${v}-${A}-${b}`;if(s[k])if(s[k].uri===e.url||e.attrs["PATHWAY-ID"])s[k].addGroupId("audio",u.AUDIO),s[k].addGroupId("text",u.SUBTITLES);else{let t=n[k]+=1;e.attrs["PATHWAY-ID"]=Array(t+1).join(".");let i=new rj(e);s[k]=i,a.push(i)}else{let t=new rj(e);s[k]=t,n[k]=1,a.push(t)}}),this.filterAndSortMediaOptions(a,t,o,l,d)}filterAndSortMediaOptions(e,t,i,r,a){let s=[],n=[],o=e;if((i||r)&&a&&(o=o.filter(({videoCodec:e,videoRange:t,width:i,height:r})=>{var a;return(!!e||!!(i&&r))&&!!(a=t)&&rV.indexOf(a)>-1})),0===o.length)return void Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);let e=Error("no level with compatible codecs found in manifest");this.hls.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}});if(t.audioTracks){let{preferManagedMediaSource:e}=this.hls.config;n1(s=t.audioTracks.filter(t=>!t.audioCodec||i7(t.audioCodec,"audio",e)))}t.subtitles&&n1(n=t.subtitles);let l=o.slice(0);o.sort((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return rV.indexOf(e.videoRange)-rV.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){let i=ri(e.videoCodec),r=ri(t.videoCodec);if(i!==r)return r-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){let i=rr(e.codecSet),r=rr(t.codecSet);if(i!==r)return r-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0});let d=l[0];if(this.steering&&(o=this.steering.filterParsedLevels(o)).length!==l.length){for(let e=0;e<l.length;e++)if(l[e].pathwayId===o[0].pathwayId){d=l[e];break}}this._levels=o;for(let e=0;e<o.length;e++)if(o[e]===d){var h;this._firstLevel=e;let t=d.bitrate,i=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${o.length} level(s) found, first bitrate: ${t}`),(null==(h=this.hls.userConfig)?void 0:h.abrEwmaDefaultEstimate)===void 0){let e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>i&&i===nJ.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}let u=a&&!r,c={levels:o,audioTracks:s,subtitleTracks:n,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:a,video:r,altAudio:!u&&s.some(e=>!!e.url)};this.hls.trigger(tq.MANIFEST_PARSED,c),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(e){let t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){let i=Error("invalid level idx"),r=e<0;
15if(this.hls.trigger(tq.ERROR,{type:tj.OTHER_ERROR,details:tY.LEVEL_SWITCH_ERROR,level:e,fatal:r,error:i,reason:i.message}),r)return;e=Math.min(e,t.length-1)}let i=this.currentLevelIndex,r=this.currentLevel,a=r?r.attrs["PATHWAY-ID"]:void 0,s=t[e],n=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=s,i===e&&s.details&&r&&a===n)return;this.log(`Switching to level ${e} (${s.height?s.height+"p ":""}${s.videoRange?s.videoRange+" ":""}${s.codecSet?s.codecSet+" ":""}@${s.bitrate})${n?" with Pathway "+n:""} from level ${i}${a?" with Pathway "+a:""}`);let o={level:e,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(tq.LEVEL_SWITCHING,o);let l=s.details;if(!l||l.live){let e=this.switchParams(s.uri,null==r?void 0:r.details,l);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){let e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){!t.fatal&&t.context&&t.context.type===rT&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===rk){let e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;let i=this._levels[t.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var i,r;let{level:a,details:s}=t,n=this._levels[a];if(!n){this.warn(`Invalid level index ${a}`),null!=(r=t.deliveryDirectives)&&r.skip&&(s.deltaUpdateFailed=!0);return}a===this.currentLevelIndex?(0===n.fragmentError&&(n.loadError=0),this.playlistLoaded(a,t,n.details)):null!=(i=t.deliveryDirectives)&&i.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();let t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let r=i.uri;if(e)try{r=e.addDirectives(r)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}let a=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(null==e?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${a?" Pathway "+a:""} ${r}`),this.clearTimer(),this.hls.trigger(tq.LEVEL_LOADING,{url:r,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return -1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;let i=this._levels.filter((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1));r1(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(tq.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(tq.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function n1(e){let t={};e.forEach(e=>{let i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++})}class n2{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(let i in this.keyUriToKeyInfo){let r=this.keyUriToKeyInfo[i].loader;if(r){var t;if(e&&e!==(null==(t=r.context)?void 0:t.frag.type))return;r.abort()}}}detach(){for(let e in this.keyUriToKeyInfo){let t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){for(let e in this.detach(),this.keyUriToKeyInfo){let t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=tY.KEY_LOAD_ERROR,i,r,a){return new aR({type:tj.NETWORK_E
15RROR,details:t,fatal:!1,frag:e,response:a,error:i,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){let{sn:i,cc:r}=e;for(let e=0;e<t.length;e++){let a=t[e];if(r<=a.cc&&("initSegment"===i||"initSegment"===a.sn||i<a.sn)){this.emeController.selectKeySystemFormat(a).then(e=>{a.setKeyFormat(e)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,r,a;t&&e.setKeyFormat(t);let s=e.decryptdata;if(!s){let i=Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,tY.KEY_LOAD_ERROR,i))}let n=s.uri;if(!n)return Promise.reject(this.createKeyLoadError(e,tY.KEY_LOAD_ERROR,Error(`Invalid key URI: "${n}"`)));let o=this.keyUriToKeyInfo[n];if(null!=(i=o)&&i.decryptdata.key)return s.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if(null!=(r=o)&&r.keyLoadPromise)switch(null==(a=o.mediaKeySessionContext)?void 0:a.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(t=>(s.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}switch(o=this.keyUriToKeyInfo[n]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":if("identity"===s.keyFormat)return this.loadKeyHTTP(o,e);return this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,tY.KEY_LOAD_ERROR,Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){let i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){let t=this.emeController.loadKey(i);if(t)return(e.keyLoadPromise=t.then(t=>(e.mediaKeySessionContext=t,i))).catch(t=>{throw e.keyLoadPromise=null,t})}return Promise.resolve(i)}loadKeyHTTP(e,t){let i=this.config,r=new i.loader(i);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((a,s)=>{let n={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},o=i.keyLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};r.load(n,l,{onSuccess:(e,t,i,r)=>{let{frag:n,keyInfo:o,url:l}=i;if(!n.decryptdata||o!==this.keyUriToKeyInfo[l])return s(this.createKeyLoadError(n,tY.KEY_LOAD_ERROR,Error("after key load, decryptdata unset or changed"),r));o.decryptdata.key=n.decryptdata.key=new Uint8Array(e.data),n.keyLoader=null,o.loader=null,a({frag:n,keyInfo:o})},onError:(e,i,r,a)=>{this.resetLoader(i),s(this.createKeyLoadError(t,tY.KEY_LOAD_ERROR,Error(`HTTP Error ${e.code} loading key ${e.text}`),r,tH({url:n.url,data:void 0},e)))},onTimeout:(e,i,r)=>{this.resetLoader(i),s(this.createKeyLoadError(t,tY.KEY_LOAD_TIMEOUT,Error("key loading timed out"),r))},onAbort:(e,i,r)=>{this.resetLoader(i),s(this.createKeyLoadError(t,tY.INTERNAL_ABORTED,Error("key loading aborted"),r))}})})}resetLoader(e){let{frag:t,keyInfo:i,url:r}=e,a=i.loader;t.keyLoader===a&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],a&&a.destroy()}}function n3(){return self.SourceBuffer||self.WebKitSourceBuffer}function n4(){if(!i9())return!1;let e=n3();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class n5{constructor(e,t,i,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){let{config:i,media:r,stalled:a}=this;if(null===r)return;let{currentTime:s,seeking:n}=r,o=this.seeking&&!n,l=!this.seeking&&n;if(this.seeking=n,s!==e){if(this.moved=!0,n||(this.nudgeRetry=0),null!==a){if(this.stallReported){let e=self.performance.now()-a;tZ.warn(`playback not stuck anymore @${s}, after ${Math.round(e)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||o){this.stalled=null;return}if(r.paused&&!n||r.ended||0===r.playbackRate||!aE.getBuffered(r).length){this.nudgeRetry=0;return}let d=aE.bufferInfo(r,s,0),h=d.nextStart||0;if(n){let e=d.len>2,i=!h||t&&t.start<=s||h-s>2&&!this.fragmentTracker.getPartialFragment(s);if(e||i)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var u;if(!(d.len>0)&&!h)return;
15let e=Math.max(h,d.start||0)-s,t=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,i=(null==t||null==(u=t.details)?void 0:u.live)?2*t.details.targetduration:2,a=this.fragmentTracker.getPartialFragment(s);if(e>0&&(e<=i||a)){r.paused||this._trySkipBufferHole(a);return}}let c=self.performance.now();if(null===a){this.stalled=c;return}let m=c-a;if(!n&&m>=250&&(this._reportStall(d),!this.media))return;let p=aE.bufferInfo(r,s,i.maxBufferHole);this._tryFixBufferStall(p,m)}_tryFixBufferStall(e,t){let{config:i,fragmentTracker:r,media:a}=this;if(null===a)return;let s=a.currentTime,n=r.getPartialFragment(s);!(n&&(this._trySkipBufferHole(n)||!this.media))&&(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-s<i.maxBufferHole)&&t>1e3*i.highBufferWatchdogPeriod&&(tZ.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){let{hls:t,media:i,stallReported:r}=this;if(!r&&i){this.stallReported=!0;let r=Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);tZ.warn(r.message),t.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len})}}
15_trySkipBufferHole(e){let{config:t,hls:i,media:r}=this;if(null===r)return 0;let a=r.currentTime,s=aE.bufferInfo(r,a,0),n=a<s.start?s.start:s.nextStart;if(n){let o=s.len<=t.maxBufferHole,l=s.len>0&&s.len<1&&r.readyState<3,d=n-a;if(d>0&&(o||l)){if(d>t.maxBufferHole){let{fragmentTracker:t}=this,i=!1;if(0===a){let e=t.getAppendedFrag(0,rk);e&&n<e.end&&(i=!0)}if(!i){let i=e||t.getAppendedFrag(a,rk);if(i){let e=!1,r=i.end;for(;r<n;){let i=t.getPartialFragment(r);if(i)r+=i.duration;else{e=!0;break}}if(e)return 0}}}let s=Math.max(n+.05,a+.1);if(tZ.warn(`skipping hole, adjusting currentTime from ${a} to ${s}`),this.moved=!0,this.stalled=null,r.currentTime=s,e&&!e.gap){let t=Error(`fragment loaded with buffer holes, seeking from ${a} to ${s}`);i.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:t,reason:t.message,frag:e})}return s}}return 0}_tryNudgeBuffer(){let{config:e,hls:t,media:i,nudgeRetry:r}=this;if(null===i)return;let a=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){let s=a+(r+1)*e.nudgeOffset,n=Error(`Nudging 'currentTime' from ${a} to ${s}`);tZ.warn(n.message),i.currentTime=s,t.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.BUFFER_NUDGE_ON_STALL,error:n,fatal:!1})}else{let i=Error(`Playhead still not moving while enough data buffered @${a} after ${e.nudgeMaxRetry} nudges`);tZ.error(i.message),t.trigger(tq.ERROR,{type:tj.MEDIA_ERROR,details:tY.BUFFER_STALLED_ERROR,error:i,fatal:!0})}}}class n8 extends aq{constructor(e,t,i){super(e,t,i,"[stream-controller]",rk),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){let{hls:e}=this;e.on(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tq.LEVEL_LOADING,this.onLevelLoading,this),e.on(tq.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tq.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(tq.ERROR,this.onError,this),e.on(tq.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(tq.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(tq.BUFFER_CREATED,this.onBufferCreated,this),e.on(tq.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(tq.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tq.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){let{hls:e}=this;e.off(tq.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tq.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tq.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tq.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tq.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tq.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(tq.ERROR,this.onError,this),e.off(tq.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(tq.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(tq.BUFFER_CREATED,this.onBufferCreated,this),e.off(tq.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(tq.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tq.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){let{lastCurrentTime:t,hls:i}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let e=i.startLevel;-1===e&&(i.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=i.firstAutoLevel),i.nextLoadLevel=e,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=aP,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=aO}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case aK:{let{levels:e,level:t}=this,i=null==e?void 0:e[t],r=null==i?void 0:i.details;if(r&&(!r.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(r))break;this.state=aP}else this.hls.nextLoadLevel!==this.level&&(this.state=aP);break}case aF:{var e;let t=self.performance.now(),i=this.retryDate;if(!i||t>=i||null!=(e=this.media)&&e.seeking){let{levels:e,level:t}=this,i=null==e?void 0:e[t];this.resetStartWhenNotLoaded(i||null),this.state=aP}}}this.state===aP&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:i,media:r}=this;if(null===t||!r&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;
15let a=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(null!=i&&i[a]))return;let s=i[a],n=this.getMainFwdBufferInfo();if(null===n)return;let o=this.getLevelDetails();if(o&&this._streamEnded(n,o)){let e={};this.altAudio&&(e.type="video"),this.hls.trigger(tq.BUFFER_EOS,e),this.state=aW;return}if(!this.buffering)return;e.loadLevel!==a&&-1===e.manualLevel&&this.log(`Adapting to level ${a} from level ${this.level}`),this.level=e.nextLoadLevel=a;let l=s.details;if(!l||this.state===aK||l.live&&this.levelLastLoaded!==s){this.level=a,this.state=aK;return}let d=n.len,h=this.getMaxBufferLength(s.maxBitrate);if(d>=h)return;this.backtrackFragment&&this.backtrackFragment.start>n.end&&(this.backtrackFragment=null);let u=this.backtrackFragment?this.backtrackFragment.start:n.end,c=this.getNextFragment(u,l);if(this.couldBacktrack&&!this.fragPrevious&&c&&"initSegment"!==c.sn&&"OK"!==this.fragmentTracker.getState(c)){var m;let e=(null!=(m=this.backtrackFragment)?m:c).sn-l.startSN,t=l.fragments[e-1];t&&c.cc===t.cc&&(c=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&n.len&&(this.backtrackFragment=null);if(c&&this.isLoopLoading(c,u)){if(!c.gap){let e=this.audioOnly&&!this.altAudio?t4:t5,t=(e===t5?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,rk)}c=this.getNextFragmentLoopLoading(c,l,n,rk,h)}c&&(!c.initSegment||c.initSegment.data||this.bitrateTest||(c=c.initSegment),this.loadFragment(c,s,u))}loadFragment(e,t,i){let r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===au||r===am?"initSegment"===e.sn?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,rk)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,1/0)}nextLevelSwitch(){let{levels:e,media:t}=this;if(null!=t&&t.readyState){let i,r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);let a=this.getLevelDetails();if(null!=a&&a.live){let e=this.getMainFwdBufferInfo();if(!e||e.len<2*a.targetduration)return}if(!t.paused&&e){let t=e[this.hls.nextLoadLevel],r=this.fragLastKbps;i=r&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*r)+1:0}else i=0;let s=this.getBufferedFrag(t.currentTime+i);if(s){let e=this.followingBufferedFrag(s);if(e){this.abortCurrentFrag();let t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,r=Math.max(s.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(r,1/0)}}}}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case aN:case aU:case aF:case a$:case aH:this.state=aP}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);let i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new n5(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){let{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){let e=this.media,t=e?e.currentTime:null;tG(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);let i=this.getMainFwdBufferInfo();null===i||0===i.len?this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`):this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(tq.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){var i;let r,a=!1,s=!1;
15t.levels.forEach(e=>{let t=e.audioCodec;t&&(a=a||-1!==t.indexOf("mp4a.40.2"),s=s||-1!==t.indexOf("mp4a.40.5"))}),this.audioCodecSwitch=a&&s&&"function"!=typeof(null==(r=n3())||null==(i=r.prototype)?void 0:i.changeType),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){let{levels:i}=this;if(!i||this.state!==aP)return;let r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=aK)}onLevelLoaded(e,t){var i,r;let{levels:a}=this,s=t.level,n=t.details,o=n.totalduration;if(!a)return void this.warn(`Levels were reset while loading level ${s}`);this.log(`Level ${s} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""}, cc [${n.startCC}, ${n.endCC}] duration:${o}`);let l=a[s],d=this.fragCurrent;d&&(this.state===aU||this.state===aF)&&d.level!==t.level&&d.loader&&this.abortCurrentFrag();let h=0;if(n.live||null!=(i=l.details)&&i.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;h=this.alignPlaylists(n,l.details,null==(r=this.levelLastLoaded)?void 0:r.details)}if(l.details=n,this.levelLastLoaded=l,this.hls.trigger(tq.LEVEL_UPDATED,{details:n,level:s}),this.state===aK){if(this.waitForCdnTuneIn(n))return;this.state=aP}this.startFragRequested?n.live&&this.synchronizeToLiveEdge(n):this.setStartPosition(n,h),this.tick()}_handleFragmentLoadProgress(e){var t;let{frag:i,part:r,payload:a}=e,{levels:s}=this;if(!s)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);let n=s[i.level],o=n.details;if(!o){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}let l=n.videoCodec,d=o.PTSKnown||!o.live,h=null==(t=i.initSegment)?void 0:t.data,u=this._getAudioCodec(n),c=this.transmuxer=this.transmuxer||new sO(this.hls,rk,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=r?r.index:-1,p=new ab(i.level,i.sn,i.stats.chunkCount,a.byteLength,m,-1!==m),f=this.initPTS[i.cc];c.push(a,h,u,l,i,r,o.totalduration,d,p,f)}onAudioTrackSwitching(e,t){let i=this.altAudio;if(!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;let e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();let e=this.hls;i&&(e.trigger(tq.BUFFER_FLUSHING,{startOffset:0,endOffset:1/0,type:null}),this.fragmentTracker.removeAllFragments()),e.trigger(tq.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let i=t.id,r=!!this.hls.audioTracks[i].url;if(r){let e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=r,this.tick()}onBufferCreated(e,t){let i,r,a=t.tracks,s=!1;for(let e in a){let t=a[e];if("main"===t.id){if(r=e,i=t,"video"===e){let t=a[e];t&&(this.videoBuffer=t.buffer)}}else s=!0}s&&i?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){let{frag:i,part:r}=t;if(i&&i.type!==rk)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===aH&&(this.state=aP);return}let a=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),"initSegment"!==i.sn&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=aG;return}switch(t.details){case tY.FRAG_GAP:case tY.FRAG_PARSING_ERROR:case tY.FRAG_DECRYPT_ERROR:case tY.FRAG_LOAD_ERROR:case tY.FRAG_LOAD_TIMEOUT:case tY.KEY_LOAD_ERROR:case tY.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(rk,t);break;case tY.LEVEL_LOAD_ERROR:case tY.LEVEL_LOAD_TIMEOUT:case tY.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==aK||(null==(i=t.context)?void 0:i.type)!==rT||(this.state=aP);break;case tY.BUFFER_APPEND_ERROR:case tY.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===tY.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,1/0);break;case tY.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}
15checkBuffer(){let{media:e,gapController:t}=this;if(e&&t&&e.readyState){if(this.loadedmetadata||!aE.getBuffered(e).length){let e=this.state!==aP?this.fragCurrent:null;t.poll(this.lastCurrentTime,e)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=aP,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==t4||this.audioOnly&&!this.altAudio){let e=(t===t5?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(e,t,rk),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){let{media:e}=this;if(!e)return;let t=e.currentTime,i=this.startPosition;if(i>=0&&t<i){if(e.seeking)return void this.log(`could not seek to ${i}, already seeking at ${t}`);let r=aE.getBuffered(e),a=(r.length?r.start(0):0)-i;a>0&&(a<this.config.maxBufferHole||a<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${a} to match buffer start`),i+=a,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${t}`),e.currentTime=i}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{let{hls:r}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=aP,this.startFragRequested=!1,this.bitrateTest=!1;let a=e.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),r.trigger(tq.FRAG_LOADED,i),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;let i="main",{hls:r}=this,{remuxResult:a,chunkMeta:s}=e,n=this.getCurrentContext(s);if(!n)return void this.resetWhenMissingContext(s);let{frag:o,part:l,level:d}=n,{video:h,text:u,id3:c,initSegment:m}=a,{details:p}=d,f=this.altAudio?void 0:a.audio;if(this.fragContextChanged(o))return void this.fragmentTracker.removeFragment(o);if(this.state=a$,m){if(null!=m&&m.tracks){let e=o.initSegment||o;this._bufferInitSegment(d,m.tracks,e,s),r.trigger(tq.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:m.tracks})}let e=m.initPTS,t=m.timescale;tG(e)&&(this.initPTS[o.cc]={baseTime:e,timescale:t},r.trigger(tq.INIT_PTS_FOUND,{frag:o,id:i,initPTS:e,timescale:t}))}if(h&&p&&"initSegment"!==o.sn){let e=p.fragments[o.sn-1-p.startSN],t=o.sn===p.startSN,i=!e||o.cc>e.cc;if(!1!==a.independent){let{startPTS:e,endPTS:r,startDTS:a,endDTS:n}=h;if(l)l.elementaryStreams[h.type]={startPTS:e,endPTS:r,startDTS:a,endDTS:n};else if(h.firstKeyFrame&&h.independent&&1===s.id&&!i&&(this.couldBacktrack=!0),h.dropped&&h.independent){let a=this.getMainFwdBufferInfo(),s=(a?a.end:this.getLoadPosition())+this.config.maxBufferHole,l=h.firstKeyFramePTS?h.firstKeyFramePTS:e;if(!t&&s<l-this.config.maxBufferHole&&!i)return void this.backtrack(o);i&&(o.gap=!0),o.setElementaryStreamInfo(h.type,o.start,r,o.start,n,!0)}else t&&e>2&&(o.gap=!0);o.setElementaryStreamInfo(h.type,e,r,a,n),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(h,o,l,s,t||i)}else{if(!t&&!i)return void this.backtrack(o);o.gap=!0}}if(f){let{startPTS:e,endPTS:t,startDTS:i,endDTS:r}=f;l&&(l.elementaryStreams[t4]={startPTS:e,endPTS:t,startDTS:i,endDTS:r}),o.setElementaryStreamInfo(t4,e,t,i,r),this.bufferFragmentData(f,o,l,s)}if(p&&null!=c&&null!=(t=c.samples)&&t.length){let e={id:i,frag:o,details:p,samples:c.samples};r.trigger(tq.FRAG_PARSING_METADATA,e)}if(p&&u){let e={id:i,frag:o,details:p,samples:u.samples};r.trigger(tq.FRAG_PARSING_USERDATA,e)}}_bufferInitSegment(e,t,i,r){if(this.state!==a$)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;let{audio:a,video:s,audiovideo:n}=t;if(a){let t=e.audioCodec,i=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");let e=a.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&-1===i.indexOf("firefox")&&(t="mp4a.40.5")}t&&-1!==t.indexOf("mp4a.40.5")&&-1!==i.indexOf("android")&&"audio/mpeg"!==a.container&&(t="mp4a.40.2",this.log(`Android: force audio codec to ${t}`)),e.audioCodec&&e.audioCodec!==t&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${t}"`),a.levelCodec=t,a.id="main",this.log(`Init audio buffer, container:${a.container}, codecs[selected/level/parsed]=[${t||""}/${e.audioCodec||""}/${a.codec}]`)}s&&(s.levelCodec=e.videoCodec,s.id="main",this.log(`Init video buffer, container:${s.container}, codecs[level/parsed]=[${e.videoCodec||""}/${s.codec}]`)),n&&this.log(`Init audiovideo buffer, container:${n.container}, codecs[level/parsed]=[${e.codecs}/${n.codec}]`),this.hls.trigger(tq.BUFFER_CODECS,t),Object.keys(t).forEach(e
15=>{let a=t[e].initSegment;null!=a&&a.byteLength&&this.hls.trigger(tq.BUFFER_APPENDING,{type:e,data:a,frag:i,part:null,chunkMeta:r,parent:i.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,rk)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=aP}checkFragmentChanged(){let e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){let i=e.currentTime;if(aE.isBuffered(e,i)?t=this.getAppendedFrag(i):aE.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;let e=this.fragPlaying,i=t.level;(!e||t.sn!==e.sn||e.level!==i)&&(this.fragPlaying=t,this.hls.trigger(tq.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(tq.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){let e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){let e=this.media;if(e){let t=e.currentTime,i=this.currentFrag;if(i&&tG(t)&&tG(i.programDateTime))return new Date(i.programDateTime+(t-i.start)*1e3)}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class n9{static get version(){return"1.5.20"}static isMSESupported(){return n4()}static isSupported(){if(!n4())return!1;let e=i9();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(t=>e.isTypeSupported(rt(t,"video")))||["mp4a.40.2","fLaC"].some(t=>e.isTypeSupported(rt(t,"audio"))))}static getMediaSource(){return i9()}static get Events(){return tq}static get ErrorTypes(){return tj}static get ErrorDetails(){return tY}static get DefaultConfig(){return n9.defaultConfig?n9.defaultConfig:nJ}static set DefaultConfig(e){n9.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new sM,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,function(e,t){if("object"==typeof console&&!0===e||"object"==typeof e){!function(e,...t){t.forEach(function(t){let i;tQ[t]=e[t]?e[t].bind(e):(i=self.console[t])?i.bind(self.console,`[${t}] >`):tz})}(e,"debug","log","info","warn","error");try{tQ.log(`Debug logs enabled for "${t}" in hls.js version 1.5.20`)}catch(e){tQ=tX}}else tQ=tX}(e.debug||!1,"Hls instance");const t=this.config=function(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');let i=function e(t){return t&&"object"==typeof t?Array.isArray(t)?t.map(e):Object.keys(t).reduce((i,r)=>(i[r]=e(t[r]),i),{}):t}(e),r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(e=>{let a=`${"level"===e?"playlist":e}LoadPolicy`,s=void 0===t[a],n=[];r.forEach(r=>{let o=`${e}Loading${r}`,l=t[o];if(void 0!==l&&s){n.push(o);let e=i[a].default;switch(t[a]={default:e},r){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}}),n.length&&tZ.warn(`hls.js config: "${n.join('", "')}" setting(s) are deprecated, use "${a}": ${JSON.stringify(t[a])}`)}),tH(tH({},i),t)}(n9.DefaultConfig,e);this.userConfig=e,t.progressive&&function(e){let t=e.loader;t!==nY&&t!==nq?(tZ.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}
15()&&(e.loader=nY,e.progressive=!0,e.enableSoftwareAES=!0,tZ.log("[config]: Progressive streaming enabled, using FetchLoader"))}(t);const{abrController:i,bufferController:r,capLevelController:a,errorController:s,fpsController:n}=t,o=new s(this),l=this.abrController=new i(this),d=this.bufferController=new r(this),h=this.capLevelController=new a(this),u=new n(this),c=new rI(this),m=new rH(this),p=t.contentSteeringController,f=p?new p(this):null,g=this.levelController=new n0(this,f),v=new ap(this),E=new n2(this.config),b=this.streamController=new n8(this,v,E);h.setStreamController(b),u.setStreamController(b);const y=[c,g,b];f&&y.splice(1,0,f),this.networkControllers=y;const T=[l,d,h,u,m,v];this.audioTrackController=this.createController(t.audioTrackController,y);const A=t.audioStreamController;A&&y.push(new A(this,v,E)),this.subtitleTrackController=this.createController(t.subtitleTrackController,y);const _=t.subtitleStreamController;_&&y.push(new _(this,v,E)),this.createController(t.timelineController,T),E.emeController=this.emeController=this.createController(t.emeController,T),this.cmcdController=this.createController(t.cmcdController,T),this.latencyController=this.createController(rW,T),this.coreComponents=T,y.push(o);const k=o.onErrorOut;"function"==typeof k&&this.on(tq.ERROR,k,o)}createController(e,t){if(e){let i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,r){this._emitter.off(e,t,i,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(tZ.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;let i=e===tq.ERROR;this.trigger(tq.ERROR,{type:tj.OTHER_ERROR,details:tY.INTERNAL_EXCEPTION,fatal:i,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){tZ.log("destroy"),this.trigger(tq.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;let e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){tZ.log("attachMedia"),this._media=e,this.trigger(tq.MEDIA_ATTACHING,{media:e})}detachMedia(){tZ.log("detachMedia"),this.trigger(tq.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();let t=this.media,i=this.url,r=this.url=tB.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,tZ.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(tq.MANIFEST_LOADING,{url:e})}startLoad(e=-1){tZ.log(`startLoad(${e})`),this.started=!0,this.resumeBuffering();for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].startLoad(e),this.started&&this.networkControllers);t++);}stopLoad(){tZ.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!this.started&&this.networkControllers);e++);}resumeBuffering(){tZ.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()})}pauseBuffering(){tZ.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()})}swapAudioCodec(){tZ.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){tZ.log("recoverMediaError");let e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){return this.levelController.levels||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){tZ.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){tZ.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){tZ.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){tZ.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){let e=this.levelController.startLevel;return -1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){tZ.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){let t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(tZ.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){rG.indexOf(e)>-1&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return -1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){let{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;let i=e.length;for(let r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){let e,{levels:t,autoLevelCapping:i,maxHdcpLevel:r}=this;if(e=-1===i&&null!=t&&t.length?t.length-1:i,r)for(let i=e;i--;){let e=t[i].attrs["HDCP-LEVEL"];if(e&&e<=r)return i}return e}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null}get allAudioTracks(){let e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){let e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){let e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){let t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){let e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){let e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){let e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){let t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){let e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){let t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}n9.defaultConfig=void 0;
15var n6=class e extends Error{constructor(t,i=e.MEDIA_ERR_CUSTOM,r,a){var s;super(t),this.name="MediaError",this.code=i,this.context=a,this.fatal=null!=r?r:i>=e.MEDIA_ERR_NETWORK&&i<=e.MEDIA_ERR_ENCRYPTED,this.message||(this.message=null!=(s=e.defaultMessages[this.code])?s:"")}};n6.MEDIA_ERR_ABORTED=1,n6.MEDIA_ERR_NETWORK=2,n6.MEDIA_ERR_DECODE=3,n6.MEDIA_ERR_SRC_NOT_SUPPORTED=4,n6.MEDIA_ERR_ENCRYPTED=5,n6.MEDIA_ERR_CUSTOM=100,n6.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var n7=(e,t)=>null!=t&&e in t,oe={ANY:"any",MUTED:"muted"},ot="on-demand",oi="live",or="unknown",oa="native",os={HEADER:"header",QUERY:"query",NONE:"none"},on=Object.values(os),oo={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},ol={HLS:oo.M3U8};Object.keys(ol),[...Object.values(oo)];var od=(e,t,i,r,a=e)=>{a.addEventListener(t,i,r),e.addEventListener("teardown",()=>{a.removeEventListener(t,i)},{once:!0})},oh=e=>{let t=e.type;if(t){let e=t.toUpperCase();return n7(e,ol)?ol[e]:t}let{src:i}=e;return i?om(i):""},ou=e=>"VOD"===e?ot:oi,oc=e=>"EVENT"===e?1/0:"VOD"===e?NaN:0,om=e=>{let t="";try{t=new URL(e).pathname}catch{console.error("invalid url")}let i=t.lastIndexOf(".");if(i<0)return"";let r=t.slice(i+1).toUpperCase();return n7(r,oo)?oo[r]:""},op=Object.values(oe),of=e=>"boolean"==typeof e||"string"==typeof e&&op.includes(e),og=(e,t)=>{if(!t)return;let i=e.muted,r=()=>e.muted=i;switch(t){case oe.ANY:e.play().catch(()=>{e.muted=!0,e.play().catch(r)});break;case oe.MUTED:e.muted=!0,e.play().catch(r);break;default:e.play().catch(()=>{})}},ov=e=>"time"in e?e.time:e.startTime;function oE(e,t,i,r,a){let s=document.createElement("track");return s.kind=t,s.label=i,r&&(s.srclang=r),a&&(s.id=a),s.track.mode=["subtitles","captions"].includes(t)?"disabled":"hidden",s.setAttribute("data-removeondestroy",""),e.append(s),s.track}function ob(e,t,i){var r;return null==(r=Array.from(e.querySelectorAll("track")).find(e=>e.track.label===t&&e.track.kind===i))?void 0:r.track}async function oy(e,t,i,r){let a=ob(e,i,r);return a||((a=oE(e,r,i)).mode="hidden",await new Promise(e=>setTimeout(()=>e(void 0),0))),"hidden"!==a.mode&&(a.mode="hidden"),[...t].sort((e,t)=>ov(t)-ov(e)).forEach(t=>{var i,s;let n=t.value,o=ov(t);if("endTime"in t&&null!=t.endTime)null==a||a.addCue(new VTTCue(o,t.endTime,"chapters"===r?n:JSON.stringify(null!=n?n:null)));else{let t=Array.prototype.findIndex.call(null==a?void 0:a.cues,e=>e.startTime>=o),l=null==(i=null==a?void 0:a.cues)?void 0:i[t],d=l?l.startTime:Number.isFinite(e.duration)?e.duration:Number.MAX_SAFE_INTEGER,h=null==(s=null==a?void 0:a.cues)?void 0:s[t-1];h&&(h.endTime=o),null==a||a.addCue(new VTTCue(o,d,"chapters"===r?n:JSON.stringify(null!=n?n:null)))}}),e.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),a}var oT="cuepoints",oA=Object.freeze({label:oT});async function o_(e,t,i=oA){return oy(e,t,i.label,"metadata")}var ok=e=>({time:e.startTime,value:JSON.parse(e.text)});function oS(e,t={label:oT}){var i,r;let a=ob(e,t.label,"metadata");if(!(null!=(i=null==a?void 0:a.activeCues)&&i.length))return;if(1===a.activeCues.length)return ok(a.activeCues[0]);let{currentTime:s}=e;return ok(Array.prototype.find.call(null!=(r=a.activeCues)?r:[],({startTime:e,endTime:t})=>e<=s&&t>s)||a.activeCues[0])}async function ow(e,t=oA){return new Promise(i=>{od(e,"loadstart",async()=>{let r=await o_(e,[],t);od(e,"cuechange",()=>{let t=oS(e);if(t){let i=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:t});e.dispatchEvent(i)}},{},r),i(r)})})}var oL="chapters",oR=Object.freeze({label:oL}),oI=e=>({startTime:e.startTime,endTime:e.endTime,value:e.text});async function oC(e,t,i=oR){return oy(e,t,i.label,"chapters")}function oD(e,t={label:oL}){var i,r;let a=ob(e,t.label,"chapters");if(!(null!=(i=null==a?void 0:a.activeCues)&&i.length))return;if(1===a.activeCues.length)return oI(a.activeCues[0]);let{currentTime:s}=e;return oI(Array.prototype.find.call(null!=(r=a.activeCues)?r:[],
15({startTime:e,endTime:t})=>e<=s&&t>s)||a.activeCues[0])}async function ox(e,t=oR){return new Promise(i=>{od(e,"loadstart",async()=>{let r=await oC(e,[],t);od(e,"cuechange",()=>{let t=oD(e);if(t){let i=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:t});e.dispatchEvent(i)}},{},r),i(r)})})}var oM,oO,oP,oN,oU,oF,oB,o$,oH,oW,oG,oV,oK,oq,oj,oY,oz,oX,oQ,oZ=async e=>fetch(e).then(e=>e.text()).then(e=>fetch(e.split(` 16`).find((e,t,i)=>t&&i[t-1].startsWith("#EXT-X-STREAM-INF"))).then(e=>e.text()).then(e=>e.split(` 17`))),oJ=async(e,t)=>t===oo.MP4?{streamType:ot,targetLiveWindow:NaN,liveEdgeStartOffset:void 0}:t===oo.M3U8?(e=>{var t,i,r;let a=null==(i=(null!=(t=e.find(e=>e.startsWith("#EXT-X-PLAYLIST-TYPE")))?t:"").split(":")[1])?void 0:i.trim(),s=ou(a),n=oc(a),o;if(s===oi){let t=e.find(e=>e.startsWith("#EXT-X-PART-INF"));if(t)o=2*t.split(":")[1].split("=")[1];else{let t=e.find(e=>e.startsWith("#EXT-X-TARGETDURATION")),i=null==(r=null==t?void 0:t.split(":"))?void 0:r[1];o=(null!=i?i:6)*3}}return{streamType:s,targetLiveWindow:n,liveEdgeStartOffset:o}})(await oZ(e)):(console.error(`Media type ${t} is an unrecognized or unsupported type for src ${e}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0}),o0=async(e,t,i=oh({src:e}))=>{var r,a,s;let{streamType:n,targetLiveWindow:o,liveEdgeStartOffset:l}=await oJ(e,i);(null!=(r=o2.get(t))?r:{}).liveEdgeStartOffset=l,(null!=(a=o2.get(t))?a:{}).targetLiveWindow=o,t.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),(null!=(s=o2.get(t))?s:{}).streamType=n,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},o1=-1!==(null!=(oX=null==(oz=null==globalThis?void 0:globalThis.navigator)?void 0:oz.userAgent)?oX:"").toLowerCase().indexOf("android"),o2=new WeakMap,o3="mux.com",o4=null==(oQ=n9.isSupported)?void 0:oQ.call(n9),o5=tN.utils.generateUUID,o8=({playbackId:e,customDomain:t=o3,maxResolution:i,minResolution:r,renditionOrder:a,programStartTime:s,programEndTime:n,tokens:{playback:o}={},extraSourceParams:l={}}={})=>{let d;if(!e)return;let[h,u=""]=(d=e.indexOf("?"))<0?[e]:[e.slice(0,d),e.slice(d)],c=new URL(`https://stream.${t}/${h}.m3u8${u}`);return o||c.searchParams.has("token")?(c.searchParams.forEach((e,t)=>{"token"!=t&&c.searchParams.delete(t)}),o&&c.searchParams.set("token",o)):(i&&c.searchParams.set("max_resolution",i),r&&(c.searchParams.set("min_resolution",r),i&&+i.slice(0,-1)<+r.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",r,"maxResolution",i)),a&&c.searchParams.set("rendition_order",a),s&&c.searchParams.set("program_start_time",`${s}`),n&&c.searchParams.set("program_end_time",`${n}`),Object.entries(l).forEach(([e,t])=>{null!=t&&c.searchParams.set(e,t)})),c.toString()},o9=e=>{if(!e||!e.startsWith("https://stream."))return;let[t]=new URL(e).pathname.slice(1).split(".m3u8");return t||void 0},o6=e=>{var t,i;return null!=(i=null==(t=o2.get(e))?void 0:t.streamType)?i:or},o7=e=>{var t,i;return null!=(i=null==(t=o2.get(e))?void 0:t.seekable)?i:e.seekable},le=.034,lt=(e,t,i=le)=>e>t||((e,t,i=le)=>Math.abs(e-t)<=i)(e,t,i),li=(e,t)=>{var i,r,a;if(!t||!e.buffered.length)return;if(e.readyState>2)return!1;let s=t.currentLevel>=0?null==(r=null==(i=t.levels)?void 0:i[t.currentLevel])?void 0:r.details:null==(a=t.levels.find(e=>!!e.details))?void 0:a.details;if(!s||s.live)return;let{fragments:n}=s;if(!(null!=n&&n.length))return;if(e.currentTime<e.duration-(s.targetduration+.5))return!1;let o=n[n.length-1];if(e.currentTime<=o.start)return!1;let l=o.start+o.duration/2,d=e.buffered.start(e.buffered.length-1),h=e.buffered.end(e.buffered.length-1);return l>d&&l<h},lr=(e,t)=>e.ended||e.loop?e.ended:!!(t&&li(e,t))||((e,t=le)=>e.paused&<(e.currentTime,e.duration,t))(e),la=(e,t)=>{let i=null==t?void 0:t.engine;i&&(i.detachMedia(),i.destroy()),null!=e&&e.mux&&!e.mux.deleted&&(e.mux.destroy(),delete e.mux),e&&(e.removeAttribute("src"),e.load(),e.removeEventListener("error",lp),e.removeEventListener("error",lf),e.removeEventListener("durationchange",lm),o2.delete(e),e.dispatchEvent(new Event("teardown")))};function ls(e,t){var i;let r=oh(e);if(r!==oo.M3U8)return!0;let a=!r||null==(i=t.canPlayType(r))||i,{preferPlayback:s}=e;return a&&(s===oa||!(o4&&("mse"===s||o1)))}var ln=e=>e===oi?{backBufferLength:8}:{},lo=e=>{let{drmToken:t,src:i,playbackId:r=o9(i)}=e;return t&&r?{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:lh(e,"fairplay"),serverCertificateUrl:lu(e,"fairplay")},"com.widevine.alpha":{licenseUrl:lh(e,"widevine")},"com.microsoft.playready":{licenseUrl:lh(e,"playready")}},requestMediaKeySystemAccessFunc:(e,t)=>("com.widevine.alpha"===e&&(t=[...t.map(e=>{var t;let i=null==(t=e.videoCapabilities)?void 0:t.map(e=>({...e,robustness:"HW_SECURE_ALL"}));return{...e,videoCapabilities:i}}),...t]),navigator.requestMediaKeySystemAccess(e,t))}:{}},ll=async e=>await (await fetch(e)).arrayBuffer(),ld=async(e,t)=>
17new Uint8Array(await (await fetch(t,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:e})).arrayBuffer()),lh=({playbackId:e,drmToken:t,customDomain:i=o3},r)=>`https://license.${i.toLocaleLowerCase().endsWith(o3)?i:o3}/license/${r}/${e}?token=${t}`,lu=({playbackId:e,drmToken:t,customDomain:i=o3},r)=>`https://license.${i.toLocaleLowerCase().endsWith(o3)?i:o3}/appcert/${r}/${e}?token=${t}`,lc=({playbackId:e,src:t,customDomain:i})=>{if(e)return!0;if("string"!=typeof t)return!1;let r=new URL(t,null==window?void 0:window.location.href).hostname.toLocaleLowerCase();return r.includes(o3)||!!i&&r.includes(i.toLocaleLowerCase())};function lm(e){var t;let i=e.target,r=null==(t=o2.get(i))?void 0:t.startTime;if(r&&function(e,t,i){t&&i>t&&(i=t);for(let t=0;t<e.length;t++)if(e.start(t)<=i&&e.end(t)>=i)return!0;return!1}(i.seekable,i.duration,r)){let e="auto"===i.preload;e&&(i.preload="none"),i.currentTime=r,e&&(i.preload="auto")}}async function lp(e){if(!e.isTrusted)return;e.stopImmediatePropagation();let t=e.target;if(!(null!=t&&t.error))return;let{message:i,code:r}=t.error,a=new n6(i,r);if(t.src&&(r!==n6.MEDIA_ERR_DECODE||void 0!==r))try{let{status:e}=await fetch(t.src);a.data={response:{code:e}}}catch{}t.dispatchEvent(new CustomEvent("error",{detail:a}))}function lf(e){var t,i;if(!(e instanceof CustomEvent)||!(e.detail instanceof n6))return;let r=e.target,a=e.detail;a&&a.fatal&&((null!=(t=o2.get(r))?t:{}).error=a,null==(i=r.mux)||i.emit("error",{player_error_code:a.code,player_error_message:a.message,player_error_context:a.context}))}let lg={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},lv={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},lE={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_PAUSED:"mediaPaused",MEDIA_HAS_P
17LAYED:"mediaHasPlayed",MEDIA_ENDED:"mediaEnded",MEDIA_MUTED:"mediaMuted",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_IS_PIP:"mediaIsPip",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_LOADING:"mediaLoading",MEDIA_BUFFERED:"mediaBuffered",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_CHAPTERS_CUES:"mediaChaptersCues"},lb=Object.entries(lE),ly=lb.reduce((e,[t,i])=>(e[t]=`${i.toLowerCase()}`,e),{}),lT=lb.reduce((e,[t,i])=>(e[t]=`${i.toLowerCase()}`,e),{USER_INACTIVE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"}),lA=Object.entries(lT).reduce((e,[t,i])=>{let r=ly[t];return r&&(e[i]=r),e},{userinactivechange:"userinactive"}),l_=Object.entries(ly).reduce((e,[t,i])=>{let r=lT[t];return r&&(e[i]=r),e},{userinactive:"userinactivechange"}),lk={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},lS={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"},lw={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},lL={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},lR={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},lI={INLINE:"inline",FULLSCREEN:"fullscreen",PICTURE_IN_PICTURE:"picture-in-picture"};e.s(["AttributeToStateChangeEventMap",0,l_,"AvailabilityStates",0,lL,"MediaStateChangeEvents",0,lT,"MediaStateReceiverAttributes",0,lv,"MediaUIAttributes",0,ly,"MediaUIEvents",0,lg,"MediaUIProps",0,lE,"PointerTypes",0,lw,"ReadyStates",0,{HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},"StateChangeEventToAttributeMap",0,lA,"StreamTypes",0,lR,"TextTrackKinds",0,lk,"TextTrackModes",0,lS,"VolumeLevels",0,{HIGH:"high",MEDIUM:"medium",LOW:"low",OFF:"off"},"WebkitPresentationModes",0,lI],92617),e.i(92617);let lC={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:e=1}={})=>`current playback rate ${e}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading",SETTINGS:()=>"settings",AUDIO_TRACKS:()=>"audio tracks",QUALITY:()=>"quality"},lD={PLAY:()=>"play",PAUSE:()=>"pause",MUTE:()=>"mute",UNMUTE:()=>"unmute",ENTER_AIRPLAY:()=>"start airplay",EXIT_AIRPLAY:()=>"stop airplay",ENTER_CAST:()=>"start casting",EXIT_CAST:()=>"stop casting",ENTER_FULLSCREEN:()=>"enter fullscreen mode",EXIT_FULLSCREEN:()=>"exit fullscreen mode",ENTER_PIP:()=>"enter picture in picture mode",EXIT_PIP:()=>"exit picture in picture mode",SEEK_FORWARD_N_SECS:({seekOffset:e=30}={})=>`seek forward ${e} seconds`,SEEK_BACK_N_SECS:({seekOffset:e=30}={})=>`seek back ${e} seconds`,SEEK_LIVE:()=>"seek to live",PLAYING_LIVE:()=>"playing live"};function lx(e){return null==e?void 0:e.split(/\s+/).map(lO)}function lM(e){if(e){let{id:t,width:i,height:r}=e;return[t,i,r].filter(e=>null!=e).join(":")}}function lO(e){if(e){let[t,i,r]=e.split(":");return{id:t,width:i,height:r}}}function lP(e){return null==e?void 0:e.split(/\s+/).map(lU)}function lN(e){if(e){let{id:t,kind:i,language:r,label:a}=e;return[t,i,r,a].filter(e=>null!=e).join(":")}}function lU(e){if(e){let[t,i,r,a]=e.split(":");return{id:t,kind:i,language:r,label:a}}}function lF(e){return"string"==typeof e&&!isNaN(e)&&!isNaN(parseFloat(e))}({...lC,...lD});let lB=e=>new Promise(t=>setTimeout(t,e)),l$=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],lH=e=>{if(!("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)))return"";let t=Math.abs(e),i=new Date(0,0,0,0,0,t,0),r=[i.getHours(),i.getMinutes(),i.getSeconds()].map((e,t)=>{let i;return e&&(i=1===e?l$[t].singular:l$[t].plural,`${e} ${i}`)}).filter(e=>e).join(", ");return`${r}${t!==e?" remaining":""}`};function lW(e,t){let i=!1;e<0&&(i=!0,e=0-e);let r=Math.floor((e=e<0?0:e)%60),a=Math.floor(e/60%60),s=Math.floor(e/3600),n=Math.floor(t/60%60),o=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(s=a=r="0"),a=(((s=s>
170||o>0?s+":":"")||n>=10)&&a<10?"0"+a:a)+":",(i?"-":"")+s+a+(r=r<10?"0"+r:r)}let lG=Object.freeze({length:0,start(e){let t=e>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(e){let t=e>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});e.s(["emptyTimeRanges",0,lG,"formatAsTimePhrase",0,lH,"formatTime",0,lW,"serializeTimeRanges",0,function(e=lG){return Array.from(e).map((t,i)=>[Number(e.start(i).toFixed(3)),Number(e.end(i).toFixed(3))].join(":")).join(" ")}],38333),e.i(38333);class lV{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}}class lK extends lV{}let lq={createElement:function(){return new lj.HTMLElement},createElementNS:function(){return new lj.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent:e=>!1},lj={ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},document:lq,Node:lK,HTMLElement:class extends lK{},DocumentFragment:class extends lV{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem:e=>null,setItem(e,t){},removeItem(e){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia:e=>({matches:!1,media:e})},lY="u"<typeof window||void 0===window.customElements,lz=Object.keys(lj).every(e=>e in globalThis),lX=lY&&!lz?lj:globalThis,lQ=lY&&!lz?lq:globalThis.document,lZ=new WeakMap,lJ=e=>{let t=lZ.get(e);return t||lZ.set(e,t=new Set),t},l0=new lX.ResizeObserver(e=>{for(let t of e)for(let e of lJ(t.target))e(t)});function l1(e,t){lJ(e).add(t),l0.observe(e)}function l2(e,t){let i=lJ(e);i.delete(t),i.size||l0.unobserve(e)}function l3(e){var t;return null!=(t=l4(e))?t:l6(e,"media-controller")}function l4(e){var t;let{MEDIA_CONTROLLER:i}=lv,r=e.getAttribute(i);if(r)return null==(t=de(e))?void 0:t.getElementById(r)}let l5=(e,t,i=".value")=>{let r=e.querySelector(i);r&&(r.textContent=t)},l8=(e,t)=>{let i,r;return(i=`slot[name="${t}"]`,!(r=e.shadowRoot.querySelector(i))?[]:r.children)[0]},l9=(e,t)=>!!e&&!!t&&(null!=e&&!!e.contains(t)||l9(e,t.getRootNode().host)),l6=(e,t)=>{if(!e)return null;let i=e.closest(t);return i||l6(e.getRootNode().host,t)};function l7(e=document){var t;let i=null==e?void 0:e.activeElement;return i?null!=(t=l7(i.shadowRoot))?t:i:null}function de(e){var t;let i=null==(t=null==e?void 0:e.getRootNode)?void 0:t.call(e);return i instanceof ShadowRoot||i instanceof Document?i:null}function dt(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function di(e,t){let i=function(e,t){var i;let r;for(r of e.querySelectorAll("style")){let e;try{e=null==(i=r.sheet)?void 0:i.cssRules}catch{continue}for(let i of null!=e?e:[])if(t(i.selectorText))return i}}(e,e=>e===t);return i||dr(e,t)}function dr(e,t){var i,r;let a=null!=(i=e.querySelectorAll("style"))?i:[],s=null==a?void 0:a[a.length-1];return(null==s?void 0:s.sheet)?(null==s||s.sheet.insertRule(`${t}{}`,s.sheet.cssRules.length),null==(r=s.sheet.cssRules)?void 0:r[s.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",e),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function da(e,t,i=NaN){let r=e.getAttribute(t);return null!=r?+r:i}function ds(e,t,i){let r=+i;if(null==i||Number.isNaN(r)){e.hasAttribute(t)&&e.removeAttribute(t);return}da(e,t,void 0)!==r&&e.setAttribute(t,`${r}`)}function dn(e,t){return e.hasAttribute(t)}function dl(e,t,i){if(null==i){e.hasAttribute(t)&&e.removeAttribute(t);return}dn(e,t)!=i&&e.toggleAttribute(t,i)}function dd(e,t,i=null){var r;return null!=(r=e.getAttribute(t))?r:i}function dh(e,t,i){if(null==i){e.hasAttribute(t)&&e.removeAttribute(t);return}let r=`${i}`;dd(e,t,void 0)!==r&&e.setAttribute(t,r)}var du=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},dc=(e,t,i)=>(du(e,t,"read from private field"),i?i.call(e):t.get(e)),dm=(e,t,i,r)=>(du(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let dp=lQ.createElement("template");dp.innerHTML=` 18<style> 19 :host { 20 display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block)); 21 box-sizing: border-box; 22 } 23</style> 24`;class df extends lX.HTMLElement{constructor(e={}){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,pH,void 0),!this.shadowRoot){const t=this.attachShadow({mode:"open"}),i=dp.content.cloneNode(!0);this.nativeEl=i;let r=e.slotTemplate;r||((r=lQ.createElement("template")).innerHTML=`<slot>${e.defaultContent||""}</slot>`),this.nativeEl.appendChild(r.content.cloneNode(!0)),t.appendChild(i)}}static get observedAttributes(){return[lv.MEDIA_CONTROLLER,ly.MEDIA_PAUSED]}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===lv.MEDIA_CONTROLLER&&(t&&(null==(a=null==(r=dc(this,pH))?void 0:r.unassociateElement)||a.call(r,this),dm(this,pH,null)),i&&this.isConnected&&(dm(this,pH,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=dc(this,pH))?void 0:n.associateElement)||o.call(n,this)))}connectedCallback(){var e,t,i,r,a,s;let n;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),dm(this,pH,(a=this,(n=a.getAttribute(lv.MEDIA_CONTROLLER))?null==(s=a.getRootNode())?void 0:s.getElementById(n):l6(a,"media-controller"))),this.getAttribute(lv.MEDIA_CONTROLLER)&&(null==(t=null==(e=
24dc(this,pH))?void 0:e.associateElement)||t.call(e,this)),null==(i=dc(this,pH))||i.addEventListener("pointerdown",this),null==(r=dc(this,pH))||r.addEventListener("click",this)}disconnectedCallback(){var e,t,i,r;this.getAttribute(lv.MEDIA_CONTROLLER)&&(null==(t=null==(e=dc(this,pH))?void 0:e.unassociateElement)||t.call(e,this)),null==(i=dc(this,pH))||i.removeEventListener("pointerdown",this),null==(r=dc(this,pH))||r.removeEventListener("click",this),dm(this,pH,null)}handleEvent(e){var t;let i=null==(t=e.composedPath())?void 0:t[0];if(["video","media-controller"].includes(null==i?void 0:i.localName)){if("pointerdown"===e.type)this._pointerType=e.pointerType;else if("click"===e.type){let{clientX:t,clientY:i}=e,{left:r,top:a,width:s,height:n}=this.getBoundingClientRect(),o=t-r,l=i-a;if(o<0||l<0||o>s||l>n||0===s&&0===n)return;let{pointerType:d=this._pointerType}=e;if(this._pointerType=void 0,d===lw.TOUCH)return void this.handleTap(e);if(d===lw.MOUSE)return void this.handleMouseClick(e)}}}get mediaPaused(){return dn(this,ly.MEDIA_PAUSED)}set mediaPaused(e){dl(this,ly.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){let t=this.mediaPaused?lg.MEDIA_PLAY_REQUEST:lg.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new lX.CustomEvent(t,{composed:!0,bubbles:!0}))}}pH=new WeakMap,lX.customElements.get("media-gesture-receiver")||lX.customElements.define("media-gesture-receiver",df);var dg=Object.defineProperty,dv=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},dE=(e,t,i)=>(dv(e,t,"read from private field"),i?i.call(e):t.get(e)),db=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},dy=(e,t,i,r)=>(dv(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),dT=(e,t,i)=>(dv(e,t,"access private method"),i);let dA="audio",d_="autohide",dk="gesturesdisabled",dS="keyboardcontrol",dw="noautohide",dL="userinactive",dR=lQ.createElement("template");dR.innerHTML=` 25 <style> 26 27 :host([${ly.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) { 28 outline: none; 29 } 30 31 :host { 32 box-sizing: border-box; 33 position: relative; 34 display: inline-block; 35 line-height: 0; 36 background-color: var(--media-background-color, #000); 37 } 38 39 :host(:not([${dA}])) [part~=layer]:not([part~=media-layer]) { 40 position: absolute; 41 top: 0; 42 left: 0; 43 bottom: 0; 44 right: 0; 45 display: flex; 46 flex-flow: column nowrap; 47 align-items: start; 48 pointer-events: none; 49 background: none; 50 } 51 52 slot[name=media] { 53 display: var(--media-slot-display, contents); 54 } 55 56 57 :host([${dA}]) slot[name=media] { 58 display: var(--media-slot-display, none); 59 } 60 61 62 :host([${dA}]) [part~=layer][part~=gesture-layer] { 63 height: 0; 64 display: block; 65 } 66 67 68 :host(:not([${dA}])[${dk}]) ::slotted([slot=gestures-chrome]), 69 :host(:not([${dA}])[${dk}]) media-gesture-receiver[slot=gestures-chrome] { 70 display: none; 71 } 72 73 74 ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator):not([hidden])) { 75 pointer-events: auto; 76 } 77 78 :host(:not([${dA}])) *[part~=layer][part~=centered-layer] { 79 align-items: center; 80 justify-content: center; 81 } 82 83 :host(:not([${dA}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]), 84 :host(:not([${dA}])) media-gesture-receiver[slot=gestures-chrome] { 85 align-self: stretch; 86 flex-grow: 1; 87 } 88 89 slot[name=middle-chrome] { 90 display: inline; 91 flex-grow: 1; 92 pointer-events: none; 93 background: none; 94 } 95 96 97 ::slotted([slot=media]), 98 ::slotted([slot=poster]) { 99 width: 100%; 100 height: 100%; 101 } 102 103 104 :host(:not([${dA}])) .spacer { 105 flex-grow: 1; 106 } 107 108 109 :host(:-webkit-full-screen) { 110 111 width: 100% !important; 112 height: 100% !important; 113 } 114 115 116 ::slotted(:not([slot=media]):not([slot=poster]):not([${dw}]):not([hidden])) { 117 opacity: 1; 118 transition: opacity 0.25s; 119 } 120 121 122 :host([${dL}]:not([${ly.MEDIA_PAUSED}]):not([${ly.MEDIA_IS_AIRPLAYING}
122]):not([${ly.MEDIA_IS_CASTING}]):not([${dA}])) ::slotted(:not([slot=media]):not([slot=poster]):not([${dw}])) { 123 opacity: 0; 124 transition: opacity 1s; 125 } 126 127 :host([${dL}]:not([${ly.MEDIA_PAUSED}]):not([${ly.MEDIA_IS_CASTING}]):not([${dA}])) ::slotted([slot=media]) { 128 cursor: none; 129 } 130 131 ::slotted(media-control-bar) { 132 align-self: stretch; 133 } 134 135 136 :host(:not([${dA}])[${ly.MEDIA_HAS_PLAYED}]) slot[name=poster] { 137 display: none; 138 } 139 140 ::slotted([role="menu"]) { 141 align-self: end; 142 } 143 144 ::slotted([role="dialog"]) { 145 align-self: center; 146 } 147 </style> 148 149 <slot name="media" part="layer media-layer"></slot> 150 <slot name="poster" part="layer poster-layer"></slot> 151 <slot name="gestures-chrome" part="layer gesture-layer"> 152 <media-gesture-receiver slot="gestures-chrome"></media-gesture-receiver> 153 </slot> 154 <span part="layer vertical-layer"> 155 <slot name="top-chrome" part="top chrome"></slot> 156 <slot name="middle-chrome" part="middle chrome"></slot> 157 <slot name="centered-chrome" part="layer centered-layer center centered chrome"></slot> 158 159 <slot part="bottom chrome"></slot> 160 </span> 161`;let dI=Object.values(ly);class dC extends lX.HTMLElement{constructor(){super(),db(this,pV),db(this,pq),db(this,pY),db(this,pX),db(this,pZ),db(this,pW,0),db(this,pG,void 0),((e,t,i)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?dg(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i})(this,"breakpointsComputed",!1),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(dR.content.cloneNode(!0))),new MutationObserver(e=>{let t=this.media;for(let i of e)"childList"===i.type&&(i.removedNodes.forEach(e=>{if("media"==e.slot&&i.target==this){let r=i.previousSibling&&i.previousSibling.previousElementSibling;if(r&&t){let t="media"!==r.slot;for(;null!==(r=r.previousSibling);)"media"==r.slot&&(t=!1);t&&this.mediaUnsetCallback(e)}else this.mediaUnsetCallback(e)}}),t&&i.addedNodes.forEach(e=>{e===t&&this.handleMediaUpdated(t)}))}).observe(this,{childList:!0,subtree:!0});let e=!1;l1(this,t=>{e||(setTimeout(()=>{(function(e,t){var i,r,a;if(!e.isConnected)return;let s=Object.fromEntries((null!=(i=e.getAttribute("breakpoints"))?i:"sm:384 md:576 lg:768 xl:960").split(/\s+/).map(e=>e.split(":"))),n=(r=s,a=t,Object.keys(r).filter(e=>a>=r[e])),o=!1;if(Object.keys(s).forEach(t=>{if(n.includes(t)){e.hasAttribute(`breakpoint${t}`)||(e.setAttribute(`breakpoint${t}`,""),o=!0);return}e.hasAttribute(`breakpoint${t}`)&&(e.removeAttribute(`breakpoint${t}`),o=!0)}),o){let t=new CustomEvent(lT.BREAKPOINTS_CHANGE,{detail:n});e.dispatchEvent(t)}})(t.target,t.contentRect.width),e=!1,this.breakpointsComputed||(this.breakpointsComputed=!0,this.dispatchEvent(new CustomEvent(lT.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))},0),e=!0)});let t=this.querySelector(":scope > slot[slot=media]");t&&t.addEventListener("slotchange",()=>{if(!t.assignedElements({flatten:!0}).length){dE(this,pG)&&this.mediaUnsetCallback(dE(this,pG));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[d_,dk].concat(dI).filter(e=>![ly.MEDIA_RENDITION_LIST,ly.MEDIA_AUDIO_TRACK_LIST,ly.MEDIA_CHAPTERS_CUES].includes(e))}attributeChangedCallback(e,t,i){e.toLowerCase()==d_&&(this.autohide=i)}get media(){let e=this.querySelector(":scope > [slot=media]");return(null==e?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(dy(this,pG,e),e.localName.includes("-")&&await lX.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;let t=null!=this.getAttribute(dA)?lC.AUDIO_PLAYER():lC.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",t),this.handleMediaUpdated(this.media),this.setAttribute(dL,""),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),null==(e=lX.window)||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;this.media&&this.mediaUnsetCallback(this.media),null==(e=lX.window)||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){dy(this,pG,null)}handleEvent(e){switch(e.type){case"pointerdown":dy(this,pW,e.timeStamp);break;case"pointermove":dT(this,pV,pK).call(this,e);break;case"pointerup":dT(this,pq,pj).call(this,e);break;case"mouseleave":dT(this,pY,pz).call(this);break;case"mouseup":this.removeAttribute(dS);break;case"keyup":dT(this,pZ,pJ).call(this),this.setAttribute(dS,"")}}set autohide(e){e=Number(e),this._autohide=isNaN(e)?0:e}get autohide(){return void 0===this._autohide?2:this._autohide}}pW=new WeakMap,pG=new WeakMap,pV=new WeakSet,pK=function(e){!("mouse"!==e.pointerType&&e.timeStamp-dE(this,pW)<250)&&(dT(this,pX,pQ).call(this),clearTimeout(this._inactiveTimeout),[this,this.media].includes(e.target)&&dT(this,pZ,pJ).call(this))},pq=new WeakSet,pj=function(e){if("touch"===e.pointerType){let t=!this.hasAttribute(dL);[this,this.media].includes(e.target)&&t?dT(this,pY,pz).call(this):dT(this,pZ,pJ).call(this)}else e.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(null==e?void 0:e.localName))&&dT(this,pZ,pJ).call(this)},pY=new WeakSet,pz=function(){if(this.autohide<0||this.hasAttribute(dL))return;this.setAttribute(dL,"");let e=new lX.CustomEvent(lT.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(e)},pX=new WeakSet,pQ=function(){if(!this.hasAttribute(dL))return;this.removeAttribute(dL);let e=new lX.CustomEvent(lT.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(e)},pZ=new WeakSet,pJ=function(){dT(this,pX,pQ).call(this),clearTimeout(this._inactiveTimeout),this.autohide<0||(this._inactiveTimeout=setTimeout(()=>{dT(this,pY,pz).call(this)},1e3*this.autohide))},lX.customElements.get("media-container")||lX.customElements.define("media-container",dC);var dD=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},dx=(e,t,i)=>(dD(e,t,"read from private field"),i?i.call(e):t.get(e)),dM=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},dO=(e,t,i,r)=>(dD(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class dP{constructor(e,t,{defaultValue:i}={defaultValue:void 0}){dM(this,p4),dM(this,p0,void 0),dM(this,p1,void 0),dM(this,p2,void 0),dM(this,p3,new Set),dO(this,p0,e),dO(this,p1,t),dO(this,p2,new Set(i))}[Symbol.iterator](){return dx(this,p4,p5).values()}get length(){return dx(this,p4,p5).size}get value(){var e;return null!=(e=[...dx(this,p4,p5)].join(" "))?e:""}set value(e){var t;e!==this.value&&(dO(this,p3,new Set),this.add(...null!=(t=null==e?void 0:e.split(" "))?t:[]))}toString(){return this.value}item(e){return[...dx(this,p4,p5)][e]}values(){return dx(this,p4,p5).values()}
161forEach(e){dx(this,p4,p5).forEach(e)}add(...e){var t,i;e.forEach(e=>dx(this,p3).add(e)),(""!==this.value||(null==(t=dx(this,p0))?void 0:t.hasAttribute(`${dx(this,p1)}`)))&&(null==(i=dx(this,p0))||i.setAttribute(`${dx(this,p1)}`,`${this.value}`))}remove(...e){var t;e.forEach(e=>dx(this,p3).delete(e)),null==(t=dx(this,p0))||t.setAttribute(`${dx(this,p1)}`,`${this.value}`)}contains(e){return dx(this,p4,p5).has(e)}toggle(e,t){if(void 0!==t)if(t)return this.add(e),!0;else return this.remove(e),!1;return this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){return this.remove(e),this.add(t),e===t}}p0=new WeakMap,p1=new WeakMap,p2=new WeakMap,p3=new WeakMap,p4=new WeakSet,p5=function(){return dx(this,p3).size?dx(this,p3):dx(this,p2)};let dN=(e="")=>{let[t,i,r]=e.split(":");return{kind:t="cc"===t?"captions":"subtitles",language:i,label:r?decodeURIComponent(r):void 0}},dU=(e="",t={})=>((e="")=>e.split(/\s+/))(e).map(e=>{let i=dN(e);return{...t,...i}}),dF=e=>e?Array.isArray(e)?e.map(e=>"string"==typeof e?dN(e):e):"string"==typeof e?dU(e):[e]:[],dB=({kind:e,label:t,language:i}={kind:"subtitles"})=>t?`${"captions"===e?"cc":"sb"}:${i}:${encodeURIComponent(t)}`:i,d$=(e=[])=>Array.prototype.map.call(e,dB).join(" "),dH=e=>{let t=Object.entries(e).map(([e,t])=>i=>i[e]===t);return e=>t.every(t=>t(e))},dW=(e,t=[],i=[])=>{let r=dF(i).map(dH);Array.from(t).filter(e=>r.some(t=>t(e))).forEach(t=>{t.mode=e})},dG=(e,t=()=>!0)=>{if(!(null==e?void 0:e.textTracks))return[];let i="function"==typeof t?t:dH(t);return Array.from(e.textTracks).filter(i)},dV=e=>{var t;return!!(null==(t=e.mediaSubtitlesShowing)?void 0:t.length)||e.hasAttribute(ly.MEDIA_SUBTITLES_SHOWING)},dK="exitFullscreen"in lQ?"exitFullscreen":"webkitExitFullscreen"in lQ?"webkitExitFullscreen":"webkitCancelFullScreen"in lQ?"webkitCancelFullScreen":void 0,dq="fullscreenElement"in lQ?"fullscreenElement":"webkitFullscreenElement"in lQ?"webkitFullscreenElement":void 0,dj="fullscreenEnabled"in lQ?"fullscreenEnabled":"webkitFullscreenEnabled"in lQ?"webkitFullscreenEnabled":void 0,dY=()=>{var e;return a||(a=null==(e=null==lQ?void 0:lQ.createElement)?void 0:e.call(lQ,"video"))},dz=async(e=dY())=>{if(!e)return!1;let t=e.volume;return e.volume=t/2+.1,await lB(0),e.volume!==t},dX=/.*Version\/.*Safari\/.*/.test(lX.navigator.userAgent),dQ=(e=dY())=>(!lX.matchMedia("(display-mode: standalone)").matches||!dX)&&"function"==typeof(null==e?void 0:e.requestPictureInPicture),dZ=(e=dY())=>(e=>{let{documentElement:t,media:i}=e;return!!(null==t?void 0:t[dj])||i&&"webkitSupportsFullscreen"in i})({documentElement:lQ,media:e}),dJ=dZ(),d0=dQ(),d1=!!lX.WebKitPlaybackTargetAvailabilityEvent,d2=!!lX.chrome,d3=e=>dG(e.media,e=>[lk.SUBTITLES,lk.CAPTIONS].includes(e.kind)).sort((e,t)=>e.kind>=t.kind?1:-1),d4=e=>dG(e.media,e=>e.mode===lS.SHOWING&&[lk.SUBTITLES,lk.CAPTIONS].includes(e.kind)),d5=(e,t)=>{let i=d3(e),r=d4(e),a=!!r.length;if(i.length){if(!1===t||a&&!0!==t)dW(lS.DISABLED,i,r);else if(!0===t||!a&&!1!==t){let t=i[0],{options:a}=e;if(!(null==a?void 0:a.noSubtitlesLangPref)){let e=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),r=e?[e,...globalThis.navigator.languages]:globalThis.navigator.languages,a=i.filter(e=>r.some(t=>e.language.toLowerCase().startsWith(t.split("-")[0]))).sort((e,t)=>r.findIndex(t=>e.language.toLowerCase().startsWith(t.split("-")[0]))-r.findIndex(e=>t.language.toLowerCase().startsWith(e.split("-")[0])));a[0]&&(t=a[0])}let{language:s,label:n,kind:o}=t;dW(lS.DISABLED,i,r),dW(lS.SHOWING,i,[{language:s,label:n,kind:o}])}}},d8=(e,t)=>e===t||typeof e==typeof t&&(!!("number"==typeof e&&Number.isNaN(e)&&Number.isNaN(t))||"object"==typeof e&&(Array.isArray(e)?d9(e,t):Object.entries(e).every(([e,i])=>e in t&&d8(i,t[e])))),d9=(e,t)=>{let i=Array.isArray(e),r=Array.isArray(t);return i===r&&(!i&&!r||e.length===t.length&&e.every((e,i)=>d8(e,t[i])))},d6=Object.values(lR),d7=dz().then(e=>s=e),he=async(...e)=>{await Promise.all(e.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof lX.HTMLElement))return;let t=e.localName;if(!t.includes("-"))return;let i=lX.customElements.get(t);i&&e instanceof i||(await lX.customElements.whenDefined(t),lX.customElements.upgrade(e))}))},ht={mediaPaused:{get(e){var t;let{media:i}=e;return null==(t=null==i?void 0:i.paused)||t},set(e,t){var i;let{media:r}=t;r&&(e?r.pause():null==(i=r.play())||i.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(e,t){let{media:i}=e;return!!i&&(t?"playing"===t.type:!i.paused)},mediaEvents:["playing","emptied"]},mediaEnded:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.ended)&&t},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.playbackRate)?t:1},set(e,t){let{media:i}=t;!i||Number.isFinite(+e)&&(i.playbackRate=+e)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.muted)&&t},set(e,t){let{media:i}=t;i&&(i.muted=e)},mediaEvents:["volumechange"]},mediaVolume:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.volume)?t:1},set(e,t){let{media:i}=t;if(i){try{null==e?lX.localStorage.removeItem("media-chrome-pref-volume"):lX.localStorage.setItem("media-chrome-pref-volume",e.toString())}catch(e){}Number.isFinite(+e)&&(i.volume=+e)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(e,t)=>{let{options:{noVolumePref:i}}=t;if(!i)try{let i=lX.localStorage.getItem("media-chrome-pref-volume");if(null==i)return;ht.mediaVolume.set(+i,t),e(i)}catch(e){console.debug("Error getting volume pref",e)}}]},mediaVolumeLevel:{get(e){let{media:t}=e;return void 0===(null==t?void 0:t.volume)?"high":t.muted||0===t.volume?"off":t.volume<.5?"low":t.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.currentTime)?t:0},set(e,t){let{media:i}=t;i&&0!==i.readyState&&(i.currentTime=e)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(e){let{media:t,options:{defaultDuration:i}={}}=e;return i&&(!t||!t.duration||Number.isNaN(t.duration)||!Number.isFinite(t.duration))?i:Number.isFinite(null==t?void 0:t.duration)?t.duration:NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(e){let{media:t}=e;return(null==t?void 0:t.readyState)<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(e){var t;let{media:i}=e;if(!(null==(t=null==i?void 0:i.seekable)?void 0:t.length))return;let r=i.seekable.start(0),a=i.seekable.end(i.seekable.length-1);if(r||a)return[Number(r.toFixed(3)),Number(a.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(e){var t;let{media:i}=e,r=null!=(t=null==i?void 0:i.buffered)?t:[];return Array.from(r).map((e,t)=>[Number(r.start(t).toFixed(3)),Number(r.end(t).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(e){let{media:t,options:{defaultStreamType:i}={}}=e,r=[lR.LIVE,lR.ON_DEMAND].includes(i)?i:void 0;if(!t)return r;let{streamType:a}=t;if(d6.includes(a))return a===lR.UNKNOWN?r:a;let s=t.duration;return s===1/0?lR.LIVE:Number.isFinite(s)?lR.ON_DEMAND:r}
161,mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(e){let{media:t}=e;if(!t)return NaN;let{targetLiveWindow:i}=t,r=ht.mediaStreamType.get(e);return(null==i||Number.isNaN(i))&&r===lR.LIVE?0:i},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(e){let{media:t,options:{liveEdgeOffset:i=10}={}}=e;if(!t)return!1;if("number"==typeof t.liveEdgeStart)return!Number.isNaN(t.liveEdgeStart)&&t.currentTime>=t.liveEdgeStart;if(ht.mediaStreamType.get(e)!==lR.LIVE)return!1;let r=t.seekable;if(!r)return!0;if(!r.length)return!1;let a=r.end(r.length-1)-i;return t.currentTime>=a},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get:e=>d3(e).map(({kind:e,label:t,language:i})=>({kind:e,label:t,language:i})),mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get:e=>d4(e).map(({kind:e,label:t,language:i})=>({kind:e,label:t,language:i})),mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(e,t)=>{var i,r;let{media:a,options:s}=t;if(!a)return;let n=e=>{var i;s.defaultSubtitles&&(e&&![lk.CAPTIONS,lk.SUBTITLES].includes(null==(i=null==e?void 0:e.track)?void 0:i.kind)||d5(t,!0))};return null==(i=a.textTracks)||i.addEventListener("addtrack",n),null==(r=a.textTracks)||r.addEventListener("removetrack",n),n(),()=>{var e,t;null==(e=a.textTracks)||e.removeEventListener("addtrack",n),null==(t=a.textTracks)||t.removeEventListener("removetrack",n)}}]},mediaChaptersCues:{get(e){var t;let{media:i}=e;if(!i)return[];let[r]=dG(i,{kind:lk.CHAPTERS});return Array.from(null!=(t=null==r?void 0:r.cues)?t:[]).map(({text:e,startTime:t,endTime:i})=>({text:e,startTime:t,endTime:i}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(e,t)=>{let{media:i}=t;if(!i)return;let r=i.querySelector('track[kind="chapters"][default][src]');return null==r||r.addEventListener("load",e),()=>{null==r||r.removeEventListener("load",e)}}]},mediaIsPip:{get(e){var t,i;let{media:r,documentElement:a}=e;if(!r||!a||!a.pictureInPictureElement)return!1;if(a.pictureInPictureElement===r)return!0;if(a.pictureInPictureElement instanceof HTMLMediaElement)return!!(null==(t=r.localName)?void 0:t.includes("-"))&&l9(r,a.pictureInPictureElement);if(a.pictureInPictureElement.localName.includes("-")){let e=a.pictureInPictureElement.shadowRoot;for(;null==e?void 0:e.pictureInPictureElement;){if(e.pictureInPictureElement===r)return!0;e=null==(i=e.pictureInPictureElement)?void 0:i.shadowRoot}}return!1},set(e,t){let{media:i}=t;if(i)if(e){if(!lQ.pictureInPictureEnabled)return void console.warn("MediaChrome: Picture-in-picture is not enabled");if(!i.requestPictureInPicture)return void console.warn("MediaChrome: The current media does not support picture-in-picture");let e=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};i.requestPictureInPicture().catch(t=>{if(11===t.code){if(!i.src)return void console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");if(0===i.readyState&&"none"===i.preload){let t=()=>{i.removeEventListener("loadedmetadata",r),i.preload="none"},r=()=>{i.requestPictureInPicture().catch(e),t()};i.addEventListener("loadedmetadata",r),i.preload="metadata",setTimeout(()=>{0===i.readyState&&e(),t()},1e3)}else throw t}else throw t})}else lQ.pictureInPictureElement&&lQ.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(e){var t;let{media:i}=e;return[...null!=(t=null==i?void 0:i.videoRenditions)?t:[]].map(e=>({...e}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(e){var t,i,r;let{media:a}=e;return null==(r=null==(i=null==a?void 0:a.videoRenditions)?void 0:i[null==(t=a.videoRenditions)?void 0:t.selectedIndex])?void 0:r.id},set(e,t){let{media:i}=t;if(!(null==i?void 0:i.videoRenditions))return void console.warn("MediaController: Rendition selection not supported by this media.");let r=Array.prototype.findIndex.call(i.videoRenditions,t=>t.id==e);i.videoRenditions.selectedIndex!=r&&(i.videoRenditions.selectedIndex=r)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(e){var t;let{media:i}=e;return[...null!=(t=null==i?void 0:i.audioTracks)?t:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(e){var t,i;let{media:r}=e;return null==(i=[...null!=(t=null==r?void 0:r.audioTracks)?t:[]].find(e=>e.enabled))?void 0:i.id},set(e,t){let{media:i}=t;if(!(null==i?void 0:i.audioTracks))return void console.warn("MediaChrome: Audio track selection not supported by this media.");
161for(let t of i.audioTracks)t.enabled=e==t.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get:e=>(e=>{var t;let{media:i,documentElement:r,fullscreenElement:a=i}=e;if(!i||!r)return!1;let s=(e=>{let{documentElement:t,media:i}=e,r=null==t?void 0:t[dq];return!r&&"webkitDisplayingFullscreen"in i&&"webkitPresentationMode"in i&&i.webkitDisplayingFullscreen&&i.webkitPresentationMode===lI.FULLSCREEN?i:r})(e);if(!s)return!1;if(s===a||s===i)return!0;if(s.localName.includes("-")){let e=s.shadowRoot;if(!(dq in e))return l9(s,a);for(;null==e?void 0:e[dq];){if(e[dq]===a)return!0;e=null==(t=e[dq])?void 0:t.shadowRoot}}return!1})(e),set(e,t){e?(e=>{var t;let{media:i,fullscreenElement:r}=e,a=r&&"requestFullscreen"in r?"requestFullscreen":r&&"webkitRequestFullScreen"in r?"webkitRequestFullScreen":void 0;if(a){let e=null==(t=r[a])?void 0:t.call(r);if(e instanceof Promise)return e.catch(()=>{})}else(null==i?void 0:i.webkitEnterFullscreen)?i.webkitEnterFullscreen():(null==i?void 0:i.requestFullscreen)&&i.requestFullscreen()})(t):(e=>{var t;let{documentElement:i}=e;if(dK){let e=null==(t=null==i?void 0:i[dK])?void 0:t.call(i);if(e instanceof Promise)return e.catch(()=>{})}})(t)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(e){var t;let{media:i}=e;return!!(null==i?void 0:i.remote)&&(null==(t=i.remote)?void 0:t.state)!=="disconnected"&&!!i.remote.state},set(e,t){var i,r;let{media:a}=t;if(a&&(!e||(null==(i=a.remote)?void 0:i.state)==="disconnected")&&(e||(null==(r=a.remote)?void 0:r.state)==="connected")){if("function"!=typeof a.remote.prompt)return void console.warn("MediaChrome: Casting is not supported in this environment");a.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get:()=>!1,set(e,t){let{media:i}=t;if(i){if(!(i.webkitShowPlaybackTargetPicker&&lX.WebKitPlaybackTargetAvailabilityEvent))return void console.warn("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");i.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(e){let{media:t}=e;if(!dJ||!dZ(t))return lL.UNSUPPORTED}},mediaPipUnavailable:{get(e){let{media:t}=e;if(!d0||!dQ(t))return lL.UNSUPPORTED}},mediaVolumeUnavailable:{get(e){let{media:t}=e;if(!1===s||(null==t?void 0:t.volume)==void 0)return lL.UNSUPPORTED},stateOwnersUpdateHandlers:[e=>{null==s&&d7.then(t=>e(t?void 0:lL.UNSUPPORTED))}]},mediaCastUnavailable:{get(e,{availability:t="not-available"}={}){var i;let{media:r}=e;return d2&&(null==(i=null==r?void 0:r.remote)?void 0:i.state)?null!=t&&"available"!==t?lL.UNAVAILABLE:void 0:lL.UNSUPPORTED},stateOwnersUpdateHandlers:[(e,t)=>{var i;let{media:r}=t;if(r)return r.disableRemotePlayback||r.hasAttribute("disableremoteplayback")||null==(i=null==r?void 0:r.remote)||i.watchAvailability(t=>{e({availability:t?"available":"not-available"})}).catch(t=>{"NotSupportedError"===t.name?e({availability:null}):e({availability:"not-available"})}),()=>{var e;null==(e=null==r?void 0:r.remote)||e.cancelWatchAvailability().catch(()=>{})}}]},mediaAirplayUnavailable:{get:(e,t)=>d1?(null==t?void 0:t.availability)==="not-available"?lL.UNAVAILABLE:void 0:lL.UNSUPPORTED,mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(e,t)=>{var i;let{media:r}=t;if(r)return r.disableRemotePlayback||r.hasAttribute("disableremoteplayback")||null==(i=null==r?void 0:r.remote)||i.watchAvailability(t=>{e({availability:t?"available":"not-available"})}).catch(t=>{"NotSupportedError"===t.name?e({availability:null}):e({availability:"not-available"})}),()=>{var e;null==(e=null==r?void 0:r.remote)||e.cancelWatchAvailability().catch(()=>{})}}]},mediaRenditionUnavailable:{get(e){var t;let{media:i}=e;return(null==i?void 0:i.videoRenditions)?(null==(t=i.videoRenditions)?void 0:t.length)?void 0:lL.UNAVAILABLE:lL.UNSUPPORTED},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(e){var t,i;let{media:r}=e;return(null==r?void 0:r.audioTracks)?(null!=(i=null==(t=r.audioTracks)?void 0:t.length)?i:0)<=1?lL.UNAVAILABLE:void 0:lL.UNSUPPORTED},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]}},hi={[lg.MEDIA_PREVIEW_REQUEST](e,t,{detail:i}){var r,a,s;let n,o,{media:l}=t,d=null!=i?i:void 0;if(l&&null!=d){let[e]=dG(l,{kind:lk.METADATA,label:"thumbnails"}),t=Array.prototype.find.call(null!=(r=null==e?void 0:e.cues)?r:[],
161(e,t,i)=>0===t?e.endTime>d:t===i.length-1?e.startTime<=d:e.startTime<=d&&e.endTime>d);if(t){let e=/'^(?:[a-z]+:)?\/\//i.test(t.text)||null==(a=null==l?void 0:l.querySelector('track[label="thumbnails"]'))?void 0:a.src,i=new URL(t.text,e);o=new URLSearchParams(i.hash).get("#xywh").split(",").map(e=>+e),n=i.href}}let h=e.mediaDuration.get(t),u=null==(s=e.mediaChaptersCues.get(t).find((e,t,i)=>t===i.length-1&&h===e.endTime?e.startTime<=d&&e.endTime>=d:e.startTime<=d&&e.endTime>d))?void 0:s.text;return null!=i&&null==u&&(u=""),{mediaPreviewTime:d,mediaPreviewImage:n,mediaPreviewCoords:o,mediaPreviewChapter:u}},[lg.MEDIA_PAUSE_REQUEST](e,t){e.mediaPaused.set(!0,t)},[lg.MEDIA_PLAY_REQUEST](e,t){var i;if(e.mediaStreamType.get(t)===lR.LIVE){let r=!(e.mediaTargetLiveWindow.get(t)>0),a=null==(i=e.mediaSeekable.get(t))?void 0:i[1];r&&a&&e.mediaCurrentTime.set(a,t)}e.mediaPaused.set(!1,t)},[lg.MEDIA_PLAYBACK_RATE_REQUEST](e,t,{detail:i}){e.mediaPlaybackRate.set(i,t)},[lg.MEDIA_MUTE_REQUEST](e,t){e.mediaMuted.set(!0,t)},[lg.MEDIA_UNMUTE_REQUEST](e,t){e.mediaVolume.get(t)||e.mediaVolume.set(.25,t),e.mediaMuted.set(!1,t)},[lg.MEDIA_VOLUME_REQUEST](e,t,{detail:i}){i&&e.mediaMuted.get(t)&&e.mediaMuted.set(!1,t),e.mediaVolume.set(i,t)},[lg.MEDIA_SEEK_REQUEST](e,t,{detail:i}){e.mediaCurrentTime.set(i,t)},[lg.MEDIA_SEEK_TO_LIVE_REQUEST](e,t){var i;let r=null==(i=e.mediaSeekable.get(t))?void 0:i[1];Number.isNaN(Number(r))&&e.mediaCurrentTime.set(r,t)},[lg.MEDIA_SHOW_SUBTITLES_REQUEST](e,t,{detail:i}){var r;let{options:a}=t,s=d3(t),n=dF(i),o=null==(r=n[0])?void 0:r.language;o&&!a.noSubtitlesLangPref&&lX.localStorage.setItem("media-chrome-pref-subtitles-lang",o),dW(lS.SHOWING,s,n)},[lg.MEDIA_DISABLE_SUBTITLES_REQUEST](e,t,{detail:i}){let r=d3(t);dW(lS.DISABLED,r,null!=i?i:[])},[lg.MEDIA_TOGGLE_SUBTITLES_REQUEST](e,t,{detail:i}){d5(t,i)},[lg.MEDIA_RENDITION_REQUEST](e,t,{detail:i}){e.mediaRenditionSelected.set(i,t)},[lg.MEDIA_AUDIO_TRACK_REQUEST](e,t,{detail:i}){e.mediaAudioTrackEnabled.set(i,t)},[lg.MEDIA_ENTER_PIP_REQUEST](e,t){e.mediaIsFullscreen.get(t)&&e.mediaIsFullscreen.set(!1,t),e.mediaIsPip.set(!0,t)},[lg.MEDIA_EXIT_PIP_REQUEST](e,t){e.mediaIsPip.set(!1,t)},[lg.MEDIA_ENTER_FULLSCREEN_REQUEST](e,t){e.mediaIsPip.get(t)&&e.mediaIsPip.set(!1,t),e.mediaIsFullscreen.set(!0,t)},[lg.MEDIA_EXIT_FULLSCREEN_REQUEST](e,t){e.mediaIsFullscreen.set(!1,t)},[lg.MEDIA_ENTER_CAST_REQUEST](e,t){e.mediaIsFullscreen.get(t)&&e.mediaIsFullscreen.set(!1,t),e.mediaIsCasting.set(!0,t)},[lg.MEDIA_EXIT_CAST_REQUEST](e,t){e.mediaIsCasting.set(!1,t)},[lg.MEDIA_AIRPLAY_REQUEST](e,t){e.mediaIsAirplaying.set(!0,t)}};var hr=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},ha=(e,t,i)=>(hr(e,t,"read from private field"),i?i.call(e):t.get(e)),hs=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},hn=(e,t,i,r)=>(hr(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),ho=(e,t,i)=>(hr(e,t,"access private method"),i);let hl=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],hd="defaultsubtitles",hh="defaultstreamtype",hu="defaultduration",hc="fullscreenelement",hm="hotkeys",hp="liveedgeoffset",hf="nohotkeys",hg="nodefaultstore",hv="keyboardforwardseekoffset",hE="keyboardbackwardseekoffset";class hb extends dC{constructor(){super(),hs(this,fi),hs(this,fa),hs(this,fn),hs(this,p8,new dP(this,hm)),hs(this,p9,void 0),hs(this,p6,void 0),hs(this,p7,void 0),hs(this,fe,void 0),hs(this,ft,e=>{var t;null==(t=ha(this,p6))||t.dispatch(e)}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associateElement(this);let e={};hn(this,p7,t=>{Object.entries(t).forEach(([t,i])=>{if(t in e&&e[t]===i)return;this.propagateMediaState(t,i);let r=t.toLowerCase(),a=new lX.CustomEvent(l_[r],{composed:!0,detail:i});this.dispatchEvent(a)}),e=t}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(hf,hm,hh,hd,hu)}get mediaStore(){return ha(this,p6)}set mediaStore(e){var t,i;(ha(this,p6)&&(null==(t=ha(this,fe))||t.call(this),hn(this,fe,void 0)),hn(this,p6,e),ha(this,p6)||this.hasAttribute(hg))?hn(this,fe,null==(i=ha(this,p6))?void 0:i.subscribe(ha(this,p7))):ho(this,fi,fr).call(this)}get fullscreenElement(){var e;return null!=(e=ha(this,p9))?e:this}set fullscreenElement(e){var t;this.hasAttribute(hc)&&this.removeAttribute(hc),hn(this,p9,e),null==(t=ha(this,p6))||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}attributeChangedCallback(e,t,i){var r,a,s,n,o,l;if(super.attributeChangedCallback(e,t,i),e===hf)i!==t&&""===i?(this.hasAttribute(hm)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):i!==t&&null===i&&this.enableHotkeys();else if(e===hm)ha(this,p8).value=i;else if(e===hd&&i!==t)null==(r=ha(this,p6))||r.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(hd)}});else if(e===hh)null==(s=ha(this,p6))||s.dispatch({type:"optionschangerequest",detail:{defaultStreamType:null!=(a=this.getAttribute(hh))?a:void 0}});else if(e===hp)null==(n=ha(this,p6))||n.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(hp)?+this.getAttribute(hp):void 0}});else if(e===hc){let e=i?null==(o=this.getRootNode())?void 0:o.getElementById(i):void 0;hn(this,p9,e),null==(l=ha(this,p6))||l.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}}connectedCallback(){var e,t;ha(this,p6)||this.hasAttribute(hg)||ho(this,fi,fr).call(this),null==(e=ha(this,p6))||e.dispatch({type:"documentelementchangerequest",detail:lQ}),super.connectedCallback(),ha(this,p6)&&!ha(this,fe)&&hn(this,fe,null==(t=ha(this,p6))?void 0:t.subscribe(ha(this,p7))),this.enableHotkeys()}disconnectedCallback(){var e,t,i,r;null==(e=super.disconnectedCallback)||e.call(this),ha(this,p6)&&(null==(t=ha(this,p6))||t.dispatch({type:"documentelementchangerequest",detail:void 0}),null==(i=ha(this,p6))||i.dispatch({type:lg.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})),ha(this,fe)&&(null==(r=ha(this,fe))||r.call(this),hn(this,fe,void 0))}mediaSetCallback(e){var t;super.mediaSetCallback(e),null==(t=ha(this,p6))||t.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var t;super.mediaUnsetCallback(e),null==(t=ha(this,p6))||t.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,t){hR(this.mediaStateReceivers,e,t)}associateElement(e){if(!e)return;let{associatedElementSubscriptions:t}=this;if(t.has(e))return;let i=hI(e,this.registerMediaStateReceiver.bind(this),this.unregisterMediaStateReceiver.bind(this));Object.values(lg).forEach(t=>{e.addEventListener(t,ha(this,ft))}),t.set(e,i)}unassociateElement(e){if(!e)return;let{associatedElementSubscriptions:t}=this;t.has(e)&&(t.get(e)(),t.delete(e),Object.values(lg).forEach(t=>{e.removeEventListener(t,ha(this,ft))}))}registerMediaStateReceiver(e){if(!e)return;let t=this.mediaStateReceivers;!(t.indexOf(e)>-1)&&(t.push(e),ha(this,p6)&&Object.entries(ha(this,p6).getState()).forEac
161h(([t,i])=>{hR([e],t,i)}))}unregisterMediaStateReceiver(e){let t=this.mediaStateReceivers,i=t.indexOf(e);i<0||t.splice(i,1)}enableHotkeys(){this.addEventListener("keydown",ho(this,fn,fo))}disableHotkeys(){this.removeEventListener("keydown",ho(this,fn,fo)),this.removeEventListener("keyup",ho(this,fa,fs))}get hotkeys(){return ha(this,p8)}keyboardShortcutHandler(e){var t,i,r,a,s,n;let o,l,d;if(!((null!=(a=null!=(r=null==(t=e.target.getAttribute("keysused"))?void 0:t.split(" "))?r:null==(i=e.target)?void 0:i.keysUsed)?a:[]).map(e=>"Space"===e?" ":e).filter(Boolean).includes(e.key)||ha(this,p8).contains(`no${e.key.toLowerCase()}`))&&!(" "===e.key&&ha(this,p8).contains("nospace")))switch(e.key){case" ":case"k":o=ha(this,p6).getState().mediaPaused?lg.MEDIA_PLAY_REQUEST:lg.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new lX.CustomEvent(o,{composed:!0,bubbles:!0}));break;case"m":o="off"===this.mediaStore.getState().mediaVolumeLevel?lg.MEDIA_UNMUTE_REQUEST:lg.MEDIA_MUTE_REQUEST,this.dispatchEvent(new lX.CustomEvent(o,{composed:!0,bubbles:!0}));break;case"f":o=this.mediaStore.getState().mediaIsFullscreen?lg.MEDIA_EXIT_FULLSCREEN_REQUEST:lg.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new lX.CustomEvent(o,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new lX.CustomEvent(lg.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":{let e=this.hasAttribute(hE)?+this.getAttribute(hE):10;l=Math.max((null!=(s=this.mediaStore.getState().mediaCurrentTime)?s:0)-e,0),d=new lX.CustomEvent(lg.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:l}),this.dispatchEvent(d);break}case"ArrowRight":{let e=this.hasAttribute(hv)?+this.getAttribute(hv):10;l=Math.max((null!=(n=this.mediaStore.getState().mediaCurrentTime)?n:0)+e,0),d=new lX.CustomEvent(lg.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:l}),this.dispatchEvent(d)}}}}p8=new WeakMap,p9=new WeakMap,p6=new WeakMap,p7=new WeakMap,fe=new WeakMap,ft=new WeakMap,fi=new WeakSet,fr=function(){var e;this.mediaStore=(({media:e,fullscreenElement:t,documentElement:i,stateMediator:r=ht,requestMap:a=hi,options:s={},monitorStateOwnersOnlyWithSubscriptions:n=!0})=>{let o,l=[],d={options:{...s}},h=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0}),u=e=>{void 0==e||d8(e,h)||(h=Object.freeze({...h,...e}),l.forEach(e=>e(h)))},c=()=>{u(Object.entries(r).reduce((e,[t,{get:i}])=>(e[t]=i(d),e),{}))},m={},p=async(e,t)=>{var i,a,s,h,p,f,g,v,E,b,y,T,A,_,k,S;let w=!!o;if(o={...d,...null!=o?o:{},...e},w)return;await he(...Object.values(e));let L=l.length>0&&0===t&&n,R=d.media!==o.media,I=(null==(i=d.media)?void 0:i.textTracks)!==(null==(a=o.media)?void 0:a.textTracks),C=(null==(s=d.media)?void 0:s.videoRenditions)!==(null==(h=o.media)?void 0:h.videoRenditions),D=(null==(p=d.media)?void 0:p.audioTracks)!==(null==(f=o.media)?void 0:f.audioTracks),x=(null==(g=d.media)?void 0:g.remote)!==(null==(v=o.media)?void 0:v.remote),M=d.documentElement!==o.documentElement,O=!!d.media&&(R||L),P=!!(null==(E=d.media)?void 0:E.textTracks)&&(I||L),N=!!(null==(b=d.media)?void 0:b.videoRenditions)&&(C||L),U=!!(null==(y=d.media)?void 0:y.audioTracks)&&(D||L),F=!!(null==(T=d.media)?void 0:T.remote)&&(x||L),B=!!d.documentElement&&(M||L),$=O||P||N||U||F||B,H=0===l.length&&1===t&&n,W=!!o.media&&(R||H),G=!!(null==(A=o.media)?void 0:A.textTracks)&&(I||H),V=!!(null==(_=o.media)?void 0:_.videoRenditions)&&(C||H),K=!!(null==(k=o.media)?void 0:k.audioTracks)&&(D||H),q=!!(null==(S=o.media)?void 0:S.remote)&&(x||H),j=!!o.documentElement&&(M||H),Y=W||G||V||K||q||j;if(!($||Y)){Object.entries(o).forEach(([e,t])=>{d[e]=t}),c(),o=void 0;return}Object.entries(r).forEach(([e,{get:t,mediaEvents:i=[],textTracksEvents:r=[],videoRenditionsEvents:a=[],audioTracksEvents:s=[],remoteEvents:n=[],rootEvents:l=[],stateOwnersUpdateHandlers:h=[]}])=>{let c;m[e]||(m[e]={});let p=i=>{u({[e]:t(d,i)})};c=m[e].mediaEvents,i.forEach(t=>{c&&O&&(d.media.removeEventListener(t,c),m[e].mediaEvents=void 0),W&&(o.media.addEventListener(t,p),m[e].mediaEvents=p)}),c=m[e].textTracksEvents,r.forEach(t=>{var i,r;c&&P&&(null==(i=d.media.textTracks)||i.removeEventListener(t,c),m[e].textTracksEvents=void 0),G&&(null==(r=o.media.textTracks)||r.addEventListener(t,p),m[e].textTracksEvents=p)}),c=m[e].videoRenditionsEvents,a.forEach(t=>{var i,r;c&&N&&(null==(i=d.media.videoRenditions)||i.removeEventListener(t,c),m[e].videoRenditionsEvents=void 0),V&&(null==(r=o.media.videoRenditions)||r.addEventListener(t,p),m[e].videoRenditionsEvents=p)}
161),c=m[e].audioTracksEvents,s.forEach(t=>{var i,r;c&&U&&(null==(i=d.media.audioTracks)||i.removeEventListener(t,c),m[e].audioTracksEvents=void 0),K&&(null==(r=o.media.audioTracks)||r.addEventListener(t,p),m[e].audioTracksEvents=p)}),c=m[e].remoteEvents,n.forEach(t=>{var i,r;c&&F&&(null==(i=d.media.remote)||i.removeEventListener(t,c),m[e].remoteEvents=void 0),q&&(null==(r=o.media.remote)||r.addEventListener(t,p),m[e].remoteEvents=p)}),c=m[e].rootEvents,l.forEach(t=>{c&&B&&(d.documentElement.removeEventListener(t,c),m[e].rootEvents=void 0),j&&(o.documentElement.addEventListener(t,p),m[e].rootEvents=p)});let f=m[e].stateOwnersUpdateHandlers;h.forEach(t=>{f&&$&&f(),Y&&(m[e].stateOwnersUpdateHandlers=t(p,o))})}),Object.entries(o).forEach(([e,t])=>{d[e]=t}),c(),o=void 0};return p({media:e,fullscreenElement:t,documentElement:i,options:s}),{dispatch(e){let{type:t,detail:i}=e;a[t]?u(a[t](r,d,e)):"mediaelementchangerequest"===t?p({media:i}):"fullscreenelementchangerequest"===t?p({fullscreenElement:i}):"documentelementchangerequest"===t?p({documentElement:i}):"optionschangerequest"===t&&Object.entries(null!=i?i:{}).forEach(([e,t])=>{d.options[e]=t})},getState:()=>h,subscribe:e=>(p({},l.length+1),l.push(e),e(h),()=>{let t=l.indexOf(e);t>=0&&(p({},l.length-1),l.splice(t,1))})}})({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(hd),defaultDuration:this.hasAttribute(hu)?+this.getAttribute(hu):void 0,defaultStreamType:null!=(e=this.getAttribute(hh))?e:void 0,liveEdgeOffset:this.hasAttribute(hp)?+this.getAttribute(hp):void 0,noVolumePref:this.hasAttribute("novolumepref"),noSubtitlesLangPref:this.hasAttribute("nosubtitleslangpref")}})},fa=new WeakSet,fs=function(e){let{key:t}=e;hl.includes(t)?this.keyboardShortcutHandler(e):this.removeEventListener("keyup",ho(this,fa,fs))},fn=new WeakSet,fo=function(e){let{metaKey:t,altKey:i,key:r}=e;t||i||!hl.includes(r)?this.removeEventListener("keyup",ho(this,fa,fs)):([" ","ArrowLeft","ArrowRight"].includes(r)&&!(ha(this,p8).contains(`no${r.toLowerCase()}`)||" "===r&&ha(this,p8).contains("nospace"))&&e.preventDefault(),this.addEventListener("keyup",ho(this,fa,fs),{once:!0}))};let hy=Object.values(ly),hT=Object.values(lE),hA=e=>{var t,i,r,a;let{observedAttributes:s}=e.constructor;!s&&(null==(t=e.nodeName)?void 0:t.includes("-"))&&(lX.customElements.upgrade(e),{observedAttributes:s}=e.constructor);let n=null==(a=null==(r=null==(i=null==e?void 0:e.getAttribute)?void 0:i.call(e,lv.MEDIA_CHROME_ATTRIBUTES))?void 0:r.split)?void 0:a.call(r,/\s+/);return Array.isArray(s||n)?(s||n).filter(e=>hy.includes(e)):[]},h_=e=>{var t,i;return(null==(t=e.nodeName)?void 0:t.includes("-"))&&lX.customElements.get(null==(i=e.nodeName)?void 0:i.toLowerCase())&&!(e instanceof lX.customElements.get(e.nodeName.toLowerCase()))&&lX.customElements.upgrade(e),hT.some(t=>t in e)||!!hA(e).length},hk=e=>{var t;return null==(t=null==e?void 0:e.join)?void 0:t.call(e,":")},hS={[ly.MEDIA_SUBTITLES_LIST]:d$,[ly.MEDIA_SUBTITLES_SHOWING]:d$,[ly.MEDIA_SEEKABLE]:hk,[ly.MEDIA_BUFFERED]:e=>null==e?void 0:e.map(hk).join(" "),[ly.MEDIA_PREVIEW_COORDS]:e=>null==e?void 0:e.join(" "),[ly.MEDIA_RENDITION_LIST]:function(e){return null==e?void 0:e.map(lM).join(" ")},[ly.MEDIA_AUDIO_TRACK_LIST]:function(e){return null==e?void 0:e.map(lN).join(" ")}},hw=async(e,t,i)=>{var r,a;if(e.isConnected||await lB(0),"boolean"==typeof i||null==i)return dl(e,t,i);if("number"==typeof i)return ds(e,t,i);if("string"==typeof i)return dh(e,t,i);if(Array.isArray(i)&&!i.length)return e.removeAttribute(t);let s=null!=(a=null==(r=hS[t])?void 0:r.call(hS,i))?a:i;return e.setAttribute(t,s)},hL=(e,t)=>{var i;if(null==(i=e.closest)?void 0:i.call(e,'*[slot="media"]'))return;let r=(e,t)=>{var i,r;h_(e)&&t(e);let{children:a=[]}=null!=e?e:{};[...a,...null!=(r=null==(i=null==e?void 0:e.shadowRoot)?void 0:i.children)?r:[]].forEach(e=>hL(e,t))},a=null==e?void 0:e.nodeName.toLowerCase();a.includes("-")&&!h_(e)?lX.customElements.whenDefined(a).then(()=>{r(e,t)}):r(e,t)},hR=(e,t,i)=>{e.forEach(e=>{if(t in e){e[t]=i;return}let r=hA(e),a=t.toLowerCase();r.includes(a)&&hw(e,a,i)})},hI=(e,t,i)=>{hL(e,t);let r=e=>{var i;t(null!=(i=null==e?void 0:e.composedPath()[0])?i:e.target)},a=e=>{var t;i(null!=(t=null==e?void 0:e.composedPath()[0])?t:e.target)};e.addEventListener(lg.REGISTER_MEDIA_STATE_RECEIVER,r),e.addEventListener(lg.UNREGISTER_MEDIA_STATE_RECEIVER,a);let s=[],n=e=>{let r=e.target;
161"media"!==r.name&&(s.forEach(e=>hL(e,i)),(s=[...r.assignedElements({flatten:!0})]).forEach(e=>hL(e,t)))};e.addEventListener("slotchange",n);let o=new MutationObserver(e=>{e.forEach(e=>{let{addedNodes:r=[],removedNodes:a=[],type:s,target:n,attributeName:o}=e;"childList"===s?(Array.prototype.forEach.call(r,e=>hL(e,t)),Array.prototype.forEach.call(a,e=>hL(e,i))):"attributes"===s&&o===lv.MEDIA_CHROME_ATTRIBUTES&&(h_(n)?t(n):i(n))})});return o.observe(e,{childList:!0,attributes:!0,subtree:!0}),()=>{hL(e,i),e.removeEventListener("slotchange",n),o.disconnect(),e.removeEventListener(lg.REGISTER_MEDIA_STATE_RECEIVER,r),e.removeEventListener(lg.UNREGISTER_MEDIA_STATE_RECEIVER,a)}};lX.customElements.get("media-controller")||lX.customElements.define("media-controller",hb);var hC=Object.defineProperty,hD=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},hx=(e,t,i)=>(hD(e,t,"read from private field"),i?i.call(e):t.get(e)),hM=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},hO=(e,t,i,r)=>(hD(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let hP=lQ.createElement("template");hP.innerHTML=` 162<style> 163 :host { 164 font: var(--media-font, 165 var(--media-font-weight, bold) 166 var(--media-font-size, 14px) / 167 var(--media-text-content-height, var(--media-control-height, 24px)) 168 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 169 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 170 background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 171 padding: var(--media-button-padding, var(--media-control-padding, 10px)); 172 justify-content: var(--media-button-justify-content, center); 173 display: inline-flex; 174 align-items: center; 175 vertical-align: middle; 176 box-sizing: border-box; 177 transition: background .15s linear; 178 pointer-events: auto; 179 cursor: pointer; 180 -webkit-tap-highlight-color: transparent; 181 } 182 183 184 :host(:focus-visible) { 185 box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9); 186 outline: 0; 187 } 188 189 :host(:where(:focus)) { 190 box-shadow: none; 191 outline: 0; 192 } 193 194 :host(:hover) { 195 background: var(--media-control-hover-background, rgba(50 50 70 / .7)); 196 } 197 198 svg, img, ::slotted(svg), ::slotted(img) { 199 width: var(--media-button-icon-width); 200 height: var(--media-button-icon-height, var(--media-control-height, 24px)); 201 transform: var(--media-button-icon-transform); 202 transition: var(--media-button-icon-transition); 203 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 204 vertical-align: middle; 205 max-width: 100%; 206 max-height: 100%; 207 min-width: 100%; 208 } 209</style> 210`;class hN extends lX.HTMLElement{constructor(e={}){if(super(),hM(this,fl,void 0),((e,t,i)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?hC(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i})(this,"preventClick",!1),hM(this,fd,e=>{this.preventClick||this.handleClick(e)}),hM(this,fh,e=>{let{key:t}=e;this.keysUsed.includes(t)?this.preventClick||this.handleClick(e):this.removeEventListener("keyup",hx(this,fh))}),hM(this,fu,e=>{let{metaKey:t,altKey:i,key:r}=e;t||i||!this.keysUsed.includes(r)?this.removeEventListener("keyup",hx(this,fh)):this.addEventListener("keyup",hx(this,fh),{once:!0})}),!this.shadowRoot){this.attachShadow({mode:"open"});const t=hP.content.cloneNode(!0);this.nativeEl=t;let i=e.slotTemplate;i||((i=lQ.createElement("template")).innerHTML=`<slot>${e.defaultContent||""}</slot>`),this.nativeEl.appendChild(i.content.cloneNode(!0)),this.shadowRoot.appendChild(t)}}static get observedAttributes(){return["disabled",lv.MEDIA_CONTROLLER]}enable(){this.addEventListener("click",hx(this,fd)),this.addEventListener("keydown",hx(this,fu)),this.tabIndex=0}disable(){this.removeEventListener("click",hx(this,fd)),this.removeEventListener("keydown",hx(this,fu)),this.removeEventListener("keyup",hx(this,fh)),this.tabIndex=-1}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===lv.MEDIA_CONTROLLER?(t&&(null==(a=null==(r=hx(this,fl))?void 0:r.unassociateElement)||a.call(r,this),hO(this,fl,null)),i&&this.isConnected&&(hO(this,fl,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=hx(this,fl))?void 0:n.associateElement)||o.call(n,this))):"disabled"===e&&i!==t&&(null==i?this.enable():this.disable())}connectedCallback(){var e,t,i;let{style:r}=di(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","button");let a=this.getAttribute(lv.MEDIA_CONTROLLER);a&&(hO(this,fl,null==(e=this.getRootNode())?void 0:e.getElementById(a)),null==(i=null==(t=hx(this,fl))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;this.disable(),null==(t=null==(e=hx(this,fl))?void 0:e.unassociateElement)||t.call(e,this),hO(this,fl,null)}get keysUsed(){return["Enter"," "]}handleClick(e){}}fl=new WeakMap,fd=new WeakMap,fh=new WeakMap,fu=new WeakMap,lX.customElements.get("media-chrome-button")||lX.customElements.define("media-chrome-button",hN);let hU=`<svg aria-hidden="true" viewBox="0 0 26 24"> 211 <path d="M22.13 3H3.87a.87.87 0 0 0-.87.87v13.26a.87.87 0 0 0 .87.87h3.4L9 16H5V5h16v11h-4l1.72 2h3.4a.87.87 0 0 0 .87-.87V3.87a.87.87 0 0 0-.86-.87Zm-8.75 11.44a.5.5 0 0 0-.76 0l-4.91 5.73a.5.5 0 0 0 .38.83h9.82a.501.501 0 0 0 .38-.83l-4.91-5.73Z"/> 212</svg> 213`,hF=lQ.createElement("template");hF.innerHTML=` 214 <style> 215 :host([${ly.MEDIA_IS_AIRPLAYING}]) slot:not([name=exit]):not([name=icon]) { 216 display: none !important; 217 } 218 219 220 :host(:not([${ly.MEDIA_IS_AIRPLAYING}])) slot:not([name=enter]):not([name=icon]) { 221 display: none !important; 222 } 223 </style> 224 225 <slot name="icon"> 226 <slot name="enter">${hU}</slot> 227 <slot name="exit">${hU}</slot> 228 </slot> 229`;let hB=e=>{let t=e.mediaIsAirplaying?lD.EXIT_AIRPLAY():lD.ENTER_AIRPLAY();e.setAttribute("aria-label",t)};function h$(e){return e.split("-")[0]}lX.customElements.get("media-airplay-button")||lX.customElements.define("media-airplay-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_IS_AIRPLAYING,ly.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(e={}){super({slotTemplate:hF,...e})}connectedCallback(){super.connectedCallback(),hB(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_IS_AIRPLAYING&&hB(this)}get mediaIsAirplaying(){return dn(this,ly.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){dl(this,ly.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return dd(this,ly.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){dh(this,ly.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){let e=new lX.CustomEvent(lg.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}});var hH=Object.defineProperty,hW=(e,t,i)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?hH(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i,i};
229class hG extends Event{constructor({action:e="auto",relatedTarget:t,...i}){super("invoke",i),hW(this,"action"),hW(this,"relatedTarget"),this.action=e,this.relatedTarget=t}}class hV extends Event{constructor({newState:e,oldState:t,...i}){super("toggle",i),hW(this,"newState"),hW(this,"oldState"),this.newState=e,this.oldState=t}}var hK=Object.defineProperty,hq=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},hj=(e,t,i)=>(hq(e,t,"read from private field"),i?i.call(e):t.get(e)),hY=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},hz=(e,t,i,r)=>(hq(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),hX=(e,t,i)=>(hq(e,t,"access private method"),i);function hQ({type:e,text:t,value:i,checked:r}){let a=lQ.createElement("media-chrome-menu-item");a.type=null!=e?e:"",a.part.add("menu-item"),e&&a.part.add(e),a.value=i,a.checked=r;let s=lQ.createElement("span");return s.textContent=t,a.append(s),a}function hZ(e,t){let i=e.querySelector(`:scope > [slot="${t}"]`);if((null==i?void 0:i.nodeName)=="SLOT"&&(i=i.assignedElements({flatten:!0})[0]),i)return i.cloneNode(!0);let r=e.shadowRoot.querySelector(`[name="${t}"] > svg`);return r?r.cloneNode(!0):""}let hJ=lQ.createElement("template");hJ.innerHTML=` 230 <style> 231 :host { 232 font: var(--media-font, 233 var(--media-font-weight, normal) 234 var(--media-font-size, 14px) / 235 var(--media-text-content-height, var(--media-control-height, 24px)) 236 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 237 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 238 background: var(--media-menu-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .8)))); 239 border-radius: var(--media-menu-border-radius); 240 border: var(--media-menu-border, none); 241 display: var(--media-menu-display, inline-flex); 242 transition: var(--media-menu-transition-in, 243 visibility 0s, 244 opacity .2s ease-out, 245 transform .15s ease-out, 246 left .2s ease-in-out, 247 min-width .2s ease-in-out, 248 min-height .2s ease-in-out 249 ) !important; 250 251 visibility: var(--media-menu-visibility, visible); 252 opacity: var(--media-menu-opacity, 1); 253 max-height: var(--media-menu-max-height, var(--_menu-max-height, 300px)); 254 transform: var(--media-menu-transform-in, translateY(0) scale(1)); 255 flex-direction: column; 256 257 min-height: 0; 258 position: relative; 259 box-sizing: border-box; 260 } 261 262 :host([hidden]) { 263 transition: var(--media-menu-transition-out, 264 visibility .15s ease-in, 265 opacity .15s ease-in, 266 transform .15s ease-in 267 ) !important; 268 visibility: var(--media-menu-hidden-visibility, hidden); 269 opacity: var(--media-menu-hidden-opacity, 0); 270 max-height: var(--media-menu-hidden-max-height, 271 var(--media-menu-max-height, var(--_menu-max-height, 300px))); 272 transform: var(--media-menu-transform-out, translateY(2px) scale(.99)); 273 pointer-events: none; 274 } 275 276 :host([slot="submenu"]) { 277 background: none; 278 width: 100%; 279 min-height: 100%; 280 position: absolute; 281 bottom: 0; 282 right: -100%; 283 } 284 285 #container { 286 display: flex; 287 flex-direction: column; 288 min-height: 0; 289 transition: transform .2s ease-out; 290 transform: translate(0, 0); 291 } 292 293 #container.has-expanded { 294 transition: transform .2s ease-in; 295 transform: translate(-100%, 0); 296 } 297 298 slot[name="header"] { 299 display: flex; 300 padding: .4em .7em; 301 border-bottom: 1px solid rgb(255 255 255 / .25); 302 cursor: default; 303 } 304 305 slot[name="header"][hidden] { 306 display: none; 307 } 308 309 button[part~="back"] { 310 background: none; 311 color: inherit; 312 border: none; 313 padding: 0; 314 font: inherit; 315 cursor: pointer; 316 outline: inherit; 317 display: inline-flex; 318 align-items: center; 319 cursor: pointer; 320 } 321 322 svg[part~="back"] { 323 height: var(--media-menu-icon-height, var(--media-control-height, 24px)); 324 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 325 display: block; 326 margin-right: .5ch; 327 } 328 329 slot:not([name]) { 330 gap: var(--media-menu-gap); 331 flex-direction: var(--media-menu-flex-direction, column); 332 overflow: var(--media-menu-overflow, hidden auto); 333 display: flex; 334 min-height: 0; 335 } 336 337 :host([role="menu"]) slot:not([name]) { 338 padding-block: .4em; 339 } 340 341 slot:not([name])::slotted([role="menu"]) { 342 background: none; 343 } 344 345 media-chrome-menu-item > span { 346 margin-right: .5ch; 347 max-width: var(--media-menu-item-max-width); 348 text-overflow: ellipsis; 349 overflow: hidden; 350 } 351 </style> 352 <style id="layout-row" media="width:0"> 353 354 slot[name="header"] { 355 padding: .4em .5em; 356 } 357 358 slot:not([name]) { 359 gap: var(--media-menu-gap, .25em); 360 flex-direction: var(--media-menu-flex-direction, row); 361 padding-inline: .5em; 362 } 363 364 media-chrome-menu-item { 365 padding: .3em .5em; 366 } 367 368 media-chrome-menu-item[aria-checked="true"] { 369 background: var(--media-menu-item-checked-background, rgb(255 255 255 / .2)); 370 } 371 372 373 media-chrome-menu-item::part(checked-indicator) { 374 display: var(--media-menu-item-checked-indicator-display, none); 375 } 376 </style> 377 <div id="container"> 378 <slot name="header" hidden> 379 <button part="back button" aria-label="Back to previous menu"> 380 <slot name="back-icon"> 381 <svg aria-hidden="true" viewBox="0 0 20 24" part="back indicator"> 382 <path d="m11.88 17.585.742-.669-4.2-4.665 4.2-4.666-.743-.669-4.803 5.335 4.803 5.334Z"/> 383 </svg> 384 </slot> 385 <slot name="title"></slot> 386 </button> 387 </slot> 388 <slot></slot> 389 </div> 390 <slot name="checked-indicator" hidden></slot> 391`;let h0="style",h1="hidden",h2="disabled";class h3 extends lX.HTMLElement{constructor(){super(),hY(this,fy),hY(this,f_),hY(this,fS),hY(this,fL),hY(this,fI),hY(this,fM),hY(this,fP),hY(this,fU),hY(this,fB),hY(this,fH),hY(this,fG),hY(this,fK),hY(this,fj),hY(this,fz),hY(this,fQ),hY(this,fJ),hY(this,f1),hY(this,fc,void 0),hY(this,fm,void 0),hY(this,fp,void 0),hY(this,ff,""),hY(this,fg,null),hY(this,fv,new Set),hY(this,fE,void 0),hY(this,fb,!1),hY(this,fA,()=>{let e=hj(this,fv),t=new Set(this.items);for(let i of e)t.has(i)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:i}));for(let i of t)e.has(i)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:i}));hz(this,fv,t)}),hY(this,fD,()=>{hX(this,fM,fO).call(this,!1),hX(this,fP,fN).call(this,!1)}),hY(this,fx,()=>{hX(this,fM,fO).call(this,!1)}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.nativeEl=this.constructor.template.content.cloneNode(!0),this.shadowRoot.append(this.nativeEl)),this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),hz(this,fE,new MutationObserver(hj(this,fA))),hj(this,fE).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[h2,h1,h0,"anchor",lv.MEDIA_CONTROLLER]}static formatMenuItemText(e){return e}enable(){this.addEventListener("click",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this),this.addEventListener("invoke",this),this.addEventListener("toggle",this)}disable(){this.removeEventListener("click",this),this.removeEventListener("focusout",this),this.removeEventListener("keyup",this),this.removeEventListener("invoke",this),this.removeEventListener("toggle",this)}handleEvent(e){switch(e.type){case"slotchange":hX(this,fy,fT).call(this,e);break;
391case"invoke":hX(this,fS,fw).call(this,e);break;case"click":hX(this,fU,fF).call(this,e);break;case"toggle":hX(this,fH,fW).call(this,e);break;case"focusout":hX(this,fK,fq).call(this,e);break;case"keydown":hX(this,fj,fY).call(this,e)}}connectedCallback(){var e,t;hX(this,f_,fk).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),hz(this,fc,l4(this)),null==(t=null==(e=hj(this,fc))?void 0:e.associateElement)||t.call(e,this),this.hidden||(l1(h5(this),hj(this,fD)),l1(this,hj(this,fx)))}disconnectedCallback(){var e,t;l2(h5(this),hj(this,fD)),l2(this,hj(this,fx)),this.disable(),null==(t=null==(e=hj(this,fc))?void 0:e.unassociateElement)||t.call(e,this),hz(this,fc,null)}attributeChangedCallback(e,t,i){var r,a,s,n;e===h1&&i!==t?(hj(this,fb)||hz(this,fb,!0),this.hidden?hX(this,fI,fC).call(this):hX(this,fL,fR).call(this),this.dispatchEvent(new hV({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===lv.MEDIA_CONTROLLER?(t&&(null==(a=null==(r=hj(this,fc))?void 0:r.unassociateElement)||a.call(r,this),hz(this,fc,null)),i&&this.isConnected&&(hz(this,fc,l4(this)),null==(n=null==(s=hj(this,fc))?void 0:s.associateElement)||n.call(s,this))):e===h2&&i!==t?null==i?this.enable():this.disable():e===h0&&i!==t&&hX(this,f_,fk).call(this)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?null==(e=de(this))?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(h4)}get radioGroupItems(){return this.items.filter(e=>"menuitemradio"===e.role)}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,t;return null!=(t=null==(e=this.checkedItems[0])?void 0:e.value)?t:""}set value(e){let t=this.items.find(t=>t.value===e);t&&hX(this,f1,f2).call(this,t)}focus(){if(hz(this,fm,l7()),this.items.length){hX(this,fJ,f0).call(this,this.items[0]),this.items[0].focus();return}let e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');null==e||e.focus()}handleSelect(e){var t;let i=hX(this,fz,fX).call(this,e);i&&(hX(this,f1,f2).call(this,i,"checkbox"===i.type),hj(this,fp)&&!this.hidden&&(null==(t=hj(this,fm))||t.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var t,i;let{key:r}=e,a=this.items,s=null!=(i=null!=(t=hX(this,fz,fX).call(this,e))?t:hX(this,fQ,fZ).call(this))?i:a[0],n=Math.max(0,a.indexOf(s));"ArrowDown"===r?n++:"ArrowUp"===r?n--:"Home"===e.key?n=0:"End"===e.key&&(n=a.length-1),n<0&&(n=a.length-1),n>a.length-1&&(n=0),hX(this,fJ,f0).call(this,a[n]),a[n].focus()}}function h4(e){return["menuitem","menuitemradio","menuitemcheckbox"].includes(null==e?void 0:e.role)}function h5(e){var t;return null!=(t=e.getAttribute("bounds")?l6(e,`#${e.getAttribute("bounds")}`):l3(e)||e.parentElement)?t:e}fc=new WeakMap,fm=new WeakMap,fp=new WeakMap,ff=new WeakMap,fg=new WeakMap,fv=new WeakMap,fE=new WeakMap,fb=new WeakMap,fy=new WeakSet,fT=function(e){let t=e.target;for(let e of t.assignedNodes({flatten:!0}))3===e.nodeType&&""===e.textContent.trim()&&e.remove();["header","title"].includes(t.name)&&(this.shadowRoot.querySelector('slot[name="header"]').hidden=0===t.assignedNodes().length),t.name||hj(this,fA).call(this)},fA=new WeakMap,f_=new WeakSet,fk=function(){var e;let t=this.shadowRoot.querySelector("#layout-row"),i=null==(e=getComputedStyle(this).getPropertyValue("--media-menu-layout"))?void 0:e.trim();t.setAttribute("media","row"===i?"":"width:0")},fS=new WeakSet,fw=function(e){hz(this,fp,e.relatedTarget),l9(this,e.relatedTarget)||(this.hidden=!this.hidden)},fL=new WeakSet,fR=function(){var e;null==(e=hj(this,fp))||e.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>hX(this,fM,fO).call(this,!1)),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),l1(h5(this),hj(this,fD)),l1(this,hj(this,fx))},fI=new WeakSet,fC=function(){var e;
391null==(e=hj(this,fp))||e.setAttribute("aria-expanded","false"),l2(h5(this),hj(this,fD)),l2(this,hj(this,fx))},fD=new WeakMap,fx=new WeakMap,fM=new WeakSet,fO=function(e,t){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:i,y:r}=function({anchor:e,floating:t,placement:i}){let{x:r,y:a}=function({anchor:e,floating:t},i){let r,a="x"==(["top","bottom"].includes(h$(i))?"y":"x")?"y":"x",s="y"===a?"height":"width",n=h$(i),o=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,d=e[s]/2-t[s]/2;switch(n){case"top":r={x:o,y:e.y-t.height};break;case"bottom":r={x:o,y:e.y+e.height};break;case"right":r={x:e.x+e.width,y:l};break;case"left":r={x:e.x-t.width,y:l};break;default:r={x:e.x,y:e.y}}switch(i.split("-")[1]){case"start":r[a]-=d;break;case"end":r[a]+=d}return r}(function({anchor:e,floating:t}){var i,r;let a,s;return{anchor:(i=e,r=t.offsetParent,a=i.getBoundingClientRect(),s=r.getBoundingClientRect(),{x:a.x-s.x,y:a.y-s.y,width:a.width,height:a.height}),floating:{x:0,y:0,width:t.offsetWidth,height:t.offsetHeight}}}({anchor:e,floating:t}),i);return{x:r,y:a}}({anchor:this.anchorElement,floating:this,placement:"top-start"});null!=t||(t=this.offsetWidth);let a=h5(this).getBoundingClientRect(),s=this.anchorElement.getBoundingClientRect(),n=a.width-i-t,o=a.height-r-this.offsetHeight,l=a.height-s.height,{style:d}=di(this.shadowRoot,":host");e||d.setProperty("--media-menu-transition-in","none"),d.setProperty("position","absolute"),d.setProperty("right",`${Math.max(0,n)}px`),d.setProperty("bottom",`${o}px`),d.setProperty("--_menu-max-height",`${l}px`),d.removeProperty("--media-menu-transition-in")},fP=new WeakSet,fN=function(e){let t=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),i=null==t?void 0:t.querySelector('[role="menu"]'),{style:r}=di(this.shadowRoot,":host");if(e||r.setProperty("--media-menu-transition-in","none"),i){let r=i.offsetHeight,a=Math.max(i.offsetWidth,t.offsetWidth);this.style.setProperty("min-width",`${a}px`),this.style.setProperty("min-height",`${r}px`),hX(this,fM,fO).call(this,e,a)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),hX(this,fM,fO).call(this,e);r.removeProperty("--media-menu-transition-in")},fU=new WeakSet,fF=function(e){var t;if(e.stopPropagation(),e.composedPath().includes(hj(this,fB,f$))){null==(t=hj(this,fm))||t.focus(),this.hidden=!0;return}let i=hX(this,fz,fX).call(this,e);!i||i.hasAttribute("disabled")||(hX(this,fJ,f0).call(this,i),this.handleSelect(e))},fB=new WeakSet,f$=function(){var e;return null==(e=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))?void 0:e.find(e=>e.part.contains("back")&&e.part.contains("button"))},fH=new WeakSet,fW=function(e){if(e.target===this)return;hX(this,fG,fV).call(this);let t=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let i of t)i.invokeTargetElement!=e.target&&("open"!=e.newState||"true"!=i.getAttribute("aria-expanded")||i.invokeTargetElement.hidden||i.invokeTargetElement.dispatchEvent(new hG({relatedTarget:i})));for(let e of t)e.setAttribute("aria-expanded",`${!e.submenuElement.hidden}`);hX(this,fP,fN).call(this,!0)},fG=new WeakSet,fV=function(){let e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)},fK=new WeakSet,fq=function(e){var t;l9(this,e.relatedTarget)||(hj(this,fb)&&(null==(t=hj(this,fm))||t.focus()),hj(this,fp)&&hj(this,fp)!==e.relatedTarget&&!this.hidden&&(this.hidden=!0))},fj=new WeakSet,fY=function(e){var t,i,r,a,s;let{key:n,ctrlKey:o,altKey:l,metaKey:d}=e;if(!o&&!l&&!d&&this.keysUsed.includes(n))if(e.preventDefault(),e.stopPropagation(),"Tab"===n){if(hj(this,fb)){this.hidden=!0;return}e.shiftKey?null==(i=null==(t=this.previousElementSibling)?void 0:t.focus)||i.call(t):null==(a=null==(r=this.nextElementSibling)?void 0:r.focus)||a.call(r),this.blur()}else"Escape"===n?(null==(s=hj(this,fm))||s.focus(),hj(this,fb)&&(this.hidden=!0)):"Enter"===n||" "===n?this.handleSelect(e):this.handleMove(e)},fz=new WeakSet,fX=function(e){return e.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))},fQ=new WeakSet,fZ=function(){return this.items.find(e=>0===e.tabIndex)},fJ=new WeakSet,f0=function(e){for(let t of this.items)t.tabIndex=t===e?0:-1},f1=new WeakSet,f2=function(e,t){let i=[...this.checkedItems];
391"radio"===e.type&&this.radioGroupItems.forEach(e=>e.checked=!1),t?e.checked=!e.checked:e.checked=!0,this.checkedItems.some((e,t)=>e!=i[t])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},(n="symbol"!=typeof(pP="template")?pP+"":pP)in h3?hK(h3,n,{enumerable:!0,configurable:!0,writable:!0,value:hJ}):h3[n]=hJ,lX.customElements.get("media-chrome-menu")||lX.customElements.define("media-chrome-menu",h3);var h8=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},h9=(e,t,i)=>(h8(e,t,"read from private field"),i?i.call(e):t.get(e)),h6=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},h7=(e,t,i,r)=>(h8(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),ue=(e,t,i)=>(h8(e,t,"access private method"),i);f3=new WeakMap,f4=new WeakMap,f5=new WeakSet,f8=function(){if(h9(this,f4)===JSON.stringify(this.mediaAudioTrackList))return;h7(this,f4,JSON.stringify(this.mediaAudioTrackList));let e=this.mediaAudioTrackList;for(let t of(this.defaultSlot.textContent="",e)){let e=hQ({type:"radio",text:this.formatMenuItemText(t.label,t),value:`${t.id}`,checked:t.enabled});
391e.prepend(hZ(this,"checked-indicator")),this.defaultSlot.append(e)}},f9=new WeakSet,f6=function(){if(null==this.value)return;let e=new lX.CustomEvent(lg.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},lX.customElements.get("media-audio-track-menu")||lX.customElements.define("media-audio-track-menu",class extends h3{constructor(){super(...arguments),h6(this,f5),h6(this,f9),h6(this,f3,[]),h6(this,f4,void 0)}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_AUDIO_TRACK_LIST,ly.MEDIA_AUDIO_TRACK_ENABLED,ly.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_AUDIO_TRACK_ENABLED&&t!==i?this.value=i:e===ly.MEDIA_AUDIO_TRACK_LIST&&t!==i&&(h7(this,f3,lP(i)),ue(this,f5,f8).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",ue(this,f9,f6))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",ue(this,f9,f6))}get anchorElement(){return"auto"!==this.anchor?super.anchorElement:l3(this).querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return h9(this,f3)}set mediaAudioTrackList(e){h7(this,f3,e),ue(this,f5,f8).call(this)}get mediaAudioTrackEnabled(){return dd(this,ly.MEDIA_AUDIO_TRACK_ENABLED)}set mediaAudioTrackEnabled(e){dh(this,ly.MEDIA_AUDIO_TRACK_ENABLED,e)}});class ut extends hN{connectedCallback(){super.connectedCallback(),this.invokeTargetElement&&this.setAttribute("aria-haspopup","menu")}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?null==(e=de(this))?void 0:e.querySelector(`#${this.invokeTarget}`):null}handleClick(){this.invokeTargetElement.dispatchEvent(new hG({relatedTarget:this}))}}lX.customElements.get("media-chrome-menu-button")||lX.customElements.define("media-chrome-menu-button",ut);let ui=`<svg aria-hidden="true" viewBox="0 0 24 24"> 392 <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/> 393 <path d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"/> 394</svg>`,ur=lQ.createElement("template");ur.innerHTML=` 395 <slot name="icon">${ui}</slot> 396`,lX.customElements.get("media-audio-track-menu-button")||lX.customElements.define("media-audio-track-menu-button",class extends ut{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_AUDIO_TRACK_ENABLED,ly.MEDIA_AUDIO_TRACK_UNAVAILABLE]}constructor(){super({slotTemplate:ur})}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",lC.AUDIO_TRACKS())}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:l3(this).querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){return dd(this,ly.MEDIA_AUDIO_TRACK_ENABLED)}set mediaAudioTrackEnabled(e){dh(this,ly.MEDIA_AUDIO_TRACK_ENABLED,e)}});let ua=`<svg aria-hidden="true" viewBox="0 0 26 24"> 397 <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/> 398</svg>`,us=`<svg aria-hidden="true" viewBox="0 0 26 24"> 399 <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.8
3991 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/> 400</svg>`,un=lQ.createElement("template");un.innerHTML=` 401 <style> 402 :host([aria-checked="true"]) slot[name=off] { 403 display: none !important; 404 } 405 406 407 :host(:not([aria-checked="true"])) slot[name=on] { 408 display: none !important; 409 } 410 </style> 411 412 <slot name="icon"> 413 <slot name="on">${ua}</slot> 414 <slot name="off">${us}</slot> 415 </slot> 416`;let uo=e=>{e.setAttribute("aria-checked",dV(e))},ul=(e,t)=>{let i=e.getAttribute(t);return i?dU(i):[]},ud=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);let r=d$(i);e.getAttribute(t)!==r&&e.setAttribute(t,r)};lX.customElements.get("media-captions-button")||lX.customElements.define("media-captions-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_SUBTITLES_LIST,ly.MEDIA_SUBTITLES_SHOWING]}constructor(e={}){super({slotTemplate:un,...e}),this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",lC.CLOSED_CAPTIONS()),uo(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_SUBTITLES_SHOWING&&uo(this)}get mediaSubtitlesList(){return ul(this,ly.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){ud(this,ly.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return ul(this,ly.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){ud(this,ly.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new lX.CustomEvent(lg.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}});var uh=Object.defineProperty,uu=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},uc=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},um=(e,t,i)=>(uu(e,t,"access private method"),i);let up=` 417 <svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator"> 418 <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/> 419 </svg>`,uf=lQ.createElement("template");uf.innerHTML=h3.template.innerHTML+` 420 <slot name="captions-indicator" hidden>${up}</slot>`;class ug extends h3{constructor(){super(...arguments),uc(this,ge),uc(this,gi),uc(this,f7,void 0)}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_SUBTITLES_LIST,ly.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_SUBTITLES_LIST&&t!==i?um(this,ge,gt).call(this):e===ly.MEDIA_SUBTITLES_SHOWING&&t!==i&&(this.value=i)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",um(this,gi,gr))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",um(this,gi,gr))}get anchorElement(){return"auto"!==this.anchor?super.anchorElement:l3(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return uv(this,ly.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){uE(this,ly.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return uv(this,ly.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){uE(this,ly.MEDIA_SUBTITLES_SHOWING,e)}}f7=new WeakMap,ge=new WeakSet,gt=function(){var e,t,i,r;if(uu(this,t=f7,"read from private field"),t.get(this)===JSON.stringify(this.mediaSubtitlesList))return;i=f7,r=JSON.stringify(this.mediaSubtitlesList),uu(this,i,"write to private field"),i.set(this,r),this.defaultSlot.textContent="";let a=!this.value,s=hQ({type:"radio",text:this.formatMenuItemText("Off"),value:"off",checked:a});for(let t of(s.prepend(hZ(this,"checked-indicator")),this.defaultSlot.append(s),this.mediaSubtitlesList)){let i=hQ({type:"radio",text:this.formatMenuItemText(t.label,t),value:dB(t),checked:this.value==dB(t)});i.prepend(hZ(this,"checked-indicator")),"captions"===(null!=(e=t.kind)?e:"subs")&&i.append(hZ(this,"captions-indicator")),this.defaultSlot.append(i)}},gi=new WeakSet,gr=function(){let e=this.mediaSubtitlesShowing,t=this.getAttribute(ly.MEDIA_SUBTITLES_SHOWING),i=this.value!==t;if((null==e?void 0:e.length)&&i&&this.dispatchEvent(new lX.CustomEvent(lg.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:e})),!this.value||!i)return;let r=new lX.CustomEvent(lg.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(r)},(o="symbol"!=typeof(pN="template")?pN+"":pN)in ug?uh(ug,o,{enumerable:!0,configurable:!0,writable:!0,value:uf}):ug[o]=uf;let uv=(e,t)=>
420{let i=e.getAttribute(t);return i?dU(i):[]},uE=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);let r=d$(i);e.getAttribute(t)!==r&&e.setAttribute(t,r)};lX.customElements.get("media-captions-menu")||lX.customElements.define("media-captions-menu",ug);let ub=`<svg aria-hidden="true" viewBox="0 0 26 24"> 421 <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/> 422</svg>`,uy=`<svg aria-hidden="true" viewBox="0 0 26 24"> 423 <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/> 424</svg>`,uT=lQ.createElement("template");uT.innerHTML=` 425 <style> 426 :host([aria-checked="true"]) slot[name=off] { 427 display: none !important; 428 } 429 430 431 :host(:not([aria-checked="true"])) slot[name=on] { 432 display: none !important; 433 } 434 </style> 435 436 <slot name="icon"> 437 <slot name="on">${ub}</slot> 438 <slot name="off">${uy}</slot> 439 </slot> 440`;let uA=e=>{e.setAttribute("aria-checked",dV(e))},u_=(e,t)=>
440{let i=e.getAttribute(t);return i?dU(i):[]},uk=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);let r=d$(i);e.getAttribute(t)!==r&&e.setAttribute(t,r)};lX.customElements.get("media-captions-menu-button")||lX.customElements.define("media-captions-menu-button",class extends ut{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_SUBTITLES_LIST,ly.MEDIA_SUBTITLES_SHOWING]}constructor(e={}){super({slotTemplate:uT,...e}),this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",lC.CLOSED_CAPTIONS()),uA(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_SUBTITLES_SHOWING&&uA(this)}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:l3(this).querySelector("media-captions-menu")}get mediaSubtitlesList(){return u_(this,ly.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){uk(this,ly.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return u_(this,ly.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){uk(this,ly.MEDIA_SUBTITLES_SHOWING,e)}});let uS=lQ.createElement("template");uS.innerHTML=` 441 <style> 442 :host([${ly.MEDIA_IS_CASTING}]) slot:not([name=exit]):not([name=icon]) { 443 display: none !important; 444 } 445 446 447 :host(:not([${ly.MEDIA_IS_CASTING}])) slot:not([name=enter]):not([name=icon]) { 448 display: none !important; 449 } 450 </style> 451 452 <slot name="icon"> 453 <slot name="enter"><svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg></slot> 454 <slot name="exit"><svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg></slot> 455 </slot> 456`;let uw=e=>{let t=e.mediaIsCasting?lD.EXIT_CAST():lD.ENTER_CAST();e.setAttribute("aria-label",t)};lX.customElements.get("media-cast-button")||lX.customElements.define("media-cast-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_IS_CASTING,ly.MEDIA_CAST_UNAVAILABLE]}constructor(e={}){super({slotTemplate:uS,...e})}connectedCallback(){super.connectedCallback(),uw(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_IS_CASTING&&uw(this)}get mediaIsCasting(){return dn(this,ly.MEDIA_IS_CASTING)}set mediaIsCasting(e){dl(this,ly.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return dd(this,ly.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){dh(this,ly.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){let e=this.mediaIsCasting?lg.MEDIA_EXIT_CAST_REQUEST:lg.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new lX.CustomEvent(e,{composed:!0,bubbles:!0}))}});var uL=Object.defineProperty,uR=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},uI=(e,t,i)=>(uR(e,t,"read from private field"),i?i.call(e):t.get(e)),uC=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},uD=(e,t,i,r)=>(uR(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),ux=(e,t,i)=>(uR(e,t,"access private method"),i);let uM=lQ.createElement("template");uM.innerHTML=` 457 <style> 458 :host { 459 font: var(--media-font, 460 var(--media-font-weight, normal) 461 var(--media-font-size, 14px) / 462 var(--media-text-content-height, var(--media-control-height, 24px)) 463 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 464 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 465 background: var(--media-dialog-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .8)))); 466 border-radius: var(--media-dialog-border-radius); 467 border: var(--media-dialog-border, none); 468 display: var(--media-dialog-display, inline-flex); 469 transition: var(--media-dialog-transition-in, 470 visibility 0s, 471 opacity .2s ease-out, 472 transform .15s ease-out 473 ) !important; 474 475 visibility: var(--media-dialog-visibility, visible); 476 opacity: var(--media-dialog-opacity, 1); 477 transform: var(--media-dialog-transform-in, translateY(0) scale(1)); 478 } 479 480 :host([hidden]) { 481 transition: var(--media-dialog-transition-out, 482 visibility .15s ease-in, 483 opacity .15s ease-in, 484 transform .15s ease-in 485 ) !important; 486 visibility: var(--media-dialog-hidden-visibility, hidden); 487 opacity: var(--media-dialog-hidden-opacity, 0); 488 transform: var(--media-dialog-transform-out, translateY(2px) scale(.99)); 489 pointer-events: none; 490 } 491 </style> 492 <slot></slot> 493`;let uO="hidden";class uP extends lX.HTMLElement{constructor(){super(),uC(this,gn),uC(this,gl),uC(this,gh),uC(this,gc),uC(this,gp),uC(this,ga,void 0),uC(this,gs,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.nativeEl=this.constructor.template.content.cloneNode(!0),this.shadowRoot.append(this.nativeEl)),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[uO,"anchor"]}handleEvent(e){switch(e.type){case"invoke":ux(this,gh,gu).call(this,e);break;case"focusout":ux(this,gc,gm).call(this,e);break;case"keydown":ux(this,gp,gf).call(this,e)}}connectedCallback(){this.role||(this.role="dialog")}attributeChangedCallback(e,t,i){e===uO&&i!==t&&(this.hidden?ux(this,gl,gd).call(this):ux(this,gn,go).call(this))}focus(){uD(this,ga,l7());
493let e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');null==e||e.focus()}get keysUsed(){return["Escape","Tab"]}}ga=new WeakMap,gs=new WeakMap,gn=new WeakSet,go=function(){var e;null==(e=uI(this,gs))||e.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0})},gl=new WeakSet,gd=function(){var e;null==(e=uI(this,gs))||e.setAttribute("aria-expanded","false")},gh=new WeakSet,gu=function(e){uD(this,gs,e.relatedTarget),l9(this,e.relatedTarget)||(this.hidden=!this.hidden)},gc=new WeakSet,gm=function(e){var t;l9(this,e.relatedTarget)||(null==(t=uI(this,ga))||t.focus(),uI(this,gs)&&uI(this,gs)!==e.relatedTarget&&!this.hidden&&(this.hidden=!0))},gp=new WeakSet,gf=function(e){var t,i,r,a,s;let{key:n,ctrlKey:o,altKey:l,metaKey:d}=e;o||l||d||this.keysUsed.includes(n)&&(e.preventDefault(),e.stopPropagation(),"Tab"===n?(e.shiftKey?null==(i=null==(t=this.previousElementSibling)?void 0:t.focus)||i.call(t):null==(a=null==(r=this.nextElementSibling)?void 0:r.focus)||a.call(r),this.blur()):"Escape"===n&&(null==(s=uI(this,ga))||s.focus(),this.hidden=!0))},(l="symbol"!=typeof(pU="template")?pU+"":pU)in uP?uL(uP,l,{enumerable:!0,configurable:!0,writable:!0,value:uM}):uP[l]=uM,lX.customElements.get("media-chrome-dialog")||lX.customElements.define("media-chrome-dialog",uP);var uN=Object.defineProperty,uU=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},uF=(e,t,i)=>(uU(e,t,"read from private field"),i?i.call(e):t.get(e)),uB=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},u$=(e,t,i,r)=>(uU(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),uH=(e,t,i)=>(uU(e,t,"access private method"),i);let uW=lQ.createElement("template");uW.innerHTML=` 494 <style> 495 :host { 496 transition: var(--media-menu-item-transition, 497 background .15s linear, 498 opacity .2s ease-in-out 499 ); 500 outline: var(--media-menu-item-outline, 0); 501 outline-offset: var(--media-menu-item-outline-offset, -1px); 502 cursor: pointer; 503 display: flex; 504 align-items: center; 505 align-self: stretch; 506 justify-self: stretch; 507 white-space: nowrap; 508 white-space-collapse: collapse; 509 text-wrap: nowrap; 510 padding: .4em .8em .4em 1em; 511 } 512 513 :host(:focus-visible) { 514 box-shadow: var(--media-menu-item-focus-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 515 outline: var(--media-menu-item-hover-outline, 0); 516 outline-offset: var(--media-menu-item-hover-outline-offset, var(--media-menu-item-outline-offset, -1px)); 517 } 518 519 :host(:hover) { 520 cursor: pointer; 521 background: var(--media-menu-item-hover-background, rgb(92 92 102 / .5)); 522 outline: var(--media-menu-item-hover-outline); 523 outline-offset: var(--media-menu-item-hover-outline-offset, var(--media-menu-item-outline-offset, -1px)); 524 } 525 526 :host([aria-checked="true"]) { 527 background: var(--media-menu-item-checked-background); 528 } 529 530 :host([hidden]) { 531 display: none; 532 } 533 534 :host([disabled]) { 535 pointer-events: none; 536 color: rgba(255, 255, 255, .3); 537 } 538 539 slot:not([name]) { 540 width: 100%; 541 } 542 543 slot:not([name="submenu"]) { 544 display: inline-flex; 545 align-items: center; 546 transition: inherit; 547 opacity: var(--media-menu-item-opacity, 1); 548 } 549 550 slot[name="description"] { 551 justify-content: end; 552 } 553 554 slot[name="description"] > span { 555 display: inline-block; 556 margin-inline: 1em .2em; 557 max-width: var(--media-menu-item-description-max-width, 100px); 558 text-overflow: ellipsis; 559 overflow: hidden; 560 font-size: .8em; 561 font-weight: 400; 562 text-align: right; 563 position: relative; 564 top: .04em; 565 } 566 567 slot[name="checked-indicator"] { 568 display: none; 569 } 570 571 :host(:is([role="menuitemradio"],[role="menuitemcheckbox"])) slot[name="checked-indicator"] { 572 display: var(--media-menu-item-checked-indicator-display, inline-block); 573 } 574 575 576 svg, img, ::slotted(svg), ::slotted(img) { 577 height: var(--media-menu-item-icon-height, var(--media-control-height, 24px)); 578 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 579 display: block; 580 } 581 582 583 [part~="indicator"], 584 ::slotted([part~="indicator"]) { 585 fill: var(--media-menu-item-indicator-fill, 586 var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)))); 587 height: var(--media-menu-item-indicator-height, 1.25em); 588 margin-right: .5ch; 589 } 590 591 [part~="checked-indicator"] { 592 visibility: hidden; 593 } 594 595 :host([aria-checked="true"]) [part~="checked-indicator"] { 596 visibility: visible; 597 } 598 </style> 599 <slot name="checked-indicator"> 600 <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator"> 601 <path d="m10 15.17 9.193-9.191 1.414 1.414-10.606 10.606-6.364-6.364 1.414-1.414 4.95 4.95Z"/> 602 </svg> 603 </slot> 604 <slot name="prefix"></slot> 605 <slot></slot> 606 <slot name="description"></slot> 607 <slot name="suffix"></slot> 608 <slot name="submenu"></slot> 609`;let uG="type",uV="value",uK="checked",uq="disabled";class uj extends lX.HTMLElement{constructor(){super(),uB(this,gE),uB(this,gy),uB(this,gA),uB(this,gS),uB(this,gL),uB(this,gI),uB(this,gg,!1),uB(this,gv,void 0),uB(this,gk,()=>{var e,t;this.setAttribute("submenusize",`${this.submenuElement.items.length}`);let i=this.shadowRoot.querySelector('slot[name="description"]'),r=null==(t=null==(e=this.submenuElement.checkedItems)?void 0:e[0])?void 0:t.text,a=lQ.createElement("span");a.textContent=null!=r?r:"",i.replaceChildren(a)}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0))),this.shadowRoot.addEventListener("slotchange",this)}static get observedAttributes(){return[uG,uq,uK,uV]}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),uY(this)&&!this.hasAttribute("aria-checked")&&this.setAttribute("aria-checked","fal
609se"),this.addEventListener("click",this),this.addEventListener("keydown",this)}disable(){this.removeAttribute("tabindex"),this.removeEventListener("click",this),this.removeEventListener("keydown",this),this.removeEventListener("keyup",this)}handleEvent(e){switch(e.type){case"slotchange":uH(this,gE,gb).call(this,e);break;case"click":this.handleClick(e);break;case"keydown":uH(this,gL,gR).call(this,e);break;case"keyup":uH(this,gS,gw).call(this,e)}}attributeChangedCallback(e,t,i){e===uK&&uY(this)&&!uF(this,gg)?this.setAttribute("aria-checked",null!=i?"true":"false"):e===uG&&i!==t?this.role="menuitem"+i:e===uq&&i!==t&&(null==i?this.enable():this.disable())}connectedCallback(){this.hasAttribute(uq)||this.enable(),this.role="menuitem"+this.type,u$(this,gv,function e(t,i){if(!t)return null;let{host:r}=t.getRootNode();return!i&&r?e(t,r):(null==i?void 0:i.items)?i:e(i,null==i?void 0:i.parentNode)}(this,this.parentNode)),uH(this,gI,gC).call(this)}disconnectedCallback(){this.disable(),uH(this,gI,gC).call(this),u$(this,gv,null)}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?null==(e=de(this))?void 0:e.querySelector(`#${this.invokeTarget}`):this.submenuElement}get submenuElement(){return this.shadowRoot.querySelector('slot[name="submenu"]').assignedElements({flatten:!0})[0]}get type(){var e;return null!=(e=this.getAttribute(uG))?e:""}set type(e){this.setAttribute(uG,`${e}`)}get value(){var e;return null!=(e=this.getAttribute(uV))?e:this.text}set value(e){this.setAttribute(uV,e)}get text(){var e;return(null!=(e=this.textContent)?e:"").trim()}get checked(){if(uY(this))return"true"===this.getAttribute("aria-checked")}set checked(e){uY(this)&&(u$(this,gg,!0),this.setAttribute("aria-checked",e?"true":"false"),e?this.part.add("checked"):this.part.remove("checked"))}handleClick(e){!uY(this)&&this.invokeTargetElement&&l9(this,e.target)&&this.invokeTargetElement.dispatchEvent(new hG({relatedTarget:this}))}get keysUsed(){return["Enter"," "]}}function uY(e){return"radio"===e.type||"checkbox"===e.type}gg=new WeakMap,gv=new WeakMap,gE=new WeakSet,gb=function(e){let t=e.target;if(!(null==t?void 0:t.name))for(let e of t.assignedNodes({flatten:!0}))e instanceof Text&&""===e.textContent.trim()&&e.remove();"submenu"===t.name&&(this.submenuElement?uH(this,gy,gT).call(this):uH(this,gA,g_).call(this))},gy=new WeakSet,gT=async function(){this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",`${!this.submenuElement.hidden}`),this.submenuElement.addEventListener("change",uF(this,gk)),this.submenuElement.addEventListener("addmenuitem",uF(this,gk)),this.submenuElement.addEventListener("removemenuitem",uF(this,gk)),uF(this,gk).call(this)},gA=new WeakSet,g_=function(){this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.submenuElement.removeEventListener("change",uF(this,gk)),this.submenuElement.removeEventListener("addmenuitem",uF(this,gk)),this.submenuElement.removeEventListener("removemenuitem",uF(this,gk)),uF(this,gk).call(this)},gk=new WeakMap,gS=new WeakSet,gw=function(e){let{key:t}=e;this.keysUsed.includes(t)?this.handleClick(e):this.removeEventListener("keyup",uH(this,gS,gw))},gL=new WeakSet,gR=function(e){let{metaKey:t,altKey:i,key:r}=e;t||i||!this.keysUsed.includes(r)?this.removeEventListener("keyup",uH(this,gS,gw)):this.addEventListener("keyup",uH(this,gS,gw),{once:!0})},gI=new WeakSet,gC=function(){var e;let t=null==(e=uF(this,gv))?void 0:e.radioGroupItems;if(!t)return;let i=t.filter(e=>"true"===e.getAttribute("aria-checked")).pop();for(let e of(i||(i=t[0]),t))e.setAttribute("aria-checked","false");null==i||i.setAttribute("aria-checked","true")},(d="symbol"!=typeof(pF="template")?pF+"":pF)in uj?uN(uj,d,{enumerable:!0,configurable:!0,writable:!0,value:uW}):uj[d]=uW,lX.customElements.get("media-chrome-menu-item")||lX.customElements.define("media-chrome-menu-item",uj);var uz=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},uX=(e,t,i)=>(uz(e,t,"read from private field"),i?i.call(e):t.get(e)),uQ=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},uZ=(e,t,i,r)=>(uz(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),uJ=(e,t,i)=>(uz(e,t,"access private method"),i);let u0=lQ.createElement("template");u0.innerHTML=` 610 <style> 611 :host {
612 --_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 613 --_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px)); 614 615 box-shadow: var(--_focus-visible-box-shadow, none); 616 background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 617 height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding)); 618 display: inline-flex; 619 align-items: center; 620 621 vertical-align: middle; 622 box-sizing: border-box; 623 position: relative; 624 width: 100px; 625 transition: background .15s linear; 626 cursor: pointer; 627 pointer-events: auto; 628 touch-action: none; 629 z-index: 1; 630 } 631 632 633 input[type=range]:focus { 634 outline: 0; 635 } 636 input[type=range]:focus::-webkit-slider-runnable-track { 637 outline: 0; 638 } 639 640 :host(:hover) { 641 background: var(--media-control-hover-background, rgb(50 50 70 / .7)); 642 } 643 644 #leftgap { 645 padding-left: var(--media-range-padding-left, var(--_media-range-padding)); 646 } 647 648 #rightgap { 649 padding-right: var(--media-range-padding-right, var(--_media-range-padding)); 650 } 651 652 #startpoint, 653 #endpoint { 654 position: absolute; 655 } 656 657 #endpoint { 658 right: 0; 659 } 660 661 #container { 662 663 width: var(--media-range-track-width, 100%); 664 transform: translate(var(--media-range-track-translate-x, 0px), var(--media-range-track-translate-y, 0px)); 665 position: relative; 666 height: 100%; 667 display: flex; 668 align-items: center; 669 min-width: 40px; 670 } 671 672 #range { 673 674 display: var(--media-time-range-hover-display, block); 675 bottom: var(--media-time-range-hover-bottom, -7px); 676 height: var(--media-time-range-hover-height, max(100% + 7px, 25px)); 677 width: 100%; 678 position: absolute; 679 cursor: pointer; 680 681 -webkit-appearance: none; 682 -webkit-tap-highlight-color: transparent; 683 background: transparent; 684 margin: 0; 685 z-index: 1; 686 } 687 688 @media (hover: hover) { 689 #range { 690 bottom: var(--media-time-range-hover-bottom, -5px); 691 height: var(--media-time-range-hover-height, max(100% + 5px, 20px)); 692 } 693 } 694 695 696 697 #range::-webkit-slider-thumb { 698 -webkit-appearance: none; 699 background: transparent; 700 width: .1px; 701 height: .1px; 702 } 703 704 705 #range::-moz-range-thumb { 706 background: transparent; 707 border: transparent; 708 width: .1px; 709 height: .1px; 710 } 711 712 #appearance { 713 height: var(--media-range-track-height, 4px); 714 display: flex; 715 flex-direction: column; 716 justify-content: center; 717 width: 100%; 718 position: absolute; 719 720 will-change: transform; 721 } 722 723 #background, 724 #track { 725 border-radius: var(--media-range-track-border-radius, 1px); 726 position: absolute; 727 width: 100%; 728 height: 100%; 729 } 730 731 #background { 732 background: var(--media-range-track-background, rgb(255 255 255 / .2)); 733 backdrop-filter: var(--media-range-track-background-backdrop-filter); 734 -webkit-backdrop-filter: var(--media-range-track-background-backdrop-filter); 735 } 736 737 #track { 738 border: var(--media-range-track-border, none); 739 outline: var(--media-range-track-outline); 740 outline-offset: var(--media-range-track-outline-offset); 741 backdrop-filter: var(--media-range-track-backdrop-filter); 742 -webkit-backdrop-filter: var(--media-range-track-backdrop-filter);
743 box-shadow: var(--media-range-track-box-shadow, none); 744 overflow: hidden; 745 } 746 747 #progress, 748 #highlight, 749 #pointer { 750 position: absolute; 751 height: 100%; 752 will-change: width; 753 } 754 755 #progress { 756 background: var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238))); 757 transition: var(--media-range-track-transition); 758 } 759 760 #pointer { 761 background: var(--media-range-track-pointer-background); 762 border-right: var(--media-range-track-pointer-border-right); 763 transition: visibility .25s, opacity .25s; 764 visibility: hidden; 765 opacity: 0; 766 } 767 768 @media (hover: hover) { 769 :host(:hover) #pointer { 770 transition: visibility .5s, opacity .5s; 771 visibility: visible; 772 opacity: 1; 773 } 774 } 775 776 #thumb { 777 width: var(--media-range-thumb-width, 10px); 778 height: var(--media-range-thumb-height, 10px); 779 margin-left: calc(var(--media-range-thumb-width, 10px) / -2); 780 border: var(--media-range-thumb-border, none); 781 border-radius: var(--media-range-thumb-border-radius, 10px); 782 background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238))); 783 box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent); 784 transition: var(--media-range-thumb-transition); 785 transform: var(--media-range-thumb-transform, none); 786 opacity: var(--media-range-thumb-opacity, 1); 787 position: absolute; 788 left: 0; 789 cursor: pointer; 790 } 791 792 :host([disabled]) #thumb { 793 background-color: #777; 794 } 795 796 .segments #appearance { 797 height: var(--media-range-segment-hover-height, 7px); 798 } 799 800 #background, 801 #track { 802 clip-path: url(#segments-clipping); 803 } 804 805 #segments { 806 --segments-gap: var(--media-range-segments-gap, 2px); 807 position: absolute; 808 width: 100%; 809 height: 100%; 810 } 811 812 #segments-clipping { 813 transform: translateX(calc(var(--segments-gap) / 2)); 814 } 815 816 #segments-clipping:empty { 817 display: none; 818 } 819 820 #segments-clipping rect { 821 height: var(--media-range-track-height, 4px); 822 y: calc((var(--media-range-segment-hover-height, 7px) - var(--media-range-track-height, 4px)) / 2); 823 transition: var(--media-range-segment-transition, transform .1s ease-in-out); 824 transform: var(--media-range-segment-transform, scaleY(1)); 825 transform-origin: center; 826 } 827 </style> 828 <div id="leftgap"></div> 829 <div id="container"> 830 <div id="startpoint"></div> 831 <div id="endpoint"></div> 832 <div id="appearance" part="appearance"> 833 <div id="background"></div> 834 <div id="track"> 835 <div id="highlight"></div> 836 <div id="pointer"></div> 837 <div id="progress"></div> 838 </div> 839 <div id="thumb"></div> 840 <svg id="segments"><clipPath id="segments-clipping"></clipPath></svg> 841 </div>
842 <input id="range" type="range" min="0" max="1" step="any" value="0"> 843 </div> 844 <div id="rightgap"></div> 845`;class u1 extends lX.HTMLElement{constructor(){super(),uQ(this,g$),uQ(this,gW),uQ(this,gV),uQ(this,gq),uQ(this,gY),uQ(this,gX),uQ(this,gZ),uQ(this,g0),uQ(this,gD,void 0),uQ(this,gx,void 0),uQ(this,gM,void 0),uQ(this,gO,void 0),uQ(this,gP,{}),uQ(this,gN,[]),uQ(this,gU,()=>{if(this.range.matches(":focus-visible")){let{style:e}=di(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),uQ(this,gF,()=>{let{style:e}=di(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")}),uQ(this,gB,()=>{let e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(u0.content.cloneNode(!0))),this.container=this.shadowRoot.querySelector("#container"),uZ(this,gM,this.shadowRoot.querySelector("#startpoint")),uZ(this,gO,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",lv.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===lv.MEDIA_CONTROLLER?(t&&(null==(a=null==(r=uX(this,gD))?void 0:r.unassociateElement)||a.call(r,this),uZ(this,gD,null)),i&&this.isConnected&&(uZ(this,gD,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=uX(this,gD))?void 0:n.associateElement)||o.call(n,this))):("disabled"===e||"aria-disabled"===e&&t!==i)&&(null==i?(this.range.removeAttribute(e),uJ(this,gW,gG).call(this)):(this.range.setAttribute(e,i),uJ(this,gV,gK).call(this)))}connectedCallback(){var e,t,i;let{style:r}=di(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),uX(this,gP).pointer=di(this.shadowRoot,"#pointer"),uX(this,gP).progress=di(this.shadowRoot,"#progress"),uX(this,gP).thumb=di(this.shadowRoot,"#thumb");let a=this.getAttribute(lv.MEDIA_CONTROLLER);a&&(uZ(this,gD,null==(e=this.getRootNode())?void 0:e.getElementById(a)),null==(i=null==(t=uX(this,gD))?void 0:t.associateElement)||i.call(t,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",uX(this,gU)),this.shadowRoot.addEventListener("focusout",uX(this,gF)),uJ(this,gW,gG).call(this),l1(this.container,uX(this,gB))}disconnectedCallback(){var e,t;uJ(this,gV,gK).call(this),null==(t=null==(e=uX(this,gD))?void 0:e.unassociateElement)||t.call(e,this),uZ(this,gD,null),this.shadowRoot.removeEventListener("focusin",uX(this,gU)),this.shadowRoot.removeEventListener("focusout",uX(this,gF)),l2(this.container,uX(this,gB))}updatePointerBar(e){var t;null==(t=uX(this,gP).pointer)||t.style.setProperty("width",`${100*this.getPointerRatio(e)}%`)}updateBar(){var e,t;let i=100*this.range.valueAsNumber;null==(e=uX(this,gP).progress)||e.style.setProperty("width",`${i}%`),null==(t=uX(this,gP).thumb)||t.style.setProperty("left",`${i}%`)}updateSegments(e){let t=this.shadowRoot.querySelector("#segments-clipping");if(t.textContent="",this.container.classList.toggle("segments",!!(null==e?void 0:e.length)),!(null==e?void 0:e.length))return;uX(this,gP).activeSegment=dr(this.shadowRoot,"#segments-clipping rect:nth-child(0)");let i=[...new Set([+this.range.min,...e.flatMap(e=>[e.start,e.end]),+this.range.max])];uZ(this,gN,[...i]);let r=i.pop();for(let[e,a]of i.entries()){let[s,n]=[0===e,e===i.length-1],o=s?"calc(var(--segments-gap) / -1)":`${100*a}%`,l=n?r:i[e+1],d=`calc(${(l-a)*100}%${s||n?"":" - var(--segments-gap)"})`,h=lQ.createElementNS("http://www.w3.org/2000/svg","rect"),u=di(this.shadowRoot,`#segments-clipping rect:nth-child(${e+1})`);u.style.setProperty("x",o),u.style.setProperty("width",d),t.append(h)}}getPointerRatio(e){var t,i,r,a;let s,n,o;return Math.max(0,Math.min(1,(t=e.clientX,i=e.clientY,s=dt(r=uX(this,gM).getBoundingClientRect(),a=uX(this,gO).getBoundingClientRect()),n=dt(r,{x:t,y:i}),o=dt(a,{x:t,y:i}),n>s||o>s?+(n>o):n/s)))}get dragging(){return this.hasAttribute("dragging")}handleEvent(e){switch(e.type){case"pointermove":uJ(this,g0,g1).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":uJ(this,gY,gz).call(this,e);break;case"pointerdown":uJ(this,gq,gj).call(this,e);break;case"pointerup":uJ(this,gX,gQ).call(this);break;case"pointerleave":uJ(this,gZ,gJ).call(this)}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}}gD=new WeakMap,gx=new WeakMap,gM=new WeakMap,gO=new WeakMap,gP=new WeakMap,gN=new WeakMap,gU=new WeakMap,gF=new WeakMap,gB=new WeakMap,g$=new WeakSet,gH=function(e){let t=uX(this,gP).activeSegment;if(!t)return;let i=this.getPointerRatio(e),r=uX(this,gN).findIndex((e,t,r)=>{let a=r[t+1];return null!=a&&i>=e&&i<=a}),a=`#segments-clipping rect:nth-child(${r+1})`;t.selectorText==a&&t.style.transform||(t.selectorText=a,t.style.setProperty("transform","var(--media-range-segment-hover-transform, scaleY(2))"))},gW=new WeakSet,gG=function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))},gV=new WeakSet,gK=function(){var e,t;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),null==(e=lX.window)||e.removeEventListener("pointerup",this),null==(t=lX.window)||t.removeEventListener("pointermove",this)},gq=new WeakSet,gj=function(e){var t;uZ(this,gx,e.composedPath().includes(this.range)),null==(t=lX.window)||t.addEventListener("pointerup",this)},gY=new WeakSet,gz=function(e){var t;"mouse"!==e.pointerType&&uJ(this,gq,gj).call(this,e),this.addEventListener("pointerleave",this),null==(t=lX.window)||t.addEventListener("pointermove",this)},gX=new WeakSet,gQ=function(){var e;null==(e=lX.window)||e.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")},gZ=new WeakSet,gJ=function(){var e,t;this.removeEventListener("pointerleave",this),null==(e=lX.window)||e.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),null==(t=uX(this,gP).activeSegment)||t.style.removeProperty("transform")},g0=new WeakSet,g1=function(e){this.toggleAttribute("dragging",1===e.buttons||"mouse"!==e.pointerType),this.updatePointerBar(e),uJ(this,g$,gH).call(this,e),this.dragging&&("mouse"!==e.pointerType||!uX(this,gx))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(e),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))},lX.customElements.get("media-chrome-range")||lX.customElements.define("media-chrome-range",u1);var u2=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},u3=(e,t,i)=>(u2(e,t,"read from private field"),i?i.call(e):t.get(e)),u4=(e,t,i,r)=>(u2(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let u5=lQ.createElement("template");u5.innerHTML=` 846 <style> 847 :host { 848 849 box-sizing: border-box; 850 display: var(--media-control-display, var(--media-control-bar-display, inline-flex)); 851 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 852 --media-loading-indicator-icon-height: 44px; 853 } 854 855 ::slotted(media-time-range), 856 ::slotted(media-volume-range) { 857 min-height: 100%; 858 } 859 860 ::slotted(media-time-range), 861 ::slotted(media-clip-selector) { 862 flex-grow: 1; 863 } 864 </style> 865 866 <slot></slot> 867`;class u8 extends lX.HTMLElement{constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,g2,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(u5.content.cloneNode(!0)))}static get observedAttributes(){return[lv.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===lv.MEDIA_CONTROLLER&&(t&&(null==(a=null==(r=u3(this,g2))?void 0:r.unassociateElement)||a.call(r,this),u4(this,g2,null)),i&&this.isConnected&&(u4(this,g2,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=u3(this,g2))?void 0:n.associateElement)||o.call(n,this)))}connectedCallback(){var e,t,i;let r=this.getAttribute(lv.MEDIA_CONTROLLER);r&&(u4(this,g2,null==(e=this.getRootNode())?void 0:e.getElementById(r)),null==(i=null==(t=u3(this,g2))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=u3(this,g2))?void 0:e.unassociateElement)||t.call(e,this),u4(this,g2,null)}}g2=new WeakMap,lX.customElements.get("media-control-bar")||lX.customElements.define("media-control-bar",u8);var u9=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},u6=(e,t,i)=>(u9(e,t,"read from private field"),i?i.call(e):t.get(e)),u7=(e,t,i,r)=>(u9(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let ce=lQ.createElement("template");ce.innerHTML=` 868 <style> 869 :host { 870 font: var(--media-font, 871 var(--media-font-weight, normal) 872 var(--media-font-size, 14px) / 873 var(--media-text-content-height, var(--media-control-height, 24px)) 874 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 875 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 876 background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)))); 877 padding: var(--media-control-padding, 10px); 878 display: inline-flex; 879 justify-content: center; 880 align-items: center; 881 vertical-align: middle; 882 box-sizing: border-box; 883 text-align: center; 884 pointer-events: auto; 885 } 886 887 888 :host(:focus-visible) { 889 box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9); 890 outline: 0; 891 } 892 893 894 :host(:where(:focus)) { 895 box-shadow: none; 896 outline: 0; 897 } 898 </style> 899 <slot></slot> 900`;class ct extends lX.HTMLElement{constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,g3,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(ce.content.cloneNode(!0)))}static get observedAttributes(){return[lv.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===lv.MEDIA_CONTROLLER&&(t&&(null==(a=null==(r=u6(this,g3))?void 0:r.unassociateElement)||a.call(r,this),u7(this,g3,null)),i&&this.isConnected&&(u7(this,g3,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=u6(this,g3))?void 0:n.associateElement)||o.call(n,this)))}connectedCallback(){var e,t,i;let{style:r}=di(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);let a=this.getAttribute(lv.MEDIA_CONTROLLER);a&&(u7(this,g3,null==(e=this.getRootNode())?void 0:e.getElementById(a)),null==(i=null==(t=u6(this,g3))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=u6(this,g3))?void 0:e.unassociateElement)||t.call(e,this),u7(this,g3,null)}}g3=new WeakMap,lX.customElements.get("media-text-display")||lX.customElements.define("media-text-display",ct);var ci=ct,cr=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},ca=(e,t,i)=>(cr(e,t,"read from private field"),i?i.call(e):t.get(e));g4=new WeakMap,lX.customElements.get("media-duration-display")||lX.customElements.define("media-duration-display",class extends ct{constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,g4,void 0),((e,t,i)=>(cr(e,t,"write to private field"),t.set(e,i)))(this,g4,this.shadowRoot.querySelector("slot")),ca(this,g4).textContent=lW(0)}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_DURATION]}attributeChangedCallback(e,t,i){e===ly.MEDIA_DURATION&&(ca(this,g4).textContent=lW(+i)),super.attributeChangedCallback(e,t,i)}get mediaDuration(){return da(this,ly.MEDIA_DURATION)}set mediaDuration(e){ds(this,ly.MEDIA_DURATION,e)}});let cs=`<svg aria-hidden="true" viewBox="0 0 26 24"> 901 <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/> 902</svg>`,cn=`<svg aria-hidden="true" viewBox="0 0 26 24"> 903 <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/> 904</svg>`,co=lQ.createElement("template");co.innerHTML=` 905 <style> 906 :host([${ly.MEDIA_IS_FULLSCREEN}]) slot:not([name=exit]):not([name=icon]) { 907 display: none !important; 908 } 909 910 911 :host(:not([${ly.MEDIA_IS_FULLSCREEN}])) slot:not([name=enter]):not([name=icon]) { 912 display: none !important; 913 } 914 </style> 915 916 <slot name="icon"> 917 <slot name="enter">${cs}</slot> 918 <slot name="exit">${cn}</slot> 919 </slot> 920`;let cl=e=>{let t=e.mediaIsFullscreen?lD.EXIT_FULLSCREEN():lD.ENTER_FULLSCREEN();e.setAttribute("aria-label",t)};lX.customElements.get("media-fullscreen-button")||lX.customElements.define("media-fullscreen-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_IS_FULLSCREEN,ly.MEDIA_FULLSCREEN_UNAVAILABLE]}constructor(e={}){super({slotTemplate:co,...e})}connectedCallback(){super.connectedCallback(),cl(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_IS_FULLSCREEN&&cl(this)}get mediaFullscreenUnavailable(){return dd(this,ly.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(e){dh(this,ly.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return dn(this,ly.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){dl(this,ly.MEDIA_IS_FULLSCREEN,e)}handleClick(){let e=this.mediaIsFullscreen?lg.MEDIA_EXIT_FULLSCREEN_REQUEST:lg.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new lX.CustomEvent(e,{composed:!0,bubbles:!0}))}});let{MEDIA_TIME_IS_LIVE:cd,MEDIA_PAUSED:ch}=ly,{MEDIA_SEEK_TO_LIVE_REQUEST:cu,MEDIA_PLAY_REQUEST:cc}=lg,cm=lQ.createElement("template");cm.innerHTML=` 921 <style> 922 923 slot[name=indicator] > *, 924 :host ::slotted([slot=indicator]) { 925 926 min-width: auto; 927 fill: var(--media-live-button-icon-color, rgb(140, 140, 140)); 928 color: var(--media-live-button-icon-color, rgb(140, 140, 140)); 929 } 930 931 :host([${cd}]:not([${ch}
931])) slot[name=indicator] > *, 932 :host([${cd}]:not([${ch}])) ::slotted([slot=indicator]) { 933 fill: var(--media-live-button-indicator-color, rgb(255, 0, 0)); 934 color: var(--media-live-button-indicator-color, rgb(255, 0, 0)); 935 } 936 937 :host([${cd}]:not([${ch}])) { 938 cursor: not-allowed; 939 } 940 941 </style> 942 943 <slot name="indicator"><svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg></slot> 944 945 <slot name="spacer"> </slot><slot name="text">LIVE</slot> 946`;let cp=e=>{let t=e.mediaPaused||!e.mediaTimeIsLive,i=t?lD.SEEK_LIVE():lD.PLAYING_LIVE();e.setAttribute("aria-label",i),t?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true")};lX.customElements.get("media-live-button")||lX.customElements.define("media-live-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ch,cd]}constructor(e={}){super({slotTemplate:cm,...e})}connectedCallback(){cp(this),super.connectedCallback()}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),cp(this)}get mediaPaused(){return dn(this,ly.MEDIA_PAUSED)}set mediaPaused(e){dl(this,ly.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return dn(this,ly.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){dl(this,ly.MEDIA_TIME_IS_LIVE,e)}handleClick(){(this.mediaPaused||!this.mediaTimeIsLive)&&(this.dispatchEvent(new lX.CustomEvent(cu,{composed:!0,bubbles:!0})),this.hasAttribute(ch)&&this.dispatchEvent(new lX.CustomEvent(cc,{composed:!0,bubbles:!0})))}});var cf=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},cg=(e,t,i)=>(cf(e,t,"read from private field"),i?i.call(e):t.get(e)),cv=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},cE=(e,t,i,r)=>(cf(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let cb="loadingdelay",cy=lQ.createElement("template"),cT=` 947<svg aria-hidden="true" viewBox="0 0 100 100"> 948 <path d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"> 949 <animateTransform 950 attributeName="transform" 951 attributeType="XML" 952 type="rotate" 953 dur="1s" 954 from="0 50 50" 955 to="360 50 50" 956 repeatCount="indefinite" /> 957 </path> 958</svg> 959`;cy.innerHTML=` 960<style> 961:host { 962 display: var(--media-control-display, var(--media-loading-indicator-display, inline-block)); 963 vertical-align: middle; 964 box-sizing: border-box; 965 --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, 500ms); 966} 967 968#status { 969 color: rgba(0,0,0,0); 970 width: 0px; 971 height: 0px; 972} 973 974:host slot[name=icon] > *, 975:host ::slotted([slot=icon]) { 976 opacity: var(--media-loading-indicator-opacity, 0); 977 transition: opacity 0.15s; 978} 979 980:host([${ly.MEDIA_LOADING}]:not([${ly.MEDIA_PAUSED}])) slot[name=icon] > *, 981:host([${ly.MEDIA_LOADING}]:not([${ly.MEDIA_PAUSED}])) ::slotted([slot=icon]) { 982 opacity: var(--media-loading-indicator-opacity, 1); 983 transition: opacity 0.15s var(--_loading-indicator-delay); 984} 985 986:host #status { 987 visibility: var(--media-loading-indicator-opacity, hidden); 988 transition: visibility 0.15s; 989} 990 991:host([${ly.MEDIA_LOADING}]:not([${ly.MEDIA_PAUSED}])) #status { 992 visibility: var(--media-loading-indicator-opacity, visible); 993 transition: visibility 0.15s var(--_loading-indicator-delay); 994} 995 996svg, img, ::slotted(svg), ::slotted(img) { 997 width: var(--media-loading-indicator-icon-width); 998 height: var(--media-loading-indicator-icon-height, 100px); 999 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 1000 vertical-align: middle; 1001} 1002</style> 1003 1004<slot name="icon">${cT}</slot> 1005<div id="status" role="status" aria-live="polite">${lC.MEDIA_LOADING()}</div> 1006`;class cA extends lX.HTMLElement{constructor(){if(super(),cv(this,g5,void 0),cv(this,g8,500),!this.shadowRoot){const e=this.attachShadow({mode:"open"}),t=cy.content.cloneNode(!0);e.appendChild(t)}}static get observedAttributes(){return[lv.MEDIA_CONTROLLER,ly.MEDIA_PAUSED,ly.MEDIA_LOADING,cb]}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===cb&&t!==i?this.loadingDelay=Number(i):e===lv.MEDIA_CONTROLLER&&(t&&(null==(a=null==(r=cg(this,g5))?void 0:r.unassociateElement)||a.call(r,this),cE(this,g5,null)),i&&this.isConnected&&(cE(this,g5,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=cg(this,g5))?void 0:n.associateElement)||o.call(n,this)))}connectedCallback(){var e,t,i;let r=this.getAttribute(lv.MEDIA_CONTROLLER);r&&(cE(this,g5,null==(e=this.getRootNode())?void 0:e.getElementById(r)),null==(i=null==(t=cg(this,g5))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=cg(this,g5))?void 0:e.unassociateElement)||t.call(e,this),cE(this,g5,null)}get loadingDelay(){return cg(this,g8)}set loadingDelay(e){cE(this,g8,e);let{style:t}=di(this.shadowRoot,":host");t.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${e}ms)`)}get mediaPaused(){return dn(this,ly.MEDIA_PAUSED)}set mediaPaused(e){dl(this,ly.MEDIA_PAUSED,e)}get mediaLoading(){return dn(this,ly.MEDIA_LOADING)}set mediaLoading(e){dl(this,ly.MEDIA_LOADING,e)}}
1006g5=new WeakMap,g8=new WeakMap,lX.customElements.get("media-loading-indicator")||lX.customElements.define("media-loading-indicator",cA);let{MEDIA_VOLUME_LEVEL:c_}=ly,ck=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1007 <path d="M16.5 12A4.5 4.5 0 0 0 14 8v2.18l2.45 2.45a4.22 4.22 0 0 0 .05-.63Zm2.5 0a6.84 6.84 0 0 1-.54 2.64L20 16.15A8.8 8.8 0 0 0 21 12a9 9 0 0 0-7-8.77v2.06A7 7 0 0 1 19 12ZM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25A6.92 6.92 0 0 1 14 18.7v2.06A9 9 0 0 0 17.69 19l2 2.05L21 19.73l-9-9L4.27 3ZM12 4 9.91 6.09 12 8.18V4Z"/> 1008</svg>`,cS=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1009 <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4Z"/> 1010</svg>`,cw=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1011 <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4ZM14 3.23v2.06a7 7 0 0 1 0 13.42v2.06a9 9 0 0 0 0-17.54Z"/> 1012</svg>`,cL=lQ.createElement("template");cL.innerHTML=` 1013 <style> 1014 1015 :host(:not([${c_}])) slot:not([name=high]):not([name=icon]), 1016 :host([${c_}=high]) slot:not([name=high]):not([name=icon]) { 1017 display: none !important; 1018 } 1019 1020 :host([${c_}=off]) slot:not([name=off]):not([name=icon]) { 1021 display: none !important; 1022 } 1023 1024 :host([${c_}
1024=low]) slot:not([name=low]):not([name=icon]) { 1025 display: none !important; 1026 } 1027 1028 :host([${c_}=medium]) slot:not([name=medium]):not([name=icon]) { 1029 display: none !important; 1030 } 1031 </style> 1032 1033 <slot name="icon"> 1034 <slot name="off">${ck}</slot> 1035 <slot name="low">${cS}</slot> 1036 <slot name="medium">${cS}</slot> 1037 <slot name="high">${cw}</slot> 1038 </slot> 1039`;let cR=e=>{let t="off"===e.mediaVolumeLevel?lD.UNMUTE():lD.MUTE();e.setAttribute("aria-label",t)};lX.customElements.get("media-mute-button")||lX.customElements.define("media-mute-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_VOLUME_LEVEL]}constructor(e={}){super({slotTemplate:cL,...e})}connectedCallback(){cR(this),super.connectedCallback()}attributeChangedCallback(e,t,i){e===ly.MEDIA_VOLUME_LEVEL&&cR(this),super.attributeChangedCallback(e,t,i)}get mediaVolumeLevel(){return dd(this,ly.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){dh(this,ly.MEDIA_VOLUME_LEVEL,e)}handleClick(){let e="off"===this.mediaVolumeLevel?lg.MEDIA_UNMUTE_REQUEST:lg.MEDIA_MUTE_REQUEST;this.dispatchEvent(new lX.CustomEvent(e,{composed:!0,bubbles:!0}))}});let cI=`<svg aria-hidden="true" viewBox="0 0 28 24"> 1040 <path d="M24 3H4a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h20a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Zm-1 16H5V5h18v14Zm-3-8h-7v5h7v-5Z"/> 1041</svg>`,cC=lQ.createElement("template");cC.innerHTML=` 1042 <style> 1043 :host([${ly.MEDIA_IS_PIP}]) slot:not([name=exit]):not([name=icon]) { 1044 display: none !important; 1045 } 1046 1047 1048 :host(:not([${ly.MEDIA_IS_PIP}])) slot:not([name=enter]):not([name=icon]) { 1049 display: none !important; 1050 } 1051 </style> 1052 1053 <slot name="icon"> 1054 <slot name="enter">${cI}</slot> 1055 <slot name="exit">${cI}</slot> 1056 </slot> 1057`;let cD=e=>{let t=e.mediaIsPip?lD.EXIT_PIP():lD.ENTER_PIP();e.setAttribute("aria-label",t)};lX.customElements.get("media-pip-button")||lX.customElements.define("media-pip-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_IS_PIP,ly.MEDIA_PIP_UNAVAILABLE]}constructor(e={}){super({slotTemplate:cC,...e})}connectedCallback(){cD(this),super.connectedCallback()}attributeChangedCallback(e,t,i){e===ly.MEDIA_IS_PIP&&cD(this),super.attributeChangedCallback(e,t,i)}get mediaPipUnavailable(){return dd(this,ly.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){dh(this,ly.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return dn(this,ly.MEDIA_IS_PIP)}set mediaIsPip(e){dl(this,ly.MEDIA_IS_PIP,e)}handleClick(){let e=this.mediaIsPip?lg.MEDIA_EXIT_PIP_REQUEST:lg.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new lX.CustomEvent(e,{composed:!0,bubbles:!0}))}});var cx=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot read from private field");return i?i.call(e):t.get(e)};let cM="rates",cO=[1,1.2,1.5,1.7,2],cP=lQ.createElement("template");cP.innerHTML=` 1058 <style> 1059 :host { 1060 min-width: 5ch; 1061 padding: var(--media-button-padding, var(--media-control-padding, 10px 5px)); 1062 } 1063 </style> 1064 <slot name="icon"></slot> 1065`,g9=new WeakMap,lX.customElements.get("media-playback-rate-button")||lX.customElements.define("media-playback-rate-button",class extends hN{constructor(e={}){super({slotTemplate:cP,...e}),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,g9,new dP(this,cM,{defaultValue:cO})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML="1x"}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_PLAYBACK_RATE,cM]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===cM&&(cx(this,g9).value=i),e===ly.MEDIA_PLAYBACK_RATE){let e=i?+i:NaN,t=Number.isNaN(e)?1:e;this.container.innerHTML=`${t}x`,this.setAttribute("aria-label",lC.PLAYBACK_RATE({playbackRate:t}))}}get rates(){return cx(this,g9)}set rates(e){e?Array.isArray(e)&&(cx(this,g9).value=e.join(" ")):cx(this,g9).value=""}get mediaPlaybackRate(){return da(this,ly.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){ds(this,ly.MEDIA_PLAYBACK_RATE,e)}handleClick(){var e,t;let i=Array.from(this.rates.values(),e=>+e).sort((e,t)=>
1065e-t),r=null!=(t=null!=(e=i.find(e=>e>this.mediaPlaybackRate))?e:i[0])?t:1,a=new lX.CustomEvent(lg.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(a)}});var cN=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},cU=(e,t,i)=>(cN(e,t,"read from private field"),i?i.call(e):t.get(e)),cF=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},cB=(e,t,i)=>(cN(e,t,"access private method"),i);let c$="rates";g6=new WeakMap,g7=new WeakSet,ve=function(){for(let e of(this.defaultSlot.textContent="",this.rates)){let t=hQ({type:"radio",text:this.formatMenuItemText(`${e}x`,e),value:e,checked:this.mediaPlaybackRate==e});t.prepend(hZ(this,"checked-indicator")),this.defaultSlot.append(t)}},vt=new WeakSet,vi=function(){if(!this.value)return;let e=new lX.CustomEvent(lg.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},lX.customElements.get("media-playback-rate-menu")||lX.customElements.define("media-playback-rate-menu",class extends h3{constructor(){super(),cF(this,g7),cF(this,vt),cF(this,g6,new dP(this,c$,{defaultValue:cO})),cB(this,g7,ve).call(this)}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_PLAYBACK_RATE,c$]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_PLAYBACK_RATE&&t!=i?this.value=i:e===c$&&t!=i&&(cU(this,g6).value=i,cB(this,g7,ve).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",cB(this,vt,vi))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",cB(this,vt,vi))}get anchorElement(){return"auto"!==this.anchor?super.anchorElement:l3(this).querySelector("media-playback-rate-menu-button")}get rates(){return cU(this,g6)}set rates(e){e?Array.isArray(e)&&(cU(this,g6).value=e.join(" ")):cU(this,g6).value="",cB(this,g7,ve).call(this)}get mediaPlaybackRate(){return da(this,ly.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){ds(this,ly.MEDIA_PLAYBACK_RATE,e)}});var cH=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot read from private field");return i?i.call(e):t.get(e)};let cW="rates",cG=[1,1.2,1.5,1.7,2],cV=lQ.createElement("template");cV.innerHTML=` 1066 <style> 1067 :host { 1068 min-width: 5ch; 1069 padding: var(--media-button-padding, var(--media-control-padding, 10px 5px)); 1070 } 1071 </style> 1072 <slot name="icon"></slot> 1073`,vr=new WeakMap,lX.customElements.get("media-playback-rate-menu-button")||lX.customElements.define("media-playback-rate-menu-button",class extends ut{constructor(e={}){super({slotTemplate:cV,...e}),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,vr,new dP(this,cW,{defaultValue:cG})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML="1x"}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_PLAYBACK_RATE,cW]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===cW&&(cH(this,vr).value=i),e===ly.MEDIA_PLAYBACK_RATE){let e=i?+i:NaN,t=Number.isNaN(e)?1:e;this.container.innerHTML=`${t}x`,this.setAttribute("aria-label",lC.PLAYBACK_RATE({playbackRate:t}))}}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:l3(this).querySelector("media-playback-rate-menu")}get rates(){return cH(this,vr)}set rates(e){e?Array.isArray(e)&&(cH(this,vr).value=e.join(" ")):cH(this,vr).value=""}get mediaPlaybackRate(){return da(this,ly.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){ds(this,ly.MEDIA_PLAYBACK_RATE,e)}});let cK=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1074 <path d="m6 21 15-9L6 3v18Z"/> 1075</svg>`,cq=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1076 <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/> 1077</svg>`,cj=lQ.createElement("template");cj.innerHTML=` 1078 <style> 1079 :host([${ly.MEDIA_PAUSED}]) slot[name=pause] { 1080 display: none !important; 1081 } 1082 1083 :host(:not([${ly.MEDIA_PAUSED}])) slot[name=play] { 1084 display: none !important; 1085 } 1086 </style> 1087 1088 <slot name="icon"> 1089 <slot name="play">${cK}</slot> 1090 <slot name="pause">${cq}</slot> 1091 </slot> 1092`;let cY=e=>{let t=e.mediaPaused?lD.PLAY():lD.PAUSE();e.setAttribute("aria-label",t)};lX.customElements.get("media-play-button")||lX.customElements.define("media-play-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_PAUSED,ly.MEDIA_ENDED]}constructor(e={}){super({slotTemplate:cj,...e})}connectedCallback(){cY(this),super.connectedCallback()}attributeChangedCallback(e,t,i){e===ly.MEDIA_PAUSED&&cY(this),super.attributeChangedCallback(e,t,i)}get mediaPaused(){return dn(this,ly.MEDIA_PAUSED)}set mediaPaused(e){dl(this,ly.MEDIA_PAUSED,e)}handleClick(){let e=this.mediaPaused?lg.MEDIA_PLAY_REQUEST:lg.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new lX.CustomEvent(e,{composed:!0,bubbles:!0}))}});let cz="placeholdersrc",cX=lQ.createElement("template");cX.innerHTML=` 1093 <style> 1094 :host { 1095 pointer-events: none; 1096 display: var(--media-poster-image-display, inline-block); 1097 box-sizing: border-box; 1098 } 1099 1100 img { 1101 max-width: 100%; 1102 max-height: 100%; 1103 min-width: 100%; 1104 min-height: 100%; 1105 background-repeat: no-repeat; 1106 background-position: var(--media-poster-image-background-position, var(--media-object-position, center)); 1107 background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain)); 1108 object-fit: var(--media-object-fit, contain); 1109 object-position: var(--media-object-position, center); 1110 } 1111 </style> 1112 1113 <img part="poster img" aria-hidden="true" id="image"/> 1114`;class cQ extends lX.HTMLElement{static get observedAttributes(){return[cz,"src"]}constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(cX.content.cloneNode(!0))),this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,t,i){if("src"===e&&(null==i?this.image.removeAttribute("src"):this.image.setAttribute("src",i)),e===cz)if(null==i)this.image.style.removeProperty("background-image");else{var r;r=this.image,r.style["background-image"]=`url('${i}')`}}get placeholderSrc(){return dd(this,cz)}set placeholderSrc(e){dh(this,"src",e)}get src(){return dd(this,"src")}set src(e){dh(this,"src",e)}}lX.customElements.get("media-poster-image")||lX.customElements.define("media-poster-image",cQ);var cZ=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};va=new WeakMap,lX.customElements.get("media-preview-chapter-display")||lX.customElements.define("media-preview-chapter-display",class extends ci{constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,va,void 0),((e,t,i)=>(cZ(e,t,"write to private field"),t.set(e,i)))(this,va,this.shadowRoot.querySelector("slot"))}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_PREVIEW_CHAPTER]}attributeChangedCallback(e,t,i){(super.attributeChangedCallback(e,t,i),e===ly.MEDIA_PREVIEW_CHAPTER&&i!==t&&null!=i)&&((cZ(this,va,"read from private field"),va.get(this)).textContent=i,""!==i?this.setAttribute("aria-valuetext",`chapter: ${i}`):this.removeAttribute("aria-valuetext"))}get mediaPreviewChapter(){return dd(this,ly.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){dh(this,ly.MEDIA_PREVIEW_CHAPTER,e)}});var cJ=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},c0=(e,t,i)=>(cJ(e,t,"read from private field"),i?i.call(e):t.get(e)),c1=(e,t,i,r)=>(cJ(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let c2=lQ.createElement("template");c2.innerHTML=` 1115 <style> 1116 :host { 1117 box-sizing: border-box; 1118 display: var(--media-control-display, var(--media-preview-thumbn
1118ail-display, inline-block)); 1119 overflow: hidden; 1120 } 1121 1122 img { 1123 display: none; 1124 position: relative; 1125 } 1126 </style> 1127 <img crossorigin loading="eager" decoding="async"> 1128`;class c3 extends lX.HTMLElement{constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,vs,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(c2.content.cloneNode(!0)))}static get observedAttributes(){return[lv.MEDIA_CONTROLLER,ly.MEDIA_PREVIEW_IMAGE,ly.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,t,i;let r=this.getAttribute(lv.MEDIA_CONTROLLER);r&&(c1(this,vs,null==(e=this.getRootNode())?void 0:e.getElementById(r)),null==(i=null==(t=c0(this,vs))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=c0(this,vs))?void 0:e.unassociateElement)||t.call(e,this),c1(this,vs,null)}attributeChangedCallback(e,t,i){var r,a,s,n,o;[ly.MEDIA_PREVIEW_IMAGE,ly.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===lv.MEDIA_CONTROLLER&&(t&&(null==(a=null==(r=c0(this,vs))?void 0:r.unassociateElement)||a.call(r,this),c1(this,vs,null)),i&&this.isConnected&&(c1(this,vs,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=c0(this,vs))?void 0:n.associateElement)||o.call(n,this)))}get mediaPreviewImage(){return dd(this,ly.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){dh(this,ly.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){let e=this.getAttribute(ly.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(e=>+e)}set mediaPreviewCoords(e){e?this.setAttribute(ly.MEDIA_PREVIEW_COORDS,e.join(" ")):this.removeAttribute(ly.MEDIA_PREVIEW_COORDS)}update(){let e=this.mediaPreviewCoords,t=this.mediaPreviewImage;if(!(e&&t))return;let[i,r,a,s]=e,n=t.split("#")[0],{maxWidth:o,maxHeight:l,minWidth:d,minHeight:h}=getComputedStyle(this),u=Math.min(parseInt(o)/a,parseInt(l)/s),c=Math.max(parseInt(d)/a,parseInt(h)/s),m=u<1,p=m?u:c>1?c:1,{style:f}=di(this.shadowRoot,":host"),g=di(this.shadowRoot,"img").style,v=this.shadowRoot.querySelector("img"),E=m?"min":"max";f.setProperty(`${E}-width`,"initial","important"),f.setProperty(`${E}-height`,"initial","important"),f.width=`${a*p}px`,f.height=`${s*p}px`;let b=()=>{g.width=`${this.imgWidth*p}px`,g.height=`${this.imgHeight*p}px`,g.display="block"};v.src!==n&&(v.onload=()=>{this.imgWidth=v.naturalWidth,this.imgHeight=v.naturalHeight,b()},v.src=n,b()),b(),g.transform=`translate(-${i*p}px, -${r*p}px)`}}vs=new WeakMap,lX.customElements.get("media-preview-thumbnail")||lX.customElements.define("media-preview-thumbnail",c3);var c4=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},c5=(e,t,i)=>(c4(e,t,"read from private field"),i?i.call(e):t.get(e));vn=new WeakMap,lX.customElements.get("media-preview-time-display")||lX.customElements.define("media-preview-time-display",class extends ct{constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,vn,void 0),((e,t,i)=>(c4(e,t,"write to private field"),t.set(e,i)))(this,vn,this.shadowRoot.querySelector("slot")),c5(this,vn).textContent=lW(0)}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_PREVIEW_TIME&&null!=i&&(c5(this,vn).textContent=lW(i))}get mediaPreviewTime(){return da(this,ly.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){ds(this,ly.MEDIA_PREVIEW_TIME,e)}});var c8=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},c9=(e,t,i)=>(c8(e,t,"read from private field"),i?i.call(e):t.get(e)),c6=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},c7=(e,t,i,r)=>(c8(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),me=(e,t,i)=>(c8(e,t,"access private method"),i);vo=new WeakMap,vl=new WeakMap,vd=new WeakSet,vh=function(){if(c9(this,vl)===JSON.stringify(this.mediaRenditionList))return;c7(this,vl,JSON.stringify(this.mediaRenditionList));let e=this.mediaRenditionList.sort((e,t)=>
1128t.height-e.height);this.defaultSlot.textContent="";let t=!this.mediaRenditionSelected;for(let i of e){let e=hQ({type:"radio",text:this.formatMenuItemText(`${Math.min(i.width,i.height)}p`,i),value:`${i.id}`,checked:i.selected&&!t});e.prepend(hZ(this,"checked-indicator")),this.defaultSlot.append(e)}let i=hQ({type:"radio",text:this.formatMenuItemText("Auto"),value:"auto",checked:t});i.prepend(hZ(this,"checked-indicator")),this.defaultSlot.append(i)},vu=new WeakSet,vc=function(){if(null==this.value)return;let e=new lX.CustomEvent(lg.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},lX.customElements.get("media-rendition-menu")||lX.customElements.define("media-rendition-menu",class extends h3{constructor(){super(...arguments),c6(this,vd),c6(this,vu),c6(this,vo,[]),c6(this,vl,void 0)}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_RENDITION_LIST,ly.MEDIA_RENDITION_SELECTED,ly.MEDIA_RENDITION_UNAVAILABLE]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_RENDITION_SELECTED&&t!==i?this.value=null!=i?i:"auto":e===ly.MEDIA_RENDITION_LIST&&t!==i&&(c7(this,vo,lx(i)),me(this,vd,vh).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",me(this,vu,vc))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",me(this,vu,vc))}get anchorElement(){return"auto"!==this.anchor?super.anchorElement:l3(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return c9(this,vo)}set mediaRenditionList(e){c7(this,vo,e),me(this,vd,vh).call(this)}get mediaRenditionSelected(){return dd(this,ly.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){dh(this,ly.MEDIA_RENDITION_SELECTED,e)}});let mt=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1129 <path d="M13.5 2.5h2v6h-2v-2h-11v-2h11v-2Zm4 2h4v2h-4v-2Zm-12 4h2v6h-2v-2h-3v-2h3v-2Zm4 2h12v2h-12v-2Zm1 4h2v6h-2v-2h-8v-2h8v-2Zm4 2h7v2h-7v-2Z" /> 1130</svg>`,mi=lQ.createElement("template");mi.innerHTML=` 1131 <slot name="icon">${mt}</slot> 1132`,lX.customElements.get("media-rendition-menu-button")||lX.customElements.define("media-rendition-menu-button",class extends ut{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_RENDITION_SELECTED,ly.MEDIA_RENDITION_UNAVAILABLE]}constructor(){super({slotTemplate:mi})}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",lC.QUALITY())}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:l3(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return dd(this,ly.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){dh(this,ly.MEDIA_RENDITION_SELECTED,e)}});let mr="seekoffset",ma=lQ.createElement("template");ma.innerHTML=` 1133 <slot name="icon"><svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(2.18 19.87)">30</text><path d="M10 6V3L4.37 7 10 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 10 6Z"/></svg></slot> 1134`,lX.customElements.get("media-seek-backward-button")||lX.customElements.define("media-seek-backward-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_CURRENT_TIME,mr]}constructor(e={}){super({slotTemplate:ma,...e})}connectedCallback(){this.seekOffset=da(this,mr,30),super.connectedCallback()}attributeChangedCallback(e,t,i){e===mr&&(this.seekOffset=da(this,mr,30)),super.attributeChangedCallback(e,t,i)}get seekOffset(){return da(this,mr,30)}set seekOffset(e){ds(this,mr,e),this.setAttribute("aria-label",lD.SEEK_BACK_N_SECS({seekOffset:this.seekOffset})),l5(l8(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return da(this,ly.MEDIA_CURRENT_TIME,0)}set mediaCurrentTime(e){ds(this,ly.MEDIA_CURRENT_TIME,e)}handleClick(){let e=Math.max(this.mediaCurrentTime-this.seekOffset,0),t=new lX.CustomEvent(lg.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}});let ms="seekoffset",mn=lQ.createElement("template");mn.innerHTML=` 1135 <slot name="icon"><svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(8.9 19.87)">30</text><path d="M10 6V3l5.61 4L10 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 10 6Z"/></svg></slot> 1136`,lX.customElements.get("media-seek-forward-button")||lX.customElements.define("media-seek-forward-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_CURRENT_TIME,ms]}constructor(e={}){super({slotTemplate:mn,...e})}connectedCallback(){this.seekOffset=da(this,ms,30),super.connectedCallback()}attributeChangedCallback(e,t,i){e===ms&&(this.seekOffset=da(this,ms,30)),super.attributeChangedCallback(e,t,i)}get seekOffset(){return da(this,ms,30)}set seekOffset(e){ds(this,ms,e),this.setAttribute("aria-label",lD.SEEK_FORWARD_N_SECS({seekOffset:this.seekOffset})),l5(l8(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return da(this,ly.MEDIA_CURRENT_TIME,0)}set mediaCurrentTime(e){ds(this,ly.MEDIA_CURRENT_TIME,e)}handleClick(){let e=this.mediaCurrentTime+this.seekOffset,t=new lX.CustomEvent(lg.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}});var mo=Object.defineProperty;let ml=lQ.createElement("template");ml.innerHTML=h3.template.innerHTML+` 1137 <style> 1138 :host { 1139 background: var(--media-settings-menu-background, 1140 var(--media-menu-background, 1141 var(--media-control-background, 1142 var(--media-secondary-color, rgb(20 20 30 / .8))))); 1143 min-width: var(--media-settings-menu-min-width, 160px); 1144 border-radius: 2px 2px 0 0; 1145 overflow: hidden; 1146 } 1147 1148 :host([role="menu"]) { 1149 1150 justify-content: end; 1151 } 1152 1153 slot:not([name]) { 1154 justify-content: var(--media-settings-menu-justify-content); 1155 flex-direction: var(--media-settings-menu-flex-direction, column); 1156 overflow: visible; 1157 } 1158 1159 #container.has-expanded { 1160 --media-settings-menu-item-opacity: 0; 1161 } 1162 </style> 1163`;class md extends h3{get anchorElement(){return"auto"!==this.anchor?super.anchorElement:l3(this).querySelector("media-settings-menu-button")}}(h="symbol"!=typeof(pB="template")?pB+"":pB)in md?mo(md,h,{enumerable:!0,configurable:!0,writable:!0,value:ml}):md[h]=ml,lX.customElements.get("media-settings-menu")||lX.customElements.define("media-settings-menu",md);let mh=lQ.createElement("template");mh.innerHTML=` 1164 <slot name="icon"> 1165 <svg aria-hidden="true" viewBox="0 0 24 24"> 1166 <path d="M4.5 14.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm7.5 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm7.5 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"/> 1167 </svg> 1168 </slot> 1169`,lX.customElements.get("media-settings-menu-button")||lX.customElements.define("media-settings-menu-button",class extends ut{static get observedAttributes(){return[...super.observedAttributes,"target"]}constructor(){super({slotTemplate:mh})}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",lC.SETTINGS())}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:l3(this).querySelector("media-settings-menu")}});var mu=Object.defineProperty;let mc=lQ.createElement("template");mc.innerHTML=uj.template.innerHTML+` 1170 <style> 1171 slot:not([name="submenu"]) { 1172 opacity: var(--media-settings-menu-item-opacity, var(--media-menu-item-opacity)); 1173 } 1174 1175 :host([aria-expanded="true"]:hover) { 1176 background: transparent; 1177 } 1178 </style> 1179`,(null==(vm=mc.content)?void 0:vm.querySelector)&&(mc.content.querySelector('slot[name="suffix"]').innerHTML=` 1180 <svg aria-hidden="true" viewBox="0 0 20 24"> 1181 <path d="m8.12 17.585-.742-.669 4.2-4.665-4.2-4.666.743-.669 4.803 5.335-4.803 5.334Z"/> 1182 </svg> 1183 `);class mm extends uj{}(u="symbol"!=typeof(p$="template")?p$+"":p$)in mm?mu(mm,u,{enumerable:!0,configurable:!0,writable:!0,value:mc}):mm[u]=mc,lX.customElements.get("media-settings-menu-item")||lX.customElements.define("media-settings-menu-item",mm);var mp=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},mf=(e,t,i)=>(mp(e,t,"read from private field"),i?i.call(e):t.get(e));let mg={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},mv=[...Object.values(mg),ly.MEDIA_CURRENT_TIME,ly.MEDIA_DURATION,ly.MEDIA_SEEKABLE],mE=["Enter"," "],mb=" / ",my=(e,{timesSep:t=mb}={})=>{var i,r;let a=e.hasAttribute(mg.REMAINING),s=e.hasAttribute(mg.SHOW_DURATION),n=null!=(i=e.mediaCurrentTime)?i:0,[,o]=null!=(r=e.mediaSeekable)?r:[],l=0;Number.isFinite(e.mediaDuration)?l=e.mediaDuration:Number.isFinite(o)&&
1183(l=o);let d=a?lW(0-(l-n)):lW(n);return s?`${d}${t}${lW(l)}`:d};vp=new WeakMap,lX.customElements.get("media-time-display")||lX.customElements.define("media-time-display",class extends ct{constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,vp,void 0),((e,t,i)=>(mp(e,t,"write to private field"),t.set(e,i)))(this,vp,this.shadowRoot.querySelector("slot")),mf(this,vp).innerHTML=`${my(this)}`}static get observedAttributes(){return[...super.observedAttributes,...mv,"disabled"]}connectedCallback(){let{style:e}=di(this.shadowRoot,":host(:hover:not([notoggle]))");e.setProperty("cursor","pointer"),e.setProperty("background","var(--media-control-hover-background, rgba(50 50 70 / .7))"),this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",lC.PLAYBACK_TIME());let t=e=>{let{key:i}=e;mE.includes(i)?this.toggleTimeDisplay():this.removeEventListener("keyup",t)};this.addEventListener("keydown",e=>{let{metaKey:i,altKey:r,key:a}=e;i||r||!mE.includes(a)?this.removeEventListener("keyup",t):this.addEventListener("keyup",t)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.noToggle||(this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining",""))}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(e,t,i){mv.includes(e)?this.update():"disabled"===e&&i!==t&&(null==i?this.enable():this.disable()),super.attributeChangedCallback(e,t,i)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return dn(this,mg.REMAINING)}set remaining(e){dl(this,mg.REMAINING,e)}get showDuration(){return dn(this,mg.SHOW_DURATION)}set showDuration(e){dl(this,mg.SHOW_DURATION,e)}get noToggle(){return dn(this,mg.NO_TOGGLE)}set noToggle(e){dl(this,mg.NO_TOGGLE,e)}get mediaDuration(){return da(this,ly.MEDIA_DURATION)}set mediaDuration(e){ds(this,ly.MEDIA_DURATION,e)}get mediaCurrentTime(){return da(this,ly.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){ds(this,ly.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){let e=this.getAttribute(ly.MEDIA_SEEKABLE);if(e)return e.split(":").map(e=>+e)}set mediaSeekable(e){null==e?this.removeAttribute(ly.MEDIA_SEEKABLE):this.setAttribute(ly.MEDIA_SEEKABLE,e.join(":"))}update(){let e=my(this);(e=>{var t;let i=e.mediaCurrentTime,[,r]=null!=(t=e.mediaSeekable)?t:[],a=null;if(Number.isFinite(e.mediaDuration)?a=e.mediaDuration:Number.isFinite(r)&&(a=r),null==i||null===a)return e.setAttribute("aria-valuetext","video not loaded, unknown time.");let s=e.hasAttribute(mg.REMAINING),n=e.hasAttribute(mg.SHOW_DURATION),o=s?lH(0-(a-i)):lH(i);if(!n)return e.setAttribute("aria-valuetext",o);let l=lH(a),d=`${o} of ${l}`;e.setAttribute("aria-valuetext",d)})(this),e!==mf(this,vp).innerHTML&&(mf(this,vp).innerHTML=e)}});var mT=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},mA=(e,t,i)=>(mT(e,t,"read from private field"),i?i.call(e):t.get(e)),m_=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},mk=(e,t,i,r)=>(mT(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class mS{constructor(e,t,i){m_(this,vf,void 0),m_(this,vg,void 0),m_(this,vv,void 0),m_(this,vE,void 0),m_(this,vb,void 0),m_(this,vy,void 0),m_(this,vT,void 0),m_(this,vA,void 0),m_(this,v_,0),m_(this,vk,(e=performance.now())=>{mk(this,v_,requestAnimationFrame(mA(this,vk))),mk(this,vE,performance.now()-mA(this,vv));let t=1e3/this.fps;if(mA(this,vE)>t){let i,r;mk(this,vv,e-mA(this,vE)%t);let a=1e3/((e-mA(this,vg))/++(i=this,r=vb,{set _(value){mk(i,r,value,void 0)},get _(){return mA(i,r,void 0)}})._),s=(e-mA(this,vy))/1e3/this.duration,n=mA(this,vT)+s*this.playbackRate;n-mA(this,vf).valueAsNumber>0?mk(this,vA,this.playbackRate/this.duration/a):(mk(this,vA,.995*mA(this,vA)),n=mA(this,vf).valueAsNumber+mA(this,vA)),this.callback(n)}}),mk(this,vf,e),this.callback=t,this.fps=i}start(){0===mA(this,v_)&&(mk(this,vv,performance.now()),mk(this,vg,mA(this,vv)),mk(this,vb,0),mA(this,vk).c
1183all(this))}stop(){0!==mA(this,v_)&&(cancelAnimationFrame(mA(this,v_)),mk(this,v_,0))}update({start:e,duration:t,playbackRate:i}){let r=e-mA(this,vf).valueAsNumber,a=Math.abs(t-this.duration);(r>0||r<-.03||a>=.5)&&this.callback(e),mk(this,vT,e),mk(this,vy,performance.now()),this.duration=t,this.playbackRate=i}}vf=new WeakMap,vg=new WeakMap,vv=new WeakMap,vE=new WeakMap,vb=new WeakMap,vy=new WeakMap,vT=new WeakMap,vA=new WeakMap,v_=new WeakMap,vk=new WeakMap;var mw=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},mL=(e,t,i)=>(mw(e,t,"read from private field"),i?i.call(e):t.get(e)),mR=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},mI=(e,t,i,r)=>(mw(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),mC=(e,t,i)=>(mw(e,t,"access private method"),i);let mD=lQ.createElement("template");mD.innerHTML=` 1184 <style> 1185 :host { 1186 --media-box-border-radius: 4px; 1187 --media-box-padding-left: 10px; 1188 --media-box-padding-right: 10px; 1189 --media-preview-border-radius: var(--media-box-border-radius); 1190 --media-box-arrow-offset: var(--media-box-border-radius); 1191 --_control-background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 1192 --_preview-background: var(--media-preview-background, var(--_control-background)); 1193 1194 1195 contain: layout; 1196 } 1197 1198 #highlight { 1199 background: var(--media-time-range-buffered-color, rgb(255 255 255 / .4)); 1200 } 1201 1202 #preview-rail, 1203 #current-rail { 1204 width: 100%; 1205 position: absolute; 1206 left: 0; 1207 bottom: 100%; 1208 pointer-events: none; 1209 will-change: transform; 1210 } 1211 1212 [part~="box"] { 1213 width: min-content; 1214 1215 position: absolute; 1216 bottom: 100%; 1217 flex-direction: column; 1218 align-items: center; 1219 transform: translateX(-50%); 1220 } 1221 1222 [part~="current-box"] { 1223 display: var(--media-current-box-display, var(--media-box-display, flex)); 1224 margin: var(--media-current-box-margin, var(--media-box-margin, 0 0 5px)); 1225 visibility: hidden; 1226 } 1227 1228 [part~="preview-box"] { 1229 display: var(--media-preview-box-display, var(--media-box-display, flex)); 1230 margin: var(--media-preview-box-margin, var(--media-box-margin, 0 0 5px)); 1231 transition-property: var(--media-preview-transition-property, visibility, opacity); 1232 transition-duration: var(--media-preview-transition-duration-out, .25s); 1233 transition-delay: var(--media-preview-transition-delay-out, 0s); 1234 visibility: hidden; 1235 opacity: 0; 1236 } 1237 1238 :host(:is([${ly.MEDIA_PREVIEW_IMAGE}], [${ly.MEDIA_PREVIEW_TIME}])[dragging]) [part~="preview-box"] { 1239 transition-duration: var(--media-preview-transition-duration-in, .5s); 1240 transition-delay: var(--media-preview-transition-delay-in, .25s); 1241 visibility: visible; 1242 opacity: 1; 1243 } 1244 1245 @media (hover: hover) { 1246 :host(:is([${ly.MEDIA_PREVIEW_IMAGE}], [${ly.MEDIA_PREVIEW_TIME}]):hover) [part~="preview-box"] { 1247 transition-duration: var(--media-preview-transition-duration-in, .5s); 1248 transition-delay: var(--media-preview-transition-delay-in, .25s); 1249 visibility: visible; 1250 opacity: 1; 1251 } 1252 } 1253 1254 media-preview-thumbnail, 1255 ::slotted(media-preview-thumbnail) { 1256 visibility: hidden; 1257 1258 transition: visibility 0s .25s; 1259 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1260 background: var(--media-preview-thumbnail-background, var(--_preview-background)); 1261 box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2)); 1262 max-width: var(--media-preview-thumbnail-max-width, 180px); 1263 max-height: var(--media-preview-thumbnail-max-height, 160px); 1264 min-width: var(--media-preview-thumbnail-min-width, 120px); 1265 min-height: var(--media-preview-thumbnail-min-height, 80px); 1266 border: var(--media-preview-thumbnail-border); 1267 border-radius: var(--media-preview-thumbnail-border-radius, 1268 var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0); 1269 } 1270 1271 :host([${ly.MEDIA_PREVIEW_IMAGE}
1271][dragging]) media-preview-thumbnail, 1272 :host([${ly.MEDIA_PREVIEW_IMAGE}][dragging]) ::slotted(media-preview-thumbnail) { 1273 transition-delay: var(--media-preview-transition-delay-in, .25s); 1274 visibility: visible; 1275 } 1276 1277 @media (hover: hover) { 1278 :host([${ly.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail, 1279 :host([${ly.MEDIA_PREVIEW_IMAGE}]:hover) ::slotted(media-preview-thumbnail) { 1280 transition-delay: var(--media-preview-transition-delay-in, .25s); 1281 visibility: visible; 1282 } 1283 1284 :host([${ly.MEDIA_PREVIEW_TIME}]:hover) { 1285 --media-time-range-hover-display: block; 1286 } 1287 } 1288 1289 media-preview-chapter-display, 1290 ::slotted(media-preview-chapter-display) { 1291 font-size: var(--media-font-size, 13px); 1292 line-height: 17px; 1293 min-width: 0; 1294 visibility: hidden; 1295 1296 transition: min-width 0s, border-radius 0s, margin 0s, padding 0s, visibility 0s; 1297 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1298 background: var(--media-preview-chapter-background, var(--_preview-background)); 1299 border-radius: var(--media-preview-chapter-border-radius, 1300 var(--media-preview-border-radius) var(--media-preview-border-radius) 1301 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1302 padding: var(--media-preview-chapter-padding, 3.5px 9px); 1303 margin: var(--media-preview-chapter-margin, 0 0 5px); 1304 text-shadow: var(--media-preview-chapter-text-shadow, 0 0 4px rgb(0 0 0 / .75)); 1305 } 1306 1307 :host([${ly.MEDIA_PREVIEW_IMAGE}]) media-preview-chapter-display, 1308 :host([${ly.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-chapter-display) { 1309 transition-delay: var(--media-preview-transition-delay-in, .25s); 1310 border-radius: var(--media-preview-chapter-border-radius, 0); 1311 padding: var(--media-preview-chapter-padding, 3.5px 9px 0); 1312 margin: var(--media-preview-chapter-margin, 0); 1313 min-width: 100%; 1314 } 1315 1316 media-preview-chapter-display[${ly.MEDIA_PREVIEW_CHAPTER}], 1317 ::slotted(media-preview-chapter-display[${ly.MEDIA_PREVIEW_CHAPTER}]) { 1318 visibility: visible; 1319 } 1320 1321 media-preview-chapter-display:not([aria-valuetext]), 1322 ::slotted(media-preview-chapter-display:not([aria-valuetext])) { 1323 display: none; 1324 } 1325 1326 media-preview-time-display, 1327 ::slotted(media-preview-time-display), 1328 media-time-display, 1329 ::slotted(media-time-display) { 1330 font-size: var(--media-font-size, 13px); 1331 line-height: 17px; 1332 min-width: 0; 1333 1334 transition: min-width 0s, border-radius 0s; 1335 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1336 background: var(--media-preview-time-background, var(--_preview-background)); 1337 border-radius: var(--media-preview-time-border-radius, 1338 var(--media-preview-border-radius) var(--media-preview-border-radius) 1339 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1340 padding: var(--media-preview-time-padding, 3.5px 9px); 1341 margin: var(--media-preview-time-margin, 0); 1342 text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75)); 1343 transform: translateX(min( 1344 max(calc(50% - var(--_box-width) / 2), 1345 calc(var(--_box-shift, 0))), 1346 calc(var(--_box-width) / 2 - 50%) 1347 )); 1348 } 1349 1350 :host([${ly.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display, 1351 :host([${ly.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) { 1352 transition-delay: var(--media-preview-transition-delay-in, .25s); 1353 border-radius: var(--media-preview-time-border-radius, 1354 0 0 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1355 min-width: 100%; 1356 } 1357 1358 :host([${ly.MEDIA_PREVIEW_TIME}]:hover) { 1359 --media-time-range-hover-display: block; 1360 } 1361 1362 [part~="arrow"], 1363 ::slotted([part~="arrow"]) { 1364 display: var(--media-box-arrow-display, inline-block); 1365 transform: translateX(min( 1366 max(calc(50% - var(--_box-width) / 2 + var(--media-box-arrow-offset)), 1367 calc(var(--_box-shift, 0))), 1368 calc(var(--_box-width) / 2 - 50% - var(--media-box-arrow-offset)) 1369 )); 1370 1371 border-color: transparent; 1372 border-top-color: var(--media-box-arrow-background, var(--_control-background)); 1373 border-width: var(--media-box-arrow-border-width, 1374 var(--media-box-arrow-height, 5px) var(--media-box-arrow-width, 6px) 0); 1375 border-style: solid; 1376 justify-content: center; 1377 height: 0; 1378 } 1379 </style> 1380 <div id="preview-rail"> 1381 <slot name="preview" part="box preview-box">
1382 <media-preview-thumbnail></media-preview-thumbnail> 1383 <media-preview-chapter-display></media-preview-chapter-display> 1384 <media-preview-time-display></media-preview-time-display> 1385 <slot name="preview-arrow"><div part="arrow"></div></slot> 1386 </slot> 1387 </div> 1388 <div id="current-rail"> 1389 <slot name="current" part="box current-box"> 1390 1391 </slot> 1392 </div> 1393`;let mx=(e,t=e.mediaCurrentTime)=>{let i=Number.isFinite(e.mediaSeekableStart)?e.mediaSeekableStart:0,r=Number.isFinite(e.mediaDuration)?e.mediaDuration:e.mediaSeekableEnd;return Number.isNaN(r)?0:Math.max(0,Math.min((t-i)/(r-i),1))},mM=(e,t=e.range.valueAsNumber)=>{let i=Number.isFinite(e.mediaSeekableStart)?e.mediaSeekableStart:0,r=Number.isFinite(e.mediaDuration)?e.mediaDuration:e.mediaSeekableEnd;return Number.isNaN(r)?0:t*(r-i)+i};vS=new WeakMap,vw=new WeakMap,vL=new WeakMap,vR=new WeakMap,vI=new WeakMap,vC=new WeakMap,vD=new WeakMap,vx=new WeakMap,vM=new WeakMap,vO=new WeakSet,vP=function(){mC(this,vN,vU).call(this)?mL(this,vw).start():mL(this,vw).stop()},vN=new WeakSet,vU=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&function(e,t=3){if(e.checkVisibility)return e.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0});let i=e;for(;i&&t>0;){let e=getComputedStyle(i);if("0"===e.opacity||"hidden"===e.visibility||"none"===e.display)return!1;i=i.parentElement,t--}return!0}(this)},vF=new WeakMap,vB=new WeakSet,v$=function(e){var t;let i=(null!=(t=this.getAttribute("bounds")?l6(this,`#${this.getAttribute("bounds")}`):this.parentElement)?t:this).getBoundingClientRect(),r=this.range.getBoundingClientRect(),a=e.offsetWidth,s=-(r.left-i.left-a/2),n=i.right-r.left-a/2;return{box:{width:a,min:s,max:n},bounds:i,range:r}},vH=new WeakSet,vW=function(e,t){let i=`${100*t}%`,{width:r,min:a,max:s}=e.box;if(!r)return i;if(!Number.isNaN(a)){let e=`calc(1 / var(--_range-width) * 100 * ${a}% + var(--media-box-padding-left))`;i=`max(${e}, ${i})`}if(!Number.isNaN(s)){let e=`calc(1 / var(--_range-width) * 100 * ${s}% - var(--media-box-padding-right))`;i=`min(${i}, ${e})`}return i},vG=new WeakSet,vV=function(e,t){let{width:i,min:r,max:a}=e.box,s=t*e.range.width;if(s<r+mL(this,vD)){let t=e.range.left-e.bounds.left-mL(this,vD);return`${s-i/2+t}px`}if(s>a-mL(this,vx)){let t=e.bounds.right-e.range.right-mL(this,vx);return`${s+i/2-t-e.range.width}px`}return 0},vK=new WeakSet,vq=function(e){let t=[...mL(this,vL)].some(t=>e.composedPath().includes(t));if(!this.dragging&&(t||!e.composedPath().includes(this)))return void mC(this,vj,vY).call(this,null);let i=this.mediaSeekableEnd;if(!i)return;let r=di(this.shadowRoot,"#preview-rail"),a=di(this.shadowRoot,'[part~="preview-box"]'),s=mC(this,vB,v$).call(this,mL(this,vI)),n=(e.clientX-s.range.left)/s.range.width;n=Math.max(0,Math.min(1,n));let o=mC(this,vH,vW).call(this,s,n),l=mC(this,vG,vV).call(this,s,n);r.style.transform=`translateX(${o})`,r.style.setProperty("--_range-width",`${s.range.width}`),a.style.setProperty("--_box-shift",`${l}`),a.style.setProperty("--_box-width",`${s.box.width}px`),1>Math.abs(Math.round(mL(this,vR))-Math.round(n*i))&&n>.01&&n<.99||(mI(this,vR,n*i),mC(this,vj,vY).call(this,mL(this,vR)))},vj=new WeakSet,vY=function(e){this.dispatchEvent(new lX.CustomEvent(lg.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:e}))},vz=new WeakSet,vX=function(){mL(this,vw).stop();let e=mM(this);this.dispatchEvent(new lX.CustomEvent(lg.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e}))},lX.customElements.get("media-time-range")||lX.customElements.define("media-time-range",class extends u1{constructor(){super(),mR(this,vO),mR(this,vN),mR(this,vB),mR(this,vH),mR(this,vG),mR(this,vK),mR(this,vj),mR(this,vz),mR(this,vS,void 0),mR(this,vw,void 0),mR(this,vL,void 0),mR(this,vR,void 0),mR(this,vI,void 0),mR(this,vC,void 0),mR(this,vD,void 0),mR(this,vx,void 0),mR(this,vM,void 0),mR(this,vF,e=>{this.dragging||(this.range.valueAsNumber=e,this.updateBar())}),this.container.appendChild(mD.content.cloneNode(!0)),mI(this,vL,this.shadowRoot.querySelectorAll('[part~="box"]')),mI(this,vI,this.shadowRoot.querySelector('[part~="preview-box"]')),mI(this,vC,this.shadowRoot.querySelector('[part~="current-box"]'));const e=getComputedStyle(this);mI(this,vD,parseInt(e.getPropertyValue("--media-box-padding-left"))),mI(this,vx,parseInt(e.getPropertyValue("--media-box-padding-right"))),mI(this,vw,new mS(this.range,mL(this,vF),60))}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_PAUSED,ly.MEDIA_DURATION,ly.MEDIA_SEEKABLE,ly.MEDIA_CURRENT_TIME,ly.MEDIA_PREVIEW_IMAGE,ly.MEDIA_PREVIEW_TIME,ly.MEDIA_PREVIEW_CHAPTER,ly.MEDIA_BUFFERED,ly.MEDIA_PLAYBACK_RATE,ly.MEDIA_LOADING,ly.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",lC.SEEK()),mC(this,vO,vP).call(this),mI(this,vS,this.getRootNode()),null==(e=mL(this,vS))||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),mC(this,vO,vP).call(this),null==(e=mL(this,vS))||e.removeEventListener("transitionstart",this),mI(this,vS,null)}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),t!=i){if(e===ly.MEDIA_CURRENT_TIME||e===ly.MEDIA_PAUSED||e===ly.MEDIA_ENDED||e===ly.MEDIA_LOADING||e===ly.MEDIA_DURATION||e===ly.MEDIA_SEEKABLE){let e,t,i,r;mL(this,vw).update({start:mx(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),mC(this,vO,vP).call(this),e=this.range,t=lH(+mM(this)),i=lH(+this.mediaSeekableEnd),r
1393=t&&i?`${t} of ${i}`:"video not loaded, unknown time.",e.setAttribute("aria-valuetext",r)}else e===ly.MEDIA_BUFFERED&&this.updateBufferedBar();(e===ly.MEDIA_DURATION||e===ly.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=mL(this,vM),this.updateBar())}}get mediaChaptersCues(){return mL(this,vM)}set mediaChaptersCues(e){var t;mI(this,vM,e),this.updateSegments(null==(t=mL(this,vM))?void 0:t.map(e=>({start:mx(this,e.startTime),end:mx(this,e.endTime)})))}get mediaPaused(){return dn(this,ly.MEDIA_PAUSED)}set mediaPaused(e){dl(this,ly.MEDIA_PAUSED,e)}get mediaLoading(){return dn(this,ly.MEDIA_LOADING)}set mediaLoading(e){dl(this,ly.MEDIA_LOADING,e)}get mediaDuration(){return da(this,ly.MEDIA_DURATION)}set mediaDuration(e){ds(this,ly.MEDIA_DURATION,e)}get mediaCurrentTime(){return da(this,ly.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){ds(this,ly.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return da(this,ly.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){ds(this,ly.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){let e=this.getAttribute(ly.MEDIA_BUFFERED);return e?e.split(" ").map(e=>e.split(":").map(e=>+e)):[]}set mediaBuffered(e){if(!e)return void this.removeAttribute(ly.MEDIA_BUFFERED);let t=e.map(e=>e.join(":")).join(" ");this.setAttribute(ly.MEDIA_BUFFERED,t)}get mediaSeekable(){let e=this.getAttribute(ly.MEDIA_SEEKABLE);if(e)return e.split(":").map(e=>+e)}set mediaSeekable(e){null==e?this.removeAttribute(ly.MEDIA_SEEKABLE):this.setAttribute(ly.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;let[,t=this.mediaDuration]=null!=(e=this.mediaSeekable)?e:[];return t}get mediaSeekableStart(){var e;let[t=0]=null!=(e=this.mediaSeekable)?e:[];return t}get mediaPreviewImage(){return dd(this,ly.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){dh(this,ly.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return da(this,ly.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){ds(this,ly.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return dn(this,ly.MEDIA_ENDED)}set mediaEnded(e){dl(this,ly.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;let t,i=this.mediaBuffered;if(!i.length)return;if(this.mediaEnded)t=1;else{let r=this.mediaCurrentTime,[,a=this.mediaSeekableStart]=null!=(e=i.find(([e,t])=>e<=r&&r<=t))?e:[];t=mx(this,a)}let{style:r}=di(this.shadowRoot,"#highlight");r.setProperty("width",`${100*t}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;let e=di(this.shadowRoot,"#current-rail"),t=di(this.shadowRoot,'[part~="current-box"]'),i=mC(this,vB,v$).call(this,mL(this,vC)),r=mC(this,vH,vW).call(this,i,this.range.valueAsNumber),a=mC(this,vG,vV).call(this,i,this.range.valueAsNumber);e.style.transform=`translateX(${r})`,e.style.setProperty("--_range-width",`${i.range.width}`),t.style.setProperty("--_box-shift",`${a}`),t.style.setProperty("--_box-width",`${i.box.width}px`),t.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":mC(this,vz,vX).call(this);break;case"pointermove":mC(this,vK,vq).call(this,e);break;case"pointerup":case"pointerleave":mC(this,vj,vY).call(this,null);break;case"transitionstart":l9(e.target,this)&&setTimeout(()=>mC(this,vO,vP).call(this),0)}}}),lX.customElements.get("media-volume-range")||lX.customElements.define("media-volume-range",class extends u1{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_VOLUME,ly.MEDIA_MUTED,ly.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{let e=this.range.value,t=new lX.CustomEvent(lg.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",lC.VOLUME())}attributeChangedCallback(e,t,i){(super.attributeChangedCallback(e,t,i),e===ly.MEDIA_VOLUME||e===ly.MEDIA_MUTED)&&(this.range.valueAsNumber=this.mediaMuted?0:this.mediaVolume,this.range.setAttribute("aria-valuetext",(({value:e})=>`${Math.round(100*e)}%`)(this.range)),this.updateBar())}
1393get mediaVolume(){return da(this,ly.MEDIA_VOLUME,1)}set mediaVolume(e){ds(this,ly.MEDIA_VOLUME,e)}get mediaMuted(){return dn(this,ly.MEDIA_MUTED)}set mediaMuted(e){dl(this,ly.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return dd(this,ly.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){dh(this,ly.MEDIA_VOLUME_UNAVAILABLE,e)}});var mO=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},mP=(e,t,i)=>(mO(e,t,"read from private field"),i?i.call(e):t.get(e)),mN=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},mU=(e,t,i,r)=>(mO(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),mF=(e,t,i)=>(mO(e,t,"access private method"),i);let mB=` 1394<svg aria-hidden="true" viewBox="0 1 24 24" part="select-indicator indicator"> 1395 <path d="m10 15.17 9.193-9.191 1.414 1.414-10.606 10.606-6.364-6.364 1.414-1.414 4.95 4.95Z"/> 1396</svg>`;function m$(e,t,i){let r=lQ.createElement("media-chrome-option");r.part.add("option"),r.value=t,r.selected=i;let a=lQ.createElement("span");return a.textContent=e,r.append(a),r}function mH(e,t){let i=e.querySelector(`:scope > [slot="${t}"]`);return((null==i?void 0:i.nodeName)=="SLOT"&&(i=i.assignedElements({flatten:!0})[0]),i)?((i=i.cloneNode(!0)).removeAttribute("slot"),i):e.shadowRoot.querySelector(`[name="${t}"] > svg`).cloneNode(!0)}let mW=lQ.createElement("template");mW.innerHTML=` 1397<style> 1398 :host { 1399 font: var(--media-font, 1400 var(--media-font-weight, normal) 1401 var(--media-font-size, 15px) / 1402 var(--media-text-content-height, var(--media-control-height, 24px)) 1403 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 1404 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 1405 background: var(--media-listbox-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .8)))); 1406 border-radius: var(--media-listbox-border-radius); 1407 display: inline-flex; 1408 flex-direction: column; 1409 position: relative; 1410 box-sizing: border-box; 1411 } 1412 1413 ::slotted([slot="header"]) { 1414 padding: .4em 1.4em; 1415 border-bottom: 1px solid rgb(255 255 255 / .25); 1416 } 1417 1418 #container { 1419 gap: var(--media-listbox-gap); 1420 display: flex; 1421 flex-direction: var(--media-listbox-flex-direction, column); 1422 overflow: hidden auto; 1423 padding-block: .5em; 1424 } 1425 1426 media-chrome-option { 1427 padding-inline: .7em 1.4em; 1428 } 1429 1430 media-chrome-option > span { 1431 margin-inline: .5ch; 1432 } 1433 1434 [part~="indicator"] { 1435 fill: var(--media-option-indicator-fill, var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)))); 1436 height: var(--media-option-indicator-height, 1.25em); 1437 vertical-align: var(--media-option-indicator-vertical-align, text-top); 1438 } 1439 1440 [part~="select-indicator"] { 1441 display: var(--media-option-select-indicator-display); 1442 visibility: hidden; 1443 } 1444 1445 [aria-selected="true"] > [part~="select-indicator"] { 1446 visibility: visible; 1447 } 1448</style> 1449<style id="layout-row" media="width:0"> 1450 1451 ::slotted([slot="header"]) { 1452 padding: .4em .5em; 1453 } 1454 1455 #container { 1456 gap: var(--media-listbox-gap, .25em); 1457 flex-direction: var(--media-listbox-flex-direction, row); 1458 padding-inline: .5em; 1459 } 1460 1461 media-chrome-option { 1462 padding: .3em .24em; 1463 } 1464 1465 media-chrome-option[aria-selected="true"] { 1466 background: var(--media-option-selected-background, rgb(255 255 255 / .2)); 1467 } 1468 1469 [part~="select-indicator"] { 1470 display: var(--media-option-select-indicator-display, none); 1471 } 1472</style> 1473<slot name="header"></slot> 1474<slot id="container"></slot> 1475<slot name="select-indicator" hidden>${mB}</slot> 1476`;class mG extends lX.HTMLElement{constructor(e={}){super(),mN(this,v2),mN(this,v8),mN(this,v6),mN(this,Ee),mN(this,Ei),mN(this,Ea),mN(this,vQ,void 0),mN(this,vZ,""),mN(this,vJ,null),mN(this,v0,!1),mN(this,v1,e=>{this.handleClick(e)}),mN(this,v4,e=>{let{key:t}=e;"Escape"===t?this.removeEventListener("keyup",mP(this,v4)):"Meta"===t?mU(this,v0,!1):mF(this,v2,v3).call(this,e)}),mN(this,v5,e=>{let{key:t,altKey:i}=e;i?this.removeEventListener("keyup",mP(this,v4)):"Meta"===t?mU(this,v0,!0):(this.keysUsed.includes(t)&&e.preventDefault(),mP(this,v0)&&this.keysUsed.includes(t))?mF(this,v2,v3).call(this,e):this.addEventListener("keyup",mP(this,v4),{once:!0})}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.nativeEl=mW.content.cloneNode(!0),e.slotTemplate&&this.nativeEl.append(e.slotTemplate.content.cloneNode(!0)),this.shadowRoot.append(this.nativeEl)),this.container=this.shadowRoot.querySelector("#container"),this.container.addEventListener("slotchange",e=>{for(let t of e.target.assignedNodes({flatten:!0}))3===t.nodeType&&""===t.textContent.trim()&&t.remove()})}static get observedAttributes(){return["disabled","style",lv.MEDIA_CONTROLLER]}static formatOptionText(e){return e}formatOptionText(e,t){return this.constructor.formatOptionText(e,t)}get options(){var e;let t=this.querySelectorAll("media-chrome-option");return t.length||(t=null==(e=this.container)?void 0:e.querySelectorAll("media-chrome-option")),Array.from(t)}get selectedOptions(){return this.options.filter(e=>e.selected)}get value(){var e,t;return null!=(t=null==(e=this.selectedOptions[0])?void 0:e.value)?t:""}set value(e){let t=this.options.find(t=>t.value===e);t&&mF(this,Ee,Et).call(this,t)}focus(){var e;null==(e=this.selectedOptions[0])||e.focus()}enable(){this.addEventListener("click",mP(this,v1)),this.addEventListener("keydown",mP(this,v5))}disable(){this.removeEventListener("click",mP(this,v1)),this.removeEventListener("keyup",mP(this,v4))}attributeChangedCallback(e,t,i){var r,a,s,n,o;"style"===e&&i!==t?mF(this,v8,v9).call(this):e===lv.MEDIA_CONTROLLER?(t&&(null==(a=null==(r=mP(this,vQ))?void 0:r.unassociateElement)||a.call(r,this),mU(this,vQ,null)),i&&this.isConnected&&(mU(this,vQ,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=mP(this,vQ))?void 0:n.associateElement)||o.call(n,this))):"disabled"===e&&i!==t&&(null==i?this.enable():this.disable())}connectedCallback(){var e,t,i;mF(this,v8,v9).call(this),this.hasAttribute("disabled")||this.enable(),this.hasAttribute("role")||this.setAttribute("role","listbox");let r=this.getAttribute(lv.MEDIA_CONTROLLER);r&&(mU(this,vQ,null==(e=this.getRootNode())?void 0:e.getElementById(r)),null==(i=null==(t=mP(this,vQ))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;this.disable(),null==(t=null==(e=mP(this,vQ))?void 0:e.unassociateElement)||t.call(e,this),mU(this,vQ,null)}get keysUsed(){return["Enter"," ","ArrowDown","ArrowUp","Home","End"]}handleSelection(e,t){let i=mF(this,v6,v7).call(this,e);i&&mF(this,Ee,Et).call(this,i,t)}handleMovement(e){let t,{key:i}=e,r=this.options,a=mF(this,v6,v7).call(this,e);switch(!a&&(a=r.filter(e=>"0"===e.getAttribute("tabindex"))[0]),i){case"ArrowDown":(null==(t=a.nextElementSibling)?void 0:t.hasAttribute("disabled"))&&(t=t.nextElementSibling);break;case"ArrowUp":(null==(t=a.previousElementSibling)?void 0:t.hasAttribute("disabled"))&&(t=t.previousElementSibling);break;case"Home":t=r[0];break;case"End":t=r[r.length-1];break;default:t=mF(this,Ei,Er).call(this,i)}
1476t&&(r.forEach(e=>e.setAttribute("tabindex","-1")),t.setAttribute("tabindex","0"),t.focus())}handleClick(e){let t=mF(this,v6,v7).call(this,e);!t||t.hasAttribute("disabled")||(this.options.forEach(e=>e.setAttribute("tabindex","-1")),t.setAttribute("tabindex","0"),this.handleSelection(e,this.hasAttribute("aria-multiselectable")&&"true"===this.getAttribute("aria-multiselectable")))}}vQ=new WeakMap,vZ=new WeakMap,vJ=new WeakMap,v0=new WeakMap,v1=new WeakMap,v2=new WeakSet,v3=function(e){let{key:t}=e;"Enter"===t||" "===t?this.handleSelection(e,this.hasAttribute("aria-multiselectable")&&"true"===this.getAttribute("aria-multiselectable")):this.handleMovement(e)},v4=new WeakMap,v5=new WeakMap,v8=new WeakSet,v9=function(){var e;let t=this.shadowRoot.querySelector("#layout-row"),i=(null==(e=getComputedStyle(this).getPropertyValue("--media-listbox-layout"))?void 0:e.trim())==="row";t.setAttribute("media",i?"":"width:0")},v6=new WeakSet,v7=function(e){let t=e.composedPath(),i=t.findIndex(e=>"MEDIA-CHROME-OPTION"===e.nodeName);return t[i]},Ee=new WeakSet,Et=function(e,t){let i=[...this.selectedOptions];this.hasAttribute("aria-multiselectable")&&"true"===this.getAttribute("aria-multiselectable")||this.options.forEach(e=>e.selected=!1),t?e.selected=!e.selected:e.selected=!0,this.selectedOptions.some((e,t)=>e!=i[t])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Ei=new WeakSet,Er=function(e){mF(this,Ea,Es).call(this);let t=this.options,i=t.findIndex(e=>"0"===e.getAttribute("tabindex"));mU(this,vZ,mP(this,vZ)+e);let r=mP(this,vZ).split("").every(t=>t===e),a=t.slice(i+ +!!r).filter(e=>e.textContent.toLowerCase().startsWith(mP(this,vZ))),s=t.slice(0,i-!!r).filter(e=>e.textContent.toLowerCase().startsWith(mP(this,vZ))),n=[],o=[];return r&&(n=t.slice(i+ +!!r).filter(t=>t.textContent.startsWith(e)),o=t.slice(0,i-!!r).filter(t=>t.textContent.startsWith(e))),[...a,...s,...n,...o][0]},Ea=new WeakSet,Es=function(){clearTimeout(mP(this,vJ)),mU(this,vJ,null),mU(this,vJ,setTimeout(()=>{mU(this,vZ,""),mU(this,vJ,null)},500))},lX.customElements.get("media-chrome-listbox")||lX.customElements.define("media-chrome-listbox",mG);var mV=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},mK=(e,t,i)=>(mV(e,t,"read from private field"),i?i.call(e):t.get(e)),mq=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},mj=(e,t,i,r)=>(mV(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),mY=(e,t,i)=>(mV(e,t,"access private method"),i);let mz=lQ.createElement("template");mz.innerHTML=` 1477<style> 1478 :host { 1479 cursor: pointer; 1480 display: block; 1481 line-height: revert; 1482 white-space: nowrap; 1483 white-space-collapse: collapse; 1484 text-wrap: nowrap; 1485 padding: .4em .5em; 1486 transition: var(--media-option-transition); 1487 outline: var(--media-option-outline, 0); 1488 outline-offset: var(--media-option-outline-offset, -1px); 1489 } 1490 1491 :host(:focus-visible) { 1492 box-shadow: var(--media-option-focus-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 1493 outline: var(--media-option-hover-outline, 0); 1494 outline-offset: var(--media-option-hover-outline-offset, var(--media-option-outline-offset, -1px)); 1495 } 1496 1497 :host(:hover) { 1498 cursor: pointer; 1499 background: var(--media-option-hover-background, rgb(82 82 122 / .8)); 1500 outline: var(--media-option-hover-outline); 1501 outline-offset: var(--media-option-hover-outline-offset, var(--media-option-outline-offset, -1px)); 1502 } 1503 1504 :host([aria-selected="true"]) { 1505 background: var(--media-option-selected-background); 1506 } 1507 1508 :host([disabled]) { 1509 pointer-events: none; 1510 color: rgba(255, 255, 255, .3); 1511 } 1512</style> 1513<slot></slot> 1514`;let mX="value",mQ="selected",mZ="disabled";class mJ extends lX.HTMLElement{constructor(){super(),mq(this,El),mq(this,En,!1),mq(this,Eo,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(mz.content.cloneNode(!0)))}static get observedAttributes(){return[mZ,mQ,mX]}get value(){var e;return null!=(e=this.getAttribute(mX))?e:this.text}set value(e){this.setAttribute(mX,e)}get text(){var e;return(null!=(e=this.textContent)?e:"").trim()}get selected(){return"true"===this.getAttribute("aria-selected")}set selected(e){mj(this,En,!0),this.setAttribute("aria-selected",e?"true":"false"),e?this.part.add("option-selected"):this.part.remove("option-selected")}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex",-1),this.hasAttribute("aria-selected")||this.setAttribute("aria-selected","false")}disable(){this.removeAttribute("tabindex")}attributeChangedCallback(e,t,i){e!==mQ||mK(this,En)?e===mZ&&i!==t&&(null==i?this.enable():this.disable()):this.setAttribute("aria-selected",null!=i?"true":"false")}connectedCallback(){this.hasAttribute(mZ)||this.enable(),this.setAttribute("role","option"),mj(this,Eo,function e(t,i){if(!t)return null;let{host:r}=t.getRootNode();return!i&&r?e(t,r):(null==i?void 0:i.options)?i:e(i,null==i?void 0:i.parentNode)}
1514(this,this.parentNode)),mY(this,El,Ed).call(this)}disconnectedCallback(){this.disable(),mY(this,El,Ed).call(this),mj(this,Eo,null)}handleClick(){}}En=new WeakMap,Eo=new WeakMap,El=new WeakSet,Ed=function(){var e;let t=null==(e=mK(this,Eo))?void 0:e.options;if(!t)return;let i=t.filter(e=>"true"===e.getAttribute("aria-selected")).pop();i||(i=t[0]),"true"!==mK(this,Eo).getAttribute("aria-multiselectable")&&t.forEach(e=>{e.setAttribute("tabindex","-1"),e.setAttribute("aria-selected","false")}),null==i||i.setAttribute("tabindex","0"),null==i||i.setAttribute("aria-selected","true")},lX.customElements.get("media-chrome-option")||lX.customElements.define("media-chrome-option",mJ);var m0=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},m1=(e,t,i)=>(m0(e,t,"read from private field"),i?i.call(e):t.get(e)),m2=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},m3=(e,t,i,r)=>(m0(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),m4=(e,t,i)=>(m0(e,t,"access private method"),i);let m5=lQ.createElement("template");m5.innerHTML=` 1515 <style> 1516 :host { 1517 font: var(--media-font, 1518 var(--media-font-weight, normal) 1519 var(--media-font-size, 15px) / 1520 var(--media-text-content-height, var(--media-control-height, 24px)) 1521 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 1522 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 1523 display: inline-flex; 1524 position: relative; 1525 flex-shrink: .5; 1526 } 1527 1528 [name=listbox]::slotted(*), 1529 [part=listbox] { 1530 position: absolute; 1531 bottom: 100%; 1532 max-height: 300px; 1533 transition: var(--media-selectmenu-transition-in, 1534 visibility 0s, transform .15s ease-out, opacity .15s ease-out); 1535 transform: var(--media-listbox-transform-in, translateY(0) scale(1)); 1536 visibility: visible; 1537 opacity: 1; 1538 } 1539 1540 [name=listbox][hidden]::slotted(*), 1541 [hidden] [part=listbox] { 1542 transition: var(--media-selectmenu-transition-out, 1543 visibility .15s ease-out, transform .15s ease-out, opacity .15s ease-out); 1544 transform: var(--media-listbox-transform-out, translateY(2px) scale(.99)); 1545 visibility: hidden; 1546 opacity: 0; 1547 pointer-events: none; 1548 } 1549 1550 slot[name=listbox][hidden] { 1551 display: block; 1552 } 1553 </style> 1554 1555 <slot name="button"> 1556 <media-chrome-button aria-haspopup="listbox" part="button"> 1557 <slot name="button-content"></slot> 1558 </media-chrome-button> 1559 </slot> 1560 <slot name="listbox" hidden> 1561 <media-chrome-listbox id="listbox" part="listbox"> 1562 <slot></slot> 1563 </media-chrome-listbox> 1564 </slot> 1565`;class m8 extends lX.HTMLElement{constructor(){var e;super(),m2(this,Ey),m2(this,EA),m2(this,Ek),m2(this,Eh,void 0),m2(this,Eu,void 0),m2(this,Ec,void 0),m2(this,Em,void 0),m2(this,Ep,void 0),m2(this,Ef,e=>{let{key:t}=e;this.keysUsed.includes(t)?e.composedPath().includes(m1(this,Eu))&&("Enter"===t||" "===t)?m4(this,Ey,ET).call(this):"Escape"===t&&m4(this,Ek,ES).call(this):this.removeEventListener("keyup",m1(this,Ef))}),m2(this,Eg,e=>{let{metaKey:t,altKey:i,key:r}=e;t||i||!this.keysUsed.includes(r)?this.removeEventListener("keyup",m1(this,Ef)):(e.preventDefault(),this.addEventListener("keyup",m1(this,Ef),{once:!0}))}),m2(this,Ev,e=>{e.composedPath().includes(this)||m4(this,Ek,ES).call(this)}),m2(this,EE,e=>{e.composedPath().includes(m1(this,Eu))&&m4(this,Ey,ET).call(this)}),m2(this,Eb,()=>{m4(this,Ek,ES).call(this)}),m2(this,Ew,()=>{if(0===m1(this,Em).offsetWidth)return;let e=m1(this,Em).offsetWidth,t=m1(this,Eu).getBoundingClientRect();if(this.hasAttribute("mediacontroller")||m1(this,Eu).hasAttribute("mediacontroller")||m1(this,Em).hasAttribute("mediacontroller")){m
15651(this,Em).style.zIndex="1",m1(this,Em).style.bottom="unset",m1(this,Em).style.right=null,m1(this,Em).style.left="0",m1(this,Em).style.top=`${t.height}px`;return}let i=m9(this).getBoundingClientRect(),r=t.x+e,a=Math.max(t.right-r,t.right-i.right);m1(this,Em).style.left=null,m1(this,Em).style.right=`${a}px`,m1(this,Em).style.maxHeight=`${i.height-t.height}px`}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(m5.content.cloneNode(!0))),null==(e=this.init)||e.call(this),m3(this,Eu,this.shadowRoot.querySelector("[part=button]")),m3(this,Em,this.shadowRoot.querySelector("[part=listbox]")),m3(this,Ec,this.shadowRoot.querySelector("slot[name=button]")),m1(this,Ec).addEventListener("slotchange",()=>{let e=m1(this,Ec).assignedElements()[0];e&&(m3(this,Eu,e),m1(this,Eu).preventClick=!0,this.hasAttribute("disabled")||m1(this,Eu).hasAttribute("disabled")?this.disable():(this.enable(),m1(this,Eu).setAttribute("aria-haspopup","listbox")))}),m3(this,Ep,this.shadowRoot.querySelector("slot[name=listbox]")),m1(this,Ep).addEventListener("slotchange",()=>{m3(this,Em,m1(this,Ep).assignedElements()[0]||m1(this,Em))})}static get observedAttributes(){return["disabled",lv.MEDIA_CONTROLLER]}enable(){m1(this,Eu).toggleAttribute("disabled",!1),this.addEventListener("change",m1(this,Eb)),this.addEventListener("keydown",m1(this,Eg)),this.addEventListener("click",m1(this,EE)),lQ.addEventListener("click",m1(this,Ev))}disable(){m1(this,Eu).toggleAttribute("disabled",!0),this.removeEventListener("change",m1(this,Eb)),this.removeEventListener("keydown",m1(this,Eg)),this.removeEventListener("keyup",m1(this,Ef)),this.removeEventListener("click",m1(this,EE)),lQ.removeEventListener("click",m1(this,Ev))}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===lv.MEDIA_CONTROLLER?(t&&(null==(a=null==(r=m1(this,Eh))?void 0:r.unassociateElement)||a.call(r,this),m3(this,Eh,null),m1(this,Em).removeAttribute(lv.MEDIA_CONTROLLER)),i&&this.isConnected&&(m3(this,Eh,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=m1(this,Eh))?void 0:n.associateElement)||o.call(n,this),m1(this,Em).setAttribute(lv.MEDIA_CONTROLLER,i))):"disabled"===e&&i!==t&&(null==i?this.enable():this.disable())}connectedCallback(){var e,t,i;let{style:r}=di(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);let a=this.getAttribute(lv.MEDIA_CONTROLLER);a&&(m3(this,Eh,null==(e=this.getRootNode())?void 0:e.getElementById(a)),null==(i=null==(t=m1(this,Eh))?void 0:t.associateElement)||i.call(t,this),m1(this,Em).setAttribute(lv.MEDIA_CONTROLLER,a)),this.hasAttribute("disabled")||this.enable(),m1(this,Ep).hidden||l1(m9(this),m1(this,Ew))}disconnectedCallback(){var e,t;l2(m9(this),m1(this,Ew)),this.disable(),null==(t=null==(e=m1(this,Eh))?void 0:e.unassociateElement)||t.call(e,this),m3(this,Eh,null),m1(this,Em).removeAttribute(lv.MEDIA_CONTROLLER)}get keysUsed(){return["Enter","Escape"," ","ArrowUp","ArrowDown","f","c","k","m"]}}function m9(e){var t,i,r;let a;return null!=(t=e.getAttribute("bounds")?l6(e,`#${e.getAttribute("bounds")}`):((a=(i=e).getAttribute(lv.MEDIA_CONTROLLER))?null==(r=i.getRootNode())?void 0:r.getElementById(a):l6(i,"media-controller"))||e.parentElement)?t:e}Eh=new WeakMap,Eu=new WeakMap,Ec=new WeakMap,Em=new WeakMap,Ep=new WeakMap,Ef=new WeakMap,Eg=new WeakMap,Ev=new WeakMap,EE=new WeakMap,Eb=new WeakMap,Ey=new WeakSet,ET=function(){m1(this,Ep).hidden?m4(this,EA,E_).call(this):m4(this,Ek,ES).call(this)},EA=new WeakSet,E_=function(){m1(this,Ep).hidden&&(m1(this,Ep).hidden=!1,m1(this,Eu).setAttribute("aria-expanded","true"),m1(this,Ew).call(this),m1(this,Em).focus(),l1(m9(this),m1(this,Ew)))},Ek=new WeakSet,ES=function(){if(m1(this,Ep).hidden)return;l2(m9(this),m1(this,Ew));let e=l7();m1(this,Ep).hidden=!0,m1(this,Eu).setAttribute("aria-expanded","false"),l9(m1(this,Em),e)&&m1(this,Eu).focus()},Ew=new WeakMap,lX.customElements.get("media-chrome-selectmenu")||lX.customElements.define("media-chrome-selectmenu",m8);var m6=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},m7=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},pe=(e,t,i)=>(m6(e,t,"access private method"),i);let pt=` 1566<svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator"> 1567 <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79
15670 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/> 1568</svg>`,pi=lQ.createElement("template");pi.innerHTML=` 1569 <slot name="captions-indicator" hidden>${pt}</slot> 1570`,EL=new WeakMap,ER=new WeakSet,EI=function(){var e,t;if(m6(this,EL,"read from private field"),EL.get(this)===JSON.stringify(this.mediaSubtitlesList))return;t=JSON.stringify(this.mediaSubtitlesList),m6(this,EL,"write to private field"),EL.set(this,t);let i=this.shadowRoot.querySelector("#container");i.textContent="";let r=!this.value,a=m$(this.formatOptionText("Off"),"off",r);for(let t of(a.prepend(mH(this,"select-indicator")),i.append(a),this.mediaSubtitlesList)){let r=m$(this.formatOptionText(t.label,t),dB(t),this.value==dB(t));r.prepend(mH(this,"select-indicator")),"captions"===(null!=(e=t.kind)?e:"subs")&&r.append(mH(this,"captions-indicator")),i.append(r)}},EC=new WeakSet,ED=function(){let e=this.mediaSubtitlesShowing,t=this.getAttribute(ly.MEDIA_SUBTITLES_SHOWING),i=this.value!==t;if((null==e?void 0:e.length)&&i&&this.dispatchEvent(new lX.CustomEvent(lg.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:e})),!this.value||!i)return;let r=new lX.CustomEvent(lg.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(r)};let pr=(e,t)=>{let i=e.getAttribute(t);return i?dU(i):[]},pa=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);let r=d$(i);e.getAttribute(t)!==r&&e.setAttribute(t,r)};lX.customElements.get("media-captions-listbox")||lX.customElements.define("media-captions-listbox",class extends mG{constructor(){super({slotTemplate:pi}),m7(this,ER),m7(this,EC),m7(this,EL,void 0)}static get observedAttributes(){return[...super.observedAttributes,"aria-multiselectable",ly.MEDIA_SUBTITLES_LIST,ly.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_SUBTITLES_LIST&&t!==i?pe(this,ER,EI).call(this):e===ly.MEDIA_SUBTITLES_SHOWING&&t!==i?this.value=i:"aria-multiselectable"===e&&(this.removeAttribute("aria-multiselectable"),console.warn("Captions List doesn't currently support multiple selections. You can enable multiple items via the media.textTracks API."))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",pe(this,EC,ED))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",pe(this,EC,ED))}get mediaSubtitlesList(){return pr(this,ly.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){pa(this,ly.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return pr(this,ly.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){pa(this,ly.MEDIA_SUBTITLES_SHOWING,e)}}),lX.customElements.get("media-captions-selectmenu")||lX.customElements.define("media-captions-selectmenu",class extends m8{init(){let e=lQ.createElement("media-captions-button");e.part.add("button"),e.preventClick=!0;let t=lQ.createElement("media-captions-listbox");t.part.add("listbox"),t.setAttribute("exportparts","option, option-selected, indicator");let i=this.shadowRoot.querySelector("slot[name=button]"),r=this.shadowRoot.querySelector("slot[name=listbox]");i.textContent="",r.textContent="",i.append(e),r.append(t)}});var ps=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pn=(e,t,i)=>(ps(e,t,"read from private field"),i?i.call(e):t.get(e)),po=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},pl=(e,t,i)=>(ps(e,t,"access private method"),i);let pd="rates";Ex=new WeakMap,EM=new WeakSet,EO=function(){let e=this.shadowRoot.querySelector("#container");for(let t of(e.textContent="",this.rates)){let i=m$(this.formatOptionText(`${t}x`,t),t,this.mediaPlaybackRate==t);i.prepend(mH(this,"select-indicator")),e.append(i)}}
1570,EP=new WeakSet,EN=function(){if(!this.value)return;let e=new lX.CustomEvent(lg.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},lX.customElements.get("media-playback-rate-listbox")||lX.customElements.define("media-playback-rate-listbox",class extends mG{constructor(){super(),po(this,EM),po(this,EP),po(this,Ex,new dP(this,pd,{defaultValue:cO})),pl(this,EM,EO).call(this)}static get observedAttributes(){return[...super.observedAttributes,"aria-multiselectable",ly.MEDIA_PLAYBACK_RATE,pd]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_PLAYBACK_RATE&&t!=i?this.value=i:e===pd&&t!=i&&(pn(this,Ex).value=i,pl(this,EM,EO).call(this))}get rates(){return pn(this,Ex)}set rates(e){e?Array.isArray(e)&&(pn(this,Ex).value=e.join(" ")):pn(this,Ex).value="",pl(this,EM,EO).call(this)}get mediaPlaybackRate(){return da(this,ly.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){ds(this,ly.MEDIA_PLAYBACK_RATE,e)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",pl(this,EP,EN))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",pl(this,EP,EN))}}),lX.customElements.get("media-playback-rate-selectmenu")||lX.customElements.define("media-playback-rate-selectmenu",class extends m8{init(){let e=lQ.createElement("media-playback-rate-button");e.part.add("button"),e.preventClick=!0;let t=lQ.createElement("media-playback-rate-listbox");t.part.add("listbox"),t.setAttribute("exportparts","option, option-selected, indicator");let i=this.shadowRoot.querySelector("slot[name=button]"),r=this.shadowRoot.querySelector("slot[name=listbox]");i.textContent="",r.textContent="",i.append(e),r.append(t)}});var ph=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pu=(e,t,i)=>(ph(e,t,"read from private field"),i?i.call(e):t.get(e)),pc=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},pm=(e,t,i,r)=>(ph(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),pp=(e,t,i)=>(ph(e,t,"access private method"),i);EU=new WeakMap,EF=new WeakMap,EB=new WeakSet,E$=function(){if(pu(this,EF)===JSON.stringify(this.mediaRenditionList))return;pm(this,EF,JSON.stringify(this.mediaRenditionList));let e=this.mediaRenditionList.sort((e,t)=>t.height-e.height),t=this.shadowRoot.querySelector("#container");t.textContent="";let i=!this.mediaRenditionSelected;for(let r of e){let e=m$(this.formatOptionText(`${Math.min(r.width,r.height)}p`,r),`${r.id}`,r.selected&&!i);e.prepend(mH(this,"select-indicator")),t.append(e)}let r=m$(this.formatOptionText("Auto"),"auto",i);r.prepend(mH(this,"select-indicator")),t.append(r)},EH=new WeakSet,EW=function(){if(null==this.value)return;let e=new lX.CustomEvent(lg.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},lX.customElements.get("media-rendition-listbox")||lX.customElements.define("media-rendition-listbox",class extends mG{constructor(){super(...arguments),pc(this,EB),pc(this,EH),pc(this,EU,[]),pc(this,EF,void 0)}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_RENDITION_LIST,ly.MEDIA_RENDITION_SELECTED]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_RENDITION_SELECTED&&t!==i?this.value=null!=i?i:"auto":e===ly.MEDIA_RENDITION_LIST&&t!==i&&(pm(this,EU,lx(i)),pp(this,EB,E$).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",pp(this,EH,EW))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",pp(this,EH,EW))}get mediaRenditionList(){return pu(this,EU)}set mediaRenditionList(e){pm(this,EU,e),pp(this,EB,E$).call(this)}get mediaRenditionSelected(){return dd(this,ly.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){dh(this,ly.MEDIA_RENDITION_SELECTED,e)}});let pf=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1571 <path d="M13.5 2.5h2v6h-2v-2h-11v-2h11v-2Zm4 2h4v2h-4v-2Zm-12 4h2v6h-2v-2h-3v-2h3v-2Zm4 2h12v2h-12v-2Zm1 4h2v6h-2v-2h-8v-2h8v-2Zm4 2h7v2h-7v-2Z" /> 1572</svg>`,pg=lQ.createElement("template");pg.innerHTML=` 1573 <slot name="icon">${pf}</slot> 1574`,lX.customElements.get("media-rendition-button")||lX.customElements.define("media-rendition-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_RENDITION_SELECTED,ly.MEDIA_RENDITION_UNAVAILABLE]}constructor(){super({slotTemplate:pg})}get mediaRenditionSelected(){return dd(this,ly.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){dh(this,ly.MEDIA_RENDITION_SELECTED,e)}}),lX.customElements.get("media-rendition-selectmenu")||lX.customElements.define("media-rendition-selectmenu",class extends m8{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_RENDITION_SELECTED,ly.MEDIA_RENDITION_UNAVAILABLE]}init(){let e=lQ.createElement("media-rendition-button");e.part.add("button"),e.preventClick=!0;let t=lQ.createElement("media-rendition-listbox");t.part.add("listbox"),t.setAttribute("exportparts","option, option-selected, indicator");let i=this.shadowRoot.querySelector("slot[name=button]"),r=this.shadowRoot.querySelector("slot[name=listbox]");i.textContent="",r.textContent="",i.append(e),r.append(t)}});var pv=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pE=(e,t,i)=>(pv(e,t,"read from private field"),i?i.call(e):t.get(e)),pb=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},py=(e,t,i,r)=>(pv(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),pT=(e,t,i)=>(pv(e,t,"access private method"),i);EG=new WeakMap,EV=new WeakMap,EK=new WeakSet,Eq=function(){if(pE(this,EV)===JSON.stringify(this.mediaAudioTrackList))return;py(this,EV,JSON.stringify(this.mediaAudioTrackList));let e=this.mediaAudioTrackList,t=this.shadowRoot.querySelector("#container");for(let i of(t.textContent="",e)){let e=m$(this.formatOptionText(i.label,i),`${i.id}`,i.enabled);
1574e.prepend(mH(this,"select-indicator")),t.append(e)}},Ej=new WeakSet,EY=function(){if(null==this.value)return;let e=new lX.CustomEvent(lg.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},lX.customElements.get("media-audio-track-listbox")||lX.customElements.define("media-audio-track-listbox",class extends mG{constructor(){super(...arguments),pb(this,EK),pb(this,Ej),pb(this,EG,[]),pb(this,EV,void 0)}static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_AUDIO_TRACK_LIST,ly.MEDIA_AUDIO_TRACK_ENABLED]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===ly.MEDIA_AUDIO_TRACK_ENABLED&&t!==i?this.value=i:e===ly.MEDIA_AUDIO_TRACK_LIST&&t!==i&&(py(this,EG,lP(i)),pT(this,EK,Eq).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",pT(this,Ej,EY))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",pT(this,Ej,EY))}get mediaAudioTrackList(){return pE(this,EG)}set mediaAudioTrackList(e){py(this,EG,e),pT(this,EK,Eq).call(this)}get mediaAudioTrackEnabled(){return dd(this,ly.MEDIA_AUDIO_TRACK_ENABLED)}set mediaAudioTrackEnabled(e){dh(this,ly.MEDIA_AUDIO_TRACK_ENABLED,e)}});let pA=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1575 <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/> 1576 <path d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"/> 1577</svg>`,p_=lQ.createElement("template");p_.innerHTML=` 1578 <slot name="icon">${pA}</slot> 1579`,lX.customElements.get("media-audio-track-button")||lX.customElements.define("media-audio-track-button",class extends hN{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_AUDIO_TRACK_ENABLED,ly.MEDIA_AUDIO_TRACK_UNAVAILABLE]}constructor(){super({slotTemplate:p_})}get mediaAudioTrackEnabled(){return dd(this,ly.MEDIA_AUDIO_TRACK_ENABLED)}set mediaAudioTrackEnabled(e){dh(this,ly.MEDIA_AUDIO_TRACK_ENABLED,e)}}),lX.customElements.get("media-audio-track-selectmenu")||lX.customElements.define("media-audio-track-selectmenu",class extends m8{static get observedAttributes(){return[...super.observedAttributes,ly.MEDIA_AUDIO_TRACK_ENABLED,ly.MEDIA_AUDIO_TRACK_UNAVAILABLE]}init(){let e=lQ.createElement("media-audio-track-button");e.part.add("button"),e.preventClick=!0;let t=lQ.createElement("media-audio-track-listbox");t.part.add("listbox"),t.setAttribute("exportparts","option, option-selected, indicator");let i=this.shadowRoot.querySelector("slot[name=button]"),r=this.shadowRoot.querySelector("slot[name=listbox]");i.textContent="",r.textContent="",i.append(e),r.append(t)}});var pk=Object.defineProperty,pS=Object.getPrototypeOf,pw=Reflect.get,pL=(e,t,i)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?pk(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i,i},pR=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pI=(e,t,i)=>(pR(e,t,"read from private field"),i?i.call(e):t.get(e)),pC=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},pD=(e,t,i,r)=>(pR(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),px=(e,t,i)=>(pR(e,t,"access private method"),i),pM=(e,t,i)=>pw(pS(e),i,t),pO=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};"u"<typeof DocumentFragment&&(globalThis.DocumentFragment=class extends pO{});var pP,pN,pU,pF,pB,p$,pH,pW,pG,pV,pK,pq,pj,pY,pz,pX,pQ,pZ,pJ,p0,p1,p2,p3,p4,p5,p8,p9,p6,p7,fe,ft,fi,fr,fa,fs,fn,fo,fl,fd,fh,fu,fc,fm,fp,ff,fg,fv,fE,fb,fy,fT,fA,f_,fk,fS,fw,fL,fR,fI,fC,fD,fx,fM,fO,fP,fN,fU,fF,fB,f$,fH,fW,fG,fV,fK,fq,fj,fY,fz,fX,fQ,fZ,fJ,f0,f1,f2,f3,f4,f5,f8,f9,f6,f7,ge,gt,gi,gr,ga,gs,gn,go,gl,gd,gh,gu,gc,gm,gp,gf,gg,gv,gE,gb,gy,gT,gA,g_,gk,gS,gw,gL,gR,gI,gC,gD,gx,gM,gO,gP,gN,gU,gF,gB,g$,gH,gW,gG,gV,gK,gq,gj,gY,gz,gX,gQ,gZ,gJ,g0,g1,g2,g3,g4,g5,g8,g9,g6,g7,ve,vt,vi,vr,va,vs,vn,vo,vl,vd,vh,vu,vc,vm,vp,vf,vg,vv,vE,vb,vy,vT,vA,v_,vk,vS,vw,vL,vR,vI,vC,vD,vx,vM,vO,vP,vN,vU,vF,vB,v$,vH,vW,vG,vV,vK,vq,vj,vY,vz,vX,vQ,vZ,vJ,v0,v1,v2,v3,v4,v5,v8,v9,v6,v7,Ee,Et,Ei,Er,Ea,Es,En,Eo,El,Ed,Eh,Eu,Ec,Em,Ep,Ef,Eg,Ev,EE,Eb,Ey,ET,EA,E_,Ek,ES,Ew,EL,ER,EI,EC,ED,Ex,EM,EO,EP,EN,EU,EF,EB,E$,EH,EW,EG,EV,EK,Eq,Ej,EY,Ez,EX=class extends pO{},EQ=class{constructor(e,t={}){pC(this,Ez,void 0),pD(this,Ez,null==t?void 0:t.detail)}get detail(){return pI(this,Ez)}initCustomEvent(){}};Ez=new WeakMap;var EZ={document:{createElement:function(e,t){return new EX}},DocumentFragment,customElements:{get(e){},define(e,t,i){},upgrade(e){},whenDefined:e=>Promise.resolve(EX)},CustomEvent:EQ,EventTarget:pO,HTMLElement:EX,HTMLVideoElement:class extends pO{}},EJ="u"<typeof window||void 0===globalThis.customElements,E0=EJ?EZ:globalThis;EJ&&EZ.document;var E1=(()=>{try{return"0.20.2"}catch{}return"UNKNOWN"})(),E2=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"];function E3(e){return` 1580 <style> 1581 :host { 1582 display: inline-flex; 1583 line-height: 0; 1584 flex-direction: column; 1585 justify-content: end; 1586 } 1587 1588 audio { 1589 width: 100%; 1590 } 1591 </style> 1592 <slot name="media"> 1593 <audio${E8(e)}></audio> 1594 </slot> 1595 <slot></slot> 1596 `}function E4(e){return` 1597 <style> 1598 :host { 1599 display: inline-block; 1600 line-height: 0; 1601 } 1602 1603 video { 1604 max-width: 100%; 1605 max-height: 100%; 1606 min-width: 100%; 1607 min-height: 100%; 1608 object-fit: var(--media-object-fit, contain); 1609 object-position: var(--media-object-position, 50% 50%); 1610 } 1611 1612 video::-webkit-media-text-track-container { 1613 transform: var(--media-webkit-text-track-transform); 1614 transition: var(--media-webkit-text-track-transition); 1615 } 1616 </style> 1617 <slot name="media"> 1618 <video${E8(e)}></video> 1619 </slot> 1620 <slot></slot> 1621 `}var E5=(e,{tag:t,is:i})=>{var r,a,s,n,o,l,d,h,u,c,m,p,f,g,v,E,b;let y=null==(a=null==(r=globalThis.document)?void 0:r.createElement)?void 0:a.call(r,t,{is:i}),T=y?function(e){let t=[];for(let i=Object.getPrototypeOf(e);i&&i!==HTMLElement.prototype;i=Object.getPrototypeOf(i))t.push(...Object.getOwnPropertyNames(i));return t}(y):[];return s=class extends e{constructor(){super(),pC(this,c),pC(this,p),pC(this,g),pC(this,E),pC(this,d,void 0),pC(this,h,void 0),pC(this,u,new Map)}static get observedAttributes(){var e,t,i;return px(e=s,o,l).call(e),[...null!=(i=null==(t=null==y?void 0:y.constructor)?void 0:t.observedAttributes)?i:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var e,i,r;return px(this,c,m).call(this),null!=(r=null!=(i=null!=(e=pI(this,h))?e:this.shadowRoot.querySelector(t))?i:this.querySelector(":scope > [slot=media]"))?r:this.querySelector(t)}set nativeEl(e){pD(this,h,e)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(e){this.toggleAttribute("muted",!!e)}get src(){return this.getAttribute("src")}set src(e){this.setAttribute("src",`${e}`)}get preload(){var e,t;return null!=(t=this.getAttribute("preload"))?t:null==(e=this.nativeEl)?void 0:e.preload}set preload(e){this.setAttribute("preload",`${e}`)}init(){var e,r;if(!this.shadowRoot){this.attachShadow({mode:"open"});let e=function(e){let t={};for(let i of e)t[i.name]=i.value;return t}(this.attributes);i&&(e.is=i),t&&(e.part=t),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}for(let e of(this.nativeEl.muted=this.hasAttribute("muted"),T))px(this,g,v).call(this,e);for(let t of(this.shadowRoot.addEventListener("slotchange",this),px(this,p,f).call(this),this.constructor.Events))null==(r=(e=this.shadowRoot).addEventListener)||r.call(e,t,this,!0)}handleEvent(e){"slotchange"===e.type?px(this,p,f).call(this):e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))}attributeChangedCallback(e,t,i){px(this,c,m).call(this),px(this,E,b).call(this,e,t,i)}connectedCallback(){px(this,c,m).call(this)}},n=new WeakMap,o=new WeakSet,l=function(){if(pI(this,n))return;pD(this,n,!0);let e=new Set(this.observedAttributes);for(let t of(e.delete("muted"),T))if(!(t in this.prototype))if("function"==typeof y[t])this.prototype[t]=function(...e){return px(this,c,m).call(this),this.call?this.call(t,...e):this.nativeEl[t].apply(this.nativeEl,e)};else{let i={get(){var i,r,a;px(this,c,m).call(this);let s=t.toLowerCase();if(e.has(s)){let e=this.getAttribute(s);return null!==e&&(""===e||e)}return null!=(a=null==(i=this.get)?void 0:i.call(this,t))?a:null==(r=this.nativeEl)?void 0:r[t]}};t!==t.toUpperCase()&&(i.set=function(i){px(this,c,m).call(this);let r=t.toLowerCase();e.has(r)?!0===i||!1===i||null==i?this.toggleAttribute(r,!!i):this.setAttribute(r,i):this.set?this.set(t,i):this.nativeEl[t]=i}),Object.defineProperty(this.prototype,t,i)}},d=new WeakMap,h=new WeakMap,u=new WeakMap,c=new WeakSet,m=function(){pI(this,d)||(pD(this,d,!0),this.init())},p=new WeakSet,f=function(){let e=new Map(pI(this,u));this.shadowRoot.querySelector("slot:not([name])").assignedElements({flatten:!0}).filter(e=>
1621["track","source"].includes(e.localName)).forEach(t=>{var i,r;e.delete(t);let a=pI(this,u).get(t);a||(a=t.cloneNode(),pI(this,u).set(t,a)),null==(r=(i=this.nativeEl).append)||r.call(i,a),"track"===a.localName&&a.default&&("chapters"===a.kind||"metadata"===a.kind)&&"disabled"===a.track.mode&&(a.track.mode="hidden")}),e.forEach(e=>e.remove())},g=new WeakSet,v=function(e){if(Object.prototype.hasOwnProperty.call(this,e)){let t=this[e];delete this[e],this[e]=t}},E=new WeakSet,b=function(e,t,i){var r,a,n,o,l,d;["id","class"].includes(e)||!s.observedAttributes.includes(e)&&this.constructor.observedAttributes.includes(e)||(null===i?null==(a=(r=this.nativeEl).removeAttribute)||a.call(r,e):(null==(o=(n=this.nativeEl).getAttribute)?void 0:o.call(n,e))!=i&&(null==(d=(l=this.nativeEl).setAttribute)||d.call(l,e,i)))},pC(s,o),pL(s,"getTemplateHTML",t.endsWith("audio")?E3:E4),pL(s,"shadowRootOptions",{mode:"open"}),pL(s,"Events",E2),pC(s,n,void 0),s};function E8(e){let t="";for(let i in e){let r=e[i];""===r?t+=` ${i}`:t+=` ${i}="${r}"`}return t}var E9,E6,E7=E5(null!=(E9=globalThis.HTMLElement)?E9:class{},{tag:"video"});E5(null!=(E6=globalThis.HTMLElement)?E6:class{},{tag:"audio"});var be=new WeakMap,bt=class extends Error{},bi=class extends Error{};function br(){var e,t;return null==(t=null==(e=globalThis.cast)?void 0:e.framework)?void 0:t.CastContext.getInstance()}function ba(){var e;return null==(e=br())?void 0:e.getCurrentSession()}function bs(){var e;return null==(e=ba())?void 0:e.getSessionObj().media[0]}function bn(e){return br().setOptions({...bo(),...e})}function bo(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}var bl,bd=new(globalThis.WeakRef?class extends Set{add(e){super.add(new WeakRef(e))}forEach(e){super.forEach(t=>{let i=t.deref();i&&e(i)})}}:Set),bh=new WeakSet;bu=()=>{var e,t,i,r;null!=(t=null==(e=globalThis.chrome)?void 0:e.cast)&&t.isAvailable?bl||(bl=cast.framework,br().addEventListener(bl.CastContextEventType.CAST_STATE_CHANGED,e=>{bd.forEach(t=>{var i,r;return null==(r=(i=be.get(t)).onCastStateChanged)?void 0:r.call(i,e)})}),br().addEventListener(bl.CastContextEventType.SESSION_STATE_CHANGED,e=>{bd.forEach(t=>{var i,r;return null==(r=(i=be.get(t)).onSessionStateChanged)?void 0:r.call(i,e)})}),bd.forEach(e=>{var t,i;return null==(i=(t=be.get(e)).init)?void 0:i.call(t)})):console.debug("chrome.cast.isAvailable",null==(r=null==(i=globalThis.chrome)?void 0:i.cast)?void 0:r.isAvailable)},null!=(bm=null==(bc=globalThis.chrome)?void 0:bc.cast)&&bm.isAvailable?null!=(bp=globalThis.cast)&&bp.framework?bu():customElements.whenDefined("google-cast-button").then(bu):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(bu)};var bu,bc,bm,bp,bf,bg,bv,bE,bb,by,bT,bA,b_,bk,bS,bw,bL,bR,bI,bC,bD,bx,bM,bO,bP,bN,bU=0,bF=class extends EventTarget{constructor(e){super(),pC(this,b_),pC(this,bS),pC(this,bL),pC(this,bI),pC(this,bD),pC(this,bM),pC(this,bP),pC(this,bf,void 0),pC(this,bg,void 0),pC(this,bv,void 0),pC(this,bE,void 0),pC(this,bb,"disconnected"),pC(this,by,!1),pC(this,bT,new Set),pC(this,bA,new WeakMap),pD(this,bf,e),bd.add(this),be.set(this,{init:()=>px(this,bD,bx).call(this),onCastStateChanged:()=>px(this,bL,bR).call(this),onSessionStateChanged:()=>px(this,bI,bC).call(this),getCastPlayer:()=>pI(this,b_,bk)}),px(this,bD,bx).call(this)}get state(){return pI(this,bb)}async watchAvailability(e){if(pI(this,bf).disableRemotePlayback)throw new bt("disableRemotePlayback attribute is present.");return pI(this,bA).set(e,++bU),pI(this,bT).add(e),bU}async cancelWatchAvailability(e){if(pI(this,bf).disableRemotePlayback)throw new bt("disableRemotePlayback attribute is present.");e?pI(this,bT).delete(e):pI(this,bT).clear()}async prompt(){var e,t,i,r;if(pI(this,bf).disableRemotePlayback)throw new bt("disableRemotePlayback attribute is present.");if(!(null!=(t=null==(e=globalThis.chrome)?void 0:e.cast)&&t.isAvailable))throw new bi("The RemotePlayback API is disabled on this platform.");let a=bh.has(pI(this,bf));bh.add(pI(this,bf)),bn(pI(this,bf).castOptions),Object.entries(pI(this,bE)).forEac
1621h(([e,t])=>{pI(this,bv).controller.addEventListener(e,t)});try{await br().requestSession()}catch(e){if("cancel"===e){a||bh.delete(pI(this,bf));return}throw Error(e)}null==(r=null==(i=be.get(pI(this,bf)))?void 0:i.loadOnPrompt)||r.call(i)}};bf=new WeakMap,bg=new WeakMap,bv=new WeakMap,bE=new WeakMap,bb=new WeakMap,by=new WeakMap,bT=new WeakMap,bA=new WeakMap,b_=new WeakSet,bk=function(){if(bh.has(pI(this,bf)))return pI(this,bv)},bS=new WeakSet,bw=function(){bh.has(pI(this,bf))&&(Object.entries(pI(this,bE)).forEach(([e,t])=>{pI(this,bv).controller.removeEventListener(e,t)}),bh.delete(pI(this,bf)),pI(this,bf).muted=pI(this,bv).isMuted,pI(this,bf).currentTime=pI(this,bv).savedPlayerState.currentTime,!1===pI(this,bv).savedPlayerState.isPaused&&pI(this,bf).play())},bL=new WeakSet,bR=function(){let e=br().getCastState();if(bh.has(pI(this,bf))&&"CONNECTING"===e&&(pD(this,bb,"connecting"),this.dispatchEvent(new Event("connecting"))),!pI(this,by)&&null!=e&&e.includes("CONNECT"))for(let e of(pD(this,by,!0),pI(this,bT)))e(!0);else if(pI(this,by)&&(!e||"NO_DEVICES_AVAILABLE"===e))for(let e of(pD(this,by,!1),pI(this,bT)))e(!1)},bI=new WeakSet,bC=async function(){var e,t;let{SESSION_RESUMED:i}=bl.SessionState;if(br().getSessionState()===i&&pI(this,bf).castSrc===(null==(e=bs())?void 0:e.media.contentId)){bh.add(pI(this,bf)),Object.entries(pI(this,bE)).forEach(([e,t])=>{pI(this,bv).controller.addEventListener(e,t)});try{await (t=new chrome.cast.media.GetStatusRequest,new Promise((e,i)=>{bs().getStatus(t,e,i)}))}catch(e){console.error(e)}pI(this,bE)[bl.RemotePlayerEventType.IS_PAUSED_CHANGED](),pI(this,bE)[bl.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},bD=new WeakSet,bx=function(){!bl||pI(this,bg)||(pD(this,bg,!0),bn(pI(this,bf).castOptions),pI(this,bf).textTracks.addEventListener("change",()=>px(this,bP,bN).call(this)),px(this,bL,bR).call(this),pD(this,bv,new bl.RemotePlayer),new bl.RemotePlayerController(pI(this,bv)),pD(this,bE,{[bl.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:e})=>{!0===e?(pD(this,bb,"connected"),this.dispatchEvent(new Event("connect"))):(px(this,bS,bw).call(this),pD(this,bb,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[bl.RemotePlayerEventType.DURATION_CHANGED]:()=>{pI(this,bf).dispatchEvent(new Event("durationchange"))},[bl.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{pI(this,bf).dispatchEvent(new Event("volumechange"))},[bl.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{pI(this,bf).dispatchEvent(new Event("volumechange"))},[bl.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var e;null!=(e=pI(this,b_,bk))&&e.isMediaLoaded&&pI(this,bf).dispatchEvent(new Event("timeupdate"))},[bl.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{pI(this,bf).dispatchEvent(new Event("resize"))},[bl.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{pI(this,bf).dispatchEvent(new Event(this.paused?"pause":"play"))},[bl.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var e,t;(null==(e=pI(this,b_,bk))?void 0:e.playerState)!==chrome.cast.media.PlayerState.PAUSED&&pI(this,bf).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[null==(t=pI(this,b_,bk))?void 0:t.playerState]))},[bl.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{var e;null!=(e=pI(this,b_,bk))&&e.isMediaLoaded&&(await Promise.resolve(),px(this,bM,bO).call(this))}}))},bM=new WeakSet,bO=function(){px(this,bP,bN).call(this)},bP=new WeakSet,bN=async function(){var e,t,i,r,a;let s;if(!pI(this,b_,bk))return;let n=(null!=(t=null==(e=pI(this,bv).mediaInfo)?void 0:e.tracks)?t:[]).filter(({type:e})=>e===chrome.cast.media.TrackType.TEXT),o=[...pI(this,bf).textTracks].filter(({kind:e})=>"subtitles"===e||"captions"===e),l=n.map(({language:e,name:t,trackId:i})=>{var r;let{mode:a}=null!=(r=o.find(i=>i.language===e&&i.label===t))?r:{};return!!a&&{mode:a,trackId:i}}).filter(Boolean),d=l.filter(({mode:e})=>"showing"!==e).map(({trackId:e})=>e),h=l.find(({mode:e})=>"showing"===e),u=null!=(a=null==(r=null==(i=ba())?void 0:i.getSessionObj().media[0])?void 0:r.activeTrackIds)?a:[],c=u;if(u.length&&(c=c.filter(e=>!d.includes(e))),null!=h&&h.trackId&&(c=[...c,h.trackId]),c=[...new Set(c)],s=c,!(u.length===s.length&&u.every(e=>s.includes(e))))try{let e=new chrome.cast.media.EditTracksInfoRequest(c);await new Promise((t,i)=>{bs().editTracksInfo(e,t,i)})}catch(e){console.error(e)}};
1621var bB=e=>{var t,i,r,a,s,n,o,l,d;return i=class extends e{constructor(){super(...arguments),pC(this,n),pC(this,l),pC(this,r,{paused:!1}),pC(this,a,bo()),pC(this,s,void 0)}get remote(){return pI(this,s)?pI(this,s):globalThis.chrome?(function(){var e;let t="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if(null!=(e=globalThis.chrome)&&e.cast||document.querySelector(`script[src="${t}"]`))return;let i=document.createElement("script");i.src=t,document.head.append(i)}(),be.set(this,{loadOnPrompt:()=>px(this,l,d).call(this)}),pD(this,s,new bF(this))):super.remote}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"cast-receiver"===e&&i){pI(this,a).receiverApplicationId=i;return}if(pI(this,n,o))switch(e){case"cast-stream-type":case"cast-src":this.load()}}async load(){var e,t;if(!pI(this,n,o))return super.load();let i=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),a=[...this.querySelectorAll("track")].filter(({kind:e,src:t})=>t&&("subtitles"===e||"captions"===e)),s=[],l=0;a.length&&(i.tracks=a.map(e=>{let t=++l;0===s.length&&"showing"===e.track.mode&&s.push(t);let i=new chrome.cast.media.Track(t,chrome.cast.media.TrackType.TEXT);return i.trackContentId=e.src,i.trackContentType="text/vtt",i.subtype="captions"===e.kind?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,i.name=e.label,i.language=e.srclang,i})),"live"===this.castStreamType?i.streamType=chrome.cast.media.StreamType.LIVE:i.streamType=chrome.cast.media.StreamType.BUFFERED,i.metadata=new chrome.cast.media.GenericMediaMetadata,i.metadata.title=this.title,i.metadata.images=[{url:this.poster}];let d=new chrome.cast.media.LoadRequest(i);d.currentTime=null!=(e=super.currentTime)?e:0,d.autoplay=!pI(this,r).paused,d.activeTrackIds=s,await (null==(t=ba())?void 0:t.loadMedia(d)),this.dispatchEvent(new Event("volumechange"))}play(){var e;if(pI(this,n,o)){pI(this,n,o).isPaused&&(null==(e=pI(this,n,o).controller)||e.playOrPause());return}return super.play()}pause(){var e;if(pI(this,n,o)){pI(this,n,o).isPaused||null==(e=pI(this,n,o).controller)||e.playOrPause();return}super.pause()}get castOptions(){return pI(this,a)}get castReceiver(){var e;return null!=(e=this.getAttribute("cast-receiver"))?e:void 0}set castReceiver(e){this.castReceiver!=e&&this.setAttribute("cast-receiver",`${e}`)}get castSrc(){var e,t,i;return null!=(i=null!=(t=this.getAttribute("cast-src"))?t:null==(e=this.querySelector("source"))?void 0:e.src)?i:this.currentSrc}set castSrc(e){this.castSrc!=e&&this.setAttribute("cast-src",`${e}`)}get castContentType(){var e;return null!=(e=this.getAttribute("cast-content-type"))?e:void 0}set castContentType(e){this.setAttribute("cast-content-type",`${e}`)}get castStreamType(){var e,t;return null!=(t=null!=(e=this.getAttribute("cast-stream-type"))?e:this.streamType)?t:void 0}set castStreamType(e){this.setAttribute("cast-stream-type",`${e}`)}get readyState(){if(pI(this,n,o))switch(pI(this,n,o).playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return pI(this,n,o)?pI(this,n,o).isPaused:super.paused}get muted(){var e;return pI(this,n,o)?null==(e=pI(this,n,o))?void 0:e.isMuted:super.muted}set muted(e){var t;if(pI(this,n,o)){(e&&!pI(this,n,o).isMuted||!e&&pI(this,n,o).isMuted)&&(null==(t=pI(this,n,o).controller)||t.muteOrUnmute());return}super.muted=e}get volume(){var e,t;return pI(this,n,o)?null!=(t=null==(e=pI(this,n,o))?void 0:e.volumeLevel)?t:1:super.volume}set volume(e){var t;if(pI(this,n,o)){pI(this,n,o).volumeLevel=+e,null==(t=pI(this,n,o).controller)||t.setVolumeLevel();return}super.volume=e}get duration(){var e,t,i;return pI(this,n,o)&&null!=(e=pI(this,n,o))&&e.isMediaLoaded?null!=(i=null==(t=pI(this,n,o))?void 0:t.duration)?i:NaN:super.duration}get currentTime(){var e,t,i;return pI(this,n,o)&&null!=(e=pI(this,n,o))&&e.isMediaLoaded?null!=(i=null==(t=pI(this,n,o))?void 0:t.currentTime)?i:0:super.currentTime}set currentTime(e){var t;if(pI(this,n,o)){pI(this,n,o).currentTime=e,null==(t=pI(this,n,o).controller)||t.seek();return}super.currentTime=e}},r=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakSet,o=function(){var e,t;return null==(t=null==(e=be.get(this.remote))?void 0:e.getCastPlayer)?void 0:t.call(e)},l=new WeakSet,d=async function(){pI(this,r).paused=pM(i.prototype,this,"paused"),pM(i.prototype,this,"pause").call(this),this.muted=pM(i.prototype,this,"muted");try{await this.load()}catch(e){console.error(e)}},pL(i,"observedAttributes",[...null!=(t=e.observedAttributes)?t:[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),i}
1621,b$=class extends Event{constructor(e,t){super(e),pL(this,"track"),this.track=t.track}},bH=new WeakMap;function bW(e){var t,i,r;let a;return null!=(t=bH.get(e))?t:(i=e,r={},(a=bH.get(i))||bH.set(i,a={}),Object.assign(a,r))}function bG(e,t){let i=e.videoTracks;bW(t).media=e,bW(t).renditionSet||(bW(t).renditionSet=new Set);let r=bW(i).trackSet;r.add(t);let a=r.size-1;a in bX.prototype||Object.defineProperty(bX.prototype,a,{get(){return[...bW(this).trackSet][a]}}),queueMicrotask(()=>{i.dispatchEvent(new b$("addtrack",{track:t}))})}function bV(e){var t;let i=null==(t=bW(e).media)?void 0:t.videoTracks;i&&(bW(i).trackSet.delete(e),queueMicrotask(()=>{i.dispatchEvent(new b$("removetrack",{track:e}))}))}var bK,bq,bj,bY,bz,bX=class extends EventTarget{constructor(){super(),pC(this,bY),pC(this,bK,void 0),pC(this,bq,void 0),pC(this,bj,void 0),bW(this).trackSet=new Set}[Symbol.iterator](){return pI(this,bY,bz).values()}get length(){return pI(this,bY,bz).size}getTrackById(e){var t;return null!=(t=[...pI(this,bY,bz)].find(t=>t.id===e))?t:null}get selectedIndex(){return[...pI(this,bY,bz)].findIndex(e=>e.selected)}get onaddtrack(){return pI(this,bK)}set onaddtrack(e){pI(this,bK)&&(this.removeEventListener("addtrack",pI(this,bK)),pD(this,bK,void 0)),"function"==typeof e&&(pD(this,bK,e),this.addEventListener("addtrack",e))}get onremovetrack(){return pI(this,bq)}set onremovetrack(e){pI(this,bq)&&(this.removeEventListener("removetrack",pI(this,bq)),pD(this,bq,void 0)),"function"==typeof e&&(pD(this,bq,e),this.addEventListener("removetrack",e))}get onchange(){return pI(this,bj)}set onchange(e){pI(this,bj)&&(this.removeEventListener("change",pI(this,bj)),pD(this,bj,void 0)),"function"==typeof e&&(pD(this,bj,e),this.addEventListener("change",e))}};bK=new WeakMap,bq=new WeakMap,bj=new WeakMap,bY=new WeakSet,bz=function(){return bW(this).trackSet};var bQ=class extends Event{constructor(e,t){super(e),pL(this,"rendition"),this.rendition=t.rendition}};function bZ(e){return[...bW(e).media.videoTracks].filter(e=>e.selected).flatMap(e=>[...bW(e).renditionSet])}var bJ,b0,b1,b2=class extends EventTarget{constructor(){super(...arguments),pC(this,bJ,void 0),pC(this,b0,void 0),pC(this,b1,void 0)}[Symbol.iterator](){return bZ(this).values()}get length(){return bZ(this).length}getRenditionById(e){var t;return null!=(t=bZ(this).find(t=>`${t.id}`==`${e}`))?t:null}get selectedIndex(){return bZ(this).findIndex(e=>e.selected)}set selectedIndex(e){for(let[t,i]of bZ(this).entries())i.selected=t===e}get onaddrendition(){return pI(this,bJ)}set onaddrendition(e){pI(this,bJ)&&(this.removeEventListener("addrendition",pI(this,bJ)),pD(this,bJ,void 0)),"function"==typeof e&&(pD(this,bJ,e),this.addEventListener("addrendition",e))}get onremoverendition(){return pI(this,b0)}set onremoverendition(e){pI(this,b0)&&(this.removeEventListener("removerendition",pI(this,b0)),pD(this,b0,void 0)),"function"==typeof e&&(pD(this,b0,e),this.addEventListener("removerendition",e))}get onchange(){return pI(this,b1)}set onchange(e){pI(this,b1)&&(this.removeEventListener("change",pI(this,b1)),pD(this,b1,void 0)),"function"==typeof e&&(pD(this,b1,e),this.addEventListener("change",e))}};bJ=new WeakMap,b0=new WeakMap,b1=new WeakMap;var b3,b4=class{constructor(){pL(this,"src"),pL(this,"id"),pL(this,"width"),pL(this,"height"),pL(this,"bitrate"),pL(this,"frameRate"),pL(this,"codec"),pC(this,b3,!1)}get selected(){return pI(this,b3)}set selected(e){var t;let i;pI(this,b3)!==e&&(pD(this,b3,e),t=this,(i=bW(t).media.videoRenditions)&&!bW(i).changeRequested&&(bW(i).changeRequested=!0,queueMicrotask(()=>{delete bW(i).changeRequested,bW(t).track.selected&&i.dispatchEvent(new Event("change"))})))}};b3=new WeakMap;var b5,b8=class{constructor(){pL(this,"id"),pL(this,"kind"),pL(this,"label",""),pL(this,"language",""),pL(this,"sourceBuffer"),pC(this,b5,!1)}addRendition(e,t,i,r,a,s){var n;let o,l,d,h=new b4;return h.src=e,h.width=t,h.height=i,h.frameRate=s,h.bitrate=a,h.codec=r,n=this,o=bW(n).media.videoRenditions,bW(h).media=bW(n).media,bW(h).track=n,(l=bW(n).renditionSet).add(h),(d=l.size-1)in b2.prototype||Object.defineProperty(b2.prototype,d,{get(){return bZ(this)[d]}}),queueMicrotask(()=>{n.selected&&o.dispatchEvent(new bQ("addrendition",{rendition:h}
1621))}),h}removeRendition(e){let t,i;t=bW(e).media.videoRenditions,i=bW(e).track,bW(i).renditionSet.delete(e),queueMicrotask(()=>{bW(e).track.selected&&t.dispatchEvent(new bQ("removerendition",{rendition:e}))})}get selected(){return pI(this,b5)}set selected(e){pI(this,b5)!==e&&(pD(this,b5,e),!0===e&&function(e){var t;let i=null!=(t=bW(e).media.videoTracks)?t:[],r=!1;for(let t of i)t!==e&&(t.selected=!1,r=!0);if(r){if(bW(i).changeRequested)return;bW(i).changeRequested=!0,queueMicrotask(()=>{delete bW(i).changeRequested,i.dispatchEvent(new Event("change"))})}}(this))}};function b9(e){return[...bW(e).media.audioTracks].filter(e=>e.enabled).flatMap(e=>[...bW(e).renditionSet])}b5=new WeakMap;var b6,b7,ye,yt=class extends EventTarget{constructor(){super(...arguments),pC(this,b6,void 0),pC(this,b7,void 0),pC(this,ye,void 0)}[Symbol.iterator](){return b9(this).values()}get length(){return b9(this).length}getRenditionById(e){var t;return null!=(t=b9(this).find(t=>`${t.id}`==`${e}`))?t:null}get selectedIndex(){return b9(this).findIndex(e=>e.selected)}set selectedIndex(e){for(let[t,i]of b9(this).entries())i.selected=t===e}get onaddrendition(){return pI(this,b6)}set onaddrendition(e){pI(this,b6)&&(this.removeEventListener("addrendition",pI(this,b6)),pD(this,b6,void 0)),"function"==typeof e&&(pD(this,b6,e),this.addEventListener("addrendition",e))}get onremoverendition(){return pI(this,b7)}set onremoverendition(e){pI(this,b7)&&(this.removeEventListener("removerendition",pI(this,b7)),pD(this,b7,void 0)),"function"==typeof e&&(pD(this,b7,e),this.addEventListener("removerendition",e))}get onchange(){return pI(this,ye)}set onchange(e){pI(this,ye)&&(this.removeEventListener("change",pI(this,ye)),pD(this,ye,void 0)),"function"==typeof e&&(pD(this,ye,e),this.addEventListener("change",e))}};b6=new WeakMap,b7=new WeakMap,ye=new WeakMap;var yi,yr=class{constructor(){pL(this,"src"),pL(this,"id"),pL(this,"bitrate"),pL(this,"codec"),pC(this,yi,!1)}get selected(){return pI(this,yi)}set selected(e){var t;let i;pI(this,yi)!==e&&(pD(this,yi,e),t=this,(i=bW(t).media.audioRenditions)&&!bW(i).changeRequested&&(bW(i).changeRequested=!0,queueMicrotask(()=>{delete bW(i).changeRequested,bW(t).track.enabled&&i.dispatchEvent(new Event("change"))})))}};function ya(e,t){let i=e.audioTracks;bW(t).media=e,bW(t).renditionSet||(bW(t).renditionSet=new Set);let r=bW(i).trackSet;r.add(t);let a=r.size-1;a in yu.prototype||Object.defineProperty(yu.prototype,a,{get(){return[...bW(this).trackSet][a]}}),queueMicrotask(()=>{i.dispatchEvent(new b$("addtrack",{track:t}))})}function ys(e){var t;let i=null==(t=bW(e).media)?void 0:t.audioTracks;i&&(bW(i).trackSet.delete(e),queueMicrotask(()=>{i.dispatchEvent(new b$("removetrack",{track:e}))}))}yi=new WeakMap;var yn,yo,yl,yd,yh,yu=class extends EventTarget{constructor(){super(),pC(this,yd),pC(this,yn,void 0),pC(this,yo,void 0),pC(this,yl,void 0),bW(this).trackSet=new Set}[Symbol.iterator](){return pI(this,yd,yh).values()}get length(){return pI(this,yd,yh).size}getTrackById(e){var t;return null!=(t=[...pI(this,yd,yh)].find(t=>t.id===e))?t:null}get onaddtrack(){return pI(this,yn)}set onaddtrack(e){pI(this,yn)&&(this.removeEventListener("addtrack",pI(this,yn)),pD(this,yn,void 0)),"function"==typeof e&&(pD(this,yn,e),this.addEventListener("addtrack",e))}get onremovetrack(){return pI(this,yo)}set onremovetrack(e){pI(this,yo)&&(this.removeEventListener("removetrack",pI(this,yo)),pD(this,yo,void 0)),"function"==typeof e&&(pD(this,yo,e),this.addEventListener("removetrack",e))}get onchange(){return pI(this,yl)}set onchange(e){pI(this,yl)&&(this.removeEventListener("change",pI(this,yl)),pD(this,yl,void 0)),"function"==typeof e&&(pD(this,yl,e),this.addEventListener("change",e))}};yn=new WeakMap,yo=new WeakMap,yl=new WeakMap,yd=new WeakSet,yh=function(){return bW(this).trackSet};var yc,ym=class{constructor(){pL(this,"id"),pL(this,"kind"),pL(this,"label",""),pL(this,"language",""),pL(this,"sourceBuffer"),pC(this,yc,!1)}addRendition(e,t,i){var r;let a,s,n,o=new yr;return o.src=e,o.codec=t,o.bitrate=i,r=this,a=bW(r).media.audioRenditions,bW(o).media=bW(r).media,bW(o).track=r,(s=bW(r).renditionSet).add(o),(n=s.size-1)in yt.prototype||Ob
1621ject.defineProperty(yt.prototype,n,{get(){return b9(this)[n]}}),queueMicrotask(()=>{r.enabled&&a.dispatchEvent(new bQ("addrendition",{rendition:o}))}),o}removeRendition(e){let t,i;t=bW(e).media.audioRenditions,i=bW(e).track,bW(i).renditionSet.delete(e),queueMicrotask(()=>{bW(e).track.enabled&&t.dispatchEvent(new bQ("removerendition",{rendition:e}))})}get enabled(){return pI(this,yc)}set enabled(e){let t;pI(this,yc)!==e&&(pD(this,yc,e),(t=bW(this).media.audioTracks)&&!bW(t).changeRequested&&(bW(t).changeRequested=!0,queueMicrotask(()=>{delete bW(t).changeRequested,t.dispatchEvent(new Event("change"))})))}};yc=new WeakMap;var yp=yv(globalThis.HTMLMediaElement,"video"),yf=yv(globalThis.HTMLMediaElement,"audio");function yg(e){if(!(null!=e&&e.prototype))return e;let t=yv(e,"video");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(e.prototype,"videoTracks",{get(){return function(e){var t;let i=bW(e).videoTracks;if(!i&&(i=new bX,bW(e).videoTracks=i,yp)){let r=yp.call(null!=(t=e.nativeEl)?t:e);for(let t of r)bG(e,t);r.addEventListener("change",()=>{i.dispatchEvent(new Event("change"))}),r.addEventListener("addtrack",t=>{if([...i].some(e=>e instanceof b8)){for(let e of r)bV(e);return}bG(e,t.track)}),r.addEventListener("removetrack",e=>{bV(e.track)})}return i}(this)}});let i=yv(e,"audio");(!i||`${i}`.includes("[native code]"))&&Object.defineProperty(e.prototype,"audioTracks",{get(){return function(e){var t;let i=bW(e).audioTracks;
1621if(!i&&(i=new yu,bW(e).audioTracks=i,yf)){let r=yf.call(null!=(t=e.nativeEl)?t:e);for(let t of r)ya(e,t);r.addEventListener("change",()=>{i.dispatchEvent(new Event("change"))}),r.addEventListener("addtrack",t=>{if([...i].some(e=>e instanceof ym)){for(let e of r)ys(e);return}ya(e,t.track)}),r.addEventListener("removetrack",e=>{ys(e.track)})}return i}(this)}}),"addVideoTrack"in e.prototype||(e.prototype.addVideoTrack=function(e,t="",i=""){let r=new b8;return r.kind=e,r.label=t,r.language=i,bG(this,r),r}),"removeVideoTrack"in e.prototype||(e.prototype.removeVideoTrack=bV),"addAudioTrack"in e.prototype||(e.prototype.addAudioTrack=function(e,t="",i=""){let r=new ym;return r.kind=e,r.label=t,r.language=i,ya(this,r),r}),"removeAudioTrack"in e.prototype||(e.prototype.removeAudioTrack=ys),"videoRenditions"in e.prototype||Object.defineProperty(e.prototype,"videoRenditions",{get(){return r(this)}});let r=e=>{let t=bW(e).videoRenditions;return t||(bW(t=new b2).media=e,bW(e).videoRenditions=t),t};"audioRenditions"in e.prototype||Object.defineProperty(e.prototype,"audioRenditions",{get(){return a(this)}});let a=e=>{let t=bW(e).audioRenditions;return t||(bW(t=new yt).media=e,bW(e).audioRenditions=t),t};return e}function yv(e,t){var i;if(null!=e&&e.prototype)return null==(i=Object.getOwnPropertyDescriptor(e.prototype,`${t}Tracks`))?void 0:i.get}E2.push("castchange","entercast","leavecast");var yE,yb,yy,yT,yA,y_,yk,yS,yw,yL,yR={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DRM_TOKEN:"drm-token",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",RENDITION_ORDER:"rendition-order",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type"},yI=Object.values(yR),yC=class extends E7{constructor(){super(),pC(this,yw),pC(this,yE,void 0),pC(this,yb,void 0),pC(this,yy,void 0),pC(this,yT,{}),pC(this,yA,void 0),pC(this,y_,void 0),pC(this,yk,void 0),pC(this,yS,void 0),pD(this,yy,tN.utils.now())}static get observedAttributes(){var e;return[...yI,...null!=(e=E7.observedAttributes)?e:[]]}get preferCmcd(){var e;return null!=(e=this.getAttribute(yR.PREFER_CMCD))?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?on.includes(e)?this.setAttribute(yR.PREFER_CMCD,e):console.warn(`Invalid value for preferCmcd. Must be one of ${on.join()}`):this.removeAttribute(yR.PREFER_CMCD))}get playerInitTime(){return pI(this,yy)}get playerSoftwareName(){var e;return null!=(e=pI(this,yk))?e:"mux-video"}set playerSoftwareName(e){pD(this,yk,e)}get playerSoftwareVersion(){var e;return null!=(e=pI(this,y_))?e:E1}set playerSoftwareVersion(e){pD(this,y_,e)}get _hls(){var e;return null==(e=pI(this,yE))?void 0:e.engine}get mux(){var e;return null==(e=this.nativeEl)?void 0:e.mux}get error(){var e,t,i;return null!=(t=this.nativeEl,e=null==(i=o2.get(t))?void 0:i.error)?e:null}get errorTranslator(){return pI(this,yS)}set errorTranslator(e){pD(this,yS,e)}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&(null==e?this.removeAttribute("src"):this.setAttribute("src",e))}get type(){var e;return null!=(e=this.getAttribute(yR.TYPE))?e:void 0}set type(e){e!==this.type&&(e?this.setAttribute(yR.TYPE,e):this.removeAttribute(yR.TYPE))}get autoplay(){let e=this.getAttribute("autoplay");return null!==e&&(""===e||e)}set autoplay(e){e!==this.autoplay&&(e?this.setAttribute("autoplay","string"==typeof e?e:""):this.removeAttribute("autoplay"))}get preload(){let e=this.getAttribute("preload");return""===e?"auto":["none","metadata","auto"].includes(e)?e:super.preload}set preload(e){e!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(e)?this.setAttribute("preload",e):this.removeAttribute("preload"))}get debug(){return null!=this.getAttribute(yR.DEBUG)}set debug(e){e!==this.debug&&(e?this.setAttribute(yR.DEBUG,""):this.removeAttribute(yR.DEBUG))}get disableTracking(){return this.hasAttribute(yR.DISABLE_TRACKING)}set disableTracking(e){e!==this.disableTracking&&this.toggleAttribute(yR.DISABLE_TRACKING,!!e)}get disableCookies(){return this.hasAttribute(yR.DISABLE_COOKIES)}set disableCookies(e){e!==this.disableCookies&&(e?this.setAttribute(yR.DISABLE_COOKIES,""):this.removeAttribute(yR.DISABLE_COOKIES))}get startTime(){let e=this.getAttribute(yR.START_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set startTime(e){e!==this.startTime&&(null==e?this.removeAttribute(yR.START_TIME):this.setAttribute(yR.START_TIME,`${e}`))}get playbackId(){var e;return this.hasAttribute(yR.PLAYBACK_ID)?this.getAttribute(yR.PLAYBACK_ID):null!=(e=o9(this.src))?e:void 0}set playbackId(e){e!==this.playbackId&&(e?this.setAttribute(yR.PLAYBACK_ID,e):this.removeAttribute(yR.PLAYBACK_ID))}get maxResolution(){var e;return null!=(e=this.getAttribute(yR.MAX_RESOLUTION))?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(yR.MAX_RESOLUTION,e):this.removeAttribute(yR.MAX_RESOLUTION))}get minResolution(){var e;return null!=(e=this.getAttribute(yR.MIN_RESOLUTION))?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(yR.MIN_RESOLUTION,e):this.removeAttribute(yR.MIN_RESOLUTION))}get renditionOrder(){var e;return null!=(e=this.getAttribute(yR.RENDITION_ORDER))?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(yR.RENDITION_ORDER,e):this.removeAttribute(yR.RENDITION_ORDER))}get programStartTime(){let e=this.getAttribute(yR.PROGRAM_START_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set programStartTime(e){null==e?this.removeAttribute(yR.PROGRAM_START_TIME):this.setAttribute(yR.PROGRAM_START_TIME,`${e}`)}get programEndTime(){let e=this.getAttribute(yR.PROGRAM_END_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set programEndTime(e){null==e?this.removeAttribute(yR.PROGRAM_END_TIME):this.setAttribute(yR.PROGRAM_END_TIME,`${e}`)}get customDomain(){var e;return null!=(e=this.getAttribute(yR.CUSTOM_DOMAIN))?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(yR.CUSTOM_DOMAIN,e):this.removeAttribute(yR.CUSTOM_DOMAIN))}get drmToken(){var e;return null!=(e=this.getAttribute(yR.DRM_TOKEN))?e:void 0}
1621set drmToken(e){e!==this.drmToken&&(e?this.setAttribute(yR.DRM_TOKEN,e):this.removeAttribute(yR.DRM_TOKEN))}get ended(){return lr(this.nativeEl,this._hls)}get envKey(){var e;return null!=(e=this.getAttribute(yR.ENV_KEY))?e:void 0}set envKey(e){e!==this.envKey&&(e?this.setAttribute(yR.ENV_KEY,e):this.removeAttribute(yR.ENV_KEY))}get beaconCollectionDomain(){var e;return null!=(e=this.getAttribute(yR.BEACON_COLLECTION_DOMAIN))?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(yR.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(yR.BEACON_COLLECTION_DOMAIN))}get streamType(){var e;return null!=(e=this.getAttribute(yR.STREAM_TYPE))?e:o6(this.nativeEl)}set streamType(e){e!==this.streamType&&(e?this.setAttribute(yR.STREAM_TYPE,e):this.removeAttribute(yR.STREAM_TYPE))}get targetLiveWindow(){var e,t,i;return this.hasAttribute(yR.TARGET_LIVE_WINDOW)?+this.getAttribute(yR.TARGET_LIVE_WINDOW):(e=this.nativeEl,null!=(i=null==(t=o2.get(e))?void 0:t.targetLiveWindow)?i:NaN)}set targetLiveWindow(e){e!=this.targetLiveWindow&&(null==e?this.removeAttribute(yR.TARGET_LIVE_WINDOW):this.setAttribute(yR.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e,t;if(this.hasAttribute(yR.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:i}=this,r=null!=(e=this.nativeEl.seekable.end(0))?e:0;return Math.max(null!=(t=this.nativeEl.seekable.start(0))?t:0,r-i)}return(e=>{var t;let i=null==(t=o2.get(e))?void 0:t.liveEdgeStartOffset;if("number"!=typeof i)return NaN;let r=o7(e);return r.length?r.end(r.length-1)-i:NaN})(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(yR.LIVE_EDGE_OFFSET))return+this.getAttribute(yR.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){e!=this.targetLiveWindow&&(null==e?this.removeAttribute(yR.LIVE_EDGE_OFFSET):this.setAttribute(yR.LIVE_EDGE_OFFSET,`${+e}`))}get seekable(){return o7(this.nativeEl)}async addCuePoints(e){return o_(this.nativeEl,e)}get activeCuePoint(){return oS(this.nativeEl)}get cuePoints(){return function(e,t={label:oT}){let i=ob(e,t.label,"metadata");return null!=i&&i.cues?Array.from(i.cues,e=>ok(e)):[]}(this.nativeEl)}async addChapters(e){return oC(this.nativeEl,e)}get activeChapter(){return oD(this.nativeEl)}get chapters(){return function(e,t={label:oL}){var i;let r=ob(e,t.label,"chapters");return null!=(i=null==r?void 0:r.cues)&&i.length?Array.from(r.cues,e=>oI(e)):[]}(this.nativeEl)}getStartDate(){return function(e,t){if(t){let i=t.playingDate;if(null!=i)return new Date(i.getTime()-1e3*e.currentTime)}return"function"==typeof e.getStartDate?e.getStartDate():new Date(NaN)}(this.nativeEl,this._hls)}get currentPdt(){var e,t;return e=this.nativeEl,(t=this._hls)&&t.playingDate?t.playingDate:new Date("function"==typeof e.getStartDate?e.getStartDate().getTime()+1e3*e.currentTime:NaN)}get preferPlayback(){let e=this.getAttribute(yR.PREFER_PLAYBACK);if("mse"===e||e===oa)return e}set preferPlayback(e){e!==this.preferPlayback&&("mse"===e||e===oa?this.setAttribute(yR.PREFER_PLAYBACK,e):this.removeAttribute(yR.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(e=>e.startsWith("metadata-")&&![yR.METADATA_URL].includes(e)).reduce((e,t)=>{let i=this.getAttribute(t);return null!=i&&(e[t.replace(/^metadata-/,"").replace(/-/g,"_")]=i),e},{}),...pI(this,yT)}}set metadata(e){pD(this,yT,null!=e?e:{}),this.mux&&this.mux.emit("hb",pI(this,yT))}get _hlsConfig(){return pI(this,yA)}set _hlsConfig(e){pD(this,yA,e)}load(){pD(this,yE,((e,t,i)=>{var r,a,s;la(t,i);let{metadata:n={}}=e,{view_session_id:o=o5()}=n,l=null!=(r=null==e?void 0:e.metadata)&&r.video_id?e.metadata.video_id:lc(e)&&null!=(s=null!=(a=(e=>{if(!e)return;let[t]=e.split("?");return t||void 0})(e.playbackId))?a:o9(e.src))?s:e.src;n.view_session_id=o,n.video_id=l,e.metadata=n,o2.set(t,{});let d=((e,t)=>{let{debug:i,streamType:r,startTime:a=-1,metadata:s,preferCmcd:n,_hlsConfig:o={}}=e,l=oh(e)===oo.M3U8,d=ls(e,t);if(l&&!d&&o4){let t=ln(r),l=lo(e);return new n9({debug:i,startPosition:a,cmcd:n!==os.NONE?{useHeaders:n===os.HEADER,sessionId:null==s?void 0:s.view_session_id,contentId:null==s?void 0:s.video_id}:void 0,xhrSetup:(e,t)=>{var i,r;if(n&&n!==os.QUERY)return;let a=new URL(t);if(!a.searchParams.has("CMCD"))return;let s=(null!=(r=null==(i=a.searchParams.get("CMCD"))?void 0:i.split(","))?r:[]).filter(e=>e.startsWith("sid")||e.startsWith("cid")).join(",");a.searchParams.set("CMCD",s),e.open("GET",a)},...{backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},...t,...l,...o}
1621)}})(e,t),h=(({preload:e,src:t},i,r)=>{let a=e=>{null!=e&&["","none","metadata","auto"].includes(e)?i.setAttribute("preload",e):i.removeAttribute("preload")};if(!r)return a(e),a;let s=!1,n=!1,o=r.config.maxBufferLength,l=r.config.maxBufferSize,d=e=>{a(e);let t=null!=e?e:i.preload;n||"none"===t||("metadata"===t?(r.config.maxBufferLength=1,r.config.maxBufferSize=1):(r.config.maxBufferLength=o,r.config.maxBufferSize=l),h())},h=()=>{!s&&t&&(s=!0,r.loadSource(t))};return od(i,"play",()=>{n=!0,r.config.maxBufferLength=o,r.config.maxBufferSize=l,h()},{once:!0}),d(e),d})(e,t,d);((e,t,i)=>{var r;let{envKey:a,disableTracking:s}=e,n=lc(e);if(!s&&(a||n)){let{playerInitTime:s,playerSoftwareName:n,playerSoftwareVersion:o,beaconCollectionDomain:l,debug:d,disableCookies:h}=e,u={...e.metadata,video_title:(null==(r=null==e?void 0:e.metadata)?void 0:r.video_title)||void 0};tN.monitor(t,{debug:d,beaconCollectionDomain:l,hlsjs:i,Hls:i?n9:void 0,automaticErrorTracking:!1,errorTranslator:t=>"string"!=typeof t.player_error_code&&("function"==typeof e.errorTranslator?e.errorTranslator(t):t),disableCookies:h,data:{...a?{env_key:a}:{},player_software_name:n,player_software:n,player_software_version:o,player_init_time:s,...u}})}})(e,t,d),((e,t,i)=>{var r;let a=ls(e,t),{src:s}=e,n=()=>{t.ended||!lr(t,i)||(li(t,i)?t.currentTime=t.buffered.end(t.buffered.length-1):t.dispatchEvent(new Event("ended")))},o,l,d=()=>{var e,i;let r=null==(e=o7(t))?void 0:e.start(0),a=null==(i=o7(t))?void 0:i.end(0);(l!==a||o!==r)&&t.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),o=r,l=a};if(od(t,"durationchange",d),t&&a){let i=oh(e);if("string"==typeof s){let a=()=>{if(o6(t)!==oi||Number.isFinite(t.duration))return;let e=setInterval(d,1e3);t.addEventListener("teardown",()=>{clearInterval(e)},{once:!0}),od(t,"durationchange",()=>{Number.isFinite(t.duration)&&clearInterval(e)})};if("none"===t.preload){let e=()=>{o0(s,t,i).then(a),t.removeEventListener("loadedmetadata",r)},r=()=>{o0(s,t,i).then(a),t.removeEventListener("play",e)};od(t,"play",e,{once:!0}),od(t,"loadedmetadata",r,{once:!0})}else o0(s,t,i).then(a);e.drmToken&&od(t,"encrypted",async i=>{try{let r=i.initDataType;if("skd"!==r)return void console.error(`Received unexpected initialization data type "${r}"`);if(!t.mediaKeys){let i=await (await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[r],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}])).createMediaKeys(),a=await ll(lu(e,"fairplay"));await i.setServerCertificate(a),await t.setMediaKeys(i)}let a=i.initData;if(null==a)return void console.error(`Could not start encrypted playback due to missing initData in ${i.type} event`);let s=t.mediaKeys.createSession();s.generateRequest(r,a);let n=await new Promise(e=>{s.addEventListener("message",t=>{e(t.message)},{once:!0})}),o=await ld(n,lh(e,"fairplay"));return await s.update(o),s}catch(e){console.error(`Could not start encrypted playback due to exception "${e}"`)}}),t.setAttribute("src",s),e.startTime&&((null!=(r=o2.get(t))?r:{}).startTime=e.startTime,t.addEventListener("durationchange",lm,{once:!0}))}else t.removeAttribute("src");t.addEventListener("error",lp),t.addEventListener("error",lf),t.addEventListener("emptied",()=>{t.querySelectorAll("track[data-removeondestroy]").forEach(e=>{e.remove()})},{once:!0}),od(t,"pause",n),od(t,"seeked",n),od(t,"play",()=>{t.ended||lt(t.currentTime,t.duration)&&(t.currentTime=t.seekable.length?t.seekable.start(0):0)})}else{let r,a;i&&s?(i.once(n9.Events.LEVEL_LOADED,(e,r)=>{((e,t,i)=>{var r,a,s,n,o,l,d,h,u;let c,m,p,f,g,{streamType:v,targetLiveWindow:E,liveEdgeStartOffset:b,lowLatency:y}=(m=ou(c=e.type),p=oc(c),g=!!(null!=(u=e.partList)&&u.length),m===oi&&(f=g?2*e.partTarget:3*e.targetduration),{streamType:m,targetLiveWindow:p,liveEdgeStartOffset:f,lowLatency:g});if(v===oi){y?(i.config.backBufferLength=null!=(r=i.userConfig.backBufferLength)?r:4,i.config.maxFragLookUpTolerance=null!=(a=i.userConfig.maxFragLookUpTolerance)?a:.001,i.config.abrBandWidthUpFactor=null!=(s=i.userConfig.abrBandWidthUpFactor)?s:i.config.abrBandWidthFactor):i.config.backBufferLength=null!=(n=i.userConfig.backBufferLength)?n:8;let e=Object.freeze({get length(){return t.seekable.length},start:e=>t.seekable.start(e),end(e){var r;return e>this.length||e<0||Number.isFinite(t.duration)?t.seekable.end(e):null!=(r=i.liveSyncPosition)?r:t.seekable.end(e)}});(null!=(o=o2.get(t))?o:{}).seekable=e}(null!=(l=o2.get(t))?l:{}).liveEdgeStartOffset=b,(null!=(d=o2.get(t))?d:{}).targetLiveWindow=E,t.dispatchEvent(new CustomEvent("targetlivewindowch
1621ange",{composed:!0,bubbles:!0})),(null!=(h=o2.get(t))?h:{}).streamType=v,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))})(r.details,t,i),d(),o6(t)!==oi||Number.isFinite(t.duration)||(i.on(n9.Events.LEVEL_UPDATED,d),od(t,"durationchange",()=>{Number.isFinite(t.duration)&&i.off(n9.Events.LEVELS_UPDATED,d)}))}),i.on(n9.Events.ERROR,(e,i)=>{let r={[n9.ErrorTypes.NETWORK_ERROR]:n6.MEDIA_ERR_NETWORK,[n9.ErrorTypes.MEDIA_ERROR]:n6.MEDIA_ERR_DECODE},a=new n6("",r[i.type]);a.fatal=i.fatal,a.data=i,t.dispatchEvent(new CustomEvent("error",{detail:a}))}),t.addEventListener("error",lf),od(t,"waiting",n),function(e,t){var i;if(!("videoTracks"in e))return;let r=new WeakMap;t.on(n9.Events.MANIFEST_PARSED,function(t,i){s();let a=e.addVideoTrack("main");for(let[e,t]of(a.selected=!0,i.levels.entries())){let i=a.addRendition(t.url[0],t.width,t.height,t.videoCodec,t.bitrate);r.set(t,`${e}`),i.id=`${e}`}}),t.on(n9.Events.AUDIO_TRACKS_UPDATED,function(t,i){for(let t of(a(),i.audioTracks)){let i=t.default?"main":"alternative",r=e.addAudioTrack(i,t.name,t.lang);r.id=`${t.id}`,t.default&&(r.enabled=!0)}}),e.audioTracks.addEventListener("change",()=>{var i;let r=+(null==(i=[...e.audioTracks].find(e=>e.enabled))?void 0:i.id),a=t.audioTracks.map(e=>e.id);r!=t.audioTrack&&a.includes(r)&&(t.audioTrack=r)}),t.on(n9.Events.LEVELS_UPDATED,function(t,i){var a;let s=e.videoTracks[null!=(a=e.videoTracks.selectedIndex)?a:0];if(!s)return;let n=i.levels.map(e=>r.get(e));for(let t of e.videoRenditions)t.id&&!n.includes(t.id)&&s.removeRendition(t)});null==(i=e.videoRenditions)||i.addEventListener("change",i=>{var r;let a,s,n,o=i.target.selectedIndex;o!=t.nextLevel&&(r=o,a=e.currentTime,s=!1,n=(e,t)=>{s||(s=!Number.isFinite(t.endOffset))},t.on(n9.Events.BUFFER_FLUSHING,n),t.nextLevel=r,t.off(n9.Events.BUFFER_FLUSHING,n),s||t.trigger(n9.Events.BUFFER_FLUSHING,{startOffset:a+10,endOffset:1/0,type:"video"}))});let a=()=>{for(let t of e.audioTracks)e.removeAudioTrack(t)},s=()=>{(()=>{for(let t of e.videoTracks)e.removeVideoTrack(t)})(),a()};t.once(n9.Events.DESTROYING,s)}(e,i),i.on(n9.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(e,{tracks:r})=>{r.forEach(e=>{var r;let a=null!=(r=e.subtitleTrack)?r:e.closedCaptions,s=i.subtitleTracks.findIndex(({lang:t,name:i,type:r})=>t==(null==a?void 0:a.lang)&&i===e.label&&r.toLowerCase()===e.kind);oE(t,e.kind,e.label,null==a?void 0:a.lang,`${e.kind}${s}`)})}),r=()=>{var e;if(!i.subtitleTracks.length)return;let r=Array.from(t.textTracks).find(e=>e.id&&"showing"===e.mode&&["subtitles","captions"].includes(e.kind)),a=`${null==(e=i.subtitleTracks[i.subtitleTrack])?void 0:e.type.toLowerCase()}${i.subtitleTrack}`;if(r&&(i.subtitleTrack<0||(null==r?void 0:r.id)!==a)){let e=i.subtitleTracks.findIndex(({lang:e,name:t,type:i})=>e==r.language&&t===r.label&&i.toLowerCase()===r.kind);i.subtitleTrack=e}r&&(null==r?void 0:r.id)===a&&r.cues&&Array.from(r.cues).forEach(e=>{r.addCue(e)})},t.textTracks.addEventListener("change",r),i.on(n9.Events.CUES_PARSED,(e,{track:i,cues:r})=>{let a=t.textTracks.getTrackById(i);if(!a)return;let s="disabled"===a.mode;s&&(a.mode="hidden"),r.forEach(e=>{var t;null!=(t=a.cues)&&t.getCueById(e.id)||a.addCue(e)}),s&&(a.mode="disabled")}),i.once(n9.Events.DESTROYING,()=>{t.textTracks.removeEventListener("change",r),t.querySelectorAll("track[data-removeondestroy]").forEach(e=>{e.remove()})}),a=()=>
1621{Array.from(t.textTracks).forEach(e=>{var i,r;if(!["subtitles","caption"].includes(e.kind)&&"thumbnails"===e.label){if(!(null!=(i=e.cues)&&i.length)){let e=t.querySelector('track[label="thumbnails"]'),i=null!=(r=null==e?void 0:e.getAttribute("src"))?r:"";null==e||e.removeAttribute("src"),setTimeout(()=>{null==e||e.setAttribute("src",i)},0)}"hidden"!==e.mode&&(e.mode="hidden")}})},i.once(n9.Events.MANIFEST_LOADED,a),i.once(n9.Events.MEDIA_ATTACHED,a),i.attachMedia(t)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")}})(e,t,d),ow(t),ox(t);let u=((e,t,i)=>{let{autoplay:r}=e,a=!1,s=!1,n=of(r)?r:!!r,o=()=>{a||od(t,"playing",()=>{a=!0},{once:!0})};if(o(),od(t,"loadstart",()=>{a=!1,o(),og(t,n)},{once:!0}),od(t,"loadstart",()=>{i||(s=e.streamType&&e.streamType!==or?e.streamType===oi:!Number.isFinite(t.duration)),og(t,n)},{once:!0}),i&&i.once(n9.Events.LEVEL_LOADED,(t,i)=>{var r;s=e.streamType&&e.streamType!==or?e.streamType===oi:null!=(r=i.details.live)&&r}),!n){let r=()=>{!s||Number.isFinite(e.startTime)||(null!=i&&i.liveSyncPosition?t.currentTime=i.liveSyncPosition:Number.isFinite(t.seekable.end(0))&&(t.currentTime=t.seekable.end(0)))};i&&od(t,"play",()=>{"metadata"===t.preload?i.once(n9.Events.LEVEL_UPDATED,r):r()},{once:!0})}return e=>{a||og(t,n=of(e)?e:!!e)}})(e,t,d);return{engine:d,setAutoplay:u,setPreload:h}})(this,this.nativeEl,pI(this,yE)))}unload(){la(this.nativeEl,pI(this,yE)),pD(this,yE,void 0)}attributeChangedCallback(e,t,i){var r,a;switch(E7.observedAttributes.includes(e)&&!["src","autoplay","preload"].includes(e)&&super.attributeChangedCallback(e,t,i),e){case yR.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=null!=i?i:void 0;break;case yR.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=null!=i?i:void 0;break;case"src":{let e=!!t,r=!!i;!e&&r?px(this,yw,yL).call(this):e&&!r?this.unload():e&&r&&(this.unload(),px(this,yw,yL).call(this));break}
1621case"autoplay":if(i===t)break;null==(r=pI(this,yE))||r.setAutoplay(this.autoplay);break;case"preload":if(i===t)break;null==(a=pI(this,yE))||a.setPreload(i);break;case yR.PLAYBACK_ID:this.src=o8(this);break;case yR.DEBUG:{let e=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=e);break}case yR.METADATA_URL:i&&fetch(i).then(e=>e.json()).then(e=>this.metadata=e).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${i}!`));break;case yR.STREAM_TYPE:(null==i||i!==t)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case yR.TARGET_LIVE_WINDOW:(null==i||i!==t)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}))}}connectedCallback(){var e;null==(e=super.connectedCallback)||e.call(this),this.nativeEl&&this.src&&!pI(this,yE)&&px(this,yw,yL).call(this)}disconnectedCallback(){this.unload()}};yE=new WeakMap,yb=new WeakMap,yy=new WeakMap,yT=new WeakMap,yA=new WeakMap,y_=new WeakMap,yk=new WeakMap,yS=new WeakMap,yw=new WeakSet,yL=async function(){pI(this,yb)||(await pD(this,yb,Promise.resolve()),pD(this,yb,null),this.load())};var yD=class extends bB(yg(yC)){};E0.customElements.get("mux-video")||(E0.customElements.define("mux-video",yD),E0.MuxVideoElement=yD);var yx=Object.defineProperty,yM=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},yO=(e,t,i)=>(yM(e,t,"read from private field"),i?i.call(e):t.get(e)),yP=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},yN=(e,t,i,r)=>(yM(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let yU={processCallback(e,t,i){if(i){for(let[e,r]of t)if(e in i){let t=i[e];"boolean"==typeof t&&r instanceof yK&&"boolean"==typeof r.element[r.attributeName]?r.booleanValue=t:"function"==typeof t&&r instanceof yK?r.element[r.attributeName]=t:r.value=t}}}};class yF extends lX.DocumentFragment{constructor(e,t,i=yU){var r;super(),yP(this,Tm,void 0),yP(this,Tp,void 0),this.append(e.content.cloneNode(!0)),yN(this,Tm,yB(this)),yN(this,Tp,i),null==(r=i.createCallback)||r.call(i,this,yO(this,Tm),t),i.processCallback(this,yO(this,Tm),t)}update(e){yO(this,Tp).processCallback(this,yO(this,Tm),e)}}Tm=new WeakMap,Tp=new WeakMap;let yB=(e,t=[])=>{let i,r;for(let a of e.attributes||[])if(a.value.includes("{{")){let s=new yV;for([i,r]of yH(a.value))if(i){let i=new yK(e,a.name,a.namespaceURI);s.append(i),t.push([r,i])}else s.append(r);a.value=s.toString()}for(let a of e.childNodes)if(1!==a.nodeType||a instanceof HTMLTemplateElement){if(1===a.nodeType||a.data.includes("{{")){let s=[];if(a.data)for([i,r]of yH(a.data))if(i){let i=new yq(e);s.push(i),t.push([r,i])}else s.push(new Text(r));else if(a instanceof HTMLTemplateElement){let i=new yj(e,a);s.push(i),t.push([i.expression,i])}a.replaceWith(...s.flatMap(e=>e.replacementNodes||[e]))}}else yB(a,t);return t},y$={},yH=e=>{let t="",i=0,r=y$[e],a=0,s;if(r)return r;for(r=[];s=e[a];a++)"{"===s&&"{"===e[a+1]&&"\\"!==e[a-1]&&e[a+2]&&1==++i?(t&&r.push([0,t]),t="",a++):"}"!==s||"}"!==e[a+1]||"\\"===e[a-1]||--i?t+=s||"":(r.push([1,t.trim()]),t="",a++);return t&&r.push([0,(i>0?"{{":"")+t]),y$[e]=r};class yW{get value(){return""}set value(e){}toString(){return this.value}}let yG=new WeakMap;class yV{constructor(){yP(this,Tf,[])}[Symbol.iterator](){return yO(this,Tf).values()}get length(){return yO(this,Tf).length}item(e){return yO(this,Tf)[e]}append(...e){for(let t of e)t instanceof yK&&yG.set(t,this),yO(this,Tf).push(t)}toString(){return yO(this,Tf).join("")}}Tf=new WeakMap;class yK extends yW{constructor(e,t,i){super(),yP(this,Ty),yP(this,Tg,""),yP(this,Tv,void 0),yP(this,TE,void 0),yP(this,Tb,void 0),yN(this,Tv,e),yN(this,TE,t),yN(this,Tb,i)}get attributeName(){return yO(this,TE)}get attributeNamespace(){return yO(this,Tb)}get element(){return yO(this,Tv)}get value(){return yO(this,Tg)}set value(e){yO(this,Tg)!==e&&(yN(this,Tg,e),yO(this,Ty,TT)&&1!==yO(this,Ty,TT).length?yO(this,Tv).setAttributeNS(yO(this,Tb),yO(this,TE),yO(this,Ty,TT)):null==e?yO(this,Tv).removeAttributeNS(yO(this,Tb),yO(this,TE)):yO(this,Tv).setAttributeNS(yO(this,Tb),yO(this,TE),e))}get booleanValue(){return yO(this,Tv).hasAttributeNS(yO(this,Tb),yO(this,TE))}set booleanValue(e){if(yO(this,Ty,TT)&&1!==yO(this,Ty,TT).length)throw new DOMException("Value is not fully templatized");this.value=e?"":null}}Tg=new WeakMap,Tv=new WeakMap,TE=new WeakMap,Tb=new WeakMap,Ty=new WeakSet,TT=function(){return yG.get(this)};class yq extends yW{constructor(e,t){super(),yP(this,TA,void 0),yP(this,T_,void 0),yN(this,TA,e),yN(this,T_,t?[...t]:[new Text])}get replacementNodes(){return yO(this,T_)}get parentNode(){return yO(this,TA)}get nextSibling(){return yO(this,T_)[yO(this,T_).length-1].nextSibling}get previousSibling(){return yO(this,T_)[0].previousSibling}get value(){return yO(this,T_).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){let t=e.flat().flatMap(e=>null==e?[new Text]:e.forEach?[...e]:11===e.nodeType?[...e.childNodes]:e.nodeType?[e]:[new Text(e)]);t.length||t.push(new Text),yN(this,T_,function(e,t,i,r=null){let a=0,s,n,o,l=i.length,d=t.length;for(;a<l&&a<d&&t[a]==i[a];)a++;for(;a<l&&a<d&&i[l-1]==t[d-1];)r=i[--d,--l];if(a==d)for(;a<l;)e.insertBefore(i[a++],r);if(a==l)for(;a<d;)e.removeChild(t[a++]);else{for(s=t[a];a<l;)o=i[a++],n=s?s.nextSibling:r,s==o?s=n:a<l&&i[a]==n?(e.replaceChild(o,s),s=n):e.insertBefore(o,s);for(;s!=r;)n=s.nextSibling,e.removeChild(s),s=n}return i}
1621(yO(this,T_)[0].parentNode,yO(this,T_),t,this.nextSibling))}}TA=new WeakMap,T_=new WeakMap;class yj extends yq{constructor(e,t){let i=t.getAttribute("directive")||t.getAttribute("type"),r=t.getAttribute("expression")||t.getAttribute(i)||"";r.startsWith("{{")&&(r=r.trim().slice(2,-2).trim()),super(e),((e,t)=>{let i,r;r=void 0,(i="symbol"!=typeof t?t+"":t)in e?yx(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r})(this,"directive"),this.expression=r,this.template=t,this.directive=i}}let yY={string:e=>String(e)};class yz{constructor(e){this.template=e,this.state=void 0}}let yX=new WeakMap,yQ=new WeakMap,yZ={partial:(e,t)=>{t[e.expression]=new yz(e.template)},if:(e,t)=>{var i;if(y2(e.expression,t))if(yX.get(e)!==e.template){yX.set(e,e.template);let i=new yF(e.template,t,y0);e.replace(i),yQ.set(e,i)}else null==(i=yQ.get(e))||i.update(t);else e.replace(""),yX.delete(e),yQ.delete(e)}},yJ=Object.keys(yZ),y0={processCallback(e,t,i){var r,a;if(i)for(let[e,s]of t){if(s instanceof yj){if(!s.directive){let e=yJ.find(e=>s.template.hasAttribute(e));e&&(s.directive=e,s.expression=s.template.getAttribute(e))}null==(r=yZ[s.directive])||r.call(yZ,s,i);continue}let t=y2(e,i);if(t instanceof yz){yX.get(s)!==t.template?(yX.set(s,t.template),s.value=t=new yF(t.template,t.state,y0),yQ.set(s,t)):null==(a=yQ.get(s))||a.update(t.state);continue}t?(s instanceof yK&&s.attributeName.startsWith("aria-")&&(t=String(t)),s instanceof yK?"boolean"==typeof t?s.booleanValue=t:"function"==typeof t?s.element[s.attributeName]=t:s.value=t:(s.value=t,yX.delete(s),yQ.delete(s))):s instanceof yK?s.value=void 0:(s.value=void 0,yX.delete(s),yQ.delete(s))}}},y1={"!":e=>!e,"!!":e=>!!e,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,">":(e,t)=>e>t,">=":(e,t)=>
1621e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"??":(e,t)=>null!=e?e:t,"|":(e,t)=>{var i;return null==(i=yY[t])?void 0:i.call(yY,e)}};function y2(e,t={}){var i,r,a,s,n,o,l;let d=(function(e,t){let i,r,a,s=[];for(;e;){for(let s in a=null,i=e.length,t)(r=t[s].exec(e))&&r.index<i&&(a={token:r[0],type:s,matches:r.slice(1)},i=r.index);i&&s.push({token:e.substr(0,i),type:void 0}),a&&s.push(a),e=e.substr(i+(a?a.token.length:0))}return s})(e,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>"ws"!==e);if(0===d.length||d.some(({type:e})=>!e))return y3(e);if((null==(i=d[0])?void 0:i.token)===">"){let i=t[null==(r=d[1])?void 0:r.token];if(!i)return y3(e);let o={...t};i.state=o;let l=d.slice(2);for(let e=0;e<l.length;e+=3){let i=null==(a=l[e])?void 0:a.token,r=null==(s=l[e+1])?void 0:s.token,d=null==(n=l[e+2])?void 0:n.token;i&&"="===r&&(o[i]=y5(d,t))}return i}if(1===d.length)return y4(d[0])?y5(d[0].token,t):y3(e);if(2===d.length){let i=y1[null==(o=d[0])?void 0:o.token];return i&&y4(d[1])?i(y5(d[1].token,t)):y3(e)}if(3===d.length){let i=null==(l=d[1])?void 0:l.token,r=y1[i];if(!r||!y4(d[0])||!y4(d[2]))return y3(e);let a=y5(d[0].token,t);return r(a,"|"===i?d[2].token:y5(d[2].token,t))}}function y3(e){return console.warn(`Warning: invalid expression \`${e}\``),!1}function y4({type:e}){return["number","boolean","string","param"].includes(e)}function y5(e,t){let i=e[0],r=e.slice(-1);return"true"===e||"false"===e?"true"===e:i===r&&["'",'"'].includes(i)?e.slice(1,-1):lF(e)?parseFloat(e):t[e]}var y8=Object.defineProperty,y9=(e,t,i)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?y8(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i,i},y6=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},y7=(e,t,i)=>(y6(e,t,"read from private field"),i?i.call(e):t.get(e)),Te=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Tt=(e,t,i,r)=>(y6(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),Ti=(e,t,i)=>(y6(e,t,"access private method"),i);let Tr={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},Ta=lQ.createElement("template");Ta.innerHTML=` 1622 <style> 1623 :host { 1624 display: inline-block; 1625 line-height: 0; 1626 } 1627 1628 media-controller { 1629 width: 100%; 1630 height: 100%; 1631 } 1632 1633 media-controller:not([mediasubtitleslist]) media-captions-selectmenu, 1634 media-captions-button:not([mediasubtitleslist]), 1635 media-rendition-selectmenu[mediarenditionunavailable], 1636 media-audio-track-selectmenu[mediaaudiotrackunavailable], 1637 media-volume-range[mediavolumeunavailable], 1638 media-airplay-button[mediaairplayunavailable], 1639 media-fullscreen-button[mediafullscreenunavailable], 1640 media-cast-button[mediacastunavailable], 1641 media-pip-button[mediapipunavailable] { 1642 display: none; 1643 } 1644 </style> 1645`;class Ts extends lX.HTMLElement{constructor(){super(),Te(this,TL),Te(this,TI),y9(this,"renderRoot"),y9(this,"renderer"),Te(this,Tk,void 0),Te(this,TS,void 0),Te(this,Tw,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());const e=new MutationObserver(e=>{var t;(!this.mediaController||(null==(t=this.mediaController)?void 0:t.breakpointsComputed))&&e.some(e=>{let t=e.target;return t===this||"media-controller"===t.localName&&!!(Tr[e.attributeName]||e.attributeName.startsWith("breakpoint"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(lT.BREAKPOINTS_COMPUTED,this.render),Ti(this,TL,TR).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return null!=(e=y7(this,Tk))?e:this.constructor.template}set template(e){Tt(this,Tw,null),Tt(this,Tk,e),this.createRenderer()}get props(){var e,t,i;let r=[...Array.from(null!=(t=null==(e=this.mediaController)?void 0:e.attributes)?t:[]).filter(({name:e})=>Tr[e]||e.startsWith("breakpoint")),...Array.from(this.attributes)],a={};for(let e of r){let t=null!=(i=Tr[e.name])?i:e.name.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase()),{value:r}=e;null!=r?(lF(r)&&(r=parseFloat(r)),a[t]=""===r||r):a[t]=!1}return a}
1645attributeChangedCallback(e,t,i){"template"===e&&t!=i&&Ti(this,TI,TC).call(this)}connectedCallback(){Ti(this,TI,TC).call(this)}createRenderer(){this.template&&this.template!==y7(this,TS)&&(Tt(this,TS,this.template),this.renderer=new yF(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(Ta.content.cloneNode(!0),this.renderer))}render(){var e;null==(e=this.renderer)||e.update(this.props)}}async function Tn(e){let t=await fetch(e);if(200!==t.status)throw Error(`Failed to load resource: the server responded with a status of ${t.status}`);return t.text()}Tk=new WeakMap,TS=new WeakMap,Tw=new WeakMap,TL=new WeakSet,TR=function(e){if(Object.prototype.hasOwnProperty.call(this,e)){let t=this[e];delete this[e],this[e]=t}},TI=new WeakSet,TC=function(){var e;let t=this.getAttribute("template");if(!t||t===y7(this,Tw))return;let i=this.getRootNode(),r=null==(e=null==i?void 0:i.getElementById)?void 0:e.call(i,t);if(r){Tt(this,Tw,t),Tt(this,Tk,r),this.createRenderer();return}(function(e){if(!/^(\/|\.\/|https?:\/\/)/.test(e))return!1;let t=/^https?:\/\//.test(e)?void 0:location.origin;try{new URL(e,t)}catch(e){return!1}return!0})(t)&&(Tt(this,Tw,t),Tn(t).then(e=>{let t=lQ.createElement("template");t.innerHTML=e,Tt(this,Tk,t),this.createRenderer()}).catch(console.error))},y9(Ts,"template"),y9(Ts,"observedAttributes",["template"]),y9(Ts,"processor",y0),lX.customElements.get("media-theme")||lX.customElements.define("media-theme",Ts);var To=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Tl=(e,t,i)=>(To(e,t,"read from private field"),i?i.call(e):t.get(e)),Td=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Th=(e,t,i,r)=>(To(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),Tu=(e,t,i)=>(To(e,t,"access private method"),i),Tc=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};"u"<typeof DocumentFragment&&(globalThis.DocumentFragment=class extends Tc{});var Tm,Tp,Tf,Tg,Tv,TE,Tb,Ty,TT,TA,T_,Tk,TS,Tw,TL,TR,TI,TC,TD,Tx=class extends Tc{},TM=class{constructor(e,t={}){Td(this,TD,void 0),Th(this,TD,null==t?void 0:t.detail)}get detail(){return Tl(this,TD)}initCustomEvent(){}};TD=new WeakMap;var TO={document:{createElement:function(e,t){return new Tx}},DocumentFragment,customElements:{get(e){},define(e,t,i){},upgrade(e){},whenDefined:e=>Promise.resolve(Tx)},CustomEvent:TM,EventTarget:Tc,HTMLElement:Tx,HTMLVideoElement:class extends Tc{}},TP="u"<typeof window||void 0===globalThis.customElements,TN=TP?TO:globalThis,TU=TP?TO.document:globalThis.document,TF={code:"en"};function TB(e,t=!0){var i;return new T$(t&&null!=(i=null==TF?void 0:TF[e])?i:e,t?TF.code:"en")}var T$=class{constructor(e,t=(e=>null!=(e=TF.code)?e:"en")()){this.message=e,this.locale=t}format(e){return this.message.replace(/\{(\w+)\}/g,(t,i)=>{var r;return null!=(r=e[i])?r:""})}toString(){return this.message}};function TH(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function TW(e){return e.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function TG(e){if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}function TV(e){let t=(function(e){let t={};for(let i in e)null!=e[i]&&(t[i]=e[i]);return new URLSearchParams(t)})(e).toString();return t?"?"+t:""}function TK(e){let t=(null!=e?e:"").split(".")[1];return t?JSON.parse(decodeURIComponent(atob(t.replace(/-/g,"+").replace(/_/g,"/")).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))):{}}var Tq,Tj,TY,Tz=(e,t)=>!!e&&!!t&&(!!e.contains(t)||Tz(e,t.getRootNode().host)),TX="mux.com",TQ=(()=>{try{return"2.9.1"}catch{}return"UNKNOWN"})(),TZ=e=>{if(e){if([oi,ot].includes(e))return e;if(null!=e&&e.includes("live"))return oi}},TJ={crossorigin:"crossOrigin",playsinline:"playsInline"},T0=class{constructor(e,t){Td(this,Tq,void 0),Td(this,Tj,void 0),Td(this,TY,[]),Th(this,Tq,e),Th(this,Tj,t)}[Symbol.iterator](){return Tl(this,TY).values()}get length(){return Tl(this,TY).length}get value(){var e;return null!=(e=Tl(this,TY).join(" "))?e:""}set value(e){var t;e!==this.value&&(Th(this,TY,[]),this.add(...null!=(t=null==e?void 0:e.split(" "))?t:[]))}toString(){return this.value}item(e){return Tl(this,TY)[e]}values(){return Tl(this,TY).values()}keys(){return Tl(this,TY).keys()}forEach(e){Tl(this,TY).forEach(e)}add(...e){var t,i;
1645e.forEach(e=>{this.contains(e)||Tl(this,TY).push(e)}),(""!==this.value||null!=(t=Tl(this,Tq))&&t.hasAttribute(`${Tl(this,Tj)}`))&&null!=(i=Tl(this,Tq))&&i.setAttribute(`${Tl(this,Tj)}`,`${this.value}`)}remove(...e){var t;e.forEach(e=>{Tl(this,TY).splice(Tl(this,TY).indexOf(e),1)}),null==(t=Tl(this,Tq))||t.setAttribute(`${Tl(this,Tj)}`,`${this.value}`)}contains(e){return Tl(this,TY).includes(e)}toggle(e,t){return void 0!==t?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){this.remove(e),this.add(t)}};Tq=new WeakMap,Tj=new WeakMap,TY=new WeakMap;var T1=`[mux-player ${TQ}]`;function T2(...e){console.warn(T1,...e)}function T3(...e){console.error(T1,...e)}function T4(e){var t;let i=null!=(t=e.message)?t:"";e.context&&(i+=` ${e.context}`),e.file&&(i+=` ${TB("Read more: ")} 1646https://github.com/muxinc/elements/blob/main/errors/${e.file}`),T2(i)}var T5,T8={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},T9={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},T6=Object.freeze({length:0,start(e){let t=e>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(e){let t=e>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),T7=E2.filter(e=>"error"!==e),Ae=Object.values(T8).filter(e=>![T8.PLAYSINLINE].includes(e)),At=Object.values(T9),Ai=class extends TN.HTMLElement{constructor(){super(),Td(this,T5,new WeakMap),new MutationObserver(e=>{for(let t of e)"childList"===t.type&&(t.removedNodes.forEach(e=>{var t;null==(t=Tl(this,T5).get(e))||t.remove()}),t.addedNodes.forEach(e=>{var t;null!=e&&e.slot||null==(t=this.media)||t.append(Aa(Tl(this,T5),e))}))}).observe(this,{childList:!0,subtree:!0})}static get observedAttributes(){return[...Ae,...At]}init(){this.querySelectorAll(":scope > :not([slot])").forEach(e=>{var t;null==(t=this.media)||t.append(Aa(Tl(this,T5),e))}),T7.forEach(e=>{var t;null==(t=this.media)||t.addEventListener(e,e=>{this.dispatchEvent(new Event(e.type))})})}attributeChangedCallback(e,t,i){var r,a;switch(e){case T9.MUTED:this.media&&(this.media.muted=null!=i,this.media.defaultMuted=null!=i);return;case T9.VOLUME:{let e=null!=(r=TG(i))?r:1;this.media&&(this.media.volume=e);return}case T9.PLAYBACKRATE:{let e=null!=(a=TG(i))?a:1;this.media&&(this.media.playbackRate=e,this.media.defaultPlaybackRate=e);return}}}play(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.play())?t:Promise.reject()}pause(){var e;null==(e=this.media)||e.pause()}load(){var e;null==(e=this.media)||e.load()}requestCast(e){var t;return null==(t=this.media)?void 0:t.requestCast(e)}get media(){var e;return null==(e=this.shadowRoot)?void 0:e.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var e,t;return null==(t=null==(e=this.media)?void 0:e.paused)||t}get duration(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.duration)?t:NaN}get ended(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.ended)&&t}get buffered(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.buffered)?t:T6}get seekable(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.seekable)?t:T6}get readyState(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.readyState)?t:0}get videoWidth(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.videoWidth)?t:0}get videoHeight(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.videoHeight)?t:0}get currentSrc(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.currentSrc)?t:""}get currentTime(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.currentTime)?t:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.volume)?t:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.playbackRate)?t:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return null!=(e=TG(this.getAttribute(T9.PLAYBACKRATE)))?e:1}set defaultPlaybackRate(e){null!=e?this.setAttribute(T9.PLAYBACKRATE,`${e}`):this.removeAttribute(T9.PLAYBACKRATE)}get crossOrigin(){return Ar(this,T8.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(T8.CROSSORIGIN,`${e}`)}get autoplay(){return null!=Ar(this,T8.AUTOPLAY)}set autoplay(e){e?this.setAttribute(T8.AUTOPLAY,"string"==typeof e?e:""):this.removeAttribute(T8.AUTOPLAY)}get loop(){return null!=Ar(this,T8.LOOP)}set loop(e){e?this.setAttribute(T8.LOOP,""):this.removeAttribute(T8.LOOP)}get muted(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.muted)&&t}set muted(e){this.media&&(this.media.muted=!!e)}get defaultMuted(){return null!=Ar(this,T8.MUTED)}set defaultMuted(e){e?this.setAttribute(T8.MUTED,""):this.removeAttribute(T8.MUTED)}
1646get playsInline(){return null!=Ar(this,T8.PLAYSINLINE)}set playsInline(e){T3("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(e){["","none","metadata","auto"].includes(e)?this.setAttribute(T8.PRELOAD,e):this.removeAttribute(T8.PRELOAD)}};function Ar(e,t){return e.media?e.media.getAttribute(t):e.getAttribute(t)}function Aa(e,t){let i=e.get(t);return i||(i=t.cloneNode(),e.set(t,i)),i}T5=new WeakMap;var As=Ai,An=`:host { 1647 --media-control-display: var(--controls); 1648 --media-loading-indicator-display: var(--loading-indicator); 1649 --media-dialog-display: var(--dialog); 1650 --media-play-button-display: var(--play-button); 1651 --media-live-button-display: var(--live-button); 1652 --media-seek-backward-button-display: var(--seek-backward-button); 1653 --media-seek-forward-button-display: var(--seek-forward-button); 1654 --media-mute-button-display: var(--mute-button); 1655 --media-captions-button-display: var(--captions-button); 1656 --media-captions-selectmenu-display: var(--captions-selectmenu, var(--media-captions-button-display)); 1657 --media-rendition-selectmenu-display: var(--rendition-selectmenu); 1658 --media-audio-track-selectmenu-display: var(--audio-track-selectmenu); 1659 --media-airplay-button-display: var(--airplay-button); 1660 --media-pip-button-display: var(--pip-button); 1661 --media-fullscreen-button-display: var(--fullscreen-button); 1662 --media-cast-button-display: var(--cast-button, var(--_cast-button-drm-display)); 1663 --media-playback-rate-button-display: var(--playback-rate-button); 1664 --media-playback-rate-selectmenu-display: var(--playback-rate-selectmenu); 1665 --media-volume-range-display: var(--volume-range); 1666 --media-time-range-display: var(--time-range); 1667 --media-time-display-display: var(--time-display); 1668 --media-duration-display-display: var(--duration-display); 1669 --media-title-display-display: var(--title-display); 1670 1671 display: inline-block; 1672 width: 100%; 1673 line-height: 0; 1674} 1675 1676/* Hide custom elements that are not defined yet */ 1677:not(:defined) { 1678 display: none; 1679} 1680 1681a { 1682 color: #fff; 1683 font-size: 0.9em; 1684 text-decoration: underline; 1685} 1686 1687media-theme { 1688 width: 100%; 1689 height: 100%; 1690 direction: ltr; 1691} 1692 1693media-poster-image { 1694 width: 100%; 1695 height: 100%; 1696} 1697 1698media-poster-image:not([src]):not([placeholdersrc]) { 1699 display: none; 1700} 1701 1702::part(top), 1703[part~='top'] { 1704 --media-control-display: var(--controls, var(--top-controls)); 1705 --media-play-button-display: var(--play-button, var(--top-play-button)); 1706 --media-live-button-display: var(--live-button, var(--top-live-button)); 1707 --media-seek-backward-button-display: var(--seek-backward-button, var(--top-seek-backward-button)); 1708 --media-seek-forward-button-display: var(--seek-forward-button, var(--top-seek-forward-button)); 1709 --media-mute-button-display: var(--mute-button, var(--top-mute-button)); 1710 --media-captions-button-display: var(--captions-button, var(--top-captions-button)); 1711 --media-captions-selectmenu-display: var( 1712 --captions-selectmenu, 1713 var(--media-captions-button-display, var(--top-captions-selectmenu)) 1714 ); 1715 --media-rendition-selectmenu-display: var(--rendition-selectmenu, var(--top-rendition-selectmenu)); 1716 --media-audio-track-selectmenu-display: var(--audio-track-selectmenu, var(--top-audio-track-selectmenu)); 1717 --media-airplay-button-display: var(--airplay-button, var(--top-airplay-button)); 1718 --media-pip-button-display: var(--pip-button, var(--top-pip-button)); 1719 --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button)); 1720 --media-cast-button-display: var(--cast-button, var(--top-cast-button, var(--_cast-button-drm-display))); 1721 --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button)); 1722 --media-playback-rate-selectmenu-display: var( 1723 --captions-selectmenu, 1724 var(--media-playback-rate-button-display, var(--top-playback-rate-selectmenu)) 1725 ); 1726 --media-volume-range-display: var(--volume-range, var(--top-volume-range)); 1727 --media-time-range-display: var(--time-range, var(--top-time-range)); 1728 --media-time-display-display: var(--time-display, var(--top-time-display)); 1729 --media-duration-display-display: var(--duration-display, var(--top-duration-display)); 1730 --media-title-display-display: var(--title-display, var(--top-title-display)); 1731} 1732 1733::part(center), 1734[part~='center'] {
1735 --media-control-display: var(--controls, var(--center-controls)); 1736 --media-play-button-display: var(--play-button, var(--center-play-button)); 1737 --media-live-button-display: var(--live-button, var(--center-live-button)); 1738 --media-seek-backward-button-display: var(--seek-backward-button, var(--center-seek-backward-button)); 1739 --media-seek-forward-button-display: var(--seek-forward-button, var(--center-seek-forward-button)); 1740 --media-mute-button-display: var(--mute-button, var(--center-mute-button)); 1741 --media-captions-button-display: var(--captions-button, var(--center-captions-button)); 1742 --media-captions-selectmenu-display: var( 1743 --captions-selectmenu, 1744 var(--media-captions-button-display, var(--center-captions-selectmenu)) 1745 ); 1746 --media-rendition-selectmenu-display: var(--rendition-selectmenu, var(--center-rendition-selectmenu)); 1747 --media-audio-track-selectmenu-display: var(--audio-track-selectmenu, var(--center-audio-track-selectmenu)); 1748 --media-airplay-button-display: var(--airplay-button, var(--center-airplay-button)); 1749 --media-pip-button-display: var(--pip-button, var(--center-pip-button)); 1750 --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button)); 1751 --media-cast-button-display: var(--cast-button, var(--center-cast-button, var(--_cast-button-drm-display))); 1752 --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button)); 1753 --media-playback-rate-selectmenu-display: var( 1754 --playback-rate-selectmenu, 1755 var(--media-playback-rate-button-display, var(--center-playback-rate-selectmenu)) 1756 ); 1757 --media-volume-range-display: var(--volume-range, var(--center-volume-range)); 1758 --media-time-range-display: var(--time-range, var(--center-time-range)); 1759 --media-time-display-display: var(--time-display, var(--center-time-display)); 1760 --media-duration-display-display: var(--duration-display, var(--center-duration-display)); 1761} 1762 1763::part(bottom), 1764[part~='bottom'] { 1765 --media-control-display: var(--controls, var(--bottom-controls)); 1766 --media-play-button-display: var(--play-button, var(--bottom-play-button)); 1767 --media-live-button-display: var(--live-button, var(--bottom-live-button)); 1768 --media-seek-backward-button-display: var(--seek-backward-button, var(--bottom-seek-backward-button)); 1769 --media-seek-forward-button-display: var(--seek-forward-button, var(--bottom-seek-forward-button)); 1770 --media-mute-button-display: var(--mute-button, var(--bottom-mute-button)); 1771 --media-captions-button-display: var(--captions-button, var(--bottom-captions-button)); 1772 --media-captions-selectmenu-display: var( 1773 --captions-selectmenu, 1774 var(--media-captions-button-display, var(--bottom-captions-selectmenu)) 1775 ); 1776 --media-rendition-selectmenu-display: var(--rendition-selectmenu, var(--bottom-rendition-selectmenu)); 1777 --media-audio-track-selectmenu-display: var(--audio-track-selectmenu, var(--bottom-audio-track-selectmenu)); 1778 --media-airplay-button-display: var(--airplay-button, var(--bottom-airplay-button)); 1779 --media-pip-button-display: var(--pip-button, var(--bottom-pip-button)); 1780 --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button)); 1781 --media-cast-button-display: var(--cast-button, var(--bottom-cast-button, var(--_cast-button-drm-display))); 1782 --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button)); 1783 --media-playback-rate-selectmenu-display: var( 1784 --playback-rate-selectmenu, 1785 var(--media-playback-rate-button-display, var(--bottom-playback-rate-selectmenu)) 1786 ); 1787 --media-volume-range-display: var(--volume-range, var(--bottom-volume-range)); 1788 --media-time-range-display: var(--time-range, var(--bottom-time-range)); 1789 --media-time-display-display: var(--time-display, var(--bottom-time-display)); 1790 --media-duration-display-display: var(--duration-display, var(--bottom-duration-display)); 1791 --media-title-display-display: var(--title-display, var(--bottom-title-display)); 1792} 1793`,Ao=` 1794 :host { 1795 z-index: 100; 1796 display: var(--media-dialog-display, flex); 1797 justify-content: center;
1798 align-items: center; 1799 width: 100%; 1800 height: 100%; 1801 position: absolute; 1802 top: 0; 1803 left: 0; 1804 box-sizing: border-box; 1805 color: #fff; 1806 line-height: 18px; 1807 font-family: Arial, sans-serif; 1808 padding: var(--media-dialog-backdrop-padding, 0); 1809 background: var(--media-dialog-backdrop-background, 1810 linear-gradient(to bottom, rgba(20, 20, 30, 0.7) 50%, rgba(20, 20, 30, 0.9)) 1811 ); 1812 /* Needs to use !important to prevent overwrite of media-chrome */ 1813 transition: var(--media-dialog-transition-open, visibility .2s, opacity .2s) !important; 1814 transform: var(--media-dialog-transform-open, none) !important; 1815 visibility: visible !important; 1816 opacity: 1 !important; 1817 pointer-events: auto !important; 1818 } 1819 1820 :host(:not([open])) { 1821 /* Needs to use !important to prevent overwrite of media-chrome */ 1822 transition: var(--media-dialog-transition-close, visibility .1s, opacity .1s) !important; 1823 transform: var(--media-dialog-transform-close, none) !important; 1824 visibility: hidden !important; 1825 opacity: 0 !important; 1826 pointer-events: none !important; 1827 } 1828 1829 :focus-visible { 1830 box-shadow: 0 0 0 2px rgba(27, 127, 204, 0.9); 1831 } 1832 1833 .dialog { 1834 position: relative; 1835 box-sizing: border-box; 1836 background: var(--media-dialog-background, none); 1837 padding: var(--media-dialog-padding, 10px); 1838 width: min(320px, 100%); 1839 word-wrap: break-word; 1840 max-height: 100%; 1841 overflow: auto; 1842 text-align: center; 1843 line-height: 1.4; 1844 } 1845`,Al=TU.createElement("template");Al.innerHTML=` 1846 <style> 1847 ${Ao} 1848 </style> 1849 1850 <div class="dialog"> 1851 <slot></slot> 1852 </div> 1853`;var Ad=class extends TN.HTMLElement{constructor(){var e;super(),this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),Ah(this)}close(){var e;this.hasAttribute("open")&&(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),e=this,e._previouslyFocusedElement instanceof HTMLElement&&e._previouslyFocusedElement.focus())}attributeChangedCallback(e,t,i){"open"===e&&t!==i&&(null!=i?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&Ah(this)}};function Ah(e){let t=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(e.dispatchEvent(t),t.defaultPrevented)return;let i=e.querySelector("[autofocus]:not([disabled])");!i&&e.tabIndex>=0&&(i=e),i||(i=function e(t){let i=["button","input","keygen","select","textarea"].map(function(e){return e+":not([disabled])"});i.push('[tabindex]:not([disabled]):not([tabindex=""])');let r=null==t?void 0:t.querySelector(i.join(", "));if(!r&&"attachShadow"in Element.prototype){let i=(null==t?void 0:t.querySelectorAll("*"))||[];for(let t=0;t<i.length&&!(i[t].tagName&&i[t].shadowRoot&&(r=e(i[t].shadowRoot)));t++);}return r}(e.shadowRoot)),e._previouslyFocusedElement=TU.activeElement,TU.activeElement instanceof HTMLElement&&TU.activeElement.blur(),e.addEventListener("transitionend",()=>{i instanceof HTMLElement&&i.focus({preventScroll:!0})},{once:!0})}Ad.styles=Ao,Ad.template=Al,Ad.observedAttributes=["open"],TN.customElements.get("media-dialog")||(TN.customElements.define("media-dialog",Ad),TN.MediaDialog=Ad);var Au=Ad,Ac=TU.createElement("template");Ac.innerHTML=` 1854 <style> 1855 ${Au.styles} 1856 1857 .close { 1858 background: none; 1859 color: inherit; 1860 border: none; 1861 padding: 0; 1862 font: inherit; 1863 cursor: pointer; 1864 outline: inherit; 1865 width: 28px; 1866 height: 28px; 1867 position: absolute; 1868 top: 1rem; 1869 right: 1rem; 1870 } 1871 </style> 1872 1873 <div class="dialog"> 1874 <slot></slot> 1875 </div> 1876 1877 <slot name="close"> 1878 <button class="close" tabindex="0"> 1879 <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"> 1880 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /> 1881 </svg> 1882 </button> 1883 </slot> 1884`;var Am=class extends Au{constructor(){var e,t;super(),null==(t=null==(e=this.shadowRoot)?void 0:e.querySelector(".close"))||t.addEventListener("click",()=>{this.close()})}};Am.template=Ac,TN.customElements.get("mxp-dialog")||(TN.customElements.define("mxp-dialog",Am),TN.MxpDialog=Am);var Ap=new WeakMap,Af=class e{constructor(e,t){this.element=e,this.type=t,this.element.addEventListener(this.type,this);let i=Ap.get(this.element);i&&i.set(this.type,this)}set(e){if("function"==typeof e)this.handleEvent=e.bind(this.element);else if("object"==typeof e&&"function"==typeof e.handleEvent)this.handleEvent=e.handleEvent.bind(e);else{this.element.removeEventListener(this.type,this);let e=Ap.get(this.element);
1884e&&e.delete(this.type)}}static for(t){Ap.has(t.element)||Ap.set(t.element,new Map);let i=t.attributeName.slice(2),r=Ap.get(t.element);return r&&r.has(i)?r.get(i):new e(t.element,i)}},Ag=new Map,Av=new WeakMap,AE=new WeakMap,Ab=class{constructor(e,t,i){this.strings=e,this.values=t,this.processor=i,this.stringsKey=this.strings.join("\x01")}get template(){if(Ag.has(this.stringsKey))return Ag.get(this.stringsKey);{let e=TU.createElement("template"),t=this.strings.length-1;return e.innerHTML=this.strings.reduce((e,i,r)=>e+i+(r<t?`{{ ${r} }}`:""),""),Ag.set(this.stringsKey,e),e}}renderInto(e){var t;let i=this.template;if(Av.get(e)!==i){Av.set(e,i);let t=new yF(i,this.values,this.processor);AE.set(e,t),e instanceof yq?e.replace(...t.children):e.appendChild(t);return}let r=AE.get(e);null==(t=null==r?void 0:r.update)||t.call(r,this.values)}},Ay={processCallback(e,t,i){var r;if(i)for(let[e,a]of t)e in i&&function(e,t){(function(e,t){if(e instanceof yK&&t instanceof Element){let i=e.element;return i[e.attributeName]!==t&&(e.element.removeAttributeNS(e.attributeNamespace,e.attributeName),i[e.attributeName]=t),!0}return!1})(e,t)||function(e,t){if("boolean"==typeof t&&e instanceof yK){let i=e.attributeNamespace;return t!==e.element.hasAttributeNS(i,e.attributeName)&&(e.booleanValue=t),!0}return!1}(e,t)||e instanceof yK&&e.attributeName.startsWith("on")&&(Af.for(e).set(t),e.element.removeAttributeNS(e.attributeNamespace,e.attributeName),1)||!1===t&&e instanceof yq&&(e.replace(""),1)||t instanceof Ab&&e instanceof yq&&(t.renderInto(e),1)||t instanceof DocumentFragment&&e instanceof yq&&(t.childNodes.length&&e.replace(...t.childNodes),1)||function(e,t){if(e instanceof yK){let i=e.attributeNamespace,r=e.element.getAttributeNS(i,e.attributeName);return String(t)!==r&&(e.value=String(t))}e.value=String(t)}(e,t)}(a,null!=(r=i[e])?r:"")}};function AT(e,...t){return new Ab(e,t,Ay)}var AA=Object.values({TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",DISPLAY:"display",CONTROL_BAR:"control-bar",SELECTMENU:"selectmenu",LISTBOX:"listbox",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"}).join(", ");function A_(e,t,i,r,a){var s,n,o;let l={},d={};switch(e.code){case n6.MEDIA_ERR_NETWORK:switch(l.title=TB("Network Error",a),l.message=e.message,null==(s=e.data)?void 0:s.response.code){case 412:l.title=TB("Video is not currently available",a),l.message=TB("The live stream or video file are not yet ready.",a),d.message=TB("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",a),d.file="412-not-playable.md";break;case 404:l.title=TB("Video does not exist",a),l.message="",d.message=TB("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",a),d.file="404-not-found.md";break;case 403:{if(l.title=TB("Invalid playback URL",a),l.message=TB("The video URL or playback-token are formatted with incorrect or incomplete information.",a),d.message=TB("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",a),d.file="missing-signed-tokens.md",!r)break;let{exp:e,aud:t,sub:s}=TK(r),n=Date.now()>1e3*e,o=s!==i,h="v"!==t,u={timeStyle:"medium",dateStyle:"medium"};if(n){l.title=TB("Video URL has expired",a),l.message=TB("The video’s secured playback-token has expired.",a),d.message=TB("The video’s secured playback-token has expired.",a),d.context=TB("Expired at: {expiredDate}. Current time: {currentDate}.",a).format({expiredDate:new Intl.DateTimeFormat(TF.code,u).format(1e3*e),currentDate:new Intl.DateTimeFormat(TF.code,u).format(Date.now())}),d.file="403-expired-token.md";break}if(o){l.title=TB("Video URL is formatted incorrectly",a),l.message=TB("The video’s playback ID does not match the one encoded in the playback-token.",a),d.message=TB("The video’s playback ID does not match the one encoded in the playback-token.",a),d.context=TB("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",a).format({playbackId:i,tokenPlaybackId:s}),d.file="403-playback-id-mismatch.md";break}if(h){l.title=TB("Video URL is formatted incorrectly",a),l.message=TB("The playback-token is formatted with incorrect information.",a),d.message=TB("The playback-token is formatted with incorrect information.",a),d.context=TB("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",a).format({tokenType:t}),d.file="403-incorrect-aud-value.md";break}d.message=TB("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",a),d.file="403-malformatted-token.md"}}break;case n6.MEDIA_ERR_DECODE:{let{message:t}=e;l={title:TB("Media Error",a),message:t},d.file="media-decode-error.md";break}case n6.MEDIA_ERR_SRC_NOT_SUPPORTED:{let s=null==(o=null==(n=e.data)?void 0:n.response)?void 0:o.code;if(s>=400&&s<500){e.code=n6.MEDIA_ERR_NETWORK,e.data={response:{code:s}},{dialog:l,devlog:d}=A_(e,t,i,r);break}l={title:TB("Source Not Supported",a),message:e.message},d.file="media-src-not-supported.md";break}default:l={title:TB("Error",a),message:e.message}}return t&&(l={title:TB("Your device appears to be offline",a),message:TB("Check your internet connection and try reloading this video.",a)}),{dialog:l,devlog:d}}var Ak=`<template id="media-theme-gerwig"> 1885 <style>
1886 @keyframes pre-play-hide { 1887 0% { 1888 transform: scale(1); 1889 opacity: 1; 1890 } 1891 1892 30% { 1893 transform: scale(0.7); 1894 } 1895 1896 100% { 1897 transform: scale(1.5); 1898 opacity: 0; 1899 } 1900 } 1901 1902 :host { 1903 --_primary-color: var(--media-primary-color, #fff); 1904 --_secondary-color: var(--media-secondary-color, transparent); 1905 --_accent-color: var(--media-accent-color, #fa50b5); 1906 --_text-color: var(--media-text-color, #000); 1907 1908 --media-icon-color: var(--_primary-color); 1909 --media-control-background: var(--_secondary-color); 1910 --media-control-hover-background: var(--_accent-color); 1911 --media-time-buffered-color: rgba(255, 255, 255, 0.4); 1912 --media-preview-time-text-shadow: none; 1913 --media-control-height: 14px; 1914 --media-control-padding: 6px; 1915 1916 color: var(--_primary-color); 1917 display: inline-block; 1918 width: 100%; 1919 height: 100%; 1920 } 1921 1922 :host([audio]) { 1923 --_secondary-color: var(--media-secondary-color, black); 1924 --media-preview-time-text-shadow: none; 1925 } 1926 1927 :host([audio]) ::slotted([slot='media']) { 1928 height: 0px; 1929 } 1930 1931 :host([audio]) media-loading-indicator { 1932 display: none; 1933 } 1934 1935 :host([audio]) media-controller { 1936 background: transparent; 1937 } 1938 1939 :host([audio]) media-controller::part(vertical-layer) { 1940 background: transparent; 1941 } 1942 1943 :host([audio]) media-control-bar { 1944 width: 100%; 1945 background-color: var(--media-control-background); 1946 } 1947 1948 /* 1949 * 0.433s is the transition duration for VTT Regions. 1950 * Borrowed here, so the captions don't move too fast. 1951 */ 1952 media-controller { 1953 --media-webkit-text-track-transform: translateY(0) scale(0.98); 1954 --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s; 1955 } 1956 media-controller:is([mediapaused], :not([userinactive])) { 1957 --media-webkit-text-track-transform: translateY(-50px) scale(0.98); 1958 --media-webkit-text-track-transition: transform 0.15s ease; 1959 } 1960 1961 /* 1962 * CSS specific to iOS devices. 1963 * See: https://stackoverflow.com/questions/30102792/css-media-query-to-target-only-ios-devices/60220757#60220757 1964 */ 1965 @supports (-webkit-touch-callout: none) { 1966 /* Disable subtitle adjusting for iOS Safari */ 1967 media-controller[mediaisfullscreen] { 1968 --media-webkit-text-track-transform: unset; 1969 --media-webkit-text-track-transition: unset; 1970 } 1971 } 1972 1973 media-time-range { 1974 --media-box-padding-left: 6px; 1975 --media-box-padding-right: 6px; 1976 --media-range-bar-color: var(--_accent-color); 1977 --media-time-range-buffered-color: var(--_primary-color); 1978 --media-range-track-color: transparent; 1979 --media-range-track-background: rgba(255, 255, 255, 0.4); 1980 --media-range-thumb-background: radial-gradient( 1981 circle, 1982 #000 0%, 1983 #000 25%, 1984 var(--_accent-color) 25%, 1985 var(--_accent-color) 1986 ); 1987 --media-range-thumb-width: 12px; 1988 --media-range-thumb-height: 12px; 1989 --media-range-thumb-transform: scale(0); 1990 --media-range-thumb-transition: transform 0.3s; 1991 --media-range-thumb-opacity: 1; 1992 --media-preview-background: var(--_primary-color); 1993 --media-box-arrow-background: var(--_primary-color); 1994 --media-preview-thumbnail-border: 5px solid var(--_primary-color); 1995 --media-preview-border-radius: 5px; 1996 --media-text-color: var(--_text-color); 1997 --media-control-hover-background: transparent; 1998 --media-preview-chapter-text-shadow: none; 1999 color: var(--_accent-color); 2000 padding: 0 6px; 2001 } 2002 2003 :host([audio]) media-time-range { 2004 --media-preview-time-padding: 1.5px 6px; 2005 --media-preview-box-margin: 0 0 -5px; 2006 } 2007 2008 media-time-range:hover { 2009 --media-range-thumb-transform: scale(1); 2010 } 2011 2012 media-preview-thumbnail { 2013 border-bottom-width: 0; 2014 } 2015 2016 [part~='listbox'] { 2017 border-radius: 2px; 2018 border: 1px solid rgba(0, 0, 0, 0.1); 2019 bottom: calc(100% + 16px); 2020 padding: 2.5px 10px; 2021 } 2022 2023 [part~='listbox']::part(indicator) { 2024 fill: var(--_accent-color); 2025 } 2026 2027 [part~='listbox']::part(option) { 2028 box-sizing: border-box; 2029 display: flex; 2030 align-items: center; 2031 padding: 6px 10px; 2032 min-height: 34px; 2033 } 2034 2035 [part~='listbox']::part(option-selected) { 2036 font-weight: 700; 2037 } 2038 2039 media-captions-selectmenu, 2040 media-rendition-selectmenu, 2041 media-audio-track-selectmenu, 2042 media-playback-rate-listbox[part~='listbox'] { 2043 --media-listbox-background: var(--_primary-color); 2044 --media-option-selected-background: transparent; 2045 --media-option-hover-background: transparent; 2046 --media-option-hover-outline: var(--_accent-color) solid 1px; 2047 --media-text-color: var(--_text-color); 2048 } 2049 2050 /* The icon is a circle so make it 16px high instead of 14px for more balance. */ 2051 media-audio-track-selectmenu { 2052 --media-control-padding: 5px; 2053 --media-control-height: 16px; 2054 } 2055 2056 media-playback-rate-button { 2057 --media-control-padding: 6px 3px; 2058 min-width: 4.4ch; 2059 } 2060 2061 media-playback-rate-listbox[part~='listbox'] { 2062 --media-listbox-layout: row; 2063 --media-option-selected-background: var(--_accent-color); 2064 margin-right: 6px; 2065 padding: 0; 2066 } 2067 2068 media-playback-rate-listbox[part~='listbox']::part(option) { 2069 padding: 6px 4px; 2070 } 2071 2072 media-playback-rate-listbox[part~='listbox']::part(option-selected) { 2073 color: #fff; 2074 } 2075 2076 :host(:not([audio])) media-time-range { 2077 /* Adding px is required here for calc() */ 2078 --media-range-padding: 0px; 2079 background: transparent; 2080 z-index: 10; 2081 height: 10px; 2082 bottom: -3px; 2083 width: 100%; 2084 } 2085 2086 media-control-bar :is([role='button'], [role='switch'], button) { 2087 line-height: 0; 2088 } 2089 2090 media-control-bar :is([part*='button'], [part*='range'], [part*='display']) { 2091 border-radius: 3px; 2092 } 2093 2094 .spacer { 2095 flex-grow: 1; 2096 background-color: var(--media-control-background, rgba(20, 20, 30, 0.7)); 2097 } 2098 2099 media-control-bar[slot~='top-chrome'] { 2100 min-height: 42px; 2101 pointer-events: none; 2102 } 2103 2104 media-control-bar { 2105 --gradient-steps: hsl(0 0% 0% / 0) 0%, hsl(0 0% 0% / 0.013) 8.1%, hsl(0 0% 0% / 0.049) 15.5%, 2106 hsl(0 0% 0% / 0.104) 22.5%, hsl(0 0% 0% / 0.175) 29%, hsl(0 0% 0% / 0.259) 35.3%, hsl(0 0% 0% / 0.352) 41.2%, 2107 hsl(0 0% 0% / 0.45) 47.1%, hsl(0 0% 0% / 0.55) 52.9%, hsl(0 0% 0% / 0.648) 58.8%, hsl(0 0% 0% / 0.741) 64.7%, 2108 hsl(0 0% 0% / 0.825) 71%, hsl(0 0% 0% / 0.896) 77.5%, hsl(0 0% 0% / 0.951) 84.5%, hsl(0 0% 0% / 0.987) 91.9%, 2109 hsl(0 0% 0%) 100%; 2110 } 2111 2112 :host([title]:not([audio])) media-control-bar[slot='top-chrome']::before { 2113 content: ''; 2114 position: absolute; 2115 width: 100%; 2116 padding-bottom: min(100px, 25%); 2117 background: linear-gradient(to top, var(--gradient-steps)); 2118 opacity: 0.8; 2119 pointer-events: none; 2120 } 2121 2122 :host(:not([audio])) media-control-bar[part~='bottom']::before { 2123 content: ''; 2124 position: absolute; 2125 width: 100%; 2126 bottom: 0; 2127 left: 0; 2128 padding-bottom: min(100px, 25%); 2129 background: linear-gradient(to bottom, var(--gradient-steps)); 2130 opacity: 0.8; 2131 z-index: 1; 2132 pointer-events: none; 2133 } 2134 2135 media-control-bar[part~='bottom'] > * { 2136 z-index: 2; 2137 } 2138 2139 media-control-bar[part~='bottom'] { 2140 padding: 6px 6px; 2141 } 2142 2143 media-control-bar[slot~='top-chrome'] > * { 2144 --media-control-background: transparent; 2145 --media-control-hover-background: transparent; 2146 position: relative; 2147 } 2148 2149 media-controller::part(vertical-layer) { 2150 transition: background-color 1s; 2151 } 2152 2153 media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) { 2154 background-color: var(--controls-backdrop-color, var(--controls, transparent)); 2155 transition: background-color 0.25s; 2156 } 2157
2158 .center-controls { 2159 --media-button-icon-width: 100%; 2160 --media-button-icon-height: auto; 2161 pointer-events: none; 2162 width: 100%; 2163 display: flex; 2164 flex-flow: row; 2165 align-items: center; 2166 justify-content: center; 2167 filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25)); 2168 paint-order: stroke; 2169 stroke: rgba(102, 102, 102, 1); 2170 stroke-width: 0.3px; 2171 text-shadow: 2172 0 0 2px rgb(0 0 0 / 0.25), 2173 0 0 6px rgb(0 0 0 / 0.25); 2174 } 2175 2176 .center-controls media-play-button { 2177 --media-control-background: transparent; 2178 --media-control-hover-background: transparent; 2179 --media-control-padding: 0; 2180 width: 40px; 2181 } 2182 2183 [breakpointsm] .center-controls media-play-button { 2184 width: 90px; 2185 height: 90px; 2186 border-radius: 50%; 2187 transition: background 0.4s; 2188 padding: 24px; 2189 --media-control-background: #000; 2190 --media-control-hover-background: var(--_accent-color); 2191 } 2192 2193 .center-controls media-seek-backward-button, 2194 .center-controls media-seek-forward-button { 2195 --media-control-background: transparent; 2196 --media-control-hover-background: transparent; 2197 padding: 0; 2198 margin: 0 20px; 2199 width: max(33px, min(8%, 40px)); 2200 } 2201 2202 [breakpointsm]:not([audio]) .center-controls.pre-playback { 2203 display: grid; 2204 align-items: initial; 2205 justify-content: initial; 2206 height: 100%; 2207 overflow: hidden; 2208 } 2209 2210 [breakpointsm]:not([audio]) .center-controls.pre-playback media-play-button { 2211 place-self: var(--_pre-playback-place, center); 2212 grid-area: 1 / 1; 2213 margin: 16px; 2214 } 2215 2216 /* Show and hide controls or pre-playback state */ 2217 2218 [breakpointsm]:is([mediahasplayed], :not([mediapaused])):not([audio]) 2219 .center-controls.pre-playback 2220 media-play-button { 2221 /* Using \`forwards\` would lead to a laggy UI after the animation got in the end state */ 2222 animation: 0.3s linear pre-play-hide; 2223 opacity: 0; 2224 pointer-events: none; 2225 } 2226 2227 .autoplay-unmute { 2228 --media-control-hover-background: transparent; 2229 width: 100%; 2230 display: flex; 2231 align-items: center; 2232 justify-content: center; 2233 filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25)); 2234 } 2235 2236 .autoplay-unmute-btn { 2237 --media-control-height: 16px; 2238 border-radius: 8px; 2239 background: #000; 2240 color: var(--_primary-color); 2241 display: flex; 2242 align-items: center; 2243 padding: 8px 16px; 2244 font-size: 18px; 2245 font-weight: 500; 2246 cursor: pointer; 2247 } 2248 2249 .autoplay-unmute-btn:hover { 2250 background: var(--_accent-color); 2251 } 2252 2253 [breakpointsm] .autoplay-unmute-btn { 2254 --media-control-height: 30px; 2255 padding: 14px 24px; 2256 font-size: 26px; 2257 } 2258 2259 .autoplay-unmute-btn svg { 2260 margin: 0 6px 0 0; 2261 } 2262 2263 [breakpointsm] .autoplay-unmute-btn svg { 2264 margin: 0 10px 0 0; 2265 } 2266 2267 media-controller:not([audio]):not([mediahasplayed]) *:is(media-control-bar, media-time-range) { 2268 display: none; 2269 } 2270 2271 media-loading-indicator { 2272 --media-loading-icon-width: 100%; 2273 --media-button-icon-height: auto; 2274 display: var(--media-control-display, var(--media-loading-indicator-display, flex)); 2275 pointer-events: none; 2276 position: absolute; 2277 width: min(15%, 150px); 2278 flex-flow: row; 2279 align-items: center; 2280 justify-content: center; 2281 } 2282 2283 /* Intentionally don't target the div for transition but the children 2284 of the div. Prevents messing with media-chrome's autohide feature. */ 2285 media-loading-indicator + div * { 2286 transition: opacity 0.15s; 2287 opacity: 1; 2288 } 2289 2290 media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * { 2291 opacity: 0; 2292 transition-delay: 400ms; 2293 } 2294 2295 media-volume-range { 2296 width: min(100%, 100px); 2297 --media-range-padding-left: 10px; 2298 --media-range-padding-right: 10px; 2299 --media-range-thumb-width: 12px; 2300 --media-range-thumb-height: 12px; 2301 --media-range-thumb-background: radial-gradient( 2302 circle, 2303 #000 0%, 2304 #000 25%, 2305 var(--_primary-color) 25%, 2306 var(--_primary-color) 2307 ); 2308 --media-control-hover-background: none; 2309 } 2310 2311 media-time-display { 2312 white-space: nowrap; 2313 } 2314 2315 /* Generic style for explicitly disabled controls */ 2316 media-control-bar[part~='bottom'] [disabled], 2317 media-control-bar[part~='bottom'] [aria-disabled='true'] { 2318 opacity: 60%;
2319 cursor: not-allowed; 2320 } 2321 2322 media-text-display { 2323 --media-font-size: 16px; 2324 --media-control-padding: 14px; 2325 font-weight: 500; 2326 } 2327 2328 media-play-button.animated *:is(g, path) { 2329 transition: all 0.3s; 2330 } 2331 2332 media-play-button.animated[mediapaused] .pause-icon-pt1 { 2333 opacity: 0; 2334 } 2335 2336 media-play-button.animated[mediapaused] .pause-icon-pt2 { 2337 transform-origin: center center; 2338 transform: scaleY(0); 2339 } 2340 2341 media-play-button.animated[mediapaused] .play-icon { 2342 clip-path: inset(0 0 0 0); 2343 } 2344 2345 media-play-button.animated:not([mediapaused]) .play-icon { 2346 clip-path: inset(0 0 0 100%); 2347 } 2348 2349 media-seek-forward-button, 2350 media-seek-backward-button { 2351 --media-font-weight: 400; 2352 } 2353 2354 .mute-icon { 2355 display: inline-block; 2356 } 2357 2358 .mute-icon :is(path, g) { 2359 transition: opacity 0.5s; 2360 } 2361 2362 .muted { 2363 opacity: 0; 2364 } 2365 2366 media-mute-button[mediavolumelevel='low'] :is(.volume-medium, .volume-high), 2367 media-mute-button[mediavolumelevel='medium'] :is(.volume-high) { 2368 opacity: 0; 2369 } 2370 2371 media-mute-button[mediavolumelevel='off'] .unmuted { 2372 opacity: 0; 2373 } 2374 2375 media-mute-button[mediavolumelevel='off'] .muted { 2376 opacity: 1; 2377 } 2378 2379 /** 2380 * Our defaults for these buttons are to hide them at small sizes 2381 * users can override this with CSS 2382 */ 2383 media-controller:not([breakpointsm]):not([audio]) { 2384 --bottom-play-button: none; 2385 --bottom-seek-backward-button: none; 2386 --bottom-seek-forward-button: none; 2387 --bottom-time-display: none; 2388 --bottom-playback-rate-selectmenu: none; 2389 --bottom-pip-button: none; 2390 } 2391 </style> 2392 2393 <template partial="TitleDisplay"> 2394 <template if="title"> 2395 <media-text-display part="top title display" class="title-display">{{title}}</media-text-display> 2396 </template> 2397 </template> 2398 2399 <template partial="PlayButton"> 2400 <media-play-button 2401 part="{{section ?? 'bottom'}} play button" 2402 disabled="{{disabled}}" 2403 aria-disabled="{{disabled}}" 2404 class="animated" 2405 > 2406 <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon"> 2407 <g class="play-icon"> 2408 <path 2409 d="M15.5987 6.2911L3.45577 0.110898C2.83667 -0.204202 2.06287 0.189698 2.06287 0.819798V13.1802C2.06287 13.8103 2.83667 14.2042 3.45577 13.8891L15.5987 7.7089C16.2178 7.3938 16.2178 6.6061 15.5987 6.2911Z" 2410 /> 2411 </g> 2412 <g class="pause-icon"> 2413 <path 2414 class="pause-icon-pt1" 2415 d="M5.90709 0H2.96889C2.46857 0 2.06299 0.405585 2.06299 0.9059V13.0941C2.06299 13.5944 2.46857 14 2.96889 14H5.90709C6.4074 14 6.81299 13.5944 6.81299 13.0941V0.9059C6.81299 0.405585 6.4074 0 5.90709 0Z" 2416 /> 2417 <path 2418 class="pause-icon-pt2" 2419 d="M15.1571 0H12.2189C11.7186 0 11.313 0.405585 11.313 0.9059V13.0941C11.313 13.5944 11.7186 14 12.2189 14H15.1571C15.6574 14 16.063 13.5944 16.063 13.0941V0.9059C16.063 0.405585 15.6574 0 15.1571 0Z" 2420 /> 2421 </g> 2422 </svg> 2423 </media-play-button> 2424 </template> 2425 2426 <template partial="PrePlayButton"> 2427 <media-play-button 2428 part="{{section ?? 'center'}} play button pre-play" 2429 disabled="{{disabled}}" 2430 aria-disabled="{{disabled}}" 2431 > 2432 <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon" style="transform: translate(3px, 0)"> 2433 <path 2434 d="M15.5987 6.2911L3.45577 0.110898C2.83667 -0.204202 2.06287 0.189698 2.06287 0.819798V13.1802C2.06287 13.8103 2.83667 14.2042 3.45577 13.8891L15.5987 7.7089C16.2178 7.3938 16.2178 6.6061 15.5987 6.2911Z" 2435 /> 2436 </svg> 2437 </media-play-button> 2438 </template> 2439 2440 <template partial="SeekBackwardButton"> 2441 <media-seek-backward-button 2442 seekoffset="{{backwardseekoffset}}" 2443 part="{{section ?? 'bottom'}} seek-backward button" 2444 disabled="{{disabled}}" 2445 aria-disabled="{{disabled}}" 2446 > 2447 <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon"> 2448 <path 2449 d="M3.65 2.07888L0.0864 6.7279C-0.0288 6.87812 -0.0288 7.12188 0.0864 7.2721L3.65 11.9211C3.7792 12.0896 4 11.9703 4 11.7321V2.26787C4 2.02968 3.7792 1.9104 3.65 2.07888Z" 2450 /> 2451 <text transform="translate(6 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'"> 2452 {{backwardseekoffset}} 2453 </text> 2454 </svg> 2455 </media-seek-backward-button> 2456 </template> 2457 2458 <template partial="SeekForwardButton"> 2459 <media-seek-forward-button 2460 seekoffset="{{forwardseekoffset}}" 2461 part="{{section ?? 'bottom'}} seek-forward button" 2462 disabled="{{disabled}}" 2463 aria-disabled="{{disabled}}" 2464 > 2465 <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon"> 2466 <g> 2467 <text transform="translate(-1 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'"> 2468 {{forwardseekoffset}} 2469 </text> 2470 <path 2471 d="M18.35 11.9211L21.9136 7.2721C22.0288 7.12188 22.0288 6.87812 21.9136 6.7279L18.35 2.07888C18.2208
24711.91041 18 2.02968 18 2.26787V11.7321C18 11.9703 18.2208 12.0896 18.35 11.9211Z" 2472 /> 2473 </g> 2474 </svg> 2475 </media-seek-forward-button> 2476 </template> 2477 2478 <template partial="MuteButton"> 2479 <media-mute-button part="bottom mute button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2480 <svg viewBox="0 0 18 14" slot="icon" class="mute-icon" aria-hidden="true"> 2481 <g class="unmuted"> 2482 <path 2483 d="M6.76786 1.21233L3.98606 3.98924H1.19937C0.593146 3.98924 0.101743 4.51375 0.101743 5.1607V6.96412L0 6.99998L0.101743 7.03583V8.83926C0.101743 9.48633 0.593146 10.0108 1.19937 10.0108H3.98606L6.76773 12.7877C7.23561 13.2547 8 12.9007 8 12.2171V1.78301C8 1.09925 7.23574 0.745258 6.76786 1.21233Z" 2484 /> 2485 <path 2486 class="volume-low" 2487 d="M10 3.54781C10.7452 4.55141 11.1393 5.74511 11.1393 6.99991C11.1393 8.25471 10.7453 9.44791 10 10.4515L10.7988 11.0496C11.6734 9.87201 12.1356 8.47161 12.1356 6.99991C12.1356 5.52821 11.6735 4.12731 10.7988 2.94971L10 3.54781Z" 2488 /> 2489 <path 2490 class="volume-medium" 2491 d="M12.3778 2.40086C13.2709 3.76756 13.7428 5.35806 13.7428 7.00026C13.7428 8.64246 13.2709 10.233 12.3778 11.5992L13.2106 12.1484C14.2107 10.6185 14.739 8.83796 14.739 7.00016C14.739 5.16236 14.2107 3.38236 13.2106 1.85156L12.3778 2.40086Z" 2492 /> 2493 <path 2494 class="volume-high" 2495 d="M15.5981 0.75L14.7478 1.2719C15.7937 2.9919 16.3468 4.9723 16.3468 7C16.3468 9.0277 15.7937 11.0082 14.7478 12.7281L15.5981 13.25C16.7398 11.3722 17.343 9.211 17.343 7C17.343 4.789 16.7398 2.6268 15.5981 0.75Z" 2496 /> 2497 </g> 2498 <g class="muted"> 2499 <path 2500 fill-rule="evenodd" 2501 clip-rule="evenodd" 2502 d="M4.39976 4.98924H1.19937C1.19429 4.98924 1.17777 4.98961 1.15296 5.01609C1.1271 5.04369 1.10174 5.09245 1.10174 5.1607V8.83926C1.10174 8.90761 1.12714 8.95641 1.15299 8.984C1.17779 9.01047 1.1943 9.01084 1.19937 9.01084H4.39977L7 11.6066V2.39357L4.39976 4.98924ZM7.47434 1.92006C7.4743 1.9201 7.47439 1.92002 7.47434 1.92006V1.92006ZM6.76773 12.7877L3.98606 10.0108H1.19937C0.593146 10.0108 0.101743 9.48633 0.101743 8.83926V7.03583L0 6.99998L0.101743 6.96412V5.1607C0.101743 4.51375 0.593146 3.98924 1.19937 3.98924H3.98606L6.76786 1.21233C7.23574 0.745258 8 1.09925 8 1.78301V12.2171C8 12.9007 7.23561 13.2547 6.76773 12.7877Z" 2503 /> 2504 <path 2505 fill-rule="evenodd" 2506 clip-rule="evenodd" 2507 d="M15.2677 9.30323C15.463 9.49849 15.7796 9.49849 15.9749 9.30323C16.1701 9.10796 16.1701 8.79138 15.9749 8.59612L14.2071 6.82841L15.9749 5.06066C16.1702 4.8654 16.1702 4.54882 15.9749 4.35355C15.7796 4.15829 15.4631 4.15829 15.2678 4.35355L13.5 6.1213L11.7322 4.35348C11.537 4.15822 11.2204 4.15822 11.0251 4.35348C10.8298 4.54874 10.8298 4.86532 11.0251 5.06058L12.7929 6.82841L11.0251 8.59619C10.8299 8.79146 10.8299 9.10804 11.0251 9.3033C11.2204 9.49856 11.537 9.49856 11.7323 9.3033L13.5 7.53552L15.2677 9.30323Z" 2508 /> 2509 </g> 2510 </svg> 2511 </media-mute-button> 2512 </template> 2513 2514 <template partial="PipButton"> 2515 <media-pip-button part="bottom pip button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2516 <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon"> 2517 <path 2518 d="M15.9891 0H2.011C0.9004 0 0 0.9003 0 2.0109V11.989C0 13.0996 0.9004 14 2.011 14H15.9891C17.0997 14 18 13.0997 18 11.9891V2.0109C18 0.9003 17.0997 0 15.9891 0ZM17 11.9891C17 12.5465 16.5465 13 15.9891 13H2.011C1.4536 13 1.0001 12.5465 1.0001 11.9891V2.0109C1.0001 1.4535 1.4536 0.9999 2.011 0.9999H15.9891C16.5465 0.9999 17 1.4535 17 2.0109V11.9891Z" 2519 /> 2520 <path 2521 d="M15.356 5.67822H8.19523C8.03253 5.67822 7.90063 5.81012 7.90063 5.97282V11.3836C7.90063 11.5463 8.03253 11.6782 8.19523 11.6782H15.356C15.5187 11.6782 15.6506 11.5463 15.6506 11.3836V5.97282C15.6506 5.81012 15.5187 5.67822 15.356 5.67822Z" 2522 /> 2523 </svg> 2524 </media-pip-button> 2525 </template> 2526 2527 <template partial="CaptionsMenuButton"> 2528 <media-captions-selectmenu part="bottom captions selectmenu" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2529 <media-captions-button 2530 slot="button" 2531 part="bottom captions button" 2532 disabled="{{disabled}}" 2533 aria-disabled="{{disabled}}" 2534 > 2535 <svg aria-hidden="true" viewBox="0 0 18 14" slot="on"> 2536 <path 2537 d="M15.989 0H2.011C0.9004 0 0 0.9003 0 2.0109V11.9891C0 13.0997 0.9004 14 2.011 14H15.989C17.0997 14 18 13.0997 18 11.9891V2.0109C18 0.9003 17.0997 0 15.989 0ZM4.2292 8.7639C4.5954 9.1902 5.0935 9.4031 5.7233 9.4031C6.1852 9.4031 6.5544 9.301 6.8302 9.0969C7.1061 8.8933 7.2863 8.614 7.3702 8.26H8.4322C8.3062 8.884 8.0093 9.3733 7.5411 9.7273C7.0733 10.0813 6.4703 10.2581 5.732 10.2581C5.108 10.2581 4.5699 10.1219 4.1168 9.8489C3.6637 9.5759 3.3141 9.1946 3.0685 8.7058C2.8224 8.2165 2.6994 7.6511 2.6994 7.009C2.6994 6.3611 2.8224 5.7927 3.0685 5.3034C3.3141 4.8146 3.6637 4.4323 4.1168 4.1559C4.5699 3.88 5.108 3.7418 5.732 3.7418C6.4703 3.7418 7.0733 3.922 7.5411 4.2818C8.0094 4.6422 8.3062 5.1461 8.4322 5.794H7.3702C7.2862 5.4283 7.106 5.1368 6.8302 4.921C6.5544 4.7052 6.1852 4.5968 5.7233 4.5968C5.0934 4.5968 4.5954 4.8116 4.2292 5.2404C3.8635 5.6696 3.6804 6.259 3.6804 7.
2537009C3.6804 7.7531 3.8635 8.3381 4.2292 8.7639ZM11.0974 8.7639C11.4636 9.1902 11.9617 9.4031 12.5915 9.4031C13.0534 9.4031 13.4226 9.301 13.6984 9.0969C13.9743 8.8933 14.1545 8.614 14.2384 8.26H15.3004C15.1744 8.884 14.8775 9.3733 14.4093 9.7273C13.9415 10.0813 13.3385 10.2581 12.6002 10.2581C11.9762 10.2581 11.4381 10.1219 10.985 9.8489C10.5319 9.5759 10.1823 9.1946 9.9367 8.7058C9.6906 8.2165 9.5676 7.6511 9.5676 7.009C9.5676 6.3611 9.6906 5.7927 9.9367 5.3034C10.1823 4.8146 10.5319 4.4323 10.985 4.1559C11.4381 3.88 11.9762 3.7418 12.6002 3.7418C13.3385 3.7418 13.9415 3.922 14.4093 4.2818C14.8776 4.6422 15.1744 5.1461 15.3004 5.794H14.2384C14.1544 5.4283 13.9742 5.1368 13.6984 4.921C13.4226 4.7052 13.0534 4.5968 12.5915 4.5968C11.9616 4.5968 11.4636 4.8116 11.0974 5.2404C10.7317 5.6696 10.5486 6.259 10.5486 7.009C10.5486 7.7531 10.7317 8.3381 11.0974 8.7639Z" 2538 /> 2539 </svg> 2540 <svg aria-hidden="true" viewBox="0 0 18 14" slot="off"> 2541 <path 2542 d="M5.73219 10.258C5.10819 10.258 4.57009 10.1218 4.11699 9.8488C3.66389 9.5758 3.31429 9.1945 3.06869 8.7057C2.82259 8.2164 2.69958 7.651 2.69958 7.0089C2.69958 6.361 2.82259 5.7926 3.06869 5.3033C3.31429 4.8145 3.66389 4.4322 4.11699 4.1558C4.57009 3.8799 5.10819 3.7417 5.73219 3.7417C6.47049 3.7417 7.07348 3.9219 7.54128 4.2817C8.00958 4.6421 8.30638 5.146 8.43238 5.7939H7.37039C7.28639 5.4282 7.10618 5.1367 6.83039 4.9209C6.55459 4.7051 6.18538 4.5967 5.72348 4.5967C5.09358 4.5967 4.59559 4.8115 4.22939 5.2403C3.86369 5.6695 3.68058 6.2589 3.68058 7.0089C3.68058 7.753 3.86369 8.338 4.22939 8.7638C4.59559 9.1901 5.09368 9.403 5.72348 9.403C6.18538 9.403 6.55459 9.3009 6.83039 9.0968C7.10629 8.8932 7.28649 8.6139 7.37039 8.2599H8.43238C8.30638 8.8839 8.00948 9.3732 7.54128 9.7272C7.07348 10.0812 6.47049 10.258 5.73219 10.258Z" 2543 /> 2544 <path 2545 d="M12.6003 10.258C11.9763 10.258 11.4382 10.1218 10.9851 9.8488C10.532 9.5758 10.1824 9.1945 9.93685 8.7057C9.69075 8.2164 9.56775 7.651 9.56775 7.0089C9.56775 6.361 9.69075 5.7926 9.93685 5.3033C10.1824 4.8145 10.532 4.4322 10.9851 4.1558C11.4382 3.8799 11.9763 3.7417 12.6003 3.7417C13.3386 3.7417 13.9416 3.9219 14.4094 4.2817C14.8777 4.6421 15.1745 5.146 15.3005 5.7939H14.2385C14.1545 5.4282 13.9743 5.1367 13.6985 4.9209C13.4227 4.7051 13.0535 4.5967 12.5916 4.5967C11.9617 4.5967 11.4637 4.8115 11.0975 5.2403C10.7318 5.6695 10.5487 6.2589 10.5487 7.0089C10.5487 7.753 10.7318 8.338 11.0975 8.7638C11.4637 9.1901 11.9618 9.403 12.5916 9.403C13.0535 9.403 13.4227 9.3009 13.6985 9.0968C13.9744 8.8932 14.1546 8.6139 14.2385 8.2599H15.3005C15.1745 8.8839 14.8776 9.3732 14.4094 9.7272C13.9416 10.0812 13.3386 10.258 12.6003 10.258Z" 2546 /> 2547 <path 2548 d="M15.9891 1C16.5465 1 17 1.4535 17 2.011V11.9891C17 12.5465 16.5465 13 15.9891 13H2.0109C1.4535 13 1 12.5465 1 11.9891V2.0109C1 1.4535 1.4535 0.9999 2.0109 0.9999L15.9891 1ZM15.9891 0H2.0109C0.9003 0 0 0.9003 0 2.0109V11.9891C0 13.0997 0.9003 14 2.0109 14H15.9891C17.0997 14 18 13.0997 18 11.9891V2.0109C18 0.9003 17.0997 0 15.9891 0Z" 2549 /> 2550 </svg> 2551 </media-captions-button> 2552 <media-captions-listbox slot="listbox" exportparts="option" part="bottom captions listbox"> 2553 <div slot="select-indicator"> 2554 <style> 2555 .listbox-indicator { 2556 position: relative; 2557 top: 1px; 2558 width: 0.9em; 2559 height: auto; 2560 fill: var(--_accent-color); 2561 } 2562 2563 [aria-selected='false'] .listbox-indicator { 2564 display: none; 2565 } 2566 </style> 2567 <svg viewBox="0 0 14 18" class="listbox-indicator"> 2568 <path 2569 d="M12.252 3.48c-.115.033-.301.161-.425.291-.059.063-1.407 1.815-2.995 3.894s-2.897 3.79-2.908 3.802c-.013.014-.661-.616-1.672-1.624-.908-.905-1.702-1.681-1.765-1.723-.401-.27-.783-.211-1.176.183a1.285 1.285 0 0 0-.261.342.582.582 0 0 0-.082.35c0 .165.01.205.08.35.075.153.213.296 2.182 2.271 1.156 1.159 2.17 2.159 2.253 2.222.189.143.338.196.539.194.203-.003.412-.104.618-.299.205-.193 6.7-8.693 6.804-8.903a.716.716 0 0 0 .085-.345c.01-.179.005-.203-.062-.339-.124-.252-.45-.531-.746-.639a.784.784 0 0 0-.469-.027" 2570 fill-rule="evenodd" 2571 /> 2572 </svg> 2573 </div> 2574 </media-captions-listbox> 2575 </media-captions-select
vendor: 5,520 bytes, lines 2575-2646
2575menu> 2576 </template> 2577 2578 <template partial="AirplayButton"> 2579 <media-airplay-button part="bottom airplay button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2580 <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon"> 2581 <path 2582 d="M16.1383 0H1.8618C0.8335 0 0 0.8335 0 1.8617V10.1382C0 11.1664 0.8335 12 1.8618 12H3.076C3.1204 11.9433 3.1503 11.8785 3.2012 11.826L4.004 11H1.8618C1.3866 11 1 10.6134 1 10.1382V1.8617C1 1.3865 1.3866 0.9999 1.8618 0.9999H16.1383C16.6135 0.9999 17.0001 1.3865 17.0001 1.8617V10.1382C17.0001 10.6134 16.6135 11 16.1383 11H13.9961L14.7989 11.826C14.8499 11.8785 14.8798 11.9432 14.9241 12H16.1383C17.1665 12 18.0001 11.1664 18.0001 10.1382V1.8617C18 0.8335 17.1665 0 16.1383 0Z" 2583 /> 2584 <path 2585 d="M9.55061 8.21903C9.39981 8.06383 9.20001 7.98633 9.00011 7.98633C8.80021 7.98633 8.60031 8.06383 8.44951 8.21903L4.09771 12.697C3.62471 13.1838 3.96961 13.9998 4.64831 13.9998H13.3518C14.0304 13.9998 14.3754 13.1838 13.9023 12.697L9.55061 8.21903Z" 2586 /> 2587 </svg> 2588 </media-airplay-button> 2589 </template> 2590 2591 <template partial="FullscreenButton"> 2592 <media-fullscreen-button part="bottom fullscreen button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2593 <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter"> 2594 <path 2595 d="M1.00745 4.39539L1.01445 1.98789C1.01605 1.43049 1.47085 0.978289 2.02835 0.979989L6.39375 0.992589L6.39665 -0.007411L2.03125 -0.020011C0.920646 -0.023211 0.0176463 0.874489 0.0144463 1.98509L0.00744629 4.39539H1.00745Z" 2596 /> 2597 <path 2598 d="M17.0144 2.03431L17.0076 4.39541H18.0076L18.0144 2.03721C18.0176 0.926712 17.1199 0.0237125 16.0093 0.0205125L11.6439 0.0078125L11.641 1.00781L16.0064 1.02041C16.5638 1.02201 17.016 1.47681 17.0144 2.03431Z" 2599 /> 2600 <path 2601 d="M16.9925 9.60498L16.9855 12.0124C16.9839 12.5698 16.5291 13.022 15.9717 13.0204L11.6063 13.0078L11.6034 14.0078L15.9688 14.0204C17.0794 14.0236 17.9823 13.1259 17.9855 12.0153L17.9925 9.60498H16.9925Z" 2602 /> 2603 <path 2604 d="M0.985626 11.9661L0.992426 9.60498H-0.0074737L-0.0142737 11.9632C-0.0174737 13.0738 0.880226 13.9767 1.99083 13.98L6.35623 13.9926L6.35913 12.9926L1.99373 12.98C1.43633 12.9784 0.983926 12.5236 0.985626 11.9661Z" 2605 /> 2606 </svg> 2607 <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit"> 2608 <path 2609 d="M5.39655 -0.0200195L5.38955 2.38748C5.38795 2.94488 4.93315 3.39708 4.37565 3.39538L0.0103463 3.38278L0.00744629 4.38278L4.37285 4.39538C5.48345 4.39858 6.38635 3.50088 6.38965 2.39028L6.39665 -0.0200195H5.39655Z" 2610 /> 2611 <path 2612 d="M12.6411 2.36891L12.6479 0.0078125H11.6479L11.6411 2.36601C11.6379 3.47651 12.5356 4.37951 13.6462 4.38271L18.0116 4.39531L18.0145 3.39531L13.6491 3.38271C13.0917 3.38111 12.6395 2.92641 12.6411 2.36891Z" 2613 /> 2614 <path 2615 d="M12.6034 14.0204L12.6104 11.613C12.612 11.0556 13.0668 10.6034 13.6242 10.605L17.9896 10.6176L17.9925 9.61759L13.6271 9.60499C12.5165 9.60179 11.6136 10.4995 11.6104 11.6101L11.6034 14.0204H12.6034Z" 2616 /> 2617 <path 2618 d="M5.359 11.6315L5.3522 13.9926H6.3522L6.359 11.6344C6.3622 10.5238 5.4645 9.62088 4.3539 9.61758L-0.0115043 9.60498L-0.0144043 10.605L4.351 10.6176C4.9084 10.6192 5.3607 11.074 5.359 11.6315Z" 2619 /> 2620 </svg> 2621 </media-fullscreen-button> 2622 </template> 2623 2624 <template partial="CastButton"> 2625 <media-cast-button part="bottom cast button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2626 <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter"> 2627 <path 2628 d="M16.0072 0H2.0291C0.9185 0 0.0181 0.9003 0.0181 2.011V5.5009C0.357 5.5016 0.6895 5.5275 1.0181 5.5669V2.011C1.0181 1.4536 1.4716 1 2.029 1H16.0072C16.5646 1 17.0181 1.4536 17.0181 2.011V11.9891C17.0181 12.5465 16.5646 13 16.0072 13H8.4358C8.4746 13.3286 8.4999 13.6611 8.4999 13.9999H16.0071C17.1177 13.9999 18.018 13.0996 18.018 11.989V2.011C18.0181 0.9003 17.1178 0 16.0072 0ZM0 6.4999V7.4999C3.584 7.4999 6.5 10.4159 6.5 13.9999H7.5C7.5 9.8642 4.1357 6.4999 0 6.4999ZM0 8.7499V9.7499C2.3433 9.7499 4.25 11.6566 4.25 13.9999H5.25C5.25 11.1049 2.895 8.7499 0 8.7499ZM0.0181 11V14H3.0181C3.0181 12.3431 1.675 11 0.0181 11Z" 2629 /> 2630 </svg> 2631 <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit"> 2632 <path 2633 d="M15.9891 0H2.01103C0.900434 0 3.35947e-05 0.9003 3.35947e-05 2.011V5.5009C0.338934 5.5016 0.671434 5.5275 1.00003 5.5669V2.011C1.00003 1.4536 1.45353 1 2.01093 1H15.9891C16.5465 1 17 1.4536 17 2.011V11.9891C17 12.5465 16.5465 13 15.9891 13H8.41773C8.45653 13.3286 8.48183 13.6611 8.48183 13.9999H15.989C17.0996 13.9999 17.9999 13.0996 17.9999 11.989V2.011C18 0.9003 17.0997 0 15.9891 0ZM-0.0180664 6.4999V7.4999C3.56593 7.4999 6.48193 10.4159 6.48193 13.9999H7.48193C7.48193 9.8642 4.11763 6.4999 -0.0180664 6.4999ZM-0.0180664 8.7499V9.7499C2.32523 9.7499 4.23193 11.6566 4.23193 13.9999H5.23193C5.23193 11.1049 2.87693 8.7499 -0.0180664 8.7499ZM3.35947e-05 11V14H3.00003C3.00003 12.3431 1.65693 11 3.35947e-05 11Z" 2634 /> 2635 <path d="M2.15002 5.634C5.18352 6.4207 7.57252 8.8151 8.35282 11.8499H15.8501V2.1499H2.15002V5.634Z" /> 2636 </svg> 2637 </media-cast-button> 2638 </template> 2639 2640 <template partial="LiveButton"> 2641 <media-live-button part="{{section ?? 'top'}} live button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2642 <span slot="text">Live</span> 2643 </media-live-button> 2644 </template> 2645 2646 <template partial="PlaybackRate
2646Select"> 2647 <media-playback-rate-selectmenu 2648 part="bottom playback-rate selectmenu" 2649 disabled="{{disabled}}" 2650 aria-disabled="{{disabled}}" 2651 > 2652 <media-playback-rate-button slot="button" part="bottom playback-rate button"></media-playback-rate-button> 2653 <media-playback-rate-listbox 2654 slot="listbox" 2655 rates="{{playbackrates}}" 2656 exportparts="option" 2657 part="bottom playback-rate listbox" 2658 ></media-playback-rate-listbox> 2659 </media-playback-rate-selectmenu> 2660 </template> 2661 2662 <template partial="VolumeRange"> 2663 <media-volume-range 2664 part="bottom volume range" 2665 disabled="{{disabled}}" 2666 aria-disabled="{{disabled}}" 2667 ></media-volume-range> 2668 </template> 2669 2670 <template partial="TimeDisplay"> 2671 <media-time-display 2672 remaining="{{defaultshowremainingtime}}" 2673 showduration="{{!hideduration}}" 2674 part="bottom time display" 2675 disabled="{{disabled}}" 2676 aria-disabled="{{disabled}}" 2677 ></media-time-display> 2678 </template> 2679 2680 <template partial="TimeRange"> 2681 <media-time-range part="bottom time range" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2682 <media-preview-thumbnail slot="preview"></media-preview-thumbnail> 2683 <media-preview-chapter-display slot="preview"></media-preview-chapter-display> 2684 <media-preview-time-display slot="preview"></media-preview-time-display> 2685 <div slot="preview" part="arrow"></div> 2686 </media-time-range> 2687 </template> 2688 2689 <template partial="AudioTrackSelect"> 2690 <media-audio-track-selectmenu 2691 part="bottom audio-track selectmenu" 2692 disabled="{{disabled}}" 2693 aria-disabled="{{disabled}}" 2694 > 2695 <media-audio-track-button slot="button" part="bottom audio-track button"> 2696 <svg aria-hidden="true" slot="icon" viewBox="0 0 18 16"> 2697 <path d="M9 15A7 7 0 1 1 9 1a7 7 0 0 1 0 14Zm0 1A8 8 0 1 0 9 0a8 8 0 0 0 0 16Z" /> 2698 <path 2699 d="M5.2 6.3a.5.5 0 0 1 .5.5v2.4a.5.5 0 1 1-1 0V6.8a.5.5 0 0 1 .5-.5Zm2.4-2.4a.5.5 0 0 1 .5.5v7.2a.5.5 0 0 1-1 0V4.4a.5.5 0 0 1 .5-.5ZM10 5.5a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.4-.8a.5.5 0 0 1 .5.5v5.6a.5.5 0 0 1-1 0V5.2a.5.5 0 0 1 .5-.5Z" 2700 /> 2701 </svg> 2702 </media-audio-track-button> 2703 <media-audio-track-listbox slot="listbox" exportparts="option" part="bottom audio-track listbox"> 2704 <div slot="select-indicator"> 2705 <style> 2706 .listbox-indicator { 2707 position: relative; 2708 top: 1px; 2709 width: 0.9em; 2710 height: auto; 2711 fill: var(--_accent-color); 2712 } 2713 2714 [aria-selected='false'] .listbox-indicator { 2715 display: none; 2716 } 2717 </style> 2718 <svg viewBox="0 0 14 18" class="listbox-indicator"> 2719 <path 2720 d="M12.252 3.48c-.115.033-.301.161-.425.291-.059.063-1.407 1.815-2.995 3.894s-2.897 3.79-2.908 3.802c-.013.014-.661-.616-1.672-1.624-.908-.905-1.702-1.681-1.765-1.723-.401-.27-.783-.211-1.176.183a1.285 1.285 0 0 0-.261.342.582.582 0 0 0-.082.35c0 .165.01.205.08.35.075.153.213.296 2.182 2.271 1.156 1.159 2.17 2.159 2.253 2.222.189.143.338.196.539.194.203-.003.412-.104.618-.299.205-.193 6.7-8.693 6.804-8.903a.716.716 0 0 0 .085-.345c.01-.179.005-.203-.062-.339-.124-.252-.45-.531-.746-.639a.784.784 0 0 0-.469-.027" 2721 fill-rule="evenodd" 2722 /> 2723 </svg> 2724 </div> 2725 </media-audio-track-listbox> 2726 </media-audio-track-selectmenu> 2727 </template> 2728 2729 <template partial="RenditionSelect"> 2730 <media-rendition-selectmenu part="bottom rendition selectmenu" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2731 <media-rendition-button slot="button" part="bottom rendition button"> 2732 <svg aria-hidden="true" slot="icon" viewBox="0 0 18 14"> 2733 <path 2734 d="M2.25 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM9 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm6.75 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z" 2735 /> 2736 </svg> 2737 </media-rendition-button> 2738 <media-rendition-listbox slot="listbox" exportparts="option" part="bottom rendition listbox"> 2739 <div slot="select-indicator"> 2740 <style> 2741 .listbox-indicator { 2742 position: relative; 2743 top: 1px; 2744 width: 0.9em; 2745 height: auto; 2746 fill: var(--_accent-color); 2747 } 2748 2749 [aria-selected='false'] .listbox-indicator { 2750 display: none; 2751 } 2752 </style> 2753 <svg viewBox="0 0 14 18" class="listbox-indicator"> 2754 <path 2755 d="M12.252 3.48c-.115.033-.301.161-.425.291-.059.063-1.407 1.815-2.995 3.894s-2.897 3.79-2.908 3.802c-.013.014-.661-.616-1.672-1.624-.908-.905-1.702-1.681-1.765-1.723-.401-.27-.783-.211-1.176.183a1.285 1.285 0 0 0-.261.342.582.582 0 0 0-.082.35c0 .165.01.205.08.35.075.153.213.296 2.182 2.271 1.156 1.159 2.17 2.159 2.253 2.222.189.143.338.196.539.194.203-.003.412-.104.618-.299.205-.193 6.7-8.693 6.804-8.903a.716.716 0 0 0 .085-.345c.01-.179.005-.203-.062-.339-.124-.252-.45-.531-.746-.639a.784.784 0 0 0-.469-.027" 2756 fill-rule="evenodd" 2757 /> 2758 </svg> 2759 </div> 2760 </media-rendition-listbox> 2761 </media-rendition-selectmenu> 2762 </template> 2763 2764 <media-controller 2765 part="controller" 2766 defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}" 2767 breakpoints="sm:470" 2768 gesturesdisabled="{{disabled}}" 2769 hotkeys="{{hotkeys}}" 2770 nohotkeys="{{nohotkeys}}" 2771 novolumepref="{{novolumepref}}" 2772 audio="{{audio}}" 2773 noautoseektolive="{{noautoseektolive}}"
2774 defaultsubtitles="{{defaultsubtitles}}" 2775 defaultduration="{{defaultduration ?? false}}" 2776 keyboardforwardseekoffset="{{forwardseekoffset}}" 2777 keyboardbackwardseekoffset="{{backwardseekoffset}}" 2778 exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer" 2779 style="--_pre-playback-place:{{preplaybackplace ?? 'center'}}" 2780 > 2781 <slot name="media" slot="media"></slot> 2782 <slot name="poster" slot="poster"></slot> 2783 2784 <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator> 2785 2786 <template if="!audio"> 2787 <!-- Pre-playback UI --> 2788 <div slot="centered-chrome" class="center-controls pre-playback"> 2789 <template if="streamtype == 'on-demand'"> 2790 <template if="!breakpointsm"> {{>SeekBackwardButton section="center"}} </template> 2791 <template if="!breakpointsm"> {{>PlayButton section="center"}} </template> 2792 <template if="breakpointsm"> {{>PrePlayButton section="center"}} </template> 2793 <template if="!breakpointsm"> {{>SeekForwardButton section="center"}} </template> 2794 </template> 2795 2796 <template if="streamtype == 'live'"> 2797 <template if="!breakpointsm"> 2798 <template if="targetlivewindow > 0"> {{>SeekBackwardButton section="center"}} </template> 2799 </template> 2800 <template if="!breakpointsm"> {{>PlayButton section="center"}} </template> 2801 <template if="breakpointsm"> {{>PrePlayButton section="center"}} </template> 2802 <template if="!breakpointsm"> 2803 <template if="targetlivewindow > 0"> {{>SeekForwardButton section="center"}} </template> 2804 </template> 2805 </template> 2806 </div> 2807 2808 <!-- Auotplay centered unmute button --> 2809 <!-- 2810 todo: figure out how show this with available state variables 2811 needs to show when: 2812 - autoplay is enabled 2813 - playback has been successful 2814 - audio is muted 2815 - in place / instead of the pre-plaback play button 2816 - not to show again after user has interacted with this button 2817 - OR user has interacted with the mute button in the control bar 2818 --> 2819 <!-- 2820 There should be a >MuteButton to the left of the "Unmute" text, but a templating bug 2821 makes it appear even if commented out in the markup, add it back when code is un-commented 2822 --> 2823 <!-- <div slot="centered-chrome" class="autoplay-unmute"> 2824 <div role="button" class="autoplay-unmute-btn">Unmute</div> 2825 </div> --> 2826 2827 <template if="streamtype == 'on-demand'"> 2828 <template if="breakpointsm"> 2829 <media-control-bar part="control-bar top" slot="top-chrome">{{>TitleDisplay}} </media-control-bar> 2830 </template> 2831 {{>TimeRange}} 2832 <media-control-bar part="control-bar bottom"> 2833 {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>MuteButton}} 2834 {{>VolumeRange}} 2835 <div class="spacer"></div> 2836 {{>RenditionSelect}} {{>PlaybackRateSelect}} {{>AudioTrackSelect}} {{>CaptionsMenuButton}} {{>AirplayButton}} 2837 {{>CastButton}} {{>PipButton}} {{>FullscreenButton}} 2838 </media-control-bar> 2839 </template> 2840 2841 <template if="streamtype == 'live'"> 2842 <media-control-bar part="control-bar top" slot="top-chrome"> 2843 {{>LiveButton}} 2844 <template if="breakpointsm"> {{>TitleDisplay}} </template> 2845 </media-control-bar> 2846 <template if="targetlivewindow > 0">{{>TimeRange}}</template> 2847 <media-control-bar part="control-bar bottom"> 2848 {{>PlayButton}} 2849 <template if="targetlivewindow > 0">{{>SeekBackwardButton}} {{>SeekForwardButton}}</template> 2850 {{>MuteButton}} {{>VolumeRange}} 2851 <div class="spacer"></div> 2852 {{>RenditionSelect}} {{>AudioTrackSelect}} {{>CaptionsMenuButton}} {{>AirplayButton}} {{>CastButton}} 2853 {{>PipButton}} {{>FullscreenButton}} 2854 </media-control-bar> 2855 </template> 2856 </template> 2857 2858 <template if="audio"> 2859 <template if="streamtype == 'on-demand'"> 2860 <template if="title"> 2861 <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar> 2862 </template> 2863 <media-control-bar part="control-bar bottom"> 2864 {{>PlayButton}} 2865 <template if="breakpointsm"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template> 2866 {{>MuteButton}} 2867 <template if="breakpointsm">{{>VolumeRange}}</template> 2868 {{>TimeDisplay}} {{>TimeRange}} 2869 <template if="breakpointsm">{{>PlaybackRateSelect}}</template> 2870 {{>AirplayButton}} {{>CastButton}} 2871 </media-control-bar> 2872 </template> 2873 2874 <template if="streamtype == 'live'"> 2875 <template if="title"> 2876 <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar> 2877 </template> 2878 <media-control-bar part="control-bar bottom"> 2879 <template if="breakpointsm"> 2880 {{>PlayButton}} {{>LiveButton section="bottom"}} {{>MuteButton}} {{>VolumeRange}} 2881 <template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template> 2882 </template> 2883 <template if="targetlivewindow > 0"> {{>TimeDisplay}} {{>TimeRange}} </template> 2884 <template if="!targetlivewindow"><div class="spacer"></div></template> 2885 {{>AirplayButton}} {{>CastButton}} 2886 </media-control-bar> 2887 </template> 2888 </template> 2889 2890 <slot></slot> 2891 </media-controller> 2892</template> 2893`,AS=TU.createElement("template");"innerHTML"in AS&&(AS.innerHTML=Ak);var Aw,AL,AR=class extends Ts{};AR.template=null==(AL=null==(Aw=AS.content)?void 0:Aw.children)?void 0:AL[0],TN.customElements.get("media-theme-gerwig")||TN.customElements.define("media-theme-gerwig",AR);var AI={SRC:"src",POSTER:"poster"},AC={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",P
2893LAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref"},AD=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function Ax(e){let t=e.hasAttribute(AC.TITLE)?{video_title:e.getAttribute(AC.TITLE)}:{};return e.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((t,i)=>{let r=e.getAttribute(i);return null!==r&&(t[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),t},t)}var AM,AO,AP,AN,AU,AF,AB,A$,AH,AW,AG,AV,AK,Aq,Aj,AY,Az,AX,AQ,AZ,AJ,A0=Object.values(yR),A1=Object.values(AI),A2=Object.values(AC),A3={dialog:void 0,isDialogOpen:!1},A4={redundant_streams:!0},A5=class extends As{constructor(){super(),Td(this,AF),Td(this,A$),Td(this,AW),Td(this,AV),Td(this,Aq),Td(this,AY),Td(this,AX),Td(this,AZ),Td(this,AM,!1),Td(this,AO,{}),Td(this,AP,!0),Td(this,AN,new T0(this,"hotkeys")),Td(this,AU,{...A3,onCloseErrorDialog:()=>Tu(this,AW,AG).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{Tz(this,TU.activeElement)||e.preventDefault()}}),this.attachShadow({mode:"open"}),Tu(this,A$,AH).call(this),this.isConnected&&Tu(this,AF,AB).call(this)}static get observedAttributes(){var e;return[...null!=(e=As.observedAttributes)?e:[],...A1,...A0,...A2]}get mediaTheme(){var e;return null==(e=this.shadowRoot)?void 0:e.querySelector("media-theme")}get mediaController(){var e,t;return null==(t=null==(e=this.mediaTheme)?void 0:e.shadowRoot)?void 0:t.querySelector("media-controller")}connectedCallback(){var e;let t=null==(e=this.shadowRoot)?void 0:e.querySelector("mux-video");t&&(t.metadata=Ax(this))}attributeChangedCallback(e,t,i){var r;switch(Tu(this,AF,AB).call(this),super.attributeChangedCallback(e,t,i),e){case AC.HOTKEYS:Tl(this,AN).value=i;break;case AC.THUMBNAIL_TIME:null!=i&&this.tokens.thumbnail&&T2(TB("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break;case AC.THUMBNAIL_TOKEN:{let{aud:e}=TK(i);i&&"t"!==e&&T2(TB("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:e}));break}case AC.STORYBOARD_TOKEN:{let{aud:e}=TK(i);i&&"s"!==e&&T2(TB("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:e}));break}case yR.PLAYBACK_ID:null!=i&&i.includes("?token")&&T3(TB("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:i}));break;case yR.STREAM_TYPE:i&&![oi,ot,or].includes(i)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=i.includes("dvr")?1/0:0:T4({file:"invalid-stream-type.md",message:TB("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):i===oi?null==this.getAttribute(AC.TARGET_LIVE_WINDOW)&&(this.targetLiveWindow=0):this.targetLiveWindow=NaN}[yR.PLAYBACK_ID,AI.SRC,AC.PLAYBACK_TOKEN].includes(e)&&t!==i&&Th(this,AU,{...Tl(this,AU),...A3}),Tu(this,AV,AK).call(this,{[null!=(r=TJ[e])?r:TW(e)]:i})}get preferCmcd(){var e;return null!=(e=this.getAttribute(yR.PREFER_CMCD))?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?on.includes(e)?this.setAttribute(yR.PREFER_CMCD,e):T2(`Invalid value for preferCmcd. Must be one of ${on.join()}`):this.removeAttribute(yR.PREFER_CMCD))}get hasPlayed(){var e,t;return null!=(t=null==(e=this.mediaController)?void 0:e.hasAttribute(ly.MEDIA_HAS_P
2893LAYED))&&t}get inLiveWindow(){var e;return null==(e=this.mediaController)?void 0:e.hasAttribute(ly.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return null==(e=this.media)?void 0:e._hls}get mux(){var e;return null==(e=this.media)?void 0:e.mux}get theme(){var e;return null!=(e=this.getAttribute(AC.THEME))?e:"gerwig"}set theme(e){this.setAttribute(AC.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let t={};for(let i of e.getAttributeNames()){if(AD.includes(i))continue;let r=e.getAttribute(i);t[TW(i)]=""===r||r}return t}set themeProps(e){var t,i;Tu(this,AF,AB).call(this);let r={...this.themeProps,...e};for(let a in r){if(AD.includes(a))continue;let r=null==e?void 0:e[a];"boolean"==typeof r||null==r?null==(t=this.mediaTheme)||t.toggleAttribute(TH(a),!!r):null==(i=this.mediaTheme)||i.setAttribute(TH(a),r)}}get playbackId(){var e;return null!=(e=this.getAttribute(yR.PLAYBACK_ID))?e:void 0}set playbackId(e){e?this.setAttribute(yR.PLAYBACK_ID,e):this.removeAttribute(yR.PLAYBACK_ID)}get src(){var e,t;return this.playbackId?null!=(e=A8(this,AI.SRC))?e:void 0:null!=(t=this.getAttribute(AI.SRC))?t:void 0}set src(e){e?this.setAttribute(AI.SRC,e):this.removeAttribute(AI.SRC)}get poster(){var e;let t=this.getAttribute(AI.POSTER);return null!=t?t:this.playbackId&&!this.audio?((e,{token:t,customDomain:i=TX,thumbnailTime:r,programTime:a}={})=>{let s=null==t?r:void 0,{aud:n}=TK(t);if(!(t&&"t"!==n))return`https://image.${i}/${e}/thumbnail.webp${TV({token:t,time:s,program_time:a})}`})(this.playbackId,{customDomain:this.customDomain,thumbnailTime:null!=(e=this.thumbnailTime)?e:this.startTime,programTime:this.programStartTime,token:this.tokens.thumbnail}):void 0}set poster(e){e||""===e?this.setAttribute(AI.POSTER,e):this.removeAttribute(AI.POSTER)}get storyboardSrc(){var e;return null!=(e=this.getAttribute(AC.STORYBOARD_SRC))?e:void 0}set storyboardSrc(e){e?this.setAttribute(AC.STORYBOARD_SRC,e):this.removeAttribute(AC.STORYBOARD_SRC)}get storyboard(){return this.storyboardSrc&&!this.tokens.storyboard?this.storyboardSrc:this.audio||!this.playbackId||!this.streamType||[oi,or].includes(this.streamType)?void 0:((e,{token:t,customDomain:i=TX,programStartTime:r,programEndTime:a}={})=>{let{aud:s}=TK(t);if(!(t&&"s"!==s))return`https://image.${i}/${e}/storyboard.vtt${TV({token:t,format:"webp",program_start_time:r,program_end_time:a})}`})(this.playbackId,{customDomain:this.customDomain,token:this.tokens.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(AC.AUDIO)}set audio(e){e?this.setAttribute(AC.AUDIO,""):this.removeAttribute(AC.AUDIO)}get hotkeys(){return Tl(this,AN)}get nohotkeys(){return this.hasAttribute(AC.NOHOTKEYS)}set nohotkeys(e){e?this.setAttribute(AC.NOHOTKEYS,""):this.removeAttribute(AC.NOHOTKEYS)}get thumbnailTime(){return TG(this.getAttribute(AC.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(AC.THUMBNAIL_TIME,`${e}`)}get title(){var e;return null!=(e=this.getAttribute(AC.TITLE))?e:""}set title(e){e!==this.title&&(e?this.setAttribute(AC.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return null!=(e=A8(this,AC.PLACEHOLDER))?e:""}set placeholder(e){this.setAttribute(AC.PLACEHOLDER,`${e}`)}get primaryColor(){var e,t;let i=this.getAttribute(AC.PRIMARY_COLOR);if(null!=i||this.mediaTheme&&(i=null==(t=null==(e=TN.getComputedStyle(this.mediaTheme))?void 0:e.getPropertyValue("--_primary-color"))?void 0:t.trim()))return i}set primaryColor(e){this.setAttribute(AC.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var e,t;let i=this.getAttribute(AC.SECONDARY_COLOR);if(null!=i||this.mediaTheme&&(i=null==(t=null==(e=TN.getComputedStyle(this.mediaTheme))?void 0:e.getPropertyValue("--_secondary-color"))?void 0:t.trim()))return i}set secondaryColor(e){this.setAttribute(AC.SECONDARY_COLOR,`${e}`)}get accentColor(){var e,t;let i=this.getAttribute(AC.ACCENT_COLOR);if(null!=i||this.mediaTheme&&(i=null==(t=null==(e=TN.getComputedStyle(this.mediaTheme))?void 0:e.getPropertyValue("--_accent-color"))?void 0:t.trim()))return i}
2893set accentColor(e){this.setAttribute(AC.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(AC.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(AC.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(AC.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(AC.PLAYBACK_RATES))return this.getAttribute(AC.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,t)=>e-t)}set playbackRates(e){e?this.setAttribute(AC.PLAYBACK_RATES,e.join(" ")):this.removeAttribute(AC.PLAYBACK_RATES)}get forwardSeekOffset(){var e;return null!=(e=TG(this.getAttribute(AC.FORWARD_SEEK_OFFSET)))?e:10}set forwardSeekOffset(e){this.setAttribute(AC.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return null!=(e=TG(this.getAttribute(AC.BACKWARD_SEEK_OFFSET)))?e:10}set backwardSeekOffset(e){this.setAttribute(AC.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(AC.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(AC.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(AC.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return TG(this.getAttribute(AC.DEFAULT_DURATION))}set defaultDuration(e){null==e?this.removeAttribute(AC.DEFAULT_DURATION):this.setAttribute(AC.DEFAULT_DURATION,`${e}`)}get playerSoftwareName(){var e;return null!=(e=this.getAttribute(yR.PLAYER_SOFTWARE_NAME))?e:"mux-player"}get playerSoftwareVersion(){var e;return null!=(e=this.getAttribute(yR.PLAYER_SOFTWARE_VERSION))?e:TQ}get beaconCollectionDomain(){var e;return null!=(e=this.getAttribute(yR.BEACON_COLLECTION_DOMAIN))?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(yR.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(yR.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return null!=(e=this.getAttribute(yR.MAX_RESOLUTION))?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(yR.MAX_RESOLUTION,e):this.removeAttribute(yR.MAX_RESOLUTION))}get minResolution(){var e;return null!=(e=this.getAttribute(yR.MIN_RESOLUTION))?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(yR.MIN_RESOLUTION,e):this.removeAttribute(yR.MIN_RESOLUTION))}get renditionOrder(){var e;return null!=(e=this.getAttribute(yR.RENDITION_ORDER))?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(yR.RENDITION_ORDER,e):this.removeAttribute(yR.RENDITION_ORDER))}get programStartTime(){return TG(this.getAttribute(yR.PROGRAM_START_TIME))}set programStartTime(e){null==e?this.removeAttribute(yR.PROGRAM_START_TIME):this.setAttribute(yR.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return TG(this.getAttribute(yR.PROGRAM_END_TIME))}set programEndTime(e){null==e?this.removeAttribute(yR.PROGRAM_END_TIME):this.setAttribute(yR.PROGRAM_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(AC.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(AC.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[t,i])=>(e[t]=i,e),{}):A4}set extraSourceParams(e){null==e?this.removeAttribute(AC.EXTRA_SOURCE_PARAMS):this.setAttribute(AC.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return null!=(e=this.getAttribute(yR.CUSTOM_DOMAIN))?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(yR.CUSTOM_DOMAIN,e):this.removeAttribute(yR.CUSTOM_DOMAIN))}get envKey(){var e;return null!=(e=A8(this,yR.ENV_KEY))?e:void 0}set envKey(e){this.setAttribute(yR.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(AC.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(AC.NO_VOLUME_PREF,""):this.removeAttribute(AC.NO_VOLUME_PREF)}get debug(){return null!=A8(this,yR.DEBUG)}set debug(e){e?this.setAttribute(yR.DEBUG,""):this.removeAttribute(yR.DEBUG)}get disableTracking(){return null!=A8(this,yR.DISABLE_TRACKING)}set disableTracking(e){this.toggleAttribute(yR.DISABLE_TRACKING,!!e)}get disableCookies(){return null!=A8(this,yR.DISABLE_COOKIES)}set disableCookies(e){e?this.setAttribute(yR.DISABLE_COOKIES,""):this.removeAttribute(yR.DISABLE_COOKIES)}get streamType(){var e,t,i;return null!=(i=null!=(t=this.getAttribute(yR.STREAM_TYPE))?t:null==(e=this.media)?void 0:e.streamType)?i:or}set streamType(e){this.setAttribute(yR.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,t,i;return null!=(i=null!=(t=this.getAttribute(AC.DEFAULT_STREAM_TYPE))?t:null==(e=this.mediaController)?void 0:e.getAttribute(AC.DEFAULT_STREAM_TYPE))?i:ot}set defaultStreamType(e){e?this.setAttribute(AC.DEFAULT_STREAM_TYPE,e):this.removeAttribute(AC.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,t;return this.hasAttribute(AC.TARGET_LIVE_WINDOW)?+this.getAttribute(AC.TARGET_LIVE_WINDOW):null!=(t=null==(e=this.media)?void 0:e.targetLiveWindow)?t:NaN}
2893set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(null==e?this.removeAttribute(AC.TARGET_LIVE_WINDOW):this.setAttribute(AC.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return null==(e=this.media)?void 0:e.liveEdgeStart}get startTime(){return TG(A8(this,yR.START_TIME))}set startTime(e){this.setAttribute(yR.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(yR.PREFER_PLAYBACK);if("mse"===e||e===oa)return e}set preferPlayback(e){e!==this.preferPlayback&&("mse"===e||e===oa?this.setAttribute(yR.PREFER_PLAYBACK,e):this.removeAttribute(yR.PREFER_PLAYBACK))}get metadata(){var e;return null==(e=this.media)?void 0:e.metadata}set metadata(e){(Tu(this,AF,AB).call(this),this.media)?this.media.metadata={...Ax(this),...e}:T3("underlying media element missing when trying to set metadata. metadata will not be set.")}get _hlsConfig(){var e;return null==(e=this.media)?void 0:e._hlsConfig}set _hlsConfig(e){(Tu(this,AF,AB).call(this),this.media)?this.media._hlsConfig=e:T3("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.")}async addCuePoints(e){var t;return(Tu(this,AF,AB).call(this),this.media)?null==(t=this.media)?void 0:t.addCuePoints(e):void T3("underlying media element missing when trying to addCuePoints. cuePoints will not be added.")}get activeCuePoint(){var e;return null==(e=this.media)?void 0:e.activeCuePoint}get cuePoints(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.cuePoints)?t:[]}addChapters(e){var t;return(Tu(this,AF,AB).call(this),this.media)?null==(t=this.media)?void 0:t.addChapters(e):void T3("underlying media element missing when trying to addChapters. chapters will not be added.")}get activeChapter(){var e;return null==(e=this.media)?void 0:e.activeChapter}get chapters(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.chapters)?t:[]}getStartDate(){var e;return null==(e=this.media)?void 0:e.getStartDate()}get currentPdt(){var e;return null==(e=this.media)?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(AC.PLAYBACK_TOKEN),t=this.getAttribute(AC.DRM_TOKEN),i=this.getAttribute(AC.THUMBNAIL_TOKEN),r=this.getAttribute(AC.STORYBOARD_TOKEN);return{...Tl(this,AO),...null!=e?{playback:e}:{},...null!=t?{drm:t}:{},...null!=i?{thumbnail:i}:{},...null!=r?{storyboard:r}:{}}}set tokens(e){Th(this,AO,null!=e?e:{})}get playbackToken(){var e;return null!=(e=this.getAttribute(AC.PLAYBACK_TOKEN))?e:void 0}set playbackToken(e){this.setAttribute(AC.PLAYBACK_TOKEN,`${e}`)}get drmToken(){var e;return null!=(e=this.getAttribute(AC.DRM_TOKEN))?e:void 0}set drmToken(e){this.setAttribute(AC.DRM_TOKEN,`${e}`)}get thumbnailToken(){var e;return null!=(e=this.getAttribute(AC.THUMBNAIL_TOKEN))?e:void 0}set thumbnailToken(e){this.setAttribute(AC.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return null!=(e=this.getAttribute(AC.STORYBOARD_TOKEN))?e:void 0}set storyboardToken(e){this.setAttribute(AC.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,t,i,r){var a;let s=null==(a=this.media)?void 0:a.nativeEl;if(s)return oE(s,e,t,i,r)}removeTextTrack(e){var t;let i=null==(t=this.media)?void 0:t.nativeEl;if(i){let t;return void(null==(t=Array.prototype.find.call(i.querySelectorAll("track"),t=>t.track===e))||t.remove())}}get textTracks(){var e;return null==(e=this.media)?void 0:e.textTracks}};function A8(e,t){return e.media?e.media.getAttribute(t):e.getAttribute(t)}AM=new WeakMap,AO=new WeakMap,AP=new WeakMap,AN=new WeakMap,AU=new WeakMap,AF=new WeakSet,AB=function(){var e,t,i,r;if(!Tl(this,AM)){Th(this,AM,!0),Tu(this,AV,AK).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof TN.HTMLElement))throw""}catch{T3("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof yD))throw""}catch{T3("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof hb))throw""}catch{T3("<media-controller> failed to upgrade!")}this.init(),Tu(this,Aq,Aj).call(this),Tu(this,AY,Az).call(this),Tu(this,AX,AQ).call(this),Th(this,AP,null==(t=null==(e=this.mediaController)?void 0:e.hasAttribute(dL))||t),Tu(this,AZ,AJ).call(this),null==(i=this.media)||i.addEventListener("streamtypechange",()=>Tu(this,AV,AK).call(this)),null==(r=this.media)||r.addEventListener("loadstart",()=>Tu(this,AV,AK).call(this))}},A$=new WeakSet,AH=function(){var e,t;try{null==(e=null==window?void 0:window.CSS)||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),null==(t=null==window?void 0:window.CSS)||t.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},AW=new WeakSet,AG=function(e){Object.assign(Tl(this,AU),e),Tu(this,AV,AK).call(this)},AV=new WeakSet,AK=function(e={}){var t,i,r,a,s,n,o,l,d,h,u,c,m,p,f,g,v,E,b,y,T,A,_,k,S,w,L,R,I,C,D,x,M,O,P,N,U,F,B,$,H,W,G,V,K;let q,j,Y,z;t={...Tl(this,AU),...e},q={src:!this.playbackId&&this.src,playbackId:this.playbackId,hasSrc:!!this.playbackId||!!this.src||!!this.currentSrc,poster:this.poster,storyboard:this.storyboard,storyboardSrc:this.getAttribute(AC.STORYBOARD_SRC),placeholder:this.getAttribute("placeholder"),themeTemplate:function(e){var t,i;let r=e.theme;if(r){let a=null==(i=null==(t=e.getRootNode())?void 0:t.getElementById)?void 0:i.call(t,r);
2893if(a&&a instanceof HTMLTemplateElement)return a;r.startsWith("media-theme-")||(r=`media-theme-${r}`);let s=TN.customElements.get(r);if(null!=s&&s.template)return s.template}}(this),thumbnailTime:!this.tokens.thumbnail&&this.thumbnailTime,autoplay:this.autoplay,crossOrigin:this.crossOrigin,loop:this.loop,noHotKeys:this.hasAttribute(AC.NOHOTKEYS),hotKeys:this.getAttribute(AC.HOTKEYS),muted:this.muted,paused:this.paused,preload:this.preload,envKey:this.envKey,preferCmcd:this.preferCmcd,debug:this.debug,disableTracking:this.disableTracking,disableCookies:this.disableCookies,tokens:this.tokens,beaconCollectionDomain:this.beaconCollectionDomain,maxResolution:this.maxResolution,minResolution:this.minResolution,programStartTime:this.programStartTime,programEndTime:this.programEndTime,renditionOrder:this.renditionOrder,metadata:this.metadata,playerSoftwareName:this.playerSoftwareName,playerSoftwareVersion:this.playerSoftwareVersion,startTime:this.startTime,preferPlayback:this.preferPlayback,audio:this.audio,defaultStreamType:this.defaultStreamType,targetLiveWindow:this.getAttribute(yR.TARGET_LIVE_WINDOW),streamType:TZ(this.getAttribute(yR.STREAM_TYPE)),primaryColor:this.getAttribute(AC.PRIMARY_COLOR),secondaryColor:this.getAttribute(AC.SECONDARY_COLOR),accentColor:this.getAttribute(AC.ACCENT_COLOR),forwardSeekOffset:this.forwardSeekOffset,backwardSeekOffset:this.backwardSeekOffset,defaultHiddenCaptions:this.defaultHiddenCaptions,defaultDuration:this.defaultDuration,defaultShowRemainingTime:this.defaultShowRemainingTime,hideDuration:(j=null==(r=this.mediaController)?void 0:r.querySelector("media-time-display"))&&"none"===getComputedStyle(j).getPropertyValue("--media-duration-display-display").trim(),playbackRates:this.getAttribute(AC.PLAYBACK_RATES),customDomain:null!=(i=this.getAttribute(yR.CUSTOM_DOMAIN))?i:void 0,title:this.getAttribute(AC.TITLE),novolumepref:this.hasAttribute(AC.NO_VOLUME_PREF),...t,extraSourceParams:this.extraSourceParams},a=AT` 2894 <style> 2895 ${(e=>{let{tokens:t}=e;return t.drm?":host { --_cast-button-drm-display: none; }":""})(q)} 2896 ${An} 2897 </style> 2898 ${n=q,AT` 2899 <media-theme 2900 template="${n.themeTemplate||!1}" 2901 defaultstreamtype="${null!=(o=n.defaultStreamType)&&o}" 2902 hotkeys="${Y=n.hotKeys?`${n.hotKeys}`:"","live"===TZ(n.streamType)&&(Y+=" noarrowleft noarrowright"),Y||!1}" 2903 nohotkeys="${n.noHotKeys||!n.hasSrc||n.isDialogOpen||!1}" 2904 noautoseektolive="${!!(null!=(l=n.streamType)&&l.includes(oi))&&0!==n.targetLiveWindow}" 2905 novolumepref="${n.novolumepref||!1}" 2906 disabled="${!n.hasSrc||n.isDialogOpen}" 2907 audio="${null!=(d=n.audio)&&d}" 2908 style="${null!=(K={"--media-primary-color":n.primaryColor,"--media-secondary-color":n.secondaryColor,"--media-accent-color":n.accentColor}
2908,z="",Object.entries(K).forEach(([e,t])=>{null!=t&&(z+=`${TH(e)}: ${t}; `)}),h=z?z.trim():void 0)&&h}" 2909 defaultsubtitles="${!n.defaultHiddenCaptions}" 2910 forwardseekoffset="${null!=(u=n.forwardSeekOffset)&&u}" 2911 backwardseekoffset="${null!=(c=n.backwardSeekOffset)&&c}" 2912 playbackrates="${null!=(m=n.playbackRates)&&m}" 2913 defaultshowremainingtime="${null!=(p=n.defaultShowRemainingTime)&&p}" 2914 defaultduration="${null!=(f=n.defaultDuration)&&f}" 2915 hideduration="${null!=(g=n.hideDuration)&&g}" 2916 title="${null!=(v=n.title)&&v}" 2917 exportparts="${AA}" 2918 > 2919 <mux-video 2920 slot="media" 2921 target-live-window="${null!=(E=n.targetLiveWindow)&&E}" 2922 stream-type="${null!=(b=TZ(n.streamType))&&b}" 2923 crossorigin="${null!=(y=n.crossOrigin)?y:""}" 2924 playsinline 2925 autoplay="${null!=(T=n.autoplay)&&T}" 2926 muted="${null!=(A=n.muted)&&A}" 2927 loop="${null!=(_=n.loop)&&_}" 2928 preload="${null!=(k=n.preload)&&k}" 2929 debug="${null!=(S=n.debug)&&S}" 2930 prefer-cmcd="${null!=(w=n.preferCmcd)&&w}" 2931 disable-tracking="${null!=(L=n.disableTracking)&&L}" 2932 disable-cookies="${null!=(R=n.disableCookies)&&R}" 2933 prefer-playback="${null!=(I=n.preferPlayback)&&I}" 2934 start-time="${null!=n.startTime&&n.startTime}" 2935 beacon-collection-domain="${null!=(C=n.beaconCollectionDomain)&&C}" 2936 player-software-name="${null!=(D=n.playerSoftwareName)&&D}" 2937 player-software-version="${null!=(x=n.playerSoftwareVersion)&&x}" 2938 env-key="${null!=(M=n.envKey)&&M}" 2939 custom-domain="${null!=(O=n.customDomain)&&O}" 2940 src="${n.src?n.src:!!n.playbackId&&o8(n)}" 2941 cast-src="${n.src?n.src:!!n.playbackId&&o8(n)}" 2942 drm-token="${null!=(N=null==(P=n.tokens)?void 0:P.drm)&&N}" 2943 exportparts="video" 2944 > 2945 ${n.storyboard?AT`<track label="thumbnails" default kind="metadata" src="${n.storyboard}" />`:AT``} 2946 </mux-video> 2947 <slot name="poster" slot="poster"> 2948 <media-poster-image 2949 part="poster" 2950 exportparts="poster, img" 2951 src="${""!==n.poster&&null!=(U=n.poster)&&U}" 2952 placeholdersrc="${null!=(F=n.placeholder)&&F}" 2953 ></media-poster-image> 2954 </slot> 2955 <mxp-dialog 2956 no-auto-hide 2957 open="${null!=(B=n.isDialogOpen)&&B}" 2958 onclose="${n.onCloseErrorDialog}" 2959 oninitfocus="${n.onInitFocusDialog}" 2960 > 2961 ${null!=($=n.dialog)&&$.title?AT`<h3>${n.dialog.title}</h3>`:AT``} 2962 <p> 2963 ${null==(H=n.dialog)?void 0:H.message} 2964 ${null!=(W=n.dialog)&&W.linkUrl?AT`<a 2965 href="${n.dialog.linkUrl}" 2966 target="_blank" 2967 rel="external noopener" 2968 aria-label="${null!=(G=n.dialog.linkText)?G:""} ${TB("(opens in a new window)")}" 2969 >${null!=(V=n.dialog.linkText)?V:n.dialog.linkUrl}</a 2970 >`:AT``} 2971 </p> 2972 </mxp-dialog> 2973 </media-theme> 2974`} 2975`,s=this.shadowRoot,a.renderInto(s)},Aq=new WeakSet,Aj=function(){let e=e=>{var t,i;if(!(null!=e&&e.startsWith("theme-")))return;let r=e.replace(/^theme-/,"");if(AD.includes(r))return;let a=this.getAttribute(e);null!=a?null==(t=this.mediaTheme)||t.setAttribute(r,a):null==(i=this.mediaTheme)||i.removeAttribute(r)};new MutationObserver(t=>{for(let{attributeName:i}of t)e(i)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},AY=new WeakSet,Az=function(){var e;let t=e=>{let{detail:t}=e;if(t instanceof n6||(t=new n6(t.message,t.code,t.fatal)),!(null!=t&&t.fatal)){T2(t),t.data&&T2(`${t.name} data:`,t.data);return}let{dialog:i,devlog:r}=A_(t,!window.navigator.onLine,this.playbackId,this.playbackToken);r.message&&T4(r),T3(t),t.data&&T3(`${t.name} data:`,t.data),Tu(this,AW,AG).call(this,{isDialogOpen:!0,dialog:i})};this.addEventListener("error",t),this.media&&(this.media.errorTranslator=(e={})=>{var t,i,r;if(!((null==(t=this.media)?void 0:t.error)instanceof n6))return e;let{devlog:a}=A_(null==(i=this.media)?void 0:i.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:null==(r=this.media)?void 0:r.error.code,player_error_message:a.message?String(a.message):e.player_error_message,player_error_context:a.context?String(a.context):e.player_error_context}}),null==(e=this.media)||e.addEventListener("error",e=>{var t,i;let{detail:r}=e;if(!r){let{message:e,code:a}=null!=(i=null==(t=this.media)?void 0:t.error)?i:{};r=new n6(e,a)}null!=r&&r.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:r}))})},AX=new WeakSet,AQ=function(){var e,t,i,r;let a=()=>Tu(this,AV,AK).call(this);null==(t=null==(e=this.media)?void 0:e.textTracks)||t.addEventListener("addtrack",a),null==(r=null==(i=this.media)?void 0:i.textTracks)||r.addEventListener("removetrack",a)},AZ=new WeakSet,AJ=function(){var e,t;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,a=()=>this.streamType===oi&&!this.secondaryColor&&this.offsetWidth>=800,s=(e,t,i=!1)=>
2975{a()||Array.from(e&&e.activeCues||[]).forEach(e=>{if(!(!e.snapToLines||e.line<-5||e.line>=0&&e.line<10))if(!t||this.paused){let t=e.text.split(` 2976`).length,a=-3;this.streamType===oi&&(a=-2);let s=a-t;if(e.line===s&&!i)return;r.has(e)||r.set(e,e.line),e.line=s}else setTimeout(()=>{e.line=r.get(e)||"auto"},500)})},n=()=>{var e,t;s(i,null!=(t=null==(e=this.mediaController)?void 0:e.hasAttribute(dL))&&t)},o=()=>{var e,t;let r=Array.from((null==(t=null==(e=this.mediaController)?void 0:e.media)?void 0:t.textTracks)||[]).filter(e=>["subtitles","captions"].includes(e.kind)&&"showing"===e.mode)[0];r!==i&&(null==i||i.removeEventListener("cuechange",n)),null==(i=r)||i.addEventListener("cuechange",n),s(i,Tl(this,AP))};o(),null==(e=this.textTracks)||e.addEventListener("change",o),null==(t=this.textTracks)||t.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var e,t;let r=null==(t=null==(e=this.mediaController)?void 0:e.hasAttribute(dL))||t;Tl(this,AP)!==r&&(Th(this,AP,r),s(i,Tl(this,AP)))})},TN.customElements.get("mux-player")||(TN.customElements.define("mux-player",A5),TN.MuxPlayerElement=A5);var A9={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},A6=Object.prototype.hasOwnProperty,A7=(e,t,i)=>!((e,t)=>{if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(Array.isArray(e))return!!Array.isArray(t)&&e.length===t.length&&e.some((e,i)=>t[i]===e);let i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(let r=0;r<i.length;r++)if(!A6.call(t,i[r])||!Object.is(e[i[r]],t[i[r]]))return!1;return!0})(t,e[i]),_e=(e,t,i)=>{e[i]=t},_t=(e,t,i,r=_e,a=A7)=>(0,m.useEffect)(()=>{let s=null==i?void 0:i.current;s&&a(s,t,e)&&r(s,t,e)},[null==i?void 0:i.current,t]),_i=(()=>{try{return"2.9.1"}catch{}return"UNKNOWN"})(),_r=m.default.forwardRef(({children:e,...t},i)=>m.default.createElement("mux-player",((e={})=>Object.entries(e).reduce((e,[t,i])=>{let r=((e,t)=>{if(!("boolean"==typeof t&&!t)){let t,i;return(t=e,null!=(i=A9)&&t in i)?A9[e]:/[A-Z]/.test(e)?e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`):e}})(t,i);if(!r)return e;let a="boolean"==typeof i?"":i;return e[r]=a,e},{}))({...t,ref:i}),e)),_a=(e,t,i)=>(0,m.useEffect)(()=>{let r=null==t?void 0:t.current;if(!(!r||!i))return r.addEventListener(e,i),()=>{r.removeEventListener(e,i)}},[null==t?void 0:t.current,i]),_s=m.default.forwardRef((e,t)=>{let i=(0,m.useRef)(null),r=((...e)=>{let t=(0,m.useRef)(null);return(0,m.useEffect)(()=>{e.forEach(e=>{e&&("function"==typeof e?e(t.current):e.current=t.current)})},[e]),t})(i,t),[a]=((e,t)=>{let{onAbort:i,onCanPlay:r,onCanPlayThrough:a,onEmptied:s,onLoadStart:n,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:h,onVolumeChange:u,onRateChange:c,onResize:m,onWaiting:p,onPlay:f,onPlaying:g,onTimeUpdate:v,onPause:E,onSeeking:b,onSeeked:y,onStalled:T,onSuspend:A,onEnded:_,onError:k,onCuePointChange:S,onCuePointsChange:w,onChapterChange:L,metadata:R,tokens:I,paused:C,playbackId:D,playbackRates:x,currentTime:M,themeProps:O,extraSourceParams:P,_hlsConfig:N,...U}=t;return _t("playbackRates",x,e),_t("metadata",R,e),_t("extraSourceParams",P,e),_t("_hlsConfig",N,e),_t("themeProps",O,e),_t("tokens",I,e),_t("playbackId",D,e),_t("paused",C,e,(e,t)=>{null!=t&&(t?e.pause():e.play())},(e,t,i)=>(!e.hasAttribute("autoplay")||!!e.hasPlayed)&&A7(e,t,i)),_t("currentTime",M,e,(e,t)=>{null!=t&&(e.currentTime=t)}),_a("abort",e,i),_a("canplay",e,r),_a("canplaythrough",e,a),_a("emptied",e,s),_a("loadstart",e,n),_a("loadeddata",e,o),_a("loadedmetadata",e,l),_a("progress",e,d),_a("durationchange",e,h),_a("volumechange",e,u),_a("ratechange",e,c),_a("resize",e,m),_a("waiting",e,p),_a("play",e,f),_a("playing",e,g),_a("timeupdate",e,v),_a("pause",e,E),_a("seeking",e,b),_a("seeked",e,y),_a("stalled",e,T),_a("suspend",e,A),_a("ended",e,_),_a("error",e,k),_a("cuepointchange",e,S),_a("cuepointschange",e,w),_a("chapterchange",e,L),[U]})(i,e);return m.default.createElement(_r,{ref:r,playerSoftwareName:"mux-player-react",playerSoftwareVersion:_i,...a}
2976)}),_n=e.i(7670);e.s(["MuxVideo",0,({playbackId:e,title:t,autoPlay:i=!1,loop:r=!1,poster:a="",hasMinimalControlButtons:s=!1,aspectRatio:n="16:9"})=>{let o=n.split(":"),l=Number(o[0])/Number(o[1]);return(0,c.jsx)(_s,{autoPlay:i,loop:r,playbackId:e,metadata:t?{video_title:t}:{},muted:!0,volume:0,className:(0,_n.default)({"hide-buttons":i,controls__minimal:s}),style:{width:"100%",objectFit:"cover",aspectRatio:l},poster:a,accentColor:"#2c72db"})}],45728)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.