PageSourceSearch

https://gt-garage.pages.dev/_nuxt/CCfE8VHj.js

js gt-garage.pages.dev collected 2026-10-03 05:12:03 UTC 1,013,952 bytes, 3,223 lines download raw bytes

vendor: 25,457 bytes, lines 1-12
1var Wb=Object.defineProperty;var qb=Object.getPrototypeOf;var Yb=Reflect.get;var cp=i=>{throw TypeError(i)};var jb=(i,e,t)=>e in i?Wb(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var xe=(i,e,t)=>jb(i,typeof e!="symbol"?e+"":e,t),Fu=(i,e,t)=>e.has(i)||cp("Cannot "+t);var M=(i,e,t)=>(Fu(i,e,"read from private field"),t?t.call(i):e.get(i)),he=(i,e,t)=>e.has(i)?cp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),ue=(i,e,t,s)=>(Fu(i,e,"write to private field"),s?s.call(i,t):e.set(i,t),t),$e=(i,e,t)=>(Fu(i,e,"access private method"),t);var Uo=(i,e,t)=>Yb(qb(i),t,e);import{u as zb,a as Qb,_ as Xb}from"./OykzN1_T.js";import{d as dv,i as is,b as hp,k as fp,E as Zb,_ as uv,c as Aa,f as Jb,G as mp,o as rn,D as $u,e as la,v as pp}from"./DkmqD0Ep.js";var e_=Object.create,cv=Object.defineProperty,t_=Object.getOwnPropertyDescriptor,i_=Object.getOwnPropertyNames,s_=Object.getPrototypeOf,r_=Object.prototype.hasOwnProperty,hv=function(i,e){return function(){return i&&(e=i(i=0)),e}},Ot=function(i,e){return function(){return e||i((e={exports:{}}).exports,e),e.exports}},n_=function(i,e,t,s){if(e&&typeof e=="object"||typeof e=="function")for(var r=i_(e),n=0,a=r.length,o;n<a;n++)o=r[n],!r_.call(i,o)&&o!==t&&cv(i,o,{get:(function(l){return e[l]}).bind(null,o),enumerable:!(s=t_(e,o))||s.enumerable});return i},Wt=function(i,e,t){return t=i!=null?e_(s_(i)):{},n_(!i||!i.__esModule?cv(t,"default",{value:i,enumerable:!0}):t,i)},Ei=Ot(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 Gr(i,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](i):Gr(i,e)}var Kr=hv(function(){Kr()});function fv(i){"@swc/helpers - typeof";return i&&typeof Symbol<"u"&&i.constructor===Symbol?"symbol":typeof i}var mv=hv(function(){}),pv=Ot(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))}}}),a_=Ot(function(i,e){Kr(),e.exports=t;function t(s,r){if(!Gr(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]"}}),o_=Ot(function(i,e){Kr(),e.exports=t;function t(s,r){if(!Gr(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}}),gv=Ot(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)}}),vv=Ot(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)}}),Ev=Ot(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)}}}),l_=Ot(function(i,e){mv(),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=fv(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 p=h[m];m=m.replace(/[A-Z]/g,function(g){return"-"+g.toLowerCase()}),f+=m+":"+p+";"}),f}function o(h){var f=h.dataset,m=[];for(var p in f)m.push({name:"data-"+p,value:f[p]});return m.length?l(m):""}function l(h){var f=[];return h.forEach(function(m){var p=m.name,g=m.value;p==="style"&&(g=a(g)),f.push(p+'="'+c(g)+'"')}),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 p in h._attributes)for(var g in h._attributes[p]){var v=h._attributes[p][g],T=(v.prefix?v.prefix+":":"")+g;f.push({name:T,value:v.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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function c(h){return u(h).replace(/"/g,"&quot;")}}),yv=Ot(function(i,e){Kr();var t=pv(),s=gv(),r=vv(),n=Ev(),a=l_(),o="http://www.w3.org/1999/xhtml";e.exports=l;function l(d,u,c){if(!Gr(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 p=this._attributes[d]||(this._attributes[d]={});p[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(p){return m.indexOf(p)!==-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}}),d_=Ot(function(i,e){Kr();var t=yv();e.exports=s;function s(r){if(!Gr(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("")}}),u_=Ot(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(){}}),c_=Ot(function(i,e){Kr();var t=pv(),s=a_(),r=o_(),n=yv(),a=d_(),o=u_(),l=gv(),d=vv(),u=Ev();e.exports=c;function c(){if(!Gr(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 p=f===null?null:String(f);return new n(m,this,p)},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(p){if(String(p.id)===f)return p});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}),h_=Ot(function(i,e){var t=c_();e.exports=new t}),Tv=Ot(function(i,e){var t=typeof global<"u"?global:typeof window<"u"?window:{},s=h_(),r;typeof document<"u"?r=document:(r=t["__GLOBAL_DOCUMENT_CACHE@4"],r||(r=t["__GLOBAL_DOCUMENT_CACHE@4"]=s)),e.exports=r});function f_(i){if(Array.isArray(i))return i}function m_(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}}function p_(){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 bv(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 fs(i,e){return f_(i)||m_(i,e)||bv(i,e)||p_()}var Ya=Wt(Ei()),gp=Wt(Ei()),g_=Wt(Ei()),v_={now:function(){var i=g_.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)}},lt=v_,ao=function(){var i,e,t;if(typeof((i=gp.default.crypto)===null||i===void 0?void 0:i.getRandomValues)=="function"){t=new Uint8Array(32),gp.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=lt.now(),o=a==null?void 0:a.toString(16).substring(3);return o?e.substring(0,28)+o:e},_v=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},oi=function(i){if(i&&typeof i.nodeName<"u")return i.muxId||(i.muxId=_v()),i.muxId;var e;try{e=document.querySelector(i)}catch{}return e&&!e.muxId&&(e.muxId=i),(e==null?void 0:e.muxId)||i},kd=function(i){var e;i&&typeof i.nodeName<"u"?(e=i,i=oi(e)):e=document.querySelector(i);var t=e&&e.nodeName?e.nodeName.toLowerCase():"";return[e,i,t]};function E_(i){if(Array.isArray(i))return Cc(i)}function y_(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function T_(){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 li(i){return E_(i)||y_(i)||bv(i)||T_()}var _r={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},b_=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,li(o)),d=(s=console.info).bind.apply(s,li(o)),u=(r=console.debug).bind.apply(r,li(o)),c=(n=console.warn).bind.apply(n,li(o)),h=(a=console.error).bind.apply(a,li(o)),f=e;return{trace:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>_r.TRACE))return l.apply(void 0,li(p))},debug:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>_r.DEBUG))return u.apply(void 0,li(p))},info:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>_r.INFO))return d.apply(void 0,li(p))},warn:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>_r.WARN))return c.apply(void 0,li(p))},error:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>_r.ERROR))return h.apply(void 0,li(p))},get level(){return f},set level(m){m!==this.level&&(f=m??e)}}},Ne=b_("[mux]"),Bu=Wt(Ei());function wc(){var i=Bu.default.doNotTrack||Bu.default.navigator&&Bu.default.navigator.doNotTrack;return i==="1"}function ae(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}Kr();function pt(i,e){if(!Gr(i,e))throw new TypeError("Cannot call a class as a function")}function __(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&&__(i.prototype,e),i}function W(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Yn(i){return Yn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Yn(i)}function A_(i,e){for(;!Object.prototype.hasOwnProperty.call(i,e)&&(i=Yn(i),i!==null););return i}function pl(i,e,t){return typeof Reflect<"u"&&Reflect.get?pl=Reflect.get:pl=function(s,r,n){var a=A_(s,r);if(a){var o=Object.getOwnPropertyDescriptor(a,r);return o.get?o.get.call(n||s):o.value}},pl(i,e,t||i)}function Mc(i,e){return Mc=Object.setPrototypeOf||function(t,s){return t.__proto__=s,t},Mc(i,e)}function S_(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&&Mc(i,e)}function I_(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 L_(i,e){if(i==null)return{};var t=I_(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 R_(){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}}mv();function x_(i,e){return e&&(fv(e)==="object"||typeof e=="function")?e:ae(i)}function k_(i){var e=R_();return function(){var t=Yn(i),s;if(e){var r=Yn(this).constructor;s=Reflect.construct(t,arguments,r)}else s=t.apply(this,arguments);return x_(this,s)}}var pi=function(i){return oo(i)[0]},oo=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]},Hu=Wt(Ei()),D_={exists:function(){var i=Hu.default.performance,e=i&&i.timing;return e!==void 0},domContentLoadedEventEnd:function(){var i=Hu.default.performance,e=i&&i.timing;return e&&e.domContentLoadedEventEnd},navigationStart:function(){var i=Hu.default.performance,e=i&&i.timing;return e&&e.navigationStart}},Dd=D_;function at(i,e,t){t=t===void 0?1:t,i[e]=i[e]||0,i[e]+=t}function Cd(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){W(i,r,t[r])})}return i}function C_(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);t.push.apply(t,s)}return t}function Sf(i,e){return e=e??{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):C_(Object(e)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))}),i}var w_=["x-cdn","content-type"],Av=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],M_=w_.concat(Av);function If(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&&(M_.indexOf(n.toLowerCase())>=0||n.toLowerCase().indexOf("x-litix-")===0)&&(e[n]=r.join(": "))}}),e}function wd(i){if(i){var e=Av.find(function(t){return i[t]!==void 0});return e?i[e]:void 0}}var P_=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},Sv=P_,Fo=function(i){if(!i)return{};var e=Dd.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)}},da=function(i){if(!(!i||typeof i.getAllResponseHeaders!="function"))return If(i.getAllResponseHeaders())},O_=function(i,e,t){var s=arguments.length>4?arguments[4]:void 0,r=i.log,n=i.utils.secondsToMs,a=function(g){var v=parseInt(s.version),T;return v===1&&g.programDateTime!==null&&(T=g.programDateTime),v===0&&g.pdt!==null&&(T=g.pdt),T};if(!Dd.exists()){r.warn("performance timing not supported. Not tracking HLS.js.");return}var o=function(g,v){return i.emit(e,g,v)},l=function(g,v){var T=v.levels,y=v.audioTracks,_=v.url,I=v.stats,x=v.networkDetails,L=v.sessionData,A={},R={};T.forEach(function(B,K){A[K]={width:B.width,height:B.height,bitrate:B.bitrate,attrs:B.attrs}}),y.forEach(function(B,K){R[K]={name:B.name,language:B.lang,bitrate:B.bitrate}});var S=Fo(I),k=S.bytesLoaded,O=S.requestStart,G=S.responseStart,V=S.responseEnd;o("requestcompleted",Sf(Cd({},Sv(L)),{request_event_type:g,request_bytes_loaded:k,request_start:O,request_response_start:G,request_response_end:V,request_type:"manifest",request_hostname:pi(_),request_response_headers:da(x),request_rendition_lists:{media:A,audio:R,video:{}}}))};t.on(s.Events.MANIFEST_LOADED,l);var d=function(g,v){var T=v.details,y=v.level,_=v.networkDetails,I=v.stats,x=Fo(I),L=x.bytesLoaded,A=x.requestStart,R=x.responseStart,S=x.responseEnd,k=T.fragments[T.fragments.length-1],O=a(k)+n(k.duration);o("requestcompleted",{request_event_type:g,request_bytes_loaded:L,request_start:A,request_response_start:R,request_response_end:S,request_current_level:y,request_type:"manifest",request_hostname:pi(T.url),request_response_headers:da(_),video_holdback:T.holdBack&&n(T.holdBack),video_part_holdback:T.partHoldBack&&n(T.partHoldBack),video_part_target_duration:T.partTarget&&n(T.partTarget),video_target_duration:T.targetduration&&n(T.targetduration),video_source_is_live:T.live,player_manifest_newest_program_time:isNaN(O)?void 0:O})};t.on(s.Events.LEVEL_LOADED,d);var u=function(g,v){var T=v.details,y=v.networkDetails,_=v.stats,I=Fo(_),x=I.bytesLoaded,L=I.requestStart,A=I.responseStart,R=I.responseEnd;o("requestcompleted",{request_event_type:g,request_bytes_loaded:x,request_start:L,request_response_start:A,request_response_end:R,request_type:"manifest",request_hostname:pi(T.url),request_response_headers:da(y)})};t.on(s.Events.AUDIO_TRACK_LOADED,u);var c=function(g,v){var T=v.stats,y=v.networkDetails,_=v.frag;T=T||_.stats;var I=Fo(T),x=I.bytesLoaded,L=I.requestStart,A=I.responseStart,R=I.responseEnd,S=y?da(y):void 0,k={request_event_type:g,request_bytes_loaded:x,request_start:L,request_response_start:A,request_response_end:R,request_hostname:y?pi(y.responseURL):void 0,request_id:S?wd(S):void 0,request_response_headers:S,request_media_duration:_.duration,request_url:y==null?void 0:y.responseURL};_.type==="main"?(k.request_type="media",k.request_current_level=_.level,k.request_video_width=(t.levels[_.level]||{}).width,k.request_video_height=(t.levels[_.level]||{}).height,k.request_labeled_bitrate=(t.levels[_.level]||{}).bitrate):k.request_type=_.type,o("requestcompleted",k)};t.on(s.Events.FRAG_LOADED,c);var h=function(g,v){var T=v.frag,y=T.start,_=a(T),I={currentFragmentPDT:_,currentFragmentStart:n(y)};o("fragmentchange",I)};t.on(s.Events.FRAG_CHANGED,h);var f=function(g,v){var T=v.type,y=v.details,_=v.response,I=v.fatal,x=v.frag,L=v.networkDetails,A=(x==null?void 0:x.url)||v.url||"",R=L?da(L):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:A,request_hostname:pi(A),request_id:R?wd(R):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:_==null?void 0:_.code,request_error_text:_==null?void 0:_.text}),I){var S,k="".concat(A?"url: ".concat(A,`
4`):"")+"".concat(_&&(_.code||_.text)?"response: ".concat(_.code,", ").concat(_.text,`
5`):"")+"".concat(v.reason?"failure reason: ".concat(v.reason,`
6`):"")+"".concat(v.level?"level: ".concat(v.level,`
7`):"")+"".concat(v.parent?"parent stream controller: ".concat(v.parent,`
8`):"")+"".concat(v.buffer?"buffer length: ".concat(v.buffer,`
9`):"")+"".concat(v.error?"error: ".concat(v.error,`
10`):"")+"".concat(v.event?"event: ".concat(v.event,`
11`):"")+"".concat(v.err?"error message: ".concat((S=v.err)===null||S===void 0?void 0:S.message,`
12`):"");o("error",{player_error_code:T,player_error_message:y,player_error_context:k})}};t.on(s.Events.ERROR,f);var m=function(g,v){var T=v.frag,y=T&&T._url||"";o("requestcanceled",{request_event_type:g,request_url:y,request_type:"media",request_hostname:pi(y)})};t.on(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,m);var p=function(g,v){var T=v.level,y=t.levels[T];if(y&&y.attrs&&y.attrs.BANDWIDTH){var _=y.attrs.BANDWIDTH,I,x=parseFloat(y.attrs["FRAME-RATE"]);isNaN(x)||(I=x),_?o("renditionchange",{video_source_fps:I,video_source_bitrate:_,video_source_width:y.width,video_source_height:y.height,video_source_rendition_name:y.name,video_source_codec:y==null?void 0:y.videoCodec}):r.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};t.on(s.Events.LEVEL_SWITCHED,p),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,p),t.off(s.Events.DESTROYING,t._stopMuxMonitor),delete t._stopMuxMonitor},t.on(s.Events.DESTROYING,t._stopMuxMonitor)},N_=function(i){i&&typeof i._stopMuxMonitor=="function"&&i._stopMuxMonitor()},vp=function(i,e){if(!i||!i.requestEndDate)return{};var t=pi(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=If(d[d.length-1]._responseHeaders||""));var c=u?wd(u):void 0;return{requestStart:n,requestResponseStart:a,requestResponseEnd:o,requestBytesLoaded:r,requestResponseHeaders:u,requestMediaDuration:l,requestHostname:t,requestUrl:s,requestId:c}},U_=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}:{}},F_=function(i){var e;return(e=i.match(/.*codecs\*?="(.*)"/))===null||e===void 0?void 0:e[1]},$_=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)}
vendor: 25,652 bytes, lines 12-14
12)[0];return s}catch{return!1}},B_=function(i,e,t){var s=i.log;if(!t||!t.on){s.warn("Invalid dash.js player reference. Monitoring blocked.");return}var r=$_(t),n=function(T,y){return i.emit(e,T,y)},a=function(T){var y=T.type,_=T.data,I=(_||{}).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:pi(I),request_url:I})};t.on("manifestLoaded",a);var o={},l=function(T){if(typeof T.getRequests!="function")return null;var y=T.getRequests({state:"executed"});return y.length===0?null:y[y.length-1]},d=function(T){var y=T.type,_=T.fragmentModel,I=T.chunk,x=l(_);u({type:y,request:x,chunk:I})},u=function(T){var y=T.type,_=T.chunk,I=T.request,x=(_||{}).mediaInfo,L=x||{},A=L.type,R=L.bitrateList;R=R||[];var S={};R.forEach(function(ee,$){S[$]={},S[$].width=ee.width,S[$].height=ee.height,S[$].bitrate=ee.bandwidth,S[$].attrs={}}),A==="video"?o.video=S:A==="audio"?o.audio=S:o.media=S;var k=vp(I,t),O=k.requestStart,G=k.requestResponseStart,V=k.requestResponseEnd,B=k.requestResponseHeaders,K=k.requestMediaDuration,J=k.requestHostname,F=k.requestUrl,ie=k.requestId;n("requestcompleted",{request_event_type:y,request_start:O,request_response_start:G,request_response_end:V,request_bytes_loaded:-1,request_type:A+"_init",request_response_headers:B,request_hostname:J,request_id:ie,request_url:F,request_media_duration:K,request_rendition_lists:o})};r>=4?t.on("initFragmentLoaded",u):t.on("initFragmentLoaded",d);var c=function(T){var y=T.type,_=T.fragmentModel,I=T.chunk,x=l(_);h({type:y,request:x,chunk:I})},h=function(T){var y=T.type,_=T.chunk,I=T.request,x=_||{},L=x.mediaInfo,A=x.start,R=L||{},S=R.type,k=vp(I,t),O=k.requestStart,G=k.requestResponseStart,V=k.requestResponseEnd,B=k.requestBytesLoaded,K=k.requestResponseHeaders,J=k.requestMediaDuration,F=k.requestHostname,ie=k.requestUrl,ee=k.requestId,$=U_(S,t),H=$.currentLevel,de=$.renditionWidth,ce=$.renditionHeight,ve=$.renditionBitrate;n("requestcompleted",{request_event_type:y,request_start:O,request_response_start:G,request_response_end:V,request_bytes_loaded:B,request_type:S,request_response_headers:K,request_hostname:F,request_id:ee,request_url:ie,request_media_start_time:A,request_media_duration:J,request_current_level:H,request_labeled_bitrate:ve,request_video_width:de,request_video_height:ce})};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 T=f.video.bitrate;if(f.audio&&typeof f.audio.bitrate=="number"&&(T+=f.audio.bitrate),T!==f.totalBitrate)return f.totalBitrate=T,{video_source_bitrate:T,video_source_height:f.video.height,video_source_width:f.video.width,video_source_codec:F_(f.video.codec)}}},p=function(T,y,_){if(typeof T.newQuality!="number"){s.warn("missing evt.newQuality in qualityChangeRendered event",T);return}var I=T.mediaType;if(I==="audio"||I==="video"){var x=t.getBitrateInfoListFor(I).find(function(A){var R=A.qualityIndex;return R===T.newQuality});if(!(x&&typeof x.bitrate=="number")){s.warn("missing bitrate info for ".concat(I));return}f[I]=Sf(Cd({},x),{codec:t.getCurrentTrackFor(I).codec});var L=m();L&&n("renditionchange",L)}};t.on("qualityChangeRendered",p);var g=function(T){var y=T.request,_=T.mediaType;y=y||{},n("requestcanceled",{request_event_type:y.type+"_"+y.action,request_url:y.url,request_type:_,request_hostname:pi(y.url)})};t.on("fragmentLoadingAbandoned",g);var v=function(T){var y=T.error,_,I,x=(y==null||(_=y.data)===null||_===void 0?void 0:_.request)||{},L=(y==null||(I=y.data)===null||I===void 0?void 0:I.response)||{};(y==null?void 0:y.code)===27&&n("requestfailed",{request_error:x.type+"_"+x.action,request_url:x.url,request_hostname:pi(x.url),request_type:x.mediaType,request_error_code:L.status,request_error_text:L.statusText});var A="".concat(x!=null&&x.url?"url: ".concat(x.url,`
13`):"")+"".concat(L!=null&&L.status||L!=null&&L.statusText?"response: ".concat(L==null?void 0:L.status,", ").concat(L==null?void 0:L.statusText,`
14`):"");n("error",{player_error_code:y==null?void 0:y.code,player_error_message:y==null?void 0:y.message,player_error_context:A})};t.on("error",v),t._stopMuxMonitor=function(){t.off("manifestLoaded",a),t.off("initFragmentLoaded",u),t.off("mediaFragmentLoaded",h),t.off("qualityChangeRendered",p),t.off("error",v),t.off("fragmentLoadingAbandoned",g),delete t._stopMuxMonitor}},H_=function(i){i&&typeof i._stopMuxMonitor=="function"&&i._stopMuxMonitor()},Ep=0,G_=function(){function i(){pt(this,i),W(this,"_listeners",void 0)}return zi(i,[{key:"on",value:function(e,t,s){return t._eventEmitterGuid=t._eventEmitterGuid||++Ep,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||++Ep;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}(),K_=G_,Gu=Wt(Ei()),V_=function(){function i(e){var t=this;pt(this,i),W(this,"_playbackHeartbeatInterval",void 0),W(this,"_playheadShouldBeProgressing",void 0),W(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&&(Gu.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=Gu.default.setInterval(function(){e.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(Gu.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),i}(),W_=V_,q_=function i(e){var t=this;pt(this,i),W(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})},Y_=q_,j_=function(){function i(e){pt(this,i),W(this,"_watchTimeTrackerLastCheckedTime",void 0),W(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}(),z_=j_,Q_=function(){function i(e){var t=this;pt(this,i),W(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),W(this,"_lastTime",void 0),W(this,"_isAdPlaying",void 0),W(this,"_callbackUpdatePlaybackTime",void 0),W(this,"pm",void 0),this.pm=e,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=lt.now(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null;var s=this._startPlaybackTimeTracking.bind(this);e.on("playing",s),e.on("adplaying",s),e.on("seeked",s);var r=this._stopPlaybackTimeTracking.bind(this);e.on("playbackheartbeatend",r),e.on("seeking",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=lt.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.pm.on("playbackheartbeat",this._callbackUpdatePlaybackTime))}},{key:"_stopPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime&&(this._updatePlaybackTime(),this.pm.off("playbackheartbeat",this._callbackUpdatePlaybackTime),this._callbackUpdatePlaybackTime=null,this._playbackTimeTrackerLastPlayheadPosition=-1)}},{key:"_updatePlaybackTime",value:function(){var e=this.pm.data.player_playhead_time,t=lt.now(),s=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&e>this._playbackTimeTrackerLastPlayheadPosition?s=e-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(s=t-this._lastTime),s>0&&s<=1e3&&at(this.pm.data,"view_content_playback_time",s),this._playbackTimeTrackerLastPlayheadPosition=e,this._lastTime=t}}]),i}(),X_=Q_,Z_=function(){function i(e){pt(this,i),W(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}(),J_=Z_,yp=5*60*1e3,eA=function i(e){if(pt(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>yp&&(e.emit("viewend"),e.send("viewend"),e.mux.log.warn("Ending view after rebuffering for longer than ".concat(yp,"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)})}},tA=eA,iA=function(){function i(e){var t=this;pt(this,i),W(this,"_lastCheckedTime",void 0),W(this,"_lastPlayheadTime",void 0),W(this,"_lastPlayheadTimeUpdatedTime",void 0),W(this,"_rebuffering",void 0),W(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:lt.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}(),sA=iA,rA=function(){function i(e){var t=this;pt(this,i),W(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||lt.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}(),nA=rA,aA=function i(e){var t=this;pt(this,i),W(this,"_lastPlayerHeight",void 0),W(this,"_lastPlayerWidth",void 0),W(this,"_lastPlayheadPosition",void 0),W(this,"_lastSourceHeight",void 0),W(this,"_lastSourceWidth",void 0),e.on("viewinit",function(){t._lastPlayheadPosition=-1});var s=["pause","rebufferstart","seeking","error","adbreakstart","hb","renditionchange","orientationchange","viewend"],r=["playing","hb","renditionchange","orientationchange"];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})})},oA=aA,lA=2e3,dA=function i(e){var t=this;pt(this,i),W(this,"isSeeking",void 0),this.isSeeking=!1;var s=-1,r=function(){var n=lt.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<=lA){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})},uA=dA,Tp=function(i,e){i.push(e),i.sort(function(t,s){return t.viewer_time-s.viewer_time})},cA=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],hA=function(){function i(e){var t=this;pt(this,i),W(this,"_adHasPlayed",void 0),W(this,"_adRequests",void 0),W(this,"_adResponses",void 0),W(this,"_currentAdRequestNumber",void 0),W(this,"_currentAdResponseNumber",void 0),W(this,"_prerollPlayTime",void 0),W(this,"_wouldBeNewAdPlay",void 0),W(this,"isAdBreak",void 0),W(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}),cA.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),Tp(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),Tp(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(!this.pm.data.view_preroll_ad_tag_hostname&&t.ad_tag_url){var s=fs(oo(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=fs(oo(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_asset_url=t==null?void 0:t.ad_asset_url,this.pm.data.ad_tag_url=t==null?void 0:t.ad_tag_url,this.pm.data.ad_creative_id=t==null?void 0:t.ad_creative_id,this.pm.data.ad_id=t==null?void 0:t.ad_id,this.pm.data.ad_universal_id=t==null?void 0:t.ad_universal_id}}]),i}(),fA=hA,bp=Wt(Ei()),mA=function i(e){pt(this,i);var t,s,r=function(){e.disableRebufferTracking||(at(e.data,"view_waiting_rebuffer_count",1),t=lt.now(),s=bp.default.setInterval(function(){if(t){var d=lt.now();at(e.data,"view_waiting_rebuffer_duration",d-t),t=d}},250))},n=function(){e.disableRebufferTracking||t&&(at(e.data,"view_waiting_rebuffer_duration",lt.now()-t),t=!1,bp.default.clearInterval(s))},a=!1,o=function(){a=!0},l=function(){a=!1,n()};e.on("waiting",function(){a&&r()}),e.on("playing",function(){n(),o()}),e.on("pause",l),e.on("seeking",l)},pA=mA,gA=function i(e){var t=this;pt(this,i),W(this,"lastWallClockTime",void 0);var s=function(){t.lastWallClockTime=lt.now(),e.on("before*",r)},r=function(n){var a=lt.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)})},vA=gA,Ku=Wt(Ei()),Iv=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: 15,704 bytes, line 14
14,s.remove=function(r,n){s(r,"",i(n,{expires:-1}))},s.withConverter=e,s}return e(function(){})}),Lv="muxData",EA=function(i){return Object.entries(i).map(function(e){var t=fs(e,2),s=t[0],r=t[1];return"".concat(s,"=").concat(r)}).join("&")},yA=function(i){return i.split("&").reduce(function(e,t){var s=fs(t.split("="),2),r=s[0],n=s[1],a=+n,o=n&&a==n?a:n;return e[r]=o,e},{})},Rv=function(){var i;try{i=yA(Iv.get(Lv)||"")}catch{i={}}return i},xv=function(i){try{Iv.set(Lv,EA(i),{expires:365})}catch{}},TA=function(){var i=Rv();return i.mux_viewer_id=i.mux_viewer_id||ao(),i.msn=i.msn||Math.random(),xv(i),{mux_viewer_id:i.mux_viewer_id,mux_sample_number:i.msn}},bA=function(){var i=Rv(),e=lt.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=ao(),i.sst=e),i.sex=e+25*60*1e3,xv(i),{session_id:i.sid,session_start:i.sst,session_expires:i.sex}};function _A(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 AA=Wt(Ei()),kv=function(){var i;switch(Dv()){case"cellular":i="cellular";break;case"ethernet":i="wired";break;case"wifi":i="wifi";break;case void 0:break;default:i="other"}return i},Dv=function(){var i=AA.default.navigator,e=i&&(i.connection||i.mozConnection||i.webkitConnection);return e&&e.type};kv.getConnectionFromAPI=Dv;var SA=kv,IA={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"},LA=Cv(IA),RA={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",cx:"connection",cz:"context",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",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"},_p=Cv(RA);function Cv(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function Pc(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=LA[a];o||(Ne.info("Data key word `"+n[0]+"` not expected in "+s),o=a+"_"),n.splice(1).forEach(function(l){l==="url"&&(r=!0),_p[l]?o+=_p[l]:Number.isInteger(Number(l))?o+=l:(Ne.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 Sr=Wt(Ei()),xA=Wt(Tv()),kA={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},DA=56*1024,CA=["hb","requestcompleted","requestfailed","requestcanceled"],wA="https://img.litix.io",ps=function(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=i||wA,this._eventQueue=[],this._postInFlight=!1,this._resendAfterPost=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},kA,e)};ps.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};ps.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()};ps.prototype.destroy=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.destroyed=!0,i?this._clearBeaconQueue():this.flushEvents(),Sr.default.clearTimeout(this._sendTimeout)};ps.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],Pc({mux_view_message:"event queue truncated"}));var t=this._createPayload(e);wv(this._beaconUrl,t,!0,function(){})};ps.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=lt.now();wv(this._beaconUrl,t,!1,function(r,n){n?(i._eventQueue=e.concat(i._eventQueue),i._failureCount+=1,Ne.info("Error sending beacon: "+n)):i._failureCount=0,i._roundTripTime=lt.now()-s,i._postInFlight=!1,i._resendAfterPost&&(i._resendAfterPost=!1,i._eventQueue.length>0&&i._sendBeaconQueue())})};ps.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};ps.prototype._startBeaconSending=function(){var i=this;Sr.default.clearTimeout(this._sendTimeout),!this.destroyed&&(this._sendTimeout=Sr.default.setTimeout(function(){i._eventQueue.length&&i._sendBeaconQueue(),i._startBeaconSending()},this._getNextBeaconTime()))};ps.prototype._createPayload=function(i){var e=this,t={transmission_timestamp:Math.round(lt.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()||(Ne.info("Payload size is too big ("+n+" kb). Removing unnecessary events."),r=i.filter(function(l){return CA.indexOf(l.e)===-1}),a()),o()||(Ne.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 MA=typeof xA.default.exitPictureInPicture=="function"?function(i){return i.length<=DA}:function(i){return!1},wv=function(i,e,t,s){if(t&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(i,e)){s();return}if(Sr.default.fetch){Sr.default.fetch(i,{method:"POST",body:e,headers:{"Content-Type":"text/plain"},keepalive:MA(e)}).then(function(n){return s(null,n.ok?null:"Error")}).catch(function(n){return s(null,n)});return}if(Sr.default.XMLHttpRequest){var r=new Sr.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()},PA=ps,OA=["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"],NA=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],UA=["ad_id","ad_creative_id","ad_universal_id"],FA=["viewstart","error","ended","viewend"],$A=10*60*1e3,BA=function(){function i(e,t){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};pt(this,i);var r,n,a,o,l,d,u,c,h,f,m,p;W(this,"mux",void 0),W(this,"envKey",void 0),W(this,"options",void 0),W(this,"eventQueue",void 0),W(this,"sampleRate",void 0),W(this,"disableCookies",void 0),W(this,"respectDoNotTrack",void 0),W(this,"previousBeaconData",void 0),W(this,"lastEventTime",void 0),W(this,"rateLimited",void 0),W(this,"pageLevelData",void 0),W(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 PA(_A(this.envKey,this.options));var g;this.sampleRate=(g=this.options.sampleRate)!==null&&g!==void 0?g:1;var v;this.disableCookies=(v=this.options.disableCookies)!==null&&v!==void 0?v:!1;var T;this.respectDoNotTrack=(T=this.options.respectDoNotTrack)!==null&&T!==void 0?T:!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:SA(),page_url:Ku.default===null||Ku.default===void 0||(p=Ku.default.location)===null||p===void 0?void 0:p.href},this.viewerData=this.disableCookies?{}:TA()}return zi(i,[{key:"send",value:function(e,t){if(!(!e||!(t!=null&&t.view_id))){if(this.respectDoNotTrack&&wc())return Ne.info("Not sending `"+e+"` because Do Not Track is enabled");if(!t||typeof t!="object")return Ne.error("A data object was expected in send() but was not provided");var s=this.disableCookies?{}:bA(),r=Sf(Cd({},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=Pc(o);if(this.lastEventTime=this.mux.utils.now(),a)return Ne.info("Not sending event due to sample rate restriction",e,r,l);if(this.envKey||Ne.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(Ne.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):FA.indexOf(e)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return r.event="eventrateexceeded",l=Pc(r),this.eventQueue.queueEvent(r.event,l),Ne.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>=$A)r=Cd({},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=fs(o,2),d=l[0],u=l[1];s.previousBeaconData&&(u!==s.previousBeaconData[d]||OA.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||UA.includes(t)&&NA.includes(e))}}]),i}(),HA=function i(e){pt(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,p=f.request_response_start,g=f.request_response_end,v=f.request_bytes_loaded;n++;var T,y;if(p?(T=p-(m??0),y=(g??0)-p):y=(g??0)-(m??0),y>0&&v&&v>0){var _=v/y*8e3;a++,s+=v,r+=y,e.data.view_min_request_throughput=Math.min(e.data.view_min_request_throughput||1/0,_),e.data.view_average_request_throughput=s/r*8e3,e.data.view_request_count=n,T>0&&(t+=T,e.data.view_max_request_latency=Math.max(e.data.view_max_request_latency||0,T),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)},GA=HA,KA=60*60*1e3,VA=function i(e){var t=this;pt(this,i),W(this,"_lastEventTime",void 0),e.on("before*",function(s,r){var n=r.viewer_time,a=lt.now(),o=t._lastEventTime;if(t._lastEventTime=a,o&&a-o>KA){var l=Object.keys(e.data).reduce(function(u,c){return c.indexOf("video_")===0?Object.assign(u,W({},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}))}})},WA=VA,qA=function i(e){pt(this,i);var t=function(o){var l=YA(o),d=jA(o);if(l!=null&&!Ap(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==null?void 0:l.video_cdn;d&&(typeof l.video_previous_cdn>"u"||l.video_previous_cdn===null)&&(Ap(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 Ap(i,e){return(i==null?void 0:i.toLowerCase())===(e==null?void 0:e.toLowerCase())}function YA(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 jA(i){return i!=null&&i.request_start?i.request_start:i!=null&&i.viewer_time?i.viewer_time:Date.now()}
14var zA=qA,QA=["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"],XA=new Set(["requestcompleted","requestfailed","requestcanceled"]),ZA=function(i){S_(t,i);var e=k_(t);function t(s,r,n){pt(this,t);var a;a=e.call(this),W(ae(a),"pageLoadEndTime",void 0),W(ae(a),"pageLoadInitTime",void 0),W(ae(a),"_destroyed",void 0),W(ae(a),"_heartBeatTimeout",void 0),W(ae(a),"adTracker",void 0),W(ae(a),"dashjs",void 0),W(ae(a),"data",void 0),W(ae(a),"disablePlayheadRebufferTracking",void 0),W(ae(a),"disableRebufferTracking",void 0),W(ae(a),"errorTracker",void 0),W(ae(a),"errorTranslator",void 0),W(ae(a),"emitTranslator",void 0),W(ae(a),"getAdData",void 0),W(ae(a),"getPlayheadTime",void 0),W(ae(a),"getStateData",void 0),W(ae(a),"stateDataTranslator",void 0),W(ae(a),"hlsjs",void 0),W(ae(a),"id",void 0),W(ae(a),"longResumeTracker",void 0),W(ae(a),"minimumRebufferDuration",void 0),W(ae(a),"mux",void 0),W(ae(a),"playbackEventDispatcher",void 0),W(ae(a),"playbackHeartbeat",void 0),W(ae(a),"playbackHeartbeatTime",void 0),W(ae(a),"playheadTime",void 0),W(ae(a),"seekingTracker",void 0),W(ae(a),"sustainedRebufferThreshold",void 0),W(ae(a),"watchTimeTracker",void 0),W(ae(a),"currentFragmentPDT",void 0),W(ae(a),"currentFragmentStart",void 0),a.pageLoadInitTime=Dd.navigationStart(),a.pageLoadEndTime=Dd.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 in 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),Ne.level=n.debug?_r.DEBUG:_r.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 BA(s,n.data.env_key,n),a.data={player_instance_id:ao(),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(ae(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}
vendor: 15,879 bytes, lines 14-16
14)),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)}),QA.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 WA(ae(a)),a.errorTracker=new Y_(ae(a)),new vA(ae(a)),a.seekingTracker=new uA(ae(a)),a.playheadTime=new J_(ae(a)),a.playbackHeartbeat=new W_(ae(a)),new oA(ae(a)),a.watchTimeTracker=new z_(ae(a)),new X_(ae(a)),a.adTracker=new fA(ae(a)),new sA(ae(a)),new tA(ae(a)),new nA(ae(a)),new pA(ae(a)),new GA(ae(a)),new zA(ae(a)),n.hlsjs&&a.addHLSJS(n),n.dashjs&&a.addDashJS(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=pl(Yn(t.prototype),"emit",this)).call.apply(n,[this].concat(li(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=fs(oo(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++,XA.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=L_(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=ao(),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,O_(this.mux,this.id,s.hlsjs,{},s.Hls||window.Hls)}},{key:"removeHLSJS",value:function(){this.hlsjs&&(N_(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,B_(this.mux,this.id,s.dashjs)}},{key:"removeDashJS",value:function(){this.dashjs&&(H_(this.dashjs),this.dashjs=void 0)}}]),t}(K_),JA=ZA,ua=Wt(Tv());function eS(){return ua.default&&!!(ua.default.fullscreenElement||ua.default.webkitFullscreenElement||ua.default.mozFullScreenElement||ua.default.msFullscreenElement)}var tS=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],iS={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};function sS(i,e,t){var s=fs(kd(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,p,g=((f=(m=this).getPlayheadTime)===null||f===void 0?void 0:f.call(m))||d(r.currentTime),v=this.hlsjs&&this.hlsjs.url,T=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:eS(),video_poster_url:r.poster,video_source_url:v||T||r.currentSrc,video_source_duration:d(r.duration),video_source_height:r.videoHeight,video_source_width:r.videoWidth,view_dropped_frame_count:r==null||(p=r.getVideoPlaybackQuality)===null||p===void 0?void 0:p.call(r).droppedVideoFrames};if(r.getStartDate&&g>0){var _=r.getStartDate();if(_&&typeof _.getTime=="function"&&_.getTime()){var I=_.getTime();if(y.player_program_time=I+g,r.seekable.length>0){var x=I+r.seekable.end(r.seekable.length-1);y.player_live_edge_program_time=x}}}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=fs(kd(f),3),p=m[0],g=m[1],v=m[2];if(p){if(v!=="video"&&v!=="audio")return i.log.error("The element of `"+g+"` was not a media element.")}else return i.log.error("No element was found with the `"+g+"` query selector.");p.muxId=r.muxId,delete r.muxId,p.mux=p.mux||{},p.mux.listeners=Object.assign({},r.mux.listeners),delete r.mux.listeners,Object.keys(p.mux.listeners).forEach(function(T){r.removeEventListener(T,p.mux.listeners[T],!1),p.addEventListener(T,p.mux.listeners[T],!1)}),p.mux.swapElement=r.mux.swapElement,p.mux.destroy=r.mux.destroy,delete r.mux,r=p},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={},tS.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=iS[r.error.code]||r.error.message}i.emit(n,f,m)},r.addEventListener(f,r.mux.listeners[f],!1))})}function rS(i,e,t,s){var r=s;if(i&&typeof i[e]=="function")try{r=i[e].apply(i,t)}catch(n){Ne.info("safeCall error",n)}return r}var ja=Wt(Ei()),nn;ja.default&&ja.default.WeakMap&&(nn=new WeakMap);function nS(i,e){if(!i||!e||!ja.default||typeof ja.default.getComputedStyle!="function")return"";var t;return nn&&nn.has(i)&&(t=nn.get(i)),t||(t=ja.default.getComputedStyle(i,null),nn&&nn.set(i,t)),t.getPropertyValue(e)}function aS(i){return Math.floor(i*1e3)}var nr={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"},hu=function(i){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(i),this.manifest};hu.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)};hu.prototype.processLine=function(i){var e=i.indexOf(":"),t=uS(i,e),s=t[0],r=t.length===2?Lf(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 nr.TARGET_DURATION:{if(!isFinite(r)||r<0)return;this.manifest.targetDuration=r,this.setHoldBack();break}case nr.PART_INF:{Vu(this.manifest,t),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break}case nr.SERVER_CONTROL:{Vu(this.manifest,t),this.setHoldBack();break}case nr.INF:{r===0?this.currentUri.duration=.01:r>0&&(this.currentUri.duration=r);break}case nr.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 nr.VERSION:{Vu(this.manifest,t);break}case nr.SESSION_DATA:{var o=cS(t[1]),l=Sv(o);Object.assign(this.manifest.sessionData,l)}}};hu.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 Vu=function(i,e){var t=Mv(e[0].replace("#EXT-X-","")),s;dS(e[1])?(s={},s=Object.assign(lS(e[1]),s)):s=Lf(e[1]),i[t]=s},Mv=function(i){return i.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()})},Lf=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},oS=function(i){var e={},t=i.split("=");if(t.length>1){var s=Mv(t[0]);e[s]=Lf(t[1])}return e},lS=function(i){for(var e=i.split(","),t={},s=0;e.length>s;s++){var r=e[s],n=oS(r);t=Object.assign(n,t)}return t},dS=function(i){return i.indexOf("=")>-1},uS=function(i,e){return e===-1?[i]:[i.substring(0,e),i.substring(e+1)]},cS=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}}},hS=hu,fS={safeCall:rS,safeIncrement:at,getComputedStyle:nS,secondsToMs:aS,assign:Object.assign,headersStringToObject:If,cdnHeadersToRequestId:wd,extractHostnameAndDomain:oo,extractHostname:pi,manifestParser:hS,generateShortID:_v,generateUUID:ao,now:lt.now,findMediaElement:kd},mS=fS,pS={PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled",HEARTBEAT:"hb",DESTROY:"destroy"},gS=pS,vS="mux-embed",ES="5.11.0",yS="2.1",tt={},Zs=function(i){var e=arguments;typeof i=="string"?Zs.hasOwnProperty(i)?Ya.default.setTimeout(function(){e=Array.prototype.splice.call(e,1),Zs[i].apply(null,e)},0):Ne.warn("`"+i+"` is an unknown task"):typeof i=="function"?Ya.default.setTimeout(function(){i(Zs)},0):Ne.warn("`"+i+"` is invalid.")},TS={loaded:lt.now(),NAME:vS,VERSION:ES,API_VERSION:yS,PLAYER_TRACKED:!1,monitor:function(i,e){return sS(Zs,i,e)},destroyMonitor:function(i){var e=fs(kd(i),1),t=e[0];t&&t.mux&&typeof t.mux.destroy=="function"?t.mux.destroy():Ne.error("A video element monitor for `"+i+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(i,e){var t=oi(i);tt[t]?tt[t].addHLSJS(e):Ne.error("A monitor for `"+t+"` has not been initialized.")},addDashJS:function(i,e){var t=oi(i);
vendor: 4,323 bytes, lines 16-22
16tt[t]?tt[t].addDashJS(e):Ne.error("A monitor for `"+t+"` has not been initialized.")},removeHLSJS:function(i){var e=oi(i);tt[e]?tt[e].removeHLSJS():Ne.error("A monitor for `"+e+"` has not been initialized.")},removeDashJS:function(i){var e=oi(i);tt[e]?tt[e].removeDashJS():Ne.error("A monitor for `"+e+"` has not been initialized.")},init:function(i,e){wc()&&e&&e.respectDoNotTrack&&Ne.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var t=oi(i);tt[t]=new JA(Zs,t,e)},emit:function(i,e,t){var s=oi(i);tt[s]?(tt[s].emit(e,t),e==="destroy"&&delete tt[s]):Ne.error("A monitor for `"+s+"` has not been initialized.")},updateData:function(i,e){var t=oi(i);tt[t]?tt[t].emit("hb",e):Ne.error("A monitor for `"+t+"` has not been initialized.")},setEmitTranslator:function(i,e){var t=oi(i);tt[t]?tt[t].emitTranslator=e:Ne.error("A monitor for `"+t+"` has not been initialized.")},setStateDataTranslator:function(i,e){var t=oi(i);tt[t]?tt[t].stateDataTranslator=e:Ne.error("A monitor for `"+t+"` has not been initialized.")},setGetPlayheadTime:function(i,e){var t=oi(i);tt[t]?tt[t].getPlayheadTime=e:Ne.error("A monitor for `"+t+"` has not been initialized.")},checkDoNotTrack:wc,log:Ne,utils:mS,events:gS,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Zs,TS);typeof Ya.default<"u"&&typeof Ya.default.addEventListener=="function"&&Ya.default.addEventListener("pagehide",function(i){i.persisted||(Zs.WINDOW_UNLOADING=!0)},!1);var Rf=Zs;/*!
17* JavaScript Cookie v2.1.3
18* https://github.com/js-cookie/js-cookie
19*
20* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
21* Released under the MIT license
22*/const q=Number.isFinite||function(i){return typeof i=="number"&&isFinite(i)},bS=Number.isSafeInteger||function(i){return typeof i=="number"&&Math.abs(i)<=_S},_S=Number.MAX_SAFE_INTEGER||9007199254740991;let te=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}({}),w=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: 17,702 bytes, line 22
22ROR="interstitialAssetItemError",i.INTERNAL_EXCEPTION="internalException",i.INTERNAL_ABORTED="aborted",i.ATTACH_MEDIA_ERROR="attachMediaError",i.UNKNOWN="unknown",i}({}),E=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 ge={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},X={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class Yr{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 AS{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 Yr(e),this.fast_=new Yr(t),this.defaultTTFB_=r,this.ttfb_=new Yr(e)}update(e,t){const{slow_:s,fast_:r,ttfb_:n}=this;s.halfLife!==e&&(this.slow_=new Yr(e,s.getEstimate(),s.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Yr(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Yr(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 SS(i,e,t){return(e=LS(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function we(){return we=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},we.apply(null,arguments)}function Sp(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 Me(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sp(Object(t),!0).forEach(function(s){SS(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Sp(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function IS(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 LS(i){var e=IS(i,"string");return typeof e=="symbol"?e:e+""}class yi{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=ws,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 ws=function(){},RS={trace:ws,debug:ws,log:ws,warn:ws,info:ws,error:ws};function Oc(){return we({},RS)}function xS(i,e){const t=self.console[i];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${i}] >`):ws}function Ip(i,e,t){return e[i]?e[i].bind(e):xS(i,t)}const Nc=Oc();function kS(i,e,t){const s=Oc();if(typeof console=="object"&&i===!0||typeof i=="object"){const r=["debug","log","info","warn","error"];r.forEach(n=>{s[n]=Ip(n,i,t)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.7`)}catch{return Oc()}r.forEach(n=>{Nc[n]=Ip(n,i)})}else we(Nc,s);return s}const Le=Nc;function er(i=!0){return typeof self>"u"?void 0:(i||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function DS(i){return typeof self<"u"&&i===self.ManagedMediaSource}function Pv(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 Vt(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;if(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}const Ar={hexDump:function(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 Ov(i){return Uint8Array.from(i.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function CS(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Wu={exports:{}},Lp;function wS(){return Lp||(Lp=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 p={scheme:f.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(p.netLoc=f.netLoc,h.path[0]!=="/"))if(!h.path)p.path=f.path,h.params||(p.params=f.params,h.query||(p.query=f.query));else{var g=f.path,v=g.substring(0,g.lastIndexOf("/")+1)+h.path;p.path=o.normalizePath(v)}return p.path===null&&(p.path=u.alwaysNormalize?o.normalizePath(h.path):h.path),o.buildURLFromParts(p)},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})()}(Wu)),Wu.exports}var xf=wS();class kf{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 Ue={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,PS(this,"stats")}setByteRange(e,t){const s=e.split("@",2);let r;s.length===1?r=(t==null?void 0: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={[Ue.AUDIO]:null,[Ue.VIDEO]:null,[Ue.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 kf),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=xf.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Ue.AUDIO]=null,e[Ue.VIDEO]=null,e[Ue.AUDIOVIDEO]=null}}function ot(i){return i.sn!=="initSegment"}class qu 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){const e=this.byteRange[0],t=this.byteRange[1];if(q(e)&&q(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(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const s=Object.keys(this.levelkeys);if(s.length===1)return this._decryptdata=this.levelkeys[s[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=q(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),s=t.length;if(s>1||s===1&&this.levelkeys[t[0]].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(!q(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return ot(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){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}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 MS=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 Uv(i,e){const t=Object.getPrototypeOf(i);if(t){const s=Object.getOwnPropertyDescriptor(t,e);return s||Uv(t,e)}}function PS(i,e){const t=Uv(i,e);t&&(t.enumerable=!0,Object.defineProperty(i,e,t))}const Rp=Math.pow(2,32)-1,OS=[].push,Fv={video:1,audio:2,id3:3,text:4};function Tt(i){return String.fromCharCode.apply(null,i)}function $v(i,e){const t=i[e]<<8|i[e+1];return t<0?65536+t:t}function oe(i,e){const t=Bv(i,e);return t<0?4294967296+t:t}function xp(i,e){let t=oe(i,e);return t*=Math.pow(2,32),t+=oe(i,e+4),t}function Bv(i,e){return i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]}function NS(i){const e=i.byteLength;for(let t=0;t<e;){const s=oe(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 me(i,e){const t=[];if(!e.length)return t;const s=i.byteLength;for(let r=0;r<s;){const n=oe(i,r),a=Tt(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=me(i.subarray(r+8,o),e.slice(1));l.length&&OS.apply(t,l)}r=o}return t}function US(i){const e=[],t=i[0];let s=8;const r=oe(i,s);s+=4;let n=0,a=0;t===0?(n=oe(i,s),a=oe(i,s+4),s+=8):(n=xp(i,s),a=xp(i,s+8),s+=16),s+=2;let o=i.length+a;const l=$v(i,s);s+=2;for(let d=0;d<l;d++){let u=s;const c=oe(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=oe(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 Hv(i){const e=[],t=me(i,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],a=me(n,["tkhd"])[0];if(a){let o=a[0];const l=oe(a,o===0?12:20),d=me(n,["mdia","mdhd"])[0];if(d){o=d[0];const u=oe(d,o===0?12:20),c=me(n,["mdia","hdlr"])[0];if(c){const h=Tt(c.subarray(8,12)),f={soun:Ue.AUDIO,vide:Ue.VIDEO}[h],m=me(n,["mdia","minf","stbl","stsd"])[0],p=FS(m);f?(e[l]={timescale:u,type:f,stsd:p},e[f]=Me({timescale:u,id:l},p)):e[l]={timescale:u,type:h,stsd:p}}}}}return me(i,["moov","mvex","trex"]).forEach(r=>{const n=oe(r,4),a=e[n];a&&(a.default={duration:oe(r,12),flags:oe(r,20)})}),e}function FS(i){const e=i.subarray(8),t=e.subarray(86),s=Tt(e.subarray(4,8));let r=s,n;const a=s==="enca"||s==="encv";if(a){const d=me(e,[s])[0].subarray(s==="enca"?28:78);
vendor: 9,060 bytes, line 22
22me(d,["sinf"]).forEach(c=>{const h=me(c,["schm"])[0];if(h){const f=Tt(h.subarray(4,8));if(f==="cbcs"||f==="cenc"){const m=me(c,["frma"])[0];m&&(r=Tt(m))}}})}const o=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const l=me(t,["avcC"])[0];l&&l.length>3&&(r+="."+Bo(l[1])+Bo(l[2])+Bo(l[3]),n=$o(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const l=me(e,[s])[0],d=me(l.subarray(28),["esds"])[0];if(d&&d.length>7){let u=4;if(d[u++]!==3)break;u=Yu(d,u),u+=2;const c=d[u++];if(c&128&&(u+=2),c&64&&(u+=d[u++]),d[u++]!==4)break;u=Yu(d,u);const h=d[u++];if(h===64)r+="."+Bo(h);else break;if(u+=12,d[u++]!==5)break;u=Yu(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=me(t,["hvcC"])[0];if(l&&l.length>12){const d=l[1],u=["","A","B","C"][d>>6],c=d&31,h=oe(l,2),f=(d&32)>>5?"H":"L",m=l[12],p=l.subarray(6,12);r+="."+u+c,r+="."+$S(h).toString(16).toUpperCase(),r+="."+f+m;let g="";for(let v=p.length;v--;){const T=p[v];(T||g)&&(g="."+T.toString(16).toUpperCase()+g)}r+=g}n=$o(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=$o(r,t)||r;break}case"vp09":{const l=me(t,["vpcC"])[0];if(l&&l.length>6){const d=l[4],u=l[5],c=l[6]>>4&15;r+="."+Ni(d)+"."+Ni(u)+"."+Ni(c)}break}case"av01":{const l=me(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,p=(l[2]&16)>>4,g=(l[2]&8)>>3,v=(l[2]&4)>>2,T=l[2]&3;r+="."+d+"."+Ni(u)+c+"."+Ni(m)+"."+p+"."+g+v+T+"."+Ni(1)+"."+Ni(1)+"."+Ni(1)+"."+0,n=$o("dav1",t)}break}}return{codec:r,encrypted:a,supplemental:n}}function $o(i,e){const t=me(e,["dvvC"]),s=t.length?t[0]:me(e,["dvcC"])[0];if(s){const r=s[2]>>1&127,n=s[2]<<5&32|s[3]>>3&31;return i+"."+Ni(r)+"."+Ni(n)}}function $S(i){let e=0;for(let t=0;t<32;t++)e|=(i>>t&1)<<31-t;return e>>>0}function Yu(i,e){const t=e+5;for(;i[e++]&128&&e<t;);return e}function Bo(i){return("0"+i.toString(16).toUpperCase()).slice(-2)}function Ni(i){return(i<10?"0":"")+i}function BS(i,e){if(!i||!e)return i;const t=e.keyId;return t&&e.isCommonEncryption&&me(i,["moov","trak"]).forEach(r=>{const a=me(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=me(a,["enca"]);const l=o.length>0;l||(o=me(a,["encv"])),o.forEach(d=>{const u=l?d.subarray(28):d.subarray(78);me(u,["sinf"]).forEach(h=>{const f=HS(h);if(f){const m=f.subarray(8,24);m.some(p=>p!==0)||(Le.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${Ar.hexDump(m)} -> ${Ar.hexDump(t)}`),f.set(t,8))}})})}),i}function HS(i){const e=me(i,["schm"])[0];if(e){const t=Tt(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return me(i,["schi","tenc"])[0]}return null}function GS(i,e,t){const s={},r=me(i,["moof","traf"]);for(let n=0;n<r.length;n++){const a=r[n],o=me(a,["tfhd"])[0],l=oe(o,4),d=e[l];if(!d)continue;const u=s[l]||(s[l]={start:NaN,duration:0,sampleCount:0,timescale:d.timescale,type:d.type}),c=me(a,["tfdt"])[0];if(c){const y=c[0];let _=oe(c,4);y===1&&(_===Rp?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(_*=Rp+1,_+=oe(c,8))),q(_)&&(!q(u.start)||_<u.start)&&(u.start=_)}const h=d.default,f=oe(o,0)|(h==null?void 0:h.flags);let m=(h==null?void 0:h.duration)||0;f&8&&(f&2?m=oe(o,12):m=oe(o,8));const p=me(a,["trun"]);let g=u.start||0,v=0,T=m;for(let y=0;y<p.length;y++){const _=p[y],I=oe(_,4),x=u.sampleCount;u.sampleCount+=I;const L=_[3]&1,A=_[3]&4,R=_[2]&1,S=_[2]&2,k=_[2]&4,O=_[2]&8;let G=8,V=I;for(L&&(G+=4),A&&I&&(!(_[G+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=x),G+=4,R?(T=oe(_,G),G+=4):T=m,S&&(G+=4),O&&(G+=4),g+=T,v+=T,V--);V--;)R?(T=oe(_,G),G+=4):T=m,S&&(G+=4),k&&(_[G+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-(V+1),u.keyFrameStart=g),G+=4),O&&(G+=4),g+=T,v+=T;!v&&m&&(v+=m*I)}u.duration+=v}if(!Object.keys(s).some(n=>s[n].duration)){let n=1/0,a=0;const o=me(i,["sidx"]);for(let l=0;l<o.length;l++){const d=US(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)}}a&&q(a)&&Object.keys(s).forEach(l=>{s[l].duration||(s[l].duration=a*s[l].timescale-s[l].start)})}return s}function KS(i){const e={valid:null,remainder:null},t=me(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 si(i,e){const t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function kp(i,e){const t=[],s=e.samples,r=e.timescale,n=e.id;let a=!1;return me(s,["moof"]).map(l=>{const d=l.byteOffset-8;me(l,["traf"]).map(c=>{const h=me(c,["tfdt"]).map(f=>{const m=f[0];let p=oe(f,4);return m===1&&(p*=Math.pow(2,32),p+=oe(f,8)),p/r})[0];return h!==void 0&&(i=h),me(c,["tfhd"]).map(f=>{const m=oe(f,4),p=oe(f,0)&16777215,g=(p&1)!==0,v=(p&2)!==0,T=(p&8)!==0;let y=0;const _=(p&16)!==0;let I=0;const x=(p&32)!==0;let L=8;m===n&&(g&&(L+=8),v&&(L+=4),T&&(y=oe(f,L),L+=4),_&&(I=oe(f,L),L+=4),x&&(L+=4),e.type==="video"&&(a=fu(e.codec)),me(c,["trun"]).map(A=>{const R=A[0],S=oe(A,0)&16777215,k=(S&1)!==0;let O=0;const G=(S&4)!==0,V=(S&256)!==0;let B=0;const K=(S&512)!==0;let J=0;const F=(S&1024)!==0,ie=(S&2048)!==0;let ee=0;const $=oe(A,4);let H=8;k&&(O=oe(A,H),H+=4),G&&(H+=4);let de=O+d;for(let ce=0;ce<$;ce++){if(V?(B=oe(A,H),H+=4):B=y,K?(J=oe(A,H),H+=4):J=I,F&&(H+=4),ie&&(R===0?ee=oe(A,H):ee=Bv(A,H),H+=4),e.type===Ue.VIDEO){let ve=0;for(;ve<J;){const Ee=oe(s,de);if(de+=4,VS(a,s[de])){const Fe=s.subarray(de,de+Ee);Df(Fe,a?2:1,i+ee/r,t)}de+=Ee,ve+=Ee+4}}i+=B/r}}))})})}),t}function fu(i){if(!i)return!1;const e=i.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function VS(i,e){if(i){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Df(i,e,t,s){const r=Gv(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=$v(r,u);if(u+=2,h===49){const f=oe(r,u);if(u+=4,f===1195456820){const m=r[u++];if(m===3){const p=r[u++],g=31&p,v=64&p,T=v?2+g*3:0,y=new Uint8Array(T);if(v){y[0]=p;for(let _=1;_<T;_++)y[_]=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 p=r[u++].toString(16);c.push(p.length==1?"0"+p:p),(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:Vt(f),userDataBytes:f})}}}function Gv(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 WS(i){const e=i[0];let t="",s="",r=0,n=0,a=0,o=0,l=0,d=0;if(e===0){for(;Tt(i.subarray(d,d+1))!=="\0";)t+=Tt(i.subarray(d,d+1)),d+=1;for(t+=Tt(i.subarray(d,d+1)),d+=1;Tt(i.subarray(d,d+1))!=="\0";)s+=Tt(i.subarray(d,d+1)),d+=1;s+=Tt(i.subarray(d,d+1)),d+=1,r=oe(i,12),n=oe(i,16),o=oe(i,20),l=oe(i,24),d=28}else if(e===1){d+=4,r=oe(i,d),d+=4;const c=oe(i,d);d+=4;const h=oe(i,d);for(d+=4,a=2**32*c+h,bS(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=oe(i,d),d+=4,l=oe(i,d),d+=4;Tt(i.subarray(d,d+1))!=="\0";)t+=Tt(i.subarray(d,d+1)),d+=1;for(t+=Tt(i.subarray(d,d+1)),d+=1;Tt(i.subarray(d,d+1))!=="\0";)s+=Tt(i.subarray(d,d+1)),d+=1;s+=Tt(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 qS(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 YS(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&&t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),qS([112,115,115,104],new Uint8Array([s,0,0,0]),i,n,r,a,t||new Uint8Array)}const Kv=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),jn={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,rv
vendor: 4,744 bytes, line 22
2260:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Cf(i,e){const t=jn[e];return!!t&&!!t[i.slice(0,4)]}function Uc(i,e,t=!0){return!i.split(",").some(s=>!wf(s,e,t))}function wf(i,e,t=!0){var s;const r=er(t);return(s=r==null?void 0:r.isTypeSupported(lo(i,e)))!=null?s:!1}function lo(i,e){return`${e}/mp4;codecs=${i}`}function Dp(i){if(i){const e=i.substring(0,4);return jn.video[e]}return 2}function Md(i){const e=Kv();return i.split(",").reduce((t,s)=>{const n=e&&fu(s)?9:jn.video[s];return n?(n*2+t)/(t?3:2):(jn.audio[s]+t)/(t?2:1)},0)}const ju={};function jS(i,e=!0){if(ju[i])return ju[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(wf(t[r],"audio",e))return ju[i]=t[r],t[r];if(t[r]==="mp3"&&(s=er(e))!=null&&s.isTypeSupported("audio/mpeg"))return""}return i}const zS=/flac|opus|mp4a\.40\.34/i;function Pd(i,e=!0){return i.replace(zS,t=>jS(t.toLowerCase(),e))}function QS(i,e){const t=[];if(i){const s=i.split(",");for(let r=0;r<s.length;r++)Cf(s[r],"video")||t.push(s[r])}return e&&t.push(e),t.join(",")}function gl(i,e){if(i&&(i.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(i)!==-1)&&(Cp(i,"audio")||Cp(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 Cp(i,e){return Cf(i,e)&&wf(i,e)}function XS(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 ZS(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 wp(i){const e=er(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 Fc(i){return i.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Vv={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function Wv(i,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:i}}function JS(i,e,t,s,r,n){const a=i.videoCodec,o=i.audioCodec?i.audioGroups:null,l=n==null?void 0:n.audioCodec,d=n==null?void 0: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(p=>{h[p]=(h[p]||0)+m.channels[p]})}return h},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(h=>fu(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&&q(u)&&Object.keys(c).some(h=>parseInt(h)>u)}function qv(i,e,t,s={}){const r=i.videoCodec;if(!r&&!i.audioCodec||!t)return Promise.resolve(Vv);const n=[],a=e1(i),o=a.length,l=t1(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=>fu(c))&&Kv())return Promise.resolve(Wv(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),n))}return Promise.all(n.map(u=>{const c=s1(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 e1(i){var e;const t=(e=i.videoCodec)==null?void 0:e.split(","),s=Yv(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:lo(ZS(l),"video"),width:r,height:n,bitrate:s,framerate:a};return o!=="sdr"&&(d.transferFunction=o),d}):[]}function t1(i,e,t){var s;const r=(s=i.audioCodec)==null?void 0:s.split(","),n=Yv(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:lo(f,"audio"),bitrate:t?i1(f,n):n};h&&(m.channels=""+h),u.push(m)})}return u},a):a},[]):[]}function i1(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 Yv(i){return Math.ceil(Math.max(i.bitrate*.9,i.averageBitrate)/1e3)*1e3||1}function s1(i){let e="";const{audio:t,video:s}=i;
vendor: 4,837 bytes, line 22
22if(s){const r=Fc(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=Fc(t.contentType);e+=`${s?"_":""}${r}_c${t.channels}`}return e}const $c=["NONE","TYPE-0","TYPE-1",null];function r1(i){return $c.indexOf(i)>-1}const Od=["SDR","PQ","HLG"];function n1(i){return!!i&&Od.indexOf(i)>-1}var vl={No:"",Yes:"YES",v2:"v2"};function Mp(i){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=i,r=s<e/2;return e&&r?t?vl.v2:vl.Yes:vl.No}class Pp{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 uo{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 Op(this._audioGroups,e)}hasSubtitleGroup(e){return Op(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 Op(i,e){return!e||!i?!1:i.indexOf(e)!==-1}function a1(){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 o1(i,e){let t=!1,s=[];if(i&&(t=i!=="SDR",s=[i]),e){s=e.allowedVideoRanges||Od.slice(0);const r=s.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&a1(),t||(s=["SDR"])}return{preferHDR:t,allowedVideoRanges:s}}const l1=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}},qe=(i,e)=>JSON.stringify(i,l1(e));function d1(i,e,t,s,r){const n=Object.keys(i),a=s==null?void 0:s.channels,o=s==null?void 0:s.audioCodec,l=r==null?void 0:r.videoCodec,d=a&&parseInt(a)===2;let u=!1,c=!1,h=1/0,f=1/0,m=1/0,p=1/0,g=0,v=[];const{preferHDR:T,allowedVideoRanges:y}=o1(e,r);for(let A=n.length;A--;){const R=i[n[A]];u||(u=R.channels[2]>0),h=Math.min(h,R.minHeight),f=Math.min(f,R.minFramerate),m=Math.min(m,R.minBitrate),y.filter(k=>R.videoRanges[k]>0).length>0&&(c=!0)}h=q(h)?h:0,f=q(f)?f:0;const _=Math.max(1080,h),I=Math.max(30,f);m=q(m)?m:t,t=Math.max(m,t),c||(e=void 0);const x=n.length>1;return{codecSet:n.reduce((A,R)=>{const S=i[R];if(R===A)return A;if(v=c?y.filter(k=>S.videoRanges[k]>0):[],x){if(S.minBitrate>t)return _i(R,`min bitrate of ${S.minBitrate} > current estimate of ${t}`),A;if(!S.hasDefaultAudio)return _i(R,"no renditions with default or auto-select sound found"),A;if(o&&R.indexOf(o.substring(0,4))%5!==0)return _i(R,`audio codec preference "${o}" not found`),A;
vendor: 4,269 bytes, line 22
22if(a&&!d){if(!S.channels[a])return _i(R,`no renditions with ${a} channel sound found (channels options: ${Object.keys(S.channels)})`),A}else if((!o||d)&&u&&S.channels[2]===0)return _i(R,"no renditions with stereo sound found"),A;if(S.minHeight>_)return _i(R,`min resolution of ${S.minHeight} > maximum of ${_}`),A;if(S.minFramerate>I)return _i(R,`min framerate of ${S.minFramerate} > maximum of ${I}`),A;if(!v.some(k=>S.videoRanges[k]>0))return _i(R,`no variants with VIDEO-RANGE of ${qe(v)} found`),A;if(l&&R.indexOf(l.substring(0,4))%5!==0)return _i(R,`video codec preference "${l}" not found`),A;if(S.maxScore<g)return _i(R,`max score of ${S.maxScore} < selected max of ${g}`),A}return A&&(Md(R)>=Md(A)||S.fragmentError>i[A].fragmentError)?A:(p=S.minIndex,g=S.maxScore,R)},void 0),videoRanges:v,preferHDR:T,minFramerate:f,minBitrate:m,minIndex:p}}function _i(i,e){Le.log(`[abr] start candidates with "${i}" ignored because ${e}`)}function jv(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 u1(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 Np(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 Hi(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(Mr(i,r,t))return s}return-1}function Mr(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||c1(n,e.lang))&&(n===void 0||e.assocLang===a)&&(o===void 0||e.default===o)&&(l===void 0||e.forced===l)&&(!("characteristics"in i)||h1(i.characteristics||"",e.characteristics))&&(t===void 0||t(i,e))}function c1(i,e="--"){return i.length===e.length?i===e:i.startsWith(e)||e.startsWith(i)}function h1(i,e=""){const t=i.split(","),s=e.split(",");return t.length===s.length&&!t.some(r=>s.indexOf(r)===-1)}function ur(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 f1(i,e,t,s,r){const n=e[s],o=e.reduce((h,f,m)=>{const p=f.uri;return(h[p]||(h[p]=[])).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=Up(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(p=>!f||f.indexOf(p.groupId)!==-1);return Hi(i,m,r)>-1});return c>-1?c:Up(e,s,h=>{const f=h.audioGroups,m=t.filter(p=>!f||f.indexOf(p.groupId)!==-1);return Hi(i,m,r)>-1})}function Up(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 Nd(i,e){var t;return!!i&&i!==((t=e.loadLevelObj)==null?void 0:t.uri)}class m1 extends yi{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.co
vendor: 4,872 bytes, lines 22-32
22decTiers=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,p=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||m<=f){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const g=p>-1&&p!==m,v=!!t||g;if(!v&&(l.paused||!l.playbackRate||!l.readyState))return;const T=a.mainForwardBufferInfo;if(!v&&T===null)return;const y=this.bwEstimator.getEstimateTTFB(),_=Math.abs(l.playbackRate);if(h<=Math.max(y,1e3*(c/(_*2))))return;const I=T?T.len/_:0,x=u.loading.first?u.loading.first-u.loading.start:-1,L=u.loaded&&x>-1,A=this.getBwEstimate(),R=a.levels,S=R[m],k=Math.max(u.loaded,Math.round(c*(r.bitrate||S.averageBitrate)/8));let O=L?h-x:h;O<1&&L&&(O=Math.min(h,u.loaded*8/A));const G=L?u.loaded*1e3/O:0,V=y/1e3,B=G?(k-u.loaded)/G:k*8/A+V;if(B<=I)return;const K=G?G*8:A,J=((s=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,F=this.hls.config.abrBandWidthUpFactor;let ie=Number.POSITIVE_INFINITY,ee;for(ee=m-1;ee>f;ee--){const ce=R[ee].maxBitrate,ve=!R[ee].details||J;if(ie=this.getTimeToLoadFrag(V,K,c*ce,ve),ie<Math.min(I,c+V))break}if(ie>=B||ie>c*10)return;L?this.bwEstimator.sample(h-Math.min(y,x),u.loaded):this.bwEstimator.sampleTTFB(h);const $=R[ee].maxBitrate;this.getBwEstimate()*F>$&&this.resetEstimator($);const H=this.findBestLevel($,f,ee,0,I,1,1);H>-1&&(ee=H),this.warn(`Fragment ${r.sn}${n?" part "+n.index:""} of level ${m} is loading too slowly;
23      Fragment duration: ${r.duration.toFixed(3)}
24      Time to underbuffer: ${I.toFixed(3)} s
25      Estimated load time for current fragment: ${B.toFixed(3)} s
26      Estimated load time for down switch fragment: ${ie.toFixed(3)} s
27      TTFB estimate: ${x|0} ms
28      Current BW estimate: ${q(A)?A|0:"Unknown"} bps
29      New BW estimate: ${this.getBwEstimate()|0} bps
30      Switching to level ${ee} @ ${$|0} bps`),a.nextLoadLevel=a.nextAutoLevel=ee,this.clearTimer();const de=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===ee&&ee>0){const ce=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${ee>0?"and switching down":""}
31      Fragment duration: ${r.duration.toFixed(3)} s
32      Time to underbuffer: ${ce.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,ee>f){let ve=this.findBestLevel(this.hls.levels[f].bitrate,f,ee,0,ce,1,1);ve===-1&&(ve=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=ve,this.resetEstimator(this.hls.levels[ve].bitrate)}}};g||B>ie*2?de():this.timer=self.setInterval(de,ie*1e3),a.trigger(E.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 AS(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(E.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;
vendor: 3,234 bytes, line 32
32if(!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 w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case w.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;q(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===X.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(E.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!==X.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()}
32_${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 g=this.findBestLevel(l,a,r,d,0,u,c);if(g>=0)return this.rebufferNotice=-1,g}let h=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay;if(!d){const g=this.bitrateTestDelay;g&&(h=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-g,this.info(`bitrate test took ${Math.round(1e3*g)}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],p=s.loadLevelObj;return p&&(m==null?void 0:m.bitrate)<p.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:p,loadLevel:g,config:v}=this.hls;if(m.length===1)return 0;const T=m[c],y=!!((l=this.hls.latestLevelDetails)!=null&&l.live),_=g===-1||u===-1;let I,x="SDR",L=(T==null?void 0:T.frameRate)||0;const{audioPreference:A,videoPreference:R}=v,S=this.audioTracksByGroup||(this.audioTracksByGroup=jv(p));let k=-1;if(_){if(this.firstSelection!==-1)return this.firstSelection;const J=this.codecTiers||(this.codecTiers=u1(m,S,t,s)),F=d1(J,x,e,A,R),{codecSet:ie,videoRanges:ee,minFramerate:$,minBitrate:H,minIndex:de,preferHDR:ce}=F;k=de,I=ie,x=ce?ee[ee.length-1]:ee[0],L=$,e=Math.max(e,H),this.log(`picked start tier ${qe(F)}`)}else I=T==null?void 0:T.codecSet,x=T==null?void 0:T.videoRange;const O=f?f.duration:h?h.duration:0,G=this.bwEstimator.getEstimateTTFB()/1e3,V=[];for(let J=s;J>=t;J--){var B,K;const F=m[J],ie=J>c;if(!F)continue;if(v.useMediaCapabilities&&!F.supportedResult&&!F.supportedPromise){const Ee=navigator.mediaCapabilities;typeof(Ee==null?void 0:Ee.decodingInfo)=="function"&&JS(F,S,x,L,e,A)?(F.supportedPromise=qv(F,S,Ee,this.supportedCache),F.supportedPromise.then(Fe=>{if(!this.hls)return;F.supportedResult=Fe;const St=this.hls.levels,dt=St.indexOf(F);Fe.error?this.warn(`MediaCapabilities decodingInfo error: "${Fe.error}" for level ${dt} ${qe(Fe)}`):Fe.supported?Fe.decodingInfoResults.some(It=>It.smooth===!1||It.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${dt} not smooth or powerEfficient: ${qe(Fe)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${dt} ${qe(Fe)}`),dt>-1&&St.length>1&&(this.log(`Removing unsupported level ${dt}`),this.hls.removeLevel(dt),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):F.supportedResult=Vv}if((I&&F.codecSet!==I||x&&F.videoRange!==x||ie&&L>F.frameRate||!ie&&L>0&&L<F.frameRate||(B=F.supportedResult)!=null&&(K=B.decodingInfoResults)!=null&&K.some(Ee=>Ee.smooth===!1))&&(!_||J!==k)){V.push(J);continue}const ee=F.details,$=(f?ee==null?void 0:ee.partTarget:ee==null?void 0:ee.averagetargetduration)||O;let H;ie?H=o*e:H=a*e;
vendor: 40,070 bytes, line 32
32const de=O&&r>=O*2&&n===0?F.averageBitrate:F.maxBitrate,ce=this.getTimeToLoadFrag(G,H,de*$,ee===void 0);if(H>=de&&(J===u||F.loadError===0&&F.fragmentError===0)&&(ce<=G||!q(ce)||y&&!this.bitrateTestDelay||ce<d)){const Ee=this.forcedAutoLevel;return J!==g&&(Ee===-1||Ee!==g)&&(V.length&&this.trace(`Skipped level(s) ${V.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${m[V[0]].codecs}" ${m[V[0]].videoRange}; not compatible with "${I}" ${x}`),this.info(`switch candidate:${c}->${J} adjustedbw(${Math.round(H)})-bitrate=${Math.round(H-de)} ttfb:${G.toFixed(1)} avgDuration:${$.toFixed(1)} maxFetchDuration:${d.toFixed(1)} fetchDuration:${ce.toFixed(1)} firstSelection:${_} codecSet:${F.codecSet} videoRange:${F.videoRange} hls.loadLevel:${g}`)),_&&(this.firstSelection=J),J}}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 zv={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 p1(i,e,t){if(e===null||!Array.isArray(i)||!i.length||!q(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(v1(e,t,a))return a}return null}function Br(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)&&Fp(t,s,n)===0||g1(n,i,Math.min(r,s))))return n;const a=zv.search(e,Fp.bind(null,t,s));return a&&(a!==i||!n)?a:n}function g1(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 Fp(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 v1(i,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>i}function Qv(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 zv.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 Ud(i){switch(i.details){case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_TIMEOUT:case w.LEVEL_LOAD_TIMEOUT:case w.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function $p(i,e){const t=Ud(e);return i.default[`${t?"timeout":"error"}Retry`]}function Mf(i,e){const t=i.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*i.retryDelayMs,i.maxRetryDelayMs)}function Bp(i){return Me(Me({},i),{errorRetry:null,timeoutRetry:null})}function Fd(i,e,t,s){if(!i)return!1;const r=s==null?void 0:s.code,n=e<i.maxNumRetry&&(E1(r)||!!t);return i.shouldRetry?i.shouldRetry(i,e,t,s,n):n}function E1(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}var kt={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},hi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2};class y1 extends yi{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.ERROR,this.onError,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.ERROR,this.onError,this),e.off(E.ERROR,this.onErrorOut,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===X.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var s;if(t.fatal)return;const r=this.hls,n=t.context;switch(t.details){case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case w.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction=co();return}case w.FRAG_GAP:case w.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=kt.SendAlternateToPenaltyBox;return}case w.LEVEL_EMPTY_ERROR:case w.LEVEL_PARSING_ERROR:{var a,o;const d=t.parent===X.MAIN?t.level:r.loadLevel;t.details===w.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(o=a.levelDetails)!=null&&o.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,d):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,d))}return;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:typeof(n==null?void 0:n.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level));return;case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.SUBTITLE_LOAD_ERROR:case w.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const d=r.loadLevelObj;if(d&&(n.type===ge.AUDIO_TRACK&&d.hasAudioGroup(n.groupId)||n.type===ge.SUBTITLE_TRACK&&d.hasSubtitleGroup(n.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=kt.SendAlternateToPenaltyBox,t.errorAction.flags=hi.MoveAllAlternatesMatchingHost;return}}return;case w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const d=r.loadLevelObj,u=d==null?void 0:d.attrs["HDCP-LEVEL"];u?t.errorAction={action:kt.SendAlternateToPenaltyBox,flags:hi.MoveAllAlternatesMatchingHDCP,hdcpLevel:u}:this.keySystemError(t)}return;case w.BUFFER_ADD_CODEC_ERROR:case w.REMUX_ALLOC_ERROR:case w.BUFFER_APPEND_ERROR:if(!t.errorAction){var l;t.errorAction=this.getLevelSwitchAction(t,(l=t.level)!=null?l:r.loadLevel)}return;case w.INTERNAL_EXCEPTION:case w.BUFFER_APPENDING_ERROR:case w.BUFFER_FULL_ERROR:case w.LEVEL_SWITCH_ERROR:case w.BUFFER_STALLED_ERROR:case w.BUFFER_SEEK_OVER_HOLE:case w.BUFFER_NUDGE_ON_STALL:t.errorAction=co();return}t.type===te.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,r=$p(s.config.playlistLoadPolicy,e),n=this.playlistError++;if(Fd(r,n,Ud(e),e.response))return{action:kt.RetryRequest,flags:hi.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=$p(e.details.startsWith("key")?a:n,e),l=t.levels.reduce((u,c)=>u+c.fragmentError,0);if(r&&(e.details!==w.FRAG_GAP&&r.fragmentError++,Fd(o,l,Ud(e),e.response)))return{action:kt.RetryRequest,flags:hi.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===w.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 p=(n=e.frag)==null?void 0:n.type,v=(p===X.AUDIO&&d===w.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(d===w.BUFFER_ADD_CODEC_ERROR||d===w.BUFFER_APPEND_ERROR))&&c.some(({audioCodec:x})=>r.audioCodec!==x),y=e.sourceBufferName==="video"&&(d===w.BUFFER_ADD_CODEC_ERROR||d===w.BUFFER_APPEND_ERROR)&&c.some(({codecSet:x,audioCodec:L})=>r.codecSet!==x&&r.audioCodec===L),{type:_,groupId:I}=(a=e.context)!=null?a:{};for(let x=c.length;x--;){const L=(x+h)%c.length;if(L!==h&&L>=f&&L<=m&&c[L].loadError===0){var o,l;const A=c[L];if(d===w.FRAG_GAP&&p===X.MAIN&&e.frag){const R=c[L].details;if(R){const S=Br(e.frag,R.fragments,e.frag.start);if(S!=null&&S.gap)continue}}else{if(_===ge.AUDIO_TRACK&&A.hasAudioGroup(I)||_===ge.SUBTITLE_TRACK&&A.hasSubtitleGroup(I))continue;if(p===X.AUDIO&&(o=r.audioGroups)!=null&&o.some(R=>A.hasAudioGroup(R))||p===X.SUBTITLE&&(l=r.subtitleGroups)!=null&&l.some(R=>A.hasSubtitleGroup(R))||v&&r.audioCodec===A.audioCodec||!v&&r.audioCodec!==A.audioCodec||y&&r.codecSet===A.codecSet)continue}u=L;break}}if(u>-1&&s.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:kt.SendAlternateToPenaltyBox,flags:hi.None,nextAutoLevel:u}}return{action:kt.SendAlternateToPenaltyBox,flags:hi.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case kt.DoNothing:break;case kt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==w.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,hdcpLevel:n,nextAutoLevel:a}=s;switch(r){case hi.None:this.switchLevel(e,a);break;case hi.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=$c[$c.indexOf(n)-1],s.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}s.resolved||this.switchLevel(e,a)}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===w.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const s=Fc(e.mimeType),r=this.hls.levels;for(let n=r.length;n--;)r[n][`${e.sourceBufferName}Codec`]===s&&this.hls.removeLevel(n)}}}function co(i){const e={action:kt.DoNothing,flags:hi.None};return i&&(e.resolved=!0),e}var ft={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class T1{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.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),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;const a=n.end;if(n.start<=e&&a!==null&&e<=a)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==null?void 0: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==null?void 0:r.fragment.sn)||-1;Object.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=jr(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?(n.buffered=!0,(n.body.endList=s.endList||n.body.endList)&&(this.endListFragments[n.body.type]=n),Ho(n)||this.removeParts(s.sn-1,s.type)):this.removeFragment(n.body)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=Hp(s,r=>r.fragment.sn>=e))}fragBuffered(e,t){const s=jr(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,r.buffered=!0)}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&&Ho(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||Ho(t))}getState(e){const t=jr(e),s=this.fragments[t];return s?s.buffered?Ho(s)?ft.PARTIAL:ft.OK:ft.APPENDING:ft.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=jr(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=jr(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==null?void 0: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=jr(e);e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const r=e.sn;this.activePartLists[e.type]=Hp(s,n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e,t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const s=(e=this.hls)==null||(t=e.latestLevelDetails)==null?void 0:t.partList;s&&s.forEach(r=>r.clearElementaryStreamInfo())}}function Ho(i){var e,t,s;return i.buffered&&(i.body.gap||((e=i.range.video)==null?void 0:e.partial)||((t=i.range.audio)==null?void 0:t.partial)||((s=i.range.audiovideo)==null?void 0:s.partial))}function jr(i){return`${i.type}_${i.level}_${i.sn}`}function Hp(i,e){return i.filter(t=>{const s=e(t);return s||t.clearElementaryStreamInfo(),s})}var tr={cbc:0,ctr:1};class b1{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 tr.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case tr.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 _1(i){const e=i.byteLength,t=e&&new DataView(i.buffer).getUint8(e-1);return t?i.slice(0,e-t):i}class A1{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,p=0,g=0;for(g=0;g<256;g++)g<128?f[g]=g<<1:f[g]=g<<1^283;for(g=0;g<256;g++){let v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^v&255^99,e[m]=v,t[v]=m;const T=f[m],y=f[T],_=f[y];let I=f[v]*257^v*16843008;r[m]=I<<24|I>>>8,n[m]=I<<16|I>>>16,a[m]=I<<8|I>>>24,o[m]=I,I=_*16843009^y*65537^T*257^m*16843008,d[v]=I<<24|I>>>8,u[v]=I<<16|I>>>16,c[v]=I<<8|I>>>24,h[v]=I,m?(m=T^f[f[f[_^T]]],p^=f[f[p]]):m=p=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],p=f[1],g=f[2],v=f[3];let T,y;for(o=0;o<a;o++){if(o<n){T=d[o]=t[o];continue}y=T,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]=T=(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]]^p[c[y>>>16&255]]^g[c[y>>>8&255]]^v[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],p=h[2],g=h[3];const v=new Int32Array(e),T=new Int32Array(v.length);let y,_,I,x,L,A,R,S,k,O,G,V,B,K;const J=this.networkToHostOrderSwap;for(;t<v.length;){for(k=J(v[t]),O=J(v[t+1]),G=J(v[t+2]),V=J(v[t+3]),L=k^n[0],A=V^n[1],R=G^n[2],S=O^n[3],B=4,K=1;K<r;K++)y=l[L>>>24]^d[A>>16&255]^u[R>>8&255]^c[S&255]^n[B],_=l[A>>>24]^d[R>>16&255]^u[S>>8&255]^c[L&255]^n[B+1],I=l[R>>>24]^d[S>>16&255]^u[L>>8&255]^c[A&255]^n[B+2],x=l[S>>>24]^d[L>>16&255]^u[A>>8&255]^c[R&255]^n[B+3],L=y,A=_,R=I,S=x,B=B+4;y=a[L>>>24]<<24^a[A>>16&255]<<16^a[R>>8&255]<<8^a[S&255]^n[B],_=a[A>>>24]<<24^a[R>>16&255]<<16^a[S>>8&255]<<8^a[L&255]^n[B+1],I=a[R>>>24]<<24^a[S>>16&255]<<16^a[L>>8&255]<<8^a[A&255]^n[B+2],x=a[S>>>24]<<24^a[L>>16&255]<<16^a[A>>8&255]<<8^a[R&255]^n[B+3],T[t]=J(y^f),T[t+1]=J(x^m),T[t+2]=J(I^p),T[t+3]=J(_^g),f=k,m=O,p=G,g=V,t=t+4}return T.buffer}}class S1{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=I1(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function I1(i){switch(i){case tr.cbc:return"AES-CBC";case tr.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${i}`)}}const L1=16;class Pf{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?_1(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!==tr.cbc||t.byteLength!==16)return Le.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=si(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 A1),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 S1(this.subtle,t,r)}return this.fastAesKey.expandKey().then(n=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new b1(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%L1;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 Gp=Math.pow(2,17);class R1{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 ns({type:te.NETWORK_ERROR,details:w.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(Vp(e));return}else e.gap=!1;const d=this.loader=n?new n(r):new a(r),u=Kp(e);e.loader=d;const c=Bp(r.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Gp};e.stats=d.stats;const f={onSuccess:(m,p,g,v)=>{this.resetLoader(e,d);let T=m.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(T.slice(0,16)),T=T.slice(16)),o({frag:e,part:null,payload:T,networkDetails:v})},onError:(m,p,g,v)=>{this.resetLoader(e,d),l(new ns({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Me({url:s,data:void 0},m),error:new Error(`HTTP Error ${m.code} ${m.text}`),networkDetails:g,stats:v}))},onAbort:(m,p,g)=>{this.resetLoader(e,d),l(new ns({type:te.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:m}))},onTimeout:(m,p,g)=>{this.resetLoader(e,d),l(new ns({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:m}))}};t&&(f.onProgress=(m,p,g,v)=>t({frag:e,part:null,payload:g,networkDetails:v})),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(Vp(e,t));return}const d=this.loader=n?new n(r):new a(r),u=Kp(e,t);e.loader=d;const c=Bp(r.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Gp};t.stats=d.stats,d.load(u,h,{onSuccess:(f,m,p,g)=>{this.resetLoader(e,d),this.updateStatsFromPart(e,t);const v={frag:e,part:t,payload:f.data,networkDetails:g};s(v),o(v)},onError:(f,m,p,g)=>{this.resetLoader(e,d),l(new ns({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Me({url:u.url,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:p,stats:g}))},onAbort:(f,m,p)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,d),l(new ns({type:te.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:p,stats:f}))},onTimeout:(f,m,p)=>{this.resetLoader(e,d),l(new ns({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:p,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 Kp(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(q(r)&&q(n)){var a;let o=r,l=n;if(i.sn==="initSegment"&&x1((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 Vp(i,e){const t=new Error(`GAP ${i.gap?"tag":"attribute"} found`),s={type:te.MEDIA_ERROR,details:w.FRAG_GAP,fatal:!1,frag:i,error:t,networkDetails:null};return e&&(s.part=e),(e||i).stats.aborted=!0,new ns(s)}function x1(i){return i==="AES-128"||i==="AES-256"}class ns extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Xv extends yi{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 Of{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=Go(),this.buffering={audio:Go(),video:Go(),audiovideo:Go()},this.level=e,this.sn=t,this.id=s,this.size=r,this.part=n,this.partial=a}}function Go(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Wp={length:0,start:()=>0,end:()=>0};class le{static isBuffered(e,t){if(e){const s=le.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=le.getBuffered(e);return le.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=le.bufferedRanges(e);if(r.length)return le.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||Wp}catch(t){return Le.log("failed to get media.buffered",t),Wp}}}const Zv=/\{\$([a-zA-Z0-9-_]+)\}/g;function qp(i){return Zv.test(i)}function Bc(i,e){if(i.variableList!==null||i.hasVariableRefs){const t=i.variableList;return e.replace(Zv,s=>{const r=s.substring(2,s.length-1),n=t==null?void 0: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 Yp(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 k1(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 D1=/^(\d+)x(\d+)$/,jp=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ze{constructor(e,t){typeof e=="string"&&(e=ze.parseAttrList(e,t)),we(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=D1.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={},n='"';for(jp.lastIndex=0;(s=jp.exec(e))!==null;){const a=s[1].trim();let o=s[2];const l=o.indexOf(n)===0&&o.lastIndexOf(n)===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 C1="com.apple.hls.interstitial";function w1(i){return i!=="ID"&&i!=="CLASS"&&i!=="CUE"&&i!=="START-DATE"&&i!=="DURATION"&&i!=="END-DATE"&&i!=="END-ON-NEXT"}function M1(i){return i==="SCTE35-OUT"||i==="SCTE35-IN"||i==="SCTE35-CMD"}class Jv{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==null?void 0:t.tagAnchor)||null,this.tagOrder=(r=t==null?void 0: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=we(new ze({}),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==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);q(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(q(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===C1}get isValid(){return!!this.id&&!this._badValueForSameId&&q(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 P1=10;class O1{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.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.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}get hasProgramDateTime(){return this.fragments.length?q(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||P1}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(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){var e;return(e=this.fragments)!=null&&e.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 Cn(i){return i==="AES-128"||i==="AES-256"||i==="AES-256-CTR"}function Nf(i){switch(i){case"AES-128":case"AES-256":return tr.cbc;case"AES-256-CTR":return tr.ctr;default:throw new Error(`invalid full segment method ${i}`)}}function eE(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0))}function Hc(i){return Uint8Array.from(unescape(encodeURIComponent(i)),e=>e.charCodeAt(0))}function N1(i){const e=Hc(i).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function U1(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 F1(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=eE(a)):t=N1(a)}}return t}const $d=typeof self<"u"?self:void 0;var et={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Pt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Gc(i){switch(i){case Pt.FAIRPLAY:return et.FAIRPLAY;case Pt.PLAYREADY:return et.PLAYREADY;case Pt.WIDEVINE:return et.WIDEVINE;case Pt.CLEARKEY:return et.CLEARKEY}}function zp(i){switch(i){case et.FAIRPLAY:return Pt.FAIRPLAY;case et.PLAYREADY:return Pt.PLAYREADY;case et.WIDEVINE:return Pt.WIDEVINE;case et.CLEARKEY:return Pt.CLEARKEY}}function El(i){const{drmSystems:e,widevineLicenseUrl:t}=i,s=e?[et.FAIRPLAY,et.WIDEVINE,et.PLAYREADY,et.CLEARKEY].filter(r=>!!e[r]):[];return!s[et.WIDEVINE]&&t&&s.push(et.WIDEVINE),s}const tE=function(i){return $d!=null&&(i=$d.navigator)!=null&&i.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function $1(i,e,t,s){let r;switch(i){case et.FAIRPLAY:r=["cenc","sinf"];break;case et.WIDEVINE:case et.PLAYREADY:r=["cenc"];break;case et.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${i}`)}return B1(r,e,t,s)}function B1(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}
32`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs=${n}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function H1(i){var e;return i.sessionType==="persistent-license"||!!((e=i.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function G1(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=eE(o).subarray(0,16);return U1(l),l}}return null}let Ko={};class mu{static clearKeyUriToKeyIdMap(){Ko={}}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(Ov(a)))}matches(e){var t,s;return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&e.keyFormatVersions.join(",")===this.keyFormatVersions.join(",")&&((t=e.iv)==null?void 0:t.join(","))===((s=this.iv)==null?void 0:s.join(","))}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 Pt.FAIRPLAY:case Pt.WIDEVINE:case Pt.PLAYREADY:case Pt.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(Cn(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(Le.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const s=K1(e);return new mu(this.method,this.uri,"identity",this.keyFormatVersions,s)}if(this.pssh&&this.keyId)return this;const t=F1(this.uri);if(t)switch(this.keyFormat){case Pt.WIDEVINE:if(this.pssh=t,!this.keyId&&t.length>=22){const s=t.length-22;this.keyId=t.subarray(s,s+16)}break;case Pt.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=YS(s,null,t),this.keyId=G1(t);break}default:{let s=t.subarray(0,16);if(s.length!==16){const r=new Uint8Array(16);r.set(s,16-s.length),s=r}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s=Ko[this.uri];if(!s){const r=Object.keys(Ko).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,r),Ko[this.uri]=s}this.keyId=s}return this}}function K1(i){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=i>>8*(15-t)&255;return e}const Qp=/#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,Xp=/#EXT-X-MEDIA:(.*)/g,V1=/^#EXT(?:INF|-X-TARGETDURATION):/m,zu=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),W1=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 Gi{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 xf.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return V1.test(e)}static parseMasterPlaylist(e,t){const s=qp(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},n=[];Qp.lastIndex=0;let a;for(;(a=Qp.exec(e))!=null;)if(a[1]){var o;const d=new ze(a[1],r),u=Bc(r,a[2]),c={attrs:d,bitrate:d.decimalInteger("BANDWIDTH")||d.decimalInteger("AVERAGE-BANDWIDTH"),name:d.NAME,url:Gi.resolve(u,t)},h=d.decimalResolution("RESOLUTION");h&&(c.width=h.width,c.height=h.height),eg(d.CODECS,c);const f=d["SUPPLEMENTAL-CODECS"];f&&(c.supplemental={},eg(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 ze(u,r),h=c["DATA-ID"];h&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[h]=c);break}case"SESSION-KEY":{const c=Zp(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 ze(u,r);Yp(r,c,t)}break}case"CONTENT-STEERING":{const c=new ze(u,r);r.contentSteering={uri:Gi.resolve(c["SERVER-URI"],t),pathwayId:c["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=Jp(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(Xp.lastIndex=0;(r=Xp.exec(e))!==null;){const d=new ze(r[1],s),u=d.TYPE;if(u){const c=o[u],h=n[u]||[];n[u]=h;
vendor: 7,791 bytes, line 32
32const f=d.LANGUAGE,m=d["ASSOC-LANGUAGE"],p=d.CHANNELS,g=d.CHARACTERISTICS,v=d["INSTREAM-ID"],T={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?Gi.resolve(d.URI,t):""};if(m&&(T.assocLang=m),p&&(T.channels=p),g&&(T.characteristics=g),v&&(T.instreamId=v),c!=null&&c.length){const y=Gi.findGroup(c,T.groupId)||c[0];tg(T,y,"audioCodec"),tg(T,y,"textCodec")}h.push(T)}}return n}static parseLevelPlaylist(e,t,s,r,n,a){var o;const l={url:t},d=new O1(t),u=d.fragments,c=[];let h=null,f=0,m=0,p=0,g=0,v=0,T=null,y=new qu(r,l),_,I,x,L=-1,A=!1,R=null,S;if(zu.lastIndex=0,d.m3u8=e,d.hasVariableRefs=qp(e),((o=zu.exec(e))==null?void 0:o[0])!=="#EXTM3U")return d.playlistParsingError=new Error("Missing format identifier #EXTM3U"),d;for(;(_=zu.exec(e))!==null;){A&&(A=!1,y=new qu(r,l),y.playlistOffset=p,y.start=p,y.sn=f,y.cc=g,v&&(y.bitrate=v),y.level=s,h&&(y.initSegment=h,h.rawProgramDateTime&&(y.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null),R&&(y.setByteRange(R),R=null)));const V=_[1];if(V){y.duration=parseFloat(V);const B=(" "+_[2]).slice(1);y.title=B||null,y.tagList.push(B?["INF",V,B]:["INF",V])}else if(_[3]){if(q(y.duration)){y.playlistOffset=p,y.start=p,x&&sg(y,x,d),y.sn=f,y.level=s,y.cc=g,u.push(y);const B=(" "+_[3]).slice(1);y.relurl=Bc(d,B),Kc(y,T,c),T=y,p+=y.duration,f++,m=0,A=!0}}else{if(_=_[0].match(W1),!_){Le.warn("No matches on slow regex match for level playlist!");continue}for(I=1;I<_.length&&_[I]===void 0;I++);const B=(" "+_[I]).slice(1),K=(" "+_[I+1]).slice(1),J=_[I+2]?(" "+_[I+2]).slice(1):null;switch(B){case"BYTERANGE":T?y.setByteRange(K,T):y.setByteRange(K);break;case"PROGRAM-DATE-TIME":y.rawProgramDateTime=K,y.tagList.push(["PROGRAM-DATE-TIME",K]),L===-1&&(L=u.length);break;case"PLAYLIST-TYPE":d.type&&Xi(d,B,_),d.type=K.toUpperCase();break;case"MEDIA-SEQUENCE":d.startSN!==0?Xi(d,B,_):u.length>0&&rg(d,B,_),f=d.startSN=parseInt(K);break;case"SKIP":{d.skippedSegments&&Xi(d,B,_);const F=new ze(K,d),ie=F.decimalInteger("SKIPPED-SEGMENTS");if(q(ie)){d.skippedSegments+=ie;for(let $=ie;$--;)u.push(null);f+=ie}const ee=F.enumeratedString("RECENTLY-REMOVED-DATERANGES");ee&&(d.recentlyRemovedDateranges=(d.recentlyRemovedDateranges||[]).concat(ee.split("	")));break}case"TARGETDURATION":d.targetduration!==0&&Xi(d,B,_),d.targetduration=Math.max(parseInt(K),1);break;case"VERSION":d.version!==null&&Xi(d,B,_),d.version=parseInt(K);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":d.live||Xi(d,B,_),d.live=!1;break;case"#":(K||J)&&y.tagList.push(J?[K,J]:[K]);break;case"DISCONTINUITY":g++,y.tagList.push(["DIS"]);break;case"GAP":y.gap=!0,y.tagList.push([B]);break;case"BITRATE":y.tagList.push([B,K]),v=parseInt(K)*1e3,q(v)?y.bitrate=v:v=0;break;case"DATERANGE":{const F=new ze(K,d),ie=new Jv(F,d.dateRanges[F.ID],d.dateRangeTagCount);d.dateRangeTagCount++,ie.isValid||d.skippedSegments?d.dateRanges[ie.id]=ie:Le.warn(`Ignoring invalid DATERANGE tag: "${K}"`),y.tagList.push(["EXT-X-DATERANGE",K]);break}case"DEFINE":{{const F=new ze(K,d);"IMPORT"in F?k1(d,F,a):Yp(d,F,t)}break}case"DISCONTINUITY-SEQUENCE":d.startCC!==0?Xi(d,B,_):u.length>0&&rg(d,B,_),d.startCC=g=parseInt(K);break;case"KEY":{const F=Zp(K,t,d);if(F.isSupported()){if(F.method==="NONE"){x=void 0;break}x||(x={});const ie=x[F.keyFormat];ie!=null&&ie.matches(F)||(ie&&(x=we({},x)),x[F.keyFormat]=F)}else Le.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${K}"`);break}case"START":d.startTimeOffset=Jp(K);break;case"MAP":{const F=new ze(K,d);if(y.duration){const ie=new qu(r,l);ig(ie,F,s,x),h=ie,y.initSegment=h,h.rawProgramDateTime&&!y.rawProgramDateTime&&(y.rawProgramDateTime=h.rawProgramDateTime)}else{const ie=y.byteRangeEndOffset;if(ie){const ee=y.byteRangeStartOffset;R=`${ie-ee}@${ee}`}else R=null;ig(y,F,s,x),h=y,A=!0}h.cc=g;break}case"SERVER-CONTROL":{S&&Xi(d,B,_),S=new ze(K),d.canBlockReload=S.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=S.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&S.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=S.optionalFloat("PART-HOLD-BACK",0),d.holdBack=S.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{d.partTarget&&Xi(d,B,_);const F=new ze(K);d.partTarget=F.decimalFloatingPoint("PART-TARGET");break}case"PART":{let F=d.partList;F||(F=d.partList=[]);const ie=m>0?F[F.length-1]:void 0,ee=m++,$=new ze(K,d),H=new MS($,y,l,ee,ie);F.push(H),y.duration+=H.duration;break}case"PRELOAD-HINT":{const F=new ze(K,d);d.preloadHint=F;break}case"RENDITION-REPORT":{const F=new ze(K,d);d.renditionReports=d.renditionReports||[],d.renditionReports.push(F);break}default:Le.warn(`line parsed but not handled: ${_}`);break}}}T&&!T.relurl?(u.pop(),p-=T.duration,d.partList&&(d.fragmentHint=T)):d.partList&&(Kc(y,T,c),y.cc=g,d.fragmentHint=y,x&&sg(y,x,d)),d.targetduration||(d.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const k=u.length,O=u[0],G=u[k-1];if(p+=d.skippedSegments*d.targetduration,p>0&&k&&G){d.averagetargetduration=p/k;const V=G.sn;d.endSN=V!=="initSegment"?V:0,d.live||(G.endList=!0),O&&d.startCC===void 0&&(d.startCC=O.cc),L>0&&(Y1(u,L),O&&c.unshift(O))}else d.endSN=0,d.startCC=0;return d.fragmentHint&&(p+=d.fragmentHint.duration),d.totalduration=p,c.length&&d.dateRangeTagCount&&O&&iE(c,d),d.endCC=g,d}}function iE(i,e){const t=i.length;if(!t)return;const s=i[t-1],r=e.live?1/0:e.totalduration,n=Object.keys(e.dateRanges);for(let a=n.length;a--;){const o=e.dateRanges[n[a]],l=o.startDate.getTime();o.tagAnchor=s.ref;for(let d=t;d--;){const u=q1(e,l,i,d,r);if(u!==-1){o.tagAnchor=e.fragments[u].ref;break}}}}function q1(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,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 Zp(i,e,t){var s,r;const n=new ze(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?Gi.resolve(o,e):"",h=(d||"1").split("/").map(Number).filter(Number.isFinite);return new mu(a,c,u,h,l,n.KEYID)}function Jp(i){const t=new ze(i).decimalFloatingPoint("TIME-OFFSET");return q(t)?t:null}function eg(i,e){let t=(i||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const r=t.filter(n=>Cf(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 tg(i,e,t){const s=e[t];s&&(i[t]=s)}function Y1(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 Kc(i,e,t){i.rawProgramDateTime?t.push(i):e!=null&&e.programDateTime&&(i.programDateTime=e.endProgramDateTime)}function ig(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 sg(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 Xi(i,e,t){i.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function rg(i,e,t){i.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Qu(i,e){const t=e.startPTS;if(q(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))}
vendor: 1,860 bytes, line 32
32function sE(i,e,t,s,r,n){s-t<=0&&(Le.warn("Fragment should have a positive duration",e),s=t+e.duration,n=r+e.duration);let o=t,l=s;const d=e.startPTS,u=e.endPTS;if(q(d)){const g=Math.abs(d-t);q(e.deltaPTS)?e.deltaPTS=Math.max(g,e.deltaPTS):e.deltaPTS=g,o=Math.max(t,d),t=Math.min(t,d),r=Math.min(r,e.startDTS),l=Math.min(s,u),s=Math.max(s,u),n=Math.max(n,e.endDTS)}const c=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(s-e.start),e.startPTS=t,e.maxStartPTS=o,e.startDTS=r,e.endPTS=s,e.minEndPTS=l,e.endDTS=n;const h=e.sn;if(!i||h<i.startSN||h>i.endSN)return 0;let f;const m=h-i.startSN,p=i.fragments;for(p[m]=e,f=m;f>0;f--)Qu(p[f],p[f-1]);for(f=m;f<p.length-1;f++)Qu(p[f],p[f+1]);return i.fragmentHint&&Qu(p[p.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,c}function j1(i,e){if(i===e)return;let t=null;const s=i.fragments;for(let d=s.length-1;d>=0;d--){const u=s[d].initSegment;if(u){t=u;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;let r;X1(i,e,(d,u,c,h)=>{if((!e.startCC||e.skippedSegments)&&u.cc!==d.cc){const f=d.cc-u.cc;for(let m=c;m<h.length;m++)h[m].cc+=f;e.endCC=h[h.length-1].cc}q(d.startPTS)&&q(d.endPTS)&&(u.setStart(u.startPTS=d.startPTS),u.startDTS=d.startDTS,u.maxStartPTS=d.maxStartPTS,u.endPTS=d.endPTS,u.endDTS=d.endDTS,u.minEndPTS=d.minEndPTS,u.setDuration(d.endPTS-d.startPTS),u.duration&&(r=u),e.PTSKnown=e.alignedSliding=!0),d.hasStreams&&(u.elementaryStreams=d.elementaryStreams),u.loader=d.loader,d.hasStats&&(u.stats=d.stats),d.initSegment&&(u.initSegment=d.initSegment,t=d.initSegment)});const n=e.fragments,a=e.fragmentHint?n.concat(e.fragmentHint):n;if(t&&a.forEach(d=>{var u;d&&(!d.initSegment||d.initSegment.relurl===((u=t)==null?void 0:u.relurl))&&(d.initSegment=t)}),e.skippedSegments){if(e.deltaUpdateFailed=n.some(d=>!d),e.deltaUpdateFailed){Le.warn("[level-helper] Previous playlist missing segments ski
32pped in delta playlist");for(let d=e.skippedSegments;d--;)n.shift();e.startSN=n[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=z1(i.dateRanges,e));const d=i.fragments.filter(u=>u.rawProgramDateTime);if(i.hasProgramDateTime&&!e.hasProgramDateTime)for(let u=1;u<a.length;u++)a[u].programDateTime===null&&Kc(a[u],a[u-1],d);iE(d,e)}e.endCC=n[n.length-1].cc}if(!e.startCC){var o;const d=aE(i,e.startSN-1);e.startCC=(o=d==null?void 0:d.cc)!=null?o:n[0].cc}Q1(i.partList,e.partList,(d,u)=>{u.elementaryStreams=d.elementaryStreams,u.stats=d.stats}),r?sE(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):rE(i,e),n.length&&(e.totalduration=e.edge-n[0].start),e.driftStartTime=i.driftStartTime,e.driftStart=i.driftStart;const l=e.advancedDateTime;if(e.advanced&&l){const d=e.edge;e.driftStart||(e.driftStartTime=l,e.driftStart=d),e.driftEndTime=l,e.driftEnd=d}else e.driftEndTime=i.driftEndTime,e.driftEnd=i.driftEnd,e.advancedDateTime=i.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=i.requestScheduled)}function z1(i,e){const{dateRanges:t,recentlyRemovedDateranges:s}=e,r=we({},i);s&&s.forEach(o=>{delete r[o]});const a=Object.keys(r).length;return a&&Object.keys(t).forEach(o=>{const l=r[o],d=new Jv(t[o].attr,l);d.isValid?(r[o]=d,l||(d.tagOrder+=a)):Le.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${qe(t[o].attr)}"`)}),r}function Q1(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 X1(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){if(t(u,c,d,o),u.url&&u.url!==c.url){e.playlistParsingError=ng(`media sequence mismatch ${c.sn}:`,i,e,u,c);return}else if(u.cc!==c.cc){e.playlistParsingError=ng(`discontinuity sequence mismatch (${u.cc}!=${c.cc})`,i,e,u,c);return}}}}function ng(i,e,t,s,r){return new Error(`${i} ${r.url}
33Playlist starting @${e.startSN}
34${e.m3u8}
35
36Playlist starting @${t.startSN}
37${t.m3u8}`)}function rE(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;Vc(e,a)}function Vc(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 nE(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 aE(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 ag(i,e,t){return i?oE(i.partList,e,t):null}function oE(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 lE(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 za(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 Z1(i,e){return!!(i&&e.startCC<i.endCC&&e.endCC>i.startCC)}function og(i,e){if(i){const t=i.start+e;i.start=i.startPTS=t,i.endPTS=t+i.duration}}function dE(i,e){const t=e.fragments;for(let s=0,r=t.length;s<r;s++)og(t[s],i);e.fragmentHint&&og(e.fragmentHint,i),e.alignedSliding=!0}function J1(i,e){i&&(uE(e,i),!e.alignedSliding&&i&&Bd(e,i),!e.alignedSliding&&i&&!e.skippedSegments&&rE(i,e,!1))}function uE(i,e){if(!Z1(e,i))return;const t=Math.min(e.endCC,i.endCC),s=za(e.fragments,t),r=za(i.fragments,t);if(!s||!r)return;Le.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const n=s.start-r.start;dE(n,i)}function Bd(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=za(s,a),n=za(t,a)),(!r||!n)&&(r=s[Math.floor(s.length/2)],n=za(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);dE(d,i)}const eI={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}},N={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 Uf extends Xv{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=N.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=le.bufferInfo(d||l,c,a.maxBufferHole),f=!h.len;if(this.log(`Media seeking to ${q(c)?c.toFixed(3):c}, state: ${u}, ${f?"out of":"in"} buffer`),this.state===N.ENDED)this.resetLoadingState();else if(o){const m=a.maxFragLookUpTolerance,p=o.start-m,g=o.start+o.duration+m;if(f||g<h.start||p>h.end){const v=c>g;(c<p||v)&&(v&&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 p=Math.max(h.end,c),g=this.shouldLoadParts(this.getLevelDetails(),p);g&&(this.log(`LL-Part loading ON after seeking to ${c.toFixed(2)} with buffer @${p.toFixed(2)}`),this.loadingParts=g)}}this.hls.hasEnoughToStart||(this.log(`Setting ${f?"startPosition":"nextLoadPosition"} to ${c} for seek without enough to start`),this.nextLoadPosition=c,f&&(this.startPosition=c)),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 R1(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Pf(e.config)}registerListeners(){const{hls:e}=this;
vendor: 26,394 bytes, line 37
37e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===N.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=N.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=le.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 le.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){var e;return(e=this.levelLastLoaded)==null?void 0:e.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;s.removeEventListener("seeking",this.onMediaSeeking),s.removeEventListener("ended",this.onMediaEnded),s.addEventListener("seeking",this.onMediaSeeking),s.addEventListener("ended",this.onMediaEnded);const r=this.config;this.levels&&r.autoStartLoad&&this.state===N.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),r.removeEventListener("seeking",this.onMediaSeeking),r.removeEventListener("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=N.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===N.FRAG_LOADING||!this.fragCurrent&&a===N.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=N.IDLE);return}"payload"in n&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===N.STOPPED||this.state===N.ERROR||(this.warn(`Frag error: ${(n==null?void 0:n.message)||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===ft.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)===ft.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==null?void 0: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(E.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{const r=s==null?void 0: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();return this.decrypter.decrypt(new Uint8Array(a),o.key.buffer,o.iv.buffer,Nf(o.method)).catch(d=>{throw r.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:n}),d}).then(d=>{const u=self.performance.now();return r.trigger(E.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===N.STOPPED||this.state===N.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!==N.STOPPED&&(this.state=N.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()}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?eI.toString(le.getBuffered(s)):"(detached)"})`),ot(e)){var r;if(e.type!==X.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=N.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=N.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 Of(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==null?void 0:t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=N.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(E.KEY_LOADED,c),this.state===N.KEY_LOADING&&(this.state=N.IDLE),c}),this.hls.trigger(E.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):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(ot(e)&&(!l||e.sn!==l.sn)){const c=this.shouldLoadParts(t.details,e.end);c!==this.loadingParts&&(this.log(`LL-Part loading ${c?"ON":"OFF"} loading sn ${l==null?void 0:l.sn}->${e.sn}`),this.loadingParts=c)}if(s=Math.max(e.start,s||0),this.loadingParts&&ot(e)){const c=a.partList;if(c&&r){s>e.end&&a.fragmentHint&&(e=a.fragmentHint);const h=this.getNextPart(c,e,s);if(h>-1){const f=c[h];e=this.fragCurrent=f.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${f.index} (${h}/${c.length-1}) of ${this.fragInfo(e,!1,f)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=f.start+f.duration,this.state=N.FRAG_LOADING;let m;return o?m=o.then(p=>!p||this.fragContextChanged(p.frag)?null:this.doFragPartsLoad(e,f,t,r)).catch(p=>this.handleFragLoadError(p)):m=this.doFragPartsLoad(e,f,t,r).catch(p=>this.handleFragLoadError(p)),this.hls.trigger(E.FRAG_LOADING,{frag:e,part:f,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):m}else if(!e.url||this.loadedEndOfParts(c,s))return Promise.resolve(null)}}if(ot(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)}`),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?"["+a.startSN+"-"+a.endSN+"]":""}, target: ${parseFloat(s.toFixed(3))}`),q(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=N.FRAG_LOADING;const d=this.config.progressive;let u;return d&&o?u=o.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,r)).catch(c=>this.handleFragLoadError(c)):u=Promise.all([this.fragmentLoader.load(e,d?r:void 0),o]).then(([c])=>(!d&&c&&r&&r(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):u}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(E.FRAG_LOADED,h);const m=ag(s.details,e.sn,c.index+1)||oE(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;e.data&&t.details===w.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==N.PARSING){!this.fragCurrent&&this.state!==N.STOPPED&&this.state!==N.ERROR&&(this.state=N.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!=null&&e.partList){var s;const n=e.partList[0],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?ag(l,n,a):null,u=d?d.fragment:aE(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){var a;if(!e||this.state!==N.PARSING)return;const{data1:o,data2:l}=e;let d=o;if(o&&l&&(d=si(o,l)),!((a=d)!=null&&a.length))return;const u=this.initPTS[t.cc],c=u?-u.baseTime/u.timescale:void 0,h={type:e.type,frag:t,part:s,chunkMeta:r,offset:c,parent:t.type,data:d};if(this.hls.trigger(E.BUFFER_APPENDING,h),e.dropped&&e.independent&&!s){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!le.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,r=le.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(!q(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=le.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 le.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=X.MAIN){var s;const r=(s=this.fragmentTracker)==null?void 0:s.getAppendedFrag(e,t);return r&&"fragment"in r?r.fragment:r}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===ft.OK||s===ft.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,r,n){let a=null;if(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(lg(this.hls.config)){var e,t;if((e=this.hls.interstitialsManager)==null||(t=e.playingItem)==null?void 0:t.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(lg(this.hls.config)&&e.type!==X.SUBTITLE){const s=this.hls.interstitialsManager,r=s==null?void 0: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==null?void 0:t.live)===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}const n=s==null?void 0: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!=null&&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&&(r=o),n=u}return r}loadedEndOfParts(e,t){const s=e[e.length-1];return s&&t>s.start&&s.loaded}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=p1(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=Qv(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&&l&&!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 p=e<this.lastCurrentTime||e>t-d||(f=this.media)!=null&&f.paused||!this.startFragRequested?0:d;h=Br(n,a,e,p)}else h=a[a.length-1];if(h){const m=h.sn-s.startSN,p=this.fragmentTracker.getState(h);if((p===ft.OK||p===ft.PARTIAL&&h.gap)&&(n=h),n&&h.sn===n.sn&&(!c||u[0].fragment.sn>h.sn||!s.live&&!c)&&n&&h.level===n.level){const v=a[m+1];h.sn<o&&this.fragmentTracker.getState(v)!==ft.OK?h=v: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&&q(n);if(a||!o&&!n){J1(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&&q(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&&ot(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!==N.FRAG_LOADING_WAITING_RETRY)&&(this.state=N.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const m=this.getCurrentContext(t.chunkMeta);m&&(t.frag=m.frag)}const s=t.frag;if(!s||s.type!==e||!this.levels)return;if(this.fragContextChanged(s)){var r;this.warn(`Frag load error must match current frag to retry ${s.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===w.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(s,!0);const a=t.errorAction,{action:o,flags:l,retryCount:d=0,retryConfig:u}=a||{},c=!!a&&!!u,h=c&&o===kt.RetryRequest,f=c&&!a.resolved&&l===hi.MoveAllAlternatesMatchingHost;if(!h&&f&&ot(s)&&!s.endList)this.resetFragmentErrors(e),this.treatAsGap(s),a.resolved=!0;else if((h||f)&&d<u.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const m=Mf(u,d);this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${d+1}/${u.maxNumRetry} in ${m}ms`),a.resolved=!0,this.retryDate=self.performance.now()+m,this.state=N.FRAG_LOADING_WAITING_RETRY}else if(u&&a)if(this.resetFragmentErrors(e),d<u.maxNumRetry)!n&&o!==kt.RemoveAlternatePermanently&&(a.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${d})`);return}else o===kt.SendAlternateToPenaltyBox?this.state=N.WAITING_LEVEL:this.state=N.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===N.PARSING||this.state===N.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==null?void 0:t.duration)||10);const a=!n;return a&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${s} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===X.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==N.STOPPED&&(this.state=N.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const r=le.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,s),this.state===N.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==N.STOPPED&&(this.state=N.IDLE)}resetStartWhenNotLoaded(e){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const 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.warn(`The loading context changed while buffering fragment ${e.sn} of ${this.playlistLabel()} ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,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:sE(n,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS);return this.hls.trigger(E.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;if(s.fragmentError===0&&this.treatAsGap(e,s),((o=this.transmuxer)==null?void 0:o.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(l.message),this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=N.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(E.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===X.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.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function lg(i){return!!i.interstitialsController&&i.enableInterstitialPlayback!==!1}class cE{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=tI(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function tI(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 Xu={exports:{}},dg;function iI(){return dg||(dg=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: 8,337 bytes, line 37
37if(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 p=t?t+d:d;if(!this._events[p])return!1;var g=this._events[p],v=arguments.length,T,y;if(g.fn){switch(g.once&&this.removeListener(d,g.fn,void 0,!0),v){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,c),!0;case 4:return g.fn.call(g.context,u,c,h),!0;case 5:return g.fn.call(g.context,u,c,h,f),!0;case 6:return g.fn.call(g.context,u,c,h,f,m),!0}for(y=1,T=new Array(v-1);y<v;y++)T[y-1]=arguments[y];g.fn.apply(g.context,T)}else{var _=g.length,I;for(y=0;y<_;y++)switch(g[y].once&&this.removeListener(d,g[y].fn,void 0,!0),v){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,u);break;case 3:g[y].fn.call(g[y].context,u,c);break;case 4:g[y].fn.call(g[y].context,u,c,h);break;default:if(!T)for(I=1,T=new Array(v-1);I<v;I++)T[I-1]=arguments[I];g[y].fn.apply(g[y].context,T)}}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 p=0,g=[],v=m.length;p<v;p++)(m[p].fn!==u||h&&!m[p].once||c&&m[p].context!==c)&&g.push(m[p]);g.length?this._events[f]=g.length===1?g[0]:g: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}(Xu)),Xu.exports}var sI=iI(),Ff=CS(sI);const ho="1.6.7",zn={};function rI(){return typeof __HLS_WORKER_BUNDLE__=="function"}function nI(){const i=zn[ho];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 zn[ho]=r,r}function aI(i){const e=zn[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 zn[i]=r,r}function oI(i){const e=zn[i||ho];if(e&&e.clientCount--===1){const{worker:s,objectURL:r}=e;delete zn[i||ho],r&&self.URL.revokeObjectURL(r),s.terminate()}}function hE(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 $f(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 pu(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 fo(i,e){const t=e;let s=0;for(;$f(i,e);){s+=10;const r=pu(i,e+6);s+=r,hE(i,e+10)&&(s+=10),e+=s}if(s>0)return i.subarray(t,t+s)}function lI(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(E.ERROR,E.ERROR,{type:te.MEDIA_ERROR,details:w.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 fE(i,e){return i[e]===255&&(i[e+1]&246)===240}function mE(i,e){return i[e+1]&1?7:9}function Bf(i,e){return(i[e+3]&3)<<11|i[e+4]<<3|(i[e+5]&224)>>>5}function dI(i,e){return e+5<i.length}function Hd(i,e){return e+1<i.length&&fE(i,e)}function uI(i,e){return dI(i,e)&&fE(i,e)&&Bf(i,e)<=i.length-e}function cI(i,e){if(Hd(i,e)){const t=mE(i,e);if(e+t>=i.length)return!1;const s=Bf(i,e);if(s<=t)return!1;const r=e+s;return r===i.length||Hd(i,r)}return!1}function pE(i,e,t,s,r){if(!i.samplerate){const n=lI(e,t,s,r);if(!n)return;we(i,n)}}function gE(i){return 1024*9e4/i}function hI(i,e){const t=mE(i,e);if(e+t<=i.length){const s=Bf(i,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function vE(i,e,t,s,r){const n=gE(i.samplerate),a=s+r*n,o=hI(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 p={unit:l,pts:a};return m||i.samples.push(p),{sample:p,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 fI(i,e){return $f(i,e)&&pu(i,e+6)+10<=i.length-e}function mI(i){return i instanceof ArrayBuffer?i:i.byteOffset==0&&i.byteLength==i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer}function Zu(i,e=0,t=1/0){return pI(i,e,t,Uint8Array)}function pI(i,e,t,s){const r=gI(i);let n=1;"BYTES_PER_ELEMENT"in s&&(n=s.BYTES_PER_ELEMENT);const a=vI(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 gI(i){return i instanceof ArrayBuffer?i:i.buffer}function vI(i){return i&&i.buffer instanceof ArrayBuffer&&i.byteLength!==void 0&&i.byteOffset!==void 0}function EI(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=Vt(Zu(i.data,1,s)),n=i.data[2+s],a=i.data.subarray(3+s).indexOf(0);if(a===-1)return;const o=Vt(Zu(i.data,3+s,a));let l;return r==="-->"?l=Vt(Zu(i.data,4+s+a)):l=mI(i.data.subarray(4+s+a)),e.mimeType=r,e.pictureType=n,e.description=o,e.data=l,e}function yI(i){if(i.size<2)return;const e=Vt(i.data,!0),t=new Uint8Array(i.data.subarray(e.length+1));return{key:i.type,info:e,data:t.buffer}}function TI(i){if(i.size<2)return;if(i.type==="TXXX"){let t=1;const s=Vt(i.data.subarray(t),!0);t+=s.length+1;const r=Vt(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=Vt(i.data.subarray(1));return{key:i.type,info:"",data:e}}function bI(i){if(i.type==="WXXX"){if(i.size<2)return;let t=1;const s=Vt(i.data.subarray(t),!0);t+=s.length+1;const r=Vt(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=Vt(i.data);return{key:i.type,info:"",data:e}}function _I(i){return i.type==="PRIV"?yI(i):i.type[0]==="W"?bI(i):i.type==="APIC"?EI(i):TI(i)}function AI(i){const e=String.fromCharCode(i[0],i[1],i[2],i[3]),t=pu(i,4),s=10;return{type:e,size:t,data:i.subarray(s,s+t)}}const Vo=10,SI=10;function EE(i){let e=0;const t=[];for(;$f(i,e);){const s=pu(i,e+6);i[e+5]>>6&1&&(e+=Vo),e+=Vo;const r=e+s;for(;e+SI<r;){const n=AI(i.subarray(e)),a=_I(n);a&&t.push(a),e+=n.size+Vo}hE(i,e)&&(e+=Vo)}return t}function yE(i){return i&&i.key==="PRIV"&&i.info==="com.apple.streaming.transportStreamTimestamp"}function II(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 Hf(i){const e=EE(i);for(let t=0;t<e.length;t++){const s=e[t];if(yE(s))return II(s)}}let Kt=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 Ui(i="",e=9e4){return{type:i,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Gf{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=si(this.cachedData,e),this.cachedData=null);
vendor: 25,833 bytes, line 37
37let s=fo(e,0),r=s?s.length:0,n;const a=this._audioTrack,o=this._id3Track,l=s?Hf(s):void 0,d=e.length;for((this.basePTS===null||this.frameIndex===0&&q(l))&&(this.basePTS=LI(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:Kt.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 fI(e,r)?(s=fo(e,r),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Kt.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=si(this.cachedData,u):this.cachedData=u}}return{audioTrack:a,videoTrack:Ui(),id3Track:o,textTrack:Ui()}}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:Ui(),id3Track:this._id3Track,textTrack:Ui()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const LI=(i,e,t)=>{if(q(i))return i*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};let Wo=null;const RI=[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],xI=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],kI=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],DI=[0,1,1,4];function TE(i,e,t,s,r){if(t+24>e.length)return;const n=bE(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 bE(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=RI[l*14+r-1]*1e3,c=xI[(t===3?0:t===2?1:2)*3+n],h=o===3?1:2,f=kI[t][s],m=DI[s],p=f*8*m,g=Math.floor(f*d/c+a)*m;if(Wo===null){const y=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Wo=y?parseInt(y[1]):0}return!!Wo&&Wo<=87&&s===2&&d>=224e3&&o===0&&(i[e+3]=i[e+3]|128),{sampleRate:c,channelCount:h,frameLength:g,samplesPerFrame:p}}}function Kf(i,e){return i[e]===255&&(i[e+1]&224)===224&&(i[e+1]&6)!==0}function _E(i,e){return e+1<i.length&&Kf(i,e)}function CI(i,e){return Kf(i,e)&&4<=i.length-e}function AE(i,e){if(e+1<i.length&&Kf(i,e)){const s=bE(i,e);let r=4;s!=null&&s.frameLength&&(r=s.frameLength);const n=e+r;return n===i.length||_E(i,n)}return!1}class wI extends Gf{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=fo(e,0);let r=(s==null?void 0:s.length)||0;if(AE(e,r))return!1;for(let n=e.length;r<n;r++)if(cI(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return uI(e,t)}appendFrame(e,t,s){pE(e,this.observer,t,s,e.manifestCodec);const r=vE(e,t,s,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const SE=(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 MI extends Gf{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=IE(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=fo(e,0);if(!t)return!1;const s=t.length;return e[s]===11&&e[s+1]===119&&Hf(t)!==void 0&&SE(e,s)<16}}function IE(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,p=[2,1,2,3,3,4,4,5][c]+f,g=e[t+5]>>3,v=e[t+5]&7,T=new Uint8Array([n<<6|g<<1|v>>2,(v&3)<<6|c<<3|f<<2|l>>4,l<<4&224]),y=1536/o*9e4,_=s+r*y,I=e.subarray(t,t+u);return i.config=T,i.channelCount=p,i.samplerate=o,i.samples.push({unit:I,pts:_}),u}class PI extends Gf{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=fo(e,0);let s=(t==null?void 0:t.length)||0;if(t&&e[s]===11&&e[s+1]===119&&Hf(t)!==void 0&&SE(e,s)<=16)return!1;for(let r=e.length;s<r;s++)if(AE(e,s))return Le.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return CI(e,t)}appendFrame(e,t,s){if(this.basePTS!==null)return TE(e,t,s,this.basePTS,this.frameIndex)}}const OI=/\/emsg[-/]ID3/i;class NI{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=Ui("video",1),a=this.audioTrack=Ui("audio",1),o=this.txtTrack=Ui("text",1);if(this.id3Track=Ui("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=Hv(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=Fv.text,n.sampleDuration=0,n.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return NS(e)}demux(e,t){this.timeOffset=t;let s=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=si(this.remainderData,e));const o=KS(s);this.remainderData=o.remainder,r.samples=o.valid||new Uint8Array}else r.samples=s;const a=this.extractID3Track(r,t);return n.samples=kp(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=kp(e,t),{videoTrack:t,audioTrack:Ui(),id3Track:r,textTrack:Ui()}}extractID3Track(e,t){const s=this.id3Track;if(e.samples.length){const r=me(e.samples,["emsg"]);r&&r.forEach(n=>{const a=WS(n);if(OI.test(a.schemeIdUri)){const o=ug(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:Kt.emsg,duration:l})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=ug(a,t);s.samples.push({data:a.payload,len:a.payload.byteLength,dts:o,pts:o,type:Kt.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 ug(i,e){return q(i.presentationTime)?i.presentationTime/i.timeScale:e+i.presentationTimeDelta/i.timeScale}class UI{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new Pf(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,tr.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)})}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=Gv(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)})}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 LE{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=si(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=si(m.data,t))}return e.naluState=n,o}}class Qa{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 cg extends LE{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 p=!1;o=!0;const g=d.data;if(l&&g.length>4){const v=this.readSliceType(g);(v===2||v===4||v===7||v===9)&&(p=!0)}if(p){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=p;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,Df(d.data,1,s.pts,t.samples);break}case 7:{var f,m;o=!0,l=!0;const p=d.data,g=this.readSPS(p);if(!e.sps||e.width!==g.width||e.height!==g.height||((f=e.pixelRatio)==null?void 0:f[0])!==g.pixelRatio[0]||((m=e.pixelRatio)==null?void 0:m[1])!==g.pixelRatio[1]){e.width=g.width,e.height=g.height,e.pixelRatio=g.pixelRatio,e.sps=[p];const v=p.subarray(1,4);let T="avc1.";for(let y=0;y<3;y++){let _=v[y].toString(16);_.length<2&&(_="0"+_),T+=_}e.codec=T}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 Qa(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 Qa(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),p=t.skipEG.bind(t),g=t.skipUEG.bind(t),v=this.skipScalingList.bind(this);u();const T=u();if(c(5),m(3),u(),g(),T===100||T===110||T===122||T===244||T===44||T===83||T===86||T===118||T===128){const A=h();if(A===3&&m(1),g(),g(),m(1),f())for(l=A!==3?8:12,d=0;d<l;d++)f()&&(d<6?v(16,t):v(64,t))}g();const y=h();if(y===0)h();else if(y===1)for(m(1),p(),p(),o=h(),d=0;d<o;d++)p();g(),m(1);const _=h(),I=h(),x=c(1);x===0&&m(1),m(1),f()&&(s=h(),r=h(),n=h(),a=h());let L=[1,1];if(f()&&f())switch(u()){case 1:L=[1,1];break;case 2:L=[12,11];break;case 3:L=[10,11];break;case 4:L=[16,11];break;case 5:L=[40,33];break;case 6:L=[24,11];break;case 7:L=[20,11];break;case 8:L=[32,11];break;case 9:L=[80,33];break;case 10:L=[18,11];break;case 11:L=[15,11];break;case 12:L=[64,33];break;case 13:L=[160,99];break;case 14:L=[4,3];break;case 15:L=[3,2];break;case 16:L=[2,1];break;case 255:{L=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((_+1)*16-s*2-r*2),height:(2-x)*(I+1)*16-(x?2:4)*(n+a),pixelRatio:L}}}class hg extends LE{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,Df(d.data,2,s.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=we(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 Qa(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 Qa(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(),p=t.readUByte(),g=t.readUByte(),v=t.readUByte(),T=[],y=[];for(let Te=0;Te<s;Te++)T.push(t.readBoolean()),y.push(t.readBoolean());if(s>0)for(let Te=s;Te<8;Te++)t.readBits(2);for(let Te=0;Te<s;Te++)T[Te]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),y[Te]&&t.readUByte();t.readUEG();const _=t.readUEG();_==3&&t.skipBits(1);const I=t.readUEG(),x=t.readUEG(),L=t.readBoolean();let A=0,R=0,S=0,k=0;L&&(A+=t.readUEG(),R+=t.readUEG(),S+=t.readUEG(),k+=t.readUEG());const O=t.readUEG(),G=t.readUEG(),V=t.readUEG(),B=t.readBoolean();for(let Te=B?0:s;Te<=s;Te++)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 ut=0;ut<4;ut++)for(let Dt=0;Dt<(ut===3?2:6);Dt++)if(!t.readBoolean())t.readUEG();else{const Yt=Math.min(64,1<<4+(ut<<1));ut>1&&t.readEG();for(let be=0;be<Yt;be++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const F=t.readUEG();let ie=0;for(let Te=0;Te<F;Te++){let ut=!1;if(Te!==0&&(ut=t.readBoolean()),ut){Te===F&&t.readUEG(),t.readBoolean(),t.readUEG();let Dt=0;for(let bi=0;bi<=ie;bi++){const Yt=t.readBoolean();let be=!1;Yt||(be=t.readBoolean()),(Yt||be)&&Dt++}ie=Dt}else{const Dt=t.readUEG(),bi=t.readUEG();ie=Dt+bi;for(let Yt=0;Yt<Dt;Yt++)t.readUEG(),t.readBoolean();for(let Yt=0;Yt<bi;Yt++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Te=t.readUEG();for(let ut=0;ut<Te;ut++){for(let Dt=0;Dt<V+4;Dt++)t.readBits(1);t.readBits(1)}}let $=0,H=1,de=1,ce=!0,ve=1,Ee=0;t.readBoolean(),t.readBoolean();let Fe=!1;if(t.readBoolean()){if(t.readBoolean()){const Nt=t.readUByte(),Mo=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],qr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Nt>0&&Nt<16?(H=Mo[Nt-1],de=qr[Nt-1]):Nt===255&&(H=t.readBits(16),de=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(),Fe=t.readBoolean(),Fe&&(A+=t.readUEG(),R+=t.readUEG(),S+=t.readUEG(),k+=t.readUEG()),t.readBoolean()&&(ve=t.readBits(32),Ee=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const qr=t.readBoolean(),Po=t.readBoolean();let rr=!1;(qr||Po)&&(rr=t.readBoolean(),rr&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),rr&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Oo=0;Oo<=s;Oo++){ce=t.readBoolean();const Uu=ce||t.readBoolean();let No=!1;Uu?t.readEG():No=t.readBoolean();const Lt=No?1:t.readUEG()+1;if(qr)for(let Ye=0;Ye<Lt;Ye++)t.readUEG(),t.readUEG(),rr&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Po)for(let Ye=0;Ye<Lt;Ye++)t.readUEG(),t.readUEG(),rr&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),$=t.readUEG())}let dt=I,It=x;if(L||Fe){let Te=1,ut=1;_===1?Te=ut=2:_==2&&(Te=2),dt=I-Te*R-Te*A,It=x-ut*k-ut*S}const Ti=r?["A","B","C"][r]:"",vs=o<<24|l<<16|d<<8|u;let Vr=0;for(let Te=0;Te<32;Te++)Vr=(Vr|(vs>>Te&1)<<31-Te)>>>0;let Wr=Vr.toString(16);return a===1&&Wr==="2"&&(Wr="6"),{codecString:`hvc1.${Ti}${a}.${Wr}.${n?"H":"L"}${v}.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,p,g],general_level_idc:v,bit_depth:O+8,bit_depth_luma_minus8:O,bit_depth_chroma_minus8:G,min_spatial_segmentation_idc:$,chroma_format_idc:_,frame_rate:{fixed:ce,fps:Ee/ve}},width:dt,height:It,pixelRatio:[H,de]}}readPPS(e){const t=new Qa(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 gt=188;class Ms{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=Ms.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(gt*5,t-gt)+1,r=0;for(;r<s;){let n=!1,a=-1,o=0;for(let l=r;l<t;l+=gt)if(e[l]===71&&(t-l===gt||e[l+gt]===71)){if(o++,a===-1&&(a=l,a!==0&&(s=Math.min(a+gt*99,e.length-gt)+1)),n||(n=Wc(e,l)===0),n&&o>1&&(a===0&&o>2||l+gt>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:Fv[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=Ms.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=Ms.createTrack("audio",r),this._id3Track=Ms.createTrack("id3"),this._txtTrack=Ms.createTrack("text"),this._audioTrack.segmentCodec="aac",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,p=l.pesData,g=null,v=this.pmtParsed,T=this._pmtId,y=e.length;if(this.remainderData&&(e=si(this.remainderData,e),y=e.length,this.remainderData=null),y<gt&&!r)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:d};const _=Math.max(0,Ms.syncOffset(e));y-=(y-_)%gt,y<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,y,e.buffer.byteLength-y));let I=0;for(let L=_;L<y;L+=gt)if(e[L]===71){const A=!!(e[L+1]&64),R=Wc(e,L),S=(e[L+3]&48)>>4;let k;if(S>1){if(k=L+5+e[L+4],k===L+gt)continue}else k=L+4;switch(R){case u:if(A){if(c&&(n=zr(c,this.logger))){if(this.videoParser===null)switch(a.segmentCodec){case"avc":this.videoParser=new cg;break;case"hevc":this.videoParser=new hg;break}this.videoParser!==null&&this.videoParser.parsePES(a,d,n,!1)}c={data:[],size:0}}c&&(c.data.push(e.subarray(k,L+gt)),c.size+=L+gt-k);break;case h:if(A){if(m&&(n=zr(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(k,L+gt)),m.size+=L+gt-k);break;case f:A&&(p&&(n=zr(p,this.logger))&&this.parseID3PES(l,n),p={data:[],size:0}),p&&(p.data.push(e.subarray(k,L+gt)),p.size+=L+gt-k);break;case 0:A&&(k+=e[k]+1),T=this._pmtId=FI(e,k);break;case T:{A&&(k+=e[k]+1);
vendor: 8,215 bytes, line 37
37const O=$I(e,k,this.typeSupported,s,this.observer,this.logger);u=O.videoPid,u>0&&(a.pid=u,a.segmentCodec=O.segmentVideoCodec),h=O.audioPid,h>0&&(o.pid=h,o.segmentCodec=O.segmentAudioCodec),f=O.id3Pid,f>0&&(l.pid=f),g!==null&&!v&&(this.logger.warn(`MPEG-TS PMT found at ${L} after unknown PID '${g}'. Backtracking to sync byte @${_} to parse all TS packets.`),g=null,L=_-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=R;break}}else I++;I>0&&qc(this.observer,new Error(`Found ${I} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=c,o.pesData=m,l.pesData=p;const x={audioTrack:o,videoTrack:a,id3Track:l,textTrack:d};return r&&this.extractRemainingSamples(x),x}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=zr(a,this.logger))){if(this.videoParser===null)switch(s.segmentCodec){case"avc":this.videoParser=new cg;break;case"hevc":this.videoParser=new hg;break}this.videoParser!==null&&(this.videoParser.parsePES(s,n,d,!0),s.pesData=null)}else s.pesData=a;if(o&&(d=zr(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=zr(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 UI(this.observer,this.config,t);return this.decrypt(r,n)}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=si(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&&!Hd(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",qc(this.observer,new Error(c),h,this.logger),!h)return}pE(e,this.observer,n,a,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(r){const c=gE(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=vE(e,n,a,l,d),a+=u.length,u.missing){this.aacOverFlow=u;break}else for(d++;a<o-1&&!Hd(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(_E(s,a)){const l=TE(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=IE(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=we({},t,{type:this._videoTrack?Kt.emsg:Kt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function Wc(i,e){return((i[e+1]&31)<<8)+i[e+2]}function FI(i,e){return(i[e+10]&31)<<8|i[e+11]}function $I(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=Wc(i,e),c=(i[e+3]&15)<<8|i[e+4];switch(i[e]){case 207:if(!s){Ju("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){Ju("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){Ju("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;){switch(i[h]){case 106:t.ac3!==!0?n.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=u,a.segmentAudioCodec="ac3");break}const p=i[h+1]+2;h+=p,f-=p}}break;case 194:case 135:return qc(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 qc(i,e,t,s){s.warn(`parsing error: ${e.message}`),i.emit(E.ERROR,E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Ju(i,e){e.log(`${i} with AES-128-CBC encryption found in unencrypted stream`)}function zr(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]=si(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 p=s.byteLength;if(c)if(c>p){c-=p;continue}else s=s.subarray(c),p-=c,c=0;h.set(s,t),t+=p}return r&&(r-=n+3),{data:h,pts:a,dts:o,len:r}}return null}class BI{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 Es=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};
vendor: 4,441 bytes, line 37
37const 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/(Es+1)),r=Math.floor(t%(Es+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/(Es+1)),r=Math.floor(t%(Es+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))}
vendor: 4,318 bytes, line 37
37else 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/(Es+1)),o=Math.floor(s%(Es+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/(Es+1)),a=Math.floor(t%(Es+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 si(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 p=0;p<s[m].length;p+=1)a+=2+s[m][p].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 p=0;p<s[m].length;p+=1)o.set(new Uint8Array([s[m][p].length>>8,s[m][p].length&255]),a),a+=2,o.set(s[m][p],a),a+=s[m][p].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 RE=9e4;function Vf(i,e,t=1,s=!1){const r=i*e*t;return s?Math.round(r):r}function HI(i,e,t=1,s=!1){return Vf(i,e,1/t,s)}function ca(i,e=!1){return Vf(i,1e3,1/RE,e)}function GI(i,e=1){return Vf(i,RE,1/e)}const KI=10*1e3,VI=1024,WI=1152,qI=1536;let Qr=null,ec=null;function fg(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 yl extends yi{constructor(e,t,s,r){if(super("mp4-remuxer",r),this.observer=void 0,this.config=void 0,this.typeSupp
vendor: 7,998 bytes, line 37
37orted=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,Qr===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Qr=a?parseInt(a[1]):0}if(ec===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);ec=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.log("initPTS & initDTS reset"),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=Zt(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,p=n,g=n;const v=e.pid>-1,T=t.pid>-1,y=t.samples.length,_=e.samples.length>0,I=o&&y>0||y>1;if((!v||_)&&(!T||I)||this.ISGenerated||o){if(this.ISGenerated){var L,A,R,S;const V=this.videoTrackConfig;(V&&(t.width!==V.width||t.height!==V.height||((L=t.pixelRatio)==null?void 0:L[0])!==((A=V.pixelRatio)==null?void 0:A[0])||((R=t.pixelRatio)==null?void 0:R[1])!==((S=V.pixelRatio)==null?void 0:S[1]))||!V&&I||this.nextAudioTs===null&&_)&&this.resetInitSegment()}this.ISGenerated||(c=this.generateIS(e,t,n,a));const k=this.isVideoContiguous;let O=-1,G;if(I&&(O=YI(t.samples),!k&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,O>0){this.warn(`Dropped ${O} out of ${y} video samples due to a missing keyframe`);const V=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(O),t.dropped+=O,g+=(t.samples[0].pts-V)/t.inputTimeScale,G=g}else O===-1&&(this.warn(`No keyframe found out of ${y} video samples`),m=!1);if(this.ISGenerated){if(_&&I){const V=this.getVideoStartPts(t.samples),K=(Zt(e.samples[0].pts,V)-V)/t.inputTimeScale;p+=Math.max(0,K),g+=Math.max(0,-K)}if(_){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),c=this.generateIS(e,t,n,a)),u=this.remuxAudio(e,p,this.isAudioContiguous,a,T||I||l===X.AUDIO?g:void 0),I){const V=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,g,k,V)}}else I&&(d=this.remuxVideo(t,g,k,0));d&&(d.firstKeyFrame=O,d.independent=O!==-1,d.firstKeyFramePTS=G)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(f=xE(s,n,this._initPTS,this._initDTS)),r.samples.length&&(h=kE(r,n,this._initPTS))),{audio:u,video:d,initSegment:c,independent:m,text:h,id3:f}}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,p;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&&(p=e.id,m=e.inputTimeScale,!d||m!==d.timescale?h=f=n[0].pts-Math.round(m*s):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(p=t.id,m=t.inputTimeScale,!d||m!==d.timescale){const g=this.getVideoStartPts(a),v=Math.round(m*s);f=Math.min(f,Zt(a[0].dts,g)-v),h=Math.min(h,g-v)}else u=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:h,timescale:m},this._initDTS={baseTime:f,timescale:m}):h=m=void 0,{tracks:l,initPTS:h,timescale:m,trackId:p}}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,p,g=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY,T=!1;if(!s||c===null){const $=u+t*n,H=a[0].pts-Zt(a[0].dts,a[0].pts);Qr&&c!==null&&Math.abs($-H-(c+u))<15e3?s=!0:c=$-H-u}const y=c+u;for(let $=0;$<l;$++){const H=a[$];H.pts=Zt(H.pts,y),H.dts=Zt(H.dts,y),H.dts<a[$>0?$-1:$].dts&&(T=!0)}T&&a.sort(function($,H){const de=$.dts-H.dts,ce=$.pts-H.pts;return de||ce}),m=a[0].dts,p=a[a.length-1].dts;const _=p-m,I=_?Math.round(_/(l-1)):f||e.inputTimeScale/30;if(s){const $=m-y,H=$>I,de=$<-1;if((H||de)&&(H?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ca($,!0)} ms (${$}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ca(-$,!0)} ms (${$}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!de||y>=a[0].pts||Qr)){m=y;const ce=a[0].pts-$;if(H)a[0].dts=m,a[0].pts=ce;else{let ve=!0;for(let Ee=0;Ee<a.length&&!(a[Ee].dts>ce&&ve);Ee++){const Fe=a[Ee].pts;if(a[Ee].dts-=$,a[Ee].pts-=$,Ee<a.length-1){const St=a[Ee+1].pts,dt=a[Ee].pts,It=St<=dt,Ti=St<=Fe;ve=It==Ti}}}this.log(`Video: Initial PTS/DTS adjusted: ${ca(ce,!0)}/${ca(m,!0)}, delta: ${ca($,!0)} ms`)}}m=Math.max(0,m);let x=0,L=0,A=m;for(let $=0;$<l;$++){const H=a[$],de=H.units,ce=de.length;let ve=0;for(let Ee=0;Ee<ce;Ee++)ve+=de[Ee].data.length;L+=ve,x+=ce,H.length=ve,H.dts<A?(H.dts=A,A+=I/4|0||1):A=H.dts,g=Math.min(H.pts,g),v=Math.max(H.pts,v)}p=a[l-1].dts;const R=L+4*x+8;let S;try{S=new Uint8Array(R)}catch($){this.observer.emit(E.ERROR,E.ERROR,{type:te.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:$,bytes:R,reason:`fail allocating video mdat ${R}`});return}const k=new DataView(S.buffer);k.setUint32(0,R),S.set(D.types.mdat,4);let O=!1,G=Number.POSITIVE_INFINITY,V=Number.POSITIVE_INFINITY,B=Number.NEGATIVE_INFINITY,K=Number.NEGATIVE_INFINITY;for(let $=0;$<l;$++){const H=a[$],de=H.units;let ce=0;for(let Fe=0,St=de.length;Fe<St;Fe++){const dt=de[Fe],It=dt.data,Ti=dt.data.byteLength;k.setUint32(h,Ti),h+=4,S.set(It,h),h+=Ti,ce+=4+Ti}let ve;if($<l-1)f=a[$+1].dts-H.dts,ve=a[$+1].pts-H.pts;else{const Fe=this.config,St=$>0?H.dts-a[$-1].dts:I;if(ve=$>0?H.pts-a[$-1].pts:I,Fe.stretchShortVideoTrack&&this.nextAudioTs!==null){const dt=Math.floor(Fe.maxBufferHole*n),It=(r?g+r*n:this.nextAudioTs+u)-H.pts;It>dt?(f=It-St,f<0?f=St:O=!0,this.log(`It is approximately ${It/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=St}else f=St}const Ee=Math.round(H.pts-H.dts);G=Math.min(G,f),B=Math.max(B,f),V=Math.min(V,ve),K=Math.max(K,ve),o.push(fg(H.key,f,ce,Ee))}if(o.length){if(Qr){if(Qr<70){const $=o[0].flags;$.dependsOn=2,$.isNonSync=0}}else if(ec&&K-V<B-G&&I/B<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let $=m;for(let H=0,de=o.length;H<de;H++){const ce=$+o[H].duration,ve=$+o[H].cts;if(H<de-1){const Ee=ce+o[H+1].cts;o[H].duration=Ee-ve}else o[H].duration=H?o[H-1].duration:I;o[H].cts=0,$=ce}}}f=O||!f?I:f;const J=p+f;this.nextVideoTs=c=J-u,this.videoSampleDuration=f,this.isVideoContiguous=!0;const ee={data1:D.moof(e.sequenceNumber++,m,we(e,{samples:o})),data2:S,startPTS:(g-u)/n,endPTS:(v+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,ee}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return WI;case"ac3":return qI;default:return VI}}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 p=e.samples,g=h?0:8,v=this.nextAudioTs||-1;const T=c.baseTime*a/c.timescale,y=T+t*a;if(this.isAudioContiguous=s=s||p.length&&v>0&&(r&&Math.abs(y-(v+T))<9e3||Math.abs(Zt(p[0].pts,y)-(v+T))<20*u),p.forEach(function(K){K.pts=Zt(K.pts,y)}
37),!s||v<0){if(p=p.filter(K=>K.pts>=0),!p.length)return;n===0?v=0:r&&!m?v=Math.max(0,y-T):v=p[0].pts-T}if(e.segmentCodec==="aac"){const K=this.config.maxAudioFramesDrift;for(let J=0,F=v+T;J<p.length;J++){const ie=p[J],ee=ie.pts,$=ee-F,H=Math.abs(1e3*$/a);if($<=-K*u&&m)J===0&&(this.warn(`Audio frame @ ${(ee/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*$/a)} ms.`),this.nextAudioTs=v=ee-T,F=ee);else if($>=K*u&&H<KI&&m){let de=Math.round($/u);for(F=ee-de*u;F<0&&de&&u;)de--,F+=u;J===0&&(this.nextAudioTs=v=F-T),this.warn(`Injecting ${de} audio frames @ ${((F-T)/a).toFixed(3)}s due to ${Math.round(1e3*$/a)} ms gap.`);for(let ce=0;ce<de;ce++){let ve=BI.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);ve||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),ve=ie.unit.subarray()),p.splice(J,0,{unit:ve,pts:F}),F+=u,J++}}ie.pts=F,F+=u}}let _=null,I=null,x,L=0,A=p.length;for(;A--;)L+=p[A].unit.byteLength;for(let K=0,J=p.length;K<J;K++){const F=p[K],ie=F.unit;let ee=F.pts;if(I!==null){const H=f[K-1];H.duration=Math.round((ee-I)/l)}else if(s&&e.segmentCodec==="aac"&&(ee=v+T),_=ee,L>0){L+=g;try{x=new Uint8Array(L)}catch(H){this.observer.emit(E.ERROR,E.ERROR,{type:te.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:H,bytes:L,reason:`fail allocating audio mdat ${L}`});return}h||(new DataView(x.buffer).setUint32(0,L),x.set(D.types.mdat,4))}else return;x.set(ie,g);const $=ie.byteLength;g+=$,f.push(fg(!0,d,$,0)),I=ee}const R=f.length;if(!R)return;const S=f[f.length-1];v=I-T,this.nextAudioTs=v+l*S.duration;const k=h?new Uint8Array(0):D.moof(e.sequenceNumber++,_/l,we({},e,{samples:f}));e.samples=[];const O=(_-T)/a,G=v/a,B={data1:k,data2:x,startPTS:O,endPTS:G,startDTS:O,endDTS:G,type:"audio",hasAudio:!0,hasVideo:!1,nb:R};return this.isAudioContiguous=!0,B}}function Zt(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 YI(i){for(let e=0;e<i.length;e++)if(i[e].key)return e;return-1}function xE(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=Zt(l.pts-t.baseTime*n/t.timescale,e*n)/n,l.dts=Zt(l.dts-s.baseTime*n/s.timescale,e*n)/n}const a=i.samples;return i.samples=[],{samples:a}}function kE(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=Zt(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 jI extends yi{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(BS(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=Hv(e);r.audio&&(t=mg(r.audio,Ue.AUDIO,this)),r.video&&(s=mg(r.video,Ue.VIDEO,this));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+s,supplemental:r.video.supplemental,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:s,supplemental:r.video.supplemental,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=n}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};q(u)||(u=this.lastEndTime=n||0);const h=t.samples;if(!(h!=null&&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 p=GS(h,m,this),g=m.audio?p[m.audio.id]:null,v=m.video?p[m.video.id]:null,T=qo(v,1/0),y=qo(g,1/0),_=qo(v,0,!0),I=qo(g,0,!0);let x,L=n,A=0;if(g&&(!v||!d&&y<T||d&&d.trackId===m.audio.id)?(f.trackId=m.audio.id,x=g,A=I-y):v&&(f.trackId=m.video.id,x=v,A=_-T),x){const K=x.timescale;L=x.start/K,f.initPTS=x.start-n*K,f.timescale=K,d||(this.initPTS=d={baseTime:f.initPTS,timescale:K,trackId:f.trackId})}
vendor: 4,301 bytes, line 37
37(a||!d)&&(zI(d,L,n,A)||f.timescale!==d.timescale)&&(f.initPTS=L-n,f.timescale=1,d&&d.timescale===1&&this.warn(`Adjusting initPTS @${n} from ${d.baseTime/d.timescale} to ${f.initPTS}`),this.initPTS=d={baseTime:f.initPTS,timescale:1});const R=e?L-d.baseTime/d.timescale:u,S=R+A;A>0?this.lastEndTime=S:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const k=!!m.audio,O=!!m.video;let G="";k&&(G+="audio"),O&&(G+="video");const V={data1:h,startPTS:R,startDTS:R,endPTS:S,endDTS:S,type:G,hasAudio:k,hasVideo:O,nb:1,dropped:0};c.audio=k&&!O?V:void 0,c.video=O?V:void 0;const B=v==null?void 0:v.sampleCount;if(B){const K=v.keyFrameIndex,J=K!==-1;V.nb=B,V.dropped=K===0||this.isVideoContiguous?0:J?K:B,V.independent=J,V.firstKeyFrame=K,J&&v.keyFrameStart&&(V.firstKeyFramePTS=(v.keyFrameStart-d.baseTime)/d.timescale),this.isVideoContiguous||(c.independent=J),this.isVideoContiguous||(this.isVideoContiguous=J),V.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${K}/${B} dropped: ${V.dropped} start: ${V.firstKeyFramePTS||"NA"}`)}return c.initSegment=f,c.id3=xE(s,n,d,d),r.samples.length&&(c.text=kE(r,n,d)),c}}function qo(i,e,t=!1){return(i==null?void 0:i.start)!==void 0?(i.start+(t?i.duration:0))/i.timescale:e}function zI(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 mg(i,e,t){const s=i==null?void 0:i.codec;return s&&s.length>4?s:e===Ue.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?Pd(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 as;try{as=self.performance.now.bind(self.performance)}catch{as=Date.now}const Tl=[{demux:NI,remux:jI},{demux:Ms,remux:yl},{demux:wI,remux:yl},{demux:PI,remux:yl}];Tl.splice(2,0,{demux:MI,remux:yl});class pg{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=as();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:p,videoCodec:g,defaultInitPts:v,duration:T,initSegmentData:y}=l,_=QI(a,t);if(_&&Cn(_.method)){const A=this.getDecrypter(),R=Nf(_.method);if(A.isSync()){let S=A.softwareDecrypt(a,_.key.buffer,_.iv.buffer,R);if(s.part>-1){const O=A.flush();S=O&&O.buffer}if(!S)return n.executeEnd=as(),tc(s);a=new Uint8Array(S)}else return this.asyncResult=!0,this.decryptionPromise=A.webCryptoDecrypt(a,_.key.buffer,_.iv.buffer,R).then(S=>{const k=this.push(S,null,s);return this.decryptionPromise=null,k}),this.decryptionPromise}const I=this.needsProbing(u,c);if(I){const A=this.configureTransmuxer(a);if(A)return this.logger.warn(`[transmuxer] ${A.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:A,reason:A.message}),n.executeEnd=as(),tc(s)}(u||c||m||I)&&this.resetInitSegment(y,p,g,T,t),(u||m||I)&&this.resetInitialTimestamp(v),d||this.resetContiguity();const x=this.transmux(a,_,f,h,s);this.asyncResult=mo(x);const L=this.currentTransmuxState;return L.contiguous=!0,L.discontinuity=!1,L.trackSwitch=!1,n.executeEnd=as(),x}flush(e){const t=e.transmuxing;t.executeStart=as();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=as();const c=[tc(e)];return this.asyncResult?Promise.resolve(c):c}const u=l.flush(o);return mo(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}
vendor: 9,539 bytes, lines 37-43
37=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===X.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=as()}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}))}configureTransmuxer(e){const{config:t,observer:s,typeSupported:r}=this;let n;for(let c=0,h=Tl.length;c<h;c++){var a;if((a=Tl[c].demux)!=null&&a.probe(e,this.logger)){n=Tl[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 Pf(this.config)),e}}function QI(i,e){let t=null;return i.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const tc=i=>({remuxResult:{},chunkMeta:i});function mo(i){return"then"in i&&i.then instanceof Function}class XI{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 ZI{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 gg=0;class DE{constructor(e,t,s,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=gg++,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(E.ERROR,{type:te.OTHER_ERROR,details:w.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===E.ERROR&&(d=d,d.parent=this.id,d.part=this.part,this.error=d.error),this.hls.trigger(l,d)};this.observer=new Ff,this.observer.on(E.FRAG_DECRYPTED,a),this.observer.on(E.ERROR,a);const o=wp(n.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(n.workerPath||rI()){try{n.workerPath?(l.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=aI(n.workerPath)):(l.log(`injecting Web Worker for "${t}"`),this.workerContext=nI());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:qe(n)})}catch(u){l.warn(`Error setting up "${t}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new pg(this.observer,o,n,"",t,e.logger)}return}}this.transmuxer=new pg(this.observer,o,n,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=gg++;const t=this.hls.config,s=wp(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:s,id:this.id,config:qe(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),oI(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,p=a?a.start:n.start,g=n.decryptdata,v=this.frag,T=!(v&&n.cc===v.cc),y=!(v&&d.level===v.level),_=v?d.sn-v.sn:-1,I=this.part?d.part-this.part.index:-1,x=_===0&&d.id>1&&d.id===(v==null?void 0:v.stats.chunkCount),L=!y&&(_===1||_===0&&(I===1||x&&I<=0)),A=self.performance.now();(y||_||n.stats.parsing.start===0)&&(n.stats.parsing.start=A),a&&(I||!L)&&(a.stats.parsing.start=A);const R=!(v&&((c=n.initSegment)==null?void 0:c.url)===((h=v.initSegment)==null?void 0:h.url)),S=new ZI(T,L,l,y,p,R);if(!L||T||R){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${n.type} sn: ${d.sn}${d.part>-1?" part: "+d.part:""} ${this.id===X.MAIN?"level":"track"}: ${d.level} id: ${d.id}
38        discontinuity: ${T}
39        trackSwitch: ${y}
40        contiguous: ${L}
41        accurateTimeOffset: ${l}
42        timeOffset: ${p}
43        initSegmentChange: ${R}`);const k=new XI(s,r,t,o,u);this.configureTransmuxer(k)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:g,chunkMeta:d,state:S},e instanceof ArrayBuffer?[e]:[]);else if(m){const k=m.push(e,g,d,S);mo(k)?k.then(O=>{this.handleTransmuxComplete(O)}).catch(O=>{this.transmuxerError(O,d,"transmuxer-interface push error")}):this.handleTransmuxComplete(k)}}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);mo(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(E.ERROR,{type:te.MEDIA_ERROR,details:w.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 vg=100;class JI extends Uf{constructor(e,t,s){super(e,t,s,"audio-stream-controller",X.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(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.AU
vendor: 4,530 bytes, line 43
43DIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:s,initPTS:r,timescale:n}){if(s===X.MAIN){const a=t.cc,o=this.fragCurrent;if(this.initPTS[a]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${a} found from main: ${r}/${n}`),this.mainAnchor=t,this.state===N.WAITING_INIT_PTS){const l=this.waitingData;(!l&&!this.loadingParts||l&&l.frag.cc!==a)&&this.syncWithAnchor(t,l==null?void 0:l.frag)}else!this.hls.hasEnoughToStart&&o&&o.cc!==a?(o.abortRequests(),this.syncWithAnchor(t,o)):this.state===N.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==null?void 0:r.cc)===t.cc)return;const n=(r||e).cc,a=this.getLevelDetails(),o=this.getLoadPosition(),l=Qv(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===N.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=N.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(vg),s>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s,this.state=N.IDLE):this.state=N.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case N.IDLE:this.doTickIdle();break;case N.WAITING_TRACK:{const{levels:t,trackId:s}=this,r=t==null?void 0:t[s],n=r==null?void 0:r.details;if(n&&!this.waitForLive(r)){if(this.waitForCdnTuneIn(n))break;this.state=N.WAITING_INIT_PTS}break}case N.FRAG_LOADING_WAITING_RETRY:{var e;const t=performance.now(),s=this.retryDate;if(!s||t>=s||(e=this.media)!=null&&e.seeking){const{levels:r,trackId:n}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((r==null?void 0:r[n])||null),this.state=N.IDLE}break}case N.WAITING_INIT_PTS:{const t=this.waitingData;if(t){const{frag:s,part:r,cache:n,complete:a}=t,o=this.mainAnchor;if(this.initPTS[s.cc]!==void 0){this.waitingData=null,this.state=N.FRAG_LOADING;const l=n.flush().buffer,d={frag:s,part:r,payload:l,networkDetails:null};this._handleFragmentLoadProgress(d),a&&super._handleFragmentLoadComplete(d)}else o&&o.cc!==t.frag.cc&&this.syncWithAnchor(o,t.frag)}else this.state=N.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=N.WAITING_TRACK,this.startFragRequested=!1;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,Ue.AUDIO,X.AUDIO));const u=this.getFwdBufferInfo(d,X.AUDIO);if(u===null)return;if(!this.switchingTrack&&this._streamEnded(u,l)){t.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=N.ENDED;return}const c=u.len,h=t.maxBufferLength,f=l.fragments,m=f[0].start,p=this.getLoadPosition(),g=this.flushing?p:u.end;if(this.switchingTrack&&r){const y=p;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&&g<f[f.length-1].start)return;let v=this.getNextFragment(g,l);if(v&&this.isLoopLoading(v,g)&&(v=this.getNextFragmentLoopLoading(v,l,u,X.MAIN,h)),!v){this.bufferFlushed=!0;return}let T=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&T&&ot(v)&&!v.endList&&(!l.live||!this.loadingParts&&g<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(T)===ft.OK&&
vendor: 25,461 bytes, lines 43-46
43(this.mainFragLoading=T=null),T&&ot(T))){if(v.start>T.end){const _=this.fragmentTracker.getFragAtPos(g,X.MAIN);_&&_.end>T.end&&(T=_,this.mainFragLoading={frag:_,targetBufferTime:null})}if(v.start>T.end)return}this.loadFragment(v,o,g)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new uo(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!==N.STOPPED&&(this.setInterval(vg),this.state=N.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(E.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!==N.STOPPED&&(this.state=N.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||(uE(n,d),n.alignedSliding||Bd(n,d),c=n.fragmentStart)}u.details=n,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(d,c),this.hls.trigger(E.AUDIO_TRACK_UPDATED,{details:n,id:a,groupId:t.groupId}),this.state===N.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=N.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 DE(this.hls,X.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 g=r?r.index:-1,v=g!==-1,T=new Of(s.level,s.sn,s.stats.chunkCount,n.byteLength,g,v);h.push(n,m,c,"",s,r,u.totalduration,!1,T,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:p}=this.waitingData=this.waitingData||{frag:s,part:r,cache:new cE,complete:!1};p.push(new Uint8Array(n)),this.state!==N.STOPPED&&(this.state=N.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===X.MAIN&&ot(t.frag)&&(this.mainFragLoading=t,this.state===N.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:s,part:r}=t;if(s.type!==X.AUDIO){!this.audioOnly&&s.type===X.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(ot(s)){this.fragPrevious=s;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(E.AUDIO_TRACK_SWITCHED,Me({},n)))}this.fragBufferedComplete(s,r),this.media&&this.tick()}onError(e,t){var s;if(t.fatal){this.state=N.ERROR;return}switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(X.AUDIO,t);break;case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===N.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===ge.AUDIO_TRACK&&(this.state=N.IDLE);break;case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case w.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Ue.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Ue.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===N.ENDED&&(this.state=N.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,X.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:p}=n;if(this.fragContextChanged(l)||!c){this.fragmentTracker.removeFragment(l);return}if(this.state=N.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),p!=null&&p.tracks){const g=l.initSegment||l;this._bufferInitSegment(u,p.tracks,g,a),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:g,id:s,tracks:p.tracks})}if(h){const{startPTS:g,endPTS:v,startDTS:T,endDTS:y}=h;d&&(d.elementaryStreams[Ue.AUDIO]={startPTS:g,endPTS:v,startDTS:T,endDTS:y}),l.setElementaryStreamInfo(Ue.AUDIO,g,v,T,y),this.bufferFragmentData(h,l,d,a)}if(m!=null&&(t=m.samples)!=null&&t.length){const g=we({id:s,frag:l,details:c},m);r.trigger(E.FRAG_PARSING_METADATA,g)}if(f){const g=we({id:s,frag:l,details:c},f);r.trigger(E.FRAG_PARSING_USERDATA,g)}}_bufferInitSegment(e,t,s,r){if(this.state!==N.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const n=t.audio;n.id=X.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(E.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(E.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,s){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===ft.NOT_LOADED||r===ft.PARTIAL){var n;if(!ot(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=N.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&Bd(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;Mr({name:t,lang:s,assocLang:r,characteristics:n,audioCodec:a,channels:o},e,ur)||(Nd(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(E.AUDIO_TRACK_SWITCHED,Me({},e))}}class Wf extends yi{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==null?void 0: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==null?void 0:t.lastPartSn);let l=parseInt(a["LAST-PART"])||(t==null?void 0: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&&Mp(s);return new Pp(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.start=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){j1(s,r);const T=r.playlistParsingError;if(T){this.warn(T);const y=this.hls;if(!y.config.ignorePlaylistParsingErrors){var d;const{networkDetails:_}=t;y.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:T,reason:T.message,level:t.level||void 0,parent:(d=r.fragments[0])==null?void 0:d.type,networkDetails:_,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=nE(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 p,g,v;if(r.canBlockReload&&r.endSN&&r.advanced){const T=this.hls.config.lowLatencyMode,y=r.lastPartSn,_=r.endSN,I=r.lastPartIndex,x=I!==-1,L=y===_;x?L?(g=_+1,v=T?0:I):(g=y,v=T?I+1:r.maxPartIndex):g=_+1;const A=r.age,R=A+r.ageHeader;let S=Math.min(R-r.partTarget,r.targetduration*1.5);if(S>0){if(R>r.targetduration*3)this.log(`Playlist last advanced ${A.toFixed(2)}s ago. Omitting segment and part directives.`),g=void 0,v=void 0;else if(s!=null&&s.tuneInGoal&&R-r.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${S} with playlist age: ${r.age}`),S=0;else{const k=Math.floor(S/r.targetduration);if(g+=k,v!==void 0){const O=Math.round(S%r.targetduration/r.partTarget);v+=O}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${A.toFixed(2)}s goal: ${S} skip sn ${k} to part ${v}`)}r.tuneInGoal=S}if(p=this.getDeliveryDirectives(r,t.deliveryDirectives,g,v),T||!L){r.requestScheduled=a,this.loadingPlaylist(u,p);return}}else(r.canBlockReload||r.canSkipUntil)&&(p=this.getDeliveryDirectives(r,t.deliveryDirectives,g,v));p&&g!==void 0&&r.canBlockReload&&(r.requestScheduled=n.loading.first+Math.max(m-o*2,m/2)),this.scheduleLoading(u,p,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=Mp(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,r=t.part,n=vl.No),new Pp(s,r,n)}checkRetry(e){const t=e.details,s=Ud(e),r=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=r||{},l=!!r&&!!o&&(n===kt.RetryRequest||!r.resolved&&n===kt.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=Mf(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 CE(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(!po(i[t].attrs,e[t].attrs))return!1;return!0}function po(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 Yc(i,e){return e.label.toLowerCase()===i.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(i.lang||"").toLowerCase())}class eL extends Wf{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(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.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==null?void 0: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==null?void 0:r.length)!==(s==null?void 0:s.length)||s!=null&&s.some(o=>(r==null?void 0: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=Hi(l,o,ur);if(h>-1)n=o[h];else{const f=Hi(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==null?void 0:s.join(",")}`),this.hls.trigger(E.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(E.ERROR,{type:te.MEDIA_ERROR,details:w.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}}onError(e,t){t.fatal||!t.context||t.context.type===ge.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&&Mr(e,r,ur))return r;const n=Hi(e,this.tracksInGroup,ur);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=f1(e,t.levels,s,a,ur);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Hi(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(E.AUDIO_TRACK_SWITCHING,Me({},r)),n))return;const a=this.switchParams(r.url,s==null?void 0: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||Mr(e,r,ur)))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(Mr({name:s,lang:r,assocLang:n,characteristics:a,audioCodec:o,channels:l},u,ur))return d}for(let d=0;d<t.length;d++){const u=t[d];if(po(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return d}for(let d=0;d<t.length;d++){const u=t[d];if(po(e.attrs,u.attrs,["LANGUAGE"]))return d}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&Nd(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==null?void 0:a.age;this.log(`Loading audio-track ${s} "${e.name}" lang:${e.lang} group:${r}${(t==null?void 0: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(E.AUDIO_TRACK_LOADING,{url:n,id:s,groupId:r,deliveryDirectives:t||null,track:e})}}class tL{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>":`
44${this.list("video")}
45${this.list("audio")}
46${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==null?void 0: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 Eg=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,wE="HlsJsTrackRemovedError";class iL extends Error{constructor(e){super(e),this.name=wE}}class sL extends yi{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(E.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=DS(er(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(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this),e.off(E.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?we(s,r.tracks):this.sourceBuffers.forEach(n=>{const[a]=n;a&&(s[a]=we({},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}
46 bufferCodec event(s) expected.`),(s=this.transferData)!=null&&s.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){const s=this.media=t.media,r=er(this.appendSource);if(this.transferData=this.overrides=void 0,s&&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,yg(s),rL(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=()=>{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})
47required tracks: ${qe(s,(l,d)=>l==="initSegment"?void 0:d)};
48transfer tracks: ${qe(r,(l,d)=>l==="initSegment"?void 0:d)}}`),!Pv(r,s)){t.mediaSource=null,t.tracks=void 0;const l=e.currentTime,d=this.details,u=Math.max(l,(d==null?void 0: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(E.MEDIA_DETACHING,{}),this.onMediaAttaching(E.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 g=le.getBuffered(c);h.detectEvictedFragments(d,g,f,null,!0)}const m=ic(d),p=[d,c];this.sourceBuffers[m]=p,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&&yg(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(E.MEDIA_DETACHED,t)}
vendor: 4,582 bytes, line 48
48onBufferReset(){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[ic(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new tL(this.tracks)}onBufferCodecs(e,t){const s=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const n="audiovideo"in t&&(s.audio||s.video)||s.audiovideo&&("audio"in t||"video"in t),a=!n&&this.sourceBufferCount&&this.media&&r.some(o=>!s[o]);if(n||a){this.warn(`Unsupported transition between "${Object.keys(s)}" and "${r}" SourceBuffers`);return}r.forEach(o=>{var l,d,u;const c=t[o],{id:h,codec:f,levelCodec:m,container:p,metadata:g,supplemental:v}=c;let T=s[o];const y=(l=this.transferData)==null||(d=l.tracks)==null?void 0:d[o],_=y!=null&&y.buffer?y:T,I=(_==null?void 0:_.pendingCodec)||(_==null?void 0:_.codec),x=_==null?void 0:_.levelCodec;T||(T=s[o]={buffer:void 0,listeners:[],codec:f,supplemental:v,container:p,levelCodec:m,metadata:g,id:h});const L=gl(I,x),A=L==null?void 0:L.replace(Eg,"$1");let R=gl(f,m);const S=(u=R)==null?void 0:u.replace(Eg,"$1");R&&L&&A!==S&&(o.slice(0,5)==="audio"&&(R=Pd(R,this.appendSource)),this.log(`switching codec ${I} to ${R}`),R!==(T.pendingCodec||T.codec)&&(T.pendingCodec=R),T.container=p,this.appendChangeType(o,p,R))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&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,X.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&&le.isBuffered(l.buffer,r)||((o=this.fragmentTracker.getAppendedFrag(r,X.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 p=o.stats.buffering,g=l?l.stats.buffering:null;p.start===0&&(p.start=m),g&&g.start===0&&(g.start=m);const v=s.audio;let T=!1;n==="audio"&&(v==null?void 0:v.container)==="audio/mpeg"&&(T=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const y=s.video,_=y==null?void 0:y.buffer;if(_&&h!=="initSegment"){const L=l||o,A=this.blockedAudioAppend;if(n==="audio"&&a!=="main"&&!this.blockedAudioAppend){const S=L.start+L.duration*.05,k=_.buffered,O=this.currentOp("video");!k.length&&!O?this.blockAudio(L):!O&&!le.isBuffered(_,S)&&this.lastVideoAppendEnd<S&&this.blockAudio(L)}else if(n==="video"){const R=L.end;if(A){const S=A.frag.start;(R>S||R<this.lastVideoAppendEnd||le.isBuffered(_,S))&&this.unblockAudio()}this.lastVideoAppendEnd=R}}const I=(l||o).start,x={label:`append-${n}`,execute:()=>{var L;c.executeStart=self.performance.now();const A=(L=this.tracks[n])==null?void 0:L.buffer;A&&(T?this.updateTimestampOffset(A,I,.1,n,h,f):u!==void 0&&q(u)&&this.updateTimestampOffset(A,u,1e-6,n,h,f)),this.appendExecutor(r,n)},onStart:()=>{},onComplete:()=>{const L=self.performance.now();c.executeEnd=c.end=L,p.first===0&&(p.first=L),g&&g.first===0&&(g.first=L);const A={};
vendor: 4,255 bytes, line 48
48this.sourceBuffers.forEach(([R,S])=>{R&&(A[R]=le.getBuffered(S))}),this.appendErrors[n]=0,n==="audio"||n==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(E.BUFFER_APPENDED,{type:n,frag:o,part:l,chunkMeta:d,parent:o.type,timeRanges:A})},onError:L=>{var A;const R={type:te.MEDIA_ERROR,parent:o.type,details:w.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:o,part:l,chunkMeta:d,error:L,err:L,fatal:!1},S=(A=this.media)==null?void 0:A.error;if(L.code===DOMException.QUOTA_EXCEEDED_ERR||L.name=="QuotaExceededError"||"quota"in L)R.details=w.BUFFER_FULL_ERROR;else if(L.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!S)R.errorAction=co(!0);else if(L.name===wE&&this.sourceBufferCount===0)R.errorAction=co(!0);else{const k=++this.appendErrors[n];this.warn(`Failed ${k}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${n}" sourceBuffer (${S||"no media error"})`),(k>=this.hls.config.appendErrorMaxRetry||S)&&(R.fatal=!0)}this.hls.trigger(E.ERROR,R)}};this.append(x,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(E.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[Ue.AUDIOVIDEO]?n.push("audiovideo"):(a[Ue.AUDIO]&&n.push("audio"),a[Ue.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(E.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])=>{var t,s;return e&&(!((t=this.tracks[e])!=null&&t.ended)||((s=this.tracks[e])==null?void 0:s.ending))})}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(E.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(E.BUFFERED_TO_END,void 0)))}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===w.BUFFER_APPEND_ERROR&&t.frag){var s;const r=(s=t.errorAction)==null?void 0:s.nextAutoLevel;q(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(q(o)&&o>=0){const l=Math.max(o,a),d=Math.floor(n/a)*a-l;this.flushBackBuffer(n,a,d)}if(q(r.frontBufferFlushThreshold)&&r.frontBufferFlushThreshold>0){const l=Math.max(r.maxBufferLength,r.frontBufferFlushThreshold),d=Math.max(l,a),u=Math.floor(n/a)*a+d;this.flushFrontBuffer(n,a,u)}}
vendor: 6,065 bytes, line 48
48flushBackBuffer(e,t,s){this.sourceBuffers.forEach(([r,n])=>{if(n){const o=le.getBuffered(n);if(o.length>0&&s>o.start(0)){var a;this.hls.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:s});const l=this.tracks[r];if((a=this.details)!=null&&a.live)this.hls.trigger(E.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(E.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:r})}}})}flushFrontBuffer(e,t,s){this.sourceBuffers.forEach(([r,n])=>{if(n){const a=le.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(E.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;const{details:t,mediaSource:s}=this;if(!t||!this.media||(s==null?void 0:s.readyState)!=="open")return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&t.live&&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 q(n)?{duration:n}:null;const a=this.media.duration,o=q(s.duration)?s.duration:0;return r>o&&r>a||!q(a)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:s}){const r=this.mediaSource;!this.media||!r||r.readyState!=="open"||(r.duration!==e&&(q(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}) ${qe(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(E.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(E.ERROR,{type:te.MEDIA_ERROR,details:w.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":""} ${qe(o)}`);try{const u=s.addSourceBuffer(d),c=ic(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(E.ERROR,{type:te.MEDIA_ERROR,details:w.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")&&Uc(s,"video")&&(r=QS(r,s));const n=gl(r,e.levelCodec);return n?t.slice(0,5)==="audio"?Pd(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(E.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==null?void 0: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(E.ERROR,{type:te.MEDIA_ERROR,details:w.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==null?void 0: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=q(r.duration)?r.duration:1/0,d=q(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==null?void 0:s.buffer;if(!r)throw new iL(`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}
48`),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 yg(i){const e=i.querySelectorAll("source");[].slice.call(e).forEach(t=>{i.removeChild(t)})}function rL(i,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,i.appendChild(t)}function ic(i){return i==="audio"?1:0}class qf{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(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.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&&q(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,qf.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.
vendor: 4,716 bytes, line 48
48width||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 nL={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Ct=nL,aL={HLS:"h"},oL=aL,lL="CMCD-Object",dL="CMCD-Request",uL="CMCD-Session",cL="CMCD-Status",Sa={OBJECT:lL,REQUEST:dL,SESSION:uL,STATUS:cL},hL={[Sa.OBJECT]:["br","ab","d","ot","tb","tpb","lb","tab","lab","url"],[Sa.REQUEST]:["pb","bl","tbl","dl","ltc","mtp","nor","nrr","rc","sn","sta","su","ttfb","ttfbb","ttlb","cmsdd","cmsds","smrt","df","cs"],[Sa.SESSION]:["cid","pr","sf","sid","st","v","msd"],[Sa.STATUS]:["bs","bsd","cdn","rtp","bg","pt","ec","e"]};class Qn{constructor(e,t){Array.isArray(e)&&(e=e.map(s=>s instanceof Qn?s:new Qn(s))),this.value=e,this.params=t}}const fL="Dict";function mL(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 pL(i,e,t,s){return new Error(`failed to ${i} "${mL(e)}" as ${t}`,{cause:s})}function ji(i,e,t){return pL("serialize",i,e,t)}class ME{constructor(e){this.description=e}}const Tg="Bare Item",gL="Boolean";function vL(i){if(typeof i!="boolean")throw ji(i,gL);return i?"?1":"?0"}function EL(i){return btoa(String.fromCharCode(...i))}const yL="Byte Sequence";function TL(i){if(ArrayBuffer.isView(i)===!1)throw ji(i,yL);return`:${EL(i)}:`}const bL="Integer";function _L(i){return i<-999999999999999||999999999999999<i}function PE(i){if(_L(i))throw ji(i,bL);return i.toString()}function AL(i){return`@${PE(i.getTime()/1e3)}`}function OE(i,e){if(i<0)return-OE(-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 SL="Decimal";function IL(i){const e=OE(i,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ji(i,SL);const t=e.toString();return t.includes(".")?t:`${t}.0`}const LL="String",RL=/[\x00-\x1f\x7f]+/;function xL(i){if(RL.test(i))throw ji(i,LL);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function kL(i){return i.description||i.toString().slice(7,-1)}const DL="Token";function bg(i){const e=kL(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ji(e,DL);return e}function jc(i){switch(typeof i){case"number":if(!q(i))throw ji(i,Tg);return Number.isInteger(i)?PE(i):IL(i);case"string":return xL(i);case"symbol":return bg(i);case"boolean":return vL(i);case"object":if(i instanceof Date)return AL(i);if(i instanceof Uint8Array)return TL(i);if(i instanceof ME)return bg(i);default:throw ji(i,Tg)}}const CL="Key";function zc(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw ji(i,CL);return i}function Yf(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${zc(e)}`:`;${zc(e)}=${jc(t)}`).join("")}function NE(i){return i instanceof Qn?`${jc(i.value)}${Yf(i.params)}`:jc(i)}function wL(i){return`(${i.value.map(NE).join(" ")})${Yf(i.params)}`}function ML(i,e={whitespace:!0}){if(typeof i!="object")throw ji(i,fL);const t=i instanceof Map?i.entries():Object.entries(i),s=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof Qn||(n=new Qn(n));let a=zc(r);return n.value===!0?a+=Yf(n.params):(a+="=",Array.isArray(n.value)?a+=wL(n):a+=NE(n)),a}).join(`,${s}`)}function PL(i,e){return ML(i,e)}function OL(i){return["ot","sf","st","e","sta"].includes(i)}function NL(i){return typeof i=="number"?q(i):i!=null&&i!==""&&i!==!1}function UL(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("/")}const bl=i=>Math.round(i),FL=(i,e)=>(e!=null&&e.baseUrl&&(i=UL(i,e.baseUrl)),encodeURIComponent(i)),Yo=i=>bl(i/100)*100,$L={br:bl,d:bl,bl:Yo,dl:Yo,mtp:Yo,nor:FL,rtp:Yo,tb:bl};function BL(i,e){const t={};if(i==null||typeof i!="object")return t;const s=Object.keys(i).sort(),r=we({},$L,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;
48return s.forEach(a=>{if((n==null?void 0:n(a))===!1)return;let o=i[a];const l=r[a];l&&(o=l(o,e)),!(a==="v"&&o===1)&&(a=="pr"&&o===1||NL(o)&&(OL(a)&&typeof o=="string"&&(o=new ME(o)),t[a]=o))}),t}function UE(i,e={}){return i?PL(BL(i,e),we({whitespace:!1},e)):""}function HL(i,e={}){const t={};if(!i)return t;const s=Object.entries(i),r=Object.entries(hL).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),n=s.reduce((a,o)=>{var l,d;const[u,c]=o,h=((l=r.find(f=>f[1].includes(u)))===null||l===void 0?void 0:l[0])||Sa.REQUEST;return(d=a[h])!==null&&d!==void 0||(a[h]={}),a[h][u]=c,a},{});return Object.entries(n).reduce((a,[o,l])=>(a[o]=UE(l,e),a),t)}function GL(i,e,t){return we(i,HL(e,t))}const KL="CMCD";function VL(i,e={}){if(!i)return"";const t=UE(i,e);return`${KL}=${encodeURIComponent(t)}`}const _g=/CMCD=[^&#]+/;function WL(i,e,t){const s=VL(e,t);if(!s)return i;if(_g.test(i))return i.replace(_g,s);const r=i.includes("?")?"&":"?";return`${i}${r}${s}`}class qL{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:Ct.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===Ct.VIDEO||l===Ct.AUDIO||l==Ct.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;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.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:oL.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){we(t,this.createData());const s=t.ot===Ct.INIT||t.ot===Ct.VIDEO||t.ot===Ct.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={}),GL(e.headers,t,n)):e.url=WL(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,s;const{index:r,fragment:n}=e,a=(t=this.hls.levels[n.level])==null||(s=t.details)==null?void 0:s.partList;if(a){const{sn:o}=n;for(let l=a.length-1;l>=0;l--){const d=a[l];if(d.index===r&&d.fragment.sn===o)return a[l+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Ct.TIMED_TEXT;if(e.sn==="initSegment")return Ct.INIT;if(t==="audio")return Ct.AUDIO;if(t==="main")return this.hls.audioTracks.length?Ct.VIDEO:Ct.MUXED}getTopBandwidth(e){let t=0,s;const r=this.hls;if(e===Ct.AUDIO)s=r.audioTracks;else{const n=r.maxAutoLevel,a=n>-1?n+1:r.levels.length;s=r.levels.slice(0,a)}
48return s.forEach(n=>{n.bitrate>t&&(t=n.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,s=e===Ct.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:le.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 YL=3e5;class jL extends yi{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(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.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)}startLoad(){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==null?void 0:s.action)===kt.SendAlternateToPenaltyBox&&s.flags===hi.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===w.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: ${qe(n)} penalized: ${qe(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();
vendor: 4,390 bytes, line 48
48Object.keys(s).forEach(n=>{r-s[n]>YL&&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,lE(t),this.hls.trigger(E.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===ge.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===ge.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 ze(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=FE(u.uri,c["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),p=new uo({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 g=1;g<u.audioGroups.length;g++)p.addGroupId("audio",`${u.audioGroups[g]}_clone_${a}`);if(u.subtitleGroups)for(let g=1;g<u.subtitleGroups.length;g++)p.addGroupId("text",`${u.subtitleGroups[g]}_clone_${a}`);return p});t.push(...d),Ag(this.audioTracks,s,l,a),Ag(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==null?void 0:m.VERSION)!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;const{"RELOAD-URI":p,"PATHWAY-CLONES":g,"PATHWAY-PRIORITY":v}=m;if(p)try{this.uri=new self.URL(p,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${p}`);return}this.scheduleRefresh(this.uri||h.url),g&&this.clonePathways(g);const T={steeringManifest:m,url:r.toString()};this.hls.trigger(E.STEERING_MANIFEST_LOADED,T),v&&this.updatePathwayPriority(v)},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 p=this.loader;if(typeof(p==null?void 0:p.getResponseHeader)=="function"){const g=p.getResponseHeader("Retry-After");g&&(m=parseFloat(g)*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 Ag(i,e,t,s){i&&Object.keys(e).forEach(r=>{const n=i.filter(a=>a.groupId===r).map(a=>{const o=we({},a);return o.details=void 0,o.attrs=new ze(o.attrs),o.url=o.attrs.URI=FE(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 FE(i,e,t,s){const{HOST:r,PARAMS:n,[t]:a}=s;let o;e&&(o=a==null?void 0:a[e],o&&(i=o));const l=new self.URL(i);
48return r&&!o&&(l.host=r),n&&Object.keys(n).sort().forEach(d=>{d&&l.searchParams.set(d,n[d])}),l.href}function ii(i,e,t){gi(i,e,t),i.addEventListener(e,t)}function gi(i,e,t){i.removeEventListener(e,t)}class wn extends yi{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=wn.CDMCleanupPromise?[wn.CDMCleanupPromise]:[],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.onWaitingForKey=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(E.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(E.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===et.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 jt?o(c):o(new jt({type:te.KEY_SYSTEM_ERROR,details:w.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 tE===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){const r=$1(e,t,s,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let a=n==null?void 0:n.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${qe(r)}`),a=this.requestMediaKeySystemAccess(e,r);const o=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),a.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const d=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=l.createMediaKeys().then(u=>(this.log(`Media-keys created for "${e}"`),o.hasMediaKeys=!0,d.then(c=>c?this.setMediaKeysServerCertificate(u,e,c):u))),o.mediaKeys.catch(u=>{this.error(`Failed to create media-keys for "${e}"}: ${u}`)}),o.mediaKeys})}return a.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${Ar.hexDump(e.keyId||[])}`);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=this.getKeyIdString(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)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return Ar.hexDump(e.keyId)}updateKeySession(e,t){var s;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${Ar.hexDump(((s=e.decryptdata)==null?void 0:s.keyId)||[])}
49      } (data length: ${t&&t.byteLength})`),r.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>zp(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=zp(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=El(this.config),s=e.map(Gc).filter(r=>!!r&&t.indexOf(r)!==-1);return this.selectKeySystem(s)}loadKey(e){const t=e.keyInfo.decryptdata,s=this.getKeyIdString(t),r=`(keyId: ${s} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[s];return n||(n=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:l})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(o,l).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:o,mediaKeys:l,decryptdata:t}))))),(this.keyIdToKeySessionPromise[s]=n.then(o=>{const l="cenc",d=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(o,l,d,"playlist-key")}
vendor: 5,196 bytes, line 49
49)).catch(o=>this.handleError(o))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof jt?this.hls.trigger(E.ERROR,e.data):this.hls.trigger(E.ERROR,{type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),s=this.keyIdToKeySessionPromise[t];if(!s){const r=Gc(e.keyFormat),n=r?[r]:El(this.config);return this.attemptKeySystemAccess(n)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=El(this.config)),e.length===0)throw new jt({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${qe({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(s).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});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,a;const o=(n=this.config.drmSystems)==null||(a=n[e.keySystem])==null?void 0:a.generateRequest;if(o)try{const m=o.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){var l;if(this.warn(m.message),(l=this.hls)!=null&&l.config.debug)throw m}if(s===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const d=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${d} (init data type: ${t} length: ${s?s.byteLength:null})`);const u=new Ff,c=e._onmessage=m=>{const p=e.mediaKeysSession;if(!p){u.emit("error",new Error("invalid state"));return}const{messageType:g,message:v}=m;this.log(`"${g}" message event for session "${p.sessionId}" message size: ${v.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,v).catch(T=>{u.eventNames().length?u.emit("error",T):this.handleError(T)}):g==="license-release"?e.keySystem===et.FAIRPLAY&&(this.updateKeySession(e,Hc("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${g}"`)},h=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const g=e.keyStatus;u.emit("keyStatus",g),g==="expired"&&(this.warn(`${e.keySystem} expired for key ${d}`),this.renewKeySession(e))};ii(e.mediaKeysSession,"message",c),ii(e.mediaKeysSession,"keystatuseschange",h);const f=new Promise((m,p)=>{u.on("error",p),u.on("keyStatus",g=>{g.startsWith("usable")?m():g==="output-restricted"?p(new jt({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):g==="internal-error"?p(new jt({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${g}"`)):g==="expired"?p(new Error("key expired while generating request")):this.warn(`unhandled key status change "${g}"`)})});return e.mediaKeysSession.generateRequest(t,s).then(()=>{var m;this.log(`Request generated for key-session "${(m=e.mediaKeysSession)==null?void 0:m.sessionId}" keyId: ${d}`)}).catch(m=>{throw new jt({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_SESSION,error:m,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>f).catch(m=>{throw u.removeAllListeners(),this.removeSession(e),m}).then(()=>(u.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,s)=>{if(typeof s=="string"&&typeof t=="object"){const r=s;s=t,t=r}this.log(`key status change "${t}" for keyStatuses keyId: ${Ar.hexDump("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${Ar.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=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,p)=>{a(h.data)},onError:(h,f,m,p)=>{o(new jt({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:Me({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${n}). Status: ${h.code} (${h.text})`))},onTimeout:(h,f,m)=>{o(new jt({type:te.KEY_SYSTEM_ERROR,details:w.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()}
vendor: 4,268 bytes, line 49
49setMediaKeysServerCertificate(e,t,s){return new Promise((r,n)=>{e.setServerCertificate(s).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${s==null?void 0:s.byteLength}) on "${t}"`),r(e)}).catch(a=>{n(new jt({type:te.KEY_SYSTEM_ERROR,details:w.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 jt({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},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==null?void 0:l.textContent;if(!d)throw new Error("Cannot find <Challenge> in key message");return Hc(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 jt({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_LICENSE_REQUEST_FAILED,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==et.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(l,d)),l.send(d)})})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,ii(s,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(gi(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,s=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,mu.clearKeyUriToKeyIdMap();const r=s.length;wn.CDMCleanupPromise=Promise.all(s.map(n=>this.removeSession(n)).concat(t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(n=>{var a;this.log(`Could not clear media keys: ${n}`),(a=this.hls)==null||a.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${n}`)})}))).catch(n=>{var a;this.log(`Could not close sessions and clear media keys: ${n}`),(a=this.hls)==null||a.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media ke
49ys: ${n}`)})}).then(()=>{r&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null}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}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{drmSystemOptions:n}=this.config;return(H1(n)?new Promise((o,l)=>{self.setTimeout(()=>l(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(o)}):Promise.resolve()).catch(o=>{var l;this.log(`Could not remove session: ${o}`),(l=this.hls)==null||l.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${o}`)})}).then(()=>t.close()).catch(o=>{var l;this.log(`Could not close session: ${o}`),(l=this.hls)==null||l.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${o}`)})})}}}wn.CDMCleanupPromise=void 0;class jt 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}}class zL{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(E.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(E.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(E.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 $E(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 Ln(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 Qc(i,e,t,s){const r=i.mode;if(r==="disabled"&&(i.mode="hidden"),i.cues&&i.cues.length>0){const n=XL(i.cues,e,t);for(let a=0;a<n.length;
vendor: 8,659 bytes, line 49
49a++)(!s||s(n[a]))&&i.removeCue(n[a])}r==="disabled"&&(i.mode=r)}function QL(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 XL(i,e,t){const s=[],r=QL(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 _l(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 ZL extends Wf{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=_l(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(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.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;_l(s.textTracks).forEach(a=>{Ln(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==null?void 0: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==null?void 0:r.length)!==(s==null?void 0:s.length)||s!=null&&s.some(a=>(r==null?void 0: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=Hi(o,a);if(u>-1)n=a[u];else{const c=Hi(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==null?void 0:s.join(",")}" group-id`),this.hls.trigger(E.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||Mr(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(po(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(po(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(Yc(r,e))return s}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ge.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&&Mr(e,s))return s;const r=Hi(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(s)return null;{const n=Hi(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==null?void 0:a.age;this.log(`Loading subtitle ${s} "${e.name}" lang:${e.lang} group:${r}${(t==null?void 0: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(E.SUBTITLE_TRACK_LOADING,{url:n,id:s,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=_l(e.textTracks),s=this.currentTrack;let r;if(s&&(r=t.filter(n=>Yc(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||!q(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(E.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(E.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:d,url:u});const c=this.switchParams(r.url,s==null?void 0:s.details,r.details);this.loadPlaylist(c)}}function JL(){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 Xa(i){let e=5381,t=i.length;for(;t;
vendor: 4,228 bytes, line 49
49)e=e*33^i.charCodeAt(--t);return(e>>>0).toString()}const Mn=.025;let Gd=function(i){return i[i.Point=0]="Point",i[i.Range=1]="Range",i}({});function eR(i,e,t){return`${i.identifier}-${t+1}-${Xa(e)}`}class tR{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 sc(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=sc(t,e);return t-s<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=q(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 sc(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)<Mn))}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"?Gd.Range:Gd.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 iR(this)}}function sc(i,e){return i-e.start<e.duration/2&&!(Math.abs(i-(e.start+e.duration))<Mn)?e.start:e.start+e.duration}function HE(i,e,t){const s=new self.URL(i,t);return s.protocol!=="data:"&&s.searchParams.set("_HLS_primary_id",e),s}function rc(i,e){for(;(t=i.assetList[++e])!=null&&t.error;)var t;return e}function iR(i){return`["${i.identifier}" ${i.cue.pre?"<pre>":i.cue.post?"<post>":""}${i.timelineStart.toFixed(2)}-${i.resumeTime.toFixed(2)}]`}function an(i){const e=i.timelineStart,t=i.duration||0;return`["${i.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class sR{constructor(e,t,s,r){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetail
49s=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls.trigger(E.PLAYOUT_LIMIT_REACHED,{})};const n=this.hls=new e(t);this.interstitial=s,this.assetItem=r;let a=r.uri;try{a=HE(a,t.primarySessionId).href}catch{}n.loadSource(a);const o=()=>{this.hasDetails=!0};n.once(E.LEVEL_LOADED,o),n.once(E.AUDIO_TRACK_LOADED,o),n.once(E.SUBTITLE_TRACK_LOADED,o),n.on(E.MEDIA_ATTACHING,(l,{media:d})=>{this.removeMediaListeners(),this.mediaAttached=d,this.interstitial.playoutLimit&&(d.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(E.BUFFER_APPENDED,()=>{const c=this.bufferedEnd;this.reachedPlayout(c)&&(this._bufferedEosTime=c,n.trigger(E.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){var e;return((e=this.interstitial)==null?void 0:e.appendInPlace)||!1}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const s=this.timelineOffset,r=le.bufferInfo(e,s,0);return this.getAssetTime(r.end)>=this._bufferedEosTime-.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=le.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;return e||0}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){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.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){this.hls.attachMedia(e)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}resetDetails(){const e=this.hls;if(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){this.hls.on(e,t)}once(e,t,s){this.hls.once(e,t)}off(e,t,s){this.hls.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${an(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Sg=.033;class rR extends yi{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={},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.i
vendor: 36,415 bytes, lines 49-50
49dentifier);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))return n}}return 0}get assetIdAtEnd(){var e,t;const s=(e=this.items)==null||(t=e[this.length-1])==null?void 0:t.event;if(s){const r=s.assetList,n=r[r.length-1];if(n)return n.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 p=d.startTime,g=u.startTime;if(p!==g)return p-g}return d.dateRange.tagOrder-u.dateRange.tagOrder}),this.events=a,l.forEach(d=>{this.removeEvent(d)}),this.updateSchedule(e,l)}updateSchedule(e,t=[]){const s=this.events||[];if(s.length||t.length||this.length<2){const r=this.items,n=this.parseSchedule(s,e);(t.length||(r==null?void 0:r.length)!==n.length||n.some((o,l)=>Math.abs(o.playout.start-r[l].playout.start)>.005||Math.abs(o.playout.end-r[l].playout.end)>.005))&&(this.items=n,this.onScheduleUpdate(t,r))}}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 tR(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,p=u.appendInPlace,g=f?n:u.startOffset,v=u.duration,T=u.timelineOccupancy===Gd.Range?v:0,y=u.resumptionOffset,_=(m==null?void 0:m.startTime)===g,I=g+u.cumulativeDuration;let x=p?I+v:g+y;if(h||!f&&g<=0){const A=d;d+=T,u.timelineStart=I;const R=a;a+=v,s.push({event:u,start:I,end:x,playout:{start:R,end:a},integrated:{start:A,end:d}})}else if(g<=n){if(!_){const S=g-l;if(S>Sg){const k=l,O=d;d+=S;const G=a;a+=S;const V={previousEvent:e[c-1]||null,nextEvent:u,start:k,end:k+S,playout:{start:G,end:a},integrated:{start:O,end:d}};s.push(V)}else S>0&&m&&(m.cumulativeDuration+=S,s[s.length-1].end=g)}f&&(x=I),u.timelineStart=I;const A=d;d+=T;const R=a;a+=v,s.push({event:u,start:I,end:x,playout:{start:R,end:a},integrated:{start:A,end:d}})}else return;const L=u.resumeTime;f||L>n?l=n:l=L}),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=Br(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<Sg&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const f=q(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)>Mn?(this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${r}`),!1):t?!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=Br(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)<Mn+u||Math.abs(d.end-s)<Mn+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)}):(this.log(`"${e.identifier}" resumption ${s} can not be aligned with media (none selected)`),!1)}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let s=0,r=!1,n=!1;e.assetList.forEach((a,o)=>{const l=t+s;a.startOffset=s,a.timelineStart=l,r||(r=a.duration===null),n||(n=!!a.error);const d=a.error?0:a.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 ys(i){return`[${i.event?'"'+i.event.identifier+'"':"primary"}: ${i.start.toFixed(2)}-${i.end.toFixed(2)}]`}class nR{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const s=e.assetListUrl;let r;try{r=HE(s,this.hls.sessionId,e.baseUrl)}catch(h){const f=this.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,h,s);this.hls.trigger(E.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,p)=>{const g=h.data,v=g==null?void 0:g.ASSETS;if(!Array.isArray(v)){const T=this.assignAssetListError(e,w.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),m.url,f,p);this.hls.trigger(E.ERROR,T);return}e.assetListResponse=g,this.hls.trigger(E.ASSET_LIST_LOADED,{event:e,assetListResponse:g,networkDetails:p})},onError:(h,f,m,p)=>{const g=this.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${h.code} ${h.text} (${f.url})`),f.url,p,m);this.hls.trigger(E.ERROR,g)},onTimeout:(h,f,m)=>{const p=this.assignAssetListError(e,w.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${f.url})`),f.url,h,m);this.hls.trigger(E.ERROR,p)}};return o.load(l,u,c),this.hls.trigger(E.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,s,r,n,a){return e.error=s,{type:te.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:s,networkDetails:a,stats:n}}}function Ig(i){i==null||i.play().catch(()=>{})}class aR extends yi{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)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(),this.checkBuffer(),a&&s<o.start||s>=o.end){var l;const h=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(o)&&(l=this.media)!=null&&l.paused&&(this.shouldPlay=!1),!a){const f=this.findItemIndex(o);if(h>f){const m=this.schedule.findJumpRestrictedIndex(f+1,h);if(m>f){this.setSchedulePosition(m);return}}}this.setSchedulePosition(h);return}const d=this.playingAsset;if(!d){if(this.playingLastItem&&this.isInterstitial(o)){const h=o.event.assetList[0];h&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,h))}return}const u=d.timelineStart,c=d.duration||0;(a&&s<u||s>=u+c)&&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,a=this.playingItem,o=n.events||[],l=n.items||[],d=n.durations,u=s.map(m=>m.identifier),c=!!(o.length||u.length);(c||r)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
50Schedule: ${l.map(m=>ys(m))} pos: ${this.timelinePos}`),u.length&&this.log(`Removed events ${u}`),this.playerQueue.forEach(m=>{if(m.interstitial.appendInPlace){const p=m.assetItem.timelineStart,g=m.timelineOffset-p;if(g)try{m.timelineOffset=p}catch(v){Math.abs(g)>Mn&&this.warn(`${v} ("${m.assetId}" ${m.timelineOffset}->${p})`)}}});let h=null;if(a){const m=this.updateItem(a,this.timelinePos);this.itemsMatch(a,m)&&(this.playingItem=m,this.waitingItem=this.endedItem=null,h=()=>this.trimInPlace(m,a))}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const f=this.bufferingItem;if(f){const m=this.updateItem(f,this.bufferedPos);this.itemsMatch(f,m)?(this.bufferingItem=m,h||(h=()=>this.trimInPlace(m,f))):f.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(f.event,null))}if(s.forEach(m=>{m.assetList.forEach(p=>{this.clearAssetPlayer(p.identifier,null)})}),c||r){if(this.hls.trigger(E.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}h&&h(),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new nR(e),this.schedule=new rR(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(E.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(E.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(E.MEDIA_ENDED,this.onMediaEnded,this),e.on(E.ERROR,this.onError,this),e.on(E.DESTROYING,this.onDestroying,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(E.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(E.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(E.MEDIA_ENDED,this.onMediaEnded,this),e.off(E.ERROR,this.onError,this),e.off(E.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.manager=null,this.hls=this.HlsPlayerClass=this.schedule=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){gi(e,"play",this.onPlay),gi(e,"pause",this.onPause),gi(e,"seeking",this.onSeeking),gi(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const s=this.media=t.media;ii(s,"seeking",this.onSeeking),ii(s,"timeupdate",this.onTimeupdate),ii(s,"play",this.onPlay),ii(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.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.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,n.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const e=this,t=()=>e.bufferingItem||e.waitingItem,s=c=>c&&e.getAssetPlayer(c.identifier),r=(c,h,f,m,p)=>{if(c){let g=c[h].start;const v=c.event;if(v){if(h==="playout"||v.timelineOccupancy!==Gd.Point){const T=s(f);(T==null?void 0:T.interstitial)===v&&(g+=T.assetItem.startOffset+T[p])}}else{const T=m==="bufferedPos"?a():e[m];g+=T-c.start}return g}return 0},n=(c,h)=>{if(c!==0&&h!=="primary"&&e.schedule.length){var f;const m=e.schedule.findItemIndexAtTime(c),p=(f=e.schedule.items)==null?void 0:f[m];if(p){const g=p[h].start-p.start;return c+g}}return c},a=()=>{const c=e.bufferedPos;return c===Number.MAX_VALUE?o("primary"):Math.max(c,0)},o=c=>{var h;return(h=e.primaryDetails)!=null&&h.live?e.primaryDetails.edge:e.schedule.durations[c]},l=(c,h)=>{var f,m;const p=e.effectivePlayingItem;if(p!=null&&(f=p.event)!=null&&f.restrictions.skip)return;e.log(`seek to ${c} "${h}"`);const g=e.effectivePlayingItem,v=e.schedule.findItemIndexAtTime(c,h),T=(m=e.schedule.items)==null?void 0:m[v],y=e.getBufferingPlayer(),_=y==null?void 0:y.interstitial,I=_==null?void 0:_.appendInPlace,x=g&&e.itemsMatch(g,T);if(g&&(I||x)){const A=s(e.playingAsset),R=(A==null?void 0:A.media)||e.primaryMedia;if(R){const S=h==="primary"?R.currentTime:r(g,h,e.playingAsset,"timelinePos","currentTime"),k=c-S,O=(I?S:R.currentTime)+k;if(O>=0&&(!A||I||O<=A.duration)){R.currentTime=O;return}}}if(T){let A=c;if(h!=="primary"){const S=T[h].start,k=c-S;A=T.start+k}const R=!e.isInterstitial(T);if((!e.isInterstitial(g)||g.event.appendInPlace)&&(R||T.event.appendInPlace)){const S=e.media||(I?y==null?void 0:y.media:null);S&&(S.currentTime=A)}else if(g){const S=e.findItemIndex(g);if(v>S){const O=e.schedule.findJumpRestrictedIndex(S+1,v);if(O>S){e.setSchedulePosition(O);return}}let k=0;if(R)e.timelinePos=A,e.checkBuffer();else{var L;const O=T==null||(L=T.event)==null?void 0:L.assetList;if(O){const G=c-(T[h]||T).start;for(let V=O.length;V--;){const B=O[V];if(B.duration&&G>=B.startOffset&&G<B.startOffset+B.duration){k=V;break}}}}e.setSchedulePosition(v,k)}}},d=()=>{const c=e.effectivePlayingItem;if(e.isInterstitial(c))return c;const h=t();return e.isInterstitial(h)?h:null},u={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()}};this.manager={get events(){var c,h;return((c=e.schedule)==null||(h=c.events)==null?void 0:h.slice(0))||[]},get schedule(){var c,h;return((c=e.schedule)==null||(h=c.items)==null?void 0:h.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==null?void 0: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)}}}}return this.manager}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,s;if(this.mediaSelection===null)return;const r=this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&!r.event.appendInPlace)return;let n=this.media;!n&&(e=this.bufferingItem)!=null&&(t=e.event)!=null&&t.appendInPlace&&(n=this.primaryMedia);const a=(s=n)==null?void 0:s.currentTime;if(!(a===void 0||!q(a)))return a}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} ${qe(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";else if(d){const f=this.getBufferingPlayer();f?(n=f.transferMedia(),u=`${f}`):u="detached MediaSource"}else u="detached media";if(!n){if(d)n=this.detachedData,this.log(`using detachedData: MediaSource ${qe(n)}`);else if(!this.detachedData||a.media===t){const f=this.playerQueue;f.length>1&&f.forEach(m=>{if(o&&m.interstitial.appendInPlace!==l){const p=m.interstitial;this.clearInterstitial(m.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;if(this.log(`${c?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${u}`),h===n){const f=o&&e.assetId===this.schedule.assetIdAtEnd;h.overrides={duration:this.schedule.duration,endOfStream:!o||f,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.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)}}advanceAfterAssetEnded(e,t,s){const r=rc(e,s);if(!e.isAssetPastPlayoutLimit(r))this.setSchedulePosition(t,r);else{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.timelinePos=l,this.checkBuffer()),this.setSchedulePosition(a)}}}setScheduleToAssetAtTime(e,t){const s=this.schedule,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){const s=this.schedule.items;if(!s||this.playbackDisabled)return;this.log(`setSchedulePosition ${e}, ${t}`);const r=e>=0?s[e]:null,n=this.playingItem,a=this.playingLastItem;if(this.isInterstitial(n)){var o;const d=n.event,u=this.playingAsset,c=u==null?void 0:u.identifier,h=c?this.getAssetPlayer(c):null;if(h&&c&&(!this.eventItemsMatch(n,r)||t!==void 0&&c!==((o=d.assetList)==null?void 0:o[t].identifier))){var l;const f=d.findAssetIndex(u);if(this.log(`INTERSTITIAL_ASSET_ENDED ${f+1}/${d.assetList.length} ${an(u)}`),this.endedAsset=u,this.playingAsset=null,this.hls.trigger(E.INTERSTITIAL_ASSET_ENDED,{asset:u,assetListIndex:f,event:d,schedule:s.slice(0),scheduleIndex:e,player:h}),n!==this.playingItem){this.itemsMatch(n,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(d,this.findItemIndex(this.playingItem),f);return}this.retreiveMediaSource(c,r),h.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&h.detachMedia()}if(!this.eventItemsMatch(n,r)&&(this.endedItem=n,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${d} ${ys(n)}`),d.hasPlayed=!0,this.hls.trigger(E.INTERSTITIAL_ENDED,{event:d,schedule:s.slice(0),scheduleIndex:e}),d.cue.once)){this.updateSchedule();const f=this.schedule.items;if(r&&f){const m=this.findItemIndex(r);this.advanceSchedule(m,f,t,n,a)}return}}this.advanceSchedule(e,s,t,n,a)}advanceSchedule(e,t,s,r,n){const a=e>=0?t[e]:null,o=this.primaryMedia,l=this.playerQueue;if(l.length&&l.forEach(d=>{const u=d.interstitial,c=this.schedule.findEventIndex(u.identifier);(c<e||c>e+1)&&this.clearInterstitial(u,a)}),this.isInterstitial(a)){this.timelinePos=Math.min(Math.max(this.timelinePos,a.start),a.end);const d=a.event;if(s===void 0){s=this.schedule.findAssetIndex(d,this.timelinePos);const f=rc(d,s-1);if(d.isAssetPastPlayoutLimit(f)){this.advanceAfterAssetEnded(d,e,s);return}s=f}const u=this.waitingItem;this.assetsBuffered(a,o)||this.setBufferingItem(a);let c=this.preloadAssets(d,s);if(this.eventItemsMatch(a,u||r)||(this.waitingItem=a,this.log(`INTERSTITIAL_STARTED ${ys(a)} ${d.appendInPlace?"append in place":""}`),this.hls.trigger(E.INTERSTITIAL_STARTED,{event:d,schedule:t.slice(0),scheduleIndex:e})),!d.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${d}`);return}if(d.assetListLoader&&(d.assetListLoader.destroy(),d.assetListLoader=void 0),!o){this.log(`Waiting for attachMedia to start Interstitial ${d}`);return}this.waitingItem=this.endedItem=null,this.playingItem=a;const h=d.assetList[s];if(!h){const f=t[e+1],m=this.media;f&&m&&!this.isInterstitial(f)&&m.currentTime<f.start&&(m.currentTime=this.timelinePos=f.start),this.advanceAfterAssetEnded(d,e,s||0);return}if(c||(c=this.getAssetPlayer(h.identifier)),c===null||c.destroyed){const f=d.assetList.length;this.warn(`asset ${s+1}/${f} player destroyed ${d}`),c=this.createAssetPlayer(d,h,s)}if(!this.eventItemsMatch(a,this.bufferingItem)&&d.appendInPlace&&this.isAssetBuffered(h))return;this.startAssetPlayer(c,s,t,e,o),this.shouldPlay&&Ig(c.media)}else a!==null?(this.resumePrimary(a,e,r),this.shouldPlay&&Ig(this.hls.media)):n&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e,t;return(e=this.mediaSelection)==null||(t=e.main)==null?void 0:t.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,s){var r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${ys(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let a=this.timelinePos;(a<e.start||a>=e.end)&&(a=this.getPrimaryResumption(e,t),this.timelinePos=a),this.attachPrimary(a,e)}if(!s)return;const n=this.schedule.items;n&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${ys(e)}`),this.hls.trigger(E.INTERSTITIALS_PRIMARY_RESUMED,{schedule:n.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:le.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.timelinePos=e,this.startLoadingPrimaryAt(e,s))}startLoadingPrimaryAt(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(){this.stopLoad(),this.schedule.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(E.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(E.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1)return;const s=this.hls.levels[t.level],r=Me(Me({},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=Me(Me({},this.altSelection),{},{audio:s});return}const n=Me(Me({},r),{},{audio:s});this.mediaSelection=n}onSubtitleTrackUpdated(e,t){const s=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=Me(Me({},this.altSelection),{},{subtitles:s});return}const n=Me(Me({},r),{},{subtitles:s});this.mediaSelection=n}onAudioTrackSwitching(e,t){const s=Np(t);this.playerQueue.forEach(r=>r.hls.setAudioOption(t)||r.hls.setAudioOption(s))}onSubtitleTrackSwitch(e,t){const s=Np(t);this.playerQueue.forEach(r=>r.hls.setSubtitleOption(t)||t.id!==-1&&r.hls.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){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){const s=this.schedule.items;if(e&&s){const r=this.findItemIndex(e,t);return s[r]||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=le.bufferInfo(this.primaryMedia,s,0);(r.end>s||(r.nextStart||0)>s)&&(this.attachPrimary(s,null),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.findItemIndex(e,t):-1}updateSchedule(){const e=this.mediaSelection;e&&this.schedule.updateSchedule(e,[])}checkBuffer(e){const t=this.schedule.items;if(!t)return;const s=le.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=s.len<1),this.updateBufferedPos(s.end,t,e)}updateBufferedPos(e,t,s){const r=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e)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,u;const c=this.findItemIndex(n),h=Math.min(c+1,t.length-1),f=t[h];if((l===-1&&n&&e>=n.end||(d=f.event)!=null&&d.appendInPlace&&e+.01>=f.start)&&(l=h),h-o>1&&(n==null||(u=n.event)==null?void 0:u.appendInPlace)===!1)return;if(this.bufferedPos=e,l>c&&l>o)this.bufferedToItem(f);else{const m=this.primaryDetails;this.primaryLive&&m&&e>m.edge-m.targetduration&&f.start<m.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(f)&&this.preloadAssets(f.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))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:r,events:n}=s;if(!r||!n)return t;const 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;this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${ys(e)}`+(t?` (${l.toFixed(2)} remaining)`:"")),this.playbackDisabled||(a?e.event.assetList.forEach(d=>{const u=this.getAssetPlayer(d.identifier);u&&u.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(d=>d.pauseBuffering()))),this.hls.trigger(E.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}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=s.assetList[t],l=this.primaryMedia;o&&l&&this.bufferAssetPlayer(a,l)}}}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 l=t;l<r;l++){const d=e.assetList[l],u=this.getAssetPlayerQueueIndex(d.identifier);(u===-1||this.playerQueue[u].destroyed)&&!d.error&&this.createAssetPlayer(e,d,l)}return this.getAssetPlayer(e.assetList[t].identifier)}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(E.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:eR(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=we({},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 y=this.timelinePos-t.timelineStart;if(y>1){const _=t.duration;_&&y<_&&(u=y)}}const c=t.identifier,h=Me(Me({},n),{},{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=we({},f,{contentId:Xa(t.uri)})),this.getAssetPlayer(c)&&this.warn(`Duplicate date range identifier ${e} and asset ${c}`);const m=new sR(this.HlsPlayerClass,h,e,t);this.playerQueue.push(m),e.assetList[s]=t;const p=y=>{if(y.live){const x=new Error(`Interstitials MUST be VOD assets ${e}`),L={fatal:!0,type:te.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ER
50ROR,error:x};this.handleAssetItemError(L,e,this.schedule.findEventIndex(e.identifier),s,x.message);return}const _=y.edge-y.fragmentStart,I=t.duration;(I===null||_>I)&&(this.log(`Interstitial asset "${c}" duration change ${I} > ${_}`),t.duration=_,this.updateSchedule())};m.on(E.LEVEL_UPDATED,(y,{details:_})=>p(_)),m.on(E.LEVEL_PTS_UPDATED,(y,{details:_})=>p(_));const g=(y,_)=>{const I=this.getAssetPlayer(c);if(I&&_.tracks){I.off(E.BUFFER_CODECS,g),I.tracks=_.tracks;const x=this.primaryMedia;this.bufferingAsset===I.assetItem&&x&&!I.media&&this.bufferAssetPlayer(I,x)}};m.on(E.BUFFER_CODECS,g);const v=()=>{var y;const _=this.getAssetPlayer(c);if(this.log(`buffered to end of asset ${_}`),!_)return;const I=this.schedule.findEventIndex(e.identifier),x=(y=this.schedule.items)==null?void 0:y[I];if(this.isInterstitial(x)){const A=e.findAssetIndex(t),R=rc(e,A);if(!e.isAssetPastPlayoutLimit(R))this.bufferedToItem(x,R);else{var L;const S=(L=this.schedule.items)==null?void 0:L[I+1];S&&this.bufferedToItem(S)}}};m.on(E.BUFFERED_TO_END,v);const T=y=>()=>{if(!this.getAssetPlayer(c))return;this.shouldPlay=!0;const I=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,I,y)};return m.once(E.MEDIA_ENDED,T(s)),m.once(E.PLAYOUT_LIMIT_REACHED,T(1/0)),m.on(E.ERROR,(y,_)=>{const I=this.getAssetPlayer(c);if(_.details===w.BUFFER_STALLED_ERROR){if(I!=null&&I.media){const x=I.currentTime,L=I.duration-x;x&&e.appendInPlace&&L/I.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${c} ${e} at ${I.media.currentTime}`),v()):(this.warn(`Stalled at ${x} of ${x+L} in asset ${c} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(_,e,this.schedule.findEventIndex(e.identifier),s,`Asset player error ${_.error} ${e}`)}),m.on(E.DESTROYING,()=>{if(!this.getAssetPlayer(c))return;const _=new Error(`Asset player destroyed unexpectedly ${c}`),I={fatal:!0,type:te.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:_};this.handleAssetItemError(I,e,this.schedule.findEventIndex(e.identifier),s,_.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${an(t)}`),this.hls.trigger(E.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:s,event:e,player:m}),m}clearInterstitial(e,t){e.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,t)}),e.reset()}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){this.log(`clear asset player "${e}" toSegment: ${t&&ys(t)}`);const r=this.playerQueue[s];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} ${an(o)}`),this.hls.trigger(E.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;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;this.setBufferingItem(l),this.bufferingAsset=a;const d=this.getBufferingPlayer();if(d===e)return;const u=n.appendInPlace;if(u&&(d==null?void 0:d.interstitial.appendInPlace)===!1)return;const c=(d==null?void 0:d.tracks)||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(u&&a!==this.playingAsset){if(!e.tracks)return;if(c&&!Pv(c,e.tracks)){const h=new Error(`Asset ${an(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(c)}')`),f={fatal:!0,type:te.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:h},m=n.findAssetIndex(a);this.handleAssetItemError(f,n,o,m,h.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,s,r,n){if(e.details===w.BUFFER_STALLED_ERROR)return;const a=t.assetList[r];this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&an(a)} ${e.error}`);const o=a==null?void 0:a.identifier,l=this.getAssetPlayerQueueIndex(o),d=this.playerQueue[l]||null,u=this.schedule.items,c=we({},e,{fatal:!1,errorAction:co(!0),asset:a,assetListIndex:r,event:t,schedule:u,scheduleIndex:s,player:d});if(this.hls.trigger(E.INTERSTITIAL_ASSET_ERROR,c),!e.fatal)return;const h=this.playingAsset,f=new Error(n);if(a&&(this.clearAssetPlayer(o,null),a.error=f),!t.assetList.some(m=>!m.error))t.error=f;else{for(let m=r;m<t.assetList.length;m++)this.resetAssetPlayer(t.assetList[m].identifier);this.updateSchedule()}t.error?this.primaryFallback(t):h&&h.identifier===o&&this.advanceAfterAssetEnded(t,s,r)}primaryFallback(e){const t=e.timelineStart,s=this.effectivePlayingItem;if(this.updateSchedule(),s){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${s?ys(s):"<none>"} error: ${e.error}`);let r=this.timelinePos;r===-1&&(r=this.hls.startPosition);const n=this.updateItem(s,r);this.itemsMatch(s,n)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));const a=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(a)}else this.checkStart()}onAssetListLoaded(e,t){var s;const r=t.event,n=r.identifier,a=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(n))return;const o=r.timelineStart,l=r.duration;let d=0;a.forEach((m,p)=>{const g=parseFloat(m.DURATION);this.createAsset(r,p,d,o+d,g,m.URI),d+=g}),r.duration=d,this.log(`Loaded asset-list with duration: ${d} (was: ${l}) ${r}`);
vendor: 34,560 bytes, lines 50-61
50const u=this.waitingItem,c=(u==null?void 0:u.event.identifier)===n;this.updateSchedule();const h=(s=this.bufferingItem)==null?void 0:s.event;if(c){var f;const m=this.schedule.findEventIndex(n),p=(f=this.schedule.items)==null?void 0:f[m];if(p){if(!this.playingItem&&this.timelinePos>p.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==m){r.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${r}`),this.primaryFallback(r);return}this.setBufferingItem(p)}this.setSchedulePosition(m)}else if((h==null?void 0:h.identifier)===n&&h.appendInPlace){const m=r.assetList[0],p=this.getAssetPlayer(m.identifier),g=this.primaryMedia;m&&p&&g&&this.bufferAssetPlayer(p,g)}}onError(e,t){switch(t.details){case w.ASSET_LIST_PARSING_ERROR:case w.ASSET_LIST_LOAD_ERROR:case w.ASSET_LIST_LOAD_TIMEOUT:{const s=t.interstitial;s&&this.primaryFallback(s);break}case w.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const Lg=500;class oR extends Uf{constructor(e,t,s){super(e,t,s,"subtitle-stream-controller",X.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(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=N.IDLE,this.setInterval(Lg),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)||(ot(s)&&(this.fragPrevious=s),this.state=N.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,X.SUBTITLE)}}onError(e,t){const s=t.frag;(s==null?void 0:s.type)===X.SUBTITLE&&(t.details===w.FRAG_GAP&&this.fragmentTracker.fragBuffered(s,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==N.STOPPED&&(this.state=N.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&CE(this.levels,t)){this.levels=t.map(s=>new uo(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const r=new uo(s);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,X.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!==N.STOPPED&&this.setInterval(Lg)}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?(Bd(a,c),d=a.fragmentStart):h&&(d=h.start,Vc(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,Vc(a,d))}c&&!this.startFragRequested&&this.setStartPosition(c,d)}l.details=a,this.levelLastLoaded=l,o===r&&(this.hls.trigger(E.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===N.IDLE&&(Br(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();this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer,Nf(r.method)).catch(o=>{throw n.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();n.trigger(E.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=N.IDLE})}}doTick(){if(!this.media){this.state=N.IDLE;return}if(this.state===N.IDLE){const{currentTrackId:e,levels:t}=this,s=t==null?void 0:t[e];if(!s||!t.length||!s.details||this.waitForLive(s))return;const{config:r}=this,n=this.getLoadPosition(),a=le.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 p=this.fragPrevious;if(o<f){const T=r.maxFragLookUpTolerance,y=o>f-T?0:T;m=Br(p,c,Math.max(c[0].start,o),y),!m&&p&&p.start<c[0].start&&(m=c[0])}else m=c[h-1];if(m=this.filterReplacedPrimary(m,s.details),!m)return;const g=m.sn-d.startSN,v=c[g-1];if(v&&v.cc===m.cc&&this.fragmentTracker.getState(v)===ft.NOT_LOADED&&(m=v),this.fragmentTracker.getState(m)===ft.NOT_LOADED){const T=this.mapToInitFragWhenRequired(m);T&&this.loadFragment(T,s,o)}}}loadFragment(e,t,s){ot(e)?super.loadFragment(e,t,s):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new lR(this.tracksBuffered[this.currentTrackId]||[])}}class lR{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 dR={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},GE=i=>String.fromCharCode(dR[i]||i),ui=15,Zi=100,uR={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},cR={17:2,18:4,21:6,22:8,23:10,19:13,20:15},hR={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},fR={25:2,26:4,29:6,30:8,31:10,27:13,28:15},mR=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class pR{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 ar=function(e){const t=[];for(let s=0;s<e.length;s++)t.push(e[s].toString(16));return t};class KE{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 gR{constructor(){this.uchar=" ",this.penState=new KE}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 vR{constructor(e){this.chars=[],this.pos=0,this.currPenState=new KE,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Zi;t++)this.chars.push(new gR);this.logger=e}equals(e){for(let t=0;t<Zi;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Zi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Zi;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>Zi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Zi)}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=GE(e);if(this.pos>=Zi){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<Zi;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<Zi;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 nc{constructor(e){this.rows=[],this.currRow=ui-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<ui;t++)this.rows.push(new vR(e));this.logger=e}reset(){for(let e=0;e<ui;e++)this.rows[e].clear();this.currRow=ui-1}equals(e){let t=!0;for(let s=0;s<ui;s++)if(!this.rows[s].equals(e.rows[s])){t=!1;break}return t}copy(e){for(let t=0;t<ui;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<ui;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 = "+qe(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<ui;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 = "+qe(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<ui;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(`
51`)),s}getTextAndFormat(){return this.rows}}class Rg{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 nc(s),this.nonDisplayedMemory=new nc(s),this.lastOutputScreen=new nc(s),this.currRollUpRow=this.displayedMemory.rows[ui-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[ui-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: "+qe(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 xg{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=yR(),this.logger=void 0;const r=this.logger=new pR;this.channels=[null,new Rg(e,t,r),new Rg(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,()=>"["+ar([t[s],t[s+1]])+"] -> ("+ar([r,n])+")");const l=this.cmdHistory;if(r>=16&&r<=31){if(ER(r,n,l)){jo(null,null,l),this.logger.log(3,()=>"Repeated command ("+ar([r,n])+") is dropped");continue}jo(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 jo(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 "+ar([r,n])+" orig: "+ar([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 ("+ar([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?uR[e]:hR[e]:s=a===1?cR[e]:fR[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 '"+GE(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 =  "+ar(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=mR[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()}jo(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 jo(i,e,t){t.a=i,t.b=e}function ER(i,e,t){return t.a===i&&t.b===e}function yR(){return{a:null,b:null}}var jf=function(){if($d!=null&&$d.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,p=l,g=d,v=null,T="",y=!0,_="auto",I="start",x=50,L="middle",A=50,R="middle";Object.defineProperty(u,"id",n({},c,{get:function(){return h},set:function(S){h=""+S}})),Object.defineProperty(u,"pauseOnExit",n({},c,{get:function(){return f},set:function(S){f=!!S}})),Object.defineProperty(u,"startTime",n({},c,{get:function(){return m},set:function(S){if(typeof S!="number")throw new TypeError("Start time must be set to a number.");m=S,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",n({},c,{get:function(){return p},set:function(S){if(typeof S!="number")throw new TypeError("End time must be set to a number.");p=S,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",n({},c,{get:function(){return g},set:function(S){g=""+S,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",n({},c,{get:function(){return v},set:function(S){v=S,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",n({},c,{get:function(){return T},set:function(S){const k=s(S);if(k===!1)throw new SyntaxError("An invalid or illegal string was specified.");T=k,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",n({},c,{get:function(){return y},set:function(S){y=!!S,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",n({},c,{get:function(){return _},set:function(S){if(typeof S!="number"&&S!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");_=S,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",n({},c,{get:function(){return I},set:function(S){const k=r(S);if(!k)throw new SyntaxError("An invalid or illegal string was specified.");I=k,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",n({},c,{get:function(){return x},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");x=S,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",n({},c,{get:function(){return L},set:function(S){const k=r(S);if(!k)throw new SyntaxError("An invalid or illegal string was specified.");L=k,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",n({},c,{get:function(){return A},set:function(S){if(S<0||S>100)throw new Error("Size must be between 0 and 100.");A=S,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",n({},c,{get:function(){return R},set:function(S){const k=r(S);if(!k)throw new SyntaxError("An invalid or illegal string was specified.");R=k,this.hasBeenReset=!0}})),u.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class TR{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function VE(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 bR{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 WE(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 Xc=new jf(0,0,""),zo=Xc.align==="middle"?"middle":"center";function _R(i,e,t){const s=i;function r(){const o=VE(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 bR;WE(o,function(h,f){let m;switch(h){case"region":for(let p=t.length-1;p>=0;p--)if(t[p].id===f){d.set(h,t[p].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",zo,"end"]);break;case"position":m=f.split(","),d.percent(h,m[0]),m.length===2&&d.alt("positionAlign",m[1],["start",zo,"end","line-left","line-right","auto"]);break;case"size":d.percent(h,f);break;case"align":d.alt(h,f,["start",zo,"end","left","right"]);break}},/:/,/\s/),l.region=d.get("region",null),l.vertical=d.get("vertical","");let u=d.get("line","auto");u==="auto"&&Xc.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",zo);let c=d.get("position","auto");c==="auto"&&Xc.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 qE(i){return i.replace(/<br(?: \/)?>/gi,`
52`)}class AR{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new TR,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=qE(n);a<n.length&&n[a]!=="\r"&&n[a]!==`
53`;)++a;const o=n.slice(0,a);return n[a]==="\r"&&++a,n[a]===`
54`&&++a,t.buffer=n.slice(a),o}function r(n){WE(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 jf(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{_R(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+=`
55`),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+=`
56
57`,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 SR=/\r\n|\n\r|\n|\r/g,ac=function(e,t,s=0){return e.slice(s,s+t.length)===t},IR=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(!q(t)||!q(s)||!q(r)||!q(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*r,t+=60*60*1e3*n,t};function zf(i,e,t){return Xa(i.toString())+Xa(e.toString())+Xa(t)}const LR=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 RR(i,e,t,s,r,n,a){const o=new AR,l=Vt(new Uint8Array(i)).trim().replace(SR,`
58`).split(`
59`),d=[],u=e?GI(e.baseTime,e.timescale):0;let c="00:00.000",h=0,f=0,m,p=!0;o.oncue=function(g){const v=t[s];let T=t.ccOffset;const y=(h-u)/9e4;if(v!=null&&v.new&&(f!==void 0?T=t.ccOffset=v.start:LR(t,s,y)),y){if(!e){m=new Error("Missing initPTS for VTT MPEGTS");return}T=y-t.presentationOffset}const _=g.endTime-g.startTime,I=Zt((g.startTime+T-f)*9e4,r*9e4)/9e4;g.startTime=Math.max(I,0),g.endTime=Math.max(I+_,0);const x=g.text.trim();g.text=decodeURIComponent(encodeURIComponent(x)),g.id||(g.id=zf(g.startTime,g.endTime,x)),g.endTime>0&&d.push(g)},o.onparsingerror=function(g){m=g},o.onflush=function(){if(m){a(m);return}n(d)},l.forEach(g=>{if(p)if(ac(g,"X-TIMESTAMP-MAP=")){p=!1,g.slice(16).split(",").forEach(v=>{ac(v,"LOCAL:")?c=v.slice(6):ac(v,"MPEGTS:")&&(h=parseInt(v.slice(7)))});try{f=IR(c)/1e3}catch(v){m=v}return}else g===""&&(p=!1);o.parse(g+`
60`)}),o.flush()}const oc="stpp.ttml.im1t",YE=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,jE=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,xR={left:"start",center:"center",right:"end",start:"start",end:"end"};function kg(i,e,t,s){const r=me(new Uint8Array(i),["mdat"]);if(r.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(o=>Vt(o)),a=HI(e.baseTime,1,e.timescale);try{n.forEach(o=>t(kR(o,a)))}catch(o){s(o)}}function kR(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=Dg(lc(r,"styling","style")),d=Dg(lc(r,"layout","region")),u=lc(r,"body","[begin]");return[].map.call(u,c=>{const h=zE(c,o);if(!h||!c.hasAttribute("begin"))return null;const f=uc(c.getAttribute("begin"),a),m=uc(c.getAttribute("dur"),a);let p=uc(c.getAttribute("end"),a);if(f===null)throw Cg(c);if(p===null){if(m===null)throw Cg(c);p=f+m}const g=new jf(f-e,p-e,h);g.id=zf(g.startTime,g.endTime,g.text);const v=d[c.getAttribute("region")],T=l[c.getAttribute("style")],y=DR(v,T,l),{textAlign:_}=y;if(_){const I=xR[_];I&&(g.lineAlign=I),g.align=_}return we(g,y),g}).filter(c=>c!==null)}function lc(i,e,t){const s=i.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function Dg(i){return i.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function zE(i,e){return[].slice.call(i.childNodes).reduce((t,s,r)=>{var n;return s.nodeName==="br"&&r?t+`
61`:(n=s.childNodes)!=null&&n.length?zE(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function DR(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=dc(e,s,l)||dc(i,s,l)||dc(r,s,l);return d&&(o[l]=d),o},{})}function dc(i,e,t){return i&&i.hasAttributeNS(e,t)?i.getAttributeNS(e,t):null}function Cg(i){return new Error(`Could not parse ttml timestamp ${i}`)}function uc(i,e){if(!i)return null;let t=VE(i);return t===null&&(YE.test(i)?t=CR(i,e):jE.test(i)&&(t=wR(i,e))),t}function CR(i,e){const t=YE.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 wR(i,e){const t=jE.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 Qo{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 MR{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=Mg(),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}}
vendor: 4,113 bytes, line 61
61,e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Qo(this,"textTrack1"),t=new Qo(this,"textTrack2"),s=new Qo(this,"textTrack3"),r=new Qo(this,"textTrack4");this.cea608Parser1=new xg(1,e,t),this.cea608Parser2=new xg(3,s,r)}addCues(e,t,s,r,n){let a=!1;for(let o=n.length;o--;){const l=n[o],d=PR(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(E.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:r,timescale:n}){const{unparsedVttFrags:a}=this;s===X.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:n}),a.length&&(this.unparsedVttFrags=[],a.forEach(o=>{this.initPTS[o.frag.cc]?this.onFragLoaded(E.FRAG_LOADED,o):this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:o.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(wg(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,Ln(s[e]),$E(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(E.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=>{Ln(r[n]),delete r[n]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Mg(),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++)Ln(t[s])}
vendor: 19,222 bytes, line 61
61onSubtitleTracksUpdated(e,t){const s=t.subtitleTracks||[],r=s.some(n=>n.textCodec===oc);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(CE(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const a=this.media,o=a?_l(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]&&wg(o[h],l)){c=o[h],o[h]=null;break}c&&(u=c)}if(u)Ln(u);else{const c=QE(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(E.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==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===X.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===X.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===oc?this._parseIMSC1(s,r):this._parseVTTs(t)}}else this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const s=this.hls;kg(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),s.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{s.logger.log(`Failed to parse IMSC1: ${r}`),s.trigger(E.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?si(s.initSegment.data,new Uint8Array(r)).buffer:r;RR(d,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,u=>{this._appendCues(u,s.level),l.trigger(E.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(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:u})})}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||kg(t,this.initPTS[e.cc],()=>{s.textCodec=oc,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(E.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:s}=t;s.type===X.SUBTITLE&&this.onFragLoaded(E.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===X.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=>Qc(o[l],t,s))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>Qc(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 QE(i){return i.characteristics&&/transcribes-spoken-dialog/gi.test(i.characteristics)&&/describes-music-and-sound/gi.test(i.characteristics)?"captions":"subtitles"}function wg(i,e){return!!i&&i.kind===QE(e)&&Yc(e,i)}function PR(i,e,t,s){return Math.min(e,s)-Math.max(i,t)}function Mg(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const OR=/\s/,NR={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 p=0;p<n.chars.length;p++)OR.test(n.chars[p].uchar)&&o?l++:(d+=n.chars[p].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const f=qE(d.trim()),m=zf(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 UR(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const FR=/(\d+)-(\d+)\/(\d+)/;class Pg{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||GR,this.controller=new self.AbortController,this.stats=new kf}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=$R(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&&q(l)?l:d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(mo(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:p,statusText:g}=c;throw new KR(g||"fetch, bad network response",p,c)}r.loading.first=f,r.total=HR(c.headers)||r.total;const m=(h=this.callbacks)==null?void 0:h.onProgress;return m&&q(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 p=c[o];p&&(r.loaded=r.total=p);const g={url:m.url,data:c,code:m.status},v=(h=this.callbacks)==null?void 0:h.onProgress;v&&!q(t.highWaterMark)&&v(r,e,c,m),(f=this.callbacks)==null||f.onSuccess(g,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)})}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 cE,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 $R(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(we({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function BR(i){const e=FR.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function HR(i){const e=i.get("Content-Range");if(e){const s=BR(e);if(q(s))return s}const t=i.get("Content-Length");if(t)return parseInt(t)}function GR(i,e){return new self.Request(i.url,e)}class KR extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const VR=/^age:\s*[\d.]+\s*$/im;class XE{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 kf,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&&q(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 p=t.responseType==="arraybuffer"?m.byteLength:m.length;s.loaded=s.total=p,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const g=(a=this.callbacks)==null?void 0:a.onProgress;g&&g(s,e,m,t);const v={url:t.responseURL,data:m,code:d};(o=this.callbacks)==null||o.onSuccess(v,s,e,t);return}}const c=n.loadPolicy.errorRetry,h=s.retry,f={url:e.url,data:void 0,code:d};if(Fd(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(Fd(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=Mf(e,s.retry),s.retry++,Le.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0: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&&VR.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 WR={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},qR=Me(Me({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:XE,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:m1,bufferController:sL,capLevelController:qf,errorController:y1,fpsController:zL,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:tE,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:WR},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},YR()),{},{subtitleStreamController:oR,subtitleTrackController:ZL,timelineController:MR,audioStreamController:JI,audioTrackController:eL,emeController:wn,cmcdController:qL,contentSteeringController:jL,interstitialsController:aR});function YR(){return{cueHandler:NR,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 jR(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=Zc(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=[];
vendor: 4,904 bytes, line 61
61n.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}": ${qe(e[o])}`)}),Me(Me({},s),e)}function Zc(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(Zc):Object.keys(i).reduce((e,t)=>(e[t]=Zc(i[t]),e),{}):i}function zR(i,e){const t=i.loader;t!==Pg&&t!==XE?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):UR()&&(i.loader=Pg,i.progressive=!0,i.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Al=2,QR=.1,XR=.05,ZR=100;class JR extends Xv{constructor(e,t){super("gap-controller",e.logger),this.hls=null,this.fragmentTracker=null,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(E.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.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(ZR),this.mediaSource=t.mediaSource;const s=this.media=t.media;ii(s,"playing",this.onMediaPlaying),ii(s,"waiting",this.onMediaWaiting),ii(s,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:s}=this;s&&(gi(s,"playing",this.onMediaPlaying),gi(s,"waiting",this.onMediaWaiting),gi(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(E.MEDIA_ENDED,{stalled:!1}));return}if(!le.getBuffered(a).length){this.nudgeRetry=0;return}const c=le.bufferInfo(a,e,0),h=c.nextStart||0,f=this.fragmentTracker;if(o&&f&&this.hls){const x=Og(this.hls.inFlightFragments,e),L=c.len>Al,A=!h||x||h-e>Al&&!f.getPartialFragment(e);if(L||A)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 L=Math.max(h,c.start||0)-e,R=!!(m!=null&&m.live)?m.targetduration*2:Al,S=f.getPartialFragment(e);if(L>0&&(L<=R||S)){a.paused||this._trySkipBufferHole(S);return}}const p=n.detectStallWithCurrentTimeMs,g=self.performance.now(),v=this.waiting;let T=this.stalled;if(T===null)if(v>0&&g-v<p)T=this.stalled=v;else{this.stalled=g;return}const y=g-T;if(!o&&(y>=p||v)&&this.hls){var _;if(((_=this.mediaSource)==null?void 0:_.readyState)==="ended"&&!(m!=null&&m.live)&&Math.abs(e-((m==null?void 0:m.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(E.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(c),!this.media||!this.hls)return}const I=le.bufferInfo(a,e,n.maxBufferHole);this._tryFixBufferStall(I,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(E.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var s;const r=this.buffered.video;
vendor: 27,723 bytes, line 61
61if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&r&&r.length>1&&e>r.end(0)){const n=le.bufferedInfo(le.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){const a=le.timeRangesToArray(r),o=le.bufferedInfo(a,t,0).bufferedIndex;if(o>-1&&o<a.length-1){const l=le.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;const h=this.fragmentTracker.getPartialFragment(e)||void 0,f=le.bufferInfo(this.media,e,0);this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.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=a.getPartialFragment(s);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,X.MAIN),a=s.getFragAtPos(r,X.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 (${qe(e)})`);this.warn(a.message),t.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.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=le.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 p=s.getAppendedFrag(0,X.MAIN);p&&l<p.end&&(m=!0)}if(!m){const p=e||s.getAppendedFrag(a,X.MAIN);if(p){var d;if(!((d=this.hls.loadLevelObj)!=null&&d.details)||Og(this.hls.inFlightFragments,l))return 0;let v=!1,T=p.end;for(;T<l;){const y=s.getAppendedFrag(T,X.MAIN)||s.getPartialFragment(T);if(y)T+=y.duration;else{v=!0;break}}if(v)return 0}}}const f=Math.max(l+XR,a+QR);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}`);this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:m,reason:m.message,frag:e||void 0,buffer:o.len,bufferInfo:o})}return f}}return 0}_tryNudgeBuffer(e){const{hls:t,media:s,nudgeRetry:r}=this,n=t==null?void 0: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(E.ERROR,{type:te.MEDIA_ERROR,details:w.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(E.ERROR,{type:te.MEDIA_ERROR,details:w.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Og(i,e){const t=Ng(i.main);if(t&&t.start<=e)return t;const s=Ng(i.audio);return s&&s.start<=e?s:null}function Ng(i){if(!i)return null;switch(i.state){case N.IDLE:case N.STOPPED:case N.ENDED:case N.ERROR:return null}return i.frag}const ex=.25;function Jc(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Ug(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,qe(r?Me({type:r},s):s))}return n}const Xo=(()=>{const i=Jc();try{i&&new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class tx{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(E.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;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.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(){const e=this.hls.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Ln(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 $E(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:s,enableID3MetadataCues:r}}}=this;if(!s&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=Jc();if(a)for(let o=0;o<n.length;o++){const l=n[o].type;if(l===Kt.emsg&&!s||!r)continue;const d=EE(n[o].data);if(d){const u=n[o].pts;let c=u+n[o].duration;c>Xo&&(c=Xo),c-u<=0&&(c=u+ex);for(let f=0;f<d.length;f++){const m=d[f];if(!yE(m)){this.updateId3CueEnds(u,l);const p=Ug(a,u,c,m,l);p&&this.id3Track.addCue(p)}}}}}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===Xo&&(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===Kt.audioId3&&l:r==="video"?d=u=>u.type===Kt.emsg&&o:d=u=>u.type===Kt.audioId3&&l||u.type===Kt.emsg&&o,Qc(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.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:s}=this,{dateRanges:r}=e,n=Object.keys(r);let a=this.dateRangeCuesAppended;if(s&&t){var o;if((o=s.cues)!=null&&o.length){const u=Object.keys(a).filter(c=>!n.includes(c));for(let c=u.length;c--;){const h=u[c],f=a[h].cues;delete a[h],Object.keys(f).forEach(m=>{try{const p=f[m];p.removeEventListener("enter",this.onEventCueEnter),s.removeCue(p)}catch{}})}}else a=this.dateRangeCuesAppended={}}const l=e.fragments[e.fragments.length-1];if(n.length===0||!q(l==null?void 0:l.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const d=Jc();for(let u=0;u<n.length;u++){const c=n[u],h=r[c],f=h.startTime,m=a[c],p=(m==null?void 0:m.cues)||{};let g=(m==null?void 0:m.durationKnown)||!1,v=Xo;const{duration:T,endDate:y}=h;if(y&&T!==null)v=f+T,g=!0;else if(h.endOnNext&&!g){const I=n.reduce((x,L)=>{if(L!==h.id){const A=r[L];if(A.class===h.class&&A.startDate>h.startDate&&(!x||h.startDate<x.startDate))return A}return x},null);I&&(v=I.startTime,g=!0)}const _=Object.keys(h.attr);for(let I=0;I<_.length;I++){const x=_[I];if(!w1(x))continue;const L=p[x];if(L)g&&!m.durationKnown?L.endTime=v:Math.abs(L.startTime-f)>.01&&(L.startTime=f,L.endTime=v);else if(d){let A=h.attr[x];M1(x)&&(A=Ov(A));const S=Ug(d,f,v,{key:x,data:A},Kt.dateRange);S&&(S.id=c,this.id3Track.addCue(S),p[x]=S,this.hls.config.interstitialsController&&(x==="X-ASSET-LIST"||x==="X-ASSET-URL")&&S.addEventListener("enter",this.onEventCueEnter))}}a[c]={cues:p,dateRange:h,durationKnown:g}}}}class ix{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;e&&(e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.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===w.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 sx extends Wf{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(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.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=Pd(h,s)||void 0),f&&(f=u.videoCodec=XS(f));const{width:m,height:p,unknownCodecs:g}=u;let v=g?g.length:0;if(g)for(let S=v;S--;){const k=g[S];this.isAudioSupported(k)?(u.audioCodec=h=h?`${h},${k}`:k,v--,jn.audio[h.substring(0,4)]=2):this.isVideoSupported(k)&&(u.videoCodec=f=f?`${f},${k}`:k,v--,jn.video[f.substring(0,4)]=2)}if(o||(o=!!(m&&p)),l||(l=!!f),d||(d=!!h),v||h&&!this.isAudioSupported(h)||f&&!this.isVideoSupported(f)){this.log(`Some or all CODECS not supported "${c.CODECS}"`);return}const{CODECS:T,"FRAME-RATE":y,"HDCP-LEVEL":_,"PATHWAY-ID":I,RESOLUTION:x,"VIDEO-RANGE":L}=c,R=`${`${I||"."}-`}${u.bitrate}-${x}-${y}-${T}-${L}-${_}`;if(n[R])if(n[R].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const S=a[R]+=1;u.attrs["PATHWAY-ID"]=new Array(S+1).join(".");const k=this.createLevel(u);n[R]=k,r.push(k)}else n[R].addGroupId("audio",c.AUDIO),n[R].addGroupId("text",c.SUBTITLES);else{const S=this.createLevel(u);n[R]=S,a[R]=1,r.push(S)}}),this.filterAndSortMediaOptions(r,t,o,l,d)}createLevel(e){const t=new uo(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=Wv(r,[])}return t}isAudioSupported(e){return Uc(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Uc(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,s,r,n){let a=[],o=[],l=e;if((s||r)&&n&&(l=l.filter(({videoCodec:g,videoRange:v,width:T,height:y})=>(!!g||!!(T&&y))&&n1(v))),l.length===0){Promise.resolve().then(()=>{if(this.hls){let g="no level with compatible codecs found in manifest",v=g;t.levels.length&&(v=`one or more CODECS in variant not supported: ${qe(t.levels.map(y=>y.attrs.CODECS).filter((y,_,I)=>I.indexOf(y)===_))}`,this.warn(v),g+=` (${v})`);const T=new Error(g);this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:T,reason:v})}});return}t.audioTracks&&(a=t.audioTracks.filter(g=>!g.audioCodec||this.isAudioSupported(g.audioCodec)),Fg(a)),t.subtitles&&(o=t.subtitles,Fg(o));const d=l.slice(0);l.sort((g,v)=>{if(g.attrs["HDCP-LEVEL"]!==v.attrs["HDCP-LEVEL"])return(g.attrs["HDCP-LEVEL"]||"")>(v.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&g.height!==v.height)return g.height-v.height;if(g.frameRate!==v.frameRate)return g.frameRate-v.frameRate;if(g.videoRange!==v.videoRange)return Od.indexOf(g.videoRange)-Od.indexOf(v.videoRange);if(g.videoCodec!==v.videoCodec){const T=Dp(g.videoCodec),y=Dp(v.videoCodec);if(T!==y)return y-T}if(g.uri===v.uri&&g.codecSet!==v.codecSet){const T=Md(g.codecSet),y=Md(v.codecSet);if(T!==y)return y-T}return g.averageBitrate!==v.averageBitrate?g.averageBitrate-v.averageBitrate:0});let u=d[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==d.length)){for(let g=0;g<d.length;g++)if(d[g].pathwayId===l[0].pathwayId){u=d[g];break}}this._levels=l;for(let g=0;g<l.length;g++)if(l[g]===u){var c;this._firstLevel=g;const v=u.bitrate,T=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${v}`),((c=this.hls.userConfig)==null?void 0:c.abrEwmaDefaultEstimate)===void 0){const y=Math.min(v,this.hls.config.abrEwmaDefaultEstimateMax);y>T&&T===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=y)}break}const h=n&&!r,f=this.hls.config,m=!!(f.audioStreamController&&f.audioTrackController),p={levels:l,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:m&&!h&&a.some(g=>!!g.url)};this.hls.trigger(E.MANIFEST_PARSED,p)}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(E.ERROR,{type:te.OTHER_ERROR,details:w.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(E.LEVEL_SWITCHING,l);const d=a.details;if(!d||d.live){const u=this.switchParams(a.uri,r==null?void 0: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===ge.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===X.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==null?void 0:a.age;this.log(`Loading level index ${r}${(t==null?void 0: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(E.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));lE(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(E.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(E.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function Fg(i){const e={};i.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}function ZE(){return self.SourceBuffer||self.WebKitSourceBuffer}function JE(){if(!er())return!1;const e=ZE();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function rx(){if(!JE())return!1;const i=er();return typeof(i==null?void 0:i.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>i.isTypeSupported(lo(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(lo(e,"audio"))))}function nx(){var i;const e=ZE();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}const ax=100;class ox extends Uf{constructor(e,t,s){super(e,t,s,"stream-controller",X.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||!q(n)||(this.log(`Media seeked to ${n.toFixed(3)}`),!this.getBufferedFrag(n)))return;const a=this.getFwdBufferInfoAtPos(r,n,X.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(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.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(ax),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=N.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=N.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case N.WAITING_LEVEL:{const{levels:t,level:s}=this,r=t==null?void 0:t[s],n=r==null?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r&&!this.waitForLive(r))){if(this.waitForCdnTuneIn(n))break;this.state=N.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=N.IDLE;break}break}case N.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),s=this.retryDate;if(!s||t>=s||(e=this.media)!=null&&e.seeking){const{levels:r,level:n}=this,a=r==null?void 0:r[n];this.resetStartWhenNotLoaded(a||null),this.state=N.IDLE}}break}this.state===N.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;
vendor: 22,815 bytes, line 61
61const 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 p={};this.altAudio===2&&(p.type="video"),this.hls.trigger(E.BUFFER_EOS,p),this.state=N.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===N.WAITING_LEVEL||this.waitForLive(a)){this.level=n,this.state=N.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&&ot(f)&&this.fragmentTracker.getState(f)!==ft.OK){var m;const g=((m=this.backtrackFragment)!=null?m:f).sn-d.startSN,v=d.fragments[g-1];v&&f.cc===v.cc&&(f=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,h)){if(!f.gap){const g=this.audioOnly&&!this.altAudio?Ue.AUDIO:Ue.VIDEO,v=(g===Ue.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,g,X.MAIN)}f=this.getNextFragmentLoopLoading(f,d,o,X.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===ft.NOT_LOADED||r===ft.PARTIAL?ot(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,X.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 N.KEY_LOADING:case N.FRAG_LOADING:case N.FRAG_LOADING_WAITING_RETRY:case N.PARSING:case N.PARSED:this.state=N.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;ii(s,"playing",this.onMediaPlaying),ii(s,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:s}=this;s&&(gi(s,"playing",this.onMediaPlaying),gi(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(E.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;t.levels.forEach(n=>{const a=n.audioCodec;a&&(s=s||a.indexOf("mp4a.40.2")!==-1,r=r||a.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=s&&r&&!nx(),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!==N.IDLE)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=N.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===N.FRAG_LOADING||this.state===N.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(E.LEVEL_UPDATED,{details:o,level:a}),this.state===N.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=N.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=le.bufferInfo(s,r,0);if(!(c!=null&&(d=c.buffered)!=null&&d.length)){s.currentTime=r;return}if(c.start<=n){s.currentTime=r;return}const{nextStart:f}=le.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 DE(this.hls,X.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=r?r.index:-1,p=m!==-1,g=new Of(s.level,s.sn,s.stats.chunkCount,n.byteLength,m,p),v=this.initPTS[s.cc];f.push(n,c,h,d,s,r,l.totalduration,u,g,v)}onAudioTrackSwitching(e,t){const s=this.hls,r=this.altAudio===2;if(Nd(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.fragmentTracker.removeAllFragments(),s.once(E.BUFFER_FLUSHED,()=>{var a;(a=this.hls)==null||a.trigger(E.AUDIO_TRACK_SWITCHED,t)}),s.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(E.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=Nd(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===X.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===N.PARSED&&(this.state=N.IDLE);return}const o=r?r.stats:s.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),ot(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,r)}const a=this.media;a&&(!this._hasEnoughToStart&&le.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=N.ERROR;return}switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(X.MAIN,t);break;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===N.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===ge.LEVEL&&(this.state=N.IDLE);break;case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case w.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=N.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Ue.AUDIO||!this.altAudio){const s=(t===Ue.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,t,X.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=le.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==null?void 0: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==null?void 0:s.frag;if(!n||this.fragContextChanged(n))return;t.fragmentError=0,this.state=N.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(E.FRAG_LOADED,s),n.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const s=this.playlistType,{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,{video:c,text:h,id3:f,initSegment:m}=n,{details:p}=u,g=this.altAudio?void 0:n.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=N.PARSING,m){if(m!=null&&m.tracks){const _=l.initSegment||l;this._bufferInitSegment(u,m.tracks,_,a),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:_,id:s,tracks:m.tracks})}const v=m.initPTS,T=m.timescale,y=this.initPTS[l.cc];q(v)&&(!y||y.baseTime!==v||y.timescale!==T)&&(this.initPTS[l.cc]={baseTime:v,timescale:T},r.trigger(E.INIT_PTS_FOUND,{frag:l,id:s,initPTS:v,timescale:T}))}if(c&&p){g&&c.type==="audiovideo"&&this.logMuxedErr(l);const v=p.fragments[l.sn-1-p.startSN],T=l.sn===p.startSN,y=!v||l.cc>v.cc;if(n.independent!==!1){const{startPTS:_,endPTS:I,startDTS:x,endDTS:L}=c;if(d)d.elementaryStreams[c.type]={startPTS:_,endPTS:I,startDTS:x,endDTS:L};else if(c.firstKeyFrame&&c.independent&&a.id===1&&!y&&(this.couldBacktrack=!0),c.dropped&&c.independent){const A=this.getMainFwdBufferInfo(),R=(A?A.end:this.getLoadPosition())+this.config.maxBufferHole,S=c.firstKeyFramePTS?c.firstKeyFramePTS:_;if(!T&&R<S-this.config.maxBufferHole&&!y){this.backtrack(l);return}else y&&(l.gap=!0);l.setElementaryStreamInfo(c.type,l.start,I,l.start,L,!0)}else T&&_-(p.appliedTimelineOffset||0)>Al&&(l.gap=!0);l.setElementaryStreamInfo(c.type,_,I,x,L),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(c,l,d,a,T||y)}else if(T||y)l.gap=!0;else{this.backtrack(l);return}}if(g){const{startPTS:v,endPTS:T,startDTS:y,endDTS:_}=g;d&&(d.elementaryStreams[Ue.AUDIO]={startPTS:v,endPTS:T,startDTS:y,endDTS:_}),l.setElementaryStreamInfo(Ue.AUDIO,v,T,y,_),this.bufferFragmentData(g,l,d,a)}if(p&&f!=null&&(t=f.samples)!=null&&t.length){const v={id:s,frag:l,details:p,samples:f.samples};r.trigger(E.FRAG_PARSING_METADATA,v)}if(p&&h){const v={id:s,frag:l,details:p,samples:h.samples};r.trigger(E.FRAG_PARSING_USERDATA,v)}}logMuxedErr(e){this.warn(`${ot(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,s,r){if(this.state!==N.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=gl(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=X.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=X.MAIN;const d=a.codec;if((d==null?void 0: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(E.BUFFER_CODECS,t),!this.hls)return;l.forEach(d=>{const c=t[d].initSegment;c!=null&&c.byteLength&&this.hls.trigger(E.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,X.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,s=e==null?void 0: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=N.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(le.isBuffered(e,s)?t=this.getAppendedFrag(s):le.isBuffered(e,s+.1)&&(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(E.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(E.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 q(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(q(t)){const s=this.getLevelDetails(),r=this.currentFrag||(s?Br(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 lx{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[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.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=w.KEY_LOAD_ERROR,s,r,n){return new ns({type:te.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&&(!ot(e)||!ot(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=Gc(o);if(l)return this.emeController.getKeySystemAccess([l])})}if(this.config.requireKeySystemAccessOnStart){const r=El(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");return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,d))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if((s=o)!=null&&s.decryptdata.key)return n.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((r=o)!=null&&r.keyLoadPromise){var l;switch((l=o.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(d=>(n.key=d.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[a]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,w.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){const r=this.emeController.loadKey(s);if(r)return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,s))).catch(n=>{throw e.keyLoadPromise=null,n})}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,p)=>{const{frag:g,keyInfo:v,url:T}=m;if(!g.decryptdata||v!==this.keyUriToKeyInfo[T])return o(this.createKeyLoadError(g,w.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),p));v.decryptdata.key=g.decryptdata.key=new Uint8Array(h.data),g.keyLoader=null,v.loader=null,a({frag:g,keyInfo:v})},onError:(h,f,m,p)=>{this.resetLoader(f),o(this.createKeyLoadError(t,w.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),m,Me({url:l.url,data:void 0},h)))},onTimeout:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,w.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,w.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),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}function $g(i){const{type:e}=i;switch(e){case ge.AUDIO_TRACK:return X.AUDIO;case ge.SUBTITLE_TRACK:return X.SUBTITLE;default:return X.MAIN}}function cc(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class dx{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(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AU
vendor: 14,427 bytes, line 61
61DIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(E.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:ge.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:ge.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:ge.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:ge.SUBTITLE_TRACK,url:n,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){const s=this.loaders[ge.LEVEL];if(s){const r=s.context;r&&!t.levels.some(n=>n===r.levelOrTrack)&&(s.abort(),delete this.loaders[ge.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===ge.MANIFEST?n=s.manifestLoadPolicy.default:n=we({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),q((t=e.deliveryDirectives)==null?void 0:t.part)){let d;if(e.type===ge.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===ge.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===ge.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=we({},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;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(d,c,new Error("no EXTM3U delimiter"),h||null,u);return}u.parsing.start=performance.now(),Gi.isMediaPlaylist(m)||c.type!==ge.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)}checkAutostartLoad(){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=cc(e,s),l=Gi.parseMasterPlaylist(a,o);if(l.playlistParsingError){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;const{AUDIO:p=[],SUBTITLES:g,"CLOSED-CAPTIONS":v}=Gi.parseMasterPlaylistMedia(a,o,l);p.length&&!p.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"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ze({}),bitrate:0,url:""})),n.trigger(E.MANIFEST_LOADED,{levels:u,audioTracks:p,subtitles:g,captions:v,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=cc(e,s),c=q(l)?l:q(o)?o:0,h=$g(s),f=Gi.parseLevelPlaylist(e.data,u,c,h,0,this.variableList);if(d===ge.MANIFEST){const m={attrs:new ze({}),bitrate:0,details:f,name:"",url:u};f.requestScheduled=t.loading.start+nE(f,0),a.trigger(E.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(E.ERROR,{type:te.NETWORK_ERROR,details:w.MANIFEST_PARSING_ERROR,fatal:t.type===ge.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===ge.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===ge.AUDIO_TRACK||e.type===ge.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let l=w.UNKNOWN,d=!1;const u=this.getInternalLoader(e);switch(e.type){case ge.MANIFEST:l=s?w.MANIFEST_LOAD_TIMEOUT:w.MANIFEST_LOAD_ERROR,d=!0;break;case ge.LEVEL:l=s?w.LEVEL_LOAD_TIMEOUT:w.LEVEL_LOAD_ERROR,d=!1;break;case ge.AUDIO_TRACK:l=s?w.AUDIO_TRACK_LOAD_TIMEOUT:w.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case ge.SUBTITLE_TRACK:l=s?w.SUBTITLE_TRACK_LOAD_TIMEOUT:w.SUBTITLE_LOAD_ERROR,d=!1;break}u&&this.resetInternalLoader(e.type);const c={type:te.NETWORK_ERROR,details:l,fatal:d,url:e.url,loader:u,context:e,error:o,networkDetails:t,stats:n};if(r){const h=(t==null?void 0:t.url)||e.url;c.response=Me({url:h,data:void 0},r)}this.hls.trigger(E.ERROR,c)}handlePlaylistLoaded(e,t,s,r,n,a){const o=this.hls,{type:l,level:d,id:u,groupId:c,deliveryDirectives:h}=r,f=cc(t,r),m=$g(r),p=typeof r.level=="number"&&m===X.MAIN?d:void 0;if(!e.fragments.length){const v=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.LEVEL_EMPTY_ERROR,fatal:!1,url:f,error:v,reason:v.message,response:t,context:r,level:p,parent:m,networkDetails:n,stats:s});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const g=e.playlistParsingError;if(g){if(this.hls.logger.warn(g),!o.config.ignorePlaylistParsingErrors){o.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:f,error:g,reason:g.message,response:t,context:r,level:p,parent:m,networkDetails:n,stats:s});return}e.playlistParsingError=null}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case ge.MANIFEST:case ge.LEVEL:o.trigger(E.LEVEL_LOADED,{details:e,levelInfo:r.levelOrTrack||o.levels[0],level:p||0,id:u||0,stats:s,networkDetails:n,deliveryDirectives:h,withoutMultiVariant:l===ge.MANIFEST});break;case ge.AUDIO_TRACK:o.trigger(E.AUDIO_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:u||0,groupId:c||"",stats:s,networkDetails:n,deliveryDirectives:h});break;case ge.SUBTITLE_TRACK:o.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:u||0,groupId:c||"",stats:s,networkDetails:n,deliveryDirectives:h});break}}}class Os{static get version(){return ho}static isMSESupported(){return JE()}static isSupported(){return rx()}static getMediaSource(){return er()}static get Events(){return E}static get MetadataSchema(){return Kt}static get ErrorTypes(){return te}static get ErrorDetails(){return w}static get DefaultConfig(){return Os.defaultConfig?Os.defaultConfig:qR}static set DefaultConfig(e){Os.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 Ff,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=kS(e.debug||!1,"Hls instance",e.assetPlayerId),s=this.config=jR(Os.DefaultConfig,e,t);this.userConfig=e,s.progressive&&zR(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 T1(this),h=s.interstitialsController,f=h?this.interstitialsController=new h(this,Os):null,m=this.bufferController=new n(this,c),p=this.capLevelController=new a(this),g=new l(this),v=new dx(this),T=s.contentSteeringController,y=T?new T(this):null,_=this.levelController=new sx(this,y),I=new tx(this),x=new lx(this.config),L=this.streamController=new ox(this,c,x),A=this.gapController=new JR(this,c);p.setStreamController(L),g.setStreamController(L);const R=[v,_,L];f&&R.splice(1,0,f),y&&R.splice(1,0,y),this.networkControllers=R;const S=[u,m,A,p,g,I,c];this.audioTrackController=this.createController(s.audioTrackController,R);const k=s.audioStreamController;k&&R.push(this.audioStreamController=new k(this,c,x)),this.subtitleTrackController=this.createController(s.subtitleTrackController,R);const O=s.subtitleStreamController;O&&R.push(this.subtititleStreamController=new O(this,c,x)),this.createController(s.timelineController,S),x.emeController=this.emeController=this.createController(s.emeController,S),this.cmcdController=this.createController(s.cmcdController,S),this.latencyController=this.createController(ix,S),this.coreComponents=S,R.push(d);const G=d.onErrorOut;typeof G=="function"&&this.on(E.ERROR,G,d),this.on(E.MANIFEST_LOADED,v.onManifestLoaded,v)}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===E.ERROR;this.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.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(E.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(E.ERROR,{type:te.OTHER_ERROR,details:w.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(E.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia"),this.trigger(E.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(E.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,s=this._url,r=this._url=xf.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(E.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={[X.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[X.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[X.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;
vendor: 5,913 bytes, line 61
61return e||(e=this._sessionId=JL()),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){r1(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}setSubtitleOption(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=jv(t);return qv(e,s,navigator.mediaCapabilities)}}Os.defaultConfig=void 0;var ye=Os,He={VIDEO:"video",THUMBNAIL:"thumbnail",STORYBOARD:"storyboard",DRM:"drm"},ne={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_
vendor: 12,140 bytes, line 61
61KEY_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},gu=i=>i===He.VIDEO?"playback":i,Ss=class Ia extends Error{constructor(e,t=Ia.MEDIA_ERR_CUSTOM,s,r){var n;super(e),this.name="MediaError",this.code=t,this.context=r,this.fatal=s??(t>=Ia.MEDIA_ERR_NETWORK&&t<=Ia.MEDIA_ERR_ENCRYPTED),this.message||(this.message=(n=Ia.defaultMessages[this.code])!=null?n:"")}};Ss.MEDIA_ERR_ABORTED=1,Ss.MEDIA_ERR_NETWORK=2,Ss.MEDIA_ERR_DECODE=3,Ss.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Ss.MEDIA_ERR_ENCRYPTED=5,Ss.MEDIA_ERR_CUSTOM=100,Ss.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 Y=Ss,ux=i=>i==null,Qf=(i,e)=>ux(e)?!1:i in e,eh={ANY:"any",MUTED:"muted"},De={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Ki={MSE:"mse",NATIVE:"native"},La={HEADER:"header",QUERY:"query",NONE:"none"},Kd=Object.values(La),cs={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Bg={HLS:cs.M3U8};[...Object.values(cs)];var cx="en",th={code:cx},st=(i,e,t,s,r=i)=>{r.addEventListener(e,t,s),i.addEventListener("teardown",()=>{r.removeEventListener(e,t)},{once:!0})};function hx(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 Xf=i=>{let e=i.indexOf("?");if(e<0)return[i];let t=i.slice(0,e),s=i.slice(e);return[t,s]},vu=i=>{let{type:e}=i;if(e){let t=e.toUpperCase();return Qf(t,Bg)?Bg[t]:e}return fx(i)},ey=i=>i==="VOD"?De.ON_DEMAND:De.LIVE,ty=i=>i==="EVENT"?Number.POSITIVE_INFINITY:i==="VOD"?Number.NaN:0,fx=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 px(i)?cs.M3U8:"";let r=t.slice(s+1).toUpperCase();return Qf(r,cs)?cs[r]:""},mx="mux.com",px=({src:i,customDomain:e=mx})=>{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},Pn=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}},gx=({exp:i},e=Date.now())=>!i||i*1e3<e,vx=({sub:i},e)=>i!==e,Ex=({aud:i},e)=>!i,yx=({aud:i},e)=>i!==e,iy="en";function se(i,e=!0){var t,s;let r=e&&(s=(t=th)==null?void 0:t[i])!=null?s:i,n=e?th.code:iy;return new Tx(r,n)}var Tx=class{constructor(e,t=(s=>(s=th)!=null?s:iy)()){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}},bx=Object.values(eh),Hg=i=>typeof i=="boolean"||typeof i=="string"&&bx.includes(i),_x=(i,e,t)=>{let{autoplay:s}=i,r=!1,n=!1,a=Hg(s)?s:!!s,o=()=>{r||st(e,"playing",()=>{r=!0},{once:!0})};if(o(),st(e,"loadstart",()=>{r=!1,o(),hc(e,a)},{once:!0}),st(e,"loadstart",()=>{t||(i.streamType&&i.streamType!==De.UNKNOWN?n=i.streamType===De.LIVE:n=!Number.isFinite(e.duration)),hc(e,a)},{once:!0}),t&&t.once(ye.Events.LEVEL_LOADED,(l,d)=>{var u;i.streamType&&i.streamType!==De.UNKNOWN?n=i.streamType===De.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&&st(e,"play",()=>{e.preload==="metadata"?t.once(ye.Events.LEVEL_UPDATED,l):l()},{once:!0})}return l=>{r||(a=Hg(l)?l:!!l,hc(e,a))}},hc=(i,e)=>{if(!e)return;let t=i.muted,s=()=>i.muted=t;switch(e){case eh.ANY:i.play().catch(()=>{i.muted=!0,i.play().catch(s)});break;case eh.MUTED:i.muted=!0,i.play().catch(s);break;default:i.play().catch(()=>{});break}},Ax=({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 st(t,"play",()=>{a=!0,s.config.maxBufferLength=o,s.config.maxBufferSize=l,u()},{once:!0}),d(i),d};function Sx(i,e){var t;if(!("videoTracks"in i))return;let s=new WeakMap;e.on(ye.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(ye.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(ye.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(ye.Events.DESTROYING,o)}var fc=i=>"time"in i?i.time:i.startTime;function Ix(i,e){e.on(ye.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==null?void 0:d.lang)&&f===a.label&&m.toLowerCase()===a.kind),c=((l=a._id)!=null?l:a.default)?"default":`${a.kind}${u}`;Zf(i,a.kind,a.label,d==null?void 0: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==null?void 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==null?void 0:r.id)===a&&r.cues&&Array.from(r.cues).forEach(o=>{r.addCue(o)})};i.textTracks.addEventListener("change",t),e.on(ye.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(ye.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==null?void 0:l.getAttribute("src"))!=null?a:"";l==null||l.removeAttribute("src"),setTimeout(()=>{l==null||l.setAttribute("src",d)},0)}r.mode!=="hidden"&&(r.mode="hidden")}})};e.once(ye.Events.MANIFEST_LOADED,s),e.once(ye.Events.MEDIA_ATTACHED,s)}function Zf(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 Lx(i,e){let t=Array.prototype.find.call(i.querySelectorAll("track"),s=>s.track===e);t==null||t.remove()}function Co(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 sy(i,e,t,s){let r=Co(i,t,s);return r||(r=Zf(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)=>fc(a)-fc(n)).forEach(n=>{var a,o;let l=n.value,d=fc(n);if("endTime"in n&&n.endTime!=null)r==null||r.addCue(new VTTCue(d,n.endTime,s==="chapters"?l:JSON.stringify(l??null)));else{let u=Array.prototype.findIndex.call(r==null?void 0:r.cues,m=>m.startTime>=d),c=(a=r==null?void 0:r.cues)==null?void 0:a[u],h=c?c.startTime:Number.isFinite(i.duration)?i.duration:Number.MAX_SAFE_INTEGER,f=(o=r==null?void 0:r.cues)==null?void 0:o[u-1];f&&(f.endTime=d),r==null||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 Jf="cuepoints",ry=Object.freeze({label:Jf});async function ny(i,e,t=ry){return sy(i,e,t.label,"metadata")}var ih=i=>({time:i.startTime,value:JSON.parse(i.text)});function Rx(i,e={label:Jf}){let t=Co(i,e.label,"metadata");return t!=null&&t.cues?Array.from(t.cues,s=>ih(s)):[]}function ay(i,e={label:Jf}){var t,s;let r=Co(i,e.label,"metadata");if(!((t=r==null?void 0:r.activeCues)!=null&&t.length))return;if(r.activeCues.length===1)return ih(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 ih(a||r.activeCues[0])}async function xx(i,e=ry){return new Promise(t=>{st(i,"loadstart",async()=>{let s=await ny(i,[],e);st(i,"cuechange",()=>{let r=ay(i);if(r){let n=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:r});i.dispatchEvent(n)}},{},s),t(s)})})}var em="chapters",oy=Object.freeze({label:em}),sh=i=>({startTime:i.startTime,endTime:i.endTime,value:i.text});async function ly(i,e,t=oy){return sy(i,e,t.label,"chapters")}function kx(i,e={label:em}){var t;let s=Co(i,e.label,"chapters");return(t=s==null?void 0:s.cues)!=null&&t.length?Array.from(s.cues,r=>sh(r)):[]}function dy(i,e={label:em}){var t,s;let r=Co(i,e.label,"chapters");if(!((t=r==null?void 0:r.activeCues)!=null&&t.length))return;if(r.activeCues.length===1)return sh(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 sh(a||r.activeCues[0])}async function Dx(i,e=oy){return new Promise(t=>{st(i,"loadstart",async()=>{let s=await ly(i,[],e);st(i,"cuechange",()=>{let r=dy(i);if(r){let n=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:r});i.dispatchEvent(n)}},{},s),t(s)})})}function Cx(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 wx(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 Za={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},Mx=i=>{if(i===He.VIDEO)return Za.VIDEO;if(i===He.DRM)return Za.DRM},Px=(i,e)=>{var t,s;let r=gu(i),n=`${r}Token`;return(t=e.tokens)!=null&&t[r]?(s=e.tokens)==null?void 0:s[r]:Qf(n,e)?e[n]:void 0},Vd=(i,e,t,s,r=!1,n=!(a=>(a=globalThis.navigator)==null?void 0:a.onLine)())=>{var a,o;if(n){let v=se("Your device appears to be offline",r),T,y=Y.MEDIA_ERR_NETWORK,_=new Y(v,y,!1,T);return _.errorCategory=e,_.muxCode=ne.NETWORK_OFFLINE,_.data=i,_}let l="status"in i?i.status:i.code,d=Date.now(),u=Y.MEDIA_ERR_NETWORK;if(l===200)return;let c=gu(e),h=Px(e,t),f=Mx(e),[m]=Xf((a=t.playbackId)!=null?a:"");if(!l||!m)return;let p=Pn(h);if(h&&!p){let v=se("The {tokenNamePrefix}
61-token provided is invalid or malformed.",r).format({tokenNamePrefix:c}),T=se("Compact JWT string: {token}",r).format({token:h}),y=new Y(v,u,!0,T);return y.errorCategory=e,y.muxCode=ne.NETWORK_TOKEN_MALFORMED,y.data=i,y}if(l>=500){let v=new Y("",u,s??!0);return v.errorCategory=e,v.muxCode=ne.NETWORK_UNKNOWN_ERROR,v}if(l===403)if(p){if(gx(p,d)){let v={timeStyle:"medium",dateStyle:"medium"},T=se("The video’s secured {tokenNamePrefix}-token has expired.",r).format({tokenNamePrefix:c}),y=se("Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat("en",v).format((o=p.exp)!=null?o:0*1e3),currentDate:new Intl.DateTimeFormat("en",v).format(d)}),_=new Y(T,u,!0,y);return _.errorCategory=e,_.muxCode=ne.NETWORK_TOKEN_EXPIRED,_.data=i,_}if(vx(p,m)){let v=se("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",r).format({tokenNamePrefix:c}),T=se("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",r).format({tokenNamePrefix:c,playbackId:m,tokenPlaybackId:p.sub}),y=new Y(v,u,!0,T);return y.errorCategory=e,y.muxCode=ne.NETWORK_TOKEN_SUB_MISMATCH,y.data=i,y}if(Ex(p)){let v=se("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:c}),T=se("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",r).format({tokenNamePrefix:c,expectedAud:f}),y=new Y(v,u,!0,T);return y.errorCategory=e,y.muxCode=ne.NETWORK_TOKEN_AUD_MISSING,y.data=i,y}if(yx(p,f)){let v=se("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:c}),T=se("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",r).format({tokenNamePrefix:c,expectedAud:f,aud:p.aud}),y=new Y(v,u,!0,T);return y.errorCategory=e,y.muxCode=ne.NETWORK_TOKEN_AUD_MISMATCH,y.data=i,y}}else{let v=se("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}),T=se("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new Y(v,u,s??!0,T);return y.errorCategory=e,y.muxCode=ne.NETWORK_TOKEN_MISSING,y.data=i,y}if(l===412){let v=se("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),T=se("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new Y(v,u,s??!0,T);return y.errorCategory=e,y.muxCode=ne.NETWORK_NOT_READY,y.streamType=t.streamType===De.LIVE?"live":t.streamType===De.ON_DEMAND?"on-demand":"unknown",y.data=i,y}if(l===404){let v=se("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),T=se("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new Y(v,u,s??!0,T);return y.errorCategory=e,y.muxCode=ne.NETWORK_NOT_FOUND,y.data=i,y}if(l===400){let v=se("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),T=se("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new Y(v,u,s??!0,T);return y.errorCategory=e,y.muxCode=ne.NETWORK_INVALID_URL,y.data=i,y}let g=new Y("",u,s??!0);return g.errorCategory=e,g.muxCode=ne.NETWORK_UNKNOWN_ERROR,g.data=i,g},Gg=ye.DefaultConfig.capLevelController,uy=class cy extends Gg{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=cy.minMaxResolution;return r>=n?t:Gg.getMaxLevelByMediaSize(s,n*(16/9),n)}};uy.minMaxResolution=720;var Ox=uy,Nx=Ox,Sl={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},Ux=i=>{if(i.includes("fps"))return Sl.FAIRPLAY;if(i.includes("playready"))return Sl.PLAYREADY;if(i.includes("widevine"))return Sl.WIDEVINE},Fx=i=>{let e=i.split(`
62`).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())},$x=i=>{let e=i.split(`
63`).filter(s=>s.startsWith("#EXT-X-SESSION-DATA"));if(!e.length)return{};let t={};for(let s of e){let r=Hx(s),n=r["DATA-ID"];n&&(t[n]={...r})}return{sessionData:t}},Bx=/([A-Z0-9-]+)="?(.*?)"?(?:,|$)/g;function Hx(i){let e=[...i.matchAll(Bx)];return Object.fromEntries(e.map(([,t,s])=>[t,s]))}var Gx=i=>{var e,t,s;let r=i.split(`
64`),n=(t=((e=r.find(d=>d.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?e:"").split(":")[1])==null?void 0:t.trim(),a=ey(n),o=ty(n),l;if(a===De.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==null?void 0:u.split(":"))==null?void 0:s[1];l=+(c??6)*3}}return{streamType:a,targetLiveWindow:o,liveEdgeStartOffset:l}},Kx=async(i,e)=>{if(e===cs.MP4)return{streamType:De.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0,sessionData:void 0};if(e===cs.M3U8){let t=await fetch(i);if(!t.ok)return Promise.reject(t);let s=await t.text(),r=await Fx(s);return{...$x(s),...Gx(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}},Vx=async(i,e,t=vu({src:i}))=>{var s,r,n,a;let{streamType:o,targetLiveWindow:l,liveEdgeStartOffset:d,sessionData:u}=await Kx(i,t),c=u==null?void 0:u["com.apple.hls.chapters"];(c!=null&&c.URI||c!=null&&c.VALUE.toLocaleLowerCase().startsWith("http"))&&tm((s=c.URI)!=null?s:c.VALUE,e),((r=Xe.get(e))!=null?r:{}).liveEdgeStartOffset=d,((n=Xe.get(e))!=null?n:{}).targetLiveWindow=l,e.dispatchEvent(new CustomEvent("targetlivewindowch
64ange",{composed:!0,bubbles:!0})),((a=Xe.get(e))!=null?a:{}).streamType=o,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},tm=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==null?void 0:n[0])!=null&&t.metadata))return;for(let l of n[0].metadata)l.key&&l.value&&(a[l.key]=l.value);((s=Xe.get(e))!=null?s:{}).metadata=a;let o=new CustomEvent("muxmetadata");e.dispatchEvent(o)}catch(r){console.error(r)}},Wx=i=>{var e;let t=i.type,s=ey(t),r=ty(t),n,a=!!((e=i.partList)!=null&&e.length);return s===De.LIVE&&(n=a?i.partTarget*2:i.targetduration*3),{streamType:s,targetLiveWindow:r,liveEdgeStartOffset:n,lowLatency:a}},qx=(i,e,t)=>{var s,r,n,a,o,l,d,u;let{streamType:c,targetLiveWindow:h,liveEdgeStartOffset:f,lowLatency:m}=Wx(i);if(c===De.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 p=Object.freeze({get length(){return e.seekable.length},start(g){return e.seekable.start(g)},end(g){var v;return g>this.length||g<0||Number.isFinite(e.duration)?e.seekable.end(g):(v=t.liveSyncPosition)!=null?v:e.seekable.end(g)}});((o=Xe.get(e))!=null?o:{}).seekable=p}((l=Xe.get(e))!=null?l:{}).liveEdgeStartOffset=f,((d=Xe.get(e))!=null?d:{}).targetLiveWindow=h,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((u=Xe.get(e))!=null?u:{}).streamType=c,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},Kg,Vg,Yx=(Vg=(Kg=globalThis==null?void 0:globalThis.navigator)==null?void 0:Kg.userAgent)!=null?Vg:"",Wg,qg,Yg,jx=(Yg=(qg=(Wg=globalThis==null?void 0:globalThis.navigator)==null?void 0:Wg.userAgentData)==null?void 0:qg.platform)!=null?Yg:"",zx=Yx.toLowerCase().includes("android")||["x11","android"].some(i=>jx.toLowerCase().includes(i)),Xe=new WeakMap,hs="mux.com",jg,zg,hy=(zg=(jg=ye).isSupported)==null?void 0:zg.call(jg),Qx=zx,fy=()=>Rf.utils.now(),Xx=Rf.utils.generateUUID,rh=({playbackId:i,customDomain:e=hs,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=""]=Xf(i),m=new URL(`https://stream.${e}/${h}.m3u8${f}`);return u||m.searchParams.has("token")?(m.searchParams.forEach((p,g)=>{g!="token"&&m.searchParams.delete(g)}),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(([p,g])=>{g!=null&&m.searchParams.set(p,g)})),m.toString()},Eu=i=>{if(!i)return;let[e]=i.split("?");return e||void 0},im=i=>{if(!i||!i.startsWith("https://stream."))return;let[e]=new URL(i).pathname.slice(1).split(/\.m3u8|\//);return e||void 0},Zx=i=>{var e,t,s;return(e=i==null?void 0:i.metadata)!=null&&e.video_id?i.metadata.video_id:by(i)&&(s=(t=Eu(i.playbackId))!=null?t:im(i.src))!=null?s:i.src},my=i=>{var e;return(e=Xe.get(i))==null?void 0:e.error},Jx=i=>{var e;return(e=Xe.get(i))==null?void 0:e.metadata},nh=i=>{var e,t;return(t=(e=Xe.get(i))==null?void 0:e.streamType)!=null?t:De.UNKNOWN},ek=i=>{var e,t;return(t=(e=Xe.get(i))==null?void 0:e.targetLiveWindow)!=null?t:Number.NaN},sm=i=>{var e,t;return(t=(e=Xe.get(i))==null?void 0:e.seekable)!=null?t:i.seekable},tk=i=>{var e;let t=(e=Xe.get(i))==null?void 0:e.liveEdgeStartOffset;if(typeof t!="number")return Number.NaN;let s=sm(i);return s.length?s.end(s.length-1)-t:Number.NaN},rm=.034,ik=(i,e,t=rm)=>Math.abs(i-e)<=t,py=(i,e,t=rm)=>i>e||ik(i,e,t),sk=(i,e=rm)=>i.paused&&py(i.currentTime,i.duration,e),gy=(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},vy=(i,e)=>i.ended||i.loop?i.ended:e&&gy(i,e)?!0:sk(i),rk=(i,e,t)=>{Ey(e,t,i);let{metadata:s={}}=i,{view_session_id:r=Xx()}=s,n=Zx(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,Xe.set(e,{retryCount:0});let o=nk(i,e),l=Ax(i,e,o);i!=null&&i.muxDataKeepSession&&e!=null&&e.mux&&!e.mux.deleted?o&&e.mux.addHLSJS({hlsjs:o,Hls:o?ye:void 0}):ck(i,e,o),hk(i,e,o),xx(e),Dx(e);let d=_x(i,e,o);return{engine:o,setAutoplay:d,setPreload:l}},Ey=(i,e,t)=>{let s=e==null?void 0: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",Ay),i.removeEventListener("error",ah),i.removeEventListener("durationchange",_y),Xe.delete(i),i.dispatchEvent(new Event("teardown")))};function yy(i,e){var t;let s=vu(i);if(s!==cs.M3U8)return!0;let r=!s||((t=e.canPlayType(s))!=null?t:!0),{preferPlayback:n}=i,a=n===Ki.MSE,o=n===Ki.NATIVE;return r&&(o||!(hy&&(a||Qx)))}var nk=(i,e)=>{let{debug:t,streamType:s,startTime:r=-1,metadata:n,preferCmcd:a,_hlsConfig:o={}}=i,l=vu(i)===cs.M3U8,d=yy(i,e);if(l&&!d&&hy){let u={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},c=ak(s),h=ok(i),f=[La.QUERY,La.HEADER].includes(a)?{useHeaders:a===La.HEADER,sessionId:n==null?void 0:n.view_session_id,contentId:n==null?void 0:n.video_id}:void 0,m=new ye({debug:t,startPosition:r,cmcd:f,xhrSetup:(p,g)=>{var v,T;if(a&&a!==La.QUERY)return;let y=new URL(g);if(!y.searchParams.has("CMCD"))return;let _=((T=(v=y.searchParams.get("CMCD"))==null?void 0:v.split(","))!=null?T:[]).filter(I=>I.startsWith("sid")||I.startsWith("cid")).join(",");y.searchParams.set("CMCD",_),p.open("GET",y)},capLevelController:Nx,...u,...c,...h,...o});return m.on(ye.Events.MANIFEST_PARSED,async function(p,g){var v,T;let y=(v=g.sessionData)==null?void 0:v["com.apple.hls.chapters"];(y!=null&&y.URI||y!=null&&y.VALUE.toLocaleLowerCase().startsWith("http"))&&tm((T=y==null?void 0:y.URI)!=null?T:y==null?void 0:y.VALUE,e)}),m}},ak=i=>i===De.LIVE?{backBufferLength:8}:{},ok=i=>{let{tokens:{drm:e}={},playbackId:t,drmTypeCb:s}=i,r=Eu(t);return!e||!r?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:Il(i,"fairplay"),serverCertificateUrl:Ty(i,"fairplay")},"com.widevine.alpha":{licenseUrl:Il(i,"widevine")},"com.microsoft.playready":{licenseUrl:Il(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=Ux(n);return s==null||s(l),o}))}},lk=async i=>{let e=await fetch(i);return e.status!==200?Promise.reject(e):await e.arrayBuffer()},dk=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)},uk=(i,e)=>{st(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,Sl.FAIRPLAY),u}).catch(()=>{let u=se("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),c=new Y(u,Y.MEDIA_ERR_ENCRYPTED,!0);
64c.errorCategory=He.DRM,c.muxCode=ne.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,ei(e,c)});if(!l)return;let d=await l.createMediaKeys();try{let u=await lk(Ty(i,"fairplay")).catch(c=>{if(c instanceof Response){let h=Vd(c,He.DRM,i);return console.error("mediaError",h==null?void 0:h.message,h==null?void 0: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=se("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),h=new Y(c,Y.MEDIA_ERR_ENCRYPTED,!0);return h.errorCategory=He.DRM,h.muxCode=ne.ENCRYPTED_UPDATE_SERVER_CERT_FAILED,Promise.reject(h)})}catch(u){ei(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=se("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");d=new Y(u,Y.MEDIA_ERR_ENCRYPTED,!0),d.errorCategory=He.DRM,d.muxCode=ne.ENCRYPTED_CDM_ERROR}else if(l==="output-restricted"||l==="output-downscaled"){let u=se("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");d=new Y(u,Y.MEDIA_ERR_ENCRYPTED,!1),d.errorCategory=He.DRM,d.muxCode=ne.ENCRYPTED_OUTPUT_RESTRICTED}d&&ei(e,d)})});let a=await Promise.all([n.generateRequest(s,r).catch(()=>{let l=se("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),d=new Y(l,Y.MEDIA_ERR_ENCRYPTED,!0);d.errorCategory=He.DRM,d.muxCode=ne.ENCRYPTED_GENERATE_REQUEST_FAILED,ei(e,d)}),new Promise(l=>{n.addEventListener("message",d=>{l(d.message)},{once:!0})})]).then(([,l])=>l),o=await dk(a,Il(i,"fairplay")).catch(l=>{if(l instanceof Response){let d=Vd(l,He.DRM,i);return console.error("mediaError",d==null?void 0:d.message,d==null?void 0: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=se("Failed to update DRM license. This may be an issue with the player or your protected content."),d=new Y(l,Y.MEDIA_ERR_ENCRYPTED,!0);return d.errorCategory=He.DRM,d.muxCode=ne.ENCRYPTED_UPDATE_LICENSE_FAILED,Promise.reject(d)})}catch(s){ei(e,s);return}})},Il=({playbackId:i,tokens:{drm:e}={},customDomain:t=hs},s)=>{let r=Eu(i);return`https://license.${t.toLocaleLowerCase().endsWith(hs)?t:hs}/license/${s}/${r}?token=${e}`},Ty=({playbackId:i,tokens:{drm:e}={},customDomain:t=hs},s)=>{let r=Eu(i);return`https://license.${t.toLocaleLowerCase().endsWith(hs)?t:hs}/appcert/${s}/${r}?token=${e}`},by=({playbackId:i,src:e,customDomain:t})=>{if(i)return!0;if(typeof e!="string")return!1;let s=window==null?void 0:window.location.href,r=new URL(e,s).hostname.toLocaleLowerCase();return r.includes(hs)||!!t&&r.includes(t.toLocaleLowerCase())},ck=(i,e,t)=>{var s;let{envKey:r,disableTracking:n,muxDataSDK:a=Rf,muxDataSDKOptions:o={}}=i,l=by(i);if(!n&&(r||l)){let{playerInitTime:d,playerSoftwareName:u,playerSoftwareVersion:c,beaconCollectionDomain:h,debug:f,disableCookies:m}=i,p={...i.metadata,video_title:((s=i==null?void 0:i.metadata)==null?void 0:s.video_title)||void 0},g=v=>typeof v.player_error_code=="string"?!1:typeof i.errorTranslator=="function"?i.errorTranslator(v):v;a.monitor(e,{debug:f,beaconCollectionDomain:h,hlsjs:t,Hls:t?ye:void 0,automaticErrorTracking:!1,errorTranslator:g,disableCookies:m,...o,data:{...r?{env_key:r}:{},player_software_name:u,player_software:u,player_software_version:c,player_init_time:d,...p}})}},hk=(i,e,t)=>{var s,r;let n=yy(i,e),{src:a,customDomain:o=hs}=i,l=()=>{e.ended||!vy(e,t)||(gy(e,t)?e.currentTime=e.buffered.end(e.buffered.length-1):e.dispatchEvent(new Event("ended")))},d,u,c=()=>{let h=sm(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(st(e,"durationchange",c),e&&n){let h=vu(i);
vendor: 4,279 bytes, line 64
64if(typeof a=="string"){if(a.endsWith(".mp4")&&a.includes(o)){let p=im(a),g=new URL(`https://stream.${o}/${p}/metadata.json`);tm(g.toString(),e)}let f=()=>{if(nh(e)!==De.LIVE||Number.isFinite(e.duration))return;let p=setInterval(c,1e3);e.addEventListener("teardown",()=>{clearInterval(p)},{once:!0}),st(e,"durationchange",()=>{Number.isFinite(e.duration)&&clearInterval(p)})},m=async()=>Vx(a,e,h).then(f).catch(p=>{if(p instanceof Response){let g=Vd(p,He.VIDEO,i);if(g){ei(e,g);return}}});if(e.preload==="none"){let p=()=>{m(),e.removeEventListener("loadedmetadata",g)},g=()=>{m(),e.removeEventListener("play",p)};st(e,"play",p,{once:!0}),st(e,"loadedmetadata",g,{once:!0})}else m();(s=i.tokens)!=null&&s.drm?uk(i,e):st(e,"encrypted",()=>{let p=se("Attempting to play DRM-protected content without providing a DRM token."),g=new Y(p,Y.MEDIA_ERR_ENCRYPTED,!0);g.errorCategory=He.DRM,g.muxCode=ne.ENCRYPTED_MISSING_TOKEN,ei(e,g)},{once:!0}),e.setAttribute("src",a),i.startTime&&(((r=Xe.get(e))!=null?r:{}).startTime=i.startTime,e.addEventListener("durationchange",_y,{once:!0}))}else e.removeAttribute("src");e.addEventListener("error",Ay),e.addEventListener("error",ah),e.addEventListener("emptied",()=>{e.querySelectorAll("track[data-removeondestroy]").forEach(f=>{f.remove()})},{once:!0}),st(e,"pause",l),st(e,"seeked",l),st(e,"play",()=>{e.ended||py(e.currentTime,e.duration)&&(e.currentTime=e.seekable.length?e.seekable.start(0):0)})}else t&&a?(t.once(ye.Events.LEVEL_LOADED,(h,f)=>{qx(f.details,e,t),c(),nh(e)===De.LIVE&&!Number.isFinite(e.duration)&&(t.on(ye.Events.LEVEL_UPDATED,c),st(e,"durationchange",()=>{Number.isFinite(e.duration)&&t.off(ye.Events.LEVELS_UPDATED,c)}))}),t.on(ye.Events.ERROR,(h,f)=>{var m,p;let g=fk(f,i);if(g.muxCode===ne.NETWORK_NOT_READY){let v=(m=Xe.get(e))!=null?m:{},T=(p=v.retryCount)!=null?p:0;if(T<6){let y=T===0?5e3:6e4,_=new Y(`Retrying in ${y/1e3} seconds...`,g.code,g.fatal);Object.assign(_,g),ei(e,_),setTimeout(()=>{v.retryCount=T+1,f.details==="manifestLoadError"&&f.url&&t.loadSource(f.url)},y);return}else{v.retryCount=0;let y=new Y('Try again later or <a href="#" onclick="window.location.reload(); return false;" style="color: #4a90e2;">click here to retry</a>',g.code,g.fatal);Object.assign(y,g),ei(e,y);return}}ei(e,g)}),t.on(ye.Events.MANIFEST_LOADED,()=>{let h=Xe.get(e);h&&h.error&&(h.error=null,h.retryCount=0,e.dispatchEvent(new Event("emptied")),e.dispatchEvent(new Event("loadstart")))}),e.addEventListener("error",ah),st(e,"waiting",l),Sx(i,t),Ix(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 _y(i){var e;let t=i.target,s=(e=Xe.get(t))==null?void 0:e.startTime;if(s&&hx(t.seekable,t.duration,s)){let r=t.preload==="auto";r&&(t.preload="none"),t.currentTime=s,r&&(t.preload="auto")}}async function Ay(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 Y(t,s);if(e.src&&s===Y.MEDIA_ERR_SRC_NOT_SUPPORTED&&e.readyState===HTMLMediaElement.HAVE_NOTHING){setTimeout(()=>{var n;let a=(n=my(e))!=null?n:e.error;(a==null?void 0:a.code)===Y.MEDIA_ERR_SRC_NOT_SUPPORTED&&ei(e,r)},500);return}if(e.src&&(s!==Y.MEDIA_ERR_DECODE||s!==void 0))try{let{status:n}=await fetch(e.src);r.data={response:{code:n}}}catch{}ei(e,r)}function ei(i,e){var t;e.fatal&&(((t=Xe.get(i))!=null?t:{}).error=e,i.dispatchEvent(new CustomEvent("error",{detail:e})))}function ah(i){var e,t;if(!(i instanceof CustomEvent)||!(i.detail instanceof Y))return;let s=i.target,r=i.detail;!r||!r.fatal||(((e=Xe.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 fk=(i,e)=>{var t,s,r;console.error("getErrorFromHlsErrorData()",i);let n={[ye.ErrorTypes.NETWORK_ERROR]:Y.MEDIA_ERR_NETWORK,[ye.ErrorTypes.MEDIA_ERROR]:Y.MEDIA_ERR_DECODE,[ye.ErrorTypes.KEY_SYSTEM_ERROR]:Y.MEDIA_ERR_ENCRYPTED},a=u=>[ye.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,ye.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(u.details)?Y.MEDIA_ERR_NETWORK:n[u.type],o=u=>{if(u.type===ye.ErrorTypes.KEY_SYSTEM_ERROR)return He.DRM;
64if(u.type===ye.ErrorTypes.NETWORK_ERROR)return He.VIDEO},l,d=a(i);if(d===Y.MEDIA_ERR_NETWORK&&i.response){let u=(t=o(i))!=null?t:He.VIDEO;l=(s=Vd(i.response,u,e,i.fatal))!=null?s:new Y("",d,i.fatal)}else if(d===Y.MEDIA_ERR_ENCRYPTED)if(i.details===ye.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE){let u=se("Attempting to play DRM-protected content without providing a DRM token.");l=new Y(u,Y.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=He.DRM,l.muxCode=ne.ENCRYPTED_MISSING_TOKEN}else if(i.details===ye.ErrorDetails.KEY_SYSTEM_NO_ACCESS){let u=se("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.");l=new Y(u,Y.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=He.DRM,l.muxCode=ne.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM}else if(i.details===ye.ErrorDetails.KEY_SYSTEM_NO_SESSION){let u=se("Failed to generate a DRM license request. This may be an issue with the player or your protected content.");l=new Y(u,Y.MEDIA_ERR_ENCRYPTED,!0),l.errorCategory=He.DRM,l.muxCode=ne.ENCRYPTED_GENERATE_REQUEST_FAILED}else if(i.details===ye.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED){let u=se("Failed to update DRM license. This may be an issue with the player or your protected content.");l=new Y(u,Y.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=He.DRM,l.muxCode=ne.ENCRYPTED_UPDATE_LICENSE_FAILED}else if(i.details===ye.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED){let u=se("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate.");l=new Y(u,Y.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=He.DRM,l.muxCode=ne.ENCRYPTED_UPDATE_SERVER_CERT_FAILED}else if(i.details===ye.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR){let u=se("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");l=new Y(u,Y.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=He.DRM,l.muxCode=ne.ENCRYPTED_CDM_ERROR}else if(i.details===ye.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED){let u=se("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");l=new Y(u,Y.MEDIA_ERR_ENCRYPTED,!1),l.errorCategory=He.DRM,l.muxCode=ne.ENCRYPTED_OUTPUT_RESTRICTED}else l=new Y(i.error.message,Y.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=He.DRM,l.muxCode=ne.ENCRYPTED_ERROR;else l=new Y("",d,i.fatal);return l.context||(l.context=`${i.url?`url: ${i.url}
65`:""}${i.response&&(i.response.code||i.response.text)?`response: ${i.response.code}, ${i.response.text}
66`:""}${i.reason?`failure reason: ${i.reason}
67`:""}${i.level?`level: ${i.level}
68`:""}${i.parent?`parent stream controller: ${i.parent}
69`:""}${i.buffer?`buffer length: ${i.buffer}
70`:""}${i.error?`error: ${i.error}
71`:""}${i.event?`event: ${i.event}
72`:""}${i.err?`error message: ${(r=i.err)==null?void 0:r.message}
73`:""}`),l.data=i,l};const mk=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],Sy=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function pk(i){return`
74    <style>
75      :host {
76        display: inline-flex;
77        line-height: 0;
78        flex-direction: column;
79        justify-content: end;
80      }
81
82      audio {
83        width: 100%;
84      }
85    </style>
86    <slot name="media">
87      <audio${Dy(i)}></audio>
88    </slot>
89    <slot></slot>
90  `}function gk(i){return`
91    <style>
92      :host {
93        display: inline-block;
94        line-height: 0;
95      }
96
97      video {
98        max-width: 100%;
99        max-height: 100%;
100        min-width: 100%;
101        min-height: 100%;
102        object-fit: var(--media-object-fit, contain);
103        object-position: var(--media-object-position, 50% 50%);
104      }
105
106      video::-webkit-media-text-track-container {
107        transform: var(--media-webkit-text-track-transform);
108        transition: var(--media-webkit-text-track-transition);
109      }
110    </style>
111    <slot name="media">
112      <video${Dy(i)}></video>
113    </slot>
114    <slot></slot>
115  `}function ky(i,{tag:e,is:t}){var n,a,o,l,d,Iy,c,h,f,m,p,cr,oh,Ly,lh,Ry,xy;const s=(a=(n=globalThis.document)==null?void 0:n.createElement)==null?void 0:a.call(n,e,{is:t}),r=s?vk(s):[];return o=class extends i{constructor(){super(...arguments);he(this,p);he(this,c,!1);he(this,h,null);he(this,f,new Map);he(this,m);xe(this,"get");xe(this,"set");xe(this,"call")}static get observedAttributes(){var R,S;return $e(R=o,d,Iy).call(R),[...((S=s==null?void 0:s.constructor)==null?void 0:S.observedAttributes)??[],...Sy]}get nativeEl(){var A;return $e(this,p,cr).call(this),M(this,h)??this.querySelector(":scope > [slot=media]")??this.querySelector(e)??((A=this.shadowRoot)==null?void 0:A.querySelector(e))??null}set nativeEl(A){ue(this,h,A)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(A){this.toggleAttribute("muted",A)}get src(){return this.getAttribute("src")}set src(A){this.setAttribute("src",`${A}`)}get preload(){var A;return this.getAttribute("preload")??((A=this.nativeEl)==null?void 0:A.preload)}set preload(A){this.setAttribute("preload",`${A}`)}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const A=Ek(this.attributes);t&&(A.is=t),e&&(A.part=e),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(A)}this.nativeEl.muted=this.hasAttribute("muted");for(const A of r)$e(this,p,Ry).call(this,A);ue(this,m,new MutationObserver($e(this,p,Ly).bind(this))),this.shadowRoot.addEventListener("slotchange",()=>$e(this,p,oh).call(this)),$e(this,p,oh).call(this);for(const A of this.constructor.Events)this.shadowRoot.addEventListener(A,this,!0)}handleEvent(A){A.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(A.type,{detail:A.detail}))}attributeChangedCallback(A,R,S){$e(this,p,cr).call(this),$e(this,p,xy).call(this,A,R,S)}connectedCallback(){$e(this,p,cr).call(this)}},l=new WeakMap,d=new WeakSet,Iy=function(){if(M(this,l))return;ue(this,l,!0);const A=new Set(this.observedAttributes);A.delete("muted");for(const R of r)if(!(R in this.prototype))if(typeof s[R]=="function")this.prototype[R]=function(...S){return $e(this,p,cr).call(this),(()=>{var G;if(this.call)return this.call(R,...S);const O=(G=this.nativeEl)==null?void 0:G[R];return O==null?void 0:O.apply(this.nativeEl,S)})()};else{const S={get(){var O,G;$e(this,p,cr).call(this);const k=R.toLowerCase();if(A.has(k)){const V=this.getAttribute(k);return V===null?!1:V===""?!0:V}return((O=this.get)==null?void 0:O.call(this,R))??((G=this.nativeEl)==null?void 0:G[R])}};R!==R.toUpperCase()&&(S.set=function(k){$e(this,p,cr).call(this);const O=R.toLowerCase();if(A.has(O)){k===!0||k===!1||k==null?this.toggleAttribute(O,!!k):this.setAttribute(O,k);return}if(this.set){this.set(R,k);return}this.nativeEl&&(this.nativeEl[R]=k)}),Object.defineProperty(this.prototype,R,S)}},c=new WeakMap,h=new WeakMap,f=new WeakMap,m=new WeakMap,p=new WeakSet,cr=function(){M(this,c)||(ue(this,c,!0),this.init())},oh=function(){var k;const A=new Map(M(this,f)),R=(k=this.shadowRoot)==null?void 0:k.querySelector("slot:not([name])");(R==null?void 0:R.assignedElements({flatten:!0}).filter(O=>
115["track","source"].includes(O.localName))).forEach(O=>{var V,B;A.delete(O);let G=M(this,f).get(O);G||(G=O.cloneNode(),M(this,f).set(O,G),(V=M(this,m))==null||V.observe(O,{attributes:!0})),(B=this.nativeEl)==null||B.append(G),$e(this,p,lh).call(this,G)}),A.forEach((O,G)=>{O.remove(),M(this,f).delete(G)})},Ly=function(A){for(const R of A)if(R.type==="attributes"){const{target:S,attributeName:k}=R,O=M(this,f).get(S);O&&k&&(O.setAttribute(k,S.getAttribute(k)??""),$e(this,p,lh).call(this,O))}},lh=function(A){A&&A.localName==="track"&&A.default&&(A.kind==="chapters"||A.kind==="metadata")&&A.track.mode==="disabled"&&(A.track.mode="hidden")},Ry=function(A){if(Object.prototype.hasOwnProperty.call(this,A)){const R=this[A];delete this[A],this[A]=R}},xy=function(A,R,S){var k,O,G;["id","class"].includes(A)||!o.observedAttributes.includes(A)&&this.constructor.observedAttributes.includes(A)||(S===null?(k=this.nativeEl)==null||k.removeAttribute(A):((O=this.nativeEl)==null?void 0:O.getAttribute(A))!==S&&((G=this.nativeEl)==null||G.setAttribute(A,S)))},he(o,d),xe(o,"getTemplateHTML",e.endsWith("audio")?pk:gk),xe(o,"shadowRootOptions",{mode:"open"}),xe(o,"Events",mk),he(o,l,!1),o}function vk(i){const e=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t)){const s=Object.getOwnPropertyNames(t);e.push(...s)}return e}function Dy(i){let e="";for(const t in i){if(!Sy.includes(t))continue;const s=i[t];s===""?e+=` ${t}`:e+=` ${t}="${s}"`}return e}function Ek(i){const e={};for(const t of i)e[t.name]=t.value;return e}const Zo=ky(globalThis.HTMLElement??class{},{tag:"video"});ky(globalThis.HTMLElement??class{},{tag:"audio"});var Cy=i=>{throw TypeError(i)},nm=(i,e,t)=>e.has(i)||Cy("Cannot "+t),_t=(i,e,t)=>(nm(i,e,"read from private field"),t?t.call(i):e.get(i)),ai=(i,e,t)=>e.has(i)?Cy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Xt=(i,e,t,s)=>(nm(i,e,"write to private field"),e.set(i,t),t),mc=(i,e,t)=>(nm(i,e,"access private method"),t),yk=()=>{try{return"0.26.1"}catch{}return"UNKNOWN"},Tk=yk(),bk=()=>Tk,_k=`
116<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.121-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>`,P={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",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"},Ak=Object.values(P),Qg=bk(),Xg="mux-video",Ii,Ra,Ll,xa,Rl,xl,kl,Dl,Cl,ka,Da,wl,Sk=class extends Zo{constructor(){super(),ai(this,Da),ai(this,Ii),ai(this,Ra),ai(this,Ll),ai(this,xa,{}),ai(this,Rl,{}),ai(this,xl),ai(this,kl),ai(this,Dl),ai(this,Cl),ai(this,ka,""),Xt(this,Ll,fy()),this.nativeEl.addEventListener("muxmetadata",i=>{var e;let t=Jx(this.nativeEl),s=(e=this.metadata)!=null?e:{};this.metadata={...t,...s},(t==null?void 0:t["com.mux.video.branding"])==="mux-free-plan"&&(Xt(this,ka,"default"),this.updateLogo())})}static get NAME(){return Xg}static get VERSION(){return Qg}static get observedAttributes(){var i;return[...Ak,...(i=Zo.observedAttributes)!=null?i:[]]}static getLogoHTML(i){return!i||i==="false"?"":i==="default"?_k:`<img part="logo" src="${i}" />`}static getTemplateHTML(i={}){var e;return`
117      ${Zo.getTemplateHTML(i)}
118      <style>
119        :host {
120          position: relative;
121        }
122        slot[name="logo"] {
123          display: flex;
124          justify-content: end;
125          position: absolute;
126          top: 1rem;
127          right: 1rem;
128          opacity: 0;
129          transition: opacity 0.25s ease-in-out;
130          z-index: 1;
131        }
132        slot[name="logo"]:has([part="logo"]) {
133          opacity: 1;
134        }
135        slot[name="logo"] [part="logo"] {
136          width: 5rem;
137          pointer-events: none;
138          user-select: none;
139        }
140      </style>
141      <slot name="logo">
142        ${this.getLogoHTML((e=i[P.LOGO])!=null?e:"")}
143      </slot>
144    `}get preferCmcd(){var i;return(i=this.getAttribute(P.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?Kd.includes(i)?this.setAttribute(P.PREFER_CMCD,i):console.warn(`Invalid value for preferCmcd. Must be one of ${Kd.join()}`):this.removeAttribute(P.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(P.PLAYER_INIT_TIME)?+this.getAttribute(P.PLAYER_INIT_TIME):_t(this,Ll)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(P.PLAYER_INIT_TIME):this.setAttribute(P.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=_t(this,Dl))!=null?i:Xg}set playerSoftwareName(i){Xt(this,Dl,i)}get playerSoftwareVersion(){var i;return(i=_t(this,kl))!=null?i:Qg}set playerSoftwareVersion(i){Xt(this,kl,i)}
vendor: 6,108 bytes, line 144
144get _hls(){var i;return(i=_t(this,Ii))==null?void 0:i.engine}get mux(){var i;return(i=this.nativeEl)==null?void 0:i.mux}get error(){var i;return(i=my(this.nativeEl))!=null?i:null}get errorTranslator(){return _t(this,Cl)}set errorTranslator(i){Xt(this,Cl,i)}get src(){return this.getAttribute("src")}set src(i){i!==this.src&&(i==null?this.removeAttribute("src"):this.setAttribute("src",i))}get type(){var i;return(i=this.getAttribute(P.TYPE))!=null?i:void 0}set type(i){i!==this.type&&(i?this.setAttribute(P.TYPE,i):this.removeAttribute(P.TYPE))}get preload(){let i=this.getAttribute("preload");return i===""?"auto":["none","metadata","auto"].includes(i)?i:super.preload}set preload(i){i!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(i)?this.setAttribute("preload",i):this.removeAttribute("preload"))}get debug(){return this.getAttribute(P.DEBUG)!=null}set debug(i){i!==this.debug&&(i?this.setAttribute(P.DEBUG,""):this.removeAttribute(P.DEBUG))}get disableTracking(){return this.hasAttribute(P.DISABLE_TRACKING)}set disableTracking(i){i!==this.disableTracking&&this.toggleAttribute(P.DISABLE_TRACKING,!!i)}get disableCookies(){return this.hasAttribute(P.DISABLE_COOKIES)}set disableCookies(i){i!==this.disableCookies&&(i?this.setAttribute(P.DISABLE_COOKIES,""):this.removeAttribute(P.DISABLE_COOKIES))}get startTime(){let i=this.getAttribute(P.START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set startTime(i){i!==this.startTime&&(i==null?this.removeAttribute(P.START_TIME):this.setAttribute(P.START_TIME,`${i}`))}get playbackId(){var i;return this.hasAttribute(P.PLAYBACK_ID)?this.getAttribute(P.PLAYBACK_ID):(i=im(this.src))!=null?i:void 0}set playbackId(i){i!==this.playbackId&&(i?this.setAttribute(P.PLAYBACK_ID,i):this.removeAttribute(P.PLAYBACK_ID))}get maxResolution(){var i;return(i=this.getAttribute(P.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(P.MAX_RESOLUTION,i):this.removeAttribute(P.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(P.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(P.MIN_RESOLUTION,i):this.removeAttribute(P.MIN_RESOLUTION))}get renditionOrder(){var i;return(i=this.getAttribute(P.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(P.RENDITION_ORDER,i):this.removeAttribute(P.RENDITION_ORDER))}get programStartTime(){let i=this.getAttribute(P.PROGRAM_START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set programStartTime(i){i==null?this.removeAttribute(P.PROGRAM_START_TIME):this.setAttribute(P.PROGRAM_START_TIME,`${i}`)}get programEndTime(){let i=this.getAttribute(P.PROGRAM_END_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set programEndTime(i){i==null?this.removeAttribute(P.PROGRAM_END_TIME):this.setAttribute(P.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){let i=this.getAttribute(P.ASSET_START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set assetStartTime(i){i==null?this.removeAttribute(P.ASSET_START_TIME):this.setAttribute(P.ASSET_START_TIME,`${i}`)}get assetEndTime(){let i=this.getAttribute(P.ASSET_END_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set assetEndTime(i){i==null?this.removeAttribute(P.ASSET_END_TIME):this.setAttribute(P.ASSET_END_TIME,`${i}`)}get customDomain(){var i;return(i=this.getAttribute(P.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(P.CUSTOM_DOMAIN,i):this.removeAttribute(P.CUSTOM_DOMAIN))}get drmToken(){var i;return(i=this.getAttribute(P.DRM_TOKEN))!=null?i:void 0}set drmToken(i){i!==this.drmToken&&(i?this.setAttribute(P.DRM_TOKEN,i):this.removeAttribute(P.DRM_TOKEN))}get playbackToken(){var i,e,t,s;if(this.hasAttribute(P.PLAYBACK_TOKEN))return(i=this.getAttribute(P.PLAYBACK_TOKEN))!=null?i:void 0;if(this.hasAttribute(P.PLAYBACK_ID)){let[,r]=Xf((e=this.playbackId)!=null?e:"");return(t=new URLSearchParams(r).get("token"))!=null?t:void 0}if(this.src)return(s=new URLSearchParams(this.src).get("token"))!=null?s:void 0}set playbackToken(i){i!==this.playbackToken&&(i?this.setAttribute(P.PLAYBACK_TOKEN,i):this.removeAttribute(P.PLAYBACK_TOKEN))}get tokens(){let i=this.getAttribute(P.PLAYBACK_TOKEN),e=this.getAttribute(P.DRM_TOKEN);return{..._t(this,Rl),...i!=null?{playback:i}:{},...e!=null?{drm:e}:{}}}set tokens(i){Xt(this,Rl,i??{})}get ended(){return vy(this.nativeEl,this._hls)}get envKey(){var i;return(i=this.getAttribute(P.ENV_KEY))!=null?i:void 0}set envKey(i){i!==this.envKey&&(i?this.setAttribute(P.ENV_KEY,i):this.removeAttribute(P.ENV_KEY))}get beaconCollectionDomain(){var i;return(i=this.getAttribute(P.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(P.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(P.BEACON_COLLECTION_DOMAIN))}get streamType(){var i;return(i=this.getAttribute(P.STREAM_TYPE))!=null?i:nh(this.nativeEl)}set streamType(i){i!==this.streamType&&(i?this.setAttribute(P.STREAM_TYPE,i):this.removeAttribute(P.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(P.TARGET_LIVE_WINDOW)?+this.getAttribute(P.TARGET_LIVE_WINDOW):ek(this.nativeEl)}set targetLiveWindow(i){i!=this.targetLiveWindow&&(i==null?this.removeAttribute(P.TARGET_LIVE_WINDOW):this.setAttribute(P.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i,e;if(this.hasAttribute(P.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:t}=this,s=(i=this.nativeEl.seekable.end(0))!=null?i:0,r=(e=this.nativeEl.seekable.start(0))!=null?e:0;return Math.max(r,s-t)}return tk(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(P.LIVE_EDGE_OFFSET))return+this.getAttribute(P.LIVE_EDGE_OFFSET)}set liveEdgeOffset(i){i!=this.liveEdgeOffset&&(i==null?this.removeAttribute(P.LIVE_EDGE_OFFSET):this.setAttribute(P.LIVE_EDGE_OFFSET,`${+i}`))}get seekable(){return sm(this.nativeEl)}async addCuePoints(i){return ny(this.nativeEl,i)}get activeCuePoint(){return ay(this.nativeEl)}get cuePoints(){return Rx(this.nativeEl)}
144async addChapters(i){return ly(this.nativeEl,i)}get activeChapter(){return dy(this.nativeEl)}get chapters(){return kx(this.nativeEl)}getStartDate(){return Cx(this.nativeEl,this._hls)}get currentPdt(){return wx(this.nativeEl,this._hls)}get preferPlayback(){let i=this.getAttribute(P.PREFER_PLAYBACK);if(i===Ki.MSE||i===Ki.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===Ki.MSE||i===Ki.NATIVE?this.setAttribute(P.PREFER_PLAYBACK,i):this.removeAttribute(P.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(i=>i.startsWith("metadata-")&&![P.METADATA_URL].includes(i)).reduce((i,e)=>{let t=this.getAttribute(e);return t!=null&&(i[e.replace(/^metadata-/,"").replace(/-/g,"_")]=t),i},{}),..._t(this,xa)}}set metadata(i){Xt(this,xa,i??{}),this.mux&&this.mux.emit("hb",_t(this,xa))}get _hlsConfig(){return _t(this,xl)}set _hlsConfig(i){Xt(this,xl,i)}get logo(){var i;return(i=this.getAttribute(P.LOGO))!=null?i:_t(this,ka)}set logo(i){i?this.setAttribute(P.LOGO,i):this.removeAttribute(P.LOGO)}load(){Xt(this,Ii,rk(this,this.nativeEl,_t(this,Ii)))}unload(){Ey(this.nativeEl,_t(this,Ii),this),Xt(this,Ii,void 0)}attributeChangedCallback(i,e,t){var s,r;switch(Zo.observedAttributes.includes(i)&&!["src","autoplay","preload"].includes(i)&&super.attributeChangedCallback(i,e,t),i){case P.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=t??void 0;break;case P.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=t??void 0;break;case"src":{let n=!!e,a=!!t;!n&&a?mc(this,Da,wl).call(this):n&&!a?this.unload():n&&a&&(this.unload(),mc(this,Da,wl).call(this));break}
144case"autoplay":if(t===e)break;(s=_t(this,Ii))==null||s.setAutoplay(this.autoplay);break;case"preload":if(t===e)break;(r=_t(this,Ii))==null||r.setPreload(t);break;case P.PLAYBACK_ID:this.src=rh(this);break;case P.DEBUG:{let n=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=n);break}case P.METADATA_URL:t&&fetch(t).then(n=>n.json()).then(n=>this.metadata=n).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${t}!`));break;case P.STREAM_TYPE:(t==null||t!==e)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case P.TARGET_LIVE_WINDOW:(t==null||t!==e)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;case P.LOGO:(t==null||t!==e)&&this.updateLogo();break}}updateLogo(){if(!this.shadowRoot)return;let i=this.shadowRoot.querySelector('slot[name="logo"]');if(!i)return;let e=this.constructor.getLogoHTML(_t(this,ka)||this.logo);i.innerHTML=e}connectedCallback(){var i;(i=super.connectedCallback)==null||i.call(this),this.nativeEl&&this.src&&!_t(this,Ii)&&mc(this,Da,wl).call(this)}disconnectedCallback(){this.unload()}handleEvent(i){i.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(i.type,{composed:!0,detail:i.detail}))}};Ii=new WeakMap,Ra=new WeakMap,Ll=new WeakMap,xa=new WeakMap,Rl=new WeakMap,xl=new WeakMap,kl=new WeakMap,Dl=new WeakMap,Cl=new WeakMap,ka=new WeakMap,Da=new WeakSet,wl=async function(){_t(this,Ra)||(await Xt(this,Ra,Promise.resolve()),Xt(this,Ra,null),this.load())};const Pr=new WeakMap;
144class pc extends Error{}class Ik extends Error{}const Lk=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"],Rk=globalThis.WeakRef?class extends Set{add(i){super.add(new WeakRef(i))}forEach(i){super.forEach(e=>{const t=e.deref();t&&i(t)})}}:Set;function xk(i){var e,t,s;(t=(e=globalThis.chrome)==null?void 0:e.cast)!=null&&t.isAvailable?(s=globalThis.cast)!=null&&s.framework?i():customElements.whenDefined("google-cast-button").then(i):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(i)}}function kk(){return globalThis.chrome}function Dk(){var t;const i="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if((t=globalThis.chrome)!=null&&t.cast||document.querySelector(`script[src="${i}"]`))return;const e=document.createElement("script");e.src=i,document.head.append(e)}function Xs(){var i,e;return(e=(i=globalThis.cast)==null?void 0:i.framework)==null?void 0:e.CastContext.getInstance()}function am(){var i;return(i=Xs())==null?void 0:i.getCurrentSession()}function om(){var i;return(i=am())==null?void 0:i.getSessionObj().media[0]}function Ck(i){return new Promise((e,t)=>{om().editTracksInfo(i,e,t)})}function wk(i){return new Promise((e,t)=>{om().getStatus(i,e,t)})}function Zg(i){return Xs().setOptions({...wy(),...i})}function wy(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}function Mk(i){if(!i)return;const e=/\.([a-zA-Z0-9]+)(?:\?.*)?$/,t=i.match(e);return t?t[1]:null}function Pk(i){const e=i.split(`
145`),t=[];for(let s=0;s<e.length;s++)if(e[s].trim().startsWith("#EXT-X-STREAM-INF")){const n=e[s+1]?e[s+1].trim():"";n&&!n.startsWith("#")&&t.push(n)}return t}function Ok(i){return i.split(`
146`).find(s=>!s.trim().startsWith("#")&&s.trim()!=="")}async function Nk(i){try{const t=(await fetch(i,{method:"HEAD"})).headers.get("Content-Type");return Lk.some(s=>t===s)}catch(e){return console.error("Error while trying to get the Content-Type of the manifest",e),!1}}async function Uk(i){try{const e=await(await fetch(i)).text();let t=e;const s=Pk(e);if(s.length>0){const a=new URL(s[0],i).toString();t=await(await fetch(a)).text()}const r=Ok(t);return Mk(r)}catch(e){console.error("Error while trying to parse the manifest playlist",e);return}}const Ml=new Rk,Ts=new WeakSet;let ct;xk(()=>{var i,e,t,s;if(!((e=(i=globalThis.chrome)==null?void 0:i.cast)!=null&&e.isAvailable)){console.debug("chrome.cast.isAvailable",(s=(t=globalThis.chrome)==null?void 0:t.cast)==null?void 0:s.isAvailable);return}ct||(ct=cast.framework,Xs().addEventListener(ct.CastContextEventType.CAST_STATE_CHANGED,r=>{Ml.forEach(n=>{var a,o;return(o=(a=Pr.get(n)).onCastStateChanged)==null?void 0:o.call(a,r)})}),Xs().addEventListener(ct.CastContextEventType.SESSION_STATE_CHANGED,r=>{Ml.forEach(n=>{var a,o;return(o=(a=Pr.get(n)).onSessionStateChanged)==null?void 0:o.call(a,r)})}),Ml.forEach(r=>{var n,a;return(a=(n=Pr.get(r)).init)==null?void 0:a.call(n)}))});let Jg=0;var ke,Do,Ht,ds,Dr,Cr,Fs,cu,Ge,hr,My,Py,dh,Oy,uh,Ny,ch;class Fk extends EventTarget{constructor(t){super();he(this,Ge);he(this,ke);he(this,Do);he(this,Ht);he(this,ds);he(this,Dr,"disconnected");he(this,Cr,!1);he(this,Fs,new Set);he(this,cu,new WeakMap);ue(this,ke,t),Ml.add(this),Pr.set(this,{init:()=>$e(this,Ge,uh).call(this),onCastStateChanged:()=>$e(this,Ge,dh).call(this),onSessionStateChanged:()=>$e(this,Ge,Oy).call(this),getCastPlayer:()=>M(this,Ge,hr)}),$e(this,Ge,uh).call(this)}get state(){return M(this,Dr)}async watchAvailability(t){if(M(this,ke).disableRemotePlayback)throw new pc("disableRemotePlayback attribute is present.");return M(this,cu).set(t,++Jg),M(this,Fs).add(t),queueMicrotask(()=>t($e(this,Ge,Py).call(this))),Jg}async cancelWatchAvailability(t){if(M(this,ke).disableRemotePlayback)throw new pc("disableRemotePlayback attribute is present.");t?M(this,Fs).delete(t):M(this,Fs).clear()}async prompt(){var s,r,n,a;if(M(this,ke).disableRemotePlayback)throw new pc("disableRemotePlayback attribute is present.");if(!((r=(s=globalThis.chrome)==null?void 0:s.cast)!=null&&r.isAvailable))throw new Ik("The RemotePlayback API is disabled on this platform.");const t=Ts.has(M(this,ke));Ts.add(M(this,ke)),Zg(M(this,ke).castOptions),Object.entries(M(this,ds)).forEac
146h(([o,l])=>{M(this,Ht).controller.addEventListener(o,l)});try{await Xs().requestSession()}catch(o){if(t||Ts.delete(M(this,ke)),o==="cancel")return;throw new Error(o)}(a=(n=Pr.get(M(this,ke)))==null?void 0:n.loadOnPrompt)==null||a.call(n)}}ke=new WeakMap,Do=new WeakMap,Ht=new WeakMap,ds=new WeakMap,Dr=new WeakMap,Cr=new WeakMap,Fs=new WeakMap,cu=new WeakMap,Ge=new WeakSet,hr=function(){if(Ts.has(M(this,ke)))return M(this,Ht)},My=function(){Ts.has(M(this,ke))&&(Object.entries(M(this,ds)).forEach(([t,s])=>{M(this,Ht).controller.removeEventListener(t,s)}),Ts.delete(M(this,ke)),M(this,ke).muted=M(this,Ht).isMuted,M(this,ke).currentTime=M(this,Ht).savedPlayerState.currentTime,M(this,Ht).savedPlayerState.isPaused===!1&&M(this,ke).play())},Py=function(){var s;const t=(s=Xs())==null?void 0:s.getCastState();return t&&t!=="NO_DEVICES_AVAILABLE"},dh=function(){const t=Xs().getCastState();if(Ts.has(M(this,ke))&&t==="CONNECTING"&&(ue(this,Dr,"connecting"),this.dispatchEvent(new Event("connecting"))),!M(this,Cr)&&(t!=null&&t.includes("CONNECT"))){ue(this,Cr,!0);for(let s of M(this,Fs))s(!0)}else if(M(this,Cr)&&(!t||t==="NO_DEVICES_AVAILABLE")){ue(this,Cr,!1);for(let s of M(this,Fs))s(!1)}},Oy=async function(){var s;const{SESSION_RESUMED:t}=ct.SessionState;if(Xs().getSessionState()===t&&M(this,ke).castSrc===((s=om())==null?void 0:s.media.contentId)){Ts.add(M(this,ke)),Object.entries(M(this,ds)).forEach(([r,n])=>{M(this,Ht).controller.addEventListener(r,n)});try{await wk(new chrome.cast.media.GetStatusRequest)}catch(r){console.error(r)}M(this,ds)[ct.RemotePlayerEventType.IS_PAUSED_CHANGED](),M(this,ds)[ct.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},uh=function(){!ct||M(this,Do)||(ue(this,Do,!0),Zg(M(this,ke).castOptions),M(this,ke).textTracks.addEventListener("change",()=>$e(this,Ge,ch).call(this)),$e(this,Ge,dh).call(this),ue(this,Ht,new ct.RemotePlayer),new ct.RemotePlayerController(M(this,Ht)),ue(this,ds,{[ct.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:t})=>{t===!0?(ue(this,Dr,"connected"),this.dispatchEvent(new Event("connect"))):($e(this,Ge,My).call(this),ue(this,Dr,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[ct.RemotePlayerEventType.DURATION_CHANGED]:()=>{M(this,ke).dispatchEvent(new Event("durationchange"))},[ct.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{M(this,ke).dispatchEvent(new Event("volumechange"))},[ct.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{M(this,ke).dispatchEvent(new Event("volumechange"))},[ct.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var t;(t=M(this,Ge,hr))!=null&&t.isMediaLoaded&&M(this,ke).dispatchEvent(new Event("timeupdate"))},[ct.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{M(this,ke).dispatchEvent(new Event("resize"))},[ct.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{M(this,ke).dispatchEvent(new Event(this.paused?"pause":"play"))},[ct.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var t,s;((t=M(this,Ge,hr))==null?void 0:t.playerState)!==chrome.cast.media.PlayerState.PAUSED&&M(this,ke).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(s=M(this,Ge,hr))==null?void 0:s.playerState]))},[ct.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{var t;(t=M(this,Ge,hr))!=null&&t.isMediaLoaded&&(await Promise.resolve(),$e(this,Ge,Ny).call(this))}}))},Ny=function(){$e(this,Ge,ch).call(this)},ch=async function(){var h,f,m;if(!M(this,Ge,hr))return;const s=(((h=M(this,Ht).mediaInfo)==null?void 0:h.tracks)??[]).filter(({type:p})=>p===chrome.cast.media.TrackType.TEXT),r=[...M(this,ke).textTracks].filter(({kind:p})=>p==="subtitles"||p==="captions"),n=s.map(({language:p,name:g,trackId:v})=>{const{mode:T}=r.find(y=>y.language===p&&y.label===g)??{};return T?{mode:T,trackId:v}:!1}).filter(Boolean),o=n.filter(({mode:p})=>p!=="showing").map(({trackId:p})=>p),l=n.find(({mode:p})=>p==="showing"),d=((m=(f=am())==null?void 0:f.getSessionObj().media[0])==null?void 0:m.activeTrackIds)??[];let u=d;if(d.length&&(u=u.filter(p=>!o.includes(p))),l!=null&&l.trackId&&(u=[...u,l.trackId]),u=[...new Set(u)],!((p,g)=>p.length===g.length&&p.every(v=>g.includes(v)))(d,u))try{const p=new chrome.cast.media.EditTracksInfoRequest(u);await Ck(p)}catch(p){console.error(p)}};const $k=i=>{var e,t,s,r,n,a,Se,Uy;return e=class extends i{constructor(){super(...arguments);he(this,a);he(this,t,{paused:!1});he(this,s,wy());he(this,r);he(this,n)}get remote(){return M(this,n)?M(this,n):kk()?(this.disableRemotePlayback||Dk(),Pr.set(this,{loadOnPrompt:()=>$e(this,a,Uy).call(this)}),ue(this,n,new Fk(this))):super.remote}attributeChangedCallback(c,h,f){if(super.attributeChangedCallback(c,h,f),c==="cast-receiver"&&f){M(this,s).receiverApplicationId=f;return}if(M(this,a,Se))switch(c){case"cast-stream-type":case"cast-src":this.load();break}}async load(){var g;if(!M(this,a,Se))return super.load();const c=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);c.customData=this.castCustomData;const h=[...this.querySelectorAll("track")].filter(({kind:v,src:T})=>T&&(v==="subtitles"||v==="captions")),f=[];let m=0;if(h.length&&(c.tracks=h.map(v=>{const T=++m;f.length===0&&v.track.mode==="showing"&&f.push(T);const y=new chrome.cast.media.Track(T,chrome.cast.media.TrackType.TEXT);return y.trackContentId=v.src,y.trackContentType="text/vtt",y.subtype=v.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,y.name=v.label,y.language=v.srclang,y})),this.castStreamType==="live"?c.streamType=chrome.cast.media.StreamType.LIVE:c.streamType=chrome.cast.media.StreamType.BUFFERED,c.metadata=new chrome.cast.media.GenericMediaMetadata,c.metadata.title=this.title,c.metadata.images=[{url:this.poster}],Nk(this.castSrc)){const v=await Uk(this.castSrc);((v==null?void 0:v.includes("m4s"))||(v==null?void 0:v.includes("mp4")))&&(c.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,c.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4)}const p=new chrome.cast.media.LoadRequest(c);p.currentTime=super.currentTime??0,p.autoplay=!M(this,t).paused,p.activeTrackIds=f,await((g=am())==null?void 0:g.loadMedia(p)),this.dispatchEvent(new Event("volumechange"))}play(){var c;if(M(this,a,Se)){M(this,a,Se).isPaused&&((c=M(this,a,Se).controller)==null||c.playOrPause());return}return super.play()}pause(){var c;if(M(this,a,Se)){M(this,a,Se).isPaused||(c=M(this,a,Se).controller)==null||c.playOrPause();return}super.pause()}get castOptions(){return M(this,s)}get castReceiver(){return this.getAttribute("cast-receiver")??void 0}set castReceiver(c){this.castReceiver!=c&&this.setAttribute("cast-receiver",`${c}`)}get castSrc(){var c;return this.getAttribute("cast-src")??((c=this.querySelector("source"))==null?void 0:c.src)??this.currentSrc}set castSrc(c){this.castSrc!=c&&this.setAttribute("cast-src",`${c}`)}get castContentType(){return this.getAttribute("cast-content-type")??void 0}set castContentType(c){this.setAttribute("cast-content-type",`${c}`)}get castStreamType(){return this.getAttribute("cast-stream-type")??this.streamType??void 0}set castStreamType(c){this.setAttribute("cast-stream-type",`${c}`)}get castCustomData(){return M(this,r)}set castCustomData(c){const h=typeof c;if(!["object","undefined"].includes(h)){console.error(`castCustomData must be nullish or an object but value was of type ${h}`);return}ue(this,r,c)}get readyState(){if(M(this,a,Se))switch(M(this,a,Se).playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return M(this,a,Se)?M(this,a,Se).isPaused:super.paused}get muted(){var c;return M(this,a,Se)?(c=M(this,a,Se))==null?void 0:c.isMuted:super.muted}set muted(c){var h;if(M(this,a,Se)){(c&&!M(this,a,Se).isMuted||!c&&M(this,a,Se).isMuted)&&((h=M(this,a,Se).controller)==null||h.muteOrUnmute());return}super.muted=c}get volume(){var c;return M(this,a,Se)?((c=M(this,a,Se))==null?void 0:c.volumeLevel)??1:super.volume}set volume(c){var h;if(M(this,a,Se)){M(this,a,Se).volumeLevel=+c,(h=M(this,a,Se).controller)==null||h.setVolumeLevel();return}super.volume=c}get duration(){var c,h;return M(this,a,Se)&&((c=M(this,a,Se))!=null&&c.isMediaLoaded)?((h=M(this,a,Se))==null?void 0:h.duration)??NaN:super.duration}get currentTime(){var c,h;return M(this,a,Se)&&((c=M(this,a,Se))!=null&&c.isMediaLoaded)?((h=M(this,a,Se))==null?void 0:h.currentTime)??0:super.currentTime}set currentTime(c){var h;if(M(this,a,Se)){M(this,a,Se).currentTime=c,(h=M(this,a,Se).controller)==null||h.seek();return}super.currentTime=c}},t=new WeakMap,s=new WeakMap,r=new WeakMap,n=new WeakMap,a=new WeakSet,Se=function(){var c,h;
146return(h=(c=Pr.get(this.remote))==null?void 0:c.getCastPlayer)==null?void 0:h.call(c)},Uy=async function(){M(this,t).paused=Uo(e.prototype,this,"paused"),Uo(e.prototype,this,"pause").call(this),this.muted=Uo(e.prototype,this,"muted");try{await this.load()}catch(c){console.error(c)}},xe(e,"observedAttributes",[...i.observedAttributes??[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),e};class yu extends Event{constructor(t,s){super(t);xe(this,"track");this.track=s.track}}const hh=new WeakMap;function z(i){return hh.get(i)??Bk(i,{})}function Bk(i,e){let t=hh.get(i);return t||hh.set(i,t={}),Object.assign(t,e)}function fh(i,e){const t=i.videoTracks;z(e).media=i,z(e).renditionSet||(z(e).renditionSet=new Set);const s=z(t).trackSet;s.add(e);const r=s.size-1;r in ph.prototype||Object.defineProperty(ph.prototype,r,{get(){return[...z(this).trackSet][r]}}),queueMicrotask(()=>{t.dispatchEvent(new yu("addtrack",{track:e}))})}function mh(i){var s;const e=(s=z(i).media)==null?void 0:s.videoTracks;if(!e)return;z(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new yu("removetrack",{track:i}))})}function Hk(i){const e=z(i).media.videoTracks??[];let t=!1;for(const s of e)s!==i&&(s.selected=!1,t=!0);if(t){if(z(e).changeRequested)return;z(e).changeRequested=!0,queueMicrotask(()=>{delete z(e).changeRequested,e.dispatchEvent(new Event("change"))})}}var $s,Bs,Hs,wr,Ca;class ph extends EventTarget{constructor(){super();he(this,wr);he(this,$s);he(this,Bs);he(this,Hs);z(this).trackSet=new Set}[Symbol.iterator](){return M(this,wr,Ca).values()}get length(){return M(this,wr,Ca).size}getTrackById(t){return[...M(this,wr,Ca)].find(s=>s.id===t)??null}get selectedIndex(){return[...M(this,wr,Ca)].findIndex(t=>t.selected)}get onaddtrack(){return M(this,$s)}set onaddtrack(t){M(this,$s)&&(this.removeEventListener("addtrack",M(this,$s)),ue(this,$s,void 0)),typeof t=="function"&&(ue(this,$s,t),this.addEventListener("addtrack",t))}get onremovetrack(){return M(this,Bs)}set onremovetrack(t){M(this,Bs)&&(this.removeEventListener("removetrack",M(this,Bs)),ue(this,Bs,void 0)),typeof t=="function"&&(ue(this,Bs,t),this.addEventListener("removetrack",t))}get onchange(){return M(this,Hs)}set onchange(t){M(this,Hs)&&(this.removeEventListener("change",M(this,Hs)),ue(this,Hs,void 0)),typeof t=="function"&&(ue(this,Hs,t),this.addEventListener("change",t))}}$s=new WeakMap,Bs=new WeakMap,Hs=new WeakMap,wr=new WeakSet,Ca=function(){return z(this).trackSet};class Tu extends Event{constructor(t,s){super(t);xe(this,"rendition");this.rendition=s.rendition}}function Gk(i,e){const t=z(i).media.videoRenditions;z(e).media=z(i).media,z(e).track=i;const s=z(i).renditionSet;s.add(e);const r=s.size-1;r in gh.prototype||Object.defineProperty(gh.prototype,r,{get(){return on(this)[r]}}),queueMicrotask(()=>{i.selected&&t.dispatchEvent(new Tu("addrendition",{rendition:e}))})}function Kk(i){const e=z(i).media.videoRenditions,t=z(i).track;z(t).renditionSet.delete(i),queueMicrotask(()=>{z(i).track.selected&&e.dispatchEvent(new Tu("removerendition",{rendition:i}))})}function Vk(i){const e=z(i).media.videoRenditions;!e||z(e).changeRequested||(z(e).changeRequested=!0,queueMicrotask(()=>{delete z(e).changeRequested,z(i).track.selected&&e.dispatchEvent(new Event("change"))}))}function on(i){return[...z(i).media.videoTracks].filter(t=>t.selected).flatMap(t=>[...z(t).renditionSet])}var Gs,Ks,Vs;
146class gh extends EventTarget{constructor(){super(...arguments);he(this,Gs);he(this,Ks);he(this,Vs)}[Symbol.iterator](){return on(this).values()}get length(){return on(this).length}getRenditionById(t){return on(this).find(s=>`${s.id}`==`${t}`)??null}get selectedIndex(){return on(this).findIndex(t=>t.selected)}set selectedIndex(t){for(const[s,r]of on(this).entries())r.selected=s===t}get onaddrendition(){return M(this,Gs)}set onaddrendition(t){M(this,Gs)&&(this.removeEventListener("addrendition",M(this,Gs)),ue(this,Gs,void 0)),typeof t=="function"&&(ue(this,Gs,t),this.addEventListener("addrendition",t))}get onremoverendition(){return M(this,Ks)}set onremoverendition(t){M(this,Ks)&&(this.removeEventListener("removerendition",M(this,Ks)),ue(this,Ks,void 0)),typeof t=="function"&&(ue(this,Ks,t),this.addEventListener("removerendition",t))}get onchange(){return M(this,Vs)}set onchange(t){M(this,Vs)&&(this.removeEventListener("change",M(this,Vs)),ue(this,Vs,void 0)),typeof t=="function"&&(ue(this,Vs,t),this.addEventListener("change",t))}}Gs=new WeakMap,Ks=new WeakMap,Vs=new WeakMap;var Gn;class Wk{constructor(){xe(this,"src");xe(this,"id");xe(this,"width");xe(this,"height");xe(this,"bitrate");xe(this,"frameRate");xe(this,"codec");he(this,Gn,!1)}get selected(){return M(this,Gn)}set selected(e){M(this,Gn)!==e&&(ue(this,Gn,e),Vk(this))}}Gn=new WeakMap;var Kn;class Fy{constructor(){xe(this,"id");xe(this,"kind");xe(this,"label","");xe(this,"language","");xe(this,"sourceBuffer");he(this,Kn,!1)}addRendition(e,t,s,r,n,a){const o=new Wk;return o.src=e,o.width=t,o.height=s,o.frameRate=a,o.bitrate=n,o.codec=r,Gk(this,o),o}removeRendition(e){Kk(e)}get selected(){return M(this,Kn)}set selected(e){M(this,Kn)!==e&&(ue(this,Kn,e),e===!0&&Hk(this))}}Kn=new WeakMap;function qk(i,e){const t=z(i).media.audioRenditions;z(e).media=z(i).media,z(e).track=i;const s=z(i).renditionSet;s.add(e);const r=s.size-1;r in vh.prototype||Object.defineProperty(vh.prototype,r,{get(){return ln(this)[r]}}),queueMicrotask(()=>{i.enabled&&t.dispatchEvent(new Tu("addrendition",{rendition:e}))})}function Yk(i){const e=z(i).media.audioRenditions,t=z(i).track;z(t).renditionSet.delete(i),queueMicrotask(()=>{z(i).track.enabled&&e.dispatchEvent(new Tu("removerendition",{rendition:i}))})}function jk(i){const e=z(i).media.audioRenditions;!e||z(e).changeRequested||(z(e).changeRequested=!0,queueMicrotask(()=>{delete z(e).changeRequested,z(i).track.enabled&&e.dispatchEvent(new Event("change"))}))}function ln(i){return[...z(i).media.audioTracks].filter(t=>t.enabled).flatMap(t=>[...z(t).renditionSet])}var Ws,qs,Ys;class vh extends EventTarget{constructor(){super(...arguments);he(this,Ws);he(this,qs);he(this,Ys)}[Symbol.iterator](){return ln(this).values()}get length(){return ln(this).length}getRenditionById(t){return ln(this).find(s=>`${s.id}`==`${t}`)??null}get selectedIndex(){return ln(this).findIndex(t=>t.selected)}set selectedIndex(t){for(const[s,r]of ln(this).entries())r.selected=s===t}get onaddrendition(){return M(this,Ws)}set onaddrendition(t){M(this,Ws)&&(this.removeEventListener("addrendition",M(this,Ws)),ue(this,Ws,void 0)),typeof t=="function"&&(ue(this,Ws,t),this.addEventListener("addrendition",t))}get onremoverendition(){return M(this,qs)}set onremoverendition(t){M(this,qs)&&(this.removeEventListener("removerendition",M(this,qs)),ue(this,qs,void 0)),typeof t=="function"&&(ue(this,qs,t),this.addEventListener("removerendition",t))}get onchange(){return M(this,Ys)}set onchange(t){M(this,Ys)&&(this.removeEventListener("change",M(this,Ys)),ue(this,Ys,void 0)),typeof t=="function"&&(ue(this,Ys,t),this.addEventListener("change",t))}}Ws=new WeakMap,qs=new WeakMap,Ys=new WeakMap;var Vn;class zk{constructor(){xe(this,"src");xe(this,"id");xe(this,"bitrate");xe(this,"codec");he(this,Vn,!1)}get selected(){return M(this,Vn)}set selected(e){M(this,Vn)!==e&&(ue(this,Vn,e),jk(this))}}Vn=new WeakMap;function Eh(i,e){const t=i.audioTracks;z(e).media=i,z(e).renditionSet||(z(e).renditionSet=new Set);const s=z(t).trackSet;s.add(e);const r=s.size-1;r in Th.prototype||Object.defineProperty(Th.prototype,r,{get(){return[...z(this).trackSet][r]}}),queueMicrotask(()=>{t.dispatchEvent(new yu("addtrack",{track:e}))})}function yh(i){var s;const e=(s=z(i).media)==null?void 0:s.audioTracks;
146if(!e)return;z(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new yu("removetrack",{track:i}))})}function Qk(i){const e=z(i).media.audioTracks;!e||z(e).changeRequested||(z(e).changeRequested=!0,queueMicrotask(()=>{delete z(e).changeRequested,e.dispatchEvent(new Event("change"))}))}var js,zs,Qs,Wn,Pl;class Th extends EventTarget{constructor(){super();he(this,Wn);he(this,js);he(this,zs);he(this,Qs);z(this).trackSet=new Set}[Symbol.iterator](){return M(this,Wn,Pl).values()}get length(){return M(this,Wn,Pl).size}getTrackById(t){return[...M(this,Wn,Pl)].find(s=>s.id===t)??null}get onaddtrack(){return M(this,js)}set onaddtrack(t){M(this,js)&&(this.removeEventListener("addtrack",M(this,js)),ue(this,js,void 0)),typeof t=="function"&&(ue(this,js,t),this.addEventListener("addtrack",t))}get onremovetrack(){return M(this,zs)}set onremovetrack(t){M(this,zs)&&(this.removeEventListener("removetrack",M(this,zs)),ue(this,zs,void 0)),typeof t=="function"&&(ue(this,zs,t),this.addEventListener("removetrack",t))}get onchange(){return M(this,Qs)}set onchange(t){M(this,Qs)&&(this.removeEventListener("change",M(this,Qs)),ue(this,Qs,void 0)),typeof t=="function"&&(ue(this,Qs,t),this.addEventListener("change",t))}}js=new WeakMap,zs=new WeakMap,Qs=new WeakMap,Wn=new WeakSet,Pl=function(){return z(this).trackSet};var qn;class $y{constructor(){xe(this,"id");xe(this,"kind");xe(this,"label","");xe(this,"language","");xe(this,"sourceBuffer");he(this,qn,!1)}addRendition(e,t,s){const r=new zk;return r.src=e,r.codec=t,r.bitrate=s,qk(this,r),r}removeRendition(e){Yk(e)}get enabled(){return M(this,qn)}set enabled(e){M(this,qn)!==e&&(ue(this,qn,e),Qk(this))}}qn=new WeakMap;const e0=Wd(globalThis.HTMLMediaElement,"video"),t0=Wd(globalThis.HTMLMediaElement,"audio");function Xk(i){if(!(i!=null&&i.prototype))return i;const e=Wd(i,"video");(!e||`${e}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"videoTracks",{get(){return Zk(this)}});const t=Wd(i,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"audioTracks",{get(){return Jk(this)}}),"addVideoTrack"in i.prototype||(i.prototype.addVideoTrack=function(n,a="",o=""){const l=new Fy;return l.kind=n,l.label=a,l.language=o,fh(this,l),l}),"removeVideoTrack"in i.prototype||(i.prototype.removeVideoTrack=mh),"addAudioTrack"in i.prototype||(i.prototype.addAudioTrack=function(n,a="",o=""){const l=new $y;return l.kind=n,l.label=a,l.language=o,Eh(this,l),l}),"removeAudioTrack"in i.prototype||(i.prototype.removeAudioTrack=yh),"videoRenditions"in i.prototype||Object.defineProperty(i.prototype,"videoRenditions",{get(){return s(this)}});const s=n=>{let a=z(n).videoRenditions;return a||(a=new gh,z(a).media=n,z(n).videoRenditions=a),a};"audioRenditions"in i.prototype||Object.defineProperty(i.prototype,"audioRenditions",{get(){return r(this)}});const r=n=>{let a=z(n).audioRenditions;return a||(a=new vh,z(a).media=n,z(n).audioRenditions=a),a};return i}function Wd(i,e){var t;if(i!=null&&i.prototype)return(t=Object.getOwnPropertyDescriptor(i.prototype,`${e}Tracks`))==null?void 0:t.get}function Zk(i){let e=z(i).videoTracks;if(!e&&(e=new ph,z(i).videoTracks=e,e0)){const t=e0.call(i.nativeEl??i);for(const s of t)fh(i,s);t.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),t.addEventListener("addtrack",s=>{if([...e].some(r=>r instanceof Fy)){for(const r of t)mh(r);return}fh(i,s.track)}),t.addEventListener("removetrack",s=>{mh(s.track)})}return e}function Jk(i){let e=z(i).audioTracks;
146if(!e&&(e=new Th,z(i).audioTracks=e,t0)){const t=t0.call(i.nativeEl??i);for(const s of t)Eh(i,s);t.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),t.addEventListener("addtrack",s=>{if([...e].some(r=>r instanceof $y)){for(const r of t)yh(r);return}Eh(i,s.track)}),t.addEventListener("removetrack",s=>{yh(s.track)})}return e}var By=i=>{throw TypeError(i)},Hy=(i,e,t)=>e.has(i)||By("Cannot "+t),eD=(i,e,t)=>(Hy(i,e,"read from private field"),t?t.call(i):e.get(i)),tD=(i,e,t)=>e.has(i)?By("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),iD=(i,e,t,s)=>(Hy(i,e,"write to private field"),e.set(i,t),t),Gy=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment>"u"){class i extends Gy{}globalThis.DocumentFragment=i}var sD=class extends Gy{},rD={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(sD)}},nD={customElements:rD},aD=typeof window>"u"||typeof globalThis.customElements>"u",gc=aD?nD:globalThis,Ol,i0=class extends $k(Xk(Sk)){constructor(){super(...arguments),tD(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=eD(this,Ol))!=null?i:this.muxCastCustomData}set castCustomData(i){iD(this,Ol,i)}};Ol=new WeakMap;gc.customElements.get("mux-video")||(gc.customElements.define("mux-video",i0),gc.MuxVideoElement=i0);const Q={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},Re={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},Ky={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
146LAYED:"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_WIDTH:"mediaWidth"},Vy=Object.entries(Ky),b=Vy.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{}),oD={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},ms=Vy.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{...oD});Object.entries(ms).reduce((i,[e,t])=>{const s=b[e];return s&&(i[t]=s),i},{userinactivechange:"userinactive"});const lD=Object.entries(b).reduce((i,[e,t])=>{const s=ms[e];return s&&(i[t]=s),i},{userinactive:"userinactivechange"}),qi={SUBTITLES:"subtitles",CAPTIONS:"captions",CHAPTERS:"chapters",METADATA:"metadata"},On={DISABLED:"disabled",SHOWING:"showing"},s0={MOUSE:"mouse",TOUCH:"touch"},zt={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},os={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},dD={FULLSCREEN:"fullscreen"};function uD(i){return i==null?void 0:i.map(hD).join(" ")}function cD(i){return i==null?void 0:i.split(/\s+/).map(fD)}function hD(i){if(i){const{id:e,width:t,height:s}=i;return[e,t,s].filter(r=>r!=null).join(":")}}function fD(i){if(i){const[e,t,s]=i.split(":");return{id:e,width:+t,height:+s}}}function mD(i){return i==null?void 0:i.map(gD).join(" ")}function pD(i){return i==null?void 0:i.split(/\s+/).map(vD)}function gD(i){if(i){const{id:e,kind:t,language:s,label:r}=i;return[e,t,s,r].filter(n=>n!=null).join(":")}}function vD(i){if(i){const[e,t,s,r]=i.split(":");return{id:e,kind:t,language:s,label:r}}}function ED(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function lm(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function Wy(i){return typeof i!="string"?!1:!isNaN(i)&&!isNaN(parseFloat(i))}const qy=i=>new Promise(e=>setTimeout(e,i)),r0=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],yD=(i,e)=>{const t=i===1?r0[e].singular:r0[e].plural;return`${i} ${t}`},Ja=i=>{if(!lm(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&&yD(o,l)).filter(o=>o).join(", ")}${t?" remaining":""}`};function Js(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 TD={"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",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
146ource 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 n0;const vc={en:TD};let bh=((n0=globalThis.navigator)==null?void 0:n0.language)||"en";const bD=i=>{bh=i},_D=i=>{var e,t,s;const[r]=bh.split("-");return((e=vc[bh])==null?void 0:e[i])||((t=vc[r])==null?void 0:t[i])||((s=vc.en)==null?void 0:s[i])||i},Z=(i,e={})=>_D(i).replace(/\{(\w+)\}/g,(t,s)=>s in e?String(e[s]):`{${s}}`);let Yy=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}};class jy extends Yy{}let a0=class extends jy{constructor(){super(...arguments),this.role=null}};class AD{observe(){}unobserve(){}disconnect(){}}const zy={createElement:function(){return new go.HTMLElement},createElementNS:function(){return new go.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(i){return!1}},go={ResizeObserver:AD,document:zy,Node:jy,Element:a0,HTMLElement:class extends a0{constructor(){super(...arguments),this.innerHTML=""}get content(){return new go.DocumentFragment}},DocumentFragment:class extends Yy{},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}}}}},Qy=typeof window>"u"||typeof window.customElements>"u",Xy=Object.keys(go).every(i=>i in globalThis),C=Qy&&!Xy?go:globalThis,mt=Qy&&!Xy?zy:globalThis.document,o0=new WeakMap,dm=i=>{let e=o0.get(i);return e||o0.set(i,e=new Set),e},Zy=new C.ResizeObserver(i=>{for(const e of i)for(const t of dm(e.target))t(e)});function Xn(i,e){dm(i).add(e),Zy.observe(i)}function Zn(i,e){const t=dm(i);t.delete(e),t.size||Zy.unobserve(i)}function qt(i){const e={};for(const t of i)e[t.name]=t.value;return e}function ri(i){var e;return(e=_h(i))!=null?e:sa(i,"media-controller")}function _h(i){var e;const{MEDIA_CONTROLLER:t}=Re,s=i.getAttribute(t);if(s)return(e=bu(i))==null?void 0:e.getElementById(s)}const Jy=(i,e,t=".value")=>{const s=i.querySelector(t);s&&(s.textContent=e)},SD=(i,e)=>{const t=`slot[name="${e}"]`,s=i.shadowRoot.querySelector(t);return s?s.children:[]},eT=(i,e)=>SD(i,e)[0],gs=(i,e)=>!i||!e?!1:i!=null&&i.contains(e)?!0:gs(i,e.getRootNode().host),sa=(i,e)=>{if(!i)return null;const t=i.closest(e);return t||sa(i.getRootNode().host,e)};function um(i=document){var e;const t=i==null?void 0:i.activeElement;return t?(e=um(t.shadowRoot))!=null?e:t:null}function bu(i){var e;const t=(e=i==null?void 0:i.getRootNode)==null?void 0:e.call(i);return t instanceof ShadowRoot||t instanceof Document?t:null}function tT(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 ID(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 nt(i,e){const t=LD(i,s=>s===e);return t||iT(i,e)}function LD(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 iT(i,e){var t,s;const r=(t=i.querySelectorAll("style:not([media])"))!=null?t:[],n=r==null?void 0:r[r.length-1];return n!=null&&n.sheet?(n==null||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 Ke(i,e,t=Number.NaN){const s=i.getAttribute(e);return s!=null?+s:t}function Ze(i,e,t){const s=+t;if(t==null||Number.isNaN(s)){i.hasAttribute(e)&&i.removeAttribute(e);return}Ke(i,e,void 0)!==s&&i.setAttribute(e,`${s}`)}function _e(i,e){return i.hasAttribute(e)}function Ae(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}_e(i,e)!=t&&i.toggleAttribute(e,t)}function Ve(i,e,t=null){var s;return(s=i.getAttribute(e))!=null?s:t}function We(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}const s=`${t}`;Ve(i,e,void 0)!==s&&i.setAttribute(e,s)}var sT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},bs=(i,e,t)=>(sT(i,e,"read from private field"),t?t.call(i):e.get(i)),RD=(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)},Jo=(i,e,t,s)=>(sT(i,e,"write to private field"),e.set(i,t),t),wt;function xD(i){return`
147    <style>
148      :host {
149        display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block));
150        box-sizing: border-box;
151      }
152    </style>
153  `}class _u extends C.HTMLElement{constructor(){if(super(),RD(this,wt,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Re.MEDIA_CONTROLLER,b.MEDIA_PAUSED]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Re.MEDIA_CONTROLLER&&(t&&((n=(r=bs(this,wt))==null?void 0:r.unassociateElement)==null||n.call(r,this),Jo(this,wt,null)),s&&this.isConnected&&(Jo(this,wt,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=bs(this,wt))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s,r;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),Jo(this,wt,kD(this)),this.getAttribute(Re.MEDIA_CONTROLLER)&&((t=(e=bs(this,wt))==null?void 0:e.associateElement)==null||t.call(e,this)),(s=bs(this,wt))==null||s.addEventListener("pointerdown",this),(r=bs(this,wt))==null||r.addEventListener("click",this)}disconnectedCallback(){var e,t,s,r;this.getAttribute(Re.MEDIA_CONTROLLER)&&((t=(e=bs(this,wt))==null?void 0:e.unassociateElement)==null||t.call(e,this)),(s=bs(this,wt))==null||s.removeEventListener("pointerdown",this),(r=bs(this,wt))==null||r.removeEventListener("click",this),Jo(this,wt,null)}handleEvent(e){var t;const s=(t=e.composedPath())==null?void 0:t[0];if(["video","media-controller"].includes(s==null?void 0: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{pointerType:f=this._pointerType}=e;if(this._pointerType=void 0,f===s0.TOUCH){this.handleTap(e);return}else if(f===s0.MOUSE){this.handleMouseClick(e);return}}}}get mediaPaused(){return _e(this,b.MEDIA_PAUSED)}set mediaPaused(e){Ae(this,b.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){const t=this.mediaPaused?Q.MEDIA_PLAY_REQUEST:Q.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new C.CustomEvent(t,{composed:!0,bubbles:!0}))}}wt=new WeakMap;_u.shadowRootOptions={mode:"open"};_u.getTemplateHTML=xD;function kD(i){var e;const t=i.getAttribute(Re.MEDIA_CONTROLLER);return t?(e=i.getRootNode())==null?void 0:e.getElementById(t):sa(i,"media-controller")}
153C.customElements.get("media-gesture-receiver")||C.customElements.define("media-gesture-receiver",_u);var l0=_u,cm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Gt=(i,e,t)=>(cm(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)},fr=(i,e,t,s)=>(cm(i,e,"write to private field"),e.set(i,t),t),ti=(i,e,t)=>(cm(i,e,"access private method"),t),qd,dn,vo,Rn,Nl,Ah,rT,wa,Ul,Sh,nT,Ih,aT,Eo,Au,Su,hm,Jn,yo;const re={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};function DD(i){return`
154    <style>
155      
156      :host([${b.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) {
157        outline: none;
158      }
159
160      :host {
161        box-sizing: border-box;
162        position: relative;
163        display: inline-block;
164        line-height: 0;
165        background-color: var(--media-background-color, #000);
166      }
167
168      :host(:not([${re.AUDIO}])) [part~=layer]:not([part~=media-layer]) {
169        position: absolute;
170        top: 0;
171        left: 0;
172        bottom: 0;
173        right: 0;
174        display: flex;
175        flex-flow: column nowrap;
176        align-items: start;
177        pointer-events: none;
178        background: none;
179      }
180
181      slot[name=media] {
182        display: var(--media-slot-display, contents);
183      }
184
185      
186      :host([${re.AUDIO}]) slot[name=media] {
187        display: var(--media-slot-display, none);
188      }
189
190      
191      :host([${re.AUDIO}]) [part~=layer][part~=gesture-layer] {
192        height: 0;
193        display: block;
194      }
195
196      
197      :host(:not([${re.AUDIO}])[${re.GESTURES_DISABLED}]) ::slotted([slot=gestures-chrome]),
198          :host(:not([${re.AUDIO}])[${re.GESTURES_DISABLED}]) media-gesture-receiver[slot=gestures-chrome] {
199        display: none;
200      }
201
202      
203      ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator):not([role=dialog]):not([hidden])) {
204        pointer-events: auto;
205      }
206
207      :host(:not([${re.AUDIO}])) *[part~=layer][part~=centered-layer] {
208        align-items: center;
209        justify-content: center;
210      }
211
212      :host(:not([${re.AUDIO}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]),
213      :host(:not([${re.AUDIO}])) media-gesture-receiver[slot=gestures-chrome] {
214        align-self: stretch;
215        flex-grow: 1;
216      }
217
218      slot[name=middle-chrome] {
219        display: inline;
220        flex-grow: 1;
221        pointer-events: none;
222        background: none;
223      }
224
225      
226      ::slotted([slot=media]),
227      ::slotted([slot=poster]) {
228        width: 100%;
229        height: 100%;
230      }
231
232      
233      :host(:not([${re.AUDIO}])) .spacer {
234        flex-grow: 1;
235      }
236
237      
238      :host(:-webkit-full-screen) {
239        
240        width: 100% !important;
241        height: 100% !important;
242      }
243
244      
245      ::slotted(:not([slot=media]):not([slot=poster]):not([${re.NO_AUTOHIDE}]):not([hidden]):not([role=dialog])) {
246        opacity: 1;
247        transition: var(--media-control-transition-in, opacity 0.25s);
248      }
249
250      
251      :host([${re.USER_INACTIVE}]:not([${b.MEDIA_PAUSED}]):not([${b.MEDIA_IS_AIRPLAYING}]):not([${b.MEDIA_IS_CASTING}]):not([${re.AUDIO}])) ::slotted(:not([slot=media]):not([slot=poster]):not([${re.NO_AUTOHIDE}]):not([role=dialog])) {
252        opacity: 0;
253        transition: var(--media-control-transition-out, opacity 1s);
254      }
255
256      :host([${re.USER_INACTIVE}]:not([${re.NO_AUTOHIDE}]):not([${b.MEDIA_PAUSED}]):not([${b.MEDIA_IS_CASTING}]):not([${re.AUDIO}])) ::slotted([slot=media]) {
257        cursor: none;
258      }
259
260      :host([${re.USER_INACTIVE}][${re.AUTOHIDE_OVER_CONTROLS}]:not([${re.NO_AUTOHIDE}]):not([${b.MEDIA_PAUSED}]):not([${b.MEDIA_IS_CASTING}]):not([${re.AUDIO}])) * {
261        --media-cursor: none;
262        cursor: none;
263      }
264
265
266      ::slotted(media-control-bar)  {
267        align-self: stretch;
268      }
269
270      
271      :host(:not([${re.AUDIO}
271])[${b.MEDIA_HAS_PLAYED}]) slot[name=poster] {
272        display: none;
273      }
274
275      ::slotted([role=dialog]) {
276        width: 100%;
277        height: 100%;
278        align-self: center;
279      }
280
281      ::slotted([role=menu]) {
282        align-self: end;
283      }
284    </style>
285
286    <slot name="media" part="layer media-layer"></slot>
287    <slot name="poster" part="layer poster-layer"></slot>
288    <slot name="gestures-chrome" part="layer gesture-layer">
289      <media-gesture-receiver slot="gestures-chrome">
290        <template shadowrootmode="${l0.shadowRootOptions.mode}">
291          ${l0.getTemplateHTML({})}
292        </template>
293      </media-gesture-receiver>
294    </slot>
295    <span part="layer vertical-layer">
296      <slot name="top-chrome" part="top chrome"></slot>
297      <slot name="middle-chrome" part="middle chrome"></slot>
298      <slot name="centered-chrome" part="layer centered-layer center centered chrome"></slot>
299      
300      <slot part="bottom chrome"></slot>
301    </span>
302    <slot name="dialog" part="layer dialog-layer"></slot>
303  `}const CD=Object.values(b),wD="sm:384 md:576 lg:768 xl:960";function MD(i){oT(i.target,i.contentRect.width)}function oT(i,e){var t;if(!i.isConnected)return;const s=(t=i.getAttribute(re.BREAKPOINTS))!=null?t:wD,r=PD(s),n=OD(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(ms.BREAKPOINTS_CHANGE,{detail:n});i.dispatchEvent(o)}i.breakpointsComputed||(i.breakpointsComputed=!0,i.dispatchEvent(new CustomEvent(ms.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}function PD(i){const e=i.split(/\s+/);return Object.fromEntries(e.map(t=>t.split(":")))}function OD(i,e){return Object.keys(i).filter(t=>e>=parseInt(i[t]))}class Iu extends C.HTMLElement{constructor(){if(super(),Ft(this,Ah),Ft(this,Sh),Ft(this,Ih),Ft(this,Eo),Ft(this,Su),Ft(this,Jn),Ft(this,qd,0),Ft(this,dn,null),Ft(this,vo,null),Ft(this,Rn,void 0),this.breakpointsComputed=!1,Ft(this,Nl,new MutationObserver(ti(this,Ah,rT).bind(this))),Ft(this,wa,!1),Ft(this,Ul,t=>{Gt(this,wa)||(setTimeout(()=>{MD(t),fr(this,wa,!1)},0),fr(this,wa,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const t=qt(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){Gt(this,dn)&&this.mediaUnsetCallback(Gt(this,dn));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[re.AUTOHIDE,re.GESTURES_DISABLED].concat(CD).filter(e=>![b.MEDIA_RENDITION_LIST,b.MEDIA_AUDIO_TRACK_LIST,b.MEDIA_CHAPTERS_CUES,b.MEDIA_WIDTH,b.MEDIA_HEIGHT,b.MEDIA_ERROR,b.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,t,s){e.toLowerCase()==re.AUTOHIDE&&(this.autohide=s)}get media(){let e=this.querySelector(":scope > [slot=media]");return(e==null?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(fr(this,dn,e),e.localName.includes("-")&&await C.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;Gt(this,Nl).observe(this,{childList:!0,subtree:!0}),Xn(this,Gt(this,Ul));const t=this.getAttribute(re.AUDIO)!=null,s=Z(t?"audio player":"video player");this.setAttribute("role","region"),this.setAttribute("aria-label",s),this.handleMediaUpdated(this.media),this.setAttribute(re.USER_INACTIVE,""),oT(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=C.window)==null||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;Gt(this,Nl).disconnect(),Zn(this,Gt(this,Ul)),this.media&&this.mediaUnsetCallback(this.media),(e=C.window)==null||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){fr(this,dn,null)}handleEvent(e){switch(e.type){case"pointerdown":fr(this,qd,e.timeStamp);break;case"pointermove":ti(this,Sh,nT).call(this,e);break;case"pointerup":ti(this,Ih,aT).call(this,e);break;case"mouseleave":ti(this,Eo,Au).call(this);break;case"mouseup":this.removeAttribute(re.KEYBOARD_CONTROL);break;case"keyup":ti(this,Jn,yo).call(this),this.setAttribute(re.KEYBOARD_CONTROL,"");break}}set autohide(e){const t=Number(e);fr(this,Rn,isNaN(t)?0:t)}get autohide(){return(Gt(this,Rn)===void 0?2:Gt(this,Rn)).toString()}get breakpoints(){return Ve(this,re.BREAKPOINTS)}set breakpoints(e){We(this,re.BREAKPOINTS,e)}get audio(){return _e(this,re.AUDIO)}set audio(e){Ae(this,re.AUDIO,e)}get gesturesDisabled(){return _e(this,re.GESTURES_DISABLED)}set gesturesDisabled(e){Ae(this,re.GESTURES_DISABLED,e)}get keyboardControl(){return _e(this,re.KEYBOARD_CONTROL)}set keyboardControl(e){Ae(this,re.KEYBOARD_CONTROL,e)}get noAutohide(){return _e(this,re.NO_AUTOHIDE)}set noAutohide(e){Ae(this,re.NO_AUTOHIDE,e)}get autohideOverControls(){return _e(this,re.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){Ae(this,re.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return _e(this,re.USER_INACTIVE)}set userInteractive(e){Ae(this,re.USER_INACTIVE,e)}}qd=new WeakMap;dn=new WeakMap;vo=new WeakMap;Rn=new WeakMap;Nl=new WeakMap;Ah=new WeakSet;rT=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)}};wa=new WeakMap;Ul=new WeakMap;Sh=new WeakSet;nT=function(i){if(i.pointerType!=="mouse"&&i.timeStamp-Gt(this,qd)<250)return;ti(this,Su,hm).call(this),clearTimeout(Gt(this,vo));const e=this.hasAttribute(re.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(i.target)||e)&&ti(this,Jn,yo).call(this)};Ih=new WeakSet;aT=function(i){if(i.pointerType==="touch"){const e=!this.hasAttribute(re.USER_INACTIVE);[this,this.media].includes(i.target)&&e?ti(this,Eo,Au).call(this):ti(this,Jn,yo).call(this)}else i.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(e==null?void 0:e.localName))&&ti(this,Jn,yo).call(this)};Eo=new WeakSet;Au=function(){if(Gt(this,Rn)<0||this.hasAttribute(re.USER_INACTIVE))return;this.setAttribute(re.USER_INACTIVE,"");const i=new C.CustomEvent(ms.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(i)};Su=new WeakSet;hm=function(){if(!this.hasAttribute(re.USER_INACTIVE))return;this.removeAttribute(re.USER_INACTIVE);const i=new C.CustomEvent(ms.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(i)};Jn=new WeakSet;yo=function(){ti(this,Su,hm).call(this),clearTimeout(Gt(this,vo));const i=parseInt(this.autohide);i<0||fr(this,vo,setTimeout(()=>{ti(this,Eo,Au).call(this)},i*1e3))};Iu.shadowRootOptions={mode:"open"};Iu.getTemplateHTML=DD;C.customElements.get("media-container")||C.customElements.define("media-container",Iu);var lT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},yt=(i,e,t)=>(lT(i,e,"read from private field"),t?t.call(i):e.get(i)),ha=(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)},el=(i,e,t,s)=>(lT(i,e,"write to private field"),e.set(i,t),t),un,cn,Yd,Ir,ss,Is;class fm{constructor(e,t,{defaultValue:s}={defaultValue:void 0}){ha(this,ss),ha(this,un,void 0),ha(this,cn,void 0),ha(this,Yd,void 0),ha(this,Ir,new Set),el(this,un,e),el(this,cn,t),el(this,Yd,new Set(s))}[Symbol.iterator](){return yt(this,ss,Is).values()}get length(){return yt(this,ss,Is).size}get value(){var e;return(e=[...yt(this,ss,Is)].join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(el(this,Ir,new Set),this.add(...(t=e==null?void 0:e.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return[...yt(this,ss,Is)][e]}values(){return yt(this,ss,Is).values()}
303forEach(e,t){yt(this,ss,Is).forEach(e,t)}add(...e){var t,s;e.forEach(r=>yt(this,Ir).add(r)),!(this.value===""&&!((t=yt(this,un))!=null&&t.hasAttribute(`${yt(this,cn)}`)))&&((s=yt(this,un))==null||s.setAttribute(`${yt(this,cn)}`,`${this.value}`))}remove(...e){var t;e.forEach(s=>yt(this,Ir).delete(s)),(t=yt(this,un))==null||t.setAttribute(`${yt(this,cn)}`,`${this.value}`)}contains(e){return yt(this,ss,Is).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}}un=new WeakMap;cn=new WeakMap;Yd=new WeakMap;Ir=new WeakMap;ss=new WeakSet;Is=function(){return yt(this,Ir).size?yt(this,Ir):yt(this,Yd)};const ND=(i="")=>i.split(/\s+/),dT=(i="")=>{const[e,t,s]=i.split(":"),r=s?decodeURIComponent(s):void 0;return{kind:e==="cc"?qi.CAPTIONS:qi.SUBTITLES,language:t,label:r}},Lu=(i="",e={})=>ND(i).map(t=>{const s=dT(t);return{...e,...s}}),uT=i=>i?Array.isArray(i)?i.map(e=>typeof e=="string"?dT(e):e):typeof i=="string"?Lu(i):[i]:[],Lh=({kind:i,label:e,language:t}={kind:"subtitles"})=>e?`${i==="captions"?"cc":"sb"}:${t}:${encodeURIComponent(e)}`:t,To=(i=[])=>Array.prototype.map.call(i,Lh).join(" "),UD=(i,e)=>t=>t[i]===e,cT=i=>{const e=Object.entries(i).map(([t,s])=>UD(t,s));return t=>e.every(s=>s(t))},eo=(i,e=[],t=[])=>{const s=uT(t).map(cT),r=n=>s.some(a=>a(n));Array.from(e).filter(r).forEach(n=>{n.mode=i})},Ru=(i,e=()=>!0)=>{if(!(i!=null&&i.textTracks))return[];const t=typeof e=="function"?e:cT(e);return Array.from(i.textTracks).filter(t)},hT=i=>{var e;return!!((e=i.mediaSubtitlesShowing)!=null&&e.length)||i.hasAttribute(b.MEDIA_SUBTITLES_SHOWING)},FD=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!=null&&t.webkitEnterFullscreen?t.webkitEnterFullscreen():t!=null&&t.requestFullscreen&&t.requestFullscreen()}catch(r){console.error(r)}},d0="exitFullscreen"in mt?"exitFullscreen":"webkitExitFullscreen"in mt?"webkitExitFullscreen":"webkitCancelFullScreen"in mt?"webkitCancelFullScreen":void 0,$D=i=>{var e;const{documentElement:t}=i;if(d0){const s=(e=t==null?void 0:t[d0])==null?void 0:e.call(t);if(s instanceof Promise)return s.catch(()=>{})}},Ma="fullscreenElement"in mt?"fullscreenElement":"webkitFullscreenElement"in mt?"webkitFullscreenElement":void 0,BD=i=>{const{documentElement:e,media:t}=i,s=e==null?void 0:e[Ma];return!s&&"webkitDisplayingFullscreen"in t&&"webkitPresentationMode"in t&&t.webkitDisplayingFullscreen&&t.webkitPresentationMode===dD.FULLSCREEN?t:s},HD=i=>{var e;const{media:t,documentElement:s,fullscreenElement:r=t}=i;if(!t||!s)return!1;const n=BD(i);if(!n)return!1;if(n===r||n===t)return!0;if(n.localName.includes("-")){let a=n.shadowRoot;if(!(Ma in a))return gs(n,r);for(;a!=null&&a[Ma];){if(a[Ma]===r)return!0;a=(e=a[Ma])==null?void 0:e.shadowRoot}}return!1},GD="fullscreenEnabled"in mt?"fullscreenEnabled":"webkitFullscreenEnabled"in mt?"webkitFullscreenEnabled":void 0,KD=i=>{const{documentElement:e,media:t}=i;return!!(e!=null&&e[GD])||t&&"webkitSupportsFullscreen"in t};let tl;const mm=()=>{var i,e;return tl||(tl=(e=(i=mt)==null?void 0:i.createElement)==null?void 0:e.call(i,"video"),tl)},VD=async(i=mm())=>{if(!i)return!1;const e=i.volume;i.volume=e/2+.1;const t=new AbortController,s=await Promise.race([WD(i,t.signal),qD(i,e)]);return t.abort(),s},WD=(i,e)=>new Promise(t=>{i.addEventListener("volumechange",()=>t(!0),{signal:e})}),qD=async(i,e)=>{for(let t=0;t<10;t++){if(i.volume===e)return!1;await qy(10)}return i.volume!==e},YD=/.*Version\/.*Safari\/.*/.test(C.navigator.userAgent),fT=(i=mm())=>C.matchMedia("(display-mode: standalone)").matches&&YD?!1:typeof(i==null?void 0:i.requestPictureInPicture)=="function",mT=(i=mm())=>KD({documentElement:mt,media:i}),jD=mT(),zD=fT(),QD=!!C.WebKitPlaybackTargetAvailabilityEvent,XD=!!C.chrome,jd=i=>Ru(i.media,e=>[qi.SUBTITLES,qi.CAPTIONS].includes(e.kind)).sort((e,t)=>
303e.kind>=t.kind?1:-1),pT=i=>Ru(i.media,e=>e.mode===On.SHOWING&&[qi.SUBTITLES,qi.CAPTIONS].includes(e.kind)),gT=(i,e)=>{const t=jd(i),s=pT(i),r=!!s.length;if(t.length){if(e===!1||r&&e!==!0)eo(On.DISABLED,t,s);else if(e===!0||!r&&e!==!1){let n=t[0];const{options:a}=i;if(!(a!=null&&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 p=c.findIndex(v=>f.language.toLowerCase().startsWith(v.split("-")[0])),g=c.findIndex(v=>m.language.toLowerCase().startsWith(v.split("-")[0]));return p-g});h[0]&&(n=h[0])}const{language:o,label:l,kind:d}=n;eo(On.DISABLED,t,s),eo(On.SHOWING,t,[{language:o,label:l,kind:d}])}}},pm=(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)?ZD(i,e):Object.entries(i).every(([t,s])=>t in e&&pm(s,e[t])),ZD=(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)=>pm(r,e[n])):!0},JD=Object.values(os);let zd;const eC=VD().then(i=>(zd=i,zd)),tC=async(...i)=>{await Promise.all(i.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof C.HTMLElement))return;const t=e.localName;if(!t.includes("-"))return;const s=C.customElements.get(t);s&&e instanceof s||(await C.customElements.whenDefined(t),C.customElements.upgrade(e))}))},iC=new C.DOMParser,sC=i=>i&&(iC.parseFromString(i,"text/html").body.textContent||i),Pa={mediaError:{get(i,e){const{media:t}=i;if((e==null?void 0:e.type)!=="playing")return t==null?void 0:t.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(i,e){var t;const{media:s}=i;if((e==null?void 0:e.type)!=="playing")return(t=s==null?void 0:s.error)==null?void 0:t.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(i,e){var t,s;const{media:r}=i;
303if((e==null?void 0:e.type)!=="playing")return(s=(t=r==null?void 0: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==null?void 0:t.videoWidth)!=null?e:0},mediaEvents:["resize"]},mediaHeight:{get(i){var e;const{media:t}=i;return(e=t==null?void 0:t.videoHeight)!=null?e:0},mediaEvents:["resize"]},mediaPaused:{get(i){var e;const{media:t}=i;return(e=t==null?void 0: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==null?void 0:t.ended)!=null?e:!1},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(i){var e;const{media:t}=i;return(e=t==null?void 0: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==null?void 0:t.muted)!=null?e:!1},set(i,e){const{media:t}=e;if(t){try{C.localStorage.setItem("media-chrome-pref-muted",i?"true":"false")}catch(s){console.debug("Error setting muted pref",s)}t.muted=i}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noMutedPref:t}}=e,{media:s}=e;if(!(!s||s.muted||t))try{const r=C.localStorage.getItem("media-chrome-pref-muted")==="true";Pa.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==null?void 0:t.volume)!=null?e:1},set(i,e){const{media:t}=e;if(t){try{i==null?C.localStorage.removeItem("media-chrome-pref-volume"):C.localStorage.setItem("media-chrome-pref-volume",i.toString())}catch(s){console.debug("Error setting volume pref",s)}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=C.localStorage.getItem("media-chrome-pref-volume");if(r==null)return;Pa.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==null?void 0: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==null?void 0:t.currentTime)!=null?e:0},set(i,e){const{media:t}=e;!t||!lm(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==null?void 0:e.duration)?e.duration:Number.NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(i){const{media:e}=i;return(e==null?void 0:e.readyState)<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(i){var e;const{media:t}=i;if(!((e=t==null?void 0: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==null?void 0: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=[os.LIVE,os.ON_DEMAND].includes(t)?t:void 0;if(!e)return s;const{streamType:r}=e;if(JD.includes(r))return r===os.UNKNOWN?s:r;const n=e.duration;return n===1/0?os.LIVE:Number.isFinite(n)?os.ON_DEMAND:s},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(i){const{media:e}=i;if(!e)return Number.NaN;const{targetLiveWindow:t}=e,s=Pa.mediaStreamType.get(i);return(t==null||Number.isNaN(t))&&s===os.LIVE?0:t}
303,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(!(Pa.mediaStreamType.get(i)===os.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 jd(i).map(({kind:e,label:t,language:s})=>({kind:e,label:t,language:s}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get(i){return pT(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&&![qi.CAPTIONS,qi.SUBTITLES].includes((l=o==null?void 0:o.track)==null?void 0:l.kind)||gT(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]=Ru(t,{kind:qi.CHAPTERS});return Array.from((e=s==null?void 0:s.cues)!=null?e:[]).map(({text:r,startTime:n,endTime:a})=>({text:sC(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==null||r.addEventListener("load",i),n==null||n.addEventListener("load",i),()=>{r==null||r.removeEventListener("load",i),n==null||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("-")?gs(s,r.pictureInPictureElement):!1;if(r.pictureInPictureElement.localName.includes("-")){let n=r.pictureInPictureElement.shadowRoot;for(;n!=null&&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(!mt.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 mt.pictureInPictureElement&&mt.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(i){var e;const{media:t}=i;return[...(e=t==null?void 0: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==null?void 0: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!=null&&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==null?void 0:t.audioTracks)!=null?e:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(i){var e,t;const{media:s}=i;return(t=[...(e=s==null?void 0:s.audioTracks)!=null?e:[]].find(r=>r.enabled))==null?void 0:t.id},set(i,e){const{media:t}=e;if(!(t!=null&&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 HD(i)},set(i,e){i?FD(e):$D(e)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(i){var e;const{media:t}=i;return!(t!=null&&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&&C.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(!jD||!mT(e))return zt.UNSUPPORTED}},mediaPipUnavailable:{get(i){const{media:e}=i;if(!zD||!fT(e))return zt.UNSUPPORTED}},mediaVolumeUnavailable:{get(i){const{media:e}=i;if(zd===!1||(e==null?void 0:e.volume)==null)return zt.UNSUPPORTED},stateOwnersUpdateHandlers:[i=>{zd==null&&eC.then(e=>i(e?void 0:zt.UNSUPPORTED))}]},mediaCastUnavailable:{get(i,{availability:e="not-available"}={}){var t;const{media:s}=i;
303if(!XD||!((t=s==null?void 0:s.remote)!=null&&t.state))return zt.UNSUPPORTED;if(!(e==null||e==="available"))return zt.UNAVAILABLE},stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;return s?(s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s==null?void 0: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==null?void 0:s.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaAirplayUnavailable:{get(i,e){if(!QD)return zt.UNSUPPORTED;if((e==null?void 0:e.availability)==="not-available")return zt.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;return s?(s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s==null?void 0: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==null?void 0:s.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaRenditionUnavailable:{get(i){var e;const{media:t}=i;if(!(t!=null&&t.videoRenditions))return zt.UNSUPPORTED;if(!((e=t.videoRenditions)!=null&&e.length))return zt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(i){var e,t;const{media:s}=i;if(!(s!=null&&s.audioTracks))return zt.UNSUPPORTED;if(((t=(e=s.audioTracks)==null?void 0:e.length)!=null?t:0)<=1)return zt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]}},rC={[Q.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]=Ru(a,{kind:qi.METADATA,label:"thumbnails"}),m=Array.prototype.find.call((s=f==null?void 0:f.cues)!=null?s:[],(p,g,v)=>g===0?p.endTime>o:g===v.length-1?p.startTime<=o:p.startTime<=o&&p.endTime>o);if(m){const p=/'^(?:[a-z]+:)?\/\//i.test(m.text)||(r=a==null?void 0:a.querySelector('track[label="thumbnails"]'))==null?void 0:r.src,g=new URL(m.text,p);d=new URLSearchParams(g.hash).get("#xywh").split(",").map(T=>+T),l=g.href}}const u=i.mediaDuration.get(e);let h=(n=i.mediaChaptersCues.get(e).find((f,m,p)=>m===p.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}},[Q.MEDIA_PAUSE_REQUEST](i,e){i["mediaPaused"].set(!0,e)},[Q.MEDIA_PLAY_REQUEST](i,e){var t,s,r,n;const a="mediaPaused",l=i.mediaStreamType.get(e)===os.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)},[Q.MEDIA_PLAYBACK_RATE_REQUEST](i,e,{detail:t}){const s="mediaPlaybackRate",r=t;i[s].set(r,e)},[Q.MEDIA_MUTE_REQUEST](i,e){i["mediaMuted"].set(!0,e)},[Q.MEDIA_UNMUTE_REQUEST](i,e){const t="mediaMuted";i.mediaVolume.get(e)||i.mediaVolume.set(.25,e),i[t].set(!1,e)},[Q.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)},[Q.MEDIA_SEEK_REQUEST](i,e,{detail:t}){const s="mediaCurrentTime",r=t;i[s].set(r,e)},[Q.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)},[Q.MEDIA_SHOW_SUBTITLES_REQUEST](i,e,{detail:t}){var s;const{options:r}=e,n=jd(e),a=uT(t),o=(s=a[0])==null?void 0:s.language;o&&!r.noSubtitlesLangPref&&C.localStorage.setItem("media-chrome-pref-subtitles-lang",o),eo(On.SHOWING,n,a)},[Q.MEDIA_DISABLE_SUBTITLES_REQUEST](i,e,{detail:t}){const s=jd(e),r=t??[];eo(On.DISABLED,s,r)},[Q.MEDIA_TOGGLE_SUBTITLES_REQUEST](i,e,{detail:t}){gT(e,t)},[Q.MEDIA_RENDITION_REQUEST](i,e,{detail:t}){const s="mediaRenditionSelected",r=t;i[s].set(r,e)},[Q.MEDIA_AUDIO_TRACK_REQUEST](i,e,{detail:t}){const s="mediaAudioTrackEnabled",r=t;i[s].set(r,e)},[Q.MEDIA_ENTER_PIP_REQUEST](i,e){const t="mediaIsPip";i.mediaIsFullscreen.get(e)&&i.mediaIsFullscreen.set(!1,e),i[t].set(!0,e)},[Q.MEDIA_EXIT_PIP_REQUEST](i,e){i["mediaIsPip"].set(!1,e)},[Q.MEDIA_ENTER_FULLSCREEN_REQUEST](i,e){const t="mediaIsFullscreen";i.mediaIsPip.get(e)&&i.mediaIsPip.set(!1,e),i[t].set(!0,e)},[Q.MEDIA_EXIT_FULLSCREEN_REQUEST](i,e){i["mediaIsFullscreen"].set(!1,e)},[Q.MEDIA_ENTER_CAST_REQUEST](i,e){const t="mediaIsCasting";i.mediaIsFullscreen.get(e)&&i.mediaIsFullscreen.set(!1,e),i[t].set(!0,e)},[Q.MEDIA_EXIT_CAST_REQUEST](i,e){i["mediaIsCasting"].set(!1,e)},[Q.MEDIA_AIRPLAY_REQUEST](i,e){i["mediaIsAirplaying"].set(!0,e)}},nC=({media:i,fullscreenElement:e,documentElement:t,stateMediator:s=Pa,requestMap:r=rC,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=p=>{p!=null&&(pm(p,d)||(d=Object.freeze({...d,...p}),o.forEach(g=>g(d))))},c=()=>{const p=Object.entries(s).reduce((g,[v,{get:T}])=>(g[v]=T(l),g),{});u(p)},h={};let f;const m=async(p,g)=>
303{var v,T,y,_,I,x,L,A,R,S,k,O,G,V,B,K;const J=!!f;if(f={...l,...f??{},...p},J)return;await tC(...Object.values(p));const F=o.length>0&&g===0&&a,ie=l.media!==f.media,ee=((v=l.media)==null?void 0:v.textTracks)!==((T=f.media)==null?void 0:T.textTracks),$=((y=l.media)==null?void 0:y.videoRenditions)!==((_=f.media)==null?void 0:_.videoRenditions),H=((I=l.media)==null?void 0:I.audioTracks)!==((x=f.media)==null?void 0:x.audioTracks),de=((L=l.media)==null?void 0:L.remote)!==((A=f.media)==null?void 0:A.remote),ce=l.documentElement!==f.documentElement,ve=!!l.media&&(ie||F),Ee=!!((R=l.media)!=null&&R.textTracks)&&(ee||F),Fe=!!((S=l.media)!=null&&S.videoRenditions)&&($||F),St=!!((k=l.media)!=null&&k.audioTracks)&&(H||F),dt=!!((O=l.media)!=null&&O.remote)&&(de||F),It=!!l.documentElement&&(ce||F),Ti=ve||Ee||Fe||St||dt||It,vs=o.length===0&&g===1&&a,Vr=!!f.media&&(ie||vs),Wr=!!((G=f.media)!=null&&G.textTracks)&&(ee||vs),Nu=!!((V=f.media)!=null&&V.videoRenditions)&&($||vs),Te=!!((B=f.media)!=null&&B.audioTracks)&&(H||vs),ut=!!((K=f.media)!=null&&K.remote)&&(de||vs),Dt=!!f.documentElement&&(ce||vs),bi=Vr||Wr||Nu||Te||ut||Dt;if(!(Ti||bi)){Object.entries(f).forEach(([be,Nt])=>{l[be]=Nt}),c(),f=void 0;return}Object.entries(s).forEach(([be,{get:Nt,mediaEvents:Mo=[],textTracksEvents:qr=[],videoRenditionsEvents:Po=[],audioTracksEvents:rr=[],remoteEvents:Oo=[],rootEvents:Uu=[],stateOwnersUpdateHandlers:No=[]}])=>{h[be]||(h[be]={});const Lt=Je=>{const Ut=Nt(l,Je);u({[be]:Ut})};let Ye;Ye=h[be].mediaEvents,Mo.forEach(Je=>{Ye&&ve&&(l.media.removeEventListener(Je,Ye),h[be].mediaEvents=void 0),Vr&&(f.media.addEventListener(Je,Lt),h[be].mediaEvents=Lt)}),Ye=h[be].textTracksEvents,qr.forEach(Je=>{var Ut,ni;Ye&&Ee&&((Ut=l.media.textTracks)==null||Ut.removeEventListener(Je,Ye),h[be].textTracksEvents=void 0),Wr&&((ni=f.media.textTracks)==null||ni.addEventListener(Je,Lt),h[be].textTracksEvents=Lt)}),Ye=h[be].videoRenditionsEvents,Po.forEach(Je=>{var Ut,ni;Ye&&Fe&&((Ut=l.media.videoRenditions)==null||Ut.removeEventListener(Je,Ye),h[be].videoRenditionsEvents=void 0),Nu&&((ni=f.media.videoRenditions)==null||ni.addEventListener(Je,Lt),h[be].videoRenditionsEvents=Lt)}),Ye=h[be].audioTracksEvents,rr.forEach(Je=>{var Ut,ni;Ye&&St&&((Ut=l.media.audioTracks)==null||Ut.removeEventListener(Je,Ye),h[be].audioTracksEvents=void 0),Te&&((ni=f.media.audioTracks)==null||ni.addEventListener(Je,Lt),h[be].audioTracksEvents=Lt)}),Ye=h[be].remoteEvents,Oo.forEach(Je=>{var Ut,ni;Ye&&dt&&((Ut=l.media.remote)==null||Ut.removeEventListener(Je,Ye),h[be].remoteEvents=void 0),ut&&((ni=f.media.remote)==null||ni.addEventListener(Je,Lt),h[be].remoteEvents=Lt)}),Ye=h[be].rootEvents,Uu.forEach(Je=>{Ye&&It&&(l.documentElement.removeEventListener(Je,Ye),h[be].rootEvents=void 0),Dt&&(f.documentElement.addEventListener(Je,Lt),h[be].rootEvents=Lt)});const up=h[be].stateOwnersUpdateHandlers;No.forEach(Je=>{up&&Ti&&up(),bi&&(h[be].stateOwnersUpdateHandlers=Je(Lt,f))})}),Object.entries(f).forEach(([be,Nt])=>{l[be]=Nt}),c(),f=void 0};return m({media:i,fullscreenElement:e,documentElement:t,options:n}
vendor: 5,486 bytes, line 303
303),{dispatch(p){const{type:g,detail:v}=p;if(r[g]&&d.mediaErrorCode==null){u(r[g](s,l,p));return}g==="mediaelementchangerequest"?m({media:v}):g==="fullscreenelementchangerequest"?m({fullscreenElement:v}):g==="documentelementchangerequest"?m({documentElement:v}):g==="optionschangerequest"&&Object.entries(v??{}).forEach(([T,y])=>{l.options[T]=y})},getState(){return d},subscribe(p){return m({},o.length+1),o.push(p),p(d),()=>{const g=o.indexOf(p);g>=0&&(m({},o.length-1),o.splice(g,1))}}}};var gm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},pe=(i,e,t)=>(gm(i,e,"read from private field"),t?t.call(i):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)},_s=(i,e,t,s)=>(gm(i,e,"write to private field"),e.set(i,t),t),Ns=(i,e,t)=>(gm(i,e,"access private method"),t),Lr,Oa,Oe,Na,Li,Fl,$l,Rh,ea,bo,Bl,xh;const vT=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],u0=10,j={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_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_DEFAULT_STORE:"nodefaultstore",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",LANG:"lang"};class ET extends Iu{constructor(){super(),Ji(this,$l),Ji(this,ea),Ji(this,Bl),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,Ji(this,Lr,new fm(this,j.HOTKEYS)),Ji(this,Oa,void 0),Ji(this,Oe,void 0),Ji(this,Na,void 0),Ji(this,Li,void 0),Ji(this,Fl,t=>{var s;(s=pe(this,Oe))==null||s.dispatch(t)}),this.associateElement(this);let e={};_s(this,Na,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 C.CustomEvent(lD[n],{composed:!0,detail:r});this.dispatchEvent(a)}),e=t}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(j.NO_HOTKEYS,j.HOTKEYS,j.DEFAULT_STREAM_TYPE,j.DEFAULT_SUBTITLES,j.DEFAULT_DURATION,j.LANG)}get mediaStore(){return pe(this,Oe)}set mediaStore(e){var t,s;if(pe(this,Oe)&&((t=pe(this,Li))==null||t.call(this),_s(this,Li,void 0)),_s(this,Oe,e),!pe(this,Oe)&&!this.hasAttribute(j.NO_DEFAULT_STORE)){Ns(this,$l,Rh).call(this);return}_s(this,Li,(s=pe(this,Oe))==null?void 0:s.subscribe(pe(this,Na)))}get fullscreenElement(){var e;return(e=pe(this,Oa))!=null?e:this}set fullscreenElement(e){var t;this.hasAttribute(j.FULLSCREEN_ELEMENT)&&this.removeAttribute(j.FULLSCREEN_ELEMENT),_s(this,Oa,e),(t=pe(this,Oe))==null||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return _e(this,j.DEFAULT_SUBTITLES)}set defaultSubtitles(e){Ae(this,j.DEFAULT_SUBTITLES,e)}get defaultStreamType(){return Ve(this,j.DEFAULT_STREAM_TYPE)}set defaultStreamType(e){We(this,j.DEFAULT_STREAM_TYPE,e)}get defaultDuration(){return Ke(this,j.DEFAULT_DURATION)}set defaultDuration(e){Ze(this,j.DEFAULT_DURATION,e)}get noHotkeys(){return _e(this,j.NO_HOTKEYS)}set noHotkeys(e){Ae(this,j.NO_HOTKEYS,e)}get keysUsed(){return Ve(this,j.KEYS_USED)}set keysUsed(e){We(this,j.KEYS_USED,e)}get liveEdgeOffset(){return Ke(this,j.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){Ze(this,j.LIVE_EDGE_OFFSET,e)}get noAutoSeekToLive(){return _e(this,j.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(e){Ae(this,j.NO_AUTO_SEEK_TO_LIVE,e)}get noVolumePref(){return _e(this,j.NO_VOLUME_PREF)}set noVolumePref(e){Ae(this,j.NO_VOLUME_PREF,e)}get noSubtitlesLangPref(){return _e(this,j.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(e){Ae(this,j.NO_SUBTITLES_LANG_PREF,e)}get noDefaultStore(){return _e(this,j.NO_DEFAULT_STORE)}set noDefaultStore(e){Ae(this,j.NO_DEFAULT_STORE,e)}attributeChangedCallback(e,t,s){var r,n,a,o,l,d,u,c;if(super.attributeChangedCallback(e,t,s),e===j.NO_HOTKEYS)s!==t&&s===""?(this.hasAttribute(j.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===j.HOTKEYS)pe(this,Lr).value=s;else if(e===j.DEFAULT_SUBTITLES&&s!==t)(r=pe(this,Oe))==null||r.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(j.DEFAULT_SUBTITLES)}});else if(e===j.DEFAULT_STREAM_TYPE)(a=pe(this,Oe))==null||a.dispatch({type:"optionschangerequest",detail:{defaultStreamType:(n=this.getAttribute(j.DEFAULT_STREAM_TYPE))!=null?n:void 0}});else if(e===j.LIVE_EDGE_OFFSET)(o=pe(this,Oe))==null||o.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(j.LIVE_EDGE_OFFSET)?+this.getAttribute(j.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(j.SEEK_TO_LIVE_OFFSET)?void 0:+this.getAttribute(j.LIVE_EDGE_OFFSET)}});else if(e===j.SEEK_TO_LIVE_OFFSET)(l=pe(this,Oe))==null||l.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(j.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(j.SEEK_TO_LIVE_OFFSET):void 0}});else if(e===j.NO_AUTO_SEEK_TO_LIVE)(d=pe(this,Oe))==null||d.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(j.NO_AUTO_SEEK_TO_LIVE)}});else if(e===j.FULLSCREEN_ELEMENT){const h=s?(u=this.getRootNode())==null?void 0:u.getElementById(s):void 0;
303_s(this,Oa,h),(c=pe(this,Oe))==null||c.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===j.LANG&&s!==t&&bD(s)}connectedCallback(){var e,t;!pe(this,Oe)&&!this.hasAttribute(j.NO_DEFAULT_STORE)&&Ns(this,$l,Rh).call(this),(e=pe(this,Oe))==null||e.dispatch({type:"documentelementchangerequest",detail:mt}),super.connectedCallback(),pe(this,Oe)&&!pe(this,Li)&&_s(this,Li,(t=pe(this,Oe))==null?void 0:t.subscribe(pe(this,Na))),this.enableHotkeys()}disconnectedCallback(){var e,t,s,r;(e=super.disconnectedCallback)==null||e.call(this),pe(this,Oe)&&((t=pe(this,Oe))==null||t.dispatch({type:"documentelementchangerequest",detail:void 0}),(s=pe(this,Oe))==null||s.dispatch({type:Q.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})),pe(this,Li)&&((r=pe(this,Li))==null||r.call(this),_s(this,Li,void 0))}mediaSetCallback(e){var t;super.mediaSetCallback(e),(t=pe(this,Oe))==null||t.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var t;super.mediaUnsetCallback(e),(t=pe(this,Oe))==null||t.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,t){f0(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=cC(e,s,r);Object.values(Q).forEach(a=>{e.addEventListener(a,pe(this,Fl))}),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(Q).forEach(r=>{e.removeEventListener(r,pe(this,Fl))})}registerMediaStateReceiver(e){if(!e)return;const t=this.mediaStateReceivers;t.indexOf(e)>-1||(t.push(e),pe(this,Oe)&&Object.entries(pe(this,Oe).getState()).forEach(([r,n])=>{f0([e],r,n)}))}unregisterMediaStateReceiver(e){const t=this.mediaStateReceivers,s=t.indexOf(e);s<0||t.splice(s,1)}enableHotkeys(){this.addEventListener("keydown",Ns(this,Bl,xh))}disableHotkeys(){this.removeEventListener("keydown",Ns(this,Bl,xh)),this.removeEventListener("keyup",Ns(this,ea,bo))}get hotkeys(){return Ve(this,j.HOTKEYS)}set hotkeys(e){We(this,j.HOTKEYS,e)}keyboardShortcutHandler(e){var t,s,r,n,a;const o=e.target;if(((r=(s=(t=o.getAttribute(j.KEYS_USED))==null?void 0:t.split(" "))!=null?s:o==null?void 0:o.keysUsed)!=null?r:[]).map(h=>h==="Space"?" ":h).filter(Boolean).includes(e.key))return;let d,u,c;if(!pe(this,Lr).contains(`no${e.key.toLowerCase()}`)&&!(e.key===" "&&pe(this,Lr).contains("nospace")))switch(e.key){case" ":case"k":d=pe(this,Oe).getState().mediaPaused?Q.MEDIA_PLAY_REQUEST:Q.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new C.CustomEvent(d,{composed:!0,bubbles:!0}));break;case"m":d=this.mediaStore.getState().mediaVolumeLevel==="off"?Q.MEDIA_UNMUTE_REQUEST:Q.MEDIA_MUTE_REQUEST,this.dispatchEvent(new C.CustomEvent(d,{composed:!0,bubbles:!0}));break;case"f":d=this.mediaStore.getState().mediaIsFullscreen?Q.MEDIA_EXIT_FULLSCREEN_REQUEST:Q.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new C.CustomEvent(d,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new C.CustomEvent(Q.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":{const h=this.hasAttribute(j.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(j.KEYBOARD_BACKWARD_SEEK_OFFSET):u0;u=Math.max(((n=this.mediaStore.getState().mediaCurrentTime)!=null?n:0)-h,0),c=new C.CustomEvent(Q.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:u}),this.dispatchEvent(c);break}case"ArrowRight":{const h=this.hasAttribute(j.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(j.KEYBOARD_FORWARD_SEEK_OFFSET):u0;u=Math.max(((a=this.mediaStore.getState().mediaCurrentTime)!=null?a:0)+h,0),c=new C.CustomEvent(Q.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:u}),this.dispatchEvent(c);break}}}}Lr=new WeakMap;Oa=new WeakMap;Oe=new WeakMap;Na=new WeakMap;Li=new WeakMap;Fl=new WeakMap;$l=new WeakSet;Rh=function(){var i;this.mediaStore=nC({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(j.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(j.DEFAULT_DURATION)?+this.getAttribute(j.DEFAULT_DURATION):void 0,defaultStreamType:(i=this.getAttribute(j.DEFAULT_STREAM_TYPE))!=null?i:void 0,liveEdgeOffset:this.hasAttribute(j.LIVE_EDGE_OFFSET)?+this.getAttribute(j.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(j.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(j.SEEK_TO_LIVE_OFFSET):this.hasAttribute(j.LIVE_EDGE_OFFSET)?+this.getAttribute(j.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(j.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(j.NO_VOLUME_PREF),noSubtitlesLangPref:this.hasAttribute(j.NO_SUBTITLES_LANG_PREF)}})};ea=new WeakSet;bo=function(i){const{key:e}=i;if(!vT.includes(e)){this.removeEventListener("keyup",Ns(this,ea,bo));return}this.keyboardShortcutHandler(i)};Bl=new WeakSet;xh=function(i){const{metaKey:e,altKey:t,key:s}=i;
303if(e||t||!vT.includes(s)){this.removeEventListener("keyup",Ns(this,ea,bo));return}[" ","ArrowLeft","ArrowRight"].includes(s)&&!(pe(this,Lr).contains(`no${s.toLowerCase()}`)||s===" "&&pe(this,Lr).contains("nospace"))&&i.preventDefault(),this.addEventListener("keyup",Ns(this,ea,bo),{once:!0})};const aC=Object.values(b),oC=Object.values(Ky),yT=i=>{var e,t,s,r;let{observedAttributes:n}=i.constructor;!n&&((e=i.nodeName)!=null&&e.includes("-"))&&(C.customElements.upgrade(i),{observedAttributes:n}=i.constructor);const a=(r=(s=(t=i==null?void 0:i.getAttribute)==null?void 0:t.call(i,Re.MEDIA_CHROME_ATTRIBUTES))==null?void 0:s.split)==null?void 0:r.call(s,/\s+/);return Array.isArray(n||a)?(n||a).filter(o=>aC.includes(o)):[]},lC=i=>{var e,t;return(e=i.nodeName)!=null&&e.includes("-")&&C.customElements.get((t=i.nodeName)==null?void 0:t.toLowerCase())&&!(i instanceof C.customElements.get(i.nodeName.toLowerCase()))&&C.customElements.upgrade(i),oC.some(s=>s in i)},kh=i=>lC(i)||!!yT(i).length,c0=i=>{var e;return(e=i==null?void 0:i.join)==null?void 0:e.call(i,":")},h0={[b.MEDIA_SUBTITLES_LIST]:To,[b.MEDIA_SUBTITLES_SHOWING]:To,[b.MEDIA_SEEKABLE]:c0,[b.MEDIA_BUFFERED]:i=>i==null?void 0:i.map(c0).join(" "),[b.MEDIA_PREVIEW_COORDS]:i=>i==null?void 0:i.join(" "),[b.MEDIA_RENDITION_LIST]:uD,[b.MEDIA_AUDIO_TRACK_LIST]:mD},dC=async(i,e,t)=>{var s,r;if(i.isConnected||await qy(0),typeof t=="boolean"||t==null)return Ae(i,e,t);if(typeof t=="number")return Ze(i,e,t);if(typeof t=="string")return We(i,e,t);if(Array.isArray(t)&&!t.length)return i.removeAttribute(e);const n=(r=(s=h0[e])==null?void 0:s.call(h0,t))!=null?r:t;return i.setAttribute(e,n)},uC=i=>{var e;return!!((e=i.closest)!=null&&e.call(i,'*[slot="media"]'))},mr=(i,e)=>{if(uC(i))return;const t=(r,n)=>{var a,o;kh(r)&&n(r);const{children:l=[]}=r??{},d=(o=(a=r==null?void 0:r.shadowRoot)==null?void 0:a.children)!=null?o:[];[...l,...d].forEach(c=>mr(c,n))},s=i==null?void 0:i.nodeName.toLowerCase();if(s.includes("-")&&!kh(i)){C.customElements.whenDefined(s).then(()=>{t(i,e)});return}t(i,e)},f0=(i,e,t)=>{i.forEach(s=>{if(e in s){s[e]=t;return}const r=yT(s),n=e.toLowerCase();r.includes(n)&&dC(s,n,t)})},cC=(i,e,t)=>{mr(i,e);const s=u=>{var c;const h=(c=u==null?void 0:u.composedPath()[0])!=null?c:u.target;e(h)},r=u=>{var c;const h=(c=u==null?void 0:u.composedPath()[0])!=null?c:u.target;t(h)};i.addEventListener(Q.REGISTER_MEDIA_STATE_RECEIVER,s),i.addEventListener(Q.UNREGISTER_MEDIA_STATE_RECEIVER,r);const n=u=>{u.forEach(c=>{const{addedNodes:h=[],removedNodes:f=[],type:m,target:p,attributeName:g}=c;m==="childList"?(Array.prototype.forEach.call(h,v=>mr(v,e)),Array.prototype.forEach.call(f,v=>mr(v,t))):m==="attributes"&&g===Re.MEDIA_CHROME_ATTRIBUTES&&(kh(p)?e(p):t(p))})};let a=[];const o=u=>{const c=u.target;c.name!=="media"&&(a.forEach(h=>mr(h,t)),a=[...c.assignedElements({flatten:!0})],a.forEach(h=>mr(h,e)))};i.addEventListener("slotchange",o);const l=new MutationObserver(n);return l.observe(i,{childList:!0,attributes:!0,subtree:!0}),()=>{mr(i,t),i.removeEventListener("slotchange",o),l.disconnect(),i.removeEventListener(Q.REGISTER_MEDIA_STATE_RECEIVER,s),i.removeEventListener(Q.UNREGISTER_MEDIA_STATE_RECEIVER,r)}};C.customElements.get("media-controller")||C.customElements.define("media-controller",ET);var hC=ET;const Xr={PLACEMENT:"placement",BOUNDS:"bounds"};function fC(i){return`
304    <style>
305      :host {
306        --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7)));
307        --_tooltip-background: var(--media-tooltip-background, var(--_tooltip-background-color));
308        --_tooltip-arrow-half-width: calc(var(--media-tooltip-arrow-width, 12px) / 2);
309        --_tooltip-arrow-height: var(--media-tooltip-arrow-height, 5px);
310        --_tooltip-arrow-background: var(--media-tooltip-arrow-color, var(--_tooltip-background-color));
311        position: relative;
312        pointer-events: none;
313        display: var(--media-tooltip-display, inline-flex);
314        justify-content: center;
315        align-items: center;
316        box-sizing: border-box;
317        z-index: var(--media-tooltip-z-index, 1);
318        background: var(--_tooltip-background);
319        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
320        font: var(--media-font,
321          var(--media-font-weight, 400)
322          var(--media-font-size, 13px) /
323          var(--media-text-content-height, var(--media-control-height, 18px))
324          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
325        padding: var(--media-tooltip-padding, .35em .7em);
326        border: var(--media-tooltip-border, none);
327        border-radius: var(--media-tooltip-border-radius, 5px);
328        filter: var(--media-tooltip-filter, drop-shadow(0 0 4px rgba(0, 0, 0, .2)));
329        white-space: var(--media-tooltip-white-space, nowrap);
330      }
331
332      :host([hidden]) {
333        display: none;
334      }
335
336      img, svg {
337        display: inline-block;
338      }
339
340      #arrow {
341        position: absolute;
342        width: 0px;
343        height: 0px;
344        border-style: solid;
345        display: var(--media-tooltip-arrow-display, block);
346      }
347
348      :host(:not([placement])),
349      :host([placement="top"]) {
350        position: absolute;
351        bottom: calc(100% + var(--media-tooltip-distance, 12px));
352        left: 50%;
353        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0
353);
354      }
355      :host(:not([placement])) #arrow,
356      :host([placement="top"]) #arrow {
357        top: 100%;
358        left: 50%;
359        border-width: var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width);
360        border-color: var(--_tooltip-arrow-background) transparent transparent transparent;
361        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);
362      }
363
364      :host([placement="right"]) {
365        position: absolute;
366        left: calc(100% + var(--media-tooltip-distance, 12px));
367        top: 50%;
368        transform: translate(0, -50%);
369      }
370      :host([placement="right"]) #arrow {
371        top: 50%;
372        right: 100%;
373        border-width: var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0;
374        border-color: transparent var(--_tooltip-arrow-background) transparent transparent;
375        transform: translate(0, -50%);
376      }
377
378      :host([placement="bottom"]) {
379        position: absolute;
380        top: calc(100% + var(--media-tooltip-distance, 12px));
381        left: 50%;
382        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0);
383      }
384      :host([placement="bottom"]) #arrow {
385        bottom: 100%;
386        left: 50%;
387        border-width: 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width);
388        border-color: transparent transparent var(--_tooltip-arrow-background) transparent;
389        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);
390      }
391
392      :host([placement="left"]) {
393        position: absolute;
394        right: calc(100% + var(--media-tooltip-distance, 12px));
395        top: 50%;
396        transform: translate(0, -50%);
397      }
398      :host([placement="left"]) #arrow {
399        top: 50%;
400        left: 100%;
401        border-width: var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height);
402        border-color: transparent transparent transparent var(--_tooltip-arrow-background);
403        transform: translate(0, -50%);
404      }
405      
406      :host([placement="none"]) #arrow {
407        display: none;
408      }
409    </style>
410    <slot></slot>
411    <div id="arrow"></div>
412  `}class xu extends C.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!tT(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=sa(this,"#"+this.bounds))!=null?e:ri(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,p=o-n+h-m,g=d-u+h+m;if(p<0){this.style.setProperty("--media-tooltip-offset-x",`${p}px`);return}if(g>0){this.style.setProperty("--media-tooltip-offset-x",`${g}px`);return}this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(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[Xr.PLACEMENT,Xr.BOUNDS]}get placement(){return Ve(this,Xr.PLACEMENT)}set placement(e){We(this,Xr.PLACEMENT,e)}get bounds(){return Ve(this,Xr.BOUNDS)}set bounds(e){We(this,Xr.BOUNDS,e)}}xu.shadowRootOptions={mode:"open"};xu.getTemplateHTML=fC;C.customElements.get("media-tooltip")||C.customElements.define("media-tooltip",xu);var m0=xu,vm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},it=(i,e,t)=>(vm(i,e,"read from private field"),t?t.call(i):e.get(i)),Zr=(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)},il=(i,e,t,s)=>(vm(i,e,"write to private field"),e.set(i,t),t),mC=(i,e,t)=>(vm(i,e,"access private method"),t),Ri,xn,Us,hn,Hl,Dh,TT;const As={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function pC(i,e={}){return`
413    <style>
414      :host {
415        position: relative;
416        font: var(--media-font,
417          var(--media-font-weight, bold)
418          var(--media-font-size, 14px) /
419          var(--media-text-content-height, var(--media-control-height, 24px))
420          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
421        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
422        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
423        padding: var(--media-button-padding, var(--media-control-padding, 10px));
424        justify-content: var(--media-button-justify-content, center);
425        display: inline-flex;
426        align-items: center;
427        vertical-align: middle;
428        box-sizing: border-box;
429        transition: background .15s linear;
430        pointer-events: auto;
431        cursor: var(--media-cursor, pointer);
432        -webkit-tap-highlight-color: transparent;
433      }
434
435      
436      :host(:focus-visible) {
437        box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9);
438        outline: 0;
439      }
440      
441      :host(:where(:focus)) {
442        box-shadow: none;
443        outline: 0;
444      }
445
446      :host(:hover) {
447        background: var(--media-control-hover-background, rgba(50 50 70 / .7));
448      }
449
450      svg, img, ::slotted(svg), ::slotted(img) {
451        width: var(--media-button-icon-width);
452        height: var(--media-button-icon-height, var(--media-control-height, 24px));
453        transform: var(--media-button-icon-transform);
454        transition: var(--media-button-icon-transition);
455        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
456        vertical-align: middle;
457        max-width: 100%;
458        max-height: 100%;
459        min-width: 100%;
460      }
461
462      media-tooltip {
463        
464        max-width: 0;
465        overflow-x: clip;
466        opacity: 0;
467        transition: opacity .3s, max-width 0s 9s;
468      }
469
470      :host(:hover) media-tooltip,
471      :host(:focus-visible) media-tooltip {
472        max-width: 100vw;
473        opacity: 1;
474        transition: opacity .3s;
475      }
476
477      :host([notooltip]) slot[name="tooltip"] {
478        display: none;
479      }
480    </style>
481
482    ${this.getSlotTemplateHTML(i,e)}
483
484    <slot name="tooltip">
485      <media-tooltip part="tooltip" aria-hidden="true">
486        <template shadowrootmode="${m0.shadowRootOptions.mode}">
487          ${m0.getTemplateHTML({})}
488        </template>
489        <slot name="tooltip-content">
490          ${this.getTooltipContentHTML(i)}
491        </slot>
492      </media-tooltip>
493    </slot>
494  `}function gC(i,e){return`
495    <slot></slot>
496  `}function vC(){return""}class At extends C.HTMLElement{constructor(){if(super(),Zr(this,Dh),Zr(this,Ri,void 0),this.preventClick=!1,this.tooltipEl=null,Zr(this,xn,e=>{this.preventClick||this.handleClick(e),setTimeout(it(this,Us),0)}),Zr(this,Us,()=>{var e,t;(t=(e=this.tooltipEl)==null?void 0:e.updateXOffset)==null||t.call(e)}),Zr(this,hn,e=>{const{key:t}=e;if(!this.keysUsed.includes(t)){this.removeEventListener("keyup",it(this,hn));return}this.preventClick||this.handleClick(e)}),Zr(this,Hl,e=>{const{metaKey:t,altKey:s,key:r}=e;if(t||s||!this.keysUsed.includes(r)){this.removeEventListener("keyup",it(this,hn));return}this.addEventListener("keyup",it(this,hn),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(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",As.TOOLTIP_PLACEMENT,Re.MEDIA_CONTROLLER]}enable(){this.addEventListener("click",it(this,xn)),this.addEventListener("keydown",it(this,Hl)),this.tabIndex=0}disable(){this.removeEventListener("click",it(this,xn)),this.removeEventListener("keydown",it(this,Hl)),this.removeEventListener("keyup",it(this,hn)),this.tabIndex=-1}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Re.MEDIA_CONTROLLER?(t&&((n=(r=it(this,Ri))==null?void 0:r.unassociateElement)==null||n.call(r,this),il(this,Ri,null)),s&&this.isConnected&&(il(this,Ri,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=it(this,Ri))==null?void 0:o.associateElement)==null||l.call(o,this))):e==="disabled"&&s!==t?s==null?this.enable():this.disable():e===As.TOOLTIP_PLACEMENT&&this.tooltipEl&&s!==t&&(this.tooltipEl.placement=s),it(this,Us).call(this)}connectedCallback(){var e,t,s;const{style:r}=nt(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(Re.MEDIA_CONTROLLER);n&&(il(this,Ri,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=it(this,Ri))==null?void 0:t.associateElement)==null||s.call(t,this)),C.customElements.whenDefined("media-tooltip").then(()=>mC(this,Dh,TT).call(this))}disconnectedCallback(){var e,t;this.disable(),(t=(e=it(this,Ri))==null?void 0:e.unassociateElement)==null||t.call(e,this),il(this,Ri,null),this.removeEventListener("mouseenter",it(this,Us)),this.removeEventListener("focus",it(this,Us)),this.removeEventListener("click",it(this,xn))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return Ve(this,As.TOOLTIP_PLACEMENT)}set tooltipPlacement(e){We(this,As.TOOLTIP_PLACEMENT,e)}get mediaController(){return Ve(this,Re.MEDIA_CONTROLLER)}set mediaController(e){We(this,Re.MEDIA_CONTROLLER,e)}get disabled(){return _e(this,As.DISABLED)}set disabled(e){Ae(this,As.DISABLED,e)}get noTooltip(){return _e(this,As.NO_TOOLTIP)}set noTooltip(e){Ae(this,As.NO_TOOLTIP,e)}handleClick(e){}}Ri=new WeakMap;xn=new WeakMap;Us=new WeakMap;hn=new WeakMap;Hl=new WeakMap;Dh=new WeakSet;TT=function(){this.addEventListener("mouseenter",it(this,Us)),this.addEventListener("focus",it(this,Us)),this.addEventListener("click",it(this,xn));const i=this.tooltipPlacement;i&&this.tooltipEl&&(this.tooltipEl.placement=i)};At.shadowRootOptions={mode:"open"};At.getTemplateHTML=pC;At.getSlotTemplateHTML=gC;At.getTooltipContentHTML=vC;C.customElements.get("media-chrome-button")||C.customElements.define("media-chrome-button",At);const p0=`<svg aria-hidden="true" viewBox="0 0 26 24">
497  <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"/>
498</svg>
499`;function EC(i){return`
500    <style>
501      :host([${b.MEDIA_IS_AIRPLAYING}]) slot[name=icon] slot:not([name=exit]) {
502        display: none !important;
503      }
504
505      
506      :host(:not([${b.MEDIA_IS_AIRPLAYING}])) slot[name=icon] slot:not([name=enter]) {
507        display: none !important;
508      }
509
510      :host([${b.MEDIA_IS_AIRPLAYING}]) slot[name=tooltip-enter],
511      :host(:not([${b.MEDIA_IS_AIRPLAYING}])) slot[name=tooltip-exit] {
512        display: none;
513      }
514    </style>
515
516    <slot name="icon">
517      <slot name="enter">${p0}</slot>
518      <slot name="exit">${p0}</slot>
519    </slot>
520  `}function yC(){return`
521    <slot name="tooltip-enter">${Z("start airplay")}</slot>
522    <slot name="tooltip-exit">${Z("stop airplay")}</slot>
523  `}const g0=i=>{const e=i.mediaIsAirplaying?Z("stop airplay"):Z("start airplay");
523i.setAttribute("aria-label",e)};class Em extends At{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_IS_AIRPLAYING,b.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),g0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_IS_AIRPLAYING&&g0(this)}get mediaIsAirplaying(){return _e(this,b.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){Ae(this,b.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return Ve(this,b.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){We(this,b.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){const e=new C.CustomEvent(Q.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}}Em.getSlotTemplateHTML=EC;Em.getTooltipContentHTML=yC;C.customElements.get("media-airplay-button")||C.customElements.define("media-airplay-button",Em);const TC=`<svg aria-hidden="true" viewBox="0 0 26 24">
524  <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"/>
525</svg>`,bC=`<svg aria-hidden="true" viewBox="0 0 26 24">
526  <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"/>
527</svg>`;function _C(i){return`
528    <style>
529      :host([aria-checked="true"]) slot[name=off] {
530        display: none !important;
531      }
532
533      
534      :host(:not([aria-checked="true"])) slot[name=on] {
535        display: none !important;
536      }
537
538      :host([aria-checked="true"]) slot[name=tooltip-enable],
539      :host(:not([aria-checked="true"])) slot[name=tooltip-disable] {
540        display: none;
541      }
542    </style>
543
544    <slot name="icon">
545      <slot name="on">${TC}</slot>
546      <slot name="off">${bC}</slot>
547    </slot>
548  `}function AC(){return`
549    <slot name="tooltip-enable">${Z("Enable captions")}</slot>
550    <slot name="tooltip-disable">${Z("Disable captions")}</slot>
551  `}const v0=i=>{i.setAttribute("aria-checked",hT(i).toString())};class ym extends At{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_SUBTITLES_LIST,b.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",Z("closed captions")),v0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_SUBTITLES_SHOWING&&v0(this)}get mediaSubtitlesList(){return E0(this,b.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){y0(this,b.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return E0(this,b.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){y0(this,b.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new C.CustomEvent(Q.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}}ym.getSlotTemplateHTML=_C;ym.getTooltipContentHTML=AC;const E0=(i,e)=>{const t=i.getAttribute(e);return t?Lu(t):[]},y0=(i,e,t)=>{if(!(t!=null&&t.length)){i.removeAttribute(e);return}const s=To(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};C.customElements.get("media-captions-button")||C.customElements.define("media-captions-button",ym);const SC='<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>',IC='<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 LC(i){return`
552    <style>
553      :host([${b.MEDIA_IS_CASTING}]) slot[name=icon] slot:not([name=exit]) {
554        display: none !important;
555      }
556
557      
558      :host(:not([${b.MEDIA_IS_CASTING}])) slot[name=icon] slot:not([name=enter]) {
559        display: none !important;
560      }
561
562      :host([${b.MEDIA_IS_CASTING}]) slot[name=tooltip-enter],
563      :host(:not([${b.MEDIA_IS_CASTING}])) slot[name=tooltip-exit] {
564        display: none;
565      }
566    </style>
567
568    <slot name="icon">
569      <slot name="enter">${SC}</slot>
570      <slot name="exit">${IC}</slot>
571    </slot>
572  `}function RC(){return`
573    <slot name="tooltip-enter">${Z("Start casting")}</slot>
574    <slot name="tooltip-exit">${Z("Stop casting")}</slot>
575  `}const T0=i=>{const e=i.mediaIsCasting?Z("stop casting"):Z("start casting");i.setAttribute("aria-label",e)};class Tm extends At{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_IS_CASTING,b.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),T0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_IS_CASTING&&T0(this)}get mediaIsCasting(){return _e(this,b.MEDIA_IS_CASTING)}set mediaIsCasting(e){Ae(this,b.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return Ve(this,b.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){We(this,b.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){const e=this.mediaIsCasting?Q.MEDIA_EXIT_CAST_REQUEST:Q.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new C.CustomEvent(e,{composed:!0,bubbles:!0}))}}Tm.getSlotTemplateHTML=LC;Tm.getTooltipContentHTML=RC;C.customElements.get("media-cast-button")||C.customElements.define("media-cast-button",Tm);var bm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Or=(i,e,t)=>(bm(i,e,"read from private field"),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)},_m=(i,e,t,s)=>(bm(i,e,"write to private field"),e.set(i,t),t),or=(i,e,t)=>(bm(i,e,"access private method"),t),Qd,_o,Hr,Gl,Ch,wh,bT,Mh,_T,Ph,AT,Oh,ST,Nh,IT;function xC(i){return`
576    <style>
577      :host {
578        font: var(--media-font,
579          var(--media-font-weight, normal)
580          var(--media-font-size, 14px) /
581          var(--media-text-content-height, var(--media-control-height, 24px))
582          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
583        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
584        display: var(--media-dialog-display, inline-flex);
585        justify-content: center;
586        align-items: center;
587        
588        transition-behavior: allow-discrete;
589        visibility: hidden;
590        opacity: 0;
591        transform: translateY(2px) scale(.99);
592        pointer-events: none;
593      }
594
595      :host([open]) {
596        transition: display .2s, visibility 0s, opacity .2s ease-out, transform .15s ease-out;
597        visibility: visible;
598        opacity: 1;
599        transform: translateY(0) scale(1);
600        pointer-events: auto;
601      }
602
603      #content {
604        display: flex;
605        position: relative;
606        box-sizing: border-box;
607        width: min(320px, 100%);
608        word-wrap: break-word;
609        max-height: 100%;
610        overflow: auto;
611        text-align: center;
612        line-height: 1.4;
613      }
614    </style>
615    ${this.getSlotTemplateHTML(i)}
616  `}function kC(i){return`
617    <slot id="content"></slot>
618  `}const fa={OPEN:"open",ANCHOR:"anchor"};class wo extends C.HTMLElement{constructor(){super(),es(this,Gl),es(this,wh),es(this,Mh),es(this,Ph),es(this,Oh),es(this,Nh),es(this,Qd,!1),es(this,_o,null),es(this,Hr,null),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[fa.OPEN,fa.ANCHOR]}get open(){return _e(this,fa.OPEN)}set open(e){Ae(this,fa.OPEN,e)}handleEvent(e){switch(e.type){case"invoke":or(this,Ph,AT).call(this,e);break;case"focusout":or(this,Oh,ST).call(this,e);break;case"keydown":or(this,Nh,IT).call(this,e);break}}connectedCallback(){or(this,Gl,Ch).call(this),this.role||(this.role="dialog")}attributeChangedCallback(e,t,s){or(this,Gl,Ch).call(this),e===fa.OPEN&&s!==t&&(this.open?or(this,wh,bT).call(this):or(this,Mh,_T).call(this))}focus(){_m(this,_o,um());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==null||s.focus()}get keysUsed(){return["Escape","Tab"]}}Qd=new WeakMap;_o=new WeakMap;Hr=new WeakMap;Gl=new WeakSet;Ch=function(){if(!Or(this,Qd)&&(_m(this,Qd,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);const i=qt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i),queueMicrotask(()=>{const{style:e}=nt(this.shadowRoot,":host");e.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")})}};wh=new WeakSet;bT=function(){var i;(i=Or(this,Hr))==null||i.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",()=>this.focus(),{once:!0})};Mh=new WeakSet;_T=function(){var i;(i=Or(this,Hr))==null||i.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))};Ph=new WeakSet;AT=function(i){_m(this,Hr,i.relatedTarget),gs(this,i.relatedTarget)||(this.open=!this.open)};Oh=new WeakSet;ST=function(i){var e;gs(this,i.relatedTarget)||((e=Or(this,_o))==null||e.focus(),Or(this,Hr)&&Or(this,Hr)!==i.relatedTarget&&this.open&&(this.open=!1))};Nh=new WeakSet;IT=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=Or(this,_o))==null||n.focus(),this.open=!1))};wo.shadowRootOptions={mode:"open"};wo.getTemplateHTML=xC;wo.getSlotTemplateHTML=kC;C.customElements.get("media-chrome-dialog")||C.customElements.define("media-chrome-dialog",wo);var Am=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},je=(i,e,t)=>(Am(i,e,"read from private field"),t?t.call(i):e.get(i)),bt=(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)},Ls=(i,e,t,s)=>(Am(i,e,"write to private field"),e.set(i,t),t),ci=(i,e,t)=>(Am(i,e,"access private method"),t),xi,ku,Kl,Vl,fi,Xd,Wl,ql,Yl,Sm,LT,jl,Uh,zl,Fh,Zd,Im,$h,RT,Bh,xT,Hh,kT,Gh,DT;function DC(i){return`
619    <style>
620      :host {
621        --_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
622        --_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px));
623
624        box-shadow: var(--_focus-visible-box-shadow, none);
625        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
626        height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding));
627        display: inline-flex;
628        align-items: center;
629        
630        vertical-align: middle;
631        box-sizing: border-box;
632        position: relative;
633        width: 100px;
634        transition: background .15s linear;
635        cursor: var(--media-cursor, pointer);
636        pointer-events: auto;
637        touch-action: none; 
638      }
639
640      
641      input[type=range]:focus {
642        outline: 0;
643      }
644      input[type=range]:focus::-webkit-slider-runnable-track {
645        outline: 0;
646      }
647
648      :host(:hover) {
649        background: var(--media-control-hover-background, rgb(50 50 70 / .7));
650      }
651
652      #leftgap {
653        padding-left: var(--media-range-padding-left, var(--_media-range-padding));
654      }
655
656      #rightgap {
657        padding-right: var(--media-range-padding-right, var(--_media-range-padding));
658      }
659
660      #startpoint,
661      #endpoint {
662        position: absolute;
663      }
664
665      #endpoint {
666        right: 0;
667      }
668
669      #container {
670        
671        width: var(--media-range-track-width, 100%);
672        transform: translate(var(--media-range-track-translate-x, 0px), var(--media-range-track-translate-y, 0px));
673        position: relative;
674        height: 100%;
675        display: flex;
676        align-items: center;
677        min-width: 40px;
678      }
679
680      #range {
681        
682        display: var(--media-time-range-hover-display, block);
683        bottom: var(--media-time-range-hover-bottom, -7px);
684        height: var(--media-time-range-hover-height, max(100% + 7px, 25px));
685        width: 100%;
686        position: absolute;
687        cursor: var(--media-cursor, pointer);
688
689        -webkit-appearance: none; 
690        -webkit-tap-highlight-color: transparent;
691        background: transparent; 
692        margin: 0;
693        z-index: 1;
694      }
695
696      @media (hover: hover) {
697        #range {
698          bottom: var(--media-time-range-hover-bottom, -5px);
699          height: var(--media-time-range-hover-height, max(100% + 5px, 20px));
700        }
701      }
702
703      
704      
705      #range::-webkit-slider-thumb {
706        -webkit-appearance: none;
707        background: transparent;
708        width: .1px;
709        height: .1px;
710      }
711
712      
713      #range::-moz-range-thumb {
714        background: transparent;
715        border: transparent;
716        width: .1px;
717        height: .1px;
718      }
719
720      #appearance {
721        height: var(--media-range-track-height, 4px);
722        display: flex;
723        flex-direction: column;
724        justify-content: center;
725        width: 100%;
726        position: absolute;
727        
728        will-change: transform;
729      }
730
731      #track {
732        background: var(--media-range-track-background, rgb(255 255 255 / .2));
733        border-radius: var(--media-range-track-border-radius, 1px);
734        border: var(--media-range-track-border, none);
735        outline: var(--media-range-track-outline);
736        outline-offset: var(--media-range-track-outline-offset);
737        backdrop-filter: var(--media-range-track-backdrop-filter);
738        -webkit-backdrop-filter: var(--media-range-track-backdrop-filter);
739        box-shadow: var(--media-range-track-box-shadow, none);
740        position: absolute;
741        width: 100%;
742        height: 100%;
743        overflow: hidden;
744      }
745
746      #progress,
747      #pointer {
748        position: absolute;
749        height: 100%;
750        will-change: width;
751      }
752
753      #progress {
754        background: var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238)));
755        transition: var(--media-range-track-transition);
756      }
757
758      #pointer {
759        background: var(--media-range-track-pointer-background);
760        border-right: var(--media-range-track-pointer-border-right);
761        transition: visibility .25s, opacity .25s;
762        visibility: hidden;
763        opacity: 0;
764      }
765
766      @media (hover: hover) {
767        :host(:hover) #pointer {
768          transition: visibility .5s, opacity .5s;
769          visibility: visible;
770          opacity: 1;
771        }
772      }
773
774      #thumb,
775      ::slotted([slot=thumb]) {
776        width: var(--media-range-thumb-width, 10px);
777        height: var(--media-range-thumb-height, 10px);
778        transition: var(--media-range-thumb-transition);
779        transform: var(--media-range-thumb-transform, none);
780        opacity: var(--media-range-thumb-opacity, 1);
781        translate: -50%;
782        position: absolute;
783        left: 0;
784        cursor: var(--media-cursor, pointer);
785      }
786
787      #thumb {
788        border-radius: var(--media-range-thumb-border-radius, 10px);
789        background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238)));
790        box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent);
791        border: var(--media-range-thumb-border, none);
792      }
793
794      :host([disabled]) #thumb {
795        background-color: #777;
796      }
797
798      .segments #appearance {
799        height: var(--media-range-segment-hover-height, 7px);
800      }
801
802      #track {
803        clip-path: url(#segments-clipping);
804      }
805
806      #segments {
807        --segments-gap: var(--media-range-segments-gap, 2px);
808        position: absolute;
809        width: 100%;
810        height: 100%;
811      }
812
813      #segments-clipping {
814        transform: translateX(calc(var(--segments-gap) / 2));
815      }
816
817      #segments-clipping:empty {
818        display: none;
819      }
820
821      #segments-clipping rect {
822        height: var(--media-range-track-height, 4px);
823        y: calc((var(--media-range-segment-hover-height, 7px) - var(--media-range-track-height, 4px)) / 2);
824        transition: var(--media-range-segment-transition, transform .1s ease-in-out);
825        transform: var(--media-range-segment-transform, scaleY(1));
826        transform-origin: center;
827      }
828    </style>
829    <div id="leftgap"></div>
830    <div id="container">
831      <div id="startpoint"></div>
832      <div id="endpoint"></div>
833      <div id="appearance">
834        <div id="track" part="track">
835          <div id="pointer"></div>
836          <div id="progress" part="progress"></div>
837        </div>
838        <slot name="thumb">
839          <div id="thumb" part="thumb"></div>
840        </slot>
841        <svg id="segments"><clipPath id="segments-clipping"></clipPath></svg>
842      </div>
843      <input id="range" type="range" min="0" max="1" step="any" value="0">
844    </div>
845    <div id="rightgap"></div>
846  `}class ra extends C.HTMLElement{constructor(){if(super(),bt(this,Sm),bt(this,jl),bt(this,zl),bt(this,Zd),bt(this,$h),bt(this,Bh),bt(this,Hh),bt(this,Gh),bt(this,xi,void 0),bt(this,ku,void 0),bt(this,Kl,void 0),bt(this,Vl,void 0),bt(this,fi,{}),bt(this,Xd,[]),bt(this,Wl,()=>{if(this.range.matches(":focus-visible")){const{style:e}=nt(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),bt(this,ql,()=>{const{style:e}=nt(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")}),bt(this,Yl,()=>{const e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.container=this.shadowRoot.querySelector("#container"),Ls(this,Kl,this.shadowRoot.querySelector("#startpoint")),Ls(this,Vl,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",Re.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Re.MEDIA_CONTROLLER?(t&&((n=(r=je(this,xi))==null?void 0:r.unassociateElement)==null||n.call(r,this),Ls(this,xi,null)),s&&this.isConnected&&(Ls(this,xi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=je(this,xi))==null?void 0:o.associateElement)==null||l.call(o,this))):(e==="disabled"||e==="aria-disabled"&&t!==s)&&(s==null?(this.range.removeAttribute(e),ci(this,jl,Uh).call(this)):(this.range.setAttribute(e,s),ci(this,zl,Fh).call(this)))}connectedCallback(){var e,t,s;const{style:r}=nt(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),je(this,fi).pointer=nt(this.shadowRoot,"#pointer"),je(this,fi).progress=nt(this.shadowRoot,"#progress"),je(this,fi).thumb=nt(this.shadowRoot,'#thumb, ::slotted([slot="thumb"])'),je(this,fi).activeSegment=nt(this.shadowRoot,"#segments-clipping rect:nth-child(0)");const n=this.getAttribute(Re.MEDIA_CONTROLLER);n&&(Ls(this,xi,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=je(this,xi))==null?void 0:t.associateElement)==null||s.call(t,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",je(this,Wl)),this.shadowRoot.addEventListener("focusout",je(this,ql)),ci(this,jl,Uh).call(this),Xn(this.container,je(this,Yl))}disconnectedCallback(){var e,t;ci(this,zl,Fh).call(this),(t=(e=je(this,xi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Ls(this,xi,null),this.shadowRoot.removeEventListener("focusin",je(this,Wl)),this.shadowRoot.removeEventListener("focusout",je(this,ql)),Zn(this.container,je(this,Yl))}updatePointerBar(e){var t;(t=je(this,fi).pointer)==null||t.style.setProperty("width",`${this.getPointerRatio(e)*100}%`)}updateBar(){var e,t;const s=this.range.valueAsNumber*100;(e=je(this,fi).progress)==null||e.style.setProperty("width",`${s}%`),(t=je(this,fi).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!=null&&e.length)),!(e!=null&&e.length))return;const s=[...new Set([+this.range.min,...e.flatMap(n=>[n.start,n.end]),+this.range.max])];Ls(this,Xd,[...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=mt.createElementNS("http://www.w3.org/2000/svg","rect"),f=nt(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 ID(e.clientX,e.clientY,je(this,Kl).getBoundingClientRect(),je(this,Vl).getBoundingClientRect())}get dragging(){return this.hasAttribute("dragging")}handleEvent(e){switch(e.type){case"pointermove":ci(this,Gh,DT).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":ci(this,$h,RT).call(this,e);break;case"pointerdown":ci(this,Zd,Im).call(this,e);break;case"pointerup":ci(this,Bh,xT).call(this);break;case"pointerleave":ci(this,Hh,kT).call(this);break}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}}xi=new WeakMap;ku=new WeakMap;Kl=new WeakMap;Vl=new WeakMap;fi=new WeakMap;Xd=new WeakMap;Wl=new WeakMap;ql=new WeakMap;Yl=new WeakMap;Sm=new WeakSet;LT=function(i){const e=je(this,fi).activeSegment;if(!e)return;const t=this.getPointerRatio(i),r=`#segments-clipping rect:nth-child(${je(this,Xd).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))"))};jl=new WeakSet;Uh=function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))};zl=new WeakSet;Fh=function(){var i,e;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),(i=C.window)==null||i.removeEventListener("pointerup",this),(e=C.window)==null||e.removeEventListener("pointermove",this)};Zd=new WeakSet;Im=function(i){var e;Ls(this,ku,i.composedPath().includes(this.range)),(e=C.window)==null||e.addEventListener("pointerup",this)};$h=new WeakSet;RT=function(i){var e;i.pointerType!=="mouse"&&ci(this,Zd,Im).call(this,i),this.addEventListener("pointerleave",this),(e=C.window)==null||e.addEventListener("pointermove",this)};Bh=new WeakSet;xT=function(){var i;(i=C.window)==null||i.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")};Hh=new WeakSet;kT=function(){var i,e;this.removeEventListener("pointerleave",this),(i=C.window)==null||i.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),(e=je(this,fi).activeSegment)==null||e.style.removeProperty("transform")};Gh=new WeakSet;DT=function(i){this.toggleAttribute("dragging",i.buttons===1||i.pointerType!=="mouse"),this.updatePointerBar(i),ci(this,Sm,LT).call(this,i),this.dragging&&(i.pointerType!=="mouse"||!je(this,ku))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(i),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))};ra.shadowRootOptions={mode:"open"};ra.getTemplateHTML=DC;C.customElements.get("media-chrome-range")||C.customElements.define("media-chrome-range",ra);
846var CT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},sl=(i,e,t)=>(CT(i,e,"read from private field"),t?t.call(i):e.get(i)),CC=(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)},rl=(i,e,t,s)=>(CT(i,e,"write to private field"),e.set(i,t),t),ki;function wC(i){return`
847    <style>
848      :host {
849        
850        box-sizing: border-box;
851        display: var(--media-control-display, var(--media-control-bar-display, inline-flex));
852        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
853        --media-loading-indicator-icon-height: 44px;
854      }
855
856      ::slotted(media-time-range),
857      ::slotted(media-volume-range) {
858        min-height: 100%;
859      }
860
861      ::slotted(media-time-range),
862      ::slotted(media-clip-selector) {
863        flex-grow: 1;
864      }
865
866      ::slotted([role="menu"]) {
867        position: absolute;
868      }
869    </style>
870
871    <slot></slot>
872  `}class Lm extends C.HTMLElement{constructor(){if(super(),CC(this,ki,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Re.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Re.MEDIA_CONTROLLER&&(t&&((n=(r=sl(this,ki))==null?void 0:r.unassociateElement)==null||n.call(r,this),rl(this,ki,null)),s&&this.isConnected&&(rl(this,ki,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=sl(this,ki))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const r=this.getAttribute(Re.MEDIA_CONTROLLER);r&&(rl(this,ki,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=sl(this,ki))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=sl(this,ki))==null?void 0:e.unassociateElement)==null||t.call(e,this),rl(this,ki,null)}}ki=new WeakMap;Lm.shadowRootOptions={mode:"open"};Lm.getTemplateHTML=wC;C.customElements.get("media-control-bar")||C.customElements.define("media-control-bar",Lm);var wT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},nl=(i,e,t)=>(wT(i,e,"read from private field"),t?t.call(i):e.get(i)),MC=(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)},al=(i,e,t,s)=>(wT(i,e,"write to private field"),e.set(i,t),t),Di;function PC(i,e={}){return`
873    <style>
874      :host {
875        font: var(--media-font,
876          var(--media-font-weight, normal)
877          var(--media-font-size, 14px) /
878          var(--media-text-content-height, var(--media-control-height, 24px))
879          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
880        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
881        background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))));
882        padding: var(--media-control-padding, 10px);
883        display: inline-flex;
884        justify-content: center;
885        align-items: center;
886        vertical-align: middle;
887        box-sizing: border-box;
888        text-align: center;
889        pointer-events: auto;
890      }
891
892      
893      :host(:focus-visible) {
894        box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9);
895        outline: 0;
896      }
897
898      
899      :host(:where(:focus)) {
900        box-shadow: none;
901        outline: 0;
902      }
903    </style>
904
905    ${this.getSlotTemplateHTML(i,e)}
906  `}function OC(i,e){return`
907    <slot></slot>
908  `}class sr extends C.HTMLElement{constructor(){if(super(),MC(this,Di,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Re.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Re.MEDIA_CONTROLLER&&(t&&((n=(r=nl(this,Di))==null?void 0:r.unassociateElement)==null||n.call(r,this),al(this,Di,null)),s&&this.isConnected&&(al(this,Di,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=nl(this,Di))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const{style:r}=nt(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);const n=this.getAttribute(Re.MEDIA_CONTROLLER);n&&(al(this,Di,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=nl(this,Di))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=nl(this,Di))==null?void 0:e.unassociateElement)==null||t.call(e,this),al(this,Di,null)}}Di=new WeakMap;sr.shadowRootOptions={mode:"open"};sr.getTemplateHTML=PC;sr.getSlotTemplateHTML=OC;C.customElements.get("media-text-display")||C.customElements.define("media-text-display",sr);var MT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},b0=(i,e,t)=>(MT(i,e,"read from private field"),t?t.call(i):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)},UC=(i,e,t,s)=>(MT(i,e,"write to private field"),e.set(i,t),t),Ua;function FC(i,e){return`
909    <slot>${Js(e.mediaDuration)}</slot>
910  `}class PT extends sr{constructor(){var e;super(),NC(this,Ua,void 0),UC(this,Ua,this.shadowRoot.querySelector("slot")),b0(this,Ua).textContent=Js((e=this.mediaDuration)!=null?e:0)}static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_DURATION]}attributeChangedCallback(e,t,s){e===b.MEDIA_DURATION&&(b0(this,Ua).textContent=Js(+s)),super.attributeChangedCallback(e,t,s)}get mediaDuration(){return Ke(this,b.MEDIA_DURATION)}set mediaDuration(e){Ze(this,b.MEDIA_DURATION,e)}}Ua=new WeakMap;PT.getSlotTemplateHTML=FC;C.customElements.get("media-duration-display")||C.customElements.define("media-duration-display",PT);const $C={2:Z("Network Error"),3:Z("Decode Error"),4:Z("Source Not Supported"),5:Z("Encryption 
910Error")},BC={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.")},OT=i=>{var e,t;return i.code===1?null:{title:(e=$C[i.code])!=null?e:`Error ${i.code}`,message:(t=BC[i.code])!=null?t:i.message}};var NT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},HC=(i,e,t)=>(NT(i,e,"read from private field"),t?t.call(i):e.get(i)),GC=(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)=>(NT(i,e,"write to private field"),e.set(i,t),t),Ql;function VC(i){return`
911    <style>
912      :host {
913        background: rgb(20 20 30 / .8);
914      }
915
916      #content {
917        display: block;
918        padding: 1.2em 1.5em;
919      }
920
921      h3,
922      p {
923        margin-block: 0 .3em;
924      }
925    </style>
926    <slot name="error-${i.mediaerrorcode}" id="content">
927      ${UT({code:+i.mediaerrorcode,message:i.mediaerrormessage})}
928    </slot>
929  `}function WC(i){return i.code&&OT(i)!==null}function UT(i){var e;const{title:t,message:s}=(e=OT(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 _0=[b.MEDIA_ERROR_CODE,b.MEDIA_ERROR_MESSAGE];class Du extends wo{constructor(){super(...arguments),GC(this,Ql,null)}static get observedAttributes(){return[...super.observedAttributes,..._0]}formatErrorMessage(e){return this.constructor.formatErrorMessage(e)}attributeChangedCallback(e,t,s){var r;if(super.attributeChangedCallback(e,t,s),!_0.includes(e))return;const n=(r=this.mediaError)!=null?r:{code:this.mediaErrorCode,message:this.mediaErrorMessage};this.open=WC(n),this.open&&(this.shadowRoot.querySelector("slot").name=`error-${this.mediaErrorCode}`,this.shadowRoot.querySelector("#content").innerHTML=this.formatErrorMessage(n))}get mediaError(){return HC(this,Ql)}set mediaError(e){KC(this,Ql,e)}get mediaErrorCode(){return Ke(this,"mediaerrorcode")}set mediaErrorCode(e){Ze(this,"mediaerrorcode",e)}get mediaErrorMessage(){return Ve(this,"mediaerrormessage")}set mediaErrorMessage(e){We(this,"mediaerrormessage",e)}}Ql=new WeakMap;Du.getSlotTemplateHTML=VC;Du.formatErrorMessage=UT;C.customElements.get("media-error-dialog")||C.customElements.define("media-error-dialog",Du);var FT=Du;const qC=`<svg aria-hidden="true" viewBox="0 0 26 24">
930  <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/>
931</svg>`,YC=`<svg aria-hidden="true" viewBox="0 0 26 24">
932  <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/>
933</svg>`;function jC(i){return`
934    <style>
935      :host([${b.MEDIA_IS_FULLSCREEN}]) slot[name=icon] slot:not([name=exit]) {
936        display: none !important;
937      }
938
939      
940      :host(:not([${b.MEDIA_IS_FULLSCREEN}])) slot[name=icon] slot:not([name=enter]) {
941        display: none !important;
942      }
943
944      :host([${b.MEDIA_IS_FULLSCREEN}]) slot[name=tooltip-enter],
945      :host(:not([${b.MEDIA_IS_FULLSCREEN}])) slot[name=tooltip-exit] {
946        display: none;
947      }
948    </style>
949
950    <slot name="icon">
951      <slot name="enter">${qC}</slot>
952      <slot name="exit">${YC}</slot>
953    </slot>
954  `}function zC(){return`
955    <slot name="tooltip-enter">${Z("Enter fullscreen mode")}</slot>
956    <slot name="tooltip-exit">${Z("Exit fullscreen mode")}</slot>
957  `}const A0=i=>{const e=i.mediaIsFullscreen?Z("exit fullscreen mode"):Z("enter fullscreen mode");i.setAttribute("aria-label",e)};class Rm extends At{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_IS_FULLSCREEN,b.MEDIA_FULLSCREEN_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),A0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_IS_FULLSCREEN&&A0(this)}get mediaFullscreenUnavailable(){return Ve(this,b.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(e){We(this,b.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return _e(this,b.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){Ae(this,b.MEDIA_IS_FULLSCREEN,e)}handleClick(){const e=this.mediaIsFullscreen?Q.MEDIA_EXIT_FULLSCREEN_REQUEST:Q.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new C.CustomEvent(e,{composed:!0,bubbles:!0}))}}Rm.getSlotTemplateHTML=jC;Rm.getTooltipContentHTML=zC;C.customElements.get("media-fullscreen-button")||C.customElements.define("media-fullscreen-button",Rm);const{MEDIA_TIME_IS_LIVE:Xl,MEDIA_PAUSED:to}=b,{MEDIA_SEEK_TO_LIVE_REQUEST:QC,MEDIA_PLAY_REQUEST:XC}=Q,ZC='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>';function JC(i){return`
958    <style>
959      :host { --media-tooltip-display: none; }
960      
961      slot[name=indicator] > *,
962      :host ::slotted([slot=indicator]) {
963        
964        min-width: auto;
965        fill: var(--media-live-button-icon-color, rgb(140, 140, 140));
966        color: var(--media-live-button-icon-color, rgb(140, 140, 140));
967      }
968
969      :host([${Xl}]:not([${to}])) slot[name=indicator] > *,
970      :host([${Xl}]:not([${to}])) ::slotted([slot=indicator]) {
971        fill: var(--media-live-button-indicator-color, rgb(255, 0, 0));
972        color: var(--media-live-button-indicator-color, rgb(255, 0, 0));
973      }
974
975      :host([${Xl}]:not([${to}])) {
976        cursor: var(--media-cursor, not-allowed);
977      }
978
979      slot[name=text]{
980        text-transform: uppercase;
981      }
982
983    </style>
984
985    <slot name="indicator">${ZC}</slot>
986    
987    <slot name="spacer">&nbsp;</slot><slot name="text">${Z("live")}</slot>
988  `}const S0=i=>{const e=i.mediaPaused||!i.mediaTimeIsLive,t=Z(e?"seek to live":"playing live");i.setAttribute("aria-label",t),e?i.removeAttribute("aria-disabled"):i.setAttribute("aria-disabled","true")};class $T extends At{static get observedAttributes(){return[...super.observedAttributes,Xl,to]}connectedCallback(){super.connectedCallback(),S0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),S0(this)}get mediaPaused(){return _e(this,b.MEDIA_PAUSED)}set mediaPaused(e){Ae(this,b.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return _e(this,b.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){Ae(this,b.MEDIA_TIME_IS_LIVE,e)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new C.CustomEvent(QC,{composed:!0,bubbles:!0})),this.hasAttribute(to)&&this.dispatchEvent(new C.CustomEvent(XC,{composed:!0,bubbles:!0})))}}$T.getSlotTemplateHTML=JC;C.customElements.get("media-live-button")||C.customElements.define("media-live-button",$T);var BT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ma=(i,e,t)=>(BT(i,e,"read from private field"),t?t.call(i):e.get(i)),I0=(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)},pa=(i,e,t,s)=>(BT(i,e,"write to private field"),e.set(i,t),t),Ci,Zl;const ol={LOADING_DELAY:"loadingdelay",NO_AUTOHIDE:"noautohide"},HT=500,ew=`
989<svg aria-hidden="true" viewBox="0 0 100 100">
990  <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">
991    <animateTransform
992       attributeName="transform"
993       attributeType="XML"
994       type="rotate"
995       dur="1s"
996       from="0 50 50"
997       to="360 50 50"
998       repeatCount="indefinite" />
999  </path>
1000</svg>
1001`;function tw(i){return`
1002    <style>
1003      :host {
1004        display: var(--media-control-display, var(--media-loading-indicator-display, inline-block));
1005        vertical-align: middle;
1006        box-sizing: border-box;
1007        --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ${HT}ms);
1008      }
1009
1010      #status {
1011        color: rgba(0,0,0,0);
1012        width: 0px;
1013        height: 0px;
1014      }
1015
1016      :host slot[name=icon] > *,
1017      :host ::slotted([slot=icon]) {
1018        opacity: var(--media-loading-indicator-opacity, 0);
1019        transition: opacity 0.15s;
1020      }
1021
1022      :host([${b.MEDIA_LOADING}]:not([${b.MEDIA_PAUSED}])) slot[name=icon] > *,
1023      :host([${b.MEDIA_LOADING}]:not([${b.MEDIA_PAUSED}])) ::slotted([slot=icon]) {
1024        opacity: var(--media-loading-indicator-opacity, 1);
1025        transition: opacity 0.15s var(--_loading-indicator-delay);
1026      }
1027
1028      :host #status {
1029        visibility: var(--media-loading-indicator-opacity, hidden);
1030        transition: visibility 0.15s;
1031      }
1032
1033      :host([${b.MEDIA_LOADING}]:not([${b.MEDIA_PAUSED}])) #status {
1034        visibility: var(--media-loading-indicator-opacity, visible);
1035        transition: visibility 0.15s var(--_loading-indicator-delay);
1036      }
1037
1038      svg, img, ::slotted(svg), ::slotted(img) {
1039        width: var(--media-loading-indicator-icon-width);
1040        height: var(--media-loading-indicator-icon-height, 100px);
1041        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
1042        vertical-align: middle;
1043      }
1044    </style>
1045
1046    <slot name="icon">${ew}</slot>
1047    <div id="status" role="status" aria-live="polite">${Z("media loading")}</div>
1048  `}class xm extends C.HTMLElement{constructor(){if(super(),I0(this,Ci,void 0),I0(this,Zl,HT),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Re.MEDIA_CONTROLLER,b.MEDIA_PAUSED,b.MEDIA_LOADING,ol.LOADING_DELAY]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===ol.LOADING_DELAY&&t!==s?this.loadingDelay=Number(s):e===Re.MEDIA_CONTROLLER&&(t&&((n=(r=ma(this,Ci))==null?void 0:r.unassociateElement)==null||n.call(r,this),pa(this,Ci,null)),s&&this.isConnected&&(pa(this,Ci,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=ma(this,Ci))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const r=this.getAttribute(Re.MEDIA_CONTROLLER);r&&(pa(this,Ci,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=ma(this,Ci))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=ma(this,Ci))==null?void 0:e.unassociateElement)==null||t.call(e,this),pa(this,Ci,null)}get loadingDelay(){return ma(this,Zl)}set loadingDelay(e){pa(this,Zl,e);const{style:t}=nt(this.shadowRoot,":host");t.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${e}ms)`)}get mediaPaused(){return _e(this,b.MEDIA_PAUSED)}set mediaPaused(e){Ae(this,b.MEDIA_PAUSED,e)}get mediaLoading(){return _e(this,b.MEDIA_LOADING)}set mediaLoading(e){Ae(this,b.MEDIA_LOADING,e)}get mediaController(){return Ve(this,Re.MEDIA_CONTROLLER)}set mediaController(e){We(this,Re.MEDIA_CONTROLLER,e)}get noAutohide(){return _e(this,ol.NO_AUTOHIDE)}set noAutohide(e){Ae(this,ol.NO_AUTOHIDE,e)}}Ci=new WeakMap;Zl=new WeakMap;xm.shadowRootOptions={mode:"open"};xm.getTemplateHTML=tw;C.customElements.get("media-loading-indicator")||C.customElements.define("media-loading-indicator",xm);const iw=`<svg aria-hidden="true" viewBox="0 0 24 24">
1049  <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"/>
1050</svg>`,L0=`<svg aria-hidden="true" viewBox="0 0 24 24">
1051  <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"/>
1052</svg>`,sw=`<svg aria-hidden="true" viewBox="0 0 24 24">
1053  <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"/>
1054</svg>`;function rw(i){return`
1055    <style>
1056      :host(:not([${b.MEDIA_VOLUME_LEVEL}])) slot[name=icon] slot:not([name=high]),
1057      :host([${b.MEDIA_VOLUME_LEVEL}=high]) slot[name=icon] slot:not([name=high]) {
1058        display: none !important;
1059      }
1060
1061      :host([${b.MEDIA_VOLUME_LEVEL}=off]) slot[name=icon] slot:not([name=off]) {
1062        display: none !important;
1063      }
1064
1065      :host([${b.MEDIA_VOLUME_LEVEL}=low]) slot[name=icon] slot:not([name=low]) {
1066        display: none !important;
1067      }
1068
1069      :host([${b.MEDIA_VOLUME_LEVEL}=medium]) slot[name=icon] slot:not([name=medium]) {
1070        display: none !important;
1071      }
1072
1073      :host(:not([${b.MEDIA_VOLUME_LEVEL}=off])) slot[name=tooltip-unmute],
1074      :host([${b.MEDIA_VOLUME_LEVEL}=off]) slot[name=tooltip-mute] {
1075        display: none;
1076      }
1077    </style>
1078
1079    <slot name="icon">
1080      <slot name="off">${iw}</slot>
1081      <slot name="low">${L0}</slot>
1082      <slot name="medium">${L0}</slot>
1083      <slot name="high">${sw}</slot>
1084    </slot>
1085  `}function nw(){return`
1086    <slot name="tooltip-mute">${Z("Mute")}</slot>
1087    <slot name="tooltip-unmute">${Z("Unmute")}</slot>
1088  `}const R0=i=>{const e=i.mediaVolumeLevel==="off",t=Z(e?"unmute":"mute");i.setAttribute("aria-label",t)};class km extends At{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_VOLUME_LEVEL]}connectedCallback(){super.connectedCallback(),R0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_VOLUME_LEVEL&&R0(this)}get mediaVolumeLevel(){return Ve(this,b.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){We(this,b.MEDIA_VOLUME_LEVEL,e)}handleClick(){const e=this.mediaVolumeLevel==="off"?Q.MEDIA_UNMUTE_REQUEST:Q.MEDIA_MUTE_REQUEST;this.dispatchEvent(new C.CustomEvent(e,{composed:!0,bubbles:!0}))}}km.getSlotTemplateHTML=rw;km.getTooltipContentHTML=nw;C.customElements.get("media-mute-button")||C.customElements.define("media-mute-button",km);const x0=`<svg aria-hidden="true" viewBox="0 0 28 24">
1089  <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"/>
1090</svg>`;function aw(i){return`
1091    <style>
1092      :host([${b.MEDIA_IS_PIP}]) slot[name=icon] slot:not([name=exit]) {
1093        display: none !important;
1094      }
1095
1096      :host(:not([${b.MEDIA_IS_PIP}])) slot[name=icon] slot:not([name=enter]) {
1097        display: none !important;
1098      }
1099
1100      :host([${b.MEDIA_IS_PIP}]) slot[name=tooltip-enter],
1101      :host(:not([${b.MEDIA_IS_PIP}])) slot[name=tooltip-exit] {
1102        display: none;
1103      }
1104    </style>
1105
1106    <slot name="icon">
1107      <slot name="enter">${x0}</slot>
1108      <slot name="exit">${x0}</slot>
1109    </slot>
1110  `}function ow(){return`
1111    <slot name="tooltip-enter">${Z("Enter picture in picture mode")}</slot>
1112    <slot name="tooltip-exit">${Z("Exit picture in picture mode")}</slot>
1113  `}const k0=i=>{const e=i.mediaIsPip?Z("exit picture in picture mode"):Z("enter picture in picture mode");i.setAttribute("aria-label",e)};class Dm extends At{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_IS_PIP,b.MEDIA_PIP_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),k0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_IS_PIP&&k0(this)}get mediaPipUnavailable(){return Ve(this,b.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){We(this,b.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return _e(this,b.MEDIA_IS_PIP)}set mediaIsPip(e){Ae(this,b.MEDIA_IS_PIP,e)}handleClick(){const e=this.mediaIsPip?Q.MEDIA_EXIT_PIP_REQUEST:Q.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new C.CustomEvent(e,{composed:!0,bubbles:!0}))}}Dm.getSlotTemplateHTML=aw;Dm.getTooltipContentHTML=ow;C.customElements.get("media-pip-button")||C.customElements.define("media-pip-button",Dm);var lw=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Jr=(i,e,t)=>(lw(i,e,"read from private field"),t?t.call(i):e.get(i)),dw=(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)},Rs;const Ec={RATES:"rates"},GT=[1,1.2,1.5,1.7,2],kn=1;function uw(i){return`
1114    <style>
1115      :host {
1116        min-width: 5ch;
1117        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
1118      }
1119    </style>
1120    <slot name="icon">${i.mediaplaybackrate||kn}x</slot>
1121  `}function cw(){return Z("Playback rate")}class Cm extends At{constructor(){var e;super(),dw(this,Rs,new fm(this,Ec.RATES,{defaultValue:GT})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:kn}x`}static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_PLAYBACK_RATE,Ec.RATES]}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),e===Ec.RATES&&(Jr(this,Rs).value=s),e===b.MEDIA_PLAYBACK_RATE){const r=s?+s:Number.NaN,n=Number.isNaN(r)?kn:r;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",Z("Playback rate {playbackRate}",{playbackRate:n}))}}get rates(){return Jr(this,Rs)}set rates(e){e?Array.isArray(e)?Jr(this,Rs).value=e.join(" "):typeof e=="string"&&(Jr(this,Rs).value=e):Jr(this,Rs).value=""}get mediaPlaybackRate(){return Ke(this,b.MEDIA_PLAYBACK_RATE,kn)}set mediaPlaybackRate(e){Ze(this,b.MEDIA_PLAYBACK_RATE,e)}handleClick(){var e,t;const s=Array.from(Jr(this,Rs).values(),a=>+a).sort((a,o)=>a-o),r=(t=(e=s.find(a=>a>this.mediaPlaybackRate))!=null?e:s[0])!=null?t:kn,n=new C.CustomEvent(Q.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(n)}}Rs=new WeakMap;Cm.getSlotTemplateHTML=uw;Cm.getTooltipContentHTML=cw;C.customElements.get("media-playback-rate-button")||C.customElements.define("media-playback-rate-button",Cm);const hw=`<svg aria-hidden="true" viewBox="0 0 24 24">
1122  <path d="m6 21 15-9L6 3v18Z"/>
1123</svg>`,fw=`<svg aria-hidden="true" viewBox="0 0 24 24">
1124  <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/>
1125</svg>`;function mw(i){return`
1126    <style>
1127      :host([${b.MEDIA_PAUSED}]) slot[name=pause],
1128      :host(:not([${b.MEDIA_PAUSED}])) slot[name=play] {
1129        display: none !important;
1130      }
1131
1132      :host([${b.MEDIA_PAUSED}]) slot[name=tooltip-pause],
1133      :host(:not([${b.MEDIA_PAUSED}
1133])) slot[name=tooltip-play] {
1134        display: none;
1135      }
1136    </style>
1137
1138    <slot name="icon">
1139      <slot name="play">${hw}</slot>
1140      <slot name="pause">${fw}</slot>
1141    </slot>
1142  `}function pw(){return`
1143    <slot name="tooltip-play">${Z("Play")}</slot>
1144    <slot name="tooltip-pause">${Z("Pause")}</slot>
1145  `}const D0=i=>{const e=i.mediaPaused?Z("play"):Z("pause");i.setAttribute("aria-label",e)};class wm extends At{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_PAUSED,b.MEDIA_ENDED]}connectedCallback(){super.connectedCallback(),D0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_PAUSED&&D0(this)}get mediaPaused(){return _e(this,b.MEDIA_PAUSED)}set mediaPaused(e){Ae(this,b.MEDIA_PAUSED,e)}handleClick(){const e=this.mediaPaused?Q.MEDIA_PLAY_REQUEST:Q.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new C.CustomEvent(e,{composed:!0,bubbles:!0}))}}wm.getSlotTemplateHTML=mw;wm.getTooltipContentHTML=pw;C.customElements.get("media-play-button")||C.customElements.define("media-play-button",wm);const Ai={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"};function gw(i){return`
1146    <style>
1147      :host {
1148        pointer-events: none;
1149        display: var(--media-poster-image-display, inline-block);
1150        box-sizing: border-box;
1151      }
1152
1153      img {
1154        max-width: 100%;
1155        max-height: 100%;
1156        min-width: 100%;
1157        min-height: 100%;
1158        background-repeat: no-repeat;
1159        background-position: var(--media-poster-image-background-position, var(--media-object-position, center));
1160        background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain));
1161        object-fit: var(--media-object-fit, contain);
1162        object-position: var(--media-object-position, center);
1163      }
1164    </style>
1165
1166    <img part="poster img" aria-hidden="true" id="image"/>
1167  `}const vw=i=>{i.style.removeProperty("background-image")},Ew=(i,e)=>{i.style["background-image"]=`url('${e}')`};class Mm extends C.HTMLElement{static get observedAttributes(){return[Ai.PLACEHOLDER_SRC,Ai.SRC]}constructor(){if(super(),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,t,s){e===Ai.SRC&&(s==null?this.image.removeAttribute(Ai.SRC):this.image.setAttribute(Ai.SRC,s)),e===Ai.PLACEHOLDER_SRC&&(s==null?vw(this.image):Ew(this.image,s))}get placeholderSrc(){return Ve(this,Ai.PLACEHOLDER_SRC)}set placeholderSrc(e){We(this,Ai.SRC,e)}get src(){return Ve(this,Ai.SRC)}set src(e){We(this,Ai.SRC,e)}}Mm.shadowRootOptions={mode:"open"};Mm.getTemplateHTML=gw;C.customElements.get("media-poster-image")||C.customElements.define("media-poster-image",Mm);var KT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},yw=(i,e,t)=>(KT(i,e,"read from private field"),t?t.call(i):e.get(i)),Tw=(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)},bw=(i,e,t,s)=>(KT(i,e,"write to private field"),e.set(i,t),t),Jl;class _w extends sr{constructor(){super(),Tw(this,Jl,void 0),bw(this,Jl,this.shadowRoot.querySelector("slot"))}static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_PREVIEW_CHAPTER]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_PREVIEW_CHAPTER&&s!==t&&s!=null&&(yw(this,Jl).textContent=s,s!==""?this.setAttribute("aria-valuetext",`chapter: ${s}`):this.removeAttribute("aria-valuetext"))}get mediaPreviewChapter(){return Ve(this,b.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){We(this,b.MEDIA_PREVIEW_CHAPTER,e)}}Jl=new WeakMap;C.customElements.get("media-preview-chapter-display")||C.customElements.define("media-preview-chapter-display",_w);var VT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ll=(i,e,t)=>(VT(i,e,"read from private field"),t?t.call(i):e.get(i)),Aw=(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)},dl=(i,e,t,s)=>(VT(i,e,"write to private field"),e.set(i,t),t),wi;function Sw(i){return`
1168    <style>
1169      :host {
1170        box-sizing: border-box;
1171        display: var(--media-control-display, var(--media-preview-thumbn
1171ail-display, inline-block));
1172        overflow: hidden;
1173      }
1174
1175      img {
1176        display: none;
1177        position: relative;
1178      }
1179    </style>
1180    <img crossorigin loading="eager" decoding="async">
1181  `}class Cu extends C.HTMLElement{constructor(){if(super(),Aw(this,wi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Re.MEDIA_CONTROLLER,b.MEDIA_PREVIEW_IMAGE,b.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,t,s;const r=this.getAttribute(Re.MEDIA_CONTROLLER);r&&(dl(this,wi,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=ll(this,wi))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=ll(this,wi))==null?void 0:e.unassociateElement)==null||t.call(e,this),dl(this,wi,null)}attributeChangedCallback(e,t,s){var r,n,a,o,l;[b.MEDIA_PREVIEW_IMAGE,b.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===Re.MEDIA_CONTROLLER&&(t&&((n=(r=ll(this,wi))==null?void 0:r.unassociateElement)==null||n.call(r,this),dl(this,wi,null)),s&&this.isConnected&&(dl(this,wi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=ll(this,wi))==null?void 0:o.associateElement)==null||l.call(o,this)))}get mediaPreviewImage(){return Ve(this,b.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){We(this,b.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){const e=this.getAttribute(b.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(t=>+t)}set mediaPreviewCoords(e){if(!e){this.removeAttribute(b.MEDIA_PREVIEW_COORDS);return}this.setAttribute(b.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),p=f<1,g=p?f:m>1?m:1,{style:v}=nt(this.shadowRoot,":host"),T=nt(this.shadowRoot,"img").style,y=this.shadowRoot.querySelector("img"),_=p?"min":"max";v.setProperty(`${_}-width`,"initial","important"),v.setProperty(`${_}-height`,"initial","important"),v.width=`${n*g}px`,v.height=`${a*g}px`;const I=()=>{T.width=`${this.imgWidth*g}px`,T.height=`${this.imgHeight*g}px`,T.display="block"};y.src!==o&&(y.onload=()=>{this.imgWidth=y.naturalWidth,this.imgHeight=y.naturalHeight,I()},y.src=o,I()),I(),T.transform=`translate(-${s*g}px, -${r*g}px)`}}wi=new WeakMap;Cu.shadowRootOptions={mode:"open"};Cu.getTemplateHTML=Sw;C.customElements.get("media-preview-thumbnail")||C.customElements.define("media-preview-thumbnail",Cu);var C0=Cu,WT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},w0=(i,e,t)=>(WT(i,e,"read from private field"),t?t.call(i):e.get(i)),Iw=(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)},Lw=(i,e,t,s)=>(WT(i,e,"write to private field"),e.set(i,t),t),Fa;class Rw extends sr{constructor(){super(),Iw(this,Fa,void 0),Lw(this,Fa,this.shadowRoot.querySelector("slot")),w0(this,Fa).textContent=Js(0)}static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_PREVIEW_TIME&&s!=null&&(w0(this,Fa).textContent=Js(parseFloat(s)))}get mediaPreviewTime(){return Ke(this,b.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){Ze(this,b.MEDIA_PREVIEW_TIME,e)}}Fa=new WeakMap;C.customElements.get("media-preview-time-display")||C.customElements.define("media-preview-time-display",Rw);const en={SEEK_OFFSET:"seekoffset"},yc=30,xw=i=>`
1182  <svg aria-hidden="true" viewBox="0 0 20 24">
1183    <defs>
1184      <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>
1185    </defs>
1186    <text class="text value" transform="translate(2.18 19.87)">${i}</text>
1187    <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"/>
1188  </svg>`;function kw(i,e){return`
1189    <slot name="icon">${xw(e.seekOffset)}</slot>
1190  `}function Dw(){return Z("Seek backward")}const Cw=0;class Pm extends At{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_CURRENT_TIME,en.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Ke(this,en.SEEK_OFFSET,yc)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===en.SEEK_OFFSET&&(this.seekOffset=Ke(this,en.SEEK_OFFSET,yc))}get seekOffset(){return Ke(this,en.SEEK_OFFSET,yc)}set seekOffset(e){Ze(this,en.SEEK_OFFSET,e),this.setAttribute("aria-label",Z("seek back {seekOffset} seconds",{seekOffset:this.seekOffset})),Jy(eT(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Ke(this,b.MEDIA_CURRENT_TIME,Cw)}set mediaCurrentTime(e){Ze(this,b.MEDIA_CURRENT_TIME,e)}handleClick(){const e=Math.max(this.mediaCurrentTime-this.seekOffset,0),t=new C.CustomEvent(Q.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}Pm.getSlotTemplateHTML=kw;Pm.getTooltipContentHTML=Dw;C.customElements.get("media-seek-backward-button")||C.customElements.define("media-seek-backward-button",Pm);const tn={SEEK_OFFSET:"seekoffset"},Tc=30,ww=i=>`
1191  <svg aria-hidden="true" viewBox="0 0 20 24">
1192    <defs>
1193      <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>
1194    </defs>
1195    <text class="text value" transform="translate(8.9 19.87)">${i}</text>
1196    <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"/>
1197  </svg>`;function Mw(i,e){return`
1198    <slot name="icon">${ww(e.seekOffset)}</slot>
1199  `}function Pw(){return Z("Seek forward")}const Ow=0;class Om extends At{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_CURRENT_TIME,tn.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Ke(this,tn.SEEK_OFFSET,Tc)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===tn.SEEK_OFFSET&&(this.seekOffset=Ke(this,tn.SEEK_OFFSET,Tc))}get seekOffset(){return Ke(this,tn.SEEK_OFFSET,Tc)}set seekOffset(e){Ze(this,tn.SEEK_OFFSET,e),this.setAttribute("aria-label",Z("seek forward {seekOffset} seconds",{seekOffset:this.seekOffset})),Jy(eT(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Ke(this,b.MEDIA_CURRENT_TIME,Ow)}set mediaCurrentTime(e){Ze(this,b.MEDIA_CURRENT_TIME,e)}handleClick(){const e=this.mediaCurrentTime+this.seekOffset,t=new C.CustomEvent(Q.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}Om.getSlotTemplateHTML=Mw;Om.getTooltipContentHTML=Pw;C.customElements.get("media-seek-forward-button")||C.customElements.define("media-seek-forward-button",Om);var qT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},bc=(i,e,t)=>(qT(i,e,"read from private field"),t?t.call(i):e.get(i)),Nw=(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)},Uw=(i,e,t,s)=>(qT(i,e,"write to private field"),e.set(i,t),t),fn;const pr={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},M0=[...Object.values(pr),b.MEDIA_CURRENT_TIME,b.MEDIA_DURATION,b.MEDIA_SEEKABLE],P0=["Enter"," "],Fw="&nbsp;/&nbsp;",Kh=(i,{timesSep:e=Fw}={})=>{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?Js(0-(a-r)):Js(r);return i.showDuration?`${o}${e}${Js(a)}`:o},$w="video not loaded, unknown time.",Bw=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",$w);return}const n=i.remaining?Ja(0-(r-t)):Ja(t);if(!i.showDuration){i.setAttribute("aria-valuetext",n);return}const a=Ja(r),o=`${n} of ${a}`;i.setAttribute("aria-valuetext",o)};function Hw(i,e){return`
1200    <slot>${Kh(e)}</slot>
1201  `}class YT extends sr{constructor(){super(),Nw(this,fn,void 0),Uw(this,fn,this.shadowRoot.querySelector("slot")),bc(this,fn).innerHTML=`${Kh(this)}`}static get observedAttributes(){return[...super.observedAttributes,...M0,"disabled"]}connectedCallback(){const{style:e}=nt(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(!P0.includes(r)){this.removeEventListener("keyup",t);return}this.toggleTimeDisplay()};this.addEventListener("keydown",s=>{const{metaKey:r,altKey:n,key:a}=s;if(r||n||!P0.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){M0.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 _e(this,pr.REMAINING)}set remaining(e){Ae(this,pr.REMAINING,e)}get showDuration(){return _e(this,pr.SHOW_DURATION)}set showDuration(e){Ae(this,pr.SHOW_DURATION,e)}get noToggle(){return _e(this,pr.NO_TOGGLE)}set noToggle(e){Ae(this,pr.NO_TOGGLE,e)}get mediaDuration(){return Ke(this,b.MEDIA_DURATION)}set mediaDuration(e){Ze(this,b.MEDIA_DURATION,e)}get mediaCurrentTime(){return Ke(this,b.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){Ze(this,b.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){const e=this.getAttribute(b.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(b.MEDIA_SEEKABLE);return}this.setAttribute(b.MEDIA_SEEKABLE,e.join(":"))}update(){const e=Kh(this);Bw(this),e!==bc(this,fn).innerHTML&&(bc(this,fn).innerHTML=e)}}fn=new WeakMap;YT.getSlotTemplateHTML=Hw;C.customElements.get("media-time-display")||C.customElements.define("media-time-display",YT);var jT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Et=(i,e,t)=>(jT(i,e,"read from private field"),e.get(i)),Si=(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)},$t=(i,e,t,s)=>(jT(i,e,"write to private field"),e.set(i,t),t),Gw=(i,e,t,s)=>({set _(r){$t(i,e,r)},get _(){return Et(i,e)}}),mn,ed,pn,$a,td,id,sd,gn,gr,rd;class Kw{constructor(e,t,s){Si(this,mn,void 0),Si(this,ed,void 0),Si(this,pn,void 0),Si(this,$a,void 0),Si(this,td,void 0),Si(this,id,void 0),Si(this,sd,void 0),Si(this,gn,void 0),Si(this,gr,0),Si(this,rd,(r=performance.now())=>{$t(this,gr,requestAnimationFrame(Et(this,rd))),$t(this,$a,performance.now()-Et(this,pn));const n=1e3/this.fps;if(Et(this,$a)>n){$t(this,pn,r-Et(this,$a)%n);const a=1e3/((r-Et(this,ed))/++Gw(this,td)._),o=(r-Et(this,id))/1e3/this.duration;let l=Et(this,sd)+o*this.playbackRate;l-Et(this,mn).valueAsNumber>0?$t(this,gn,this.playbackRate/this.duration/a):($t(this,gn,.995*Et(this,gn)),l=Et(this,mn).valueAsNumber+Et(this,gn)),this.callback(l)}}),$t(this,mn,e),this.callback=t,this.fps=s}start(){Et(this,gr)===0&&($t(this,pn,performance.now()),$t(this,ed,Et(this,pn)),$t(this,td,0),Et(this,rd).call(this))}stop(){Et(this,gr)!==0&&(cancelAnimationFrame(Et(this,gr)),$t(this,gr,0))}update({start:e,duration:t,playbackRate:s}){const r=e-Et(this,mn).valueAsNumber,n=Math.abs(t-this.duration);(r>0||r<-.03||n>=.5)&&this.callback(e),$t(this,sd,e),$t(this,id,performance.now()),this.duration=t,this.playbackRate=s}}mn=new WeakMap;ed=new WeakMap;pn=new WeakMap;$a=new WeakMap;td=new WeakMap;id=new WeakMap;sd=new WeakMap;gn=new WeakMap;gr=new WeakMap;rd=new WeakMap;var Nm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ht=(i,e,t)=>(Nm(i,e,"read from private field"),t?t.call(i):e.get(i)),vt=(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)},Mi=(i,e,t,s)=>(Nm(i,e,"write to private field"),e.set(i,t),t),xt=(i,e,t)=>(Nm(i,e,"access private method"),t),vn,Nr,Jd,io,eu,nd,Ao,So,En,yn,Ba,Um,zT,Vh,tu,Fm,iu,$m,su,Bm,Wh,QT,Io,ru,qh,XT;const Vw="video not loaded, unknown time.",Ww=i=>
1201{const e=i.range,t=Ja(+ZT(i)),s=Ja(+i.mediaSeekableEnd),r=t&&s?`${t} of ${s}`:Vw;e.setAttribute("aria-valuetext",r)};function qw(i){return`
1202    ${ra.getTemplateHTML(i)}
1203    <style>
1204      :host {
1205        --media-box-border-radius: 4px;
1206        --media-box-padding-left: 10px;
1207        --media-box-padding-right: 10px;
1208        --media-preview-border-radius: var(--media-box-border-radius);
1209        --media-box-arrow-offset: var(--media-box-border-radius);
1210        --_control-background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
1211        --_preview-background: var(--media-preview-background, var(--_control-background));
1212
1213        
1214        contain: layout;
1215      }
1216
1217      #buffered {
1218        background: var(--media-time-range-buffered-color, rgb(255 255 255 / .4));
1219        position: absolute;
1220        height: 100%;
1221        will-change: width;
1222      }
1223
1224      #preview-rail,
1225      #current-rail {
1226        width: 100%;
1227        position: absolute;
1228        left: 0;
1229        bottom: 100%;
1230        pointer-events: none;
1231        will-change: transform;
1232      }
1233
1234      [part~="box"] {
1235        width: min-content;
1236        
1237        position: absolute;
1238        bottom: 100%;
1239        flex-direction: column;
1240        align-items: center;
1241        transform: translateX(-50%);
1242      }
1243
1244      [part~="current-box"] {
1245        display: var(--media-current-box-display, var(--media-box-display, flex));
1246        margin: var(--media-current-box-margin, var(--media-box-margin, 0 0 5px));
1247        visibility: hidden;
1248      }
1249
1250      [part~="preview-box"] {
1251        display: var(--media-preview-box-display, var(--media-box-display, flex));
1252        margin: var(--media-preview-box-margin, var(--media-box-margin, 0 0 5px));
1253        transition-property: var(--media-preview-transition-property, visibility, opacity);
1254        transition-duration: var(--media-preview-transition-duration-out, .25s);
1255        transition-delay: var(--media-preview-transition-delay-out, 0s);
1256        visibility: hidden;
1257        opacity: 0;
1258      }
1259
1260      :host(:is([${b.MEDIA_PREVIEW_IMAGE}], [${b.MEDIA_PREVIEW_TIME}])[dragging]) [part~="preview-box"] {
1261        transition-duration: var(--media-preview-transition-duration-in, .5s);
1262        transition-delay: var(--media-preview-transition-delay-in, .25s);
1263        visibility: visible;
1264        opacity: 1;
1265      }
1266
1267      @media (hover: hover) {
1268        :host(:is([${b.MEDIA_PREVIEW_IMAGE}], [${b.MEDIA_PREVIEW_TIME}]):hover) [part~="preview-box"] {
1269          transition-duration: var(--media-preview-transition-duration-in, .5s);
1270          transition-delay: var(--media-preview-transition-delay-in, .25s);
1271          visibility: visible;
1272          opacity: 1;
1273        }
1274      }
1275
1276      media-preview-thumbnail,
1277      ::slotted(media-preview-thumbnail) {
1278        visibility: hidden;
1279        
1280        transition: visibility 0s .25s;
1281        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
1282        background: var(--media-preview-thumbnail-background, var(--_preview-background));
1283        box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2));
1284        max-width: var(--media-preview-thumbnail-max-width, 180px);
1285        max-height: var(--media-preview-thumbnail-max-height, 160px);
1286        min-width: var(--media-preview-thumbnail-min-width, 120px);
1287        min-height: var(--media-preview-thumbnail-min-height, 80px);
1288        border: var(--media-preview-thumbnail-border);
1289        border-radius: var(--media-preview-thumbnail-border-radius,
1290          var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0);
1291      }
1292
1293      :host([${b.MEDIA_PREVIEW_IMAGE}][dragging]) media-preview-thumbnail,
1294      :host([${b.MEDIA_PREVIEW_IMAGE}][dragging]) ::slotted(media-preview-thumbnail) {
1295        transition-delay: var(--media-preview-transition-delay-in, .25s);
1296        visibility: visible;
1297      }
1298
1299      @media (hover: hover) {
1300        :host([${b.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail,
1301        :host([${b.MEDIA_PREVIEW_IMAGE}
1301]:hover) ::slotted(media-preview-thumbnail) {
1302          transition-delay: var(--media-preview-transition-delay-in, .25s);
1303          visibility: visible;
1304        }
1305
1306        :host([${b.MEDIA_PREVIEW_TIME}]:hover) {
1307          --media-time-range-hover-display: block;
1308        }
1309      }
1310
1311      media-preview-chapter-display,
1312      ::slotted(media-preview-chapter-display) {
1313        font-size: var(--media-font-size, 13px);
1314        line-height: 17px;
1315        min-width: 0;
1316        visibility: hidden;
1317        
1318        transition: min-width 0s, border-radius 0s, margin 0s, padding 0s, visibility 0s;
1319        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
1320        background: var(--media-preview-chapter-background, var(--_preview-background));
1321        border-radius: var(--media-preview-chapter-border-radius,
1322          var(--media-preview-border-radius) var(--media-preview-border-radius)
1323          var(--media-preview-border-radius) var(--media-preview-border-radius));
1324        padding: var(--media-preview-chapter-padding, 3.5px 9px);
1325        margin: var(--media-preview-chapter-margin, 0 0 5px);
1326        text-shadow: var(--media-preview-chapter-text-shadow, 0 0 4px rgb(0 0 0 / .75));
1327      }
1328
1329      :host([${b.MEDIA_PREVIEW_IMAGE}]) media-preview-chapter-display,
1330      :host([${b.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-chapter-display) {
1331        transition-delay: var(--media-preview-transition-delay-in, .25s);
1332        border-radius: var(--media-preview-chapter-border-radius, 0);
1333        padding: var(--media-preview-chapter-padding, 3.5px 9px 0);
1334        margin: var(--media-preview-chapter-margin, 0);
1335        min-width: 100%;
1336      }
1337
1338      media-preview-chapter-display[${b.MEDIA_PREVIEW_CHAPTER}],
1339      ::slotted(media-preview-chapter-display[${b.MEDIA_PREVIEW_CHAPTER}]) {
1340        visibility: visible;
1341      }
1342
1343      media-preview-chapter-display:not([aria-valuetext]),
1344      ::slotted(media-preview-chapter-display:not([aria-valuetext])) {
1345        display: none;
1346      }
1347
1348      media-preview-time-display,
1349      ::slotted(media-preview-time-display),
1350      media-time-display,
1351      ::slotted(media-time-display) {
1352        font-size: var(--media-font-size, 13px);
1353        line-height: 17px;
1354        min-width: 0;
1355        
1356        transition: min-width 0s, border-radius 0s;
1357        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
1358        background: var(--media-preview-time-background, var(--_preview-background));
1359        border-radius: var(--media-preview-time-border-radius,
1360          var(--media-preview-border-radius) var(--media-preview-border-radius)
1361          var(--media-preview-border-radius) var(--media-preview-border-radius));
1362        padding: var(--media-preview-time-padding, 3.5px 9px);
1363        margin: var(--media-preview-time-margin, 0);
1364        text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75));
1365        transform: translateX(min(
1366          max(calc(50% - var(--_box-width) / 2),
1367          calc(var(--_box-shift, 0))),
1368          calc(var(--_box-width) / 2 - 50%)
1369        ));
1370      }
1371
1372      :host([${b.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display,
1373      :host([${b.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) {
1374        transition-delay: var(--media-preview-transition-delay-in, .25s);
1375        border-radius: var(--media-preview-time-border-radius,
1376          0 0 var(--media-preview-border-radius) var(--media-preview-border-radius));
1377        min-width: 100%;
1378      }
1379
1380      :host([${b.MEDIA_PREVIEW_TIME}]:hover) {
1381        --media-time-range-hover-display: block;
1382      }
1383
1384      [part~="arrow"],
1385      ::slotted([part~="arrow"]) {
1386        display: var(--media-box-arrow-display, inline-block);
1387        transform: translateX(min(
1388          max(calc(50% - var(--_box-width) / 2 + var(--media-box-arrow-offset)),
1389          calc(var(--_box-shift, 0))),
1390          calc(var(--_box-width) / 2 - 50% - var(--media-box-arrow-offset))
1391        ));
1392        
1393        border-color: transparent;
1394        border-top-color: var(--media-box-arrow-background, var(--_control-background));
1395        border-width: var(--media-box-arrow-border-width,
1396          var(--media-box-arrow-height, 5px) var(--media-box-arrow-width, 6px) 0);
1397        border-style: solid;
1398        justify-content: center;
1399        height: 0;
1400      }
1401    </style>
1402    <div id="preview-rail">
1403      <slot name="preview" part="box preview-box">
1404        <media-preview-thumbnail>
1405          <template shadowrootmode="${C0.shadowRootOptions.mode}">
1406            ${C0.getTemplateHTML({})}
1407          </template>
1408        </media-preview-thumbnail>
1409        <media-preview-chapter-display></media-preview-chapter-display>
1410        <media-preview-time-display></media-preview-time-display>
1411        <slot name="preview-arrow"><div part="arrow"></div></slot>
1412      </slot>
1413    </div>
1414    <div id="current-rail">
1415      <slot name="current" part="box current-box">
1416        
1417      </slot>
1418    </div>
1419  `}const ul=(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))},ZT=(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 Hm extends ra{constructor(){super(),vt(this,yn),vt(this,Um),vt(this,tu),vt(this,iu),vt(this,su),vt(this,Wh),vt(this,Io),vt(this,qh),vt(this,vn,void 0),vt(this,Nr,void 0),vt(this,Jd,void 0),vt(this,io,void 0),vt(this,eu,void 0),vt(this,nd,void 0),vt(this,Ao,void 0),vt(this,So,void 0),vt(this,En,void 0),vt(this,Vh,s=>{this.dragging||(lm(s)&&(this.range.valueAsNumber=s),this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),Mi(this,Jd,this.shadowRoot.querySelectorAll('[part~="box"]')),Mi(this,eu,this.shadowRoot.querySelector('[part~="preview-box"]')),Mi(this,nd,this.shadowRoot.querySelector('[part~="current-box"]'));const t=getComputedStyle(this);Mi(this,Ao,parseInt(t.getPropertyValue("--media-box-padding-left"))),Mi(this,So,parseInt(t.getPropertyValue("--media-box-padding-right"))),Mi(this,Nr,new Kw(this.range,ht(this,Vh),60))}static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_PAUSED,b.MEDIA_DURATION,b.MEDIA_SEEKABLE,b.MEDIA_CURRENT_TIME,b.MEDIA_PREVIEW_IMAGE,b.MEDIA_PREVIEW_TIME,b.MEDIA_PREVIEW_CHAPTER,b.MEDIA_BUFFERED,b.MEDIA_PLAYBACK_RATE,b.MEDIA_LOADING,b.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",Z("seek")),xt(this,yn,Ba).call(this),Mi(this,vn,this.getRootNode()),(e=ht(this,vn))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),xt(this,yn,Ba).call(this),(e=ht(this,vn))==null||e.removeEventListener("transitionstart",this),Mi(this,vn,null)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),t!=s&&(e===b.MEDIA_CURRENT_TIME||e===b.MEDIA_PAUSED||e===b.MEDIA_ENDED||e===b.MEDIA_LOADING||e===b.MEDIA_DURATION||e===b.MEDIA_SEEKABLE?(ht(this,Nr).update({start:ul(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),xt(this,yn,Ba).call(this),Ww(this)):e===b.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===b.MEDIA_DURATION||e===b.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=ht(this,En),this.updateBar()))}get mediaChaptersCues(){return ht(this,En)}set mediaChaptersCues(e){var t;Mi(this,En,e),this.updateSegments((t=ht(this,En))==null?void 0:t.map(s=>({start:ul(this,s.startTime),end:ul(this,s.endTime)})))}get mediaPaused(){return _e(this,b.MEDIA_PAUSED)}set mediaPaused(e){Ae(this,b.MEDIA_PAUSED,e)}get mediaLoading(){return _e(this,b.MEDIA_LOADING)}set mediaLoading(e){Ae(this,b.MEDIA_LOADING,e)}get mediaDuration(){return Ke(this,b.MEDIA_DURATION)}set mediaDuration(e){Ze(this,b.MEDIA_DURATION,e)}get mediaCurrentTime(){return Ke(this,b.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){Ze(this,b.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return Ke(this,b.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){Ze(this,b.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){const e=this.getAttribute(b.MEDIA_BUFFERED);return e?e.split(" ").map(t=>t.split(":").map(s=>+s)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(b.MEDIA_BUFFERED);return}const t=e.map(s=>s.join(":")).join(" ");this.setAttribute(b.MEDIA_BUFFERED,t)}get mediaSeekable(){const e=this.getAttribute(b.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(b.MEDIA_SEEKABLE);return}this.setAttribute(b.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 Ve(this,b.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){We(this,b.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return Ke(this,b.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){Ze(this,b.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return _e(this,b.MEDIA_ENDED)}set mediaEnded(e){Ae(this,b.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=ul(this,a)}const{style:r}=nt(this.shadowRoot,"#buffered");r.setProperty("width",`${s*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;const t=nt(this.shadowRoot,"#current-rail"),s=nt(this.shadowRoot,'[part~="current-box"]'),r=xt(this,tu,Fm).call(this,ht(this,nd)),n=xt(this,iu,$m).call(this,r,this.range.valueAsNumber),a=xt(this,su,Bm).call(this,r,this.range.valueAsNumber);t.style.transform=`translateX(${n}
1419)`,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":xt(this,qh,XT).call(this);break;case"pointermove":xt(this,Wh,QT).call(this,e);break;case"pointerup":case"pointerleave":xt(this,Io,ru).call(this,null);break;case"transitionstart":gs(e.target,this)&&setTimeout(()=>xt(this,yn,Ba).call(this),0);break}}}vn=new WeakMap;Nr=new WeakMap;Jd=new WeakMap;io=new WeakMap;eu=new WeakMap;nd=new WeakMap;Ao=new WeakMap;So=new WeakMap;En=new WeakMap;yn=new WeakSet;Ba=function(){xt(this,Um,zT).call(this)?ht(this,Nr).start():ht(this,Nr).stop()};Um=new WeakSet;zT=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&tT(this)};Vh=new WeakMap;tu=new WeakSet;Fm=function(i){var e;const s=((e=this.getAttribute("bounds")?sa(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}};iu=new WeakSet;$m=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};su=new WeakSet;Bm=function(i,e){const{width:t,min:s,max:r}=i.box,n=e*i.range.width;if(n<s+ht(this,Ao)){const a=i.range.left-i.bounds.left-ht(this,Ao);return`${n-t/2+a}px`}if(n>r-ht(this,So)){const a=i.bounds.right-i.range.right-ht(this,So);return`${n+t/2-a-i.range.width}px`}return 0};Wh=new WeakSet;QT=function(i){const e=[...ht(this,Jd)].some(u=>i.composedPath().includes(u));if(!this.dragging&&(e||!i.composedPath().includes(this))){xt(this,Io,ru).call(this,null);return}const t=this.mediaSeekableEnd;if(!t)return;const s=nt(this.shadowRoot,"#preview-rail"),r=nt(this.shadowRoot,'[part~="preview-box"]'),n=xt(this,tu,Fm).call(this,ht(this,eu));let a=(i.clientX-n.range.left)/n.range.width;a=Math.max(0,Math.min(1,a));const o=xt(this,iu,$m).call(this,n,a),l=xt(this,su,Bm).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(ht(this,io))-Math.round(a*t);Math.abs(d)<1&&a>.01&&a<.99||(Mi(this,io,a*t),xt(this,Io,ru).call(this,ht(this,io)))};Io=new WeakSet;ru=function(i){this.dispatchEvent(new C.CustomEvent(Q.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:i}))};qh=new WeakSet;XT=function(){ht(this,Nr).stop();const i=ZT(this);this.dispatchEvent(new C.CustomEvent(Q.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:i}))};Hm.shadowRootOptions={mode:"open"};Hm.getTemplateHTML=qw;C.customElements.get("media-time-range")||C.customElements.define("media-time-range",Hm);const Yw=1,jw=i=>i.mediaMuted?0:i.mediaVolume,zw=i=>`${Math.round(i*100)}%`;class Qw extends ra{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_VOLUME,b.MEDIA_MUTED,b.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{const e=this.range.value,t=new C.CustomEvent(Q.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===b.MEDIA_VOLUME||e===b.MEDIA_MUTED)&&(this.range.valueAsNumber=jw(this),this.range.setAttribute("aria-valuetext",zw(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return Ke(this,b.MEDIA_VOLUME,Yw)}set mediaVolume(e){Ze(this,b.MEDIA_VOLUME,e)}get mediaMuted(){return _e(this,b.MEDIA_MUTED)}set mediaMuted(e){Ae(this,b.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return Ve(this,b.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){We(this,b.MEDIA_VOLUME_UNAVAILABLE,e)}}C.customElements.get("media-volume-range")||C.customElements.define("media-volume-range",Qw);var JT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},fe=(i,e,t)=>(JT(i,e,"read from private field"),t?t.call(i):e.get(i)),Fi=(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)},us=(i,e,t,s)=>(JT(i,e,"write to private field"),e.set(i,t),t),Tn,ad,vr,Ha,xs,ks,Ds,Er,bn,od,di;const O0=1,N0=0,Xw=1,Zw={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 vi&&typeof r.element[r.attributeName]=="boolean"?r.booleanValue=n:typeof n=="function"&&r instanceof vi?r.element[r.attributeName]=n:r.value=n}}}};class wu extends C.DocumentFragment{constructor(e,t,s=Zw){var r;super(),Fi(this,Tn,void 0),Fi(this,ad,void 0),this.append(e.content.cloneNode(!0)),us(this,Tn,eb(this)),us(this,ad,s),(r=s.createCallback)==null||r.call(s,this,fe(this,Tn),t),s.processCallback(this,fe(this,Tn),t)}update(e){fe(this,ad).processCallback(this,fe(this,Tn),e)}}Tn=new WeakMap;ad=new WeakMap;const eb=(i,e=[])=>{let t,s;for(const r of i.attributes||[])if(r.value.includes("{{")){const n=new eM;for([t,s]of F0(r.value))if(!t)n.append(s);else{const a=new vi(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===O0&&!(r instanceof HTMLTemplateElement))eb(r,e);else{const n=r.data;if(r.nodeType===O0||n.includes("{{")){const a=[];if(n)for([t,s]of F0(n))if(!t)a.push(new Text(s));else{const o=new na(i);
1419a.push(o),e.push([s,o])}else if(r instanceof HTMLTemplateElement){const o=new sb(i,r);a.push(o),e.push([o.expression,o])}r.replaceWith(...a.flatMap(o=>o.replacementNodes||[o]))}}return e},U0={},F0=i=>{let e="",t=0,s=U0[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([N0,e]),e="",r++):n==="}"&&i[r+1]==="}"&&i[r-1]!=="\\"&&!--t?(s.push([Xw,e.trim()]),e="",r++):e+=n||"";return e&&s.push([N0,(t>0?"{{":"")+e]),U0[i]=s},Jw=11;class tb{get value(){return""}set value(e){}toString(){return this.value}}const ib=new WeakMap;class eM{constructor(){Fi(this,vr,[])}[Symbol.iterator](){return fe(this,vr).values()}get length(){return fe(this,vr).length}item(e){return fe(this,vr)[e]}append(...e){for(const t of e)t instanceof vi&&ib.set(t,this),fe(this,vr).push(t)}toString(){return fe(this,vr).join("")}}vr=new WeakMap;class vi extends tb{constructor(e,t,s){super(),Fi(this,Er),Fi(this,Ha,""),Fi(this,xs,void 0),Fi(this,ks,void 0),Fi(this,Ds,void 0),us(this,xs,e),us(this,ks,t),us(this,Ds,s)}get attributeName(){return fe(this,ks)}get attributeNamespace(){return fe(this,Ds)}get element(){return fe(this,xs)}get value(){return fe(this,Ha)}set value(e){fe(this,Ha)!==e&&(us(this,Ha,e),!fe(this,Er,bn)||fe(this,Er,bn).length===1?e==null?fe(this,xs).removeAttributeNS(fe(this,Ds),fe(this,ks)):fe(this,xs).setAttributeNS(fe(this,Ds),fe(this,ks),e):fe(this,xs).setAttributeNS(fe(this,Ds),fe(this,ks),fe(this,Er,bn).toString()))}get booleanValue(){return fe(this,xs).hasAttributeNS(fe(this,Ds),fe(this,ks))}set booleanValue(e){if(!fe(this,Er,bn)||fe(this,Er,bn).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}}Ha=new WeakMap;xs=new WeakMap;ks=new WeakMap;Ds=new WeakMap;Er=new WeakSet;bn=function(){return ib.get(this)};class na extends tb{constructor(e,t){super(),Fi(this,od,void 0),Fi(this,di,void 0),us(this,od,e),us(this,di,t?[...t]:[new Text])}get replacementNodes(){return fe(this,di)}get parentNode(){return fe(this,od)}get nextSibling(){return fe(this,di)[fe(this,di).length-1].nextSibling}get previousSibling(){return fe(this,di)[0].previousSibling}get value(){return fe(this,di).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===Jw?[...s.childNodes]:s.nodeType?[s]:[new Text(s)]);t.length||t.push(new Text),us(this,di,tM(fe(this,di)[0].parentNode,fe(this,di),t,this.nextSibling))}}od=new WeakMap;di=new WeakMap;class sb extends na{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 tM(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 $0={string:i=>String(i)};class rb{constructor(e){this.template=e,this.state=void 0}}const Rr=new WeakMap,xr=new WeakMap,Yh={partial:(i,e)=>{e[i.expression]=new rb(i.template)},if:(i,e)=>{var t;if(nb(i.expression,e))if(Rr.get(i)!==i.template){Rr.set(i,i.template);const s=new wu(i.template,e,Gm);i.replace(s),xr.set(i,s)}else(t=xr.get(i))==null||t.update(e);else i.replace(""),Rr.delete(i),xr.delete(i)}},iM=Object.keys(Yh),Gm={processCallback(i,e,t){var s,r;if(t)for(const[n,a]of e){if(a instanceof sb){if(!a.directive){const l=iM.find(d=>a.template.hasAttribute(d));l&&(a.directive=l,a.expression=a.template.getAttribute(l))}(s=Yh[a.directive])==null||s.call(Yh,a,t);continue}let o=nb(n,t);if(o instanceof rb){Rr.get(a)!==o.template?(Rr.set(a,o.template),o=new wu(o.template,o.state,Gm),a.value=o,xr.set(a,o)):(r=xr.get(a))==null||r.update(o.state);continue}o?(a instanceof vi&&a.attributeName.startsWith("aria-")&&(o=String(o)),a instanceof vi?typeof o=="boolean"?a.booleanValue=o:typeof o=="function"?a.element[a.attributeName]=o:a.value=o:(a.value=o,Rr.delete(a),xr.delete(a))):a instanceof vi?a.value=void 0:(a.value=void 0,Rr.delete(a),xr.delete(a))}}},B0={"!":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=$0[e])==null?void 0:t.call($0,i)}};function sM(i){return rM(i,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function nb(i,e={}){var t,s,r,n,a,o,l;const d=sM(i);if(d.length===0||d.some(({type:u})=>!u))return ga(i);if(((t=d[0])==null?void 0:t.token)===">"){const u=e[(s=d[1])==null?void 0:s.token];if(!u)return ga(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,p=(n=h[f+1])==null?void 0:n.token,g=(a=h[f+2])==null?void 0:a.token;m&&p==="="&&(c[m]=va(g,e))}return u}if(d.length===1)return cl(d[0])?va(d[0].token,e):ga(i);if(d.length===2){const u=(o=d[0])==null?void 0:o.token,c=B0[u];if(!c||!cl(d[1]))return ga(i);const h=va(d[1].token,e);return c(h)}if(d.length===3){const u=(l=d[1])==null?void 0:l.token,c=B0[u];if(!c||!cl(d[0])||!cl(d[2]))return ga(i);const h=va(d[0].token,e);if(u==="|")return c(h,d[2].token);const f=va(d[2].token,e);return c(h,f)}}function ga(i){return console.warn(`Warning: invalid expression \`${i}\``),!1}function cl({type:i}){return["number","boolean","string","param"].includes(i)}function va(i,e){const t=i[0],s=i.slice(-1);return i==="true"||i==="false"?i==="true":t===s&&["'",'"'].includes(t)?
1419i.slice(1,-1):Wy(i)?parseFloat(i):e[i]}function rM(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 Km=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},jh=(i,e,t)=>(Km(i,e,"read from private field"),t?t.call(i):e.get(i)),Ea=(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)},kr=(i,e,t,s)=>(Km(i,e,"write to private field"),e.set(i,t),t),_c=(i,e,t)=>(Km(i,e,"access private method"),t),Nn,ld,Un,zh,ab,dd,Qh;const Ac={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},ob=mt.createElement("template");ob.innerHTML=`
1420  <style>
1421    :host {
1422      display: inline-block;
1423      line-height: 0;
1424    }
1425
1426    media-controller {
1427      width: 100%;
1428      height: 100%;
1429    }
1430
1431    media-captions-button:not([mediasubtitleslist]),
1432    media-captions-menu:not([mediasubtitleslist]),
1433    media-captions-menu-button:not([mediasubtitleslist]),
1434    media-audio-track-menu[mediaaudiotrackunavailable],
1435    media-audio-track-menu-button[mediaaudiotrackunavailable],
1436    media-rendition-menu[mediarenditionunavailable],
1437    media-rendition-menu-button[mediarenditionunavailable],
1438    media-volume-range[mediavolumeunavailable],
1439    media-airplay-button[mediaairplayunavailable],
1440    media-fullscreen-button[mediafullscreenunavailable],
1441    media-cast-button[mediacastunavailable],
1442    media-pip-button[mediapipunavailable] {
1443      display: none;
1444    }
1445  </style>
1446`;class Mu extends C.HTMLElement{constructor(){super(),Ea(this,zh),Ea(this,dd),Ea(this,Nn,void 0),Ea(this,ld,void 0),Ea(this,Un,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:!!(Ac[r.attributeName]||r.attributeName.startsWith("breakpoint"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(ms.BREAKPOINTS_COMPUTED,this.render),_c(this,zh,ab).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return(e=jh(this,Nn))!=null?e:this.constructor.template}set template(e){kr(this,Un,null),kr(this,Nn,e),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})=>Ac[a]||a.startsWith("breakpoint")),...Array.from(this.attributes)],n={};for(const a of r){const o=(s=Ac[a.name])!=null?s:ED(a.name);let{value:l}=a;l!=null?(Wy(l)&&(l=parseFloat(l)),n[o]=l===""?!0:l):n[o]=!1}return n}attributeChangedCallback(e,t,s){e==="template"&&t!=s&&_c(this,dd,Qh).call(this)}connectedCallback(){_c(this,dd,Qh).call(this)}createRenderer(){this.template&&this.template!==jh(this,ld)&&(kr(this,ld,this.template),this.renderer=new wu(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(ob.content.cloneNode(!0),this.renderer))}render(){var e;(e=this.renderer)==null||e.update(this.props)}}Nn=new WeakMap;ld=new WeakMap;Un=new WeakMap;zh=new WeakSet;ab=function(i){if(Object.prototype.hasOwnProperty.call(this,i)){const e=this[i];delete this[i],this[i]=e}};dd=new WeakSet;Qh=function(){var i;const e=this.getAttribute("template");if(!e||e===jh(this,Un))return;const t=this.getRootNode(),s=(i=t==null?void 0:t.getElementById)==null?void 0:i.call(t,e);if(s){kr(this,Un,e),kr(this,Nn,s),this.createRenderer();return}nM(e)&&(kr(this,Un,e),aM(e).then(r=>{const n=mt.createElement("template");n.innerHTML=r,kr(this,Nn,n),this.createRenderer()}).catch(console.error))};Mu.observedAttributes=["template"];Mu.processor=Gm;function nM(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 aM(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()}C.customElements.get("media-theme")||C.customElements.define("media-theme",Mu);function oM({anchor:i,floating:e,placement:t}){const s=lM({anchor:i,floating:e}),{x:r,y:n}=uM(s,t);return{x:r,y:n}}function lM({anchor:i,floating:e}){return{anchor:dM(i,e.offsetParent),floating:{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}}}function dM(i,e){var t;const s=i.getBoundingClientRect(),r=(t=e==null?void 0: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 uM({anchor:i,floating:e},t){const s=cM(t)==="x"?"y":"x",r=s==="y"?"height":"width",n=lb(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 lb(i){return i.split("-")[0]}function cM(i){return["top","bottom"].includes(lb(i))?"y":"x"}
1446class Vm extends Event{constructor({action:e="auto",relatedTarget:t,...s}){super("invoke",s),this.action=e,this.relatedTarget=t}}class hM extends Event{constructor({newState:e,oldState:t,...s}){super("toggle",s),this.newState=e,this.oldState=t}}var Wm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ie=(i,e,t)=>(Wm(i,e,"read from private field"),t?t.call(i):e.get(i)),Pe=(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)},Pi=(i,e,t,s)=>(Wm(i,e,"write to private field"),e.set(i,t),t),Be=(i,e,t)=>(Wm(i,e,"access private method"),t),Oi,Ur,ir,ud,cd,Fr,Lo,Xh,db,nu,hd,Zh,Jh,ub,ef,cb,tf,hb,Fn,$n,Bn,Ro,au,qm,sf,fb,Ym,mb,rf,pb,jm,gb,nf,vb,af,Eb,so,ou,of,yb,ro,lu,fd,lf;function ta({type:i,text:e,value:t,checked:s}){const r=mt.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=mt.createElement("span");return n.textContent=e,r.append(n),r}function $r(i,e){let t=i.querySelector(`:scope > [slot="${e}"]`);if((t==null?void 0: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 fM(i){return`
1447    <style>
1448      :host {
1449        font: var(--media-font,
1450          var(--media-font-weight, normal)
1451          var(--media-font-size, 14px) /
1452          var(--media-text-content-height, var(--media-control-height, 24px))
1453          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
1454        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
1455        --_menu-bg: rgb(20 20 30 / .8);
1456        background: var(--media-menu-background, var(--media-control-background, var(--media-secondary-color, var(--_menu-bg))));
1457        border-radius: var(--media-menu-border-radius);
1458        border: var(--media-menu-border, none);
1459        display: var(--media-menu-display, inline-flex);
1460        transition: var(--media-menu-transition-in,
1461          visibility 0s,
1462          opacity .2s ease-out,
1463          transform .15s ease-out,
1464          left .2s ease-in-out,
1465          min-width .2s ease-in-out,
1466          min-height .2s ease-in-out
1467        ) !important;
1468        
1469        visibility: var(--media-menu-visibility, visible);
1470        opacity: var(--media-menu-opacity, 1);
1471        max-height: var(--media-menu-max-height, var(--_menu-max-height, 300px));
1472        transform: var(--media-menu-transform-in, translateY(0) scale(1));
1473        flex-direction: column;
1474        
1475        min-height: 0;
1476        position: relative;
1477        bottom: var(--_menu-bottom);
1478        box-sizing: border-box;
1479      } 
1480
1481      @-moz-document url-prefix() {
1482        :host{
1483          --_menu-bg: rgb(20 20 30);
1484        }
1485      }
1486
1487      :host([hidden]) {
1488        transition: var(--media-menu-transition-out,
1489          visibility .15s ease-in,
1490          opacity .15s ease-in,
1491          transform .15s ease-in
1492        ) !important;
1493        visibility: var(--media-menu-hidden-visibility, hidden);
1494        opacity: var(--media-menu-hidden-opacity, 0);
1495        max-height: var(--media-menu-hidden-max-height,
1496          var(--media-menu-max-height, var(--_menu-max-height, 300px)));
1497        transform: var(--media-menu-transform-out, translateY(2px) scale(.99));
1498        pointer-events: none;
1499      }
1500
1501      :host([slot="submenu"]) {
1502        background: none;
1503        width: 100%;
1504        min-height: 100%;
1505        position: absolute;
1506        bottom: 0;
1507        right: -100%;
1508      }
1509
1510      #container {
1511        display: flex;
1512        flex-direction: column;
1513        min-height: 0;
1514        transition: transform .2s ease-out;
1515        transform: translate(0, 0);
1516      }
1517
1518      #container.has-expanded {
1519        transition: transform .2s ease-in;
1520        transform: translate(-100%, 0);
1521      }
1522
1523      button {
1524        background: none;
1525        color: inherit;
1526        border: none;
1527        padding: 0;
1528        font: inherit;
1529        outline: inherit;
1530        display: inline-flex;
1531        align-items: center;
1532      }
1533
1534      slot[name="header"][hidden] {
1535        display: none;
1536      }
1537
1538      slot[name="header"] > *,
1539      slot[name="header"]::slotted(*) {
1540        padding: .4em .7em;
1541        border-bottom: 1px solid rgb(255 255 255 / .25);
1542        cursor: var(--media-cursor, default);
1543      }
1544
1545      slot[name="header"] > button[part~="back"],
1546      slot[name="header"]::slotted(button[part~="back"]) {
1547        cursor: var(--media-cursor, pointer);
1548      }
1549
1550      svg[part~="back"] {
1551        height: var(--media-menu-icon-height, var(--media-control-height, 24px));
1552        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
1553        display: block;
1554        margin-right: .5ch;
1555      }
1556
1557      slot:not([name]) {
1558        gap: var(--media-menu-gap);
1559        flex-direction: var(--media-menu-flex-direction, column);
1560        overflow: var(--media-menu-overflow, hidden auto);
1561        display: flex;
1562        min-height: 0;
1563      }
1564
1565      :host([role="menu"]) slot:not([name]) {
1566        padding-block: .4em;
1567      }
1568
1569      slot:not([name])::slotted([role="menu"]) {
1570        background: none;
1571      }
1572
1573      media-chrome-menu-item > span {
1574        margin-right: .5ch;
1575        max-width: var(--media-menu-item-max-width);
1576        text-overflow: ellipsis;
1577        overflow: hidden;
1578      }
1579    </style>
1580    <style id="layout-row" media="width:0">
1581
1582      slot[name="header"] > *,
1583      slot[name="header"]::slotted(*) {
1584        padding: .4em .5em;
1585      }
1586
1587      slot:not([name]) {
1588        gap: var(--media-menu-gap, .25em);
1589        flex-direction: var(--media-menu-flex-direction, row);
1590        padding-inline: .5em;
1591      }
1592
1593      media-chrome-menu-item {
1594        padding: .3em .5em;
1595      }
1596
1597      media-chrome-menu-item[aria-checked="true"] {
1598        background: var(--media-menu-item-checked-background, rgb(255 255 255 / .2));
1599      }
1600
1601      
1602      media-chrome-menu-item::part(checked-indicator) {
1603        display: var(--media-menu-item-checked-indicator-display, none);
1604      }
1605    </style>
1606    <div id="container">
1607      <slot name="header" hidden>
1608        <button part="back button" aria-label="Back to previous menu">
1609          <slot name="back-icon">
1610            <svg aria-hidden="true" viewBox="0 0 20 24" part="back indicator">
1611              <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"/>
1612            </svg>
1613          </slot>
1614          <slot name="title"></slot>
1615        </button>
1616      </slot>
1617      <slot></slot>
1618    </div>
1619    <slot name="checked-indicator" hidden></slot>
1620  `}const lr={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"};class Qi extends C.HTMLElement{constructor(){if(super(),Pe(this,Xh),Pe(this,hd),Pe(this,Jh),Pe(this,ef),Pe(this,tf),Pe(this,Bn),Pe(this,au),Pe(this,sf),Pe(this,Ym),Pe(this,rf),Pe(this,jm),Pe(this,nf),Pe(this,af),Pe(this,so),Pe(this,of),Pe(this,ro),Pe(this,fd),Pe(this,Oi,null),Pe(this,Ur,null),Pe(this,ir,null),Pe(this,ud,new Set),Pe(this,cd,void 0),Pe(this,Fr,!1),Pe(this,Lo,null),Pe(this,nu,()=>{const e=Ie(this,ud),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}));Pi(this,ud,t)}),Pe(this,Fn,()=>{Be(this,Bn,Ro).call(this),Be(this,au,qm).call(this,!1)}),Pe(this,$n,()=>{Be(this,Bn,Ro).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(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),Pi(this,cd,new MutationObserver(Ie(this,nu))),Ie(this,cd).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[lr.DISABLED,lr.HIDDEN,lr.STYLE,lr.ANCHOR,Re.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":Be(this,Xh,db).call(this,e);break;case"invoke":Be(this,Jh,ub).call(this,e);break;case"click":Be(this,sf,fb).call(this,e);break;case"toggle":Be(this,rf,pb).call(this,e);break;case"focusout":Be(this,nf,vb).call(this,e);break;case"keydown":Be(this,af,Eb).call(this,e);break}}connectedCallback(){var e,t;Pi(this,Lo,iT(this.shadowRoot,":host")),Be(this,hd,Zh).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),Pi(this,Oi,_h(this)),(t=(e=Ie(this,Oi))==null?void 0:e.associateElement)==null||t.call(e,this),this.hidden||(Xn(xo(this),Ie(this,Fn)),Xn(this,Ie(this,$n)))}disconnectedCallback(){var e,t;Zn(xo(this),Ie(this,Fn)),Zn(this,Ie(this,$n)),this.disable(),(t=(e=Ie(this,Oi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Pi(this,Oi,null)}attributeChangedCallback(e,t,s){var r,n,a,o;e===lr.HIDDEN&&s!==t?(Ie(this,Fr)||Pi(this,Fr,!0),this.hidden?Be(this,tf,hb).call(this):Be(this,ef,cb).call(this),this.dispatchEvent(new hM({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===Re.MEDIA_CONTROLLER?(t&&((n=(r=Ie(this,Oi))==null?void 0:r.unassociateElement)==null||n.call(r,this),Pi(this,Oi,null)),s&&this.isConnected&&(Pi(this,Oi,_h(this)),(o=(a=Ie(this,Oi))==null?void 0:a.associateElement)==null||o.call(a,this))):e===lr.DISABLED&&s!==t?s==null?this.enable():this.disable():e===lr.STYLE&&s!==t&&Be(this,hd,Zh).call(this)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}get anchor(){return this.getAttribute("anchor")}
1620set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?(e=bu(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(mM)}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&&Be(this,fd,lf).call(this,t)}focus(){if(Pi(this,Ur,um()),this.items.length){Be(this,ro,lu).call(this,this.items[0]),this.items[0].focus();return}const e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');e==null||e.focus()}handleSelect(e){var t;const s=Be(this,so,ou).call(this,e);s&&(Be(this,fd,lf).call(this,s,s.type==="checkbox"),Ie(this,ir)&&!this.hidden&&((t=Ie(this,Ur))==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=Be(this,so,ou).call(this,e))!=null?t:Be(this,of,yb).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),Be(this,ro,lu).call(this,n[l]),n[l].focus()}}Oi=new WeakMap;Ur=new WeakMap;ir=new WeakMap;ud=new WeakMap;cd=new WeakMap;Fr=new WeakMap;Lo=new WeakMap;Xh=new WeakSet;db=function(i){const e=i.target;for(const t of e.assignedNodes({flatten:!0}))t.nodeType===3&&t.textContent.trim()===""&&t.remove();if(["header","title"].includes(e.name)){const t=this.shadowRoot.querySelector('slot[name="header"]');t.hidden=e.assignedNodes().length===0}e.name||Ie(this,nu).call(this)};nu=new WeakMap;hd=new WeakSet;Zh=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")};Jh=new WeakSet;ub=function(i){Pi(this,ir,i.relatedTarget),gs(this,i.relatedTarget)||(this.hidden=!this.hidden)};ef=new WeakSet;cb=function(){var i;(i=Ie(this,ir))==null||i.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),Xn(xo(this),Ie(this,Fn)),Xn(this,Ie(this,$n))};tf=new WeakSet;hb=function(){var i;(i=Ie(this,ir))==null||i.setAttribute("aria-expanded","false"),Zn(xo(this),Ie(this,Fn)),Zn(this,Ie(this,$n))};Fn=new WeakMap;$n=new WeakMap;Bn=new WeakSet;Ro=function(i){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;const{x:e,y:t}=oM({anchor:this.anchorElement,floating:this,placement:"top-start"});i??(i=this.offsetWidth);const r=xo(this).getBoundingClientRect(),n=r.width-e-i,a=r.height-t-this.offsetHeight,{style:o}=Ie(this,Lo);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`)};au=new WeakSet;qm=function(i){const e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),t=e==null?void 0:e.querySelector('[role="menu"]'),{style:s}=Ie(this,Lo);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`),Be(this,Bn,Ro).call(this,n)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),Be(this,Bn,Ro).call(this);s.removeProperty("--media-menu-transition-in")};sf=new WeakSet;fb=function(i){var e;if(i.stopPropagation(),i.composedPath().includes(Ie(this,Ym,mb))){(e=Ie(this,Ur))==null||e.focus(),this.hidden=!0;return}const t=Be(this,so,ou).call(this,i);!t||t.hasAttribute("disabled")||(Be(this,ro,lu).call(this,t),this.handleSelect(i))};Ym=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"]'))};rf=new WeakSet;pb=function(i){if(i.target===this)return;Be(this,jm,gb).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 Vm({relatedTarget:t}));for(const t of e)t.setAttribute("aria-expanded",`${!t.submenuElement.hidden}`);Be(this,au,qm).call(this,!0)};jm=new WeakSet;gb=function(){const e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)};
vendor: 5,624 bytes, lines 1620-1734
1620nf=new WeakSet;vb=function(i){var e;gs(this,i.relatedTarget)||(Ie(this,Fr)&&((e=Ie(this,Ur))==null||e.focus()),Ie(this,ir)&&Ie(this,ir)!==i.relatedTarget&&!this.hidden&&(this.hidden=!0))};af=new WeakSet;Eb=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(Ie(this,Fr)){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=Ie(this,Ur))==null||n.focus(),Ie(this,Fr)&&(this.hidden=!0)):a==="Enter"||a===" "?this.handleSelect(i):this.handleMove(i)};so=new WeakSet;ou=function(i){return i.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};of=new WeakSet;yb=function(){return this.items.find(i=>i.tabIndex===0)};ro=new WeakSet;lu=function(i){for(const e of this.items)e.tabIndex=e===i?0:-1};fd=new WeakSet;lf=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}))};Qi.shadowRootOptions={mode:"open"};Qi.getTemplateHTML=fM;function mM(i){return["menuitem","menuitemradio","menuitemcheckbox"].includes(i==null?void 0:i.role)}function xo(i){var e;return(e=i.getAttribute("bounds")?sa(i,`#${i.getAttribute("bounds")}`):ri(i)||i.parentElement)!=null?e:i}C.customElements.get("media-chrome-menu")||C.customElements.define("media-chrome-menu",Qi);var zm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Vi=(i,e,t)=>(zm(i,e,"read from private field"),t?t.call(i):e.get(i)),ts=(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)=>(zm(i,e,"write to private field"),e.set(i,t),t),$i=(i,e,t)=>(zm(i,e,"access private method"),t),md,no,df,Tb,Qm,bb,Xm,_b,Wi,ia,ko,uf,Ab,pd,cf;function pM(i){return`
1621    <style>
1622      :host {
1623        transition: var(--media-menu-item-transition,
1624          background .15s linear,
1625          opacity .2s ease-in-out
1626        );
1627        outline: var(--media-menu-item-outline, 0);
1628        outline-offset: var(--media-menu-item-outline-offset, -1px);
1629        cursor: var(--media-cursor, pointer);
1630        display: flex;
1631        align-items: center;
1632        align-self: stretch;
1633        justify-self: stretch;
1634        white-space: nowrap;
1635        white-space-collapse: collapse;
1636        text-wrap: nowrap;
1637        padding: .4em .8em .4em 1em;
1638      }
1639
1640      :host(:focus-visible) {
1641        box-shadow: var(--media-menu-item-focus-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
1642        outline: var(--media-menu-item-hover-outline, 0);
1643        outline-offset: var(--media-menu-item-hover-outline-offset,  var(--media-menu-item-outline-offset, -1px));
1644      }
1645
1646      :host(:hover) {
1647        cursor: var(--media-cursor, pointer);
1648        background: var(--media-menu-item-hover-background, rgb(92 92 102 / .5));
1649        outline: var(--media-menu-item-hover-outline);
1650        outline-offset: var(--media-menu-item-hover-outline-offset,  var(--media-menu-item-outline-offset, -1px));
1651      }
1652
1653      :host([aria-checked="true"]) {
1654        background: var(--media-menu-item-checked-background);
1655      }
1656
1657      :host([hidden]) {
1658        display: none;
1659      }
1660
1661      :host([disabled]) {
1662        pointer-events: none;
1663        color: rgba(255, 255, 255, .3);
1664      }
1665
1666      slot:not([name]) {
1667        width: 100%;
1668      }
1669
1670      slot:not([name="submenu"]) {
1671        display: inline-flex;
1672        align-items: center;
1673        transition: inherit;
1674        opacity: var(--media-menu-item-opacity, 1);
1675      }
1676
1677      slot[name="description"] {
1678        justify-content: end;
1679      }
1680
1681      slot[name="description"] > span {
1682        display: inline-block;
1683        margin-inline: 1em .2em;
1684        max-width: var(--media-menu-item-description-max-width, 100px);
1685        text-overflow: ellipsis;
1686        overflow: hidden;
1687        font-size: .8em;
1688        font-weight: 400;
1689        text-align: right;
1690        position: relative;
1691        top: .04em;
1692      }
1693
1694      slot[name="checked-indicator"] {
1695        display: none;
1696      }
1697
1698      :host(:is([role="menuitemradio"],[role="menuitemcheckbox"])) slot[name="checked-indicator"] {
1699        display: var(--media-menu-item-checked-indicator-display, inline-block);
1700      }
1701
1702      
1703      svg, img, ::slotted(svg), ::slotted(img) {
1704        height: var(--media-menu-item-icon-height, var(--media-control-height, 24px));
1705        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
1706        display: block;
1707      }
1708
1709      
1710      [part~="indicator"],
1711      ::slotted([part~="indicator"]) {
1712        fill: var(--media-menu-item-indicator-fill,
1713          var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))));
1714        height: var(--media-menu-item-indicator-height, 1.25em);
1715        margin-right: .5ch;
1716      }
1717
1718      [part~="checked-indicator"] {
1719        visibility: hidden;
1720      }
1721
1722      :host([aria-checked="true"]) [part~="checked-indicator"] {
1723        visibility: visible;
1724      }
1725    </style>
1726    <slot name="checked-indicator">
1727      <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator">
1728        <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"/>
1729      </svg>
1730    </slot>
1731    <slot name="prefix"></slot>
1732    <slot></slot>
1733    <slot name="description"></slot>
1734    <slot name="suffix">
1735      ${this.getSuffixSlotInnerHTML(i)}
1736    </slot>
1737    <slot name="submenu"></slot>
1738  `}function gM(i){return""}const Qt={TYPE:"type",VALUE:"value",CHECKED:"checked",DISABLED:"disabled"};class aa extends C.HTMLElement{constructor(){if(super(),ts(this,df),ts(this,Qm),ts(this,Xm),ts(this,ia),ts(this,uf),ts(this,pd),ts(this,md,!1),ts(this,no,void 0),ts(this,Wi,()=>{var e,t;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==null?void 0:r.dataset.description)!=null?t:r==null?void 0:r.text,a=mt.createElement("span");a.textContent=n??"",s.replaceChildren(a)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=qt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.shadowRoot.addEventListener("slotchange",this)}static get observedAttributes(){return[Qt.TYPE,Qt.DISABLED,Qt.CHECKED,Qt.VALUE]}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),ya(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":$i(this,df,Tb).call(this,e);break;case"click":this.handleClick(e);break;case"keydown":$i(this,uf,Ab).call(this,e);break;case"keyup":$i(this,ia,ko).call(this,e);break}}attributeChangedCallback(e,t,s){e===Qt.CHECKED&&ya(this)&&!Vi(this,md)?this.setAttribute("aria-checked",s!=null?"true":"false"):e===Qt.TYPE&&s!==t?this.role="menuitem"+s:e===Qt.DISABLED&&s!==t&&(s==null?this.enable():this.disable())}connectedCallback(){this.hasAttribute(Qt.DISABLED)||this.enable(),this.role="menuitem"+this.type,Sc(this,no,hf(this,this.parentNode)),$i(this,pd,cf).call(this)}disconnectedCallback(){this.disable(),$i(this,pd,cf).call(this),Sc(this,no,null)}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?(e=bu(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(Qt.TYPE))!=null?e:""}set type(e){this.setAttribute(Qt.TYPE,`${e}`)}get value(){var e;return(e=this.getAttribute(Qt.VALUE))!=null?e:this.text}set value(e){this.setAttribute(Qt.VALUE,e)}get text(){var e;return((e=this.textContent)!=null?e:"").trim()}get checked(){if(ya(this))return this.getAttribute("aria-checked")==="true"}set checked(e){ya(this)&&(Sc(this,md,!0),this.setAttribute("aria-checked",e?"true":"false"),e?this.part.add("checked"):this.part.remove("checked"))}handleClick(e){ya(this)||this.invokeTargetElement&&gs(this,e.target)&&this.invokeTargetElement.dispatchEvent(new Vm({relatedTarget:this}))}get keysUsed(){return["Enter"," "]}}md=new WeakMap;no=new WeakMap;df=new WeakSet;Tb=function(i){const e=i.target;if(!(e!=null&&e.name))for(const s of e.assignedNodes({flatten:!0}))s instanceof Text&&s.textContent.trim()===""&&s.remove();e.name==="submenu"&&(this.submenuElement?$i(this,Qm,bb).call(this):$i(this,Xm,_b).call(this))};Qm=new WeakSet;bb=async function(){this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",`${!this.submenuElement.hidden}`),this.submenuElement.addEventListener("change",Vi(this,Wi)),this.submenuElement.addEventListener("addmenuitem",Vi(this,Wi)),this.submenuElement.addEventListener("removemenuitem",Vi(this,Wi)),Vi(this,Wi).call(this)};Xm=new WeakSet;_b=function(){this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.submenuElement.removeEventListener("change",Vi(this,Wi)),this.submenuElement.removeEventListener("addmenuitem",Vi(this,Wi)),this.submenuElement.removeEventListener("removemenuitem",Vi(this,Wi)),Vi(this,Wi).call(this)};Wi=new WeakMap;
1738ia=new WeakSet;ko=function(i){const{key:e}=i;if(!this.keysUsed.includes(e)){this.removeEventListener("keyup",$i(this,ia,ko));return}this.handleClick(i)};uf=new WeakSet;Ab=function(i){const{metaKey:e,altKey:t,key:s}=i;if(e||t||!this.keysUsed.includes(s)){this.removeEventListener("keyup",$i(this,ia,ko));return}this.addEventListener("keyup",$i(this,ia,ko),{once:!0})};pd=new WeakSet;cf=function(){var i;const e=(i=Vi(this,no))==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==null||t.setAttribute("aria-checked","true")};aa.shadowRootOptions={mode:"open"};aa.getTemplateHTML=pM;aa.getSuffixSlotInnerHTML=gM;function ya(i){return i.type==="radio"||i.type==="checkbox"}function hf(i,e){if(!i)return null;const{host:t}=i.getRootNode();return!e&&t?hf(i,t):e!=null&&e.items?e:hf(e,e==null?void 0:e.parentNode)}C.customElements.get("media-chrome-menu-item")||C.customElements.define("media-chrome-menu-item",aa);function vM(i){return`
1739    ${Qi.getTemplateHTML(i)}
1740    <style>
1741      :host {
1742        --_menu-bg: rgb(20 20 30 / .8);
1743        background: var(--media-settings-menu-background,
1744            var(--media-menu-background,
1745              var(--media-control-background,
1746                var(--media-secondary-color, var(--_menu-bg)))));
1747        min-width: var(--media-settings-menu-min-width, 170px);
1748        border-radius: 2px 2px 0 0;
1749        overflow: hidden;
1750      }
1751
1752      @-moz-document url-prefix() {
1753        :host{
1754          --_menu-bg: rgb(20 20 30);
1755        }
1756      }
1757
1758      :host([role="menu"]) {
1759        
1760        justify-content: end;
1761      }
1762
1763      slot:not([name]) {
1764        justify-content: var(--media-settings-menu-justify-content);
1765        flex-direction: var(--media-settings-menu-flex-direction, column);
1766        overflow: visible;
1767      }
1768
1769      #container.has-expanded {
1770        --media-settings-menu-item-opacity: 0;
1771      }
1772    </style>
1773  `}class Sb extends Qi{get anchorElement(){return this.anchor!=="auto"?super.anchorElement:ri(this).querySelector("media-settings-menu-button")}}Sb.getTemplateHTML=vM;C.customElements.get("media-settings-menu")||C.customElements.define("media-settings-menu",Sb);function EM(i){return`
1774    ${aa.getTemplateHTML.call(this,i)}
1775    <style>
1776      slot:not([name="submenu"]) {
1777        opacity: var(--media-settings-menu-item-opacity, var(--media-menu-item-opacity));
1778      }
1779
1780      :host([aria-expanded="true"]:hover) {
1781        background: transparent;
1782      }
1783    </style>
1784  `}function yM(i){return`
1785    <svg aria-hidden="true" viewBox="0 0 20 24">
1786      <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"/>
1787    </svg>
1788  `}class Pu extends aa{}Pu.shadowRootOptions={mode:"open"};Pu.getTemplateHTML=EM;Pu.getSuffixSlotInnerHTML=yM;C.customElements.get("media-settings-menu-item")||C.customElements.define("media-settings-menu-item",Pu);class oa extends At{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=bu(this))==null?void 0:e.querySelector(`#${this.invokeTarget}`):null}handleClick(){var e;(e=this.invokeTargetElement)==null||e.dispatchEvent(new Vm({relatedTarget:this}))}}C.customElements.get("media-chrome-menu-button")||C.customElements.define("media-chrome-menu-button",oa);function TM(){return`
1789    <style>
1790      :host([aria-expanded="true"]) slot[name=tooltip] {
1791        display: none;
1792      }
1793    </style>
1794    <slot name="icon">
1795      <svg aria-hidden="true" viewBox="0 0 24 24">
1796        <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"/>
1797      </svg>
1798    </slot>
1799  `}function bM(){return Z("Settings")}class Zm extends oa{static get observedAttributes(){return[...super.observedAttributes,"target"]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",Z("settings"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:ri(this).querySelector("media-settings-menu")}}Zm.getSlotTemplateHTML=TM;Zm.getTooltipContentHTML=bM;C.customElements.get("media-settings-menu-button")||C.customElements.define("media-settings-menu-button",Zm);var Jm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ib=(i,e,t)=>(Jm(i,e,"read from private field"),t?t.call(i):e.get(i)),hl=(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)},ff=(i,e,t,s)=>(Jm(i,e,"write to private field"),e.set(i,t),t),fl=(i,e,t)=>(Jm(i,e,"access private method"),t),Ga,du,gd,mf,vd,pf;class _M extends Qi{constructor(){super(...arguments),hl(this,gd),hl(this,vd),hl(this,Ga,[]),hl(this,du,void 0)}static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_AUDIO_TRACK_LIST,b.MEDIA_AUDIO_TRACK_ENABLED,b.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_AUDIO_TRACK_ENABLED&&t!==s?this.value=s:e===b.MEDIA_AUDIO_TRACK_LIST&&t!==s&&(ff(this,Ga,pD(s??"")),fl(this,gd,mf).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",fl(this,vd,pf))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",fl(this,vd,pf))}get anchorElement(){var e;return this.anchor!=="auto"?super.anchorElement:(e=ri(this))==null?void 0:e.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return Ib(this,Ga)}set mediaAudioTrackList(e){ff(this,Ga,e),fl(this,gd,mf).call(this)}get mediaAudioTrackEnabled(){var e;return(e=Ve(this,b.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){We(this,b.MEDIA_AUDIO_TRACK_ENABLED,e)}}Ga=new WeakMap;du=new WeakMap;gd=new WeakSet;mf=function(){if(Ib(this,du)===JSON.stringify(this.mediaAudioTrackList))return;ff(this,du,JSON.stringify(this.mediaAudioTrackList));const i=this.mediaAudioTrackList;this.defaultSlot.textContent="";for(const e of i){const t=this.formatMenuItemText(e.label,e),s=ta({type:"radio",text:t,value:`${e.id}`,checked:e.enabled});s.prepend($r(this,"checked-indicator")),this.defaultSlot.append(s)}};vd=new WeakSet;pf=function(){if(this.value==null)return;const i=new C.CustomEvent(Q.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};C.customElements.get("media-audio-track-menu")||C.customElements.define("media-audio-track-menu",_M);const AM=`<svg aria-hidden="true" viewBox="0 0 24 24">
1800  <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/>
1801  <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"/>
1802</svg>`;function SM(){return`
1803    <style>
1804      :host([aria-expanded="true"]) slot[name=tooltip] {
1805        display: none;
1806      }
1807    </style>
1808    <slot name="icon">${AM}</slot>
1809  `}function IM(){return Z("Audio")}class ep extends oa{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_AUDIO_TRACK_ENABLED,b.MEDIA_AUDIO_TRACK_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",Z("Audio"))}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=ri(this))==null?void 0:e.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var e;return(e=Ve(this,b.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){We(this,b.MEDIA_AUDIO_TRACK_ENABLED,e)}}ep.getSlotTemplateHTML=SM;ep.getTooltipContentHTML=IM;C.customElements.get("media-audio-track-menu-button")||C.customElements.define("media-audio-track-menu-button",ep);var tp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},LM=(i,e,t)=>(tp(i,e,"read from private field"),e.get(i)),Ic=(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)},RM=(i,e,t,s)=>(tp(i,e,"write to private field"),e.set(i,t),t),Lc=(i,e,t)=>(tp(i,e,"access private method"),t),uu,gf,Lb,Ed,vf;const xM=`
1810  <svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator">
1811    <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 
18110 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"/>
1812  </svg>`;function kM(i){return`
1813    ${Qi.getTemplateHTML(i)}
1814    <slot name="captions-indicator" hidden>${xM}</slot>
1815  `}class Rb extends Qi{constructor(){super(...arguments),Ic(this,gf),Ic(this,Ed),Ic(this,uu,void 0)}static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_SUBTITLES_LIST,b.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_SUBTITLES_LIST&&t!==s?Lc(this,gf,Lb).call(this):e===b.MEDIA_SUBTITLES_SHOWING&&t!==s&&(this.value=s)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Lc(this,Ed,vf))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Lc(this,Ed,vf))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:ri(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return H0(this,b.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){G0(this,b.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return H0(this,b.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){G0(this,b.MEDIA_SUBTITLES_SHOWING,e)}}uu=new WeakMap;gf=new WeakSet;Lb=function(){var i;if(LM(this,uu)===JSON.stringify(this.mediaSubtitlesList))return;RM(this,uu,JSON.stringify(this.mediaSubtitlesList)),this.defaultSlot.textContent="";const e=!this.value,t=ta({type:"radio",text:this.formatMenuItemText(Z("Off")),value:"off",checked:e});t.prepend($r(this,"checked-indicator")),this.defaultSlot.append(t);const s=this.mediaSubtitlesList;for(const r of s){const n=ta({type:"radio",text:this.formatMenuItemText(r.label,r),value:Lh(r),checked:this.value==Lh(r)});n.prepend($r(this,"checked-indicator")),((i=r.kind)!=null?i:"subs")==="captions"&&n.append($r(this,"captions-indicator")),this.defaultSlot.append(n)}};Ed=new WeakSet;vf=function(){const i=this.mediaSubtitlesShowing,e=this.getAttribute(b.MEDIA_SUBTITLES_SHOWING),t=this.value!==e;if(i!=null&&i.length&&t&&this.dispatchEvent(new C.CustomEvent(Q.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i})),!this.value||!t)return;const s=new C.CustomEvent(Q.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(s)};Rb.getTemplateHTML=kM;const H0=(i,e)=>{const t=i.getAttribute(e);return t?Lu(t):[]},G0=(i,e,t)=>{if(!(t!=null&&t.length)){i.removeAttribute(e);return}const s=To(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};C.customElements.get("media-captions-menu")||C.customElements.define("media-captions-menu",Rb);const DM=`<svg aria-hidden="true" viewBox="0 0 26 24">
1816  <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"/>
1817</svg>`,CM=`<svg aria-hidden="true" viewBox="0 0 26 24">
1818  <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.8
18181 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"/>
1819</svg>`;function wM(){return`
1820    <style>
1821      :host([aria-checked="true"]) slot[name=off] {
1822        display: none !important;
1823      }
1824
1825      
1826      :host(:not([aria-checked="true"])) slot[name=on] {
1827        display: none !important;
1828      }
1829
1830      :host([aria-expanded="true"]) slot[name=tooltip] {
1831        display: none;
1832      }
1833    </style>
1834
1835    <slot name="icon">
1836      <slot name="on">${DM}</slot>
1837      <slot name="off">${CM}</slot>
1838    </slot>
1839  `}function MM(){return Z("Captions")}const K0=i=>{i.setAttribute("aria-checked",hT(i).toString())};class ip extends oa{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_SUBTITLES_LIST,b.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",Z("closed captions")),K0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_SUBTITLES_SHOWING&&K0(this)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=ri(this))==null?void 0:e.querySelector("media-captions-menu")}get mediaSubtitlesList(){return V0(this,b.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){W0(this,b.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return V0(this,b.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){W0(this,b.MEDIA_SUBTITLES_SHOWING,e)}}ip.getSlotTemplateHTML=wM;ip.getTooltipContentHTML=MM;const V0=(i,e)=>{const t=i.getAttribute(e);return t?Lu(t):[]},W0=(i,e,t)=>{if(!(t!=null&&t.length)){i.removeAttribute(e);return}const s=To(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};C.customElements.get("media-captions-menu-button")||C.customElements.define("media-captions-menu-button",ip);var xb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},_n=(i,e,t)=>(xb(i,e,"read from private field"),t?t.call(i):e.get(i)),Rc=(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)},Ta=(i,e,t)=>(xb(i,e,"access private method"),t),Ps,Ka,yd,Td,Ef;const xc={RATES:"rates"};class PM extends Qi{constructor(){super(),Rc(this,Ka),Rc(this,Td),Rc(this,Ps,new fm(this,xc.RATES,{defaultValue:GT})),Ta(this,Ka,yd).call(this)}static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_PLAYBACK_RATE,xc.RATES]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_PLAYBACK_RATE&&t!=s?this.value=s:e===xc.RATES&&t!=s&&(_n(this,Ps).value=s,Ta(this,Ka,yd).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Ta(this,Td,Ef))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Ta(this,Td,Ef))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:ri(this).querySelector("media-playback-rate-menu-button")}get rates(){return _n(this,Ps)}set rates(e){e?Array.isArray(e)?_n(this,Ps).value=e.join(" "):typeof e=="string"&&(_n(this,Ps).value=e):_n(this,Ps).value="",Ta(this,Ka,yd).call(this)}get mediaPlaybackRate(){return Ke(this,b.MEDIA_PLAYBACK_RATE,kn)}set mediaPlaybackRate(e){Ze(this,b.MEDIA_PLAYBACK_RATE,e)}}Ps=new WeakMap;Ka=new WeakSet;yd=function(){this.defaultSlot.textContent="";for(const i of _n(this,Ps)){const e=ta({type:"radio",text:this.formatMenuItemText(`${i}x`,i),value:i,checked:this.mediaPlaybackRate===Number(i)});e.prepend($r(this,"checked-indicator")),this.defaultSlot.append(e)}};Td=new WeakSet;Ef=function(){if(!this.value)return;const i=new C.CustomEvent(Q.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};C.customElements.get("media-playback-rate-menu")||C.customElements.define("media-playback-rate-menu",PM);const bd=1;function OM(i){return`
1840    <style>
1841      :host {
1842        min-width: 5ch;
1843        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
1844      }
1845      
1846      :host([aria-expanded="true"]) slot[name=tooltip] {
1847        display: none;
1848      }
1849    </style>
1850    <slot name="icon">${i.mediaplaybackrate||bd}x</slot>
1851  `}function NM(){return Z("Playback rate")}class sp extends oa{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_PLAYBACK_RATE]}constructor(){var e;super(),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:bd}x`}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),e===b.MEDIA_PLAYBACK_RATE){const r=s?+s:Number.NaN,n=Number.isNaN(r)?bd:r;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",Z("Playback rate {playbackRate}",{playbackRate:n}))}}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:ri(this).querySelector("media-playback-rate-menu")}get mediaPlaybackRate(){return Ke(this,b.MEDIA_PLAYBACK_RATE,bd)}set mediaPlaybackRate(e){Ze(this,b.MEDIA_PLAYBACK_RATE,e)}}sp.getSlotTemplateHTML=OM;sp.getTooltipContentHTML=NM;C.customElements.get("media-playback-rate-menu-button")||C.customElements.define("media-playback-rate-menu-button",sp);var rp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)}
1851,Va=(i,e,t)=>(rp(i,e,"read from private field"),t?t.call(i):e.get(i)),ml=(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)},q0=(i,e,t,s)=>(rp(i,e,"write to private field"),e.set(i,t),t),sn=(i,e,t)=>(rp(i,e,"access private method"),t),Wa,Dn,An,qa,_d,yf;class UM extends Qi{constructor(){super(...arguments),ml(this,An),ml(this,_d),ml(this,Wa,[]),ml(this,Dn,{})}static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_RENDITION_LIST,b.MEDIA_RENDITION_SELECTED,b.MEDIA_RENDITION_UNAVAILABLE,b.MEDIA_HEIGHT]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===b.MEDIA_RENDITION_SELECTED&&t!==s?(this.value=s??"auto",sn(this,An,qa).call(this)):e===b.MEDIA_RENDITION_LIST&&t!==s?(q0(this,Wa,cD(s)),sn(this,An,qa).call(this)):e===b.MEDIA_HEIGHT&&t!==s&&sn(this,An,qa).call(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",sn(this,_d,yf))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",sn(this,_d,yf))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:ri(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return Va(this,Wa)}set mediaRenditionList(e){q0(this,Wa,e),sn(this,An,qa).call(this)}get mediaRenditionSelected(){return Ve(this,b.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){We(this,b.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return Ke(this,b.MEDIA_HEIGHT)}set mediaHeight(e){Ze(this,b.MEDIA_HEIGHT,e)}}Wa=new WeakMap;Dn=new WeakMap;An=new WeakSet;qa=function(){if(Va(this,Dn).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&Va(this,Dn).mediaHeight===this.mediaHeight)return;Va(this,Dn).mediaRenditionList=JSON.stringify(this.mediaRenditionList),Va(this,Dn).mediaHeight=this.mediaHeight;const i=this.mediaRenditionList.sort((n,a)=>a.height-n.height);for(const n of i)n.selected=n.id===this.mediaRenditionSelected;this.defaultSlot.textContent="";const e=!this.mediaRenditionSelected;for(const n of i){const a=this.formatMenuItemText(`${Math.min(n.width,n.height)}p`,n),o=ta({type:"radio",text:a,value:`${n.id}`,checked:n.selected&&!e});o.prepend($r(this,"checked-indicator")),this.defaultSlot.append(o)}const t=e?this.formatMenuItemText(`${Z("Auto")} (${this.mediaHeight}p)`):this.formatMenuItemText(Z("Auto")),s=ta({type:"radio",text:t,value:"auto",checked:e}),r=this.mediaHeight>0?`${Z("Auto")} (${this.mediaHeight}p)`:Z("Auto");s.dataset.description=r,s.prepend($r(this,"checked-indicator")),this.defaultSlot.append(s)};_d=new WeakSet;yf=function(){if(this.value==null)return;const i=new C.CustomEvent(Q.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};C.customElements.get("media-rendition-menu")||C.customElements.define("media-rendition-menu",UM);const FM=`<svg aria-hidden="true" viewBox="0 0 24 24">
1852  <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" />
1853</svg>`;function $M(){return`
1854    <style>
1855      :host([aria-expanded="true"]) slot[name=tooltip] {
1856        display: none;
1857      }
1858    </style>
1859    <slot name="icon">${FM}</slot>
1860  `}function BM(){return Z("Quality")}class np extends oa{static get observedAttributes(){return[...super.observedAttributes,b.MEDIA_RENDITION_SELECTED,b.MEDIA_RENDITION_UNAVAILABLE,b.MEDIA_HEIGHT]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",Z("quality"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:ri(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return Ve(this,b.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){We(this,b.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return Ke(this,b.MEDIA_HEIGHT)}set mediaHeight(e){Ze(this,b.MEDIA_HEIGHT,e)}}np.getSlotTemplateHTML=$M;np.getTooltipContentHTML=BM;C.customElements.get("media-rendition-menu-button")||C.customElements.define("media-rendition-menu-button",np);var kb=i=>{throw TypeError(i)},ap=(i,e,t)=>e.has(i)||kb("Cannot "+t),Ce=(i,e,t)=>(ap(i,e,"read from private field"),t?t.call(i):e.get(i)),mi=(i,e,t)=>e.has(i)?kb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Yi=(i,e,t,s)=>(ap(i,e,"write to private field"),e.set(i,t),t),rt=(i,e,t)=>(ap(i,e,"access private method"),t),Ou=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends Ou{}globalThis.DocumentFragment=i}var op=class extends Ou{},HM=class extends Ou{},GM={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(op)}},Ad,KM=class{constructor(i,e={}){mi(this,Ad),Yi(this,Ad,e==null?void 0:e.detail)}get detail(){return Ce(this,Ad)}initCustomEvent(){}};Ad=new WeakMap;
vendor: 6,006 bytes, lines 1860-1861
1860function VM(i,e){return new op}var Db={document:{createElement:VM},DocumentFragment,customElements:GM,CustomEvent:KM,EventTarget:Ou,HTMLElement:op,HTMLVideoElement:HM},Cb=typeof window>"u"||typeof globalThis.customElements>"u",Bi=Cb?Db:globalThis,lp=Cb?Db.document:globalThis.document;function WM(i){let e="";return Object.entries(i).forEach(([t,s])=>{s!=null&&(e+=`${Tf(t)}: ${s}; `)}),e?e.trim():void 0}function Tf(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function wb(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Bt(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function Mb(i){let e=qM(i).toString();return e?"?"+e:""}function qM(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}var Pb=(i,e)=>!i||!e?!1:i.contains(e)?!0:Pb(i,e.getRootNode().host),Ob="mux.com",YM=()=>{try{return"3.5.1"}catch{}return"UNKNOWN"},jM=YM(),Nb=()=>jM,zM=(i,{token:e,customDomain:t=Ob,thumbnailTime:s,programTime:r}={})=>{var n;let a=e==null?s:void 0,{aud:o}=(n=Pn(e))!=null?n:{};if(!(e&&o!=="t"))return`https://image.${t}/${i}/thumbnail.webp${Mb({token:e,time:a,program_time:r})}`},QM=(i,{token:e,customDomain:t=Ob,programStartTime:s,programEndTime:r}={})=>{var n;let{aud:a}=(n=Pn(e))!=null?n:{};if(!(e&&a!=="s"))return`https://image.${t}/${i}/storyboard.vtt${Mb({token:e,format:"webp",program_start_time:s,program_end_time:r})}`},dp=i=>{if(i){if([De.LIVE,De.ON_DEMAND].includes(i))return i;if(i!=null&&i.includes("live"))return De.LIVE}},XM={crossorigin:"crossOrigin",playsinline:"playsInline"};function ZM(i){var e;return(e=XM[i])!=null?e:wb(i)}var Sn,In,Mt,JM=class{constructor(i,e){mi(this,Sn),mi(this,In),mi(this,Mt,[]),Yi(this,Sn,i),Yi(this,In,e)}[Symbol.iterator](){return Ce(this,Mt).values()}get length(){return Ce(this,Mt).length}get value(){var i;return(i=Ce(this,Mt).join(" "))!=null?i:""}set value(i){var e;i!==this.value&&(Yi(this,Mt,[]),this.add(...(e=i==null?void 0:i.split(" "))!=null?e:[]))}toString(){return this.value}item(i){return Ce(this,Mt)[i]}values(){return Ce(this,Mt).values()}keys(){return Ce(this,Mt).keys()}forEach(i){Ce(this,Mt).forEach(i)}add(...i){var e,t;i.forEach(s=>{this.contains(s)||Ce(this,Mt).push(s)}),!(this.value===""&&!((e=Ce(this,Sn))!=null&&e.hasAttribute(`${Ce(this,In)}`)))&&((t=Ce(this,Sn))==null||t.setAttribute(`${Ce(this,In)}`,`${this.value}`))}remove(...i){var e;i.forEach(t=>{Ce(this,Mt).splice(Ce(this,Mt).indexOf(t),1)}),(e=Ce(this,Sn))==null||e.setAttribute(`${Ce(this,In)}`,`${this.value}`)}contains(i){return Ce(this,Mt).includes(i)}toggle(i,e){return typeof e<"u"?e?(this.add(i),!0):(this.remove(i),!1):this.contains(i)?(this.remove(i),!1):(this.add(i),!0)}replace(i,e){this.remove(i),this.add(e)}};Sn=new WeakMap,In=new WeakMap,Mt=new WeakMap;var Ub=`[mux-player ${Nb()}]`;function ls(...i){console.warn(Ub,...i)}function Jt(...i){console.error(Ub,...i)}function Fb(i){var e;let t=(e=i.message)!=null?e:"";i.context&&(t+=` ${i.context}`),i.file&&(t+=` ${se("Read more: ")}
1861https://github.com/muxinc/elements/blob/main/errors/${i.file}`),ls(t)}var Rt={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},yr={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Y0=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}}),eP=Object.values(Rt).filter(i=>Rt.PLAYSINLINE!==i),tP=Object.values(yr),iP=[...eP,...tP],sP=class extends Bi.HTMLElement{static get observedAttributes(){return iP}constructor(){super()}attributeChangedCallback(i,e,t){var s,r;switch(i){case yr.MUTED:{this.media&&(this.media.muted=t!=null,this.media.defaultMuted=t!=null);return}case yr.VOLUME:{let n=(s=Bt(t))!=null?s:1;this.media&&(this.media.volume=n);return}case yr.PLAYBACKRATE:{let n=(r=Bt(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:Y0}get seekable(){var i,e;return(e=(i=this.media)==null?void 0:i.seekable)!=null?e:Y0}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=Bt(this.getAttribute(yr.PLAYBACKRATE)))!=null?i:1}
vendor: 5,090 bytes, lines 1861-1948
1861set defaultPlaybackRate(i){i!=null?this.setAttribute(yr.PLAYBACKRATE,`${i}`):this.removeAttribute(yr.PLAYBACKRATE)}get crossOrigin(){return ba(this,Rt.CROSSORIGIN)}set crossOrigin(i){this.setAttribute(Rt.CROSSORIGIN,`${i}`)}get autoplay(){return ba(this,Rt.AUTOPLAY)!=null}set autoplay(i){i?this.setAttribute(Rt.AUTOPLAY,typeof i=="string"?i:""):this.removeAttribute(Rt.AUTOPLAY)}get loop(){return ba(this,Rt.LOOP)!=null}set loop(i){i?this.setAttribute(Rt.LOOP,""):this.removeAttribute(Rt.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 ba(this,Rt.MUTED)!=null}set defaultMuted(i){i?this.setAttribute(Rt.MUTED,""):this.removeAttribute(Rt.MUTED)}get playsInline(){return ba(this,Rt.PLAYSINLINE)!=null}set playsInline(i){Jt("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(Rt.PRELOAD,i):this.removeAttribute(Rt.PRELOAD)}};function ba(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var j0=sP,rP=`:host {
1862  --media-control-display: var(--controls);
1863  --media-loading-indicator-display: var(--loading-indicator);
1864  --media-dialog-display: var(--dialog);
1865  --media-play-button-display: var(--play-button);
1866  --media-live-button-display: var(--live-button);
1867  --media-seek-backward-button-display: var(--seek-backward-button);
1868  --media-seek-forward-button-display: var(--seek-forward-button);
1869  --media-mute-button-display: var(--mute-button);
1870  --media-captions-button-display: var(--captions-button);
1871  --media-captions-menu-button-display: var(--captions-menu-button, var(--media-captions-button-display));
1872  --media-rendition-menu-button-display: var(--rendition-menu-button);
1873  --media-audio-track-menu-button-display: var(--audio-track-menu-button);
1874  --media-airplay-button-display: var(--airplay-button);
1875  --media-pip-button-display: var(--pip-button);
1876  --media-fullscreen-button-display: var(--fullscreen-button);
1877  --media-cast-button-display: var(--cast-button, var(--_cast-button-drm-display));
1878  --media-playback-rate-button-display: var(--playback-rate-button);
1879  --media-playback-rate-menu-button-display: var(--playback-rate-menu-button);
1880  --media-volume-range-display: var(--volume-range);
1881  --media-time-range-display: var(--time-range);
1882  --media-time-display-display: var(--time-display);
1883  --media-duration-display-display: var(--duration-display);
1884  --media-title-display-display: var(--title-display);
1885
1886  display: inline-block;
1887  line-height: 0;
1888  width: 100%;
1889}
1890
1891a {
1892  color: #fff;
1893  font-size: 0.9em;
1894  text-decoration: underline;
1895}
1896
1897media-theme {
1898  display: inline-block;
1899  line-height: 0;
1900  width: 100%;
1901  height: 100%;
1902  direction: ltr;
1903}
1904
1905media-poster-image {
1906  display: inline-block;
1907  line-height: 0;
1908  width: 100%;
1909  height: 100%;
1910}
1911
1912media-poster-image:not([src]):not([placeholdersrc]) {
1913  display: none;
1914}
1915
1916::part(top),
1917[part~='top'] {
1918  --media-control-display: var(--controls, var(--top-controls));
1919  --media-play-button-display: var(--play-button, var(--top-play-button));
1920  --media-live-button-display: var(--live-button, var(--top-live-button));
1921  --media-seek-backward-button-display: var(--seek-backward-button, var(--top-seek-backward-button));
1922  --media-seek-forward-button-display: var(--seek-forward-button, var(--top-seek-forward-button));
1923  --media-mute-button-display: var(--mute-button, var(--top-mute-button));
1924  --media-captions-button-display: var(--captions-button, var(--top-captions-button));
1925  --media-captions-menu-button-display: var(
1926    --captions-menu-button,
1927    var(--media-captions-button-display, var(--top-captions-menu-button))
1928  );
1929  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--top-rendition-menu-button));
1930  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--top-audio-track-menu-button));
1931  --media-airplay-button-display: var(--airplay-button, var(--top-airplay-button));
1932  --media-pip-button-display: var(--pip-button, var(--top-pip-button));
1933  --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button));
1934  --media-cast-button-display: var(--cast-button, var(--top-cast-button, var(--_cast-button-drm-display)));
1935  --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button));
1936  --media-playback-rate-menu-button-display: var(
1937    --captions-menu-button,
1938    var(--media-playback-rate-button-display, var(--top-playback-rate-menu-button))
1939  );
1940  --media-volume-range-display: var(--volume-range, var(--top-volume-range));
1941  --media-time-range-display: var(--time-range, var(--top-time-range));
1942  --media-time-display-display: var(--time-display, var(--top-time-display));
1943  --media-duration-display-display: var(--duration-display, var(--top-duration-display));
1944  --media-title-display-display: var(--title-display, var(--top-title-display));
1945}
1946
1947::part(center),
1948[part~='center'] {
1949  --media-control-display: var(--controls, var(--center-controls));
1950  --media-play-button-display: var(--play-button, var(--center-play-button));
1951  --media-live-button-display: var(--live-button, var(--center-live-button));
1952  --media-seek-backward-button-display: var(--seek-backward-button, var(--center-seek-backward-button));
1953  --media-seek-forward-button-display: var(--seek-forward-button, var(--center-seek-forward-button));
1954  --media-mute-button-display: var(--mute-button, var(--center-mute-button));
1955  --media-captions-button-display: var(--captions-button, var(--center-captions-button));
1956  --media-captions-menu-button-display: var(
1957    --captions-menu-button,
1958    var(--media-captions-button-display, var(--center-captions-menu-button))
1959  );
1960  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--center-rendition-menu-button));
1961  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--center-audio-track-menu-button));
1962  --media-airplay-button-display: var(--airplay-button, var(--center-airplay-button));
1963  --media-pip-button-display: var(--pip-button, var(--center-pip-button));
1964  --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button));
1965  --media-cast-button-display: var(--cast-button, var(--center-cast-button, var(--_cast-button-drm-display)));
1966  --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button));
1967  --media-playback-rate-menu-button-display: var(
1968    --playback-rate-menu-button,
1969    var(--media-playback-rate-button-display, var(--center-playback-rate-menu-button))
1970  );
1971  --media-volume-range-display: var(--volume-range, var(--center-volume-range));
1972  --media-time-range-display: var(--time-range, var(--center-time-range));
1973  --media-time-display-display: var(--time-display, var(--center-time-display));
1974  --media-duration-display-display: var(--duration-display, var(--center-duration-display));
1975}
1976
1977::part(bottom),
1978[part~='bottom'] {
1979  --media-control-display: var(--controls, var(--bottom-controls));
1980  --media-play-button-display: var(--play-button, var(--bottom-play-button));
1981  --media-live-button-display: var(--live-button, var(--bottom-live-button));
1982  --media-seek-backward-button-display: var(--seek-backward-button, var(--bottom-seek-backward-button));
1983  --media-seek-forward-button-display: var(--seek-forward-button, var(--bottom-seek-forward-button));
1984  --media-mute-button-display: var(--mute-button, var(--bottom-mute-button));
1985  --media-captions-button-display: var(--captions-button, var(--bottom-captions-button));
1986  --media-captions-menu-button-display: var(
1987    --captions-menu-button,
1988    var(--media-captions-button-display, var(--bottom-captions-menu-button))
1989  );
1990  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--bottom-rendition-menu-button));
1991  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--bottom-audio-track-menu-button));
1992  --media-airplay-button-display: var(--airplay-button, var(--bottom-airplay-button));
1993  --media-pip-button-display: var(--pip-button, var(--bottom-pip-button));
1994  --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button));
1995  --media-cast-button-display: var(--cast-button, var(--bottom-cast-button, var(--_cast-button-drm-display)));
1996  --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button));
1997  --media-playback-rate-menu-button-display: var(
1998    --playback-rate-menu-button,
1999    var(--media-playback-rate-button-display, var(--bottom-playback-rate-menu-button))
2000  );
2001  --media-volume-range-display: var(--volume-range, var(--bottom-volume-range));
2002  --media-time-range-display: var(--time-range, var(--bottom-time-range));
2003  --media-time-display-display: var(--time-display, var(--bottom-time-display));
2004  --media-duration-display-display: var(--duration-display, var(--bottom-duration-display));
2005  --media-title-display-display: var(--title-display, var(--bottom-title-display));
2006}
2007
2008:host([no-tooltips]) {
2009  --media-tooltip-display: none;
2010}
2011`,_a=new WeakMap,nP=class $b{constructor(e,t){this.element=e,this.type=t,this.element.addEventListener(this.type,this);let s=_a.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=_a.get(this.element);
vendor: 4,297 bytes, lines 2011-2036
2011t&&t.delete(this.type)}}static for(e){_a.has(e.element)||_a.set(e.element,new Map);let t=e.attributeName.slice(2),s=_a.get(e.element);return s&&s.has(t)?s.get(t):new $b(e.element,t)}};function aP(i,e){return i instanceof vi&&i.attributeName.startsWith("on")?(nP.for(i).set(e),i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),!0):!1}function oP(i,e){return e instanceof Bb&&i instanceof na?(e.renderInto(i),!0):!1}function lP(i,e){return e instanceof DocumentFragment&&i instanceof na?(e.childNodes.length&&i.replace(...e.childNodes),!0):!1}function dP(i,e){if(i instanceof vi){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 uP(i,e){if(i instanceof vi&&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 cP(i,e){if(typeof e=="boolean"&&i instanceof vi){let t=i.attributeNamespace,s=i.element.hasAttributeNS(t,i.attributeName);return e!==s&&(i.booleanValue=e),!0}return!1}function hP(i,e){return e===!1&&i instanceof na?(i.replace(""),!0):!1}function fP(i,e){uP(i,e)||cP(i,e)||aP(i,e)||hP(i,e)||oP(i,e)||lP(i,e)||dP(i,e)}var kc=new Map,z0=new WeakMap,Q0=new WeakMap,Bb=class{constructor(i,e,t){this.strings=i,this.values=e,this.processor=t,this.stringsKey=this.strings.join("�")}get template(){if(kc.has(this.stringsKey))return kc.get(this.stringsKey);{let i=lp.createElement("template"),e=this.strings.length-1;return i.innerHTML=this.strings.reduce((t,s,r)=>t+s+(r<e?`{{ ${r} }}`:""),""),kc.set(this.stringsKey,i),i}}renderInto(i){var e;let t=this.template;if(z0.get(i)!==t){z0.set(i,t);let r=new wu(t,this.values,this.processor);Q0.set(i,r),i instanceof na?i.replace(...r.children):i.appendChild(r);return}let s=Q0.get(i);(e=s==null?void 0:s.update)==null||e.call(s,this.values)}},mP={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:"";fP(n,a)}}}};function Sd(i,...e){return new Bb(i,e,mP)}function pP(i,e){i.renderInto(e)}var gP=i=>{let{tokens:e}=i;return e.drm?":host(:not([cast-receiver])) { --_cast-button-drm-display: none; }":""},vP=i=>Sd`
2012  <style>
2013    ${gP(i)}
2014    ${rP}
2015  </style>
2016  ${bP(i)}
2017`,EP=i=>{let e=i.hotKeys?`${i.hotKeys}`:"";return dp(i.streamType)==="live"&&(e+=" noarrowleft noarrowright"),e},yP={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"},TP=Object.values(yP).join(", "),bP=i=>{var e,t,s,r,n,a,o,l,d,u,c,h,f,m,p,g,v,T,y,_,I,x,L,A,R,S,k,O,G,V,B,K,J,F,ie;return Sd`
2018  <media-theme
2019    template="${i.themeTemplate||!1}"
2020    defaultstreamtype="${(e=i.defaultStreamType)!=null?e:!1}"
2021    hotkeys="${EP(i)||!1}"
2022    nohotkeys="${i.noHotKeys||!i.hasSrc||!1}"
2023    noautoseektolive="${!!((t=i.streamType)!=null&&t.includes(De.LIVE))&&i.targetLiveWindow!==0}"
2024    novolumepref="${i.novolumepref||!1}"
2025    disabled="${!i.hasSrc||i.isDialogOpen}"
2026    audio="${(s=i.audio)!=null?s:!1}"
2027    style="${(r=WM({"--media-primary-color":i.primaryColor,"--media-secondary-color":i.secondaryColor,"--media-accent-color":i.accentColor}))!=null?r:!1}"
2028    defaultsubtitles="${!i.defaultHiddenCaptions}"
2029    forwardseekoffset="${(n=i.forwardSeekOffset)!=null?n:!1}"
2030    backwardseekoffset="${(a=i.backwardSeekOffset)!=null?a:!1}"
2031    playbackrates="${(o=i.playbackRates)!=null?o:!1}"
2032    defaultshowremainingtime="${(l=i.defaultShowRemainingTime)!=null?l:!1}"
2033    defaultduration="${(d=i.defaultDuration)!=null?d:!1}"
2034    hideduration="${(u=i.hideDuration)!=null?u:!1}"
2035    title="${(c=i.title)!=null?c:!1}"
2036    videotitle="${(h=i.videoTitle)!=null?h:!1}
2036"
2037    proudlydisplaymuxbadge="${(f=i.proudlyDisplayMuxBadge)!=null?f:!1}"
2038    exportparts="${TP}"
2039    onclose="${i.onCloseErrorDialog}"
2040    onfocusin="${i.onFocusInErrorDialog}"
2041  >
2042    <mux-video
2043      slot="media"
2044      target-live-window="${(m=i.targetLiveWindow)!=null?m:!1}"
2045      stream-type="${(p=dp(i.streamType))!=null?p:!1}"
2046      crossorigin="${(g=i.crossOrigin)!=null?g:""}"
2047      playsinline
2048      autoplay="${(v=i.autoplay)!=null?v:!1}"
2049      muted="${(T=i.muted)!=null?T:!1}"
2050      loop="${(y=i.loop)!=null?y:!1}"
2051      preload="${(_=i.preload)!=null?_:!1}"
2052      debug="${(I=i.debug)!=null?I:!1}"
2053      prefer-cmcd="${(x=i.preferCmcd)!=null?x:!1}"
2054      disable-tracking="${(L=i.disableTracking)!=null?L:!1}"
2055      disable-cookies="${(A=i.disableCookies)!=null?A:!1}"
2056      prefer-playback="${(R=i.preferPlayback)!=null?R:!1}"
2057      start-time="${i.startTime!=null?i.startTime:!1}"
2058      beacon-collection-domain="${(S=i.beaconCollectionDomain)!=null?S:!1}"
2059      player-init-time="${(k=i.playerInitTime)!=null?k:!1}"
2060      player-software-name="${(O=i.playerSoftwareName)!=null?O:!1}"
2061      player-software-version="${(G=i.playerSoftwareVersion)!=null?G:!1}"
2062      env-key="${(V=i.envKey)!=null?V:!1}"
2063      custom-domain="${(B=i.customDomain)!=null?B:!1}"
2064      src="${i.src?i.src:i.playbackId?rh(i):!1}"
2065      cast-src="${i.src?i.src:i.playbackId?rh(i):!1}"
2066      cast-receiver="${(K=i.castReceiver)!=null?K:!1}"
2067      drm-token="${(F=(J=i.tokens)==null?void 0:J.drm)!=null?F:!1}"
2068      exportparts="video"
2069    >
2070      ${i.storyboard?Sd`<track label="thumbnails" default kind="metadata" src="${i.storyboard}" />`:Sd``}
2071      <slot></slot>
2072    </mux-video>
2073    <slot name="poster" slot="poster">
2074      <media-poster-image
2075        part="poster"
2076        exportparts="poster, img"
2077        src="${i.poster?i.poster:!1}"
2078        placeholdersrc="${(ie=i.placeholder)!=null?ie:!1}"
2079      ></media-poster-image>
2080    </slot>
2081  </media-theme>
2082`},Hb=i=>i.charAt(0).toUpperCase()+i.slice(1),_P=(i,e=!1)=>{var t,s;if(i.muxCode){let r=Hb((t=i.errorCategory)!=null?t:"video"),n=gu((s=i.errorCategory)!=null?s:He.VIDEO);if(i.muxCode===ne.NETWORK_OFFLINE)return se("Your device appears to be offline",e);if(i.muxCode===ne.NETWORK_TOKEN_EXPIRED)return se("{category} URL has expired",e).format({category:r});if([ne.NETWORK_TOKEN_SUB_MISMATCH,ne.NETWORK_TOKEN_AUD_MISMATCH,ne.NETWORK_TOKEN_AUD_MISSING,ne.NETWORK_TOKEN_MALFORMED].includes(i.muxCode))return se("{category} URL is formatted incorrectly",e).format({category:r});if(i.muxCode===ne.NETWORK_TOKEN_MISSING)return se("Invalid {categoryName} URL",e).format({categoryName:n});if(i.muxCode===ne.NETWORK_NOT_FOUND)return se("{category} does not exist",e).format({category:r});if(i.muxCode===ne.NETWORK_NOT_READY){let a=i.streamType==="live"?"Live stream":"Video";return se("{mediaType} is not currently available",e).format({mediaType:a})}}if(i.code){if(i.code===Y.MEDIA_ERR_NETWORK)return se("Network Error",e);if(i.code===Y.MEDIA_ERR_DECODE)return se("Media Error",e);if(i.code===Y.MEDIA_ERR_SRC_NOT_SUPPORTED)return se("Source Not Supported",e)}return se("Error",e)},AP=(i,e=!1)=>{var t,s;if(i.muxCode){let r=Hb((t=i.errorCategory)!=null?t:"video"),n=gu((s=i.errorCategory)!=null?s:He.VIDEO);return i.muxCode===ne.NETWORK_OFFLINE?se("Check your internet connection and try reloading this video.",e):i.muxCode===ne.NETWORK_TOKEN_EXPIRED?se("The video’s secured {tokenNamePrefix}-token has expired.",e).format({tokenNamePrefix:n}):i.muxCode===ne.NETWORK_TOKEN_SUB_MISMATCH?se("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",e).format({tokenNamePrefix:n}):i.muxCode===ne.NETWORK_TOKEN_MALFORMED?se("{category} URL is formatted incorrectly",e).format({category:r}):[ne.NETWORK_TOKEN_AUD_MISMATCH,ne.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode)?se("The {tokenNamePrefix}-token is formatted with incorrect information.",e).format({tokenNamePrefix:n}):[ne.NETWORK_TOKEN_MISSING,ne.NETWORK_INVALID_URL].includes(i.muxCode)?se("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",e).format({tokenNamePrefix:n}):i.muxCode===ne.NETWORK_NOT_FOUND?"":i.message}return i.code&&(i.code===Y.MEDIA_ERR_NETWORK||i.code===Y.MEDIA_ERR_DECODE||(i.code,Y.MEDIA_ERR_SRC_NOT_SUPPORTED)),i.message},SP=(i,e=!1)=>{let t=_P(i,e).toString(),s=AP(i,e).toString();return{title:t,message:s}},IP=i=>{if(i.muxCode){if(i.muxCode===ne.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(i.muxCode===ne.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([ne.NETWORK_TOKEN_AUD_MISMATCH,ne.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode))return"403-incorrect-aud-value.md";if(i.muxCode===ne.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(i.muxCode===ne.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(i.muxCode===ne.NETWORK_NOT_FOUND)return"404-not-found.md";if(i.muxCode===ne.NETWORK_NOT_READY)return"412-not-playable.md"}if(i.code){if(i.code===Y.MEDIA_ERR_NETWORK)return"";if(i.code===Y.MEDIA_ERR_DECODE)return"media-decode-error.md";if(i.code===Y.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},X0=(i,e)=>{let t=IP(i);return{message:i.message,context:i.context,file:t}},LP=`<template id="media-theme-gerwig">
2083  <style>
2084    @keyframes pre-play-hide {
2085      0% {
2086        transform: scale(1);
2087        opacity: 1;
2088      }
2089
2090      30% {
2091        transform: scale(0.7);
2092      }
2093
2094      100% {
2095        transform: scale(1.5);
2096        opacity: 0;
2097      }
2098    }
2099
2100    :host {
2101      --_primary-color: var(--media-primary-color, #fff);
2102      --_secondary-color: var(--media-secondary-color, transparent);
2103      --_accent-color: var(--media-accent-color, #fa50b5);
2104      --_text-color: var(--media-text-color, #000);
2105
2106      --media-icon-color: var(--_primary-color);
2107      --media-control-background: var(--_secondary-color);
2108      --media-control-hover-background: var(--_accent-color);
2109      --media-time-buffered-color: rgba(255, 255, 255, 0.4);
2110      --media-preview-time-text-shadow: none;
2111      --media-control-height: 14px;
2112      --media-control-padding: 6px;
2113      --media-tooltip-container-margin: 6px;
2114      --media-tooltip-distance: 18px;
2115
2116      color: var(--_primary-color);
2117      display: inline-block;
2118      width: 100%;
2119      height: 100%;
2120    }
2121
2122    :host([audio]) {
2123      --_secondary-color: var(--media-secondary-color, black);
2124      --media-preview-time-text-shadow: none;
2125    }
2126
2127    :host([audio]) ::slotted([slot='media']) {
2128      height: 0px;
2129    }
2130
2131    :host([audio]) media-loading-indicator {
2132      display: none;
2133    }
2134
2135    :host([audio]) media-controller {
2136      background: transparent;
2137    }
2138
2139    :host([audio]) media-controller::part(vertical-layer) {
2140      background: transparent;
2141    }
2142
2143    :host([audio]) media-control-bar {
2144      width: 100%;
2145      background-color: var(--media-control-background);
2146    }
2147
2148    /*
2149     * 0.433s is the transition duration for VTT Regions.
2150     * Borrowed here, so the captions don't move too fast.
2151     */
2152    media-controller {
2153      --media-webkit-text-track-transform: translateY(0) scale(0.98);
2154      --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s;
2155    }
2156    media-controller:is([mediapaused], :not([userinactive])) {
2157      --media-webkit-text-track-transform: translateY(-50px) scale(0.98);
2158      --media-webkit-text-track-transition: transform 0.15s ease;
2159    }
2160
2161    /*
2162     * CSS specific to iOS devices.
2163     * See: https://stackoverflow.com/questions/30102792/css-media-query-to-target-only-ios-devices/60220757#60220757
2164     */
2165    @supports (-webkit-touch-callout: none) {
2166      /* Disable subtitle adjusting for iOS Safari */
2167      media-controller[mediaisfullscreen] {
2168        --media-webkit-text-track-transform: unset;
2169        --media-webkit-text-track-transition: unset;
2170      }
2171    }
2172
2173    media-time-range {
2174      --media-box-padding-left: 6px;
2175      --media-box-padding-right: 6px;
2176      --media-range-bar-color: var(--_accent-color);
2177      --media-time-range-buffered-color: var(--_primary-color);
2178      --media-range-track-color: transparent;
2179      --media-range-track-background: rgba(255, 255, 255, 0.4);
2180      --media-range-thumb-background: radial-gradient(
2181        circle,
2182        #000 0%,
2183        #000 25%,
2184        var(--_accent-color) 25%,
2185        var(--_accent-color)
2186      );
2187      --media-range-thumb-width: 12px;
2188      --media-range-thumb-height: 12px;
2189      --media-range-thumb-transform: scale(0);
2190      --media-range-thumb-transition: transform 0.3s;
2191      --media-range-thumb-opacity: 1;
2192      --media-preview-background: var(--_primary-color);
2193      --media-box-arrow-background: var(--_primary-color);
2194      --media-preview-thumbnail-border: 5px solid var(--_primary-color);
2195      --media-preview-border-radius: 5px;
2196      --media-text-color: var(--_text-color);
2197      --media-control-hover-background: transparent;
2198      --media-preview-chapter-text-shadow: none;
2199      color: var(--_accent-color);
2200      padding: 0 6px;
2201    }
2202
2203    :host([audio]) media-time-range {
2204      --media-preview-time-padding: 1.5px 6px;
2205      --media-preview-box-margin: 0 0 -5px;
2206    }
2207
2208    media-time-range:hover {
2209      --media-range-thumb-transform: scale(1);
2210    }
2211
2212    media-preview-thumbnail {
2213      border-bottom-width: 0;
2214    }
2215
2216    [part~='menu'] {
2217      border-radius: 2px;
2218      border: 1px solid rgba(0, 0, 0, 0.1);
2219      bottom: 50px;
2220      padding: 2.5px 10px;
2221    }
2222
2223    [part~='menu']::part(indicator) {
2224      fill: var(--_accent-color);
2225    }
2226
2227    [part~='menu']::part(menu-item) {
2228      box-sizing: border-box;
2229      display: flex;
2230      align-items: center;
2231      padding: 6px 10px;
2232      min-height: 34px;
2233    }
2234
2235    [part~='menu']::part(checked) {
2236      font-weight: 700;
2237    }
2238
2239    media-captions-menu,
2240    media-rendition-menu,
2241    media-audio-track-menu,
2242    media-playback-rate-menu {
2243      position: absolute; /* ensure they don't take up space in DOM on load */
2244      --media-menu-background: var(--_primary-color);
2245      --media-menu-item-checked-background: transparent;
2246      --media-text-color: var(--_text-color);
2247      --media-menu-item-hover-background: transparent;
2248      --media-menu-item-hover-outline: var(--_accent-color) solid 1px;
2249    }
2250
2251    media-rendition-menu {
2252      min-width: 140px;
2253    }
2254
2255    /* The icon is a circle so make it 16px high instead of 14px for more balance. */
2256    media-audio-track-menu-button {
2257      --media-control-padding: 5px;
2258      --media-control-height: 16px;
2259    }
2260
2261    media-playback-rate-menu-button {
2262      --media-control-padding: 6px 3px;
2263      min-width: 4.4ch;
2264    }
2265
2266    media-playback-rate-menu {
2267      --media-menu-flex-direction: row;
2268      --media-menu-item-checked-background: var(--_accent-color);
2269      --media-menu-item-checked-indicator-display: none;
2270      margin-right: 6px;
2271      padding: 0;
2272      --media-menu-gap: 0.25em;
2273    }
2274
2275    media-playback-rate-menu[part~='menu']::part(menu-item) {
2276      padding: 6px 6px 6px 8px;
2277    }
2278
2279    media-playback-rate-menu[part~='menu']::part(checked) {
2280      color: #fff;
2281    }
2282
2283    :host(:not([audio])) media-time-range {
2284      /* Adding px is required here for calc() */
2285      --media-range-padding: 0px;
2286      background: transparent;
2287      z-index: 10;
2288      height: 10px;
2289      bottom: -3px;
2290      width: 100%;
2291    }
2292
2293    media-control-bar :is([role='button'], [role='switch'], button) {
2294      line-height: 0;
2295    }
2296
2297    media-control-bar :is([part*='button'], [part*='range'], [part*='display']) {
2298      border-radius: 3px;
2299    }
2300
2301    .spacer {
2302      flex-grow: 1;
2303      background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
2304    }
2305
2306    media-control-bar[slot~='top-chrome'] {
2307      min-height: 42px;
2308      pointer-events: none;
2309    }
2310
2311    media-control-bar {
2312      --gradient-steps:
2313        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%,
2314        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%,
2315        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%,
2316        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%;
2317    }
2318
2319    :host([title]:not([audio])) media-control-bar[slot='top-chrome']::before {
2320      content: '';
2321      position: absolute;
2322      width: 100%;
2323      padding-bottom: min(100px, 25%);
2324      background: linear-gradient(to top, var(--gradient-steps));
2325      opacity: 0.8;
2326      pointer-events: none;
2327    }
2328
2329    :host(:not([audio])) media-control-bar[part~='bottom']::before {
2330      content: '';
2331      position: absolute;
2332      width: 100%;
2333      bottom: 0;
2334      left: 0;
2335      padding-bottom: min(100px, 25%);
2336      background: linear-gradient(to bottom, var(--gradient-steps));
2337      opacity: 0.8;
2338      z-index: 1;
2339      pointer-events: none;
2340    }
2341
2342    media-control-bar[part~='bottom'] > * {
2343      z-index: 20;
2344    }
2345
2346    media-control-bar[part~='bottom'] {
2347      padding: 6px 6px;
2348    }
2349
2350    media-control-bar[slot~='top-chrome'] > * {
2351      --media-control-background: transparent;
2352      --media-control-hover-background: transparent;
2353      position: relative;
2354    }
2355
2356    media-controller::part(vertical-layer) {
2357      transition: background-color 1s;
2358    }
2359
2360    media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) {
2361      background-color: var(--controls-backdrop-color, var(--controls, transparent));
2362      transition: background-color 0.25s;
2363    }
2364
2365    .center-controls {
2366      --media-button-icon-width: 100%;
2367      --media-button-icon-height: auto;
2368      --media-tooltip-display: none;
2369      pointer-events: none;
2370      width: 100%;
2371      display: flex;
2372      flex-flow: row;
2373      align-items: center;
2374      justify-content: center;
2375      filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25));
2376      paint-order: stroke;
2377      stroke: rgba(102, 102, 102, 1);
2378      stroke-width: 0.3px;
2379      text-shadow:
2380        0 0 2px rgb(0 0 0 / 0.25),
2381        0 0 6px rgb(0 0 0 / 0.25);
2382    }
2383
2384    .center-controls media-play-button {
2385      --media-control-background: transparent;
2386      --media-control-hover-background: transparent;
2387      --media-control-padding: 0;
2388      width: 40px;
2389    }
2390
2391    [breakpointsm] .center-controls media-play-button {
2392      width: 90px;
2393      height: 90px;
2394      border-radius: 50%;
2395      transition: background 0.4s;
2396      padding: 24px;
2397      --media-control-background: #000;
2398      --media-control-hover-background: var(--_accent-color);
2399    }
2400
2401    .center-controls media-seek-backward-button,
2402    .center-controls media-seek-forward-button {
2403      --media-control-background: transparent;
2404      --media-control-hover-background: transparent;
2405      padding: 0;
2406      margin: 0 20px;
2407      width: max(33px, min(8%, 40px)
vendor: 26,664 bytes, lines 2407-2971
2407);
2408    }
2409
2410    [breakpointsm]:not([audio]) .center-controls.pre-playback {
2411      display: grid;
2412      align-items: initial;
2413      justify-content: initial;
2414      height: 100%;
2415      overflow: hidden;
2416    }
2417
2418    [breakpointsm]:not([audio]) .center-controls.pre-playback media-play-button {
2419      place-self: var(--_pre-playback-place, center);
2420      grid-area: 1 / 1;
2421      margin: 16px;
2422    }
2423
2424    /* Show and hide controls or pre-playback state */
2425
2426    [breakpointsm]:is([mediahasplayed], :not([mediapaused])):not([audio])
2427      .center-controls.pre-playback
2428      media-play-button {
2429      /* Using \`forwards\` would lead to a laggy UI after the animation got in the end state */
2430      animation: 0.3s linear pre-play-hide;
2431      opacity: 0;
2432      pointer-events: none;
2433    }
2434
2435    .autoplay-unmute {
2436      --media-control-hover-background: transparent;
2437      width: 100%;
2438      display: flex;
2439      align-items: center;
2440      justify-content: center;
2441      filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25));
2442    }
2443
2444    .autoplay-unmute-btn {
2445      --media-control-height: 16px;
2446      border-radius: 8px;
2447      background: #000;
2448      color: var(--_primary-color);
2449      display: flex;
2450      align-items: center;
2451      padding: 8px 16px;
2452      font-size: 18px;
2453      font-weight: 500;
2454      cursor: pointer;
2455    }
2456
2457    .autoplay-unmute-btn:hover {
2458      background: var(--_accent-color);
2459    }
2460
2461    [breakpointsm] .autoplay-unmute-btn {
2462      --media-control-height: 30px;
2463      padding: 14px 24px;
2464      font-size: 26px;
2465    }
2466
2467    .autoplay-unmute-btn svg {
2468      margin: 0 6px 0 0;
2469    }
2470
2471    [breakpointsm] .autoplay-unmute-btn svg {
2472      margin: 0 10px 0 0;
2473    }
2474
2475    media-controller:not([audio]):not([mediahasplayed]) *:is(media-control-bar, media-time-range) {
2476      display: none;
2477    }
2478
2479    media-error-dialog:not([mediaerrorcode]) {
2480      opacity: 0;
2481    }
2482
2483    media-loading-indicator {
2484      --media-loading-icon-width: 100%;
2485      --media-button-icon-height: auto;
2486      display: var(--media-control-display, var(--media-loading-indicator-display, flex));
2487      pointer-events: none;
2488      position: absolute;
2489      width: min(15%, 150px);
2490      flex-flow: row;
2491      align-items: center;
2492      justify-content: center;
2493    }
2494
2495    /* Intentionally don't target the div for transition but the children
2496     of the div. Prevents messing with media-chrome's autohide feature. */
2497    media-loading-indicator + div * {
2498      transition: opacity 0.15s;
2499      opacity: 1;
2500    }
2501
2502    media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * {
2503      opacity: 0;
2504      transition-delay: 400ms;
2505    }
2506
2507    media-volume-range {
2508      width: min(100%, 100px);
2509      --media-range-padding-left: 10px;
2510      --media-range-padding-right: 10px;
2511      --media-range-thumb-width: 12px;
2512      --media-range-thumb-height: 12px;
2513      --media-range-thumb-background: radial-gradient(
2514        circle,
2515        #000 0%,
2516        #000 25%,
2517        var(--_primary-color) 25%,
2518        var(--_primary-color)
2519      );
2520      --media-control-hover-background: none;
2521    }
2522
2523    media-time-display {
2524      white-space: nowrap;
2525    }
2526
2527    /* Generic style for explicitly disabled controls */
2528    media-control-bar[part~='bottom'] [disabled],
2529    media-control-bar[part~='bottom'] [aria-disabled='true'] {
2530      opacity: 60%;
2531      cursor: not-allowed;
2532    }
2533
2534    media-text-display {
2535      --media-font-size: 16px;
2536      --media-control-padding: 14px;
2537      font-weight: 500;
2538    }
2539
2540    media-play-button.animated *:is(g, path) {
2541      transition: all 0.3s;
2542    }
2543
2544    media-play-button.animated[mediapaused] .pause-icon-pt1 {
2545      opacity: 0;
2546    }
2547
2548    media-play-button.animated[mediapaused] .pause-icon-pt2 {
2549      transform-origin: center center;
2550      transform: scaleY(0);
2551    }
2552
2553    media-play-button.animated[mediapaused] .play-icon {
2554      clip-path: inset(0 0 0 0);
2555    }
2556
2557    media-play-button.animated:not([mediapaused]) .play-icon {
2558      clip-path: inset(0 0 0 100%);
2559    }
2560
2561    media-seek-forward-button,
2562    media-seek-backward-button {
2563      --media-font-weight: 400;
2564    }
2565
2566    .mute-icon {
2567      display: inline-block;
2568    }
2569
2570    .mute-icon :is(path, g) {
2571      transition: opacity 0.5s;
2572    }
2573
2574    .muted {
2575      opacity: 0;
2576    }
2577
2578    media-mute-button[mediavolumelevel='low'] :is(.volume-medium, .volume-high),
2579    media-mute-button[mediavolumelevel='medium'] :is(.volume-high) {
2580      opacity: 0;
2581    }
2582
2583    media-mute-button[mediavolumelevel='off'] .unmuted {
2584      opacity: 0;
2585    }
2586
2587    media-mute-button[mediavolumelevel='off'] .muted {
2588      opacity: 1;
2589    }
2590
2591    /**
2592     * Our defaults for these buttons are to hide them at small sizes
2593     * users can override this with CSS
2594     */
2595    media-controller:not([breakpointsm]):not([audio]) {
2596      --bottom-play-button: none;
2597      --bottom-seek-backward-button: none;
2598      --bottom-seek-forward-button: none;
2599      --bottom-time-display: none;
2600      --bottom-playback-rate-menu-button: none;
2601      --bottom-pip-button: none;
2602    }
2603
2604    [part='mux-badge'] {
2605      position: absolute;
2606      bottom: 10px;
2607      right: 10px;
2608      z-index: 2;
2609      opacity: 0.6;
2610      transition:
2611        opacity 0.2s ease-in-out,
2612        bottom 0.2s ease-in-out;
2613    }
2614
2615    [part='mux-badge']:hover {
2616      opacity: 1;
2617    }
2618
2619    [part='mux-badge'] a {
2620      font-size: 14px;
2621      font-family: var(--_font-family);
2622      color: var(--_primary-color);
2623      text-decoration: none;
2624      display: flex;
2625      align-items: center;
2626      gap: 5px;
2627    }
2628
2629    [part='mux-badge'] .mux-badge-text {
2630      transition: opacity 0.5s ease-in-out;
2631      opacity: 0;
2632    }
2633
2634    [part='mux-badge'] .mux-badge-logo {
2635      width: 40px;
2636      height: auto;
2637      display: inline-block;
2638    }
2639
2640    [part='mux-badge'] .mux-badge-logo svg {
2641      width: 100%;
2642      height: 100%;
2643      fill: white;
2644    }
2645
2646    media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'],
2647    media-controller:not([userinactive]) [part='mux-badge'],
2648    media-controller[mediahasplayed][mediapaused] [part='mux-badge'] {
2649      transition: bottom 0.1s ease-in-out;
2650    }
2651
2652    media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] {
2653      transition: bottom 0.2s ease-in-out 0.62s;
2654    }
2655
2656    media-controller:not([userinactive]) [part='mux-badge'] .mux-badge-text,
2657    media-controller[mediahasplayed][mediapaused] [part='mux-badge'] .mux-badge-text {
2658      opacity: 1;
2659    }
2660
2661    media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] .mux-badge-text {
2662      opacity: 0;
2663    }
2664
2665    media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] {
2666      bottom: 10px;
2667    }
2668
2669    media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'] {
2670      bottom: 10px;
2671    }
2672
2673    media-controller:not([userinactive])[mediahasplayed] [part='mux-badge'],
2674    media-controller[mediahasplayed][mediapaused] [part='mux-badge'] {
2675      bottom: calc(28px + var(--media-control-height, 0px) + var(--media-control-padding, 0px) * 2);
2676    }
2677  </style>
2678
2679  <template partial="TitleDisplay">
2680    <template if="videotitle">
2681      <template if="videotitle != true">
2682        <media-text-display part="top title display" class="title-display">{{videotitle}}</media-text-display>
2683      </template>
2684    </template>
2685    <template if="!videotitle">
2686      <template if="title">
2687        <media-text-display part="top title display" class="title-display">{{title}}</media-text-display>
2688      </template>
2689    </template>
2690  </template>
2691
2692  <template partial="PlayButton">
2693    <media-play-button
2694      part="{{section ?? 'bottom'}} play button"
2695      disabled="{{disabled}}"
2696      aria-disabled="{{disabled}}"
2697      class="animated"
2698    >
2699      <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon">
2700        <g class="play-icon">
2701          <path
2702            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"
2703          />
2704        </g>
2705        <g class="pause-icon">
2706          <path
2707            class="pause-icon-pt1"
2708            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"
2709          />
2710          <path
2711            class="pause-icon-pt2"
2712            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"
2713          />
2714        </g>
2715      </svg>
2716    </media-play-button>
2717  </template>
2718
2719  <template partial="PrePlayButton">
2720    <media-play-button
2721      part="{{section ?? 'center'}} play button pre-play"
2722      disabled="{{disabled}}"
2723      aria-disabled="{{disabled}}"
2724    >
2725      <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon" style="transform: translate(3px, 0)">
2726        <path
2727          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"
2728        />
2729      </svg>
2730    </media-play-button>
2731  </template>
2732
2733  <template partial="SeekBackwardButton">
2734    <media-seek-backward-button
2735      seekoffset="{{backwardseekoffset}}"
2736      part="{{section ?? 'bottom'}} seek-backward button"
2737      disabled="{{disabled}}"
2738      aria-disabled="{{disabled}}"
2739    >
2740      <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon">
2741        <path
2742          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"
2743        />
2744        <text transform="translate(6 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'">
2745          {{backwardseekoffset}}
2746        </text>
2747      </svg>
2748    </media-seek-backward-button>
2749  </template>
2750
2751  <template partial="SeekForwardButton">
2752    <media-seek-forward-button
2753      seekoffset="{{forwardseekoffset}}"
2754      part="{{section ?? 'bottom'}} seek-forward button"
2755      disabled="{{disabled}}"
2756      aria-disabled="{{disabled}}"
2757    >
2758      <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon">
2759        <g>
2760          <text transform="translate(-1 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'">
2761            {{forwardseekoffset}}
2762          </text>
2763          <path
2764            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"
2765          />
2766        </g>
2767      </svg>
2768    </media-seek-forward-button>
2769  </template>
2770
2771  <template partial="MuteButton">
2772    <media-mute-button part="bottom mute button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
2773      <svg viewBox="0 0 18 14" slot="icon" class="mute-icon" aria-hidden="true">
2774        <g class="unmuted">
2775          <path
2776            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"
2777          />
2778          <path
2779            class="volume-low"
2780            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"
2781          />
2782          <path
2783            class="volume-medium"
2784            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"
2785          />
2786          <path
2787            class="volume-high"
2788            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"
2789          />
2790        </g>
2791        <g class="muted">
2792          <path
2793            fill-rule="evenodd"
2794            clip-rule="evenodd"
2795            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"
2796          />
2797          <path
2798            fill-rule="evenodd"
2799            clip-rule="evenodd"
2800            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"
2801          />
2802        </g>
2803      </svg>
2804    </media-mute-button>
2805  </template>
2806
2807  <template partial="PipButton">
2808    <media-pip-button part="bottom pip button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
2809      <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon">
2810        <path
2811          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"
2812        />
2813        <path
2814          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"
2815        />
2816      </svg>
2817    </media-pip-button>
2818  </template>
2819
2820  <template partial="CaptionsMenu">
2821    <media-captions-menu-button part="bottom captions button">
2822      <svg aria-hidden="true" viewBox="0 0 18 14" slot="on">
2823        <path
2824          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"
2825        />
2826      </svg>
2827      <svg aria-hidden="true" viewBox="0 0 18 14" slot="off">
2828        <path
2829          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"
2830        />
2831        <path
2832          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"
2833        />
2834        <path
2835          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"
2836        />
2837      </svg>
2838    </media-captions-menu-button>
2839    <media-captions-menu
2840      hidden
2841      anchor="auto"
2842      part="bottom captions menu"
2843      disabled="{{disabled}}"
2844      aria-disabled="{{disabled}}"
2845      exportparts="menu-item"
2846    >
2847      <div slot="checked-indicator">
2848        <style>
2849          .indicator {
2850            position: relative;
2851            top: 1px;
2852            width: 0.9em;
2853            height: auto;
2854            fill: var(--_accent-color);
2855            margin-right: 5px;
2856          }
2857
2858          [aria-checked='false'] .indicator {
2859            display: none;
2860          }
2861        </style>
2862        <svg viewBox="0 0 14 18" class="indicator">
2863          <path
2864            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"
2865            fill-rule="evenodd"
2866          />
2867        </svg></div
2868    ></media-captions-menu>
2869  </template>
2870
2871  <template partial="AirplayButton">
2872    <media-airplay-button part="bottom airplay button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
2873      <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon">
2874        <path
2875          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"
2876        />
2877        <path
2878          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"
2879        />
2880      </svg>
2881    </media-airplay-button>
2882  </template>
2883
2884  <template partial="FullscreenButton">
2885    <media-fullscreen-button part="bottom fullscreen button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
2886      <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter">
2887        <path
2888          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"
2889        />
2890        <path
2891          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"
2892        />
2893        <path
2894          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"
2895        />
2896        <path
2897          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"
2898        />
2899      </svg>
2900      <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit">
2901        <path
2902          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"
2903        />
2904        <path
2905          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"
2906        />
2907        <path
2908          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"
2909        />
2910        <path
2911          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"
2912        />
2913      </svg>
2914    </media-fullscreen-button>
2915  </template>
2916
2917  <template partial="CastButton">
2918    <media-cast-button part="bottom cast button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
2919      <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter">
2920        <path
2921          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"
2922        />
2923      </svg>
2924      <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit">
2925        <path
2926          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"
2927        />
2928        <path d="M2.15002 5.634C5.18352 6.4207 7.57252 8.8151 8.35282 11.8499H15.8501V2.1499H2.15002V5.634Z" />
2929      </svg>
2930    </media-cast-button>
2931  </template>
2932
2933  <template partial="LiveButton">
2934    <media-live-button part="{{section ?? 'top'}} live button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
2935      <span slot="text">Live</span>
2936    </media-live-button>
2937  </template>
2938
2939  <template partial="PlaybackRateMenu">
2940    <media-playback-rate-menu-button part="bottom playback-rate button"></media-playback-rate-menu-button>
2941    <media-playback-rate-menu
2942      hidden
2943      anchor="auto"
2944      rates="{{playbackrates}}"
2945      exportparts="menu-item"
2946      part="bottom playback-rate menu"
2947      disabled="{{disabled}}"
2948      aria-disabled="{{disabled}}"
2949    ></media-playback-rate-menu>
2950  </template>
2951
2952  <template partial="VolumeRange">
2953    <media-volume-range
2954      part="bottom volume range"
2955      disabled="{{disabled}}"
2956      aria-disabled="{{disabled}}"
2957    ></media-volume-range>
2958  </template>
2959
2960  <template partial="TimeDisplay">
2961    <media-time-display
2962      remaining="{{defaultshowremainingtime}}"
2963      showduration="{{!hideduration}}"
2964      part="bottom time display"
2965      disabled="{{disabled}}"
2966      aria-disabled="{{disabled}}"
2967    ></media-time-display>
2968  </template>
2969
2970  <template partial="TimeRange">
2971    <media-time-range part="bottom time range" disabled="{{disabled}}" aria-disabled="{{disabled}}"
2971>
2972      <media-preview-thumbnail slot="preview"></media-preview-thumbnail>
2973      <media-preview-chapter-display slot="preview"></media-preview-chapter-display>
2974      <media-preview-time-display slot="preview"></media-preview-time-display>
2975      <div slot="preview" part="arrow"></div>
2976    </media-time-range>
2977  </template>
2978
2979  <template partial="AudioTrackMenu">
2980    <media-audio-track-menu-button part="bottom audio-track button">
2981      <svg aria-hidden="true" slot="icon" viewBox="0 0 18 16">
2982        <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" />
2983        <path
2984          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"
2985        />
2986      </svg>
2987    </media-audio-track-menu-button>
2988    <media-audio-track-menu
2989      hidden
2990      anchor="auto"
2991      part="bottom audio-track menu"
2992      disabled="{{disabled}}"
2993      aria-disabled="{{disabled}}"
2994      exportparts="menu-item"
2995    >
2996      <div slot="checked-indicator">
2997        <style>
2998          .indicator {
2999            position: relative;
3000            top: 1px;
3001            width: 0.9em;
3002            height: auto;
3003            fill: var(--_accent-color);
3004            margin-right: 5px;
3005          }
3006
3007          [aria-checked='false'] .indicator {
3008            display: none;
3009          }
3010        </style>
3011        <svg viewBox="0 0 14 18" class="indicator">
3012          <path
3013            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"
3014            fill-rule="evenodd"
3015          />
3016        </svg>
3017      </div>
3018    </media-audio-track-menu>
3019  </template>
3020
3021  <template partial="RenditionMenu">
3022    <media-rendition-menu-button part="bottom rendition button">
3023      <svg aria-hidden="true" slot="icon" viewBox="0 0 18 14">
3024        <path
3025          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"
3026        />
3027      </svg>
3028    </media-rendition-menu-button>
3029    <media-rendition-menu
3030      hidden
3031      anchor="auto"
3032      part="bottom rendition menu"
3033      disabled="{{disabled}}"
3034      aria-disabled="{{disabled}}"
3035    >
3036      <div slot="checked-indicator">
3037        <style>
3038          .indicator {
3039            position: relative;
3040            top: 1px;
3041            width: 0.9em;
3042            height: auto;
3043            fill: var(--_accent-color);
3044            margin-right: 5px;
3045          }
3046
3047          [aria-checked='false'] .indicator {
3048            opacity: 0;
3049          }
3050        </style>
3051        <svg viewBox="0 0 14 18" class="indicator">
3052          <path
3053            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"
3054            fill-rule="evenodd"
3055          />
3056        </svg>
3057      </div>
3058    </media-rendition-menu>
3059  </template>
3060
3061  <template partial="MuxBadge">
3062    <div part="mux-badge">
3063      <a href="https://www.mux.com/player" target="_blank">
3064        <span class="mux-badge-text">Powered by</span>
3065        <div class="mux-badge-logo">
3066          <svg
3067            viewBox="0 0 1600 500"
3068            style="fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 2"
3069          >
3070            <g>
3071              <path
3072                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"
3073                style="fill-rule: nonzero"
3074              ></path>
3075              <path
3076                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"
3077                style="fill-rule: nonzero"
3078              ></path>
3079              <path
3080                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"
3081                style="fill-rule: nonzero"
3082              ></path>
3083            </g>
3084          </svg>
3085        </div>
3086      </a>
3087    </div>
3088  </template>
3089
3090  <media-controller
3091    part="controller"
3092    defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}"
3093    breakpoints="sm:470"
3094    gesturesdisabled="{{disabled}}"
3095    hotkeys="{{hotkeys}}"
3096    nohotkeys="{{nohotkeys}}"
3097    novolumepref="{{novolumepref}}"
3098    audio="{{audio}}"
3099    noautoseektolive="{{noautoseektolive}}"
3100    defaultsubtitles="{{defaultsubtitles}}"
3101    defaultduration="{{defaultduration ?? false}}"
3102    keyboardforwardseekoffset="{{forwardseekoffset}}"
3103    keyboardbackwardseekoffset="{{backwardseekoffset}}"
3104    exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer"
3105    style="--_pre-playback-place:{{preplaybackplace ?? 'center'}}"
3106  >
3107    <slot name="media" slot="media"></slot>
3108    <slot name="poster" slot="poster"></slot>
3109
3110    <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>
3111    <media-error-dialog slot="dialog" noautohide></media-error-dialog>
3112
3113    <template if="!audio">
3114      <!-- Pre-playback UI -->
3115      <!-- same for both on-demand and live -->
3116      <div slot="centered-chrome" class="center-controls pre-playback">
3117        <template if="!breakpointsm">{{>PlayButton section="center"}}</template>
3118        <template if="breakpointsm">{{>PrePlayButton section="center"}}</template>
3119      </div>
3120
3121      <!-- Mux Badge -->
3122      <template if="proudlydisplaymuxbadge"> {{>MuxBadge}} </template>
3123
3124      <!-- Autoplay centered unmute button -->
3125      <!--
3126        todo: figure out how show this with available state variables
3127        needs to show when:
3128        - autoplay is enabled
3129        - playback has been successful
3130        - audio is muted
3131        - in place / instead of the pre-plaback play button
3132        - not to show again after user has interacted with this button
3133          - OR user has interacted with the mute button in the control bar
3134      -->
3135      <!--
3136        There should be a >MuteButton to the left of the "Unmute" text, but a templating bug
3137        makes it appear even if commented out in the markup, add it back when code is un-commented
3138      -->
3139      <!-- <div slot="centered-chrome" class="autoplay-unmute">
3140        <div role="button" class="autoplay-unmute-btn">Unmute</div>
3141      </div> -->
3142
3143      <template if="streamtype == 'on-demand'">
3144        <template if="breakpointsm">
3145          <media-control-bar part="control-bar top" slot="top-chrome">{{>TitleDisplay}} </media-control-bar>
3146        </template>
3147        {{>TimeRange}}
3148        <media-control-bar part="control-bar bottom">
3149          {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>MuteButton}}
3150          {{>VolumeRange}}
3151          <div class="spacer"></div>
3152          {{>RenditionMenu}} {{>PlaybackRateMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}}
3153          {{>CastButton}} {{>PipButton}} {{>FullscreenButton}}
3154        </media-control-bar>
3155      </template>
3156
3157      <template if="streamtype == 'live'">
3158        <media-control-bar part="control-bar top" slot="top-chrome">
3159          {{>LiveButton}}
3160          <template if="breakpointsm"> {{>TitleDisplay}} </template>
3161        </media-control-bar>
3162        <template if="targetlivewindow > 0">{{>TimeRange}}</template>
3163        <media-control-bar part="control-bar bottom">
3164          {{>PlayButton}}
3165          <template if="targetlivewindow > 0">{{>SeekBackwardButton}} {{>SeekForwardButton}}</template>
3166          {{>MuteButton}} {{>VolumeRange}}
3167          <div class="spacer"></div>
3168          {{>RenditionMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}}
3169          {{>FullscreenButton}}
3170        </media-control-bar>
3171      </template>
3172    </template>
3173
3174    <template if="audio">
3175      <template if="streamtype == 'on-demand'">
3176        <template if="title">
3177          <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
3178        </template>
3179        <media-control-bar part="control-bar bottom">
3180          {{>PlayButton}}
3181          <template if="breakpointsm"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
3182          {{>MuteButton}}
3183          <template if="breakpointsm">{{>VolumeRange}}</template>
3184          {{>TimeDisplay}} {{>TimeRange}}
3185          <template if="breakpointsm">{{>PlaybackRateMenu}}</template>
3186          {{>AirplayButton}} {{>CastButton}}
3187        </media-control-bar>
3188      </template>
3189
3190      <template if="streamtype == 'live'">
3191        <template if="title">
3192          <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
3193        </template>
3194        <media-control-bar part="control-bar bottom">
3195          {{>PlayButton}} {{>LiveButton section="bottom"}} {{>MuteButton}}
3196          <template if="breakpointsm">
3197            {{>VolumeRange}}
3198            <template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
3199          </template>
3200          <template if="targetlivewindow > 0"> {{>TimeDisplay}} {{>TimeRange}} </template>
3201          <template if="!targetlivewindow"><div class="spacer"></div></template>
3202          {{>AirplayButton}} {{>CastButton}}
3203        </media-control-bar>
3204      </template>
3205    </template>
3206
3207    <slot></slot>
3208  </media-controller>
3209</template>
3210`,bf=lp.createElement("template");"innerHTML"in bf&&(bf.innerHTML=LP);var Z0,J0,Gb=class extends Mu{};Gb.template=(J0=(Z0=bf.content)==null?void 0:Z0.children)==null?void 0:J0[0];Bi.customElements.get("media-theme-gerwig")||Bi.customElements.define("media-theme-gerwig",Gb);var RP="gerwig",rs={SRC:"src",POSTER:"poster"},U={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,393 bytes, lines 3210-3222
3210LAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",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",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge"},_f=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","videotitle","novolumepref","proudlydisplaymuxbadge"];function xP(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(U.STORYBOARD_SRC),placeholder:i.getAttribute("placeholder"),themeTemplate:DP(i),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute(U.NOHOTKEYS),hotKeys:i.getAttribute(U.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(P.TARGET_LIVE_WINDOW),streamType:dp(i.getAttribute(P.STREAM_TYPE)),primaryColor:i.getAttribute(U.PRIMARY_COLOR),secondaryColor:i.getAttribute(U.SECONDARY_COLOR),accentColor:i.getAttribute(U.ACCENT_COLOR),forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultDuration:i.defaultDuration,defaultShowRemainingTime:i.defaultShowRemainingTime,hideDuration:CP(i),playbackRates:i.getAttribute(U.PLAYBACK_RATES),customDomain:(t=i.getAttribute(P.CUSTOM_DOMAIN))!=null?t:void 0,title:i.getAttribute(U.TITLE),videoTitle:(s=i.getAttribute(U.VIDEO_TITLE))!=null?s:i.getAttribute(U.TITLE),novolumepref:i.hasAttribute(U.NO_VOLUME_PREF),proudlyDisplayMuxBadge:i.hasAttribute(U.PROUDLY_DISPLAY_MUX_BADGE),castReceiver:i.castReceiver,...e,extraSourceParams:i.extraSourceParams}}var kP=FT.formatErrorMessage;FT.formatErrorMessage=i=>{var e,t;if(i instanceof Y){let s=SP(i,!1);return`
3211      ${s!=null&&s.title?`<h3>${s.title}</h3>`:""}
3212      ${s!=null&&s.message||s!=null&&s.linkUrl?`<p>
3213        ${s==null?void 0:s.message}
3214        ${s!=null&&s.linkUrl?`<a
3215              href="${s.linkUrl}"
3216              target="_blank"
3217              rel="external noopener"
3218              aria-label="${(e=s.linkText)!=null?e:""} ${se("(opens in a new window)")}"
3219              >${(t=s.linkText)!=null?t:s.linkUrl}</a
3220            >`:""}
3221      </p>`:""}
3222    `}return kP(i)};function DP(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=Bi.customElements.get(s);if(n!=null&&n.template)return n.template}}function CP(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 ev(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,277 bytes, line 3222
3222]=r),t},e)}var wP=Object.values(P),MP=Object.values(rs),PP=Object.values(U),tv=Nb(),iv="mux-player",sv={isDialogOpen:!1},OP={redundant_streams:!0},Id,Ld,Rd,Tr,xd,Hn,Qe,Cs,Kb,Af,br,rv,nv,av,ov,NP=class extends j0{constructor(){super(),mi(this,Qe),mi(this,Id),mi(this,Ld,!1),mi(this,Rd,{}),mi(this,Tr,!0),mi(this,xd,new JM(this,"hotkeys")),mi(this,Hn,{...sv,onCloseErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&rt(this,Qe,Af).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&(Pb(this,lp.activeElement)||i.preventDefault())}}),Yi(this,Id,fy()),this.attachShadow({mode:"open"}),rt(this,Qe,Kb).call(this),this.isConnected&&rt(this,Qe,Cs).call(this)}static get NAME(){return iv}static get VERSION(){return tv}static get observedAttributes(){var i;return[...(i=j0.observedAttributes)!=null?i:[],...MP,...wP,...PP]}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=ev(this))}attributeChangedCallback(i,e,t){switch(rt(this,Qe,Cs).call(this),super.attributeChangedCallback(i,e,t),i){case U.HOTKEYS:Ce(this,xd).value=t;break;case U.THUMBNAIL_TIME:{t!=null&&this.tokens.thumbnail&&ls(se("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case U.THUMBNAIL_TOKEN:{if(t){let s=Pn(t);if(s){let{aud:r}=s,n=Za.THUMBNAIL;r!==n&&ls(se("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"thumbnail"}))}}break}case U.STORYBOARD_TOKEN:{if(t){let s=Pn(t);if(s){let{aud:r}=s,n=Za.STORYBOARD;r!==n&&ls(se("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"storyboard"}))}}break}case U.DRM_TOKEN:{if(t){let s=Pn(t);if(s){let{aud:r}=s,n=Za.DRM;r!==n&&ls(se("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"drm"}))}}break}case P.PLAYBACK_ID:{t!=null&&t.includes("?token")&&Jt(se("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:t}));break}case P.STREAM_TYPE:t&&![De.LIVE,De.ON_DEMAND,De.UNKNOWN].includes(t)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=t.includes("dvr")?Number.POSITIVE_INFINITY:0:Fb({file:"invalid-stream-type.md",message:se("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):t===De.LIVE?this.getAttribute(U.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[P.PLAYBACK_ID,rs.SRC,U.PLAYBACK_TOKEN].includes(i)&&e!==t&&Yi(this,Hn,{...Ce(this,Hn),...sv}),rt(this,Qe,br).call(this,{[ZM(i)]:t})}async requestFullscreen(i){var e;if(!(!this.mediaController||this.mediaController.hasAttribute(b.MEDIA_IS_FULLSCREEN)))return(e=this.mediaController)==null||e.dispatchEvent(new Bi.CustomEvent(Q.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((t,s)=>{var r;(r=this.mediaController)==null||r.addEventListener(ms.MEDIA_IS_FULLSCREEN,()=>t(),{once:!0})})}async exitFullscreen(){var i;if(!(!this.mediaController||!this.mediaController.hasAttribute(b.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new Bi.CustomEvent(Q.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((e,t)=>{var s;(s=this.mediaController)==null||s.addEventListener(ms.MEDIA_IS_FULLSCREEN,()=>e(),{once:!0})})}get preferCmcd(){var i;return(i=this.getAttribute(P.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?Kd.includes(i)?this.setAttribute(P.PREFER_CMCD,i):ls(`Invalid value for preferCmcd. Must be one of ${Kd.join()}`):this.removeAttribute(P.PREFER_CMCD))}get hasPlayed(){var i,e;return(e=(i=this.mediaController)==null?void 0:i.hasAttribute(b.MEDIA_HAS_P
vendor: 10,158 bytes, line 3222
3222LAYED))!=null?e:!1}get inLiveWindow(){var i;return(i=this.mediaController)==null?void 0:i.hasAttribute(b.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(U.THEME))!=null?i:RP}set theme(i){this.setAttribute(U.THEME,`${i}`)}get themeProps(){let i=this.mediaTheme;if(!i)return;let e={};for(let t of i.getAttributeNames()){if(_f.includes(t))continue;let s=i.getAttribute(t);e[wb(t)]=s===""?!0:s}return e}set themeProps(i){var e,t;rt(this,Qe,Cs).call(this);let s={...this.themeProps,...i};for(let r in s){if(_f.includes(r))continue;let n=i==null?void 0:i[r];typeof n=="boolean"||n==null?(e=this.mediaTheme)==null||e.toggleAttribute(Tf(r),!!n):(t=this.mediaTheme)==null||t.setAttribute(Tf(r),n)}}get playbackId(){var i;return(i=this.getAttribute(P.PLAYBACK_ID))!=null?i:void 0}set playbackId(i){i?this.setAttribute(P.PLAYBACK_ID,i):this.removeAttribute(P.PLAYBACK_ID)}get src(){var i,e;return this.playbackId?(i=dr(this,rs.SRC))!=null?i:void 0:(e=this.getAttribute(rs.SRC))!=null?e:void 0}set src(i){i?this.setAttribute(rs.SRC,i):this.removeAttribute(rs.SRC)}get poster(){var i;let e=this.getAttribute(rs.POSTER);if(e!=null)return e;let{tokens:t}=this;if(t.playback&&!t.thumbnail){ls("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return zM(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(rs.POSTER,i):this.removeAttribute(rs.POSTER)}get storyboardSrc(){var i;return(i=this.getAttribute(U.STORYBOARD_SRC))!=null?i:void 0}set storyboardSrc(i){i?this.setAttribute(U.STORYBOARD_SRC,i):this.removeAttribute(U.STORYBOARD_SRC)}get storyboard(){let{tokens:i}=this;if(this.storyboardSrc&&!i.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[De.LIVE,De.UNKNOWN].includes(this.streamType)||i.playback&&!i.storyboard))return QM(this.playbackId,{customDomain:this.customDomain,token:i.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(U.AUDIO)}set audio(i){if(!i){this.removeAttribute(U.AUDIO);return}this.setAttribute(U.AUDIO,"")}get hotkeys(){return Ce(this,xd)}get nohotkeys(){return this.hasAttribute(U.NOHOTKEYS)}set nohotkeys(i){if(!i){this.removeAttribute(U.NOHOTKEYS);return}this.setAttribute(U.NOHOTKEYS,"")}get thumbnailTime(){return Bt(this.getAttribute(U.THUMBNAIL_TIME))}set thumbnailTime(i){this.setAttribute(U.THUMBNAIL_TIME,`${i}`)}get videoTitle(){var i,e;return(e=(i=this.getAttribute(U.VIDEO_TITLE))!=null?i:this.getAttribute(U.TITLE))!=null?e:""}set videoTitle(i){i!==this.videoTitle&&(i?this.setAttribute(U.VIDEO_TITLE,i):this.removeAttribute(U.VIDEO_TITLE))}get placeholder(){var i;return(i=dr(this,U.PLACEHOLDER))!=null?i:""}set placeholder(i){this.setAttribute(U.PLACEHOLDER,`${i}`)}get primaryColor(){var i,e;let t=this.getAttribute(U.PRIMARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=Bi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:e.trim(),t))return t}set primaryColor(i){this.setAttribute(U.PRIMARY_COLOR,`${i}`)}get secondaryColor(){var i,e;let t=this.getAttribute(U.SECONDARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=Bi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:e.trim(),t))return t}set secondaryColor(i){this.setAttribute(U.SECONDARY_COLOR,`${i}`)}get accentColor(){var i,e;let t=this.getAttribute(U.ACCENT_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=Bi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:e.trim(),t))return t}set accentColor(i){this.setAttribute(U.ACCENT_COLOR,`${i}`)}get defaultShowRemainingTime(){return this.hasAttribute(U.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(i){i?this.setAttribute(U.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(U.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(U.PLAYBACK_RATES))return this.getAttribute(U.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(U.PLAYBACK_RATES);return}this.setAttribute(U.PLAYBACK_RATES,i.join(" "))}get forwardSeekOffset(){var i;return(i=Bt(this.getAttribute(U.FORWARD_SEEK_OFFSET)))!=null?i:10}set forwardSeekOffset(i){this.setAttribute(U.FORWARD_SEEK_OFFSET,`${i}`)}get backwardSeekOffset(){var i;return(i=Bt(this.getAttribute(U.BACKWARD_SEEK_OFFSET)))!=null?i:10}set backwardSeekOffset(i){this.setAttribute(U.BACKWARD_SEEK_OFFSET,`${i}`)}get defaultHiddenCaptions(){return this.hasAttribute(U.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(i){i?this.setAttribute(U.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(U.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return Bt(this.getAttribute(U.DEFAULT_DURATION))}set defaultDuration(i){i==null?this.removeAttribute(U.DEFAULT_DURATION):this.setAttribute(U.DEFAULT_DURATION,`${i}`)}get playerInitTime(){return this.hasAttribute(P.PLAYER_INIT_TIME)?Bt(this.getAttribute(P.PLAYER_INIT_TIME)):Ce(this,Id)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(P.PLAYER_INIT_TIME):this.setAttribute(P.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=this.getAttribute(P.PLAYER_SOFTWARE_NAME))!=null?i:iv}get playerSoftwareVersion(){var i;return(i=this.getAttribute(P.PLAYER_SOFTWARE_VERSION))!=null?i:tv}get beaconCollectionDomain(){var i;return(i=this.getAttribute(P.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(P.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(P.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var i;return(i=this.getAttribute(P.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(P.MAX_RESOLUTION,i):this.removeAttribute(P.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(P.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(P.MIN_RESOLUTION,i):this.removeAttribute(P.MIN_RESOLUTION))}get renditionOrder(){var i;return(i=this.getAttribute(P.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(P.RENDITION_ORDER,i):this.removeAttribute(P.RENDITION_ORDER))}get programStartTime(){return Bt(this.getAttribute(P.PROGRAM_START_TIME))}set programStartTime(i){i==null?this.removeAttribute(P.PROGRAM_START_TIME):this.setAttribute(P.PROGRAM_START_TIME,`${i}`)}get programEndTime(){return Bt(this.getAttribute(P.PROGRAM_END_TIME))}set programEndTime(i){i==null?this.removeAttribute(P.PROGRAM_END_TIME):this.setAttribute(P.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){return Bt(this.getAttribute(P.ASSET_START_TIME))}set assetStartTime(i){i==null?this.removeAttribute(P.ASSET_START_TIME):this.setAttribute(P.ASSET_START_TIME,`${i}`)}get assetEndTime(){return Bt(this.getAttribute(P.ASSET_END_TIME))}set assetEndTime(i){i==null?this.removeAttribute(P.ASSET_END_TIME):this.setAttribute(P.ASSET_END_TIME,`${i}`)}get extraSourceParams(){return this.hasAttribute(U.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(U.EXTRA_SOURCE_PARAMS)).entries()].reduce((i,[e,t])=>(i[e]=t,i),{}):OP}set extraSourceParams(i){i==null?this.removeAttribute(U.EXTRA_SOURCE_PARAMS):this.setAttribute(U.EXTRA_SOURCE_PARAMS,new URLSearchParams(i).toString())}get customDomain(){var i;return(i=this.getAttribute(P.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(P.CUSTOM_DOMAIN,i):this.removeAttribute(P.CUSTOM_DOMAIN))}get envKey(){var i;return(i=dr(this,P.ENV_KEY))!=null?i:void 0}set envKey(i){this.setAttribute(P.ENV_KEY,`${i}`)}get noVolumePref(){return this.hasAttribute(U.NO_VOLUME_PREF)}set noVolumePref(i){i?this.setAttribute(U.NO_VOLUME_PREF,""):this.removeAttribute(U.NO_VOLUME_PREF)}get debug(){return dr(this,P.DEBUG)!=null}set debug(i){i?this.setAttribute(P.DEBUG,""):this.removeAttribute(P.DEBUG)}get disableTracking(){return dr(this,P.DISABLE_TRACKING)!=null}set disableTracking(i){this.toggleAttribute(P.DISABLE_TRACKING,!!i)}get disableCookies(){return dr(this,P.DISABLE_COOKIES)!=null}set disableCookies(i){i?this.setAttribute(P.DISABLE_COOKIES,""):this.removeAttribute(P.DISABLE_COOKIES)}get streamType(){var i,e,t;return(t=(e=this.getAttribute(P.STREAM_TYPE))!=null?e:(i=this.media)==null?void 0:i.streamType)!=null?t:De.UNKNOWN}set streamType(i){this.setAttribute(P.STREAM_TYPE,`${i}`)}get defaultStreamType(){var i,e,t;return(t=(e=this.getAttribute(U.DEFAULT_STREAM_TYPE))!=null?e:(i=this.mediaController)==null?void 0:i.getAttribute(U.DEFAULT_STREAM_TYPE))!=null?t:De.ON_DEMAND}set defaultStreamType(i){i?this.setAttribute(U.DEFAULT_STREAM_TYPE,i):this.removeAttribute(U.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var i,e;return this.hasAttribute(U.TARGET_LIVE_WINDOW)?+this.getAttribute(U.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(U.TARGET_LIVE_WINDOW):this.setAttribute(U.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i;return(i=this.media)==null?void 0:i.liveEdgeStart}get startTime(){return Bt(dr(this,P.START_TIME))}set startTime(i){this.setAttribute(P.START_TIME,`${i}`)}get preferPlayback(){let i=this.getAttribute(P.PREFER_PLAYBACK);if(i===Ki.MSE||i===Ki.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===Ki.MSE||i===Ki.NATIVE?this.setAttribute(P.PREFER_PLAYBACK,i):this.removeAttribute(P.PREFER_PLAYBACK))}get metadata(){var i;return(i=this.media)==null?void 0:i.metadata}set metadata(i){if(rt(this,Qe,Cs).call(this),!this.media){Jt("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...ev(this),...i}}
vendor: 4,924 bytes, line 3222
3222get _hlsConfig(){var i;return(i=this.media)==null?void 0:i._hlsConfig}set _hlsConfig(i){if(rt(this,Qe,Cs).call(this),!this.media){Jt("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(rt(this,Qe,Cs).call(this),!this.media){Jt("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(rt(this,Qe,Cs).call(this),!this.media){Jt("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(U.PLAYBACK_TOKEN),e=this.getAttribute(U.DRM_TOKEN),t=this.getAttribute(U.THUMBNAIL_TOKEN),s=this.getAttribute(U.STORYBOARD_TOKEN);return{...Ce(this,Rd),...i!=null?{playback:i}:{},...e!=null?{drm:e}:{},...t!=null?{thumbnail:t}:{},...s!=null?{storyboard:s}:{}}}set tokens(i){Yi(this,Rd,i??{})}get playbackToken(){var i;return(i=this.getAttribute(U.PLAYBACK_TOKEN))!=null?i:void 0}set playbackToken(i){this.setAttribute(U.PLAYBACK_TOKEN,`${i}`)}get drmToken(){var i;return(i=this.getAttribute(U.DRM_TOKEN))!=null?i:void 0}set drmToken(i){this.setAttribute(U.DRM_TOKEN,`${i}`)}get thumbnailToken(){var i;return(i=this.getAttribute(U.THUMBNAIL_TOKEN))!=null?i:void 0}set thumbnailToken(i){this.setAttribute(U.THUMBNAIL_TOKEN,`${i}`)}get storyboardToken(){var i;return(i=this.getAttribute(U.STORYBOARD_TOKEN))!=null?i:void 0}set storyboardToken(i){this.setAttribute(U.STORYBOARD_TOKEN,`${i}`)}addTextTrack(i,e,t,s){var r;let n=(r=this.media)==null?void 0:r.nativeEl;if(n)return Zf(n,i,e,t,s)}removeTextTrack(i){var e;let t=(e=this.media)==null?void 0:e.nativeEl;if(t)return Lx(t,i)}get textTracks(){var i;return(i=this.media)==null?void 0:i.textTracks}get castReceiver(){var i;return(i=this.getAttribute(U.CAST_RECEIVER))!=null?i:void 0}set castReceiver(i){i!==this.castReceiver&&(i?this.setAttribute(U.CAST_RECEIVER,i):this.removeAttribute(U.CAST_RECEIVER))}get castCustomData(){var i;return(i=this.media)==null?void 0:i.castCustomData}set castCustomData(i){if(!this.media){Jt("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=i}get noTooltips(){return this.hasAttribute(U.NO_TOOLTIPS)}set noTooltips(i){if(!i){this.removeAttribute(U.NO_TOOLTIPS);return}this.setAttribute(U.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(U.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(i){i?this.setAttribute(U.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(U.PROUDLY_DISPLAY_MUX_BADGE)}};Id=new WeakMap,Ld=new WeakMap,Rd=new WeakMap,Tr=new WeakMap,xd=new WeakMap,Hn=new WeakMap,Qe=new WeakSet,Cs=function(){var i,e,t,s;if(!Ce(this,Ld)){Yi(this,Ld,!0),rt(this,Qe,br).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof Bi.HTMLElement))throw""}catch{Jt("<media-theme> failed to upgrade!")}try{customElements.upgrade(this.media)}catch{Jt("underlying media element failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof hC))throw""}catch{Jt("<media-controller> failed to upgrade!")}rt(this,Qe,rv).call(this),rt(this,Qe,nv).call(this),rt(this,Qe,av).call(this),Yi(this,Tr,(e=(i=this.mediaController)==null?void 0:i.hasAttribute(re.USER_INACTIVE))!=null?e:!0),rt(this,Qe,ov).call(this),(t=this.media)==null||t.addEventListener("streamtypechange",()=>rt(this,Qe,br).call(this)),(s=this.media)==null||s.addEventListener("loadstart",()=>rt(this,Qe,br).call(this))}},Kb=function(){var i,e;try{(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Af=function(i){Object.assign(Ce(this,Hn),i),rt(this,Qe,br).call(this)},br=function(i={}){pP(vP(xP(this,{...Ce(this,Hn),...i})),this.shadowRoot)},rv=function(){let i=e=>{var t,s;if(!(e!=null&&e.startsWith("theme-")))return;let r=e.replace(/^theme-/,"");if(_f.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}
3222),this.getAttributeNames().forEach(i)},nv=function(){let i=e=>{var t;let s=(t=this.media)==null?void 0:t.error;if(!(s instanceof Y)){let{message:n,code:a}=s??{};s=new Y(n,a)}if(!(s!=null&&s.fatal)){ls(s),s.data&&ls(`${s.name} data:`,s.data);return}let r=X0(s);r.message&&Fb(r),Jt(s),s.data&&Jt(`${s.name} data:`,s.data),rt(this,Qe,Af).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 Y))return e;let n=X0((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}})},av=function(){var i,e,t,s;let r=()=>rt(this,Qe,br).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)},ov=function(){var i,e;if(!/Firefox/i.test(navigator.userAgent))return;let t,s=new WeakMap,r=()=>this.streamType===De.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(`
3223`).length,f=-3;this.streamType===De.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(re.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==null||t.removeEventListener("cuechange",a)),t=u,t==null||t.addEventListener("cuechange",a),n(t,Ce(this,Tr))};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(re.USER_INACTIVE))!=null?d:!0;Ce(this,Tr)!==u&&(Yi(this,Tr,u),n(t,Ce(this,Tr)))})};function dr(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var lv=NP,Vb=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends Vb{}globalThis.DocumentFragment=i}var UP=class extends Vb{},FP={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(UP)}},$P={customElements:FP},BP=typeof window>"u"||typeof globalThis.customElements>"u",Dc=BP?$P:globalThis;Dc.customElements.get("mux-player")||(Dc.customElements.define("mux-player",lv),Dc.MuxPlayerElement=lv);const HP=dv({__name:"Asset",props:{asset:Object,lazy:{type:Boolean,default:!0},preload:{type:Boolean,default:!1},height:{type:Number,default:400},isHero:{type:Boolean,default:!1},width:{type:String,default:"auto"}},setup(i,{expose:e}){e();function t(g){return g&&g.__typename==="SanityImageAsset"}function s(g){return g&&g.__typename==="SanityFileAsset"}function r(g){return g&&g.__typename==="MuxVideoAsset"&&"playbackId"in g}const n=is(()=>t(i.asset)),a=is(()=>s(i.asset)),o=is(()=>r(i.asset)),l=is(()=>(t(i.asset)||s(i.asset))&&i.asset.altText||""),d=is(()=>s(i.asset)&&i.asset.altText||"Video content"),u=is(()=>{if(s(i.asset)&&i.asset.url)try{const g=new URL(i.asset.url),v=decodeURIComponent(g.pathname.split("/").pop()||"");return v?`/videos/${v}`:""}catch{return""}return""}),c=is(()=>{if(t(i.asset)){const g=zb(i.asset);if(g)return`https://gtgarage.nl/cdn-cgi/image/format=auto,quality=65,width=${i.width}/`+g.url()}return""}),h=is(()=>o.value&&i.asset?`https://gtgarage.nl/cdn-cgi/image/format=auto,quality=65,width=500/https://image.mux.com/${i.asset.playbackId}/thumbnail.jpg`:"");i.preload&&i.asset&&t(i.asset)&&c.value&&hp({link:[{rel:"preload",as:"image",fetchpriority:"high",href:c.value}]}),i.asset&&r(i.asset)&&hp({link:[{rel:"preload",as:"image",href:h.value,fetchpriority:"high"}]});const f=fp(),m=fp(!1);Zb(()=>{if(i.lazy&&a.value&&f.value){const g=new IntersectionObserver(v=>{v.forEach(T=>{T.isIntersecting&&(m.value=!0,g.disconnect())})},{rootMargin:"50px"});g.observe(f.value)}});const p={isSanityImageAsset:t,isSanityFileAsset:s,isMuxVideoAsset:r,isSanityImage:n,isSanityFile:a,isMuxVideo:o,altText:l,ariaLabel:d,localVideoUrl:u,assetUrl:c,muxPosterUrl:h,videoRef:f,isVideoLoaded:m};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),GP=["playback-id","poster"],KP=["aria-label"],VP=["src"],WP=["data-src"];function qP(i,e,t,s,r,n){const a=Qb;return s.isMuxVideo?(rn(),Aa("mux-player",{key:0,preload:"metadata","playback-id":t.asset&&t.asset.playbackId,autoplay:"muted",poster:s.muxPosterUrl,class:$u(["asset-element",{"hero-asset":t.isHero}])},null,10,GP)):s.isSanityFile?(rn(),Aa("video",{key:1,ref:"videoRef",class:$u(["asset-element",{"hero-asset":t.isHero,lazy:t.lazy&&!s.isVideoLoaded}]),preload:"metadata",autoplay:"",muted:"",loop:"",playsinline:"true","aria-label":s.ariaLabel},[s.localVideoUrl&&(!t.lazy||s.isVideoLoaded)?(rn(),Aa("source",{key:0,src:s.localVideoUrl},null,8,VP)):s.localVideoUrl?(rn(),Aa("source",{key:1,"data-src":s.localVideoUrl},null,8,WP)):mp("",!0)],10,KP)):s.isSanityImage?(rn(),Jb(a,{key:2,loading:t.lazy?"lazy":"eager",alt:s.altText,src:s.assetUrl,class:$u(["asset-element",{"hero-asset":t.isHero}])},null,8,["loading","alt","src","class"])):mp("",!0)}const YP=uv(HP,[["render",qP],["__scopeId","data-v-ca0906ab"],["__file","Asset.vue"]]),jP=dv({__name:"Hero",props:{data:Object},setup(i,{expose:e}){e();const s={heroAsset:is(()=>{var r,n,a,o,l,d;return((n=(r=i.data)==null?void 0:r.video_mux)==null?void 0:n.asset)||((o=(a=i.data)==null?void 0:a.video)==null?void 0:o.asset)||((d=(l=i.data)==null?void 0:l.image)==null?void 0:d.asset)})};return Object.defineProperty(s,"__isScriptSetup",{enumerable:!1,value:!0}),s}}),zP={class:"hero",critical:""},QP={class:"hero-background"},XP={class:"container"},ZP={class:"row align-items-center justify-content-center"},JP={class:"col-lg-12"},eO={class:"hero-inner"};function tO(i,e,t,s,r,n){var l;const a=YP,o=Xb;return rn(),Aa("section",zP,[la("div",QP,[pp(a,{lazy:!1,preload:!0,asset:s.heroAsset,"is-hero":!0,class:"hero-asset"},null,8,["asset"])]),la("div",XP,[la("div",ZP,[la("div",JP,[la("div",eO,[pp(o,{blocks:(l=t.data)==null?void 0:l.content},null,8,["blocks"])])])])])])}const pO=uv(jP,[["render",tO],["__file","Hero.vue"]]);export{pO as _,YP as a};

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.