vendor: 10,063 bytes, line 1
1import{R as Ca,r as wa}from"./main-0mA9R0ha.js";import{C as uo,M as pT}from"./mixin-BPAPQfSE.js";import{C as gT}from"./castable-mixin-DSar2FIC.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="295d7e85-501d-4180-8267-cac33fa9ca8c",i._sentryDebugIdIdentifier="sentry-dbid-295d7e85-501d-4180-8267-cac33fa9ca8c")}catch{}})();var vT=Object.create,P0=Object.defineProperty,ET=Object.getOwnPropertyDescriptor,yT=Object.getOwnPropertyNames,bT=Object.getPrototypeOf,TT=Object.prototype.hasOwnProperty,O0=function(i,e){return function(){return i&&(e=i(i=0)),e}},Dt=function(i,e){return function(){return e||i((e={exports:{}}).exports,e),e.exports}},_T=function(i,e,t,s){if(e&&typeof e=="object"||typeof e=="function")for(var r=yT(e),n=0,a=r.length,o;n<a;n++)o=r[n],!TT.call(i,o)&&o!==t&&P0(i,o,{get:(function(l){return e[l]}).bind(null,o),enumerable:!(s=ET(e,o))||s.enumerable});return i},ei=function(i,e,t){return t=i!=null?vT(bT(i)):{},_T(!i||!i.__esModule?P0(t,"default",{value:i,enumerable:!0}):t,i)},ji=Dt(function(i,e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={},e.exports=t});function Tr(i,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](i):Tr(i,e)}var _r=O0(function(){_r()});function N0(i){"@swc/helpers - typeof";return i&&typeof Symbol<"u"&&i.constructor===Symbol?"symbol":typeof i}var U0=O0(function(){}),$0=Dt(function(i,e){var t=Array.prototype.slice;e.exports=s;function s(r,n){for(("length"in r)||(r=[r]),r=t.call(r);r.length;){var a=r.shift(),o=n(a);if(o)return o;a.childNodes&&a.childNodes.length&&(r=t.call(a.childNodes).concat(r))}}}),AT=Dt(function(i,e){_r(),e.exports=t;function t(s,r){if(!Tr(this,t))return new t(s,r);this.data=s,this.nodeValue=s,this.length=s.length,this.ownerDocument=r||null}t.prototype.nodeType=8,t.prototype.nodeName="#comment",t.prototype.toString=function(){return"[object Comment]"}}),ST=Dt(function(i,e){_r(),e.exports=t;function t(s,r){if(!Tr(this,t))return new t(s);this.data=s||"",this.length=this.data.length,this.ownerDocument=r||null}t.prototype.type="DOMTextNode",t.prototype.nodeType=3,t.prototype.nodeName="#text",t.prototype.toString=function(){return this.data},t.prototype.replaceData=function(s,r,n){var a=this.data,o=a.substring(0,s),l=a.substring(s+r,a.length);this.data=o+n+l,this.length=this.data.length}}),F0=Dt(function(i,e){e.exports=t;function t(s){var r=this,n=s.type;s.target||(s.target=r),r.listeners||(r.listeners={});var a=r.listeners[n];if(a)return a.forEach(function(o){s.currentTarget=r,typeof o=="function"?o(s):o.handleEvent(s)});r.parentNode&&r.parentNode.dispatchEvent(s)}}),B0=Dt(function(i,e){e.exports=t;function t(s,r){var n=this;n.listeners||(n.listeners={}),n.listeners[s]||(n.listeners[s]=[]),n.listeners[s].indexOf(r)===-1&&n.listeners[s].push(r)}}),H0=Dt(function(i,e){e.exports=t;function t(s,r){var n=this;if(n.listeners&&n.listeners[s]){var a=n.listeners[s],o=a.indexOf(r);o!==-1&&a.splice(o,1)}}}),IT=Dt(function(i,e){U0(),e.exports=s;var t=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function s(h){switch(h.nodeType){case 3:return u(h.data);case 8:return"<!--"+h.data+"-->";default:return r(h)}}function r(h){var f=[],m=h.tagName;return h.namespaceURI==="http://www.w3.org/1999/xhtml"&&(m=m.toLowerCase()),f.push("<"+m+d(h)+o(h)),t.indexOf(m)>-1?f.push(" />"):(f.push(">"),h.childNodes.length?f.push.apply(f,h.childNodes.map(s)):h.textContent||h.innerText?f.push(u(h.textContent||h.innerText)):h.innerHTML&&f.push(h.innerHTML),f.push("</"+m+">")),f.join("")}function n(h,f){var m=N0(h[f]);return f==="style"&&Object.keys(h.style).length>0?!0:h.hasOwnProperty(f)&&(m==="string"||m==="boolean"||m==="number")&&f!=="nodeName"&&f!=="className"&&f!=="tagName"&&f!=="textContent"&&f!=="innerText"&&f!=="namespaceURI"&&f!=="innerHTML"}function a(h){if(typeof h=="string")return h;var f="";return Object.keys(h).forEach(function(m){var g=h[m];m=m.replace(/[A-Z]/g,function(p){return"-"+p.toLowerCase()}),f+=m+":"+g+";"}),f}function o(h){var f=h.dataset,m=[];for(var g in f)m.push({name:"data-"+g,value:f[g]});return m.length?l(m):""}function l(h){var f=[];return h.forEach(function(m){var g=m.name,p=m.value;g==="style"&&(p=a(p)),f.push(g+'="'+c(p)+'"')}),f.length?" "+f.join(" "):""}function d(h){var f=[];for(var m in h)n(h,m)&&f.push({name:m,value:h[m]});for(var g in h._attributes)for(var p in h._attributes[g]){var E=h._attributes[g][p],b=(E.prefix?E.prefix+":":"")+p;f.push({name:b,value:E.value})}return h.className&&f.push({name:"class",value:h.className}),f.length?l(f):""}function u(h){var f="";return typeof h=="string"?f=h:h&&(f=h.toString()),f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function c(h){return u(h).replace(/"/g,""")}}),G0=Dt(function(i,e){_r();var t=$0(),s=F0(),r=B0(),n=H0(),a=IT(),o="http://www.w3.org/1999/xhtml";e.exports=l;function l(d,u,c){if(!Tr(this,l))return new l(d);var h=c===void 0?o:c||null;this.tagName=h===o?String(d).toUpperCase():d,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=u||null,this.namespaceURI=h,this._attributes={},this.tagName==="INPUT"&&(this.type="text")}l.prototype.type="DOMElement",l.prototype.nodeType=1,l.prototype.appendChild=function(d){return d.parentNode&&d.parentNode.removeChild(d),this.childNodes.push(d),d.parentNode=this,d},l.prototype.replaceChild=function(d,u){d.parentNode&&d.parentNode.removeChild(d);var c=this.childNodes.indexOf(u);return u.parentNode=null,this.childNodes[c]=d,d.parentNode=this,u},l.prototype.removeChild=function(d){var u=this.childNodes.indexOf(d);return this.childNodes.splice(u,1),d.parentNode=null,d},l.prototype.insertBefore=function(d,u){d.parentNode&&d.parentNode.removeChild(d);var c=u==null?-1:this.childNodes.indexOf(u);return c>-1?this.childNodes.splice(c,0,d):this.childNodes.push(d),d.parentNode=this,d},l.prototype.setAttributeNS=function(d,u,c){var h=null,f=u,m=u.indexOf(":");if(m>-1&&(h=u.substr(0,m),f=u.substr(m+1)),this.tagName==="INPUT"&&u==="type")this.type=c;else{var g=this._attributes[d]||(this._attributes[d]={});g[f]={value:c,prefix:h}}},l.prototype.getAttributeNS=function(d,u){var c=this._attributes[d],h=c&&c[u]&&c[u].value;return this.tagName==="INPUT"&&u==="type"?this.type:typeof h!="string"?null:h},l.prototype.removeAttributeNS=function(d,u){var c=this._attributes[d];c&&delete c[u]},l.prototype.hasAttributeNS=function(d,u){var c=this._attributes[d];return!!c&&u in c},l.prototype.setAttribute=function(d,u){return this.setAttributeNS(null,d,u)},l.prototype.getAttribute=function(d){return this.getAttributeNS(null,d)},l.prototype.removeAttribute=function(d){return this.removeAttributeNS(null,d)},l.prototype.hasAttribute=function(d){return this.hasAttributeNS(null,d)},l.prototype.removeEventListener=n,l.prototype.addEventListener=r,l.prototype.dispatchEvent=s,l.prototype.focus=function(){},l.prototype.toString=function(){return a(this)},l.prototype.getElementsByClassName=function(d){var u=d.split(" "),c=[];return t(this,function(h){if(h.nodeType===1){var f=h.className||"",m=f.split(" ");u.every(function(g){return m.indexOf(g)!==-1})&&c.push(h)}}),c},l.prototype.getElementsByTagName=function(d){d=d.toLowerCase();var u=[];return t(this.childNodes,function(c){c.nodeType===1&&(d==="*"||c.tagName.toLowerCase()===d)&&u.push(c)}),u},l.prototype.contains=function(d){return t(this,function(u){return d===u})||!1}}),LT=Dt(function(i,e){_r();var t=G0();e.exports=s;function s(r){if(!Tr(this,s))return new s;this.childNodes=[],this.parentNode=null,this.ownerDocument=r||null}s.prototype.type="DocumentFragment",s.prototype.nodeType=11,s.prototype.nodeName="#document-fragment",s.prototype.appendChild=t.prototype.appendChild,s.prototype.replaceChild=t.prototype.replaceChild,s.prototype.removeChild=t.prototype.removeChild,s.prototype.toString=function(){return this.childNodes.map(function(r){return String(r)}).join("")}}),RT=Dt(function(i,e){e.exports=t;function t(s){}t.prototype.initEvent=function(s,r,n){this.type=s,this.bubbles=r,this.cancelable=n},t.prototype.preventDefault=function(){}}),xT=Dt(function(i,e){_r();var t=$0(),s=AT(),r=ST(),n=G0(),a=LT(),o=RT(),l=F0(),d=B0(),u=H0();e.exports=c;function c(){if(!Tr(this,c))return new c;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}var h=c.prototype;h.createTextNode=function(f){return new r(f,this)},h.createElementNS=function(f,m){var g=f===null?null:String(f);return new n(m,this,g)},h.createElement=function(f){return new n(f,this)},h.createDocumentFragment=function(){return new a(this)},h.createEvent=function(f){return new o(f)},h.createComment=function(f){return new s(f,this)},h.getElementById=function(f){f=String(f);var m=t(this.childNodes,function(g){if(String(g.id)===f)return g});return m||null},h.getElementsByClassName=n.prototype.getElementsByClassName,h.getElementsByTagName=n.prototype.getElementsByTagName,h.contains=n.prototype.contains,h.removeEventListener=u,h.addEventListener=d,h.dispatchEvent=l}),kT=Dt(function(i,e){var t=xT();e.exports=new t}),K0=Dt(function(i,e){var t=typeof global<"u"?global:typeof window<"u"?window:{},s=kT(),r;typeof document<"u"?r=document:(r=t["__GLOBAL_DOCUMENT_CACHE@4"],r||(r=t["__GLOBAL_DOCUMENT_CACHE@4"]=s)),e.exports=r});function DT(i){if(Array.isArray(i))return i}function CT(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var s=[],r=!0,n=!1,a,o;try{for(t=t.call(i);!(r=(a=t.next()).done)&&(s.push(a.value),!(e&&s.length===e));r=!0);}catch(l){n=!0,o=l}finally{try{!r&&t.return!=null&&t.return()}finally{if(n)throw o}}return s}}
1function wT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cc(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}function V0(i,e){if(i){if(typeof i=="string")return cc(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return cc(i,e)}}function us(i,e){return DT(i)||CT(i,e)||V0(i,e)||wT()}var Ea=ei(ji()),Um=ei(ji()),MT=ei(ji()),PT={now:function(){var i=MT.default.performance,e=i&&i.timing,t=e&&e.navigationStart,s=typeof t=="number"&&typeof i.now=="function"?t+i.now():Date.now();return Math.round(s)}},ht=PT,Ma=function(){var i,e,t;if(typeof((i=Um.default.crypto)===null||i===void 0?void 0:i.getRandomValues)=="function"){t=new Uint8Array(32),Um.default.crypto.getRandomValues(t);for(var s=0;s<32;s++)t[s]=t[s]%16}else{t=[];for(var r=0;r<32;r++)t[r]=Math.random()*16|0}var n=0;e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(l){var d=l==="x"?t[n]:t[n]&3|8;return n++,d.toString(16)});var a=ht.now(),o=a?.toString(16).substring(3);return o?e.substring(0,28)+o:e},W0=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},ai=function(i){if(i&&typeof i.nodeName<"u")return i.muxId||(i.muxId=W0()),i.muxId;var e;try{e=document.querySelector(i)}catch{}return e&&!e.muxId&&(e.muxId=i),e?.muxId||i},nd=function(i){var e;i&&typeof i.nodeName<"u"?(e=i,i=ai(e)):e=document.querySelector(i);var t=e&&e.nodeName?e.nodeName.toLowerCase():"";return[e,i,t]};function OT(i){if(Array.isArray(i))return cc(i)}function NT(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function UT(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 3In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oi(i){return OT(i)||NT(i)||V0(i)||UT()}var nr={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},$T=function(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3,t,s,r,n,a,o=[console,i],l=(t=console.trace).bind.apply(t,oi(o)),d=(s=console.info).bind.apply(s,oi(o)),u=(r=console.debug).bind.apply(r,oi(o)),c=(n=console.warn).bind.apply(n,oi(o)),h=(a=console.error).bind.apply(a,oi(o)),f=e;return{trace:function(){for(var m=arguments.length,g=new Array(m),p=0;p<m;p++)g[p]=arguments[p];if(!(f>nr.TRACE))return l.apply(void 0,oi(g))},debug:function(){for(var m=arguments.length,g=new Array(m),p=0;p<m;p++)g[p]=arguments[p];if(!(f>nr.DEBUG))return u.apply(void 0,oi(g))},info:function(){for(var m=arguments.length,g=new Array(m),p=0;p<m;p++)g[p]=arguments[p];if(!(f>nr.INFO))return d.apply(void 0,oi(g))},warn:function(){for(var m=arguments.length,g=new Array(m),p=0;p<m;p++)g[p]=arguments[p];if(!(f>nr.WARN))return c.apply(void 0,oi(g))},error:function(){for(var m=arguments.length,g=new Array(m),p=0;p<m;p++)g[p]=arguments[p];if(!(f>nr.ERROR))return h.apply(void 0,oi(g))},get level(){return f},set level(m){m!==this.level&&(f=m??e)}}},De=$T("[mux]"),vu=ei(ji());function hc(){var i=vu.default.doNotTrack||vu.default.navigator&&vu.default.navigator.doNotTrack;return i==="1"}function ne(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}_r();function lt(i,e){if(!Tr(i,e))throw new TypeError("Cannot call a class as a function")}function FT(i,e){for(var t=0;t<e.length;t++){var s=e[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(i,s.key,s)}}function zi(i,e,t){return e&&FT(i.prototype,e),i}function K(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _n(i){return _n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_n(i)}function BT(i,e){for(;!Object.prototype.hasOwnProperty.call(i,e)&&(i=_n(i),i!==null););return i}function Ko(i,e,t){return typeof Reflect<"u"&&Reflect.get?Ko=Reflect.get:Ko=function(s,r,n){var a=BT(s,r);if(a){var o=Object.getOwnPropertyDescriptor(a,r);return o.get?o.get.call(n||s):o.value}},Ko(i,e,t||i)}
vendor: 22,465 bytes, lines 3-14
3function fc(i,e){return fc=Object.setPrototypeOf||function(t,s){return t.__proto__=s,t},fc(i,e)}function HT(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&fc(i,e)}function GT(i,e){if(i==null)return{};var t={},s=Object.keys(i),r,n;for(n=0;n<s.length;n++)r=s[n],!(e.indexOf(r)>=0)&&(t[r]=i[r]);return t}function KT(i,e){if(i==null)return{};var t=GT(i,e),s,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(r=0;r<n.length;r++)s=n[r],!(e.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(i,s)&&(t[s]=i[s])}return t}function VT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}U0();function WT(i,e){return e&&(N0(e)==="object"||typeof e=="function")?e:ne(i)}function YT(i){var e=VT();return function(){var t=_n(i),s;if(e){var r=_n(this).constructor;s=Reflect.construct(t,arguments,r)}else s=t.apply(this,arguments);return WT(this,s)}}var fi=function(i){return Pa(i)[0]},Pa=function(i){if(typeof i!="string"||i==="")return["localhost"];var e=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,t=i.match(e)||[],s=t[4],r;return s&&(r=(s.match(/[^\.]+\.[^\.]+$/)||[])[0]),[s,r]},Eu=ei(ji()),qT={exists:function(){var i=Eu.default.performance,e=i&&i.timing;return e!==void 0},domContentLoadedEventEnd:function(){var i=Eu.default.performance,e=i&&i.timing;return e&&e.domContentLoadedEventEnd},navigationStart:function(){var i=Eu.default.performance,e=i&&i.timing;return e&&e.navigationStart}},ad=qT;function at(i,e,t){t=t===void 0?1:t,i[e]=i[e]||0,i[e]+=t}function od(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{},s=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),s.forEach(function(r){K(i,r,t[r])})}return i}function jT(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);t.push.apply(t,s)}return t}function Wh(i,e){return e=e??{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):jT(Object(e)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))}),i}var zT=["x-cdn","content-type"],Y0=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],QT=zT.concat(Y0);function Yh(i){i=i||"";var e={},t=i.trim().split(/[\r\n]+/);return t.forEach(function(s){if(s){var r=s.split(": "),n=r.shift();n&&(QT.indexOf(n.toLowerCase())>=0||n.toLowerCase().indexOf("x-litix-")===0)&&(e[n]=r.join(": "))}}),e}function ld(i){if(i){var e=Y0.find(function(t){return i[t]!==void 0});return e?i[e]:void 0}}var XT=function(i){var e={};for(var t in i){var s=i[t],r=s["DATA-ID"].search("io.litix.data.");if(r!==-1){var n=s["DATA-ID"].replace("io.litix.data.","");e[n]=s.VALUE}}return e},q0=XT,co=function(i){if(!i)return{};var e=ad.navigationStart(),t=i.loading,s=t?t.start:i.trequest,r=t?t.first:i.tfirst,n=t?t.end:i.tload;return{bytesLoaded:i.total,requestStart:Math.round(e+s),responseStart:Math.round(e+r),responseEnd:Math.round(e+n)}},Nn=function(i){if(!(!i||typeof i.getAllResponseHeaders!="function"))return Yh(i.getAllResponseHeaders())},ZT=function(i,e,t){var s=arguments.length>4?arguments[4]:void 0,r=i.log,n=i.utils.secondsToMs,a=function(p){var E=parseInt(s.version),b;return E===1&&p.programDateTime!==null&&(b=p.programDateTime),E===0&&p.pdt!==null&&(b=p.pdt),b};if(!ad.exists()){r.warn("performance timing not supported. Not tracking HLS.js.");return}var o=function(p,E){return i.emit(e,p,E)},l=function(p,E){var b=E.levels,y=E.audioTracks,T=E.url,A=E.stats,L=E.networkDetails,S=E.sessionData,R={},x={};b.forEach(function(H,N){R[N]={width:H.width,height:H.height,bitrate:H.bitrate,attrs:H.attrs}}),y.forEach(function(H,N){x[N]={name:H.name,language:H.lang,bitrate:H.bitrate}});var I=co(A),M=I.bytesLoaded,$=I.requestStart,V=I.responseStart,Y=I.responseEnd;o("requestcompleted",Wh(od({},q0(S)),{request_event_type:p,request_bytes_loaded:M,request_start:$,request_response_start:V,request_response_end:Y,request_type:"manifest",request_hostname:fi(T),request_response_headers:Nn(L),request_rendition_lists:{media:R,audio:x,video:{}}}))};t.on(s.Events.MANIFEST_LOADED,l);var d=function(p,E){var b=E.details,y=E.level,T=E.networkDetails,A=E.stats,L=co(A),S=L.bytesLoaded,R=L.requestStart,x=L.responseStart,I=L.responseEnd,M=b.fragments[b.fragments.length-1],$=a(M)+n(M.duration);o("requestcompleted",{request_event_type:p,request_bytes_loaded:S,request_start:R,request_response_start:x,request_response_end:I,request_current_level:y,request_type:"manifest",request_hostname:fi(b.url),request_response_headers:Nn(T),video_holdback:b.holdBack&&n(b.holdBack),video_part_holdback:b.partHoldBack&&n(b.partHoldBack),video_part_target_duration:b.partTarget&&n(b.partTarget),video_target_duration:b.targetduration&&n(b.targetduration),video_source_is_live:b.live,player_manifest_newest_program_time:isNaN($)?void 0:$})};t.on(s.Events.LEVEL_LOADED,d);var u=function(p,E){var b=E.details,y=E.networkDetails,T=E.stats,A=co(T),L=A.bytesLoaded,S=A.requestStart,R=A.responseStart,x=A.responseEnd;o("requestcompleted",{request_event_type:p,request_bytes_loaded:L,request_start:S,request_response_start:R,request_response_end:x,request_type:"manifest",request_hostname:fi(b.url),request_response_headers:Nn(y)})};t.on(s.Events.AUDIO_TRACK_LOADED,u);var c=function(p,E){var b=E.stats,y=E.networkDetails,T=E.frag;b=b||T.stats;var A=co(b),L=A.bytesLoaded,S=A.requestStart,R=A.responseStart,x=A.responseEnd,I=y?Nn(y):void 0,M={request_event_type:p,request_bytes_loaded:L,request_start:S,request_response_start:R,request_response_end:x,request_hostname:y?fi(y.responseURL):void 0,request_id:I?ld(I):void 0,request_response_headers:I,request_media_duration:T.duration,request_url:y?.responseURL};T.type==="main"?(M.request_type="media",M.request_current_level=T.level,M.request_video_width=(t.levels[T.level]||{}).width,M.request_video_height=(t.levels[T.level]||{}).height,M.request_labeled_bitrate=(t.levels[T.level]||{}).bitrate):M.request_type=T.type,o("requestcompleted",M)};t.on(s.Events.FRAG_LOADED,c);var h=function(p,E){var b=E.frag,y=b.start,T=a(b),A={currentFragmentPDT:T,currentFragmentStart:n(y)};o("fragmentchange",A)};t.on(s.Events.FRAG_CHANGED,h);var f=function(p,E){var b=E.type,y=E.details,T=E.response,A=E.fatal,L=E.frag,S=E.networkDetails,R=L?.url||E.url||"",x=S?Nn(S):void 0;if((y===s.ErrorDetails.MANIFEST_LOAD_ERROR||y===s.ErrorDetails.MANIFEST_LOAD_TIMEOUT||y===s.ErrorDetails.FRAG_LOAD_ERROR||y===s.ErrorDetails.FRAG_LOAD_TIMEOUT||y===s.ErrorDetails.LEVEL_LOAD_ERROR||y===s.ErrorDetails.LEVEL_LOAD_TIMEOUT||y===s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||y===s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT||y===s.ErrorDetails.SUBTITLE_LOAD_ERROR||y===s.ErrorDetails.SUBTITLE_LOAD_TIMEOUT||y===s.ErrorDetails.KEY_LOAD_ERROR||y===s.ErrorDetails.KEY_LOAD_TIMEOUT)&&o("requestfailed",{request_error:y,request_url:R,request_hostname:fi(R),request_id:x?ld(x):void 0,request_type:y===s.ErrorDetails.FRAG_LOAD_ERROR||y===s.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":y===s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||y===s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":y===s.ErrorDetails.SUBTITLE_LOAD_ERROR||y===s.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":y===s.ErrorDetails.KEY_LOAD_ERROR||y===s.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:T?.code,request_error_text:T?.text}),A){var I,M="".concat(R?"url: ".concat(R,` 4`):"")+"".concat(T&&(T.code||T.text)?"response: ".concat(T.code,", ").concat(T.text,` 5`):"")+"".concat(E.reason?"failure reason: ".concat(E.reason,` 6`):"")+"".concat(E.level?"level: ".concat(E.level,` 7`):"")+"".concat(E.parent?"parent stream controller: ".concat(E.parent,` 8`):"")+"".concat(E.buffer?"buffer length: ".concat(E.buffer,` 9`):"")+"".concat(E.error?"error: ".concat(E.error,` 10`):"")+"".concat(E.event?"event: ".concat(E.event,` 11`):"")+"".concat(E.err?"error message: ".concat((I=E.err)===null||I===void 0?void 0:I.message,` 12`):"");o("error",{player_error_code:b,player_error_message:y,player_error_context:M})}};t.on(s.Events.ERROR,f);var m=function(p,E){var b=E.frag,y=b&&b._url||"";o("requestcanceled",{request_event_type:p,request_url:y,request_type:"media",request_hostname:fi(y)})};t.on(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,m);var g=function(p,E){var b=E.level,y=t.levels[b];if(y&&y.attrs&&y.attrs.BANDWIDTH){var T=y.attrs.BANDWIDTH,A,L=parseFloat(y.attrs["FRAME-RATE"]);isNaN(L)||(A=L),T?o("renditionchange",{video_source_fps:A,video_source_bitrate:T,video_source_width:y.width,video_source_height:y.height,video_source_rendition_name:y.name,video_source_codec:y?.videoCodec}):r.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};t.on(s.Events.LEVEL_SWITCHED,g),t._stopMuxMonitor=function(){t.off(s.Events.MANIFEST_LOADED,l),t.off(s.Events.LEVEL_LOADED,d),t.off(s.Events.AUDIO_TRACK_LOADED,u),t.off(s.Events.FRAG_LOADED,c),t.off(s.Events.FRAG_CHANGED,h),t.off(s.Events.ERROR,f),t.off(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,m),t.off(s.Events.LEVEL_SWITCHED,g),t.off(s.Events.DESTROYING,t._stopMuxMonitor),delete t._stopMuxMonitor},t.on(s.Events.DESTROYING,t._stopMuxMonitor)},JT=function(i){i&&typeof i._stopMuxMonitor=="function"&&i._stopMuxMonitor()},$m=function(i,e){if(!i||!i.requestEndDate)return{};var t=fi(i.url),s=i.url,r=i.bytesLoaded,n=new Date(i.requestStartDate).getTime(),a=new Date(i.firstByteDate).getTime(),o=new Date(i.requestEndDate).getTime(),l=isNaN(i.duration)?0:i.duration,d=typeof e.getMetricsFor=="function"?e.getMetricsFor(i.mediaType).HttpList:e.getDashMetrics().getHttpRequests(i.mediaType),u;d.length>0&&(u=Yh(d[d.length-1]._responseHeaders||""));var c=u?ld(u):void 0;return{requestStart:n,requestResponseStart:a,requestResponseEnd:o,requestBytesLoaded:r,requestResponseHeaders:u,requestMediaDuration:l,requestHostname:t,requestUrl:s,requestId:c}},e_=function(i,e){var t=e.getQualityFor(i),s=e.getCurrentTrackFor(i).bitrateList;return s?{currentLevel:t,renditionWidth:s[t].width||null,renditionHeight:s[t].height||null,renditionBitrate:s[t].bandwidth}:{}},t_=function(i){var e;return(e=i.match(/.*codecs\*?="(.*)"/))===null||e===void 0?void 0:e[1]},i_=function(i){try{var e,t,s=(t=i.getVersion)===null||t===void 0||(e=t.call(i))===null||e===void 0?void 0:e.split(".").map(function(r){return parseInt(r)})[0];return s}catch{return!1}},s_=function(i,e,t){var s=i.log;if(!t||!t.on){s.warn("Invalid dash.js player reference. Monitoring blocked.");return}var r=i_(t),n=function(b,y){return i.emit(e,b,y)},a=function(b){var y=b.type,T=b.data,A=(T||{}).url;n("requestcompleted",{request_event_type:y,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:fi(A),request_url:A})};t.on("manifestLoaded",a);var o={},l=function(b){if(typeof b.getRequests!="function")return null;var y=b.getRequests({state:"executed"});return y.length===0?null:y[y.length-1]},d=function(b){var y=b.type,T=b.fragmentModel,A=b.chunk,L=l(T);u({type:y,request:L,chunk:A})},u=function(b){var y=b.type,T=b.chunk,A=b.request,L=(T||{}).mediaInfo,S=L||{},R=S.type,x=S.bitrateList;x=x||[];var I={};x.forEach(function(J,U){I[U]={},I[U].width=J.width,I[U].height=J.height,I[U].bitrate=J.bandwidth,I[U].attrs={}}),R==="video"?o.video=I:R==="audio"?o.audio=I:o.media=I;var M=$m(A,t),$=M.requestStart,V=M.requestResponseStart,Y=M.requestResponseEnd,H=M.requestResponseHeaders,N=M.requestMediaDuration,W=M.requestHostname,B=M.requestUrl,q=M.requestId;n("requestcompleted",{request_event_type:y,request_start:$,request_response_start:V,request_response_end:Y,request_bytes_loaded:-1,request_type:R+"_init",request_response_headers:H,request_hostname:W,request_id:q,request_url:B,request_media_duration:N,request_rendition_lists:o})};r>=4?t.on("initFragmentLoaded",u):t.on("initFragmentLoaded",d);var c=function(b){var y=b.type,T=b.fragmentModel,A=b.chunk,L=l(T);h({type:y,request:L,chunk:A})},h=function(b){var y=b.type,T=b.chunk,A=b.request,L=T||{},S=L.mediaInfo,R=L.start,x=S||{},I=x.type,M=$m(A,t),$=M.requestStart,V=M.requestResponseStart,Y=M.requestResponseEnd,H=M.requestBytesLoaded,N=M.requestResponseHeaders,W=M.requestMediaDuration,B=M.requestHostname,q=M.requestUrl,J=M.requestId,U=e_(I,t),F=U.currentLevel,re=U.renditionWidth,me=U.renditionHeight,le=U.renditionBitrate;n("requestcompleted",{request_event_type:y,request_start:$,request_response_start:V,request_response_end:Y,request_bytes_loaded:H,request_type:I,request_response_headers:N,request_hostname:B,request_id:J,request_url:q,request_media_start_time:R,request_media_duration:W,request_current_level:F,request_labeled_bitrate:le,request_video_width:re,request_video_height:me})};r>=4?t.on("mediaFragmentLoaded",h):t.on("mediaFragmentLoaded",c);var f={video:void 0,audio:void 0,totalBitrate:void 0},m=function(){if(f.video&&typeof f.video.bitrate=="number"){if(!(f.video.width&&f.video.height)){s.warn("have bitrate info for video but missing width/height");return}var b=f.video.bitrate;if(f.audio&&typeof f.audio.bitrate=="number"&&(b+=f.audio.bitrate),b!==f.totalBitrate)return f.totalBitrate=b,{video_source_bitrate:b,video_source_height:f.video.height,video_source_width:f.video.width,video_source_codec:t_(f.video.codec)}}},g=function(b,y,T){if(typeof b.newQuality!="number"){s.warn("missing evt.newQuality in qualityChangeRendered event",b);return}var A=b.mediaType;if(A==="audio"||A==="video"){var L=t.getBitrateInfoListFor(A).find(function(R){var x=R.qualityIndex;return x===b.newQuality});if(!(L&&typeof L.bitrate=="number")){s.warn("missing bitrate info for ".concat(A));return}f[A]=Wh(od({},L),{codec:t.getCurrentTrackFor(A).codec});var S=m();S&&n("renditionchange",S)}};t.on("qualityChangeRendered",g);var p=function(b){var y=b.request,T=b.mediaType;y=y||{},n("requestcanceled",{request_event_type:y.type+"_"+y.action,request_url:y.url,request_type:T,request_hostname:fi(y.url)})};t.on("fragmentLoadingAbandoned",p);var E=function(b){var y=b.error,T,A,L=(y==null||(T=y.data)===null||T===void 0?void 0:T.request)||{},S=(y==null||(A=y.data)===null||A===void 0?void 0:A.response)||{};y?.code===27&&n("requestfailed",{request_error:L.type+"_"+L.action,request_url:L.url,request_hostname:fi(L.url),request_type:L.mediaType,request_error_code:S.status,request_error_text:S.statusText});var R="".concat(L!=null&&L.url?"url: ".concat(L.url,` 13`):"")+"".concat(S!=null&&S.status||S!=null&&S.statusText?"response: ".concat(S?.status,", ").concat(S?.statusText,` 14`):"");n("error",{player_error_code:y?.code,player_error_message:y?.message,player_error_context:R})};t.on("error",E),t._stopMuxMonitor=function(){t.off("manifestLoaded",a),t.off("initFragmentLoaded",u),t.off("mediaFragmentLoaded",h),t.off("qualityChangeRendered",g),t.off("error",E),t.off("fragmentLoadingAbandoned",p),delete t._stopMuxMonitor}},r_=function(i){i&&typeof i._stopMuxMonitor=="function"&&i._stopMuxMonitor()},Fm=0,n_=(function(){function i(){lt(this,i),K(this,"_listeners",void 0)}return zi(i,[{key:"on",value:function(e,t,s){return t._eventEmitterGuid=t._eventEmitterGuid||++Fm,this._listeners=this._listeners||{},this._listeners[e]=this._listeners[e]||[],s&&(t=t.bind(s)),this._listeners[e].push(t),t}},{key:"off",value:function(e,t){var s=this._listeners&&this._listeners[e];s&&s.forEach(function(r,n){r._eventEmitterGuid===t._eventEmitterGuid&&s.splice(n,1)})}},{key:"one",value:function(e,t,s){var r=this;t._eventEmitterGuid=t._eventEmitterGuid||++Fm;var n=function(){r.off(e,n),t.apply(s||this,arguments)};n._eventEmitterGuid=t._eventEmitterGuid,this.on(e,n)}},{key:"emit",value:function(e,t){var s=this;if(this._listeners){t=t||{};var r=this._listeners["before"+e]||[],n=this._listeners["before*"]||[],a=this._listeners[e]||[],o=this._listeners["after"+e]||[],l=function(d,u){d=d.slice(),d.forEach(function(c){c.call(s,{type:e},u)})};l(r,t),l(n,t),l(a,t),l(o,t)}}}]),i})(),a_=n_,yu=ei(ji()),o_=(function(){function i(e){var t=this;lt(this,i),K(this,"_playbackHeartbeatInterval",void 0),K(this,"_playheadShouldBeProgressing",void 0),K(this,"pm",void 0),this.pm=e,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,e.on("playing",function(){t._playheadShouldBeProgressing=!0}),e.on("play",this._startPlaybackHeartbeatInterval.bind(this)),e.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),e.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),e.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("seeked",function(){e.data.player_is_paused?t._stopPlaybackHeartbeatInterval():t._startPlaybackHeartbeatInterval()}),e.on("timeupdate",function(){t._playbackHeartbeatInterval!==null&&e.emit("playbackheartbeat")}),e.on("devicesleep",function(s,r){t._playbackHeartbeatInterval!==null&&(yu.default.clearInterval(t._playbackHeartbeatInterval),e.emit("playbackheartbeatend",{viewer_time:r.viewer_time}),t._playbackHeartbeatInterval=null)})}return zi(i,[{key:"_startPlaybackHeartbeatInterval",value:function(){var e=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=yu.default.setInterval(function(){e.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(yu.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),i})(),l_=o_,d_=function i(e){var t=this;lt(this,i),K(this,"viewErrored",void 0),e.on("viewinit",function(){t.viewErrored=!1}),e.on("error",function(s,r){try{var n=e.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});n&&(e.data.player_error_code=n.player_error_code||r.player_error_code,e.data.player_error_message=n.player_error_message||r.player_error_message,e.data.player_error_context=n.player_error_context||r.player_error_context,e.data.player_error_severity=n.player_error_severity||r.player_error_severity,e.data.player_error_business_exception=n.player_error_business_exception||r.player_error_business_exception,t.viewErrored=!0)}catch(a){e.mux.log.warn("Exception in error translator callback.",a),t.viewErrored=!0}}),e.on("aftererror",function(){var s,r,n,a,o;(s=e.data)===null||s===void 0||delete s.player_error_code,(r=e.data)===null||r===void 0||delete r.player_error_message,(n=e.data)===null||n===void 0||delete n.player_error_context,(a=e.data)===null||a===void 0||delete a.player_error_severity,(o=e.data)===null||o===void 0||delete o.player_error_business_exception})},u_=d_,c_=(function(){function i(e){lt(this,i),K(this,"_watchTimeTrackerLastCheckedTime",void 0),K(this,"pm",void 0),this.pm=e,this._watchTimeTrackerLastCheckedTime=null,e.on("playbackheartbeat",this._updateWatchTime.bind(this)),e.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}return zi(i,[{key:"_updateWatchTime",value:function(e,t){var s=t.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=s),at(this.pm.data,"view_watch_time",s-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=s}},{key:"_clearWatchTimeState",value:function(e,t){this._updateWatchTime(e,t),this._watchTimeTrackerLastCheckedTime=null}}]),i})(),h_=c_,f_=(function(){function i(e){var t=this;lt(this,i),K(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),K(this,"_lastTime",void 0),K(this,"_isAdPlaying",void 0),K(this,"_callbackUpdatePlaybackTime",void 0),K(this,"pm",void 0),this.pm=e,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=ht.now(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null,e.on("viewinit",function(){t.pm.data.view_playing_time_ms_cumulative=0});var s=this._startPlaybackTimeTracking.bind(this);e.on("playing",s),e.on("adplaying",s),e.on("seeked",s),e.on("rebufferend",s);var r=this._stopPlaybackTimeTracking.bind(this);e.on("playbackheartbeatend",r),e.on("seeking",r),e.on("rebufferstart",r),e.on("adplaying",function(){t._isAdPlaying=!0}),e.on("adended",function(){t._isAdPlaying=!1}),e.on("adpause",function(){t._isAdPlaying=!1}),e.on("adbreakstart",function(){t._isAdPlaying=!1}),e.on("adbreakend",function(){t._isAdPlaying=!1}),e.on("adplay",function(){t._isAdPlaying=!1}),e.on("viewinit",function(){t._playbackTimeTrackerLastPlayheadPosition=-1,t._lastTime=ht.now(),t._isAdPlaying=!1,t._callbackUpdatePlaybackTime=null})}return zi(i,[{key:"_startPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime===null&&(this._callbackUpdatePlaybackTime=this._updatePlaybackTime.bind(this),this._playbackTimeTrackerLastPlayheadPosition=this.pm.data.player_playhead_time,this._lastTime=ht.now(),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||0,t=ht.now(),s=t-this._lastTime,r=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&e>
vendor: 10,949 bytes, line 14
14this._playbackTimeTrackerLastPlayheadPosition?r=e-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(r=s),r>0&&r<=1e3&&at(this.pm.data,"view_content_playback_time",r),this._callbackUpdatePlaybackTime!==null&&s>0&&s<=1e3&&(this._isAdPlaying&&at(this.pm.data,"ad_playing_time_ms_cumulative",s),at(this.pm.data,"view_playing_time_ms_cumulative",s)),this._playbackTimeTrackerLastPlayheadPosition=e,this._lastTime=t}}]),i})(),m_=f_,p_=(function(){function i(e){lt(this,i),K(this,"pm",void 0),this.pm=e;var t=this._updatePlayheadTime.bind(this);e.on("playbackheartbeat",t),e.on("playbackheartbeatend",t),e.on("timeupdate",t),e.on("destroy",function(){e.off("timeupdate",t)})}return zi(i,[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=typeof this.pm.data.view_max_playhead_position>"u"?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 s=this,r=function(){s.pm.currentFragmentPDT&&s.pm.currentFragmentStart&&(s.pm.data.player_program_time=s.pm.currentFragmentPDT+s.pm.data.player_playhead_time-s.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 n=this.pm.getPlayheadTime();typeof n<"u"&&(this.pm.data.player_playhead_time=n,r(),this._updateMaxPlayheadPosition())}}}]),i})(),g_=p_,Bm=300*1e3,v_=function i(e){if(lt(this,i),!e.disableRebufferTracking){var t,s=function(n,a){r(a),t=void 0},r=function(n){if(t){var a=n.viewer_time-t;at(e.data,"view_rebuffer_duration",a),t=n.viewer_time,e.data.view_rebuffer_duration>Bm&&(e.emit("viewend"),e.send("viewend"),e.mux.log.warn("Ending view after rebuffering for longer than ".concat(Bm,"ms, future events will be ignored unless a programchange or videochange occurs.")))}e.data.view_watch_time>=0&&e.data.view_rebuffer_count>0&&(e.data.view_rebuffer_frequency=e.data.view_rebuffer_count/e.data.view_watch_time,e.data.view_rebuffer_percentage=e.data.view_rebuffer_duration/e.data.view_watch_time)};e.on("playbackheartbeat",function(n,a){return r(a)}),e.on("rebufferstart",function(n,a){t||(at(e.data,"view_rebuffer_count",1),t=a.viewer_time,e.one("rebufferend",s))}),e.on("viewinit",function(){t=void 0,e.off("rebufferend",s)})}},E_=v_,y_=(function(){function i(e){var t=this;lt(this,i),K(this,"_lastCheckedTime",void 0),K(this,"_lastPlayheadTime",void 0),K(this,"_lastPlayheadTimeUpdatedTime",void 0),K(this,"_rebuffering",void 0),K(this,"pm",void 0),this.pm=e,!(e.disableRebufferTracking||e.disablePlayheadRebufferTracking)&&(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,e.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),e.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),e.on("seeking",function(){t._cleanupRebufferTracker(null,{viewer_time:ht.now()})}))}return zi(i,[{key:"_checkIfRebuffering",value:function(e,t){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing){this._cleanupRebufferTracker(e,t);return}if(this._lastCheckedTime===null){this._prepareRebufferTrackerState(t.viewer_time);return}if(this._lastPlayheadTime!==this.pm.data.player_playhead_time){this._cleanupRebufferTracker(e,t,!0);return}var s=t.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&s>=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 s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:t.viewer_time});else{if(this._lastCheckedTime===null)return;var r=this.pm.data.player_playhead_time-this._lastPlayheadTime,n=t.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&r>0&&n-r>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+n-r}))}s?this._prepareRebufferTrackerState(t.viewer_time):this._clearRebufferTrackerState()}}]),i})(),b_=y_,T_=(function(){function i(e){var t=this;lt(this,i),K(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){var s=e.data,r=s.view_id;if(!s.view_program_changed){var n=function(a,o){var l=o.viewer_time;(a.type==="playing"&&typeof e.data.view_time_to_first_frame>"u"||a.type==="adplaying"&&(typeof e.data.view_time_to_first_frame>"u"||t._inPrerollPosition()))&&t.calculateTimeToFirstFrame(l||ht.now(),r)};e.one("playing",n),e.one("adplaying",n),e.one("viewend",function(){e.off("playing",n),e.off("adplaying",n)})}})}return zi(i,[{key:"_inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time>"u"||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.pm.pageLoadInitTime&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.pm.pageLoadInitTime))}}]),i})(),__=T_,A_=function i(e){var t=this;lt(this,i),K(this,"_lastPlayerHeight",void 0),K(this,"_lastPlayerWidth",void 0),K(this,"_lastPlayheadPosition",void 0),K(this,"_lastSourceHeight",void 0),K(this,"_lastSourceWidth",void 0),e.on("viewinit",function(){t._lastPlayheadPosition=-1});var s=["pause","rebufferstart","seeking","error","adbreakstart","hb","renditionchange","orientationchange","viewend","playbackmodechange"],r=["playing","hb","renditionchange","orientationchange","playbackmodechange"];s.forEach(function(n){e.on(n,function(){if(t._lastPlayheadPosition>=0&&e.data.player_playhead_time>=0&&t._lastPlayerWidth>=0&&t._lastSourceWidth>0&&t._lastPlayerHeight>=0&&t._lastSourceHeight>0){var a=e.data.player_playhead_time-t._lastPlayheadPosition;if(a<0){t._lastPlayheadPosition=-1;return}var o=Math.min(t._lastPlayerWidth/t._lastSourceWidth,t._lastPlayerHeight/t._lastSourceHeight),l=Math.max(0,o-1),d=Math.max(0,1-o);e.data.view_max_upscale_percentage=Math.max(e.data.view_max_upscale_percentage||0,l),e.data.view_max_downscale_percentage=Math.max(e.data.view_max_downscale_percentage||0,d),at(e.data,"view_total_content_playback_time",a),at(e.data,"view_total_upscaling",l*a),at(e.data,"view_total_downscaling",d*a)}t._lastPlayheadPosition=-1})}),r.forEach(function(n){e.on(n,function(){t._lastPlayheadPosition=e.data.player_playhead_time,t._lastPlayerWidth=e.data.player_width,t._lastPlayerHeight=e.data.player_height,t._lastSourceWidth=e.data.video_source_width,t._lastSourceHeight=e.data.video_source_height})})},S_=A_,I_=2e3,L_=function i(e){var t=this;lt(this,i),K(this,"isSeeking",void 0),this.isSeeking=!1;var s=-1,r=function(){var n=ht.now(),a=(e.data.viewer_time||n)-(s||n);at(e.data,"view_seek_duration",a),e.data.view_max_seek_time=Math.max(e.data.view_max_seek_time||0,a),t.isSeeking=!1,s=-1};e.on("seeking",function(n,a){if(Object.assign(e.data,a),t.isSeeking&&a.viewer_time-s<=I_){s=a.viewer_time;return}t.isSeeking&&r(),t.isSeeking=!0,s=a.viewer_time,at(e.data,"view_seek_count",1),e.send("seeking")}),e.on("seeked",function(){r()}),e.on("viewend",function(){t.isSeeking&&(r(),e.send("seeked")),t.isSeeking=!1,s=-1})},R_=L_,Hm=function(i,e){i.push(e),i.sort(function(t,s){return t.viewer_time-s.viewer_time})},x_=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],k_=(function(){function i(e){var t=this;lt(this,i),K(this,"_adHasPlayed",void 0),K(this,"_adRequests",void 0),K(this,"_adResponses",void 0),K(this,"_currentAdRequestNumber",void 0),K(this,"_currentAdResponseNumber",void 0),K(this,"_prerollPlayTime",void 0),K(this,"_wouldBeNewAdPlay",void 0),K(this,"isAdBreak",void 0),K(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){t.isAdBreak=!1,t._currentAdRequestNumber=0,t._currentAdResponseNumber=0,t._adRequests=[],t._adResponses=[],t._adHasPlayed=!1,t._wouldBeNewAdPlay=!0,t._prerollPlayTime=void 0}),x_.forEach(function(r){return e.on(r,t._updateAdData.bind(t))});var s=function(){t.isAdBreak=!1};e.on("adbreakstart",function(){t.isAdBreak=!0}),e.on("play",s),e.on("playing",s),e.on("viewend",s),e.on("adrequest",function(r,n){n=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdRequestNumber++},n),Hm(t._adRequests,n),at(e.data,"view_ad_request_count"),t.inPrerollPosition()&&(e.data.view_preroll_requested=!0,t._adHasPlayed||at(e.data,"view_preroll_request_count"))}),e.on("adresponse",function(r,n){n=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdResponseNumber++},n),Hm(t._adResponses,n);var a=t.findAdRequest(n.ad_request_id);a&&at(e.data,"view_ad_request_time",Math.max(0,n.viewer_time-a.viewer_time))}),e.on("adplay",function(r,n){t._adHasPlayed=!0,t._wouldBeNewAdPlay&&(t._wouldBeNewAdPlay=!1,at(e.data,"view_ad_played_count")),t.inPrerollPosition()&&!e.data.view_preroll_played&&(e.data.view_preroll_played=!0,t._adRequests.length>0&&(e.data.view_preroll_request_time=Math.max(0,n.viewer_time-t._adRequests[0].viewer_time)),e.data.view_start&&(e.data.view_startup_preroll_request_time=Math.max(0,n.viewer_time-e.data.view_start)),t._prerollPlayTime=n.viewer_time)}),e.on("adplaying",function(r,n){t.inPrerollPosition()&&typeof e.data.view_preroll_load_time>"u"&&typeof t._prerollPlayTime<"u"&&(e.data.view_preroll_load_time=n.viewer_time-t._prerollPlayTime,e.data.view_startup_preroll_load_time=n.viewer_time-t._prerollPlayTime)}),e.on("adclicked",function(r,n){t._wouldBeNewAdPlay||at(e.data,"view_ad_clicked_count")}),e.on("adskipped",function(r,n){t._wouldBeNewAdPlay||at(e.data,"view_ad_skipped_count")}),e.on("adended",function(){t._wouldBeNewAdPlay=!0}),e.on("aderror",function(){t._wouldBeNewAdPlay=!0})}return zi(i,[{key:"inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time>"u"||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
14(!this.pm.data.view_preroll_ad_tag_hostname&&t.ad_tag_url){var s=us(Pa(t.ad_tag_url),2),r=s[0],n=s[1];this.pm.data.view_preroll_ad_tag_domain=n,this.pm.data.view_preroll_ad_tag_hostname=r}if(!this.pm.data.view_preroll_ad_asset_hostname&&t.ad_asset_url){var a=us(Pa(t.ad_asset_url),2),o=a[0],l=a[1];this.pm.data.view_preroll_ad_asset_domain=l,this.pm.data.view_preroll_ad_asset_hostname=o}this.pm.data.ad_type="preroll"}this.pm.data.ad_asset_url=t?.ad_asset_url,this.pm.data.ad_tag_url=t?.ad_tag_url,this.pm.data.ad_creative_id=t?.ad_creative_id,this.pm.data.ad_id=t?.ad_id,this.pm.data.ad_universal_id=t?.ad_universal_id,t!=null&&t.ad_type&&(this.pm.data.ad_type=t?.ad_type)}}]),i})(),D_=k_,C_=function i(e){var t=this;lt(this,i),K(this,"lastWallClockTime",void 0);var s=function(){t.lastWallClockTime=ht.now(),e.on("before*",r)},r=function(n){var a=ht.now(),o=t.lastWallClockTime;t.lastWallClockTime=a,a-o>3e4&&(e.emit("devicesleep",{viewer_time:o}),Object.assign(e.data,{viewer_time:o}),e.send("devicesleep"),e.emit("devicewake",{viewer_time:a}),Object.assign(e.data,{viewer_time:a}),e.send("devicewake"))};e.one("playbackheartbeat",s),e.on("playbackheartbeatend",function(){e.off("before*",r),e.one("playbackheartbeat",s)})},w_=C_,bu=ei(ji()),j0=(function(i){return i()})(function(){var i=function(){for(var t=0,s={};t<arguments.length;t++){var r=arguments[t];for(var n in r)s[n]=r[n]}return s};function e(t){function s(r,n,a){var o;if(typeof document<"u"){if(arguments.length>1){if(a=i({path:"/"},s.defaults,a),typeof a.expires=="number"){var l=new Date;l.setMilliseconds(l.getMilliseconds()+a.expires*864e5),a.expires=l}try{o=JSON.stringify(n),/^[\{\[]/.test(o)&&(n=o)}catch{}return t.write?n=t.write(n,r):n=encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),r=encodeURIComponent(String(r)),r=r.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),r=r.replace(/[\(\)]/g,escape),document.cookie=[r,"=",n,a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}r||(o={});for(var d=document.cookie?document.cookie.split("; "):[],u=/(%[0-9A-Z]{2})+/g,c=0;c<d.length;c++){var h=d[c].split("="),f=h.slice(1).join("=");f.charAt(0)==='"'&&(f=f.slice(1,-1));try{var m=h[0].replace(u,decodeURIComponent);if(f=t.read?t.read(f,m):t(f,m)||f.replace(u,decodeURIComponent),this.json)try{f=JSON.parse(f)}catch{}if(r===m){o=f;break}r||(o[m]=f)}catch{}}return o}}return s.set=s,s.get=function(r){return s.call(s,r)},s.getJSON=function(){return s.apply({json:!0},[].slice.call(arguments))},s.defaults={}
vendor: 18,850 bytes, line 14
14,s.remove=function(r,n){s(r,"",i(n,{expires:-1}))},s.withConverter=e,s}return e(function(){})}),z0="muxData",M_=function(i){return Object.entries(i).map(function(e){var t=us(e,2),s=t[0],r=t[1];return"".concat(s,"=").concat(r)}).join("&")},P_=function(i){return i.split("&").reduce(function(e,t){var s=us(t.split("="),2),r=s[0],n=s[1],a=+n,o=n&&a==n?a:n;return e[r]=o,e},{})},Q0=function(){var i;try{i=P_(j0.get(z0)||"")}catch{i={}}return i},X0=function(i){try{j0.set(z0,M_(i),{expires:365})}catch{}},O_=function(){var i=Q0();return i.mux_viewer_id=i.mux_viewer_id||Ma(),i.msn=i.msn||Math.random(),X0(i),{mux_viewer_id:i.mux_viewer_id,mux_sample_number:i.msn}},N_=function(){var i=Q0(),e=ht.now();return i.session_start&&(i.sst=i.session_start,delete i.session_start),i.session_id&&(i.sid=i.session_id,delete i.session_id),i.session_expires&&(i.sex=i.session_expires,delete i.session_expires),(!i.sex||i.sex<e)&&(i.sid=Ma(),i.sst=e),i.sex=e+1500*1e3,X0(i),{session_id:i.sid,session_start:i.sst,session_expires:i.sex}};function U_(i,e){var t=e.beaconCollectionDomain,s=e.beaconDomain;if(t)return"https://"+t;i=i||"inferred";var r=s||"litix.io";return i.match(/^[a-z0-9]+$/)?"https://"+i+"."+r:"https://img.litix.io/a.gif"}var $_=ei(ji()),Z0=function(){var i;switch(J0()){case"cellular":i="cellular";break;case"ethernet":i="wired";break;case"wifi":i="wifi";break;case void 0:break;default:i="other"}return i},J0=function(){var i=$_.default.navigator,e=i&&(i.connection||i.mozConnection||i.webkitConnection);return e&&e.type};Z0.getConnectionFromAPI=J0;var F_=Z0,B_={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"},H_=ev(B_),G_={ad:"ad",af:"affiliate",ag:"aggregate",ap:"api",al:"application",ao:"audio",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",bn:"brand",br:"break",bw:"browser",by:"bytes",bz:"business",ca:"cached",cb:"cancel",cc:"codec",cd:"code",cg:"category",ch:"changed",ci:"client",ck:"clicked",cl:"canceled",cm:"cmcd",cn:"config",co:"count",ce:"counter",cp:"complete",cq:"creator",cr:"creative",cs:"captions",ct:"content",cu:"current",cv:"cumulative",cx:"connection",cz:"context",da:"data",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",dr:"drm",dp:"dropped",du:"duration",dv:"device",dy:"dynamic",eb:"enabled",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",mp:"mode",ms:"ms",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",or:"origin",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pp:"pip",pr:"preload",ps:"position",pt:"part",pv:"previous",py:"property",px:"pop",pz:"plan",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rg:"range",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",sd:"skipped",se:"session",sh:"shift",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",ss:"status",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"},Gm=ev(G_);function ev(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function mc(i){var e={},t={};return Object.keys(i).forEach(function(s){var r=!1;if(i.hasOwnProperty(s)&&i[s]!==void 0){var n=s.split("_"),a=n[0],o=H_[a];o||(De.info("Data key word `"+n[0]+"` not expected in "+s),o=a+"_"),n.splice(1).forEach(function(l){l==="url"&&(r=!0),Gm[l]?o+=Gm[l]:Number.isInteger(Number(l))?o+=l:(De.info("Data key word `"+l+"` not expected in "+s),o+="_"+l+"_")}),r?t[o]=i[s]:e[o]=i[s]}}),Object.assign(e,t)}var or=ei(ji()),K_=ei(K0()),V_={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},W_=56*1024,Y_=["hb","requestcompleted","requestfailed","requestcanceled"],q_="https://img.litix.io",hs=function(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=i||q_,this._eventQueue=[],this._postInFlight=!1,this._resendAfterPost=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},V_,e)};hs.prototype.queueEvent=function(i,e){var t=Object.assign({},e);return this._eventQueue.length<=this._options.maxQueueLength||i==="eventrateexceeded"?(this._eventQueue.push(t),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength):!1};hs.prototype.flushEvents=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(i&&this._eventQueue.length===1){this._eventQueue.pop();return}this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending()};hs.prototype.destroy=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.destroyed=!0,i?this._clearBeaconQueue():this.flushEvents(),or.default.clearTimeout(this._sendTimeout)};hs.prototype._clearBeaconQueue=function(){var i=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,e=this._eventQueue.slice(i);i>0&&Object.assign(e[e.length-1],mc({mux_view_message:"event queue truncated"}));var t=this._createPayload(e);tv(this._beaconUrl,t,!0,function(){})};hs.prototype._sendBeaconQueue=function(){var i=this;if(this._postInFlight){this._resendAfterPost=!0;return}var e=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var t=this._createPayload(e),s=ht.now();tv(this._beaconUrl,t,!1,function(r,n){n?(i._eventQueue=e.concat(i._eventQueue),i._failureCount+=1,De.info("Error sending beacon: "+n)):i._failureCount=0,i._roundTripTime=ht.now()-s,i._postInFlight=!1,i._resendAfterPost&&(i._resendAfterPost=!1,i._eventQueue.length>0&&i._sendBeaconQueue())})};hs.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var i=Math.pow(2,this._failureCount-1);return i=i*Math.random(),(1+i)*this._options.baseTimeBetweenBeacons};hs.prototype._startBeaconSending=function(){var i=this;or.default.clearTimeout(this._sendTimeout),!this.destroyed&&(this._sendTimeout=or.default.setTimeout(function(){i._eventQueue.length&&i._sendBeaconQueue(),i._startBeaconSending()},this._getNextBeaconTime()))};hs.prototype._createPayload=function(i){var e=this,t={transmission_timestamp:Math.round(ht.now())};this._roundTripTime&&(t.rtt_ms=Math.round(this._roundTripTime));var s,r,n,a=function(){s=JSON.stringify({metadata:t,events:r||i}),n=s.length/1024},o=function(){return n<=e._options.maxPayloadKBSize};return a(),o()||(De.info("Payload size is too big ("+n+" kb). Removing unnecessary events."),r=i.filter(function(l){return Y_.indexOf(l.e)===-1}),a()),o()||(De.info("Payload size still too big ("+n+" kb). Cropping fields.."),r.forEach(function(l){for(var d in l){var u=l[d],c=50*1024;typeof u=="string"&&u.length>c&&(l[d]=u.substring(0,c))}}),a()),s};var j_=typeof K_.default.exitPictureInPicture=="function"?function(i){return i.length<=W_}:function(i){return!1},tv=function(i,e,t,s){if(t&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(i,e)){s();return}if(or.default.fetch){or.default.fetch(i,{method:"POST",body:e,headers:{"Content-Type":"text/plain"},keepalive:j_(e)}).then(function(n){return s(null,n.ok?null:"Error")}).catch(function(n){return s(null,n)});return}if(or.default.XMLHttpRequest){var r=new or.default.XMLHttpRequest;r.onreadystatechange=function(){if(r.readyState===4)return s(null,r.status!==200?"error":void 0)},r.open("POST",i),r.setRequestHeader("Content-Type","text/plain"),r.send(e);return}s()},z_=hs,Q_=["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","view_playing_time_ms_cumulative","ad_playing_time_ms_cumulative"],X_=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],Z_=["ad_id","ad_creative_id","ad_universal_id"],J_=["viewstart","error","ended","viewend"],eA=600*1e3,tA=(function(){function i(e,t){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};lt(this,i);var r,n,a,o,l,d,u,c,h,f,m,g;K(this,"mux",void 0),K(this,"envKey",void 0),K(this,"options",void 0),K(this,"eventQueue",void 0),K(this,"sampleRate",void 0),K(this,"disableCookies",void 0),K(this,"respectDoNotTrack",void 0),K(this,"previousBeaconData",void 0),K(this,"lastEventTime",void 0),K(this,"rateLimited",void 0),K(this,"pageLevelData",void 0),K(this,"viewerData",void 0),this.mux=e,this.envKey=t,this.options=s,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.eventQueue=new z_(U_(this.envKey,this.options));var p;this.sampleRate=(p=this.options.sampleRate)!==null&&p!==void 0?p:1;var E;this.disableCookies=(E=this.options.disableCookies)!==null&&E!==void 0?E:!1;var b;this.respectDoNotTrack=(b=this.options.respectDoNotTrack)!==null&&b!==void 0?b:!1,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:(r=this.options.platform)===null||r===void 0?void 0:r.name,viewer_application_version:(n=this.options.platform)===null||n===void 0?void 0:n.version,viewer_application_engine:(a=this.options.platform)===null||a===void 0?void 0:a.layout,viewer_device_name:(o=this.options.platform)===null||o===void 0?void 0:o.product,viewer_device_category:"",viewer_device_manufacturer:(l=this.options.platform)===null||l===void 0?void 0:l.manufacturer,viewer_os_family:(u=this.options.platform)===null||u===void 0||(d=u.os)===null||d===void 0?void 0:d.family,viewer_os_architecture:(h=this.options.platform)===null||h===void 0||(c=h.os)===null||c===void 0?void 0:c.architecture,viewer_os_version:(m=this.options.platform)===null||m===void 0||(f=m.os)===null||f===void 0?void 0:f.version,viewer_connection_type:F_(),page_url:bu.default===null||bu.default===void 0||(g=bu.default.location)===null||g===void 0?void 0:g.href},this.viewerData=this.disableCookies?{}:O_()}return zi(i,[{key:"send",value:function(e,t){if(!(!e||!(t!=null&&t.view_id))){if(this.respectDoNotTrack&&hc())return De.info("Not sending `"+e+"` because Do Not Track is enabled");if(!t||typeof t!="object")return De.error("A data object was expected in send() but was not provided");var s=this.disableCookies?{}:N_(),r=Wh(od({},this.pageLevelData,t,s,this.viewerData),{event:e,env_key:this.envKey});r.user_id&&(r.viewer_user_id=r.user_id,delete r.user_id);var n,a=((n=r.mux_sample_number)!==null&&n!==void 0?n:0)>=this.sampleRate,o=this._deduplicateBeaconData(e,r),l=mc(o);if(this.lastEventTime=this.mux.utils.now(),a)return De.info("Not sending event due to sample rate restriction",e,r,l);if(this.envKey||De.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",e,r,l),!this.rateLimited)if(De.info("Sending event",e,r,l),this.rateLimited=!this.eventQueue.queueEvent(e,l),this.mux.WINDOW_UNLOADING&&e==="viewend")this.eventQueue.destroy(!0);else{if(this.mux.WINDOW_HIDDEN&&e==="hb")this.eventQueue.flushEvents(!0);else if(J_.indexOf(e)>=0){if(e==="error"&&t.player_error_severity==="warning")return;this.eventQueue.flushEvents()}if(this.rateLimited)return r.event="eventrateexceeded",l=mc(r),this.eventQueue.queueEvent(r.event,l),De.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(e,t){var s=this,r={},n=t.view_id;if(n==="-1"||e==="viewstart"||e==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=eA)r=od({},t),n&&(this.previousBeaconData=r),n&&e==="viewend"&&(this.previousBeaconData=null);else{var a=e.indexOf("request")===0;Object.entries(t).forEach(function(o){var l=us(o,2),d=l[0],u=l[1];s.previousBeaconData&&(u!==s.previousBeaconData[d]||Q_.indexOf(d)>-1||s.objectHasChanged(a,d,u,s.previousBeaconData[d])||s.eventRequiresKey(e,d))&&(r[d]=u,s.previousBeaconData[d]=u)})}return r}},{key:"objectHasChanged",value:function(e,t,s,r){return!e||t.indexOf("request_")!==0?!1:t==="request_response_headers"||typeof s!="object"||typeof r!="object"?!0:Object.keys(s||{}).length!==Object.keys(r||{}).length}},{key:"eventRequiresKey",value:function(e,t){return!!(e==="renditionchange"&&t.indexOf("video_source_")===0||Z_.includes(t)&&X_.includes(e))}}]),i})(),iA=function i(e){lt(this,i);var t=0,s=0,r=0,n=0,a=0,o=0,l=0,d=function(h,f){var m=f.request_start,g=f.request_response_start,p=f.request_response_end,E=f.request_bytes_loaded;n++;var b,y;if(g?(b=g-(m??0),y=(p??0)-g):y=(p??0)-(m??0),y>0&&E&&E>0){var T=E/y*8e3;a++,s+=E,r+=y,e.data.view_min_request_throughput=Math.min(e.data.view_min_request_throughput||1/0,T),e.data.view_average_request_throughput=s/r*8e3,e.data.view_request_count=n,b>0&&(t+=b,e.data.view_max_request_latency=Math.max(e.data.view_max_request_latency||0,b),e.data.view_average_request_latency=t/a)}},u=function(h,f){n++,o++,e.data.view_request_count=n,e.data.view_request_failed_count=o},c=function(h,f){n++,l++,e.data.view_request_count=n,e.data.view_request_canceled_count=l};e.on("requestcompleted",d),e.on("requestfailed",u),e.on("requestcanceled",c)},sA=iA,rA=3600*1e3,nA=function i(e){var t=this;lt(this,i),K(this,"_lastEventTime",void 0),e.on("before*",function(s,r){var n=r.viewer_time,a=ht.now(),o=t._lastEventTime;if(t._lastEventTime=a,o&&a-o>rA){var l=Object.keys(e.data).reduce(function(u,c){return c.indexOf("video_")===0?Object.assign(u,K({},c,e.data[c])):u},{});e.mux.log.info("Received event after at least an hour inactivity, creating a new view");var d=e.playbackHeartbeat._playheadShouldBeProgressing;e._resetView(Object.assign({viewer_time:n},l)),e.playbackHeartbeat._playheadShouldBeProgressing=d,e.playbackHeartbeat._playheadShouldBeProgressing&&s.type!=="play"&&s.type!=="adbreakstart"&&(e.emit("play",{viewer_time:n}),s.type!=="playing"&&e.emit("playing",{viewer_time:n}))}})},aA=nA,oA=function i(e){lt(this,i);var t=function(o){var l=lA(o),d=dA(o);if(l!=null&&!Km(l,n)&&a<=d){n=l,a=d;var u={video_cdn:l};e.emit("cdnchange",u)}},s=null,r=null,n=null,a=0;e.on("viewinit",function(){s=null,r=null,n=null,a=0}),e.on("beforecdnchange",function(o,l){var d=l?.video_cdn;d&&(typeof l.video_previous_cdn>"u"||l.video_previous_cdn===null)&&(Km(d,r)?l.video_previous_cdn=s??void 0:(l.video_previous_cdn=r??void 0,s=r,r=d))}),e.on("requestcompleted",function(o,l){t(l)})};function Km(i,e){return i?.toLowerCase()===e?.toLowerCase()}function lA(i){var e;return i!=null&&i.request_type&&(i.request_type==="media"||i.request_type==="video")&&!((e=i.request_response_headers)===null||e===void 0)&&e["x-cdn"]?i.request_response_headers["x-cdn"]:i!=null&&i.video_cdn?i.video_cdn:null}function dA(i){return i!=null&&i.request_start?i.request_start:i!=null&&i.viewer_time?i.viewer_time:Date.now()}var uA=oA,cA=function(i){try{return JSON.parse(i),!0}catch{return!1}},hA=function i(e){var t=this;lt(this,i),K(this,"_emittingAutomaticEvent",!1),K(this,"_hasInitialized",!1),e.on("viewstart",function(){t._hasInitialized||(t._hasInitialized=!0,t._emittingAutomaticEvent=!0,e.emit("playbackmodechange",{player_playback_mode:"standard",player_playback_mode_data:"{}"}),t._emittingAutomaticEvent=!1)}),e.on("viewend",function(){t._hasInitialized=!1}),e.on("playbackmodechange",function(s,r){t._emittingAutomaticEvent||(r.player_playback_mode_data?cA(r.player_playback_mode_data)||(e.mux.log.warn("Invalid JSON string for player_playback_mode_data"),r.player_playback_mode_data="{}"):r.player_playback_mode_data="{}",e.data.player_playback_mode_data=r.player_playback_mode_data,e.data.player_playback_mode=r.player_playback_mode)})},fA=hA,mA=["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","cdnchange","playbackmodechange"],pA=new Set(["requestcompleted","requestfailed","requestcanceled"]),gA=(function(i){HT(t,i);var e=YT(t);function t(s,r,n){lt(this,t);var a;a=e.call(this),K(ne(a),"pageLoadEndTime",void 0),K(ne(a),"pageLoadInitTime",void 0),K(ne(a),"_destroyed",void 0),K(ne(a),"_heartBeatTimeout",void 0),K(ne(a),"adTracker",void 0),K(ne(a),"dashjs",void 0),K(ne(a),"data",void 0),K(ne(a),"disablePlayheadRebufferTracking",void 0),K(ne(a),"disableRebufferTracking",void 0),K(ne(a),"errorTracker",void 0),K(ne(a),"errorTranslator",void 0),K(ne(a),"emitTranslator",void 0),K(ne(a),"getAdData",void 0),K(ne(a),"getPlayheadTime",void 0),K(ne(a),"getStateData",void 0),K(ne(a),"stateDataTranslator",void 0),K(ne(a),"hlsjs",void 0),K(ne(a),"id",void 0),K(ne(a),"longResumeTracker",void 0),K(ne(a),"minimumRebufferDuration",void 0),K(ne(a),"mux",void 0),K(ne(a),"playbackEventDispatcher",void 0),K(ne(a),"playbackHeartbeat",void 0),K(ne(a),"playbackHeartbeatTime",void 0),K(ne(a),"playheadTime",void 0),K(ne(a),"seekingTracker",void 0),K(ne(a),"sustainedRebufferThreshold",void 0),K(ne(a),"watchTimeTracker",void 0),K(ne(a),"currentFragmentPDT",void 0),K(ne(a),"currentFragmentStart",void 0),a.pageLoadInitTime=ad.navigationStart(),a.pageLoadEndTime=ad.domContentLoadedEventEnd();var o={debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(h){return h},emitTranslator:function(){for(var h=arguments.length,f=new Array(h),m=0;m<h;m++)f[m]=arguments[m];return f},stateDataTranslator:function(h){return h}};a.mux=s,a.id=r,n!=null&&n.beaconDomain&&a.mux.log.warn("The `beaconDomain` setting has been deprecated
14in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."),n=Object.assign(o,n),n.data=n.data||{},n.data.property_key&&(n.data.env_key=n.data.property_key,delete n.data.property_key),De.level=n.debug?nr.DEBUG:nr.WARN,a.getPlayheadTime=n.getPlayheadTime,a.getStateData=n.getStateData||function(){return{}},a.getAdData=n.getAdData||function(){},a.minimumRebufferDuration=n.minimumRebufferDuration,a.sustainedRebufferThreshold=n.sustainedRebufferThreshold,a.playbackHeartbeatTime=n.playbackHeartbeatTime,a.disableRebufferTracking=n.disableRebufferTracking,a.disableRebufferTracking&&a.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."),a.disablePlayheadRebufferTracking=n.disablePlayheadRebufferTracking,a.errorTranslator=n.errorTranslator,a.emitTranslator=n.emitTranslator,a.stateDataTranslator=n.stateDataTranslator,a.playbackEventDispatcher=new tA(s,n.data.env_key,n),a.data={player_instance_id:Ma(),mux_sample_rate:n.sampleRate,beacon_domain:n.beaconCollectionDomain||n.beaconDomain},a.data.view_sequence_number=1,a.data.player_sequence_number=1;var l=(function(){typeof this.data.view_start>"u"&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}).bind(ne(a));if(a.on("viewinit",function(h,f){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,f),this._initializeViewData(),this.one("play",l),this.one("adbreakstart",l)}),a.on("videochange",function(h,f){this._resetView(f)}),a.on("programchange",function(h,f){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."),this._resetView(Object.assign(f,{view_program_changed:!0})),l(),this.emit("play"),this.emit("playing")}),a.on("fragmentchange",function(h,f){this.currentFragmentPDT=f.currentFragmentPDT,this.currentFragmentStart=f.currentFragmentStart}),a.on("destroy",a.destroy),typeof window<"u"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var d=function(){var h=typeof a.data.view_start<"u";a.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",h&&a.mux.WINDOW_HIDDEN&&(a.data.player_is_paused||a.emit("hb"))};window.addEventListener("visibilitychange",d,!1);var u=function(h){h.persisted||a.destroy()};window.addEventListener("pagehide",u,!1),a.on("destroy",function(){window.removeEventListener("visibilitychange",d),window.removeEventListener("pagehide",u)})}a.on("playerready",function(h,f){Object.assign(this.data,f)}),mA.forEach(function(h){a.on(h,function(f,m){h.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,m),this._sanitizeData()}),a.on("after"+h,function(){(h!=="error"||this.errorTracker.viewErrored)&&this.send(h)})}),a.on("viewend",function(h,f){Object.assign(a.data,f)});var c=function(h){var f=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=f-this.data.player_init_time),this.pageLoadInitTime=this.data.page_load_init_time||this.pageLoadInitTime,this.pageLoadEndTime=this.data.page_load_end_time||this.pageLoadEndTime,!this.mux.PLAYER_TRACKED&&this.pageLoadInitTime&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.pageLoadEndTime)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.pageLoadEndTime||1/0)-this.pageLoadInitTime)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time};return a.one("playerready",c),a.longResumeTracker=new aA(ne(a)),a.errorTracker=new u_(ne(a)),new w_(ne(a)),a.seekingTracker=new R_(ne(a)),a.playheadTime=new g_(ne(a)),a.playbackHeartbeat=new l_(ne(a)),new S_(ne(a)),a.watchTimeTracker=new h_(ne(a)),new m_(ne(a)),a.adTracker=new D_(ne(a)),new b_(ne(a)),new E_(ne(a)),new __(ne(a)),new sA(ne(a)),new uA(ne(a)),new fA(ne(a)),n.hlsjs&&a.addHLSJS(n),n.dashjs&&a.addD
vendor: 13,802 bytes, lines 14-16
14ashJS(n),a.emit("viewinit",n.data),a}return zi(t,[{key:"emit",value:function(s,r){var n,a=Object.assign({viewer_time:this.mux.utils.now()},r),o=[s,a];if(this.emitTranslator)try{o=this.emitTranslator(s,a)}catch(l){this.mux.log.warn("Exception in emit translator callback.",l)}o!=null&&o.length&&(n=Ko(_n(t.prototype),"emit",this)).call.apply(n,[this].concat(oi(o)))}},{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,typeof this.data.view_start<"u"&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(s){if(this.data.view_id){var r=Object.assign({},this.data),n=["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"];if(r.video_source_is_live===void 0&&(r.player_source_duration===1/0||r.video_source_duration===1/0?r.video_source_is_live=!0:(r.player_source_duration>0||r.video_source_duration>0)&&(r.video_source_is_live=!1)),r.video_source_is_live||n.forEach(function(d){r[d]=void 0}),r.video_source_url=r.video_source_url||r.player_source_url,r.video_source_url){var a=us(Pa(r.video_source_url),2),o=a[0],l=a[1];r.video_source_domain=l,r.video_source_hostname=o}delete r.ad_request_id,this.playbackEventDispatcher.send(s,r),this.data.view_sequence_number++,this.data.player_sequence_number++,pA.has(s)||this._restartHeartBeat(),s==="viewend"&&delete this.data.view_id}}},{key:"_resetView",value:function(s){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",s)}},{key:"_updateStateData",value:function(){var s,r=this.getStateData();if(typeof this.stateDataTranslator=="function")try{r=this.stateDataTranslator(r)}catch(a){this.mux.log.warn("Exception in stateDataTranslator translator callback.",a)}if(!((s=this.data)===null||s===void 0)&&s.video_cdn&&r!=null&&r.video_cdn){r.video_cdn;var n=KT(r,["video_cdn"]);r=n}Object.assign(this.data,r),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var s=this,r=["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"];r.forEach(function(a){var o=parseInt(s.data[a],10);s.data[a]=isNaN(o)?void 0:o});var n=["player_source_url","video_source_url"];n.forEach(function(a){if(s.data[a]){var o=s.data[a].toLowerCase();(o.indexOf("data:")===0||o.indexOf("blob:")===0)&&(s.data[a]="MSE style URL")}})}},{key:"_resetVideoData",value:function(){var s=this;Object.keys(this.data).forEach(function(r){r.indexOf("video_")===0&&delete s.data[r]})}},{key:"_resetViewData",value:function(){var s=this;Object.keys(this.data).forEach(function(r){r.indexOf("view_")===0&&delete s.data[r]}),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 s=this,r=this.data.view_id=Ma(),n=function(){r===s.data.view_id&&at(s.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",n):n()}},{key:"_restartHeartBeat",value:function(){var s=this;window.clearTimeout(this._heartBeatTimeout),this._heartBeatTimeout=window.setTimeout(function(){s.data.player_is_paused||s.emit("hb")},1e4)}},{key:"addHLSJS",value:function(s){if(!s.hlsjs){this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.");return}if(this.hlsjs){this.mux.log.warn("An instance of HLS.js is already being monitored for this player.");return}this.hlsjs=s.hlsjs,ZT(this.mux,this.id,s.hlsjs,{},s.Hls||window.Hls)}},{key:"removeHLSJS",value:function(){this.hlsjs&&(JT(this.hlsjs),this.hlsjs=void 0)}},{key:"addDashJS",value:function(s){if(!s.dashjs){this.mux.log.warn("You must pass a valid dashjs instance in order to track it.");return}if(this.dashjs){this.mux.log.warn("An instance of Dash.js is already being monitored for this player.");return}this.dashjs=s.dashjs,s_(this.mux,this.id,s.dashjs)}},{key:"removeDashJS",value:function(){this.dashjs&&(r_(this.dashjs),this.dashjs=void 0)}}]),t})(a_),vA=gA,Un=ei(K0());function EA(){return Un.default&&!!(Un.default.fullscreenElement||Un.default.webkitFullscreenElement||Un.default.mozFullScreenElement||Un.default.msFullscreenElement)}var yA=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],bA={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};function TA(i,e,t){var s=us(nd(e),3),r=s[0],n=s[1],a=s[2],o=i.log,l=i.utils.getComputedStyle,d=i.utils.secondsToMs,u={automaticErrorTracking:!0};if(r){if(a!=="video"&&a!=="audio")return o.error("The element of `"+n+"` was not a media element.")}else return o.error("No element was found with the `"+n+"` query selector.");r.mux&&(r.mux.destroy(),delete r.mux,o.warn("Already monitoring this video element, replacing existing event listeners"));var c={getPlayheadTime:function(){return d(r.currentTime)},getStateData:function(){var f,m,g,p=((f=(m=this).getPlayheadTime)===null||f===void 0?void 0:f.call(m))||d(r.currentTime),E=this.hlsjs&&this.hlsjs.url,b=this.dashjs&&typeof this.dashjs.getSource=="function"&&this.dashjs.getSource(),y={player_is_paused:r.paused,player_width:parseInt(l(r,"width")),player_height:parseInt(l(r,"height")),player_autoplay_on:r.autoplay,player_preload_on:r.preload,player_language_code:r.lang,player_is_fullscreen:EA(),video_poster_url:r.poster,video_source_url:E||b||r.currentSrc,video_source_duration:d(r.duration),video_source_height:r.videoHeight,video_source_width:r.videoWidth,view_dropped_frame_count:r==null||(g=r.getVideoPlaybackQuality)===null||g===void 0?void 0:g.call(r).droppedVideoFrames};if(r.getStartDate&&p>0){var T=r.getStartDate();if(T&&typeof T.getTime=="function"&&T.getTime()){var A=T.getTime();if(y.player_program_time=A+p,r.seekable.length>0){var L=A+r.seekable.end(r.seekable.length-1);y.player_live_edge_program_time=L}}}return y}};t=Object.assign(u,t,c),t.data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:i.VERSION},t.data),r.mux=r.mux||{},r.mux.deleted=!1,r.mux.emit=function(f,m){i.emit(n,f,m)},r.mux.updateData=function(f){r.mux.emit("hb",f)};var h=function(){o.error("The monitor for this video element has already been destroyed.")};r.mux.destroy=function(){Object.keys(r.mux.listeners).forEach(function(f){r.removeEventListener(f,r.mux.listeners[f],!1)}),delete r.mux.listeners,r.mux.destroy=h,r.mux.swapElement=h,r.mux.emit=h,r.mux.addHLSJS=h,r.mux.addDashJS=h,r.mux.removeHLSJS=h,r.mux.removeDashJS=h,r.mux.updateData=h,r.mux.setEmitTranslator=h,r.mux.setStateDataTranslator=h,r.mux.setGetPlayheadTime=h,r.mux.deleted=!0,i.emit(n,"destroy")},r.mux.swapElement=function(f){var m=us(nd(f),3),g=m[0],p=m[1],E=m[2];if(g){if(E!=="video"&&E!=="audio")return i.log.error("The element of `"+p+"` was not a media element.")}else return i.log.error("No element was found with the `"+p+"` query selector.");g.muxId=r.muxId,delete r.muxId,g.mux=g.mux||{},g.mux.listeners=Object.assign({},r.mux.listeners),delete r.mux.listeners,Object.keys(g.mux.listeners).forEach(function(b){r.removeEventListener(b,g.mux.listeners[b],!1),g.addEventListener(b,g.mux.listeners[b],!1)}),g.mux.swapElement=r.mux.swapElement,g.mux.destroy=r.mux.destroy,delete r.mux,r=g},r.mux.addHLSJS=function(f){i.addHLSJS(n,f)},r.mux.addDashJS=function(f){i.addDashJS(n,f)},r.mux.removeHLSJS=function(){i.removeHLSJS(n)},r.mux.removeDashJS=function(){i.removeDashJS(n)},r.mux.setEmitTranslator=function(f){i.setEmitTranslator(n,f)},r.mux.setStateDataTranslator=function(f){i.setStateDataTranslator(n,f)},r.mux.setGetPlayheadTime=function(f){f||(f=t.getPlayheadTime),i.setGetPlayheadTime(n,f)},i.init(n,t),i.emit(n,"playerready"),r.paused||(i.emit(n,"play"),r.readyState>2&&i.emit(n,"playing")),r.mux.listeners={},yA.forEach(function(f){f==="error"&&!t.automaticErrorTracking||(r.mux.listeners[f]=function(){var m={};if(f==="error"){if(!r.error||r.error.code===1)return;m.player_error_code=r.error.code,m.player_error_message=bA[r.error.code]||r.error.message}i.emit(n,f,m)},r.addEventListener(f,r.mux.listeners[f],!1))})}function _A(i,e,t,s){var r=s;if(i&&typeof i[e]=="function")try{r=i[e].apply(i,t)}catch(n){De.info("safeCall error",n)}return r}var ya=ei(ji()),Ur;ya.default&&ya.default.WeakMap&&(Ur=new WeakMap);function AA(i,e){if(!i||!e||!ya.default||typeof ya.default.getComputedStyle!="function")return"";var t;return Ur&&Ur.has(i)&&(t=Ur.get(i)),t||(t=ya.default.getComputedStyle(i,null),Ur&&Ur.set(i,t)),t.getPropertyValue(e)}function SA(i){return Math.floor(i*1e3)}var Ks={TARGET_DURATION:"#EXT-X-TARGETDURATION",PART_INF:"#EXT-X-PART-INF",SERVER_CONTROL:"#EXT-X-SERVER-CONTROL",INF:"#EXTINF",PROGRAM_DATE_TIME:"#EXT-X-PROGRAM-DATE-TIME",VERSION:"#EXT-X-VERSION",SESSION_DATA:"#EXT-X-SESSION-DATA"},Yd=function(i){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(i),this.manifest};Yd.prototype.process=function(i){var e;for(this.buffer+=i,e=this.buffer.indexOf(` 15`);e>-1;e=this.buffer.indexOf(` 16`))this.processLine(this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)};Yd.prototype.processLine=function(i){var e=i.indexOf(":"),t=xA(i,e),s=t[0],r=t.length===2?qh(t[1]):void 0;if(s[0]!=="#")this.currentUri.uri=s,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(s){case Ks.TARGET_DURATION:{if(!isFinite(r)||r<0)return;this.manifest.targetDuration=r,this.setHoldBack();break}case Ks.PART_INF:{Tu(this.manifest,t),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break}case Ks.SERVER_CONTROL:{Tu(this.manifest,t),this.setHoldBack();break}case Ks.INF:{r===0?this.currentUri.duration=.01:r>0&&(this.currentUri.duration=r);break}case Ks.PROGRAM_DATE_TIME:{var n=r,a=new Date(n);this.manifest.dateTimeString||(this.manifest.dateTimeString=n,this.manifest.dateTimeObject=a),this.currentUri.dateTimeString=n,this.currentUri.dateTimeObject=a;break}case Ks.VERSION:{Tu(this.manifest,t);break}case Ks.SESSION_DATA:{var o=kA(t[1]),l=q0(o);Object.assign(this.manifest.sessionData,l)}}};Yd.prototype.setHoldBack=function(){var i=this.manifest,e=i.serverControl,t=i.targetDuration,s=i.partTargetDuration;if(e){var r="holdBack",n="partHoldBack",a=t&&t*3,o=s&&s*2;t&&!e.hasOwnProperty(r)&&(e[r]=a),a&&e[r]<a&&(e[r]=a),s&&!e.hasOwnProperty(n)&&(e[n]=s*3),s&&e[n]<o&&(e[n]=o)}};var Tu=function(i,e){var t=iv(e[0].replace("#EXT-X-","")),s;RA(e[1])?(s={},s=Object.assign(LA(e[1]),s)):s=qh(e[1]),i[t]=s},iv=function(i){return i.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()})},qh=function(i){if(i.toLowerCase()==="yes"||i.toLowerCase()==="no")return i.toLowerCase()==="yes";var e=i.indexOf(":")!==-1?i:parseFloat(i);return isNaN(e)?i:e},IA=function(i){var e={},t=i.split("=");if(t.length>1){var s=iv(t[0]);e[s]=qh(t[1])}return e},LA=function(i){for(var e=i.split(","),t={},s=0;e.length>s;s++){var r=e[s],n=IA(r);t=Object.assign(n,t)}return t},RA=function(i){return i.indexOf("=")>-1},xA=function(i,e){return e===-1?[i]:[i.substring(0,e),i.substring(e+1)]},kA=function(i){var e={};if(i){var t=i.search(","),s=i.slice(0,t),r=i.slice(t+1),n=[s,r];return n.forEach(function(a,o){for(var l=a.replace(/['"]+/g,"").split("="),d=0;d<l.length;d++)l[d]==="DATA-ID"&&(e["DATA-ID"]=l[1-d]),l[d]==="VALUE"&&(e.VALUE=l[1-d])}),{data:e}}},DA=Yd,CA={safeCall:_A,safeIncrement:at,getComputedStyle:AA,secondsToMs:SA,assign:Object.assign,headersStringToObject:Yh,cdnHeadersToRequestId:ld,extractHostnameAndDomain:Pa,extractHostname:fi,manifestParser:DA,generateShortID:W0,generateUUID:Ma,now:ht.now,findMediaElement:nd},wA=CA,MA={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",PLAYBACK_MODE_CHANGE:"playbackmodechange",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",HEARTBEAT:"hb",DESTROY:"destroy"},PA=MA,OA="mux-embed",NA="5.13.0",UA="2.1",Qe={},Ps=function(i){var e=arguments;typeof i=="string"?Ps.hasOwnProperty(i)?Ea.default.setTimeout(function(){e=Array.prototype.splice.call(e,1),Ps[i].apply(null,e)},0):De.warn("`"+i+"` is an unknown task"):typeof i=="function"?Ea.default.setTimeout(function(){i(Ps)},0):De.warn("`"+i+"` is invalid.")},$A={loaded:ht.now(),NAME:OA,VERSION:NA,API_VERSION:UA,PLAYER_TRACKED:!1,monitor:function(i,e){return TA(Ps,i,e)},destroyMonitor:function(i){var e=us(nd(i),1),t=e[0];t&&t.mux&&typeof t.mux.destroy=="function"?t.mux.destroy():De.error("A video element monitor for `"+i+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(i,e){var t=ai(i);Qe[t]?Qe[t].addHLSJS(e):De.error("A monitor for `"+t+"` has not been initialized.")},addDashJS:function(i,e){var t=ai(i);
16Qe[t]?Qe[t].addDashJS(e):De.error("A monitor for `"+t+"` has not been initialized.")},removeHLSJS:function(i){var e=ai(i);Qe[e]?Qe[e].removeHLSJS():De.error("A monitor for `"+e+"` has not been initialized.")},removeDashJS:function(i){var e=ai(i);Qe[e]?Qe[e].removeDashJS():De.error("A monitor for `"+e+"` has not been initialized.")},init:function(i,e){hc()&&e&&e.respectDoNotTrack&&De.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var t=ai(i);Qe[t]=new vA(Ps,t,e)},emit:function(i,e,t){var s=ai(i);Qe[s]?(Qe[s].emit(e,t),e==="destroy"&&delete Qe[s]):De.error("A monitor for `"+s+"` has not been initialized.")},updateData:function(i,e){var t=ai(i);Qe[t]?Qe[t].emit("hb",e):De.error("A monitor for `"+t+"` has not been initialized.")},setEmitTranslator:function(i,e){var t=ai(i);Qe[t]?Qe[t].emitTranslator=e:De.error("A monitor for `"+t+"` has not been initialized.")},setStateDataTranslator:function(i,e){var t=ai(i);Qe[t]?Qe[t].stateDataTranslator=e:De.error("A monitor for `"+t+"` has not been initialized.")},setGetPlayheadTime:function(i,e){var t=ai(i);Qe[t]?Qe[t].getPlayheadTime=e:De.error("A monitor for `"+t+"` has not been initialized.")},checkDoNotTrack:hc,log:De,utils:wA,events:PA,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Ps,$A);typeof Ea.default<"u"&&typeof Ea.default.addEventListener=="function"&&Ea.default.addEventListener("pagehide",function(i){i.persisted||(Ps.WINDOW_UNLOADING=!0)},!1);var jh=Ps;const j=Number.isFinite||function(i){return typeof i=="number"&&isFinite(i)},FA=Number.isSafeInteger||function(i){return typeof i=="number"&&Math.abs(i)<=BA},BA=Number.MAX_SAFE_INTEGER||9007199254740991;let ee=(function(i){return i.NETWORK_ERROR="networkError",i.MEDIA_ERROR="mediaError",i.KEY_SYSTEM_ERROR="keySystemError",i.MUX_ERROR="muxError",i.OTHER_ERROR="otherError",i})({}),C=(function(i){return i.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",i.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",i.KEY_SYSTEM_NO_SESSION="keySystemNoSession",i.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",i.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",i.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",i.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",i.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",i.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",i.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",i.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",i.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",i.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",i.MANIFEST_LOAD_ERROR="manifestLoadError",i.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",i.MANIFEST_PARSING_ERROR="manifestParsingError",i.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",i.LEVEL_EMPTY_ERROR="levelEmptyError",i.LEVEL_LOAD_ERROR="levelLoadError",i.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",i.LEVEL_PARSING_ERROR="levelParsingError",i.LEVEL_SWITCH_ERROR="levelSwitchError",i.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",i.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",i.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",i.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",i.FRAG_LOAD_ERROR="fragLoadError",i.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",i.FRAG_DECRYPT_ERROR="fragDecryptError",i.FRAG_PARSING_ERROR="fragParsingError",i.FRAG_GAP="fragGap",i.REMUX_ALLOC_ERROR="remuxAllocError",i.KEY_LOAD_ERROR="keyLoadError",i.KEY_LOAD_TIMEOUT="keyLoadTimeOut",i.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",i.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",i.BUFFER_APPEND_ERROR="bufferAppendError",i.BUFFER_APPENDING_ERROR="bufferAppendingError",i.BUFFER_STALLED_ERROR="bufferStalledError",i.BUFFER_FULL_ERROR="bufferFullError",i.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",i.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",i.ASSET_LIST_LOAD_ERROR="assetListLoadError",i.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",i.ASSET_LIST_PARSING_ERROR="assetListParsingError",i.INTERSTITIAL_ASSET_ITEM_ER
vendor: 7,918 bytes, line 16
16ROR="interstitialAssetItemError",i.INTERNAL_EXCEPTION="internalException",i.INTERNAL_ABORTED="aborted",i.ATTACH_MEDIA_ERROR="attachMediaError",i.UNKNOWN="unknown",i})({}),v=(function(i){return i.MEDIA_ATTACHING="hlsMediaAttaching",i.MEDIA_ATTACHED="hlsMediaAttached",i.MEDIA_DETACHING="hlsMediaDetaching",i.MEDIA_DETACHED="hlsMediaDetached",i.MEDIA_ENDED="hlsMediaEnded",i.STALL_RESOLVED="hlsStallResolved",i.BUFFER_RESET="hlsBufferReset",i.BUFFER_CODECS="hlsBufferCodecs",i.BUFFER_CREATED="hlsBufferCreated",i.BUFFER_APPENDING="hlsBufferAppending",i.BUFFER_APPENDED="hlsBufferAppended",i.BUFFER_EOS="hlsBufferEos",i.BUFFERED_TO_END="hlsBufferedToEnd",i.BUFFER_FLUSHING="hlsBufferFlushing",i.BUFFER_FLUSHED="hlsBufferFlushed",i.MANIFEST_LOADING="hlsManifestLoading",i.MANIFEST_LOADED="hlsManifestLoaded",i.MANIFEST_PARSED="hlsManifestParsed",i.LEVEL_SWITCHING="hlsLevelSwitching",i.LEVEL_SWITCHED="hlsLevelSwitched",i.LEVEL_LOADING="hlsLevelLoading",i.LEVEL_LOADED="hlsLevelLoaded",i.LEVEL_UPDATED="hlsLevelUpdated",i.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",i.LEVELS_UPDATED="hlsLevelsUpdated",i.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",i.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",i.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",i.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",i.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",i.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",i.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",i.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",i.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",i.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",i.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",i.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",i.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",i.CUES_PARSED="hlsCuesParsed",i.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",i.INIT_PTS_FOUND="hlsInitPtsFound",i.FRAG_LOADING="hlsFragLoading",i.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",i.FRAG_LOADED="hlsFragLoaded",i.FRAG_DECRYPTED="hlsFragDecrypted",i.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",i.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",i.FRAG_PARSING_METADATA="hlsFragParsingMetadata",i.FRAG_PARSED="hlsFragParsed",i.FRAG_BUFFERED="hlsFragBuffered",i.FRAG_CHANGED="hlsFragChanged",i.FPS_DROP="hlsFpsDrop",i.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",i.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",i.ERROR="hlsError",i.DESTROYING="hlsDestroying",i.KEY_LOADING="hlsKeyLoading",i.KEY_LOADED="hlsKeyLoaded",i.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",i.BACK_BUFFER_REACHED="hlsBackBufferReached",i.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",i.ASSET_LIST_LOADING="hlsAssetListLoading",i.ASSET_LIST_LOADED="hlsAssetListLoaded",i.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",i.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",i.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",i.INTERSTITIAL_STARTED="hlsInterstitialStarted",i.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",i.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",i.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",i.INTERSTITIAL_ENDED="hlsInterstitialEnded",i.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",i.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",i.EVENT_CUE_ENTER="hlsEventCueEnter",i})({});var fe={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Q={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class Lr{constructor(e,t=0,s=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_=s}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class HA{constructor(e,t,s,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Lr(e),this.fast_=new Lr(t),this.defaultTTFB_=r,this.ttfb_=new Lr(e)}update(e,t){const{slow_:s,fast_:r,ttfb_:n}=this;s.halfLife!==e&&(this.slow_=new Lr(e,s.getEstimate(),s.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Lr(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Lr(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,r=e/1e3,n=s/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,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_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function GA(i,e,t){return(e=VA(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ke(){return ke=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},ke.apply(null,arguments)}function Vm(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function Ie(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vm(Object(t),!0).forEach(function(s){GA(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Vm(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function KA(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var s=t.call(i,e);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function VA(i){var e=KA(i,"string");return typeof e=="symbol"?e:e+""}class ti{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const s=`[${e}]:`;this.trace=xs,this.debug=t.debug.bind(null,s),this.log=t.log.bind(null,s),this.warn=t.warn.bind(null,s),this.info=t.info.bind(null,s),this.error=t.error.bind(null,s)}}const xs=function(){},WA={trace:xs,debug:xs,log:xs,warn:xs,info:xs,error:xs};function pc(){return ke({},WA)}function YA(i,e){const t=self.console[i];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${i}] >`):xs}function Wm(i,e,t){return e[i]?e[i].bind(e):YA(i,t)}const gc=pc();function qA(i,e,t){const s=pc();if(typeof console=="object"&&i===!0||typeof i=="object"){const r=["debug","log","info","warn","error"];r.forEach(n=>{s[n]=Wm(n,i,t)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return pc()}r.forEach(n=>{gc[n]=Wm(n,i)})}else ke(gc,s);return s}const Le=gc;function Us(i=!0){return typeof self>"u"?void 0:(i||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function jA(i){return typeof self<"u"&&i===self.ManagedMediaSource}function sv(i,e){const t=Object.keys(i),s=Object.keys(e),r=t.length,n=s.length;return!r||!n||r===n&&!t.some(a=>s.indexOf(a)===-1)}function Kt(i,e=!1){if(typeof TextDecoder<"u"){const d=new TextDecoder("utf-8").decode(i);if(e){const u=d.indexOf("\0");return u!==-1?d.substring(0,u):d}return d.replace(/\0/g,"")}const t=i.length;let s,r,n,a="",o=0;for(;o<t;){if(s=i[o++],s===0&&e)return a;
vendor: 5,508 bytes, line 16
16if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(s);break;case 12:case 13:r=i[o++],a+=String.fromCharCode((s&31)<<6|r&63);break;case 14:r=i[o++],n=i[o++],a+=String.fromCharCode((s&15)<<12|(r&63)<<6|(n&63)<<0);break}}return a}function gt(i){let e="";for(let t=0;t<i.length;t++){let s=i[t].toString(16);s.length<2&&(s="0"+s),e+=s}return e}function rv(i){return Uint8Array.from(i.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function zA(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var _u={exports:{}},Ym;function QA(){return Ym||(Ym=1,(function(i,e){(function(t){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,d,u){if(u=u||{},l=l.trim(),d=d.trim(),!d){if(!u.alwaysNormalize)return l;var c=o.parseURL(l);if(!c)throw new Error("Error trying to parse base URL.");return c.path=o.normalizePath(c.path),o.buildURLFromParts(c)}var h=o.parseURL(d);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return u.alwaysNormalize?(h.path=o.normalizePath(h.path),o.buildURLFromParts(h)):d;var f=o.parseURL(l);if(!f)throw new Error("Error trying to parse base URL.");if(!f.netLoc&&f.path&&f.path[0]!=="/"){var m=r.exec(f.path);f.netLoc=m[1],f.path=m[2]}f.netLoc&&!f.path&&(f.path="/");var g={scheme:f.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(g.netLoc=f.netLoc,h.path[0]!=="/"))if(!h.path)g.path=f.path,h.params||(g.params=f.params,h.query||(g.query=f.query));else{var p=f.path,E=p.substring(0,p.lastIndexOf("/")+1)+h.path;g.path=o.normalizePath(E)}return g.path===null&&(g.path=u.alwaysNormalize?o.normalizePath(h.path):h.path),o.buildURLFromParts(g)},parseURL:function(l){var d=s.exec(l);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(n,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};i.exports=o})()})(_u)),_u.exports}var zh=QA();class Qh{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 Ce={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class nv{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,ZA(this,"stats")}setByteRange(e,t){const s=e.split("@",2);let r;s.length===1?r=t?.byteRangeEndOffset||0:r=parseInt(s[1]),this._byteRange=[r,parseInt(s[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[Ce.AUDIO]:null,[Ce.VIDEO]:null,[Ce.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new Qh),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=zh.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Ce.AUDIO]=null,e[Ce.VIDEO]=null,e[Ce.AUDIOVIDEO]=null}}function je(i){return i.sn!=="initSegment"}class Au extends nv{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=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.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,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 byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(j(e)&&j(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const s=Object.keys(t);if(s.length===1){const r=this._decryptdata=t[s[0]]||null;r&&(this._decryptdata=r.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=j(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;
vendor: 4,294 bytes, line 16
16if(this.levelkeys){var t;const s=Object.keys(this.levelkeys),r=s.length;if(r>1||r===1&&(t=this.levelkeys[s[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!j(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return je(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var s;const r=t[e];r&&!((s=this._decryptdata)!=null&&s.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,r,n,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:s,startDTS:r,endDTS:n,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,s),l.startDTS=Math.min(l.startDTS,r),l.endDTS=Math.max(l.endDTS,n)}}let XA=class extends nv{constructor(e,t,s,r,n){super(s),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.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 a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,n),n&&(this.fragOffset=n.fragOffset+n.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}};function av(i,e){const t=Object.getPrototypeOf(i);if(t){const s=Object.getOwnPropertyDescriptor(t,e);return s||av(t,e)}}function ZA(i,e){const t=av(i,e);t&&(t.enumerable=!0,Object.defineProperty(i,e,t))}const qm=Math.pow(2,32)-1,JA=[].push,ov={video:1,audio:2,id3:3,text:4};function rt(i){return String.fromCharCode.apply(null,i)}function lv(i,e){const t=i[e]<<8|i[e+1];return t<0?65536+t:t}function ae(i,e){const t=dv(i,e);return t<0?4294967296+t:t}function jm(i,e){let t=ae(i,e);return t*=Math.pow(2,32),t+=ae(i,e+4),t}function dv(i,e){return i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]}function eS(i){const e=i.byteLength;for(let t=0;t<e;){const s=ae(i,t);if(s>8&&i[t+4]===109&&i[t+5]===111&&i[t+6]===111&&i[t+7]===102)return!0;t=s>1?t+s:e}return!1}function ce(i,e){const t=[];if(!e.length)return t;const s=i.byteLength;for(let r=0;r<s;){const n=ae(i,r),a=rt(i.subarray(r+4,r+8)),o=n>1?r+n:s;if(a===e[0])if(e.length===1)t.push(i.subarray(r+8,o));else{const l=ce(i.subarray(r+8,o),e.slice(1));l.length&&JA.apply(t,l)}r=o}return t}function tS(i){const e=[],t=i[0];let s=8;const r=ae(i,s);s+=4;let n=0,a=0;t===0?(n=ae(i,s),a=ae(i,s+4),s+=8):(n=jm(i,s),a=jm(i,s+8),s+=16),s+=2;let o=i.length+a;const l=lv(i,s);s+=2;for(let d=0;d<l;d++){let u=s;const c=ae(i,u);u+=4;const h=c&2147483647;if((c&2147483648)>>>31===1)return Le.warn("SIDX has hierarchical references (not supported)"),null;const m=ae(i,u);u+=4,e.push({referenceSize:h,subsegmentDuration:m,info:{duration:m/r,start:o,end:o+h-1}}),o+=h,u+=4,s=u}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:l,references:e}}function uv(i){const e=[],t=ce(i,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],a=ce(n,["tkhd"])[0];if(a){let o=a[0];const l=ae(a,o===0?12:20),d=ce(n,["mdia","mdhd"])[0];if(d){o=d[0];const u=ae(d,o===0?12:20),c=ce(n,["mdia","hdlr"])[0];if(c){const h=rt(c.subarray(8,12)),f={soun:Ce.AUDIO,vide:Ce.VIDEO}[h],m=ce(n,["mdia","minf","stbl","stsd"])[0],g=iS(m);f?(e[l]={timescale:u,type:f,stsd:g},e[f]=Ie({timescale:u,id:l},g)):e[l]={timescale:u,type:h,stsd:g}}}}}return ce(i,["moov","mvex","trex"]).forEach(r=>{const n=ae(r,4),a=e[n];a&&(a.default={duration:ae(r,12),flags:ae(r,20)})}),e}function iS(i){const e=i.subarray(8),t=e.subarray(86),s=rt(e.subarray(4,8));let r=s,n;const a=s==="enca"||s==="encv";if(a){const d=ce(e,[s])[0].subarray(s==="enca"?28:78);
16ce(d,["sinf"]).forEach(c=>{const h=ce(c,["schm"])[0];if(h){const f=rt(h.subarray(4,8));if(f==="cbcs"||f==="cenc"){const m=ce(c,["frma"])[0];m&&(r=rt(m))}}})}const o=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const l=ce(t,["avcC"])[0];l&&l.length>3&&(r+="."+fo(l[1])+fo(l[2])+fo(l[3]),n=ho(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const l=ce(e,[s])[0],d=ce(l.subarray(28),["esds"])[0];if(d&&d.length>7){let u=4;if(d[u++]!==3)break;u=Su(d,u),u+=2;const c=d[u++];if(c&128&&(u+=2),c&64&&(u+=d[u++]),d[u++]!==4)break;u=Su(d,u);const h=d[u++];if(h===64)r+="."+fo(h);else break;if(u+=12,d[u++]!==5)break;u=Su(d,u);const f=d[u++];let m=(f&248)>>3;m===31&&(m+=1+((f&7)<<3)+((d[u]&224)>>5)),r+="."+m}break}case"hvc1":case"hev1":{const l=ce(t,["hvcC"])[0];if(l&&l.length>12){const d=l[1],u=["","A","B","C"][d>>6],c=d&31,h=ae(l,2),f=(d&32)>>5?"H":"L",m=l[12],g=l.subarray(6,12);r+="."+u+c,r+="."+sS(h).toString(16).toUpperCase(),r+="."+f+m;let p="";for(let E=g.length;E--;){const b=g[E];(b||p)&&(p="."+b.toString(16).toUpperCase()+p)}r+=p}n=ho(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=ho(r,t)||r;break}case"vp09":{const l=ce(t,["vpcC"])[0];if(l&&l.length>6){const d=l[4],u=l[5],c=l[6]>>4&15;r+="."+Pi(d)+"."+Pi(u)+"."+Pi(c)}break}case"av01":{const l=ce(t,["av1C"])[0];if(l&&l.length>2){const d=l[1]>>>5,u=l[1]&31,c=l[2]>>>7?"H":"M",h=(l[2]&64)>>6,f=(l[2]&32)>>5,m=d===2&&h?f?12:10:h?10:8,g=(l[2]&16)>>4,p=(l[2]&8)>>3,E=(l[2]&4)>>2,b=l[2]&3;r+="."+d+"."+Pi(u)+c+"."+Pi(m)+"."+g+"."+p+E+b+"."+Pi(1)+"."+Pi(1)+"."+Pi(1)+"."+0,n=ho("dav1",t)}break}}return{codec:r,encrypted:a,supplemental:n}}function ho(i,e){const t=ce(e,["dvvC"]),s=t.length?t[0]:ce(e,["dvcC"])[0];if(s){const r=s[2]>>1&127,n=s[2]<<5&32|s[3]>>3&31;return i+"."+Pi(r)+"."+Pi(n)}}function sS(i){let e=0;for(let t=0;t<32;t++)e|=(i>>t&1)<<31-t;return e>>>0}function Su(i,e){const t=e+5;for(;i[e++]&128&&e<t;);return e}function fo(i){return("0"+i.toString(16).toUpperCase()).slice(-2)}function Pi(i){return(i<10?"0":"")+i}function rS(i,e){if(!i||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&cv(i,(s,r)=>{const n=s.subarray(8,24);n.some(a=>a!==0)||(Le.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${gt(n)} -> ${gt(t)}`),s.set(t,8))})}function nS(i){const e=[];return cv(i,t=>e.push(t.subarray(8,24))),e}function cv(i,e){ce(i,["moov","trak"]).forEach(s=>{const r=ce(s,["mdia","minf","stbl","stsd"])[0];if(!r)return;const n=r.subarray(8);let a=ce(n,["enca"]);const o=a.length>0;o||(a=ce(n,["encv"])),a.forEach(l=>{const d=o?l.subarray(28):l.subarray(78);ce(d,["sinf"]).forEach(c=>{const h=hv(c);h&&e(h,o)})})})}function hv(i){const e=ce(i,["schm"])[0];if(e){const t=rt(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const s=ce(i,["schi","tenc"])[0];if(s)return s}}}function aS(i,e,t){const s={},r=ce(i,["moof","traf"]);for(let n=0;n<r.length;n++){const a=r[n],o=ce(a,["tfhd"])[0],l=ae(o,4),d=e[l];if(!d)continue;s[l]||(s[l]={start:NaN,duration:0,sampleCount:0,timescale:d.timescale,type:d.type});const u=s[l],c=ce(a,["tfdt"])[0];if(c){const y=c[0];let T=ae(c,4);y===1&&(T===qm?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(T*=qm+1,T+=ae(c,8))),j(T)&&(!j(u.start)||T<u.start)&&(u.start=T)}const h=d.default,f=ae(o,0)|h?.flags;let m=h?.duration||0;f&8&&(f&2?m=ae(o,12):m=ae(o,8));const g=ce(a,["trun"]);let p=u.start||0,E=0,b=m;for(let y=0;y<g.length;y++){const T=g[y],A=ae(T,4),L=u.sampleCount;u.sampleCount+=A;const S=T[3]&1,R=T[3]&4,x=T[2]&1,I=T[2]&2,M=T[2]&4,$=T[2]&8;let V=8,Y=A;for(S&&(V+=4),R&&A&&(!(T[V+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=L),V+=4,x?(b=ae(T,V),V+=4):b=m,I&&(V+=4),$&&(V+=4),p+=b,E+=b,Y--);Y--;)x?(b=ae(T,V),V+=4):b=m,I&&(V+=4),M&&(T[V+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-(Y+1),u.keyFrameStart=p),V+=4),$&&(V+=4),p+=b,E+=b;!E&&m&&(E+=m*A)}u.duration+=E}if(!Object.keys(s).some(n=>s[n].duration)){let n=1/0,a=0;const o=ce(i,["sidx"]);for(let l=0;l<o.length;l++){const d=tS(o[l]);if(d!=null&&d.references){n=Math.min(n,d.earliestPresentationTime/d.timescale);const u=d.references.reduce((c,h)=>c+h.info.duration||0,0);a=Math.max(a,u+d.earliestPresentationTime/d.timescale)}}
vendor: 4,408 bytes, line 16
16a&&j(a)&&Object.keys(s).forEach(l=>{s[l].duration||(s[l].duration=a*s[l].timescale-s[l].start)})}return s}function oS(i){const e={valid:null,remainder:null},t=ce(i,["moof"]);if(t.length<2)return e.remainder=i,e;const s=t[t.length-1];return e.valid=i.slice(0,s.byteOffset-8),e.remainder=i.slice(s.byteOffset-8),e}function Jt(i,e){const t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function zm(i,e){const t=[],s=e.samples,r=e.timescale,n=e.id;let a=!1;return ce(s,["moof"]).map(l=>{const d=l.byteOffset-8;ce(l,["traf"]).map(c=>{const h=ce(c,["tfdt"]).map(f=>{const m=f[0];let g=ae(f,4);return m===1&&(g*=Math.pow(2,32),g+=ae(f,8)),g/r})[0];return h!==void 0&&(i=h),ce(c,["tfhd"]).map(f=>{const m=ae(f,4),g=ae(f,0)&16777215,p=(g&1)!==0,E=(g&2)!==0,b=(g&8)!==0;let y=0;const T=(g&16)!==0;let A=0;const L=(g&32)!==0;let S=8;m===n&&(p&&(S+=8),E&&(S+=4),b&&(y=ae(f,S),S+=4),T&&(A=ae(f,S),S+=4),L&&(S+=4),e.type==="video"&&(a=qd(e.codec)),ce(c,["trun"]).map(R=>{const x=R[0],I=ae(R,0)&16777215,M=(I&1)!==0;let $=0;const V=(I&4)!==0,Y=(I&256)!==0;let H=0;const N=(I&512)!==0;let W=0;const B=(I&1024)!==0,q=(I&2048)!==0;let J=0;const U=ae(R,4);let F=8;M&&($=ae(R,F),F+=4),V&&(F+=4);let re=$+d;for(let me=0;me<U;me++){if(Y?(H=ae(R,F),F+=4):H=y,N?(W=ae(R,F),F+=4):W=A,B&&(F+=4),q&&(x===0?J=ae(R,F):J=dv(R,F),F+=4),e.type===Ce.VIDEO){let le=0;for(;le<W;){const he=ae(s,re);if(re+=4,lS(a,s[re])){const tt=s.subarray(re,re+he);Xh(tt,a?2:1,i+J/r,t)}re+=he,le+=he+4}}i+=H/r}}))})})}),t}function qd(i){if(!i)return!1;const e=i.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function lS(i,e){if(i){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Xh(i,e,t,s){const r=fv(i);let n=0;n+=e;let a=0,o=0,l=0;for(;n<r.length;){a=0;do{if(n>=r.length)break;l=r[n++],a+=l}while(l===255);o=0;do{if(n>=r.length)break;l=r[n++],o+=l}while(l===255);const d=r.length-n;let u=n;if(o<d)n+=o;else if(o>d){Le.error(`Malformed SEI payload. ${o} is too small, only ${d} bytes left to parse.`);break}if(a===4){if(r[u++]===181){const h=lv(r,u);if(u+=2,h===49){const f=ae(r,u);if(u+=4,f===1195456820){const m=r[u++];if(m===3){const g=r[u++],p=31&g,E=64&g,b=E?2+p*3:0,y=new Uint8Array(b);if(E){y[0]=g;for(let T=1;T<b;T++)y[T]=r[u++]}s.push({type:m,payloadType:a,pts:t,bytes:y})}}}}}else if(a===5&&o>16){const c=[];for(let m=0;m<16;m++){const g=r[u++].toString(16);c.push(g.length==1?"0"+g:g),(m===3||m===5||m===7||m===9)&&c.push("-")}const h=o-16,f=new Uint8Array(h);for(let m=0;m<h;m++)f[m]=r[u++];s.push({payloadType:a,pts:t,uuid:c.join(""),userData:Kt(f),userDataBytes:f})}}}function fv(i){const e=i.byteLength,t=[];let s=1;for(;s<e-2;)i[s]===0&&i[s+1]===0&&i[s+2]===3?(t.push(s+2),s+=2):s++;if(t.length===0)return i;const r=e-t.length,n=new Uint8Array(r);let a=0;for(s=0;s<r;a++,s++)a===t[0]&&(a++,t.shift()),n[s]=i[a];return n}function dS(i){const e=i[0];let t="",s="",r=0,n=0,a=0,o=0,l=0,d=0;if(e===0){for(;rt(i.subarray(d,d+1))!=="\0";)t+=rt(i.subarray(d,d+1)),d+=1;for(t+=rt(i.subarray(d,d+1)),d+=1;rt(i.subarray(d,d+1))!=="\0";)s+=rt(i.subarray(d,d+1)),d+=1;s+=rt(i.subarray(d,d+1)),d+=1,r=ae(i,12),n=ae(i,16),o=ae(i,20),l=ae(i,24),d=28}else if(e===1){d+=4,r=ae(i,d),d+=4;const c=ae(i,d);d+=4;const h=ae(i,d);for(d+=4,a=2**32*c+h,FA(a)||(a=Number.MAX_SAFE_INTEGER,Le.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=ae(i,d),d+=4,l=ae(i,d),d+=4;rt(i.subarray(d,d+1))!=="\0";)t+=rt(i.subarray(d,d+1)),d+=1;for(t+=rt(i.subarray(d,d+1)),d+=1;rt(i.subarray(d,d+1))!=="\0";)s+=rt(i.subarray(d,d+1)),d+=1;s+=rt(i.subarray(d,d+1)),d+=1}const u=i.subarray(d,i.byteLength);return{schemeIdUri:t,value:s,timeScale:r,presentationTime:a,presentationTimeDelta:n,eventDuration:o,id:l,payload:u}}function uS(i,...e){const t=e.length;let s=8,r=t;for(;r--;)s+=e[r].byteLength;const n=new Uint8Array(s);for(n[0]=s>>24&255,n[1]=s>>16&255,n[2]=s>>8&255,n[3]=s&255,n.set(i,4),r=0,s=8;r<t;r++)n.set(e[r],s),s+=e[r].byteLength;return n}function cS(i,e,t){if(i.byteLength!==16)throw new RangeError("Invalid system id");let s,r;s=0,r=new Uint8Array;let n;s>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),uS([112,115,115,104],new Uint8Array([s,0,0,0]),i,n,r,a,t)}function hS(i){const e=[];
vendor: 14,181 bytes, line 16
16if(i instanceof ArrayBuffer){const t=i.byteLength;let s=0;for(;s+32<t;){const r=new DataView(i,s),n=fS(r);e.push(n),s+=n.size}}return e}function fS(i){const e=i.getUint32(0),t=i.byteOffset,s=i.byteLength;if(s<e)return{offset:t,size:s};if(i.getUint32(4)!==1886614376)return{offset:t,size:e};const n=i.getUint32(8)>>>24;if(n!==0&&n!==1)return{offset:t,size:e};const a=i.buffer,o=gt(new Uint8Array(a,t+12,16));let l=null,d=null,u=0;if(n===0)u=28;else{const h=i.getUint32(28);if(!h||s<32+h*16)return{offset:t,size:e};l=[];for(let f=0;f<h;f++)l.push(new Uint8Array(a,t+32+f*16,16));u=32+h*16}if(!u)return{offset:t,size:e};const c=i.getUint32(u);return e-32<c?{offset:t,size:e}:(d=new Uint8Array(a,t+u+4,c),{version:n,systemId:o,kids:l,data:d,offset:t,size:e})}const mv=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),An={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,dav1:.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 Zh(i,e){const t=An[e];return!!t&&!!t[i.slice(0,4)]}function Oa(i,e,t=!0){return!i.split(",").some(s=>!Jh(s,e,t))}function Jh(i,e,t=!0){var s;const r=Us(t);return(s=r?.isTypeSupported(Na(i,e)))!=null?s:!1}function Na(i,e){return`${e}/mp4;codecs=${i}`}function Qm(i){if(i){const e=i.substring(0,4);return An.video[e]}return 2}function dd(i){const e=mv();return i.split(",").reduce((t,s)=>{const n=e&&qd(s)?9:An.video[s];return n?(n*2+t)/(t?3:2):(An.audio[s]+t)/(t?2:1)},0)}const Iu={};function mS(i,e=!0){if(Iu[i])return Iu[i];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[i];for(let r=0;r<t.length;r++){var s;if(Jh(t[r],"audio",e))return Iu[i]=t[r],t[r];if(t[r]==="mp3"&&(s=Us(e))!=null&&s.isTypeSupported("audio/mpeg"))return""}return i}const pS=/flac|opus|mp4a\.40\.34/i;function ud(i,e=!0){return i.replace(pS,t=>mS(t.toLowerCase(),e))}function gS(i,e){const t=[];if(i){const s=i.split(",");for(let r=0;r<s.length;r++)Zh(s[r],"video")||t.push(s[r])}return e&&t.push(e),t.join(",")}function Vo(i,e){if(i&&(i.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(i)!==-1)&&(Xm(i,"audio")||Xm(i,"video")))return i;if(e){const t=e.split(",");if(t.length>1){if(i){for(let s=t.length;s--;)if(t[s].substring(0,4)===i.substring(0,4))return t[s]}return t[0]}}return e||i}function Xm(i,e){return Zh(i,e)&&Jh(i,e)}function vS(i){const e=i.split(",");for(let t=0;t<e.length;t++){const s=e[t].split(".");s.length>2&&s[0]==="avc1"&&(e[t]=`avc1.${parseInt(s[1]).toString(16)}${("000"+parseInt(s[2]).toString(16)).slice(-4)}`)}return e.join(",")}function ES(i){if(i.startsWith("av01.")){const e=i.split("."),t=["0","111","01","01","01","0"];for(let s=e.length;s>4&&s<10;s++)e[s]=t[s-4];return e.join(".")}return i}function Zm(i){const e=Us(i)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function vc(i){return i.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const yS={supported:!0,powerEfficient:!0,smooth:!0},bS={supported:!1,smooth:!1,powerEfficient:!1},pv={supported:!0,configurations:[],decodingInfoResults:[yS]};function gv(i,e){return{supported:!1,configurations:e,decodingInfoResults:[bS],error:i}}function TS(i,e,t,s,r,n){const a=i.videoCodec,o=i.audioCodec?i.audioGroups:null,l=n?.audioCodec,d=n?.channels,u=d?parseInt(d):l?1/0:2;let c=null;if(o!=null&&o.length)try{o.length===1&&o[0]?c=e.groups[o[0]].channels:c=o.reduce((h,f)=>{if(f){const m=e.groups[f];if(!m)throw new Error(`Audio track group ${f} not found`);Object.keys(m.channels).forEach(g=>{h[g]=(h[g]||0)+m.channels[g]})}return h},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(h=>qd(h))||i.width>1920&&i.height>1088||i.height>1920&&i.width>1088||i.frameRate>Math.max(s,30)||i.videoRange!=="SDR"&&i.videoRange!==t||i.bitrate>Math.max(r,8e6))||!!c&&j(u)&&Object.keys(c).some(h=>parseInt(h)>u)}function vv(i,e,t,s={}){const r=i.videoCodec;if(!r&&!i.audioCodec||!t)return Promise.resolve(pv);const n=[],a=_S(i),o=a.length,l=AS(i,e,o>0),d=l.length;for(let u=o||1*d||1;u--;){const c={type:"media-source"};if(o&&(c.video=a[u%o]),d){c.audio=l[u%d];const h=c.audio.bitrate;c.video&&h&&(c.video.bitrate-=h)}n.push(c)}if(r){const u=navigator.userAgent;if(r.split(",").some(c=>qd(c))&&mv())return Promise.resolve(gv(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),n))}return Promise.all(n.map(u=>{const c=IS(u);return s[c]||(s[c]=t.decodingInfo(u))})).then(u=>({supported:!u.some(c=>!c.supported),configurations:n,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:n,decodingInfoResults:[],error:u}))}function _S(i){var e;const t=(e=i.videoCodec)==null?void 0:e.split(","),s=Ev(i),r=i.width||640,n=i.height||480,a=i.frameRate||30,o=i.videoRange.toLowerCase();return t?t.map(l=>{const d={contentType:Na(ES(l),"video"),width:r,height:n,bitrate:s,framerate:a};return o!=="sdr"&&(d.transferFunction=o),d}):[]}function AS(i,e,t){var s;const r=(s=i.audioCodec)==null?void 0:s.split(","),n=Ev(i);return r&&i.audioGroups?i.audioGroups.reduce((a,o)=>{var l;const d=o?(l=e.groups[o])==null?void 0:l.tracks:null;return d?d.reduce((u,c)=>{if(c.groupId===o){const h=parseFloat(c.channels||"");r.forEach(f=>{const m={contentType:Na(f,"audio"),bitrate:t?SS(f,n):n};h&&(m.channels=""+h),u.push(m)})}return u},a):a},[]):[]}function SS(i,e){if(e<=1)return 1;let t=128e3;return i==="ec-3"?t=768e3:i==="ac-3"&&(t=64e4),Math.min(e/2,t)}function Ev(i){return Math.ceil(Math.max(i.bitrate*.9,i.averageBitrate)/1e3)*1e3||1}function IS(i){let e="";const{audio:t,video:s}=i;if(s){const r=vc(s.contentType);e+=`${r}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(t){const r=vc(t.contentType);e+=`${s?"_":""}${r}_c${t.channels}`}return e}const Ec=["NONE","TYPE-0","TYPE-1",null];function LS(i){return Ec.indexOf(i)>-1}const cd=["SDR","PQ","HLG"];function RS(i){return!!i&&cd.indexOf(i)>-1}var Wo={No:"",Yes:"YES",v2:"v2"};function Jm(i){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=i,r=s<e/2;return e&&r?t?Wo.v2:Wo.Yes:Wo.No}class ep{constructor(e,t,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=s}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class Ua{constructor(e){if(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.supplemental=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(s=>!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const s=(t=e.supplemental)==null?void 0:t.videoCodec;s&&s!==e.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}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 tp(this._audioGroups,e)}hasSubtitleGroup(e){return tp(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t)}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.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(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function tp(i,e){return!e||!i?!1:i.indexOf(e)!==-1}function xS(){if(typeof matchMedia=="function"){const i=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(i.media!==e.media)return i.matches===!0}return!1}function kS(i,e){let t=!1,s=[];if(i&&(t=i!=="SDR",s=[i]),e){s=e.allowedVideoRanges||cd.slice(0);const r=s.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&xS(),t||(s=["SDR"])}return{preferHDR:t,allowedVideoRanges:s}}const DS=i=>{const e=new WeakSet;return(t,s)=>{if(i&&(s=i(t,s)),typeof s=="object"&&s!==null){if(e.has(s))return;e.add(s)}return s}},we=(i,e)=>JSON.stringify(i,DS(e));function CS(i,e,t,s,r){const n=Object.keys(i),a=s?.channels,o=s?.audioCodec,l=r?.videoCodec,d=a&&parseInt(a)===2;let u=!1,c=!1,h=1/0,f=1/0,m=1/0,g=1/0,p=0,E=[];const{preferHDR:b,allowedVideoRanges:y}=kS(e,r);for(let R=n.length;R--;){const x=i[n[R]];u||(u=x.channels[2]>0),h=Math.min(h,x.minHeight),f=Math.min(f,x.minFramerate),m=Math.min(m,x.minBitrate),y.filter(M=>x.videoRanges[M]>0).length>0&&(c=!0)}h=j(h)?h:0,f=j(f)?f:0;const T=Math.max(1080,h),A=Math.max(30,f);m=j(m)?m:t,t=Math.max(m,t),c||(e=void 0);const L=n.length>1;return{codecSet:n.reduce((R,x)=>{const I=i[x];if(x===R)return R;if(E=c?y.filter(M=>I.videoRanges[M]>0):[],L){if(I.minBitrate>t)return Ei(x,`min bitrate of ${I.minBitrate} > current estimate of ${t}`),R;if(!I.hasDefaultAudio)return Ei(x,"no renditions with default or auto-select sound found"),R;if(o&&x.indexOf(o.substring(0,4))%5!==0)return Ei(x,`audio codec preference "${o}" not found`),R;if(a&&!d){if(!I.channels[a])return Ei(x,`no renditions with ${a} channel sound found (channels options: ${Object.keys(I.channels)})`),R}else if((!o||d)&&u&&I.channels[2]===0)return Ei(x,"no renditions with stereo sound found"),R;if(I.minHeight>T)return Ei(x,`min resolution of ${I.minHeight} > maximum of ${T}`),R;if(I.minFramerate>A)return Ei(x,`min framerate of ${I.minFramerate} > maximum of ${A}`),R;if(!E.some(M=>I.videoRanges[M]>0))return Ei(x,`no variants with VIDEO-RANGE of ${we(E)} found`),R;if(l&&x.indexOf(l.substring(0,4))%5!==0)return Ei(x,`video codec preference "${l}" not found`),R;if(I.maxScore<p)return Ei(x,`max score of ${I.maxScore} < selected max of ${p}`),R}return R&&(dd(x)>=dd(R)||I.fragmentError>i[R].fragmentError)?R:(g=I.minIndex,p=I.maxScore,x)},void 0),videoRanges:E,preferHDR:b,minFramerate:f,minBitrate:m,minIndex:g}}function Ei(i,e){Le.log(`[abr] start candidates with "${i}" ignored because ${e}`)}function yv(i){return i.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(t);const r=t.channels||"2";return s.channels[r]=(s.channels[r]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function wS(i,e,t,s){return i.slice(t,s+1).reduce((r,n,a)=>{if(!n.codecSet)return r;const o=n.audioGroups;let l=r[n.codecSet];l||(r[n.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,n.bitrate);const d=Math.min(n.height,n.width);return l.minHeight=Math.min(l.minHeight,d),l.minFramerate=Math.min(l.minFramerate,n.frameRate),l.minIndex=Math.min(l.minIndex,a),l.maxScore=Math.max(l.maxScore,n.score),l.fragmentError+=n.fragmentError,l.videoRanges[n.videoRange]=(l.videoRanges[n.videoRange]||0)+1,o&&o.forEach(u=>{if(!u)return;const c=e.groups[u];c&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?c.hasDefault:c.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(c.channels).forEach(h=>{l.channels[h]=(l.channels[h]||0)+c.channels[h]}))}),r},{})}function ip(i){if(!i)return i;const{lang:e,assocLang:t,characteristics:s,channels:r,audioCodec:n}=i;return{lang:e,assocLang:t,characteristics:s,channels:r,audioCodec:n}}function Fi(i,e,t){if("attrs"in i){const s=e.indexOf(i);if(s!==-1)return s}for(let s=0;s<e.length;s++){const r=e[s];if(fr(i,r,t))return s}return-1}function fr(i,e,t){const{groupId:s,name:r,lang:n,assocLang:a,default:o}=i,l=i.forced;return(s===void 0||e.groupId===s)&&(r===void 0||e.name===r)&&(n===void 0||MS(n,e.lang))&&(n===void 0||e.assocLang===a)&&(o===void 0||e.default===o)&&(l===void 0||e.forced===l)&&(!("characteristics"in i)||PS(i.characteristics||"",e.characteristics))&&(t===void 0||t(i,e))}function MS(i,e="--"){return i.length===e.length?i===e:i.startsWith(e)||e.startsWith(i)}function PS(i,e=""){const t=i.split(","),s=e.split(",");return t.length===s.length&&!t.some(r=>s.indexOf(r)===-1)}function zs(i,e){const{audioCodec:t,channels:s}=i;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function OS(i,e,t,s,r){const n=e[s],o=e.reduce((h,f,m)=>{const g=f.uri;
vendor: 8,935 bytes, lines 16-26
16return(h[g]||(h[g]=[])).push(m),h},{})[n.uri];o.length>1&&(s=Math.max.apply(Math,o));const l=n.videoRange,d=n.frameRate,u=n.codecSet.substring(0,4),c=sp(e,s,h=>{if(h.videoRange!==l||h.frameRate!==d||h.codecSet.substring(0,4)!==u)return!1;const f=h.audioGroups,m=t.filter(g=>!f||f.indexOf(g.groupId)!==-1);return Fi(i,m,r)>-1});return c>-1?c:sp(e,s,h=>{const f=h.audioGroups,m=t.filter(g=>!f||f.indexOf(g.groupId)!==-1);return Fi(i,m,r)>-1})}function sp(i,e,t){for(let s=e;s>-1;s--)if(t(i[s]))return s;for(let s=e+1;s<i.length;s++)if(t(i[s]))return s;return-1}function hd(i,e){var t;return!!i&&i!==((t=e.loadLevelObj)==null?void 0:t.uri)}class NS extends ti{constructor(e){super("abr",e.logger),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.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var s;const{fragCurrent:r,partCurrent:n,hls:a}=this,{autoLevelEnabled:o,media:l}=a;if(!r||!l)return;const d=performance.now(),u=n?n.stats:r.stats,c=n?n.duration:r.duration,h=d-u.loading.start,f=a.minAutoLevel,m=r.level,g=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||m<=f){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const p=g>-1&&g!==m,E=!!t||p;if(!E&&(l.paused||!l.playbackRate||!l.readyState))return;const b=a.mainForwardBufferInfo;if(!E&&b===null)return;const y=this.bwEstimator.getEstimateTTFB(),T=Math.abs(l.playbackRate);if(h<=Math.max(y,1e3*(c/(T*2))))return;const A=b?b.len/T:0,L=u.loading.first?u.loading.first-u.loading.start:-1,S=u.loaded&&L>-1,R=this.getBwEstimate(),x=a.levels,I=x[m],M=Math.max(u.loaded,Math.round(c*(r.bitrate||I.averageBitrate)/8));let $=S?h-L:h;$<1&&S&&($=Math.min(h,u.loaded*8/R));const V=S?u.loaded*1e3/$:0,Y=y/1e3,H=V?(M-u.loaded)/V:M*8/R+Y;if(H<=A)return;const N=V?V*8:R,W=((s=t?.details||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,B=this.hls.config.abrBandWidthUpFactor;let q=Number.POSITIVE_INFINITY,J;for(J=m-1;J>f;J--){const me=x[J].maxBitrate,le=!x[J].details||W;if(q=this.getTimeToLoadFrag(Y,N,c*me,le),q<Math.min(A,c+Y))break}if(q>=H||q>c*10)return;S?this.bwEstimator.sample(h-Math.min(y,L),u.loaded):this.bwEstimator.sampleTTFB(h);const U=x[J].maxBitrate;this.getBwEstimate()*B>U&&this.resetEstimator(U);const F=this.findBestLevel(U,f,J,0,A,1,1);F>-1&&(J=F),this.warn(`Fragment ${r.sn}${n?" part "+n.index:""} of level ${m} is loading too slowly; 17 Fragment duration: ${r.duration.toFixed(3)} 18 Time to underbuffer: ${A.toFixed(3)} s 19 Estimated load time for current fragment: ${H.toFixed(3)} s 20 Estimated load time for down switch fragment: ${q.toFixed(3)} s 21 TTFB estimate: ${L|0} ms 22 Current BW estimate: ${j(R)?R|0:"Unknown"} bps 23 New BW estimate: ${this.getBwEstimate()|0} bps 24 Switching to level ${J} @ ${U|0} bps`),a.nextLoadLevel=a.nextAutoLevel=J,this.clearTimer();const re=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===J&&J>0){const me=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${J>0?"and switching down":""} 25 Fragment duration: ${r.duration.toFixed(3)} s 26 Time to underbuffer: ${me.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,J>f){let le=this.findBestLevel(this.hls.levels[f].bitrate,f,J,0,me,1,1);le===-1&&(le=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=le,this.resetEstimator(this.hls.levels[le].bitrate)}}};p||H>q*2?re():this.timer=self.setInterval(re,q*1e3),a.trigger(v.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:n,stats:u})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new HA(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.FRAG_LOADING,this.onFragLoading,this),e.on(v.FRAG_LOADED,this.onFragLoaded,this),e.on(v.FRAG_BUFFERED,this.onFragBuffered,this),e.on(v.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(v.LEVEL_LOADED,this.onLevelLoaded,this),e.on(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(v.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(v.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.FRAG_LOADING,this.onFragLoading,this),e.off(v.FRAG_LOADED,this.onFragLoaded,this),e.off(v.FRAG_BUFFERED,this.onFragBuffered,this),e.off(v.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(v.LEVEL_LOADED,this.onLevelLoaded,this),e.off(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(v.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(v.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},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){const s=t.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var r;this.fragCurrent=s,this.partCurrent=(r=t.part)!=null?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 C.BUFFER_ADD_CODEC_ERROR:case C.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case C.FRAG_LOAD_TIMEOUT:{const s=t.frag,{fragCurrent:r,partCurrent:n}=this;if(s&&r&&s.sn===r.sn&&s.level===r.level){const a=performance.now(),o=n?n.stats:s.stats,l=a-o.loading.start,d=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&d>-1){const c=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(c,d),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,s,r){const n=e+s/t,a=r?e+this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const s=this.hls.config,{loading:r}=t.stats,n=r.end-r.first;j(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:s}){const r=s?s.stats:t.stats;if(t.type===Q.MAIN&&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){const n=s?s.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+r.loaded,l=(a.loaded?a.loaded.duration:0)+n;a.loaded={bytes:o,duration:l},a.realBitrate=Math.round(8*o/l)}if(t.bitrateTest){const n={stats:r,frag:t,part:s,id:t.type};this.onFragBuffered(v.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:s,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:s.stats;if(n.aborted||this.ignoreFragment(s))return;const a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Q.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,s=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(s,t,e,0,r,1,1);if(n>-1)return n;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=s&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}
26_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this;if(s.levels.length<=1)return s.loadLevel;const{maxAutoLevel:r,config:n,minAutoLevel:a}=s,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),d=this.getStarvationDelay();let u=n.abrBandWidthFactor,c=n.abrBandWidthUpFactor;if(d){const p=this.findBestLevel(l,a,r,d,0,u,c);if(p>=0)return this.rebufferNotice=-1,p}let h=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay;if(!d){const p=this.bitrateTestDelay;p&&(h=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-p,this.info(`bitrate test took ${Math.round(1e3*p)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),u=c=1)}const f=this.findBestLevel(l,a,r,d,h,u,c);if(this.rebufferNotice!==f&&(this.rebufferNotice=f,this.info(`${d?"rebuffering expected":"buffer is empty"}, optimal quality level ${f}`)),f>-1)return f;const m=s.levels[a],g=s.loadLevelObj;return g&&m?.bitrate<g.bitrate?a:s.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const s=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/s}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,s,r,n,a,o){var l;const d=r+n,u=this.lastLoadedFragLevel,c=u===-1?this.hls.firstLevel:u,{fragCurrent:h,partCurrent:f}=this,{levels:m,allAudioTracks:g,loadLevel:p,config:E}=this.hls;if(m.length===1)return 0;const b=m[c],y=!!((l=this.hls.latestLevelDetails)!=null&&l.live),T=p===-1||u===-1;let A,L="SDR",S=b?.frameRate||0;const{audioPreference:R,videoPreference:x}=E,I=this.audioTracksByGroup||(this.audioTracksByGroup=yv(g));let M=-1;if(T){if(this.firstSelection!==-1)return this.firstSelection;const N=this.codecTiers||(this.codecTiers=wS(m,I,t,s)),W=CS(N,L,e,R,x),{codecSet:B,videoRanges:q,minFramerate:J,minBitrate:U,minIndex:F,preferHDR:re}=W;M=F,A=B,L=re?q[q.length-1]:q[0],S=J,e=Math.max(e,U),this.log(`picked start tier ${we(W)}`)}else A=b?.codecSet,L=b?.videoRange;const $=f?f.duration:h?h.duration:0,V=this.bwEstimator.getEstimateTTFB()/1e3,Y=[];for(let N=s;N>=t;N--){var H;const W=m[N],B=N>c;if(!W)continue;if(E.useMediaCapabilities&&!W.supportedResult&&!W.supportedPromise){const le=navigator.mediaCapabilities;typeof le?.decodingInfo=="function"&&TS(W,I,L,S,e,R)?(W.supportedPromise=vv(W,I,le,this.supportedCache),W.supportedPromise.then(he=>{if(!this.hls)return;W.supportedResult=he;const tt=this.hls.levels,ze=tt.indexOf(W);he.error?this.warn(`MediaCapabilities decodingInfo error: "${he.error}" for level ${ze} ${we(he)}`):he.supported?he.decodingInfoResults.some(_t=>_t.smooth===!1||_t.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${ze} not smooth or powerEfficient: ${we(he)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${ze} ${we(he)}`),ze>-1&&tt.length>1&&(this.log(`Removing unsupported level ${ze}`),this.hls.removeLevel(ze),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(he=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${he}`)})):W.supportedResult=pv}if((A&&W.codecSet!==A||L&&W.videoRange!==L||B&&S>W.frameRate||!B&&S>0&&S<W.frameRate||(H=W.supportedResult)!=null&&(H=H.decodingInfoResults)!=null&&H.some(le=>le.smooth===!1))&&(!T||N!==M)){Y.push(N);continue}const q=W.details,J=(f?q?.partTarget:q?.averagetargetduration)||$;let U;B?U=o*e:U=a*e;const F=$&&r>=$*2&&n===0?W.averageBitrate:W.maxBitrate,re=this.getTimeToLoadFrag(V,U,F*J,q===void 0);if(U>=F&&(N===u||W.loadError===0&&W.fragmentError===0)&&(re<=V||!j(re)||y&&!this.bitrateTestDelay||re<d)){const le=this.forcedAutoLevel;return N!==p&&(le===-1||le!==p)&&(Y.length&&this.trace(`Skipped level(s) ${Y.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${m[Y[0]].codecs}" ${m[Y[0]].videoRange}; not compatible with "${A}" ${L}`),this.info(`switch candidate:${c}->${N} adjustedbw(${Math.round(U)})-bitrate=${Math.round(U-F)} ttfb:${V.toFixed(1)} avgDuration:${J.toFixed(1)} maxFetchDuration:${d.toFixed(1)} fetchDuration:${re.toFixed(1)}
26 firstSelection:${T} codecSet:${W.codecSet} videoRange:${W.videoRange} hls.loadLevel:${p}`)),T&&(this.firstSelection=N),N}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls;return Math.min(Math.max(e,s),t)}}const bv={search:function(i,e){let t=0,s=i.length-1,r=null,n=null;for(;t<=s;){r=(t+s)/2|0,n=i[r];const a=e(n);if(a>0)t=r+1;else if(a<0)s=r-1;else return n}return null}};function US(i,e,t){if(e===null||!Array.isArray(i)||!i.length||!j(e))return null;const s=i[0].programDateTime;if(e<(s||0))return null;const r=i[i.length-1].endProgramDateTime;if(e>=(r||0))return null;for(let n=0;n<i.length;++n){const a=i[n];if(FS(e,t,a))return a}return null}function yr(i,e,t=0,s=0,r=.005){let n=null;if(i){n=e[1+i.sn-e[0].sn]||null;const o=i.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),n&&i.level!==n.level&&n.end<=i.end&&(n=e[2+i.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(n=e[0]);if(n&&((!i||i.level===n.level)&&rp(t,s,n)===0||$S(n,i,Math.min(r,s))))return n;const a=bv.search(e,rp.bind(null,t,s));return a&&(a!==i||!n)?a:n}function $S(i,e,t){if(e&&e.start===0&&e.level<i.level&&(e.endPTS||0)>0){const s=e.tagList.reduce((r,n)=>(n[0]==="INF"&&(r+=parseFloat(n[1])),r),t);return i.start<=s}return!1}function rp(i=0,e=0,t){if(t.start<=i&&t.start+t.duration>i)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=i?1:t.start-s>i&&t.start?-1:0}function FS(i,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>i}function Tv(i,e,t){if(i&&i.startCC<=e&&i.endCC>=e){let s=i.fragments;const{fragmentHint:r}=i;r&&(s=s.concat(r));let n;return bv.search(s,a=>a.cc<e?1:a.cc>e?-1:(n=a,a.end<=t?1:a.start>t?-1:0)),n||null}return null}function fd(i){switch(i.details){case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_TIMEOUT:case C.LEVEL_LOAD_TIMEOUT:case C.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function _v(i){return i.details.startsWith("key")}function Av(i){return _v(i)&&!!i.frag&&!i.frag.decryptdata}function np(i,e){const t=fd(e);return i.default[`${t?"timeout":"error"}Retry`]}function ef(i,e){const t=i.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*i.retryDelayMs,i.maxRetryDelayMs)}function ap(i){return Ie(Ie({},i),{errorRetry:null,timeoutRetry:null})}function md(i,e,t,s){if(!i)return!1;const r=s?.code,n=e<i.maxNumRetry&&(BS(r)||!!t);return i.shouldRetry?i.shouldRetry(i,e,t,s,n):n}function BS(i){return yc(i)||!!i&&(i<400||i>499)}function yc(i){return i===0&&navigator.onLine===!1}var pt={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},$t={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class HS extends ti{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(v.ERROR,this.onError,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(v.ERROR,this.onError,this),e.off(v.ERROR,this.onErrorOut,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===Q.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,s=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||s===-1?t.loadLevel:s}variantHasKey(e,t){if(e){var s;if((s=e.details)!=null&&s.hasKey(t))return!0;const r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(a=>r.indexOf(a.groupId)>=0).some(a=>{var o;return(o=a.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var s;if(t.fatal)return;const r=this.hls,n=t.context;switch(t.details){case C.FRAG_LOAD_ERROR:case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_ERROR:case C.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case C.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction=un();return}case C.FRAG_GAP:case C.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=pt.SendAlternateToPenaltyBox;return}case C.LEVEL_EMPTY_ERROR:case C.LEVEL_PARSING_ERROR:{var a;const l=t.parent===Q.MAIN?t.level:r.loadLevel;t.details===C.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case C.LEVEL_LOAD_ERROR:case C.LEVEL_LOAD_TIMEOUT:typeof n?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level));return;case C.AUDIO_TRACK_LOAD_ERROR:case C.AUDIO_TRACK_LOAD_TIMEOUT:case C.SUBTITLE_LOAD_ERROR:case C.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const l=r.loadLevelObj;if(l&&(n.type===fe.AUDIO_TRACK&&l.hasAudioGroup(n.groupId)||n.type===fe.SUBTITLE_TRACK&&l.hasSubtitleGroup(n.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=pt.SendAlternateToPenaltyBox,t.errorAction.flags=$t.MoveAllAlternatesMatchingHost;return}}return;case C.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:pt.SendAlternateToPenaltyBox,flags:$t.MoveAllAlternatesMatchingHDCP};return;case C.KEY_SYSTEM_SESSION_UPDATE_FAILED:case C.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case C.KEY_SYSTEM_NO_SESSION:t.errorAction={action:pt.SendAlternateToPenaltyBox,flags:$t.MoveAllAlternatesMatchingKey};return;
26case C.BUFFER_ADD_CODEC_ERROR:case C.REMUX_ALLOC_ERROR:case C.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:r.loadLevel)}return;case C.INTERNAL_EXCEPTION:case C.BUFFER_APPENDING_ERROR:case C.BUFFER_FULL_ERROR:case C.LEVEL_SWITCH_ERROR:case C.BUFFER_STALLED_ERROR:case C.BUFFER_SEEK_OVER_HOLE:case C.BUFFER_NUDGE_ON_STALL:t.errorAction=un();return}t.type===ee.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=un())}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,r=np(s.config.playlistLoadPolicy,e),n=this.playlistError++;if(md(r,n,fd(e),e.response))return{action:pt.RetryRequest,flags:$t.None,retryConfig:r,retryCount:n};const o=this.getLevelSwitchAction(e,t);return r&&(o.retryConfig=r,o.retryCount=n),o}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),r=t.levels[s],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,o=np(_v(e)?a:n,e),l=t.levels.reduce((u,c)=>u+c.fragmentError,0);if(r&&(e.details!==C.FRAG_GAP&&r.fragmentError++,!Av(e)&&md(o,l,fd(e),e.response)))return{action:pt.RetryRequest,flags:$t.None,retryConfig:o,retryCount:l};const d=this.getLevelSwitchAction(e,s);return o&&(d.retryConfig=o,d.retryCount=l),d}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const r=this.hls.levels[t];if(r){var n,a;const d=e.details;r.loadError++,d===C.BUFFER_APPEND_ERROR&&r.fragmentError++;let u=-1;const{levels:c,loadLevel:h,minAutoLevel:f,maxAutoLevel:m}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const g=(n=e.frag)==null?void 0:n.type,E=(g===Q.AUDIO&&d===C.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(d===C.BUFFER_ADD_CODEC_ERROR||d===C.BUFFER_APPEND_ERROR))&&c.some(({audioCodec:L})=>r.audioCodec!==L),y=e.sourceBufferName==="video"&&(d===C.BUFFER_ADD_CODEC_ERROR||d===C.BUFFER_APPEND_ERROR)&&c.some(({codecSet:L,audioCodec:S})=>r.codecSet!==L&&r.audioCodec===S),{type:T,groupId:A}=(a=e.context)!=null?a:{};for(let L=c.length;L--;){const S=(L+h)%c.length;if(S!==h&&S>=f&&S<=m&&c[S].loadError===0){var o,l;const R=c[S];if(d===C.FRAG_GAP&&g===Q.MAIN&&e.frag){const x=c[S].details;if(x){const I=yr(e.frag,x.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else{if(T===fe.AUDIO_TRACK&&R.hasAudioGroup(A)||T===fe.SUBTITLE_TRACK&&R.hasSubtitleGroup(A))continue;if(g===Q.AUDIO&&(o=r.audioGroups)!=null&&o.some(x=>R.hasAudioGroup(x))||g===Q.SUBTITLE&&(l=r.subtitleGroups)!=null&&l.some(x=>R.hasSubtitleGroup(x))||E&&r.audioCodec===R.audioCodec||y&&r.codecSet===R.codecSet||!E&&r.codecSet!==R.codecSet)continue}u=S;break}}if(u>-1&&s.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:pt.SendAlternateToPenaltyBox,flags:$t.None,nextAutoLevel:u}}return{action:pt.SendAlternateToPenaltyBox,flags:$t.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case pt.DoNothing:break;case pt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==C.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:r}=s,n=s.nextAutoLevel;switch(r){case $t.None:this.switchLevel(e,n);break;case $t.MoveAllAlternatesMatchingHDCP:{const l=this.getVariantLevelIndex(e.frag),d=t.levels[l],u=d?.attrs["HDCP-LEVEL"];if(s.hdcpLevel=u,u==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(u){t.maxHdcpLevel=Ec[Ec.indexOf(u)-1],s.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case $t.MoveAllAlternatesMatchingKey:{const l=e.decryptdata;if(l){const d=this.hls.levels,u=d.length;for(let h=u;h--;)if(this.variantHasKey(d[h],l)){var a,o;this.log(`Banned key found in level ${h} (${d[h].bitrate}bps) or audio group "${(a=d[h].audioGroups)==null?void 0:a.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${gt(l.keyId||[])}`),d[h].fragmentError++,d[h].loadError++,this.log(`Removing level ${h} with key error (${e.error})`),this.hls.removeLevel(h)}const c=e.frag;if(this.hls.levels.length<u)s.resolved=!0;else if(c&&c.type!==Q.MAIN){const h=c.decryptdata;h&&!l.matches(h)&&(s.resolved=!0)}}break}}s.resolved||this.switchLevel(e,n)}switchLevel(e,t){if(t!==void 0&&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,e.details===C.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const s=vc(e.mimeType),r=this.hls.levels;for(let n=r.length;n--;)r[n][`${e.sourceBufferName}Codec`]===s&&(this.log(`Removing level ${n} for ${e.details} ("${s}" not supported)`),this.hls.removeLevel(n))}}}function un(i){const e={action:pt.DoNothing,flags:$t.None};return i&&(e.resolved=!0),e}var nt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class GS{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(){const{hls:e}=this;e&&(e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.BUFFER_APPENDED,this.onBufferAppended,this),e.on(v.FRAG_BUFFERED,this.onFragBuffered,this),e.on(v.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.BUFFER_APPENDED,this.onBufferAppended,this),e.off(v.FRAG_BUFFERED,this.onFragBuffered,this),e.off(v.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const s=this.activePartLists[t];if(s)for(let r=s.length;r--;){const n=s[r];if(!n)break;if(n.start<=e&&e<=n.end&&n.loaded)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,s){const{fragments:r}=this,n=Object.keys(r);for(let a=n.length;a--;){const o=r[n[a]];if(o?.body.type===t&&(!s||o.buffered)){const l=o.body;if(l.start<=e&&e<=l.end)return l}}return null}detectEvictedFragments(e,t,s,r,n){this.timeRanges&&(this.timeRanges[e]=t);const a=r?.fragment.sn||-1;
vendor: 24,065 bytes, line 26
26Object.keys(this.fragments).forEach(o=>{const l=this.fragments[o];if(!l||a>=l.body.sn)return;if(!l.buffered&&(!l.loaded||n)){l.body.type===s&&this.removeFragment(l.body);return}const d=l.range[e];if(d){if(d.time.length===0){this.removeFragment(l.body);return}d.time.some(u=>{const c=!this.isTimeBuffered(u.startPTS,u.endPTS,t);return c&&this.removeFragment(l.body),c})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const s=e.frag,r=Rr(s),n=this.fragments[r];if(!n||n.buffered&&s.gap)return;const a=!s.relurl;Object.keys(t).forEach(o=>{const l=s.elementaryStreams[o];if(!l)return;const d=t[o],u=a||l.partial===!0;n.range[o]=this.getBufferedTimes(s,e.part,u,d)}),n.loaded=null,Object.keys(n.range).length?(this.bufferedEnd(n,s),mo(n)||this.removeParts(s.sn-1,s.type)):this.removeFragment(n.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=op(s,r=>r.fragment.sn>=e))}fragBuffered(e,t){const s=Rr(e);let r=this.fragments[s];!r&&t&&(r=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,this.bufferedEnd(r,e))}getBufferedTimes(e,t,s,r){const n={time:[],partial:s},a=e.start,o=e.end,l=e.minEndPTS||o,d=e.maxStartPTS||a;for(let u=0;u<r.length;u++){const c=r.start(u)-this.bufferPadding,h=r.end(u)+this.bufferPadding;if(d>=c&&l<=h){n.time.push({startPTS:Math.max(a,r.start(u)),endPTS:Math.min(o,r.end(u))});break}else if(a<h&&o>c){const f=Math.max(a,r.start(u)),m=Math.min(o,r.end(u));m>f&&(n.partial=!0,n.time.push({startPTS:f,endPTS:m}))}else if(o<=c)break}return n}getPartialFragment(e){let t=null,s,r,n,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(d=>{const u=l[d];u&&mo(u)&&(r=u.body.start-o,n=u.body.end+o,e>=r&&e<=n&&(s=Math.min(e-r,n-e),a<=s&&(t=u.body,a=s)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||mo(t))}getState(e){const t=Rr(e),s=this.fragments[t];return s?s.buffered?mo(s)?nt.PARTIAL:nt.OK:nt.APPENDING:nt.NOT_LOADED}isTimeBuffered(e,t,s){let r,n;for(let a=0;a<s.length;a++){if(r=s.start(a)-this.bufferPadding,n=s.end(a)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const s=t.frag,r=t.part?null:t,n=Rr(s);this.fragments[n]={body:s,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:r,timeRanges:n,type:a}=t;if(s.sn==="initSegment")return;const o=s.type;if(r){let d=this.activePartLists[o];d||(this.activePartLists[o]=d=[]),d.push(r)}this.timeRanges=n;const l=n[a];this.detectEvictedFragments(a,l,o,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Rr(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,s=Object.keys(t);if(!e)return s.length>0;for(let r=s.length;r--;){const n=t[s[r]];if(n?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==s||r&&!l.gap||l.start<t&&l.end>e&&(o.buffered||n)&&this.removeFragment(l)})}removeFragment(e){const t=Rr(e);e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const r=e.sn;this.activePartLists[e.type]=op(s,n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(s=>s.clearElementaryStreamInfo())}}function mo(i){var e,t,s;return i.buffered&&!!(i.body.gap||(e=i.range.video)!=null&&e.partial||(t=i.range.audio)!=null&&t.partial||(s=i.range.audiovideo)!=null&&s.partial)}function Rr(i){return`${i.type}_${i.level}_${i.sn}`}function op(i,e){return i.filter(t=>{const s=e(t);return s||t.clearElementaryStreamInfo(),s})}var $s={cbc:0,ctr:1};class KS{constructor(e,t,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=s}decrypt(e,t){switch(this.aesMode){case $s.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case $s.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function VS(i){const e=i.byteLength,t=e&&new DataView(i.buffer).getUint8(e-1);return t?i.slice(0,e-t):i}class WS{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){const t=new DataView(e),s=new Uint32Array(4);for(let r=0;r<4;r++)s[r]=t.getUint32(r*4);return s}initTable(){const e=this.sBox,t=this.invSBox,s=this.subMix,r=s[0],n=s[1],a=s[2],o=s[3],l=this.invSubMix,d=l[0],u=l[1],c=l[2],h=l[3],f=new Uint32Array(256);let m=0,g=0,p=0;for(p=0;p<256;p++)p<128?f[p]=p<<1:f[p]=p<<1^283;for(p=0;p<256;p++){let E=g^g<<1^g<<2^g<<3^g<<4;E=E>>>8^E&255^99,e[m]=E,t[E]=m;const b=f[m],y=f[b],T=f[y];let A=f[E]*257^E*16843008;r[m]=A<<24|A>>>8,n[m]=A<<16|A>>>16,a[m]=A<<8|A>>>24,o[m]=A,A=T*16843009^y*65537^b*257^m*16843008,d[E]=A<<24|A>>>8,u[E]=A<<16|A>>>16,c[E]=A<<8|A>>>24,h[E]=A,m?(m=b^f[f[f[T^b]]],g^=f[f[g]]):m=g=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,r=0;for(;r<t.length&&s;)s=t[r]===this.key[r],r++;if(s)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const a=this.ksRows=(n+6+1)*4;let o,l;const d=this.keySchedule=new Uint32Array(a),u=this.invKeySchedule=new Uint32Array(a),c=this.sBox,h=this.rcon,f=this.invSubMix,m=f[0],g=f[1],p=f[2],E=f[3];let b,y;for(o=0;o<a;o++){if(o<n){b=d[o]=t[o];continue}y=b,o%n===0?(y=y<<8|y>>>24,y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[y&255],y^=h[o/n|0]<<24):n>6&&o%n===4&&(y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[y&255]),d[o]=b=(d[o-n]^y)>>>0}for(l=0;l<a;l++)o=a-l,l&3?y=d[o]:y=d[o-4],l<4||o<=4?u[l]=y:u[l]=m[c[y>>>24]]^g[c[y>>>16&255]]^p[c[y>>>8&255]]^E[c[y&255]],u[l]=u[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,s){const r=this.keySize+6,n=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],d=o[1],u=o[2],c=o[3],h=this.uint8ArrayToUint32Array_(s);let f=h[0],m=h[1],g=h[2],p=h[3];const E=new Int32Array(e),b=new Int32Array(E.length);let y,T,A,L,S,R,x,I,M,$,V,Y,H,N;const W=this.networkToHostOrderSwap;for(;t<E.length;){for(M=W(E[t]),$=W(E[t+1]),V=W(E[t+2]),Y=W(E[t+3]),S=M^n[0],R=Y^n[1],x=V^n[2],I=$^n[3],H=4,N=1;N<r;N++)y=l[S>>>24]^d[R>>16&255]^u[x>>8&255]^c[I&255]^n[H],T=l[R>>>24]^d[x>>16&255]^u[I>>8&255]^c[S&255]^n[H+1],A=l[x>>>24]^d[I>>16&255]^u[S>>8&255]^c[R&255]^n[H+2],L=l[I>>>24]^d[S>>16&255]^u[R>>8&255]^c[x&255]^n[H+3],S=y,R=T,x=A,I=L,H=H+4;y=a[S>>>24]<<24^a[R>>16&255]<<16^a[x>>8&255]<<8^a[I&255]^n[H],T=a[R>>>24]<<24^a[x>>16&255]<<16^a[I>>8&255]<<8^a[S&255]^n[H+1],A=a[x>>>24]<<24^a[I>>16&255]<<16^a[S>>8&255]<<8^a[R&255]^n[H+2],L=a[I>>>24]<<24^a[S>>16&255]<<16^a[R>>8&255]<<8^a[x&255]^n[H+3],b[t]=W(y^f),b[t+1]=W(L^m),b[t+2]=W(A^g),b[t+3]=W(T^p),f=M,m=$,g=V,p=Y,t=t+4}return b.buffer}}class YS{constructor(e,t,s){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=s}expandKey(){const e=qS(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function qS(i){switch(i){case $s.cbc:return"AES-CBC";case $s.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${i}`)}}const jS=16;class tf{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.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch{}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(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const s=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?VS(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,s,r){return this.useSoftware?new Promise((n,a)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,s,r);const l=this.flush();l?n(l.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,s,r)}softwareDecrypt(e,t,s,r){const{currentIV:n,currentResult:a,remainderData:o}=this;if(r!==$s.cbc||t.byteLength!==16)return Le.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=Jt(o,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;n&&(s=n);let d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new WS),d.expandKey(t);const u=a;return this.currentResult=d.decrypt(l.buffer,0,s),this.currentIV=l.slice(-16).buffer,u||null}webCryptoDecrypt(e,t,s,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,s,r));this.key=t,this.fastAesKey=new YS(this.subtle,t,r)}return this.fastAesKey.expandKey().then(n=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new KS(this.subtle,new Uint8Array(s),r).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(Le.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,s,r)))}onWebCryptoError(e,t,s,r){const n=this.enableSoftwareAES;if(n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s,r);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(n?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%jS;return s!==e.length&&(t=e.slice(0,s),this.remainderData=e.slice(s)),t}logOnce(e){this.logEnabled&&(Le.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const lp=Math.pow(2,17);class zS{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){const s=e.url;if(!s)return Promise.reject(new ss({type:ee.NETWORK_ERROR,details:C.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(m=>m[0]==="GAP")){l(up(e));return}else e.gap=!1;const d=this.loader=n?new n(r):new a(r),u=dp(e);e.loader=d;const c=ap(r.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:lp};e.stats=d.stats;const f={onSuccess:(m,g,p,E)=>{this.resetLoader(e,d);let b=m.data;p.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(b.slice(0,16)),b=b.slice(16)),o({frag:e,part:null,payload:b,networkDetails:E})},onError:(m,g,p,E)=>{this.resetLoader(e,d),l(new ss({type:ee.NETWORK_ERROR,details:C.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Ie({url:s,data:void 0},m),error:new Error(`HTTP Error ${m.code} ${m.text}`),networkDetails:p,stats:E}))},onAbort:(m,g,p)=>{this.resetLoader(e,d),l(new ss({type:ee.NETWORK_ERROR,details:C.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:p,stats:m}))},onTimeout:(m,g,p)=>{this.resetLoader(e,d),l(new ss({type:ee.NETWORK_ERROR,details:C.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:p,stats:m}))}};t&&(f.onProgress=(m,g,p,E)=>t({frag:e,part:null,payload:p,networkDetails:E})),d.load(u,h,f)})}loadPart(e,t,s){this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(up(e,t));return}const d=this.loader=n?new n(r):new a(r),u=dp(e,t);e.loader=d;const c=ap(r.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:lp};t.stats=d.stats,d.load(u,h,{onSuccess:(f,m,g,p)=>{this.resetLoader(e,d),this.updateStatsFromPart(e,t);const E={frag:e,part:t,payload:f.data,networkDetails:p};s(E),o(E)},onError:(f,m,g,p)=>{this.resetLoader(e,d),l(new ss({type:ee.NETWORK_ERROR,details:C.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Ie({url:u.url,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:g,stats:p}))},onAbort:(f,m,g)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,d),l(new ss({type:ee.NETWORK_ERROR,details:C.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:g,stats:f}))},onTimeout:(f,m,g)=>{this.resetLoader(e,d),l(new ss({type:ee.NETWORK_ERROR,details:C.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:f}))}})})}updateStatsFromPart(e,t){const s=e.stats,r=t.stats,n=r.total;if(s.loaded+=r.loaded,n){const l=Math.round(e.duration/t.duration),d=Math.min(Math.round(s.loaded/n),l),c=(l-d)*Math.round(s.loaded/d);s.total=s.loaded+c}else s.total=Math.max(s.loaded,s.total);const a=s.loading,o=r.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function dp(i,e=null){const t=e||i,s={frag:i,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(j(r)&&j(n)){var a;let o=r,l=n;if(i.sn==="initSegment"&&QS((a=i.decryptdata)==null?void 0:a.method)){const d=n-r;d%16&&(l=n+(16-d%16)),r!==0&&(s.resetIV=!0,o=r-16)}s.rangeStart=o,s.rangeEnd=l}return s}function up(i,e){const t=new Error(`GAP ${i.gap?"tag":"attribute"} found`),s={type:ee.MEDIA_ERROR,details:C.FRAG_GAP,fatal:!1,frag:i,error:t,networkDetails:null};return e&&(s.part=e),(e||i).stats.aborted=!0,new ss(s)}function QS(i){return i==="AES-128"||i==="AES-256"}class ss extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Sv extends ti{constructor(e,t){super(e,t),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?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class sf{constructor(e,t,s,r=0,n=-1,a=!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=po(),this.buffering={audio:po(),video:po(),audiovideo:po()},this.level=e,this.sn=t,this.id=s,this.size=r,this.part=n,this.partial=a}}function po(){return{start:0,executeStart:0,executeEnd:0,end:0}}const cp={length:0,start:()=>0,end:()=>0};class oe{static isBuffered(e,t){if(e){const s=oe.getBuffered(e);for(let r=s.length;r--;)if(t>=s.start(r)&&t<=s.end(r))return!0}return!1}static bufferedRanges(e){if(e){const t=oe.getBuffered(e);return oe.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let s=0;s<e.length;s++)t.push({start:e.start(s),end:e.end(s)});return t}static bufferInfo(e,t,s){if(e){const r=oe.bufferedRanges(e);if(r.length)return oe.bufferedInfo(r,t,s)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,s){t=Math.max(0,t),e.length>1&&e.sort((u,c)=>u.start-c.start||c.end-u.end);let r=-1,n=[];if(s)for(let u=0;u<e.length;u++){t>=e[u].start&&t<=e[u].end&&(r=u);const c=n.length;if(c){const h=n[c-1].end;e[u].start-h<s?e[u].end>h&&(n[c-1].end=e[u].end):n.push(e[u])}else n.push(e[u])}else n=e;let a=0,o,l=t,d=t;for(let u=0;u<n.length;u++){const c=n[u].start,h=n[u].end;if(r===-1&&t>=c&&t<=h&&(r=u),t+s>=c&&t<h)l=c,d=h,a=d-t;else if(t+s<c){o=c;break}}return{len:a,start:l||0,end:d||0,nextStart:o,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||cp}catch(t){return Le.log("failed to get media.buffered",t),cp}}}const Iv=/\{\$([a-zA-Z0-9-_]+)\}/g;function hp(i){return Iv.test(i)}function bc(i,e){if(i.variableList!==null||i.hasVariableRefs){const t=i.variableList;return e.replace(Iv,s=>{const r=s.substring(2,s.length-1),n=t?.[r];return n===void 0?(i.playlistParsingError||(i.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),s):n})}return e}function fp(i,e,t){let s=i.variableList;s||(i.variableList=s={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(r))n=a.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(a){i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else r=e.NAME,n=e.VALUE;r in s?i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):s[r]=n||""}function XS(i,e,t){const s=e.IMPORT;if(t&&s in t){let r=i.variableList;r||(i.variableList=r={}),r[s]=t[s]}else i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}const ZS=/^(\d+)x(\d+)$/,mp=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Be{constructor(e,t){typeof e=="string"&&(e=Be.parseAttrList(e,t)),ke(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const s=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)s[r]=parseInt(t.slice(r*2,r*2+2),16);return s}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const s=this[e];return(s?s.split(/[ ,]+/):[]).reduce((r,n)=>(r[n.toLowerCase()]=!0,r),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=ZS.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let s;const r={};for(mp.lastIndex=0;(s=mp.exec(e))!==null;){const a=s[1].trim();let o=s[2];const l=o.indexOf('"')===0&&o.lastIndexOf('"')===o.length-1;let d=!1;if(l)o=o.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":d=!0}if(t&&(l||d))o=bc(t,o);else if(!d&&!l)switch(a){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":Le.warn(`${e}: attribute ${a} is missing quotes`)}r[a]=o}return r}}const JS="com.apple.hls.interstitial";function e1(i){return i!=="ID"&&i!=="CLASS"&&i!=="CUE"&&i!=="START-DATE"&&i!=="DURATION"&&i!=="END-DATE"&&i!=="END-ON-NEXT"}function t1(i){return i==="SCTE35-OUT"||i==="SCTE35-IN"||i==="SCTE35-CMD"}class Lv{constructor(e,t,s=0){var r;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(r=t?.tagOrder)!=null?r:s,t){const n=t.attr;for(const a in n)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==n[a]){Le.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=ke(new Be({}),n,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const n=t?.endDate||new Date(this.attr["END-DATE"]);j(n.getTime())&&(this._endDate=n)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(Le.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(j(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 isInterstitial(){return this.class===JS}get isValid(){return!!this.id&&!this._badValueForSameId&&j(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const i1=10;class s1{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.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!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.drift
vendor: 4,537 bytes, line 26
26StartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let s=t.decryptdata;return s||(t.setKeyFormat(e.keyFormat),s=t.decryptdata),!!s&&e.matches(s)})}get hasProgramDateTime(){return this.fragments.length?j(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||i1}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let s=e.length;s--;)if(e[s].index>t)return e[s].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function pd(i,e){return i.length===e.length?!i.some((t,s)=>t!==e[s]):!1}function pp(i,e){return!i&&!e?!0:!i||!e?!1:pd(i,e)}function cn(i){return i==="AES-128"||i==="AES-256"||i==="AES-256-CTR"}function rf(i){switch(i){case"AES-128":case"AES-256":return $s.cbc;case"AES-256-CTR":return $s.ctr;default:throw new Error(`invalid full segment method ${i}`)}}function nf(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0))}function Tc(i){return Uint8Array.from(unescape(encodeURIComponent(i)),e=>e.charCodeAt(0))}function r1(i){const e=Tc(i).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Rv(i){const e=function(s,r,n){const a=s[r];s[r]=s[n],s[n]=a};e(i,0,3),e(i,1,2),e(i,4,5),e(i,6,7)}function xv(i){const e=i.split(":");let t=null;if(e[0]==="data"&&e.length===2){const s=e[1].split(";"),r=s[s.length-1].split(",");if(r.length===2){const n=r[0]==="base64",a=r[1];n?(s.splice(-1,1),t=nf(a)):t=r1(a)}}return t}const gd=typeof self<"u"?self:void 0;var He={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},vt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Yo(i){switch(i){case vt.FAIRPLAY:return He.FAIRPLAY;case vt.PLAYREADY:return He.PLAYREADY;case vt.WIDEVINE:return He.WIDEVINE;case vt.CLEARKEY:return He.CLEARKEY}}function Lu(i){switch(i){case He.FAIRPLAY:return vt.FAIRPLAY;case He.PLAYREADY:return vt.PLAYREADY;case He.WIDEVINE:return vt.WIDEVINE;case He.CLEARKEY:return vt.CLEARKEY}}function Qn(i){const{drmSystems:e,widevineLicenseUrl:t}=i,s=e?[He.FAIRPLAY,He.WIDEVINE,He.PLAYREADY,He.CLEARKEY].filter(r=>!!e[r]):[];return!s[He.WIDEVINE]&&t&&s.push(He.WIDEVINE),s}const kv=(function(i){return gd!=null&&(i=gd.navigator)!=null&&i.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function n1(i,e,t,s){let r;switch(i){case He.FAIRPLAY:r=["cenc","sinf"];break;case He.WIDEVINE:case He.PLAYREADY:r=["cenc"];break;case He.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${i}`)}return a1(r,e,t,s)}function a1(i,e,t,s){return[{initDataTypes:i,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs=${n}
26`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs=${n}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function o1(i){var e;return!!i&&(i.sessionType==="persistent-license"||!!((e=i.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function Dv(i){const e=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),s=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(a){const o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(o){const l=nf(o).subarray(0,16);return Rv(l),l}}return null}let xr={};class Os{static clearKeyUriToKeyIdMap(){xr={}}static setKeyIdForUri(e,t){xr[e]=t}static addKeyIdForUri(e){const t=Object.keys(xr).length%Number.MAX_SAFE_INTEGER,s=new Uint8Array(16);return new DataView(s.buffer,12,4).setUint32(0,t),xr[e]=s,s}constructor(e,t,s,r=[1],n=null,a){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.pssh=null,this.method=e,this.uri=t,this.keyFormat=s,this.keyFormatVersions=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!cn(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(rv(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&pd(e.keyFormatVersions,this.keyFormatVersions)&&pp(e.iv,this.iv)&&pp(e.keyId,this.keyId)}isSupported(){if(this.method){if(cn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case vt.FAIRPLAY:case vt.WIDEVINE:case vt.PLAYREADY:case vt.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(cn(this.method)){let n=this.iv;return n||(typeof e!="number"&&(Le.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),n=d1(e)),new Os(this.method,this.uri,"identity",this.keyFormatVersions,n)}if(this.keyId){const n=xr[this.uri];if(n&&!pd(this.keyId,n)&&Os.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const s=xv(this.uri);if(s)switch(this.keyFormat){case vt.WIDEVINE:if(this.pssh=s,!this.keyId){const n=hS(s.buffer);if(n.length){var r;const a=n[0];this.keyId=(r=a.kids)!=null&&r.length?a.kids[0]:null}}this.keyId||(this.keyId=gp(t));break;case vt.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=cS(n,null,s),this.keyId=Dv(s);break}default:{let n=s.subarray(0,16);if(n.length!==16){const a=new Uint8Array(16);a.set(n,16-n.length),n=a}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n;n=l1(t),n||(n=gp(t),n||(n=xr[this.uri])),n&&(this.keyId=n,Os.setKeyIdForUri(this.uri,n))}return this}}function l1(i){const e=i?.[vt.WIDEVINE];return e?e.keyId:null}function gp(i){const e=i?.[vt.PLAYREADY];if(e){const t=xv(e.uri);if(t)return Dv(t)}return null}function d1(i){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=i>>8*(15-t)&255;return e}const vp=/#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,Ep=/#EXT-X-MEDIA:(.*)/g,u1=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ru=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),c1=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|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 Bi{static findGroup(e,t){for(let s=0;s<e.length;s++){const r=e[s];if(r.id===t)return r}}static resolve(e,t){return zh.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return u1.test(e)}static parseMasterPlaylist(e,t){const s=hp(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},n=[];if(vp.lastIndex=0,!e.startsWith("#EXTM3U"))return r.playlistParsingError=new Error("no EXTM3U delimiter"),r;let a;for(;(a=vp.exec(e))!=null;)if(a[1]){var o;const d=new Be(a[1],r),u=bc(r,a[2]),c={attrs:d,bitrate:d.decimalInteger("BANDWIDTH")||d.decimalInteger("AVERAGE-BANDWIDTH"),name:d.NAME,url:Bi.resolve(u,t)},h=d.decimalResolution("RESOLUTION");h&&(c.width=h.width,c.height=h.height),Tp(d.CODECS,c);const f=d["SUPPLEMENTAL-CODECS"];f&&(c.supplemental={},Tp(f,c.supplemental)),(o=c.unknownCodecs)!=null&&o.length||n.push(c),r.levels.push(c)}else if(a[3]){const d=a[3],u=a[4];switch(d){case"SESSION-DATA":{const c=new Be(u,r),h=c["DATA-ID"];h&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[h]=c);break}case"SESSION-KEY":{const c=yp(u,t,r);c.encrypted&&c.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(c)):Le.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const c=new Be(u,r);fp(r,c,t)}break}case"CONTENT-STEERING":{const c=new Be(u,r);r.contentSteering={uri:Bi.resolve(c["SERVER-URI"],t),pathwayId:c["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=bp(u);break}}}const l=n.length>0&&n.length<r.levels.length;return r.levels=l?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,s){let r;const n={},a=s.levels,o={AUDIO:a.map(d=>({id:d.attrs.AUDIO,audioCodec:d.audioCodec})),SUBTITLES:a.map(d=>({id:d.attrs.SUBTITLES,textCodec:d.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(Ep.lastIndex=0;(r=Ep.exec(e))!==null;){const d=new Be(r[1],s),u=d.TYPE;if(u){const c=o[u],h=n[u]||[];n[u]=h;
vendor: 9,395 bytes, line 26
26const f=d.LANGUAGE,m=d["ASSOC-LANGUAGE"],g=d.CHANNELS,p=d.CHARACTERISTICS,E=d["INSTREAM-ID"],b={attrs:d,bitrate:0,id:l++,groupId:d["GROUP-ID"]||"",name:d.NAME||f||"",type:u,default:d.bool("DEFAULT"),autoselect:d.bool("AUTOSELECT"),forced:d.bool("FORCED"),lang:f,url:d.URI?Bi.resolve(d.URI,t):""};if(m&&(b.assocLang=m),g&&(b.channels=g),p&&(b.characteristics=p),E&&(b.instreamId=E),c!=null&&c.length){const y=Bi.findGroup(c,b.groupId)||c[0];_p(b,y,"audioCodec"),_p(b,y,"textCodec")}h.push(b)}}return n}static parseLevelPlaylist(e,t,s,r,n,a){var o;const l={url:t},d=new s1(t),u=d.fragments,c=[];let h=null,f=0,m=0,g=0,p=0,E=0,b=null,y=new Au(r,l),T,A,L,S=-1,R=!1,x=null,I;if(Ru.lastIndex=0,d.m3u8=e,d.hasVariableRefs=hp(e),((o=Ru.exec(e))==null?void 0:o[0])!=="#EXTM3U")return d.playlistParsingError=new Error("Missing format identifier #EXTM3U"),d;for(;(T=Ru.exec(e))!==null;){R&&(R=!1,y=new Au(r,l),y.playlistOffset=g,y.setStart(g),y.sn=f,y.cc=p,E&&(y.bitrate=E),y.level=s,h&&(y.initSegment=h,h.rawProgramDateTime&&(y.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null),x&&(y.setByteRange(x),x=null)));const Y=T[1];if(Y){y.duration=parseFloat(Y);const H=(" "+T[2]).slice(1);y.title=H||null,y.tagList.push(H?["INF",Y,H]:["INF",Y])}else if(T[3]){if(j(y.duration)){y.playlistOffset=g,y.setStart(g),L&&Sp(y,L,d),y.sn=f,y.level=s,y.cc=p,u.push(y);const H=(" "+T[3]).slice(1);y.relurl=bc(d,H),_c(y,b,c),b=y,g+=y.duration,f++,m=0,R=!0}}else{if(T=T[0].match(c1),!T){Le.warn("No matches on slow regex match for level playlist!");continue}for(A=1;A<T.length&&T[A]===void 0;A++);const H=(" "+T[A]).slice(1),N=(" "+T[A+1]).slice(1),W=T[A+2]?(" "+T[A+2]).slice(1):null;switch(H){case"BYTERANGE":b?y.setByteRange(N,b):y.setByteRange(N);break;case"PROGRAM-DATE-TIME":y.rawProgramDateTime=N,y.tagList.push(["PROGRAM-DATE-TIME",N]),S===-1&&(S=u.length);break;case"PLAYLIST-TYPE":d.type&&Qi(d,H,T),d.type=N.toUpperCase();break;case"MEDIA-SEQUENCE":d.startSN!==0?Qi(d,H,T):u.length>0&&Ip(d,H,T),f=d.startSN=parseInt(N);break;case"SKIP":{d.skippedSegments&&Qi(d,H,T);const B=new Be(N,d),q=B.decimalInteger("SKIPPED-SEGMENTS");if(j(q)){d.skippedSegments+=q;for(let U=q;U--;)u.push(null);f+=q}const J=B.enumeratedString("RECENTLY-REMOVED-DATERANGES");J&&(d.recentlyRemovedDateranges=(d.recentlyRemovedDateranges||[]).concat(J.split(" ")));break}case"TARGETDURATION":d.targetduration!==0&&Qi(d,H,T),d.targetduration=Math.max(parseInt(N),1);break;case"VERSION":d.version!==null&&Qi(d,H,T),d.version=parseInt(N);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":d.live||Qi(d,H,T),d.live=!1;break;case"#":(N||W)&&y.tagList.push(W?[N,W]:[N]);break;case"DISCONTINUITY":p++,y.tagList.push(["DIS"]);break;case"GAP":y.gap=!0,y.tagList.push([H]);break;case"BITRATE":y.tagList.push([H,N]),E=parseInt(N)*1e3,j(E)?y.bitrate=E:E=0;break;case"DATERANGE":{const B=new Be(N,d),q=new Lv(B,d.dateRanges[B.ID],d.dateRangeTagCount);d.dateRangeTagCount++,q.isValid||d.skippedSegments?d.dateRanges[q.id]=q:Le.warn(`Ignoring invalid DATERANGE tag: "${N}"`),y.tagList.push(["EXT-X-DATERANGE",N]);break}case"DEFINE":{{const B=new Be(N,d);"IMPORT"in B?XS(d,B,a):fp(d,B,t)}break}case"DISCONTINUITY-SEQUENCE":d.startCC!==0?Qi(d,H,T):u.length>0&&Ip(d,H,T),d.startCC=p=parseInt(N);break;case"KEY":{const B=yp(N,t,d);if(B.isSupported()){if(B.method==="NONE"){L=void 0;break}L||(L={});const q=L[B.keyFormat];q!=null&&q.matches(B)||(q&&(L=ke({},L)),L[B.keyFormat]=B)}else Le.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${N}"`);break}case"START":d.startTimeOffset=bp(N);break;case"MAP":{const B=new Be(N,d);if(y.duration){const q=new Au(r,l);Ap(q,B,s,L),h=q,y.initSegment=h,h.rawProgramDateTime&&!y.rawProgramDateTime&&(y.rawProgramDateTime=h.rawProgramDateTime)}else{const q=y.byteRangeEndOffset;if(q){const J=y.byteRangeStartOffset;x=`${q-J}@${J}`}else x=null;Ap(y,B,s,L),h=y,R=!0}h.cc=p;break}case"SERVER-CONTROL":{I&&Qi(d,H,T),I=new Be(N),d.canBlockReload=I.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=I.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&I.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=I.optionalFloat("PART-HOLD-BACK",0),d.holdBack=I.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{d.partTarget&&Qi(d,H,T);const B=new Be(N);d.partTarget=B.decimalFloatingPoint("PART-TARGET");break}case"PART":{let B=d.partList;B||(B=d.partList=[]);const q=m>0?B[B.length-1]:void 0,J=m++,U=new Be(N,d),F=new XA(U,y,l,J,q);B.push(F),y.duration+=F.duration;break}case"PRELOAD-HINT":{const B=new Be(N,d);d.preloadHint=B;break}case"RENDITION-REPORT":{const B=new Be(N,d);d.renditionReports=d.renditionReports||[],d.renditionReports.push(B);break}default:Le.warn(`line parsed but not handled: ${T}`);break}}}b&&!b.relurl?(u.pop(),g-=b.duration,d.partList&&(d.fragmentHint=b)):d.partList&&(_c(y,b,c),y.cc=p,d.fragmentHint=y,L&&Sp(y,L,d)),d.targetduration||(d.playlistParsingError=new Error("Missing Target Duration"));const M=u.length,$=u[0],V=u[M-1];if(g+=d.skippedSegments*d.targetduration,g>0&&M&&V){d.averagetargetduration=g/M;const Y=V.sn;d.endSN=Y!=="initSegment"?Y:0,d.live||(V.endList=!0),S>0&&(f1(u,S),$&&c.unshift($))}return d.fragmentHint&&(g+=d.fragmentHint.duration),d.totalduration=g,c.length&&d.dateRangeTagCount&&$&&Cv(c,d),d.endCC=p,d}}function Cv(i,e){let t=i.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];i.push(o),t++}else return;const s=i[t-1],r=e.live?1/0:e.totalduration,n=Object.keys(e.dateRanges);for(let o=n.length;o--;){const l=e.dateRanges[n[o]],d=l.startDate.getTime();l.tagAnchor=s.ref;for(let u=t;u--;){var a;if(((a=i[u])==null?void 0:a.sn)<e.startSN)break;const c=h1(e,d,i,u,r);if(c!==-1){l.tagAnchor=e.fragments[c].ref;break}}}}function h1(i,e,t,s,r){const n=t[s];if(n){const o=n.programDateTime;if(e>=o||s===0){var a;const l=(((a=t[s+1])==null?void 0:a.start)||r)-n.start;if(e<=o+l*1e3){const d=t[s].sn-i.startSN;if(d<0)return-1;const u=i.fragments;if(u.length>t.length){const h=(t[s+1]||u[u.length-1]).sn-i.startSN;for(let f=h;f>d;f--){const m=u[f].programDateTime;if(e>=m&&e<m+u[f].duration*1e3)return f}}return d}}}return-1}function yp(i,e,t){var s,r;const n=new Be(i,t),a=(s=n.METHOD)!=null?s:"",o=n.URI,l=n.hexadecimalInteger("IV"),d=n.KEYFORMATVERSIONS,u=(r=n.KEYFORMAT)!=null?r:"identity";o&&n.IV&&!l&&Le.error(`Invalid IV: ${n.IV}`);const c=o?Bi.resolve(o,e):"",h=(d||"1").split("/").map(Number).filter(Number.isFinite);return new Os(a,c,u,h,l,n.KEYID)}function bp(i){const t=new Be(i).decimalFloatingPoint("TIME-OFFSET");return j(t)?t:null}function Tp(i,e){let t=(i||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const r=t.filter(n=>Zh(n,s));r.length&&(e[`${s}Codec`]=r.map(n=>n.split("/")[0]).join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function _p(i,e,t){const s=e[t];s&&(i[t]=s)}function f1(i,e){let t=i[e];for(let s=e;s--;){const r=i[s];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function _c(i,e,t){i.rawProgramDateTime?t.push(i):e!=null&&e.programDateTime&&(i.programDateTime=e.endProgramDateTime)}function Ap(i,e,t,s){i.relurl=e.URI,e.BYTERANGE&&i.setByteRange(e.BYTERANGE),i.level=t,i.sn="initSegment",s&&(i.levelkeys=s),i.initSegment=null}function Sp(i,e,t){i.levelkeys=e;const{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&s.push(i)}function Qi(i,e,t){i.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function Ip(i,e,t){i.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function xu(i,e){const t=e.startPTS;if(j(t)){let s=0,r;e.sn>i.sn?(s=t-i.start,r=i):(s=i.start-t,r=e),r.duration!==s&&r.setDuration(s)}else e.sn>i.sn?i.cc===e.cc&&i.minEndPTS?e.setStart(i.start+(i.minEndPTS-i.start)):e.setStart(i.start+i.duration):e.setStart(Math.max(i.start-e.duration,0))}function wv(i,e,t,s,r,n,a){s-t<=0&&(a.warn("Fragment should have a positive duration",e),s=t+e.duration,n=r+e.duration);let l=t,d=s;const u=e.startPTS,c=e.endPTS;if(j(u)){const E=Math.abs(u-t);i&&E>i.totalduration?a.warn(`media timestamps and playlist times differ by ${E}s for level ${e.level} ${i.url}`):j(e.deltaPTS)?e.deltaPTS=Math.max(E,e.deltaPTS):e.deltaPTS=E,l=Math.max(t,u),t=Math.min(t,u),r=e.startDTS!==void 0?Math.min(r,e.startDTS):r,d=Math.min(s,c),s=Math.max(s,c),n=e.endDTS!==void 0?Math.max(n,e.endDTS):n}const h=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(s-e.start),e.startPTS=t,e.maxStartPTS=l,e.startDTS=r,e.endPTS=s,e.minEndPTS=d,e.endDTS=n;const f=e.sn;if(!i||f<i.startSN||f>i.endSN)return 0;let m;const g=f-i.startSN,p=i.fragments;for(p[g]=e,m=g;m>0;m--)xu(p[m],p[m-1]);for(m=g;m<p.length-1;m++)xu(p[m],p[m+1]);return i.fragmentHint&&xu(p[p.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,h}function m1(i,e,t){if(i===e)return;let s=null;const r=i.fragments;for(let u=r.length-1;u>=0;u--){const c=r[u].initSegment;if(c){s=c;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;let n;v1(i,e,(u,c,h,f)=>{if((!e.startCC||e.skippedSegments)&&c.cc!==u.cc){const m=u.cc-c.cc;for(let g=h;g<f.length;g++)f[g].cc+=m;e.endCC=f[f.length-1].cc}j(u.startPTS)&&j(u.endPTS)&&(c.setStart(c.startPTS=u.startPTS),c.startDTS=u.startDTS,c.maxStartPTS=u.maxStartPTS,c.endPTS=u.endPTS,c.endDTS=u.endDTS,c.minEndPTS=u.minEndPTS,c.setDuration(u.endPTS-u.startPTS),c.duration&&(n=c),e.PTSKnown=e.alignedSliding=!0),u.hasStream
26s&&(c.elementaryStreams=u.elementaryStreams),c.loader=u.loader,u.hasStats&&(c.stats=u.stats),u.initSegment&&(c.initSegment=u.initSegment,s=u.initSegment)});const a=e.fragments,o=e.fragmentHint?a.concat(e.fragmentHint):a;if(s&&o.forEach(u=>{var c;u&&(!u.initSegment||u.initSegment.relurl===((c=s)==null?void 0:c.relurl))&&(u.initSegment=s)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(u=>!u),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let u=e.skippedSegments;u--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=p1(i.dateRanges,e,t));const u=i.fragments.filter(c=>c.rawProgramDateTime);if(i.hasProgramDateTime&&!e.hasProgramDateTime)for(let c=1;c<o.length;c++)o[c].programDateTime===null&&_c(o[c],o[c-1],u);Cv(u,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var l;const u=Ov(i,e.startSN-1);e.startCC=(l=u?.cc)!=null?l:a[0].cc}g1(i.partList,e.partList,(u,c)=>{c.elementaryStreams=u.elementaryStreams,c.stats=u.stats}),n?wv(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS,t):Mv(i,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=i.driftStartTime,e.driftStart=i.driftStart;const d=e.advancedDateTime;if(e.advanced&&d){const u=e.edge;e.driftStart||(e.driftStartTime=d,e.driftStart=u),e.driftEndTime=d,e.driftEnd=u}else e.driftEndTime=i.driftEndTime,e.driftEnd=i.driftEnd,e.advancedDateTime=i.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=i.requestScheduled)}function p1(i,e,t){const{dateRanges:s,recentlyRemovedDateranges:r}=e,n=ke({},i);r&&r.forEach(l=>{delete n[l]});const o=Object.keys(n).length;return o?(Object.keys(s).forEach(l=>{const d=n[l],u=new Lv(s[l].attr,d);u.isValid?(n[l]=u,d||(u.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${we(s[l].attr)}"`)}),n):s}function g1(i,e,t){if(i&&e){let s=0;for(let r=0,n=i.length;r<=n;r++){const a=i[r],o=e[r+s];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):s--}}}function v1(i,e,t){const s=e.skippedSegments,r=Math.max(i.startSN,e.startSN)-e.startSN,n=(i.fragmentHint?1:0)+(s?e.endSN:Math.min(i.endSN,e.endSN))-e.startSN,a=e.startSN-i.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments;for(let d=r;d<=n;d++){const u=l[a+d];let c=o[d];if(s&&!c&&u&&(c=e.fragments[d]=u),u&&c){t(u,c,d,o);const h=u.relurl,f=c.relurl;if(h&&E1(h,f)){e.playlistParsingError=Lp(`media sequence mismatch ${c.sn}:`,i,e,u,c);return}else if(u.cc!==c.cc){e.playlistParsingError=Lp(`discontinuity sequence mismatch (${u.cc}!=${c.cc})`,i,e,u,c);return}}}}function Lp(i,e,t,s,r){return new Error(`${i} ${r.url} 27Playlist starting @${e.startSN} 28${e.m3u8} 29 30Playlist starting @${t.startSN} 31${t.m3u8}`)}function Mv(i,e,t=!0){const s=e.startSN+e.skippedSegments-i.startSN,r=i.fragments,n=s>=0;let a=0;if(n&&s<r.length)a=r[s].start;else if(n&&e.startSN===i.endSN+1)a=i.fragmentEnd;else if(n&&t)a=i.fragmentStart+s*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)a=i.fragmentStart;else return;Ac(e,a)}function Ac(i,e){if(e){const t=i.fragments;for(let s=i.skippedSegments;s<t.length;s++)t[s].addStart(e);i.fragmentHint&&i.fragmentHint.addStart(e)}}function Pv(i,e=1/0){let t=1e3*i.targetduration;if(i.updated){const s=i.fragments;if(s.length&&t*4>e){const n=s[s.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function Ov(i,e,t){if(!i)return null;let s=i.fragments[e-i.startSN];return s||(s=i.fragmentHint,s&&s.sn===e)?s:e<i.startSN&&t&&t.sn===e?t:null}function Rp(i,e,t){return i?Nv(i.partList,e,t):null}function Nv(i,e,t){if(i)for(let s=i.length;s--;){const r=i[s];if(r.index===t&&r.fragment.sn===e)return r}return null}function Uv(i){i.forEach((e,t)=>{var s;(s=e.details)==null||s.fragments.forEach(r=>{r.level=t,r.initSegment&&(r.initSegment.level=t)})})}function E1(i,e){return i!==e&&e?xp(i)!==xp(e):!1}function xp(i){return i.replace(/\?[^?]*$/,"")}function ba(i,e){for(let s=0,r=i.length;s<r;s++){var t;if(((t=i[s])==null?void 0:t.cc)===e)return i[s]}return null}function y1(i,e){return!!(i&&e.startCC<i.endCC&&e.endCC>i.startCC)}function kp(i,e){const t=i.start+e;i.startPTS=t,i.setStart(t),i.endPTS=t+i.duration}function $v(i,e){const t=e.fragments;for(let s=0,r=t.length;s<r;s++)kp(t[s],i);e.fragmentHint&&kp(e.fragmentHint,i),e.alignedSliding=!0}function b1(i,e){i&&(Fv(e,i),e.alignedSliding||vd(e,i),!e.alignedSliding&&!e.skippedSegments&&Mv(i,e,!1))}function Fv(i,e){if(!y1(e,i))return;const t=Math.min(e.endCC,i.endCC),s=ba(e.fragments,t),r=ba(i.fragments,t);
31if(!s||!r)return;Le.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const n=s.start-r.start;$v(n,i)}function vd(i,e){if(!i.hasProgramDateTime||!e.hasProgramDateTime)return;const t=i.fragments,s=e.fragments;if(!t.length||!s.length)return;let r,n;const a=Math.min(e.endCC,i.endCC);e.startCC<a&&i.startCC<a&&(r=ba(s,a),n=ba(t,a)),(!r||!n)&&(r=s[Math.floor(s.length/2)],n=ba(t,r.cc)||t[Math.floor(t.length/2)]);const o=r.programDateTime,l=n.programDateTime;if(!o||!l)return;const d=(l-o)/1e3-(n.start-r.start);$v(d,i)}function St(i,e,t){xt(i,e,t),i.addEventListener(e,t)}function xt(i,e,t){i.removeEventListener(e,t)}const T1={toString:function(i){let e="";const t=i.length;for(let s=0;s<t;s++)e+=`[${i.start(s).toFixed(3)}-${i.end(s).toFixed(3)}]`;return e}},P={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class af extends Sv{constructor(e,t,s,r,n){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=P.STOPPED,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.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.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:a,fragCurrent:o,media:l,mediaBuffer:d,state:u}=this,c=l?l.currentTime:0,h=oe.bufferInfo(d||l,c,a.maxBufferHole),f=!h.len;if(this.log(`Media seeking to ${j(c)?c.toFixed(3):c}, state: ${u}, ${f?"out of":"in"} buffer`),this.state===P.ENDED)this.resetLoadingState();else if(o){const m=a.maxFragLookUpTolerance,g=o.start-m,p=o.start+o.duration+m;if(f||p<h.start||g>h.end){const E=c>p;(c<g||E)&&(E&&o.loader&&(this.log(`Cancelling fragment load for seek (sn: ${o.sn})`),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(l){this.fragmentTracker.removeFragmentsInRange(c,1/0,this.playlistType,!0);const m=this.lastCurrentTime;if(c>m&&(this.lastCurrentTime=c),!this.loadingParts){const g=Math.max(h.end,c),p=this.shouldLoadParts(this.getLevelDetails(),g);p&&(this.log(`LL-Part loading ON after seeking to ${c.toFixed(2)} with buffer @${g.toFixed(2)}`),this.loadingParts=p)}}this.hls.hasEnoughToStart||(this.log(`Setting ${f?"startPosition":"nextLoadPosition"} to ${c} for seek without enough to start`),this.nextLoadPosition=c,f&&(this.startPosition=c)),f&&this.state===P.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=n,this.hls=e,this.fragmentLoader=new zS(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new tf(e.config)}registerListeners(){const{hls:e}=this;
vendor: 5,642 bytes, line 31
31e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(v.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(v.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===P.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=P.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const s=e.end||0,r=this.config.timelineOffset||0;if(s<=r)return!1;const n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=oe.bufferedInfo(n,e.start,0));const a=e.nextStart;if(a&&a>r&&a<t.edge||this.media.currentTime<e.start)return!1;const l=t.partList;if(l!=null&&l.length){const u=l[l.length-1];return oe.isBuffered(this.media,u.start+u.duration/2)}const d=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(d)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const s=this.media=this.mediaBuffer=t.media;St(s,"seeking",this.onMediaSeeking),St(s,"ended",this.onMediaEnded);const r=this.config;this.levels&&r.autoStartLoad&&this.state===P.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){const s=!!t.transferMedia,r=this.media;if(r!==null){if(r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),xt(r,"seeking",this.onMediaSeeking),xt(r,"ended",this.onMediaEnded),this.keyLoader&&!s&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,s){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=P.STOPPED,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,s){this.startFragRequested=!0,this._loadFragForPlayback(e,t,s)}_loadFragForPlayback(e,t,s){const r=n=>{const a=n.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${n.part?" part: "+n.part.index:""} of ${this.fragInfo(a,!1,n.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,s,r).then(n=>{if(!n)return;const a=this.state,o=n.frag;if(this.fragContextChanged(o)){(a===P.FRAG_LOADING||!this.fragCurrent&&a===P.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=P.IDLE);return}"payload"in n&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(v.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===P.STOPPED||this.state===P.ERROR||(this.warn(`Frag error: ${n?.message||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===nt.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&s.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===nt.PARTIAL&&s.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const 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)}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,s=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:s};this.hls.trigger(v.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{const r=s?.frag;if(!r||this.fragContextChanged(r)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:r}=this,{frag:n,payload:a}=s,o=n.decryptdata;if(a&&a.byteLength>0&&o!=null&&o.key&&o.iv&&cn(o.method)){const l=self.performance.now();
31return this.decrypter.decrypt(new Uint8Array(a),o.key.buffer,o.iv.buffer,rf(o.method)).catch(d=>{throw r.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:n}),d}).then(d=>{const u=self.performance.now();return r.trigger(v.FRAG_DECRYPTED,{frag:n,payload:d,stats:{tstart:l,tdecrypt:u}}),s.payload=d,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===P.STOPPED||this.state===P.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const s=e.frag.stats;this.state!==P.STOPPED&&(this.state=P.IDLE),e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var s,r;const n=e.tracks;if(n&&!t.encrypted&&((s=n.audio)!=null&&s.encrypted||(r=n.video)!=null&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(o.message),!a||a.mediaKeys?!1:(this.hls.trigger(v.ERROR,{type:ee.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${s?T1.toString(oe.getBuffered(s)):"(detached)"})`),je(e)){var r;if(e.type!==Q.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=P.IDLE;return}}const n=(r=this.levels)==null?void 0:r[e.level];n!=null&&n.fragmentError&&(this.log(`Resetting level fragment error count of ${n.fragmentError} on frag buffered`),n.fragmentError=0)}this.state=P.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:r,partsLoaded:n}=e,a=!n||n.length===0||n.some(l=>!l),o=new sf(s.level,s.sn,s.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,r){var n;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=P.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(h=>{if(!this.fragContextChanged(h.frag))return this.hls.trigger(v.KEY_LOADED,h),this.state===P.KEY_LOADING&&(this.state=P.IDLE),h}),this.hls.trigger(v.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const l=this.fragPrevious;if(je(e)&&(!l||e.sn!==l.sn)){const h=this.shouldLoadParts(t.details,e.end);h!==this.loadingParts&&(this.log(`LL-Part loading ${h?"ON":"OFF"} loading sn ${l?.sn}->${e.sn}`),this.loadingParts=h)}if(s=Math.max(e.start,s||0),this.loadingParts&&je(e)){const h=a.partList;if(h&&r){s>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const f=this.getNextPart(h,e,s);if(f>-1){const m=h[f];e=this.fragCurrent=m.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${m.index} (${f}/${h.length-1}) of ${this.fragInfo(e,!1,m)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=m.start+m.duration,this.state=P.FRAG_LOADING;let g;return o?g=o.then(p=>!p||this.fragContextChanged(p.frag)?null:this.doFragPartsLoad(e,m,t,r)).catch(p=>this.handleFragLoadError(p)):g=this.doFragPartsLoad(e,m,t,r).catch(p=>this.handleFragLoadError(p)),this.hls.trigger(v.FRAG_LOADING,{frag:e,part:m,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):g}else if(!e.url||this.loadedEndOfParts(h,s))return Promise.resolve(null)}}if(je(e)&&this.loadingParts){var d;this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(d=a.partList)==null?void 0:d.filter(h=>h.loaded).map(h=>`[${h.start}-${h.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(s.toFixed(3))}`),j(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=P.FRAG_LOADING;const u=this.config.progressive&&e.type!==Q.SUBTITLE;let c;return u&&o?c=o.then(h=>!h||this.fragContextChanged(h.frag)?null:this.fragmentLoader.load(e,r)).catch(h=>
vendor: 5,391 bytes, line 31
31this.handleFragLoadError(h)):c=Promise.all([this.fragmentLoader.load(e,u?r:void 0),o]).then(([h])=>(!u&&r&&r(h),h)).catch(h=>this.handleFragLoadError(h)),this.hls.trigger(v.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,s,r){return new Promise((n,a)=>{var o;const l=[],d=(o=s.details)==null?void 0:o.partList,u=c=>{this.fragmentLoader.loadPart(e,c,r).then(h=>{l[c.index]=h;const f=h.part;this.hls.trigger(v.FRAG_LOADED,h);const m=Rp(s.details,e.sn,c.index+1)||Nv(d,e.sn,c.index+1);if(m)u(m);else return n({frag:e,part:f,partsLoaded:l})}).catch(a)};u(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===C.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===ee.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(v.ERROR,t)}else this.hls.trigger(v.ERROR,{type:ee.OTHER_ERROR,details:C.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==P.PARSING){!this.fragCurrent&&this.state!==P.STOPPED&&this.state!==P.ERROR&&(this.state=P.IDLE);return}const{frag:s,part:r,level:n}=t,a=self.performance.now();s.stats.parsing.end=a,r&&(r.stats.parsing.end=a);const o=this.getLevelDetails(),d=o&&s.sn>o.endSN||this.shouldLoadParts(o,s.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=d),this.updateLevelTiming(s,r,n,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var s;const n=e.partList[0];if(n.fragment.type===Q.SUBTITLE)return!1;const a=n.end+(((s=e.fragmentHint)==null?void 0:s.duration)||0);if(t>=a){var r;if((this.hls.hasEnoughToStart?((r=this.media)==null?void 0:r.currentTime)||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:r,sn:n,part:a}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;const o=t[r],l=o.details,d=a>-1?Rp(l,n,a):null,u=d?d.fragment:Ov(l,n,s);return u?(s&&s!==u&&(u.stats=s.stats),{frag:u,part:d,level:o}):null}bufferFragmentData(e,t,s,r,n){if(this.state!==P.PARSING)return;const{data1:a,data2:o}=e;let l=a;if(o&&(l=Jt(a,o)),!l.length)return;const d=this.initPTS[t.cc],u=d?-d.baseTime/d.timescale:void 0,c={type:e.type,frag:t,part:s,chunkMeta:r,offset:u,parent:t.type,data:l};if(this.hls.trigger(v.BUFFER_APPENDING,c),e.dropped&&e.independent&&!s){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!oe.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,r=oe.bufferInfo(t,s,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),o=Math.max(Math.min(e.start-a,r.end-a),s+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var s;const r=this.getLoadPosition();if(!j(r))return null;const a=this.lastCurrentTime>r||(s=this.media)!=null&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,a)}getFwdBufferInfoAtPos(e,t,s,r){const n=oe.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,s);if(a&&(n.nextStart<=a.end||a.gap)){const o=Math.max(Math.min(n.nextStart,a.end)-t,r);return oe.bufferInfo(e,t,o)}}return n}getMaxBufferLength(e){const{config:t}=this;let s;return e?s=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):s=t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const s=this.config,r=Math.max(Math.min(e-t,s.maxBufferLength),t),n=Math.max(e-t*3,s.maxMaxBufferLength/2,r);return n>=r?(s.maxMaxBufferLength=n,this.warn(`Reduce max buffer length to ${n}s`),!0):!1}getAppendedFrag(e,t=Q.MAIN){const s=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return s&&"fragment"in s?s.fragment:s}getNextFragment(e,t){const s=t.fragments,r=s.length;if(!r)return null;const{config:n}=this,a=s[0].start,o=n.lowLatencyMode&&!!t.partList;let l=null;if(t.live){const c=n.initialLiveManifestSize;if(r<c)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${c})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){var d;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),l=this.getInitialLiveFragment(t);const h=this.hls.startPosition,f=this.hls.liveSyncPosition,m=l?(h!==-1&&h>=a?h:f)||l.start:e;this.log(`Setting startPosition to ${m} to match start frag at live edge. mainStart: ${h} liveSyncPosition: ${f} frag.start: ${(d=l)==null?void 0:d.start}`),this.startPosition=this.nextLoadPosition=m}}else e<=a&&(l=s[0]);if(!l){const c=this.loadingParts?t.partEnd:t.fragmentEnd;l=this.getFragmentAtPosition(e,c,t)}let u=this.filterReplacedPrimary(l,t);if(!u&&l){const c=l.sn-t.startSN;u=this.filterReplacedPrimary(s[c+1]||null,t)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return(s===nt.OK||s===nt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,r,n){let a=null;
31if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&s.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,r,0);if(o!==null&&s.len+o.len>=n){const l=a.sn;return this.loopSn!==l&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${l}`),this.loopSn=l),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(Dp(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Dp(this.config)&&e.type!==Q.SUBTITLE){const s=this.hls.interstitialsManager,r=s?.bufferingItem;if(r){const a=r.event;if(a){if(a.appendInPlace||Math.abs(e.start-r.start)>1||r.start===0)return null}else if(e.end<=r.start&&t?.live===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}const n=s?.playerQueue;if(n)for(let a=n.length;a--;){const o=n[a].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let r=-1,n=!1,a=!0;for(let o=0,l=e.length;o<l;o++){const d=e[o];if(a=a&&!d.independent,r>-1&&s<d.start)break;const u=d.loaded;u?r=-1:(n||(d.independent||a)&&d.fragment===t)&&(d.fragment!==t&&this.warn(`Need buffer at ${s} but next unloaded part starts at ${d.start}`),r=o),n=u}return r}loadedEndOfParts(e,t){let s;for(let r=e.length;r--;){if(s=e[r],!s.loaded)return!1;if(t>s.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,s=this.fragPrevious;let r=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),r=US(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=s.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];s.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=Tv(e,s.cc,s.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,s){const{config:r}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=s;const{fragmentHint:l}=s,{maxFragLookUpTolerance:d}=r,u=s.partList,c=!!(this.loadingParts&&u!=null&&u.length&&l);c&&!this.bitrateTest&&u[u.length-1].fragment.sn===l.sn&&(a=a.concat(l),o=l.sn);let h;if(e<t){var f;const g=e<this.lastCurrentTime||e>t-d||(f=this.media)!=null&&f.paused||!this.startFragRequested?0:d;h=yr(n,a,e,g)}else h=a[a.length-1];if(h){const m=h.sn-s.startSN,g=this.fragmentTracker.getState(h);if((g===nt.OK||g===nt.PARTIAL&&h.gap)&&(n=h),n&&h.sn===n.sn&&(!c||u[0].fragment.sn>h.sn||!s.live)&&h.level===n.level){const E=a[m+1];h.sn<o&&this.fragmentTracker.getState(E)!==nt.OK?h=E:h=null}}return h}alignPlaylists(e,t,s){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const n=e.fragmentStart,a=!t,o=e.alignedSliding&&j(n);if(a||!o&&!n){b1(s,e);const l=e.fragmentStart;return this.log(`Live playlist sliding: ${l.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${r}`),l}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;s<t&&(s=-1);const r=this.timelineOffset;if(s===-1){const n=this.startTimeOffset!==null,a=n?this.startTimeOffset:e.startTimeOffset;a!==null&&j(a)?(s=t+a,a<0&&(s+=e.edge),s=Math.min(Math.max(t,s),t+e.totalduration),this.log(`Setting startPosition to ${s} for start time offset ${a} found in ${n?"multivariant":"media"} playlist`),this.startPosition=s):e.live?(s=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${s}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=s=0),this.lastCurrentTime=s+r}this.nextLoadPosition=s+r}getLoadPosition(){var e;const{media:t}=this;let s=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?s=t.currentTime:this.nextLoadPosition>=0&&(s=this.nextLoadPosition),s}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&je(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==P.FRAG_LOADING_WAITING_RETRY)&&(this.state=P.IDLE)}onFragmentOrKeyLoadError(e,t){var s;if(t.chunkMeta&&!t.frag){const E=this.getCurrentContext(t.chunkMeta);E&&(t.frag=E.frag)}const r=t.frag;if(!r||r.type!==e||!this.levels)return;if(this.fragContextChanged(r)){var n;this.warn(`Frag load error must match current frag to retry ${r.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const a=t.details===C.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(r,!0);const o=t.errorAction;if(!o){this.state=P.ERROR;return}const{action:l,flags:d,retryCount:u=0,retryConfig:c}
31=o,h=!!c,f=h&&l===pt.RetryRequest,m=h&&!o.resolved&&d===$t.MoveAllAlternatesMatchingHost,g=(s=this.hls.latestLevelDetails)==null?void 0:s.live;if(!f&&m&&je(r)&&!r.endList&&g&&!Av(t))this.resetFragmentErrors(e),this.treatAsGap(r),o.resolved=!0;else if((f||m)&&u<c.maxNumRetry){var p;const E=yc((p=t.response)==null?void 0:p.code),b=ef(c,u);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+b,this.state=P.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,E){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${r.sn} of ${e} ${r.level} errored with ${t.details}, retrying loading ${u+1}/${c.maxNumRetry} in ${b}ms`)}else if(c)if(this.resetFragmentErrors(e),u<c.maxNumRetry)!a&&l!==pt.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${u})`);return}else l===pt.SendAlternateToPenaltyBox?this.state=P.WAITING_LEVEL:this.state=P.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,s=t===1/0;(!t||e>=t||s&&!yc(0))&&(s&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=P.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===P.PARSING||this.state===P.PARSED){const t=e.frag,s=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,s),n=r&&r.len>.5;n&&this.reduceMaxBufferLength(r.len,t?.duration||10);const a=!n;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${s} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===Q.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==P.STOPPED&&(this.state=P.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const r=oe.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,s),this.state===P.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==P.STOPPED&&(this.state=P.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,r){const n=s.details;if(!n){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,d)=>{const u=e.elementaryStreams[d];if(u){const c=u.endPTS-u.startPTS;if(c<=0)return this.warn(`Could not parse fragment ${e.sn} ${d} duration reliably (${c})`),l||!1;const h=r?0:wv(n,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS,this);return this.hls.trigger(v.LEVEL_PTS_UPDATED,{details:n,level:s,drift:h,type:d,frag:e,start:u.startPTS,end:u.endPTS}),!0}return l},!1)){var o;const l=((o=this.transmuxer)==null?void 0:o.error)===null;if((s.fragmentError===0||l&&(s.fragmentError<2||e.endList))&&this.treatAsGap(e,s),l){const d=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(d.message),this.hls.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!1,error:d,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=P.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(v.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===Q.MAIN?"level":"track"}fragInfo(e,t=!0,s){var r,n;return`${this.playlistLabel()} ${e.level} (${s?"part":"frag"}:[${((r=t&&!s?e.startPTS:(s||e).start)!=null?r:NaN).toFixed(3)}-${((n=t&&!s?e.endPTS:(s||e).end)!=null?n:NaN).toFixed(3)}]${s&&e.type==="main"?"INDEPENDENT="+(s.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function Dp(i){return!!i.interstitialsController&&i.enableInterstitialPlayback!==!1}class Bv{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let s;if(e.length)e.length===1?s=e[0]:s=_1(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function _1(i,e){const t=new Uint8Array(e);let s=0;for(let r=0;r<i.length;r++){const n=i[r];t.set(n,s),s+=n.length}return t}var ku={exports:{}},Cp;function A1(){return Cp||(Cp=1,(function(i){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function r(l,d,u){this.fn=l,this.context=d,this.once=u||!1}function n(l,d,u,c,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new r(u,c||l,h),m=t?t+d:d;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],f]:l._events[m].push(f):(l._events[m]=f,l._eventsCount++),l}function a(l,d){--l._eventsCount===0?l._events=new s:delete l._events[d]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var d=[],u,c;if(this._eventsCount===0)return d;for(c in u=this._events)e.call(u,c)&&d.push(t?c.slice(1):c);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},o.prototype.listeners=function(d){var u=t?t+d:d,c=this._events[u];if(!c)return[];
vendor: 51,143 bytes, line 31
31if(c.fn)return[c.fn];for(var h=0,f=c.length,m=new Array(f);h<f;h++)m[h]=c[h].fn;return m},o.prototype.listenerCount=function(d){var u=t?t+d:d,c=this._events[u];return c?c.fn?1:c.length:0},o.prototype.emit=function(d,u,c,h,f,m){var g=t?t+d:d;if(!this._events[g])return!1;var p=this._events[g],E=arguments.length,b,y;if(p.fn){switch(p.once&&this.removeListener(d,p.fn,void 0,!0),E){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,u),!0;case 3:return p.fn.call(p.context,u,c),!0;case 4:return p.fn.call(p.context,u,c,h),!0;case 5:return p.fn.call(p.context,u,c,h,f),!0;case 6:return p.fn.call(p.context,u,c,h,f,m),!0}for(y=1,b=new Array(E-1);y<E;y++)b[y-1]=arguments[y];p.fn.apply(p.context,b)}else{var T=p.length,A;for(y=0;y<T;y++)switch(p[y].once&&this.removeListener(d,p[y].fn,void 0,!0),E){case 1:p[y].fn.call(p[y].context);break;case 2:p[y].fn.call(p[y].context,u);break;case 3:p[y].fn.call(p[y].context,u,c);break;case 4:p[y].fn.call(p[y].context,u,c,h);break;default:if(!b)for(A=1,b=new Array(E-1);A<E;A++)b[A-1]=arguments[A];p[y].fn.apply(p[y].context,b)}}return!0},o.prototype.on=function(d,u,c){return n(this,d,u,c,!1)},o.prototype.once=function(d,u,c){return n(this,d,u,c,!0)},o.prototype.removeListener=function(d,u,c,h){var f=t?t+d:d;if(!this._events[f])return this;if(!u)return a(this,f),this;var m=this._events[f];if(m.fn)m.fn===u&&(!h||m.once)&&(!c||m.context===c)&&a(this,f);else{for(var g=0,p=[],E=m.length;g<E;g++)(m[g].fn!==u||h&&!m[g].once||c&&m[g].context!==c)&&p.push(m[g]);p.length?this._events[f]=p.length===1?p[0]:p:a(this,f)}return this},o.prototype.removeAllListeners=function(d){var u;return d?(u=t?t+d:d,this._events[u]&&a(this,u)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,i.exports=o})(ku)),ku.exports}var S1=A1(),of=zA(S1);const $a="1.6.15",Sn={};function I1(){return typeof __HLS_WORKER_BUNDLE__=="function"}function L1(){const i=Sn[$a];if(i)return i.clientCount++,i;const 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),r={worker:new self.Worker(t),objectURL:t,clientCount:1};return Sn[$a]=r,r}function R1(i){const e=Sn[i];if(e)return e.clientCount++,e;const t=new self.URL(i,self.location.href).href,r={worker:new self.Worker(t),scriptURL:t,clientCount:1};return Sn[i]=r,r}function x1(i){const e=Sn[i||$a];if(e&&e.clientCount--===1){const{worker:s,objectURL:r}=e;delete Sn[i||$a],r&&self.URL.revokeObjectURL(r),s.terminate()}}function Hv(i,e){return e+10<=i.length&&i[e]===51&&i[e+1]===68&&i[e+2]===73&&i[e+3]<255&&i[e+4]<255&&i[e+6]<128&&i[e+7]<128&&i[e+8]<128&&i[e+9]<128}function lf(i,e){return e+10<=i.length&&i[e]===73&&i[e+1]===68&&i[e+2]===51&&i[e+3]<255&&i[e+4]<255&&i[e+6]<128&&i[e+7]<128&&i[e+8]<128&&i[e+9]<128}function jd(i,e){let t=0;return t=(i[e]&127)<<21,t|=(i[e+1]&127)<<14,t|=(i[e+2]&127)<<7,t|=i[e+3]&127,t}function Fa(i,e){const t=e;let s=0;for(;lf(i,e);){s+=10;const r=jd(i,e+6);s+=r,Hv(i,e+10)&&(s+=10),e+=s}if(s>0)return i.subarray(t,t+s)}function k1(i,e,t,s){const r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],n=e[t+2],a=n>>2&15;if(a>12){const f=new Error(`invalid ADTS sampling index:${a}`);i.emit(v.ERROR,v.ERROR,{type:ee.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!0,error:f,reason:f.message});return}const o=(n>>6&3)+1,l=e[t+3]>>6&3|(n&1)<<2,d="mp4a.40."+o,u=r[a];let c=a;(o===5||o===29)&&(c-=3);const h=[o<<3|(c&14)>>1,(c&1)<<7|l<<3];return Le.log(`manifest codec:${s}, parsed codec:${d}, channels:${l}, rate:${u} (ADTS object type:${o} sampling index:${a})`),{config:h,samplerate:u,channelCount:l,codec:d,parsedCodec:d,manifestCodec:s}}function Gv(i,e){return i[e]===255&&(i[e+1]&246)===240}function Kv(i,e){return i[e+1]&1?7:9}function df(i,e){return(i[e+3]&3)<<11|i[e+4]<<3|(i[e+5]&224)>>>5}function D1(i,e){return e+5<i.length}function Ed(i,e){return e+1<i.length&&Gv(i,e)}function C1(i,e){return D1(i,e)&&Gv(i,e)&&df(i,e)<=i.length-e}function w1(i,e){if(Ed(i,e)){const t=Kv(i,e);if(e+t>=i.length)return!1;const s=df(i,e);if(s<=t)return!1;const r=e+s;return r===i.length||Ed(i,r)}return!1}function Vv(i,e,t,s,r){if(!i.samplerate){const n=k1(e,t,s,r);if(!n)return;ke(i,n)}}function Wv(i){return 1024*9e4/i}function M1(i,e){const t=Kv(i,e);if(e+t<=i.length){const s=df(i,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function Yv(i,e,t,s,r){const n=Wv(i.samplerate),a=s+r*n,o=M1(e,t);let l;if(o){const{frameLength:c,headerLength:h}=o,f=h+c,m=Math.max(0,t+f-e.length);m?(l=new Uint8Array(f-h),l.set(e.subarray(t+h,e.length),0)):l=e.subarray(t+h,t+f);const g={unit:l,pts:a};return m||i.samples.push(g),{sample:g,length:f,missing:m}}const d=e.length-t;return l=new Uint8Array(d),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:a},length:d,missing:-1}}function P1(i,e){return lf(i,e)&&jd(i,e+6)+10<=i.length-e}function O1(i){return i instanceof ArrayBuffer?i:i.byteOffset==0&&i.byteLength==i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer}function Du(i,e=0,t=1/0){return N1(i,e,t,Uint8Array)}function N1(i,e,t,s){const r=U1(i);let n=1;"BYTES_PER_ELEMENT"in s&&(n=s.BYTES_PER_ELEMENT);const a=$1(i)?i.byteOffset:0,o=(a+i.byteLength)/n,l=(a+e)/n,d=Math.floor(Math.max(0,Math.min(l,o))),u=Math.floor(Math.min(d+Math.max(t,0),o));return new s(r,d,u-d)}function U1(i){return i instanceof ArrayBuffer?i:i.buffer}function $1(i){return i&&i.buffer instanceof ArrayBuffer&&i.byteLength!==void 0&&i.byteOffset!==void 0}function F1(i){const e={key:i.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(i.size<2)return;if(i.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const s=i.data.subarray(1).indexOf(0);if(s===-1)return;const r=Kt(Du(i.data,1,s)),n=i.data[2+s],a=i.data.subarray(3+s).indexOf(0);if(a===-1)return;const o=Kt(Du(i.data,3+s,a));let l;return r==="-->"?l=Kt(Du(i.data,4+s+a)):l=O1(i.data.subarray(4+s+a)),e.mimeType=r,e.pictureType=n,e.description=o,e.data=l,e}function B1(i){if(i.size<2)return;const e=Kt(i.data,!0),t=new Uint8Array(i.data.subarray(e.length+1));return{key:i.type,info:e,data:t.buffer}}function H1(i){if(i.size<2)return;if(i.type==="TXXX"){let t=1;const s=Kt(i.data.subarray(t),!0);t+=s.length+1;const r=Kt(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=Kt(i.data.subarray(1));return{key:i.type,info:"",data:e}}function G1(i){if(i.type==="WXXX"){if(i.size<2)return;let t=1;const s=Kt(i.data.subarray(t),!0);t+=s.length+1;const r=Kt(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=Kt(i.data);return{key:i.type,info:"",data:e}}function K1(i){return i.type==="PRIV"?B1(i):i.type[0]==="W"?G1(i):i.type==="APIC"?F1(i):H1(i)}function V1(i){const e=String.fromCharCode(i[0],i[1],i[2],i[3]),t=jd(i,4),s=10;return{type:e,size:t,data:i.subarray(s,s+t)}}const go=10,W1=10;function qv(i){let e=0;const t=[];for(;lf(i,e);){const s=jd(i,e+6);i[e+5]>>6&1&&(e+=go),e+=go;const r=e+s;for(;e+W1<r;){const n=V1(i.subarray(e)),a=K1(n);a&&t.push(a),e+=n.size+go}Hv(i,e)&&(e+=go)}return t}function jv(i){return i&&i.key==="PRIV"&&i.info==="com.apple.streaming.transportStreamTimestamp"}function Y1(i){if(i.data.byteLength===8){const e=new Uint8Array(i.data),t=e[3]&1;let s=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return s/=45,t&&(s+=4772185884e-2),Math.round(s)}}function uf(i){const e=qv(i);for(let t=0;t<e.length;t++){const s=e[t];if(jv(s))return Y1(s)}}let Gt=(function(i){return i.audioId3="org.id3",i.dateRange="com.apple.quicktime.HLS",i.emsg="https://aomedia.org/emsg/ID3",i.misbklv="urn:misb:KLV:bin:1910.1",i})({});function Ni(i="",e=9e4){return{type:i,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class cf{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,s,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,s){}demux(e,t){this.cachedData&&(e=Jt(this.cachedData,e),this.cachedData=null);let s=Fa(e,0),r=s?s.length:0,n;const a=this._audioTrack,o=this._id3Track,l=s?uf(s):void 0,d=e.length;for((this.basePTS===null||this.frameIndex===0&&j(l))&&(this.basePTS=q1(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Gt.audioId3,duration:Number.POSITIVE_INFINITY});r<d;){if(this.canParse(e,r)){const u=this.appendFrame(a,e,r);u?(this.frameIndex++,this.lastPTS=u.sample.pts,r+=u.length,n=r):r=d}else P1(e,r)?(s=Fa(e,r),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Gt.audioId3,duration:Number.POSITIVE_INFINITY}),r+=s.length,n=r):r++;if(r===d&&n!==d){const u=e.slice(n);this.cachedData?this.cachedData=Jt(this.cachedData,u):this.cachedData=u}}return{audioTrack:a,videoTrack:Ni(),id3Track:o,textTrack:Ni()}}demuxSampleAes(e,t,s){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Ni(),id3Track:this._id3Track,textTrack:Ni()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const q1=(i,e,t)=>{if(j(i))return i*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};let vo=null;const j1=[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],z1=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Q1=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],X1=[0,1,1,4];function zv(i,e,t,s,r){if(t+24>e.length)return;const n=Qv(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,o=s+r*a,l={unit:e.subarray(t,t+n.frameLength),pts:o,dts:o};return i.config=[],i.channelCount=n.channelCount,i.samplerate=n.sampleRate,i.samples.push(l),{sample:l,length:n.frameLength,missing:0}}}function Qv(i,e){const t=i[e+1]>>3&3,s=i[e+1]>>1&3,r=i[e+2]>>4&15,n=i[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const a=i[e+2]>>1&1,o=i[e+3]>>6,l=t===3?3-s:s===3?3:4,d=j1[l*14+r-1]*1e3,c=z1[(t===3?0:t===2?1:2)*3+n],h=o===3?1:2,f=Q1[t][s],m=X1[s],g=f*8*m,p=Math.floor(f*d/c+a)*m;if(vo===null){const y=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);vo=y?parseInt(y[1]):0}return vo&&vo<=87&&s===2&&d>=224e3&&o===0&&(i[e+3]=i[e+3]|128),{sampleRate:c,channelCount:h,frameLength:p,samplesPerFrame:g}}}function hf(i,e){return i[e]===255&&(i[e+1]&224)===224&&(i[e+1]&6)!==0}function Xv(i,e){return e+1<i.length&&hf(i,e)}function Z1(i,e){return hf(i,e)&&4<=i.length-e}function Zv(i,e){if(e+1<i.length&&hf(i,e)){const s=Qv(i,e);let r=4;s!=null&&s.frameLength&&(r=s.frameLength);const n=e+r;return n===i.length||Xv(i,n)}return!1}class J1 extends cf{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,s,r){super.resetInitSegment(e,t,s,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,t){if(!e)return!1;const s=Fa(e,0);let r=s?.length||0;if(Zv(e,r))return!1;for(let n=e.length;r<n;r++)if(w1(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return C1(e,t)}appendFrame(e,t,s){Vv(e,this.observer,t,s,e.manifestCodec);const r=Yv(e,t,s,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Jv=(i,e)=>{let t=0,s=5;e+=s;const r=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=i[e];const o=Math.min(s,8),l=8-o;n[0]=4278190080>>>24+l<<l,r[0]=(a[0]&n[0])>>l,t=t?t<<o|r[0]:r[0],e+=1,s-=o}return t};class eI extends cf{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,s,r){super.resetInitSegment(e,t,s,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,s){const r=eE(e,t,s,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=Fa(e,0);if(!t)return!1;const s=t.length;return e[s]===11&&e[s+1]===119&&uf(t)!==void 0&&Jv(e,s)<16}}function eE(i,e,t,s,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const o=[48e3,44100,32e3][n],l=e[t+4]&63,u=[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][l*3+n]*2;if(t+u>e.length)return-1;const c=e[t+6]>>5;let h=0;c===2?h+=2:(c&1&&c!==1&&(h+=2),c&4&&(h+=2));const f=(e[t+6]<<8|e[t+7])>>12-h&1,g=[2,1,2,3,3,4,4,5][c]+f,p=e[t+5]>>3,E=e[t+5]&7,b=new Uint8Array([n<<6|p<<1|E>>2,(E&3)<<6|c<<3|f<<2|l>>4,l<<4&224]),y=1536/o*9e4,T=s+r*y,A=e.subarray(t,t+u);return i.config=b,i.channelCount=g,i.samplerate=o,i.samples.push({unit:A,pts:T}),u}class tI extends cf{resetInitSegment(e,t,s,r){super.resetInitSegment(e,t,s,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;const t=Fa(e,0);let s=t?.length||0;if(t&&e[s]===11&&e[s+1]===119&&uf(t)!==void 0&&Jv(e,s)<=16)return!1;for(let r=e.length;s<r;s++)if(Zv(e,s))return Le.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Z1(e,t)}appendFrame(e,t,s){if(this.basePTS!==null)return zv(e,t,s,this.basePTS,this.frameIndex)}}const iI=/\/emsg[-/]ID3/i;class sI{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,s,r){const n=this.videoTrack=Ni("video",1),a=this.audioTrack=Ni("audio",1),o=this.txtTrack=Ni("text",1);if(this.id3Track=Ni("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=uv(e);if(l.video){const{id:d,timescale:u,codec:c,supplemental:h}=l.video;n.id=d,n.timescale=o.timescale=u,n.codec=c,n.supplemental=h}if(l.audio){const{id:d,timescale:u,codec:c}=l.audio;a.id=d,a.timescale=u,a.codec=c}o.id=ov.text,n.sampleDuration=0,n.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return eS(e)}demux(e,t){this.timeOffset=t;let s=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=Jt(this.remainderData,e));const o=oS(s);this.remainderData=o.remainder,r.samples=o.valid||new Uint8Array}else r.samples=s;const a=this.extractID3Track(r,t);return n.samples=zm(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,s=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return s.samples=zm(e,t),{videoTrack:t,audioTrack:Ni(),id3Track:r,textTrack:Ni()}}extractID3Track(e,t){const s=this.id3Track;if(e.samples.length){const r=ce(e.samples,["emsg"]);r&&r.forEach(n=>{const a=dS(n);if(iI.test(a.schemeIdUri)){const o=wp(a,t);let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const d=a.payload;s.samples.push({data:d,len:d.byteLength,dts:o,pts:o,type:Gt.emsg,duration:l})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=wp(a,t);s.samples.push({data:a.payload,len:a.payload.byteLength,dts:o,pts:o,type:Gt.misbklv,duration:Number.POSITIVE_INFINITY})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function wp(i,e){return j(i.presentationTime)?i.presentationTime/i.timeScale:e+i.presentationTimeDelta/i.timeScale}class rI{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new tf(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,$s.cbc)}decryptAacSample(e,t,s){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);r.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)}).catch(s)}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)s.set(e.subarray(n,n+16),r);return s}getAvcDecryptedUnit(e,t){const s=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(s.subarray(r,r+16),n);return e}decryptAvcSample(e,t,s,r,n){const a=fv(n.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(l=>{n.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,r)}).catch(r)}decryptAvcSamples(e,t,s,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(s>=n.length);s++){const a=n[s];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,s,r,a),!this.decrypter.isSync()))return}}}}class tE{constructor(){this.VideoSample=null}createVideoSample(e,t,s){return{key:e,frame:!1,pts:t,dts:s,units:[],length:0}}getLastNalUnit(e){var t;let s=this.VideoSample,r;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){const n=s.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const s=t.samples,r=s.length;if(r){const n=s[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,s){const r=t.byteLength;let n=e.naluState||0;const a=n,o=[];let l=0,d,u,c,h=-1,f=0;for(n===-1&&(h=0,f=this.getNALuType(t,0),n=0,l=1);l<r;){if(d=t[l++],!n){n=d?0:1;continue}if(n===1){n=d?0:2;continue}if(!d)n=3;else if(d===1){if(u=l-n-1,h>=0){const m={data:t.subarray(h,u),type:f};o.push(m)}else{const m=this.getLastNalUnit(e.samples);m&&(a&&l<=4-a&&m.state&&(m.data=m.data.subarray(0,m.data.byteLength-a)),u>0&&(m.data=Jt(m.data,t.subarray(0,u)),m.state=0))}l<r?(c=this.getNALuType(t,l),h=l,f=c,n=0):n=-1}else n=0}if(h>=0&&n>=0){const m={data:t.subarray(h,r),type:f,state:n};o.push(m)}if(o.length===0){const m=this.getLastNalUnit(e.samples);m&&(m.data=Jt(m.data,t))}return e.naluState=n,o}}class Ta{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(){const e=this.data,t=this.bytesAvailable,s=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(s,s+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,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);const s=this.word>>>32-t;if(e>32&&Le.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 new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?s<<t|this.readBits(t):s}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>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(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class nI extends tE{parsePES(e,t,s,r){const n=this.parseNALu(e,s.data,r);let a=this.VideoSample,o,l=!1;s.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),n.forEach(d=>{var u,c;switch(d.type){case 1:{let g=!1;o=!0;const p=d.data;if(l&&p.length>4){const E=this.readSliceType(p);(E===2||E===4||E===7||E===9)&&(g=!0)}if(g){var h;(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.frame=!0,a.key=g;break}case 5:o=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 6:{o=!0,Xh(d.data,1,s.pts,t.samples);break}case 7:{var f,m;o=!0,l=!0;const g=d.data,p=this.readSPS(g);if(!e.sps||e.width!==p.width||e.height!==p.height||((f=e.pixelRatio)==null?void 0:f[0])!==p.pixelRatio[0]||((m=e.pixelRatio)==null?void 0:m[1])!==p.pixelRatio[1]){e.width=p.width,e.height=p.height,e.pixelRatio=p.pixelRatio,e.sps=[g];const E=g.subarray(1,4);let b="avc1.";for(let y=0;y<3;y++){let T=E[y].toString(16);T.length<2&&(T="0"+T),b+=T}e.codec=b}break}case 8:o=!0,e.pps=[d.data];break;case 9:o=!0,e.audFound=!0,(c=a)!=null&&c.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;case 12:o=!0;break;default:o=!1;break}a&&o&&a.units.push(d)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Ta(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let s=8,r=8,n;for(let a=0;a<e;a++)r!==0&&(n=t.readEG(),r=(s+n+256)%256),s=r===0?s:r}readSPS(e){const t=new Ta(e);let s=0,r=0,n=0,a=0,o,l,d;const u=t.readUByte.bind(t),c=t.readBits.bind(t),h=t.readUEG.bind(t),f=t.readBoolean.bind(t),m=t.skipBits.bind(t),g=t.skipEG.bind(t),p=t.skipUEG.bind(t),E=this.skipScalingList.bind(this);u();const b=u();if(c(5),m(3),u(),p(),b===100||b===110||b===122||b===244||b===44||b===83||b===86||b===118||b===128){const R=h();if(R===3&&m(1),p(),p(),m(1),f())for(l=R!==3?8:12,d=0;d<l;d++)f()&&(d<6?E(16,t):E(64,t))}p();const y=h();if(y===0)h();else if(y===1)for(m(1),g(),g(),o=h(),d=0;d<o;d++)g();p(),m(1);const T=h(),A=h(),L=c(1);L===0&&m(1),m(1),f()&&(s=h(),r=h(),n=h(),a=h());let S=[1,1];if(f()&&f())switch(u()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:{S=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((T+1)*16-s*2-r*2),height:(2-L)*(A+1)*16-(L?2:4)*(n+a),pixelRatio:S}}}class aI extends tE{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,s,r){const n=this.parseNALu(e,s.data,r);let a=this.VideoSample,o,l=!1;s.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),n.forEach(d=>{var u,c;switch(d.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),a.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,l){var h;(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:o=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 39:o=!0,Xh(d.data,2,s.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=ke(e.params,this.readVPS(d.data)),this.initVPS=d.data),e.vps=[d.data];break;case 33:if(o=!0,l=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],d.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const f=this.readSPS(d.data);e.width=f.width,e.height=f.height,e.pixelRatio=f.pixelRatio,e.codec=f.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const m in f.params)e.params[m]=f.params[m]}this.pushParameterSet(e.sps,d.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const f=this.readPPS(d.data);for(const m in f)e.params[m]=f[m]}this.pushParameterSet(e.pps,d.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(c=a)!=null&&c.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;default:o=!1;break}a&&o&&a.units.push(d)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,s){(s&&s[0]===this.initVPS||!s&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let s=0;for(let r=0;r<e.byteLength;r++)r>=2&&e[r]===3&&e[r-1]===0&&e[r-2]===0||(t[s]=e[r],s++);return new Uint8Array(t.buffer,0,s)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Ta(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const s=t.readBits(3),r=t.readBoolean();return{numTemporalLayers:s+1,temporalIdNested:r}}readSPS(e){const t=new Ta(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const s=t.readBits(3);t.readBoolean();const r=t.readBits(2),n=t.readBoolean(),a=t.readBits(5),o=t.readUByte(),l=t.readUByte(),d=t.readUByte(),u=t.readUByte(),c=t.readUByte(),h=t.readUByte(),f=t.readUByte(),m=t.readUByte(),g=t.readUByte(),p=t.readUByte(),E=t.readUByte(),b=[],y=[];for(let ge=0;ge<s;ge++)b.push(t.readBoolean()),y.push(t.readBoolean());if(s>0)for(let ge=s;ge<8;ge++)t.readBits(2);for(let ge=0;ge<s;ge++)b[ge]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),y[ge]&&t.readUByte();t.readUEG();const T=t.readUEG();T==3&&t.skipBits(1);const A=t.readUEG(),L=t.readUEG(),S=t.readBoolean();let R=0,x=0,I=0,M=0;S&&(R+=t.readUEG(),x+=t.readUEG(),I+=t.readUEG(),M+=t.readUEG());const $=t.readUEG(),V=t.readUEG(),Y=t.readUEG(),H=t.readBoolean();for(let ge=H?0:s;ge<=s;ge++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let it=0;it<4;it++)for(let At=0;At<(it===3?2:6);At++)if(!t.readBoolean())t.readUEG();else{const Wt=Math.min(64,1<<4+(it<<1));it>1&&t.readEG();for(let ye=0;ye<Wt;ye++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const B=t.readUEG();let q=0;for(let ge=0;ge<B;ge++){let it=!1;if(ge!==0&&(it=t.readBoolean()),it){ge===B&&t.readUEG(),t.readBoolean(),t.readUEG();let At=0;for(let vi=0;vi<=q;vi++){const Wt=t.readBoolean();let ye=!1;Wt||(ye=t.readBoolean()),(Wt||ye)&&At++}q=At}else{const At=t.readUEG(),vi=t.readUEG();q=At+vi;for(let Wt=0;Wt<At;Wt++)t.readUEG(),t.readBoolean();for(let Wt=0;Wt<vi;Wt++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const ge=t.readUEG();for(let it=0;it<ge;it++){for(let At=0;At<Y+4;At++)t.readBits(1);t.readBits(1)}}let U=0,F=1,re=1,me=!0,le=1,he=0;t.readBoolean(),t.readBoolean();let tt=!1;if(t.readBoolean()){if(t.readBoolean()){const wt=t.readUByte(),no=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Ir=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];wt>0&&wt<16?(F=no[wt-1],re=Ir[wt-1]):wt===255&&(F=t.readBits(16),re=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),tt=t.readBoolean(),tt&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(le=t.readBits(32),he=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Ir=t.readBoolean(),ao=t.readBoolean();let Gs=!1;(Ir||ao)&&(Gs=t.readBoolean(),Gs&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),Gs&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let oo=0;oo<=s;oo++){me=t.readBoolean();const gu=me||t.readBoolean();let lo=!1;gu?t.readEG():lo=t.readBoolean();const yt=lo?1:t.readUEG()+1;if(Ir)for(let $e=0;$e<yt;$e++)t.readUEG(),t.readUEG(),Gs&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(ao)for(let $e=0;$e<yt;$e++)t.readUEG(),t.readUEG(),Gs&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),U=t.readUEG())}let _t=A,Ct=L;if(S){let ge=1,it=1;T===1?ge=it=2:T==2&&(ge=2),_t=A-ge*x-ge*R,Ct=L-it*M-it*I}const gi=r?["A","B","C"][r]:"",ms=o<<24|l<<16|d<<8|u;let Ar=0;for(let ge=0;ge<32;ge++)Ar=(Ar|(ms>>ge&1)<<31-ge)>>>0;let Sr=Ar.toString(16);return a===1&&Sr==="2"&&(Sr="6"),{codecString:`hvc1.${gi}${a}.${Sr}.${n?"H":"L"}${E}.B0`,params:{general_tier_flag:n,general_profile_idc:a,general_profile_space:r,general_profile_compatibility_flags:[o,l,d,u],general_constraint_indicator_flags:[c,h,f,m,g,p],general_level_idc:E,bit_depth:$+8,bit_depth_luma_minus8:$,bit_depth_chroma_minus8:V,min_spatial_segmentation_idc:U,chroma_format_idc:T,frame_rate:{fixed:me,fps:he/le}},width:_t,height:Ct,pixelRatio:[F,re]}}readPPS(e){const t=new Ta(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const r=t.readBoolean(),n=t.readBoolean();let a=1;return n&&r?a=0:n?a=3:r&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const dt=188;class ks{constructor(e,t,s,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 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=s,this.logger=r,this.videoParser=null}static probe(e,t){const s=ks.syncOffset(e);return s>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),s!==-1}static syncOffset(e){const t=e.length;let s=Math.min(dt*5,t-dt)+1,r=0;for(;r<s;){let n=!1,a=-1,o=0;for(let l=r;l<t;l+=dt)if(e[l]===71&&(t-l===dt||e[l+dt]===71)){if(o++,a===-1&&(a=l,a!==0&&(s=Math.min(a+dt*99,e.length-dt)+1)),n||(n=Sc(e,l)===0),n&&o>1&&(a===0&&o>2||l+dt>s))return a}else{if(o)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:ov[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,s,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=ks.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=ks.createTrack("audio",r),this._id3Track=ks.createTrack("id3"),this._txtTrack=ks.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,s=!1,r=!1){s||(this.sampleAes=null);let n;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,d=this._txtTrack;let u=a.pid,c=a.pesData,h=o.pid,f=l.pid,m=o.pesData,g=l.pesData,p=null,E=this.pmtParsed,b=this._pmtId,y=e.length;if(this.remainderData&&(e=Jt(this.remainderData,e),y=e.length,this.remainderData=null),y<dt&&!r)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:d};const T=Math.max(0,ks.syncOffset(e));y-=(y-T)%dt,y<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,y,e.buffer.byteLength-y));let A=0;for(let S=T;S<y;S+=dt)if(e[S]===71){const R=!!(e[S+1]&64),x=Sc(e,S),I=(e[S+3]&48)>>4;let M;if(I>1){if(M=S+5+e[S+4],M===S+dt)continue}else M=S+4;switch(x){case u:R&&(c&&(n=kr(c,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,d,n,!1)),c={data:[],size:0}),c&&(c.data.push(e.subarray(M,S+dt)),c.size+=S+dt-M);break;case h:if(R){if(m&&(n=kr(m,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break;case"ac3":this.parseAC3PES(o,n);break}m={data:[],size:0}}m&&(m.data.push(e.subarray(M,S+dt)),m.size+=S+dt-M);break;case f:R&&(g&&(n=kr(g,this.logger))&&this.parseID3PES(l,n),g={data:[],size:0}),g&&(g.data.push(e.subarray(M,S+dt)),g.size+=S+dt-M);break;case 0:R&&(M+=e[M]+1),b=this._pmtId=oI(e,M);break;case b:{R&&(M+=e[M]+1);const $=lI(e,M,this.typeSupported,s,this.observer,this.logger);u=$.videoPid,u>0&&(a.pid=u,a.segmentCodec=$.segmentVideoCodec),h=$.audioPid,h>0&&(o.pid=h,o.segmentCodec=$.segmentAudioCodec),f=$.id3Pid,f>0&&(l.pid=f),p!==null&&!E&&(this.logger.warn(`MPEG-TS PMT found at ${S} after unknown PID '${p}'. Backtracking to sync byte @${T} to parse all TS packets.`),p=null,S=T-188),E=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=x;break}}else A++;A>0&&Ic(this.observer,new Error(`Found ${A} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=c,o.pesData=m,l.pesData=g;const L={audioTrack:o,videoTrack:a,id3Track:l,textTrack:d};return r&&this.extractRemainingSamples(L),L}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:s,id3Track:r,textTrack:n}=e,a=s.pesData,o=t.pesData,l=r.pesData;let d;if(a&&(d=kr(a,this.logger))?(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(s,n,d,!0),s.pesData=null)):s.pesData=a,o&&(d=kr(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,d);break;case"mp3":this.parseMPEGPES(t,d);break;case"ac3":this.parseAC3PES(t,d);break}t.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;l&&(d=kr(l,this.logger))?(this.parseID3PES(r,d),r.pesData=null):r.pesData=l}demuxSampleAes(e,t,s){const r=this.demux(e,s,!0,!this.config.progressive),n=this.sampleAes=new rI(this.observer,this.config,t);return this.decrypt(r,n)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new nI:e==="hevc"&&(this.videoParser=new aI))}decrypt(e,t){return new Promise(s=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{s(e)}):s(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{s(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let s=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const c=r.missing,h=r.sample.unit.byteLength;if(c===-1)n=Jt(r.sample.unit,n);else{const f=h-c;r.sample.unit.set(n.subarray(0,c),f),e.samples.push(r.sample),s=r.missing}}let a,o;for(a=s,o=n.length;a<o-1&&!Ed(n,a);a++);if(a!==s){let c;const h=a<o-1;if(h?c=`AAC PES did not start with ADTS header,offset:${a}`:c="No ADTS header found in AAC PES",Ic(this.observer,new Error(c),h,this.logger),!h)return}Vv(e,this.observer,n,a,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(r){const c=Wv(e.samplerate);l=r.sample.pts+c}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let d=0,u;for(;a<o;)if(u=Yv(e,n,a,l,d),a+=u.length,u.missing){this.aacOverFlow=u;break}else for(d++;a<o-1&&!Ed(n,a);a++);}parseMPEGPES(e,t){const s=t.data,r=s.length;let n=0,a=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<r;)if(Xv(s,a)){const l=zv(e,s,a,o,n);if(l)a+=l.length,n++;else break}else a++}parseAC3PES(e,t){{const s=t.data,r=t.pts;if(r===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=s.length;let a=0,o=0,l;for(;o<n&&(l=eE(e,s,o,r,a++))>0;)o+=l}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=ke({},t,{type:this._videoTrack?Gt.emsg:Gt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function Sc(i,e){return((i[e+1]&31)<<8)+i[e+2]}function oI(i,e){return(i[e+10]&31)<<8|i[e+11]}function lI(i,e,t,s,r,n){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(i[e+1]&15)<<8|i[e+2],l=e+3+o-4,d=(i[e+10]&15)<<8|i[e+11];for(e+=12+d;e<l;){const u=Sc(i,e),c=(i[e+3]&15)<<8|i[e+4];switch(i[e]){case 207:if(!s){Cu("ADTS AAC",n);break}case 15:a.audioPid===-1&&(a.audioPid=u);break;case 21:a.id3Pid===-1&&(a.id3Pid=u);break;case 219:if(!s){Cu("H.264",n);break}case 27:a.videoPid===-1&&(a.videoPid=u);break;case 3:case 4:!t.mpeg&&!t.mp3?n.log("MPEG audio found, not supported in this browser"):a.audioPid===-1&&(a.audioPid=u,a.segmentAudioCodec="mp3");break;case 193:if(!s){Cu("AC-3",n);break}case 129:t.ac3?a.audioPid===-1&&(a.audioPid=u,a.segmentAudioCodec="ac3"):n.log("AC-3 audio found, not supported in this browser");break;case 6:if(a.audioPid===-1&&c>0){let h=e+5,f=c;for(;f>2;){i[h]===106&&(t.ac3!==!0?n.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=u,a.segmentAudioCodec="ac3"));const g=i[h+1]+2;h+=g,f-=g}}break;case 194:case 135:return Ic(r,new Error("Unsupported EC-3 in M2TS found"),void 0,n),a;case 36:a.videoPid===-1&&(a.videoPid=u,a.segmentVideoCodec="hevc",n.log("HEVC in M2TS found"));break}e+=c+5}return a}function Ic(i,e,t,s){s.warn(`parsing error: ${e.message}`),i.emit(v.ERROR,v.ERROR,{type:ee.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Cu(i,e){e.log(`${i} with AES-128-CBC encryption found in unencrypted stream`)}function kr(i,e){let t=0,s,r,n,a,o;const l=i.data;if(!i||i.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=Jt(l[0],l[1]),l.splice(1,1);if(s=l[0],(s[0]<<16)+(s[1]<<8)+s[2]===1){if(r=(s[4]<<8)+s[5],r&&r>i.size-6)return null;const u=s[7];u&192&&(a=(s[9]&14)*536870912+(s[10]&255)*4194304+(s[11]&254)*16384+(s[12]&255)*128+(s[13]&254)/2,u&64?(o=(s[14]&14)*536870912+(s[15]&255)*4194304+(s[16]&254)*16384+(s[17]&255)*128+(s[18]&254)/2,a-o>60*9e4&&(e.warn(`${Math.round((a-o)/9e4)}s delta between PTS and DTS, align them`),a=o)):o=a),n=s[8];let c=n+9;if(i.size<=c)return null;i.size-=c;const h=new Uint8Array(i.size);for(let f=0,m=l.length;f<m;f++){s=l[f];let g=s.byteLength;if(c)if(c>g){c-=g;continue}else s=s.subarray(c),g-=c,c=0;h.set(s,t),t+=g}return r&&(r-=n+3),{data:h,pts:a,dts:o,len:r}}return null}class dI{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)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]);break;default:if(t===1)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(t===2)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(t===3)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]);break}}}const ps=Math.pow(2,32)-1;class D{static init(){D.types={avc1:[],avcC:[],hvc1:[],hvcC:[],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:[]};let e;for(e in D.types)D.types.hasOwnProperty(e)&&(D.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=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]),s=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]);D.HDLR_TYPES={video:t,audio:s};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);D.STTS=D.STSC=D.STCO=n,D.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),D.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),D.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),D.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);D.FTYP=D.box(D.types.ftyp,a,l,a,o),D.DINF=D.box(D.types.dinf,D.box(D.types.dref,r))}static box(e,...t){let s=8,r=t.length;const n=r;for(;r--;)s+=t[r].byteLength;const a=new Uint8Array(s);for(a[0]=s>>24&255,a[1]=s>>16&255,a[2]=s>>8&255,a[3]=s&255,a.set(e,4),r=0,s=8;r<n;r++)a.set(t[r],s),s+=t[r].byteLength;return a}static hdlr(e){return D.box(D.types.hdlr,D.HDLR_TYPES[e])}static mdat(e){return D.box(D.types.mdat,e)}static mdhd(e,t){t*=e;const s=Math.floor(t/(ps+1)),r=Math.floor(t%(ps+1));return D.box(D.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,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return D.box(D.types.mdia,D.mdhd(e.timescale||0,e.duration||0),D.hdlr(e.type),D.minf(e))}static mfhd(e){return D.box(D.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?D.box(D.types.minf,D.box(D.types.smhd,D.SMHD),D.DINF,D.stbl(e)):D.box(D.types.minf,D.box(D.types.vmhd,D.VMHD),D.DINF,D.stbl(e))}static moof(e,t,s){return D.box(D.types.moof,D.mfhd(e),D.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=D.trak(e[t]);return D.box.apply(null,[D.types.moov,D.mvhd(e[0].timescale||0,e[0].duration||0)].concat(s).concat(D.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=D.trex(e[t]);return D.box.apply(null,[D.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(ps+1)),r=Math.floor(t%(ps+1)),n=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,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,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 D.box(D.types.mvhd,n)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,s[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return D.box(D.types.sdtp,s)}static stbl(e){return D.box(D.types.stbl,D.stsd(e),D.box(D.types.stts,D.STTS),D.box(D.types.stsc,D.STSC),D.box(D.types.stsz,D.STSZ),D.box(D.types.stco,D.STCO))}static avc1(e){let t=[],s=[],r,n,a;for(r=0;r<e.sps.length;r++)n=e.sps[r],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],a=n.byteLength,s.push(a>>>8&255),s.push(a&255),s=s.concat(Array.prototype.slice.call(n));const o=D.box(D.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),l=e.width,d=e.height,u=e.pixelRatio[0],c=e.pixelRatio[1];return D.box(D.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,l>>8&255,l&255,d>>8&255,d&255,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]),o,D.box(D.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),D.box(D.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,c>>24,c>>16&255,c>>8&255,c&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return D.box(D.types.mp4a,D.audioStsd(e),D.box(D.types.esds,D.esds(e)))}static mp3(e){return D.box(D.types[".mp3"],D.audioStsd(e))}static ac3(e){return D.box(D.types["ac-3"],D.audioStsd(e),D.box(D.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return D.box(D.types.stsd,D.STSD,D.mp4a(e));if(t==="ac3"&&e.config)return D.box(D.types.stsd,D.STSD,D.ac3(e));if(t==="mp3"&&e.codec==="mp3")return D.box(D.types.stsd,D.STSD,D.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return D.box(D.types.stsd,D.STSD,D.avc1(e));if(t==="hevc"&&e.vps)return D.box(D.types.stsd,D.STSD,D.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,s=(e.duration||0)*(e.timescale||0),r=e.width||0,n=e.height||0,a=Math.floor(s/(ps+1)),o=Math.floor(s%(ps+1));return D.box(D.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,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,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,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const s=D.sdtp(e),r=e.id,n=Math.floor(t/(ps+1)),a=Math.floor(t%(ps+1));return D.box(D.types.traf,D.box(D.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),D.box(D.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,a>>24,a>>16&255,a>>8&255,a&255])),D.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,D.box(D.types.trak,D.tkhd(e),D.mdia(e))}static trex(e){const t=e.id;return D.box(D.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const s=e.samples||[],r=s.length,n=12+16*r,a=new Uint8Array(n);let o,l,d,u,c,h;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<r;o++)l=s[o],d=l.duration,u=l.size,c=l.flags,h=l.cts,a.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,c.degradPrio&61440,c.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*o);return D.box(D.types.trun,a)}static initSegment(e){D.types||D.init();const t=D.moov(e);return Jt(D.FTYP,t)}static hvc1(e){const t=e.params,s=[e.vps,e.sps,e.pps],r=4,n=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),r-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),s.length]);let a=n.length;for(let m=0;m<s.length;m+=1){a+=3;for(let g=0;g<s[m].length;g+=1)a+=2+s[m][g].length}const o=new Uint8Array(a);o.set(n,0),a=n.length;const l=s.length-1;for(let m=0;m<s.length;m+=1){o.set(new Uint8Array([32+m|(m===l?128:0),0,s[m].length]),a),a+=3;for(let g=0;g<s[m].length;g+=1)o.set(new Uint8Array([s[m][g].length>>8,s[m][g].length&255]),a),a+=2,o.set(s[m][g],a),a+=s[m][g].length}const d=D.box(D.types.hvcC,o),u=e.width,c=e.height,h=e.pixelRatio[0],f=e.pixelRatio[1];return D.box(D.types.hvc1,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,u>>8&255,u&255,c>>8&255,c&255,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]),d,D.box(D.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),D.box(D.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,f>>24,f>>16&255,f>>8&255,f&255])))}}D.types=void 0;D.HDLR_TYPES=void 0;D.STTS=void 0;D.STSC=void 0;D.STCO=void 0;D.STSZ=void 0;D.VMHD=void 0;D.SMHD=void 0;D.STSD=void 0;D.FTYP=void 0;D.DINF=void 0;const iE=9e4;function ff(i,e,t=1,s=!1){const r=i*e*t;return s?Math.round(r):r}function uI(i,e,t=1,s=!1){return ff(i,e,1/t,s)}function $n(i,e=!1){return ff(i,1e3,1/iE,e)}function cI(i,e=1){return ff(i,iE,1/e)}function Mp(i){const{baseTime:e,timescale:t,trackId:s}=i;return`${e/t} (${e}/${t}) trackId: ${s}`}const hI=10*1e3,fI=1024,mI=1152,pI=1536;let Dr=null,wu=null;function Pp(i,e,t,s){return{duration:e,size:t,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:i?2:1,isNonSync:i?0:1}}}class qo extends ti{constructor(e,t,s,r){if(super("mp4-remuxer",r),this.observer=void 0,this.config=void 0,this.typeSupp
31orted=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,Dr===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Dr=a?parseInt(a[1]):0}if(wu===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);wu=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&Mp(t)} > ${e&&Mp(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const s=e[0].pts,r=e.reduce((n,a)=>{let o=a.pts,l=o-n;return l<-4294967296&&(t=!0,o=Bt(o,s),l=o-n),l>0?n:o},s);return t&&this.debug("PTS rollover detected"),r}remux(e,t,s,r,n,a,o,l){let d,u,c,h,f,m,g=n,p=n;const E=e.pid>-1,b=t.pid>-1,y=t.samples.length,T=e.samples.length>0,A=o&&y>0||y>1;if((!E||T)&&(!b||A)||this.ISGenerated||o){if(this.ISGenerated){var S,R,x,I;const Y=this.videoTrackConfig;(Y&&(t.width!==Y.width||t.height!==Y.height||((S=t.pixelRatio)==null?void 0:S[0])!==((R=Y.pixelRatio)==null?void 0:R[0])||((x=t.pixelRatio)==null?void 0:x[1])!==((I=Y.pixelRatio)==null?void 0:I[1]))||!Y&&A||this.nextAudioTs===null&&T)&&this.resetInitSegment()}this.ISGenerated||(c=this.generateIS(e,t,n,a));const M=this.isVideoContiguous;let $=-1,V;if(A&&($=gI(t.samples),!M&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,$>0){this.warn(`Dropped ${$} out of ${y} video samples due to a missing keyframe`);const Y=this.getVideoStartPts(t.samples);t.samples=t.samples.slice($),t.dropped+=$,p+=(t.samples[0].pts-Y)/t.inputTimeScale,V=p}else $===-1&&(this.warn(`No keyframe found out of ${y} video samples`),m=!1);if(this.ISGenerated){if(T&&A){const Y=this.getVideoStartPts(t.samples),N=(Bt(e.samples[0].pts,Y)-Y)/t.inputTimeScale;g+=Math.max(0,N),p+=Math.max(0,-N)}if(T){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),c=this.generateIS(e,t,n,a)),u=this.remuxAudio(e,g,this.isAudioContiguous,a,b||A||l===Q.AUDIO?p:void 0),A){const Y=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),c=this.generateIS(e,t,n,a)),d=this.remuxVideo(t,p,M,Y)}}else A&&(d=this.remuxVideo(t,p,M,0));d&&(d.firstKeyFrame=$,d.independent=$!==-1,d.firstKeyFramePTS=V)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(f=sE(s,n,this._initPTS,this._initDTS)),r.samples.length&&(h=rE(r,n,this._initPTS))),{audio:u,video:d,initSegment:c,independent:m,text:h,id3:f}}computeInitPts(e,t,s,r){const n=Math.round(s*t);let a=Bt(e,n);if(a<n+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(n-a)/t} ${r}`);a<n+t;)a+=8589934592;return a-n}generateIS(e,t,s,r){const n=e.samples,a=t.samples,o=this.typeSupported,l={},d=this._initPTS;let u=!d||r,c="audio/mp4",h,f,m,g=-1;if(u&&(h=f=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(c="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:c,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):D.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(g=e.id,m=e.inputTimeScale,!d||m!==d.timescale?h=f=this.computeInitPts(n[0].pts,m,s,"audio"):u=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:D.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(g=t.id,m=t.inputTimeScale,!d||m!==d.timescale){const p=this.getVideoStartPts(a),E=Bt(a[0].dts,p),b=this.computeInitPts(E,m,s,"video"),y=this.computeInitPts(p,m,s,"video");f=Math.min(f,b),h=Math.min(h,y)}else u=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,u?(d&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${s} ${h/m} != initPTS: ${d.baseTime/d.timescale} (${d.baseTime}/${d.timescale}) trackId: ${d.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${h/m} (${h}/${m}) trackId: ${g}`),this._initPTS={baseTime:h,timescale:m,trackId:g},this._initDTS={baseTime:f,timescale:m,trackId:g}):h=m=void 0,{tracks:l,initPTS:h,timescale:m,trackId:g}}remuxVideo(e,t,s,r){const n=e.inputTimeScale,a=e.samples,o=[],l=a.length,d=this._initPTS,u=d.baseTime*n/d.timescale;let c=this.nextVideoTs,h=8,f=this.videoSampleDuration,m,g,p=Number.POSITIVE_INFINITY,E=Number.NEGATIVE_INFINITY,b
vendor: 5,148 bytes, line 31
31=!1;if(!s||c===null){const U=u+t*n,F=a[0].pts-Bt(a[0].dts,a[0].pts);Dr&&c!==null&&Math.abs(U-F-(c+u))<15e3?s=!0:c=U-F-u}const y=c+u;for(let U=0;U<l;U++){const F=a[U];F.pts=Bt(F.pts,y),F.dts=Bt(F.dts,y),F.dts<a[U>0?U-1:U].dts&&(b=!0)}b&&a.sort(function(U,F){const re=U.dts-F.dts,me=U.pts-F.pts;return re||me}),m=a[0].dts,g=a[a.length-1].dts;const T=g-m,A=T?Math.round(T/(l-1)):f||e.inputTimeScale/30;if(s){const U=m-y,F=U>A,re=U<-1;if((F||re)&&(F?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${$n(U,!0)} ms (${U}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${$n(-U,!0)} ms (${U}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!re||y>=a[0].pts||Dr)){m=y;const me=a[0].pts-U;if(F)a[0].dts=m,a[0].pts=me;else{let le=!0;for(let he=0;he<a.length&&!(a[he].dts>me&&le);he++){const tt=a[he].pts;if(a[he].dts-=U,a[he].pts-=U,he<a.length-1){const ze=a[he+1].pts,_t=a[he].pts,Ct=ze<=_t,gi=ze<=tt;le=Ct==gi}}}this.log(`Video: Initial PTS/DTS adjusted: ${$n(me,!0)}/${$n(m,!0)}, delta: ${$n(U,!0)} ms`)}}m=Math.max(0,m);let L=0,S=0,R=m;for(let U=0;U<l;U++){const F=a[U],re=F.units,me=re.length;let le=0;for(let he=0;he<me;he++)le+=re[he].data.length;S+=le,L+=me,F.length=le,F.dts<R?(F.dts=R,R+=A/4|0||1):R=F.dts,p=Math.min(F.pts,p),E=Math.max(F.pts,E)}g=a[l-1].dts;const x=S+4*L+8;let I;try{I=new Uint8Array(x)}catch(U){this.observer.emit(v.ERROR,v.ERROR,{type:ee.MUX_ERROR,details:C.REMUX_ALLOC_ERROR,fatal:!1,error:U,bytes:x,reason:`fail allocating video mdat ${x}`});return}const M=new DataView(I.buffer);M.setUint32(0,x),I.set(D.types.mdat,4);let $=!1,V=Number.POSITIVE_INFINITY,Y=Number.POSITIVE_INFINITY,H=Number.NEGATIVE_INFINITY,N=Number.NEGATIVE_INFINITY;for(let U=0;U<l;U++){const F=a[U],re=F.units;let me=0;for(let tt=0,ze=re.length;tt<ze;tt++){const _t=re[tt],Ct=_t.data,gi=_t.data.byteLength;M.setUint32(h,gi),h+=4,I.set(Ct,h),h+=gi,me+=4+gi}let le;if(U<l-1)f=a[U+1].dts-F.dts,le=a[U+1].pts-F.pts;else{const tt=this.config,ze=U>0?F.dts-a[U-1].dts:A;if(le=U>0?F.pts-a[U-1].pts:A,tt.stretchShortVideoTrack&&this.nextAudioTs!==null){const _t=Math.floor(tt.maxBufferHole*n),Ct=(r?p+r*n:this.nextAudioTs+u)-F.pts;Ct>_t?(f=Ct-ze,f<0?f=ze:$=!0,this.log(`It is approximately ${Ct/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=ze}else f=ze}const he=Math.round(F.pts-F.dts);V=Math.min(V,f),H=Math.max(H,f),Y=Math.min(Y,le),N=Math.max(N,le),o.push(Pp(F.key,f,me,he))}if(o.length){if(Dr){if(Dr<70){const U=o[0].flags;U.dependsOn=2,U.isNonSync=0}}else if(wu&&N-Y<H-V&&A/H<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let U=m;for(let F=0,re=o.length;F<re;F++){const me=U+o[F].duration,le=U+o[F].cts;if(F<re-1){const he=me+o[F+1].cts;o[F].duration=he-le}else o[F].duration=F?o[F-1].duration:A;o[F].cts=0,U=me}}}f=$||!f?A:f;const W=g+f;this.nextVideoTs=c=W-u,this.videoSampleDuration=f,this.isVideoContiguous=!0;const J={data1:D.moof(e.sequenceNumber++,m,ke(e,{samples:o})),data2:I,startPTS:(p-u)/n,endPTS:(E+f-u)/n,startDTS:(m-u)/n,endDTS:c/n,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,J}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return mI;case"ac3":return pI;default:return fI}}remuxAudio(e,t,s,r,n){const a=e.inputTimeScale,o=e.samplerate?e.samplerate:a,l=a/o,d=this.getSamplesPerFrame(e),u=d*l,c=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,f=[],m=n!==void 0;let g=e.samples,p=h?0:8,E=this.nextAudioTs||-1;const b=c.baseTime*a/c.timescale,y=b+t*a;if(this.isAudioContiguous=s=s||g.length&&E>0&&(r&&Math.abs(y-(E+b))<9e3||Math.abs(Bt(g[0].pts,y)-(E+b))<20*u),g.forEach(function(N){N.pts=Bt(N.pts,y)}),!s||E<0){const N=g.length;if(g=g.filter(W=>W.pts>=0),N!==g.length&&this.warn(`Removed ${g.length-N} of ${N} samples (initPTS ${b} / ${a})`),!g.length)return;n===0?E=0:r&&!m?E=Math.max(0,y-b):E=g[0].pts-b}if(e.segmentCodec==="aac"){const N=this.config.maxAudioFramesDrift;for(let W=0,B=E+b;W<g.length;W++){const q=g[W],J=q.pts,U=J-B,F=Math.abs(1e3*U/a);if(U<=-N*u&&m)W===0&&(this.warn(`Audio frame @ ${(J/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*U/a)} ms.`),this.nextAudioTs=E=J-b,B=J);else if(U>=N*u&&F<hI&&m){let re=Math.round(U/u);for(B=J-re*u;B<0&&re&&u;)re--,B+=u;W===0&&(this.nextAudioTs=E=B-b),this.warn(`Injecting ${re} audio frames @ ${((B-b)/a).toFixed(3)}s due to ${Math.round(1e3*U/a)} ms gap.`);for(let me=0;me<re;me++){let le=dI.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);le||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),le=q.unit.subarray()),g.splice(W,0,{unit:le,pts:B}),B+=u,W++}}q.pts=B,B+=u}}let T=null,A=null,L,S=0,R=g.length;for(;R--;)S+=g[R].unit.byteLength;for(let N=0,W=g.length;N<W;N++){const B=g[N],q=B.unit;let J=B.pts;if(A!==null){const F=f[N-1];F.duration=Math.round((J-A)/l)}else if(s&&e.segmentCodec==="aac"&&(J=E+b),T=J,S>0){S+=p;try{L=new Uint8Array(S)}catch(F){this.observer.emit(v.ERROR,v.ERROR,{type:ee.MUX_ERROR,details:C.REMUX_ALLOC_ER
31ROR,fatal:!1,error:F,bytes:S,reason:`fail allocating audio mdat ${S}`});return}h||(new DataView(L.buffer).setUint32(0,S),L.set(D.types.mdat,4))}else return;L.set(q,p);const U=q.byteLength;p+=U,f.push(Pp(!0,d,U,0)),A=J}const x=f.length;if(!x)return;const I=f[f.length-1];E=A-b,this.nextAudioTs=E+l*I.duration;const M=h?new Uint8Array(0):D.moof(e.sequenceNumber++,T/l,ke({},e,{samples:f}));e.samples=[];const $=(T-b)/a,V=this.nextAudioTs/a,H={data1:M,data2:L,startPTS:$,endPTS:V,startDTS:$,endDTS:V,type:"audio",hasAudio:!0,hasVideo:!1,nb:x};return this.isAudioContiguous=!0,H}}function Bt(i,e){let t;if(e===null)return i;for(e<i?t=-8589934592:t=8589934592;Math.abs(i-e)>4294967296;)i+=t;return i}function gI(i){for(let e=0;e<i.length;e++)if(i[e].key)return e;return-1}function sE(i,e,t,s){const r=i.samples.length;if(!r)return;const n=i.inputTimeScale;for(let o=0;o<r;o++){const l=i.samples[o];l.pts=Bt(l.pts-t.baseTime*n/t.timescale,e*n)/n,l.dts=Bt(l.dts-s.baseTime*n/s.timescale,e*n)/n}const a=i.samples;return i.samples=[],{samples:a}}function rE(i,e,t){const s=i.samples.length;if(!s)return;const r=i.inputTimeScale;for(let a=0;a<s;a++){const o=i.samples[a];o.pts=Bt(o.pts-t.baseTime*r/t.timescale,e*r)/r}i.samples.sort((a,o)=>a.pts-o.pts);const n=i.samples;return i.samples=[],{samples:n}}class vI extends ti{constructor(e,t,s,r){super("passthrough-remuxer",r),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,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,s,r){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(e,r),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:s,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:n,video:a}=this.initData=uv(e);if(t)rS(e,t);else{const l=n||a;l!=null&&l.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${l.codec}")!`)}n&&(s=Op(n,Ce.AUDIO,this)),a&&(r=Op(a,Ce.VIDEO,this));const o={};n&&a?o.audiovideo={container:"video/mp4",codec:s+","+r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:n?o.audio={container:"audio/mp4",codec:s,encrypted:n.encrypted,initSegment:e,id:"audio"}:a?o.video={container:"video/mp4",codec:r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,s,r,n,a){var o,l;let{initPTS:d,lastEndTime:u}=this;const c={audio:void 0,video:void 0,text:r,id3:s,initSegment:void 0};j(u)||(u=this.lastEndTime=n||0);const h=t.samples;if(!h.length)return c;const f={initPTS:void 0,timescale:void 0,trackId:void 0};let m=this.initData;if((o=m)!=null&&o.length||(this.generateInitSegment(h),m=this.initData),!((l=m)!=null&&l.length))return this.warn("Failed to generate initSegment."),c;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);const g=aS(h,m,this),p=m.audio?g[m.audio.id]:null,E=m.video?g[m.video.id]:null,b=Eo(E,1/0),y=Eo(p,1/0),T=Eo(E,0,!0),A=Eo(p,0,!0);let L=n,S=0;const R=p&&(!E||!d&&y<b||d&&d.trackId===m.audio.id),x=R?p:E;if(x){const B=x.timescale,q=x.start-n*B,J=R?m.audio.id:m.video.id;L=x.start/B,S=R?A-y:T-b,(a||!d)&&(EI(d,L,n,S)||B!==d.timescale)&&(d&&this.warn(`Timestamps at playlist time: ${a?"":"~"}${n} ${q/B} != initPTS: ${d.baseTime/d.timescale} (${d.baseTime}/${d.timescale}) trackId: ${d.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${L-n} (${q}/${B}) trackId: ${J}`),d=null,f.initPTS=q,f.timescale=B,f.trackId=J)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${n}`);d?(f.initPTS=d.baseTime,f.timescale=d.timescale,f.trackId=d.trackId):((!f.timescale||f.trackId===void 0||f.initPTS===void 0)&&(this.warn("Could not set initPTS"),f.initPTS=L,f.timescale=1,f.trackId=-1),this.initPTS=d={baseTime:f.initPTS,timescale:f.timescale,trackId:f.trackId});const I=L-d.baseTime/d.timescale,M=I+S;S>0?this.lastEndTime=M:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const $=!!m.audio,V=!!m.video;let Y="";
31$&&(Y+="audio"),V&&(Y+="video");const H=(m.audio?m.audio.encrypted:!1)||(m.video?m.video.encrypted:!1),N={data1:h,startPTS:I,startDTS:I,endPTS:M,endDTS:M,type:Y,hasAudio:$,hasVideo:V,nb:1,dropped:0,encrypted:H};c.audio=$&&!V?N:void 0,c.video=V?N:void 0;const W=E?.sampleCount;if(W){const B=E.keyFrameIndex,q=B!==-1;N.nb=W,N.dropped=B===0||this.isVideoContiguous?0:q?B:W,N.independent=q,N.firstKeyFrame=B,q&&E.keyFrameStart&&(N.firstKeyFramePTS=(E.keyFrameStart-d.baseTime)/d.timescale),this.isVideoContiguous||(c.independent=q),this.isVideoContiguous||(this.isVideoContiguous=q),N.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${B}/${W} dropped: ${N.dropped} start: ${N.firstKeyFramePTS||"NA"}`)}return c.initSegment=f,c.id3=sE(s,n,d,d),r.samples.length&&(c.text=rE(r,n,d)),c}}function Eo(i,e,t=!1){return i?.start!==void 0?(i.start+(t?i.duration:0))/i.timescale:e}function EI(i,e,t,s){if(i===null)return!0;const r=Math.max(s,1),n=e-i.baseTime/i.timescale;return Math.abs(n-t)>r}function Op(i,e,t){const s=i.codec;return s&&s.length>4?s:e===Ce.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?ud(s,!1):(t.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||"mp4a"):(t.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||"avc1")}let rs;try{rs=self.performance.now.bind(self.performance)}catch{rs=Date.now}const jo=[{demux:sI,remux:vI},{demux:ks,remux:qo},{demux:J1,remux:qo},{demux:tI,remux:qo}];jo.splice(2,0,{demux:eI,remux:qo});class Np{constructor(e,t,s,r,n,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=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=s,this.id=n,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,r){const n=s.transmuxing;n.executeStart=rs();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;r&&(this.currentTransmuxState=r);const{contiguous:d,discontinuity:u,trackSwitch:c,accurateTimeOffset:h,timeOffset:f,initSegmentChange:m}=r||o,{audioCodec:g,videoCodec:p,defaultInitPts:E,duration:b,initSegmentData:y}=l,T=yI(a,t);if(T&&cn(T.method)){const R=this.getDecrypter(),x=rf(T.method);if(R.isSync()){let I=R.softwareDecrypt(a,T.key.buffer,T.iv.buffer,x);if(s.part>-1){const $=R.flush();I=$&&$.buffer}if(!I)return n.executeEnd=rs(),Mu(s);a=new Uint8Array(I)}else return this.asyncResult=!0,this.decryptionPromise=R.webCryptoDecrypt(a,T.key.buffer,T.iv.buffer,x).then(I=>{const M=this.push(I,null,s);return this.decryptionPromise=null,M}),this.decryptionPromise}const A=this.needsProbing(u,c);if(A){const R=this.configureTransmuxer(a);if(R)return this.logger.warn(`[transmuxer] ${R.message}`),this.observer.emit(v.ERROR,v.ERROR,{type:ee.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!1,error:R,reason:R.message}),n.executeEnd=rs(),Mu(s)}(u||c||m||A)&&this.resetInitSegment(y,g,p,b,t),(u||m||A)&&this.resetInitialTimestamp(E),d||this.resetContiguity();const L=this.transmux(a,T,f,h,s);this.asyncResult=Ba(L);const S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,n.executeEnd=rs(),L}flush(e){const t=e.transmuxing;t.executeStart=rs();const{decrypter:s,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return this.asyncResult=!0,n.then(()=>this.flush(e));const a=[],{timeOffset:o}=r;if(s){const c=s.flush();c&&a.push(this.push(c.buffer,null,e))}const{demuxer:l,remuxer:d}=this;if(!l||!d){t.executeEnd=rs();const c=[Mu(e)];return this.asyncResult?Promise.resolve(c):c}const u=l.flush(o);return Ba(u)?(this.asyncResult=!0,u.then(c=>(this.flushRemux(a,c,e),a))):(this.flushRemux(a,u,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,s){const{audioTrack:r,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:d}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?" part: "+s.part:""} of ${this.id===Q.MAIN?"level":"track"} ${s.level}`);const u=this.remuxer.remux(r,n,a,o,d,l,!0,this.id);e.push({remuxResult:u,chunkMeta:s}),s.transmuxing.executeEnd=rs()}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,r,n){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,s,r),o.resetInitSegment(e,t,s,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,r,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,s,r,n):a=this.transmuxUnencrypted(e,s,r,n),a}transmuxUnencrypted(e,t,s,r){const{audioTrack:n,videoTrack:a,id3Track:o,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,a,o,l,t,s,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,s,r,n){return this.demuxer.demuxSampleAes(e,t,s).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,s,r,!1,this.id),chunkMeta:n}))}
vendor: 3,935 bytes, line 31
31configureTransmuxer(e){const{config:t,observer:s,typeSupported:r}=this;let n;for(let c=0,h=jo.length;c<h;c++){var a;if((a=jo[c].demux)!=null&&a.probe(e,this.logger)){n=jo[c];break}}if(!n)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,l=this.remuxer,d=n.remux,u=n.demux;(!l||!(l instanceof d))&&(this.remuxer=new d(s,t,r,this.logger)),(!o||!(o instanceof u))&&(this.demuxer=new u(s,t,r,this.logger),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new tf(this.config)),e}}function yI(i,e){let t=null;return i.byteLength>0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Mu=i=>({remuxResult:{},chunkMeta:i});function Ba(i){return"then"in i&&i.then instanceof Function}class bI{constructor(e,t,s,r,n){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=s,this.duration=r,this.defaultInitPts=n||null}}class TI{constructor(e,t,s,r,n,a){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=s,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=a}}let Up=0;class nE{constructor(e,t,s,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Up++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=l=>{const d=l.data,u=this.hls;if(!(!u||!(d!=null&&d.event)||d.instanceNo!==this.instanceNo))switch(d.event){case"init":{var c;const h=(c=this.workerContext)==null?void 0:c.objectURL;h&&self.URL.revokeObjectURL(h);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}case"workerLog":{u.logger[d.data.logType]&&u.logger[d.data.logType](d.data.message);break}default:{d.data=d.data||{},d.data.frag=this.frag,d.data.part=this.part,d.data.id=this.id,u.trigger(d.event,d.data);break}}},this.onWorkerError=l=>{if(!this.hls)return;const d=new Error(`${l.message} (${l.filename}:${l.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(v.ERROR,{type:ee.OTHER_ERROR,details:C.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:d})};const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=s,this.onFlush=r;const a=(l,d)=>{d=d||{},d.frag=this.frag||void 0,l===v.ERROR&&(d=d,d.parent=this.id,d.part=this.part,this.error=d.error),this.hls.trigger(l,d)};this.observer=new of,this.observer.on(v.FRAG_DECRYPTED,a),this.observer.on(v.ERROR,a);const o=Zm(n.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(n.workerPath||I1()){try{n.workerPath?(l.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=R1(n.workerPath)):(l.log(`injecting Web Worker for "${t}"`),this.workerContext=L1());const{worker:u}=this.workerContext;u.addEventListener("message",this.onWorkerMessage),u.addEventListener("error",this.onWorkerError),u.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:we(n)})}catch(u){l.warn(`Error setting up "${t}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new Np(this.observer,o,n,"",t,e.logger)}return}}this.transmuxer=new Np(this.observer,o,n,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Up++;const t=this.hls.config,s=Zm(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:s,id:this.id,c
vendor: 5,774 bytes, lines 31-37
31onfig:we(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),x1(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,s,r,n,a,o,l,d,u){var c,h;d.transmuxing.start=self.performance.now();const{instanceNo:f,transmuxer:m}=this,g=a?a.start:n.start,p=n.decryptdata,E=this.frag,b=!(E&&n.cc===E.cc),y=!(E&&d.level===E.level),T=E?d.sn-E.sn:-1,A=this.part?d.part-this.part.index:-1,L=T===0&&d.id>1&&d.id===E?.stats.chunkCount,S=!y&&(T===1||T===0&&(A===1||L&&A<=0)),R=self.performance.now();(y||T||n.stats.parsing.start===0)&&(n.stats.parsing.start=R),a&&(A||!S)&&(a.stats.parsing.start=R);const x=!(E&&((c=n.initSegment)==null?void 0:c.url)===((h=E.initSegment)==null?void 0:h.url)),I=new TI(b,S,l,y,g,x);if(!S||b||x){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${n.type} sn: ${d.sn}${d.part>-1?" part: "+d.part:""} ${this.id===Q.MAIN?"level":"track"}: ${d.level} id: ${d.id} 32 discontinuity: ${b} 33 trackSwitch: ${y} 34 contiguous: ${S} 35 accurateTimeOffset: ${l} 36 timeOffset: ${g} 37 initSegmentChange: ${x}`);const M=new bI(s,r,t,o,u);this.configureTransmuxer(M)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:p,chunkMeta:d,state:I},e instanceof ArrayBuffer?[e]:[]);else if(m){const M=m.push(e,p,d,I);Ba(M)?M.then($=>{this.handleTransmuxComplete($)}).catch($=>{this.transmuxerError($,d,"transmuxer-interface push error")}):this.handleTransmuxComplete(M)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(s){const r=s.flush(e);Ba(r)?r.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")}):this.handleFlushResult(r,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:s}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):s&&s.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const $p=100;class _I extends af{constructor(e,t,s){super(e,t,s,"audio-stream-controller",Q.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!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.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(v.LEVEL_LOADED,this.onLevelLoaded,this),e.on(v.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(v.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(v.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(v.BUFFER_RESET,this.onBufferReset,this),e.on(v.BUFFER_CREATED,this.onBufferCreated,this),e.on(v.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(v.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(v.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(v.FRAG_LOADING,this.onFragLoading,this),e.on(v.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(v.LEVEL_LOADED,this.onLevelLoaded,this),e.off(v.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(v.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(v.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(v.BUFFER_RESET,this.onBufferReset,this),e.off(v.BUFFER_CREATED,this.onBufferCreated,this),e.off(v.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(v.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(v.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(v.FRAG_LOADING,this.onFragLoading,this),e.off(v.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:s,initPTS:r,timescale:n,trackId:a}){if(s===Q.MAIN){const o=t.cc,l=this.fragCurrent;if(this.initPTS[o]={baseTime:r,timescale:n,trackId:a},this.log(`InitPTS for cc: ${o} found from main: ${r/n} (${r}/${n}) trackId: ${a}`),this.mainAnchor=t,this.state===P.WAITING_INIT_PTS){const d=this.waitingData;(!d&&!this.loadingParts||d&&d.frag.cc!==o)&&this.syncWithAnchor(t,d?.frag)}else!this.hls.hasEnoughToStart&&l&&l.cc!==o?(l.abortRequests(),this.syncWithAnchor(t,l)):this.state===P.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var s;const r=((s=this.mainFragLoading)==null?void 0:s.frag)||null;if(t&&r?.cc===t.cc)return;const n=(r||e).cc,a=this.getLevelDetails(),o=this.getLoadPosition(),l=Tv(a,n,o);l&&(this.log(`Syncing with main frag at ${l.start} cc ${l.cc}`),this.startFragRequested=!1,this.nextLoadPosition=l.start,this.resetLoadingState(),this.state===P.IDLE&&this.doTickIdle())}
vendor: 26,462 bytes, lines 37-40
37startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=P.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval($p),s>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s,this.state=P.IDLE):this.state=P.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case P.IDLE:this.doTickIdle();break;case P.WAITING_TRACK:{const{levels:e,trackId:t}=this,s=e?.[t],r=s?.details;if(r&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(r))break;this.state=P.WAITING_INIT_PTS}break}case P.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case P.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:s,cache:r,complete:n}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=P.FRAG_LOADING;const o=r.flush().buffer,l={frag:t,part:s,payload:o,networkDetails:null};this._handleFragmentLoadProgress(l),n&&super._handleFragmentLoadComplete(l)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=P.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:s,media:r,trackId:n}=this,a=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(s!=null&&s[n]))return;const o=s[n],l=o.details;if(!l||this.waitForLive(o)||this.waitForCdnTuneIn(l)){this.state=P.WAITING_TRACK,this.startFragRequested=!1;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,Ce.AUDIO,Q.AUDIO));const u=this.getFwdBufferInfo(d,Q.AUDIO);if(u===null)return;if(!this.switchingTrack&&this._streamEnded(u,l)){t.trigger(v.BUFFER_EOS,{type:"audio"}),this.state=P.ENDED;return}const c=u.len,h=t.maxBufferLength,f=l.fragments,m=f[0].start,g=this.getLoadPosition(),p=this.flushing?g:u.end;if(this.switchingTrack&&r){const y=g;l.PTSKnown&&y<m&&(u.end>m||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=m+.05)}if(c>=h&&!this.switchingTrack&&p<f[f.length-1].start)return;let E=this.getNextFragment(p,l);if(E&&this.isLoopLoading(E,p)&&(E=this.getNextFragmentLoopLoading(E,l,u,Q.MAIN,h)),!E){this.bufferFlushed=!0;return}let b=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&b&&je(E)&&!E.endList&&(!l.live||!this.loadingParts&&p<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(b)===nt.OK&&(this.mainFragLoading=b=null),b&&je(b))){if(E.start>b.end){const T=this.fragmentTracker.getFragAtPos(p,Q.MAIN);T&&T.end>b.end&&(b=T,this.mainFragLoading={frag:T,targetBufferTime:null})}if(E.start>b.end)return}this.loadFragment(E,o,p)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new Ua(s))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),s?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==P.STOPPED&&(this.setInterval($p),this.state=P.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const s=this.cachedTrackLoadedData;s&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(v.AUDIO_TRACK_LOADED,s))}onAudioTrackLoaded(e,t){var s;const{levels:r}=this,{details:n,id:a,groupId:o,track:l}=t;if(!r){this.warn(`Audio tracks reset while loading track ${a} "${l.name}" of "${o}"`);return}const d=this.mainDetails;if(!d||n.endCC>d.endCC||d.expired){this.cachedTrackLoadedData=t,this.state!==P.STOPPED&&(this.state=P.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${l.name}" of "${o}" loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const u=r[a];let c=0;if(n.live||(s=u.details)!=null&&s.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;if(u.details){var h;c=this.alignPlaylists(n,u.details,(h=this.levelLastLoaded)==null?void 0:h.details)}n.alignedSliding||(Fv(n,d),n.alignedSliding||vd(n,d),c=n.fragmentStart)}u.details=n,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(d,c),this.hls.trigger(v.AUDIO_TRACK_UPDATED,{details:n,id:a,groupId:t.groupId}),this.state===P.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=P.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const s=e.frag,{part:r,payload:n}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const d=l[o];if(!d){this.warn("Audio track is undefined on fragment load progress");return}const u=d.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const c=a.defaultAudioCodec||d.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new nE(this.hls,Q.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const f=this.initPTS[s.cc],m=(t=s.initSegment)==null?void 0:t.data;if(f!==void 0){const p=r?r.index:-1,E=p!==-1,b=new sf(s.level,s.sn,s.stats.chunkCount,n.byteLength,p,E);h.push(n,m,c,"",s,r,u.totalduration,!1,b,f)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${u.startSN} ,${u.endSN}],track ${o}`);const{cache:g}=this.waitingData=this.waitingData||{frag:s,part:r,cache:new Bv,complete:!1};g.push(new Uint8Array(n)),this.state!==P.STOPPED&&(this.state=P.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===Q.MAIN&&je(t.frag)&&(this.mainFragLoading=t,this.state===P.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:s,part:r}=t;if(s.type!==Q.AUDIO){!this.audioOnly&&s.type===Q.MAIN&&!s.elementaryStreams.video&&!s.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(je(s)){this.fragPrevious=s;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(v.AUDIO_TRACK_SWITCHED,Ie({},n)))}this.fragBufferedComplete(s,r),this.media&&this.tick()}onError(e,t){var s;if(t.fatal){this.state=P.ERROR;return}switch(t.details){case C.FRAG_GAP:case C.FRAG_PARSING_ERROR:case C.FRAG_DECRYPT_ERROR:case C.FRAG_LOAD_ERROR:case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_ERROR:case C.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Q.AUDIO,t);break;case C.AUDIO_TRACK_LOAD_ERROR:case C.AUDIO_TRACK_LOAD_TIMEOUT:case C.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===P.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===fe.AUDIO_TRACK&&(this.state=P.IDLE);break;case C.BUFFER_ADD_CODEC_ERROR:case C.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case C.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case C.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Ce.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Ce.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===P.ENDED&&(this.state=P.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,Q.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const s="audio",{hls:r}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:d,level:u}=o,{details:c}=u,{audio:h,text:f,id3:m,initSegment:g}=n;if(this.fragContextChanged(l)||!c){this.fragmentTracker.removeFragment(l);return}if(this.state=P.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){const p=l.initSegment||l;if(this.unhandledEncryptionError(g,l))return;this._bufferInitSegment(u,g.tracks,p,a),r.trigger(v.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:s,tracks:g.tracks})}if(h){const{startPTS:p,endPTS:E,startDTS:b,endDTS:y}=h;d&&(d.elementaryStreams[Ce.AUDIO]={startPTS:p,endPTS:E,startDTS:b,endDTS:y}),l.setElementaryStreamInfo(Ce.AUDIO,p,E,b,y),this.bufferFragmentData(h,l,d,a)}if(m!=null&&(t=m.samples)!=null&&t.length){const p=ke({id:s,frag:l,details:c},m);r.trigger(v.FRAG_PARSING_METADATA,p)}if(f){const p=ke({id:s,frag:l,details:c},f);r.trigger(v.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,s,r){if(this.state!==P.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const n=t.audio;n.id=Q.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${a}/${n.codec}]`),a&&a.split(",").length===1&&(n.levelCodec=a),this.hls.trigger(v.BUFFER_CODECS,t);const o=n.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:s,part:null,chunkMeta:r,parent:s.type,data:o};this.hls.trigger(v.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,s){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===nt.NOT_LOADED||r===nt.PARTIAL){var n;if(!je(e))this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.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=P.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&vd(t.details,a)}else super.loadFragment(e,t,s)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:s,assocLang:r,characteristics:n,audioCodec:a,channels:o}=this.bufferedTrack;fr({name:t,lang:s,assocLang:r,characteristics:n,audioCodec:a,channels:o},e,zs)||(hd(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(v.AUDIO_TRACK_SWITCHED,Ie({},e))}}class mf extends ti{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,s){const r=t?.renditionReports;if(r){let n=-1;for(let a=0;a<r.length;a++){const o=r[a];let l;try{l=new self.URL(o.URI,t.url).href}catch(d){this.warn(`Could not construct new URL for Rendition Report: ${d}`),l=o.URI||""}if(l===e){n=a;break}else l===e.substring(0,l.length)&&(n=a)}if(n!==-1){const a=r[n],o=parseInt(a["LAST-MSN"])||t.lastPartSn;let l=parseInt(a["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const u=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&u>t.partTarget&&(l+=1)}const d=s&&Jm(s);return new ep(o,l>=0?l:void 0,d)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}return e}playlistLoaded(e,t,s){const{details:r,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;r.advancedDateTime=Date.now()-o;const l=this.hls.config.timelineOffset;if(l!==r.appliedTimelineOffset){const u=Math.max(l||0,0);r.appliedTimelineOffset=u,r.fragments.forEach(c=>{c.setStart(c.playlistOffset+u)})}if(r.live||s!=null&&s.live){const u="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(s),s&&r.fragments.length>0){m1(s,r,this);const b=r.playlistParsingError;if(b){this.warn(b);const y=this.hls;if(!y.config.ignorePlaylistParsingErrors){var d;const{networkDetails:T}=t;y.trigger(v.ERROR,{type:ee.NETWORK_ERROR,details:C.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:b,reason:b.message,level:t.level||void 0,parent:(d=r.fragments[0])==null?void 0:d.type,networkDetails:T,stats:n});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=n.loading.start);const c=this.hls.mainForwardBufferInfo,h=c?c.end-c.len:0,f=(r.edge-h)*1e3,m=Pv(r,f);if(r.requestScheduled+m<a?r.requestScheduled=a:r.requestScheduled+=m,this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),!this.canLoad||!r.live)return;let g,p,E;if(r.canBlockReload&&r.endSN&&r.advanced){const b=this.hls.config.lowLatencyMode,y=r.lastPartSn,T=r.endSN,A=r.lastPartIndex,L=A!==-1,S=y===T;L?S?(p=T+1,E=b?0:A):(p=y,E=b?A+1:r.maxPartIndex):p=T+1;const R=r.age,x=R+r.ageHeader;let I=Math.min(x-r.partTarget,r.targetduration*1.5);if(I>0){if(x>r.targetduration*3)this.log(`Playlist last advanced ${R.toFixed(2)}s ago. Omitting segment and part directives.`),p=void 0,E=void 0;else if(s!=null&&s.tuneInGoal&&x-r.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${I} with playlist age: ${r.age}`),I=0;else{const M=Math.floor(I/r.targetduration);if(p+=M,E!==void 0){const $=Math.round(I%r.targetduration/r.partTarget);E+=$}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${R.toFixed(2)}s goal: ${I} skip sn ${M} to part ${E}`)}r.tuneInGoal=I}if(g=this.getDeliveryDirectives(r,t.deliveryDirectives,p,E),b||!S){r.requestScheduled=a,this.loadingPlaylist(u,g);return}}else(r.canBlockReload||r.canSkipUntil)&&(g=this.getDeliveryDirectives(r,t.deliveryDirectives,p,E));g&&p!==void 0&&r.canBlockReload&&(r.requestScheduled=n.loading.first+Math.max(m-o*2,m/2)),this.scheduleLoading(u,g,r)}else this.clearTimer()}scheduleLoading(e,t,s){const r=s||e.details;if(!r){this.loadingPlaylist(e,t);return}const n=self.performance.now(),a=r.requestScheduled;if(n>=a){this.loadingPlaylist(e,t);return}const o=a-n;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,s,r){let n=Jm(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,r=t.part,n=Wo.No),new ep(s,r,n)}checkRetry(e){const t=e.details,s=fd(e),r=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=r||{},l=!!r&&!!o&&(n===pt.RetryRequest||!r.resolved&&n===pt.SendAlternateToPenaltyBox);if(l){var d;if(a>=o.maxNumRetry)return!1;if(s&&(d=e.context)!=null&&d.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const u=ef(o,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),u),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${u}ms`)}e.levelRetry=!0,r.resolved=!0}return l}}function aE(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(!Ha(i[t].attrs,e[t].attrs))return!1;return!0}function Ha(i,e,t){const s=i["STABLE-RENDITION-ID"];return s&&!t?s===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>i[r]!==e[r])}function Lc(i,e){return e.label.toLowerCase()===i.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(i.lang||"").toLowerCase())}class AI extends mf{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(){const{hls:e}=this;e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.LEVEL_LOADING,this.onLevelLoading,this),e.on(v.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(v.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(v.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.LEVEL_LOADING,this.onLevelLoading,this),e.off(v.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(v.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(v.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){const{id:s,groupId:r,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Audio track with id:${s} and group:${r} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.audioGroups||null,r=this.groupIds;let n=this.currentTrack;if(!s||r?.length!==s?.length||s!=null&&s.some(o=>r?.indexOf(o)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(h=>!s||s.indexOf(h.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(h=>h.default)&&(this.selectDefaultTrack=!1),o.forEach((h,f)=>{h.id=f});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!n&&l){const h=Fi(l,o,zs);if(h>-1)n=o[h];else{const f=Fi(l,this.tracks);n=this.tracks[f]}}let d=this.findTrackId(n);d===-1&&n&&(d=this.findTrackId(null));const u={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s?.join(",")}`),this.hls.trigger(v.AUDIO_TRACKS_UPDATED,u);const c=this.trackId;if(d!==-1&&c===-1)this.setAudioTrack(d);else if(o.length&&c===-1){var a;const h=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(h.message),this.hls.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}}onError(e,t){t.fatal||!t.context||t.context.type===fe.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-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){const t=this.hls;if(t.config.audioPreference=e,e){const s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const r=this.currentTrack;if(r&&fr(e,r,zs))return r;const n=Fi(e,this.tracksInGroup,zs);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(r){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=OS(e,t.levels,s,a,zs);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Fi(e,s);if(a>-1)return s[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===s&&n||(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(v.AUDIO_TRACK_SWITCHING,Ie({},r)),n))return;const a=this.switchParams(r.url,s?.details,r.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const r=t[s];if(!(this.selectDefaultTrack&&!r.default)&&(!e||fr(e,r,zs)))return s}if(e){const{name:s,lang:r,assocLang:n,characteristics:a,audioCodec:o,channels:l}=e;for(let d=0;d<t.length;d++){const u=t[d];if(fr({name:s,lang:r,assocLang:n,characteristics:a,audioCodec:o,channels:l},u,zs))return d}for(let d=0;d<t.length;d++){const u=t[d];if(Ha(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return d}for(let d=0;d<t.length;d++){const u=t[d];if(Ha(e.attrs,u.attrs,["LANGUAGE"]))return d}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&hd(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading audio-track ${s} "${e.name}" lang:${e.lang} group:${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${n}`),this.hls.trigger(v.AUDIO_TRACK_LOADING,{url:n,id:s,groupId:r,deliveryDirectives:t||null,track:e})}}class SI{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,s){if(this.queues===null||this.tracks===null)return;const r=this.queues[t];r.push(e),r.length===1&&!s&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const s={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(s,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const s={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(s)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const s=(t=e[0])==null?void 0:t.label;(s==="async-blocker"||s==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const r=t[0];try{r.execute()}catch(n){var s;if(r.onError(n),this.queues===null||this.tracks===null)return;const a=(s=this.tracks[e])==null?void 0:s.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":` 38${this.list("video")} 39${this.list("audio")} 40${this.list("audiovideo")}}`}list(e){var t,s;return(t=this.queues)!=null&&t[e]||(s=this.tracks)!=null&&s[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const s=(t=this.tracks)==null?void 0:t[e],r=s?.buffer;return r?`SourceBuffer${r.updating?" updating":""}${s.ended?" ended":""}${s.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(s=>s.label).join(", "))||""}}const Fp=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,oE="HlsJsTrackRemovedError";class II extends Error{constructor(e){super(e),this.name=oE}}class LI extends ti{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=s=>{var r;this.hls&&((r=this.mediaSource)==null?void 0:r.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=s=>{const{media:r,mediaSource:n}=this;s&&this.log("Media source opened"),!(!r||!n)&&(n.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(v.MEDIA_ATTACHED,{media:r,mediaSource:n}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:r}=this;s!==r&&this.error(`Media element src was set while attaching MediaSource (${r} > ${s})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=jA(Us(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.BUFFER_RESET,this.onBufferReset,this),e.on(v.BUFFER_APPENDING,this.onBufferAppending,this),e.on(v.BUFFER_CODECS,this.onBufferCodecs,this),e.on(v.BUFFER_EOS,this.onBufferEos,this),e.on(v.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(v.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(v.FRAG_PARSED,this.onFragParsed,this),e.on(v.FRAG_CHANGED,this.onFragChanged,this),e.on(v.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;
vendor: 3,919 bytes, lines 40-42
40e.off(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.BUFFER_RESET,this.onBufferReset,this),e.off(v.BUFFER_APPENDING,this.onBufferAppending,this),e.off(v.BUFFER_CODECS,this.onBufferCodecs,this),e.off(v.BUFFER_EOS,this.onBufferEos,this),e.off(v.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(v.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(v.FRAG_PARSED,this.onFragParsed,this),e.off(v.FRAG_CHANGED,this.onFragChanged,this),e.off(v.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const s={};if(this.operationQueue){const n=this.isUpdating();n||this.operationQueue.removeBlockers();const a=this.isQueued();(n||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${n?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?ke(s,r.tracks):this.sourceBuffers.forEach(n=>{const[a]=n;a&&(s[a]=ke({},this.tracks[a]),this.removeBuffer(a)),n[0]=n[1]=null}),{media:e,mediaSource:t,tracks:s}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var s;let r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),(s=this.transferData)!=null&&s.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){const s=this.media=t.media;this.transferData=this.overrides=void 0;const r=Us(this.appendSource);if(r){const n=!!t.mediaSource;(n||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(a),n)this._objectUrl=s.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{s.removeAttribute("src");const l=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||l&&a instanceof l,Bp(s),RI(s,o),s.load()}catch{s.src=o}else s.src=o}s.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,s;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(s=e.constructor)==null?void 0:s.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))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const s=this.tracks,r=t.tracks,n=r?Object.keys(r):null,a=n?n.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&n&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal}) 41required tracks: ${we(s,(l,d)=>l==="initSegment"?void 0:d)}; 42transfer tracks: ${we(r,(l,d)=>l==="initSegment"?void 0:d)}}`),!sv(r,s)){t.mediaSource=null,t.tracks=void 0;const l=e.currentTime,d=this.details,u=Math.max(l,d?.fragments[0].start||0);if(u-l>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${l} -> ${u}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(s)}") start time: ${u} currentTime: ${l}`),this.onMediaDetaching(v.MEDIA_DETACHING,{}
vendor: 6,599 bytes, line 42
42),this.onMediaAttaching(v.MEDIA_ATTACHING,t),e.currentTime=u;return}this.transferData=void 0,n.forEach(l=>{const d=l,u=r[d];if(u){const c=u.buffer;if(c){const h=this.fragmentTracker,f=u.id;if(h.hasFragments(f)||h.hasParts(f)){const p=oe.getBuffered(c);h.detectEvictedFragments(d,p,f,null,!0)}const m=Pu(d),g=[d,c];this.sourceBuffers[m]=g,c.updating&&this.operationQueue&&this.operationQueue.prependBlocker(d),this.trackSourceBuffer(d,u)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const s=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:r,mediaSource:n,_objectUrl:a}=this;if(n){if(this.log(`media source ${s?"transferring":"detaching"}`),s)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=n.readyState==="open";try{const l=n.sourceBuffers;for(let d=l.length;d--;)o&&l[d].abort(),n.removeSourceBuffer(l[d]);o&&n.endOfStream()}catch(l){this.warn(`onMediaDetaching: ${l.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}n.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("sourceended",this._onMediaSourceEnded),n.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.removeEventListener("startstreaming",this._onStartStreaming),n.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),s||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(r.removeAttribute("src"),this.appendSource&&Bp(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(v.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const s=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),s)try{var r;(r=this.mediaSource)!=null&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(s)}catch(n){this.warn(`onBufferReset ${e}`,n)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Pu(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new SI(this.tracks)}onBufferCodecs(e,t){var s;const r=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in t&&(r.audio||r.video)||r.audiovideo&&("audio"in t||"video"in t),o=!a&&this.sourceBufferCount&&this.media&&n.some(l=>!r[l]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(r)}" and "${n}" SourceBuffers`);return}n.forEach(l=>{var d,u;const c=t[l],{id:h,codec:f,levelCodec:m,container:g,metadata:p,supplemental:E}=c;let b=r[l];const y=(d=this.transferData)==null||(d=d.tracks)==null?void 0:d[l],T=y!=null&&y.buffer?y:b,A=T?.pendingCodec||T?.codec,L=T?.levelCodec;b||(b=r[l]={buffer:void 0,listeners:[],codec:f,supplemental:E,container:g,levelCodec:m,metadata:p,id:h});const S=Vo(A,L),R=S?.replace(Fp,"$1");let x=Vo(f,m);const I=(u=x)==null?void 0:u.replace(Fp,"$1");x&&S&&R!==I&&(l.slice(0,5)==="audio"&&(x=ud(x,this.appendSource)),this.log(`switching codec ${A} to ${x}`),x!==(b.pendingCodec||b.codec)&&(b.pendingCodec=x),b.container=g,this.appendChangeType(l,g,x))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((s=t.audio)==null?void 0:s.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const s=this.tracks[t];return e[t]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},e},{})}appendChangeType(e,t,s){const r=`${t};codecs=${s}`,n={label:`change-type=${r}`,execute:()=>{const a=this.tracks[e];if(a){const o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),o.changeType(r),a.codec=s,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(n,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const s=e.start,r=s+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(s,Q.MAIN))==null?void 0:t.gap)===!0)return;const a={label:"block-audio",execute:()=>{var o;const l=this.tracks.video;(this.lastVideoAppendEnd>r||l!=null&&l.buffer&&oe.isBuffered(l.buffer,r)||((o=this.fragmentTracker.getAppendedFrag(r,Q.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:s}=this,{data:r,type:n,parent:a,frag:o,part:l,chunkMeta:d,offset:u}=t,c=d.buffering[n],{sn:h,cc:f}=o,m=self.performance.now();c.start=m;const g=o.stats.buffering,p=l?l.stats.buffering:null;g.start===0&&(g.start=m),p&&p.start===0&&(p.start=m);const E=s.audio;let b=!1;n==="audio"&&E?.container==="audio/mpeg"&&(b=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const y=s.video,T=y?.buffer;if(T&&h!=="initSegment"){const S=l||o,R=this.blockedAudioAppend;if(n==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(y.ending||y.ended)){const I=S.start+S.duration*.05,M=T.buffered,$=this.currentOp("video");!M.length&&!$?this.blockAudio(S):!$&&!oe.isBuffered(T,I)&&this.lastVideoAppendEnd<I&&this.blockAudio(S)}else if(n==="video"){const x=S.end;if(R){const I=R.frag.start;(x>I||x<this.lastVideoAppendEnd||oe.isBuffered(T,I))&&this.unblockAudio()}this.lastVideoAppendEnd=x}}const A=(l||o).start,L={label:`append-${n}`,execute:()=>{var S;c.executeStart=self.performance.now();const R=(S=this.tracks[n])==null?void 0:S.buffer;R&&(b?this.updateTimestampOffset(R,A,.1,n,h,f):u!==void 0&&j(u)&&this.updateTimestampOffset(R,u,1e-6,n,h,f)),this.appendExecutor(r,n)},onStart:()=>{},onComplete:()=>{const S=self.performance.now();c.executeEnd=c.end=S,g.first===0&&(g.first=S),p&&p.first===0&&(p.first=S);const R={};
42this.sourceBuffers.forEach(([x,I])=>{x&&(R[x]=oe.getBuffered(I))}),this.appendErrors[n]=0,n==="audio"||n==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(v.BUFFER_APPENDED,{type:n,frag:o,part:l,chunkMeta:d,parent:o.type,timeRanges:R})},onError:S=>{var R;const x={type:ee.MEDIA_ERROR,parent:o.type,details:C.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:o,part:l,chunkMeta:d,error:S,err:S,fatal:!1},I=(R=this.media)==null?void 0:R.error;if(S.code===DOMException.QUOTA_EXCEEDED_ERR||S.name=="QuotaExceededError"||"quota"in S)x.details=C.BUFFER_FULL_ERROR;else if(S.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!I)x.errorAction=un(!0);else if(S.name===oE&&this.sourceBufferCount===0)x.errorAction=un(!0);else{const M=++this.appendErrors[n];this.warn(`Failed ${M}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${n}" sourceBuffer (${I||"no media error"})`),(M>=this.hls.config.appendErrorMaxRetry||I)&&(x.fatal=!0)}this.hls.trigger(v.ERROR,x)}};this.log(`queuing "${n}" append sn: ${h}${l?" p: "+l.index:""} of ${o.type===Q.MAIN?"level":"track"} ${o.level} cc: ${f}`),this.append(L,n,this.isPending(this.tracks[n]))}getFlushOp(e,t,s){return this.log(`queuing "${e}" remove ${t}-${s}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,s)},onStart:()=>{},onComplete:()=>{this.hls.trigger(v.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn(`Failed to remove ${t}-${s} from "${e}" SourceBuffer`,r)}}}onBufferFlushing(e,t){const{type:s,startOffset:r,endOffset:n}=t;s?this.append(this.getFlushOp(s,r,n),s):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,r,n),a)})}onFragParsed(e,t){const{frag:s,part:r}=t,n=[],a=r?r.elementaryStreams:s.elementaryStreams;a[Ce.AUDIOVIDEO]?n.push("audiovideo"):(a[Ce.AUDIO]&&n.push("audio"),a[Ce.VIDEO]&&n.push("video"));const o=()=>{const l=self.performance.now();s.stats.buffering.end=l,r&&(r.stats.buffering.end=l);const d=r?r.stats:s.stats;this.hls.trigger(v.FRAG_BUFFERED,{frag:s,part:r,stats:d,id:s.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(o,n).catch(l=>{this.warn(`Fragment buffered callback ${l}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var s;this.sourceBuffers.forEach(([a])=>{if(a){const o=this.tracks[a];(!t.type||t.type===a)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${a} buffer reached EOS`)))}});const r=((s=this.overrides)==null?void 0:s.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var o;return a&&!((o=this.tracks[a])!=null&&o.ended)})?r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(v.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(v.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===C.BUFFER_APPEND_ERROR&&t.frag){var s;const r=(s=t.errorAction)==null?void 0:s.nextAutoLevel;j(r)&&r!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:s}=this;if(!s||t===null||!this.sourceBufferCount)return;const r=e.config,n=s.currentTime,a=t.levelTargetDuration,o=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(j(o)&&o>=0){const d=Math.max(o,a),u=Math.floor(n/a)*a-d;this.flushBackBuffer(n,a,u)}const l=r.frontBufferFlushThreshold;if(j(l)&&l>0){const d=Math.max(r.maxBufferLength,l),u=Math.max(d,a),c=Math.floor(n/a)*a+u;this.flushFrontBuffer(n,a,c)}}
vendor: 5,999 bytes, line 42
42flushBackBuffer(e,t,s){this.sourceBuffers.forEach(([r,n])=>{if(n){const o=oe.getBuffered(n);if(o.length>0&&s>o.start(0)){var a;this.hls.trigger(v.BACK_BUFFER_REACHED,{bufferEnd:s});const l=this.tracks[r];if((a=this.details)!=null&&a.live)this.hls.trigger(v.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(l!=null&&l.ended){this.log(`Cannot flush ${r} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(v.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:r})}}})}flushFrontBuffer(e,t,s){this.sourceBuffers.forEach(([r,n])=>{if(n){const a=oe.getBuffered(n),o=a.length;if(o<2)return;const l=a.start(o-1),d=a.end(o-1);if(s>l||e>=l&&e<=d)return;this.hls.trigger(v.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;const{details:t,mediaSource:s}=this;if(!t||!this.media||s?.readyState!=="open")return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&s.setLiveSeekableRange){const d=Math.max(0,t.fragmentStart),u=Math.max(d,r);return{duration:1/0,start:d,end:u}}return{duration:1/0}}const n=(e=this.overrides)==null?void 0:e.duration;if(n)return j(n)?{duration:n}:null;const a=this.media.duration,o=j(s.duration)?s.duration:0;return r>o&&r>a||!j(a)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:s}){const r=this.mediaSource;!this.media||!r||r.readyState!=="open"||(r.duration!==e&&(j(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),t!==void 0&&s!==void 0&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${s}.`),r.setLiveSeekableRange(t,s)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:s}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${we(s)}`),this.tracksReady){var r;const n=(r=this.transferData)==null?void 0:r.tracks;n&&Object.keys(n).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,s])=>{if(t){const r=this.tracks[t];e[t]={buffer:s,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.metadata}}}),this.hls.trigger(v.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:s}=this;if(!s)throw new Error("createSourceBuffers called when mediaSource was null");for(const n in e){const a=n,o=e[a];if(this.isPending(o)){const l=this.getTrackCodec(o,a),d=`${o.container};codecs=${l}`;o.codec=l,this.log(`creating sourceBuffer(${d})${this.currentOp(a)?" Queued":""} ${we(o)}`);try{const u=s.addSourceBuffer(d),c=Pu(a),h=[a,u];t[c]=h,o.buffer=u}catch(u){var r;this.error(`error while trying to add sourceBuffer: ${u.message}`),this.shiftAndExecuteNext(a),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[a],this.hls.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:a,mimeType:d,parent:o.id});return}this.trackSourceBuffer(a,o)}}this.bufferCreated()}getTrackCodec(e,t){const s=e.supplemental;let r=e.codec;s&&(t==="video"||t==="audiovideo")&&Oa(s,"video")&&(r=gS(r,s));const n=Vo(r,e.levelCodec);return n?t.slice(0,5)==="audio"?ud(n,this.appendSource):n:""}trackSourceBuffer(e,t){const s=t.buffer;if(!s)return;const r=this.getTrackCodec(t,e);this.tracks[e]={buffer:s,codec:r,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(n,a)=>{const o=a.removedRanges;o!=null&&o.length&&this.hls.trigger(v.BUFFER_FLUSHED,{type:n})})}get mediaSrc(){var e,t;const s=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return s?.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const s=this.currentOp(e);s&&(s.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var s;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${r}`,t),this.hls.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.currentOp(e);n&&n.onError(r)}updateTimestampOffset(e,t,s,r,n,a){const o=t-e.timestampOffset;Math.abs(o)>=s&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${t} (sn: ${n} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,s){const{media:r,mediaSource:n}=this,a=this.tracks[e],o=a?.buffer;if(!r||!n||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const l=j(r.duration)?r.duration:1/0,d=j(n.duration)?n.duration:1/0,u=Math.max(0,t),c=Math.min(s,l,d);c>u&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${u},${c}] from the ${e} SourceBuffer`),o.remove(u,c)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const s=this.tracks[t],r=s?.buffer;if(!r)throw new II(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);s.ending=!1,s.ended=!1,r.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}
42`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:s}=this,r=t.map(a=>this.appendBlocker(a));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(a=>{s===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var s;const r=(s=this.tracks[t])==null?void 0:s.buffer;!r||r.updating||this.shiftAndExecuteNext(t)})}append(e,t,s){this.operationQueue&&this.operationQueue.append(e,t,s)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,s){const r=this.tracks[e];if(!r)return;const n=r.buffer;if(!n)return;const a=s.bind(this,e);r.listeners.push({event:t,listener:a}),n.addEventListener(t,a)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const s=t.buffer;s&&(t.listeners.forEach(r=>{s.removeEventListener(r.event,r.listener)}),t.listeners.length=0)}}function Bp(i){const e=i.querySelectorAll("source");[].slice.call(e).forEach(t=>{i.removeChild(t)})}function RI(i,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,i.appendChild(t)}function Pu(i){return i==="audio"?1:0}class pf{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=Number.POSITIVE_INFINITY,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(){const{hls:e}=this;e.on(v.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(v.MEDIA_ATTA
vendor: 3,501 bytes, line 42
42CHING,this.onMediaAttaching,this),e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(v.BUFFER_CODECS,this.onBufferCodecs,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(v.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(v.BUFFER_CODECS,this.onBufferCodecs,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const s=this.hls.levels[t.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.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){const s=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,s.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&j(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${s}: ${e[s].height}p@${e[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=s,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const s=t.filter((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,pf.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,!t.width&&!t.height&&(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.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{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,t,s){if(!(e!=null&&e.length))return-1;const r=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let n=e.length-1;const a=Math.max(t,s);for(let o=0;o<e.length;o+=1){const l=e[o];if((l.width>=a||l.height>=a)&&r(l,e[o+1])){n=o;break}}return n}}const xI={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",
42KEY:"k",OTHER:"o"},It=xI,kI={HLS:"h"},DI=kI;class Yi{constructor(e,t){Array.isArray(e)&&(e=e.map(s=>s instanceof Yi?s:new Yi(s))),this.value=e,this.params=t}}const CI="Dict";function wI(i){return Array.isArray(i)?JSON.stringify(i):i instanceof Map?"Map{}":i instanceof Set?"Set{}":typeof i=="object"?JSON.stringify(i):String(i)}function MI(i,e,t,s){return new Error(`failed to ${i} "${wI(e)}" as ${t}`,{cause:s})}function qi(i,e,t){return MI("serialize",i,e,t)}class lE{constructor(e){this.description=e}}const Hp="Bare Item",PI="Boolean";function OI(i){if(typeof i!="boolean")throw qi(i,PI);return i?"?1":"?0"}function NI(i){return btoa(String.fromCharCode(...i))}const UI="Byte Sequence";function $I(i){if(ArrayBuffer.isView(i)===!1)throw qi(i,UI);return`:${NI(i)}:`}const FI="Integer";function BI(i){return i<-999999999999999||999999999999999<i}function dE(i){if(BI(i))throw qi(i,FI);return i.toString()}function HI(i){return`@${dE(i.getTime()/1e3)}`}function uE(i,e){if(i<0)return-uE(-i,e);const t=Math.pow(10,e);if(Math.abs(i*t%1-.5)<Number.EPSILON){const r=Math.floor(i*t);return(r%2===0?r:r+1)/t}else return Math.round(i*t)/t}const GI="Decimal";function KI(i){const e=uE(i,3);if(Math.floor(Math.abs(e)).toString().length>12)throw qi(i,GI);const t=e.toString();return t.includes(".")?t:`${t}.0`}const VI="String",WI=/[\x00-\x1f\x7f]+/;function YI(i){if(WI.test(i))throw qi(i,VI);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function qI(i){return i.description||i.toString().slice(7,-1)}const jI="Token";function Gp(i){const e=qI(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw qi(e,jI);return e}function Rc(i){switch(typeof i){case"number":if(!j(i))throw qi(i,Hp);return Number.isInteger(i)?dE(i):KI(i);case"string":return YI(i);case"symbol":return Gp(i);case"boolean":return OI(i);case"object":if(i instanceof Date)return HI(i);if(i instanceof Uint8Array)return $I(i);if(i instanceof lE)return Gp(i);default:throw qi(i,Hp)}}const zI="Key";function xc(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw qi(i,zI);return i}function gf(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${xc(e)}`:`;${xc(e)}=${Rc(t)}`).join("")}function cE(i){return i instanceof Yi?`${Rc(i.value)}${gf(i.params)}`:Rc(i)}function QI(i){return`(${i.value.map(cE).join(" ")})${gf(i.params)}`}function XI(i,e={whitespace:!0}){if(typeof i!="object"||i==null)throw qi(i,CI);const t=i instanceof Map?i.entries():Object.entries(i),s=e?.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof Yi||(n=new Yi(n));let a=xc(r);return n.value===!0?a+=gf(n.params):(a+="=",Array.isArray(n.value)?a+=QI(n):a+=cE(n)),a}).join(`,${s}`)}function hE(i,e){return XI(i,e)}const yi="CMCD-Object",Ge="CMCD-Request",Vs="CMCD-Session",gs="CMCD-Status",ZI={br:yi,ab:yi,d:yi,ot:yi,tb:yi,tpb:yi,lb:yi,tab:yi,lab:yi,url:yi,pb:Ge,bl:Ge,tbl:Ge,dl:Ge,ltc:Ge,mtp:Ge,nor:Ge,nrr:Ge,rc:Ge,sn:Ge,sta:Ge,su:Ge,ttfb:Ge,ttfbb:Ge,ttlb:Ge,cmsdd:Ge,cmsds:Ge,smrt:Ge,df:Ge,cs:Ge,ts:Ge,cid:Vs,pr:Vs,sf:Vs,sid:Vs,st:Vs,v:Vs,msd:Vs,bs:gs,bsd:gs,cdn:gs,rtp:gs,bg:gs,pt:gs,ec:gs,e:gs},JI={REQUEST:Ge};function eL(i){return Object.keys(i).reduce((e,t)=>{var s;return(s=i[t])===null||s===void 0||s.forEach(r=>e[r]=t),e},{})}function tL(i,e){const t={};if(!i)return t;const s=Object.keys(i),r=e?eL(e):{};return s.reduce((n,a)=>{var o;const l=ZI[a]||r[a]||JI.REQUEST,d=(o=n[l])!==null&&o!==void 0?o:n[l]={};return d[a]=i[a],n},t)}function iL(i){return["ot","sf","st","e","sta"].includes(i)}function sL(i){return typeof i=="number"?j(i):i!=null&&i!==""&&i!==!1}const fE="event";function rL(i,e){const t=new URL(i),s=new URL(e);if(t.origin!==s.origin)return i;const r=t.pathname.split("/").slice(1),n=s.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")+t.search+t.hash}const zo=i=>Math.round(i),kc=(i,e)=>Array.isArray(i)?i.map(t=>kc(t,e)):i instanceof Yi&&typeof i.value=="string"?new Yi(kc(i.value,e),i.params):(e.baseUrl&&(i=rL(i,e.baseUrl)),e.version===1?encodeURIComponent(i):i),yo=i=>zo(i/100)*100,nL=(i,e)=>{let t=i;return e.version>=2&&(i instanceof Yi&&typeof i.value=="string"?t=new Yi([i]):typeof i=="string"&&(t=[i])),kc(t,e)},aL={br:zo,d:zo,bl:yo,dl:yo,mtp:yo,nor:nL,rtp:yo,tb:zo}
42,mE="request",pE="response",vf=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],oL=["e"],lL=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function zd(i){return lL.test(i)}function dL(i){return vf.includes(i)||oL.includes(i)||zd(i)}const gE=["d","dl","nor","ot","rtp","su"];function uL(i){return vf.includes(i)||gE.includes(i)||zd(i)}const cL=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function hL(i){return vf.includes(i)||gE.includes(i)||cL.includes(i)||zd(i)}const fL=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function mL(i){return fL.includes(i)||zd(i)}const pL={[pE]:hL,[fE]:dL,[mE]:uL};function vE(i,e={}){const t={};if(i==null||typeof i!="object")return t;const s=e.version||i.v||1,r=e.reportingMode||mE,n=s===1?mL:pL[r];let a=Object.keys(i).filter(n);const o=e.filter;typeof o=="function"&&(a=a.filter(o));const l=r===pE||r===fE;l&&!a.includes("ts")&&a.push("ts"),s>1&&!a.includes("v")&&a.push("v");const d=ke({},aL,e.formatters),u={version:s,reportingMode:r,baseUrl:e.baseUrl};return a.sort().forEach(c=>{let h=i[c];const f=d[c];if(typeof f=="function"&&(h=f(h,u)),c==="v"){if(s===1)return;h=s}c=="pr"&&h===1||(l&&c==="ts"&&!j(h)&&(h=Date.now()),sL(h)&&(iL(c)&&typeof h=="string"&&(h=new lE(h)),t[c]=h))}),t}function gL(i,e={}){const t={};if(!i)return t;const s=vE(i,e),r=tL(s,e?.customHeaderMap);return Object.entries(r).reduce((n,[a,o])=>{const l=hE(o,{whitespace:!1});return l&&(n[a]=l),n},t)}function vL(i,e,t){return ke(i,gL(e,t))}const EL="CMCD";function yL(i,e={}){return i?hE(vE(i,e),{whitespace:!1}):""}function bL(i,e={}){if(!i)return"";const t=yL(i,e);return encodeURIComponent(t)}function TL(i,e={}){if(!i)return"";const t=bL(i,e);return`${EL}=${t}`}const Kp=/CMCD=[^&#]+/;function _L(i,e,t){const s=TL(e,t);if(!s)return i;if(Kp.test(i))return i.replace(Kp,s);const r=i.includes("?")?"&":"?";return`${i}${r}${s}`}class AL{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=r=>{try{this.apply(r,{ot:It.MANIFEST,su:!this.initialized})}catch(n){this.hls.logger.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const{frag:n,part:a}=r,o=this.hls.levels[n.level],l=this.getObjectType(n),d={d:(a||n).duration*1e3,ot:l};(l===It.VIDEO||l===It.AUDIO||l==It.MUXED)&&(d.br=o.bitrate/1e3,d.tb=this.getTopBandwidth(l)/1e3,d.bl=this.getBufferLength(l));const u=a?this.getNextPart(a):this.getNextFrag(n);u!=null&&u.url&&u.url!==n.url&&(d.nor=u.url),this.apply(r,d)}catch(n){this.hls.logger.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||e.sessionId,this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;
42e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHED,this.onMediaDetached,this),e.on(v.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHED,this.onMediaDetached,this),e.off(v.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=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 s,r;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:DI.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){ke(t,this.createData());const s=t.ot===It.INIT||t.ot===It.VIDEO||t.ot===It.MUXED;this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((a,o)=>(r.includes(o)&&(a[o]=t[o]),a),{}));const n={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),vL(e.headers,t,n)):e.url=_L(e.url,t,n)}getNextFrag(e){var t;const s=(t=this.hls.levels[e.level])==null?void 0:t.details;if(s){const r=e.sn-s.startSN;return s.fragments[r+1]}}getNextPart(e){var t;const{index:s,fragment:r}=e,n=(t=this.hls.levels[r.level])==null||(t=t.details)==null?void 0:t.partList;if(n){const{sn:a}=r;for(let o=n.length-1;o>=0;o--){const l=n[o];if(l.index===s&&l.fragment.sn===a)return n[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return It.TIMED_TEXT;if(e.sn==="initSegment")return It.INIT;if(t==="audio")return It.AUDIO;if(t==="main")return this.hls.audioTracks.length?It.VIDEO:It.MUXED}getTopBandwidth(e){let t=0,s;const r=this.hls;if(e===It.AUDIO)s=r.audioTracks;else{const n=r.maxAutoLevel,a=n>-1?n+1:r.levels.length;s=r.levels.slice(0,a)}return s.forEach(n=>{n.bitrate>t&&(t=n.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,s=e===It.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:oe.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}}const SL=3e5;class IL extends ti{constructor(e){super("content-steering",e.logger),this.hls=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.registerListeners()}registerListeners(){const e=this.hls;e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}
vendor: 6,682 bytes, line 42
42startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(s=>s!==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}onManifestLoaded(e,t){const{contentSteering:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:s}=t;if(s?.action===pt.SendAlternateToPenaltyBox&&s.flags===$t.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:d}=t.context;o&&r?a=this.getPathwayForGroupId(o,d,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&r&&(n=this.pathways()),n&&n.length>1&&(this.updatePathwayPriority(n),s.resolved=this.pathwayId!==a),t.details===C.BUFFER_APPEND_ERROR&&!t.fatal?s.resolved=!0:s.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${r&&r.length} priorities: ${we(n)} penalized: ${we(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const s=this.penalizedPathways,r=performance.now();Object.keys(s).forEach(n=>{r-s[n]>SL&&delete s[n]});for(let n=0;n<e.length;n++){const a=e[n];if(a in s)continue;if(a===this.pathwayId)return;const o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,Uv(t),this.hls.trigger(v.LEVELS_UPDATED,{levels:t});const d=this.hls.levels[o];l&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${d.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,s){const r=this.getLevelsForPathway(s).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===fe.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===fe.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return s}clonePathways(e){const t=this.levels;if(!t)return;const s={},r={};e.forEach(n=>{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=n;if(t.some(u=>u.pathwayId===a))return;const d=this.getLevelsForPathway(o).map(u=>{const c=new Be(u.attrs);c["PATHWAY-ID"]=a;const h=c.AUDIO&&`${c.AUDIO}_clone_${a}`,f=c.SUBTITLES&&`${c.SUBTITLES}_clone_${a}`;h&&(s[c.AUDIO]=h,c.AUDIO=h),f&&(r[c.SUBTITLES]=f,c.SUBTITLES=f);const m=EE(u.uri,c["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),g=new Ua({attrs:c,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:m,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let p=1;p<u.audioGroups.length;p++)g.addGroupId("audio",`${u.audioGroups[p]}_clone_${a}`);if(u.subtitleGroups)for(let p=1;p<u.subtitleGroups.length;p++)g.addGroupId("text",`${u.subtitleGroups[p]}_clone_${a}`);return g});t.push(...d),Vp(this.audioTracks,s,l,a),Vp(this.subtitleTracks,r,l,a)})}loadSteeringManifest(e){const t=this.hls.config,s=t.loader;this.loader&&this.loader.destroy(),this.loader=new s(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+u)}const n={responseType:"json",url:r.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},d={onSuccess:(u,c,h,f)=>{this.log(`Loaded steering manifest: "${r}"`);const m=u.data;if(m?.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":E}=m;if(g)try{this.uri=new self.URL(g,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||h.url),p&&this.clonePathways(p);const b={steeringManifest:m,url:r.toString()};this.hls.trigger(v.STEERING_MANIFEST_LOADED,b),E&&this.updatePathwayPriority(E)},onError:(u,c,h,f)=>{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${c.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${c.url} no longer available`);return}let m=this.timeToLoad*1e3;if(u.code===429){const g=this.loader;if(typeof g?.getResponseHeader=="function"){const p=g.getResponseHeader("Retry-After");p&&(m=parseFloat(p)*1e3)}this.log(`Steering manifest ${c.url} rate limited`);return}this.scheduleRefresh(this.uri||c.url,m)},onTimeout:(u,c,h)=>{this.log(`Timeout loading steering manifest (${c.url})`),this.scheduleRefresh(this.uri||c.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,l,d)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const r=(s=this.hls)==null?void 0:s.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Vp(i,e,t,s){i&&Object.keys(e).forEach(r=>{const n=i.filter(a=>a.groupId===r).map(a=>{const o=ke({},a);return o.details=void 0,o.attrs=new Be(o.attrs),o.url=o.attrs.URI=EE(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[r],o.attrs["PATHWAY-ID"]=s,o});i.push(...n)})}function EE(i,e,t,s){const{HOST:r,PARAMS:n,[t]:a}=s;let o;e&&(o=a?.[e],o&&(i=o));const l=new self.URL(i);
42return r&&!o&&(l.host=r),n&&Object.keys(n).sort().forEach(d=>{d&&l.searchParams.set(d,n[d])}),l.href}class hn extends ti{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=hn.CDMCleanupPromise?[hn.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:s,initData:r}=t,n=`"${t.type}" event: init data type: "${s}"`;if(this.debug(n),r!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=Qn(this.config));const o=a.map(Lu).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(a=>{const o=Yo(a);if(s!=="sinf"||o!==He.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${s}" for selected key-system ${o}`);return}let l;try{const f=rt(new Uint8Array(r)),m=nf(JSON.parse(f).sinf),g=hv(m);if(!g)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=new Uint8Array(g.subarray(8,24))}catch(f){this.warn(`${n} Failed to parse sinf: ${f}`);return}const d=gt(l),{keyIdToKeySessionPromise:u,mediaKeySessions:c}=this;let h=u[d];for(let f=0;f<c.length;f++){const m=c[f],g=m.decryptdata;if(!g.keyId)continue;const p=gt(g.keyId);if(pd(l,g.keyId)||g.uri.replace(/-/g,"").indexOf(d)!==-1){if(h=u[p],!h)continue;if(g.pssh)break;delete u[p],g.pssh=new Uint8Array(r),g.keyId=l,h=u[d]=h.then(()=>this.generateRequestWithPreferredKeySession(m,s,r,"encrypted-event-key-match")),h.catch(E=>this.handleError(E));break}}h||this.handleError(new Error(`Key ID ${d} not encountered in playlist. Key-system sessions ${c.length}.`))}).catch(a=>this.handleError(a))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const 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}
42registerListeners(){this.hls.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(v.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(v.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(v.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(v.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(v.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(v.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(v.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(v.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,r=t?.[e];if(r)return r.licenseUrl;if(e===He.WIDEVINE&&s)return s}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,s=t?.[e];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,s=(a,o,l)=>!!a&&l.indexOf(a)===o,r=t.map(a=>a.audioCodec).filter(s),n=t.map(a=>a.videoCodec).filter(s);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,o)=>{const l=d=>{const u=d.shift();this.getMediaKeysPromise(u,r,n).then(c=>a({keySystem:u,mediaKeys:c})).catch(c=>{d.length?l(d):c instanceof Nt?o(c):o(new Nt({type:ee.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_ACCESS,error:c,fatal:!0},c.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${s}`;return kv===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return s(e,t)}getMediaKeysPromise(e,t,s){var r;const n=n1(e,t,s,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],o=(r=a)==null?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${we(n)}`),o=this.requestMediaKeySystemAccess(e,n);const l=a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(d=>{this.log(`Failed to obtain access to key-system "${e}": ${d}`)}),o.then(d=>{this.log(`Access for key-system "${d.keySystem}" obtained`);const u=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const c=l.mediaKeys=d.createMediaKeys().then(h=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=!0,u.then(f=>f?this.setMediaKeysServerCertificate(h,e,f):h)));return c.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),c})}return o.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${gt(e.keyId||[])} keyUri: ${e.uri}`);const r=s.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),r=bo(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(s,n,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyId ${gt(e.decryptdata.keyId||[])} 43 } (data length: ${t.byteLength})`),s.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Lu(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:s})=>this.attemptSetMediaKeys(t,s))}selectKeySystem(e){return new Promise((t,s)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:r})=>{const n=Lu(r);n?t(n):s(new Error(`Unable to find format for key-system "${r}"`))}).catch(s)})}selectKeySystemFormat(e){const 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){const t=Qn(this.config),s=e.map(Yo).filter(r=>!!r&&t.indexOf(r)!==-1);return this.selectKeySystem(s)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let s=0;s<t.length;s++){const r=LL(e,t[s]);if(r)return r}}loadKey(e){const t=e.keyInfo.decryptdata,s=bo(t),r=this.bannedKeyIds[s];if(r||this.getKeyStatus(t)==="internal-error"){const o=Wp(r||"internal-error",t);return this.handleError(o,e.frag),Promise.reject(o)}const n=`(keyId: ${s} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);const a=this.keyIdToKeySessionPromise[s];if(!a){const o=this.getKeySystemForKeyPromise(t).then(({keySystem:l,mediaKeys:d})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(l,d).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:l,mediaKeys:d,decryptdata:t}))))).then(l=>{const d="cenc",u=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(l,d,u,"playlist-key")});return o.catch(l=>this.handleError(l,e.frag)),this.keyIdToKeySessionPromise[s]=o,o}return a.catch(o=>{if(o instanceof Nt){const l=Ie({},o.data);this.getKeyStatus(t)==="internal-error"&&(l.decryptdata=t);const d=new Nt(l,o.message);this.handleError(d,e.frag)}}),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof Nt){t&&(e.data.frag=t);const s=e.data.decryptdata;this.error(`${e.message}${s?` (${gt(s.keyId||[])})`:""}`),this.hls.trigger(v.ERROR,e.data)}else this.error(e.message),this.hls.trigger(v.ERROR,{type:ee.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}
43getKeySystemForKeyPromise(e){const t=bo(e),s=this.keyIdToKeySessionPromise[t];if(!s){const r=Yo(e.keyFormat),n=r?[r]:Qn(this.config);return this.attemptKeySystemAccess(n)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=Qn(this.config)),e.length===0)throw new Nt({type:ee.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${we({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(s).then(()=>this.media?this.media.setMediaKeys(t):new Promise((n,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(n).catch(a)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>s.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,s,r){var n;const a=(n=this.config.drmSystems)==null||(n=n[e.keySystem])==null?void 0:n.generateRequest;if(a)try{const m=a.call(this.hls,t,s,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,s=m.initData?m.initData:null,e.decryptdata.pssh=s?new Uint8Array(s):null}catch(m){if(this.warn(m.message),this.hls&&this.hls.config.debug)throw m}if(s===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const o=bo(e.decryptdata),l=e.decryptdata.uri;this.log(`Generating key-session request for "${r}" keyId: ${o} URI: ${l} (init data type: ${t} length: ${s.byteLength})`);const d=new of,u=e._onmessage=m=>{const g=e.mediaKeysSession;if(!g){d.emit("error",new Error("invalid state"));return}const{messageType:p,message:E}=m;this.log(`"${p}" message event for session "${g.sessionId}" message size: ${E.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,E).catch(b=>{d.eventNames().length?d.emit("error",b):this.handleError(b)}):p==="license-release"?e.keySystem===He.FAIRPLAY&&this.updateKeySession(e,Tc("acknowledged")).then(()=>this.removeSession(e)).catch(b=>this.handleError(b)):this.warn(`unhandled media key message type "${p}"`)},c=(m,g)=>{g.keyStatus=m;let p;m.startsWith("usable")?d.emit("resolved"):m==="internal-error"||m==="output-restricted"||m==="output-downscaled"?p=Wp(m,g.decryptdata):m==="expired"?p=new Error(`key expired (keyId: ${o})`):m==="released"?p=new Error("key released"):m==="status-pending"||this.warn(`unhandled key status change "${m}" (keyId: ${o})`),p&&(d.eventNames().length?d.emit("error",p):this.handleError(p))},h=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}const p=this.getKeyStatuses(e);if(!Object.keys(p).some(T=>p[T]!=="status-pending"))return;if(p[o]==="expired"){this.log(`Expired key ${we(p)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let b=p[o];if(b)c(b,e);else{var y;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(y=e.keyStatusTimeouts)[o]||(y[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const A=this.getKeyStatus(e.decryptdata);if(A&&A!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${A} from other session.`),c(A,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),b="internal-error",c(b,e)},1e3)),this.log(`No status for keyId ${o} (${we(p)}).`)}};St(e.mediaKeysSession,"message",u),St(e.mediaKeysSession,"keystatuseschange",h);const f=new Promise((m,g)=>{d.on("error",g),d.on("resolved",m)});return e.mediaKeysSession.generateRequest(t,s).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${l}`)}).catch(m=>{throw new Nt({type:ee.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_SESSION,error:m,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>f).catch(m=>(d.removeAllListeners(),this.removeSession(e).then(()=>{throw m}))).then(()=>(d.removeAllListeners(),e))}getKeyStatuses(e){const t={};
43return e.mediaKeysSession.keyStatuses.forEach((s,r)=>{if(typeof r=="string"&&typeof s=="object"){const o=r;r=s,s=o}const n="buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);if(e.keySystem===He.PLAYREADY&&n.length===16){const o=gt(n);t[o]=s,Rv(n)}const a=gt(n);s==="internal-error"&&(this.bannedKeyIds[a]=s),this.log(`key status change "${s}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),t[a]=s}),t}fetchServerCertificate(e){const t=this.config,s=t.loader,r=new s(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={responseType:"arraybuffer",url:n},d=t.certLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,g)=>{a(h.data)},onError:(h,f,m,g)=>{o(new Nt({type:ee.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:Ie({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${n}). Status: ${h.code} (${h.text})`))},onTimeout:(h,f,m)=>{o(new Nt({type:ee.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(h,f,m)=>{o(new Error("aborted"))}};r.load(l,u,c)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((r,n)=>{e.setServerCertificate(s).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${s.byteLength}) on "${t}"`),r(e)}).catch(a=>{n(new Nt({type:ee.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(s=>this.updateKeySession(e,new Uint8Array(s)).catch(r=>{throw new Nt({type:ee.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:r,fatal:!1},r.message)}))}unpackPlayReadyKeyMessage(e,t){const s=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(s,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let u;for(let c=0,h=n.length;c<h;c++){var a,o;u=n[c];const f=(a=u.querySelector("name"))==null?void 0:a.textContent,m=(o=u.querySelector("value"))==null?void 0:o.textContent;f&&m&&e.setRequestHeader(f,m)}}const l=r.querySelector("Challenge"),d=l?.textContent;if(!d)throw new Error("Cannot find <Challenge> in key message");return Tc(atob(d))}setupLicenseXHR(e,t,s,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,s,r)}).catch(a=>{if(!s.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,s,r)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const d=this.config.licenseResponseCallback;if(d)try{l=d.call(this.hls,o,a,e)}catch(u){this.error(u)}r(l)}else{const l=s.errorRetry,d=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>d||o.status>=400&&o.status<500)n(new Nt({type:ee.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const u=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:d})=>{e.keySystem==He.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(l,d)),l.send(d)}).catch(n)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,St(s,"encrypted",this.onMediaEncrypted),St(s,"waitingforkey",this.onWaitingForKey);const r=this.mediaResolved;r?r():this.mediaKeys=s.mediaKeys}onMediaDetached(){const e=this.media;e&&(xt(e,"encrypted",this.onMediaEncrypted),xt(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const s=this.media,r=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Os.clearKeyUriToKeyIdMap();const n=r.length;hn.CDMCleanupPromise=Promise.all(r.map(a=>this.removeSession(a)).concat((s==null||(e=s.setMediaKeys(null))==null?void 0:e.catch(a=>
43{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.trigger(v.ERROR,{type:ee.OTHER_ERROR,details:C.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${a}`)})}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.trigger(v.ERROR,{type:ee.OTHER_ERROR,details:C.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${a}`)})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s,decryptdata:r}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${gt(r?.keyId||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{keyStatusTimeouts:a}=e;a&&Object.keys(a).forEach(d=>self.clearTimeout(a[d]));const{drmSystemOptions:o}=this.config;return(o1(o)?new Promise((d,u)=>{self.setTimeout(()=>u(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(d).catch(u)}):Promise.resolve()).catch(d=>{this.log(`Could not remove session: ${d}`),this.hls&&this.hls.trigger(v.ERROR,{type:ee.OTHER_ERROR,details:C.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${d}`)})}).then(()=>t.close()).catch(d=>{this.log(`Could not close session: ${d}`),this.hls&&this.hls.trigger(v.ERROR,{type:ee.OTHER_ERROR,details:C.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${d}`)})})}return Promise.resolve()}}hn.CDMCleanupPromise=void 0;function bo(i){if(!i)throw new Error("Could not read keyId of undefined decryptdata");if(i.keyId===null)throw new Error("keyId is null");return gt(i.keyId)}function LL(i,e){if(i.keyId&&e.mediaKeysSession.keyStatuses.has(i.keyId))return e.mediaKeysSession.keyStatuses.get(i.keyId);if(i.matches(e.decryptdata))return e.keyStatus}class Nt extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function Wp(i,e){const t=i==="output-restricted",s=t?C.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:C.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Nt({type:ee.KEY_SYSTEM_ERROR,details:s,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${i}"`)}class RL{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}
vendor: 11,183 bytes, line 43
43registerListeners(){this.hls.on(v.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(v.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(v.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(v.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const s=this.hls.config;if(s.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,s){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,a=s-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/n,d=this.hls;if(d.trigger(v.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:s}),l>0&&a>d.config.fpsDroppedMonitoringThreshold*o){let u=d.currentLevel;d.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(d.autoLevelCapping===-1||d.autoLevelCapping>=u)&&(u=u-1,d.trigger(v.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:d.currentLevel}),d.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=s,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function yE(i,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=i,e.dispatchEvent(t)}function bE(i,e){const t=i.mode;if(t==="disabled"&&(i.mode="hidden"),i.cues&&!i.cues.getCueById(e.id))try{if(i.addCue(e),!i.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){Le.debug(`[texttrack-utils]: ${s}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,i.addCue(r)}catch(r){Le.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(i.mode=t)}function rn(i,e){const t=i.mode;if(t==="disabled"&&(i.mode="hidden"),i.cues)for(let s=i.cues.length;s--;)e&&i.cues[s].removeEventListener("enter",e),i.removeCue(i.cues[s]);t==="disabled"&&(i.mode=t)}function Dc(i,e,t,s){const r=i.mode;if(r==="disabled"&&(i.mode="hidden"),i.cues&&i.cues.length>0){const n=kL(i.cues,e,t);for(let a=0;a<n.length;a++)(!s||s(n[a]))&&i.removeCue(n[a])}r==="disabled"&&(i.mode=r)}function xL(i,e){if(e<=i[0].startTime)return 0;const t=i.length-1;if(e>i[t].endTime)return-1;let s=0,r=t,n;for(;s<=r;)if(n=Math.floor((r+s)/2),e<i[n].startTime)r=n-1;else if(e>i[n].startTime&&s<t)s=n+1;else return n;return i[s].startTime-e<e-i[r].startTime?s:r}function kL(i,e,t){const s=[],r=xL(i,e);if(r>-1)for(let n=r,a=i.length;n<a;n++){const o=i[n];if(o.startTime>=e&&o.endTime<=t)s.push(o);else if(o.startTime>t)return s}return s}function Qo(i){const e=[];for(let t=0;t<i.length;t++){const s=i[t];(s.kind==="subtitles"||s.kind==="captions")&&s.label&&e.push(i[t])}return e}class DL extends mf{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.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const s=Qo(this.media.textTracks);for(let n=0;n<s.length;n++)if(s[n].mode==="hidden")t=s[n];else if(s[n].mode==="showing"){t=s[n];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},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(){const{hls:e}=this;e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.LEVEL_LOADING,this.onLevelLoading,this),e.on(v.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(v.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(v.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.LEVEL_LOADING,this.onLevelLoading,this),e.off(v.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(v.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(v.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(e,t){const s=this.media;if(!s)return;const r=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||s.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,r)return;Qo(s.textTracks).forEach(a=>{rn(a)})}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){const{id:s,groupId:r,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Subtitle track with id:${s} and group:${r} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.subtitleGroups||null,r=this.groupIds;let n=this.currentTrack;if(!s||r?.length!==s?.length||s!=null&&s.some(a=>r?.indexOf(a)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(u=>!s||s.indexOf(u.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(u=>u.default)&&(this.selectDefaultTrack=!1),a.forEach((u,c)=>{u.id=c});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!n&&o){this.selectDefaultTrack=!1;const u=Fi(o,a);if(u>-1)n=a[u];else{const c=Fi(o,this.tracks);n=this.tracks[c]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const d={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${s?.join(",")}" group-id`),this.hls.trigger(v.SUBTITLE_TRACKS_UPDATED,d),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}}findTrackId(e){const t=this.tracksInGroup,s=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const n=t[r];if(!(s&&!n.default||!s&&!e)&&(!e||fr(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Ha(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Ha(e.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const r=t[s];if(Lc(r,e))return s}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===fe.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&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){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const s=this.currentTrack;if(s&&fr(e,s))return s;const r=Fi(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(s)return null;{const n=Fi(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading subtitle ${s} "${e.name}" lang:${e.lang} group:${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${n}`),this.hls.trigger(v.SUBTITLE_TRACK_LOADING,{url:n,id:s,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Qo(e.textTracks),s=this.currentTrack;let r;if(s&&(r=t.filter(n=>Lc(s,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!j(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(v.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===s&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:a,groupId:o="",name:l,type:d,url:u}=r;this.hls.trigger(v.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:d,url:u});const c=this.switchParams(r.url,s?.details,r.details);this.loadPlaylist(c)}}function CL(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}function _a(i){let e=5381,t=i.length;for(;t;
vendor: 8,464 bytes, line 43
43)e=e*33^i.charCodeAt(--t);return(e>>>0).toString()}const fn=.025;let yd=(function(i){return i[i.Point=0]="Point",i[i.Range=1]="Range",i})({});function wL(i,e,t){return`${i.identifier}-${t+1}-${_a(e)}`}class ML{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const s=this.playoutLimit;return e<=0||isNaN(s)?!1:s===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>s}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Ou(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,s=Ou(t,e);return t-s<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=j(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return Ou(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<fn))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?yd.Range:yd.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return PL(this)}}function Ou(i,e){return i-e.start<e.duration/2&&!(Math.abs(i-(e.start+e.duration))<fn)?e.start:e.start+e.duration}function TE(i,e,t){const s=new self.URL(i,t);return s.protocol!=="data:"&&s.searchParams.set("_HLS_primary_id",e),s}function Nu(i,e){for(;(t=i.assetList[++e])!=null&&t.error;)var t;return e}function PL(i){return`["${i.identifier}" ${i.cue.pre?"<pre>":i.cue.post?"<post>":""}${i.timelineStart.toFixed(2)}-${i.resumeTime.toFixed(2)}]`}function $r(i){const e=i.timelineStart,t=i.duration||0;return`["${i.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class OL{constructor(e,t,s,r){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(v.PLAYOUT_LIMIT_REACHED,{})};const n=this.hls=new e(t);this.interstitial=s,this.assetItem=r;const a=()=>{this.hasDetails=!0};n.once(v.LEVEL_LOADED,a),n.once(v.AUDIO_TRACK_LOADED,a),n.once(v.SUBTITLE_TRACK_LOADED,a),n.on(v.MEDIA_ATTACHING,(o,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(v.BUFFER_APPENDED,()=>{const u=this.bufferedEnd;this.reachedPlayout(u)&&(this._bufferedEosTime=u,n.trigger(v.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=TE(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const s=Math.min(this._bufferedEosTime||1/0,this.duration),r=this.timelineOffset,n=oe.bufferInfo(e,r,0);return this.getAssetTime(n.end)>=s-.02}reachedPlayout(e){const s=this.interstitial.playoutLimit;return this.startOffset+e>=s}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=oe.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const s=t-this.startOffset;if(s>0&&s<e)return s}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const s=e-t;if(Math.abs(s)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,e-t),s)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=s=>delete s.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,s){var r;(r=this.hls)==null||r.on(e,t)}once(e,t,s){var r;(r=this.hls)==null||r.once(e,t)}off(e,t,s){var r;(r=this.hls)==null||r.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${$r(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Yp=.033;class NL extends ti{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={}
vendor: 2,217 bytes, line 43
43,this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((s,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,s+1):s,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let s=-1;e.nextEvent?s=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(s=this.findEventIndex(e.previousEvent.identifier)+1);const r=this.items;if(r)for(r[s]||(t===void 0&&(t=e.start),s=this.findItemIndexAtTime(t));s>=0&&(n=r[s])!=null&&n.event;){var n;s--}return s}findItemIndexAtTime(e,t){const s=this.items;if(s)for(let r=0;r<s.length;r++){let n=s[r];if(t&&t!=="primary"&&(n=n[t]),e===n.start||e>n.start&&e<n.end)return r}return-1}findJumpRestrictedIndex(e,t){const s=this.items;if(s)for(let r=e;r<=t&&s[r];r++){const n=s[r].event;if(n!=null&&n.restrictions.jump&&!n.appendInPlace)return r}return-1}findEventIndex(e){const t=this.items;if(t)for(let r=t.length;r--;){var s;if(((s=t[r].event)==null?void 0:s.identifier)===e)return r}return-1}findAssetIndex(e,t){const s=e.assetList,r=s.length;if(r>1)for(let n=0;n<r;n++){const a=s[n];if(!a.error){const o=a.timelineStart;if(t===o||t>o&&(t<o+(a.duration||0)||n===r-1))return n}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const s=t.assetList,r=s[s.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,t){const s=e.main.details,{dateRanges:r}=s,n=this.events,a=this.parseDateRanges(r,{url:s.url},t),o=Object.keys(r),l=n?n.filter(d=>!o.includes(d.identifier)):[];a.length&&a.sort((d,u)=>{const c=d.cue.pre,h=d.cue.post,f=u.cue.pre,m=u.cue.post;if(c&&!f)return-1;if(f&&!c||h&&!m)return 1;if(m&&!h)return-1;if(!c&&!f&&!h&&!m){const g=d.startTime,p=u.startTime;if(g!==p)return g-p}return d.dateRange.tagOrder-u.dateRange.tagOrder}),this.events=a,l.forEach(d=>{this.removeEvent(d)}),this.updateSchedule(e,l)}updateSchedule(e,t=[],s=!1){const r=this.events||[];
vendor: 19,312 bytes, lines 43-44
43if(r.length||t.length||this.length<2){const n=this.items,a=this.parseSchedule(r,e);(s||t.length||n?.length!==a.length||a.some((l,d)=>Math.abs(l.playout.start-n[d].playout.start)>.005||Math.abs(l.playout.end-n[d].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,s){const r=[],n=Object.keys(e);for(let a=0;a<n.length;a++){const o=n[a],l=e[o];if(l.isInterstitial){let d=this.eventMap[o];d?d.setDateRange(l):(d=new ML(l,t),this.eventMap[o]=d,s===!1&&(d.appendInPlace=s)),r.push(d)}}return r}parseSchedule(e,t){const s=[],r=t.main.details,n=r.live?1/0:r.edge;let a=0;if(e=e.filter(l=>!l.error&&!(l.cue.once&&l.hasPlayed)),e.length){this.resolveOffsets(e,t);let l=0,d=0;if(e.forEach((u,c)=>{const h=u.cue.pre,f=u.cue.post,m=e[c-1]||null,g=u.appendInPlace,p=f?n:u.startOffset,E=u.duration,b=u.timelineOccupancy===yd.Range?E:0,y=u.resumptionOffset,T=m?.startTime===p,A=p+u.cumulativeDuration;let L=g?A+E:p+y;if(h||!f&&p<=0){const R=d;d+=b,u.timelineStart=A;const x=a;a+=E,s.push({event:u,start:A,end:L,playout:{start:x,end:a},integrated:{start:R,end:d}})}else if(p<=n){if(!T){const I=p-l;if(I>Yp){const M=l,$=d;d+=I;const V=a;a+=I;const Y={previousEvent:e[c-1]||null,nextEvent:u,start:M,end:M+I,playout:{start:V,end:a},integrated:{start:$,end:d}};s.push(Y)}else I>0&&m&&(m.cumulativeDuration+=I,s[s.length-1].end=p)}f&&(L=A),u.timelineStart=A;const R=d;d+=b;const x=a;a+=E,s.push({event:u,start:A,end:L,playout:{start:x,end:a},integrated:{start:R,end:d}})}else return;const S=u.resumeTime;f||S>n?l=n:l=S}),l<n){var o;const u=l,c=d,h=n-l;d+=h;const f=a;a+=h,s.push({previousEvent:((o=s[s.length-1])==null?void 0:o.event)||null,nextEvent:null,start:l,end:u+h,playout:{start:f,end:a},integrated:{start:c,end:d}})}this.setDurations(n,a,d)}else s.push({previousEvent:null,nextEvent:null,start:0,end:n,playout:{start:0,end:n},integrated:{start:0,end:n}}),this.setDurations(n,n,n);return s}setDurations(e,t,s){this.durations={primary:e,playout:t,integrated:s}}resolveOffsets(e,t){const s=t.main.details,r=s.live?1/0:s.edge;let n=0,a=-1;e.forEach((o,l)=>{const d=o.cue.pre,u=o.cue.post,c=d?0:u?r:o.startTime;this.updateAssetDurations(o),a===c?o.cumulativeDuration=n:(n=0,a=c),!u&&o.snapOptions.in&&(o.resumeAnchor=yr(null,s.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&l+1<e.length&&e[l+1].startTime-e[l].resumeTime<Yp&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const f=j(o.resumeOffset)?o.resumeOffset:o.duration;n+=f})}primaryCanResumeInPlaceAt(e,t){const s=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(s-r)>fn?(this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${r}`),!1):!Object.keys(t).some(a=>{const o=t[a].details,l=o.edge;if(s>=l)return this.log(`"${e.identifier}" resumption ${s} past ${a} playlist end ${l}`),!1;const d=yr(null,o.fragments,s);if(!d)return this.log(`"${e.identifier}" resumption ${s} does not align with any fragments in ${a} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const u=a==="audio"?.175:0;return Math.abs(d.start-s)<fn+u||Math.abs(d.end-s)<fn+u?!1:(this.log(`"${e.identifier}" resumption ${s} not aligned with ${a} fragment bounds (${d.start}-${d.end} sn: ${d.sn} cc: ${d.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let s=0,r=!1,n=!1;for(let a=0;a<e.assetList.length;a++){const o=e.assetList[a],l=t+s;o.startOffset=s,o.timelineStart=l,r||(r=o.duration===null),n||(n=!!o.error);const d=o.error?0:o.duration||0;s+=d}r&&!n?e.duration=Math.max(s,e.duration):e.duration=s}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function ri(i){return`[${i.event?'"'+i.event.identifier+'"':"primary"}: ${i.start.toFixed(2)}-${i.end.toFixed(2)}]`}class UL{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const s=e.assetListUrl;let r;try{r=TE(s,this.hls.sessionId,e.baseUrl)}catch(h){const f=this.assignAssetListError(e,C.ASSET_LIST_LOAD_ERROR,h,s);this.hls.trigger(v.ERROR,f);return}t&&r.protocol!=="data:"&&r.searchParams.set("_HLS_start_offset",""+t);const n=this.hls.config,a=n.loader,o=new a(n),l={responseType:"json",url:r.href},d=n.interstitialAssetListLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,g)=>{const p=h.data,E=p?.ASSETS;if(!Array.isArray(E)){const b=this.assignAssetListError(e,C.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),m.url,f,g);this.hls.trigger(v.ERROR,b);return}e.assetListResponse=p,this.hls.trigger(v.ASSET_LIST_LOADED,{event:e,assetListResponse:p,networkDetails:g})},onError:(h,f,m,g)=>{const p=this.assignAssetListError(e,C.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${h.code} ${h.text} (${f.url})`),f.url,g,m);this.hls.trigger(v.ERROR,p)},onTimeout:(h,f,m)=>{const g=this.assignAssetListError(e,C.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${f.url})`),f.url,h,m);this.hls.trigger(v.ERROR,g)}};return o.load(l,u,c),this.hls.trigger(v.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,s,r,n,a){return e.error=s,{type:ee.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:s,networkDetails:a,stats:n}}}function qp(i){var e;i==null||(e=i.play())==null||e.catch(()=>{})}function To(i,e){return`[${i}] Advancing timeline position to ${e}`}class $L extends ti{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled||!this.schedule)return;const r=s-this.timelinePos;if(Math.abs(r)<1/7056e5)return;const a=r<=-.01;this.timelinePos=s,this.bufferedPos=s;const o=this.playingItem;if(!o){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(s,s-r)&&this.updateSchedule(!0),this.checkBuffer(),a&&s<o.start||s>=o.end){var l;const f=this.findItemIndex(o);let m=this.schedule.findItemIndexAtTime(s);if(m===-1&&(m=f+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${s} (resolving from ${f} to ${m})`)),!this.isInterstitial(o)&&(l=this.media)!=null&&l.paused&&(this.shouldPlay=!1),!a&&m>f){const g=this.schedule.findJumpRestrictedIndex(f+1,m);if(g>f){this.setSchedulePosition(g);return}}this.setSchedulePosition(m);return}const d=this.playingAsset;if(!d){if(this.playingLastItem&&this.isInterstitial(o)){const f=o.event.assetList[0];f&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,f))}return}const u=d.timelineStart,c=d.duration||0;if(a&&s<u||s>=u+c){var h;(h=o.event)!=null&&h.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(s)),this.setScheduleToAssetAtTime(s,d)}},this.onTimeupdate=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)return;if(s>this.timelinePos)this.timelinePos=s,s>this.bufferedPos&&this.checkBuffer();else return;const r=this.playingItem;if(!r||this.playingLastItem)return;if(s>=r.end){this.timelinePos=r.end;const o=this.findItemIndex(r);this.setSchedulePosition(o+1)}const n=this.playingAsset;if(!n)return;const a=n.timelineStart+(n.duration||0);s>=a&&this.setScheduleToAssetAtTime(s,n)},this.onScheduleUpdate=(s,r)=>{const n=this.schedule;if(!n)return;const a=this.playingItem,o=n.events||[],l=n.items||[],d=n.durations,u=s.map(g=>g.identifier),c=!!(o.length||u.length);(c||r)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o} 44Schedule: ${l.map(g=>ri(g))} pos: ${this.timelinePos}`),u.length&&this.log(`Removed events ${u}`);let h=null,f=null;a&&(h=this.updateItem(a,this.timelinePos),this.itemsMatch(a,h)?this.playingItem=h:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const m=this.bufferingItem;if(m&&(f=this.updateItem(m,this.bufferedPos),this.itemsMatch(m,f)?this.bufferingItem=f:m.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(m.event,null))),s.forEach(g=>{g.assetList.forEach(p=>{this.clearAssetPlayer(p.identifier,null)})}),this.playerQueue.forEach(g=>{if(g.interstitial.appendInPlace){const p=g.assetItem.timelineStart,E=g.timelineOffset-p;if(E)try{g.timelineOffset=p}catch(b){Math.abs(E)>fn&&this.warn(`${b} ("${g.assetId}" ${g.timelineOffset}->${p})`)}}}),c||r){if(this.hls.trigger(v.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:l.slice(0),durations:d,removedIds:u}),this.isInterstitial(a)&&u.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(h,a),m&&f!==h&&this.trimInPlace(f,m),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new UL(e),this.schedule=new NL(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(v.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(v.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(v.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(v.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(v.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(v.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(v.BUFFER_APPENDED,this.onBufferAppended,this),e.on(v.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(v.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(v.MEDIA_ENDED,this.onMediaEnded,this),e.on(v.ERROR,this.onError,this),e.on(v.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(v.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(v.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(v.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(v.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(v.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(v.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(v.BUFFER_CODECS,this.onBufferCodecs,this),e.off(v.BUFFER_APPENDED,this.onBufferAppended,this),e.off(v.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(v.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(v.MEDIA_ENDED,this.onMediaEnded,this),e.off(v.ERROR,this.onError,this),e.off(v.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){xt(e,"play",this.onPlay),xt(e,"pause",this.onPause),xt(e,"seeking",this.onSeeking),xt(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const s=this.media=t.media;St(s,"seeking",this.onSeeking),St(s,"timeupdate",this.onTimeupdate),St(s,"play",this.onPlay),St(s,"pause",this.onPause)}onMediaAttached(e,t){const s=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,s===null)this.checkStart();else if(!r){this.clearScheduleState();const n=this.findItemIndex(s);this.setSchedulePosition(n)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const s=!!t.transferMedia,r=this.media;if(this.media=null,!s&&(r&&this.removeMediaListeners(r),this.detachedData)){const n=this.getBufferingPlayer();n&&(this.log(`Removing schedule state for detachedData and ${n}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,n.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,s=c=>c&&e.getAssetPlayer(c.identifier),r=(c,h,f,m,g)=>{if(c){let p=c[h].start;const E=c.event;if(E){if(h==="playout"||E.timelineOccupancy!==yd.Point){const b=s(f);b?.interstitial===E&&(p+=b.assetItem.startOffset+b[g])}}else{const b=m==="bufferedPos"?a():e[m];p+=b-c.start}return p}return 0},n=(c,h)=>{var f;if(c!==0&&h!=="primary"&&(f=e.schedule)!=null&&f.length){var m;const g=e.schedule.findItemIndexAtTime(c),p=(m=e.schedule.items)==null?void 0:m[g];if(p){const E=p[h].start-p.start;return c+E}}return c},a=()=>{const c=e.bufferedPos;return c===Number.MAX_VALUE?o("primary"):Math.max(c,0)},o=c=>{var h,f;return(h=e.primaryDetails)!=null&&h.live?e.primaryDetails.edge:((f=e.schedule)==null?void 0:f.durations[c])||0},l=(c,h)=>{var f,m;const g=e.effectivePlayingItem;if(g!=null&&(f=g.event)!=null&&f.restrictions.skip||!e.schedule)return;e.log(`seek to ${c} "${h}"`);const p=e.effectivePlayingItem,E=e.schedule.findItemIndexAtTime(c,h),b=(m=e.schedule.items)==null?void 0:m[E],y=e.getBufferingPlayer(),T=y?.interstitial,A=T?.appendInPlace,L=p&&e.itemsMatch(p,b);if(p&&(A||L)){const S=s(e.playingAsset),R=S?.media||e.primaryMedia;if(R){const x=h==="primary"?R.currentTime:r(p,h,e.playingAsset,"timelinePos","currentTime"),I=c-x,M=(A?x:R.currentTime)+I;if(M>=0&&(!S||A||M<=S.duration)){R.currentTime=M;return}}}if(b){let S=c;if(h!=="primary"){const x=b[h].start,I=c-x;S=b.start+I}const R=!e.isInterstitial(b);if((!e.isInterstitial(p)||p.event.appendInPlace)&&(R||b.event.appendInPlace)){const x=e.media||(A?y?.media:null);x&&(x.currentTime=S)}else if(p){const x=e.findItemIndex(p);if(E>x){const M=e.schedule.findJumpRestrictedIndex(x+1,E);if(M>x){e.setSchedulePosition(M);return}}let I=0;if(R)e.timelinePos=S,e.checkBuffer();else{const M=b.event.assetList,$=c-(b[h]||b).start;for(let V=M.length;V--;){const Y=M[V];if(Y.duration&&$>=Y.startOffset&&$<Y.startOffset+Y.duration){I=V;break}}}e.setSchedulePosition(E,I)}}},d=()=>{const c=e.effectivePlayingItem;if(e.isInterstitial(c))return c;const h=t();return e.isInterstitial(h)?h:null},u={get bufferedEnd(){const c=t(),h=e.bufferingItem;if(h&&h===c){var f;return r(h,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-h.playout.start||((f=e.bufferingAsset)==null?void 0:f.startOffset)||0}return 0},get currentTime(){const c=d(),h=e.effectivePlayingItem;return h&&h===c?r(h,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-h.playout.start:0},set currentTime(c){const h=d(),f=e.effectivePlayingItem;f&&f===h&&l(c+f.playout.start,"playout")},get duration(){const c=d();return c?c.playout.end-c.playout.start:0},get assetPlayers(){var c;const h=(c=d())==null?void 0:c.event.assetList;return h?h.map(f=>e.getAssetPlayer(f.identifier)):[]},get playingIndex(){var c;const h=(c=d())==null?void 0:c.event;return h&&e.effectivePlayingAsset?h.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return d()}};return this.manager={get events(){var c;return((c=e.schedule)==null||(c=c.events)==null?void 0:c.slice(0))||[]},get schedule(){var c;return((c=e.schedule)==null||(c=c.items)==null?void 0:c.slice(0))||[]},get interstitialPlayer(){return d()?u:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const c=t();return e.findItemIndex(c)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const c=e.effectivePlayingItem;return e.findItemIndex(c)},primary:{get bufferedEnd(){return a()},get currentTime(){const c=e.timelinePos;return c>0?c:0},set currentTime(c){l(c,"primary")},get duration(){return o("primary")},get seekableStart(){var c;return((c=e.primaryDetails)==null?void 0:c.fragmentStart)||0}},integrated:{get bufferedEnd(){return r(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(c){l(c,"integrated")},get duration(){return o("integrated")},get seekableStart(){var c;return n(((c=e.primaryDetails)==null?void 0:c.fragmentStart)||0,"integrated")}},skip:()=>{const c=e.effectivePlayingItem,h=c?.event;if(h&&!h.restrictions.skip){const f=e.findItemIndex(c);if(h.appendInPlace){const m=c.playout.start+c.event.duration;l(m+.001,"playout")}else e.advanceAfterAssetEnded(h,f,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,s=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!s?!1:this.findItemIndex(t)===s.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(r=this.primaryMedia);const n=(t=r)==null?void 0:t.currentTime;if(!(n===void 0||!j(n)))return n}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const s=this.getAssetPlayer(e);s&&this.transferMediaFromPlayer(s,t)}transferMediaFromPlayer(e,t){const s=e.interstitial.appendInPlace,r=e.media;if(s&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}const n=e.transferMedia();this.log(`transfer MediaSource from ${e} ${we(n)}`),this.detachedData=n}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var s,r;if(e.media===t)return;let n=null;const a=this.hls,o=e!==a,l=o&&e.interstitial.appendInPlace,d=(s=this.detachedData)==null?void 0:s.mediaSource;let u;if(a.media)l&&(n=a.transferMedia(),this.detachedData=n),u="Primary";
44else if(d){const m=this.getBufferingPlayer();m?(n=m.transferMedia(),u=`${m}`):u="detached MediaSource"}else u="detached media";if(!n){if(d)n=this.detachedData,this.log(`using detachedData: MediaSource ${we(n)}`);else if(!this.detachedData||a.media===t){const m=this.playerQueue;m.length>1&&m.forEach(g=>{if(o&&g.interstitial.appendInPlace!==l){const p=g.interstitial;this.clearInterstitial(g.interstitial,null),p.appendInPlace=!1,p.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${p}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const c=n&&"mediaSource"in n&&((r=n.mediaSource)==null?void 0:r.readyState)!=="closed",h=c&&n?n:t;this.log(`${c?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${u} (media.currentTime: ${t.currentTime})`);const f=this.schedule;if(h===n&&f){const m=o&&e.assetId===f.assetIdAtEnd;h.overrides={duration:f.duration,endOfStream:!o||m,cueRemoval:!o}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const s=this.timelinePos,r=this.effectivePlayingItem;if(s===-1){const n=this.hls.startPosition;if(this.log(To("checkStart",n)),this.timelinePos=n,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(n>=0||!this.primaryLive){const a=this.timelinePos=n>0?n:0,o=e.findItemIndexAtTime(a);this.setSchedulePosition(o)}}else if(r&&!this.playingItem){const n=e.findItemIndex(r);this.setSchedulePosition(n)}}advanceAssetBuffering(e,t){const s=e.event,r=s.findAssetIndex(t),n=Nu(s,r);if(!s.isAssetPastPlayoutLimit(n))this.bufferedToEvent(e,n);else if(this.schedule){var a;const o=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,s){const r=Nu(e,s);if(e.isAssetPastPlayoutLimit(r)){if(this.schedule){const n=this.schedule.items;if(n){const a=t+1,o=n.length;if(a>=o){this.setSchedulePosition(-1);return}const l=e.resumeTime;this.timelinePos<l&&(this.log(To("advanceAfterAssetEnded",l)),this.timelinePos=l,e.appendInPlace&&this.advanceInPlace(l),this.checkBuffer(this.bufferedPos<l)),this.setSchedulePosition(a)}}}else{if(e.appendInPlace){const n=e.assetList[r];n&&this.advanceInPlace(n.timelineStart)}this.setSchedulePosition(t,r)}}setScheduleToAssetAtTime(e,t){const s=this.schedule;if(!s)return;const r=t.parentIdentifier,n=s.getEvent(r);if(n){const a=s.findEventIndex(r),o=s.findAssetIndex(n,e);this.advanceAfterAssetEnded(n,a,o-1)}}setSchedulePosition(e,t){var s;const r=(s=this.schedule)==null?void 0:s.items;if(!r||this.playbackDisabled)return;const n=e>=0?r[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${n&&ri(n)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){const u=a.event,c=this.playingAsset,h=c?.identifier,f=h?this.getAssetPlayer(h):null;if(f&&h&&(!this.eventItemsMatch(a,n)||t!==void 0&&h!==u.assetList[t].identifier)){var l;const m=u.findAssetIndex(c);if(this.log(`INTERSTITIAL_ASSET_ENDED ${m+1}/${u.assetList.length} ${$r(c)}`),this.endedAsset=c,this.playingAsset=null,this.hls.trigger(v.INTERSTITIAL_ASSET_ENDED,{asset:c,assetListIndex:m,event:u,schedule:r.slice(0),scheduleIndex:e,player:f}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(u,this.findItemIndex(this.playingItem),m);return}this.retreiveMediaSource(h,n),f.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&f.detachMedia()}if(!this.eventItemsMatch(a,n)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${ri(a)}`),u.hasPlayed=!0,this.hls.trigger(v.INTERSTITIAL_ENDED,{event:u,schedule:r.slice(0),scheduleIndex:e}),u.cue.once)){var d;this.updateSchedule();const m=(d=this.schedule)==null?void 0:d.items;if(n&&m){const g=this.findItemIndex(n);this.advanceSchedule(g,m,t,a,o)}return}}this.advanceSchedule(e,r,t,a,o)}advanceSchedule(e,t,s,r,n){const a=this.schedule;if(!a)return;const o=t[e]||null,l=this.primaryMedia,d=this.playerQueue;if(d.length&&d.forEach(u=>{const c=u.interstitial,h=a.findEventIndex(c.identifier);(h<e||h>e+1)&&this.clearInterstitial(c,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const u=o.event;if(s===void 0){s=a.findAssetIndex(u,this.timelinePos);const m=Nu(u,s-1);if(u.isAssetPastPlayoutLimit(m)||u.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(u,e,s);return}s=m}const c=this.waitingItem;this.assetsBuffered(o,l)||this.setBufferingItem(o);let h=this.preloadAssets(u,s);if(this.eventItemsMatch(o,c||r)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${ri(o)} ${u.appendInPlace?"append in place":""}`),this.hls.trigger(v.INTERSTITIAL_STARTED,{event:u,schedule:t.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const f=u.assetList[s];if(!f){this.advanceAfterAssetEnded(u,e,s||0);return}if(h||(h=this.getAssetPlayer(f.identifier)),h===null||h.destroyed){const m=u.assetList.length;this.warn(`asset ${s+1}/${m} player destroyed ${u}`),h=this.createAssetPlayer(u,f,s),h.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(f))return;this.startAssetPlayer(h,s,t,e,l),this.shouldPlay&&qp(h.media)}else o?(this.resumePrimary(o,e,r),this.shouldPlay&&qp(this.hls.media)):n&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,s){var r,n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${ri(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(To("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!s)return;const a=(n=this.schedule)==null?void 0:n.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${ri(e)}`),this.hls.trigger(v.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const s=e.start;if(this.primaryLive){const r=this.primaryDetails;if(t===0)return this.hls.startPosition;if(r&&(s<r.fragmentStart||s>r.edge))return this.hls.liveSyncPosition||-1}return s}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:oe.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,s){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const r=this.primaryMedia;if(!r)return;const n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,r),s&&this.startLoadingPrimaryAt(e,s)),s||(this.log(To("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,s))}
vendor: 4,927 bytes, line 44
44startLoadingPrimaryAt(e,t){var s;const r=this.hls;!r.loadingEnabled||!r.media||Math.abs((((s=r.mainForwardBufferInfo)==null?void 0:s.start)||r.media.currentTime)-e)>.5?r.startLoad(e,t):r.bufferingEnabled||r.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(v.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(v.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const s=this.hls.levels[t.level];if(!s.details)return;const r=Ie(Ie({},this.mediaSelection||this.altSelection),{},{main:s});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const s=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=Ie(Ie({},this.altSelection),{},{audio:s});return}const n=Ie(Ie({},r),{},{audio:s});this.mediaSelection=n}onSubtitleTrackUpdated(e,t){const s=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=Ie(Ie({},this.altSelection),{},{subtitles:s});return}const n=Ie(Ie({},r),{},{subtitles:s});this.mediaSelection=n}onAudioTrackSwitching(e,t){const s=ip(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setAudioOption(t)||r.setAudioOption(s)))}onSubtitleTrackSwitch(e,t){const s=ip(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setSubtitleOption(t)||t.id!==-1&&r.setSubtitleOption(s)))}onBufferCodecs(e,t){const s=t.tracks;s&&(this.requiredTracks=s)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const s=this.playingItem;if(s&&!this.itemsMatch(s,this.bufferingItem)&&!this.isInterstitial(s)){const r=this.timelinePos;this.bufferedPos=r,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let r=0;r<t.length;r++){const n=t[r];if(n.cue.post){var s;const a=this.schedule.findEventIndex(n.identifier),o=(s=this.schedule.items)==null?void 0:s[a];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const s=this.findItemIndex(t);this.setSchedulePosition(s+1)}else this.shouldPlay=!1}updateItem(e,t){var s;const r=(s=this.schedule)==null?void 0:s.items;if(e&&r){const n=this.findItemIndex(e,t);return r[n]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((n,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(n.identifier,null)});const s=e.end+.25,r=oe.bufferInfo(this.primaryMedia,s,0);(r.end>s||(r.nextStart||0)>s)&&(this.log(`trim buffered interstitial ${ri(e)} (was ${ri(t)})`),this.attachPrimary(s,null,!0),this.flushFrontBuffer(s))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var s;return!!t&&(e===t||e.event.identifier===((s=t.event)==null?void 0:s.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const s=this.mediaSelection;s&&((t=this.schedule)==null||t.updateSchedule(s,[],e))}checkBuffer(e){var t;const s=(t=this.schedule)==null?void 0:t.items;if(!s)return;const r=oe.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=r.len<1),this.updateBufferedPos(r.end,s,e)}updateBufferedPos(e,t,s){const r=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(t.length===1&&this.itemsMatch(t[0],n)){this.bufferedPos=e;return}const a=this.playingItem,o=this.findItemIndex(a);let l=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var d;const u=this.findItemIndex(n),c=Math.min(u+1,t.length-1),h=t[c];if((l===-1&&n&&e>=n.end||(d=h.event)!=null&&d.appendInPlace&&e+.01>=h.start)&&(l=c),this.isInterstitial(n)){const f=n.event;if(c-o>1&&f.appendInPlace===!1||f.assetList.length===0&&f.assetListLoader)return}if(this.bufferedPos=e,l>u&&l>o)this.bufferedToItem(h);else{const f=this.primaryDetails;this.primaryLive&&f&&e>f.edge-f.targetduration&&h.start<f.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(h)&&this.preloadAssets(h.event,0)}}else s&&a&&!this.itemsMatch(a,n)&&(l===o?this.bufferedToItem(a):l===o+1&&this.bufferedToItem(t[l]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(r=>{const n=this.getAssetPlayer(r.identifier);return!(n!=null&&n.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,s=this.schedule;if(!this.itemsMatch(e,t)&&s){const{items:r,events:n}=s;if(!r||!n)return t;
44const a=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const l=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${ri(e)}`+(t?` (${l.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const d=s.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((u,c)=>{const h=this.getAssetPlayer(u.identifier);h&&(c===d&&h.loadSource(),h.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(d=>d.pauseBuffering());this.hls.trigger(v.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const s=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(s!==null){this.bufferingAsset=null;const r=this.detachedData;r?r.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),s=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(s)}bufferedToEvent(e,t){const s=e.event,r=s.assetList.length===0&&!s.assetListLoader,n=s.cue.once;if(r||!n){const a=this.preloadAssets(s,t);if(a!=null&&a.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(a,o)}}}preloadAssets(e,t){const s=e.assetUrl,r=e.assetList.length,n=r===0&&!e.assetListLoader,a=e.cue.once;if(n){const l=e.timelineStart;if(e.appendInPlace){var o;const h=this.playingItem;!this.isInterstitial(h)&&(h==null||(o=h.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(l+.25)}let d,u=0;if(!this.playingItem&&this.primaryLive&&(u=this.hls.startPosition,u===-1&&(u=this.hls.liveSyncPosition||0)),u&&!(e.cue.pre||e.cue.post)){const h=u-l;h>0&&(d=Math.round(h*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${s?1:r} ${e}${d?` live-start: ${u} start-offset: ${d}`:""}`),s)return this.createAsset(e,0,0,l,e.duration,s);const c=this.assetListLoader.loadAssetList(e,d);c&&(e.assetListLoader=c)}else if(!a&&r){for(let d=t;d<r;d++){const u=e.assetList[d],c=this.getAssetPlayerQueueIndex(u.identifier);(c===-1||this.playerQueue[c].destroyed)&&!u.error&&this.createAssetPlayer(e,u,d)}const l=e.assetList[t];if(l){const d=this.getAssetPlayer(l.identifier);return d&&d.loadSource(),d}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(r=>{this.hls.trigger(v.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:r})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let s=0;s<t.length;s++)if(e===t[s].assetId)return s;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let s=0;s<e.length;s++)if(e[s].media===t)return e[s]}return null}createAsset(e,t,s,r,n,a){const o={parentIdentifier:e.identifier,identifier:wL(e,a,t),duration:n,startOffset:s,timelineStart:r,uri:a};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,s){const r=this.hls,n=r.userConfig;let a=n.videoPreference;const o=r.loadLevelObj||r.levels[r.currentLevel];(a||o)&&(a=ke({},a),o.videoCodec&&(a.videoCodec=o.videoCodec),o.videoRange&&(a.allowedVideoRanges=[o.videoRange]));const l=r.audioTracks[r.audioTrack],d=r.subtitleTracks[r.subtitleTrack];let u=0;if(this.primaryLive||e.appendInPlace){const T=this.timelinePos-t.timelineStart;if(T>1){const A=t.duration;A&&T<A&&(u=T)}}const c=t.identifier,h=Ie(Ie({},n),{},{maxMaxBufferLength:Math.min(180,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:c,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:l||n.audioPreference,subtitlePreference:d||n.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(h.timelineOffset=t.timelineStart));const f=h.cmcd;f!=null&&f.sessionId&&f.contentId&&(h.cmcd=ke({},f,{contentId:_a(t.uri)})),this.getAssetPlayer(c)&&this.warn(`Duplicate date range identifier ${e} and asset ${c}`);const m=new OL(this.HlsPlayerClass,h,e,t);this.playerQueue.push(m),e.assetList[s]=t;let g=!0;const p=T=>{if(T.live){var A;const R=new Error(`Interstitials MUST be VOD assets ${e}`),x={fatal:!0,type:ee.OTHER_ERROR,details:C.INTERSTITIAL_ASSET_ITEM_ER
44ROR,error:R},I=((A=this.schedule)==null?void 0:A.findEventIndex(e.identifier))||-1;this.handleAssetItemError(x,e,I,s,R.message);return}const L=T.edge-T.fragmentStart,S=t.duration;(g||S===null||L>S)&&(g=!1,this.log(`Interstitial asset "${c}" duration change ${S} > ${L}`),t.duration=L,this.updateSchedule())};m.on(v.LEVEL_UPDATED,(T,{details:A})=>p(A)),m.on(v.LEVEL_PTS_UPDATED,(T,{details:A})=>p(A)),m.on(v.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const E=(T,A)=>{const L=this.getAssetPlayer(c);if(L&&A.tracks){L.off(v.BUFFER_CODECS,E),L.tracks=A.tracks;const S=this.primaryMedia;this.bufferingAsset===L.assetItem&&S&&!L.media&&this.bufferAssetPlayer(L,S)}};m.on(v.BUFFER_CODECS,E);const b=()=>{var T;const A=this.getAssetPlayer(c);if(this.log(`buffered to end of asset ${A}`),!A||!this.schedule)return;const L=this.schedule.findEventIndex(e.identifier),S=(T=this.schedule.items)==null?void 0:T[L];this.isInterstitial(S)&&this.advanceAssetBuffering(S,t)};m.on(v.BUFFERED_TO_END,b);const y=T=>()=>{if(!this.getAssetPlayer(c)||!this.schedule)return;this.shouldPlay=!0;const L=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,L,T)};return m.once(v.MEDIA_ENDED,y(s)),m.once(v.PLAYOUT_LIMIT_REACHED,y(1/0)),m.on(v.ERROR,(T,A)=>{if(!this.schedule)return;const L=this.getAssetPlayer(c);if(A.details===C.BUFFER_STALLED_ERROR){if(L!=null&&L.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(A,e,this.schedule.findEventIndex(e.identifier),s,`Asset player error ${A.error} ${e}`)}),m.on(v.DESTROYING,()=>{if(!this.getAssetPlayer(c)||!this.schedule)return;const A=new Error(`Asset player destroyed unexpectedly ${c}`),L={fatal:!0,type:ee.OTHER_ERROR,details:C.INTERSTITIAL_ASSET_ITEM_ERROR,error:A};this.handleAssetItemError(L,e,this.schedule.findEventIndex(e.identifier),s,A.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${$r(t)}`),this.hls.trigger(v.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:s,event:e,player:m}),m}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const s=this.playerQueue[t];this.transferMediaFromPlayer(s,null),s.resetDetails()}}clearAssetPlayer(e,t){const s=this.getAssetPlayerQueueIndex(e);if(s!==-1){const r=this.playerQueue[s];this.log(`clear ${r} toSegment: ${t&&ri(t)}`),this.transferMediaFromPlayer(r,t),this.playerQueue.splice(s,1),r.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,s,r,n){const{interstitial:a,assetItem:o,assetId:l}=e,d=a.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!u||u.identifier!==l)&&(u&&(this.clearAssetPlayer(u.identifier,s[r]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${d} ${$r(o)}`),this.hls.trigger(v.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:a,schedule:s.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,n)}bufferAssetPlayer(e,t){var s,r;if(!this.schedule)return;const{interstitial:n,assetItem:a}=e,o=this.schedule.findEventIndex(n.identifier),l=(s=this.schedule.items)==null?void 0:s[o];if(!l)return;e.loadSource(),this.setBufferingItem(l),this.bufferingAsset=a;const d=this.getBufferingPlayer();if(d===e)return;const u=n.appendInPlace;if(u&&d?.interstitial.appendInPlace===!1)return;const c=d?.tracks||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(u&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(c&&!sv(c,e.tracks)){const h=new Error(`Asset ${$r(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(c)}')`),f={fatal:!0,type:ee.OTHER_ERROR,details:C.INTERSTITIAL_ASSET_ITEM_ERROR,error:h},m=n.findAssetIndex(a);this.handleAssetItemError(f,n,o,m,h.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,s=this.primaryMedia;if(!t||!s)return;const r=s.currentTime,n=t.findAssetIndex(e,r),a=e.assetList[n];if(a){const o=this.getAssetPlayer(a.identifier);if(o){const l=o.currentTime||r-a.timelineStart,d=o.duration-l;if(this.warn(`Stalled at ${l} of ${l+d} in ${o} ${e} (media.currentTime: ${r})`),l&&(d/s.playbackRate<.5||o.bufferedInPlaceToEnd(s))&&o.hls){const u=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,u,n)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,s,r,n){if(e.details===C.BUFFER_STALLED_ERROR)return;const a=t.assetList[r]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&$r(a)} ${e.error}`),!this.schedule)return;const o=a?.identifier||"",l=this.getAssetPlayerQueueIndex(o),d=this.playerQueue[l]||null,u=this.schedule.items,c=ke({},e,{fatal:!1,errorAction:un(!0),asset:a,assetListIndex:r,event:t,schedule:u,scheduleIndex:s,player:d});if(this.hls.trigger(v.INTERSTITIAL_ASSET_ERROR,c),!e.fatal)return;const h=this.playingAsset,f=this.bufferingAsset,m=new Error(n);if(a&&(this.clearAssetPlayer(o,null),a.error=m),!t.assetList.some(g=>!g.error))t.error=m;else for(let g=r;g<t.assetList.length;g++)this.resetAssetPlayer(t.assetList[g].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):h&&h.identifier===o?this.advanceAfterAssetEnded(t,s,r):f&&f.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,f)}primaryFallback(e){const t=e.timelineStart,s=this.effectivePlayingItem;let r=this.timelinePos;if(s){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${r} playing: ${ri(s)} error: ${e.error}`),r===-1&&(r=this.hls.startPosition);const a=this.updateItem(s,r);this.itemsMatch(s,a)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(r===-1){this.checkStart();return}if(!this.schedule)return;const n=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(n)}onAssetListLoaded(e,t){var s,r;const n=t.event,a=n.identifier,o=t.assetListResponse.ASSETS;if(!((s=this.schedule)!=null&&s.hasEvent(a)))return;const l=n.timelineStart,d=n.duration;let u=0;o.forEach((g,p)=>{const E=parseFloat(g.DURATION);this.createAsset(n,p,u,l+u,E,g.URI),u+=E}),n.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${d}) ${n}`);
44const c=this.waitingItem,h=c?.event.identifier===a;this.updateSchedule();const f=(r=this.bufferingItem)==null?void 0:r.event;if(h){var m;const g=this.schedule.findEventIndex(a),p=(m=this.schedule.items)==null?void 0:m[g];if(p){if(!this.playingItem&&this.timelinePos>p.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==g){n.error=new Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${n}`),this.log(n.error.message),this.updateSchedule(!0),this.primaryFallback(n);return}this.setBufferingItem(p)}this.setSchedulePosition(g)}else if(f?.identifier===a){const g=n.assetList[0];if(g){const p=this.getAssetPlayer(g.identifier);if(f.appendInPlace){const E=this.primaryMedia;p&&E&&this.bufferAssetPlayer(p,E)}else p&&p.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case C.ASSET_LIST_PARSING_ERROR:case C.ASSET_LIST_LOAD_ERROR:case C.ASSET_LIST_LOAD_TIMEOUT:{const s=t.interstitial;s&&(this.updateSchedule(!0),this.primaryFallback(s));break}case C.BUFFER_STALLED_ERROR:{const s=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&s.event.appendInPlace){this.handleInPlaceStall(s.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const jp=500;class FL extends af{constructor(e,t,s){super(e,t,s,"subtitle-stream-controller",Q.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(v.LEVEL_LOADED,this.onLevelLoaded,this),e.on(v.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(v.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(v.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(v.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(v.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(v.LEVEL_LOADED,this.onLevelLoaded,this),e.off(v.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(v.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(v.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(v.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(v.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=P.IDLE,this.setInterval(jp),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:s,success:r}=t;if(this.fragContextChanged(s)||(je(s)&&(this.fragPrevious=s),this.state=P.IDLE),!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=s.start;for(let d=0;d<n.length;d++)if(o>=n[d].start&&o<=n[d].end){a=n[d];break}const l=s.start+s.duration;a?a.end=l:(a={start:o,end:l},n.push(a)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:s,endOffset:r}=t;if(s===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let o=0;o<a.length;){if(a[o].end<=n){a.shift();continue}else if(a[o].start<n)a[o].start=n;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(s,n,Q.SUBTITLE)}}onError(e,t){const s=t.frag;s?.type===Q.SUBTITLE&&(t.details===C.FRAG_GAP&&this.fragmentTracker.fragBuffered(s,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==P.STOPPED&&(this.state=P.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&aE(this.levels,t)){this.levels=t.map(s=>new Ua(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const r=new Ua(s);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Q.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var s;if(this.currentTrackId=t.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==P.STOPPED&&this.setInterval(jp)}onSubtitleTrackLoaded(e,t){var s;const{currentTrackId:r,levels:n}=this,{details:a,id:o}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=n[o];if(o>=n.length||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let d=0;if(a.live||(s=l.details)!=null&&s.live){if(a.deltaUpdateFailed)return;const c=this.mainDetails;if(!c){this.startFragRequested=!1;return}const h=c.fragments[0];if(!l.details)a.hasProgramDateTime&&c.hasProgramDateTime?(vd(a,c),d=a.fragmentStart):h&&(d=h.start,Ac(a,d));else{var u;d=this.alignPlaylists(a,l.details,(u=this.levelLastLoaded)==null?void 0:u.details),d===0&&h&&(d=h.start,Ac(a,d))}c&&!this.startFragRequested&&this.setStartPosition(c,d)}l.details=a,this.levelLastLoaded=l,o===r&&(this.hls.trigger(v.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===P.IDLE&&(yr(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&r!=null&&r.key&&r.iv&&cn(r.method)){const a=performance.now();
vendor: 41,448 bytes, lines 44-55
44this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer,rf(r.method)).catch(o=>{throw n.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();n.trigger(v.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=P.IDLE})}}doTick(){if(!this.media){this.state=P.IDLE;return}if(this.state===P.IDLE){const{currentTrackId:e,levels:t}=this,s=t?.[e];if(!s||!t.length||!s.details||this.waitForLive(s))return;const{config:r}=this,n=this.getLoadPosition(),a=oe.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:o,len:l}=a,d=s.details,u=this.hls.maxBufferLength+d.levelTargetDuration;if(l>u)return;const c=d.fragments,h=c.length,f=d.edge;let m=null;const g=this.fragPrevious;if(o<f){const b=r.maxFragLookUpTolerance,y=o>f-b?0:b;m=yr(g,c,Math.max(c[0].start,o),y),!m&&g&&g.start<c[0].start&&(m=c[0])}else m=c[h-1];if(m=this.filterReplacedPrimary(m,s.details),!m)return;const p=m.sn-d.startSN,E=c[p-1];if(E&&E.cc===m.cc&&this.fragmentTracker.getState(E)===nt.NOT_LOADED&&(m=E),this.fragmentTracker.getState(m)===nt.NOT_LOADED){const b=this.mapToInitFragWhenRequired(m);b&&this.loadFragment(b,s,o)}}}loadFragment(e,t,s){je(e)?super.loadFragment(e,t,s):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new BL(this.tracksBuffered[this.currentTrackId]||[])}}class BL{constructor(e){this.buffered=void 0;const t=(s,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][s]};this.buffered={get length(){return e.length},end(s){return t("end",s,e.length)},start(s){return t("start",s,e.length)}}}}const HL={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,185: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},_E=i=>String.fromCharCode(HL[i]||i),di=15,Xi=100,GL={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},KL={17:2,18:4,21:6,22:8,23:10,19:13,20:15},VL={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},WL={25:2,26:4,29:6,30:8,31:10,27:13,28:15},YL=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class qL{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;Le.log(`${this.time} [${e}] ${s}`)}}}const Ws=function(e){const t=[];for(let s=0;s<e.length;s++)t.push(e[s].toString(16));return t};class AE{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){const t=["foreground","underline","italics","background","flash"];for(let s=0;s<t.length;s++){const r=t[s];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!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 jL{constructor(){this.uchar=" ",this.penState=new AE}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 zL{constructor(e){this.chars=[],this.pos=0,this.currPenState=new AE,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Xi;t++)this.chars.push(new jL);this.logger=e}equals(e){for(let t=0;t<Xi;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Xi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Xi;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>Xi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Xi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let s=this.pos+1;s<t+1;s++)this.chars[s].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=_E(e);if(this.pos>=Xi){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<Xi;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let s=0;s<Xi;s++){const r=this.chars[s].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 Uu{constructor(e){this.rows=[],this.currRow=di-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<di;t++)this.rows.push(new zL(e));this.logger=e}reset(){for(let e=0;e<di;e++)this.rows[e].clear();this.currRow=di-1}equals(e){let t=!0;for(let s=0;s<di;s++)if(!this.rows[s].equals(e.rows[s])){t=!1;break}return t}copy(e){for(let t=0;t<di;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<di;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 = "+we(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<di;o++)this.rows[o].clear();const n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const o=a.rows[n].cueStartTime,l=this.logger.time;if(o!==null&&l!==null&&o<l)for(let d=0;d<this.nrRollUpRows;d++)this.rows[t-this.nrRollUpRows+d+1].copy(a.rows[n+d])}}this.currRow=t;const s=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,a=Math.max(n-1,0);s.setCursor(e.indent),e.color=s.chars[a].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+we(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const 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;const t=[];let s="",r=-1;for(let n=0;n<di;n++){const a=this.rows[n].getTextString();a&&(r=n+1,e?t.push("Row "+r+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?s="["+t.join(" | ")+"]":s=t.join(` 45`)),s}getTextAndFormat(){return this.rows}}class zp{constructor(e,t,s){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 Uu(s),this.nonDisplayedMemory=new Uu(s),this.lastOutputScreen=new Uu(s),this.currRollUpRow=this.displayedMemory.rows[di-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[di-1],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),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let s=0;s<e.length;s++)this.writeScreen.insertChar(e[s]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(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"),this.mode!=="MODE_TEXT"&&(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})}ccRDC(){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"),this.mode==="MODE_POP-ON"){const 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){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const s=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[s]}this.logger.log(2,"MIDROW: "+we(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t: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.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 Qp{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=XL(),this.logger=void 0;const r=this.logger=new qL;this.channels=[null,new zp(e,t,r),new zp(e+1,s,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 s=0;s<t.length;s+=2){const r=t[s]&127,n=t[s+1]&127;let a=!1,o=null;if(r===0&&n===0)continue;this.logger.log(3,()=>"["+Ws([t[s],t[s+1]])+"] -> ("+Ws([r,n])+")");const l=this.cmdHistory;if(r>=16&&r<=31){if(QL(r,n,l)){_o(null,null,l),this.logger.log(3,()=>"Repeated command ("+Ws([r,n])+") is dropped");continue}_o(r,n,this.cmdHistory),a=this.parseCmd(r,n),a||(a=this.parseMidrow(r,n)),a||(a=this.parsePAC(r,n)),a||(a=this.parseBackgroundAttributes(r,n))}else _o(null,null,l);if(!a&&(o=this.parseChars(r,n),o)){const u=this.currentChannel;u&&u>0?this.channels[u].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Ws([r,n])+" orig: "+Ws([t[s],t[s+1]]))}}parseCmd(e,t){const s=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=33&&t<=35;if(!(s||r))return!1;const n=e===20||e===21||e===23?1:2,a=this.channels[n];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let s=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[s];return r?(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Ws([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let s;const r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(e===16||e===24)&&t>=64&&t<=95;if(!(r||n))return!1;const a=e<=23?1:2;t>=64&&t<=95?s=a===1?GL[e]:VL[e]:s=a===1?KL[e]:WL[e];const o=this.channels[a];return o?(o.setPAC(this.interpretPAC(s,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let s;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?s=t-96:s=t-64,r.underline=(s&1)===1,s<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((s-16)/2)*4,r}parseChars(e,t){let s,r=null,n=null;if(e>=25?(s=2,n=e-8):(s=1,n=e),n>=17&&n<=19){let a;n===17?a=t+80:n===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+_E(a)+"' in channel "+s),r=[a]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+Ws(r).join(",")),r}parseBackgroundAttributes(e,t){const s=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(s||r))return!1;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=YL[n],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}_o(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const s=this.channels[t];s&&s.cueSplitAtTime(e)}}}function _o(i,e,t){t.a=i,t.b=e}function QL(i,e,t){return t.a===i&&t.b===e}function XL(){return{a:null,b:null}}var Ef=(function(){if(gd!=null&&gd.VTTCue)return self.VTTCue;const i=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,l){if(typeof l!="string"||!Array.isArray(o))return!1;const d=l.toLowerCase();return~o.indexOf(d)?d:!1}function s(o){return t(i,o)}function r(o){return t(e,o)}function n(o,...l){let d=1;for(;d<arguments.length;d++){const u=arguments[d];for(const c in u)o[c]=u[c]}return o}function a(o,l,d){const u=this,c={enumerable:!0};u.hasBeenReset=!1;let h="",f=!1,m=o,g=l,p=d,E=null,b="",y=!0,T="auto",A="start",L=50,S="middle",R=50,x="middle";Object.defineProperty(u,"id",n({},c,{get:function(){return h},set:function(I){h=""+I}})),Object.defineProperty(u,"pauseOnExit",n({},c,{get:function(){return f},set:function(I){f=!!I}})),Object.defineProperty(u,"startTime",n({},c,{get:function(){return m},set:function(I){if(typeof I!="number")throw new TypeError("Start time must be set to a number.");m=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",n({},c,{get:function(){return g},set:function(I){if(typeof I!="number")throw new TypeError("End time must be set to a number.");g=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",n({},c,{get:function(){return p},set:function(I){p=""+I,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",n({},c,{get:function(){return E},set:function(I){E=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",n({},c,{get:function(){return b},set:function(I){const M=s(I);if(M===!1)throw new SyntaxError("An invalid or illegal string was specified.");b=M,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",n({},c,{get:function(){return y},set:function(I){y=!!I,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",n({},c,{get:function(){return T},set:function(I){if(typeof I!="number"&&I!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");T=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",n({},c,{get:function(){return A},set:function(I){const M=r(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");A=M,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",n({},c,{get:function(){return L},set:function(I){if(I<0||I>100)throw new Error("Position must be between 0 and 100.");L=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",n({},c,{get:function(){return S},set:function(I){const M=r(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");S=M,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",n({},c,{get:function(){return R},set:function(I){if(I<0||I>100)throw new Error("Size must be between 0 and 100.");R=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",n({},c,{get:function(){return x},set:function(I){const M=r(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");x=M,this.hasBeenReset=!0}})),u.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a})();class ZL{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function SE(i){function e(s,r,n,a){return(s|0)*3600+(r|0)*60+(n|0)+parseFloat(a||0)}const t=i.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class JL{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let r=0;r<s.length;++r)if(t===s[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)){const s=parseFloat(t);if(s>=0&&s<=100)return this.set(e,s),!0}return!1}}function IE(i,e,t,s){const r=s?i.split(s):[i];for(const n in r){if(typeof r[n]!="string")continue;const a=r[n].split(t);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const Cc=new Ef(0,0,""),Ao=Cc.align==="middle"?"middle":"center";function eR(i,e,t){const s=i;function r(){const o=SE(i);if(o===null)throw new Error("Malformed timestamp: "+s);return i=i.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,l){const d=new JL;IE(o,function(h,f){let m;switch(h){case"region":for(let g=t.length-1;g>=0;g--)if(t[g].id===f){d.set(h,t[g].region);break}break;case"vertical":d.alt(h,f,["rl","lr"]);break;case"line":m=f.split(","),d.integer(h,m[0]),d.percent(h,m[0])&&d.set("snapToLines",!1),d.alt(h,m[0],["auto"]),m.length===2&&d.alt("lineAlign",m[1],["start",Ao,"end"]);break;case"position":m=f.split(","),d.percent(h,m[0]),m.length===2&&d.alt("positionAlign",m[1],["start",Ao,"end","line-left","line-right","auto"]);break;case"size":d.percent(h,f);break;case"align":d.alt(h,f,["start",Ao,"end","left","right"]);break}},/:/,/\s/),l.region=d.get("region",null),l.vertical=d.get("vertical","");let u=d.get("line","auto");u==="auto"&&Cc.line===-1&&(u=-1),l.line=u,l.lineAlign=d.get("lineAlign","start"),l.snapToLines=d.get("snapToLines",!0),l.size=d.get("size",100),l.align=d.get("align",Ao);let c=d.get("position","auto");c==="auto"&&Cc.position===50&&(c=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=c}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),i.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);i=i.slice(3),a(),e.endTime=r(),a(),n(i,e)}function LE(i){return i.replace(/<br(?: \/)?>/gi,` 46`)}class tR{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new ZL,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function s(){let n=t.buffer,a=0;for(n=LE(n);a<n.length&&n[a]!=="\r"&&n[a]!==` 47`;)++a;const o=n.slice(0,a);return n[a]==="\r"&&++a,n[a]===` 48`&&++a,t.buffer=n.slice(a),o}function r(n){IE(n,function(a,o){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=s();const o=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:n=s(),t.state){case"HEADER":/:/.test(n)?r(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new Ef(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{eR(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=n.indexOf("-->")!==-1;if(!n||o&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` 49`),t.cue.text+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=` 50 51`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const iR=/\r\n|\n\r|\n|\r/g,$u=function(e,t,s=0){return e.slice(s,s+t.length)===t},sR=function(e){let t=parseInt(e.slice(-3));const s=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!j(t)||!j(s)||!j(r)||!j(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*r,t+=3600*1e3*n,t};function yf(i,e,t){return _a(i.toString())+_a(e.toString())+_a(t)}const rR=function(e,t,s){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(a=n)!=null&&a.new;){var a;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=s};function nR(i,e,t,s,r,n,a){const o=new tR,l=Kt(new Uint8Array(i)).trim().replace(iR,` 52`).split(` 53`),d=[],u=e?cI(e.baseTime,e.timescale):0;let c="00:00.000",h=0,f=0,m,g=!0;o.oncue=function(p){const E=t[s];let b=t.ccOffset;const y=(h-u)/9e4;if(E!=null&&E.new&&(f!==void 0?b=t.ccOffset=E.start:rR(t,s,y)),y){if(!e){m=new Error("Missing initPTS for VTT MPEGTS");return}b=y-t.presentationOffset}const T=p.endTime-p.startTime,A=Bt((p.startTime+b-f)*9e4,r*9e4)/9e4;p.startTime=Math.max(A,0),p.endTime=Math.max(A+T,0);const L=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(L)),p.id||(p.id=yf(p.startTime,p.endTime,L)),p.endTime>0&&d.push(p)},o.onparsingerror=function(p){m=p},o.onflush=function(){if(m){a(m);return}n(d)},l.forEach(p=>{if(g)if($u(p,"X-TIMESTAMP-MAP=")){g=!1,p.slice(16).split(",").forEach(E=>{$u(E,"LOCAL:")?c=E.slice(6):$u(E,"MPEGTS:")&&(h=parseInt(E.slice(7)))});try{f=sR(c)/1e3}catch(E){m=E}return}else p===""&&(g=!1);o.parse(p+` 54`)}),o.flush()}const Fu="stpp.ttml.im1t",RE=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,xE=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,aR={left:"start",center:"center",right:"end",start:"start",end:"end"};function Xp(i,e,t,s){const r=ce(new Uint8Array(i),["mdat"]);if(r.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(o=>Kt(o)),a=uI(e.baseTime,1,e.timescale);try{n.forEach(o=>t(oR(o,a)))}catch(o){s(o)}}function oR(i,e){const r=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((c,h)=>(c[h]=r.getAttribute(`ttp:${h}`)||n[h],c),{}),o=r.getAttribute("xml:space")!=="preserve",l=Zp(Bu(r,"styling","style")),d=Zp(Bu(r,"layout","region")),u=Bu(r,"body","[begin]");return[].map.call(u,c=>{const h=kE(c,o);if(!h||!c.hasAttribute("begin"))return null;const f=Gu(c.getAttribute("begin"),a),m=Gu(c.getAttribute("dur"),a);let g=Gu(c.getAttribute("end"),a);if(f===null)throw Jp(c);if(g===null){if(m===null)throw Jp(c);g=f+m}const p=new Ef(f-e,g-e,h);p.id=yf(p.startTime,p.endTime,p.text);const E=d[c.getAttribute("region")],b=l[c.getAttribute("style")],y=lR(E,b,l),{textAlign:T}=y;if(T){const A=aR[T];A&&(p.lineAlign=A),p.align=T}return ke(p,y),p}).filter(c=>c!==null)}function Bu(i,e,t){const s=i.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function Zp(i){return i.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function kE(i,e){return[].slice.call(i.childNodes).reduce((t,s,r)=>{var n;return s.nodeName==="br"&&r?t+` 55`:(n=s.childNodes)!=null&&n.length?kE(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function lR(i,e,t){const s="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=i!=null&&i.hasAttribute("style")?i.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(r=t[a]),n.reduce((o,l)=>{const d=Hu(e,s,l)||Hu(i,s,l)||Hu(r,s,l);return d&&(o[l]=d),o},{})}function Hu(i,e,t){return i&&i.hasAttributeNS(e,t)?i.getAttributeNS(e,t):null}function Jp(i){return new Error(`Could not parse ttml timestamp ${i}`)}function Gu(i,e){if(!i)return null;let t=SE(i);return t===null&&(RE.test(i)?t=dR(i,e):xE.test(i)&&(t=uR(i,e))),t}function dR(i,e){const t=RE.exec(i),s=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+s/e.frameRate}function uR(i,e){const t=xE.exec(i),s=Number(t[1]);switch(t[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/e.frameRate;case"t":return s/e.tickRate}return s}class So{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(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class cR{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=tg(),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}},e.on(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(v.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(v.FRAG_LOADING,this.onFragLoading,this),e.on(v.FRAG_LOADED,this.onFragLoaded,this),e.on(v.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(v.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(v.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(v.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(v.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(v.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(v.FRAG_LOADING,this.onFragLoading,this),e.off(v.FRAG_LOADED,this.onFragLoaded,this),e.off(v.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(v.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(v.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(v.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(v.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new So(this,"textTrack1"),t=new So(this,"textTrack2"),s=new So(this,"textTrack3"),r=new So(this,"textTrack4");this.cea608Parser1=new Qp(1,e,t),this.cea608Parser2=new Qp(3,s,r)}addCues(e,t,s,r,n){let a=!1;for(let o=n.length;o--;){const l=n[o],d=hR(l[0],l[1],t,s);if(d>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],s),a=!0,d/(s-t)>.5))return}if(a||n.push([t,s]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,s,r)}else{const o=this.Cues.newCue(null,t,s,r);this.hls.trigger(v.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:r,timescale:n,trackId:a}){const{unparsedVttFrags:o}=this;s===Q.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:n,trackId:a}),o.length&&(this.unparsedVttFrags=[],o.forEach(l=>{this.initPTS[l.frag.cc]?this.onFragLoaded(v.FRAG_LOADED,l):this.hls.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:s}=this;if(s)for(let r=0;r<s.textTracks.length;r++){const n=s.textTracks[r];if(eg(n,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:s,media:r}=this,{label:n,languageCode:a}=t[e],o=this.getExistingTrack(n,a);if(o)s[e]=o,rn(s[e]),yE(s[e],r);else{const l=this.createTextTrack("captions",n,a);l&&(l[e]=!0,s[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const s=t.label,r={_id:e,label:s,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(v.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,s){const r=this.media;if(r)return r.addTextTrack(e,t,s)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const s=!!t.transferMedia;if(this.media=null,s)return;const{captionsTracks:r}=this;Object.keys(r).forEach(n=>{rn(r[n]),delete r[n]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=tg(),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(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let s=0;s<t.length;s++)rn(t[s])}onSubtitleTracksUpdated(e,t){const s=t.subtitleTracks||[],r=s.some(n=>n.textCodec===Fu);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(aE(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const a=this.media,o=a?Qo(a.textTracks):null;if(this.tracks.forEach((l,d)=>{let u;if(o){let c=null;for(let h=0;h<o.length;h++)if(o[h]&&eg(o[h],l)){c=o[h],o[h]=null;break}c&&(u=c)}if(u)rn(u);else{const c=DE(l);u=this.createTextTrack(c,l.name,l.lang),u&&(u.mode="disabled")}u&&this.textTracks.push(u)}),o!=null&&o.length){const l=o.filter(d=>d!==null).map(d=>d.label);l.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(v.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(s=>{const r=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!r)return;const n=`textTrack${r[1]}`,a=this.captionsProperties[n];a&&(a.label=s.name,s.lang&&(a.languageCode=s.lang),a.media=s)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Q.MAIN){var s,r;const{cea608Parser1:n,cea608Parser2:a,lastSn:o}=this,{cc:l,sn:d}=t.frag,u=(s=(r=t.part)==null?void 0:r.index)!=null?s:-1;n&&a&&(d!==o+1||d===o&&u!==this.lastPartIndex+1||l!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=l,this.lastSn=d,this.lastPartIndex=u}}onFragLoaded(e,t){const{frag:s,payload:r}=t;if(s.type===Q.SUBTITLE)if(r.byteLength){const n=s.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const o=this.tracks[s.level],l=this.vttCCs;l[s.cc]||(l[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),o&&o.textCodec===Fu?this._parseIMSC1(s,r):this._parseVTTs(t)}}else this.hls.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const s=this.hls;Xp(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),s.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{s.logger.log(`Failed to parse IMSC1: ${r}`),s.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:s,payload:r}=e,{initPTS:n,unparsedVttFrags:a}=this,o=n.length-1;if(!n[s.cc]&&o===-1){a.push(e);return}const l=this.hls,d=(t=s.initSegment)!=null&&t.data?Jt(s.initSegment.data,new Uint8Array(r)).buffer:r;nR(d,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,u=>{this._appendCues(u,s.level),l.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},u=>{const c=u.message==="Missing initPTS for VTT MPEGTS";c?a.push(e):this._fallbackToIMSC1(s,r),l.logger.log(`Failed to parse VTT cue: ${u}`),!(c&&o>s.cc)&&l.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:u})})}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||Xp(t,this.initPTS[e.cc],()=>{s.textCodec=Fu,this._parseIMSC1(e,t)},()=>{s.textCodec="wvtt"})}_appendCues(e,t){const s=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>bE(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;s.trigger(v.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:s}=t;s.type===Q.SUBTITLE&&this.onFragLoaded(v.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:s,samples:r}=t;if(!(s.type===Q.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let n=0;n<r.length;n++){const a=r[n].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(a);this.cea608Parser1.addData(r[n].pts,o[0]),this.cea608Parser2.addData(r[n].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:s,endOffsetSubtitles:r,type:n}){const{media:a}=this;if(!(!a||a.currentTime<s)){if(!n||n==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(l=>Dc(o[l],t,s))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>Dc(o[l],t,r))}}}extractCea608Data(e){const t=[[],[]],s=e[0]&31;let r=2;for(let n=0;n<s;n++){const a=e[r++],o=127&e[r++],l=127&e[r++];if(o===0&&l===0)continue;if((4&a)!==0){const u=3&a;(u===0||u===1)&&(t[u].push(o),t[u].push(l))}}return t}}function DE(i){return i.characteristics&&/transcribes-spoken-dialog/gi.test(i.characteristics)&&/describes-music-and-sound/gi.test(i.characteristics)?"captions":"subtitles"}function eg(i,e){return!!i&&i.kind===DE(e)&&Lc(e,i)}function hR(i,e,t,s){return Math.min(e,s)-Math.max(i,t)}function tg(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const fR=/\s/,mR={newCue(i,e,t,s){const r=[];let n,a,o,l,d;const u=self.VTTCue||self.TextTrackCue;for(let h=0;h<s.rows.length;h++)if(n=s.rows[h],o=!0,l=0,d="",!n.isEmpty()){var c;for(let g=0;g<n.chars.length;g++)fR.test(n.chars[g].uchar)&&o?l++:(d+=n.chars[g].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const f=LE(d.trim()),m=yf(e,t,f);i!=null&&(c=i.cues)!=null&&c.getCueById(m)||(a=new u(e,t,f),a.id=m,a.line=h+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),r.push(a))}return i&&r.length&&(r.sort((h,f)=>h.line==="auto"||f.line==="auto"?0:h.line>8&&f.line>8?f.line-h.line:h.line-f.line),r.forEach(h=>bE(i,h))),r}};function pR(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const gR=/(\d+)-(\d+)\/(\d+)/;class ig{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||bR,this.controller=new self.AbortController,this.stats=new Qh}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(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,s){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=vR(e,this.controller.signal),a=e.responseType==="arraybuffer",o=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=l&&j(l)?l:d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(Ba(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(c=>{var h;this.response=this.loader=c;const f=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},d-(f-r.loading.start)),!c.ok){const{status:g,statusText:p}=c;throw new TR(p||"fetch, bad network response",g,c)}r.loading.first=f,r.total=yR(c.headers)||r.total;const m=(h=this.callbacks)==null?void 0:h.onProgress;return m&&j(t.highWaterMark)?this.loadProgressively(c,r,e,t.highWaterMark,m):a?c.arrayBuffer():e.responseType==="json"?c.json():c.text()}).then(c=>{var h,f;const m=this.response;if(!m)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const g=c[o];g&&(r.loaded=r.total=g);const p={url:m.url,data:c,code:m.status},E=(h=this.callbacks)==null?void 0:h.onProgress;E&&!j(t.highWaterMark)&&E(r,e,c,m),(f=this.callbacks)==null||f.onSuccess(p,r,e,m)}).catch(c=>{var h;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const f=c&&c.code||0,m=c?c.message:null;(h=this.callbacks)==null||h.onError({code:f,text:m},e,c?c.details:null,r)}
vendor: 1,049 bytes, line 55
55)}getCacheAge(){let e=null;if(this.response){const 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,s,r=0,n){const a=new Bv,o=e.body.getReader(),l=()=>o.read().then(d=>{if(d.done)return a.dataLength&&n(t,s,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const u=d.value,c=u.length;return t.loaded+=c,c<r||a.dataLength?(a.push(u),a.dataLength>=r&&n(t,s,a.flush().buffer,e)):n(t,s,u.buffer,e),l()}).catch(()=>Promise.reject());return l()}}function vR(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(ke({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function ER(i){const e=gR.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function yR(i){const e=i.get("Content-Range");if(e){const s=ER(e);if(j(s))return s}const t=i.get("Content-Length");if(t)return parseInt(t)}function bR(i,e){return new self.Request(i.url,e)}
vendor: 11,531 bytes, line 55
55class TR extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const _R=/^age:\s*[\d.]+\s*$/im;class CE{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 Qh,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const s=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return n(s,t.url)}).catch(a=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",t.url,!0),n(s,t.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(a=>{var o;(o=this.callbacks)==null||o.onError({code:s.status,text:a.message},t,s,r)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=s.loadPolicy;if(r)for(const o in r)e.setRequestHeader(o,r[o]);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),s.timeout=n&&j(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!s.aborted&&r>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const d=t.status,u=t.responseType==="text"?t.responseText:null;if(d>=200&&d<300){const m=u??t.response;if(m!=null){var a,o;s.loading.end=Math.max(self.performance.now(),s.loading.first);const g=t.responseType==="arraybuffer"?m.byteLength:m.length;s.loaded=s.total=g,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const p=(a=this.callbacks)==null?void 0:a.onProgress;p&&p(s,e,m,t);const E={url:t.responseURL,data:m,code:d};(o=this.callbacks)==null||o.onSuccess(E,s,e,t);return}}const c=n.loadPolicy.errorRetry,h=s.retry,f={url:e.url,data:void 0,code:d};if(md(c,h,!1,f))this.retry(c);else{var l;Le.error(`${d} while loading ${e.url}`),(l=this.callbacks)==null||l.onError({code:d,text:t.statusText},e,t,s)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(md(e,t,!0))this.retry(e);else{var s;Le.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:s}=this;this.retryDelay=ef(e,s.retry),s.retry++,Le.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${s.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){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&_R.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const AR={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},SR=Ie(Ie({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:CE,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:NS,bufferController:LI,capLevelController:pf,errorController:HS,fpsController:RL,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:kv,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:AR},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}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,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},IR()),{},{subtitleStreamController:FL,subtitleTrackController:DL,timelineController:cR,audioStreamController:_I,audioTrackController:AI,emeController:hn,cmcdController:AL,contentSteeringController:IL,interstitialsController:$L});function IR(){return{cueHandler:mR,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function LR(i,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const s=wc(i),r=["manifest","level","frag"],n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(a=>{const o=`${a==="level"?"playlist":a}LoadPolicy`,l=e[o]===void 0,d=[];n.forEach(u=>{const c=`${a}Loading${u}`,h=e[c];if(h!==void 0&&l){d.push(c);const f=s[o].default;switch(e[o]={default:f},u){case"TimeOut":f.maxLoadTimeMs=h,f.maxTimeToFirstByteMs=h;break;case"MaxRetry":f.errorRetry.maxNumRetry=h,f.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":f.errorRetry.retryDelayMs=h,f.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=h,f.timeoutRetry.maxRetryDelayMs=h;break}}}),d.length&&t.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${o}": ${we(e[o])}`)}),Ie(Ie({},s),e)}function wc(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(wc):Object.keys(i).reduce((e,t)=>(e[t]=wc(i[t]),e),{}):i}function RR(i,e){const t=i.loader;t!==ig&&t!==CE?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):pR()&&(i.loader=ig,i.progressive=!0,i.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Xo=2,xR=.1,kR=.05,DR=100;class CR extends Sv{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var s;this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(v.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;
vendor: 7,880 bytes, line 55
55e&&(e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(DR),this.mediaSource=t.mediaSource;const s=this.media=t.media;St(s,"playing",this.onMediaPlaying),St(s,"waiting",this.onMediaWaiting),St(s,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:s}=this;s&&(xt(s,"playing",this.onMediaPlaying),xt(s,"waiting",this.onMediaWaiting),xt(s,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var s,r;const n=(s=this.hls)==null?void 0:s.config;if(!n)return;const a=this.media;if(!a)return;const{seeking:o}=a,l=this.seeking&&!o,d=!this.seeking&&o,u=a.paused&&!o||a.ended||a.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!u&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(d||l){l&&this.stallResolved(e);return}if(u){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(v.MEDIA_ENDED,{stalled:!1}));return}if(!oe.getBuffered(a).length){this.nudgeRetry=0;return}const c=oe.bufferInfo(a,e,0),h=c.nextStart||0,f=this.fragmentTracker;if(o&&f&&this.hls){const L=sg(this.hls.inFlightFragments,e),S=c.len>Xo,R=!h||L||h-e>Xo&&!f.getPartialFragment(e);if(S||R)return;this.moved=!1}const m=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&f){if(!(c.len>0)&&!h)return;const S=Math.max(h,c.start||0)-e,x=!!(m!=null&&m.live)?m.targetduration*2:Xo,I=Io(e,f);if(S>0&&(S<=x||I)){a.paused||this._trySkipBufferHole(I);return}}const g=n.detectStallWithCurrentTimeMs,p=self.performance.now(),E=this.waiting;let b=this.stalled;if(b===null)if(E>0&&p-E<g)b=this.stalled=E;else{this.stalled=p;return}const y=p-b;if(!o&&(y>=g||E)&&this.hls){var T;if(((T=this.mediaSource)==null?void 0:T.readyState)==="ended"&&!(m!=null&&m.live)&&Math.abs(e-(m?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(v.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(c),!this.media||!this.hls)return}const A=oe.bufferInfo(a,e,n.maxBufferHole);this._tryFixBufferStall(A,y,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const s=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(v.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var s;const r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&r&&r.length>1&&e>r.end(0)){const n=oe.bufferedInfo(oe.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){const a=oe.timeRangesToArray(r),o=oe.bufferedInfo(a,t,0).bufferedIndex;if(o>-1&&o<a.length-1){const l=oe.bufferedInfo(a,e,0).bufferedIndex,d=a[o].end,u=a[o+1].start;if((l===-1||l>o)&&u-d<1&&e-d<2){const c=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${d} -> ${u} buffered index: ${l}`);this.warn(c.message),this.media.currentTime+=1e-6;let h=Io(e,this.fragmentTracker);h&&"fragment"in h?h=h.fragment:h||(h=void 0);const f=oe.bufferInfo(this.media,e,0);this.hls.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:c,reason:c.message,frag:h,buffer:f.len,bufferInfo:f})}}}}}_tryFixBufferStall(e,t,s){var r,n;const{fragmentTracker:a,media:o}=this,l=(r=this.hls)==null?void 0:r.config;if(!o||!a||!l)return;const d=(n=this.hls)==null?void 0:n.latestLevelDetails,u=Io(s,a);if((u||d!=null&&d.live&&s<d.fragmentStart)&&(this._trySkipBufferHole(u)||!this.media))return;const c=e.buffered,h=this.adjacentTraversal(e,s);(c&&c.length>1&&e.len>l.maxBufferHole||e.nextStart&&(e.nextStart-s<l.maxBufferHole||h))&&(t>l.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const s=this.fragmentTracker,r=e.nextStart;if(s&&r){const n=s.getFragAtPos(t,Q.MAIN),a=s.getFragAtPos(r,Q.MAIN);if(n&&a)return a.sn-n.sn<2}return!1}_reportStall(e){const{hls:t,media:s,stallReported:r,stalled:n}=this;if(!r&&n!==null&&s&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${we(e)})`);this.warn(a.message),t.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:n}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:s,media:r}=this,n=(t=this.hls)==null?void 0:t.config;if(!r||!s||!n)return 0;const a=r.currentTime,o=oe.bufferInfo(r,a,0),l=a<o.start?o.start:o.nextStart;if(l&&this.hls){const u=o.len<=n.maxBufferHole,c=o.len>0&&o.len<1&&r.readyState<3,h=l-a;if(h>0&&(u||c)){if(h>n.maxBufferHole){let m=!1;if(a===0){const g=s.getAppendedFrag(0,Q.MAIN);g&&l<g.end&&(m=!0)}if(!m&&e){var d;if(!((d=this.hls.loadLevelObj)!=null&&d.details)||sg(this.hls.inFlightFragments,l))return 0;let p=!1,E=e.end;for(;E<l;){const b=Io(E,s);if(b)E+=b.duration;else{p=!0;break}}if(p)return 0}}const f=Math.max(l+kR,a+xR);if(this.warn(`skipping hole, adjusting currentTime from ${a} to ${f}`),this.moved=!0,r.currentTime=f,!(e!=null&&e.gap)){const m=new Error(`fragment loaded with buffer holes, seeking from ${a} to ${f}`),g={type:ee.MEDIA_ERROR,details:C.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:m,reason:m.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?g.part=e:g.frag=e),this.hls.trigger(v.ERROR,g)}return f}}return 0}_tryNudgeBuffer(e){const{hls:t,media:s,nudgeRetry:r}=this,n=t?.config;if(!s||!n)return 0;const a=s.currentTime;if(this.nudgeRetry++,r<n.nudgeMaxRetry){const o=a+(r+1)*n.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${a} to ${o}`);this.warn(l.message),s.currentTime=o,t.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.BUFFER_NUDGE_ON_STALL,error:l,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${a} after ${n.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function sg(i,e){const t=rg(i.main);if(t&&t.start<=e)return t;const s=rg(i.audio);return s&&s.start<=e?s:null}function rg(i){if(!i)return null;switch(i.state){case P.IDLE:case P.STOPPED:case P.ENDED:case P.ERROR:return null}return i.frag}function Io(i,e){return e.getAppendedFrag(i,Q.MAIN)||e.getPartialFragment(i)}const wR=.25;function Mc(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Ku(i,e,t,s,r){let n=new i(e,t,"");try{n.value=s,r&&(n.type=r)}catch{n=new i(e,t,we(r?Ie({type:r},s):s))}return n}const Lo=(()=>{const i=Mc();try{i&&new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class MR{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(v.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;
55e&&(e.on(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(v.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(v.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(v.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(v.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(v.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(v.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var s;this.media=t.media,((s=t.overrides)==null?void 0:s.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&rn(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const s=e[t];if(s.kind==="metadata"&&s.label==="id3")return yE(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:s,enableID3MetadataCues:r}=this.hls.config;if(!s&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=Mc();if(a)for(let o=0;o<n.length;o++){const l=n[o].type;if(l===Gt.emsg&&!s||!r)continue;const d=qv(n[o].data),u=n[o].pts;let c=u+n[o].duration;c>Lo&&(c=Lo),c-u<=0&&(c=u+wR);for(let f=0;f<d.length;f++){const m=d[f];if(!jv(m)){this.updateId3CueEnds(u,l);const g=Ku(a,u,c,m,l);g&&this.id3Track.addCue(g)}}}}updateId3CueEnds(e,t){var s;const r=(s=this.id3Track)==null?void 0:s.cues;if(r)for(let n=r.length;n--;){const a=r[n];a.type===t&&a.startTime<e&&a.endTime===Lo&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:s,type:r}){const{id3Track:n,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(n&&(o||l)){let d;r==="audio"?d=u=>u.type===Gt.audioId3&&l:r==="video"?d=u=>u.type===Gt.emsg&&o:d=u=>u.type===Gt.audioId3&&l||u.type===Gt.emsg&&o,Dc(n,t,s,d)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:s,timelineOffset:r,enableDateRangeMetadataCues:n,interstitialsController:a}=this.hls.config;if(!n)return;const o=Mc();if(s&&r&&!a){const{fragmentStart:g,fragmentEnd:p}=e;let E=this.assetCue;E?(E.startTime=g,E.endTime=p):o&&(E=this.assetCue=Ku(o,g,p,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),E&&(E.id=s,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(E),E.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:d}=e,u=Object.keys(d);let c=this.dateRangeCuesAppended;if(l&&t){var h;if((h=l.cues)!=null&&h.length){const g=Object.keys(c).filter(p=>!u.includes(p));for(let p=g.length;p--;){var f;const E=g[p],b=(f=c[E])==null?void 0:f.cues;delete c[E],b&&Object.keys(b).forEach(y=>{const T=b[y];if(T){T.removeEventListener("enter",this.onEventCueEnter);try{l.removeCue(T)}catch{}}})}}else c=this.dateRangeCuesAppended={}}const m=e.fragments[e.fragments.length-1];if(!(u.length===0||!j(m?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let g=0;g<u.length;g++){const p=u[g],E=d[p],b=E.startTime,y=c[p],T=y?.cues||{};let A=y?.durationKnown||!1,L=Lo;const{duration:S,endDate:R}=E;if(R&&S!==null)L=b+S,A=!0;else if(E.endOnNext&&!A){const I=u.reduce((M,$)=>
vendor: 3,171 bytes, line 55
55{if($!==E.id){const V=d[$];if(V.class===E.class&&V.startDate>E.startDate&&(!M||E.startDate<M.startDate))return V}return M},null);I&&(L=I.startTime,A=!0)}const x=Object.keys(E.attr);for(let I=0;I<x.length;I++){const M=x[I];if(!e1(M))continue;const $=T[M];if($)A&&!(y!=null&&y.durationKnown)?$.endTime=L:Math.abs($.startTime-b)>.01&&($.startTime=b,$.endTime=L);else if(o){let V=E.attr[M];t1(M)&&(V=rv(V));const H=Ku(o,b,L,{key:M,data:V},Gt.dateRange);H&&(H.id=p,this.id3Track.addCue(H),T[M]=H,a&&(M==="X-ASSET-LIST"||M==="X-ASSET-URL")&&H.addEventListener("enter",this.onEventCueEnter))}}c[p]={cues:T,dateRange:E,durationKnown:A}}}}}class PR{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,s=this.levelDetails;if(!t||!s)return;this.currentTime=t.currentTime;const r=this.computeLatency();if(r===null)return;this._latency=r;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:a}=this.config;if(!n||a===1||!s.live)return;const o=this.targetLatency;if(o===null)return;const l=r-o,d=Math.min(this.maxLatency,o+s.targetduration);if(l<d&&l>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,a)),h=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20,f=Math.min(c,Math.max(1,h));this.changeMediaPlaybackRate(t,f)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:s,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let d=o&&s||t;(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||d===0)&&(d=n!==void 0?n:a*r);const u=r;return d+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const s=this.levelDetails;if(s===null)return null;const r=s.edge,n=e-t-this.edgeStalled,a=r-s.totalduration,o=r-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,n),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;
vendor: 27,723 bytes, line 55
55e&&(e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(v.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(v.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var s;t.details===C.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(s=this.levelDetails)!=null&&s.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var s,r;e.playbackRate!==t&&((s=this.hls)==null||s.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(r=this.targetLatency)==null?void 0:r.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class OR extends mf{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(){const{hls:e}=this;e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(v.LEVEL_LOADED,this.onLevelLoaded,this),e.on(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(v.FRAG_BUFFERED,this.onFragBuffered,this),e.on(v.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(v.LEVEL_LOADED,this.onLevelLoaded,this),e.off(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(v.FRAG_BUFFERED,this.onFragBuffered,this),e.off(v.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.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){const s=this.hls.config.preferManagedMediaSource,r=[],n={},a={};let o=!1,l=!1,d=!1;t.levels.forEach(u=>{const c=u.attrs;let{audioCodec:h,videoCodec:f}=u;h&&(u.audioCodec=h=ud(h,s)||void 0),f&&(f=u.videoCodec=vS(f));const{width:m,height:g,unknownCodecs:p}=u,E=p?.length||0;if(o||(o=!!(m&&g)),l||(l=!!f),d||(d=!!h),E||h&&!this.isAudioSupported(h)||f&&!this.isVideoSupported(f)){this.log(`Some or all CODECS not supported "${c.CODECS}"`);return}const{CODECS:b,"FRAME-RATE":y,"HDCP-LEVEL":T,"PATHWAY-ID":A,RESOLUTION:L,"VIDEO-RANGE":S}=c,x=`${`${A||"."}-`}${u.bitrate}-${L}-${y}-${b}-${S}-${T}`;if(n[x])if(n[x].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const I=a[x]+=1;u.attrs["PATHWAY-ID"]=new Array(I+1).join(".");const M=this.createLevel(u);n[x]=M,r.push(M)}else n[x].addGroupId("audio",c.AUDIO),n[x].addGroupId("text",c.SUBTITLES);else{const I=this.createLevel(u);n[x]=I,a[x]=1,r.push(I)}}),this.filterAndSortMediaOptions(r,t,o,l,d)}createLevel(e){const t=new Ua(e),s=e.supplemental;if(s!=null&&s.videoCodec&&!this.isVideoSupported(s.videoCodec)){const r=new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);this.log(r.message),t.supportedResult=gv(r,[])}return t}isAudioSupported(e){return Oa(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Oa(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,s,r,n){var a;let o=[],l=[],d=e;const u=((a=t.stats)==null?void 0:a.parsing)||{};if((s||r)&&n&&(d=d.filter(({videoCodec:b,videoRange:y,width:T,height:A})=>(!!b||!!(T&&A))&&RS(y))),d.length===0){Promise.resolve().then(()=>{if(this.hls){let b="no level with compatible codecs found in manifest",y=b;t.levels.length&&(y=`one or more CODECS in variant not supported: ${we(t.levels.map(A=>A.attrs.CODECS).filter((A,L,S)=>S.indexOf(A)===L))}`,this.warn(y),b+=` (${y})`);const T=new Error(b);this.hls.trigger(v.ERROR,{type:ee.MEDIA_ERROR,details:C.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:T,reason:y})}}),u.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(b=>!b.audioCodec||this.isAudioSupported(b.audioCodec)),ng(o)),t.subtitles&&(l=t.subtitles,ng(l));const c=d.slice(0);d.sort((b,y)=>{if(b.attrs["HDCP-LEVEL"]!==y.attrs["HDCP-LEVEL"])return(b.attrs["HDCP-LEVEL"]||"")>(y.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&b.height!==y.height)return b.height-y.height;if(b.frameRate!==y.frameRate)return b.frameRate-y.frameRate;if(b.videoRange!==y.videoRange)return cd.indexOf(b.videoRange)-cd.indexOf(y.videoRange);if(b.videoCodec!==y.videoCodec){const T=Qm(b.videoCodec),A=Qm(y.videoCodec);if(T!==A)return A-T}if(b.uri===y.uri&&b.codecSet!==y.codecSet){const T=dd(b.codecSet),A=dd(y.codecSet);if(T!==A)return A-T}return b.averageBitrate!==y.averageBitrate?b.averageBitrate-y.averageBitrate:0});let h=c[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==c.length)){for(let b=0;b<c.length;b++)if(c[b].pathwayId===d[0].pathwayId){h=c[b];break}}this._levels=d;for(let b=0;b<d.length;b++)if(d[b]===h){var f;this._firstLevel=b;const y=h.bitrate,T=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${d.length} level(s) found, first bitrate: ${y}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const A=Math.min(y,this.hls.config.abrEwmaDefaultEstimateMax);A>T&&T===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=A)}break}const m=n&&!r,g=this.hls.config,p=!!(g.audioStreamController&&g.audioTrackController),E={levels:d,audioTracks:o,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:p&&!m&&o.some(b=>!!b.url)};u.end=performance.now(),this.hls.trigger(v.MANIFEST_PARSED,E)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const u=new Error("invalid level idx"),c=e<0;if(this.hls.trigger(v.ERROR,{type:ee.OTHER_ERROR,details:C.LEVEL_SWITCH_ERROR,level:e,fatal:c,error:u,reason:u.message}),c)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,s===e&&r&&n===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${s}${n?" with Pathway "+n:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(v.LEVEL_SWITCHING,l);const d=a.details;if(!d||d.live){const u=this.switchParams(a.uri,r?.details,d);this.loadPlaylist(u)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),s=e.filter(r=>t.indexOf(r)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=s}}onError(e,t){t.fatal||!t.context||t.context.type===fe.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Q.MAIN){const s=t.elementaryStreams;if(!Object.keys(s).some(n=>!!s[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var s;const{level:r,details:n}=t,a=t.levelInfo;if(!a){var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let l=a.details;l===t.details&&l.advanced&&(l=void 0),this.playlistLoaded(r,t,l)}else(s=t.deliveryDirectives)!=null&&s.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,n=e.attrs["PATHWAY-ID"],a=e.details,o=a?.age;this.log(`Loading level index ${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${n?" Pathway "+n:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${s}`),this.hls.trigger(v.LEVEL_LOADING,{url:s,level:r,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const s=this._levels.filter((n,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(n),n===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,n.details&&n.details.fragments.forEach(o=>o.level=-1)),!1));Uv(s),this._levels=s,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const r=s.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(v.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(v.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function ng(i){const e={};i.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}function wE(){return self.SourceBuffer||self.WebKitSourceBuffer}function ME(){if(!Us())return!1;const e=wE();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function NR(){if(!ME())return!1;const i=Us();return typeof i?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>i.isTypeSupported(Na(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(Na(e,"audio"))))}function UR(){var i;const e=wE();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}const $R=100;class FR extends af{constructor(e,t,s){super(e,t,s,"stream-controller",Q.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const r=this.media,n=r?r.currentTime:null;if(n===null||!j(n)||(this.log(`Media seeked to ${n.toFixed(3)}`),!this.getBufferedFrag(n)))return;const a=this.getFwdBufferInfoAtPos(r,n,Q.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${n} on "seeked" event ${a?a.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.LEVEL_LOADING,this.onLevelLoading,this),e.on(v.LEVEL_LOADED,this.onLevelLoaded,this),e.on(v.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(v.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(v.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(v.BUFFER_CREATED,this.onBufferCreated,this),e.on(v.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(v.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.LEVEL_LOADED,this.onLevelLoaded,this),e.off(v.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(v.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(v.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(v.BUFFER_CREATED,this.onBufferCreated,this),e.off(v.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(v.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:s,hls:r}=this;if(this.stopLoad(),this.setInterval($R),this.level=-1,!this.startFragRequested){let n=r.startLevel;n===-1&&(r.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=r.firstAutoLevel),r.nextLoadLevel=n,this.level=r.loadLevel,this._hasEnoughToStart=!!t}s>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s),this.state=P.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=P.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case P.WAITING_LEVEL:{const{levels:e,level:t}=this,s=e?.[t],r=s?.details;if(r&&(!r.live||this.levelLastLoaded===s&&!this.waitForLive(s))){if(this.waitForCdnTuneIn(r))break;this.state=P.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=P.IDLE;break}break}case P.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===P.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(s!=null&&s[n]))return;const a=s[n],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const g={};this.altAudio===2&&(g.type="video"),this.hls.trigger(v.BUFFER_EOS,g),this.state=P.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const d=a.details;if(!d||this.state===P.WAITING_LEVEL||this.waitForLive(a)){this.level=n,this.state=P.WAITING_LEVEL,this.startFragRequested=!1;return}const u=o.len,c=this.getMaxBufferLength(a.maxBitrate);if(u>=c)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:o.end;let f=this.getNextFragment(h,d);if(this.couldBacktrack&&!this.fragPrevious&&f&&je(f)&&this.fragmentTracker.getState(f)!==nt.OK){var m;const p=((m=this.backtrackFragment)!=null?m:f).sn-d.startSN,E=d.fragments[p-1];E&&f.cc===E.cc&&(f=E,this.fragmentTracker.removeFragment(E))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,h)){if(!f.gap){const p=this.audioOnly&&!this.altAudio?Ce.AUDIO:Ce.VIDEO,E=(p===Ce.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;E&&this.afterBufferFlushed(E,p,Q.MAIN)}f=this.getNextFragmentLoopLoading(f,d,o,Q.MAIN,c)}f&&(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,a,h))}loadFragment(e,t,s){const r=this.fragmentTracker.getState(e);r===nt.NOT_LOADED||r===nt.PARTIAL?je(e)?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)):super.loadFragment(e,t,s):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Q.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let s;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<n.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,l=e[o],d=this.fragLastKbps;d&&this.fragCurrent?s=this.fragCurrent.duration*l.maxBitrate/(1e3*d)+1:s=0}else s=0;const a=this.getBufferedFrag(t.currentTime+s);if(a){const o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();const l=o.maxStartPTS?o.maxStartPTS:o.start,d=o.duration,u=Math.max(a.end,l+Math.min(Math.max(d-this.config.maxFragLookUpTolerance,d*(this.couldBacktrack?.5:.125)),d*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case P.KEY_LOADING:case P.FRAG_LOADING:case P.FRAG_LOADING_WAITING_RETRY:case P.PARSING:case P.PARSED:this.state=P.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const s=t.media;St(s,"playing",this.onMediaPlaying),St(s,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:s}=this;s&&(xt(s,"playing",this.onMediaPlaying),xt(s,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(v.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let s=!1,r=!1;for(let n=0;n<t.levels.length;n++){const a=t.levels[n].audioCodec;a&&(s=s||a.indexOf("mp4a.40.2")!==-1,r=r||a.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=s&&r&&!UR(),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){const{levels:s}=this;if(!s||this.state!==P.IDLE)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=P.WAITING_LEVEL)}onLevelLoaded(e,t){var s;const{levels:r,startFragRequested:n}=this,a=t.level,o=t.details,l=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${l}`);const d=t.levelInfo,u=this.fragCurrent;u&&(this.state===P.FRAG_LOADING||this.state===P.FRAG_LOADING_WAITING_RETRY)&&u.level!==t.level&&u.loader&&this.abortCurrentFrag();let c=0;if(o.live||(s=d.details)!=null&&s.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,d.details,(h=this.levelLastLoaded)==null?void 0:h.details)}if(d.details=o,this.levelLastLoaded=d,n||this.setStartPosition(o,c),this.hls.trigger(v.LEVEL_UPDATED,{details:o,level:a}),this.state===P.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=P.IDLE}n&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:s}=this;if(!s)return;const r=this.hls.liveSyncPosition,n=this.getLoadPosition(),a=e.fragmentStart,o=e.edge,l=n>=a-t.maxFragLookUpTolerance&&n<=o;if(r!==null&&s.duration>r&&(n<r||!l)){const u=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!l&&s.readyState<4||n<o-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),s.readyState))if(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var d;const c=oe.bufferInfo(s,r,0);if(!((d=c.buffered)!=null&&d.length)){s.currentTime=r;return}if(c.start<=n){s.currentTime=r;return}const{nextStart:f}=oe.bufferedInfo(c.buffered,n,0);f&&(s.currentTime=f)}else s.currentTime=r}}_handleFragmentLoadProgress(e){var t;const s=e.frag,{part:r,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const o=a[s.level];if(!o){this.warn(`Level ${s.level} not found on progress`);return}const l=o.details;if(!l){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const d=o.videoCodec,u=l.PTSKnown||!l.live,c=(t=s.initSegment)==null?void 0:t.data,h=this._getAudioCodec(o),f=this.transmuxer=this.transmuxer||new nE(this.hls,Q.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=r?r.index:-1,g=m!==-1,p=new sf(s.level,s.sn,s.stats.chunkCount,n.byteLength,m,g),E=this.initPTS[s.cc];f.push(n,c,h,d,s,r,l.totalduration,u,p,E)}onAudioTrackSwitching(e,t){const s=this.hls,r=this.altAudio!==0;if(hd(t.url,s))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.altAudio=0,this.fragmentTracker.removeAllFragments(),s.once(v.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(v.AUDIO_TRACK_SWITCHED,t)}),s.trigger(v.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(v.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=hd(t.url,this.hls);if(s){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=s?2:0,this.tick()}onBufferCreated(e,t){const s=t.tracks;let r,n,a=!1;for(const o in s){const l=s[o];if(l.id==="main"){if(n=o,r=l,o==="video"){const d=s[o];d&&(this.videoBuffer=d.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:r}=t,n=s.type===Q.MAIN;if(n){if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===P.PARSED&&(this.state=P.IDLE);return}const o=r?r.stats:s.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),je(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,r)}const a=this.media;a&&(!this._hasEnoughToStart&&oe.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var s;if(t.fatal){this.state=P.ERROR;return}switch(t.details){case C.FRAG_GAP:case C.FRAG_PARSING_ERROR:case C.FRAG_DECRYPT_ERROR:case C.FRAG_LOAD_ERROR:case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_ERROR:case C.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Q.MAIN,t);break;case C.LEVEL_LOAD_ERROR:case C.LEVEL_LOAD_TIMEOUT:case C.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===P.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===fe.LEVEL&&(this.state=P.IDLE);break;case C.BUFFER_ADD_CODEC_ERROR:case C.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case C.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case C.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=P.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Ce.AUDIO||!this.altAudio){const s=(t===Ce.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,t,Q.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t<s){if(e.seeking){this.log(`could not seek to ${s}, already seeking at ${t}`);return}const r=this.timelineOffset;r&&s&&(s+=r);const n=this.getLevelDetails(),a=oe.getBuffered(e),o=a.length?a.start(0):0,l=o-s,d=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||l>0&&(l<d||this.loadingParts&&l<2*(n?.partTarget||0)))&&(this.log(`adjusting start position by ${l} to match buffer start`),s+=l,this.startPosition=s),t<s&&(this.log(`seek to target start position ${s} from current time ${t} buffer start ${o}`),e.currentTime=s)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(s=>{const{hls:r}=this,n=s?.frag;if(!n||this.fragContextChanged(n))return;t.fragmentError=0,this.state=P.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=n.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),r.trigger(v.FRAG_LOADED,s),n.bitrateTest=!1}
vendor: 4,820 bytes, line 55
55).catch(s=>{this.state===P.STOPPED||this.state===P.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:s}=this,{remuxResult:r,chunkMeta:n}=e,a=this.getCurrentContext(n);if(!a){this.resetWhenMissingContext(n);return}const{frag:o,part:l,level:d}=a,{video:u,text:c,id3:h,initSegment:f}=r,{details:m}=d,g=this.altAudio?void 0:r.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=P.PARSING,f){const p=f.tracks;if(p){const T=o.initSegment||o;if(this.unhandledEncryptionError(f,o))return;this._bufferInitSegment(d,p,T,n),s.trigger(v.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:t,tracks:p})}const E=f.initPTS,b=f.timescale,y=this.initPTS[o.cc];if(j(E)&&(!y||y.baseTime!==E||y.timescale!==b)){const T=f.trackId;this.initPTS[o.cc]={baseTime:E,timescale:b,trackId:T},s.trigger(v.INIT_PTS_FOUND,{frag:o,id:t,initPTS:E,timescale:b,trackId:T})}}if(u&&m){g&&u.type==="audiovideo"&&this.logMuxedErr(o);const p=m.fragments[o.sn-1-m.startSN],E=o.sn===m.startSN,b=!p||o.cc>p.cc;if(r.independent!==!1){const{startPTS:y,endPTS:T,startDTS:A,endDTS:L}=u;if(l)l.elementaryStreams[u.type]={startPTS:y,endPTS:T,startDTS:A,endDTS:L};else if(u.firstKeyFrame&&u.independent&&n.id===1&&!b&&(this.couldBacktrack=!0),u.dropped&&u.independent){const S=this.getMainFwdBufferInfo(),R=(S?S.end:this.getLoadPosition())+this.config.maxBufferHole,x=u.firstKeyFramePTS?u.firstKeyFramePTS:y;if(!E&&R<x-this.config.maxBufferHole&&!b){this.backtrack(o);return}else b&&(o.gap=!0);o.setElementaryStreamInfo(u.type,o.start,T,o.start,L,!0)}else E&&y-(m.appliedTimelineOffset||0)>Xo&&(o.gap=!0);o.setElementaryStreamInfo(u.type,y,T,A,L),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(u,o,l,n,E||b)}else if(E||b)o.gap=!0;else{this.backtrack(o);return}}if(g){const{startPTS:p,endPTS:E,startDTS:b,endDTS:y}=g;l&&(l.elementaryStreams[Ce.AUDIO]={startPTS:p,endPTS:E,startDTS:b,endDTS:y}),o.setElementaryStreamInfo(Ce.AUDIO,p,E,b,y),this.bufferFragmentData(g,o,l,n)}if(m&&h!=null&&h.samples.length){const p={id:t,frag:o,details:m,samples:h.samples};s.trigger(v.FRAG_PARSING_METADATA,p)}if(m&&c){const p={id:t,frag:o,details:m,samples:c.samples};s.trigger(v.FRAG_PARSING_USERDATA,p)}}logMuxedErr(e){this.warn(`${je(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,s,r){if(this.state!==P.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(s));const{audio:n,video:a,audiovideo:o}=t;if(n){const d=e.audioCodec;let u=Vo(n.codec,d);u==="mp4a"&&(u="mp4a.40.5");const c=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const h=n.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&c.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&c.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),d&&d!==u&&this.log(`Swapping manifest audio codec "${d}" for "${u}"`),n.levelCodec=u,n.id=Q.MAIN,this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${u||""}/${d||""}/${n.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=Q.MAIN;const d=a.codec;if(d?.length===4)switch(d){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${d}]${a.codec!==d?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const l=Object.keys(t);if(l.length){if(this.hls.trigger(v.BUFFER_CODECS,t),!this.hls)return;l.forEach(d=>{const c=t[d].initSegment;c!=null&&c.byteLength&&this.hls.trigger(v.BUFFER_APPENDING,{type:d,data:c,frag:s,part:null,chunkMeta:r,parent:s.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,Q.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,s=e?.[t];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}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=P.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(oe.isBuffered(e,s)?t=this.getAppendedFrag(s):oe.isBuffered(e,s+.1)&&
55(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(v.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(v.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return j(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(j(t)){const s=this.getLevelDetails(),r=this.currentFrag||(s?yr(null,s.fragments,t):null);if(r){const n=r.programDateTime;if(n!==null){const a=n+(t-r.start)*1e3;return new Date(a)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class BR extends ti{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyIdToKeyInfo){const r=this.keyIdToKeyInfo[s].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=C.KEY_LOAD_ERROR,s,r,n){return new ss({type:ee.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:s,networkDetails:r})}loadClear(e,t,s){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,n=t.length;r<n;r++){const a=t[r];if(e.cc<=a.cc&&(!je(e)||!je(a)||e.sn<a.sn)||!s&&r==n-1)return this.emeController.selectKeySystemFormat(a).then(o=>{if(!this.emeController)return;a.setKeyFormat(o);const l=Yo(o);if(l)return this.emeController.getKeySystemAccess([l])})}if(this.config.requireKeySystemAccessOnStart){const r=Qn(this.config);if(r.length)return this.emeController.getKeySystemAccess(r)}}return null}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 s,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const d=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,C.KEY_LOAD_ERROR,d))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,C.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));const o=Vu(n);let l=this.keyIdToKeyInfo[o];if((s=l)!=null&&s.decryptdata.key)return n.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if(this.emeController&&(r=l)!=null&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(l.decryptdata)){case"usable":case"usable-in-future":return l.keyLoadPromise.then(u=>{const{keyInfo:c}=u;return n.key=c.decryptdata.key,{frag:e,keyInfo:c}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${n.keyId?" keyId: "+gt(n.keyId):""} URI: ${n.uri} from ${e.type} ${e.level}`),l=this.keyIdToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,C.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r;if(!e.decryptdata.keyId&&(r=t.initSegment)!=null&&r.data){const a=nS(t.initSegment.data);if(a.length){let o=a[0];o.some(l=>l!==0)?(this.log(`Using keyId found in init segment ${gt(o)}`),Os.setKeyIdForUri(e.decryptdata.uri,o)):(o=Os.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${gt(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!je(t))return Promise.resolve(s);const n=this.emeController.loadKey(s);
vendor: 5,692 bytes, line 55
55return(e.keyLoadPromise=n.then(a=>(e.mediaKeySessionContext=a,s))).catch(a=>{throw e.keyLoadPromise=null,"data"in a&&(a.data.frag=t),a})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,r=s.loader,n=new r(s);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=s.keyLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,g)=>{const{frag:p,keyInfo:E}=m,b=Vu(E.decryptdata);if(!p.decryptdata||E!==this.keyIdToKeyInfo[b])return o(this.createKeyLoadError(p,C.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),g));E.decryptdata.key=p.decryptdata.key=new Uint8Array(h.data),p.keyLoader=null,E.loader=null,a({frag:p,keyInfo:E})},onError:(h,f,m,g)=>{this.resetLoader(f),o(this.createKeyLoadError(t,C.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),m,Ie({url:l.url,data:void 0},h)))},onTimeout:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,C.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,C.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};n.load(l,u,c)})}resetLoader(e){const{frag:t,keyInfo:s,url:r}=e,n=s.loader;t.keyLoader===n&&(t.keyLoader=null,s.loader=null);const a=Vu(s.decryptdata)||r;delete this.keyIdToKeyInfo[a],n&&n.destroy()}}function Vu(i){if(i.keyFormat!==vt.FAIRPLAY){const e=i.keyId;if(e)return gt(e)}return i.uri}function ag(i){const{type:e}=i;switch(e){case fe.AUDIO_TRACK:return Q.AUDIO;case fe.SUBTITLE_TRACK:return Q.SUBTITLE;default:return Q.MAIN}}function Wu(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class HR{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.LEVEL_LOADING,this.onLevelLoading,this),e.on(v.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(v.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(v.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.LEVEL_LOADING,this.onLevelLoading,this),e.off(v.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(v.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(v.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,r=t.loader,n=s||r,a=new n(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(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:fe.MANIFEST,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:s,level:r,pathwayId:n,url:a,deliveryDirectives:o,levelInfo:l}=t;this.load({id:s,level:r,pathwayId:n,responseType:"text",type:fe.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:l})}onAudioTrackLoading(e,t){const{id:s,groupId:r,url:n,deliveryDirectives:a,track:o}=t;this.load({id:s,groupId:r,level:null,responseType:"text",type:fe.AUDIO_TRACK,url:n,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:s,groupId:r,url:n,deliveryDirectives:a,track:o}=t;this.load({id:s,groupId:r,level:null,responseType:"text",type:fe.SUBTITLE_TRACK,url:n,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){const s=this.loaders[fe.LEVEL];if(s){const r=s.context;r&&!t.levels.some(n=>n===r.levelOrTrack)&&(s.abort(),delete this.loaders[fe.LEVEL])}}load(e){var t;const s=this.hls.config;let r=this.getInternalLoader(e);if(r){const d=this.hls.logger,u=r.context;if(u&&u.levelOrTrack===e.levelOrTrack&&(u.url===e.url||u.deliveryDirectives&&!e.deliveryDirectives)){u.url===e.url?d.log(`[playlist-loader]: ignore ${e.url} ongoing request`):d.log(`[playlist-loader]: ignore ${e.url} in favor of ${u.url}`);return}d.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===fe.MANIFEST?n=s.manifestLoadPolicy.default:n=ke({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),j((t=e.deliveryDirectives)==null?void 0:t.part)){let d;if(e.type===fe.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===fe.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===fe.SUBTITLE_TRACK&&e.id!==null&&(d=this.hls.subtitleTracks[e.id].details),d){const u=d.partTarget,c=d.targetduration;if(u&&c){const h=Math.max(u*3,c*.8)*1e3;n=ke({},n,{maxTimeToFirstByteMs:Math.min(h,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(d,u,c,h)=>{const f=this.getInternalLoader(c);this.resetInternalLoader(c.type);const m=d.data;u.parsing.start=performance.now(),Bi.isMediaPlaylist(m)||c.type!==fe.MANIFEST?this.handleTrackOrLevelPlaylist(d,u,c,h||null,f):this.handleMasterPlaylist(d,u,c,h)},onError:(d,u,c,h)=>{this.handleNetworkError(u,c,!1,d,h)},onTimeout:(d,u,c)=>{this.handleNetworkError(u,c,!0,void 0,d)}};r.load(e,o,l)}
vendor: 4,283 bytes, line 55
55checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:s}=this.hls;(e||s)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,s,r){const n=this.hls,a=e.data,o=Wu(e,s),l=Bi.parseMasterPlaylist(a,o);if(l.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,s,l.playlistParsingError,r,t);return}const{contentSteering:d,levels:u,sessionData:c,sessionKeys:h,startTimeOffset:f,variableList:m}=l;this.variableList=m,u.forEach(b=>{const{unknownCodecs:y}=b;if(y){const{preferManagedMediaSource:T}=this.hls.config;let{audioCodec:A,videoCodec:L}=b;for(let S=y.length;S--;){const R=y[S];Oa(R,"audio",T)?(b.audioCodec=A=A?`${A},${R}`:R,An.audio[A.substring(0,4)]=2,y.splice(S,1)):Oa(R,"video",T)&&(b.videoCodec=L=L?`${L},${R}`:R,An.video[L.substring(0,4)]=2,y.splice(S,1))}}});const{AUDIO:g=[],SUBTITLES:p,"CLOSED-CAPTIONS":E}=Bi.parseMasterPlaylistMedia(a,o,l);g.length&&!g.some(y=>!y.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Be({}),bitrate:0,url:""})),n.trigger(v.MANIFEST_LOADED,{levels:u,audioTracks:g,subtitles:p,captions:E,contentSteering:d,url:o,stats:t,networkDetails:r,sessionData:c,sessionKeys:h,startTimeOffset:f,variableList:m})}handleTrackOrLevelPlaylist(e,t,s,r,n){const a=this.hls,{id:o,level:l,type:d}=s,u=Wu(e,s),c=j(l)?l:j(o)?o:0,h=ag(s),f=Bi.parseLevelPlaylist(e.data,u,c,h,0,this.variableList);if(d===fe.MANIFEST){const m={attrs:new Be({}),bitrate:0,details:f,name:"",url:u};f.requestScheduled=t.loading.start+Pv(f,0),a.trigger(v.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:u,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=f,this.handlePlaylistLoaded(f,e,t,s,r,n)}handleManifestParsingError(e,t,s,r,n){this.hls.trigger(v.ERROR,{type:ee.NETWORK_ERROR,details:C.MANIFEST_PARSING_ERROR,fatal:t.type===fe.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,s=!1,r,n){let a=`A network ${s?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===fe.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===fe.AUDIO_TRACK||e.type===fe.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let l=C.UNKNOWN,d=!1;const u=this.getInternalLoader(e);switch(e.type){case fe.MANIFEST:l=s?C.MANIFEST_LOAD_TIMEOUT:C.MANIFEST_LOAD_ERROR,d=!0;break;case fe.LEVEL:l=s?C.LEVEL_LOAD_TIMEOUT:C.LEVEL_LOAD_ERROR,d=!1;break;case fe.AUDIO_TRACK:l=s?C.AUDIO_TRACK_LOAD_TIMEOUT:C.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case fe.SUBTITLE_TRACK:l=s?C.SUBTITLE_TRACK_LOAD_TIMEOUT:C.SUBTITLE_LOAD_ERROR,d=!1;break}u&&this.resetInternalLoader(e.type);const c={type:ee.NETWORK_ERROR,details:l,fatal:d,url:e.url,loader:u,context:e,error:o,networkDetails:t,stats:n};if(r){const h=t?.url||e.url;c.response=Ie({url:h,data:void 0},r)}this.hls.trigger(v.ERROR,c)}handlePlaylistLoaded(e,t,s,r,n,a){const o=this.hls,{type:l,level:d,levelOrTrack:u,id:c,groupId:h,deliveryDirectives:f}=r,m=Wu(t,r),g=ag(r);let p=typeof r.level=="number"&&g===Q.MAIN?d:void 0;const E=e.playlistParsingError;if(E){if(this.hls.logger.warn(`${E} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(v.ERROR,{type:ee.NETWORK_ERROR,details:C.LEVEL_PARSING_ERROR,fatal:!1,url:m,error:E,reason:E.message,response:t,context:r,level:p,parent:g,networkDetails:n,stats:s});return}e.playlistParsingError=null}if(!e.fragments.length){const b=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(v.ERROR,{type:ee.NETWORK_ERROR,details:C.LEVEL_EMPTY_ERROR,fatal:!1,url:m,error:b,reason:b.message,response:t,context:r,level:p,parent:g,networkDetails:n,stats:s});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case fe.MANIFEST:case fe.LEVEL:if(p){if
vendor: 10,538 bytes, line 55
55(!u)p=0;else if(u!==o.levels[p]){const b=o.levels.indexOf(u);b>-1&&(p=b)}}o.trigger(v.LEVEL_LOADED,{details:e,levelInfo:u||o.levels[0],level:p||0,id:c||0,stats:s,networkDetails:n,deliveryDirectives:f,withoutMultiVariant:l===fe.MANIFEST});break;case fe.AUDIO_TRACK:o.trigger(v.AUDIO_TRACK_LOADED,{details:e,track:u,id:c||0,groupId:h||"",stats:s,networkDetails:n,deliveryDirectives:f});break;case fe.SUBTITLE_TRACK:o.trigger(v.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:c||0,groupId:h||"",stats:s,networkDetails:n,deliveryDirectives:f});break}}}class Cs{static get version(){return $a}static isMSESupported(){return ME()}static isSupported(){return NR()}static getMediaSource(){return Us()}static get Events(){return v}static get MetadataSchema(){return Gt}static get ErrorTypes(){return ee}static get ErrorDetails(){return C}static get DefaultConfig(){return Cs.defaultConfig?Cs.defaultConfig:SR}static set DefaultConfig(e){Cs.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new of,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.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=qA(e.debug||!1,"Hls instance",e.assetPlayerId),s=this.config=LR(Cs.DefaultConfig,e,t);this.userConfig=e,s.progressive&&RR(s,t);const{abrController:r,bufferController:n,capLevelController:a,errorController:o,fpsController:l}=s,d=new o(this),u=this.abrController=new r(this),c=new GS(this),h=s.interstitialsController,f=h?this.interstitialsController=new h(this,Cs):null,m=this.bufferController=new n(this,c),g=this.capLevelController=new a(this),p=new l(this),E=new HR(this),b=s.contentSteeringController,y=b?new b(this):null,T=this.levelController=new OR(this,y),A=new MR(this),L=new BR(this.config,this.logger),S=this.streamController=new FR(this,c,L),R=this.gapController=new CR(this,c);g.setStreamController(S),p.setStreamController(S);const x=[E,T,S];f&&x.splice(1,0,f),y&&x.splice(1,0,y),this.networkControllers=x;const I=[u,m,R,g,p,A,c];this.audioTrackController=this.createController(s.audioTrackController,x);const M=s.audioStreamController;M&&x.push(this.audioStreamController=new M(this,c,L)),this.subtitleTrackController=this.createController(s.subtitleTrackController,x);const $=s.subtitleStreamController;$&&x.push(this.subtititleStreamController=new $(this,c,L)),this.createController(s.timelineController,I),L.emeController=this.emeController=this.createController(s.emeController,I),this.cmcdController=this.createController(s.cmcdController,I),this.latencyController=this.createController(PR,I),this.coreComponents=I,x.push(d);const V=d.onErrorOut;typeof V=="function"&&this.on(v.ERROR,V,d),this.on(v.MANIFEST_LOADED,E.onManifestLoaded,E)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,r){this._emitter.off(e,t,s,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(s){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const r=e===v.ERROR;this.trigger(v.ERROR,{type:ee.OTHER_ERROR,details:C.INTERNAL_EXCEPTION,fatal:r,event:e,error:s}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(v.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const n=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(v.ERROR,{type:ee.OTHER_ERROR,details:C.ATTACH_MEDIA_ERROR,fatal:!0,error:n});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,s=t?e.media:e,r=t?e:{media:s};this._media=s,this.trigger(v.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia"),this.trigger(v.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(v.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,s=this._url,r=this._url=zh.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&s&&(s!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(v.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let s=0;s<this.networkControllers.length&&(this.networkControllers[s].startLoad(e,t),!(!this.started||!this.networkControllers));s++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[Q.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[Q.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Q.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=CL()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.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){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const 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(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){LS(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const s=e.length;for(let r=0;r<s;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,s)for(let n=r;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=s)return n}return r}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()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}
55setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const 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}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const s=yv(t);return vv(e,s,navigator.mediaCapabilities)}}Cs.defaultConfig=void 0;var pe=Cs,Me={VIDEO:"video",THUMBNAIL:"thumbnail",STORYBOARD:"storyboard",DRM:"drm"},se={NOT_AN_ERROR:0,NETWORK_OFFLINE:2000002,NETWORK_UNKNOWN_ERROR:2e6,NETWORK_NO_STATUS:2000001,NETWORK_INVALID_URL:24e5,NETWORK_NOT_FOUND:2404e3,NETWORK_NOT_READY:2412e3,NETWORK_GENERIC_SERVER_FAIL:25e5,NETWORK_TOKEN_MISSING:2403201,NETWORK_TOKEN_MALFORMED:2412202,NETWORK_TOKEN_EXPIRED:2403210,NETWORK_TOKEN_AUD_MISSING:2403221,NETWORK_TOKEN_AUD_MISMATCH:2403222,NETWORK_TOKEN_SUB_MISMATCH:2403232,ENCRYPTED_ERROR:5e6,ENCRYPTED_UNSUPPORTED_KEY_SYSTEM:5000001,ENCRYPTED_GENERATE_REQUEST_FAILED:5000002,ENCRYPTED_UPDATE_LICENSE_FAILED:5000003,ENCRYPTED_UPDATE_SERVER_CERT_FAILED:5000004,ENCRYPTED_CDM_ERROR:5000005,ENCRYPTED_OUTPUT_RESTRICTED:5000006,ENCRYPTED_MISSING_TOKEN:5000002},Qd=i=>i===Me.VIDEO?"playback":i,bs=class Xn extends Error{constructor(e,t=Xn.MEDIA_ERR_CUSTOM,s,r){var n;super(e),this.name="MediaError",this.code=t,this.context=r,this.fatal=s??(t>=Xn.MEDIA_ERR_NETWORK&&t<=Xn.MEDIA_ERR_ENCRYPTED),this.message||(this.message=(n=Xn.defaultMessages[this.code])!=null?n:"")}};bs.MEDIA_ERR_ABORTED=1,bs.MEDIA_ERR_NETWORK=2,bs.MEDIA_ERR_DECODE=3,bs.MEDIA_ERR_SRC_NOT_SUPPORTED=4,bs.MEDIA_ERR_ENCRYPTED=5,bs.MEDIA_ERR_CUSTOM=100,bs.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 z=bs,GR=i=>i==null,bf=(i,e)=>GR(e)?!1:i in e,Pc={ANY:"any",MUTED:"muted"},Ae={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Hi={MSE:"mse",NATIVE:"native"},Zn={HEADER:"header",QUERY:"query",NONE:"none"},bd=Object.values(Zn),ls={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},og={HLS:ls.M3U8};[...Object.values(ls)];var EP={upTo720p:"720p",upTo1080p:"1080p",upTo1440p:"1440p",upTo2160p:"2160p"},yP={noLessThan480p:"480p",noLessThan540p:"540p",noLessThan720p:"720p",noLessThan1080p:"1080p",noLessThan1440p:"1440p",noLessThan2160p:"2160p"},bP={DESCENDING:"desc"},KR="en",Oc={code:KR},Ze=(i,e,t,s,r=i)=>{r.addEventListener(e,t,s),i.addEventListener("teardown",()=>{r.removeEventListener(e,t)},{once:!0})};function VR(i,e,t){e&&t>e&&(t=e);for(let s=0;s<i.length;s++)if(i.start(s)<=t&&i.end(s)>=t)return!0;return!1}var Tf=i=>{let e=i.indexOf("?");if(e<0)return[i];let t=i.slice(0,e),s=i.slice(e);return[t,s]},Xd=i=>{let{type:e}=i;if(e){let t=e.toUpperCase();return bf(t,og)?og[t]:e}return WR(i)},PE=i=>i==="VOD"?Ae.ON_DEMAND:Ae.LIVE,OE=i=>i==="EVENT"?Number.POSITIVE_INFINITY:i==="VOD"?Number.NaN:0,WR=i=>{let{src:e}=i;if(!e)return"";let t="";try{t=new URL(e).pathname}catch{console.error("invalid url")}let s=t.lastIndexOf(".");if(s<0)return qR(i)?ls.M3U8:"";let r=t.slice(s+1).toUpperCase();return bf(r,ls)?ls[r]:""},YR="mux.com",qR=({src:i,customDomain:e=YR})=>{let t;try{t=new URL(`${i}`)}catch{return!1}let s=t.protocol==="https:",r=t.hostname===`stream.${e}`.toLowerCase(),n=t.pathname.split("/"),a=n.length===2,o=!(n!=null&&n[1].includes("."));return s&&r&&a&&o},mn=i=>{let e=(i??"").split(".")[1];if(e)try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(s)}catch{return}},jR=({exp:i},e=Date.now())=>!i||i*1e3<e,zR=({sub:i},e)=>i!==e,QR=({aud:i},e)=>!i,XR=({aud:i},e)=>i!==e,NE="en";function te(i,e=!0){var t,s;let r=e&&(s=(t=Oc)==null?void 0:t[i])!=null?s:i,n=e?Oc.code:NE;return new ZR(r,n)}var ZR=class{constructor(e,t=(s=>(s=Oc)!=null?s:NE)()){this.message=e,this.locale=t}format(e){return this.message.replace(/\{(\w+)\}/g,(t,s)=>{var r;return(r=e[s])!=null?r:""})}toString(){return this.message}},JR=Object.values(Pc),lg=i=>typeof i=="boolean"||typeof i=="string"&&JR.includes(i),ex=(i,e,t)=>{let{autoplay:s}=i,r=!1,n=!1,a=lg(s)?s:!!s,o=()=>{r||Ze(e,"playing",()=>{r=!0},{once:!0})};if(o(),Ze(e,"loadstart",()=>{r=!1,o(),Yu(e,a)},{once:!0}),Ze(e,"loadstart",()=>{t||(i.streamType&&i.streamType!==Ae.UNKNOWN?n=i.streamType===Ae.
vendor: 8,486 bytes, line 55
55LIVE:n=!Number.isFinite(e.duration)),Yu(e,a)},{once:!0}),t&&t.once(pe.Events.LEVEL_LOADED,(l,d)=>{var u;i.streamType&&i.streamType!==Ae.UNKNOWN?n=i.streamType===Ae.LIVE:n=(u=d.details.live)!=null?u:!1}),!a){let l=()=>{!n||Number.isFinite(i.startTime)||(t!=null&&t.liveSyncPosition?e.currentTime=t.liveSyncPosition:Number.isFinite(e.seekable.end(0))&&(e.currentTime=e.seekable.end(0)))};t&&Ze(e,"play",()=>{e.preload==="metadata"?t.once(pe.Events.LEVEL_UPDATED,l):l()},{once:!0})}return l=>{r||(a=lg(l)?l:!!l,Yu(e,a))}},Yu=(i,e)=>{if(!e)return;let t=i.muted,s=()=>i.muted=t;switch(e){case Pc.ANY:i.play().catch(()=>{i.muted=!0,i.play().catch(s)});break;case Pc.MUTED:i.muted=!0,i.play().catch(s);break;default:i.play().catch(()=>{});break}},tx=({preload:i,src:e},t,s)=>{let r=c=>{c!=null&&["","none","metadata","auto"].includes(c)?t.setAttribute("preload",c):t.removeAttribute("preload")};if(!s)return r(i),r;let n=!1,a=!1,o=s.config.maxBufferLength,l=s.config.maxBufferSize,d=c=>{r(c);let h=c??t.preload;a||h==="none"||(h==="metadata"?(s.config.maxBufferLength=1,s.config.maxBufferSize=1):(s.config.maxBufferLength=o,s.config.maxBufferSize=l),u())},u=()=>{!n&&e&&(n=!0,s.loadSource(e))};return Ze(t,"play",()=>{a=!0,s.config.maxBufferLength=o,s.config.maxBufferSize=l,u()},{once:!0}),d(i),d};function ix(i,e){var t;if(!("videoTracks"in i))return;let s=new WeakMap;e.on(pe.Events.MANIFEST_PARSED,function(l,d){o();let u=i.addVideoTrack("main");u.selected=!0;for(let[c,h]of d.levels.entries()){let f=u.addRendition(h.url[0],h.width,h.height,h.videoCodec,h.bitrate);s.set(h,`${c}`),f.id=`${c}`}}),e.on(pe.Events.AUDIO_TRACKS_UPDATED,function(l,d){a();for(let u of d.audioTracks){let c=u.default?"main":"alternative",h=i.addAudioTrack(c,u.name,u.lang);h.id=`${u.id}`,u.default&&(h.enabled=!0)}}),i.audioTracks.addEventListener("change",()=>{var l;let d=+((l=[...i.audioTracks].find(c=>c.enabled))==null?void 0:l.id),u=e.audioTracks.map(c=>c.id);d!=e.audioTrack&&u.includes(d)&&(e.audioTrack=d)}),e.on(pe.Events.LEVELS_UPDATED,function(l,d){var u;let c=i.videoTracks[(u=i.videoTracks.selectedIndex)!=null?u:0];if(!c)return;let h=d.levels.map(f=>s.get(f));for(let f of i.videoRenditions)f.id&&!h.includes(f.id)&&c.removeRendition(f)});let r=l=>{let d=l.target.selectedIndex;d!=e.nextLevel&&(e.nextLevel=d)};(t=i.videoRenditions)==null||t.addEventListener("change",r);let n=()=>{for(let l of i.videoTracks)i.removeVideoTrack(l)},a=()=>{for(let l of i.audioTracks)i.removeAudioTrack(l)},o=()=>{n(),a()};e.once(pe.Events.DESTROYING,o)}var qu=i=>"time"in i?i.time:i.startTime;function sx(i,e){e.on(pe.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(r,{tracks:n})=>{n.forEach(a=>{var o,l;let d=(o=a.subtitleTrack)!=null?o:a.closedCaptions,u=e.subtitleTracks.findIndex(({lang:h,name:f,type:m})=>h==d?.lang&&f===a.label&&m.toLowerCase()===a.kind),c=((l=a._id)!=null?l:a.default)?"default":`${a.kind}${u}`;_f(i,a.kind,a.label,d?.lang,c,a.default)})});let t=()=>{if(!e.subtitleTracks.length)return;let r=Array.from(i.textTracks).find(o=>o.id&&o.mode==="showing"&&["subtitles","captions"].includes(o.kind));if(!r)return;let n=e.subtitleTracks[e.subtitleTrack],a=n?n.default?"default":`${e.subtitleTracks[e.subtitleTrack].type.toLowerCase()}${e.subtitleTrack}`:void 0;if(e.subtitleTrack<0||r?.id!==a){let o=e.subtitleTracks.findIndex(({lang:l,name:d,type:u,default:c})=>r.id==="default"&&c||l==r.language&&d===r.label&&u.toLowerCase()===r.kind);e.subtitleTrack=o}r?.id===a&&r.cues&&Array.from(r.cues).forEach(o=>{r.addCue(o)})};i.textTracks.addEventListener("change",t),e.on(pe.Events.CUES_PARSED,(r,{track:n,cues:a})=>{let o=i.textTracks.getTrackById(n);if(!o)return;let l=o.mode==="disabled";l&&(o.mode="hidden"),a.forEach(d=>{var u;(u=o.cues)!=null&&u.getCueById(d.id)||o.addCue(d)}),l&&(o.mode="disabled")}),e.once(pe.Events.DESTROYING,()=>{i.textTracks.removeEventListener("change",t),i.querySelectorAll("track[data-removeondestroy]").forEach(r=>{r.remove()})});let s=()=>{Array.from(i.textTracks).forEach(r=>{var n,a;if(!["subtitles","caption"].includes(r.kind)&&(r.label==="thumbnails"||r.kind==="chapters")){if(!((n=r.cues)!=null&&n.length)){let o="track";r.kind&&(o+=`[kind="${r.kind}"]`),r.label&&(o+=`[label="${r.label}"]`);let l=i.querySelector(o),d=(a=l?.getAttribute("src"))!=null?a:"";l?.removeAttribute("src"),setTimeout(()=>{l?.setAttribute("src",d)},0)}r.mode!=="hidden"&&(r.mode="hidden")}})};e.once(pe.Events.MANIFEST_LOADED,s),e.once(pe.Events.MEDIA_ATTACHED,s)}function _f(i,e,t,s,r,n){let a=document.createElement("track");return a.kind=e,a.label=t,s&&(a.srclang=s),r&&(a.id=r),n&&(a.default=!0),a.track.mode=["subtitles","captions"].includes(e)?"disabled":"hidden",a.setAttribute("data-removeondestroy",""),i.append(a),a.track}function rx(i,e){let t=Array.prototype.find.call(i.querySelectorAll("track"),s=>s.track===e);t?.remove()}function so(i,e,t){var s;return(s=Array.from(i.querySelectorAll("track")).find(r=>r.track.label===e&&r.track.kind===t))==null?void 0:s.track}async function UE(i,e,t,s){let r=so(i,t,s);return r||(r=_f(i,s,t),r.mode="hidden",await new Promise(n=>setTimeout(()=>n(void 0),0))),r.mode!=="hidden"&&(r.mode="hidden"),[...e].sort((n,a)=>qu(a)-qu(n)).forEach(n=>{var a,o;let l=n.value,d=qu(n);if("endTime"in n&&n.endTime!=null)r?.addCue(new VTTCue(d,n.endTime,s==="chapters"?l:JSON.stringify(l??null)));else{let u=Array.prototype.findIndex.call(r?.cues,m=>m.startTime>=d),c=(a=r?.cues)==null?void 0:a[u],h=c?c.startTime:Number.isFinite(i.duration)?i.duration:Number.MAX_SAFE_INTEGER,f=(o=r?.cues)==null?void 0:o[u-1];f&&(f.endTime=d),r?.addCue(new VTTCue(d,h,s==="chapters"?l:JSON.stringify(l??null)))}}),i.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),r}var Af="cuepoints",$E=Object.freeze({label:Af});async function FE(i,e,t=$E){return UE(i,e,t.label,"metadata")}var Nc=i=>({time:i.startTime,value:JSON.parse(i.text)});function nx(i,e={label:Af}){let t=so(i,e.label,"metadata");return t!=null&&t.cues?Array.from(t.cues,s=>Nc(s)):[]}function BE(i,e={label:Af}){var t,s;let r=so(i,e.label,"metadata");if(!((t=r?.activeCues)!=null&&t.length))return;if(r.activeCues.length===1)return Nc(r.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((s=r.activeCues)!=null?s:[],({startTime:o,endTime:l})=>o<=n&&l>n);return Nc(a||r.activeCues[0])}async function ax(i,e=$E){return new Promise(t=>{Ze(i,"loadstart",async()=>{let s=await FE(i,[],e);Ze(i,"cuechange",()=>{let r=BE(i);if(r){let n=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:r});i.dispatchEvent(n)}},{},s),t(s)})})}var Sf="chapters",HE=Object.freeze({label:Sf}),Uc=i=>({startTime:i.startTime,endTime:i.endTime,value:i.text});async function GE(i,e,t=HE){return UE(i,e,t.label,"chapters")}function ox(i,e={label:Sf}){var t;let s=so(i,e.label,"chapters");return(t=s?.cues)!=null&&t.length?Array.from(s.cues,r=>Uc(r)):[]}function KE(i,e={label:Sf}){var t,s;let r=so(i,e.label,"chapters");if(!((t=r?.activeCues)!=null&&t.length))return;if(r.activeCues.length===1)return Uc(r.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((s=r.activeCues)!=null?s:[],({startTime:o,endTime:l})=>o<=n&&l>n);return Uc(a||r.activeCues[0])}async function lx(i,e=HE){return new Promise(t=>{Ze(i,"loadstart",async()=>{let s=await GE(i,[],e);Ze(i,"cuechange",()=>{let r=KE(i);if(r){let n=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:r});i.dispatchEvent(n)}},{},s),t(s)})})}function dx(i,e){if(e){let t=e.playingDate;if(t!=null)return new Date(t.getTime()-i.currentTime*1e3)}return typeof i.getStartDate=="function"?i.getStartDate():new Date(NaN)}function ux(i,e){if(e&&e.playingDate)return e.playingDate;if(typeof i.getStartDate=="function"){let t=i.getStartDate();return new Date(t.getTime()+i.currentTime*1e3)}return new Date(NaN)}var Aa={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},cx=i=>{if(i===Me.VIDEO)return Aa.VIDEO;if(i===Me.DRM)return Aa.DRM},hx=(i,e)=>{var t,s;let r=Qd(i),n=`${r}Token`;return(t=e.tokens)!=null&&t[r]?(s=e.tokens)==null?void 0:s[r]:bf(n,e)?e[n]:void 0},Td=(i,e,t,s,r=!1,n=!(a=>(a=globalThis.navigator)==null?void 0:a.onLine)())=>{var a,o;if(n){let E=te("Your device appears to be offline",r),b,y=z.MEDIA_ERR_NETWORK,T=new z(E,y,!1,b);return T.errorCategory=e,T.muxCode=se.NETWORK_OFFLINE,T.data=i,T}let l="status"in i?i.status:i.code,d=Date.now(),u=z.MEDIA_ERR_NETWORK;if(l===200)return;let c=Qd(e),h=hx(e,t),f=cx(e),[m]=Tf((a=t.playbackId)!=null?a:"");if(!l||!m)return;let g=mn(h);if(h&&!g){let E=te("The {tokenNamePrefix}
55-token provided is invalid or malformed.",r).format({tokenNamePrefix:c}),b=te("Compact JWT string: {token}",r).format({token:h}),y=new z(E,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_MALFORMED,y.data=i,y}if(l>=500){let E=new z("",u,s??!0);return E.errorCategory=e,E.muxCode=se.NETWORK_UNKNOWN_ERROR,E}if(l===403)if(g){if(jR(g,d)){let E={timeStyle:"medium",dateStyle:"medium"},b=te("The video’s secured {tokenNamePrefix}-token has expired.",r).format({tokenNamePrefix:c}),y=te("Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat("en",E).format((o=g.exp)!=null?o:0*1e3),currentDate:new Intl.DateTimeFormat("en",E).format(d)}),T=new z(b,u,!0,y);return T.errorCategory=e,T.muxCode=se.NETWORK_TOKEN_EXPIRED,T.data=i,T}if(zR(g,m)){let E=te("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",r).format({tokenNamePrefix:c}),b=te("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",r).format({tokenNamePrefix:c,playbackId:m,tokenPlaybackId:g.sub}),y=new z(E,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_SUB_MISMATCH,y.data=i,y}if(QR(g)){let E=te("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:c}),b=te("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",r).format({tokenNamePrefix:c,expectedAud:f}),y=new z(E,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_AUD_MISSING,y.data=i,y}if(XR(g,f)){let E=te("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:c}),b=te("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",r).format({tokenNamePrefix:c,expectedAud:f,aud:g.aud}),y=new z(E,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_AUD_MISMATCH,y.data=i,y}}else{let E=te("Authorization error trying to access this {category} URL. If this is a signed URL, you might need to provide a {tokenNamePrefix}-token.",r).format({tokenNamePrefix:c,category:e}),b=te("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new z(E,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_MISSING,y.data=i,y}if(l===412){let E=te("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),b=te("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new z(E,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_NOT_READY,y.streamType=t.streamType===Ae.LIVE?"live":t.streamType===Ae.ON_DEMAND?"on-demand":"unknown",y.data=i,y}if(l===404){let E=te("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),b=te("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new z(E,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_NOT_FOUND,y.data=i,y}if(l===400){let E=te("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),b=te("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new z(E,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_INVALID_URL,y.data=i,y}let p=new z("",u,s??!0);return p.errorCategory=e,p.muxCode=se.NETWORK_UNKNOWN_ERROR,p.data=i,p},dg=pe.DefaultConfig.capLevelController,VE=class WE extends dg{constructor(e){super(e)}get levels(){var e;return(e=this.hls.levels)!=null?e:[]}getValidLevels(e){return this.levels.filter((t,s)=>this.isLevelAllowed(t)&&s<=e)}getMaxLevel(e){let t=super.getMaxLevel(e),s=this.getValidLevels(e);if(!s[t])return t;let r=Math.min(s[t].width,s[t].height),n=WE.minMaxResolution;return r>=n?t:dg.getMaxLevelByMediaSize(s,n*(16/9),n)}};VE.minMaxResolution=720;var fx=VE,mx=fx,Zo={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},px=i=>{if(i.includes("fps"))return Zo.FAIRPLAY;if(i.includes("playready"))return Zo.PLAYREADY;if(i.includes("widevine"))return Zo.WIDEVINE},gx=i=>{let e=i.split(` 56`).find((t,s,r)=>s&&r[s-1].startsWith("#EXT-X-STREAM-INF"));return fetch(e).then(t=>t.status!==200?Promise.reject(t):t.text())},vx=i=>{let e=i.split(` 57`).filter(s=>s.startsWith("#EXT-X-SESSION-DATA"));if(!e.length)return{};let t={};for(let s of e){let r=yx(s),n=r["DATA-ID"];n&&(t[n]={...r})}return{sessionData:t}},Ex=/([A-Z0-9-]+)="?(.*?)"?(?:,|$)/g;function yx(i){let e=[...i.matchAll(Ex)];return Object.fromEntries(e.map(([,t,s])=>[t,s]))}var bx=i=>{var e,t,s;let r=i.split(` 58`),n=(t=((e=r.find(d=>d.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?e:"").split(":")[1])==null?void 0:t.trim(),a=PE(n),o=OE(n),l;if(a===Ae.LIVE){let d=r.find(u=>u.startsWith("#EXT-X-PART-INF"));if(d)l=+d.split(":")[1].split("=")[1]*2;else{let u=r.find(h=>h.startsWith("#EXT-X-TARGETDURATION")),c=(s=u?.split(":"))==null?void 0:s[1];l=+(c??6)*3}}return{streamType:a,targetLiveWindow:o,liveEdgeStartOffset:l}},Tx=async(i,e)=>{if(e===ls.MP4)return{streamType:Ae.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0,sessionData:void 0};if(e===ls.M3U8){let t=await fetch(i);if(!t.ok)return Promise.reject(t);let s=await t.text(),r=await gx(s);return{...vx(s),...bx(r)}}return console.error(`Media type ${e} is an unrecognized or unsupported type for src ${i}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0,sessionData:void 0}},_x=async(i,e,t=Xd({src:i}))=>{var s,r,n,a;let{streamType:o,targetLiveWindow:l,liveEdgeStartOffset:d,sessionData:u}=await Tx(i,t),c=u?.["com.apple.hls.chapters"];(c!=null&&c.URI||c!=null&&c.VALUE.toLocaleLowerCase().startsWith("http"))&&If((s=c.URI)!=null?s:c.VALUE,e),((r=Ve.get(e))!=null?r:{}).liveEdgeStartOffset=d,((n=Ve.get(e))!=null?n:{}).targetLiveWindow=l,e.dispatchEvent(new CustomEvent("targetlivewindowch
58ange",{composed:!0,bubbles:!0})),((a=Ve.get(e))!=null?a:{}).streamType=o,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},If=async(i,e)=>{var t,s;try{let r=await fetch(i);if(!r.ok)throw new Error(`Failed to fetch Mux metadata: ${r.status} ${r.statusText}`);let n=await r.json(),a={};if(!((t=n?.[0])!=null&&t.metadata))return;for(let l of n[0].metadata)l.key&&l.value&&(a[l.key]=l.value);((s=Ve.get(e))!=null?s:{}).metadata=a;let o=new CustomEvent("muxmetadata");e.dispatchEvent(o)}catch(r){console.error(r)}},Ax=i=>{var e;let t=i.type,s=PE(t),r=OE(t),n,a=!!((e=i.partList)!=null&&e.length);return s===Ae.LIVE&&(n=a?i.partTarget*2:i.targetduration*3),{streamType:s,targetLiveWindow:r,liveEdgeStartOffset:n,lowLatency:a}},Sx=(i,e,t)=>{var s,r,n,a,o,l,d,u;let{streamType:c,targetLiveWindow:h,liveEdgeStartOffset:f,lowLatency:m}=Ax(i);if(c===Ae.LIVE){m?(t.config.backBufferLength=(s=t.userConfig.backBufferLength)!=null?s:4,t.config.maxFragLookUpTolerance=(r=t.userConfig.maxFragLookUpTolerance)!=null?r:.001,t.config.abrBandWidthUpFactor=(n=t.userConfig.abrBandWidthUpFactor)!=null?n:t.config.abrBandWidthFactor):t.config.backBufferLength=(a=t.userConfig.backBufferLength)!=null?a:8;let g=Object.freeze({get length(){return e.seekable.length},start(p){return e.seekable.start(p)},end(p){var E;return p>this.length||p<0||Number.isFinite(e.duration)?e.seekable.end(p):(E=t.liveSyncPosition)!=null?E:e.seekable.end(p)}});((o=Ve.get(e))!=null?o:{}).seekable=g}((l=Ve.get(e))!=null?l:{}).liveEdgeStartOffset=f,((d=Ve.get(e))!=null?d:{}).targetLiveWindow=h,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((u=Ve.get(e))!=null?u:{}).streamType=c,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},ug,cg,Ix=(cg=(ug=globalThis?.navigator)==null?void 0:ug.userAgent)!=null?cg:"",hg,fg,mg,Lx=(mg=(fg=(hg=globalThis?.navigator)==null?void 0:hg.userAgentData)==null?void 0:fg.platform)!=null?mg:"",pg,gg,vg,Rx=(vg=(gg=(pg=globalThis?.navigator)==null?void 0:pg.userAgentData)==null?void 0:gg.brands)!=null?vg:[],xx=Ix.toLowerCase().includes("android")||["x11","android"].some(i=>Lx.toLowerCase().includes(i)),Eg=Rx.find(i=>i.brand==="Google Chrome"),kx=i=>{var e;return Eg&&parseInt((e=Eg.version)!=null?e:"0")>=141&&!!i.canPlayType("application/vnd.apple.mpegurl")},Ve=new WeakMap,ds="mux.com",yg,bg,YE=(bg=(yg=pe).isSupported)==null?void 0:bg.call(yg),Dx=i=>xx||kx(i),Lf=()=>jh.utils.now(),Cx=jh.utils.generateUUID,$c=({playbackId:i,customDomain:e=ds,maxResolution:t,minResolution:s,renditionOrder:r,programStartTime:n,programEndTime:a,assetStartTime:o,assetEndTime:l,playbackToken:d,tokens:{playback:u=d}={},extraSourceParams:c={}}={})=>{if(!i)return;let[h,f=""]=Tf(i),m=new URL(`https://stream.${e}/${h}.m3u8${f}`);return u||m.searchParams.has("token")?(m.searchParams.forEach((g,p)=>{p!="token"&&m.searchParams.delete(p)}),u&&m.searchParams.set("token",u)):(t&&m.searchParams.set("max_resolution",t),s&&(m.searchParams.set("min_resolution",s),t&&+t.slice(0,-1)<+s.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",s,"maxResolution",t)),r&&m.searchParams.set("rendition_order",r),n&&m.searchParams.set("program_start_time",`${n}`),a&&m.searchParams.set("program_end_time",`${a}`),o&&m.searchParams.set("asset_start_time",`${o}`),l&&m.searchParams.set("asset_end_time",`${l}`),Object.entries(c).forEach(([g,p])=>{p!=null&&m.searchParams.set(g,p)})),m.toString()},Zd=i=>{if(!i)return;let[e]=i.split("?");return e||void 0},Rf=i=>{if(!i||!i.startsWith("https://stream."))return;let[e]=new URL(i).pathname.slice(1).split(/\.m3u8|\//);return e||void 0},wx=i=>{var e,t,s;return(e=i?.metadata)!=null&&e.video_id?i.metadata.video_id:ey(i)&&(s=(t=Zd(i.playbackId))!=null?t:Rf(i.src))!=null?s:i.src},qE=i=>{var e;return(e=Ve.get(i))==null?void 0:e.error},Mx=i=>{var e;return(e=Ve.get(i))==null?void 0:e.metadata},Fc=i=>{var e,t;return(t=(e=Ve.get(i))==null?void 0:e.streamType)!=null?t:Ae.UNKNOWN},Px=i=>{var e,t;return(t=(e=Ve.get(i))==null?void 0:e.targetLiveWindow)!=null?t:Number.NaN},xf=i=>{var e,t;return(t=(e=Ve.get(i))==null?void 0:e.seekable)!=null?t:i.seekable},Ox=i=>{var e;let t=(e=Ve.get(i))==null?void 0:e.liveEdgeStartOffset;if(typeof t!="number")return Number.NaN;let s=xf(i);return s.length?s.end(s.length-1)-t:Number.NaN},kf=.034,Nx=(i,e,t=kf)=>Math.abs(i-e)<=t,jE=(i,e,t=kf)=>i>e||Nx(i,e,t),Ux=(i,e=kf)=>i.paused&&jE(i.currentTime,i.duration,e),zE=(i,e)=>{var t,s,r;if(!e||!i.buffered.length)return;if(i.readyState>2)return!1;let n=e.currentLevel>=0?(s=(t=e.levels)==null?void 0:t[e.currentLevel])==null?void 0:s.details:(r=e.levels.find(c=>!!c.details))==null?void 0:r.details;if(!n||n.live)return;let{fragments:a}=n;if(!(a!=null&&a.length))return;if(i.currentTime<i.duration-(n.targetduration+.5))return!1;let o=a[a.length-1];if(i.currentTime<=o.start)return!1;let l=o.start+o.duration/2,d=i.buffered.start(i.buffered.length-1),u=i.buffered.end(i.buffered.length-1);return l>d&&l<u},QE=(i,e)=>i.ended||i.loop?i.ended:e&&zE(i,e)?!0:Ux(i),$x=(i,e,t)=>{XE(e,t,i);let{metadata:s={}}=i,{view_session_id:r=Cx()}=s,n=wx(i);s.view_session_id=r,s.video_id=n,i.metadata=s;let a=u=>{var c;(c=e.mux)==null||c.emit("hb",{view_drm_type:u})};i.drmTypeCb=a,Ve.set(e,{retryCount:0});let o=Fx(i,e),l=tx(i,e,o);i!=null&&i.muxDataKeepSession&&e!=null&&e.mux&&!e.mux.deleted?o&&e.mux.addHLSJS({hlsjs:o,Hls:o?pe:void 0}):Wx(i,e,o),Yx(i,e,o),ax(e),lx(e);let d=ex(i,e,o);return{engine:o,setAutoplay:d,setPreload:l}},XE=(i,e,t)=>{let s=e?.engine;i!=null&&i.mux&&!i.mux.deleted&&(t!=null&&t.muxDataKeepSession?s&&i.mux.removeHLSJS():(i.mux.destroy(),delete i.mux)),s&&(s.detachMedia(),s.destroy()),i&&(i.hasAttribute("src")&&(i.removeAttribute("src"),i.load()),i.removeEventListener("error",iy),i.removeEventListener("error",Bc),i.removeEventListener("durationchange",ty),Ve.delete(i),i.dispatchEvent(new Event("teardown")))};function ZE(i,e){var t;let s=Xd(i);if(s!==ls.M3U8)return!0;let r=!s||((t=e.canPlayType(s))!=null?t:!0),{preferPlayback:n}=i,a=n===Hi.MSE,o=n===Hi.NATIVE,l=YE&&(a||Dx(e));return r&&(o||!l)}var Fx=(i,e)=>{let{debug:t,streamType:s,startTime:r=-1,metadata:n,preferCmcd:a,_hlsConfig:o={}}=i,l=Xd(i)===ls.M3U8,d=ZE(i,e);if(l&&!d&&YE){let u={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},c=Bx(s),h=Hx(i),f=[Zn.QUERY,Zn.HEADER].includes(a)?{useHeaders:a===Zn.HEADER,sessionId:n?.view_session_id,contentId:n?.video_id}:void 0,m=o.capLevelToPlayerSize==null?{capLevelController:mx}:{},g=new pe({debug:t,startPosition:r,cmcd:f,xhrSetup:(p,E)=>{var b,y;if(a&&a!==Zn.QUERY)return;let T=new URL(E);if(!T.searchParams.has("CMCD"))return;let A=((y=(b=T.searchParams.get("CMCD"))==null?void 0:b.split(","))!=null?y:[]).filter(L=>L.startsWith("sid")||L.startsWith("cid")).join(",");T.searchParams.set("CMCD",A),p.open("GET",T)},...m,...u,...c,...h,...o});return g.on(pe.Events.MANIFEST_PARSED,async function(p,E){var b,y;let T=(b=E.sessionData)==null?void 0:b["com.apple.hls.chapters"];(T!=null&&T.URI||T!=null&&T.VALUE.toLocaleLowerCase().startsWith("http"))&&If((y=T?.URI)!=null?y:T?.VALUE,e)}),g}},Bx=i=>i===Ae.LIVE?{backBufferLength:8}:{},Hx=i=>{let{tokens:{drm:e}={},playbackId:t,drmTypeCb:s}=i,r=Zd(t);return!e||!r?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:Jo(i,"fairplay"),serverCertificateUrl:JE(i,"fairplay")},"com.widevine.alpha":{licenseUrl:Jo(i,"widevine")},"com.microsoft.playready":{licenseUrl:Jo(i,"playready")}},requestMediaKeySystemAccessFunc:(n,a)=>(n==="com.widevine.alpha"&&(a=[...a.map(o=>{var l;let d=(l=o.videoCapabilities)==null?void 0:l.map(u=>({...u,robustness:"HW_SECURE_ALL"}));return{...o,videoCapabilities:d}}),...a]),navigator.requestMediaKeySystemAccess(n,a).then(o=>{let l=px(n);return s?.(l),o}))}},Gx=async i=>{let e=await fetch(i);return e.status!==200?Promise.reject(e):await e.arrayBuffer()},Kx=async(i,e)=>{let t=await fetch(e,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:i});if(t.status!==200)return Promise.reject(t);let s=await t.arrayBuffer();return new Uint8Array(s)},Vx=(i,e)=>{Ze(e,"encrypted",async t=>{try{let s=t.initDataType;if(s!=="skd"){console.error(`Received unexpected initialization data type "${s}"`);return}if(!e.mediaKeys){let l=await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[s],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(u=>{var c;return(c=i.drmTypeCb)==null||c.call(i,Zo.FAIRPLAY),u}).catch(()=>{let u=te("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),c=new z(u,z.MEDIA_ERR_ENCRYPTED,!0);
58c.errorCategory=Me.DRM,c.muxCode=se.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,Xt(e,c)});if(!l)return;let d=await l.createMediaKeys();try{let u=await Gx(JE(i,"fairplay")).catch(c=>{if(c instanceof Response){let h=Td(c,Me.DRM,i);return console.error("mediaError",h?.message,h?.context),h?Promise.reject(h):Promise.reject(new Error("Unexpected error in app cert request"))}return Promise.reject(c)});await d.setServerCertificate(u).catch(()=>{let c=te("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),h=new z(c,z.MEDIA_ERR_ENCRYPTED,!0);return h.errorCategory=Me.DRM,h.muxCode=se.ENCRYPTED_UPDATE_SERVER_CERT_FAILED,Promise.reject(h)})}catch(u){Xt(e,u);return}await e.setMediaKeys(d)}let r=t.initData;if(r==null){console.error(`Could not start encrypted playback due to missing initData in ${t.type} event`);return}let n=e.mediaKeys.createSession();n.addEventListener("keystatuseschange",()=>{n.keyStatuses.forEach(l=>{let d;if(l==="internal-error"){let u=te("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");d=new z(u,z.MEDIA_ERR_ENCRYPTED,!0),d.errorCategory=Me.DRM,d.muxCode=se.ENCRYPTED_CDM_ERROR}else if(l==="output-restricted"||l==="output-downscaled"){let u=te("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");d=new z(u,z.MEDIA_ERR_ENCRYPTED,!1),d.errorCategory=Me.DRM,d.muxCode=se.ENCRYPTED_OUTPUT_RESTRICTED}d&&Xt(e,d)})});let a=await Promise.all([n.generateRequest(s,r).catch(()=>{let l=te("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),d=new z(l,z.MEDIA_ERR_ENCRYPTED,!0);d.errorCategory=Me.DRM,d.muxCode=se.ENCRYPTED_GENERATE_REQUEST_FAILED,Xt(e,d)}),new Promise(l=>{n.addEventListener("message",d=>{l(d.message)},{once:!0})})]).then(([,l])=>l),o=await Kx(a,Jo(i,"fairplay")).catch(l=>{if(l instanceof Response){let d=Td(l,Me.DRM,i);return console.error("mediaError",d?.message,d?.context),d?Promise.reject(d):Promise.reject(new Error("Unexpected error in license key request"))}return Promise.reject(l)});await n.update(o).catch(()=>{let l=te("Failed to update DRM license. This may be an issue with the player or your protected content."),d=new z(l,z.MEDIA_ERR_ENCRYPTED,!0);return d.errorCategory=Me.DRM,d.muxCode=se.ENCRYPTED_UPDATE_LICENSE_FAILED,Promise.reject(d)})}catch(s){Xt(e,s);return}})},Jo=({playbackId:i,tokens:{drm:e}={},customDomain:t=ds},s)=>{let r=Zd(i);return`https://license.${t.toLocaleLowerCase().endsWith(ds)?t:ds}/license/${s}/${r}?token=${e}`},JE=({playbackId:i,tokens:{drm:e}={},customDomain:t=ds},s)=>{let r=Zd(i);return`https://license.${t.toLocaleLowerCase().endsWith(ds)?t:ds}/appcert/${s}/${r}?token=${e}`},ey=({playbackId:i,src:e,customDomain:t})=>{if(i)return!0;if(typeof e!="string")return!1;let s=window?.location.href,r=new URL(e,s).hostname.toLocaleLowerCase();return r.includes(ds)||!!t&&r.includes(t.toLocaleLowerCase())},Wx=(i,e,t)=>{var s;let{envKey:r,disableTracking:n,muxDataSDK:a=jh,muxDataSDKOptions:o={}}=i,l=ey(i);if(!n&&(r||l)){let{playerInitTime:d,playerSoftwareName:u,playerSoftwareVersion:c,beaconCollectionDomain:h,debug:f,disableCookies:m}=i,g={...i.metadata,video_title:((s=i?.metadata)==null?void 0:s.video_title)||void 0},p=E=>typeof E.player_error_code=="string"?!1:typeof i.errorTranslator=="function"?i.errorTranslator(E):E;a.monitor(e,{debug:f,beaconCollectionDomain:h,hlsjs:t,Hls:t?pe:void 0,automaticErrorTracking:!1,errorTranslator:p,disableCookies:m,...o,data:{...r?{env_key:r}:{},player_software_name:u,player_software:u,player_software_version:c,player_init_time:d,...g}})}},Yx=(i,e,t)=>{var s,r;let n=ZE(i,e),{src:a,customDomain:o=ds}=i,l=()=>{e.ended||i.disablePseudoEnded||!QE(e,t)||(zE(e,t)?e.currentTime=e.buffered.end(e.buffered.length-1):e.dispatchEvent(new Event("ended")))},d,u,c=()=>{let h=xf(e),f,m;h.length>0&&(f=h.start(0),m=h.end(0)),(u!==m||d!==f)&&e.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),d=f,u=m};if(Ze(e,"durationchange",c),e&&n){let h=Xd(i);
vendor: 8,361 bytes, lines 58-68
58if(typeof a=="string"){if(a.endsWith(".mp4")&&a.includes(o)){let g=Rf(a),p=new URL(`https://stream.${o}/${g}/metadata.json`);If(p.toString(),e)}let f=()=>{if(Fc(e)!==Ae.LIVE||Number.isFinite(e.duration))return;let g=setInterval(c,1e3);e.addEventListener("teardown",()=>{clearInterval(g)},{once:!0}),Ze(e,"durationchange",()=>{Number.isFinite(e.duration)&&clearInterval(g)})},m=async()=>_x(a,e,h).then(f).catch(g=>{if(g instanceof Response){let p=Td(g,Me.VIDEO,i);if(p){Xt(e,p);return}}});if(e.preload==="none"){let g=()=>{m(),e.removeEventListener("loadedmetadata",p)},p=()=>{m(),e.removeEventListener("play",g)};Ze(e,"play",g,{once:!0}),Ze(e,"loadedmetadata",p,{once:!0})}else m();(s=i.tokens)!=null&&s.drm?Vx(i,e):Ze(e,"encrypted",()=>{let g=te("Attempting to play DRM-protected content without providing a DRM token."),p=new z(g,z.MEDIA_ERR_ENCRYPTED,!0);p.errorCategory=Me.DRM,p.muxCode=se.ENCRYPTED_MISSING_TOKEN,Xt(e,p)},{once:!0}),e.setAttribute("src",a),i.startTime&&(((r=Ve.get(e))!=null?r:{}).startTime=i.startTime,e.addEventListener("durationchange",ty,{once:!0}))}else e.removeAttribute("src");e.addEventListener("error",iy),e.addEventListener("error",Bc),e.addEventListener("emptied",()=>{e.querySelectorAll("track[data-removeondestroy]").forEach(f=>{f.remove()})},{once:!0}),Ze(e,"pause",l),Ze(e,"seeked",l),Ze(e,"play",()=>{e.ended||jE(e.currentTime,e.duration)&&(e.currentTime=e.seekable.length?e.seekable.start(0):0)})}else t&&a?(t.once(pe.Events.LEVEL_LOADED,(h,f)=>{Sx(f.details,e,t),c(),Fc(e)===Ae.LIVE&&!Number.isFinite(e.duration)&&(t.on(pe.Events.LEVEL_UPDATED,c),Ze(e,"durationchange",()=>{Number.isFinite(e.duration)&&t.off(pe.Events.LEVELS_UPDATED,c)}))}),t.on(pe.Events.ERROR,(h,f)=>{var m,g;let p=qx(f,i);if(p.muxCode===se.NETWORK_NOT_READY){let E=(m=Ve.get(e))!=null?m:{},b=(g=E.retryCount)!=null?g:0;if(b<6){let y=b===0?5e3:6e4,T=new z(`Retrying in ${y/1e3} seconds...`,p.code,p.fatal);Object.assign(T,p),Xt(e,T),setTimeout(()=>{E.retryCount=b+1,f.details==="manifestLoadError"&&f.url&&t.loadSource(f.url)},y);return}else{E.retryCount=0;let y=new z('Try again later or <a href="#" onclick="window.location.reload(); return false;" style="color: #4a90e2;">click here to retry</a>',p.code,p.fatal);Object.assign(y,p),Xt(e,y);return}}Xt(e,p)}),t.on(pe.Events.MANIFEST_LOADED,()=>{let h=Ve.get(e);h&&h.error&&(h.error=null,h.retryCount=0,e.dispatchEvent(new Event("emptied")),e.dispatchEvent(new Event("loadstart")))}),e.addEventListener("error",Bc),Ze(e,"waiting",l),ix(i,t),sx(e,t),t.attachMedia(e)):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.")};function ty(i){var e;let t=i.target,s=(e=Ve.get(t))==null?void 0:e.startTime;if(s&&VR(t.seekable,t.duration,s)){let r=t.preload==="auto";r&&(t.preload="none"),t.currentTime=s,r&&(t.preload="auto")}}async function iy(i){if(!i.isTrusted)return;i.stopImmediatePropagation();let e=i.target;if(!(e!=null&&e.error))return;let{message:t,code:s}=e.error,r=new z(t,s);if(e.src&&s===z.MEDIA_ERR_SRC_NOT_SUPPORTED&&e.readyState===HTMLMediaElement.HAVE_NOTHING){setTimeout(()=>{var n;let a=(n=qE(e))!=null?n:e.error;a?.code===z.MEDIA_ERR_SRC_NOT_SUPPORTED&&Xt(e,r)},500);return}if(e.src&&(s!==z.MEDIA_ERR_DECODE||s!==void 0))try{let{status:n}=await fetch(e.src);r.data={response:{code:n}}}catch{}Xt(e,r)}function Xt(i,e){var t;e.fatal&&(((t=Ve.get(i))!=null?t:{}).error=e,i.dispatchEvent(new CustomEvent("error",{detail:e})))}function Bc(i){var e,t;if(!(i instanceof CustomEvent)||!(i.detail instanceof z))return;let s=i.target,r=i.detail;!r||!r.fatal||(((e=Ve.get(s))!=null?e:{}).error=r,(t=s.mux)==null||t.emit("error",{player_error_code:r.code,player_error_message:r.message,player_error_context:r.context}))}var qx=(i,e)=>{var t,s,r;console.error("getErrorFromHlsErrorData()",i);let n={[pe.ErrorTypes.NETWORK_ERROR]:z.MEDIA_ERR_NETWORK,[pe.ErrorTypes.MEDIA_ERROR]:z.MEDIA_ERR_DECODE,[pe.ErrorTypes.KEY_SYSTEM_ERROR]:z.MEDIA_ERR_ENCRYPTED},a=u=>[pe.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,pe.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(u.details)?z.MEDIA_ERR_NETWORK:n[u.type],o=u=>{if(u.type===pe.ErrorTypes.KEY_SYSTEM_ERROR)return Me.DRM;if(u.type===pe.ErrorTypes.NETWORK_ERROR)return Me.VIDEO},l,d=a(i);if(d===z.MEDIA_ERR_NETWORK&&i.response){let u=(t=o(i))!=null?t:Me.VIDEO;l=(s=Td(i.response,u,e,i.fatal))!=null?s:new z("",d,i.fatal)}else if(d===z.MEDIA_ERR_ENCRYPTED)if(i.details===pe.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE){let u=te("Attempting to play DRM-protected content without providing a DRM token.");l=new z(u,z.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Me.DRM,l.muxCode=se.ENCRYPTED_MISSING_TOKEN}else if(i.details===pe.ErrorDetails.KEY_SYSTEM_NO_ACCESS){let u=te("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.");l=new z(u,z.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Me.DRM,l.muxCode=se.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM}else if(i.details===pe.ErrorDetails.KEY_SYSTEM_NO_SESSION){let u=te("Failed to generate a DRM license request. This may be an issue with the player or your protected content.");l=new z(u,z.MEDIA_ERR_ENCRYPTED,!0),l.errorCategory=Me.DRM,l.muxCode=se.ENCRYPTED_GENERATE_REQUEST_FAILED}else if(i.details===pe.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED){let u=te("Failed to update DRM license. This may be an issue with the player or your protected content.");l=new z(u,z.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Me.DRM,l.muxCode=se.ENCRYPTED_UPDATE_LICENSE_FAILED}else if(i.details===pe.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED){let u=te("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate.");l=new z(u,z.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Me.DRM,l.muxCode=se.ENCRYPTED_UPDATE_SERVER_CERT_FAILED}else if(i.details===pe.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR){let u=te("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");l=new z(u,z.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Me.DRM,l.muxCode=se.ENCRYPTED_CDM_ERROR}else if(i.details===pe.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED){let u=te("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");l=new z(u,z.MEDIA_ERR_ENCRYPTED,!1),l.errorCategory=Me.DRM,l.muxCode=se.ENCRYPTED_OUTPUT_RESTRICTED}else l=new z(i.error.message,z.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Me.DRM,l.muxCode=se.ENCRYPTED_ERROR;else l=new z("",d,i.fatal);return l.context||(l.context=`${i.url?`url: ${i.url} 59`:""}${i.response&&(i.response.code||i.response.text)?`response: ${i.response.code}, ${i.response.text} 60`:""}${i.reason?`failure reason: ${i.reason} 61`:""}${i.level?`level: ${i.level} 62`:""}${i.parent?`parent stream controller: ${i.parent} 63`:""}${i.buffer?`buffer length: ${i.buffer} 64`:""}${i.error?`error: ${i.error} 65`:""}${i.event?`event: ${i.event} 66`:""}${i.err?`error message: ${(r=i.err)==null?void 0:r.message} 67`:""}`),l.data=i,l},sy=i=>{throw TypeError(i)},Df=(i,e,t)=>e.has(i)||sy("Cannot "+t),mt=(i,e,t)=>(Df(i,e,"read from private field"),t?t.call(i):e.get(i)),ni=(i,e,t)=>e.has(i)?sy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),jt=(i,e,t,s)=>(Df(i,e,"write to private field"),e.set(i,t),t),ju=(i,e,t)=>(Df(i,e,"access private method"),t),jx=()=>{try{return"0.27.2"}catch{}return"UNKNOWN"},zx=jx(),Qx=()=>zx,Xx=` 68<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" part="logo" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 1600 500"><g fill="#fff"><path d="M994.287 93.486c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31m0-93.486c-34.509 0-62.484 27.976-62.484 62.486v187.511c0 68.943-56.09 125.033-125.032 125.033s-125.03-56.09-125.03-125.033V62.486C681.741 27.976 653.765 0 619.256 0s-62.484 27.976-62.484 62.486v187.511C556.772 387.85 668.921 500 806.771 500c137.851 0 250.001-112.15 250.001-250.003V62.486c0-34.51-27.976-62.486-62.485-62.486M1537.51 468.511c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.12
681-13.879 31-31 31m-275.883-218.509-143.33 143.329c-24.402 24.402-24.402 63.966 0 88.368 24.402 24.402 63.967 24.402 88.369 0l143.33-143.329 143.328 143.329c24.402 24.4 63.967 24.402 88.369 0 24.403-24.402 24.403-63.966.001-88.368l-143.33-143.329.001-.004 143.329-143.329c24.402-24.402 24.402-63.965 0-88.367s-63.967-24.402-88.369 0L1349.996 161.63 1206.667 18.302c-24.402-24.401-63.967-24.402-88.369 0s-24.402 63.965 0 88.367l143.329 143.329v.004ZM437.511 468.521c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31M461.426 4.759C438.078-4.913 411.2.432 393.33 18.303L249.999 161.632 106.669 18.303C88.798.432 61.922-4.913 38.573 4.759 15.224 14.43-.001 37.214-.001 62.488v375.026c0 34.51 27.977 62.486 62.487 62.486 34.51 0 62.486-27.976 62.486-62.486V213.341l80.843 80.844c24.404 24.402 63.965 24.402 88.369 0l80.843-80.844v224.173c0 34.51 27.976 62.486 62.486 62.486s62.486-27.976 62.486-62.486V62.488c0-25.274-15.224-48.058-38.573-57.729" style="fill-rule:nonzero"/></g></svg>`,w={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended",DRM_TOKEN:"drm-token",PLAYBACK_TOKEN:"playback-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",ASSET_START_TIME:"asset-start-time",ASSET_END_TIME:"asset-end-time",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_INIT_TIME:"player-init-time",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",LOGO:"logo"},Zx=Object.values(w),Tg=Qx(),_g="mux-video",Si,Jn,el,ea,tl,il,sl,rl,nl,ta,ia,al,Jx=class extends uo{constructor(){super(),ni(this,ia),ni(this,Si),ni(this,Jn),ni(this,el),ni(this,ea,{}),ni(this,tl,{}),ni(this,il),ni(this,sl),ni(this,rl),ni(this,nl),ni(this,ta,""),jt(this,el,Lf()),this.nativeEl.addEventListener("muxmetadata",e=>{var t;let s=Mx(this.nativeEl),r=(t=this.metadata)!=null?t:{};this.metadata={...s,...r},s?.["com.mux.video.branding"]==="mux-free-plan"&&(jt(this,ta,"default"),this.updateLogo())})}static get NAME(){return _g}static get VERSION(){return Tg}static get observedAttributes(){var e;return[...Zx,...(e=uo.observedAttributes)!=null?e:[]]}static getLogoHTML(e){return!e||e==="false"?"":e==="default"?Xx:`<img part="logo" src="${e}" />`}static getTemplateHTML(e={}){var t;return` 69 ${uo.getTemplateHTML(e)} 70 <style> 71 :host { 72 position: relative; 73 } 74 slot[name="logo"] { 75 display: flex; 76 justify-content: end; 77 position: absolute; 78 top: 1rem; 79 right: 1rem; 80 opacity: 0; 81 transition: opacity 0.25s ease-in-out; 82 z-index: 1; 83 } 84 slot[name="logo"]:has([part="logo"]) { 85 opacity: 1; 86 } 87 slot[name="logo"] [part="logo"] { 88 width: 5rem; 89 pointer-events: none; 90 user-select: none; 91 } 92 </style> 93 <slot name="logo"> 94 ${this.getLogoHTML((t=e[w.LOGO])!=null?t:"")} 95 </slot> 96 `}get preferCmcd(){var e;return(e=this.getAttribute(w.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?bd.includes(e)?this.setAttribute(w.PREFER_CMCD,e):console.warn(`Invalid value for preferCmcd. Must be one of ${bd.join()}`):this.removeAttribute(w.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(w.PLAYER_INIT_TIME)?+this.getAttribute(w.PLAYER_INIT_TIME):mt(this,el)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(w.PLAYER_INIT_TIME):this.setAttribute(w.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=mt(this,rl))!=null?e:_g}set playerSoftwareName(e){jt(this,rl,e)}get playerSoftwareVersion(){var e;return(e=mt(this,sl))!=null?e:Tg}set playerSoftwareVersion(e){jt(this,sl,e)}
vendor: 7,919 bytes, line 96
96get _hls(){var e;return(e=mt(this,Si))==null?void 0:e.engine}get mux(){var e;return(e=this.nativeEl)==null?void 0:e.mux}get error(){var e;return(e=qE(this.nativeEl))!=null?e:null}get errorTranslator(){return mt(this,nl)}set errorTranslator(e){jt(this,nl,e)}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&(e==null?this.removeAttribute("src"):this.setAttribute("src",e))}get type(){var e;return(e=this.getAttribute(w.TYPE))!=null?e:void 0}set type(e){e!==this.type&&(e?this.setAttribute(w.TYPE,e):this.removeAttribute(w.TYPE))}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 this.getAttribute(w.DEBUG)!=null}set debug(e){e!==this.debug&&(e?this.setAttribute(w.DEBUG,""):this.removeAttribute(w.DEBUG))}get disableTracking(){return this.hasAttribute(w.DISABLE_TRACKING)}set disableTracking(e){e!==this.disableTracking&&this.toggleAttribute(w.DISABLE_TRACKING,!!e)}get disableCookies(){return this.hasAttribute(w.DISABLE_COOKIES)}set disableCookies(e){e!==this.disableCookies&&(e?this.setAttribute(w.DISABLE_COOKIES,""):this.removeAttribute(w.DISABLE_COOKIES))}get disablePseudoEnded(){return this.hasAttribute(w.DISABLE_PSEUDO_ENDED)}set disablePseudoEnded(e){e!==this.disablePseudoEnded&&(e?this.setAttribute(w.DISABLE_PSEUDO_ENDED,""):this.removeAttribute(w.DISABLE_PSEUDO_ENDED))}get startTime(){let e=this.getAttribute(w.START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set startTime(e){e!==this.startTime&&(e==null?this.removeAttribute(w.START_TIME):this.setAttribute(w.START_TIME,`${e}`))}get playbackId(){var e;return this.hasAttribute(w.PLAYBACK_ID)?this.getAttribute(w.PLAYBACK_ID):(e=Rf(this.src))!=null?e:void 0}set playbackId(e){e!==this.playbackId&&(e?this.setAttribute(w.PLAYBACK_ID,e):this.removeAttribute(w.PLAYBACK_ID))}get maxResolution(){var e;return(e=this.getAttribute(w.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(w.MAX_RESOLUTION,e):this.removeAttribute(w.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(w.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(w.MIN_RESOLUTION,e):this.removeAttribute(w.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(w.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(w.RENDITION_ORDER,e):this.removeAttribute(w.RENDITION_ORDER))}get programStartTime(){let e=this.getAttribute(w.PROGRAM_START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set programStartTime(e){e==null?this.removeAttribute(w.PROGRAM_START_TIME):this.setAttribute(w.PROGRAM_START_TIME,`${e}`)}get programEndTime(){let e=this.getAttribute(w.PROGRAM_END_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set programEndTime(e){e==null?this.removeAttribute(w.PROGRAM_END_TIME):this.setAttribute(w.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){let e=this.getAttribute(w.ASSET_START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetStartTime(e){e==null?this.removeAttribute(w.ASSET_START_TIME):this.setAttribute(w.ASSET_START_TIME,`${e}`)}get assetEndTime(){let e=this.getAttribute(w.ASSET_END_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetEndTime(e){e==null?this.removeAttribute(w.ASSET_END_TIME):this.setAttribute(w.ASSET_END_TIME,`${e}`)}get customDomain(){var e;return(e=this.getAttribute(w.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(w.CUSTOM_DOMAIN,e):this.removeAttribute(w.CUSTOM_DOMAIN))}get drmToken(){var e;return(e=this.getAttribute(w.DRM_TOKEN))!=null?e:void 0}set drmToken(e){e!==this.drmToken&&(e?this.setAttribute(w.DRM_TOKEN,e):this.removeAttribute(w.DRM_TOKEN))}get playbackToken(){var e,t,s,r;if(this.hasAttribute(w.PLAYBACK_TOKEN))return(e=this.getAttribute(w.PLAYBACK_TOKEN))!=null?e:void 0;if(this.hasAttribute(w.PLAYBACK_ID)){let[,n]=Tf((t=this.playbackId)!=null?t:"");return(s=new URLSearchParams(n).get("token"))!=null?s:void 0}if(this.src)return(r=new URLSearchParams(this.src).get("token"))!=null?r:void 0}set playbackToken(e){e!==this.playbackToken&&(e?this.setAttribute(w.PLAYBACK_TOKEN,e):this.removeAttribute(w.PLAYBACK_TOKEN))}get tokens(){let e=this.getAttribute(w.PLAYBACK_TOKEN),t=this.getAttribute(w.DRM_TOKEN);return{...mt(this,tl),...e!=null?{playback:e}:{},...t!=null?{drm:t}:{}}}set tokens(e){jt(this,tl,e??{})}get ended(){return QE(this.nativeEl,this._hls)}get envKey(){var e;return(e=this.getAttribute(w.ENV_KEY))!=null?e:void 0}set envKey(e){e!==this.envKey&&(e?this.setAttribute(w.ENV_KEY,e):this.removeAttribute(w.ENV_KEY))}get beaconCollectionDomain(){var e;return(e=this.getAttribute(w.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(w.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(w.BEACON_COLLECTION_DOMAIN))}get streamType(){var e;return(e=this.getAttribute(w.STREAM_TYPE))!=null?e:Fc(this.nativeEl)}set streamType(e){e!==this.streamType&&(e?this.setAttribute(w.STREAM_TYPE,e):this.removeAttribute(w.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(w.TARGET_LIVE_WINDOW)?+this.getAttribute(w.TARGET_LIVE_WINDOW):Px(this.nativeEl)}set targetLiveWindow(e){e!=this.targetLiveWindow&&(e==null?this.removeAttribute(w.TARGET_LIVE_WINDOW):this.setAttribute(w.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e,t;if(this.hasAttribute(w.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:s}=this,r=(e=this.nativeEl.seekable.end(0))!=null?e:0,n=(t=this.nativeEl.seekable.start(0))!=null?t:0;return Math.max(n,r-s)}return Ox(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(w.LIVE_EDGE_OFFSET))return+this.getAttribute(w.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){e!=this.liveEdgeOffset&&(e==null?this.removeAttribute(w.LIVE_EDGE_OFFSET):this.setAttribute(w.LIVE_EDGE_OFFSET,`${+e}`))}get seekable(){return xf(this.nativeEl)}async addCuePoints(e){return FE(this.nativeEl,e)}get activeCuePoint(){return BE(this.nativeEl)}get cuePoints(){return nx(this.nativeEl)}async addChapters(e){return GE(this.nativeEl,e)}get activeChapter(){return KE(this.nativeEl)}get chapters(){return ox(this.nativeEl)}getStartDate(){return dx(this.nativeEl,this._hls)}get currentPdt(){return ux(this.nativeEl,this._hls)}get preferPlayback(){let e=this.getAttribute(w.PREFER_PLAYBACK);if(e===Hi.MSE||e===Hi.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===Hi.MSE||e===Hi.NATIVE?this.setAttribute(w.PREFER_PLAYBACK,e):this.removeAttribute(w.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(e=>e.startsWith("metadata-")&&![w.METADATA_URL].includes(e)).reduce((e,t)=>{let s=this.getAttribute(t);return s!=null&&(e[t.replace(/^metadata-/,"").replace(/-/g,"_")]=s),e},{}),...mt(this,ea)}}set metadata(e){jt(this,ea,e??{}),this.mux&&this.mux.emit("hb",mt(this,ea))}get _hlsConfig(){return mt(this,il)}set _hlsConfig(e){jt(this,il,e)}get logo(){var e;return(e=this.getAttribute(w.LOGO))!=null?e:mt(this,ta)}set logo(e){e?this.setAttribute(w.LOGO,e):this.removeAttribute(w.LOGO)}load(){jt(this,Si,$x(this,this.nativeEl,mt(this,Si)))}unload(){XE(this.nativeEl,mt(this,Si),this),jt(this,Si,void 0)}attributeChangedCallback(e,t,s){var r,n;switch(uo.observedAttributes.includes(e)&&!["src","autoplay","preload"].includes(e)&&super.attributeChangedCallback(e,t,s),e){case w.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=s??void 0;break;case w.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=s??void 0;break;case"src":{let a=!!t,o=!!s;!a&&o?ju(this,ia,al).call(this):a&&!o?this.unload():a&&o&&(this.unload(),ju(this,ia,al).call(this));break}
96case"autoplay":if(s===t)break;(r=mt(this,Si))==null||r.setAutoplay(this.autoplay);break;case"preload":if(s===t)break;(n=mt(this,Si))==null||n.setPreload(s);break;case w.PLAYBACK_ID:this.src=$c(this);break;case w.DEBUG:{let a=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=a);break}case w.METADATA_URL:s&&fetch(s).then(a=>a.json()).then(a=>this.metadata=a).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${s}!`));break;case w.STREAM_TYPE:(s==null||s!==t)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case w.TARGET_LIVE_WINDOW:(s==null||s!==t)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;case w.LOGO:(s==null||s!==t)&&this.updateLogo();break}}updateLogo(){if(!this.shadowRoot)return;let e=this.shadowRoot.querySelector('slot[name="logo"]');if(!e)return;let t=this.constructor.getLogoHTML(mt(this,ta)||this.logo);e.innerHTML=t}connectedCallback(){var e;(e=super.connectedCallback)==null||e.call(this),this.nativeEl&&this.src&&!mt(this,Si)&&ju(this,ia,al).call(this)}disconnectedCallback(){this.unload()}handleEvent(e){e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{composed:!0,detail:e.detail}))}};Si=new WeakMap,Jn=new WeakMap,el=new WeakMap,ea=new WeakMap,tl=new WeakMap,il=new WeakMap,sl=new WeakMap,rl=new WeakMap,nl=new WeakMap,ta=new WeakMap,ia=new WeakSet,al=async function(){mt(this,Jn)||(await jt(this,Jn,Promise.resolve()),jt(this,Jn,null),this.load())};var ry=i=>{throw TypeError(i)},ny=(i,e,t)=>e.has(i)||ry("Cannot "+t),ek=(i,e,t)=>(ny(i,e,"read from private field"),t?t.call(i):e.get(i)),tk=(i,e,t)=>e.has(i)?ry("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),ik=(i,e,t,s)=>(ny(i,e,"write to private field"),e.set(i,t),t),ay=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment>"u"){class i extends ay{}globalThis.DocumentFragment=i}var sk=class extends ay{},rk={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(sk)}},nk={customElements:rk},ak=typeof window>"u"||typeof globalThis.customElements>"u",zu=ak?nk:globalThis,ol,Ag=class extends gT(pT(Jx)){constructor(){super(...arguments),tk(this,ol)}get autoplay(){let i=this.getAttribute("autoplay");return i===null?!1:i===""?!0:i}set autoplay(i){let e=this.autoplay;i!==e&&(i?this.setAttribute("autoplay",typeof i=="string"?i:""):this.removeAttribute("autoplay"))}get muxCastCustomData(){return{mux:{playbackId:this.playbackId,minResolution:this.minResolution,maxResolution:this.maxResolution,renditionOrder:this.renditionOrder,customDomain:this.customDomain,tokens:{drm:this.drmToken},envKey:this.envKey,metadata:this.metadata,disableCookies:this.disableCookies,disableTracking:this.disableTracking,beaconCollectionDomain:this.beaconCollectionDomain,startTime:this.startTime,preferCmcd:this.preferCmcd}}}get castCustomData(){var i;return(i=ek(this,ol))!=null?i:this.muxCastCustomData}set castCustomData(i){ik(this,ol,i)}};ol=new WeakMap;zu.customElements.get("mux-video")||(zu.customElements.define("mux-video",Ag),zu.MuxVideoElement=Ag);const X={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:"mediash
96owsubtitlesrequest",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"},Te={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},oy={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_P
96LAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},ly=Object.entries(oy),_=ly.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{}),ok={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},cs=ly.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{...ok});Object.entries(cs).reduce((i,[e,t])=>{const s=_[e];return s&&(i[t]=s),i},{userinactivechange:"userinactive"});const lk=Object.entries(_).reduce((i,[e,t])=>{const s=cs[e];return s&&(i[t]=s),i},{userinactive:"userinactivechange"}),Vi={SUBTITLES:"subtitles",CAPTIONS:"captions",CHAPTERS:"chapters",METADATA:"metadata"},pn={DISABLED:"disabled",SHOWING:"showing"},Qu={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Pt={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},ns={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},dk={FULLSCREEN:"fullscreen"};function uk(i){return i?.map(hk).join(" ")}function ck(i){return i?.split(/\s+/).map(fk)}function hk(i){if(i){const{id:e,width:t,height:s}=i;return[e,t,s].filter(r=>r!=null).join(":")}}function fk(i){if(i){const[e,t,s]=i.split(":");return{id:e,width:+t,height:+s}}}function mk(i){return i?.map(gk).join(" ")}function pk(i){return i?.split(/\s+/).map(vk)}function gk(i){if(i){const{id:e,kind:t,language:s,label:r}=i;return[e,t,s,r].filter(n=>n!=null).join(":")}}function vk(i){if(i){const[e,t,s,r]=i.split(":");return{id:e,kind:t,language:s,label:r}}}function Ek(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Cf(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function dy(i){return typeof i!="string"?!1:!isNaN(i)&&!isNaN(parseFloat(i))}const uy=i=>new Promise(e=>setTimeout(e,i)),Sg=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],yk=(i,e)=>{const t=i===1?Sg[e].singular:Sg[e].plural;return`${i} ${t}`},Sa=i=>{if(!Cf(i))return"";const e=Math.abs(i),t=e!==i,s=new Date(0,0,0,0,0,e,0);return`${[s.getHours(),s.getMinutes(),s.getSeconds()].map((o,l)=>o&&yk(o,l)).filter(o=>o).join(", ")}${t?" remaining":""}`};function Ns(i,e){let t=!1;i<0&&(t=!0,i=0-i),i=i<0?0:i;let s=Math.floor(i%60),r=Math.floor(i/60%60),n=Math.floor(i/3600);const a=Math.floor(e/60%60),o=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(n=r=s="0"),n=n>0||o>0?n+":":"",r=((n||a>=10)&&r<10?"0"+r:r)+":",s=s<10?"0"+s:s,(t?"-":"")+n+r+s}const bk={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute","chapter: {chapterName}":"chapter: {chapterName}",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","S
96ource Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."};var Ig;const Xu={en:bk};let Hc=((Ig=globalThis.navigator)==null?void 0:Ig.language)||"en";const Tk=i=>{Hc=i},_k=i=>{var e,t,s;const[r]=Hc.split("-");return((e=Xu[Hc])==null?void 0:e[i])||((t=Xu[r])==null?void 0:t[i])||((s=Xu.en)==null?void 0:s[i])||i},Z=(i,e={})=>_k(i).replace(/\{(\w+)\}/g,(t,s)=>s in e?String(e[s]):`{${s}}`);class cy{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}}class hy extends cy{}let Lg=class extends hy{constructor(){super(...arguments),this.role=null}};class Ak{observe(){}unobserve(){}disconnect(){}}const fy={createElement:function(){return new Ga.HTMLElement},createElementNS:function(){return new Ga.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(i){return!1}},Ga={ResizeObserver:Ak,document:fy,Node:hy,Element:Lg,HTMLElement:class extends Lg{constructor(){super(...arguments),this.innerHTML=""}get content(){return new Ga.DocumentFragment}},DocumentFragment:class extends cy{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(i){return null},setItem(i,e){},removeItem(i){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia(i){return{matches:!1,media:i}},DOMParser:class{parseFromString(e,t){return{body:{textContent:e}}}}},my=typeof window>"u"||typeof window.customElements>"u",py=Object.keys(Ga).every(i=>i in globalThis),k=my&&!py?Ga:globalThis,ot=my&&!py?fy:globalThis.document,Rg=new WeakMap,wf=i=>{let e=Rg.get(i);return e||Rg.set(i,e=new Set),e},gy=new k.ResizeObserver(i=>{for(const e of i)for(const t of wf(e.target))t(e)});function In(i,e){wf(i).add(e),gy.observe(i)}function Ln(i,e){const t=wf(i);t.delete(e),t.size||gy.unobserve(i)}function Vt(i){const e={};for(const t of i)e[t.name]=t.value;return e}function kt(i){var e;return(e=Gc(i))!=null?e:wn(i,"media-controller")}function Gc(i){var e;const{MEDIA_CONTROLLER:t}=Te,s=i.getAttribute(t);if(s)return(e=Jd(i))==null?void 0:e.getElementById(s)}const vy=(i,e,t=".value")=>{const s=i.querySelector(t);s&&(s.textContent=e)},Sk=(i,e)=>{const t=`slot[name="${e}"]`,s=i.shadowRoot.querySelector(t);return s?s.children:[]},Ey=(i,e)=>Sk(i,e)[0],fs=(i,e)=>!i||!e?!1:i?.contains(e)?!0:fs(i,e.getRootNode().host),wn=(i,e)=>{if(!i)return null;const t=i.closest(e);return t||wn(i.getRootNode().host,e)};function Mf(i=document){var e;const t=i?.activeElement;return t?(e=Mf(t.shadowRoot))!=null?e:t:null}function Jd(i){var e;const t=(e=i?.getRootNode)==null?void 0:e.call(i);return t instanceof ShadowRoot||t instanceof Document?t:null}function yy(i,{depth:e=3,checkOpacity:t=!0,checkVisibilityCSS:s=!0}={}){if(i.checkVisibility)return i.checkVisibility({checkOpacity:t,checkVisibilityCSS:s});let r=i;for(;r&&e>0;){const n=getComputedStyle(r);if(t&&n.opacity==="0"||s&&n.visibility==="hidden"||n.display==="none")return!1;r=r.parentElement,e--}return!0}function Ik(i,e,t,s){const r=s.x-t.x,n=s.y-t.y,a=r*r+n*n;if(a===0)return 0;const o=((i-t.x)*r+(e-t.y)*n)/a;return Math.max(0,Math.min(1,o))}function et(i,e){const t=Lk(i,s=>s===e);return t||by(i,e)}function Lk(i,e){var t,s;let r;for(r of(t=i.querySelectorAll("style:not([media])"))!=null?t:[]){let n;try{n=(s=r.sheet)==null?void 0:s.cssRules}catch{continue}for(const a of n??[])if(e(a.selectorText))return a}}function by(i,e){var t,s;const r=(t=i.querySelectorAll("style:not([media])"))!=null?t:[],n=r?.[r.length-1];return n?.sheet?(n?.sheet.insertRule(`${e}{}`,n.sheet.cssRules.length),(s=n.sheet.cssRules)==null?void 0:s[n.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",i),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function Pe(i,e,t=Number.NaN){const s=i.getAttribute(e);return s!=null?+s:t}function We(i,e,t){const s=+t;if(t==null||Number.isNaN(s)){i.hasAttribute(e)&&i.removeAttribute(e);return}Pe(i,e,void 0)!==s&&i.setAttribute(e,`${s}`)}function ve(i,e){return i.hasAttribute(e)}function Ee(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}ve(i,e)!=t&&i.toggleAttribute(e,t)}function Oe(i,e,t=null){var s;return(s=i.getAttribute(e))!=null?s:t}function Ne(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}const s=`${t}`;Oe(i,e,void 0)!==s&&i.setAttribute(e,s)}var Ty=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},vs=(i,e,t)=>(Ty(i,e,"read from private field"),t?t.call(i):e.get(i)),Rk=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ro=(i,e,t,s)=>(Ty(i,e,"write to private field"),e.set(i,t),t),Lt;function xk(i){return` 97 <style> 98 :host { 99 display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block)); 100 box-sizing: border-box; 101 } 102 </style> 103 `}class eu extends k.HTMLElement{constructor(){if(super(),Rk(this,Lt,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Te.MEDIA_CONTROLLER,_.MEDIA_PAUSED]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Te.MEDIA_CONTROLLER&&(t&&((n=(r=vs(this,Lt))==null?void 0:r.unassociateElement)==null||n.call(r,this),Ro(this,Lt,null)),s&&this.isConnected&&(Ro(this,Lt,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=vs(this,Lt))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s,r;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),Ro(this,Lt,kk(this)),this.getAttribute(Te.MEDIA_CONTROLLER)&&((t=(e=vs(this,Lt))==null?void 0:e.associateElement)==null||t.call(e,this)),(s=vs(this,Lt))==null||s.addEventListener("pointerdown",this),(r=vs(this,Lt))==null||r.addEventListener("click",this)}disconnectedCallback(){var e,t,s,r;this.getAttribute(Te.MEDIA_CONTROLLER)&&((t=(e=vs(this,Lt))==null?void 0:e.unassociateElement)==null||t.call(e,this)),(s=vs(this,Lt))==null||s.removeEventListener("pointerdown",this),(r=vs(this,Lt))==null||r.removeEventListener("click",this),Ro(this,Lt,null)}handleEvent(e){var t;const s=(t=e.composedPath())==null?void 0:t[0];if(["video","media-controller"].includes(s?.localName)){if(e.type==="pointerdown")this._pointerType=e.pointerType;else if(e.type==="click"){const{clientX:n,clientY:a}=e,{left:o,top:l,width:d,height:u}=this.getBoundingClientRect(),c=n-o,h=a-l;if(c<0||h<0||c>d||h>u||d===0&&u===0)return;const f=this._pointerType||"mouse";if(this._pointerType=void 0,f===Qu.TOUCH){this.handleTap(e);return}else if(f===Qu.MOUSE||f===Qu.PEN){this.handleMouseClick(e);return}}}}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){const t=this.mediaPaused?X.MEDIA_PLAY_REQUEST:X.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new k.CustomEvent(t,{composed:!0,bubbles:!0}))}}Lt=new WeakMap;eu.shadowRootOptions={mode:"open"};eu.getTemplateHTML=xk;function kk(i){var e;const t=i.getAttribute(Te.MEDIA_CONTROLLER);return t?(e=i.getRootNode())==null?void 0:e.getElementById(t):wn(i,"media-controller")}k.customElements.get("media-gesture-receiver")||k.customElements.define("media-gesture-receiver",eu);var xg=eu,Pf=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ht=(i,e,t)=>(Pf(i,e,"read from private field"),t?t.call(i):e.get(i)),Ot=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Qs=(i,e,t,s)=>(Pf(i,e,"write to private field"),e.set(i,t),t),Zt=(i,e,t)=>(Pf(i,e,"access private method"),t),_d,Fr,Ka,nn,ll,Kc,_y,sa,dl,Vc,Ay,Wc,Sy,Va,tu,iu,Of,Rn,Wa;const ie={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};function Dk(i){return` 104 <style> 105 106 :host([${_.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) { 107 outline: none; 108 } 109 110 :host { 111 box-sizing: border-box; 112 position: relative; 113 display: inline-block; 114 line-height: 0; 115 background-color: var(--media-background-color, #000); 116 overflow: hidden; 117 } 118 119 :host(:not([${ie.AUDIO}])) [part~=layer]:not([part~=media-layer]) { 120 position: absolute; 121 top: 0; 122 left: 0; 123 bottom: 0; 124 right: 0; 125 display: flex; 126 flex-flow: column nowrap; 127 align-items: start; 128 pointer-events: none; 129 background: none; 130 } 131 132 slot[name=media] { 133 display: var(--media-slot-display, contents); 134 } 135 136 137 :host([${ie.AUDIO}]) slot[name=media] { 138 display: var(--media-slot-display, none); 139 } 140 141 142 :host([${ie.AUDIO}]) [part~=layer][part~=gesture-layer] { 143 height: 0; 144 display: block; 145 } 146 147 148 :host(:not([${ie.AUDIO}])[${ie.GESTURES_DISABLED}]) ::slotted([slot=gestures-chrome]), 149 :host(:not([${ie.AUDIO}])[${ie.GESTURES_DISABLED}]) media-gesture-receiver[slot=gestures-chrome] { 150 display: none; 151 } 152 153 154 ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator):not([role=dialog]):not([hidden])) { 155 pointer-events: auto; 156 } 157 158 :host(:not([${ie.AUDIO}])) *[part~=layer][part~=centered-layer] { 159 align-items: center; 160 justify-content: center; 161 } 162 163 :host(:not([${ie.AUDIO}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]), 164 :host(:not([${ie.AUDIO}])) media-gesture-receiver[slot=gestures-chrome] { 165 align-self: stretch; 166 flex-grow: 1; 167 } 168 169 slot[name=middle-chrome] { 170 display: inline; 171 flex-grow: 1; 172 pointer-events: none; 173 background: none; 174 } 175 176 177 ::slotted([slot=media]), 178 ::slotted([slot=poster]) { 179 width: 100%; 180 height: 100%; 181 } 182 183 184 :host(:not([${ie.AUDIO}])) .spacer { 185 flex-grow: 1; 186 } 187 188 189 :host(:-webkit-full-screen) { 190 191 width: 100% !important; 192 height: 100% !important; 193 } 194 195 196 ::slotted(:not([slot=media]):not([slot=poster]):not([${ie.NO_AUTOHIDE}]):not([hidden]):not([role=dialog])) { 197 opacity: 1; 198 transition: var(--media-control-transition-in, opacity 0.25s); 199 } 200 201 202 :host([${ie.USER_INACTIVE}]:not([${_.MEDIA_PAUSED}]):not([${_.MEDIA_IS_AIRPLAYING}
202]):not([${_.MEDIA_IS_CASTING}]):not([${ie.AUDIO}])) ::slotted(:not([slot=media]):not([slot=poster]):not([${ie.NO_AUTOHIDE}]):not([role=dialog])) { 203 opacity: 0; 204 transition: var(--media-control-transition-out, opacity 1s); 205 } 206 207 :host([${ie.USER_INACTIVE}]:not([${ie.NO_AUTOHIDE}]):not([${_.MEDIA_PAUSED}]):not([${_.MEDIA_IS_CASTING}]):not([${ie.AUDIO}])) ::slotted([slot=media]) { 208 cursor: none; 209 } 210 211 :host([${ie.USER_INACTIVE}][${ie.AUTOHIDE_OVER_CONTROLS}]:not([${ie.NO_AUTOHIDE}]):not([${_.MEDIA_PAUSED}]):not([${_.MEDIA_IS_CASTING}]):not([${ie.AUDIO}])) * { 212 --media-cursor: none; 213 cursor: none; 214 } 215 216 217 ::slotted(media-control-bar) { 218 align-self: stretch; 219 } 220 221 222 :host(:not([${ie.AUDIO}])[${_.MEDIA_HAS_PLAYED}]) slot[name=poster] { 223 display: none; 224 } 225 226 ::slotted([role=dialog]) { 227 width: 100%; 228 height: 100%; 229 align-self: center; 230 } 231 232 ::slotted([role=menu]) { 233 align-self: end; 234 } 235 </style> 236 237 <slot name="media" part="layer media-layer"></slot> 238 <slot name="poster" part="layer poster-layer"></slot> 239 <slot name="gestures-chrome" part="layer gesture-layer"> 240 <media-gesture-receiver slot="gestures-chrome"> 241 <template shadowrootmode="${xg.shadowRootOptions.mode}"> 242 ${xg.getTemplateHTML({})} 243 </template> 244 </media-gesture-receiver> 245 </slot> 246 <span part="layer vertical-layer"> 247 <slot name="top-chrome" part="top chrome"></slot> 248 <slot name="middle-chrome" part="middle chrome"></slot> 249 <slot name="centered-chrome" part="layer centered-layer center centered chrome"></slot> 250 251 <slot part="bottom chrome"></slot> 252 </span> 253 <slot name="dialog" part="layer dialog-layer"></slot> 254 `}const Ck=Object.values(_),wk="sm:384 md:576 lg:768 xl:960";function Mk(i){Iy(i.target,i.contentRect.width)}function Iy(i,e){var t;if(!i.isConnected)return;const s=(t=i.getAttribute(ie.BREAKPOINTS))!=null?t:wk,r=Pk(s),n=Ok(r,e);let a=!1;if(Object.keys(r).forEach(o=>{if(n.includes(o)){i.hasAttribute(`breakpoint${o}`)||(i.setAttribute(`breakpoint${o}`,""),a=!0);return}i.hasAttribute(`breakpoint${o}`)&&(i.removeAttribute(`breakpoint${o}`),a=!0)}),a){const o=new CustomEvent(cs.BREAKPOINTS_CHANGE,{detail:n});i.dispatchEvent(o)}i.breakpointsComputed||(i.breakpointsComputed=!0,i.dispatchEvent(new CustomEvent(cs.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}function Pk(i){const e=i.split(/\s+/);return Object.fromEntries(e.map(t=>t.split(":")))}function Ok(i,e){return Object.keys(i).filter(t=>e>=parseInt(i[t]))}class su extends k.HTMLElement{constructor(){if(super(),Ot(this,Kc),Ot(this,Vc),Ot(this,Wc),Ot(this,Va),Ot(this,iu),Ot(this,Rn),Ot(this,_d,0),Ot(this,Fr,null),Ot(this,Ka,null),Ot(this,nn,void 0),this.breakpointsComputed=!1,Ot(this,ll,new MutationObserver(Zt(this,Kc,_y).bind(this))),Ot(this,sa,!1),Ot(this,dl,t=>{Ht(this,sa)||(setTimeout(()=>{Mk(t),Qs(this,sa,!1)},0),Qs(this,sa,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const t=Vt(this.attributes),s=this.constructor.getTemplateHTML(t);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(s):this.shadowRoot.innerHTML=s}const e=this.querySelector(":scope > slot[slot=media]");e&&e.addEventListener("slotchange",()=>{if(!e.assignedElements({flatten:!0}).length){Ht(this,Fr)&&this.mediaUnsetCallback(Ht(this,Fr));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[ie.AUTOHIDE,ie.GESTURES_DISABLED].concat(Ck).filter(e=>![_.MEDIA_RENDITION_LIST,_.MEDIA_AUDIO_TRACK_LIST,_.MEDIA_CHAPTERS_CUES,_.MEDIA_WIDTH,_.MEDIA_HEIGHT,_.MEDIA_ERROR,_.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,t,s){e.toLowerCase()==ie.AUTOHIDE&&(this.autohide=s)}get media(){let e=this.querySelector(":scope > [slot=media]");return e?.nodeName=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(Qs(this,Fr,e),e.localName.includes("-")&&await k.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;Ht(this,ll).observe(this,{childList:!0,subtree:!0}),In(this,Ht(this,dl));const t=this.getAttribute(ie.AUDIO)!=null,s=Z(t?"audio player":"video player");
254this.setAttribute("role","region"),this.setAttribute("aria-label",s),this.handleMediaUpdated(this.media),this.setAttribute(ie.USER_INACTIVE,""),Iy(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),(e=k.window)==null||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;Ht(this,ll).disconnect(),Ln(this,Ht(this,dl)),this.media&&this.mediaUnsetCallback(this.media),(e=k.window)==null||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){Qs(this,Fr,null)}handleEvent(e){switch(e.type){case"pointerdown":Qs(this,_d,e.timeStamp);break;case"pointermove":Zt(this,Vc,Ay).call(this,e);break;case"pointerup":Zt(this,Wc,Sy).call(this,e);break;case"mouseleave":Zt(this,Va,tu).call(this);break;case"mouseup":this.removeAttribute(ie.KEYBOARD_CONTROL);break;case"keyup":Zt(this,Rn,Wa).call(this),this.setAttribute(ie.KEYBOARD_CONTROL,"");break}}set autohide(e){const t=Number(e);Qs(this,nn,isNaN(t)?0:t)}get autohide(){return(Ht(this,nn)===void 0?2:Ht(this,nn)).toString()}get breakpoints(){return Oe(this,ie.BREAKPOINTS)}set breakpoints(e){Ne(this,ie.BREAKPOINTS,e)}get audio(){return ve(this,ie.AUDIO)}set audio(e){Ee(this,ie.AUDIO,e)}get gesturesDisabled(){return ve(this,ie.GESTURES_DISABLED)}set gesturesDisabled(e){Ee(this,ie.GESTURES_DISABLED,e)}get keyboardControl(){return ve(this,ie.KEYBOARD_CONTROL)}set keyboardControl(e){Ee(this,ie.KEYBOARD_CONTROL,e)}get noAutohide(){return ve(this,ie.NO_AUTOHIDE)}set noAutohide(e){Ee(this,ie.NO_AUTOHIDE,e)}get autohideOverControls(){return ve(this,ie.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){Ee(this,ie.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return ve(this,ie.USER_INACTIVE)}set userInteractive(e){Ee(this,ie.USER_INACTIVE,e)}}_d=new WeakMap;Fr=new WeakMap;Ka=new WeakMap;nn=new WeakMap;ll=new WeakMap;Kc=new WeakSet;_y=function(i){const e=this.media;for(const t of i){if(t.type!=="childList")continue;const s=t.removedNodes;for(const r of s){if(r.slot!="media"||t.target!=this)continue;let n=t.previousSibling&&t.previousSibling.previousElementSibling;if(!n||!e)this.mediaUnsetCallback(r);else{let a=n.slot!=="media";for(;(n=n.previousSibling)!==null;)n.slot=="media"&&(a=!1);a&&this.mediaUnsetCallback(r)}}if(e)for(const r of t.addedNodes)r===e&&this.handleMediaUpdated(e)}};sa=new WeakMap;dl=new WeakMap;Vc=new WeakSet;Ay=function(i){if(i.pointerType!=="mouse"&&i.timeStamp-Ht(this,_d)<250)return;Zt(this,iu,Of).call(this),clearTimeout(Ht(this,Ka));const e=this.hasAttribute(ie.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(i.target)||e)&&Zt(this,Rn,Wa).call(this)};Wc=new WeakSet;Sy=function(i){if(i.pointerType==="touch"){const e=!this.hasAttribute(ie.USER_INACTIVE);[this,this.media].includes(i.target)&&e?Zt(this,Va,tu).call(this):Zt(this,Rn,Wa).call(this)}else i.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(e?.localName))&&Zt(this,Rn,Wa).call(this)};Va=new WeakSet;tu=function(){if(Ht(this,nn)<0||this.hasAttribute(ie.USER_INACTIVE))return;this.setAttribute(ie.USER_INACTIVE,"");const i=new k.CustomEvent(cs.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(i)};iu=new WeakSet;Of=function(){if(!this.hasAttribute(ie.USER_INACTIVE))return;this.removeAttribute(ie.USER_INACTIVE);const i=new k.CustomEvent(cs.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(i)};Rn=new WeakSet;Wa=function(){Zt(this,iu,Of).call(this),clearTimeout(Ht(this,Ka));const i=parseInt(this.autohide);i<0||Qs(this,Ka,setTimeout(()=>{Zt(this,Va,tu).call(this)},i*1e3))};su.shadowRootOptions={mode:"open"};su.getTemplateHTML=Dk;k.customElements.get("media-container")||k.customElements.define("media-container",su);var Ly=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ct=(i,e,t)=>(Ly(i,e,"read from private field"),t?t.call(i):e.get(i)),Fn=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},xo=(i,e,t,s)=>(Ly(i,e,"write to private field"),e.set(i,t),t),Br,Hr,Ad,lr,ts,Ts;class Nf{constructor(e,t,{defaultValue:s}={defaultValue:void 0}){Fn(this,ts),Fn(this,Br,void 0),Fn(this,Hr,void 0),Fn(this,Ad,void 0),Fn(this,lr,new Set),xo(this,Br,e),xo(this,Hr,t),xo(this,Ad,new Set(s))}[Symbol.iterator](){return ct(this,ts,Ts).values()}get length(){return ct(this,ts,Ts).size}get value(){var e;return(e=[...ct(this,ts,Ts)].join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(xo(this,lr,new Set),this.add(...(t=e?.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return[...ct(this,ts,Ts)][e]}values(){return ct(this,ts,Ts).values()}
254forEach(e,t){ct(this,ts,Ts).forEach(e,t)}add(...e){var t,s;e.forEach(r=>ct(this,lr).add(r)),!(this.value===""&&!((t=ct(this,Br))!=null&&t.hasAttribute(`${ct(this,Hr)}`)))&&((s=ct(this,Br))==null||s.setAttribute(`${ct(this,Hr)}`,`${this.value}`))}remove(...e){var t;e.forEach(s=>ct(this,lr).delete(s)),(t=ct(this,Br))==null||t.setAttribute(`${ct(this,Hr)}`,`${this.value}`)}contains(e){return ct(this,ts,Ts).has(e)}toggle(e,t){return typeof t<"u"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){return this.remove(e),this.add(t),e===t}}Br=new WeakMap;Hr=new WeakMap;Ad=new WeakMap;lr=new WeakMap;ts=new WeakSet;Ts=function(){return ct(this,lr).size?ct(this,lr):ct(this,Ad)};const Nk=(i="")=>i.split(/\s+/),Ry=(i="")=>{const[e,t,s]=i.split(":"),r=s?decodeURIComponent(s):void 0;return{kind:e==="cc"?Vi.CAPTIONS:Vi.SUBTITLES,language:t,label:r}},ru=(i="",e={})=>Nk(i).map(t=>{const s=Ry(t);return{...e,...s}}),xy=i=>i?Array.isArray(i)?i.map(e=>typeof e=="string"?Ry(e):e):typeof i=="string"?ru(i):[i]:[],Yc=({kind:i,label:e,language:t}={kind:"subtitles"})=>e?`${i==="captions"?"cc":"sb"}:${t}:${encodeURIComponent(e)}`:t,Ya=(i=[])=>Array.prototype.map.call(i,Yc).join(" "),Uk=(i,e)=>t=>t[i]===e,ky=i=>{const e=Object.entries(i).map(([t,s])=>Uk(t,s));return t=>e.every(s=>s(t))},Ia=(i,e=[],t=[])=>{const s=xy(t).map(ky),r=n=>s.some(a=>a(n));Array.from(e).filter(r).forEach(n=>{n.mode=i})},nu=(i,e=()=>!0)=>{if(!i?.textTracks)return[];const t=typeof e=="function"?e:ky(e);return Array.from(i.textTracks).filter(t)},Dy=i=>{var e;return!!((e=i.mediaSubtitlesShowing)!=null&&e.length)||i.hasAttribute(_.MEDIA_SUBTITLES_SHOWING)},$k=i=>{var e;const{media:t,fullscreenElement:s}=i;try{const r=s&&"requestFullscreen"in s?"requestFullscreen":s&&"webkitRequestFullScreen"in s?"webkitRequestFullScreen":void 0;if(r){const n=(e=s[r])==null?void 0:e.call(s);if(n instanceof Promise)return n.catch(()=>{})}else t?.webkitEnterFullscreen?t.webkitEnterFullscreen():t?.requestFullscreen&&t.requestFullscreen()}catch(r){console.error(r)}},kg="exitFullscreen"in ot?"exitFullscreen":"webkitExitFullscreen"in ot?"webkitExitFullscreen":"webkitCancelFullScreen"in ot?"webkitCancelFullScreen":void 0,Fk=i=>{var e;const{documentElement:t}=i;if(kg){const s=(e=t?.[kg])==null?void 0:e.call(t);if(s instanceof Promise)return s.catch(()=>{})}},ra="fullscreenElement"in ot?"fullscreenElement":"webkitFullscreenElement"in ot?"webkitFullscreenElement":void 0,Bk=i=>{const{documentElement:e,media:t}=i,s=e?.[ra];return!s&&"webkitDisplayingFullscreen"in t&&"webkitPresentationMode"in t&&t.webkitDisplayingFullscreen&&t.webkitPresentationMode===dk.FULLSCREEN?t:s},Hk=i=>{var e;const{media:t,documentElement:s,fullscreenElement:r=t}=i;if(!t||!s)return!1;const n=Bk(i);if(!n)return!1;if(n===r||n===t)return!0;if(n.localName.includes("-")){let a=n.shadowRoot;if(!(ra in a))return fs(n,r);for(;a?.[ra];){if(a[ra]===r)return!0;a=(e=a[ra])==null?void 0:e.shadowRoot}}return!1},Gk="fullscreenEnabled"in ot?"fullscreenEnabled":"webkitFullscreenEnabled"in ot?"webkitFullscreenEnabled":void 0,Kk=i=>{const{documentElement:e,media:t}=i;return!!e?.[Gk]||t&&"webkitSupportsFullscreen"in t};let ko;const Uf=()=>{var i,e;return ko||(ko=(e=(i=ot)==null?void 0:i.createElement)==null?void 0:e.call(i,"video"),ko)},Vk=async(i=Uf())=>{if(!i)return!1;const e=i.volume;i.volume=e/2+.1;const t=new AbortController,s=await Promise.race([Wk(i,t.signal),Yk(i,e)]);return t.abort(),s},Wk=(i,e)=>new Promise(t=>{i.addEventListener("volumechange",()=>t(!0),{signal:e})}),Yk=async(i,e)=>{for(let t=0;t<10;t++){if(i.volume===e)return!1;await uy(10)}return i.volume!==e},qk=/.*Version\/.*Safari\/.*/.test(k.navigator.userAgent),Cy=(i=Uf())=>k.matchMedia("(display-mode: standalone)").matches&&qk?!1:typeof i?.requestPictureInPicture=="function",wy=(i=Uf())=>Kk({documentElement:ot,media:i}),jk=wy(),zk=Cy(),Qk=!!k.WebKitPlaybackTargetAvailabilityEvent,Xk=!!k.chrome,Sd=i=>nu(i.media,e=>[Vi.SUBTITLES,Vi.CAPTIONS].includes(e.kind)).sort((e,t)=>e.kind>=t.kind?1:-1),My=i=>nu(i.media,e=>e.mode===pn.SHOWING&&[Vi.SUBTITLES,Vi.CAPTIONS].includes(e.kind)),Py=(i,e)=>{const t=Sd(i),s=My(i),r=!!s.length;if(t.length){if(e===!1||r&&e!==!0)Ia(pn.DISABLED,t,s);else if(e===!0||!r&&e!==!1){let n=t[0];const{options:a}=i;if(!a?.noSubtitlesLangPref){const u=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),c=u?[u,...globalThis.navigator.languages]:globalThis.navigator.languages,h=t.filter(f=>c.some(m=>f.language.toLowerCase().startsWith(m.split("-")[0]))).sort((f,m)=>{const g=c.findIndex(E=>f.language.toLowerCase().startsWith(E.split("-")[0])),p=c.findIndex(E=>m.language.toLowerCase().startsWith(E.split("-")[0]));return g-p});h[0]&&(n=h[0])}const{language:o,label:l,kind:d}=n;Ia(pn.DISABLED,t,s),Ia(pn.SHOWING,t,[{language:o,label:l,kind:d}])}}},$f=(i,e)=>i===e?!0:i==null||e==null||typeof i!=typeof e?!1:typeof i=="number"&&Number.isNaN(i)&&Number.isNaN(e)?!0:typeof i!="object"?!1:Array.isArray(i)?Zk(i,e):Object.entries(i).every(([t,s])=>t in e&&$f(s,e[t])),Zk=(i,e)=>{const t=Array.isArray(i),s=Array.isArray(e);return t!==s?!1:t||s?i.length!==e.length?!1:i.every((r,n)=>$f(r,e[n])):!0},Jk=Object.values(ns);let Id;const eD=Vk().then(i=>(Id=i,Id)),tD=async(...i)=>{await Promise.all(i.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof k.HTMLElement))return;const t=e.localName;if(!t.includes("-"))return;const s=k.customElements.get(t);s&&e instanceof s||(await k.customElements.whenDefined(t),k.customElements.upgrade(e))}))},iD=new k.DOMParser,sD=i=>i&&(iD.parseFromString(i,"text/html").body.textContent||i),na={mediaError:{get(i,e){const{media:t}=i;if(e?.type!=="playing")return t?.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(i,e){var t;const{media:s}=i;
254if(e?.type!=="playing")return(t=s?.error)==null?void 0:t.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(i,e){var t,s;const{media:r}=i;if(e?.type!=="playing")return(s=(t=r?.error)==null?void 0:t.message)!=null?s:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(i){var e;const{media:t}=i;return(e=t?.videoWidth)!=null?e:0},mediaEvents:["resize"]},mediaHeight:{get(i){var e;const{media:t}=i;return(e=t?.videoHeight)!=null?e:0},mediaEvents:["resize"]},mediaPaused:{get(i){var e;const{media:t}=i;return(e=t?.paused)!=null?e:!0},set(i,e){var t;const{media:s}=e;s&&(i?s.pause():(t=s.play())==null||t.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(i,e){const{media:t}=i;return t?e?e.type==="playing":!t.paused:!1},mediaEvents:["playing","emptied"]},mediaEnded:{get(i){var e;const{media:t}=i;return(e=t?.ended)!=null?e:!1},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(i){var e;const{media:t}=i;return(e=t?.playbackRate)!=null?e:1},set(i,e){const{media:t}=e;t&&Number.isFinite(+i)&&(t.playbackRate=+i)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(i){var e;const{media:t}=i;return(e=t?.muted)!=null?e:!1},set(i,e){const{media:t,options:{noMutedPref:s}={}}=e;if(t){t.muted=i;try{const r=k.localStorage.getItem("media-chrome-pref-muted")!==null,n=t.hasAttribute("muted");if(s){r&&k.localStorage.removeItem("media-chrome-pref-muted");return}if(n&&!r)return;k.localStorage.setItem("media-chrome-pref-muted",i?"true":"false")}catch(r){console.debug("Error setting muted pref",r)}}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noMutedPref:t}}=e,{media:s}=e;if(!(!s||s.muted||t))try{const r=k.localStorage.getItem("media-chrome-pref-muted")==="true";na.mediaMuted.set(r,e),i(r)}catch(r){console.debug("Error getting muted pref",r)}}]},mediaVolume:{get(i){var e;const{media:t}=i;return(e=t?.volume)!=null?e:1},set(i,e){const{media:t,options:{noVolumePref:s}={}}=e;if(t){try{i==null?k.localStorage.removeItem("media-chrome-pref-volume"):!t.hasAttribute("muted")&&!s&&k.localStorage.setItem("media-chrome-pref-volume",i.toString())}catch(r){console.debug("Error setting volume pref",r)}Number.isFinite(+i)&&(t.volume=+i)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noVolumePref:t}}=e;if(!t)try{const{media:s}=e;if(!s)return;const r=k.localStorage.getItem("media-chrome-pref-volume");if(r==null)return;na.mediaVolume.set(+r,e),i(+r)}catch(s){console.debug("Error getting volume pref",s)}}]},mediaVolumeLevel:{get(i){const{media:e}=i;return typeof e?.volume>"u"?"high":e.muted||e.volume===0?"off":e.volume<.5?"low":e.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(i){var e;const{media:t}=i;return(e=t?.currentTime)!=null?e:0},set(i,e){const{media:t}=e;!t||!Cf(i)||(t.currentTime=i)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(i){const{media:e,options:{defaultDuration:t}={}}=i;return t&&(!e||!e.duration||Number.isNaN(e.duration)||!Number.isFinite(e.duration))?t:Number.isFinite(e?.duration)?e.duration:Number.NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(i){const{media:e}=i;return e?.readyState<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(i){var e;const{media:t}=i;if(!((e=t?.seekable)!=null&&e.length))return;const s=t.seekable.start(0),r=t.seekable.end(t.seekable.length-1);if(!(!s&&!r))return[Number(s.toFixed(3)),Number(r.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(i){var e;const{media:t}=i,s=(e=t?.buffered)!=null?e:[];return Array.from(s).map((r,n)=>[Number(s.start(n).toFixed(3)),Number(s.end(n).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(i){const{media:e,options:{defaultStreamType:t}={}}=i,s=[ns.LIVE,ns.ON_DEMAND].includes(t)?t:void 0;if(!e)return s;const{streamType:r}=e;if(Jk.includes(r))return r===ns.UNKNOWN?s:r;const n=e.duration;return n===1/0?ns.LIVE:Number.isFinite(n)?ns.ON_DEMAND:s}
254,mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(i){const{media:e}=i;if(!e)return Number.NaN;const{targetLiveWindow:t}=e,s=na.mediaStreamType.get(i);return(t==null||Number.isNaN(t))&&s===ns.LIVE?0:t},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(i){const{media:e,options:{liveEdgeOffset:t=10}={}}=i;if(!e)return!1;if(typeof e.liveEdgeStart=="number")return Number.isNaN(e.liveEdgeStart)?!1:e.currentTime>=e.liveEdgeStart;if(!(na.mediaStreamType.get(i)===ns.LIVE))return!1;const r=e.seekable;if(!r)return!0;if(!r.length)return!1;const n=r.end(r.length-1)-t;return e.currentTime>=n},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get(i){return Sd(i).map(({kind:e,label:t,language:s})=>({kind:e,label:t,language:s}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get(i){return My(i).map(({kind:e,label:t,language:s})=>({kind:e,label:t,language:s}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,e)=>{var t,s;const{media:r,options:n}=e;if(!r)return;const a=o=>{var l;!n.defaultSubtitles||o&&![Vi.CAPTIONS,Vi.SUBTITLES].includes((l=o?.track)==null?void 0:l.kind)||Py(e,!0)};return r.addEventListener("loadstart",a),(t=r.textTracks)==null||t.addEventListener("addtrack",a),(s=r.textTracks)==null||s.addEventListener("removetrack",a),()=>{var o,l;r.removeEventListener("loadstart",a),(o=r.textTracks)==null||o.removeEventListener("addtrack",a),(l=r.textTracks)==null||l.removeEventListener("removetrack",a)}}]},mediaChaptersCues:{get(i){var e;const{media:t}=i;if(!t)return[];const[s]=nu(t,{kind:Vi.CHAPTERS});return Array.from((e=s?.cues)!=null?e:[]).map(({text:r,startTime:n,endTime:a})=>({text:sD(r),startTime:n,endTime:a}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;if(!s)return;const r=s.querySelector('track[kind="chapters"][default][src]'),n=(t=s.shadowRoot)==null?void 0:t.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return r?.addEventListener("load",i),n?.addEventListener("load",i),()=>{r?.removeEventListener("load",i),n?.removeEventListener("load",i)}}]},mediaIsPip:{get(i){var e,t;const{media:s,documentElement:r}=i;if(!s||!r||!r.pictureInPictureElement)return!1;if(r.pictureInPictureElement===s)return!0;if(r.pictureInPictureElement instanceof HTMLMediaElement)return(e=s.localName)!=null&&e.includes("-")?fs(s,r.pictureInPictureElement):!1;if(r.pictureInPictureElement.localName.includes("-")){let n=r.pictureInPictureElement.shadowRoot;for(;n?.pictureInPictureElement;){if(n.pictureInPictureElement===s)return!0;n=(t=n.pictureInPictureElement)==null?void 0:t.shadowRoot}}return!1},set(i,e){const{media:t}=e;if(t)if(i){if(!ot.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!t.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}const s=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};t.requestPictureInPicture().catch(r=>{if(r.code===11){if(!t.src){console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");return}if(t.readyState===0&&t.preload==="none"){const n=()=>{t.removeEventListener("loadedmetadata",a),t.preload="none"},a=()=>{t.requestPictureInPicture().catch(s),n()};t.addEventListener("loadedmetadata",a),t.preload="metadata",setTimeout(()=>{t.readyState===0&&s(),n()},1e3)}else throw r}else throw r})}else ot.pictureInPictureElement&&ot.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(i){var e;const{media:t}=i;return[...(e=t?.videoRenditions)!=null?e:[]].map(s=>({...s}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(i){var e,t,s;const{media:r}=i;return(s=(t=r?.videoRenditions)==null?void 0:t[(e=r.videoRenditions)==null?void 0:e.selectedIndex])==null?void 0:s.id},set(i,e){const{media:t}=e;if(!t?.videoRenditions){console.warn("MediaController: Rendition selection not supported by this media.");return}const s=i,r=Array.prototype.findIndex.call(t.videoRenditions,n=>n.id==s);t.videoRenditions.selectedIndex!=r&&(t.videoRenditions.selectedIndex=r)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(i){var e;const{media:t}=i;return[...(e=t?.audioTracks)!=null?e:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(i){var e,t;const{media:s}=i;return(t=[...(e=s?.audioTracks)!=null?e:[]].find(r=>r.enabled))==null?void 0:t.id},set(i,e){const{media:t}=e;if(!t?.audioTracks){console.warn("MediaChrome: Audio track selection not supported by this media.");return}const s=i;for(const r of t.audioTracks)r.enabled=s==r.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get(i){return Hk(i)},set(i,e,t){var s;i?($k(e),t.detail&&((s=e.media)==null||s.focus())):Fk(e)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(i){var e;const{media:t}=i;return!t?.remote||((e=t.remote)==null?void 0:e.state)==="disconnected"?!1:!!t.remote.state},set(i,e){var t,s;const{media:r}=e;if(r&&!(i&&((t=r.remote)==null?void 0:t.state)!=="disconnected")&&!(!i&&((s=r.remote)==null?void 0:s.state)!=="connected")){if(typeof r.remote.prompt!="function"){console.warn("MediaChrome: Casting is not supported in this environment");return}r.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get(){return!1},set(i,e){const{media:t}=e;if(t){if(!(t.webkitShowPlaybackTargetPicker&&k.WebKitPlaybackTargetAvailabilityEvent)){console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");return}t.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(i){const{media:e}=i;if(!jk||!wy(e))return Pt.UNSUPPORTED}},mediaPipUnavailable:{get(i){const{media:e}=i;if(!zk||!Cy(e))return Pt.UNSUPPORTED;if(e?.disablePictureInPicture)return Pt.UNAVAILABLE}},mediaVolumeUnavailable:{get(i){const{media:e}=i;if(Id===!1||e?.volume==null)return Pt.UNSUPPORTED},stateOwnersUpdateHandlers:[i=>{Id==null&&eD.then(e=>i(e?void 0:Pt.UNSUPPORTED))}]},mediaCastUnavailable:{get(i,{availability:e="not-available"}={}){var t;const{media:s}=i;
254if(!Xk||!((t=s?.remote)!=null&&t.state))return Pt.UNSUPPORTED;if(!(e==null||e==="available"))return Pt.UNAVAILABLE},stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;return s?(s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s?.remote)==null||t.watchAvailability(n=>{i({availability:n?"available":"not-available"})}).catch(n=>{n.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var n;(n=s?.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaAirplayUnavailable:{get(i,e){if(!Qk)return Pt.UNSUPPORTED;if(e?.availability==="not-available")return Pt.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;return s?(s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s?.remote)==null||t.watchAvailability(n=>{i({availability:n?"available":"not-available"})}).catch(n=>{n.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var n;(n=s?.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaRenditionUnavailable:{get(i){var e;const{media:t}=i;if(!t?.videoRenditions)return Pt.UNSUPPORTED;if(!((e=t.videoRenditions)!=null&&e.length))return Pt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(i){var e,t;const{media:s}=i;if(!s?.audioTracks)return Pt.UNSUPPORTED;if(((t=(e=s.audioTracks)==null?void 0:e.length)!=null?t:0)<=1)return Pt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaLang:{get(i){const{options:{mediaLang:e}={}}=i;return e??"en"}}},rD={[X.MEDIA_PREVIEW_REQUEST](i,e,{detail:t}){var s,r,n;const{media:a}=e,o=t??void 0;let l,d;if(a&&o!=null){const[f]=nu(a,{kind:Vi.METADATA,label:"thumbnails"}),m=Array.prototype.find.call((s=f?.cues)!=null?s:[],(g,p,E)=>p===0?g.endTime>o:p===E.length-1?g.startTime<=o:g.startTime<=o&&g.endTime>o);if(m){const g=/'^(?:[a-z]+:)?\/\//i.test(m.text)||(r=a?.querySelector('track[label="thumbnails"]'))==null?void 0:r.src,p=new URL(m.text,g);d=new URLSearchParams(p.hash).get("#xywh").split(",").map(b=>+b),l=p.href}}const u=i.mediaDuration.get(e);let h=(n=i.mediaChaptersCues.get(e).find((f,m,g)=>m===g.length-1&&u===f.endTime?f.startTime<=o&&f.endTime>=o:f.startTime<=o&&f.endTime>o))==null?void 0:n.text;return t!=null&&h==null&&(h=""),{mediaPreviewTime:o,mediaPreviewImage:l,mediaPreviewCoords:d,mediaPreviewChapter:h}},[X.MEDIA_PAUSE_REQUEST](i,e){i["mediaPaused"].set(!0,e)},[X.MEDIA_PLAY_REQUEST](i,e){var t,s,r,n;const a="mediaPaused",l=i.mediaStreamType.get(e)===ns.LIVE,d=!((t=e.options)!=null&&t.noAutoSeekToLive),u=i.mediaTargetLiveWindow.get(e)>0;if(l&&d&&!u){const c=(s=i.mediaSeekable.get(e))==null?void 0:s[1];if(c){const h=(n=(r=e.options)==null?void 0:r.seekToLiveOffset)!=null?n:0,f=c-h;i.mediaCurrentTime.set(f,e)}}i[a].set(!1,e)},[X.MEDIA_PLAYBACK_RATE_REQUEST](i,e,{detail:t}){const s="mediaPlaybackRate",r=t;i[s].set(r,e)},[X.MEDIA_MUTE_REQUEST](i,e){i["mediaMuted"].set(!0,e)},[X.MEDIA_UNMUTE_REQUEST](i,e){const t="mediaMuted";i.mediaVolume.get(e)||i.mediaVolume.set(.25,e),i[t].set(!1,e)},[X.MEDIA_VOLUME_REQUEST](i,e,{detail:t}){const s="mediaVolume",r=t;r&&i.mediaMuted.get(e)&&i.mediaMuted.set(!1,e),i[s].set(r,e)},[X.MEDIA_SEEK_REQUEST](i,e,{detail:t}){const s="mediaCurrentTime",r=t;i[s].set(r,e)},[X.MEDIA_SEEK_TO_LIVE_REQUEST](i,e){var t,s,r;const n="mediaCurrentTime",a=(t=i.mediaSeekable.get(e))==null?void 0:t[1];if(Number.isNaN(Number(a)))return;const o=(r=(s=e.options)==null?void 0:s.seekToLiveOffset)!=null?r:0,l=a-o;i[n].set(l,e)},[X.MEDIA_SHOW_SUBTITLES_REQUEST](i,e,{detail:t}){var s;const{options:r}=e,n=Sd(e),a=xy(t),o=(s=a[0])==null?void 0:s.language;o&&!r.noSubtitlesLangPref&&k.localStorage.setItem("media-chrome-pref-subtitles-lang",o),Ia(pn.SHOWING,n,a)},[X.MEDIA_DISABLE_SUBTITLES_REQUEST](i,e,{detail:t}){const s=Sd(e),r=t??[];Ia(pn.DISABLED,s,r)},[X.MEDIA_TOGGLE_SUBTITLES_REQUEST](i,e,{detail:t}){Py(e,t)},[X.MEDIA_RENDITION_REQUEST](i,e,{detail:t}){const s="mediaRenditionSelected",r=t;i[s].set(r,e)},[X.MEDIA_AUDIO_TRACK_REQUEST](i,e,{detail:t}){const s="mediaAudioTrackEnabled",r=t;i[s].set(r,e)},[X.MEDIA_ENTER_PIP_REQUEST](i,e){const t="mediaIsPip";i.mediaIsFullscreen.get(e)&&i.mediaIsFullscreen.set(!1,e),i[t].set(!0,e)},[X.MEDIA_EXIT_PIP_REQUEST](i,e){i["mediaIsPip"].set(!1,e)},[X.MEDIA_ENTER_FULLSCREEN_REQUEST](i,e,t){const s="mediaIsFullscreen";i.mediaIsPip.get(e)&&i.mediaIsPip.set(!1,e),i[s].set(!0,e,t)},[X.MEDIA_EXIT_FULLSCREEN_REQUEST](i,e){i["mediaIsFullscreen"].set(!1,e)},[X.MEDIA_ENTER_CAST_REQUEST](i,e){const t="mediaIsCasting";i.mediaIsFullscreen.get(e)&&i.mediaIsFullscreen.set(!1,e),i[t].set(!0,e)},[X.MEDIA_EXIT_CAST_REQUEST](i,e){i["mediaIsCasting"].set(!1,e)},[X.MEDIA_AIRPLAY_REQUEST](i,e){i["mediaIsAirplaying"].set(!0,e)}},nD=({media:i,fullscreenElement:e,documentElement:t,stateMediator:s=na,requestMap:r=rD,options:n={},monitorStateOwnersOnlyWithSubscriptions:a=!0})=>{const o=[],l={options:{...n}};let d=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0});const u=g=>{g!=null&&($f(g,d)||(d=Object.freeze({...d,...g}),o.forEach(p=>p(d))))},c=()=>{const g=Object.entries(s).reduce((p,[E,{get:b}])=>(p[E]=b(l),p),{});u(g)},h={};let f;const m=async(g,p)=>{var E,b,y,T,A,L,S,R,x,I,M,$,V,Y,H,N;const W=!!f;if(f={...l,...f??{},...g},W)return;await tD(...Object.values(g));const B=o.length>0&&p===0&&a,q=l.media!==f.media,J=((E=l.media)==null?void 0:E.textTracks)!==((b=f.media)==null?void 0:b.textTracks),U=((y=l.media)==null?void 0:y.videoRenditions)!==((T=f.media)==null?void 0:T.videoRenditions),F=((A=l.media)==null?void 0:A.audioTracks)!==((L=f.media)==null?void 0:L.audioTracks),re=((S=l.media)==null?void 0:S.remote)!==((R=f.media)==null?void 0:R.remote),me=l.documentElement!==f.documentElement,le=!!l.media&&(q||B),he=!!((x=l.media)!=null&&x.textTracks)&&(J||B),tt=!!((I=l.media)!=null&&I.videoRenditions)&&(U||B),ze=!!((M=l.media)!=null&&M.audioTracks)&&(F||B),_t=!!(($=l.media)!=null&&$.remote)&&(re||B),Ct=!!l.documentElement&&(me||B),gi=le||he||tt||ze||_t||Ct,ms=o.length===0&&p===1&&a,Ar=!!f.media&&(q||ms),Sr=!!((V=f.media)!=null&&V.textTracks)&&(J||ms),pu=!!((Y=f.media)!=null&&Y.videoRenditions)&&(U||ms),ge=!!((H=f.media)!=null&&H.audioTracks)&&(F||ms),it=!!((N=f.media)!=null&&N.remote)&&(re||ms),At=!!f.documentElement&&(me||ms),vi=Ar||Sr||pu||ge||it||At;if(!(gi||vi)){Object.entries(f).forEach(([ye,wt])=>
254{l[ye]=wt}),c(),f=void 0;return}Object.entries(s).forEach(([ye,{get:wt,mediaEvents:no=[],textTracksEvents:Ir=[],videoRenditionsEvents:ao=[],audioTracksEvents:Gs=[],remoteEvents:oo=[],rootEvents:gu=[],stateOwnersUpdateHandlers:lo=[]}])=>{h[ye]||(h[ye]={});const yt=Ye=>{const Mt=wt(l,Ye);u({[ye]:Mt})};let $e;$e=h[ye].mediaEvents,no.forEach(Ye=>{$e&&le&&(l.media.removeEventListener(Ye,$e),h[ye].mediaEvents=void 0),Ar&&(f.media.addEventListener(Ye,yt),h[ye].mediaEvents=yt)}),$e=h[ye].textTracksEvents,Ir.forEach(Ye=>{var Mt,si;$e&&he&&((Mt=l.media.textTracks)==null||Mt.removeEventListener(Ye,$e),h[ye].textTracksEvents=void 0),Sr&&((si=f.media.textTracks)==null||si.addEventListener(Ye,yt),h[ye].textTracksEvents=yt)}),$e=h[ye].videoRenditionsEvents,ao.forEach(Ye=>{var Mt,si;$e&&tt&&((Mt=l.media.videoRenditions)==null||Mt.removeEventListener(Ye,$e),h[ye].videoRenditionsEvents=void 0),pu&&((si=f.media.videoRenditions)==null||si.addEventListener(Ye,yt),h[ye].videoRenditionsEvents=yt)}),$e=h[ye].audioTracksEvents,Gs.forEach(Ye=>{var Mt,si;$e&&ze&&((Mt=l.media.audioTracks)==null||Mt.removeEventListener(Ye,$e),h[ye].audioTracksEvents=void 0),ge&&((si=f.media.audioTracks)==null||si.addEventListener(Ye,yt),h[ye].audioTracksEvents=yt)}),$e=h[ye].remoteEvents,oo.forEach(Ye=>{var Mt,si;$e&&_t&&((Mt=l.media.remote)==null||Mt.removeEventListener(Ye,$e),h[ye].remoteEvents=void 0),it&&((si=f.media.remote)==null||si.addEventListener(Ye,yt),h[ye].remoteEvents=yt)}),$e=h[ye].rootEvents,gu.forEach(Ye=>{$e&&Ct&&(l.documentElement.removeEventListener(Ye,$e),h[ye].rootEvents=void 0),At&&(f.documentElement.addEventListener(Ye,yt),h[ye].rootEvents=yt)});const Nm=h[ye].stateOwnersUpdateHandlers;lo.forEach(Ye=>{Nm&&gi&&Nm(),vi&&(h[ye].stateOwnersUpdateHandlers=Ye(yt,f))})}),Object.entries(f).forEach(([ye,wt])=>
vendor: 6,980 bytes, line 254
254{l[ye]=wt}),c(),f=void 0};return m({media:i,fullscreenElement:e,documentElement:t,options:n}),{dispatch(g){const{type:p,detail:E}=g;if(r[p]&&d.mediaErrorCode==null){u(r[p](s,l,g));return}p==="mediaelementchangerequest"?m({media:E}):p==="fullscreenelementchangerequest"?m({fullscreenElement:E}):p==="documentelementchangerequest"?m({documentElement:E}):p==="optionschangerequest"&&(Object.entries(E??{}).forEach(([b,y])=>{l.options[b]=y}),c())},getState(){return d},subscribe(g){return m({},o.length+1),o.push(g),g(d),()=>{const p=o.indexOf(g);p>=0&&(m({},o.length-1),o.splice(p,1))}}}};var Ff=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},de=(i,e,t)=>(Ff(i,e,"read from private field"),t?t.call(i):e.get(i)),Zi=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Es=(i,e,t,s)=>(Ff(i,e,"write to private field"),e.set(i,t),t),ws=(i,e,t)=>(Ff(i,e,"access private method"),t),dr,aa,_e,oa,Ii,ul,cl,qc,xn,qa,hl,jc;const Oy=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"," ","f","m","k","c"],Dg=10,Cg=.025,G={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYS_USED:"keysused",LIVE_EDGE_OFFSET:"liveedgeoffset",SEEK_TO_LIVE_OFFSET:"seektoliveoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_HOTKEYS:"nohotkeys",NO_VOLUME_PREF:"novolumepref",NO_MUTED_PREF:"nomutedpref",NO_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_DEFAULT_STORE:"nodefaultstore",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",KEYBOARD_UP_VOLUME_STEP:"keyboardupvolumestep",KEYBOARD_DOWN_VOLUME_STEP:"keyboarddownvolumestep",LANG:"lang"};class Ny extends su{constructor(){super(),Zi(this,cl),Zi(this,xn),Zi(this,hl),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,Zi(this,dr,new Nf(this,G.HOTKEYS)),Zi(this,aa,void 0),Zi(this,_e,void 0),Zi(this,oa,void 0),Zi(this,Ii,void 0),Zi(this,ul,t=>{var s;(s=de(this,_e))==null||s.dispatch(t)}),this.associateElement(this);let e={};Es(this,oa,t=>{Object.entries(t).forEach(([s,r])=>{if(s in e&&e[s]===r)return;this.propagateMediaState(s,r);const n=s.toLowerCase(),a=new k.CustomEvent(lk[n],{composed:!0,detail:r});this.dispatchEvent(a)}),e=t}),this.hasAttribute(G.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(G.NO_HOTKEYS,G.HOTKEYS,G.DEFAULT_STREAM_TYPE,G.DEFAULT_SUBTITLES,G.DEFAULT_DURATION,G.NO_MUTED_PREF,G.NO_VOLUME_PREF,G.LANG)}get mediaStore(){return de(this,_e)}set mediaStore(e){var t,s;if(de(this,_e)&&((t=de(this,Ii))==null||t.call(this),Es(this,Ii,void 0)),Es(this,_e,e),!de(this,_e)&&!this.hasAttribute(G.NO_DEFAULT_STORE)){ws(this,cl,qc).call(this);return}Es(this,Ii,(s=de(this,_e))==null?void 0:s.subscribe(de(this,oa)))}get fullscreenElement(){var e;return(e=de(this,aa))!=null?e:this}set fullscreenElement(e){var t;this.hasAttribute(G.FULLSCREEN_ELEMENT)&&this.removeAttribute(G.FULLSCREEN_ELEMENT),Es(this,aa,e),(t=de(this,_e))==null||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return ve(this,G.DEFAULT_SUBTITLES)}set defaultSubtitles(e){Ee(this,G.DEFAULT_SUBTITLES,e)}get defaultStreamType(){return Oe(this,G.DEFAULT_STREAM_TYPE)}set defaultStreamType(e){Ne(this,G.DEFAULT_STREAM_TYPE,e)}get defaultDuration(){return Pe(this,G.DEFAULT_DURATION)}set defaultDuration(e){We(this,G.DEFAULT_DURATION,e)}get noHotkeys(){return ve(this,G.NO_HOTKEYS)}set noHotkeys(e){Ee(this,G.NO_HOTKEYS,e)}get keysUsed(){return Oe(this,G.KEYS_USED)}set keysUsed(e){Ne(this,G.KEYS_USED,e)}get liveEdgeOffset(){return Pe(this,G.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){We(this,G.LIVE_EDGE_OFFSET,e)}get noAutoSeekToLive(){return ve(this,G.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(e){Ee(this,G.NO_AUTO_SEEK_TO_LIVE,e)}get noVolumePref(){return ve(this,G.NO_VOLUME_PREF)}set noVolumePref(e){Ee(this,G.NO_VOLUME_PREF,e)}get noMutedPref(){return ve(this,G.NO_MUTED_PREF)}set noMutedPref(e){Ee(this,G.NO_MUTED_PREF,e)}get noSubtitlesLangPref(){return ve(this,G.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(e){Ee(this,G.NO_SUBTITLES_LANG_PREF,e)}get noDefaultStore(){return ve(this,G.NO_DEFAULT_STORE)}set noDefaultStore(e){Ee(this,G.NO_DEFAULT_STORE,e)}attributeChangedCallback(e,t,s){var r,n,a,o,l,d,u,c,h,f,m;if(super.attributeChangedCallback(e,t,s),e===G.NO_HOTKEYS)s!==t&&s===""?(this.hasAttribute(G.HOTKEYS)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):s!==t&&s===null&&this.enableHotkeys();else if(e===G.HOTKEYS)de(this,dr).value=s;else if(e===G.DEFAULT_SUBTITLES&&s!==t)(r=de(this,_e))==null||r.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(G.DEFAULT_SUBTITLES)}});else if(e===G.DEFAULT_STREAM_TYPE)(a=de(this,_e))==null||a.dispatch({type:"optionschangerequest",detail:{defaultStreamType:(n=this.getAttribute(G.DEFAULT_STREAM_TYPE))!=null?n:void 0}});else if(e===G.LIVE_EDGE_OFFSET)(o=de(this,_e))==null||o.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?void 0:+this.getAttribute(G.LIVE_EDGE_OFFSET)}});else if(e===G.SEEK_TO_LIVE_OFFSET)(l=de(this,_e))==null||l.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(G.SEEK_TO_LIVE_OFFSET):void 0}});else if(e===G.NO_AUTO_SEEK_TO_LIVE)(d=de(this,_e))==null||d.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(G.NO_AUTO_SEEK_TO_LIVE)}});else if(e===G.FULLSCREEN_ELEMENT){const g=s?(u=this.getRootNode())==null?void 0:u.getElementById(s):void 0;Es(this,aa,g),(c=de(this,_e))==null||c.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===G.LANG&&s!==t?(Tk(s),(h=de(this,_e))==null||h.dispatch({type:"optionschangerequest",detail:{mediaLang:s}})):e===G.NO_VOLUME_PREF&&s!==t?(f=de(this,_e))==null||f.dispatch({type:"optionschangerequest",detail:{noVolumePref:this.hasAttribute(G.NO_VOLUME_PREF)}}):e===G.NO_MUTED_PREF&&s!==t&&((m=de(this,_e))==null||m.dispatch({type:"optionschangerequest",detail:{noMutedPref:this.hasAttribute(G.NO_MUTED_PREF)}}))}connectedCallback(){var e,t;!de(this,_e)&&!this.hasAttribute(G.NO_DEFAULT_STORE)&&ws(this,cl,qc).call(this),(e=de(this,_e))==null||e.dispatch({type:"documentelementchangerequest",detail:ot}),super.connectedCallback(),de(this,_e)&&!de(this,Ii)&&Es(this,Ii,(t=de(this,_e))==null?void 0:t.subscribe(de(this,oa))),this.hasAttribute(G.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}disconnectedCallback(){var e,t,s,r;(e=super.disconnectedCallback)==null||e.call(this),de(this,_e)&&((t=de(this,_e))==null||t.dis
254patch({type:"documentelementchangerequest",detail:void 0}),(s=de(this,_e))==null||s.dispatch({type:X.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})),de(this,Ii)&&((r=de(this,Ii))==null||r.call(this),Es(this,Ii,void 0))}mediaSetCallback(e){var t;super.mediaSetCallback(e),(t=de(this,_e))==null||t.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var t;super.mediaUnsetCallback(e),(t=de(this,_e))==null||t.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,t){Pg(this.mediaStateReceivers,e,t)}associateElement(e){if(!e)return;const{associatedElementSubscriptions:t}=this;if(t.has(e))return;const s=this.registerMediaStateReceiver.bind(this),r=this.unregisterMediaStateReceiver.bind(this),n=cD(e,s,r);Object.values(X).forEach(a=>{e.addEventListener(a,de(this,ul))}),t.set(e,n)}unassociateElement(e){if(!e)return;const{associatedElementSubscriptions:t}=this;if(!t.has(e))return;t.get(e)(),t.delete(e),Object.values(X).forEach(r=>{e.removeEventListener(r,de(this,ul))})}registerMediaStateReceiver(e){if(!e)return;const t=this.mediaStateReceivers;t.indexOf(e)>-1||(t.push(e),de(this,_e)&&Object.entries(de(this,_e).getState()).forEach(([r,n])=>{Pg([e],r,n)}))}unregisterMediaStateReceiver(e){const t=this.mediaStateReceivers,s=t.indexOf(e);s<0||t.splice(s,1)}enableHotkeys(){this.addEventListener("keydown",ws(this,hl,jc))}disableHotkeys(){this.removeEventListener("keydown",ws(this,hl,jc)),this.removeEventListener("keyup",ws(this,xn,qa))}get hotkeys(){return Oe(this,G.HOTKEYS)}set hotkeys(e){Ne(this,G.HOTKEYS,e)}keyboardShortcutHandler(e){var t,s,r,n,a,o,l;const d=e.target;if(((r=(s=(t=d.getAttribute(G.KEYS_USED))==null?void 0:t.split(" "))!=null?s:d?.keysUsed)!=null?r:[]).map(m=>m==="Space"?" ":m).filter(Boolean).includes(e.key))return;let c,h,f;if(!de(this,dr).contains(`no${e.key.toLowerCase()}`)&&!(e.key===" "&&de(this,dr).contains("nospace")))switch(e.key){case" ":case"k":c=de(this,_e).getState().mediaPaused?X.MEDIA_PLAY_REQUEST:X.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new k.CustomEvent(c,{composed:!0,bubbles:!0}));break;case"m":c=this.mediaStore.getState().mediaVolumeLevel==="off"?X.MEDIA_UNMUTE_REQUEST:X.MEDIA_MUTE_REQUEST,this.dispatchEvent(new k.CustomEvent(c,{composed:!0,bubbles:!0}));break;case"f":c=this.mediaStore.getState().mediaIsFullscreen?X.MEDIA_EXIT_FULLSCREEN_REQUEST:X.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new k.CustomEvent(c,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new k.CustomEvent(X.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":{const m=this.hasAttribute(G.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(G.KEYBOARD_BACKWARD_SEEK_OFFSET):Dg;h=Math.max(((n=this.mediaStore.getState().mediaCurrentTime)!=null?n:0)-m,0),f=new k.CustomEvent(X.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(f);break}case"ArrowRight":{const m=this.hasAttribute(G.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(G.KEYBOARD_FORWARD_SEEK_OFFSET):Dg;h=Math.max(((a=this.mediaStore.getState().mediaCurrentTime)!=null?a:0)+m,0),f=new k.CustomEvent(X.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(f);break}case"ArrowUp":{const m=this.hasAttribute(G.KEYBOARD_UP_VOLUME_STEP)?+this.getAttribute(G.KEYBOARD_UP_VOLUME_STEP):Cg;h=Math.min(((o=this.mediaStore.getState().mediaVolume)!=null?o:1)+m,1),f=new k.CustomEvent(X.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(f);break}case"ArrowDown":{const m=this.hasAttribute(G.KEYBOARD_DOWN_VOLUME_STEP)?+this.getAttribute(G.KEYBOARD_DOWN_VOLUME_STEP):Cg;h=Math.max(((l=this.mediaStore.getState().mediaVolume)!=null?l:1)-m,0),f=new k.CustomEvent(X.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(f);break}}}}dr=new WeakMap;aa=new WeakMap;_e=new WeakMap;oa=new WeakMap;Ii=new WeakMap;ul=new WeakMap;cl=new WeakSet;qc=function(){var i;this.mediaStore=nD({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(G.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(G.DEFAULT_DURATION)?+this.getAttribute(G.DEFAULT_DURATION):void 0,defaultStreamType:(i=this.getAttribute(G.DEFAULT_STREAM_TYPE))!=null?i:void 0,liveEdgeOffset:this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(G.SEEK_TO_LIVE_OFFSET):this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(G.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(G.NO_VOLUME_PREF),noMutedPref:this.hasAttribute(G.NO_MUTED_PREF),noSubtitlesLangPref:this.hasAttribute(G.NO_SUBTITLES_LANG_PREF)}})};xn=new WeakSet;qa=function(i){const{key:e}=i;if(!Oy.includes(e)){this.removeEventListener("keyup",ws(this,xn,qa));return}this.keyboardShortcutHandler(i)};hl=new WeakSet;jc=function(i){const{metaKey:e,altKey:t,key:s}=i;
254if(e||t||!Oy.includes(s)){this.removeEventListener("keyup",ws(this,xn,qa));return}const r=i.target,n=r instanceof HTMLElement&&(r.tagName.toLowerCase()==="media-volume-range"||r.tagName.toLowerCase()==="media-time-range");[" ","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(s)&&!(de(this,dr).contains(`no${s.toLowerCase()}`)||s===" "&&de(this,dr).contains("nospace"))&&!n&&i.preventDefault(),this.addEventListener("keyup",ws(this,xn,qa),{once:!0})};const aD=Object.values(_),oD=Object.values(oy),Uy=i=>{var e,t,s,r;let{observedAttributes:n}=i.constructor;!n&&((e=i.nodeName)!=null&&e.includes("-"))&&(k.customElements.upgrade(i),{observedAttributes:n}=i.constructor);const a=(r=(s=(t=i?.getAttribute)==null?void 0:t.call(i,Te.MEDIA_CHROME_ATTRIBUTES))==null?void 0:s.split)==null?void 0:r.call(s,/\s+/);return Array.isArray(n||a)?(n||a).filter(o=>aD.includes(o)):[]},lD=i=>{var e,t;return(e=i.nodeName)!=null&&e.includes("-")&&k.customElements.get((t=i.nodeName)==null?void 0:t.toLowerCase())&&!(i instanceof k.customElements.get(i.nodeName.toLowerCase()))&&k.customElements.upgrade(i),oD.some(s=>s in i)},zc=i=>lD(i)||!!Uy(i).length,wg=i=>{var e;return(e=i?.join)==null?void 0:e.call(i,":")},Mg={[_.MEDIA_SUBTITLES_LIST]:Ya,[_.MEDIA_SUBTITLES_SHOWING]:Ya,[_.MEDIA_SEEKABLE]:wg,[_.MEDIA_BUFFERED]:i=>i?.map(wg).join(" "),[_.MEDIA_PREVIEW_COORDS]:i=>i?.join(" "),[_.MEDIA_RENDITION_LIST]:uk,[_.MEDIA_AUDIO_TRACK_LIST]:mk},dD=async(i,e,t)=>{var s,r;if(i.isConnected||await uy(0),typeof t=="boolean"||t==null)return Ee(i,e,t);if(typeof t=="number")return We(i,e,t);if(typeof t=="string")return Ne(i,e,t);if(Array.isArray(t)&&!t.length)return i.removeAttribute(e);const n=(r=(s=Mg[e])==null?void 0:s.call(Mg,t))!=null?r:t;return i.setAttribute(e,n)},uD=i=>{var e;return!!((e=i.closest)!=null&&e.call(i,'*[slot="media"]'))},Xs=(i,e)=>{if(uD(i))return;const t=(r,n)=>{var a,o;zc(r)&&n(r);const{children:l=[]}=r??{},d=(o=(a=r?.shadowRoot)==null?void 0:a.children)!=null?o:[];[...l,...d].forEach(c=>Xs(c,n))},s=i?.nodeName.toLowerCase();if(s.includes("-")&&!zc(i)){k.customElements.whenDefined(s).then(()=>{t(i,e)});return}t(i,e)},Pg=(i,e,t)=>{i.forEach(s=>{if(e in s){s[e]=t;return}const r=Uy(s),n=e.toLowerCase();r.includes(n)&&dD(s,n,t)})},cD=(i,e,t)=>{Xs(i,e);const s=u=>{var c;const h=(c=u?.composedPath()[0])!=null?c:u.target;e(h)},r=u=>{var c;const h=(c=u?.composedPath()[0])!=null?c:u.target;t(h)};i.addEventListener(X.REGISTER_MEDIA_STATE_RECEIVER,s),i.addEventListener(X.UNREGISTER_MEDIA_STATE_RECEIVER,r);const n=u=>{u.forEach(c=>{const{addedNodes:h=[],removedNodes:f=[],type:m,target:g,attributeName:p}=c;m==="childList"?(Array.prototype.forEach.call(h,E=>Xs(E,e)),Array.prototype.forEach.call(f,E=>Xs(E,t))):m==="attributes"&&p===Te.MEDIA_CHROME_ATTRIBUTES&&(zc(g)?e(g):t(g))})};let a=[];const o=u=>{const c=u.target;c.name!=="media"&&(a.forEach(h=>Xs(h,t)),a=[...c.assignedElements({flatten:!0})],a.forEach(h=>Xs(h,e)))};i.addEventListener("slotchange",o);const l=new MutationObserver(n);return l.observe(i,{childList:!0,attributes:!0,subtree:!0}),()=>{Xs(i,t),i.removeEventListener("slotchange",o),l.disconnect(),i.removeEventListener(X.REGISTER_MEDIA_STATE_RECEIVER,s),i.removeEventListener(X.UNREGISTER_MEDIA_STATE_RECEIVER,r)}};k.customElements.get("media-controller")||k.customElements.define("media-controller",Ny);var hD=Ny;const Cr={PLACEMENT:"placement",BOUNDS:"bounds"};function fD(i){return` 255 <style> 256 :host { 257 --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7))); 258 --_tooltip-background: var(--media-tooltip-background, var(--_tooltip-background-color)); 259 --_tooltip-arrow-half-width: calc(var(--media-tooltip-arrow-width, 12px) / 2); 260 --_tooltip-arrow-height: var(--media-tooltip-arrow-height, 5px); 261 --_tooltip-arrow-background: var(--media-tooltip-arrow-color, var(--_tooltip-background-color)); 262 position: relative; 263 pointer-events: none; 264 display: var(--media-tooltip-display, inline-flex); 265 justify-content: center; 266 align-items: center; 267 box-sizing: border-box; 268 z-index: var(--media-tooltip-z-index, 1); 269 background: var(--_tooltip-background); 270 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 271 font: var(--media-font, 272 var(--media-font-weight, 400) 273 var(--media-font-size, 13px) / 274 var(--media-text-content-height, var(--media-control-height, 18px)) 275 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 276 padding: var(--media-tooltip-padding, .35em .7em); 277 border: var(--media-tooltip-border, none); 278 border-radius: var(--media-tooltip-border-radius, 5px); 279 filter: var(--media-tooltip-filter, drop-shadow(0 0 4px rgba(0, 0, 0, .2))); 280 white-space: var(--media-tooltip-white-space, nowrap); 281 } 282 283 :host([hidden]) { 284 display: none; 285 } 286 287 img, svg { 288 display: inline-block; 289 } 290 291 #arrow { 292 position: absolute; 293 width: 0px; 294 height: 0px; 295 border-style: solid; 296 display: var(--media-tooltip-arrow-display, block); 297 } 298 299 :host(:not([placement])), 300 :host([placement="top"]) { 301 position: absolute; 302 bottom: calc(100% + var(--media-tooltip-distance, 12px)); 303 left: 50%; 304 transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0
304); 305 } 306 :host(:not([placement])) #arrow, 307 :host([placement="top"]) #arrow { 308 top: 100%; 309 left: 50%; 310 border-width: var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width); 311 border-color: var(--_tooltip-arrow-background) transparent transparent transparent; 312 transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0); 313 } 314 315 :host([placement="right"]) { 316 position: absolute; 317 left: calc(100% + var(--media-tooltip-distance, 12px)); 318 top: 50%; 319 transform: translate(0, -50%); 320 } 321 :host([placement="right"]) #arrow { 322 top: 50%; 323 right: 100%; 324 border-width: var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0; 325 border-color: transparent var(--_tooltip-arrow-background) transparent transparent; 326 transform: translate(0, -50%); 327 } 328 329 :host([placement="bottom"]) { 330 position: absolute; 331 top: calc(100% + var(--media-tooltip-distance, 12px)); 332 left: 50%; 333 transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0); 334 } 335 :host([placement="bottom"]) #arrow { 336 bottom: 100%; 337 left: 50%; 338 border-width: 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width); 339 border-color: transparent transparent var(--_tooltip-arrow-background) transparent; 340 transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0); 341 } 342 343 :host([placement="left"]) { 344 position: absolute; 345 right: calc(100% + var(--media-tooltip-distance, 12px)); 346 top: 50%; 347 transform: translate(0, -50%); 348 } 349 :host([placement="left"]) #arrow { 350 top: 50%; 351 left: 100%; 352 border-width: var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height); 353 border-color: transparent transparent transparent var(--_tooltip-arrow-background); 354 transform: translate(0, -50%); 355 } 356 357 :host([placement="none"]) #arrow { 358 display: none; 359 } 360 </style> 361 <slot></slot> 362 <div id="arrow"></div> 363 `}class au extends k.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!yy(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;const t=this.placement;if(t==="left"||t==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}const s=getComputedStyle(this),r=(e=wn(this,"#"+this.bounds))!=null?e:kt(this);if(!r)return;const{x:n,width:a}=r.getBoundingClientRect(),{x:o,width:l}=this.getBoundingClientRect(),d=o+l,u=n+a,c=s.getPropertyValue("--media-tooltip-offset-x"),h=c?parseFloat(c.replace("px","")):0,f=s.getPropertyValue("--media-tooltip-container-margin"),m=f?parseFloat(f.replace("px","")):0,g=o-n+h-m,p=d-u+h+m;if(g<0){this.style.setProperty("--media-tooltip-offset-x",`${g}px`);return}if(p>0){this.style.setProperty("--media-tooltip-offset-x",`${p}px`);return}this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){const e=this.placement;delete this.placement,this.placement=e}}static get observedAttributes(){return[Cr.PLACEMENT,Cr.BOUNDS]}get placement(){return Oe(this,Cr.PLACEMENT)}set placement(e){Ne(this,Cr.PLACEMENT,e)}get bounds(){return Oe(this,Cr.BOUNDS)}set bounds(e){Ne(this,Cr.BOUNDS,e)}}au.shadowRootOptions={mode:"open"};au.getTemplateHTML=fD;k.customElements.get("media-tooltip")||k.customElements.define("media-tooltip",au);var Og=au,Bf=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Xe=(i,e,t)=>(Bf(i,e,"read from private field"),t?t.call(i):e.get(i)),wr=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Do=(i,e,t,s)=>(Bf(i,e,"write to private field"),e.set(i,t),t),mD=(i,e,t)=>(Bf(i,e,"access private method"),t),Li,an,Ms,Gr,fl,Qc,$y;const ys={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function pD(i,e={}){return` 364 <style> 365 :host { 366 position: relative; 367 font: var(--media-font, 368 var(--media-font-weight, bold) 369 var(--media-font-size, 14px) / 370 var(--media-text-content-height, var(--media-control-height, 24px)) 371 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 372 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 373 background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 374 padding: var(--media-button-padding, var(--media-control-padding, 10px)); 375 justify-content: var(--media-button-justify-content, center); 376 display: inline-flex; 377 align-items: center; 378 vertical-align: middle; 379 box-sizing: border-box; 380 transition: background .15s linear; 381 pointer-events: auto; 382 cursor: var(--media-cursor, pointer); 383 -webkit-tap-highlight-color: transparent; 384 } 385 386 387 :host(:focus-visible) {
388 box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 389 outline: 0; 390 } 391 392 :host(:where(:focus)) { 393 box-shadow: none; 394 outline: 0; 395 } 396 397 :host(:hover) { 398 background: var(--media-control-hover-background, rgba(50 50 70 / .7)); 399 } 400 401 svg, img, ::slotted(svg), ::slotted(img) { 402 width: var(--media-button-icon-width); 403 height: var(--media-button-icon-height, var(--media-control-height, 24px)); 404 transform: var(--media-button-icon-transform); 405 transition: var(--media-button-icon-transition); 406 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 407 vertical-align: middle; 408 max-width: 100%; 409 max-height: 100%; 410 min-width: 100%; 411 } 412 413 media-tooltip { 414 415 max-width: 0; 416 overflow-x: clip; 417 opacity: 0; 418 transition: opacity .3s, max-width 0s 9s; 419 } 420 421 :host(:hover) media-tooltip, 422 :host(:focus-visible) media-tooltip { 423 max-width: 100vw; 424 opacity: 1; 425 transition: opacity .3s; 426 } 427 428 :host([notooltip]) slot[name="tooltip"] { 429 display: none; 430 } 431 </style> 432 433 ${this.getSlotTemplateHTML(i,e)} 434 435 <slot name="tooltip"> 436 <media-tooltip part="tooltip" aria-hidden="true"> 437 <template shadowrootmode="${Og.shadowRootOptions.mode}"> 438 ${Og.getTemplateHTML({})} 439 </template> 440 <slot name="tooltip-content"> 441 ${this.getTooltipContentHTML(i)} 442 </slot> 443 </media-tooltip> 444 </slot> 445 `}function gD(i,e){return` 446 <slot></slot> 447 `}function vD(){return""}class Et extends k.HTMLElement{constructor(){if(super(),wr(this,Qc),wr(this,Li,void 0),this.preventClick=!1,this.tooltipEl=null,wr(this,an,e=>{this.preventClick||this.handleClick(e),setTimeout(Xe(this,Ms),0)}),wr(this,Ms,()=>{var e,t;(t=(e=this.tooltipEl)==null?void 0:e.updateXOffset)==null||t.call(e)}),wr(this,Gr,e=>{const{key:t}=e;if(!this.keysUsed.includes(t)){this.removeEventListener("keyup",Xe(this,Gr));return}this.preventClick||this.handleClick(e)}),wr(this,fl,e=>{const{metaKey:t,altKey:s,key:r}=e;if(t||s||!this.keysUsed.includes(r)){this.removeEventListener("keyup",Xe(this,Gr));return}this.addEventListener("keyup",Xe(this,Gr),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.tooltipEl=this.shadowRoot.querySelector("media-tooltip")}static get observedAttributes(){return["disabled",ys.TOOLTIP_PLACEMENT,Te.MEDIA_CONTROLLER,_.MEDIA_LANG]}enable(){this.addEventListener("click",Xe(this,an)),this.addEventListener("keydown",Xe(this,fl)),this.tabIndex=0}disable(){this.removeEventListener("click",Xe(this,an)),this.removeEventListener("keydown",Xe(this,fl)),this.removeEventListener("keyup",Xe(this,Gr)),this.tabIndex=-1}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Te.MEDIA_CONTROLLER?(t&&((n=(r=Xe(this,Li))==null?void 0:r.unassociateElement)==null||n.call(r,this),Do(this,Li,null)),s&&this.isConnected&&(Do(this,Li,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Xe(this,Li))==null?void 0:o.associateElement)==null||l.call(o,this))):e==="disabled"&&s!==t?s==null?this.enable():this.disable():e===ys.TOOLTIP_PLACEMENT&&this.tooltipEl&&s!==t?this.tooltipEl.placement=s:e===_.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),Xe(this,Ms).call(this)}connectedCallback(){var e,t,s;const{style:r}=et(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");const n=this.getAttribute(Te.MEDIA_CONTROLLER);n&&(Do(this,Li,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=Xe(this,Li))==null?void 0:t.associateElement)==null||s.call(t,this)),k.customElements.whenDefined("media-tooltip").then(()=>mD(this,Qc,$y).call(this))}disconnectedCallback(){var e,t;this.disable(),(t=(e=Xe(this,Li))==null?void 0:e.unassociateElement)==null||t.call(e,this),Do(this,Li,null),this.removeEventListener("mouseenter",Xe(this,Ms)),this.removeEventListener("focus",Xe(this,Ms)),this.removeEventListener("click",Xe(this,an))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return Oe(this,ys.TOOLTIP_PLACEMENT)}set tooltipPlacement(e){Ne(this,ys.TOOLTIP_PLACEMENT,e)}get mediaController(){return Oe(this,Te.MEDIA_CONTROLLER)}set mediaController(e){Ne(this,Te.MEDIA_CONTROLLER,e)}get disabled(){return ve(this,ys.DISABLED)}set disabled(e){Ee(this,ys.DISABLED,e)}get noTooltip(){return ve(this,ys.NO_TOOLTIP)}set noTooltip(e){Ee(this,ys.NO_TOOLTIP,e)}handleClick(e){}}Li=new WeakMap;an=new WeakMap;Ms=new WeakMap;Gr=new WeakMap;fl=new WeakMap;Qc=new WeakSet;$y=function(){this.addEventListener("mouseenter",Xe(this,Ms)),this.addEventListener("focus",Xe(this,Ms)),this.addEventListener("click",Xe(this,an));const i=this.tooltipPlacement;i&&this.tooltipEl&&(this.tooltipEl.placement=i)};Et.shadowRootOptions={mode:"open"};Et.getTemplateHTML=pD;Et.getSlotTemplateHTML=gD;Et.getTooltipContentHTML=vD;k.customElements.get("media-chrome-button")||k.customElements.define("media-chrome-button",Et);const Ng=`<svg aria-hidden="true" viewBox="0 0 26 24"> 448 <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"/> 449</svg> 450`;function ED(i){return` 451 <style> 452 :host([${_.MEDIA_IS_AIRPLAYING}]) slot[name=icon] slot:not([name=exit]) { 453 display: none !important; 454 } 455 456 457 :host(:not([${_.MEDIA_IS_AIRPLAYING}])) slot[name=icon] slot:not([name=enter]) { 458 display: none !important; 459 } 460 461 :host([${_.MEDIA_IS_AIRPLAYING}]) slot[name=tooltip-enter], 462 :host(:not([${_.MEDIA_IS_AIRPLAYING}])) slot[name=tooltip-exit] { 463 display: none; 464 } 465 </style> 466 467 <slot name="icon"> 468 <slot name="enter">${Ng}</slot> 469 <slot name="exit">${Ng}</slot> 470 </slot> 471 `}function yD(){return` 472 <slot name="tooltip-enter">${Z("start airplay")}</slot> 473 <slot name="tooltip-exit">${Z("stop airplay")}</slot> 474 `}const Ug=i=>{const e=i.mediaIsAirplaying?Z("stop airplay"):Z("start airplay");
474i.setAttribute("aria-label",e)};class Hf extends Et{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_AIRPLAYING,_.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Ug(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_AIRPLAYING&&Ug(this)}get mediaIsAirplaying(){return ve(this,_.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){Ee(this,_.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return Oe(this,_.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){Ne(this,_.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){const e=new k.CustomEvent(X.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}}Hf.getSlotTemplateHTML=ED;Hf.getTooltipContentHTML=yD;k.customElements.get("media-airplay-button")||k.customElements.define("media-airplay-button",Hf);const bD=`<svg aria-hidden="true" viewBox="0 0 26 24"> 475 <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"/> 476</svg>`,TD=`<svg aria-hidden="true" viewBox="0 0 26 24"> 477 <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"/> 478</svg>`;function _D(i){return` 479 <style> 480 :host([aria-checked="true"]) slot[name=off] { 481 display: none !important; 482 } 483 484 485 :host(:not([aria-checked="true"])) slot[name=on] { 486 display: none !important; 487 } 488 489 :host([aria-checked="true"]) slot[name=tooltip-enable], 490 :host(:not([aria-checked="true"])) slot[name=tooltip-disable] { 491 display: none; 492 } 493 </style> 494 495 <slot name="icon"> 496 <slot name="on">${bD}</slot> 497 <slot name="off">${TD}</slot> 498 </slot> 499 `}function AD(){return` 500 <slot name="tooltip-enable">${Z("Enable captions")}</slot> 501 <slot name="tooltip-disable">${Z("Disable captions")}</slot> 502 `}const $g=i=>{i.setAttribute("aria-checked",Dy(i).toString())};class Gf extends Et{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_SUBTITLES_LIST,_.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",Z("closed captions")),$g(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_SUBTITLES_SHOWING&&$g(this)}get mediaSubtitlesList(){return Fg(this,_.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){Bg(this,_.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return Fg(this,_.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){Bg(this,_.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new k.CustomEvent(X.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}}Gf.getSlotTemplateHTML=_D;Gf.getTooltipContentHTML=AD;const Fg=(i,e)=>{const t=i.getAttribute(e);return t?ru(t):[]},Bg=(i,e,t)=>{if(!t?.length){i.removeAttribute(e);return}const s=Ya(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};k.customElements.get("media-captions-button")||k.customElements.define("media-captions-button",Gf);const SD='<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>',ID='<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>';function LD(i){return` 503 <style> 504 :host([${_.MEDIA_IS_CASTING}]) slot[name=icon] slot:not([name=exit]) { 505 display: none !important; 506 } 507 508 509 :host(:not([${_.MEDIA_IS_CASTING}])) slot[name=icon] slot:not([name=enter]) { 510 display: none !important; 511 } 512 513 :host([${_.MEDIA_IS_CASTING}]) slot[name=tooltip-enter], 514 :host(:not([${_.MEDIA_IS_CASTING}])) slot[name=tooltip-exit] { 515 display: none; 516 } 517 </style> 518 519 <slot name="icon"> 520 <slot name="enter">${SD}</slot> 521 <slot name="exit">${ID}</slot> 522 </slot> 523 `}function RD(){return` 524 <slot name="tooltip-enter">${Z("Start casting")}</slot> 525 <slot name="tooltip-exit">${Z("Stop casting")}</slot> 526 `}const Hg=i=>{const e=i.mediaIsCasting?Z("stop casting"):Z("start casting");i.setAttribute("aria-label",e)};
526class Kf extends Et{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_CASTING,_.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Hg(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_CASTING&&Hg(this)}get mediaIsCasting(){return ve(this,_.MEDIA_IS_CASTING)}set mediaIsCasting(e){Ee(this,_.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return Oe(this,_.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){Ne(this,_.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){const e=this.mediaIsCasting?X.MEDIA_EXIT_CAST_REQUEST:X.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Kf.getSlotTemplateHTML=LD;Kf.getTooltipContentHTML=RD;k.customElements.get("media-cast-button")||k.customElements.define("media-cast-button",Kf);var Vf=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},mr=(i,e,t)=>(Vf(i,e,"read from private field"),e.get(i)),Ji=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Wf=(i,e,t,s)=>(Vf(i,e,"write to private field"),e.set(i,t),t),Ys=(i,e,t)=>(Vf(i,e,"access private method"),t),Ld,ja,br,ml,Xc,Zc,Fy,Jc,By,eh,Hy,th,Gy,ih,Ky;function xD(i){return` 527 <style> 528 :host { 529 font: var(--media-font, 530 var(--media-font-weight, normal) 531 var(--media-font-size, 14px) / 532 var(--media-text-content-height, var(--media-control-height, 24px)) 533 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 534 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 535 display: var(--media-dialog-display, inline-flex); 536 justify-content: center; 537 align-items: center; 538 539 transition-behavior: allow-discrete; 540 visibility: hidden; 541 opacity: 0; 542 transform: translateY(2px) scale(.99); 543 pointer-events: none; 544 } 545 546 :host([open]) { 547 transition: display .2s, visibility 0s, opacity .2s ease-out, transform .15s ease-out; 548 visibility: visible; 549 opacity: 1; 550 transform: translateY(0) scale(1); 551 pointer-events: auto; 552 } 553 554 #content { 555 display: flex; 556 position: relative; 557 box-sizing: border-box; 558 width: min(320px, 100%); 559 word-wrap: break-word; 560 max-height: 100%; 561 overflow: auto; 562 text-align: center; 563 line-height: 1.4; 564 } 565 </style> 566 ${this.getSlotTemplateHTML(i)} 567 `}function kD(i){return` 568 <slot id="content"></slot> 569 `}const Bn={OPEN:"open",ANCHOR:"anchor"};class ro extends k.HTMLElement{constructor(){super(),Ji(this,ml),Ji(this,Zc),Ji(this,Jc),Ji(this,eh),Ji(this,th),Ji(this,ih),Ji(this,Ld,!1),Ji(this,ja,null),Ji(this,br,null),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[Bn.OPEN,Bn.ANCHOR]}get open(){return ve(this,Bn.OPEN)}set open(e){Ee(this,Bn.OPEN,e)}handleEvent(e){switch(e.type){case"invoke":Ys(this,eh,Hy).call(this,e);break;case"focusout":Ys(this,th,Gy).call(this,e);break;case"keydown":Ys(this,ih,Ky).call(this,e);break}}connectedCallback(){Ys(this,ml,Xc).call(this),this.role||(this.role="dialog")}attributeChangedCallback(e,t,s){Ys(this,ml,Xc).call(this),e===Bn.OPEN&&s!==t&&(this.open?Ys(this,Zc,Fy).call(this):Ys(this,Jc,By).call(this))}focus(){Wf(this,ja,Mf());const e=!this.dispatchEvent(new Event("focus",{composed:!0,cancelable:!0})),t=!this.dispatchEvent(new Event("focusin",{composed:!0,bubbles:!0,cancelable:!0}));if(e||t)return;const s=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');s?.focus()}get keysUsed(){return["Escape","Tab"]}}Ld=new WeakMap;ja=new WeakMap;br=new WeakMap;ml=new WeakSet;Xc=function(){if(!mr(this,Ld)&&(Wf(this,Ld,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);const i=Vt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i),queueMicrotask(()=>{const{style:e}=et(this.shadowRoot,":host");e.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")})}};Zc=new WeakSet;Fy=function(){var i;(i=mr(this,br))==null||i.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",()=>this.focus(),{once:!0})};Jc=new WeakSet;By=function(){var i;
vendor: 4,976 bytes, lines 569-689
569(i=mr(this,br))==null||i.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))};eh=new WeakSet;Hy=function(i){Wf(this,br,i.relatedTarget),fs(this,i.relatedTarget)||(this.open=!this.open)};th=new WeakSet;Gy=function(i){var e;fs(this,i.relatedTarget)||((e=mr(this,ja))==null||e.focus(),mr(this,br)&&mr(this,br)!==i.relatedTarget&&this.open&&(this.open=!1))};ih=new WeakSet;Ky=function(i){var e,t,s,r,n;const{key:a,ctrlKey:o,altKey:l,metaKey:d}=i;o||l||d||this.keysUsed.includes(a)&&(i.preventDefault(),i.stopPropagation(),a==="Tab"?(i.shiftKey?(t=(e=this.previousElementSibling)==null?void 0:e.focus)==null||t.call(e):(r=(s=this.nextElementSibling)==null?void 0:s.focus)==null||r.call(s),this.blur()):a==="Escape"&&((n=mr(this,ja))==null||n.focus(),this.open=!1))};ro.shadowRootOptions={mode:"open"};ro.getTemplateHTML=xD;ro.getSlotTemplateHTML=kD;k.customElements.get("media-chrome-dialog")||k.customElements.define("media-chrome-dialog",ro);var Yf=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Fe=(i,e,t)=>(Yf(i,e,"read from private field"),t?t.call(i):e.get(i)),ft=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},_s=(i,e,t,s)=>(Yf(i,e,"write to private field"),e.set(i,t),t),ui=(i,e,t)=>(Yf(i,e,"access private method"),t),Ri,ou,pl,gl,ci,Rd,vl,El,yl,qf,Vy,bl,sh,Tl,rh,xd,jf,nh,Wy,ah,Yy,oh,qy,lh,jy;function DD(i){return` 570 <style> 571 :host { 572 --_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 573 --_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px)); 574 575 box-shadow: var(--_focus-visible-box-shadow, none); 576 background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 577 height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding)); 578 display: inline-flex; 579 align-items: center; 580 581 vertical-align: middle; 582 box-sizing: border-box; 583 position: relative; 584 width: 100px; 585 transition: background .15s linear; 586 cursor: var(--media-cursor, pointer); 587 pointer-events: auto; 588 touch-action: none; 589 } 590 591 592 input[type=range]:focus { 593 outline: 0; 594 } 595 input[type=range]:focus::-webkit-slider-runnable-track { 596 outline: 0; 597 } 598 599 :host(:hover) { 600 background: var(--media-control-hover-background, rgb(50 50 70 / .7)); 601 } 602 603 #leftgap { 604 padding-left: var(--media-range-padding-left, var(--_media-range-padding)); 605 } 606 607 #rightgap { 608 padding-right: var(--media-range-padding-right, var(--_media-range-padding)); 609 } 610 611 #startpoint, 612 #endpoint { 613 position: absolute; 614 } 615 616 #endpoint { 617 right: 0; 618 } 619 620 #container { 621 622 width: var(--media-range-track-width, 100%); 623 transform: translate(var(--media-range-track-translate-x, 0px), var(--media-range-track-translate-y, 0px)); 624 position: relative; 625 height: 100%; 626 display: flex; 627 align-items: center; 628 min-width: 40px; 629 } 630 631 #range { 632 633 display: var(--media-time-range-hover-display, block); 634 bottom: var(--media-time-range-hover-bottom, -7px); 635 height: var(--media-time-range-hover-height, max(100% + 7px, 25px)); 636 width: 100%; 637 position: absolute; 638 cursor: var(--media-cursor, pointer); 639 640 -webkit-appearance: none; 641 -webkit-tap-highlight-color: transparent; 642 background: transparent; 643 margin: 0; 644 z-index: 1; 645 } 646 647 @media (hover: hover) { 648 #range { 649 bottom: var(--media-time-range-hover-bottom, -5px); 650 height: var(--media-time-range-hover-height, max(100% + 5px, 20px)); 651 } 652 } 653 654 655 656 #range::-webkit-slider-thumb { 657 -webkit-appearance: none; 658 background: transparent; 659 width: .1px; 660 height: .1px; 661 } 662 663 664 #range::-moz-range-thumb { 665 background: transparent; 666 border: transparent; 667 width: .1px; 668 height: .1px; 669 } 670 671 #appearance { 672 height: var(--media-range-track-height, 4px); 673 display: flex; 674 flex-direction: column; 675 justify-content: center; 676 width: 100%; 677 position: absolute; 678 679 will-change: transform; 680 } 681 682 #track { 683 background: var(--media-range-track-background, rgb(255 255 255 / .2)); 684 border-radius: var(--media-range-track-border-radius, 1px); 685 border: var(--media-range-track-border, none); 686 outline: var(--media-range-track-outline); 687 outline-offset: var(--media-range-track-outline-offset); 688 backdrop-filter: var(--media-range-track-backdrop-filter); 689 -webkit-backdrop-filter: var(--media-range-track-backdrop-filter);
690 box-shadow: var(--media-range-track-box-shadow, none); 691 position: absolute; 692 width: 100%; 693 height: 100%; 694 overflow: hidden; 695 } 696 697 #progress, 698 #pointer { 699 position: absolute; 700 height: 100%; 701 will-change: width; 702 } 703 704 #progress { 705 background: var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238))); 706 transition: var(--media-range-track-transition); 707 } 708 709 #pointer { 710 background: var(--media-range-track-pointer-background); 711 border-right: var(--media-range-track-pointer-border-right); 712 transition: visibility .25s, opacity .25s; 713 visibility: hidden; 714 opacity: 0; 715 } 716 717 @media (hover: hover) { 718 :host(:hover) #pointer { 719 transition: visibility .5s, opacity .5s; 720 visibility: visible; 721 opacity: 1; 722 } 723 } 724 725 #thumb, 726 ::slotted([slot=thumb]) { 727 width: var(--media-range-thumb-width, 10px); 728 height: var(--media-range-thumb-height, 10px); 729 transition: var(--media-range-thumb-transition); 730 transform: var(--media-range-thumb-transform, none); 731 opacity: var(--media-range-thumb-opacity, 1); 732 translate: -50%; 733 position: absolute; 734 left: 0; 735 cursor: var(--media-cursor, pointer); 736 } 737 738 #thumb { 739 border-radius: var(--media-range-thumb-border-radius, 10px); 740 background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238))); 741 box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent); 742 border: var(--media-range-thumb-border, none); 743 } 744 745 :host([disabled]) #thumb { 746 background-color: #777; 747 } 748 749 .segments #appearance { 750 height: var(--media-range-segment-hover-height, 7px); 751 } 752 753 #track { 754 clip-path: url(#segments-clipping); 755 } 756 757 #segments { 758 --segments-gap: var(--media-range-segments-gap, 2px); 759 position: absolute; 760 width: 100%; 761 height: 100%; 762 } 763 764 #segments-clipping { 765 transform: translateX(calc(var(--segments-gap) / 2)); 766 } 767 768 #segments-clipping:empty { 769 display: none; 770 } 771 772 #segments-clipping rect { 773 height: var(--media-range-track-height, 4px); 774 y: calc((var(--media-range-segment-hover-height, 7px) - var(--media-range-track-height, 4px)) / 2); 775 transition: var(--media-range-segment-transition, transform .1s ease-in-out); 776 transform: var(--media-range-segment-transform, scaleY(1)); 777 transform-origin: center; 778 } 779 </style> 780 <div id="leftgap"></div> 781 <div id="container"> 782 <div id="startpoint"></div> 783 <div id="endpoint"></div> 784 <div id="appearance"> 785 <div id="track" part="track"> 786 <div id="pointer"></div> 787 <div id="progress" part="progress"></div> 788 </div> 789 <slot name="thumb"> 790 <div id="thumb" part="thumb"></div> 791 </slot> 792 <svg id="segments"><clipPath id="segments-clipping"></clipPath></svg> 793 </div>
794 <input id="range" type="range" min="0" max="1" step="any" value="0"> 795 </div> 796 <div id="rightgap"></div> 797 `}class Mn extends k.HTMLElement{constructor(){if(super(),ft(this,qf),ft(this,bl),ft(this,Tl),ft(this,xd),ft(this,nh),ft(this,ah),ft(this,oh),ft(this,lh),ft(this,Ri,void 0),ft(this,ou,void 0),ft(this,pl,void 0),ft(this,gl,void 0),ft(this,ci,{}),ft(this,Rd,[]),ft(this,vl,()=>{if(this.range.matches(":focus-visible")){const{style:e}=et(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),ft(this,El,()=>{const{style:e}=et(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")}),ft(this,yl,()=>{const e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.container=this.shadowRoot.querySelector("#container"),_s(this,pl,this.shadowRoot.querySelector("#startpoint")),_s(this,gl,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",Te.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Te.MEDIA_CONTROLLER?(t&&((n=(r=Fe(this,Ri))==null?void 0:r.unassociateElement)==null||n.call(r,this),_s(this,Ri,null)),s&&this.isConnected&&(_s(this,Ri,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Fe(this,Ri))==null?void 0:o.associateElement)==null||l.call(o,this))):(e==="disabled"||e==="aria-disabled"&&t!==s)&&(s==null?(this.range.removeAttribute(e),ui(this,bl,sh).call(this)):(this.range.setAttribute(e,s),ui(this,Tl,rh).call(this)))}connectedCallback(){var e,t,s;const{style:r}=et(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),Fe(this,ci).pointer=et(this.shadowRoot,"#pointer"),Fe(this,ci).progress=et(this.shadowRoot,"#progress"),Fe(this,ci).thumb=et(this.shadowRoot,'#thumb, ::slotted([slot="thumb"])'),Fe(this,ci).activeSegment=et(this.shadowRoot,"#segments-clipping rect:nth-child(0)");const n=this.getAttribute(Te.MEDIA_CONTROLLER);n&&(_s(this,Ri,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=Fe(this,Ri))==null?void 0:t.associateElement)==null||s.call(t,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",Fe(this,vl)),this.shadowRoot.addEventListener("focusout",Fe(this,El)),ui(this,bl,sh).call(this),In(this.container,Fe(this,yl))}disconnectedCallback(){var e,t;ui(this,Tl,rh).call(this),(t=(e=Fe(this,Ri))==null?void 0:e.unassociateElement)==null||t.call(e,this),_s(this,Ri,null),this.shadowRoot.removeEventListener("focusin",Fe(this,vl)),this.shadowRoot.removeEventListener("focusout",Fe(this,El)),Ln(this.container,Fe(this,yl))}updatePointerBar(e){var t;(t=Fe(this,ci).pointer)==null||t.style.setProperty("width",`${this.getPointerRatio(e)*100}%`)}updateBar(){var e,t;const s=this.range.valueAsNumber*100;(e=Fe(this,ci).progress)==null||e.style.setProperty("width",`${s}%`),(t=Fe(this,ci).thumb)==null||t.style.setProperty("left",`${s}%`)}updateSegments(e){const t=this.shadowRoot.querySelector("#segments-clipping");if(t.textContent="",this.container.classList.toggle("segments",!!e?.length),!e?.length)return;const s=[...new Set([+this.range.min,...e.flatMap(n=>[n.start,n.end]),+this.range.max])];_s(this,Rd,[...s]);const r=s.pop();for(const[n,a]of s.entries()){const[o,l]=[n===0,n===s.length-1],d=o?"calc(var(--segments-gap) / -1)":`${a*100}%`,c=`calc(${((l?r:s[n+1])-a)*100}%${o||l?"":" - var(--segments-gap)"})`,h=ot.createElementNS("http://www.w3.org/2000/svg","rect"),f=et(this.shadowRoot,`#segments-clipping rect:nth-child(${n+1})`);f.style.setProperty("x",d),f.style.setProperty("width",c),t.append(h)}}getPointerRatio(e){return Ik(e.clientX,e.clientY,Fe(this,pl).getBoundingClientRect(),Fe(this,gl).getBoundingClientRect())}get dragging(){return this.hasAttribute("dragging")}handleEvent(e){switch(e.type){case"pointermove":ui(this,lh,jy).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":ui(this,nh,Wy).call(this,e);break;case"pointerdown":ui(this,xd,jf).call(this,e);break;case"pointerup":ui(this,ah,Yy).call(this);break;case"pointerleave":ui(this,oh,qy).call(this);break}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}}Ri=new WeakMap;ou=new WeakMap;pl=new WeakMap;gl=new WeakMap;ci=new WeakMap;Rd=new WeakMap;vl=new WeakMap;El=new WeakMap;yl=new WeakMap;qf=new WeakSet;Vy=function(i){const e=Fe(this,ci).activeSegment;if(!e)return;const t=this.getPointerRatio(i),r=`#segments-clipping rect:nth-child(${Fe(this,Rd).findIndex((n,a,o)=>{const l=o[a+1];return l!=null&&t>=n&&t<=l})+1})`;(e.selectorText!=r||!e.style.transform)&&(e.selectorText=r,e.style.setProperty("transform","var(--media-range-segment-hover-transform, scaleY(2))"))};bl=new WeakSet;sh=function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))};Tl=new WeakSet;rh=function(){var i,e;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),(i=k.window)==null||i.removeEventListener("pointerup",this),(e=k.window)==null||e.removeEventListener("pointermove",this)};xd=new WeakSet;jf=function(i){var e;_s(this,ou,i.composedPath().includes(this.range)),(e=k.window)==null||e.addEventListener("pointerup",this)};nh=new WeakSet;Wy=function(i){var e;i.pointerType!=="mouse"&&ui(this,xd,jf).call(this,i),this.addEventListener("pointerleave",this),(e=k.window)==null||e.addEventListener("pointermove",this)};ah=new WeakSet;Yy=function(){var i;(i=k.window)==null||i.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")};oh=new WeakSet;qy=function(){var i,e;this.removeEventListener("pointerleave",this),(i=k.window)==null||i.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),(e=Fe(this,ci).activeSegment)==null||e.style.removeProperty("transform")};lh=new WeakSet;jy=function(i){i.pointerType==="pen"&&i.buttons===0||(this.toggleAttribute("dragging",i.buttons===1||i.pointerType!=="mouse"),this.updatePointerBar(i),ui(this,qf,Vy).call(this,i),this.dragging&&(i.pointerType!=="mouse"||!Fe(this,ou))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(i),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))))};Mn.shadowRootOptions={mode:"open"};Mn.getTemplateHTML=DD;k.customElements.get("media-chrome-range")||k.customElements.define("media-chrome-range",Mn);var zy=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Co=(i,e,t)=>(zy(i,e,"read from private field"),t?t.call(i):e.get(i)),CD=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},wo=(i,e,t,s)=>(zy(i,e,"write to private field"),e.set(i,t),t),xi;function wD(i){return` 798 <style> 799 :host { 800 801 box-sizing: border-box; 802 display: var(--media-control-display, var(--media-control-bar-display, inline-flex)); 803 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 804 --media-loading-indicator-icon-height: 44px; 805 } 806 807 ::slotted(media-time-range), 808 ::slotted(media-volume-range) { 809 min-height: 100%; 810 } 811 812 ::slotted(media-time-range), 813 ::slotted(media-clip-selector) { 814 flex-grow: 1; 815 } 816 817 ::slotted([role="menu"]) { 818 position: absolute; 819 } 820 </style> 821 822 <slot></slot> 823 `}class zf extends k.HTMLElement{constructor(){if(super(),CD(this,xi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Te.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Te.MEDIA_CONTROLLER&&(t&&((n=(r=Co(this,xi))==null?void 0:r.unassociateElement)==null||n.call(r,this),wo(this,xi,null)),s&&this.isConnected&&(wo(this,xi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Co(this,xi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const r=this.getAttribute(Te.MEDIA_CONTROLLER);r&&(wo(this,xi,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=Co(this,xi))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Co(this,xi))==null?void 0:e.unassociateElement)==null||t.call(e,this),wo(this,xi,null)}}xi=new WeakMap;zf.shadowRootOptions={mode:"open"};zf.getTemplateHTML=wD;k.customElements.get("media-control-bar")||k.customElements.define("media-control-bar",zf);var Qy=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Mo=(i,e,t)=>(Qy(i,e,"read from private field"),t?t.call(i):e.get(i)),MD=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Po=(i,e,t,s)=>(Qy(i,e,"write to private field"),e.set(i,t),t),ki;function PD(i,e={}){return` 824 <style> 825 :host { 826 font: var(--media-font, 827 var(--media-font-weight, normal) 828 var(--media-font-size, 14px) / 829 var(--media-text-content-height, var(--media-control-height, 24px)) 830 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 831 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 832 background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)))); 833 padding: var(--media-control-padding, 10px); 834 display: inline-flex; 835 justify-content: center; 836 align-items: center; 837 vertical-align: middle; 838 box-sizing: border-box; 839 text-align: center; 840 pointer-events: auto; 841 } 842 843 844 :host(:focus-visible) { 845 box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9); 846 outline: 0; 847 } 848 849 850 :host(:where(:focus)) { 851 box-shadow: none; 852 outline: 0; 853 } 854 </style> 855
856 ${this.getSlotTemplateHTML(i,e)} 857 `}function OD(i,e){return` 858 <slot></slot> 859 `}class Bs extends k.HTMLElement{constructor(){if(super(),MD(this,ki,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Te.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Te.MEDIA_CONTROLLER&&(t&&((n=(r=Mo(this,ki))==null?void 0:r.unassociateElement)==null||n.call(r,this),Po(this,ki,null)),s&&this.isConnected&&(Po(this,ki,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Mo(this,ki))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const{style:r}=et(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);const n=this.getAttribute(Te.MEDIA_CONTROLLER);n&&(Po(this,ki,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=Mo(this,ki))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Mo(this,ki))==null?void 0:e.unassociateElement)==null||t.call(e,this),Po(this,ki,null)}}ki=new WeakMap;Bs.shadowRootOptions={mode:"open"};Bs.getTemplateHTML=PD;Bs.getSlotTemplateHTML=OD;k.customElements.get("media-text-display")||k.customElements.define("media-text-display",Bs);var Xy=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Gg=(i,e,t)=>(Xy(i,e,"read from private field"),t?t.call(i):e.get(i)),ND=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},UD=(i,e,t,s)=>(Xy(i,e,"write to private field"),e.set(i,t),t),la;function $D(i,e){return` 860 <slot>${Ns(e.mediaDuration)}</slot> 861 `}class Zy extends Bs{constructor(){var e;super(),ND(this,la,void 0),UD(this,la,this.shadowRoot.querySelector("slot")),Gg(this,la).textContent=Ns((e=this.mediaDuration)!=null?e:0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_DURATION]}attributeChangedCallback(e,t,s){e===_.MEDIA_DURATION&&(Gg(this,la).textContent=Ns(+s)),super.attributeChangedCallback(e,t,s)}get mediaDuration(){return Pe(this,_.MEDIA_DURATION)}set mediaDuration(e){We(this,_.MEDIA_DURATION,e)}}la=new WeakMap;Zy.getSlotTemplateHTML=$D;k.customElements.get("media-duration-display")||k.customElements.define("media-duration-display",Zy);const FD={2:Z("Network Error"),3:Z("Decode Error"),4:Z("Source Not Supported"),5:Z("Encryption
861Error")},BD={2:Z("A network error caused the media download to fail."),3:Z("A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format."),4:Z("An unsupported error occurred. The server or network failed, or your browser does not support this format."),5:Z("The media is encrypted and there are no keys to decrypt it.")},Jy=i=>{var e,t;return i.code===1?null:{title:(e=FD[i.code])!=null?e:`Error ${i.code}`,message:(t=BD[i.code])!=null?t:i.message}};var eb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},HD=(i,e,t)=>(eb(i,e,"read from private field"),t?t.call(i):e.get(i)),GD=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},KD=(i,e,t,s)=>(eb(i,e,"write to private field"),e.set(i,t),t),_l;function VD(i){return` 862 <style> 863 :host { 864 background: rgb(20 20 30 / .8); 865 } 866 867 #content { 868 display: block; 869 padding: 1.2em 1.5em; 870 } 871 872 h3, 873 p { 874 margin-block: 0 .3em; 875 } 876 </style> 877 <slot name="error-${i.mediaerrorcode}" id="content"> 878 ${tb({code:+i.mediaerrorcode,message:i.mediaerrormessage})} 879 </slot> 880 `}function WD(i){return i.code&&Jy(i)!==null}function tb(i){var e;const{title:t,message:s}=(e=Jy(i))!=null?e:{};let r="";return t&&(r+=`<slot name="error-${i.code}-title"><h3>${t}</h3></slot>`),s&&(r+=`<slot name="error-${i.code}-message"><p>${s}</p></slot>`),r}const Kg=[_.MEDIA_ERROR_CODE,_.MEDIA_ERROR_MESSAGE];class lu extends ro{constructor(){super(...arguments),GD(this,_l,null)}static get observedAttributes(){return[...super.observedAttributes,...Kg]}formatErrorMessage(e){return this.constructor.formatErrorMessage(e)}attributeChangedCallback(e,t,s){var r;if(super.attributeChangedCallback(e,t,s),!Kg.includes(e))return;const n=(r=this.mediaError)!=null?r:{code:this.mediaErrorCode,message:this.mediaErrorMessage};this.open=WD(n),this.open&&(this.shadowRoot.querySelector("slot").name=`error-${this.mediaErrorCode}`,this.shadowRoot.querySelector("#content").innerHTML=this.formatErrorMessage(n))}get mediaError(){return HD(this,_l)}set mediaError(e){KD(this,_l,e)}get mediaErrorCode(){return Pe(this,"mediaerrorcode")}set mediaErrorCode(e){We(this,"mediaerrorcode",e)}get mediaErrorMessage(){return Oe(this,"mediaerrormessage")}set mediaErrorMessage(e){Ne(this,"mediaerrormessage",e)}}_l=new WeakMap;lu.getSlotTemplateHTML=VD;lu.formatErrorMessage=tb;k.customElements.get("media-error-dialog")||k.customElements.define("media-error-dialog",lu);var ib=lu,sb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},YD=(i,e,t)=>(sb(i,e,"read from private field"),e.get(i)),qD=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},jD=(i,e,t,s)=>(sb(i,e,"write to private field"),e.set(i,t),t),Al;const zD=`<svg aria-hidden="true" viewBox="0 0 26 24"> 881 <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/> 882</svg>`,QD=`<svg aria-hidden="true" viewBox="0 0 26 24"> 883 <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/> 884</svg>`;function XD(i){return` 885 <style> 886 :host([${_.MEDIA_IS_FULLSCREEN}]) slot[name=icon] slot:not([name=exit]) { 887 display: none !important; 888 } 889 890 891 :host(:not([${_.MEDIA_IS_FULLSCREEN}])) slot[name=icon] slot:not([name=enter]) { 892 display: none !important; 893 } 894 895 :host([${_.MEDIA_IS_FULLSCREEN}]) slot[name=tooltip-enter], 896 :host(:not([${_.MEDIA_IS_FULLSCREEN}])) slot[name=tooltip-exit] { 897 display: none; 898 } 899 </style> 900 901 <slot name="icon"> 902 <slot name="enter">${zD}</slot> 903 <slot name="exit">${QD}</slot> 904 </slot> 905 `}function ZD(){return` 906 <slot name="tooltip-enter">${Z("Enter fullscreen mode")}</slot> 907 <slot name="tooltip-exit">${Z("Exit fullscreen mode")}</slot> 908 `}const Vg=i=>{const e=i.mediaIsFullscreen?Z("exit fullscreen mode"):Z("enter fullscreen mode");i.setAttribute("aria-label",e)};
908class Qf extends Et{constructor(){super(...arguments),qD(this,Al,null)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_FULLSCREEN,_.MEDIA_FULLSCREEN_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Vg(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_FULLSCREEN&&Vg(this)}get mediaFullscreenUnavailable(){return Oe(this,_.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(e){Ne(this,_.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return ve(this,_.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){Ee(this,_.MEDIA_IS_FULLSCREEN,e)}handleClick(e){jD(this,Al,e);const t=YD(this,Al)instanceof PointerEvent,s=this.mediaIsFullscreen?new k.CustomEvent(X.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0}):new k.CustomEvent(X.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(s)}}Al=new WeakMap;Qf.getSlotTemplateHTML=XD;Qf.getTooltipContentHTML=ZD;k.customElements.get("media-fullscreen-button")||k.customElements.define("media-fullscreen-button",Qf);const{MEDIA_TIME_IS_LIVE:Sl,MEDIA_PAUSED:La}=_,{MEDIA_SEEK_TO_LIVE_REQUEST:JD,MEDIA_PLAY_REQUEST:eC}=X,tC='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>';function iC(i){return` 909 <style> 910 :host { --media-tooltip-display: none; } 911 912 slot[name=indicator] > *, 913 :host ::slotted([slot=indicator]) { 914 915 min-width: auto; 916 fill: var(--media-live-button-icon-color, rgb(140, 140, 140)); 917 color: var(--media-live-button-icon-color, rgb(140, 140, 140)); 918 } 919 920 :host([${Sl}]:not([${La}])) slot[name=indicator] > *, 921 :host([${Sl}]:not([${La}])) ::slotted([slot=indicator]) { 922 fill: var(--media-live-button-indicator-color, rgb(255, 0, 0)); 923 color: var(--media-live-button-indicator-color, rgb(255, 0, 0)); 924 } 925 926 :host([${Sl}]:not([${La}])) { 927 cursor: var(--media-cursor, not-allowed); 928 } 929 930 slot[name=text]{ 931 text-transform: uppercase; 932 } 933 934 </style> 935 936 <slot name="indicator">${tC}</slot> 937 938 <slot name="spacer"> </slot><slot name="text">${Z("live")}</slot> 939 `}const Wg=i=>{var e;const t=i.mediaPaused||!i.mediaTimeIsLive,s=Z(t?"seek to live":"playing live");i.setAttribute("aria-label",s);const r=(e=i.shadowRoot)==null?void 0:e.querySelector('slot[name="text"]');r&&(r.textContent=Z("live")),t?i.removeAttribute("aria-disabled"):i.setAttribute("aria-disabled","true")};class rb extends Et{static get observedAttributes(){return[...super.observedAttributes,Sl,La]}connectedCallback(){super.connectedCallback(),Wg(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),Wg(this)}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return ve(this,_.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){Ee(this,_.MEDIA_TIME_IS_LIVE,e)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new k.CustomEvent(JD,{composed:!0,bubbles:!0})),this.hasAttribute(La)&&this.dispatchEvent(new k.CustomEvent(eC,{composed:!0,bubbles:!0})))}}rb.getSlotTemplateHTML=iC;k.customElements.get("media-live-button")||k.customElements.define("media-live-button",rb);var nb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Hn=(i,e,t)=>(nb(i,e,"read from private field"),t?t.call(i):e.get(i)),Yg=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Gn=(i,e,t,s)=>(nb(i,e,"write to private field"),e.set(i,t),t),Di,Il;const Oo={LOADING_DELAY:"loadingdelay",NO_AUTOHIDE:"noautohide"},ab=500,sC=` 940<svg aria-hidden="true" viewBox="0 0 100 100"> 941 <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"> 942 <animateTransform 943 attributeName="transform" 944 attributeType="XML" 945 type="rotate" 946 dur="1s" 947 from="0 50 50" 948 to="360 50 50" 949 repeatCount="indefinite" /> 950 </path> 951</svg> 952`;function rC(i){return` 953 <style> 954 :host { 955 display: var(--media-control-display, var(--media-loading-indicator-display, inline-block)); 956 vertical-align: middle; 957 box-sizing: border-box; 958 --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ${ab}ms); 959 } 960 961 #status { 962 color: rgba(0,0,0,0); 963 width: 0px; 964 height: 0px; 965 } 966 967 :host slot[name=icon] > *, 968 :host ::slotted([slot=icon]) { 969 opacity: var(--media-loading-indicator-opacity, 0); 970 transition: opacity 0.15s; 971 } 972 973 :host([${_.MEDIA_LOADING}]:not([${_.MEDIA_PAUSED}])) slot[name=icon] > *, 974 :host([${_.MEDIA_LOADING}]:not([${_.MEDIA_PAUSED}])) ::slotted([slot=icon]) { 975 opacity: var(--media-loading-indicator-opacity, 1); 976 transition: opacity 0.15s var(--_loading-indicator-delay); 977 } 978 979 :host #status { 980 visibility: var(--media-loading-indicator-opacity, hidden); 981 transition: visibility 0.15s; 982 } 983 984 :host([${_.MEDIA_LOADING}]:not([${_.MEDIA_PAUSED}])) #status { 985 visibility: var(--media-loading-indicator-opacity, visible); 986 transition: visibility 0.15s var(--_loading-indicator-delay); 987 } 988 989 svg, img, ::slotted(svg), ::slotted(img) { 990 width: var(--media-loading-indicator-icon-width); 991 height: var(--media-loading-indicator-icon-height, 100px); 992 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 993 vertical-align: middle; 994 } 995 </style> 996 997 <slot name="icon">${sC}</slot>
998 <div id="status" role="status" aria-live="polite">${Z("media loading")}</div> 999 `}class Xf extends k.HTMLElement{constructor(){if(super(),Yg(this,Di,void 0),Yg(this,Il,ab),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Te.MEDIA_CONTROLLER,_.MEDIA_PAUSED,_.MEDIA_LOADING,Oo.LOADING_DELAY]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Oo.LOADING_DELAY&&t!==s?this.loadingDelay=Number(s):e===Te.MEDIA_CONTROLLER&&(t&&((n=(r=Hn(this,Di))==null?void 0:r.unassociateElement)==null||n.call(r,this),Gn(this,Di,null)),s&&this.isConnected&&(Gn(this,Di,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Hn(this,Di))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const r=this.getAttribute(Te.MEDIA_CONTROLLER);r&&(Gn(this,Di,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=Hn(this,Di))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Hn(this,Di))==null?void 0:e.unassociateElement)==null||t.call(e,this),Gn(this,Di,null)}get loadingDelay(){return Hn(this,Il)}set loadingDelay(e){Gn(this,Il,e);const{style:t}=et(this.shadowRoot,":host");t.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${e}ms)`)}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}get mediaLoading(){return ve(this,_.MEDIA_LOADING)}set mediaLoading(e){Ee(this,_.MEDIA_LOADING,e)}get mediaController(){return Oe(this,Te.MEDIA_CONTROLLER)}set mediaController(e){Ne(this,Te.MEDIA_CONTROLLER,e)}get noAutohide(){return ve(this,Oo.NO_AUTOHIDE)}set noAutohide(e){Ee(this,Oo.NO_AUTOHIDE,e)}}Di=new WeakMap;Il=new WeakMap;Xf.shadowRootOptions={mode:"open"};Xf.getTemplateHTML=rC;k.customElements.get("media-loading-indicator")||k.customElements.define("media-loading-indicator",Xf);const nC=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1000 <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"/> 1001</svg>`,qg=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1002 <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"/> 1003</svg>`,aC=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1004 <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"/> 1005</svg>`;function oC(i){return` 1006 <style> 1007 :host(:not([${_.MEDIA_VOLUME_LEVEL}])) slot[name=icon] slot:not([name=high]), 1008 :host([${_.MEDIA_VOLUME_LEVEL}=high]) slot[name=icon] slot:not([name=high]) { 1009 display: none !important; 1010 } 1011 1012 :host([${_.MEDIA_VOLUME_LEVEL}=off]) slot[name=icon] slot:not([name=off]) { 1013 display: none !important; 1014 } 1015 1016 :host([${_.MEDIA_VOLUME_LEVEL}=low]) slot[name=icon] slot:not([name=low]) { 1017 display: none !important; 1018 } 1019 1020 :host([${_.MEDIA_VOLUME_LEVEL}=medium]) slot[name=icon] slot:not([name=medium]) { 1021 display: none !important; 1022 } 1023 1024 :host(:not([${_.MEDIA_VOLUME_LEVEL}=off])) slot[name=tooltip-unmute], 1025 :host([${_.MEDIA_VOLUME_LEVEL}=off]) slot[name=tooltip-mute] { 1026 display: none; 1027 } 1028 </style> 1029 1030 <slot name="icon"> 1031 <slot name="off">${nC}</slot> 1032 <slot name="low">${qg}</slot> 1033 <slot name="medium">${qg}</slot> 1034 <slot name="high">${aC}</slot> 1035 </slot> 1036 `}function lC(){return` 1037 <slot name="tooltip-mute">${Z("Mute")}</slot> 1038 <slot name="tooltip-unmute">${Z("Unmute")}</slot> 1039 `}const jg=i=>{const e=i.mediaVolumeLevel==="off",t=Z(e?"unmute":"mute");i.setAttribute("aria-label",t)};class Zf extends Et{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_VOLUME_LEVEL]}connectedCallback(){super.connectedCallback(),jg(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_VOLUME_LEVEL&&jg(this)}get mediaVolumeLevel(){return Oe(this,_.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){Ne(this,_.MEDIA_VOLUME_LEVEL,e)}handleClick(){const e=this.mediaVolumeLevel==="off"?X.MEDIA_UNMUTE_REQUEST:X.MEDIA_MUTE_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Zf.getSlotTemplateHTML=oC;Zf.getTooltipContentHTML=lC;k.customElements.get("media-mute-button")||k.customElements.define("media-mute-button",Zf);const zg=`<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>`;function dC(i){return` 1042 <style> 1043 :host([${_.MEDIA_IS_PIP}]) slot[name=icon] slot:not([name=exit]) { 1044 display: none !important; 1045 } 1046 1047 :host(:not([${_.MEDIA_IS_PIP}])) slot[name=icon] slot:not([name=enter]) { 1048 display: none !important; 1049 } 1050 1051 :host([${_.MEDIA_IS_PIP}]) slot[name=tooltip-enter], 1052 :host(:not([${_.MEDIA_IS_PIP}])) slot[name=tooltip-exit] { 1053 display: none; 1054 } 1055 </style> 1056 1057 <slot name="icon"> 1058 <slot name="enter">${zg}</slot> 1059 <slot name="exit">${zg}</slot> 1060 </slot> 1061 `}function uC(){return` 1062 <slot name="tooltip-enter">${Z("Enter picture in picture mode")}</slot> 1063 <slot name="tooltip-exit">${Z("Exit picture in picture mode")}</slot> 1064 `}const Qg=i=>{const e=i.mediaIsPip?Z("exit picture in picture mode"):Z("enter picture in picture mode");i.setAttribute("aria-label",e)};
1064class Jf extends Et{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_PIP,_.MEDIA_PIP_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Qg(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_PIP&&Qg(this)}get mediaPipUnavailable(){return Oe(this,_.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){Ne(this,_.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return ve(this,_.MEDIA_IS_PIP)}set mediaIsPip(e){Ee(this,_.MEDIA_IS_PIP,e)}handleClick(){const e=this.mediaIsPip?X.MEDIA_EXIT_PIP_REQUEST:X.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Jf.getSlotTemplateHTML=dC;Jf.getTooltipContentHTML=uC;k.customElements.get("media-pip-button")||k.customElements.define("media-pip-button",Jf);var cC=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Mr=(i,e,t)=>(cC(i,e,"read from private field"),t?t.call(i):e.get(i)),hC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},As;const Zu={RATES:"rates"},ob=[1,1.2,1.5,1.7,2],on=1;function fC(i){return` 1065 <style> 1066 :host { 1067 min-width: 5ch; 1068 padding: var(--media-button-padding, var(--media-control-padding, 10px 5px)); 1069 } 1070 </style> 1071 <slot name="icon">${i.mediaplaybackrate||on}x</slot> 1072 `}function mC(){return Z("Playback rate")}class em extends Et{constructor(){var e;super(),hC(this,As,new Nf(this,Zu.RATES,{defaultValue:ob})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:on}x`}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PLAYBACK_RATE,Zu.RATES]}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),e===Zu.RATES&&(Mr(this,As).value=s),e===_.MEDIA_PLAYBACK_RATE){const r=s?+s:Number.NaN,n=Number.isNaN(r)?on:r;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",Z("Playback rate {playbackRate}",{playbackRate:n}))}}get rates(){return Mr(this,As)}set rates(e){e?Array.isArray(e)?Mr(this,As).value=e.join(" "):typeof e=="string"&&(Mr(this,As).value=e):Mr(this,As).value=""}get mediaPlaybackRate(){return Pe(this,_.MEDIA_PLAYBACK_RATE,on)}set mediaPlaybackRate(e){We(this,_.MEDIA_PLAYBACK_RATE,e)}handleClick(){var e,t;const s=Array.from(Mr(this,As).values(),a=>+a).sort((a,o)=>a-o),r=(t=(e=s.find(a=>a>this.mediaPlaybackRate))!=null?e:s[0])!=null?t:on,n=new k.CustomEvent(X.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(n)}}As=new WeakMap;em.getSlotTemplateHTML=fC;em.getTooltipContentHTML=mC;k.customElements.get("media-playback-rate-button")||k.customElements.define("media-playback-rate-button",em);const pC=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1073 <path d="m6 21 15-9L6 3v18Z"/> 1074</svg>`,gC=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1075 <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/> 1076</svg>`;function vC(i){return` 1077 <style> 1078 :host([${_.MEDIA_PAUSED}]) slot[name=pause], 1079 :host(:not([${_.MEDIA_PAUSED}])) slot[name=play] { 1080 display: none !important; 1081 } 1082 1083 :host([${_.MEDIA_PAUSED}]) slot[name=tooltip-pause], 1084 :host(:not([${_.MEDIA_PAUSED}])) slot[name=tooltip-play] { 1085 display: none; 1086 } 1087 </style> 1088 1089 <slot name="icon"> 1090 <slot name="play">${pC}</slot> 1091 <slot name="pause">${gC}</slot> 1092 </slot> 1093 `}function EC(){return` 1094 <slot name="tooltip-play">${Z("Play")}</slot> 1095 <slot name="tooltip-pause">${Z("Pause")}</slot> 1096 `}const Xg=i=>{const e=i.mediaPaused?Z("play"):Z("pause");i.setAttribute("aria-label",e)};class tm extends Et{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PAUSED,_.MEDIA_ENDED]}connectedCallback(){super.connectedCallback(),Xg(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),(e===_.MEDIA_PAUSED||e===_.MEDIA_LANG)&&Xg(this)}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}handleClick(){const e=this.mediaPaused?X.MEDIA_PLAY_REQUEST:X.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}tm.getSlotTemplateHTML=vC;tm.getTooltipContentHTML=EC;k.customElements.get("media-play-button")||k.customElements.define("media-play-button",tm);const bi={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"};function yC(i){return` 1097 <style> 1098 :host { 1099 pointer-events: none; 1100 display: var(--media-poster-image-display, inline-block); 1101 box-sizing: border-box; 1102 } 1103 1104 img { 1105 max-width: 100%; 1106 max-height: 100%; 1107 min-width: 100%; 1108 min-height: 100%; 1109 background-repeat: no-repeat; 1110 background-position: var(--media-poster-image-background-position, var(--media-object-position, center)); 1111 background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain)); 1112 object-fit: var(--media-object-fit, contain); 1113 object-position: var(--media-object-position, center); 1114 } 1115 </style> 1116 1117 <img part="poster img" aria-hidden="true" id="image"/> 1118 `}const bC=i=>{i.style.removeProperty("background-image")},TC=(i,e)=>{i.style["background-image"]=`url('${e}')`};class im extends k.HTMLElement{static get observedAttributes(){return[bi.PLACEHOLDER_SRC,bi.SRC]}constructor(){if(super(),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,t,s){e===bi.SRC&&(s==null?this.image.removeAttribute(bi.SRC):this.image.setAttribute(bi.SRC,s)),e===bi.PLACEHOLDER_SRC&&(s==null?bC(this.image):TC(this.image,s))}get placeholderSrc(){return Oe(this,bi.PLACEHOLDER_SRC)}set placeholderSrc(e){Ne(this,bi.SRC,e)}get src(){return Oe(this,bi.SRC)}set src(e){Ne(this,bi.SRC,e)}}im.shadowRootOptions={mode:"open"};im.getTemplateHTML=yC;k.customElements.get("media-poster-image")||k.customElements.define("media-poster-image",im);var lb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},_C=(i,e,t)=>(lb(i,e,"read from private field"),t?t.call(i):e.get(i)),AC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},SC=(i,e,t,s)=>(lb(i,e,"write to private field"),e.set(i,t),t),Ll;class IC extends Bs{constructor(){super(),AC(this,Ll,void 0),SC(this,Ll,this.shadowRoot.querySelector("slot"))}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PREVIEW_CHAPTER,_.MEDIA_LA
1118NG]}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),(e===_.MEDIA_PREVIEW_CHAPTER||e===_.MEDIA_LANG)&&s!==t&&s!=null)if(_C(this,Ll).textContent=s,s!==""){const r=Z("chapter: {chapterName}",{chapterName:s});this.setAttribute("aria-valuetext",r)}else this.removeAttribute("aria-valuetext")}get mediaPreviewChapter(){return Oe(this,_.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){Ne(this,_.MEDIA_PREVIEW_CHAPTER,e)}}Ll=new WeakMap;k.customElements.get("media-preview-chapter-display")||k.customElements.define("media-preview-chapter-display",IC);var db=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},No=(i,e,t)=>(db(i,e,"read from private field"),t?t.call(i):e.get(i)),LC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Uo=(i,e,t,s)=>(db(i,e,"write to private field"),e.set(i,t),t),Ci;function RC(i){return` 1119 <style> 1120 :host { 1121 box-sizing: border-box; 1122 display: var(--media-control-display, var(--media-preview-thumbnail-display, inline-block)); 1123 overflow: hidden; 1124 } 1125 1126 img { 1127 display: none; 1128 position: relative; 1129 } 1130 </style> 1131 <img crossorigin loading="eager" decoding="async"> 1132 `}class du extends k.HTMLElement{constructor(){if(super(),LC(this,Ci,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Te.MEDIA_CONTROLLER,_.MEDIA_PREVIEW_IMAGE,_.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,t,s;const r=this.getAttribute(Te.MEDIA_CONTROLLER);r&&(Uo(this,Ci,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=No(this,Ci))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=No(this,Ci))==null?void 0:e.unassociateElement)==null||t.call(e,this),Uo(this,Ci,null)}attributeChangedCallback(e,t,s){var r,n,a,o,l;[_.MEDIA_PREVIEW_IMAGE,_.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===Te.MEDIA_CONTROLLER&&(t&&((n=(r=No(this,Ci))==null?void 0:r.unassociateElement)==null||n.call(r,this),Uo(this,Ci,null)),s&&this.isConnected&&(Uo(this,Ci,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=No(this,Ci))==null?void 0:o.associateElement)==null||l.call(o,this)))}get mediaPreviewImage(){return Oe(this,_.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){Ne(this,_.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){const e=this.getAttribute(_.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(t=>+t)}set mediaPreviewCoords(e){if(!e){this.removeAttribute(_.MEDIA_PREVIEW_COORDS);return}this.setAttribute(_.MEDIA_PREVIEW_COORDS,e.join(" "))}update(){const e=this.mediaPreviewCoords,t=this.mediaPreviewImage;if(!(e&&t))return;const[s,r,n,a]=e,o=t.split("#")[0],l=getComputedStyle(this),{maxWidth:d,maxHeight:u,minWidth:c,minHeight:h}=l,f=Math.min(parseInt(d)/n,parseInt(u)/a),m=Math.max(parseInt(c)/n,parseInt(h)/a),g=f<1,p=g?f:m>1?m:1,{style:E}=et(this.shadowRoot,":host"),b=et(this.shadowRoot,"img").style,y=this.shadowRoot.querySelector("img"),T=g?"min":"max";E.setProperty(`${T}-width`,"initial","important"),E.setProperty(`${T}-height`,"initial","important"),E.width=`${n*p}px`,E.height=`${a*p}px`;const A=()=>{b.width=`${this.imgWidth*p}px`,b.height=`${this.imgHeight*p}px`,b.display="block"};y.src!==o&&(y.onload=()=>{this.imgWidth=y.naturalWidth,this.imgHeight=y.naturalHeight,A()},y.src=o,A()),A(),b.transform=`translate(-${s*p}px, -${r*p}px)`}}Ci=new WeakMap;du.shadowRootOptions={mode:"open"};du.getTemplateHTML=RC;k.customElements.get("media-preview-thumbnail")||k.customElements.define("media-preview-thumbnail",du);var Zg=du,ub=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Jg=(i,e,t)=>(ub(i,e,"read from private field"),t?t.call(i):e.get(i)),xC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},kC=(i,e,t,s)=>(ub(i,e,"write to private field"),e.set(i,t),t),da;class DC extends Bs{constructor(){super(),xC(this,da,void 0),kC(this,da,this.shadowRoot.querySelector("slot")),Jg(this,da).textContent=Ns(0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_PREVIEW_TIME&&s!=null&&(Jg(this,da).textContent=Ns(parseFloat(s)))}get mediaPreviewTime(){return Pe(this,_.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){We(this,_.MEDIA_PREVIEW_TIME,e)}}da=new WeakMap;k.customElements.get("media-preview-time-display")||k.customElements.define("media-preview-time-display",DC);const Pr={SEEK_OFFSET:"seekoffset"},Ju=30,CC=i=>` 1133 <svg aria-hidden="true" viewBox="0 0 20 24"> 1134 <defs> 1135 <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style> 1136 </defs> 1137 <text class="text value" transform="translate(2.18 19.87)">${i}</text> 1138 <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"/> 1139 </svg>`;function wC(i,e){return` 1140 <slot name="icon">${CC(e.seekOffset)}</slot> 1141 `}function MC(){return Z("Seek backward")}const PC=0;
1141class sm extends Et{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_CURRENT_TIME,Pr.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Pe(this,Pr.SEEK_OFFSET,Ju)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===Pr.SEEK_OFFSET&&(this.seekOffset=Pe(this,Pr.SEEK_OFFSET,Ju))}get seekOffset(){return Pe(this,Pr.SEEK_OFFSET,Ju)}set seekOffset(e){We(this,Pr.SEEK_OFFSET,e),this.setAttribute("aria-label",Z("seek back {seekOffset} seconds",{seekOffset:this.seekOffset})),vy(Ey(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Pe(this,_.MEDIA_CURRENT_TIME,PC)}set mediaCurrentTime(e){We(this,_.MEDIA_CURRENT_TIME,e)}handleClick(){const e=Math.max(this.mediaCurrentTime-this.seekOffset,0),t=new k.CustomEvent(X.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}sm.getSlotTemplateHTML=wC;sm.getTooltipContentHTML=MC;k.customElements.get("media-seek-backward-button")||k.customElements.define("media-seek-backward-button",sm);const Or={SEEK_OFFSET:"seekoffset"},ec=30,OC=i=>` 1142 <svg aria-hidden="true" viewBox="0 0 20 24"> 1143 <defs> 1144 <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style> 1145 </defs> 1146 <text class="text value" transform="translate(8.9 19.87)">${i}</text> 1147 <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"/> 1148 </svg>`;function NC(i,e){return` 1149 <slot name="icon">${OC(e.seekOffset)}</slot> 1150 `}function UC(){return Z("Seek forward")}const $C=0;class rm extends Et{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_CURRENT_TIME,Or.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Pe(this,Or.SEEK_OFFSET,ec)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===Or.SEEK_OFFSET&&(this.seekOffset=Pe(this,Or.SEEK_OFFSET,ec))}get seekOffset(){return Pe(this,Or.SEEK_OFFSET,ec)}set seekOffset(e){We(this,Or.SEEK_OFFSET,e),this.setAttribute("aria-label",Z("seek forward {seekOffset} seconds",{seekOffset:this.seekOffset})),vy(Ey(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Pe(this,_.MEDIA_CURRENT_TIME,$C)}set mediaCurrentTime(e){We(this,_.MEDIA_CURRENT_TIME,e)}handleClick(){const e=this.mediaCurrentTime+this.seekOffset,t=new k.CustomEvent(X.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}rm.getSlotTemplateHTML=NC;rm.getTooltipContentHTML=UC;k.customElements.get("media-seek-forward-button")||k.customElements.define("media-seek-forward-button",rm);var cb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},tc=(i,e,t)=>(cb(i,e,"read from private field"),t?t.call(i):e.get(i)),FC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},BC=(i,e,t,s)=>(cb(i,e,"write to private field"),e.set(i,t),t),Kr;const Zs={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},e0=[...Object.values(Zs),_.MEDIA_CURRENT_TIME,_.MEDIA_DURATION,_.MEDIA_SEEKABLE],t0=["Enter"," "],HC=" / ",dh=(i,{timesSep:e=HC}={})=>{var t,s;const r=(t=i.mediaCurrentTime)!=null?t:0,[,n]=(s=i.mediaSeekable)!=null?s:[];let a=0;Number.isFinite(i.mediaDuration)?a=i.mediaDuration:Number.isFinite(n)&&(a=n);const o=i.remaining?Ns(0-(a-r)):Ns(r);return i.showDuration?`${o}${e}${Ns(a)}`:o},GC="video not loaded, unknown time.",KC=i=>{var e;const t=i.mediaCurrentTime,[,s]=(e=i.mediaSeekable)!=null?e:[];let r=null;if(Number.isFinite(i.mediaDuration)?r=i.mediaDuration:Number.isFinite(s)&&(r=s),t==null||r===null){i.setAttribute("aria-valuetext",GC);return}const n=i.remaining?Sa(0-(r-t)):Sa(t);if(!i.showDuration){i.setAttribute("aria-valuetext",n);return}const a=Sa(r),o=`${n} of ${a}`;i.setAttribute("aria-valuetext",o)};function VC(i,e){return` 1151 <slot>${dh(e)}</slot> 1152 `}class hb extends Bs{constructor(){super(),FC(this,Kr,void 0),BC(this,Kr,this.shadowRoot.querySelector("slot")),tc(this,Kr).innerHTML=`${dh(this)}`}static get observedAttributes(){return[...super.observedAttributes,...e0,"disabled"]}connectedCallback(){const{style:e}=et(this.shadowRoot,":host(:hover:not([notoggle]))");e.setProperty("cursor","var(--media-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",Z("playback time"));const t=s=>{const{key:r}=s;if(!t0.includes(r)){this.removeEventListener("keyup",t);return}this.toggleTimeDisplay()};this.addEventListener("keydown",s=>{const{metaKey:r,altKey:n,key:a}=s;if(r||n||!t0.includes(a)){this.removeEventListener("keyup",t);return}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,s){e0.includes(e)?this.update():e==="disabled"&&s!==t&&(s==null?this.enable():this.disable()),super.attributeChangedCallback(e,t,s)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return ve(this,Zs.REMAINING)}set remaining(e){Ee(this,Zs.REMAINING,e)}get showDuration(){return ve(this,Zs.SHOW_DURATION)}set showDuration(e){Ee(this,Zs.SHOW_DURATION,e)}get noToggle(){return ve(this,Zs.NO_TOGGLE)}set noToggle(e){Ee(this,Zs.NO_TOGGLE,e)}get mediaDuration(){return Pe(this,_.MEDIA_DURATION)}set mediaDuration(e){We(this,_.MEDIA_DURATION,e)}get mediaCurrentTime(){return Pe(this,_.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){We(this,_.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){const e=this.getAttribute(_.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(_.MEDIA_SEEKABLE);return}this.setAttribute(_.MEDIA_SEEKABLE,e.join(":"))}update(){const e=dh(this);KC(this),e!==tc(this,Kr).innerHTML&&(tc(this,Kr).innerHTML=e)}}Kr=new WeakMap;hb.getSlotTemplateHTML=VC;k.customElements.get("media-time-display")||k.customElements.define("media-time-display",hb);var fb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ut=(i,e,t)=>(fb(i,e,"read from private field"),e.get(i)),Ti=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ut=(i,e,t,s)=>(fb(i,e,"write to private field"),e.set(i,t),t),WC=(i,e,t,s)=>({set _(r){Ut(i,e,r)},get _(){return ut(i,e)}}),Vr,Rl,Wr,ua,xl,kl,Dl,Yr,Js,Cl;class YC{constructor(e,t,s){Ti(this,Vr,void 0),Ti(this,Rl,void 0),Ti(this,Wr,void 0),Ti(this,ua,void 0),Ti(this,xl,void 0),Ti(this,kl,void 0),Ti(this,Dl,void 0),Ti(this,Yr,void 0),Ti(this,Js,0),Ti(this,Cl,(r=performance.now())=>{Ut(this,Js,requestAnimationFrame(ut(this,Cl))),Ut(this,ua,performance.now()-ut(this,Wr));const n=1e3/this.fps;if(ut(this,ua)>n){Ut(this,Wr,r-ut(this,ua)%n);const a=1e3/((r-ut(this,Rl))/++WC(this,xl)._),o=(r-ut(this,kl))/1e3/this.duration;let l=ut(this,Dl)+o*this.playbackRate;l-ut(this,Vr).valueAsNumber>0?Ut(this,Yr,this.playbackRate/this.duration/a):(Ut(this,Yr,.995*ut(this,Yr)),l=ut(this,Vr).valueAsNumber+ut(this,Yr)),this.callback(l)}}),Ut(this,Vr,e),this.callback=t,this.fps=s}start(){ut(this,Js)===0&&(Ut(this,Wr,performance.now()),Ut(this,Rl,ut(this,Wr)),Ut(this,xl,0),ut(this,Cl).call(this))}stop(){ut(this,Js)!==0&&(cancelAnimationFrame(ut(this,Js)),Ut(this,Js,0))}update({start:e,duration:t,playbackRate:s}){const r=e-ut(this,Vr).valueAsNumber,n=Math.abs(t-this.duration);(r>0||r<-.03||n>=.5)&&this.callback(e),Ut(this,Dl,e),Ut(this,kl,performance.now()),this.duration=t,this.playbackRate=s}}Vr=new WeakMap;Rl=new WeakMap;Wr=new WeakMap;ua=new WeakMap;xl=new WeakMap;kl=new WeakMap;Dl=new WeakMap;Yr=new WeakMap;Js=new WeakMap;Cl=new WeakMap;var nm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},qe=(i,e,t)=>(nm(i,e,"read from private field"),t?t.call(i):e.get(i)),st=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},qt=(i,e,t,s)=>(nm(i,e,"write to private field"),e.set(i,t),t),Tt=(i,e,t)=>(nm(i,e,"access private method"),t),qr,pr,kd,Ra,Dd,wl,za,Qa,jr,zr,Qr,ca,am,mb,uh,Cd,om,wd,lm,Md,dm,ch,pb,Xa,Pd,hh,gb;const qC="video not loaded, unknown time.",jC=i=>
1152{const e=i.range,t=Sa(+vb(i)),s=Sa(+i.mediaSeekableEnd),r=t&&s?`${t} of ${s}`:qC;e.setAttribute("aria-valuetext",r)};function zC(i){return` 1153 ${Mn.getTemplateHTML(i)} 1154 <style> 1155 :host { 1156 --media-box-border-radius: 4px; 1157 --media-box-padding-left: 10px; 1158 --media-box-padding-right: 10px; 1159 --media-preview-border-radius: var(--media-box-border-radius); 1160 --media-box-arrow-offset: var(--media-box-border-radius); 1161 --_control-background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 1162 --_preview-background: var(--media-preview-background, var(--_control-background)); 1163 1164 1165 contain: layout; 1166 } 1167 1168 #buffered { 1169 background: var(--media-time-range-buffered-color, rgb(255 255 255 / .4)); 1170 position: absolute; 1171 height: 100%; 1172 will-change: width; 1173 } 1174 1175 #preview-rail, 1176 #current-rail { 1177 width: 100%; 1178 position: absolute; 1179 left: 0; 1180 bottom: 100%; 1181 pointer-events: none; 1182 will-change: transform; 1183 } 1184 1185 [part~="box"] { 1186 width: min-content; 1187 1188 position: absolute; 1189 bottom: 100%; 1190 flex-direction: column; 1191 align-items: center; 1192 transform: translateX(-50%); 1193 } 1194 1195 [part~="current-box"] { 1196 display: var(--media-current-box-display, var(--media-box-display, flex)); 1197 margin: var(--media-current-box-margin, var(--media-box-margin, 0 0 5px)); 1198 visibility: hidden; 1199 } 1200 1201 [part~="preview-box"] { 1202 display: var(--media-preview-box-display, var(--media-box-display, flex)); 1203 margin: var(--media-preview-box-margin, var(--media-box-margin, 0 0 5px)); 1204 transition-property: var(--media-preview-transition-property, visibility, opacity); 1205 transition-duration: var(--media-preview-transition-duration-out, .25s); 1206 transition-delay: var(--media-preview-transition-delay-out, 0s); 1207 visibility: hidden; 1208 opacity: 0; 1209 } 1210 1211 :host(:is([${_.MEDIA_PREVIEW_IMAGE}], [${_.MEDIA_PREVIEW_TIME}])[dragging]) [part~="preview-box"] { 1212 transition-duration: var(--media-preview-transition-duration-in, .5s); 1213 transition-delay: var(--media-preview-transition-delay-in, .25s); 1214 visibility: visible; 1215 opacity: 1; 1216 } 1217 1218 @media (hover: hover) { 1219 :host(:is([${_.MEDIA_PREVIEW_IMAGE}], [${_.MEDIA_PREVIEW_TIME}]):hover) [part~="preview-box"] { 1220 transition-duration: var(--media-preview-transition-duration-in, .5s); 1221 transition-delay: var(--media-preview-transition-delay-in, .25s); 1222 visibility: visible; 1223 opacity: 1; 1224 } 1225 } 1226 1227 media-preview-thumbnail, 1228 ::slotted(media-preview-thumbnail) { 1229 visibility: hidden; 1230 1231 transition: visibility 0s .25s; 1232 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1233 background: var(--media-preview-thumbnail-background, var(--_preview-background)); 1234 box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2)); 1235 max-width: var(--media-preview-thumbnail-max-width, 180px); 1236 max-height: var(--media-preview-thumbnail-max-height, 160px); 1237 min-width: var(--media-preview-thumbnail-min-width, 120px); 1238 min-height: var(--media-preview-thumbnail-min-height, 80px); 1239 border: var(--media-preview-thumbnail-border); 1240 border-radius: var(--media-preview-thumbnail-border-radius, 1241 var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0); 1242 } 1243 1244 :host([${_.MEDIA_PREVIEW_IMAGE}][dragging]) media-preview-thumbnail, 1245 :host([${_.MEDIA_PREVIEW_IMAGE}][dragging]) ::slotted(media-preview-thumbnail) { 1246 transition-delay: var(--media-preview-transition-delay-in, .25s); 1247 visibility: visible; 1248 } 1249 1250 @media (hover: hover) { 1251 :host([${_.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail, 1252 :host([${_.MEDIA_PREVIEW_IMAGE}
1252]:hover) ::slotted(media-preview-thumbnail) { 1253 transition-delay: var(--media-preview-transition-delay-in, .25s); 1254 visibility: visible; 1255 } 1256 1257 :host([${_.MEDIA_PREVIEW_TIME}]:hover) { 1258 --media-time-range-hover-display: block; 1259 } 1260 } 1261 1262 media-preview-chapter-display, 1263 ::slotted(media-preview-chapter-display) { 1264 font-size: var(--media-font-size, 13px); 1265 line-height: 17px; 1266 min-width: 0; 1267 visibility: hidden; 1268 1269 transition: min-width 0s, border-radius 0s, margin 0s, padding 0s, visibility 0s; 1270 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1271 background: var(--media-preview-chapter-background, var(--_preview-background)); 1272 border-radius: var(--media-preview-chapter-border-radius, 1273 var(--media-preview-border-radius) var(--media-preview-border-radius) 1274 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1275 padding: var(--media-preview-chapter-padding, 3.5px 9px); 1276 margin: var(--media-preview-chapter-margin, 0 0 5px); 1277 text-shadow: var(--media-preview-chapter-text-shadow, 0 0 4px rgb(0 0 0 / .75)); 1278 } 1279 1280 :host([${_.MEDIA_PREVIEW_IMAGE}]) media-preview-chapter-display, 1281 :host([${_.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-chapter-display) { 1282 transition-delay: var(--media-preview-transition-delay-in, .25s); 1283 border-radius: var(--media-preview-chapter-border-radius, 0); 1284 padding: var(--media-preview-chapter-padding, 3.5px 9px 0); 1285 margin: var(--media-preview-chapter-margin, 0); 1286 min-width: 100%; 1287 } 1288 1289 media-preview-chapter-display[${_.MEDIA_PREVIEW_CHAPTER}], 1290 ::slotted(media-preview-chapter-display[${_.MEDIA_PREVIEW_CHAPTER}]) { 1291 visibility: visible; 1292 } 1293 1294 media-preview-chapter-display:not([aria-valuetext]), 1295 ::slotted(media-preview-chapter-display:not([aria-valuetext])) { 1296 display: none; 1297 } 1298 1299 media-preview-time-display, 1300 ::slotted(media-preview-time-display), 1301 media-time-display, 1302 ::slotted(media-time-display) { 1303 font-size: var(--media-font-size, 13px); 1304 line-height: 17px; 1305 min-width: 0; 1306 1307 transition: min-width 0s, border-radius 0s; 1308 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1309 background: var(--media-preview-time-background, var(--_preview-background)); 1310 border-radius: var(--media-preview-time-border-radius, 1311 var(--media-preview-border-radius) var(--media-preview-border-radius) 1312 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1313 padding: var(--media-preview-time-padding, 3.5px 9px); 1314 margin: var(--media-preview-time-margin, 0); 1315 text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75)); 1316 transform: translateX(min( 1317 max(calc(50% - var(--_box-width) / 2), 1318 calc(var(--_box-shift, 0))), 1319 calc(var(--_box-width) / 2 - 50%) 1320 )); 1321 } 1322 1323 :host([${_.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display, 1324 :host([${_.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) { 1325 transition-delay: var(--media-preview-transition-delay-in, .25s); 1326 border-radius: var(--media-preview-time-border-radius, 1327 0 0 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1328 min-width: 100%; 1329 } 1330 1331 :host([${_.MEDIA_PREVIEW_TIME}]:hover) { 1332 --media-time-range-hover-display: block; 1333 } 1334 1335 [part~="arrow"], 1336 ::slotted([part~="arrow"]) { 1337 display: var(--media-box-arrow-display, inline-block); 1338 transform: translateX(min( 1339 max(calc(50% - var(--_box-width) / 2 + var(--media-box-arrow-offset)), 1340 calc(var(--_box-shift, 0))), 1341 calc(var(--_box-width) / 2 - 50% - var(--media-box-arrow-offset)) 1342 )); 1343 1344 border-color: transparent; 1345 border-top-color: var(--media-box-arrow-background, var(--_control-background)); 1346 border-width: var(--media-box-arrow-border-width, 1347 var(--media-box-arrow-height, 5px) var(--media-box-arrow-width, 6px) 0); 1348 border-style: solid; 1349 justify-content: center; 1350 height: 0; 1351 } 1352 </style> 1353 <div id="preview-rail"> 1354 <slot name="preview" part="box preview-box">
1355 <media-preview-thumbnail> 1356 <template shadowrootmode="${Zg.shadowRootOptions.mode}"> 1357 ${Zg.getTemplateHTML({})} 1358 </template> 1359 </media-preview-thumbnail> 1360 <media-preview-chapter-display></media-preview-chapter-display> 1361 <media-preview-time-display></media-preview-time-display> 1362 <slot name="preview-arrow"><div part="arrow"></div></slot> 1363 </slot> 1364 </div> 1365 <div id="current-rail"> 1366 <slot name="current" part="box current-box"> 1367 1368 </slot> 1369 </div> 1370 `}const $o=(i,e=i.mediaCurrentTime)=>{const t=Number.isFinite(i.mediaSeekableStart)?i.mediaSeekableStart:0,s=Number.isFinite(i.mediaDuration)?i.mediaDuration:i.mediaSeekableEnd;if(Number.isNaN(s))return 0;const r=(e-t)/(s-t);return Math.max(0,Math.min(r,1))},vb=(i,e=i.range.valueAsNumber)=>{const t=Number.isFinite(i.mediaSeekableStart)?i.mediaSeekableStart:0,s=Number.isFinite(i.mediaDuration)?i.mediaDuration:i.mediaSeekableEnd;return Number.isNaN(s)?0:e*(s-t)+t};class um extends Mn{constructor(){super(),st(this,Qr),st(this,am),st(this,Cd),st(this,wd),st(this,Md),st(this,ch),st(this,Xa),st(this,hh),st(this,qr,void 0),st(this,pr,void 0),st(this,kd,void 0),st(this,Ra,void 0),st(this,Dd,void 0),st(this,wl,void 0),st(this,za,void 0),st(this,Qa,void 0),st(this,jr,void 0),st(this,zr,void 0),st(this,uh,s=>{this.dragging||(Cf(s)&&(this.range.valueAsNumber=s),qe(this,zr)||this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),qt(this,kd,this.shadowRoot.querySelectorAll('[part~="box"]')),qt(this,Dd,this.shadowRoot.querySelector('[part~="preview-box"]')),qt(this,wl,this.shadowRoot.querySelector('[part~="current-box"]'));const t=getComputedStyle(this);qt(this,za,parseInt(t.getPropertyValue("--media-box-padding-left"))),qt(this,Qa,parseInt(t.getPropertyValue("--media-box-padding-right"))),qt(this,pr,new YC(this.range,qe(this,uh),60))}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PAUSED,_.MEDIA_DURATION,_.MEDIA_SEEKABLE,_.MEDIA_CURRENT_TIME,_.MEDIA_PREVIEW_IMAGE,_.MEDIA_PREVIEW_TIME,_.MEDIA_PREVIEW_CHAPTER,_.MEDIA_BUFFERED,_.MEDIA_PLAYBACK_RATE,_.MEDIA_LOADING,_.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",Z("seek")),Tt(this,Qr,ca).call(this),qt(this,qr,this.getRootNode()),(e=qe(this,qr))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),Tt(this,Qr,ca).call(this),(e=qe(this,qr))==null||e.removeEventListener("transitionstart",this),qt(this,qr,null)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),t!=s&&(e===_.MEDIA_CURRENT_TIME||e===_.MEDIA_PAUSED||e===_.MEDIA_ENDED||e===_.MEDIA_LOADING||e===_.MEDIA_DURATION||e===_.MEDIA_SEEKABLE?(qe(this,pr).update({start:$o(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),Tt(this,Qr,ca).call(this),jC(this)):e===_.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===_.MEDIA_DURATION||e===_.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=qe(this,jr),this.updateBar()))}get mediaChaptersCues(){return qe(this,jr)}set mediaChaptersCues(e){var t;qt(this,jr,e),this.updateSegments((t=qe(this,jr))==null?void 0:t.map(s=>({start:$o(this,s.startTime),end:$o(this,s.endTime)})))}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}get mediaLoading(){return ve(this,_.MEDIA_LOADING)}set mediaLoading(e){Ee(this,_.MEDIA_LOADING,e)}get mediaDuration(){return Pe(this,_.MEDIA_DURATION)}set mediaDuration(e){We(this,_.MEDIA_DURATION,e)}get mediaCurrentTime(){return Pe(this,_.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){We(this,_.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return Pe(this,_.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){We(this,_.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){const e=this.getAttribute(_.MEDIA_BUFFERED);return e?e.split(" ").map(t=>t.split(":").map(s=>+s)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(_.MEDIA_BUFFERED);return}const t=e.map(s=>s.join(":")).join(" ");this.setAttribute(_.MEDIA_BUFFERED,t)}get mediaSeekable(){const e=this.getAttribute(_.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(_.MEDIA_SEEKABLE);return}this.setAttribute(_.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;const[,t=this.mediaDuration]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaSeekableStart(){var e;const[t=0]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaPreviewImage(){return Oe(this,_.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){Ne(this,_.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return Pe(this,_.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){We(this,_.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return ve(this,_.MEDIA_ENDED)}set mediaEnded(e){Ee(this,_.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;const t=this.mediaBuffered;if(!t.length)return;let s;if(this.mediaEnded)s=1;else{const n=this.mediaCurrentTime,[,a=this.mediaSeekableStart]=(e=t.find(([o,l])=>o<=n&&n<=l))!=null?e:[];s=$o(this,a)}const{style:r}=et(this.shadowRoot,"#buffered");r.setProperty("width",`${s*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;const t=et(this.shadowRoot,"#current-rail"),s=et(this.shadowRoot,'[part~="current-box"]'),r=Tt(this,Cd,om).call(this,qe(this,wl)),n=Tt(this,wd,lm).call(this,r,this.range.valueAsNumber),a=Tt(this,Md,dm).call(this,r,this.range.valueAsNumber);t.style.transform=`translateX(${n}
1370)`,t.style.setProperty("--_range-width",`${r.range.width}`),s.style.setProperty("--_box-shift",`${a}`),s.style.setProperty("--_box-width",`${r.box.width}px`),s.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":Tt(this,hh,gb).call(this);break;case"pointermove":Tt(this,ch,pb).call(this,e);break;case"pointerup":qe(this,zr)&&qt(this,zr,!1);break;case"pointerdown":qt(this,zr,!0);break;case"pointerleave":Tt(this,Xa,Pd).call(this,null);break;case"transitionstart":fs(e.target,this)&&setTimeout(()=>Tt(this,Qr,ca).call(this),0);break}}}qr=new WeakMap;pr=new WeakMap;kd=new WeakMap;Ra=new WeakMap;Dd=new WeakMap;wl=new WeakMap;za=new WeakMap;Qa=new WeakMap;jr=new WeakMap;zr=new WeakMap;Qr=new WeakSet;ca=function(){Tt(this,am,mb).call(this)?qe(this,pr).start():qe(this,pr).stop()};am=new WeakSet;mb=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&yy(this)};uh=new WeakMap;Cd=new WeakSet;om=function(i){var e;const s=((e=this.getAttribute("bounds")?wn(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?e:this).getBoundingClientRect(),r=this.range.getBoundingClientRect(),n=i.offsetWidth,a=-(r.left-s.left-n/2),o=s.right-r.left-n/2;return{box:{width:n,min:a,max:o},bounds:s,range:r}};wd=new WeakSet;lm=function(i,e){let t=`${e*100}%`;const{width:s,min:r,max:n}=i.box;if(!s)return t;if(Number.isNaN(r)||(t=`max(${`calc(1 / var(--_range-width) * 100 * ${r}% + var(--media-box-padding-left))`}, ${t})`),!Number.isNaN(n)){const o=`calc(1 / var(--_range-width) * 100 * ${n}% - var(--media-box-padding-right))`;t=`min(${t}, ${o})`}return t};Md=new WeakSet;dm=function(i,e){const{width:t,min:s,max:r}=i.box,n=e*i.range.width;if(n<s+qe(this,za)){const a=i.range.left-i.bounds.left-qe(this,za);return`${n-t/2+a}px`}if(n>r-qe(this,Qa)){const a=i.bounds.right-i.range.right-qe(this,Qa);return`${n+t/2-a-i.range.width}px`}return 0};ch=new WeakSet;pb=function(i){const e=[...qe(this,kd)].some(u=>i.composedPath().includes(u));if(!this.dragging&&(e||!i.composedPath().includes(this))){Tt(this,Xa,Pd).call(this,null);return}const t=this.mediaSeekableEnd;if(!t)return;const s=et(this.shadowRoot,"#preview-rail"),r=et(this.shadowRoot,'[part~="preview-box"]'),n=Tt(this,Cd,om).call(this,qe(this,Dd));let a=(i.clientX-n.range.left)/n.range.width;a=Math.max(0,Math.min(1,a));const o=Tt(this,wd,lm).call(this,n,a),l=Tt(this,Md,dm).call(this,n,a);s.style.transform=`translateX(${o})`,s.style.setProperty("--_range-width",`${n.range.width}`),r.style.setProperty("--_box-shift",`${l}`),r.style.setProperty("--_box-width",`${n.box.width}px`);const d=Math.round(qe(this,Ra))-Math.round(a*t);Math.abs(d)<1&&a>.01&&a<.99||(qt(this,Ra,a*t),Tt(this,Xa,Pd).call(this,qe(this,Ra)))};Xa=new WeakSet;Pd=function(i){this.dispatchEvent(new k.CustomEvent(X.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:i}))};hh=new WeakSet;gb=function(){qe(this,pr).stop();const i=vb(this);this.dispatchEvent(new k.CustomEvent(X.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:i}))};um.shadowRootOptions={mode:"open"};um.getTemplateHTML=zC;k.customElements.get("media-time-range")||k.customElements.define("media-time-range",um);const QC=1,XC=i=>i.mediaMuted?0:i.mediaVolume,ZC=i=>`${Math.round(i*100)}%`;class JC extends Mn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_VOLUME,_.MEDIA_MUTED,_.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{const e=this.range.value,t=new k.CustomEvent(X.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",Z("volume"))}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),(e===_.MEDIA_VOLUME||e===_.MEDIA_MUTED)&&(this.range.valueAsNumber=XC(this),this.range.setAttribute("aria-valuetext",ZC(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return Pe(this,_.MEDIA_VOLUME,QC)}set mediaVolume(e){We(this,_.MEDIA_VOLUME,e)}get mediaMuted(){return ve(this,_.MEDIA_MUTED)}set mediaMuted(e){Ee(this,_.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return Oe(this,_.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){Ne(this,_.MEDIA_VOLUME_UNAVAILABLE,e)}}k.customElements.get("media-volume-range")||k.customElements.define("media-volume-range",JC);var Eb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ue=(i,e,t)=>(Eb(i,e,"read from private field"),t?t.call(i):e.get(i)),Ui=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},os=(i,e,t,s)=>(Eb(i,e,"write to private field"),e.set(i,t),t),Xr,Ml,er,ha,Ss,Is,Ls,tr,Zr,Pl,li;const i0=1,s0=0,ew=1,tw={processCallback(i,e,t){if(t){for(const[s,r]of e)if(s in t){const n=t[s];typeof n=="boolean"&&r instanceof pi&&typeof r.element[r.attributeName]=="boolean"?r.booleanValue=n:typeof n=="function"&&r instanceof pi?r.element[r.attributeName]=n:r.value=n}}}};class uu extends k.DocumentFragment{constructor(e,t,s=tw){var r;super(),Ui(this,Xr,void 0),Ui(this,Ml,void 0),this.append(e.content.cloneNode(!0)),os(this,Xr,yb(this)),os(this,Ml,s),(r=s.createCallback)==null||r.call(s,this,ue(this,Xr),t),s.processCallback(this,ue(this,Xr),t)}update(e){ue(this,Ml).processCallback(this,ue(this,Xr),e)}}Xr=new WeakMap;Ml=new WeakMap;const yb=(i,e=[])=>{let t,s;for(const r of i.attributes||[])if(r.value.includes("{{")){const n=new sw;for([t,s]of n0(r.value))if(!t)n.append(s);else{const a=new pi(i,r.name,r.namespaceURI);n.append(a),e.push([s,a])}r.value=n.toString()}for(const r of i.childNodes)if(r.nodeType===i0&&!(r instanceof HTMLTemplateElement))yb(r,e);else{const n=r.data;if(r.nodeType===i0||n.includes("{{")){const a=[];if(n)for([t,s]of n0(n))if(!t)a.push(new Text(s));else{const o=new Pn(i);
1370a.push(o),e.push([s,o])}else if(r instanceof HTMLTemplateElement){const o=new _b(i,r);a.push(o),e.push([o.expression,o])}r.replaceWith(...a.flatMap(o=>o.replacementNodes||[o]))}}return e},r0={},n0=i=>{let e="",t=0,s=r0[i],r=0,n;if(s)return s;for(s=[];n=i[r];r++)n==="{"&&i[r+1]==="{"&&i[r-1]!=="\\"&&i[r+2]&&++t==1?(e&&s.push([s0,e]),e="",r++):n==="}"&&i[r+1]==="}"&&i[r-1]!=="\\"&&!--t?(s.push([ew,e.trim()]),e="",r++):e+=n||"";return e&&s.push([s0,(t>0?"{{":"")+e]),r0[i]=s},iw=11;class bb{get value(){return""}set value(e){}toString(){return this.value}}const Tb=new WeakMap;class sw{constructor(){Ui(this,er,[])}[Symbol.iterator](){return ue(this,er).values()}get length(){return ue(this,er).length}item(e){return ue(this,er)[e]}append(...e){for(const t of e)t instanceof pi&&Tb.set(t,this),ue(this,er).push(t)}toString(){return ue(this,er).join("")}}er=new WeakMap;class pi extends bb{constructor(e,t,s){super(),Ui(this,tr),Ui(this,ha,""),Ui(this,Ss,void 0),Ui(this,Is,void 0),Ui(this,Ls,void 0),os(this,Ss,e),os(this,Is,t),os(this,Ls,s)}get attributeName(){return ue(this,Is)}get attributeNamespace(){return ue(this,Ls)}get element(){return ue(this,Ss)}get value(){return ue(this,ha)}set value(e){ue(this,ha)!==e&&(os(this,ha,e),!ue(this,tr,Zr)||ue(this,tr,Zr).length===1?e==null?ue(this,Ss).removeAttributeNS(ue(this,Ls),ue(this,Is)):ue(this,Ss).setAttributeNS(ue(this,Ls),ue(this,Is),e):ue(this,Ss).setAttributeNS(ue(this,Ls),ue(this,Is),ue(this,tr,Zr).toString()))}get booleanValue(){return ue(this,Ss).hasAttributeNS(ue(this,Ls),ue(this,Is))}set booleanValue(e){if(!ue(this,tr,Zr)||ue(this,tr,Zr).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}}ha=new WeakMap;Ss=new WeakMap;Is=new WeakMap;Ls=new WeakMap;tr=new WeakSet;Zr=function(){return Tb.get(this)};class Pn extends bb{constructor(e,t){super(),Ui(this,Pl,void 0),Ui(this,li,void 0),os(this,Pl,e),os(this,li,t?[...t]:[new Text])}get replacementNodes(){return ue(this,li)}get parentNode(){return ue(this,Pl)}get nextSibling(){return ue(this,li)[ue(this,li).length-1].nextSibling}get previousSibling(){return ue(this,li)[0].previousSibling}get value(){return ue(this,li).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){const t=e.flat().flatMap(s=>s==null?[new Text]:s.forEach?[...s]:s.nodeType===iw?[...s.childNodes]:s.nodeType?[s]:[new Text(s)]);t.length||t.push(new Text),os(this,li,rw(ue(this,li)[0].parentNode,ue(this,li),t,this.nextSibling))}}Pl=new WeakMap;li=new WeakMap;class _b extends Pn{constructor(e,t){const s=t.getAttribute("directive")||t.getAttribute("type");let r=t.getAttribute("expression")||t.getAttribute(s)||"";r.startsWith("{{")&&(r=r.trim().slice(2,-2).trim()),super(e),this.expression=r,this.template=t,this.directive=s}}function rw(i,e,t,s=null){let r=0,n,a,o,l=t.length,d=e.length;for(;r<l&&r<d&&e[r]==t[r];)r++;for(;r<l&&r<d&&t[l-1]==e[d-1];)s=t[--d,--l];if(r==d)for(;r<l;)i.insertBefore(t[r++],s);if(r==l)for(;r<d;)i.removeChild(e[r++]);else{for(n=e[r];r<l;)o=t[r++],a=n?n.nextSibling:s,n==o?n=a:r<l&&t[r]==a?(i.replaceChild(o,n),n=a):i.insertBefore(o,n);for(;n!=s;)a=n.nextSibling,i.removeChild(n),n=a}return t}const a0={string:i=>String(i)};
1370class Ab{constructor(e){this.template=e,this.state=void 0}}const ur=new WeakMap,cr=new WeakMap,fh={partial:(i,e)=>{e[i.expression]=new Ab(i.template)},if:(i,e)=>{var t;if(Sb(i.expression,e))if(ur.get(i)!==i.template){ur.set(i,i.template);const s=new uu(i.template,e,cm);i.replace(s),cr.set(i,s)}else(t=cr.get(i))==null||t.update(e);else i.replace(""),ur.delete(i),cr.delete(i)}},nw=Object.keys(fh),cm={processCallback(i,e,t){var s,r;if(t)for(const[n,a]of e){if(a instanceof _b){if(!a.directive){const l=nw.find(d=>a.template.hasAttribute(d));l&&(a.directive=l,a.expression=a.template.getAttribute(l))}(s=fh[a.directive])==null||s.call(fh,a,t);continue}let o=Sb(n,t);if(o instanceof Ab){ur.get(a)!==o.template?(ur.set(a,o.template),o=new uu(o.template,o.state,cm),a.value=o,cr.set(a,o)):(r=cr.get(a))==null||r.update(o.state);continue}o?(a instanceof pi&&a.attributeName.startsWith("aria-")&&(o=String(o)),a instanceof pi?typeof o=="boolean"?a.booleanValue=o:typeof o=="function"?a.element[a.attributeName]=o:a.value=o:(a.value=o,ur.delete(a),cr.delete(a))):a instanceof pi?a.value=void 0:(a.value=void 0,ur.delete(a),cr.delete(a))}}},o0={"!":i=>!i,"!!":i=>!!i,"==":(i,e)=>i==e,"!=":(i,e)=>i!=e,">":(i,e)=>i>e,">=":(i,e)=>i>=e,"<":(i,e)=>i<e,"<=":(i,e)=>i<=e,"??":(i,e)=>i??e,"|":(i,e)=>{var t;return(t=a0[e])==null?void 0:t.call(a0,i)}};function aw(i){return ow(i,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function Sb(i,e={}){var t,s,r,n,a,o,l;const d=aw(i);if(d.length===0||d.some(({type:u})=>!u))return Kn(i);if(((t=d[0])==null?void 0:t.token)===">"){const u=e[(s=d[1])==null?void 0:s.token];if(!u)return Kn(i);const c={...e};u.state=c;const h=d.slice(2);for(let f=0;f<h.length;f+=3){const m=(r=h[f])==null?void 0:r.token,g=(n=h[f+1])==null?void 0:n.token,p=(a=h[f+2])==null?void 0:a.token;m&&g==="="&&(c[m]=Vn(p,e))}return u}if(d.length===1)return Fo(d[0])?Vn(d[0].token,e):Kn(i);if(d.length===2){const u=(o=d[0])==null?void 0:o.token,c=o0[u];if(!c||!Fo(d[1]))return Kn(i);const h=Vn(d[1].token,e);return c(h)}if(d.length===3){const u=(l=d[1])==null?void 0:l.token,c=o0[u];if(!c||!Fo(d[0])||!Fo(d[2]))return Kn(i);const h=Vn(d[0].token,e);if(u==="|")return c(h,d[2].token);const f=Vn(d[2].token,e);return c(h,f)}}function Kn(i){return console.warn(`Warning: invalid expression \`${i}\``),!1}function Fo({type:i}){return["number","boolean","string","param"].includes(i)}function Vn(i,e){const t=i[0],s=i.slice(-1);return i==="true"||i==="false"?i==="true":t===s&&["'",'"'].includes(t)?i.slice(1,-1):dy(i)?parseFloat(i):e[i]}function ow(i,e){let t,s,r;const n=[];for(;i;){r=null,t=i.length;for(const a in e)s=e[a].exec(i),s&&s.index<t&&(r={token:s[0],type:a,matches:s.slice(1)},t=s.index);t&&n.push({token:i.substr(0,t),type:void 0}),r&&n.push(r),i=i.substr(t+(r?r.token.length:0))}return n}var hm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},mh=(i,e,t)=>(hm(i,e,"read from private field"),t?t.call(i):e.get(i)),Wn=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},hr=(i,e,t,s)=>(hm(i,e,"write to private field"),e.set(i,t),t),ic=(i,e,t)=>(hm(i,e,"access private method"),t),gn,Ol,vn,ph,Ib,Nl,gh;const sc={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},Lb=ot.createElement("template");Lb.innerHTML=` 1371 <style> 1372 :host { 1373 display: inline-block; 1374 line-height: 0; 1375 } 1376 1377 media-controller { 1378 width: 100%; 1379 height: 100%; 1380 } 1381 1382 media-captions-button:not([mediasubtitleslist]), 1383 media-captions-menu:not([mediasubtitleslist]), 1384 media-captions-menu-button:not([mediasubtitleslist]), 1385 media-audio-track-menu[mediaaudiotrackunavailable], 1386 media-audio-track-menu-button[mediaaudiotrackunavailable], 1387 media-rendition-menu[mediarenditionunavailable], 1388 media-rendition-menu-button[mediarenditionunavailable], 1389 media-volume-range[mediavolumeunavailable], 1390 media-airplay-button[mediaairplayunavailable], 1391 media-fullscreen-button[mediafullscreenunavailable], 1392 media-cast-button[mediacastunavailable], 1393 media-pip-button[mediapipunavailable] { 1394 display: none; 1395 } 1396 </style> 1397`;class cu extends k.HTMLElement{constructor(){super(),Wn(this,ph),Wn(this,Nl),Wn(this,gn,void 0),Wn(this,Ol,void 0),Wn(this,vn,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());const e=new MutationObserver(t=>{var s;this.mediaController&&!((s=this.mediaController)!=null&&s.breakpointsComputed)||t.some(r=>{const n=r.target;return n===this?!0:n.localName!=="media-controller"?!1:!!(sc[r.attributeName]||r.attributeName.startsWith("breakpoint"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(cs.BREAKPOINTS_COMPUTED,this.render),ic(this,ph,Ib).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return(e=mh(this,gn))!=null?e:this.constructor.template}set template(e){if(e===null){this.removeAttribute("template");return}typeof e=="string"?this.setAttribute("template",e):e instanceof HTMLTemplateElement&&(hr(this,gn,e),hr(this,vn,null),this.createRenderer())}get props(){var e,t,s;const r=[...Array.from((t=(e=this.mediaController)==null?void 0:e.attributes)!=null?t:[]).filter(({name:a})=>sc[a]||a.startsWith("breakpoint")),...Array.from(this.attributes)],n={};for(const a of r){const o=(s=sc[a.name])!=null?s:Ek(a.name);let{value:l}=a;l!=null?(dy(l)&&(l=parseFloat(l)),n[o]=l===""?!0:l):n[o]=!1}return n}attributeChangedCallback(e,t,s){e==="template"&&t!=s&&ic(this,Nl,gh).call(this)}connectedCallback(){ic(this,Nl,gh).call(this)}createRenderer(){this.template instanceof HTMLTemplateElement&&this.template!==mh(this,Ol)&&(hr(this,Ol,this.template),this.renderer=new uu(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(Lb.content.cloneNode(!0),this.renderer))}render(){var e;(e=this.renderer)==null||e.update(this.props)}}gn=new WeakMap;Ol=new WeakMap;vn=new WeakMap;ph=new WeakSet;Ib=function(i){if(Object.prototype.hasOwnProperty.call(this,i)){const e=this[i];delete this[i],this[i]=e}};Nl=new WeakSet;gh=function(){var i;const e=this.getAttribute("template");if(!e||e===mh(this,vn))return;const t=this.getRootNode(),s=(i=t?.getElementById)==null?void 0:i.call(t,e);if(s){hr(this,vn,e),hr(this,gn,s),this.createRenderer();return}lw(e)&&(hr(this,vn,e),dw(e).then(r=>{const n=ot.createElement("template");n.innerHTML=r,hr(this,gn,n),this.createRenderer()}).catch(console.error))};cu.observedAttributes=["template"];cu.processor=cm;function lw(i){if(!/^(\/|\.\/|https?:\/\/)/.test(i))return!1;const e=/^https?:\/\//.test(i)?void 0:location.origin;try{new URL(i,e)}catch{return!1}return!0}async function dw(i){const e=await fetch(i);if(e.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${e.status}`);return e.text()}k.customElements.get("media-theme")||k.customElements.define("media-theme",cu);function uw({anchor:i,floating:e,placement:t}){const s=cw({anchor:i,floating:e}),{x:r,y:n}=fw(s,t);return{x:r,y:n}}function cw({anchor:i,floating:e}){return{anchor:hw(i,e.offsetParent),floating:{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}}}function hw(i,e){var t;const s=i.getBoundingClientRect(),r=(t=e?.getBoundingClientRect())!=null?t:{x:0,y:0};return{x:s.x-r.x,y:s.y-r.y,width:s.width,height:s.height}}function fw({anchor:i,floating:e},t){const s=mw(t)==="x"?"y":"x",r=s==="y"?"height":"width",n=Rb(t),a=i.x+i.width/2-e.width/2,o=i.y+i.height/2-e.height/2,l=i[r]/2-e[r]/2;let d;switch(n){case"top":d={x:a,y:i.y-e.height};break;case"bottom":d={x:a,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:o};break;case"left":d={x:i.x-e.width,y:o};break;default:d={x:i.x,y:i.y}}switch(t.split("-")[1]){case"start":d[s]-=l;break;case"end":d[s]+=l;break}return d}function Rb(i){return i.split("-")[0]}function mw(i){return["top","bottom"].includes(Rb(i))?"y":"x"}
1397class fm extends Event{constructor({action:e="auto",relatedTarget:t,...s}){super("invoke",s),this.action=e,this.relatedTarget=t}}class pw extends Event{constructor({newState:e,oldState:t,...s}){super("toggle",s),this.newState=e,this.oldState=t}}var mm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},be=(i,e,t)=>(mm(i,e,"read from private field"),t?t.call(i):e.get(i)),Re=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},wi=(i,e,t,s)=>(mm(i,e,"write to private field"),e.set(i,t),t),xe=(i,e,t)=>(mm(i,e,"access private method"),t),Mi,gr,Fs,Ul,$l,vr,Za,vh,xb,Od,pm,Nd,Fl,Eh,yh,kb,bh,Db,Th,Cb,En,yn,bn,Ja,Ud,gm,_h,wb,vm,Mb,Ah,Pb,Em,Ob,Sh,Nb,Ih,Ub,xa,$d,Lh,$b,ka,Fd,Bl,Rh;function kn({type:i,text:e,value:t,checked:s}){const r=ot.createElement("media-chrome-menu-item");r.type=i,r.part.add("menu-item"),r.part.add(i),r.value=t,r.checked=s;const n=ot.createElement("span");return n.textContent=e,r.append(n),r}function Er(i,e){let t=i.querySelector(`:scope > [slot="${e}"]`);if(t?.nodeName=="SLOT"&&(t=t.assignedElements({flatten:!0})[0]),t)return t=t.cloneNode(!0),t;const s=i.shadowRoot.querySelector(`[name="${e}"] > svg`);return s?s.cloneNode(!0):""}function gw(i){return` 1398 <style> 1399 :host { 1400 font: var(--media-font, 1401 var(--media-font-weight, normal) 1402 var(--media-font-size, 14px) / 1403 var(--media-text-content-height, var(--media-control-height, 24px)) 1404 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 1405 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 1406 --_menu-bg: rgb(20 20 30 / .8); 1407 background: var(--media-menu-background, var(--media-control-background, var(--media-secondary-color, var(--_menu-bg)))); 1408 border-radius: var(--media-menu-border-radius); 1409 border: var(--media-menu-border, none); 1410 display: var(--media-menu-display, inline-flex) !important; 1411 1412 transition: var(--media-menu-transition-in, 1413 visibility 0s, 1414 opacity .2s ease-out, 1415 transform .15s ease-out, 1416 left .2s ease-in-out, 1417 min-width .2s ease-in-out, 1418 min-height .2s ease-in-out 1419 ) !important; 1420 1421 visibility: var(--media-menu-visibility, visible); 1422 opacity: var(--media-menu-opacity, 1); 1423 max-height: var(--media-menu-max-height, var(--_menu-max-height, 300px)); 1424 transform: var(--media-menu-transform-in, translateY(0) scale(1)); 1425 flex-direction: column; 1426 1427 min-height: 0; 1428 position: relative; 1429 bottom: var(--_menu-bottom); 1430 box-sizing: border-box; 1431 } 1432 1433 @-moz-document url-prefix() { 1434 :host{ 1435 --_menu-bg: rgb(20 20 30); 1436 } 1437 } 1438 1439 :host([hidden]) { 1440 transition: var(--media-menu-transition-out, 1441 visibility .15s ease-in, 1442 opacity .15s ease-in, 1443 transform .15s ease-in 1444 ) !important; 1445 visibility: var(--media-menu-hidden-visibility, hidden); 1446 opacity: var(--media-menu-hidden-opacity, 0); 1447 max-height: var(--media-menu-hidden-max-height, 1448 var(--media-menu-max-height, var(--_menu-max-height, 300px))); 1449 transform: var(--media-menu-transform-out, translateY(2px) scale(.99)); 1450 pointer-events: none; 1451 } 1452 1453 :host([slot="submenu"]) { 1454 background: none; 1455 width: 100%; 1456 min-height: 100%; 1457 position: absolute; 1458 bottom: 0; 1459 right: -100%; 1460 } 1461 1462 #container { 1463 display: flex; 1464 flex-direction: column; 1465 min-height: 0; 1466 transition: transform .2s ease-out; 1467 transform: translate(0, 0); 1468 } 1469 1470 #container.has-expanded { 1471 transition: transform .2s ease-in; 1472 transform: translate(-100%, 0); 1473 } 1474 1475 button { 1476 background: none; 1477 color: inherit; 1478 border: none; 1479 padding: 0; 1480 font: inherit; 1481 outline: inherit; 1482 display: inline-flex; 1483 align-items: center; 1484 } 1485 1486 slot[name="header"][hidden] { 1487 display: none; 1488 } 1489 1490 slot[name="header"] > *, 1491 slot[name="header"]::slotted(*) { 1492 padding: .4em .7em; 1493 border-bottom: 1px solid rgb(255 255 255 / .25); 1494 cursor: var(--media-cursor, default); 1495 } 1496 1497 slot[name="header"] > button[part~="back"], 1498 slot[name="header"]::slotted(button[part~="back"]) { 1499 cursor: var(--media-cursor, pointer); 1500 } 1501 1502 svg[part~="back"] { 1503 height: var(--media-menu-icon-height, var(--media-control-height, 24px)); 1504 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 1505 display: block; 1506 margin-right: .5ch; 1507 } 1508 1509 slot:not([name]) { 1510 gap: var(--media-menu-gap); 1511 flex-direction: var(--media-menu-flex-direction, column); 1512 overflow: var(--media-menu-overflow, hidden auto); 1513 display: flex; 1514 min-height: 0; 1515 } 1516 1517 :host([role="menu"]) slot:not([name]) { 1518 padding-block: .4em; 1519 } 1520 1521 slot:not([name])::slotted([role="menu"]) { 1522 background: none; 1523 } 1524 1525 media-chrome-menu-item > span { 1526 margin-right: .5ch; 1527 max-width: var(--media-menu-item-max-width); 1528 text-overflow: ellipsis; 1529 overflow: hidden; 1530 } 1531 </style> 1532 <style id="layout-row" media="width:0"> 1533 1534 slot[name="header"] > *, 1535 slot[name="header"]::slotted(*) { 1536 padding: .4em .5em; 1537 } 1538 1539 slot:not([name]) { 1540 gap: var(--media-menu-gap, .25em); 1541 flex-direction: var(--media-menu-flex-direction, row); 1542 padding-inline: .5em; 1543 } 1544 1545 media-chrome-menu-item { 1546 padding: .3em .5em; 1547 } 1548 1549 media-chrome-menu-item[aria-checked="true"] { 1550 background: var(--media-menu-item-checked-background, rgb(255 255 255 / .2)); 1551 } 1552 1553 1554 media-chrome-menu-item::part(checked-indicator) { 1555 display: var(--media-menu-item-checked-indicator-display, none); 1556 } 1557 </style> 1558 <div id="container" part="container"> 1559 <slot name="header" hidden> 1560 <button part="back button" aria-label="Back to previous menu"> 1561 <slot name="back-icon"> 1562 <svg aria-hidden="true" viewBox="0 0 20 24" part="back indicator"> 1563 <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"/> 1564 </svg> 1565 </slot> 1566 <slot name="title"></slot> 1567 </button> 1568 </slot> 1569 <slot></slot> 1570 </div> 1571 <slot name="checked-indicator" hidden></slot> 1572 `}const qs={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"};class ii extends k.HTMLElement{constructor(){if(super(),Re(this,vh),Re(this,Od),Re(this,Fl),Re(this,yh),Re(this,bh),Re(this,Th),Re(this,bn),Re(this,Ud),Re(this,_h),Re(this,vm),Re(this,Ah),Re(this,Em),Re(this,Sh),Re(this,Ih),Re(this,xa),Re(this,Lh),Re(this,ka),Re(this,Bl),Re(this,Mi,null),Re(this,gr,null),Re(this,Fs,null),Re(this,Ul,new Set),Re(this,$l,void 0),Re(this,vr,!1),Re(this,Za,null),Re(this,Nd,()=>{const e=be(this,Ul),t=new Set(this.items);for(const s of e)t.has(s)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:s}));for(const s of t)e.has(s)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:s}));wi(this,Ul,t)}),Re(this,En,()=>{xe(this,bn,Ja).call(this),xe(this,Ud,gm).call(this,!1)}),Re(this,yn,()=>{xe(this,bn,Ja).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),wi(this,$l,new MutationObserver(be(this,Nd))),be(this,$l).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[qs.DISABLED,qs.HIDDEN,qs.STYLE,qs.ANCHOR,Te.MEDIA_CONTROLLER]}static formatMenuItemText(e,t){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":xe(this,vh,xb).call(this,e);break;case"invoke":xe(this,yh,kb).call(this,e);break;case"click":xe(this,_h,wb).call(this,e);break;case"toggle":xe(this,Ah,Pb).call(this,e);break;case"focusout":xe(this,Sh,Nb).call(this,e);break;case"keydown":xe(this,Ih,Ub).call(this,e);break}}connectedCallback(){var e,t;wi(this,Za,by(this.shadowRoot,":host")),xe(this,Fl,Eh).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),wi(this,Mi,Gc(this)),(t=(e=be(this,Mi))==null?void 0:e.associateElement)==null||t.call(e,this),this.hidden||(In(eo(this),be(this,En)),In(this,be(this,yn))),xe(this,Od,pm).call(this)}disconnectedCallback(){var e,t;Ln(eo(this),be(this,En)),Ln(this,be(this,yn)),this.disable(),(t=(e=be(this,Mi))==null?void 0:e.unassociateElement)==null||t.call(e,this),wi(this,Mi,null)}attributeChangedCallback(e,t,s){var r,n,a,o;e===qs.HIDDEN&&s!==t?(be(this,vr)||wi(this,vr,!0),this.hidden?xe(this,Th,Cb).call(this):xe(this,bh,Db).call(this),this.dispatchEvent(new pw({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===Te.MEDIA_CONTROLLER?(t&&((n=(r=be(this,Mi))==null?void 0:r.unassociateElement)==null||n.call(r,this),wi(this,Mi,null)),s&&this.isConnected&&(wi(this,Mi,Gc(this)),(o=(a=be(this,Mi))==null?void 0:a.associateElement)==null||o.call(a,this))):e===qs.DISABLED&&s!==t?s==null?this.enable():this.disable():e===qs.STYLE&&s!==t&&xe(this,Fl,Eh).call(this)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}get anchor(){return this.getAttribute("anchor")}
1572set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?(e=Jd(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(vw)}get radioGroupItems(){return this.items.filter(e=>e.role==="menuitemradio")}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,t;return(t=(e=this.checkedItems[0])==null?void 0:e.value)!=null?t:""}set value(e){const t=this.items.find(s=>s.value===e);t&&xe(this,Bl,Rh).call(this,t)}focus(){if(wi(this,gr,Mf()),this.items.length){xe(this,ka,Fd).call(this,this.items[0]),this.items[0].focus();return}const e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');e?.focus()}handleSelect(e){var t;const s=xe(this,xa,$d).call(this,e);s&&(xe(this,Bl,Rh).call(this,s,s.type==="checkbox"),be(this,Fs)&&!this.hidden&&((t=be(this,gr))==null||t.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var t,s;const{key:r}=e,n=this.items,a=(s=(t=xe(this,xa,$d).call(this,e))!=null?t:xe(this,Lh,$b).call(this))!=null?s:n[0],o=n.indexOf(a);let l=Math.max(0,o);r==="ArrowDown"?l++:r==="ArrowUp"?l--:e.key==="Home"?l=0:e.key==="End"&&(l=n.length-1),l<0&&(l=n.length-1),l>n.length-1&&(l=0),xe(this,ka,Fd).call(this,n[l]),n[l].focus()}}Mi=new WeakMap;gr=new WeakMap;Fs=new WeakMap;Ul=new WeakMap;$l=new WeakMap;vr=new WeakMap;Za=new WeakMap;vh=new WeakSet;xb=function(i){const e=i.target;for(const t of e.assignedNodes({flatten:!0}))t.nodeType===3&&t.textContent.trim()===""&&t.remove();["header","title"].includes(e.name)&&xe(this,Od,pm).call(this),e.name||be(this,Nd).call(this)};Od=new WeakSet;pm=function(){const i=this.shadowRoot.querySelector('slot[name="header"]'),e=this.shadowRoot.querySelector('slot[name="title"]');i.hidden=e.assignedNodes().length===0&&i.assignedNodes().length===0};Nd=new WeakMap;Fl=new WeakSet;Eh=function(){var i;const e=this.shadowRoot.querySelector("#layout-row"),t=(i=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:i.trim();e.setAttribute("media",t==="row"?"":"width:0")};yh=new WeakSet;kb=function(i){wi(this,Fs,i.relatedTarget),fs(this,i.relatedTarget)||(this.hidden=!this.hidden)};bh=new WeakSet;Db=function(){var i;(i=be(this,Fs))==null||i.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),In(eo(this),be(this,En)),In(this,be(this,yn))};Th=new WeakSet;Cb=function(){var i;(i=be(this,Fs))==null||i.setAttribute("aria-expanded","false"),Ln(eo(this),be(this,En)),Ln(this,be(this,yn))};En=new WeakMap;yn=new WeakMap;bn=new WeakSet;Ja=function(i){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;const{x:e,y:t}=uw({anchor:this.anchorElement,floating:this,placement:"top-start"});i??(i=this.offsetWidth);const r=eo(this).getBoundingClientRect(),n=r.width-e-i,a=r.height-t-this.offsetHeight,{style:o}=be(this,Za);o.setProperty("position","absolute"),o.setProperty("right",`${Math.max(0,n)}px`),o.setProperty("--_menu-bottom",`${a}px`);const l=getComputedStyle(this),u=o.getPropertyValue("--_menu-bottom")===l.bottom?a:parseFloat(l.bottom),c=r.height-u-parseFloat(l.marginBottom);this.style.setProperty("--_menu-max-height",`${c}px`)};Ud=new WeakSet;gm=function(i){const e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),t=e?.querySelector('[role="menu"]'),{style:s}=be(this,Za);if(i||s.setProperty("--media-menu-transition-in","none"),t){const r=t.offsetHeight,n=Math.max(t.offsetWidth,e.offsetWidth);this.style.setProperty("min-width",`${n}px`),this.style.setProperty("min-height",`${r}px`),xe(this,bn,Ja).call(this,n)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),xe(this,bn,Ja).call(this);s.removeProperty("--media-menu-transition-in")};_h=new WeakSet;wb=function(i){var e;if(i.stopPropagation(),i.composedPath().includes(be(this,vm,Mb))){(e=be(this,gr))==null||e.focus(),this.hidden=!0;return}const t=xe(this,xa,$d).call(this,i);!t||t.hasAttribute("disabled")||(xe(this,ka,Fd).call(this,t),this.handleSelect(i))};vm=new WeakSet;Mb=function(){var i;return(i=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))==null?void 0:i.find(t=>t.matches('button[part~="back"]'))};Ah=new WeakSet;Pb=function(i){if(i.target===this)return;xe(this,Em,Ob).call(this);const e=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(const t of e)t.invokeTargetElement!=i.target&&i.newState=="open"&&t.getAttribute("aria-expanded")=="true"&&!t.invokeTargetElement.hidden&&t.invokeTargetElement.dispatchEvent(new fm({relatedTarget:t}));for(const t of e)t.setAttribute("aria-expanded",`${!t.submenuElement.hidden}`);xe(this,Ud,gm).call(this,!0)};Em=new WeakSet;Ob=function(){const e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)};Sh=new WeakSet;Nb=function(i){var e;fs(this,i.relatedTarget)||(be(this,vr)&&((e=be(this,gr))==null||e.focus()),be(this,Fs)&&be(this,Fs)!==i.relatedTarget&&!this.hidden&&(this.hidden=!0))};Ih=new WeakSet;Ub=function(i){var e,t,s,r,n;const{key:a,ctrlKey:o,altKey:l,metaKey:d}=i;if(!(o||l||d)&&this.keysUsed.includes(a))if(i.preventDefault(),i.stopPropagation(),a==="Tab"){if(be(this,vr)){this.hidden=!0;return}i.shiftKey?(t=(e=this.previousElementSibling)==null?void 0:e.focus)==null||t.call(e):(r=(s=this.nextElementSibling)==null?void 0:s.focus)==null||r.call(s),this.blur()}else a==="Escape"?((n=be(this,gr))==null||n.focus(),be(this,vr)&&(this.hidden=!0)):a==="Enter"||a===" "?this.handleSelect(i):this.handleMove(i)};xa=new WeakSet;$d=function(i){return i.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};Lh=new WeakSet;$b=function(){return this.items.find(i=>i.tabIndex===0)};ka=new WeakSet;
vendor: 4,685 bytes, lines 1572-1686
1572Fd=function(i){for(const e of this.items)e.tabIndex=e===i?0:-1};Bl=new WeakSet;Rh=function(i,e){const t=[...this.checkedItems];i.type==="radio"&&this.radioGroupItems.forEach(s=>s.checked=!1),e?i.checked=!i.checked:i.checked=!0,this.checkedItems.some((s,r)=>s!=t[r])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};ii.shadowRootOptions={mode:"open"};ii.getTemplateHTML=gw;function vw(i){return["menuitem","menuitemradio","menuitemcheckbox"].includes(i?.role)}function eo(i){var e;return(e=i.getAttribute("bounds")?wn(i,`#${i.getAttribute("bounds")}`):kt(i)||i.parentElement)!=null?e:i}k.customElements.get("media-chrome-menu")||k.customElements.define("media-chrome-menu",ii);var ym=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Gi=(i,e,t)=>(ym(i,e,"read from private field"),t?t.call(i):e.get(i)),es=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},rc=(i,e,t,s)=>(ym(i,e,"write to private field"),e.set(i,t),t),mi=(i,e,t)=>(ym(i,e,"access private method"),t),Hl,Da,xh,Fb,Bd,bm,Tm,Bb,Ki,Dn,to,kh,Hb,Gl,Dh;function Ew(i){return` 1573 <style> 1574 :host { 1575 transition: var(--media-menu-item-transition, 1576 background .15s linear, 1577 opacity .2s ease-in-out 1578 ); 1579 outline: var(--media-menu-item-outline, 0); 1580 outline-offset: var(--media-menu-item-outline-offset, -1px); 1581 cursor: var(--media-cursor, pointer); 1582 display: flex; 1583 align-items: center; 1584 align-self: stretch; 1585 justify-self: stretch; 1586 white-space: nowrap; 1587 white-space-collapse: collapse; 1588 text-wrap: nowrap; 1589 padding: .4em .8em .4em 1em; 1590 } 1591 1592 :host(:focus-visible) { 1593 box-shadow: var(--media-menu-item-focus-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 1594 outline: var(--media-menu-item-hover-outline, 0); 1595 outline-offset: var(--media-menu-item-hover-outline-offset, var(--media-menu-item-outline-offset, -1px)); 1596 } 1597 1598 :host(:hover) { 1599 cursor: var(--media-cursor, pointer); 1600 background: var(--media-menu-item-hover-background, rgb(92 92 102 / .5)); 1601 outline: var(--media-menu-item-hover-outline); 1602 outline-offset: var(--media-menu-item-hover-outline-offset, var(--media-menu-item-outline-offset, -1px)); 1603 } 1604 1605 :host([aria-checked="true"]) { 1606 background: var(--media-menu-item-checked-background); 1607 } 1608 1609 :host([hidden]) { 1610 display: none; 1611 } 1612 1613 :host([disabled]) { 1614 pointer-events: none; 1615 color: rgba(255, 255, 255, .3); 1616 } 1617 1618 slot:not([name]) { 1619 width: 100%; 1620 } 1621 1622 slot:not([name="submenu"]) { 1623 display: inline-flex; 1624 align-items: center; 1625 transition: inherit; 1626 opacity: var(--media-menu-item-opacity, 1); 1627 } 1628 1629 slot[name="description"] { 1630 justify-content: end; 1631 } 1632 1633 slot[name="description"] > span { 1634 display: inline-block; 1635 margin-inline: 1em .2em; 1636 max-width: var(--media-menu-item-description-max-width, 100px); 1637 text-overflow: ellipsis; 1638 overflow: hidden; 1639 font-size: .8em; 1640 font-weight: 400; 1641 text-align: right; 1642 position: relative; 1643 top: .04em; 1644 } 1645 1646 slot[name="checked-indicator"] { 1647 display: none; 1648 } 1649 1650 :host(:is([role="menuitemradio"],[role="menuitemcheckbox"])) slot[name="checked-indicator"] { 1651 display: var(--media-menu-item-checked-indicator-display, inline-block); 1652 } 1653 1654 1655 svg, img, ::slotted(svg), ::slotted(img) { 1656 height: var(--media-menu-item-icon-height, var(--media-control-height, 24px)); 1657 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 1658 display: block; 1659 } 1660 1661 1662 [part~="indicator"], 1663 ::slotted([part~="indicator"]) { 1664 fill: var(--media-menu-item-indicator-fill, 1665 var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)))); 1666 height: var(--media-menu-item-indicator-height, 1.25em); 1667 margin-right: .5ch; 1668 } 1669 1670 [part~="checked-indicator"] { 1671 visibility: hidden; 1672 } 1673 1674 :host([aria-checked="true"]) [part~="checked-indicator"] { 1675 visibility: visible; 1676 } 1677 </style> 1678 <slot name="checked-indicator"> 1679 <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator"> 1680 <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"/> 1681 </svg> 1682 </slot> 1683 <slot name="prefix"></slot> 1684 <slot></slot> 1685 <slot name="description"></slot> 1686 <slot name="suffix">
1687 ${this.getSuffixSlotInnerHTML(i)} 1688 </slot> 1689 <slot name="submenu"></slot> 1690 `}function yw(i){return""}const Yt={TYPE:"type",VALUE:"value",CHECKED:"checked",DISABLED:"disabled"};class Hs extends k.HTMLElement{constructor(){if(super(),es(this,xh),es(this,Bd),es(this,Tm),es(this,Dn),es(this,kh),es(this,Gl),es(this,Hl,!1),es(this,Da,void 0),es(this,Ki,()=>{var e,t;this.submenuElement.items&&this.setAttribute("submenusize",`${this.submenuElement.items.length}`);const s=this.shadowRoot.querySelector('slot[name="description"]'),r=(e=this.submenuElement.checkedItems)==null?void 0:e[0],n=(t=r?.dataset.description)!=null?t:r?.text,a=ot.createElement("span");a.textContent=n??"",s.replaceChildren(a)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Vt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.shadowRoot.addEventListener("slotchange",this)}static get observedAttributes(){return[Yt.TYPE,Yt.DISABLED,Yt.CHECKED,Yt.VALUE]}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),Yn(this)&&!this.hasAttribute("aria-checked")&&this.setAttribute("aria-checked","false"),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":mi(this,xh,Fb).call(this,e);break;case"click":this.handleClick(e);break;case"keydown":mi(this,kh,Hb).call(this,e);break;case"keyup":mi(this,Dn,to).call(this,e);break}}attributeChangedCallback(e,t,s){e===Yt.CHECKED&&Yn(this)&&!Gi(this,Hl)?this.setAttribute("aria-checked",s!=null?"true":"false"):e===Yt.TYPE&&s!==t?this.role="menuitem"+s:e===Yt.DISABLED&&s!==t&&(s==null?this.enable():this.disable())}connectedCallback(){this.hasAttribute(Yt.DISABLED)||this.enable(),this.role="menuitem"+this.type,rc(this,Da,Ch(this,this.parentNode)),mi(this,Gl,Dh).call(this),this.submenuElement&&mi(this,Bd,bm).call(this)}disconnectedCallback(){this.disable(),mi(this,Gl,Dh).call(this),rc(this,Da,null)}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?(e=Jd(this))==null?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(e=this.getAttribute(Yt.TYPE))!=null?e:""}set type(e){this.setAttribute(Yt.TYPE,`${e}`)}get value(){var e;return(e=this.getAttribute(Yt.VALUE))!=null?e:this.text}set value(e){this.setAttribute(Yt.VALUE,e)}get text(){var e;return((e=this.textContent)!=null?e:"").trim()}get checked(){if(Yn(this))return this.getAttribute("aria-checked")==="true"}set checked(e){Yn(this)&&(rc(this,Hl,!0),this.setAttribute("aria-checked",e?"true":"false"),e?this.part.add("checked"):this.part.remove("checked"))}handleClick(e){Yn(this)||this.invokeTargetElement&&fs(this,e.target)&&this.invokeTargetElement.dispatchEvent(new fm({relatedTarget:this}))}get keysUsed(){return["Enter"," "]}}Hl=new WeakMap;Da=new WeakMap;xh=new WeakSet;Fb=function(i){const e=i.target;if(!e?.name)for(const s of e.assignedNodes({flatten:!0}))s instanceof Text&&s.textContent.trim()===""&&s.remove();e.name==="submenu"&&(this.submenuElement?mi(this,Bd,bm).call(this):mi(this,Tm,Bb).call(this))};Bd=new WeakSet;bm=async function(){this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",`${!this.submenuElement.hidden}`),this.submenuElement.addEventListener("change",Gi(this,Ki)),this.submenuElement.addEventListener("addmenuitem",Gi(this,Ki)),this.submenuElement.addEventListener("removemenuitem",Gi(this,Ki)),Gi(this,Ki).call(this)};Tm=new WeakSet;Bb=function(){this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.submenuElement.removeEventListener("change",Gi(this,Ki)),this.submenuElement.removeEventListener("addmenuitem",Gi(this,Ki)),this.submenuElement.removeEventListener("removemenuitem",Gi(this,Ki)),Gi(this,Ki).call(this)};Ki=new WeakMap;Dn=new WeakSet;to=function(i){const{key:e}=i;if(!this.keysUsed.includes(e)){this.removeEventListener("keyup",mi(this,Dn,to));return}this.handleClick(i)};kh=new WeakSet;Hb=function(i){const{metaKey:e,altKey:t,key:s}=i;
1690if(e||t||!this.keysUsed.includes(s)){this.removeEventListener("keyup",mi(this,Dn,to));return}this.addEventListener("keyup",mi(this,Dn,to),{once:!0})};Gl=new WeakSet;Dh=function(){var i;const e=(i=Gi(this,Da))==null?void 0:i.radioGroupItems;if(!e)return;let t=e.filter(s=>s.getAttribute("aria-checked")==="true").pop();t||(t=e[0]);for(const s of e)s.setAttribute("aria-checked","false");t?.setAttribute("aria-checked","true")};Hs.shadowRootOptions={mode:"open"};Hs.getTemplateHTML=Ew;Hs.getSuffixSlotInnerHTML=yw;function Yn(i){return i.type==="radio"||i.type==="checkbox"}function Ch(i,e){if(!i)return null;const{host:t}=i.getRootNode();return!e&&t?Ch(i,t):e?.items?e:Ch(e,e?.parentNode)}k.customElements.get("media-chrome-menu-item")||k.customElements.define("media-chrome-menu-item",Hs);function bw(i){return` 1691 ${ii.getTemplateHTML(i)} 1692 <style> 1693 :host { 1694 --_menu-bg: rgb(20 20 30 / .8); 1695 background: var(--media-settings-menu-background, 1696 var(--media-menu-background, 1697 var(--media-control-background, 1698 var(--media-secondary-color, var(--_menu-bg))))); 1699 min-width: var(--media-settings-menu-min-width, 170px); 1700 border-radius: 2px 2px 0 0; 1701 overflow: hidden; 1702 } 1703 1704 @-moz-document url-prefix() { 1705 :host{ 1706 --_menu-bg: rgb(20 20 30); 1707 } 1708 } 1709 1710 :host([role="menu"]) { 1711 1712 justify-content: end; 1713 } 1714 1715 slot:not([name]) { 1716 justify-content: var(--media-settings-menu-justify-content); 1717 flex-direction: var(--media-settings-menu-flex-direction, column); 1718 overflow: visible; 1719 } 1720 1721 #container.has-expanded { 1722 --media-settings-menu-item-opacity: 0; 1723 } 1724 </style> 1725 `}class Gb extends ii{get anchorElement(){return this.anchor!=="auto"?super.anchorElement:kt(this).querySelector("media-settings-menu-button")}}Gb.getTemplateHTML=bw;k.customElements.get("media-settings-menu")||k.customElements.define("media-settings-menu",Gb);function Tw(i){return` 1726 ${Hs.getTemplateHTML.call(this,i)} 1727 <style> 1728 slot:not([name="submenu"]) { 1729 opacity: var(--media-settings-menu-item-opacity, var(--media-menu-item-opacity)); 1730 } 1731 1732 :host([aria-expanded="true"]:hover) { 1733 background: transparent; 1734 } 1735 </style> 1736 `}function _w(i){return` 1737 <svg aria-hidden="true" viewBox="0 0 20 24"> 1738 <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"/> 1739 </svg> 1740 `}class hu extends Hs{}hu.shadowRootOptions={mode:"open"};hu.getTemplateHTML=Tw;hu.getSuffixSlotInnerHTML=_w;k.customElements.get("media-settings-menu-item")||k.customElements.define("media-settings-menu-item",hu);class On extends Et{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?(e=Jd(this))==null?void 0:e.querySelector(`#${this.invokeTarget}`):null}handleClick(){var e;(e=this.invokeTargetElement)==null||e.dispatchEvent(new fm({relatedTarget:this}))}}k.customElements.get("media-chrome-menu-button")||k.customElements.define("media-chrome-menu-button",On);function Aw(){return` 1741 <style> 1742 :host([aria-expanded="true"]) slot[name=tooltip] { 1743 display: none; 1744 } 1745 </style> 1746 <slot name="icon"> 1747 <svg aria-hidden="true" viewBox="0 0 24 24"> 1748 <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"/> 1749 </svg> 1750 </slot> 1751 `}function Sw(){return Z("Settings")}class _m extends On{static get observedAttributes(){return[...super.observedAttributes,"target"]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",Z("settings"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:kt(this).querySelector("media-settings-menu")}}_m.getSlotTemplateHTML=Aw;_m.getTooltipContentHTML=Sw;k.customElements.get("media-settings-menu-button")||k.customElements.define("media-settings-menu-button",_m);var Am=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Kb=(i,e,t)=>(Am(i,e,"read from private field"),t?t.call(i):e.get(i)),Bo=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},wh=(i,e,t,s)=>(Am(i,e,"write to private field"),e.set(i,t),t),Ho=(i,e,t)=>(Am(i,e,"access private method"),t),fa,Hd,Kl,Mh,Vl,Ph;class Iw extends ii{constructor(){super(...arguments),Bo(this,Kl),Bo(this,Vl),Bo(this,fa,[]),Bo(this,Hd,void 0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_AUDIO_TRACK_LIST,_.MEDIA_AUDIO_TRACK_ENABLED,_.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_AUDIO_TRACK_ENABLED&&t!==s?this.value=s:e===_.MEDIA_AUDIO_TRACK_LIST&&t!==s&&(wh(this,fa,pk(s??"")),Ho(this,Kl,Mh).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Ho(this,Vl,Ph))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Ho(this,Vl,Ph))}get anchorElement(){var e;return this.anchor!=="auto"?super.anchorElement:(e=kt(this))==null?void 0:e.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return Kb(this,fa)}set mediaAudioTrackList(e){wh(this,fa,e),Ho(this,Kl,Mh).call(this)}get mediaAudioTrackEnabled(){var e;return(e=Oe(this,_.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){Ne(this,_.MEDIA_AUDIO_TRACK_ENABLED,e)}}fa=new WeakMap;Hd=new WeakMap;Kl=new WeakSet;Mh=function(){if(Kb(this,Hd)===JSON.stringify(this.mediaAudioTrackList))return;wh(this,Hd,JSON.stringify(this.mediaAudioTrackList));const i=this.mediaAudioTrackList;this.defaultSlot.textContent="",i.sort((e,t)=>
1751e.id.localeCompare(t.id,void 0,{numeric:!0}));for(const e of i){const t=this.formatMenuItemText(e.label,e),s=kn({type:"radio",text:t,value:`${e.id}`,checked:e.enabled});s.prepend(Er(this,"checked-indicator")),this.defaultSlot.append(s)}};Vl=new WeakSet;Ph=function(){if(this.value==null)return;const i=new k.CustomEvent(X.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};k.customElements.get("media-audio-track-menu")||k.customElements.define("media-audio-track-menu",Iw);const Lw=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1752 <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/> 1753 <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"/> 1754</svg>`;function Rw(){return` 1755 <style> 1756 :host([aria-expanded="true"]) slot[name=tooltip] { 1757 display: none; 1758 } 1759 </style> 1760 <slot name="icon">${Lw}</slot> 1761 `}function xw(){return Z("Audio")}const l0=i=>{const e=Z("Audio");i.setAttribute("aria-label",e)};class Sm extends On{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_AUDIO_TRACK_ENABLED,_.MEDIA_AUDIO_TRACK_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),l0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_LANG&&l0(this)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=kt(this))==null?void 0:e.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var e;return(e=Oe(this,_.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){Ne(this,_.MEDIA_AUDIO_TRACK_ENABLED,e)}}Sm.getSlotTemplateHTML=Rw;Sm.getTooltipContentHTML=xw;k.customElements.get("media-audio-track-menu-button")||k.customElements.define("media-audio-track-menu-button",Sm);var Im=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},kw=(i,e,t)=>(Im(i,e,"read from private field"),e.get(i)),nc=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Dw=(i,e,t,s)=>(Im(i,e,"write to private field"),e.set(i,t),t),ac=(i,e,t)=>(Im(i,e,"access private method"),t),Gd,Oh,Vb,Wl,Nh;const Cw=` 1762 <svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator"> 1763 <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"/> 1764 </svg>`;function ww(i){return` 1765 ${ii.getTemplateHTML(i)} 1766 <slot name="captions-indicator" hidden>${Cw}</slot> 1767 `}class Wb extends ii{constructor(){super(...arguments),nc(this,Oh),nc(this,Wl),nc(this,Gd,void 0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_SUBTITLES_LIST,_.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_SUBTITLES_LIST&&t!==s?ac(this,Oh,Vb).call(this):e===_.MEDIA_SUBTITLES_SHOWING&&t!==s&&(this.value=s)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",ac(this,Wl,Nh))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",ac(this,Wl,Nh))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:kt(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return d0(this,_.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){u0(this,_.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return d0(this,_.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){u0(this,_.MEDIA_SUBTITLES_SHOWING,e)}}Gd=new WeakMap;Oh=new WeakSet;Vb=function(){var i;if(kw(this,Gd)===JSON.stringify(this.mediaSubtitlesList))return;Dw(this,Gd,JSON.stringify(this.mediaSubtitlesList)),this.defaultSlot.textContent="";const e=!this.value,t=kn({type:"radio",text:this.formatMenuItemText(Z("Off")),value:"off",checked:e});t.prepend(Er(this,"checked-indicator")),this.defaultSlot.append(t);const s=this.mediaSubtitlesList;for(const r of s){const n=kn({type:"radio",text:this.formatMenuItemText(r.label,r),value:Yc(r),checked:this.value==Yc(r)});n.prepend(Er(this,"checked-indicator")),((i=r.kind)!=null?i:"subs")==="captions"&&n.append(Er(this,"captions-indicator")),this.defaultSlot.append(n)}};Wl=new WeakSet;Nh=function(){const i=this.mediaSubtitlesShowing,e=this.getAttribute(_.MEDIA_SUBTITLES_SHOWING),t=this.value!==e;if(i?.length&&t&&this.dispatchEvent(new k.CustomEvent(X.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i})),!this.value||!t)return;const s=new k.CustomEvent(X.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(s)};Wb.getTemplateHTML=ww;const d0=(i,e)=>{const t=i.getAttribute(e);return t?ru(t):[]},u0=(i,e,t)=>{if(!t?.length){i.removeAttribute(e);return}const s=Ya(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};k.customElements.get("media-captions-menu")||k.customElements.define("media-captions-menu",Wb);const Mw=`<svg aria-hidden="true" viewBox="0 0 26 24"> 1768 <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
17680 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"/> 1769</svg>`,Pw=`<svg aria-hidden="true" viewBox="0 0 26 24"> 1770 <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"/> 1771</svg>`;function Ow(){return` 1772 <style> 1773 :host([data-captions-enabled="true"]) slot[name=off] { 1774 display: none !important; 1775 } 1776 1777 1778 :host(:not([data-captions-enabled="true"])) slot[name=on] { 1779 display: none !important; 1780 } 1781 1782 :host([aria-expanded="true"]) slot[name=tooltip] { 1783 display: none; 1784 } 1785 </style> 1786 1787 <slot name="icon"> 1788 <slot name="on">${Mw}</slot> 1789 <slot name="off">${Pw}</slot> 1790 </slot> 1791 `}function Nw(){return Z("Captions")}const c0=i=>{i.setAttribute("data-captions-enabled",Dy(i).toString())},h0=i=>{i.setAttribute("aria-label",Z("closed captions"))};class Lm extends On{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_SUBTITLES_LIST,_.MEDIA_SUBTITLES_SHOWING,_.MEDIA_LANG]}connectedCallback(){super.connectedCallback(),h0(this),c0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_SUBTITLES_SHOWING?c0(this):e===_.MEDIA_LANG&&h0(this)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=kt(this))==null?void 0:e.querySelector("media-captions-menu")}get mediaSubtitlesList(){return f0(this,_.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){m0(this,_.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return f0(this,_.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){m0(this,_.MEDIA_SUBTITLES_SHOWING,e)}}Lm.getSlotTemplateHTML=Ow;Lm.getTooltipContentHTML=Nw;const f0=(i,e)=>{const t=i.getAttribute(e);return t?ru(t):[]},m0=(i,e,t)=>{if(!t?.length){i.removeAttribute(e);return}const s=Ya(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};k.customElements.get("media-captions-menu-button")||k.customElements.define("media-captions-menu-button",Lm);var Yb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Jr=(i,e,t)=>(Yb(i,e,"read from private field"),t?t.call(i):e.get(i)),oc=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},qn=(i,e,t)=>(Yb(i,e,"access private method"),t),Ds,ma,Yl,ql,Uh;const lc={RATES:"rates"};class Uw extends ii{constructor(){super(),oc(this,ma),oc(this,ql),oc(this,Ds,new Nf(this,lc.RATES,{defaultValue:ob})),qn(this,ma,Yl).call(this)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PLAYBACK_RATE,lc.RATES]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_PLAYBACK_RATE&&t!=s?this.value=s:e===lc.RATES&&t!=s&&(Jr(this,Ds).value=s,qn(this,ma,Yl).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",qn(this,ql,Uh))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",qn(this,ql,Uh))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:kt(this).querySelector("media-playback-rate-menu-button")}get rates(){return Jr(this,Ds)}set rates(e){e?Array.isArray(e)?Jr(this,Ds).value=e.join(" "):typeof e=="string"&&(Jr(this,Ds).value=e):Jr(this,Ds).value="",qn(this,ma,Yl).call(this)}get mediaPlaybackRate(){return Pe(this,_.MEDIA_PLAYBACK_RATE,on)}set mediaPlaybackRate(e){We(this,_.MEDIA_PLAYBACK_RATE,e)}}Ds=new WeakMap;ma=new WeakSet;Yl=function(){this.defaultSlot.textContent="";for(const i of Jr(this,Ds)){const e=kn({type:"radio",text:this.formatMenuItemText(`${i}x`,i),value:i,checked:this.mediaPlaybackRate===Number(i)});
1791e.prepend(Er(this,"checked-indicator")),this.defaultSlot.append(e)}};ql=new WeakSet;Uh=function(){if(!this.value)return;const i=new k.CustomEvent(X.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};k.customElements.get("media-playback-rate-menu")||k.customElements.define("media-playback-rate-menu",Uw);const jl=1;function $w(i){return` 1792 <style> 1793 :host { 1794 min-width: 5ch; 1795 padding: var(--media-button-padding, var(--media-control-padding, 10px 5px)); 1796 } 1797 1798 :host([aria-expanded="true"]) slot[name=tooltip] { 1799 display: none; 1800 } 1801 </style> 1802 <slot name="icon">${i.mediaplaybackrate||jl}x</slot> 1803 `}function Fw(){return Z("Playback rate")}class Rm extends On{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PLAYBACK_RATE]}constructor(){var e;super(),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:jl}x`}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),e===_.MEDIA_PLAYBACK_RATE){const r=s?+s:Number.NaN,n=Number.isNaN(r)?jl:r;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",Z("Playback rate {playbackRate}",{playbackRate:n}))}}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:kt(this).querySelector("media-playback-rate-menu")}get mediaPlaybackRate(){return Pe(this,_.MEDIA_PLAYBACK_RATE,jl)}set mediaPlaybackRate(e){We(this,_.MEDIA_PLAYBACK_RATE,e)}}Rm.getSlotTemplateHTML=$w;Rm.getTooltipContentHTML=Fw;k.customElements.get("media-playback-rate-menu-button")||k.customElements.define("media-playback-rate-menu-button",Rm);var xm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},pa=(i,e,t)=>(xm(i,e,"read from private field"),t?t.call(i):e.get(i)),Go=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},p0=(i,e,t,s)=>(xm(i,e,"write to private field"),e.set(i,t),t),Nr=(i,e,t)=>(xm(i,e,"access private method"),t),ga,ln,en,va,zl,$h;class Bw extends ii{constructor(){super(...arguments),Go(this,en),Go(this,zl),Go(this,ga,[]),Go(this,ln,{})}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_RENDITION_LIST,_.MEDIA_RENDITION_SELECTED,_.MEDIA_RENDITION_UNAVAILABLE,_.MEDIA_HEIGHT]}static formatMenuItemText(e,t){return super.formatMenuItemText(e,t)}static formatRendition(e,{showBitrate:t=!1}={}){const s=`${Math.min(e.width,e.height)}p`;if(t&&e.bitrate){const r=e.bitrate/1e6,n=`${r.toFixed(r<1?1:0)} Mbps`;return`${s} (${n})`}return this.formatMenuItemText(s,e)}static compareRendition(e,t){var s,r;return t.height===e.height?((s=t.bitrate)!=null?s:0)-((r=e.bitrate)!=null?r:0):t.height-e.height}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_RENDITION_SELECTED&&t!==s?(this.value=s??"auto",Nr(this,en,va).call(this)):e===_.MEDIA_RENDITION_LIST&&t!==s?(p0(this,ga,ck(s)),Nr(this,en,va).call(this)):e===_.MEDIA_HEIGHT&&t!==s&&Nr(this,en,va).call(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Nr(this,zl,$h))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Nr(this,zl,$h))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:kt(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return pa(this,ga)}set mediaRenditionList(e){p0(this,ga,e),Nr(this,en,va).call(this)}get mediaRenditionSelected(){return Oe(this,_.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){Ne(this,_.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return Pe(this,_.MEDIA_HEIGHT)}set mediaHeight(e){We(this,_.MEDIA_HEIGHT,e)}compareRendition(e,t){return this.constructor.compareRendition(e,t)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}formatRendition(e,t){return this.constructor.formatRendition(e,t)}showRenditionBitrate(e){return this.mediaRenditionList.some(t=>t!==e&&t.height===e.height&&t.bitrate!==e.bitrate)}}ga=new WeakMap;ln=new WeakMap;en=new WeakSet;va=function(){if(pa(this,ln).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&pa(this,ln).mediaHeight===this.mediaHeight)return;pa(this,ln).mediaRenditionList=JSON.stringify(this.mediaRenditionList),pa(this,ln).mediaHeight=this.mediaHeight;const i=this.mediaRenditionList.sort(this.compareRendition.bind(this)),e=i.find(a=>a.id===this.mediaRenditionSelected);for(const a of i)a.selected=a===e;this.defaultSlot.textContent="";const t=!this.mediaRenditionSelected;for(const a of i){const o=this.formatRendition(a,{showBitrate:this.showRenditionBitrate(a)}),l=kn({type:"radio",text:o,value:`${a.id}`,checked:a.selected&&!t});
1803l.prepend(Er(this,"checked-indicator")),this.defaultSlot.append(l)}const s=e&&this.showRenditionBitrate(e),r=t?e?this.formatMenuItemText(`${Z("Auto")} • ${this.formatRendition(e,{showBitrate:s})}`,e):this.formatMenuItemText(`${Z("Auto")} (${this.mediaHeight}p)`):this.formatMenuItemText(Z("Auto")),n=kn({type:"radio",text:r,value:"auto",checked:t});n.dataset.description=r,n.prepend(Er(this,"checked-indicator")),this.defaultSlot.append(n)};zl=new WeakSet;$h=function(){if(this.value==null)return;const i=new k.CustomEvent(X.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};k.customElements.get("media-rendition-menu")||k.customElements.define("media-rendition-menu",Bw);const Hw=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1804 <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" /> 1805</svg>`;function Gw(){return` 1806 <style> 1807 :host([aria-expanded="true"]) slot[name=tooltip] { 1808 display: none; 1809 } 1810 </style> 1811 <slot name="icon">${Hw}</slot> 1812 `}function Kw(){return Z("Quality")}class km extends On{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_RENDITION_SELECTED,_.MEDIA_RENDITION_UNAVAILABLE,_.MEDIA_HEIGHT]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",Z("quality"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:kt(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return Oe(this,_.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){Ne(this,_.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return Pe(this,_.MEDIA_HEIGHT)}set mediaHeight(e){We(this,_.MEDIA_HEIGHT,e)}}km.getSlotTemplateHTML=Gw;km.getTooltipContentHTML=Kw;k.customElements.get("media-rendition-menu-button")||k.customElements.define("media-rendition-menu-button",km);var Dm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Oi=(i,e,t)=>(Dm(i,e,"read from private field"),t?t.call(i):e.get(i)),_i=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},qb=(i,e,t,s)=>(Dm(i,e,"write to private field"),e.set(i,t),t),zt=(i,e,t)=>(Dm(i,e,"access private method"),t),Cn,io,fu,ar,dn,Cm,jb,Ql,Fh,Xl,Bh,zb,Kd,Vd,Zl;function Vw(i){return` 1813 ${ii.getTemplateHTML(i)} 1814 <style> 1815 :host { 1816 --_menu-bg: rgb(20 20 30 / .8); 1817 background: var(--media-settings-menu-background, 1818 var(--media-menu-background, 1819 var(--media-control-background, 1820 var(--media-secondary-color, var(--_menu-bg))))); 1821 min-width: var(--media-settings-menu-min-width, 170px); 1822 border-radius: 2px; 1823 overflow: hidden; 1824 } 1825 </style> 1826 `}class Qb extends ii{constructor(){super(),_i(this,io),_i(this,ar),_i(this,Cm),_i(this,Ql),_i(this,Bh),_i(this,Cn,!1),_i(this,Xl,e=>{const t=e.target,s=t?.nodeName==="VIDEO",r=zt(this,Ql,Fh).call(this,t);(s||r)&&(Oi(this,Cn)?zt(this,ar,dn).call(this):zt(this,Bh,zb).call(this,e))}),_i(this,Kd,e=>{const t=e.target,s=this.contains(t),r=e.button===2,n=t?.nodeName==="VIDEO",a=zt(this,Ql,Fh).call(this,t);s||r&&(n||a)||zt(this,ar,dn).call(this)}),_i(this,Vd,e=>{e.key==="Escape"&&zt(this,ar,dn).call(this)}),_i(this,Zl,e=>{var t,s;const r=e.target;if((t=r.matches)!=null&&t.call(r,'button[invoke="copy"]')){const n=(s=r.closest("media-context-menu-item"))==null?void 0:s.querySelector('input[slot="copy"]');n&&navigator.clipboard.writeText(n.value)}zt(this,ar,dn).call(this)}),this.setAttribute("noautohide",""),zt(this,io,fu).call(this)}connectedCallback(){super.connectedCallback(),kt(this).addEventListener("contextmenu",Oi(this,Xl)),this.addEventListener("click",Oi(this,Zl))}disconnectedCallback(){super.disconnectedCallback(),kt(this).removeEventListener("contextmenu",Oi(this,Xl)),this.removeEventListener("click",Oi(this,Zl)),document.removeEventListener("mousedown",Oi(this,Kd)),document.removeEventListener("keydown",Oi(this,Vd))}}Cn=new WeakMap;io=new WeakSet;fu=function(){this.hidden=!Oi(this,Cn)};ar=new WeakSet;dn=function(){qb(this,Cn,!1),zt(this,io,fu).call(this)};Cm=new WeakSet;jb=function(){document.querySelectorAll("media-context-menu").forEach(e
vendor: 4,739 bytes, lines 1826-1839
1826=>{var t;e!==this&&zt(t=e,ar,dn).call(t)})};Ql=new WeakSet;Fh=function(i){return i?i.hasAttribute("slot")&&i.getAttribute("slot")==="media"?!0:i.nodeName.includes("-")&&i.tagName.includes("-")?i.hasAttribute("src")||i.hasAttribute("poster")||i.hasAttribute("preload")||i.hasAttribute("playsinline"):!1:!1};Xl=new WeakMap;Bh=new WeakSet;zb=function(i){i.preventDefault(),zt(this,Cm,jb).call(this),qb(this,Cn,!0),this.style.position="fixed",this.style.left=`${i.clientX}px`,this.style.top=`${i.clientY}px`,zt(this,io,fu).call(this),document.addEventListener("mousedown",Oi(this,Kd),{once:!0}),document.addEventListener("keydown",Oi(this,Vd),{once:!0})};Kd=new WeakMap;Vd=new WeakMap;Zl=new WeakMap;Qb.getTemplateHTML=Vw;k.customElements.get("media-context-menu")||k.customElements.define("media-context-menu",Qb);function Ww(i){return` 1827 ${Hs.getTemplateHTML.call(this,i)} 1828 <style> 1829 ::slotted(*) { 1830 color: var(--media-text-color, white); 1831 text-decoration: none; 1832 border: none; 1833 background: none; 1834 cursor: pointer; 1835 padding: 0; 1836 min-height: var(--media-control-height, 24px); 1837 } 1838 </style> 1839 `}class wm extends Hs{}wm.shadowRootOptions={mode:"open"};wm.getTemplateHTML=Ww;k.customElements.get("media-context-menu-item")||k.customElements.define("media-context-menu-item",wm);var Xb=i=>{throw TypeError(i)},Mm=(i,e,t)=>e.has(i)||Xb("Cannot "+t),Se=(i,e,t)=>(Mm(i,e,"read from private field"),t?t.call(i):e.get(i)),hi=(i,e,t)=>e.has(i)?Xb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Wi=(i,e,t,s)=>(Mm(i,e,"write to private field"),e.set(i,t),t),Je=(i,e,t)=>(Mm(i,e,"access private method"),t),mu=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends mu{}globalThis.DocumentFragment=i}var Pm=class extends mu{},Yw=class extends mu{},qw={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(Pm)}},Jl,jw=class{constructor(e,t={}){hi(this,Jl),Wi(this,Jl,t?.detail)}get detail(){return Se(this,Jl)}initCustomEvent(){}};Jl=new WeakMap;function zw(i,e){return new Pm}var Zb={document:{createElement:zw},DocumentFragment,customElements:qw,CustomEvent:jw,EventTarget:mu,HTMLElement:Pm,HTMLVideoElement:Yw},Jb=typeof window>"u"||typeof globalThis.customElements>"u",$i=Jb?Zb:globalThis,Wd=Jb?Zb.document:globalThis.document;function Qw(i){let e="";return Object.entries(i).forEach(([t,s])=>{s!=null&&(e+=`${Hh(t)}: ${s}; `)}),e?e.trim():void 0}function Hh(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function eT(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Ft(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function tT(i){let e=Xw(i).toString();return e?"?"+e:""}function Xw(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}var iT=(i,e)=>!i||!e?!1:i.contains(e)?!0:iT(i,e.getRootNode().host),sT="mux.com",Zw=()=>{try{return"3.8.0"}catch{}return"UNKNOWN"},Jw=Zw(),rT=()=>Jw,eM=(i,{token:e,customDomain:t=sT,thumbnailTime:s,programTime:r}={})=>{var n;let a=e==null?s:void 0,{aud:o}=(n=mn(e))!=null?n:{};if(!(e&&o!=="t"))return`https://image.${t}/${i}/thumbnail.webp${tT({token:e,time:a,program_time:r})}`},tM=(i,{token:e,customDomain:t=sT,programStartTime:s,programEndTime:r}={})=>{var n;let{aud:a}=(n=mn(e))!=null?n:{};if(!(e&&a!=="s"))return`https://image.${t}/${i}/storyboard.vtt${tT({token:e,format:"webp",program_start_time:s,program_end_time:r})}`},Om=i=>{if(i){if([Ae.LIVE,Ae.ON_DEMAND].includes(i))return i;if(i!=null&&i.includes("live"))return Ae.LIVE}},iM={crossorigin:"crossOrigin",playsinline:"playsInline"};function sM(i){var e;return(e=iM[i])!=null?e:eT(i)}var tn,sn,Rt,rM=class{constructor(e,t){hi(this,tn),hi(this,sn),hi(this,Rt,[]),Wi(this,tn,e),Wi(this,sn,t)}[Symbol.iterator](){return Se(this,Rt).values()}get length(){return Se(this,Rt).length}get value(){var e;return(e=Se(this,Rt).join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(Wi(this,Rt,[]),this.add(...(t=e?.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return Se(this,Rt)[e]}values(){return Se(this,Rt).values()}keys(){return Se(this,Rt).keys()}forEach(e){Se(this,Rt).forEach(e)}add(...e){var t,s;e.forEach(r=>{this.contains(r)||Se(this,Rt).push(r)}),!(this.value===""&&!((t=Se(this,tn))!=null&&t.hasAttribute(`${Se(this,sn)}`)))&&((s=Se(this,tn))==null||s.setAttribute(`${Se(this,sn)}`,`${this.value}`))}remove(...e){var t;e.forEach(s=>{Se(this,Rt).splice(Se(this,Rt).indexOf(s),1)}),(t=Se(this,tn))==null||t.setAttribute(`${Se(this,sn)}`,`${this.value}`)}contains(e){return Se(this,Rt).includes(e)}
vendor: 8,533 bytes, lines 1839-1927
1839toggle(e,t){return typeof t<"u"?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)}};tn=new WeakMap,sn=new WeakMap,Rt=new WeakMap;var nT=`[mux-player ${rT()}]`;function as(...i){console.warn(nT,...i)}function Qt(...i){console.error(nT,...i)}function aT(i){var e;let t=(e=i.message)!=null?e:"";i.context&&(t+=` ${i.context}`),i.file&&(t+=` ${te("Read more: ")} 1840https://github.com/muxinc/elements/blob/main/errors/${i.file}`),as(t)}var bt={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},ir={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},g0=Object.freeze({length:0,start(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),nM=Object.values(bt).filter(i=>bt.PLAYSINLINE!==i),aM=Object.values(ir),oM=[...nM,...aM],lM=class extends $i.HTMLElement{static get observedAttributes(){return oM}constructor(){super()}attributeChangedCallback(i,e,t){var s,r;switch(i){case ir.MUTED:{this.media&&(this.media.muted=t!=null,this.media.defaultMuted=t!=null);return}case ir.VOLUME:{let n=(s=Ft(t))!=null?s:1;this.media&&(this.media.volume=n);return}case ir.PLAYBACKRATE:{let n=(r=Ft(t))!=null?r:1;this.media&&(this.media.playbackRate=n,this.media.defaultPlaybackRate=n);return}}}play(){var i,e;return(e=(i=this.media)==null?void 0:i.play())!=null?e:Promise.reject()}pause(){var i;(i=this.media)==null||i.pause()}load(){var i;(i=this.media)==null||i.load()}get media(){var i;return(i=this.shadowRoot)==null?void 0:i.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 i,e;return(e=(i=this.media)==null?void 0:i.paused)!=null?e:!0}get duration(){var i,e;return(e=(i=this.media)==null?void 0:i.duration)!=null?e:NaN}get ended(){var i,e;return(e=(i=this.media)==null?void 0:i.ended)!=null?e:!1}get buffered(){var i,e;return(e=(i=this.media)==null?void 0:i.buffered)!=null?e:g0}get seekable(){var i,e;return(e=(i=this.media)==null?void 0:i.seekable)!=null?e:g0}get readyState(){var i,e;return(e=(i=this.media)==null?void 0:i.readyState)!=null?e:0}get videoWidth(){var i,e;return(e=(i=this.media)==null?void 0:i.videoWidth)!=null?e:0}get videoHeight(){var i,e;return(e=(i=this.media)==null?void 0:i.videoHeight)!=null?e:0}get currentSrc(){var i,e;return(e=(i=this.media)==null?void 0:i.currentSrc)!=null?e:""}get currentTime(){var i,e;return(e=(i=this.media)==null?void 0:i.currentTime)!=null?e:0}set currentTime(i){this.media&&(this.media.currentTime=Number(i))}get volume(){var i,e;return(e=(i=this.media)==null?void 0:i.volume)!=null?e:1}set volume(i){this.media&&(this.media.volume=Number(i))}get playbackRate(){var i,e;return(e=(i=this.media)==null?void 0:i.playbackRate)!=null?e:1}set playbackRate(i){this.media&&(this.media.playbackRate=Number(i))}get defaultPlaybackRate(){var i;return(i=Ft(this.getAttribute(ir.PLAYBACKRATE)))!=null?i:1}set defaultPlaybackRate(i){i!=null?this.setAttribute(ir.PLAYBACKRATE,`${i}`):this.removeAttribute(ir.PLAYBACKRATE)}get crossOrigin(){return jn(this,bt.CROSSORIGIN)}set crossOrigin(i){this.setAttribute(bt.CROSSORIGIN,`${i}`)}get autoplay(){return jn(this,bt.AUTOPLAY)!=null}set autoplay(i){i?this.setAttribute(bt.AUTOPLAY,typeof i=="string"?i:""):this.removeAttribute(bt.AUTOPLAY)}get loop(){return jn(this,bt.LOOP)!=null}set loop(i){i?this.setAttribute(bt.LOOP,""):this.removeAttribute(bt.LOOP)}get muted(){var i,e;return(e=(i=this.media)==null?void 0:i.muted)!=null?e:!1}set muted(i){this.media&&(this.media.muted=!!i)}get defaultMuted(){return jn(this,bt.MUTED)!=null}set defaultMuted(i){i?this.setAttribute(bt.MUTED,""):this.removeAttribute(bt.MUTED)}get playsInline(){return jn(this,bt.PLAYSINLINE)!=null}set playsInline(i){Qt("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(i){["","none","metadata","auto"].includes(i)?this.setAttribute(bt.PRELOAD,i):this.removeAttribute(bt.PRELOAD)}};function jn(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var v0=lM,dM=`:host { 1841 --media-control-display: var(--controls); 1842 --media-loading-indicator-display: var(--loading-indicator); 1843 --media-dialog-display: var(--dialog); 1844 --media-play-button-display: var(--play-button); 1845 --media-live-button-display: var(--live-button); 1846 --media-seek-backward-button-display: var(--seek-backward-button); 1847 --media-seek-forward-button-display: var(--seek-forward-button); 1848 --media-mute-button-display: var(--mute-button); 1849 --media-captions-button-display: var(--captions-button); 1850 --media-captions-menu-button-display: var(--captions-menu-button, var(--media-captions-button-display)); 1851 --media-rendition-menu-button-display: var(--rendition-menu-button); 1852 --media-audio-track-menu-button-display: var(--audio-track-menu-button); 1853 --media-airplay-button-display: var(--airplay-button); 1854 --media-pip-button-display: var(--pip-button); 1855 --media-fullscreen-button-display: var(--fullscreen-button); 1856 --media-cast-button-display: var(--cast-button, var(--_cast-button-drm-display)); 1857 --media-playback-rate-button-display: var(--playback-rate-button); 1858 --media-playback-rate-menu-button-display: var(--playback-rate-menu-button); 1859 --media-volume-range-display: var(--volume-range); 1860 --media-time-range-display: var(--time-range); 1861 --media-time-display-display: var(--time-display); 1862 --media-duration-display-display: var(--duration-display); 1863 --media-title-display-display: var(--title-display); 1864 1865 display: inline-block; 1866 line-height: 0; 1867 width: 100%; 1868} 1869 1870a { 1871 color: #fff; 1872 font-size: 0.9em; 1873 text-decoration: underline; 1874} 1875 1876media-theme { 1877 display: inline-block; 1878 line-height: 0; 1879 width: 100%; 1880 height: 100%; 1881 direction: ltr; 1882} 1883 1884media-poster-image { 1885 display: inline-block; 1886 line-height: 0; 1887 width: 100%; 1888 height: 100%; 1889} 1890 1891media-poster-image:not([src]):not([placeholdersrc]) { 1892 display: none; 1893} 1894 1895::part(top), 1896[part~='top'] { 1897 --media-control-display: var(--controls, var(--top-controls)); 1898 --media-play-button-display: var(--play-button, var(--top-play-button)); 1899 --media-live-button-display: var(--live-button, var(--top-live-button)); 1900 --media-seek-backward-button-display: var(--seek-backward-button, var(--top-seek-backward-button)); 1901 --media-seek-forward-button-display: var(--seek-forward-button, var(--top-seek-forward-button)); 1902 --media-mute-button-display: var(--mute-button, var(--top-mute-button)); 1903 --media-captions-button-display: var(--captions-button, var(--top-captions-button)); 1904 --media-captions-menu-button-display: var( 1905 --captions-menu-button, 1906 var(--media-captions-button-display, var(--top-captions-menu-button)) 1907 ); 1908 --media-rendition-menu-button-display: var(--rendition-menu-button, var(--top-rendition-menu-button)); 1909 --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--top-audio-track-menu-button)); 1910 --media-airplay-button-display: var(--airplay-button, var(--top-airplay-button)); 1911 --media-pip-button-display: var(--pip-button, var(--top-pip-button)); 1912 --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button)); 1913 --media-cast-button-display: var(--cast-button, var(--top-cast-button, var(--_cast-button-drm-display))); 1914 --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button)); 1915 --media-playback-rate-menu-button-display: var( 1916 --captions-menu-button, 1917 var(--media-playback-rate-button-display, var(--top-playback-rate-menu-button)) 1918 ); 1919 --media-volume-range-display: var(--volume-range, var(--top-volume-range)); 1920 --media-time-range-display: var(--time-range, var(--top-time-range)); 1921 --media-time-display-display: var(--time-display, var(--top-time-display)); 1922 --media-duration-display-display: var(--duration-display, var(--top-duration-display)); 1923 --media-title-display-display: var(--title-display, var(--top-title-display)); 1924} 1925 1926::part(center), 1927[part~='center'] {
1928 --media-control-display: var(--controls, var(--center-controls)); 1929 --media-play-button-display: var(--play-button, var(--center-play-button)); 1930 --media-live-button-display: var(--live-button, var(--center-live-button)); 1931 --media-seek-backward-button-display: var(--seek-backward-button, var(--center-seek-backward-button)); 1932 --media-seek-forward-button-display: var(--seek-forward-button, var(--center-seek-forward-button)); 1933 --media-mute-button-display: var(--mute-button, var(--center-mute-button)); 1934 --media-captions-button-display: var(--captions-button, var(--center-captions-button)); 1935 --media-captions-menu-button-display: var( 1936 --captions-menu-button, 1937 var(--media-captions-button-display, var(--center-captions-menu-button)) 1938 ); 1939 --media-rendition-menu-button-display: var(--rendition-menu-button, var(--center-rendition-menu-button)); 1940 --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--center-audio-track-menu-button)); 1941 --media-airplay-button-display: var(--airplay-button, var(--center-airplay-button)); 1942 --media-pip-button-display: var(--pip-button, var(--center-pip-button)); 1943 --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button)); 1944 --media-cast-button-display: var(--cast-button, var(--center-cast-button, var(--_cast-button-drm-display))); 1945 --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button)); 1946 --media-playback-rate-menu-button-display: var( 1947 --playback-rate-menu-button, 1948 var(--media-playback-rate-button-display, var(--center-playback-rate-menu-button)) 1949 ); 1950 --media-volume-range-display: var(--volume-range, var(--center-volume-range)); 1951 --media-time-range-display: var(--time-range, var(--center-time-range)); 1952 --media-time-display-display: var(--time-display, var(--center-time-display)); 1953 --media-duration-display-display: var(--duration-display, var(--center-duration-display)); 1954} 1955 1956::part(bottom), 1957[part~='bottom'] { 1958 --media-control-display: var(--controls, var(--bottom-controls)); 1959 --media-play-button-display: var(--play-button, var(--bottom-play-button)); 1960 --media-live-button-display: var(--live-button, var(--bottom-live-button)); 1961 --media-seek-backward-button-display: var(--seek-backward-button, var(--bottom-seek-backward-button)); 1962 --media-seek-forward-button-display: var(--seek-forward-button, var(--bottom-seek-forward-button)); 1963 --media-mute-button-display: var(--mute-button, var(--bottom-mute-button)); 1964 --media-captions-button-display: var(--captions-button, var(--bottom-captions-button)); 1965 --media-captions-menu-button-display: var( 1966 --captions-menu-button, 1967 var(--media-captions-button-display, var(--bottom-captions-menu-button)) 1968 ); 1969 --media-rendition-menu-button-display: var(--rendition-menu-button, var(--bottom-rendition-menu-button)); 1970 --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--bottom-audio-track-menu-button)); 1971 --media-airplay-button-display: var(--airplay-button, var(--bottom-airplay-button)); 1972 --media-pip-button-display: var(--pip-button, var(--bottom-pip-button)); 1973 --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button)); 1974 --media-cast-button-display: var(--cast-button, var(--bottom-cast-button, var(--_cast-button-drm-display))); 1975 --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button)); 1976 --media-playback-rate-menu-button-display: var( 1977 --playback-rate-menu-button, 1978 var(--media-playback-rate-button-display, var(--bottom-playback-rate-menu-button)) 1979 ); 1980 --media-volume-range-display: var(--volume-range, var(--bottom-volume-range)); 1981 --media-time-range-display: var(--time-range, var(--bottom-time-range)); 1982 --media-time-display-display: var(--time-display, var(--bottom-time-display)); 1983 --media-duration-display-display: var(--duration-display, var(--bottom-duration-display)); 1984 --media-title-display-display: var(--title-display, var(--bottom-title-display)); 1985} 1986 1987:host([no-tooltips]) { 1988 --media-tooltip-display: none; 1989} 1990`,zn=new WeakMap,uM=class oT{constructor(e,t){this.element=e,this.type=t,this.element.addEventListener(this.type,this);let s=zn.get(this.element);s&&s.set(this.type,this)}set(e){if(typeof e=="function")this.handleEvent=e.bind(this.element);else if(typeof e=="object"&&typeof e.handleEvent=="function")this.handleEvent=e.handleEvent.bind(e);else{this.element.removeEventListener(this.type,this);let t=zn.get(this.element);
vendor: 4,325 bytes, lines 1990-2016
1990t&&t.delete(this.type)}}static for(e){zn.has(e.element)||zn.set(e.element,new Map);let t=e.attributeName.slice(2),s=zn.get(e.element);return s&&s.has(t)?s.get(t):new oT(e.element,t)}};function cM(i,e){return i instanceof pi&&i.attributeName.startsWith("on")?(uM.for(i).set(e),i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),!0):!1}function hM(i,e){return e instanceof lT&&i instanceof Pn?(e.renderInto(i),!0):!1}function fM(i,e){return e instanceof DocumentFragment&&i instanceof Pn?(e.childNodes.length&&i.replace(...e.childNodes),!0):!1}function mM(i,e){if(i instanceof pi){let t=i.attributeNamespace,s=i.element.getAttributeNS(t,i.attributeName);return String(e)!==s&&(i.value=String(e)),!0}return i.value=String(e),!0}function pM(i,e){if(i instanceof pi&&e instanceof Element){let t=i.element;return t[i.attributeName]!==e&&(i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),t[i.attributeName]=e),!0}return!1}function gM(i,e){if(typeof e=="boolean"&&i instanceof pi){let t=i.attributeNamespace,s=i.element.hasAttributeNS(t,i.attributeName);return e!==s&&(i.booleanValue=e),!0}return!1}function vM(i,e){return e===!1&&i instanceof Pn?(i.replace(""),!0):!1}function EM(i,e){pM(i,e)||gM(i,e)||cM(i,e)||vM(i,e)||hM(i,e)||fM(i,e)||mM(i,e)}var dc=new Map,E0=new WeakMap,y0=new WeakMap,lT=class{constructor(e,t,s){this.strings=e,this.values=t,this.processor=s,this.stringsKey=this.strings.join("�")}get template(){if(dc.has(this.stringsKey))return dc.get(this.stringsKey);{let e=Wd.createElement("template"),t=this.strings.length-1;return e.innerHTML=this.strings.reduce((s,r,n)=>s+r+(n<t?`{{ ${n} }}`:""),""),dc.set(this.stringsKey,e),e}}renderInto(e){var t;let s=this.template;if(E0.get(e)!==s){E0.set(e,s);let n=new uu(s,this.values,this.processor);y0.set(e,n),e instanceof Pn?e.replace(...n.children):e.appendChild(n);return}let r=y0.get(e);(t=r?.update)==null||t.call(r,this.values)}},yM={processCallback(i,e,t){var s;if(t){for(let[r,n]of e)if(r in t){let a=(s=t[r])!=null?s:"";EM(n,a)}}}};function ed(i,...e){return new lT(i,e,yM)}function bM(i,e){i.renderInto(e)}var TM=i=>{let{tokens:e}=i;return e.drm?":host(:not([cast-receiver])) { --_cast-button-drm-display: none; }":""},_M=i=>ed` 1991 <style> 1992 ${TM(i)} 1993 ${dM} 1994 </style> 1995 ${LM(i)} 1996`,AM=i=>{let e=i.hotKeys?`${i.hotKeys}`:"";return Om(i.streamType)==="live"&&(e+=" noarrowleft noarrowright"),e},SM={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",MENU_BUTTON:"menu-button",MENU:"menu",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"},IM=Object.values(SM).join(", "),LM=i=>{var e,t,s,r,n,a,o,l,d,u,c,h,f,m,g,p,E,b,y,T,A,L,S,R,x,I,M,$,V,Y,H,N,W,B,q,J,U;return ed` 1997 <media-theme 1998 template="${i.themeTemplate||!1}" 1999 defaultstreamtype="${(e=i.defaultStreamType)!=null?e:!1}" 2000 hotkeys="${AM(i)||!1}" 2001 nohotkeys="${i.noHotKeys||!i.hasSrc||!1}" 2002 noautoseektolive="${!!((t=i.streamType)!=null&&t.includes(Ae.LIVE))&&i.targetLiveWindow!==0}" 2003 novolumepref="${i.novolumepref||!1}" 2004 nomutedpref="${i.nomutedpref||!1}" 2005 disabled="${!i.hasSrc||i.isDialogOpen}" 2006 audio="${(s=i.audio)!=null?s:!1}" 2007 style="${(r=Qw({"--media-primary-color":i.primaryColor,"--media-secondary-color":i.secondaryColor,"--media-accent-color":i.accentColor}))!=null?r:!1}" 2008 defaultsubtitles="${!i.defaultHiddenCaptions}" 2009 forwardseekoffset="${(n=i.forwardSeekOffset)!=null?n:!1}" 2010 backwardseekoffset="${(a=i.backwardSeekOffset)!=null?a:!1}" 2011 playbackrates="${(o=i.playbackRates)!=null?o:!1}" 2012 defaultshowremainingtime="${(l=i.defaultShowRemainingTime)!=null?l:!1}" 2013 defaultduration="${(d=i.defaultDuration)!=null?d:!1}" 2014 hideduration="${(u=i.hideDuration)!=null?u:!1}" 2015 title="${(c=i.title)!=null?c:!1}" 2016 videotitle="${(h=i.videoTitle)!=null?h:!1}
2016" 2017 proudlydisplaymuxbadge="${(f=i.proudlyDisplayMuxBadge)!=null?f:!1}" 2018 exportparts="${IM}" 2019 onclose="${i.onCloseErrorDialog}" 2020 onfocusin="${i.onFocusInErrorDialog}" 2021 > 2022 <mux-video 2023 slot="media" 2024 inert="${(m=i.noHotKeys)!=null?m:!1}" 2025 target-live-window="${(g=i.targetLiveWindow)!=null?g:!1}" 2026 stream-type="${(p=Om(i.streamType))!=null?p:!1}" 2027 crossorigin="${(E=i.crossOrigin)!=null?E:""}" 2028 playsinline 2029 autoplay="${(b=i.autoplay)!=null?b:!1}" 2030 muted="${(y=i.muted)!=null?y:!1}" 2031 loop="${(T=i.loop)!=null?T:!1}" 2032 preload="${(A=i.preload)!=null?A:!1}" 2033 debug="${(L=i.debug)!=null?L:!1}" 2034 prefer-cmcd="${(S=i.preferCmcd)!=null?S:!1}" 2035 disable-tracking="${(R=i.disableTracking)!=null?R:!1}" 2036 disable-cookies="${(x=i.disableCookies)!=null?x:!1}" 2037 prefer-playback="${(I=i.preferPlayback)!=null?I:!1}" 2038 start-time="${i.startTime!=null?i.startTime:!1}" 2039 beacon-collection-domain="${(M=i.beaconCollectionDomain)!=null?M:!1}" 2040 player-init-time="${($=i.playerInitTime)!=null?$:!1}" 2041 player-software-name="${(V=i.playerSoftwareName)!=null?V:!1}" 2042 player-software-version="${(Y=i.playerSoftwareVersion)!=null?Y:!1}" 2043 env-key="${(H=i.envKey)!=null?H:!1}" 2044 custom-domain="${(N=i.customDomain)!=null?N:!1}" 2045 src="${i.src?i.src:i.playbackId?$c(i):!1}" 2046 cast-src="${i.src?i.src:i.playbackId?$c(i):!1}" 2047 cast-receiver="${(W=i.castReceiver)!=null?W:!1}" 2048 drm-token="${(q=(B=i.tokens)==null?void 0:B.drm)!=null?q:!1}" 2049 exportparts="video" 2050 disable-pseudo-ended="${(J=i.disablePseudoEnded)!=null?J:!1}" 2051 > 2052 ${i.storyboard?ed`<track label="thumbnails" default kind="metadata" src="${i.storyboard}" />`:ed``} 2053 <slot></slot> 2054 </mux-video> 2055 <slot name="poster" slot="poster"> 2056 <media-poster-image 2057 part="poster" 2058 exportparts="poster, img" 2059 src="${i.poster?i.poster:!1}" 2060 placeholdersrc="${(U=i.placeholder)!=null?U:!1}" 2061 ></media-poster-image> 2062 </slot> 2063 </media-theme> 2064`},dT=i=>i.charAt(0).toUpperCase()+i.slice(1),RM=(i,e=!1)=>{var t,s;if(i.muxCode){let r=dT((t=i.errorCategory)!=null?t:"video"),n=Qd((s=i.errorCategory)!=null?s:Me.VIDEO);if(i.muxCode===se.NETWORK_OFFLINE)return te("Your device appears to be offline",e);if(i.muxCode===se.NETWORK_TOKEN_EXPIRED)return te("{category} URL has expired",e).format({category:r});if([se.NETWORK_TOKEN_SUB_MISMATCH,se.NETWORK_TOKEN_AUD_MISMATCH,se.NETWORK_TOKEN_AUD_MISSING,se.NETWORK_TOKEN_MALFORMED].includes(i.muxCode))return te("{category} URL is formatted incorrectly",e).format({category:r});if(i.muxCode===se.NETWORK_TOKEN_MISSING)return te("Invalid {categoryName} URL",e).format({categoryName:n});if(i.muxCode===se.NETWORK_NOT_FOUND)return te("{category} does not exist",e).format({category:r});if(i.muxCode===se.NETWORK_NOT_READY){let a=i.streamType==="live"?"Live stream":"Video";return te("{mediaType} is not currently available",e).format({mediaType:a})}}if(i.code){if(i.code===z.MEDIA_ERR_NETWORK)return te("Network Error",e);if(i.code===z.MEDIA_ERR_DECODE)return te("Media Error",e);if(i.code===z.MEDIA_ERR_SRC_NOT_SUPPORTED)return te("Source Not Supported",e)}return te("Error",e)},xM=(i,e=!1)=>{var t,s;if(i.muxCode){let r=dT((t=i.errorCategory)!=null?t:"video"),n=Qd((s=i.errorCategory)!=null?s:Me.VIDEO);return i.muxCode===se.NETWORK_OFFLINE?te("Check your internet connection and try reloading this video.",e):i.muxCode===se.NETWORK_TOKEN_EXPIRED?te("The video’s secured {tokenNamePrefix}-token has expired.",e).format({tokenNamePrefix:n}):i.muxCode===se.NETWORK_TOKEN_SUB_MISMATCH?te("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",e).format({tokenNamePrefix:n}):i.muxCode===se.NETWORK_TOKEN_MALFORMED?te("{category} URL is formatted incorrectly",e).format({category:r}):[se.NETWORK_TOKEN_AUD_MISMATCH,se.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode)?te("The {tokenNamePrefix}-token is formatted with incorrect information.",e).format({tokenNamePrefix:n}):[se.NETWORK_TOKEN_MISSING,se.NETWORK_INVALID_URL].includes(i.muxCode)?te("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",e).format({tokenNamePrefix:n}):i.muxCode===se.NETWORK_NOT_FOUND?"":i.message}return i.code&&(i.code===z.MEDIA_ERR_NETWORK||i.code===z.MEDIA_ERR_DECODE||(i.code,z.MEDIA_ERR_SRC_NOT_SUPPORTED)),i.message},kM=(i,e=!1)=>{let t=RM(i,e).toString(),s=xM(i,e).toString();return{title:t,message:s}},DM=i=>{if(i.muxCode){if(i.muxCode===se.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(i.muxCode===se.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([se.NETWORK_TOKEN_AUD_MISMATCH,se.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode))return"403-incorrect-aud-value.md";if(i.muxCode===se.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(i.muxCode===se.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(i.muxCode===se.NETWORK_NOT_FOUND)return"404-not-found.md";if(i.muxCode===se.NETWORK_NOT_READY)return"412-not-playable.md"}if(i.code){if(i.code===z.MEDIA_ERR_NETWORK)return"";if(i.code===z.MEDIA_ERR_DECODE)return"media-decode-error.md";if(i.code===z.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},b0=(i,e)=>{let t=DM(i);return{message:i.message,context:i.context,file:t}},CM
vendor: 8,830 bytes, lines 2064-2364
2064=`<template id="media-theme-gerwig"> 2065 <style> 2066 @keyframes pre-play-hide { 2067 0% { 2068 transform: scale(1); 2069 opacity: 1; 2070 } 2071 2072 30% { 2073 transform: scale(0.7); 2074 } 2075 2076 100% { 2077 transform: scale(1.5); 2078 opacity: 0; 2079 } 2080 } 2081 2082 :host { 2083 --_primary-color: var(--media-primary-color, #fff); 2084 --_secondary-color: var(--media-secondary-color, transparent); 2085 --_accent-color: var(--media-accent-color, #fa50b5); 2086 --_text-color: var(--media-text-color, #000); 2087 2088 --media-icon-color: var(--_primary-color); 2089 --media-control-background: var(--_secondary-color); 2090 --media-control-hover-background: var(--_accent-color); 2091 --media-time-buffered-color: rgba(255, 255, 255, 0.4); 2092 --media-preview-time-text-shadow: none; 2093 --media-control-height: 14px; 2094 --media-control-padding: 6px; 2095 --media-tooltip-container-margin: 6px; 2096 --media-tooltip-distance: 18px; 2097 2098 color: var(--_primary-color); 2099 display: inline-block; 2100 width: 100%; 2101 height: 100%; 2102 } 2103 2104 :host([audio]) { 2105 --_secondary-color: var(--media-secondary-color, black); 2106 --media-preview-time-text-shadow: none; 2107 } 2108 2109 :host([audio]) ::slotted([slot='media']) { 2110 height: 0px; 2111 } 2112 2113 :host([audio]) media-loading-indicator { 2114 display: none; 2115 } 2116 2117 :host([audio]) media-controller { 2118 background: transparent; 2119 } 2120 2121 :host([audio]) media-controller::part(vertical-layer) { 2122 background: transparent; 2123 } 2124 2125 :host([audio]) media-control-bar { 2126 width: 100%; 2127 background-color: var(--media-control-background); 2128 } 2129 2130 /* 2131 * 0.433s is the transition duration for VTT Regions. 2132 * Borrowed here, so the captions don't move too fast. 2133 */ 2134 media-controller { 2135 --media-webkit-text-track-transform: translateY(0) scale(0.98); 2136 --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s; 2137 } 2138 media-controller:is([mediapaused], :not([userinactive])) { 2139 --media-webkit-text-track-transform: translateY(-50px) scale(0.98); 2140 --media-webkit-text-track-transition: transform 0.15s ease; 2141 } 2142 2143 /* 2144 * CSS specific to iOS devices. 2145 * See: https://stackoverflow.com/questions/30102792/css-media-query-to-target-only-ios-devices/60220757#60220757 2146 */ 2147 @supports (-webkit-touch-callout: none) { 2148 /* Disable subtitle adjusting for iOS Safari */ 2149 media-controller[mediaisfullscreen] { 2150 --media-webkit-text-track-transform: unset; 2151 --media-webkit-text-track-transition: unset; 2152 } 2153 } 2154 2155 media-time-range { 2156 --media-box-padding-left: 6px; 2157 --media-box-padding-right: 6px; 2158 --media-range-bar-color: var(--_accent-color); 2159 --media-time-range-buffered-color: var(--_primary-color); 2160 --media-range-track-color: transparent; 2161 --media-range-track-background: rgba(255, 255, 255, 0.4); 2162 --media-range-thumb-background: radial-gradient( 2163 circle, 2164 #000 0%, 2165 #000 25%, 2166 var(--_accent-color) 25%, 2167 var(--_accent-color) 2168 ); 2169 --media-range-thumb-width: 12px; 2170 --media-range-thumb-height: 12px; 2171 --media-range-thumb-transform: scale(0); 2172 --media-range-thumb-transition: transform 0.3s; 2173 --media-range-thumb-opacity: 1; 2174 --media-preview-background: var(--_primary-color); 2175 --media-box-arrow-background: var(--_primary-color); 2176 --media-preview-thumbnail-border: 5px solid var(--_primary-color); 2177 --media-preview-border-radius: 5px; 2178 --media-text-color: var(--_text-color); 2179 --media-control-hover-background: transparent; 2180 --media-preview-chapter-text-shadow: none; 2181 color: var(--_accent-color); 2182 padding: 0 6px; 2183 } 2184 2185 :host([audio]) media-time-range { 2186 --media-preview-time-padding: 1.5px 6px; 2187 --media-preview-box-margin: 0 0 -5px; 2188 } 2189 2190 media-time-range:hover { 2191 --media-range-thumb-transform: scale(1); 2192 } 2193 2194 media-preview-thumbnail { 2195 border-bottom-width: 0; 2196 } 2197 2198 [part~='menu'] { 2199 border-radius: 2px; 2200 border: 1px solid rgba(0, 0, 0, 0.1); 2201 bottom: 50px; 2202 padding: 2.5px 10px; 2203 } 2204 2205 [part~='menu']::part(indicator) { 2206 fill: var(--_accent-color); 2207 } 2208 2209 [part~='menu']::part(menu-item) { 2210 box-sizing: border-box; 2211 display: flex; 2212 align-items: center; 2213 padding: 6px 10px; 2214 min-height: 34px; 2215 } 2216 2217 [part~='menu']::part(checked) { 2218 font-weight: 700; 2219 } 2220 2221 media-captions-menu, 2222 media-rendition-menu, 2223 media-audio-track-menu, 2224 media-playback-rate-menu { 2225 position: absolute; /* ensure they don't take up space in DOM on load */ 2226 --media-menu-background: var(--_primary-color); 2227 --media-menu-item-checked-background: transparent; 2228 --media-text-color: var(--_text-color); 2229 --media-menu-item-hover-background: transparent; 2230 --media-menu-item-hover-outline: var(--_accent-color) solid 1px; 2231 } 2232 2233 media-rendition-menu { 2234 min-width: 140px; 2235 } 2236 2237 /* The icon is a circle so make it 16px high instead of 14px for more balance. */ 2238 media-audio-track-menu-button { 2239 --media-control-padding: 5px; 2240 --media-control-height: 16px; 2241 } 2242 2243 media-playback-rate-menu-button { 2244 --media-control-padding: 6px 3px; 2245 min-width: 4.4ch; 2246 } 2247 2248 media-playback-rate-menu { 2249 --media-menu-flex-direction: row; 2250 --media-menu-item-checked-background: var(--_accent-color); 2251 --media-menu-item-checked-indicator-display: none; 2252 margin-right: 6px; 2253 padding: 0; 2254 --media-menu-gap: 0.25em; 2255 } 2256 2257 media-playback-rate-menu[part~='menu']::part(menu-item) { 2258 padding: 6px 6px 6px 8px; 2259 } 2260 2261 media-playback-rate-menu[part~='menu']::part(checked) { 2262 color: #fff; 2263 } 2264 2265 :host(:not([audio])) media-time-range { 2266 /* Adding px is required here for calc() */ 2267 --media-range-padding: 0px; 2268 background: transparent; 2269 z-index: 10; 2270 height: 10px; 2271 bottom: -3px; 2272 width: 100%; 2273 } 2274 2275 media-control-bar :is([role='button'], [role='switch'], button) { 2276 line-height: 0; 2277 } 2278 2279 media-control-bar :is([part*='button'], [part*='range'], [part*='display']) { 2280 border-radius: 3px; 2281 } 2282 2283 .spacer { 2284 flex-grow: 1; 2285 background-color: var(--media-control-background, rgba(20, 20, 30, 0.7)); 2286 } 2287 2288 media-control-bar[slot~='top-chrome'] { 2289 min-height: 42px; 2290 pointer-events: none; 2291 } 2292 2293 media-control-bar { 2294 --gradient-steps: 2295 hsl(0 0% 0% / 0) 0%, hsl(0 0% 0% / 0.013) 8.1%, hsl(0 0% 0% / 0.049) 15.5%, hsl(0 0% 0% / 0.104) 22.5%, 2296 hsl(0 0% 0% / 0.175) 29%, hsl(0 0% 0% / 0.259) 35.3%, hsl(0 0% 0% / 0.352) 41.2%, hsl(0 0% 0% / 0.45) 47.1%, 2297 hsl(0 0% 0% / 0.55) 52.9%, hsl(0 0% 0% / 0.648) 58.8%, hsl(0 0% 0% / 0.741) 64.7%, hsl(0 0% 0% / 0.825) 71%, 2298 hsl(0 0% 0% / 0.896) 77.5%, hsl(0 0% 0% / 0.951) 84.5%, hsl(0 0% 0% / 0.987) 91.9%, hsl(0 0% 0%) 100%; 2299 } 2300 2301 :host([title]) media-control-bar[slot='top-chrome']::before, 2302 :host([videotitle]) media-control-bar[slot='top-chrome']::before { 2303 content: ''; 2304 position: absolute; 2305 width: 100%; 2306 padding-bottom: min(100px, 25%); 2307 background: linear-gradient(to top, var(--gradient-steps)); 2308 opacity: 0.8; 2309 pointer-events: none; 2310 } 2311 2312 :host(:not([audio])) media-control-bar[part~='bottom']::before { 2313 content: ''; 2314 position: absolute; 2315 width: 100%; 2316 bottom: 0; 2317 left: 0; 2318 padding-bottom: min(100px, 25%); 2319 background: linear-gradient(to bottom, var(--gradient-steps)); 2320 opacity: 0.8; 2321 z-index: 1; 2322 pointer-events: none; 2323 } 2324 2325 media-control-bar[part~='bottom'] > * { 2326 z-index: 20; 2327 } 2328 2329 media-control-bar[part~='bottom'] { 2330 padding: 6px 6px; 2331 } 2332 2333 media-control-bar[slot~='top-chrome'] > * { 2334 --media-control-background: transparent; 2335 --media-control-hover-background: transparent; 2336 position: relative; 2337 } 2338 2339 media-controller::part(vertical-layer) { 2340 transition: background-color 1s; 2341 } 2342 2343 media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) { 2344 background-color: var(--controls-backdrop-color, var(--controls, transparent)); 2345 transition: background-color 0.25s; 2346 } 2347 2348 .center-controls { 2349 --media-button-icon-width: 100%; 2350 --media-button-icon-height: auto; 2351 --media-tooltip-display: none; 2352 pointer-events: none; 2353 width: 100%; 2354 display: flex; 2355 flex-flow: row; 2356 align-items: center; 2357 justify-content: center; 2358 paint-order: stroke; 2359 stroke: rgba(102, 102, 102, 1); 2360 stroke-width: 0.3px; 2361 text-shadow: 2362 0 0 2px rgb(0 0 0 / 0.25), 2363 0 0 6px rgb(0 0 0 / 0.25); 2364
2364} 2365 2366 .center-controls media-play-button { 2367 --media-control-background: transparent; 2368 --media-control-hover-background: transparent; 2369 --media-control-padding: 0; 2370 width: 40px; 2371 filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25))
vendor: 27,322 bytes, lines 2371-2957
2371; 2372 } 2373 2374 [breakpointsm] .center-controls media-play-button { 2375 width: 90px; 2376 height: 90px; 2377 border-radius: 50%; 2378 transition: background 0.4s; 2379 padding: 24px; 2380 --media-control-background: #000; 2381 --media-control-hover-background: var(--_accent-color); 2382 } 2383 2384 .center-controls media-seek-backward-button, 2385 .center-controls media-seek-forward-button { 2386 --media-control-background: transparent; 2387 --media-control-hover-background: transparent; 2388 padding: 0; 2389 margin: 0 20px; 2390 width: max(33px, min(8%, 40px)); 2391 text-shadow: 2392 0 0 2px rgb(0 0 0 / 0.25), 2393 0 0 6px rgb(0 0 0 / 0.25); 2394 } 2395 2396 [breakpointsm]:not([audio]) .center-controls.pre-playback { 2397 display: grid; 2398 align-items: initial; 2399 justify-content: initial; 2400 height: 100%; 2401 overflow: hidden; 2402 } 2403 2404 [breakpointsm]:not([audio]) .center-controls.pre-playback media-play-button { 2405 place-self: var(--_pre-playback-place, center); 2406 grid-area: 1 / 1; 2407 margin: 16px; 2408 } 2409 2410 /* Show and hide controls or pre-playback state */ 2411 2412 [breakpointsm]:is([mediahasplayed], :not([mediapaused])):not([audio]) 2413 .center-controls.pre-playback 2414 media-play-button { 2415 /* Using \`forwards\` would lead to a laggy UI after the animation got in the end state */ 2416 animation: 0.3s linear pre-play-hide; 2417 opacity: 0; 2418 pointer-events: none; 2419 } 2420 2421 .autoplay-unmute { 2422 --media-control-hover-background: transparent; 2423 width: 100%; 2424 display: flex; 2425 align-items: center; 2426 justify-content: center; 2427 filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25)); 2428 } 2429 2430 .autoplay-unmute-btn { 2431 --media-control-height: 16px; 2432 border-radius: 8px; 2433 background: #000; 2434 color: var(--_primary-color); 2435 display: flex; 2436 align-items: center; 2437 padding: 8px 16px; 2438 font-size: 18px; 2439 font-weight: 500; 2440 cursor: pointer; 2441 } 2442 2443 .autoplay-unmute-btn:hover { 2444 background: var(--_accent-color); 2445 } 2446 2447 [breakpointsm] .autoplay-unmute-btn { 2448 --media-control-height: 30px; 2449 padding: 14px 24px; 2450 font-size: 26px; 2451 } 2452 2453 .autoplay-unmute-btn svg { 2454 margin: 0 6px 0 0; 2455 } 2456 2457 [breakpointsm] .autoplay-unmute-btn svg { 2458 margin: 0 10px 0 0; 2459 } 2460 2461 media-controller:not([audio]):not([mediahasplayed]) *:is(media-control-bar, media-time-range) { 2462 display: none; 2463 } 2464 2465 media-error-dialog:not([mediaerrorcode]) { 2466 opacity: 0; 2467 } 2468 2469 media-loading-indicator { 2470 --media-loading-icon-width: 100%; 2471 --media-button-icon-height: auto; 2472 display: var(--media-control-display, var(--media-loading-indicator-display, flex)); 2473 pointer-events: none; 2474 position: absolute; 2475 width: min(15%, 150px); 2476 flex-flow: row; 2477 align-items: center; 2478 justify-content: center; 2479 } 2480 2481 /* Intentionally don't target the div for transition but the children 2482 of the div. Prevents messing with media-chrome's autohide feature. */ 2483 media-loading-indicator + div * { 2484 transition: opacity 0.15s; 2485 opacity: 1; 2486 } 2487 2488 media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * { 2489 opacity: 0; 2490 transition-delay: 400ms; 2491 } 2492 2493 media-volume-range { 2494 width: min(100%, 100px); 2495 --media-range-padding-left: 10px; 2496 --media-range-padding-right: 10px; 2497 --media-range-thumb-width: 12px; 2498 --media-range-thumb-height: 12px; 2499 --media-range-thumb-background: radial-gradient( 2500 circle, 2501 #000 0%, 2502 #000 25%, 2503 var(--_primary-color) 25%, 2504 var(--_primary-color) 2505 ); 2506 --media-control-hover-background: none; 2507 } 2508 2509 media-time-display { 2510 white-space: nowrap; 2511 } 2512 2513 /* Generic style for explicitly disabled controls */ 2514 media-control-bar[part~='bottom'] [disabled], 2515 media-control-bar[part~='bottom'] [aria-disabled='true'] { 2516 opacity: 60%; 2517 cursor: not-allowed; 2518 } 2519 2520 media-text-display { 2521 --media-font-size: 16px; 2522 --media-control-padding: 14px; 2523 font-weight: 500; 2524 } 2525 2526 media-play-button.animated *:is(g, path) { 2527 transition: all 0.3s; 2528 } 2529 2530 media-play-button.animated[mediapaused] .pause-icon-pt1 { 2531 opacity: 0; 2532 } 2533 2534 media-play-button.animated[mediapaused] .pause-icon-pt2 { 2535 transform-origin: center center; 2536 transform: scaleY(0); 2537 } 2538 2539 media-play-button.animated[mediapaused] .play-icon { 2540 clip-path: inset(0 0 0 0); 2541 } 2542 2543 media-play-button.animated:not([mediapaused]) .play-icon { 2544 clip-path: inset(0 0 0 100%); 2545 } 2546 2547 media-seek-forward-button, 2548 media-seek-backward-button { 2549 --media-font-weight: 400; 2550 } 2551 2552 .mute-icon { 2553 display: inline-block; 2554 } 2555 2556 .mute-icon :is(path, g) { 2557 transition: opacity 0.5s; 2558 } 2559 2560 .muted { 2561 opacity: 0; 2562 } 2563 2564 media-mute-button[mediavolumelevel='low'] :is(.volume-medium, .volume-high), 2565 media-mute-button[mediavolumelevel='medium'] :is(.volume-high) { 2566 opacity: 0; 2567 } 2568 2569 media-mute-button[mediavolumelevel='off'] .unmuted { 2570 opacity: 0; 2571 } 2572 2573 media-mute-button[mediavolumelevel='off'] .muted { 2574 opacity: 1; 2575 } 2576 2577 /** 2578 * Our defaults for these buttons are to hide them at small sizes 2579 * users can override this with CSS 2580 */ 2581 media-controller:not([breakpointsm]):not([audio]) { 2582 --bottom-play-button: none; 2583 --bottom-seek-backward-button: none; 2584 --bottom-seek-forward-button: none; 2585 --bottom-time-display: none; 2586 --bottom-playback-rate-menu-button: none; 2587 --bottom-pip-button: none; 2588 } 2589 2590 [part='mux-badge'] { 2591 position: absolute; 2592 bottom: 10px; 2593 right: 10px; 2594 z-index: 2; 2595 opacity: 0.6; 2596 transition: 2597 opacity 0.2s ease-in-out, 2598 bottom 0.2s ease-in-out; 2599 } 2600 2601 [part='mux-badge']:hover { 2602 opacity: 1; 2603 } 2604 2605 [part='mux-badge'] a { 2606 font-size: 14px; 2607 font-family: var(--_font-family); 2608 color: var(--_primary-color); 2609 text-decoration: none; 2610 display: flex; 2611 align-items: center; 2612 gap: 5px; 2613 } 2614 2615 [part='mux-badge'] .mux-badge-text { 2616 transition: opacity 0.5s ease-in-out; 2617 opacity: 0; 2618 } 2619 2620 [part='mux-badge'] .mux-badge-logo { 2621 width: 40px; 2622 height: auto; 2623 display: inline-block; 2624 } 2625 2626 [part='mux-badge'] .mux-badge-logo svg { 2627 width: 100%; 2628 height: 100%; 2629 fill: white; 2630 } 2631 2632 media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'], 2633 media-controller:not([userinactive]) [part='mux-badge'], 2634 media-controller[mediahasplayed][mediapaused] [part='mux-badge'] { 2635 transition: bottom 0.1s ease-in-out; 2636 } 2637 2638 media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] { 2639 transition: bottom 0.2s ease-in-out 0.62s; 2640 } 2641 2642 media-controller:not([userinactive]) [part='mux-badge'] .mux-badge-text, 2643 media-controller[mediahasplayed][mediapaused] [part='mux-badge'] .mux-badge-text { 2644 opacity: 1; 2645 } 2646 2647 media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] .mux-badge-text { 2648 opacity: 0; 2649 } 2650 2651 media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] { 2652 bottom: 10px; 2653 } 2654 2655 media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'] { 2656 bottom: 10px; 2657 } 2658 2659 media-controller:not([userinactive])[mediahasplayed] [part='mux-badge'], 2660 media-controller[mediahasplayed][mediapaused] [part='mux-badge'] { 2661 bottom: calc(28px + var(--media-control-height, 0px) + var(--media-control-padding, 0px) * 2); 2662 } 2663 </style> 2664 2665 <template partial="TitleDisplay"> 2666 <template if="videotitle"> 2667 <template if="videotitle != true"> 2668 <media-text-display part="top title display" class="title-display">{{videotitle}}</media-text-display> 2669 </template> 2670 </template> 2671 <template if="!videotitle"> 2672 <template if="title"> 2673 <media-text-display part="top title display" class="title-display">{{title}}</media-text-display> 2674 </template> 2675 </template> 2676 </template> 2677 2678 <template partial="PlayButton"> 2679 <media-play-button 2680 part="{{section ?? 'bottom'}} play button" 2681 disabled="{{disabled}}" 2682 aria-disabled="{{disabled}}" 2683 class="animated" 2684 > 2685 <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon"> 2686 <g class="play-icon"> 2687 <path 2688 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" 2689 /> 2690 </g> 2691 <g class="pause-icon"> 2692 <path 2693 class="pause-icon-pt1" 2694 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" 2695 /> 2696 <path 2697 class="pause-icon-pt2" 2698 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" 2699 /> 2700 </g> 2701 </svg> 2702 </media-play-button> 2703 </template> 2704 2705 <template partial="PrePlayButton"> 2706 <media-play-button 2707 part="{{section ?? 'center'}} play button pre-play" 2708 disabled="{{disabled}}" 2709 aria-disabled="{{disabled}}" 2710 > 2711 <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon" style="transform: translate(3px, 0)"> 2712 <path 2713 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" 2714 /> 2715 </svg> 2716 </media-play-button> 2717 </template> 2718 2719 <template partial="SeekBackwardButton"> 2720 <media-seek-backward-button 2721 seekoffset="{{backwardseekoffset}}" 2722 part="{{section ?? 'bottom'}} seek-backward button" 2723 disabled="{{disabled}}" 2724 aria-disabled="{{disabled}}" 2725 > 2726 <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon"> 2727 <path 2728 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" 2729 /> 2730 <text transform="translate(6 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'"> 2731 {{backwardseekoffset}} 2732 </text> 2733 </svg> 2734 </media-seek-backward-button> 2735 </template> 2736 2737 <template partial="SeekForwardButton"> 2738 <media-seek-forward-button 2739 seekoffset="{{forwardseekoffset}}" 2740 part="{{section ?? 'bottom'}} seek-forward button" 2741 disabled="{{disabled}}" 2742 aria-disabled="{{disabled}}" 2743 > 2744 <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon"> 2745 <g> 2746 <text transform="translate(-1 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'"> 2747 {{forwardseekoffset}} 2748 </text> 2749 <path 2750 d="M18.35 11.9211L21.9136 7.2721C22.0288 7.12188 22.0288 6.87812 21.9136 6.7279L18.35 2.07888C18.2208 1.91041 18 2.02968 18 2.26787V11.7321C18 11.9703 18.2208 12.0896 18.35 11.9211Z" 2751 /> 2752 </g> 2753 </svg> 2754 </media-seek-forward-button> 2755 </template> 2756 2757 <template partial="MuteButton"> 2758 <media-mute-button part="bottom mute button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2759 <svg viewBox="0 0 18 14" slot="icon" class="mute-icon" aria-hidden="true"> 2760 <g class="unmuted"> 2761 <path 2762 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" 2763 /> 2764 <path 2765 class="volume-low" 2766 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" 2767 /> 2768 <path 2769 class="volume-medium" 2770 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" 2771 /> 2772 <path 2773 class="volume-high" 2774 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" 2775 /> 2776 </g> 2777 <g class="muted"> 2778 <path 2779 fill-rule="evenodd" 2780 clip-rule="evenodd" 2781 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" 2782 /> 2783 <path 2784 fill-rule="evenodd" 2785 clip-rule="evenodd" 2786 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" 2787 /> 2788 </g> 2789 </svg> 2790 </media-mute-button> 2791 </template> 2792 2793 <template partial="PipButton"> 2794 <media-pip-button part="bottom pip button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2795 <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon"> 2796 <path 2797 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" 2798 /> 2799 <path 2800 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" 2801 /> 2802 </svg> 2803 </media-pip-button> 2804 </template> 2805 2806 <template partial="CaptionsMenu"> 2807 <media-captions-menu-button part="bottom captions button"> 2808 <svg aria-hidden="true" viewBox="0 0 18 14" slot="on"> 2809 <path 2810 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.009C3.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" 2811 /> 2812 </svg> 2813 <svg aria-hidden="true" viewBox="0 0 18 14" slot="off"> 2814 <path 2815 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" 2816 /> 2817 <path 2818 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" 2819 /> 2820 <path 2821 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" 2822 /> 2823 </svg> 2824 </media-captions-menu-button> 2825 <media-captions-menu 2826 hidden 2827 anchor="auto" 2828 part="bottom captions menu" 2829 disabled="{{disabled}}" 2830 aria-disabled="{{disabled}}" 2831 exportparts="menu-item" 2832 > 2833 <div slot="checked-indicator"> 2834 <style> 2835 .indicator { 2836 position: relative; 2837 top: 1px; 2838 width: 0.9em; 2839 height: auto; 2840 fill: var(--_accent-color); 2841 margin-right: 5px; 2842 } 2843 2844 [aria-checked='false'] .indicator { 2845 display: none; 2846 } 2847 </style> 2848 <svg viewBox="0 0 14 18" class="indicator"> 2849 <path 2850 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" 2851 fill-rule="evenodd" 2852 /> 2853 </svg></div 2854 ></media-captions-menu> 2855 </template> 2856 2857 <template partial="AirplayButton"> 2858 <media-airplay-button part="bottom airplay button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2859 <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon"> 2860 <path 2861 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" 2862 /> 2863 <path 2864 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" 2865 /> 2866 </svg> 2867 </media-airplay-button> 2868 </template> 2869 2870 <template partial="FullscreenButton"> 2871 <media-fullscreen-button part="bottom fullscreen button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2872 <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter"> 2873 <path 2874 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" 2875 /> 2876 <path 2877 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" 2878 /> 2879 <path 2880 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" 2881 /> 2882 <path 2883 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" 2884 /> 2885 </svg> 2886 <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit"> 2887 <path 2888 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" 2889 /> 2890 <path 2891 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" 2892 /> 2893 <path 2894 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" 2895 /> 2896 <path 2897 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" 2898 /> 2899 </svg> 2900 </media-fullscreen-button> 2901 </template> 2902 2903 <template partial="CastButton"> 2904 <media-cast-button part="bottom cast button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2905 <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter"> 2906 <path 2907 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" 2908 /> 2909 </svg> 2910 <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit"> 2911 <path 2912 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" 2913 /> 2914 <path d="M2.15002 5.634C5.18352 6.4207 7.57252 8.8151 8.35282 11.8499H15.8501V2.1499H2.15002V5.634Z" /> 2915 </svg> 2916 </media-cast-button> 2917 </template> 2918 2919 <template partial="LiveButton"> 2920 <media-live-button part="{{section ?? 'top'}} live button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2921 <span slot="text">Live</span> 2922 </media-live-button> 2923 </template> 2924 2925 <template partial="PlaybackRateMenu"> 2926 <media-playback-rate-menu-button part="bottom playback-rate button"></media-playback-rate-menu-button> 2927 <media-playback-rate-menu 2928 hidden 2929 anchor="auto" 2930 rates="{{playbackrates}}" 2931 exportparts="menu-item" 2932 part="bottom playback-rate menu" 2933 disabled="{{disabled}}" 2934 aria-disabled="{{disabled}}" 2935 ></media-playback-rate-menu> 2936 </template> 2937 2938 <template partial="VolumeRange"> 2939 <media-volume-range 2940 part="bottom volume range" 2941 disabled="{{disabled}}" 2942 aria-disabled="{{disabled}}" 2943 ></media-volume-range> 2944 </template> 2945 2946 <template partial="TimeDisplay"> 2947 <media-time-display 2948 remaining="{{defaultshowremainingtime}}" 2949 showduration="{{!hideduration}}" 2950 part="bottom time display" 2951 disabled="{{disabled}}" 2952 aria-disabled="{{disabled}}" 2953 ></media-time-display> 2954 </template> 2955 2956 <template partial="TimeRange"> 2957 <media-time-range part="bottom time range" disabled="{{disabled}}" aria-disabled="{{disabled}}"
2957> 2958 <media-preview-thumbnail slot="preview"></media-preview-thumbnail> 2959 <media-preview-chapter-display slot="preview"></media-preview-chapter-display> 2960 <media-preview-time-display slot="preview"></media-preview-time-display> 2961 <div slot="preview" part="arrow"></div> 2962 </media-time-range> 2963 </template> 2964 2965 <template partial="AudioTrackMenu"> 2966 <media-audio-track-menu-button part="bottom audio-track button"> 2967 <svg aria-hidden="true" slot="icon" viewBox="0 0 18 16"> 2968 <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" /> 2969 <path 2970 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" 2971 /> 2972 </svg> 2973 </media-audio-track-menu-button> 2974 <media-audio-track-menu 2975 hidden 2976 anchor="auto" 2977 part="bottom audio-track menu" 2978 disabled="{{disabled}}" 2979 aria-disabled="{{disabled}}" 2980 exportparts="menu-item" 2981 > 2982 <div slot="checked-indicator"> 2983 <style> 2984 .indicator { 2985 position: relative; 2986 top: 1px; 2987 width: 0.9em; 2988 height: auto; 2989 fill: var(--_accent-color); 2990 margin-right: 5px; 2991 } 2992 2993 [aria-checked='false'] .indicator { 2994 display: none; 2995 } 2996 </style> 2997 <svg viewBox="0 0 14 18" class="indicator"> 2998 <path 2999 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" 3000 fill-rule="evenodd" 3001 /> 3002 </svg> 3003 </div> 3004 </media-audio-track-menu> 3005 </template> 3006 3007 <template partial="RenditionMenu"> 3008 <media-rendition-menu-button part="bottom rendition button"> 3009 <svg aria-hidden="true" slot="icon" viewBox="0 0 18 14"> 3010 <path 3011 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" 3012 /> 3013 </svg> 3014 </media-rendition-menu-button> 3015 <media-rendition-menu 3016 hidden 3017 anchor="auto" 3018 part="bottom rendition menu" 3019 disabled="{{disabled}}" 3020 aria-disabled="{{disabled}}" 3021 > 3022 <div slot="checked-indicator"> 3023 <style> 3024 .indicator { 3025 position: relative; 3026 top: 1px; 3027 width: 0.9em; 3028 height: auto; 3029 fill: var(--_accent-color); 3030 margin-right: 5px; 3031 } 3032 3033 [aria-checked='false'] .indicator { 3034 opacity: 0; 3035 } 3036 </style> 3037 <svg viewBox="0 0 14 18" class="indicator"> 3038 <path 3039 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" 3040 fill-rule="evenodd" 3041 /> 3042 </svg> 3043 </div> 3044 </media-rendition-menu> 3045 </template> 3046 3047 <template partial="MuxBadge"> 3048 <div part="mux-badge"> 3049 <a href="https://www.mux.com/player" target="_blank"> 3050 <span class="mux-badge-text">Powered by</span> 3051 <div class="mux-badge-logo"> 3052 <svg
3053 viewBox="0 0 1600 500" 3054 style="fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 2" 3055 > 3056 <g> 3057 <path 3058 d="M994.287,93.486c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m0,-93.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,68.943 -56.09,125.033 -125.032,125.033c-68.942,-0 -125.03,-56.09 -125.03,-125.033l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,137.853 112.149,250.003 249.999,250.003c137.851,-0 250.001,-112.15 250.001,-250.003l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486" 3059 style="fill-rule: nonzero" 3060 ></path> 3061 <path 3062 d="M1537.51,468.511c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m-275.883,-218.509l-143.33,143.329c-24.402,24.402 -24.402,63.966 0,88.368c24.402,24.402 63.967,24.402 88.369,-0l143.33,-143.329l143.328,143.329c24.402,24.4 63.967,24.402 88.369,-0c24.403,-24.402 24.403,-63.966 0.001,-88.368l-143.33,-143.329l0.001,-0.004l143.329,-143.329c24.402,-24.402 24.402,-63.965 0,-88.367c-24.402,-24.402 -63.967,-24.402 -88.369,-0l-143.329,143.328l-143.329,-143.328c-24.402,-24.401 -63.967,-24.402 -88.369,-0c-24.402,24.402 -24.402,63.965 0,88.367l143.329,143.329l0,0.004Z" 3063 style="fill-rule: nonzero" 3064 ></path> 3065 <path 3066 d="M437.511,468.521c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m23.915,-463.762c-23.348,-9.672 -50.226,-4.327 -68.096,13.544l-143.331,143.329l-143.33,-143.329c-17.871,-17.871 -44.747,-23.216 -68.096,-13.544c-23.349,9.671 -38.574,32.455 -38.574,57.729l0,375.026c0,34.51 27.977,62.486 62.487,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-224.173l80.843,80.844c24.404,24.402 63.965,24.402 88.369,-0l80.843,-80.844l0,224.173c0,34.51 27.976,62.486 62.486,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-375.026c0,-25.274 -15.224,-48.058 -38.573,-57.729" 3067 style="fill-rule: nonzero" 3068 ></path> 3069 </g> 3070 </svg> 3071 </div> 3072 </a> 3073 </div> 3074 </template> 3075 3076 <media-controller 3077 part="controller" 3078 defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}" 3079 breakpoints="sm:470" 3080 gesturesdisabled="{{disabled}}" 3081 hotkeys="{{hotkeys}}" 3082 nohotkeys="{{nohotkeys}}" 3083 novolumepref="{{novolumepref}}" 3084 audio="{{audio}}" 3085 noautoseektolive="{{noautoseektolive}}" 3086 defaultsubtitles="{{defaultsubtitles}}" 3087 defaultduration="{{defaultduration ?? false}}" 3088 keyboardforwardseekoffset="{{forwardseekoffset}}" 3089 keyboardbackwardseekoffset="{{backwardseekoffset}}" 3090 exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer" 3091 style="--_pre-playback-place:{{preplaybackplace ?? 'center'}}" 3092 > 3093 <slot name="media" slot="media"></slot> 3094 <slot name="poster" slot="poster"></slot> 3095 3096 <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator> 3097 3098 <template if="!audio"> 3099 <media-error-dialog slot="dialog" noautohide></media-error-dialog> 3100 <!-- Pre-playback UI --> 3101 <!-- same for both on-demand and live --> 3102 <div slot="centered-chrome" class="center-controls pre-playback"> 3103 <template if="!breakpointsm">{{>PlayButton section="center"}}</template> 3104 <template if="breakpointsm">{{>PrePlayButton section="center"}}</template> 3105 </div> 3106 3107 <!-- Mux Badge --> 3108 <template if="proudlydisplaymuxbadge"> {{>MuxBadge}} </template> 3109 3110 <!-- Autoplay centered unmute button --> 3111 <!-- 3112 todo: figure out how show this with available state variables 3113 needs to show when: 3114 - autoplay is enabled 3115 - playback has been successful 3116 - audio is muted 3117 - in place / instead of the pre-plaback play button 3118 - not to show again after user has interacted with this button 3119 - OR user has interacted with the mute button in the control bar 3120 --> 3121 <!-- 3122 There should be a >MuteButton to the left of the "Unmute" text, but a templating bug 3123 makes it appear even if commented out in the markup, add it back when code is un-commented 3124 --> 3125 <!-- <div slot="centered-chrome" class="autoplay-unmute"> 3126 <div role="button" class="autoplay-unmute-btn">Unmute</div> 3127 </div> --> 3128 3129 <template if="streamtype == 'on-demand'"> 3130 <template if="breakpointsm"> 3131 <media-control-bar part="control-bar top" slot="top-chrome">{{>TitleDisplay}} </media-control-bar> 3132 </template> 3133 {{>TimeRange}} 3134 <media-control-bar part="control-bar bottom"> 3135 {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>MuteButton}} 3136 {{>VolumeRange}} 3137 <div class="spacer"></div> 3138 {{>RenditionMenu}} {{>PlaybackRateMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}} 3139 {{>CastButton}} {{>PipButton}} {{>FullscreenButton}} 3140 </media-control-bar> 3141 </template> 3142 3143 <template if="streamtype == 'live'"> 3144 <media-control-bar part="control-bar top" slot="top-chrome"> 3145 {{>LiveButton}} 3146 <template if="breakpointsm"> {{>TitleDisplay}} </template> 3147 </media-control-bar> 3148 <template if="targetlivewindow > 0">{{>TimeRange}}</template> 3149 <media-control-bar part="control-bar bottom"> 3150 {{>PlayButton}} 3151 <template if="targetlivewindow > 0">{{>SeekBackwardButton}} {{>SeekForwardButton}}</template> 3152 {{>MuteButton}} {{>VolumeRange}} 3153 <div class="spacer"></div> 3154 {{>RenditionMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}} 3155 {{>FullscreenButton}} 3156 </media-control-bar> 3157 </template> 3158 </template> 3159 3160 <template if="audio"> 3161 <template if="streamtype == 'on-demand'"> 3162 <template if="title"> 3163 <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar> 3164 </template> 3165 <media-control-bar part="control-bar bottom"> 3166 {{>PlayButton}} 3167 <template if="breakpointsm"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template> 3168 {{>MuteButton}} 3169 <template if="breakpointsm">{{>VolumeRange}}</template> 3170 {{>TimeDisplay}} {{>TimeRange}} 3171 <template if="breakpointsm">{{>PlaybackRateMenu}}</template> 3172 {{>AirplayButton}} {{>CastButton}} 3173 </media-control-bar> 3174 </template> 3175 3176 <template if="streamtype == 'live'"> 3177 <template if="title"> 3178 <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar> 3179 </template> 3180 <media-control-bar part="control-bar bottom"> 3181 {{>PlayButton}} {{>LiveButton section="bottom"}} {{>MuteButton}} 3182 <template if="breakpointsm"> 3183 {{>VolumeRange}} 3184 <template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template> 3185 </template> 3186 <template if="targetlivewindow > 0"> {{>TimeDisplay}} {{>TimeRange}} </template> 3187 <template if="!targetlivewindow"><div class="spacer"></div></template> 3188 {{>AirplayButton}} {{>CastButton}} 3189 </media-control-bar> 3190 </template> 3191 </template> 3192 3193 <slot></slot> 3194 </media-controller> 3195</template> 3196`,Gh=Wd.createElement("template");"innerHTML"in Gh&&(Gh.innerHTML=CM);var T0,_0,uT=class extends cu{};uT.template=(_0=(T0=Gh.content)==null?void 0:T0.children)==null?void 0:_0[0];$i.customElements.get("media-theme-gerwig")||$i.customElements.define("media-theme-gerwig",uT);var wM="gerwig",is={SRC:"src",POSTER:"poster"},O={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
vendor: 4,664 bytes, lines 3196-3208
3196LAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",FULLSCREEN_ELEMENT:"fullscreen-element",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",VIDEO_TITLE:"video-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",NO_MUTED_PREF:"no-muted-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended"},Kh=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","videotitle","novolumepref","nomutedpref","proudlydisplaymuxbadge"];function MM(i,e){var t,s;return{src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src||!!i.currentSrc,poster:i.poster,storyboard:i.storyboard,storyboardSrc:i.getAttribute(O.STORYBOARD_SRC),fullscreenElement:i.getAttribute(O.FULLSCREEN_ELEMENT),placeholder:i.getAttribute("placeholder"),themeTemplate:OM(i),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute(O.NOHOTKEYS),hotKeys:i.getAttribute(O.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableTracking:i.disableTracking,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,maxResolution:i.maxResolution,minResolution:i.minResolution,programStartTime:i.programStartTime,programEndTime:i.programEndTime,assetStartTime:i.assetStartTime,assetEndTime:i.assetEndTime,renditionOrder:i.renditionOrder,metadata:i.metadata,playerInitTime:i.playerInitTime,playerSoftwareName:i.playerSoftwareName,playerSoftwareVersion:i.playerSoftwareVersion,startTime:i.startTime,preferPlayback:i.preferPlayback,audio:i.audio,defaultStreamType:i.defaultStreamType,targetLiveWindow:i.getAttribute(w.TARGET_LIVE_WINDOW),streamType:Om(i.getAttribute(w.STREAM_TYPE)),primaryColor:i.getAttribute(O.PRIMARY_COLOR),secondaryColor:i.getAttribute(O.SECONDARY_COLOR),accentColor:i.getAttribute(O.ACCENT_COLOR),forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultDuration:i.defaultDuration,defaultShowRemainingTime:i.defaultShowRemainingTime,hideDuration:NM(i),playbackRates:i.getAttribute(O.PLAYBACK_RATES),customDomain:(t=i.getAttribute(w.CUSTOM_DOMAIN))!=null?t:void 0,title:i.getAttribute(O.TITLE),videoTitle:(s=i.getAttribute(O.VIDEO_TITLE))!=null?s:i.getAttribute(O.TITLE),novolumepref:i.hasAttribute(O.NO_VOLUME_PREF),nomutedpref:i.hasAttribute(O.NO_MUTED_PREF),proudlyDisplayMuxBadge:i.hasAttribute(O.PROUDLY_DISPLAY_MUX_BADGE),castReceiver:i.castReceiver,disablePseudoEnded:i.hasAttribute(O.DISABLE_PSEUDO_ENDED),...e,extraSourceParams:i.extraSourceParams}}var PM=ib.formatErrorMessage;ib.formatErrorMessage=i=>{var e,t;if(i instanceof z){let s=kM(i,!1);return` 3197 ${s!=null&&s.title?`<h3>${s.title}</h3>`:""} 3198 ${s!=null&&s.message||s!=null&&s.linkUrl?`<p> 3199 ${s?.message} 3200 ${s!=null&&s.linkUrl?`<a 3201 href="${s.linkUrl}" 3202 target="_blank" 3203 rel="external noopener" 3204 aria-label="${(e=s.linkText)!=null?e:""} ${te("(opens in a new window)")}" 3205 >${(t=s.linkText)!=null?t:s.linkUrl}</a 3206 >`:""} 3207 </p>`:""} 3208 `}return PM(i)};function OM(i){var e,t;let s=i.theme;if(s){let r=(t=(e=i.getRootNode())==null?void 0:e.getElementById)==null?void 0:t.call(e,s);if(r&&r instanceof HTMLTemplateElement)return r;s.startsWith("media-theme-")||(s=`media-theme-${s}`);let n=$i.customElements.get(s);if(n!=null&&n.template)return n.template}}function NM(i){var e;let t=(e=i.mediaController)==null?void 0:e.querySelector("media-time-display");return t&&getComputedStyle(t).getPropertyValue("--media-duration-display-display").trim()==="none"}function A0(i){let e=i.videoTitle?{video_title:i.videoTitle}:{};return i.getAttributeNames().filter(t=>t.startsWith("metadata-")).reduce((t,s)=>{let r=i.getAttribute(s);return r!==null&&(t[s.replace(/^metadata-/,"").replace(/-/g,"_")
vendor: 4,468 bytes, line 3208
3208]=r),t},e)}var UM=Object.values(w),$M=Object.values(is),FM=Object.values(O),S0=rT(),I0="mux-player",L0={isDialogOpen:!1},BM={redundant_streams:!0},td,id,sd,sr,rd,Tn,Ke,Rs,cT,Vh,rr,R0,x0,k0,D0,HM=class extends v0{constructor(){super(),hi(this,Ke),hi(this,td),hi(this,id,!1),hi(this,sd,{}),hi(this,sr,!0),hi(this,rd,new rM(this,"hotkeys")),hi(this,Tn,{...L0,onCloseErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&Je(this,Ke,Vh).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&(iT(this,Wd.activeElement)||i.preventDefault())}}),Wi(this,td,Lf()),this.attachShadow({mode:"open"}),Je(this,Ke,cT).call(this),this.isConnected&&Je(this,Ke,Rs).call(this)}static get NAME(){return I0}static get VERSION(){return S0}static get observedAttributes(){var i;return[...(i=v0.observedAttributes)!=null?i:[],...$M,...UM,...FM]}get mediaTheme(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("media-theme")}get mediaController(){var i,e;return(e=(i=this.mediaTheme)==null?void 0:i.shadowRoot)==null?void 0:e.querySelector("media-controller")}connectedCallback(){let i=this.media;i&&(i.metadata=A0(this))}attributeChangedCallback(i,e,t){switch(Je(this,Ke,Rs).call(this),super.attributeChangedCallback(i,e,t),i){case O.HOTKEYS:Se(this,rd).value=t;break;case O.THUMBNAIL_TIME:{t!=null&&this.tokens.thumbnail&&as(te("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case O.THUMBNAIL_TOKEN:{if(t){let s=mn(t);if(s){let{aud:r}=s,n=Aa.THUMBNAIL;r!==n&&as(te("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"thumbnail"}))}}break}case O.STORYBOARD_TOKEN:{if(t){let s=mn(t);if(s){let{aud:r}=s,n=Aa.STORYBOARD;r!==n&&as(te("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"storyboard"}))}}break}case O.DRM_TOKEN:{if(t){let s=mn(t);if(s){let{aud:r}=s,n=Aa.DRM;r!==n&&as(te("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"drm"}))}}break}case w.PLAYBACK_ID:{t!=null&&t.includes("?token")&&Qt(te("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:t}));break}case w.STREAM_TYPE:{t&&![Ae.LIVE,Ae.ON_DEMAND,Ae.UNKNOWN].includes(t)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=t.includes("dvr")?Number.POSITIVE_INFINITY:0:aT({file:"invalid-stream-type.md",message:te("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):t===Ae.LIVE?this.getAttribute(O.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN;break}case O.FULLSCREEN_ELEMENT:{if(t!=null||t!==e){let s=Wd.getElementById(t),r=s?.querySelector("mux-player");this.mediaController&&s&&r&&(this.mediaController.fullscreenElement=s)}break}}[w.PLAYBACK_ID,is.SRC,O.PLAYBACK_TOKEN].includes(i)&&e!==t&&Wi(this,Tn,{...Se(this,Tn),...L0}),Je(this,Ke,rr).call(this,{[sM(i)]:t})}async requestFullscreen(i){var e;if(!(!this.mediaController||this.mediaController.hasAttribute(_.MEDIA_IS_FULLSCREEN)))return(e=this.mediaController)==null||e.dispatchEvent(new $i.CustomEvent(X.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((t,s)=>{var r;(r=this.mediaController)==null||r.addEventListener(cs.MEDIA_IS_FULLSCREEN,()=>t(),{once:!0})})}async exitFullscreen(){var i;if(!(!this.mediaController||!this.mediaController.hasAttribute(_.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new $i.CustomEvent(X.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((e,t)=>{var s;(s=this.mediaController)==null||s.addEventListener(cs.MEDIA_IS_FULLSCREEN,()=>e(),{once:!0})})}get preferCmcd(){var i;return(i=this.getAttribute(w.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?bd.includes(i)?this.setAttribute(w.PREFER_CMCD,i):as(`Invalid value for preferCmcd. Must be one of ${bd.join()}`):this.removeAttribute(w.PREFER_CMCD))}get hasPlayed(){var i,e;return(e=(i=this.mediaController)==null?void 0:i.hasAttribute(_.MEDIA_HAS_P
vendor: 10,302 bytes, line 3208
3208LAYED))!=null?e:!1}get inLiveWindow(){var i;return(i=this.mediaController)==null?void 0:i.hasAttribute(_.MEDIA_TIME_IS_LIVE)}get _hls(){var i;return(i=this.media)==null?void 0:i._hls}get mux(){var i;return(i=this.media)==null?void 0:i.mux}get theme(){var i;return(i=this.getAttribute(O.THEME))!=null?i:wM}set theme(i){this.setAttribute(O.THEME,`${i}`)}get themeProps(){let i=this.mediaTheme;if(!i)return;let e={};for(let t of i.getAttributeNames()){if(Kh.includes(t))continue;let s=i.getAttribute(t);e[eT(t)]=s===""?!0:s}return e}set themeProps(i){var e,t;Je(this,Ke,Rs).call(this);let s={...this.themeProps,...i};for(let r in s){if(Kh.includes(r))continue;let n=i?.[r];typeof n=="boolean"||n==null?(e=this.mediaTheme)==null||e.toggleAttribute(Hh(r),!!n):(t=this.mediaTheme)==null||t.setAttribute(Hh(r),n)}}get playbackId(){var i;return(i=this.getAttribute(w.PLAYBACK_ID))!=null?i:void 0}set playbackId(i){i?this.setAttribute(w.PLAYBACK_ID,i):this.removeAttribute(w.PLAYBACK_ID)}get src(){var i,e;return this.playbackId?(i=js(this,is.SRC))!=null?i:void 0:(e=this.getAttribute(is.SRC))!=null?e:void 0}set src(i){i?this.setAttribute(is.SRC,i):this.removeAttribute(is.SRC)}get poster(){var i;let e=this.getAttribute(is.POSTER);if(e!=null)return e;let{tokens:t}=this;if(t.playback&&!t.thumbnail){as("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return eM(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,programTime:this.programStartTime,token:t.thumbnail})}set poster(i){i||i===""?this.setAttribute(is.POSTER,i):this.removeAttribute(is.POSTER)}get storyboardSrc(){var i;return(i=this.getAttribute(O.STORYBOARD_SRC))!=null?i:void 0}set storyboardSrc(i){i?this.setAttribute(O.STORYBOARD_SRC,i):this.removeAttribute(O.STORYBOARD_SRC)}get storyboard(){let{tokens:i}=this;if(this.storyboardSrc&&!i.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[Ae.LIVE,Ae.UNKNOWN].includes(this.streamType)||i.playback&&!i.storyboard))return tM(this.playbackId,{customDomain:this.customDomain,token:i.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(O.AUDIO)}set audio(i){if(!i){this.removeAttribute(O.AUDIO);return}this.setAttribute(O.AUDIO,"")}get hotkeys(){return Se(this,rd)}get nohotkeys(){return this.hasAttribute(O.NOHOTKEYS)}set nohotkeys(i){if(!i){this.removeAttribute(O.NOHOTKEYS);return}this.setAttribute(O.NOHOTKEYS,"")}get thumbnailTime(){return Ft(this.getAttribute(O.THUMBNAIL_TIME))}set thumbnailTime(i){this.setAttribute(O.THUMBNAIL_TIME,`${i}`)}get videoTitle(){var i,e;return(e=(i=this.getAttribute(O.VIDEO_TITLE))!=null?i:this.getAttribute(O.TITLE))!=null?e:""}set videoTitle(i){i!==this.videoTitle&&(i?this.setAttribute(O.VIDEO_TITLE,i):this.removeAttribute(O.VIDEO_TITLE))}get placeholder(){var i;return(i=js(this,O.PLACEHOLDER))!=null?i:""}set placeholder(i){this.setAttribute(O.PLACEHOLDER,`${i}`)}get primaryColor(){var i,e;let t=this.getAttribute(O.PRIMARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=$i.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:e.trim(),t))return t}set primaryColor(i){this.setAttribute(O.PRIMARY_COLOR,`${i}`)}get secondaryColor(){var i,e;let t=this.getAttribute(O.SECONDARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=$i.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:e.trim(),t))return t}set secondaryColor(i){this.setAttribute(O.SECONDARY_COLOR,`${i}`)}get accentColor(){var i,e;let t=this.getAttribute(O.ACCENT_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=$i.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:e.trim(),t))return t}set accentColor(i){this.setAttribute(O.ACCENT_COLOR,`${i}`)}get defaultShowRemainingTime(){return this.hasAttribute(O.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(i){i?this.setAttribute(O.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(O.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(O.PLAYBACK_RATES))return this.getAttribute(O.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(i=>Number(i)).filter(i=>!Number.isNaN(i)).sort((i,e)=>i-e)}set playbackRates(i){if(!i){this.removeAttribute(O.PLAYBACK_RATES);return}this.setAttribute(O.PLAYBACK_RATES,i.join(" "))}get forwardSeekOffset(){var i;return(i=Ft(this.getAttribute(O.FORWARD_SEEK_OFFSET)))!=null?i:10}set forwardSeekOffset(i){this.setAttribute(O.FORWARD_SEEK_OFFSET,`${i}`)}get backwardSeekOffset(){var i;return(i=Ft(this.getAttribute(O.BACKWARD_SEEK_OFFSET)))!=null?i:10}set backwardSeekOffset(i){this.setAttribute(O.BACKWARD_SEEK_OFFSET,`${i}`)}get defaultHiddenCaptions(){return this.hasAttribute(O.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(i){i?this.setAttribute(O.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(O.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return Ft(this.getAttribute(O.DEFAULT_DURATION))}set defaultDuration(i){i==null?this.removeAttribute(O.DEFAULT_DURATION):this.setAttribute(O.DEFAULT_DURATION,`${i}`)}get playerInitTime(){return this.hasAttribute(w.PLAYER_INIT_TIME)?Ft(this.getAttribute(w.PLAYER_INIT_TIME)):Se(this,td)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(w.PLAYER_INIT_TIME):this.setAttribute(w.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=this.getAttribute(w.PLAYER_SOFTWARE_NAME))!=null?i:I0}get playerSoftwareVersion(){var i;return(i=this.getAttribute(w.PLAYER_SOFTWARE_VERSION))!=null?i:S0}get beaconCollectionDomain(){var i;return(i=this.getAttribute(w.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(w.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(w.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var i;return(i=this.getAttribute(w.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(w.MAX_RESOLUTION,i):this.removeAttribute(w.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(w.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(w.MIN_RESOLUTION,i):this.removeAttribute(w.MIN_RESOLUTION))}get renditionOrder(){var i;return(i=this.getAttribute(w.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(w.RENDITION_ORDER,i):this.removeAttribute(w.RENDITION_ORDER))}get programStartTime(){return Ft(this.getAttribute(w.PROGRAM_START_TIME))}set programStartTime(i){i==null?this.removeAttribute(w.PROGRAM_START_TIME):this.setAttribute(w.PROGRAM_START_TIME,`${i}`)}get programEndTime(){return Ft(this.getAttribute(w.PROGRAM_END_TIME))}set programEndTime(i){i==null?this.removeAttribute(w.PROGRAM_END_TIME):this.setAttribute(w.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){return Ft(this.getAttribute(w.ASSET_START_TIME))}set assetStartTime(i){i==null?this.removeAttribute(w.ASSET_START_TIME):this.setAttribute(w.ASSET_START_TIME,`${i}`)}get assetEndTime(){return Ft(this.getAttribute(w.ASSET_END_TIME))}set assetEndTime(i){i==null?this.removeAttribute(w.ASSET_END_TIME):this.setAttribute(w.ASSET_END_TIME,`${i}`)}get extraSourceParams(){return this.hasAttribute(O.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(O.EXTRA_SOURCE_PARAMS)).entries()].reduce((i,[e,t])=>(i[e]=t,i),{}):BM}set extraSourceParams(i){i==null?this.removeAttribute(O.EXTRA_SOURCE_PARAMS):this.setAttribute(O.EXTRA_SOURCE_PARAMS,new URLSearchParams(i).toString())}get customDomain(){var i;return(i=this.getAttribute(w.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(w.CUSTOM_DOMAIN,i):this.removeAttribute(w.CUSTOM_DOMAIN))}get envKey(){var i;return(i=js(this,w.ENV_KEY))!=null?i:void 0}set envKey(i){this.setAttribute(w.ENV_KEY,`${i}`)}get noVolumePref(){return this.hasAttribute(O.NO_VOLUME_PREF)}set noVolumePref(i){i?this.setAttribute(O.NO_VOLUME_PREF,""):this.removeAttribute(O.NO_VOLUME_PREF)}get noMutedPref(){return this.hasAttribute(O.NO_MUTED_PREF)}set noMutedPref(i){i?this.setAttribute(O.NO_MUTED_PREF,""):this.removeAttribute(O.NO_MUTED_PREF)}get debug(){return js(this,w.DEBUG)!=null}set debug(i){i?this.setAttribute(w.DEBUG,""):this.removeAttribute(w.DEBUG)}get disableTracking(){return js(this,w.DISABLE_TRACKING)!=null}set disableTracking(i){this.toggleAttribute(w.DISABLE_TRACKING,!!i)}get disableCookies(){return js(this,w.DISABLE_COOKIES)!=null}set disableCookies(i){i?this.setAttribute(w.DISABLE_COOKIES,""):this.removeAttribute(w.DISABLE_COOKIES)}get streamType(){var i,e,t;return(t=(e=this.getAttribute(w.STREAM_TYPE))!=null?e:(i=this.media)==null?void 0:i.streamType)!=null?t:Ae.UNKNOWN}set streamType(i){this.setAttribute(w.STREAM_TYPE,`${i}`)}get defaultStreamType(){var i,e,t;return(t=(e=this.getAttribute(O.DEFAULT_STREAM_TYPE))!=null?e:(i=this.mediaController)==null?void 0:i.getAttribute(O.DEFAULT_STREAM_TYPE))!=null?t:Ae.ON_DEMAND}set defaultStreamType(i){i?this.setAttribute(O.DEFAULT_STREAM_TYPE,i):this.removeAttribute(O.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var i,e;return this.hasAttribute(O.TARGET_LIVE_WINDOW)?+this.getAttribute(O.TARGET_LIVE_WINDOW):(e=(i=this.media)==null?void 0:i.targetLiveWindow)!=null?e:Number.NaN}set targetLiveWindow(i){i==this.targetLiveWindow||Number.isNaN(i)&&Number.isNaN(this.targetLiveWindow)||(i==null?this.removeAttribute(O.TARGET_LIVE_WINDOW):this.setAttribute(O.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i;return(i=this.media)==null?void 0:i.liveEdgeStart}get startTime(){return Ft(js(this,w.START_TIME))}set startTime(i){this.setAttribute(w.START_TIME,`${i}`)}get preferPlayback(){let i=this.getAttribute(w.PREFER_PLAYBACK);if(i===Hi.MSE||i===Hi.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===Hi.MSE||i===Hi.NATIVE?this.setAttribute(w.PREFER_PLAYBACK,i):this.removeAttribute(w.PREFER_PLAYBACK))}get metadata(){var i;return(i=this.media)==null?void 0:i.metadata}set metadata(i){if(Je(this,Ke,Rs).call(this),!this.media){Qt("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...A0(this),...i}}
vendor: 4,886 bytes, line 3208
3208get _hlsConfig(){var i;return(i=this.media)==null?void 0:i._hlsConfig}set _hlsConfig(i){if(Je(this,Ke,Rs).call(this),!this.media){Qt("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=i}async addCuePoints(i){var e;if(Je(this,Ke,Rs).call(this),!this.media){Qt("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(e=this.media)==null?void 0:e.addCuePoints(i)}get activeCuePoint(){var i;return(i=this.media)==null?void 0:i.activeCuePoint}get cuePoints(){var i,e;return(e=(i=this.media)==null?void 0:i.cuePoints)!=null?e:[]}addChapters(i){var e;if(Je(this,Ke,Rs).call(this),!this.media){Qt("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(e=this.media)==null?void 0:e.addChapters(i)}get activeChapter(){var i;return(i=this.media)==null?void 0:i.activeChapter}get chapters(){var i,e;return(e=(i=this.media)==null?void 0:i.chapters)!=null?e:[]}getStartDate(){var i;return(i=this.media)==null?void 0:i.getStartDate()}get currentPdt(){var i;return(i=this.media)==null?void 0:i.currentPdt}get tokens(){let i=this.getAttribute(O.PLAYBACK_TOKEN),e=this.getAttribute(O.DRM_TOKEN),t=this.getAttribute(O.THUMBNAIL_TOKEN),s=this.getAttribute(O.STORYBOARD_TOKEN);return{...Se(this,sd),...i!=null?{playback:i}:{},...e!=null?{drm:e}:{},...t!=null?{thumbnail:t}:{},...s!=null?{storyboard:s}:{}}}set tokens(i){Wi(this,sd,i??{})}get playbackToken(){var i;return(i=this.getAttribute(O.PLAYBACK_TOKEN))!=null?i:void 0}set playbackToken(i){this.setAttribute(O.PLAYBACK_TOKEN,`${i}`)}get drmToken(){var i;return(i=this.getAttribute(O.DRM_TOKEN))!=null?i:void 0}set drmToken(i){this.setAttribute(O.DRM_TOKEN,`${i}`)}get thumbnailToken(){var i;return(i=this.getAttribute(O.THUMBNAIL_TOKEN))!=null?i:void 0}set thumbnailToken(i){this.setAttribute(O.THUMBNAIL_TOKEN,`${i}`)}get storyboardToken(){var i;return(i=this.getAttribute(O.STORYBOARD_TOKEN))!=null?i:void 0}set storyboardToken(i){this.setAttribute(O.STORYBOARD_TOKEN,`${i}`)}addTextTrack(i,e,t,s){var r;let n=(r=this.media)==null?void 0:r.nativeEl;if(n)return _f(n,i,e,t,s)}removeTextTrack(i){var e;let t=(e=this.media)==null?void 0:e.nativeEl;if(t)return rx(t,i)}get textTracks(){var i;return(i=this.media)==null?void 0:i.textTracks}get castReceiver(){var i;return(i=this.getAttribute(O.CAST_RECEIVER))!=null?i:void 0}set castReceiver(i){i!==this.castReceiver&&(i?this.setAttribute(O.CAST_RECEIVER,i):this.removeAttribute(O.CAST_RECEIVER))}get castCustomData(){var i;return(i=this.media)==null?void 0:i.castCustomData}set castCustomData(i){if(!this.media){Qt("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=i}get noTooltips(){return this.hasAttribute(O.NO_TOOLTIPS)}set noTooltips(i){if(!i){this.removeAttribute(O.NO_TOOLTIPS);return}this.setAttribute(O.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(O.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(i){i?this.setAttribute(O.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(O.PROUDLY_DISPLAY_MUX_BADGE)}};td=new WeakMap,id=new WeakMap,sd=new WeakMap,sr=new WeakMap,rd=new WeakMap,Tn=new WeakMap,Ke=new WeakSet,Rs=function(){var i,e,t,s;if(!Se(this,id)){Wi(this,id,!0),Je(this,Ke,rr).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof $i.HTMLElement))throw""}catch{Qt("<media-theme> failed to upgrade!")}try{customElements.upgrade(this.media)}catch{Qt("underlying media element failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof hD))throw""}catch{Qt("<media-controller> failed to upgrade!")}Je(this,Ke,R0).call(this),Je(this,Ke,x0).call(this),Je(this,Ke,k0).call(this),Wi(this,sr,(e=(i=this.mediaController)==null?void 0:i.hasAttribute(ie.USER_INACTIVE))!=null?e:!0),Je(this,Ke,D0).call(this),(t=this.media)==null||t.addEventListener("streamtypechange",()=>Je(this,Ke,rr).call(this)),(s=this.media)==null||s.addEventListener("loadstart",()=>Je(this,Ke,rr).call(this))}},cT=function(){var i,e;try{(i=window?.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(e=window?.CSS)==null||e.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Vh=function(i){Object.assign(Se(this,Tn),i),Je(this,Ke,rr).call(this)},rr=function(i={}){bM(_M(MM(this,{...Se(this,Tn),...i})),this.shadowRoot)},R0=function(){let i=e=>{var t,s;if(!(e!=null&&e.startsWith("theme-")))return;let r=e.replace(/^theme-/,"");if(Kh.includes(r))return;let n=this.getAttribute(e);n!=null?(t=this.mediaTheme)==null||t.setAttribute(r,n):(s=this.mediaTheme)==null||s.removeAttribute(r)};new MutationObserver(e=>{for(let{attributeName:t}of e)i(t)}).observe(this,{attributes:!0}
3208),this.getAttributeNames().forEach(i)},x0=function(){let i=e=>{var t;let s=(t=this.media)==null?void 0:t.error;if(!(s instanceof z)){let{message:n,code:a}=s??{};s=new z(n,a)}if(!(s!=null&&s.fatal)){as(s),s.data&&as(`${s.name} data:`,s.data);return}let r=b0(s);r.message&&aT(r),Qt(s),s.data&&Qt(`${s.name} data:`,s.data),Je(this,Ke,Vh).call(this,{isDialogOpen:!0})};this.addEventListener("error",i),this.media&&(this.media.errorTranslator=(e={})=>{var t,s,r;if(!(((t=this.media)==null?void 0:t.error)instanceof z))return e;let n=b0((s=this.media)==null?void 0:s.error);return{player_error_code:(r=this.media)==null?void 0:r.error.code,player_error_message:n.message?String(n.message):e.player_error_message,player_error_context:n.context?String(n.context):e.player_error_context}})},k0=function(){var i,e,t,s;let r=()=>Je(this,Ke,rr).call(this);(e=(i=this.media)==null?void 0:i.textTracks)==null||e.addEventListener("addtrack",r),(s=(t=this.media)==null?void 0:t.textTracks)==null||s.addEventListener("removetrack",r)},D0=function(){var i,e;if(!/Firefox/i.test(navigator.userAgent))return;let t,s=new WeakMap,r=()=>this.streamType===Ae.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,n=(l,d,u=!1)=>{r()||Array.from(l&&l.activeCues||[]).forEach(c=>{if(!(!c.snapToLines||c.line<-5||c.line>=0&&c.line<10))if(!d||this.paused){let h=c.text.split(` 3209`).length,f=-3;this.streamType===Ae.LIVE&&(f=-2);let m=f-h;if(c.line===m&&!u)return;s.has(c)||s.set(c,c.line),c.line=m}else setTimeout(()=>{c.line=s.get(c)||"auto"},500)})},a=()=>{var l,d;n(t,(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ie.USER_INACTIVE))!=null?d:!1)},o=()=>{var l,d;let u=Array.from(((d=(l=this.mediaController)==null?void 0:l.media)==null?void 0:d.textTracks)||[]).filter(c=>["subtitles","captions"].includes(c.kind)&&c.mode==="showing")[0];u!==t&&t?.removeEventListener("cuechange",a),t=u,t?.addEventListener("cuechange",a),n(t,Se(this,sr))};o(),(i=this.textTracks)==null||i.addEventListener("change",o),(e=this.textTracks)==null||e.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var l,d;let u=(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ie.USER_INACTIVE))!=null?d:!0;Se(this,sr)!==u&&(Wi(this,sr,u),n(t,Se(this,sr)))})};function js(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var C0=HM,hT=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends hT{}globalThis.DocumentFragment=i}var GM=class extends hT{},KM={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(GM)}},VM={customElements:KM},WM=typeof window>"u"||typeof globalThis.customElements>"u",uc=WM?VM:globalThis;uc.customElements.get("mux-player")||(uc.customElements.define("mux-player",C0),uc.MuxPlayerElement=C0);var fT=parseInt(Ca.version)>=19,w0={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},YM=i=>i==null,qM=(i,e)=>YM(e)?!1:i in e,jM=i=>i.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),zM=(i,e)=>{if(!(!fT&&typeof e=="boolean"&&!e)){if(qM(i,w0))return w0[i];if(typeof e<"u")return/[A-Z]/.test(i)?jM(i):i}},QM=(i,e)=>!fT&&typeof i=="boolean"?"":i,XM=(i={})=>{let{ref:e,...t}=i;return Object.entries(t).reduce((s,[r,n])=>{let a=zM(r,n);if(!a)return s;let o=QM(n);return s[a]=o,s},{})};function M0(i,e){if(typeof i=="function")return i(e);i!=null&&(i.current=e)}function ZM(...i){return e=>{let t=!1,s=i.map(r=>{let n=M0(r,e);return!t&&typeof n=="function"&&(t=!0),n});if(t)return()=>{for(let r=0;r<s.length;r++){let n=s[r];typeof n=="function"?n():M0(i[r],null)}}}}function JM(...i){return wa.useCallback(ZM(...i),i)}var eP=Object.prototype.hasOwnProperty,tP=(i,e)=>{if(Object.is(i,e))return!0;if(typeof i!="object"||i===null||typeof e!="object"||e===null)return!1;if(Array.isArray(i))return!Array.isArray(e)||i.length!==e.length?!1:i.some((r,n)=>e[n]===r);let t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(!eP.call(e,t[r])||!Object.is(i[t[r]],e[t[r]]))return!1;return!0},mT=(i,e,t)=>!tP(e,i[t]),iP=(i,e,t)=>{i[t]=e},sP=(i,e,t,s=iP,r=mT)=>wa.useEffect(()=>{let n=t?.current;n&&r(n,e,i)&&s(n,e,i)},[t?.current,e]),Ai=sP,rP=()=>{try{return"3.8.0"}catch{}return"UNKNOWN"},nP=rP(),aP=()=>nP,Ue=(i,e,t)=>wa.useEffect(()=>{let s=e?.current;if(!s||!t)return;let r=i,n=t;return s.addEventListener(r,n),()=>{s.removeEventListener(r,n)}},[e?.current,t,i]),oP=Ca.forwardRef(({children:i,...e},t)=>Ca.createElement("mux-player",{suppressHydrationWarning:!0,...XM(e),ref:t},i)),lP=(i,e)=>{let{onAbort:t,onCanPlay:s,onCanPlayThrough:r,onEmptied:n,onLoadStart:a,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:u,onVolumeChange:c,onRateChange:h,onResize:f,onWaiting:m,onPlay:g,onPlaying:p,onTimeUpdate:E,onPause:b,onSeeking:y,onSeeked:T,onStalled:A,onSuspend:L,onEnded:S,onError:R,onCuePointChange:x,onChapterChange:I,metadata:M,tokens:$,paused:V,playbackId:Y,playbackRates:H,currentTime:N,themeProps:W,extraSourceParams:B,castCustomData:q,_hlsConfig:J,...U}=e;return Ai("tokens",$,i),Ai("playbackId",Y,i),Ai("playbackRates",H,i),Ai("metadata",M,i),Ai("extraSourceParams",B,i),Ai("_hlsConfig",J,i),Ai("themeProps",W,i),Ai("castCustomData",q,i),Ai("paused",V,i,(F,re)=>{re!=null&&(re?F.pause():F.play())},(F,re,me)=>F.hasAttribute("autoplay")&&!F.hasPlayed?!1:mT(F,re,me)),Ai("currentTime",N,i,(F,re)=>{re!=null&&(F.currentTime=re)}),Ue("abort",i,t),Ue("canplay",i,s),Ue("canplaythrough",i,r),Ue("emptied",i,n),Ue("loadstart",i,a),Ue("loadeddata",i,o),Ue("loadedmetadata",i,l),Ue("progress",i,d),Ue("durationchange",i,u),Ue("volumechange",i,c),Ue("ratechange",i,h),Ue("resize",i,f),Ue("waiting",i,m),Ue("play",i,g),Ue("playing",i,p),Ue("timeupdate",i,E),Ue("pause",i,b),Ue("seeking",i,y),Ue("seeked",i,T),Ue("stalled",i,A),Ue("suspend",
3209i,L),Ue("ended",i,S),Ue("error",i,R),Ue("cuepointchange",i,x),Ue("chapterchange",i,I),[U]},dP=aP(),uP="mux-player-react",cP=Ca.forwardRef((i,e)=>{var t;let s=wa.useRef(null),r=JM(s,e),[n]=lP(s,i),[a]=wa.useState((t=i.playerInitTime)!=null?t:Lf());return Ca.createElement(oP,{ref:r,defaultHiddenCaptions:i.defaultHiddenCaptions,playerSoftwareName:uP,playerSoftwareVersion:dP,playerInitTime:a,...n})}),MP=cP;export{EP as MaxResolution,z as MediaError,yP as MinResolution,bP as RenditionOrder,MP as default,Lf as generatePlayerInitTime,uP as playerSoftwareName,dP as playerSoftwareVersion};
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.